Merge pull request #3213 from henricm/fix-for-win-securestring-to-bstr
authorNiklas Therning <niklas@therning.org>
Wed, 10 Aug 2016 15:04:53 +0000 (17:04 +0200)
committerGitHub <noreply@github.com>
Wed, 10 Aug 2016 15:04:53 +0000 (17:04 +0200)
Fix for win securestring to bstr

1003 files changed:
.gitignore
.gitmodules
Makefile.am
acceptance-tests/SUBMODULES.json
acceptance-tests/coreclr.mk
acceptance-tests/ms-test-suite.mk
acceptance-tests/roslyn.mk
acceptance-tests/versions.mk
configure.ac
eglib/configure.ac
eglib/src/Makefile.am
eglib/src/gerror.c
eglib/src/giconv.c
eglib/src/glib.h
eglib/src/gmarkup.c
eglib/src/gmem.c
eglib/src/gmisc-win32.c
eglib/src/goutput.c
eglib/src/gpath.c
eglib/src/gstr.c
eglib/src/vasprintf.c [deleted file]
eglib/src/vasprintf.h [deleted file]
eglib/test/test.c
external/binary-reference-assemblies
external/buildtools [new submodule]
external/cecil
external/cecil-legacy [new submodule]
external/nuget-buildtasks [new submodule]
external/nunit-lite
libgc/os_dep.c
llvm/Makefile.am
man/mono-symbolicate.1
man/mono.1
mcs/Makefile
mcs/build/platforms/darwin.make
mcs/build/platforms/linux.make
mcs/build/platforms/win32.make
mcs/build/profiles/mobile.make
mcs/build/profiles/mobile_static.make
mcs/build/profiles/monodroid.make
mcs/build/profiles/monotouch_runtime.make
mcs/build/profiles/xbuild_12.make
mcs/build/rules.make
mcs/class/Facades/Makefile
mcs/class/Facades/Microsoft.Win32.Registry.AccessControl/Makefile
mcs/class/Facades/Microsoft.Win32.Registry.AccessControl/Microsoft.Win32.Registry.AccessControl.dll.sources
mcs/class/Facades/Microsoft.Win32.Registry.AccessControl/RegistryAclExtensions.cs [new file with mode: 0644]
mcs/class/Facades/Microsoft.Win32.Registry.AccessControl/TypeForwarders.cs
mcs/class/Facades/Microsoft.Win32.Registry/TypeForwarders.cs
mcs/class/Facades/System.ComponentModel.Primitives/TypeForwarders.cs
mcs/class/Facades/System.ComponentModel.TypeConverter/TypeForwarders.cs
mcs/class/Facades/System.Console/TypeForwarders.cs
mcs/class/Facades/System.Data.Common/DbColumn.cs [new file with mode: 0644]
mcs/class/Facades/System.Data.Common/DbDataReaderExtensions.Facade.cs [new file with mode: 0644]
mcs/class/Facades/System.Data.Common/IDbColumnSchemaGenerator.cs [new file with mode: 0644]
mcs/class/Facades/System.Data.Common/Makefile
mcs/class/Facades/System.Data.Common/System.Data.Common.dll.sources
mcs/class/Facades/System.Data.Common/TypeForwarders.cs
mcs/class/Facades/System.Data.SqlClient/TypeForwarders.cs
mcs/class/Facades/System.Diagnostics.Process/TypeForwarders.cs
mcs/class/Facades/System.Diagnostics.StackTrace/Makefile
mcs/class/Facades/System.Diagnostics.StackTrace/StackFrameExtensions.cs [new file with mode: 0644]
mcs/class/Facades/System.Diagnostics.StackTrace/System.Diagnostics.StackTrace.dll.sources
mcs/class/Facades/System.Diagnostics.StackTrace/TypeForwarders.cs
mcs/class/Facades/System.Diagnostics.Tracing/EventCounter.cs [new file with mode: 0644]
mcs/class/Facades/System.Diagnostics.Tracing/Makefile
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 [new file with mode: 0644]
mcs/class/Facades/System.Drawing.Primitives/Makefile [new file with mode: 0644]
mcs/class/Facades/System.Drawing.Primitives/System.Drawing.Primitives.dll.sources [new file with mode: 0644]
mcs/class/Facades/System.Drawing.Primitives/TypeForwarders.cs [new file with mode: 0644]
mcs/class/Facades/System.Drawing.Primitives/embedded_System.Drawing.Primitives.dll.sources [new file with mode: 0644]
mcs/class/Facades/System.Drawing.Primitives/monotouch_watch_System.Drawing.Primitives.dll.sources [new file with mode: 0644]
mcs/class/Facades/System.Drawing.Primitives/xammac_net_4_5_System.Drawing.Primitives.dll.sources [new file with mode: 0644]
mcs/class/Facades/System.Globalization.Extensions/GlobalizationExtensions.cs [new file with mode: 0644]
mcs/class/Facades/System.Globalization.Extensions/Makefile
mcs/class/Facades/System.Globalization.Extensions/SR.cs [new file with mode: 0644]
mcs/class/Facades/System.Globalization.Extensions/StringNormalizationExtensions.cs [new file with mode: 0644]
mcs/class/Facades/System.Globalization.Extensions/System.Globalization.Extensions.dll.sources
mcs/class/Facades/System.Globalization.Extensions/TypeForwarders.cs
mcs/class/Facades/System.IO.FileSystem.AccessControl/FileSystemAclExtensions.cs [new file with mode: 0644]
mcs/class/Facades/System.IO.FileSystem.AccessControl/Makefile
mcs/class/Facades/System.IO.FileSystem.AccessControl/System.IO.FileSystem.AccessControl.dll.sources
mcs/class/Facades/System.IO.FileSystem.AccessControl/TypeForwarders.cs
mcs/class/Facades/System.IO.FileSystem.Watcher/TypeForwarders.cs
mcs/class/Facades/System.IO.Packaging/AssemblyInfo.cs [new file with mode: 0644]
mcs/class/Facades/System.IO.Packaging/Makefile [new file with mode: 0644]
mcs/class/Facades/System.IO.Packaging/System.IO.Packaging.dll.sources [new file with mode: 0644]
mcs/class/Facades/System.IO.Packaging/TypeForwarders.cs [new file with mode: 0644]
mcs/class/Facades/System.IO/TypeForwarders.cs
mcs/class/Facades/System.Linq.Expressions/TypeForwarders.cs
mcs/class/Facades/System.Net.Ping/AssemblyInfo.cs [new file with mode: 0644]
mcs/class/Facades/System.Net.Ping/Makefile [new file with mode: 0644]
mcs/class/Facades/System.Net.Ping/System.Net.Ping.dll.sources [new file with mode: 0644]
mcs/class/Facades/System.Net.Ping/TypeForwarders.cs [new file with mode: 0644]
mcs/class/Facades/System.Net.Security/TypeForwarders.cs
mcs/class/Facades/System.Net.Sockets/Makefile
mcs/class/Facades/System.Net.Sockets/SocketReceiveFromResult.cs [new file with mode: 0644]
mcs/class/Facades/System.Net.Sockets/SocketReceiveMessageFromResult.cs [new file with mode: 0644]
mcs/class/Facades/System.Net.Sockets/SocketTaskExtensions.cs [new file with mode: 0644]
mcs/class/Facades/System.Net.Sockets/System.Net.Sockets.dll.sources
mcs/class/Facades/System.Private.CoreLib.Threading/AssemblyInfo.cs [deleted file]
mcs/class/Facades/System.Private.CoreLib.Threading/Facades_System.Private.CoreLib.Threading-net_4_x.csproj [deleted file]
mcs/class/Facades/System.Private.CoreLib.Threading/Makefile [deleted file]
mcs/class/Facades/System.Private.CoreLib.Threading/System.Private.CoreLib.Threading-net_4_x.csproj [deleted file]
mcs/class/Facades/System.Private.CoreLib.Threading/System.Private.CoreLib.Threading.dll.sources [deleted file]
mcs/class/Facades/System.Private.CoreLib.Threading/TypeForwarders.cs [deleted file]
mcs/class/Facades/System.Reflection.Primitives/TypeForwarders.cs
mcs/class/Facades/System.Reflection.TypeExtensions/Makefile
mcs/class/Facades/System.Reflection.TypeExtensions/Requires.cs [new file with mode: 0644]
mcs/class/Facades/System.Reflection.TypeExtensions/SR.cs [new file with mode: 0644]
mcs/class/Facades/System.Reflection.TypeExtensions/System.Reflection.TypeExtensions.dll.sources
mcs/class/Facades/System.Reflection.TypeExtensions/TypeExtensions.CoreCLR.cs [new file with mode: 0644]
mcs/class/Facades/System.Reflection.TypeExtensions/TypeForwarders.cs
mcs/class/Facades/System.Reflection/TypeForwarders.cs
mcs/class/Facades/System.Runtime.InteropServices/TypeForwarders.cs
mcs/class/Facades/System.Runtime.Serialization.Formatters/AssemblyInfo.cs [new file with mode: 0644]
mcs/class/Facades/System.Runtime.Serialization.Formatters/Makefile [new file with mode: 0644]
mcs/class/Facades/System.Runtime.Serialization.Formatters/System.Runtime.Serialization.Formatters.dll.sources [new file with mode: 0644]
mcs/class/Facades/System.Runtime.Serialization.Formatters/TypeForwarders.cs [new file with mode: 0644]
mcs/class/Facades/System.Runtime.Serialization.Primitives/ISerializationSurrogateProvider.cs [new file with mode: 0644]
mcs/class/Facades/System.Runtime.Serialization.Primitives/Makefile
mcs/class/Facades/System.Runtime.Serialization.Primitives/System.Runtime.Serialization.Primitives.dll.sources
mcs/class/Facades/System.Runtime.Serialization.Primitives/TypeForwarders.cs
mcs/class/Facades/System.Runtime.Serialization.Xml/DataContractSerializerExtensions.cs [new file with mode: 0644]
mcs/class/Facades/System.Runtime.Serialization.Xml/Makefile
mcs/class/Facades/System.Runtime.Serialization.Xml/NotImplemented.cs [new file with mode: 0644]
mcs/class/Facades/System.Runtime.Serialization.Xml/System.Runtime.Serialization.Xml.dll.sources
mcs/class/Facades/System.Runtime.Serialization.Xml/TypeForwarders.cs
mcs/class/Facades/System.Runtime/TypeForwarders.cs
mcs/class/Facades/System.Security.Cryptography.Algorithms/AssemblyInfo.cs [new file with mode: 0644]
mcs/class/Facades/System.Security.Cryptography.Algorithms/ECCurve.cs [new file with mode: 0644]
mcs/class/Facades/System.Security.Cryptography.Algorithms/ECParameters.cs [new file with mode: 0644]
mcs/class/Facades/System.Security.Cryptography.Algorithms/ECPoint.cs [new file with mode: 0644]
mcs/class/Facades/System.Security.Cryptography.Algorithms/IncrementalHash.cs [new file with mode: 0644]
mcs/class/Facades/System.Security.Cryptography.Algorithms/Makefile [new file with mode: 0644]
mcs/class/Facades/System.Security.Cryptography.Algorithms/System.Security.Cryptography.Algorithms.dll.sources [new file with mode: 0644]
mcs/class/Facades/System.Security.Cryptography.Algorithms/TypeForwarders.cs [new file with mode: 0644]
mcs/class/Facades/System.Security.Cryptography.Cng/AssemblyInfo.cs [new file with mode: 0644]
mcs/class/Facades/System.Security.Cryptography.Cng/Makefile [new file with mode: 0644]
mcs/class/Facades/System.Security.Cryptography.Cng/System.Security.Cryptography.Cng.dll.sources [new file with mode: 0644]
mcs/class/Facades/System.Security.Cryptography.Cng/TypeForwarders.cs [new file with mode: 0644]
mcs/class/Facades/System.Security.Cryptography.Csp/AssemblyInfo.cs [new file with mode: 0644]
mcs/class/Facades/System.Security.Cryptography.Csp/Makefile [new file with mode: 0644]
mcs/class/Facades/System.Security.Cryptography.Csp/System.Security.Cryptography.Csp.dll.sources [new file with mode: 0644]
mcs/class/Facades/System.Security.Cryptography.Csp/TypeForwarders.cs [new file with mode: 0644]
mcs/class/Facades/System.Security.Cryptography.Encoding/TypeForwarders.cs
mcs/class/Facades/System.Security.Cryptography.OpenSsl/AssemblyInfo.cs [new file with mode: 0644]
mcs/class/Facades/System.Security.Cryptography.OpenSsl/ECDsaOpenSsl.cs [new file with mode: 0644]
mcs/class/Facades/System.Security.Cryptography.OpenSsl/Makefile [new file with mode: 0644]
mcs/class/Facades/System.Security.Cryptography.OpenSsl/RSAOpenSsl.cs [new file with mode: 0644]
mcs/class/Facades/System.Security.Cryptography.OpenSsl/SafeEvpPKeyHandle.cs [new file with mode: 0644]
mcs/class/Facades/System.Security.Cryptography.OpenSsl/System.Security.Cryptography.OpenSsl.dll.sources [new file with mode: 0644]
mcs/class/Facades/System.Security.Cryptography.Pkcs/AssemblyInfo.cs [new file with mode: 0644]
mcs/class/Facades/System.Security.Cryptography.Pkcs/Makefile [new file with mode: 0644]
mcs/class/Facades/System.Security.Cryptography.Pkcs/System.Security.Cryptography.Pkcs.dll.sources [new file with mode: 0644]
mcs/class/Facades/System.Security.Cryptography.Pkcs/TypeForwarders.cs [new file with mode: 0644]
mcs/class/Facades/System.Security.Cryptography.Primitives/AssemblyInfo.cs [new file with mode: 0644]
mcs/class/Facades/System.Security.Cryptography.Primitives/Makefile [new file with mode: 0644]
mcs/class/Facades/System.Security.Cryptography.Primitives/System.Security.Cryptography.Primitives.dll.sources [new file with mode: 0644]
mcs/class/Facades/System.Security.Cryptography.Primitives/TypeForwarders.cs [new file with mode: 0644]
mcs/class/Facades/System.Security.Cryptography.X509Certificates/Makefile
mcs/class/Facades/System.Security.Cryptography.X509Certificates/TypeForwarders.cs
mcs/class/Facades/System.Security.Principal.Windows/TypeForwarders.cs
mcs/class/Facades/System.Security.SecureString/Makefile
mcs/class/Facades/System.Security.SecureString/SecureStringMarshal.cs [new file with mode: 0644]
mcs/class/Facades/System.Security.SecureString/System.Security.SecureString.dll.sources
mcs/class/Facades/System.Security.SecureString/TypeForwarders.cs
mcs/class/Facades/System.ServiceModel.Duplex/TypeForwarders.cs
mcs/class/Facades/System.ServiceModel.Http/TypeForwarders.cs
mcs/class/Facades/System.ServiceModel.NetTcp/TypeForwarders.cs
mcs/class/Facades/System.ServiceModel.Primitives/Makefile
mcs/class/Facades/System.ServiceModel.Primitives/System.ServiceModel.Primitives.dll.sources
mcs/class/Facades/System.ServiceModel.Primitives/TypeForwarders.cs
mcs/class/Facades/System.ServiceModel.Primitives/X509CertificateInitiatorClientCredential_mobile.cs [new file with mode: 0644]
mcs/class/Facades/System.ServiceModel.Primitives/X509CertificateRecipientClientCredential_mobile.cs [new file with mode: 0644]
mcs/class/Facades/System.ServiceModel.Primitives/X509CertificateValidationMode_mobile.cs [new file with mode: 0644]
mcs/class/Facades/System.ServiceModel.Primitives/X509CertificateValidator_mobile.cs [new file with mode: 0644]
mcs/class/Facades/System.ServiceModel.Primitives/X509ServiceCertificateAuthentication_mobile.cs [new file with mode: 0644]
mcs/class/Facades/System.ServiceModel.Security/TypeForwarders.cs
mcs/class/Facades/System.ServiceProcess.ServiceController/Makefile
mcs/class/Facades/System.ServiceProcess.ServiceController/ServiceControllerStatus_mobile.cs [new file with mode: 0644]
mcs/class/Facades/System.ServiceProcess.ServiceController/ServiceController_mobile.cs [new file with mode: 0644]
mcs/class/Facades/System.ServiceProcess.ServiceController/ServiceStartMode_mobile.cs [new file with mode: 0644]
mcs/class/Facades/System.ServiceProcess.ServiceController/ServiceType_mobile.cs [new file with mode: 0644]
mcs/class/Facades/System.ServiceProcess.ServiceController/System.ServiceProcess.ServiceController.dll.sources
mcs/class/Facades/System.ServiceProcess.ServiceController/TimeoutException_mobile.cs [new file with mode: 0644]
mcs/class/Facades/System.ServiceProcess.ServiceController/TypeForwarders.cs
mcs/class/Facades/System.Text.Encoding.CodePages/AssemblyInfo.cs [new file with mode: 0644]
mcs/class/Facades/System.Text.Encoding.CodePages/CodePagesEncodingProvider.cs [new file with mode: 0644]
mcs/class/Facades/System.Text.Encoding.CodePages/Makefile [new file with mode: 0644]
mcs/class/Facades/System.Text.Encoding.CodePages/System.Text.Encoding.CodePages.dll.sources [new file with mode: 0644]
mcs/class/Facades/System.Text.RegularExpressions/TypeForwarders.cs
mcs/class/Facades/System.Threading.AccessControl/Makefile
mcs/class/Facades/System.Threading.AccessControl/System.Threading.AccessControl.dll.sources
mcs/class/Facades/System.Threading.AccessControl/ThreadingAclExtensions.cs [new file with mode: 0644]
mcs/class/Facades/System.Threading.AccessControl/TypeForwarders.cs
mcs/class/Facades/System.Threading.Overlapped/ClrThreadPoolBoundHandle.cs [new file with mode: 0644]
mcs/class/Facades/System.Threading.Overlapped/ClrThreadPoolBoundHandleOverlapped.cs [new file with mode: 0644]
mcs/class/Facades/System.Threading.Overlapped/ClrThreadPoolPreAllocatedOverlapped.cs [new file with mode: 0644]
mcs/class/Facades/System.Threading.Overlapped/DeferredDisposableLifetime.cs [new file with mode: 0644]
mcs/class/Facades/System.Threading.Overlapped/HResults.cs [new file with mode: 0644]
mcs/class/Facades/System.Threading.Overlapped/Makefile
mcs/class/Facades/System.Threading.Overlapped/SR.cs [new file with mode: 0644]
mcs/class/Facades/System.Threading.Overlapped/System.Threading.Overlapped.dll.sources
mcs/class/Facades/System.Threading.Overlapped/TypeForwarders.cs
mcs/class/Facades/System.Xml.ReaderWriter/TypeForwarders.cs
mcs/class/Facades/System.Xml.XPath.XDocument/Makefile
mcs/class/Facades/System.Xml.XPath.XDocument/System.Xml.XPath.XDocument.dll.sources
mcs/class/Facades/System.Xml.XPath.XDocument/TypeForwarders.cs
mcs/class/Facades/System.Xml.XPath.XDocument/XDocumentExtensions.cs [new file with mode: 0644]
mcs/class/Facades/subdirs.make
mcs/class/Makefile
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Project.cs
mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/GetReferenceAssemblyPaths.cs
mcs/class/Microsoft.Build.Utilities/Mono.XBuild.Utilities/ReservedNameUtils.cs
mcs/class/Microsoft.NuGet.Build.Tasks/Makefile [new file with mode: 0644]
mcs/class/Microsoft.NuGet.Build.Tasks/xbuild_14_Microsoft.NuGet.Build.Tasks.dll.sources [new file with mode: 0644]
mcs/class/Mono.CSharp/Mono.CSharp_test.dll.sources
mcs/class/Mono.CSharp/Test/Visit/ASTVisitorTest.cs
mcs/class/Mono.CSharp/mobile_static_Mono.CSharp_test.dll.exclude.sources [new file with mode: 0644]
mcs/class/Mono.CSharp/mobile_static_Mono.CSharp_test.dll.sources [new file with mode: 0644]
mcs/class/Mono.CSharp/monotouch_Mono.CSharp.dll.sources
mcs/class/Mono.CSharp/monotouch_tv_Mono.CSharp.dll.sources
mcs/class/Mono.CSharp/monotouch_watch_Mono.CSharp.dll.sources
mcs/class/Mono.Cecil.Mdb/Mono.Cecil.Mdb.dll.sources
mcs/class/Mono.Cecil/Makefile
mcs/class/Mono.Cecil/Mono.Cecil-SL.csproj [deleted file]
mcs/class/Mono.Cecil/Mono.Cecil.dll.sources
mcs/class/Mono.CodeContracts/Makefile
mcs/class/Mono.CodeContracts/Mono.CodeContracts.Rewrite.AstVisitors/CompileVisitor.cs
mcs/class/Mono.CodeContracts/Mono.CodeContracts.Rewrite.AstVisitors/SourcePositionVisitor.cs
mcs/class/Mono.CodeContracts/Mono.CodeContracts.Rewrite/ContractsRuntime.cs
mcs/class/Mono.CodeContracts/Mono.CodeContracts.Static.AST/TypeNode.cs
mcs/class/Mono.CodeContracts/Test/TestCCRewrite.cs
mcs/class/Mono.CompilerServices.SymbolWriter/SymbolWriterImpl.cs
mcs/class/Mono.Debugger.Soft/Makefile
mcs/class/Mono.Debugger.Soft/Test/dtest-app.cs
mcs/class/Mono.Debugger.Soft/Test/dtest.cs
mcs/class/Mono.Security/monodroid_Mono.Security_test.dll.exclude.sources
mcs/class/Mono.Tasklets/Makefile
mcs/class/Mono.Tasklets/Mono.Tasklets_test.dll.sources [new file with mode: 0644]
mcs/class/Mono.Tasklets/Test/Mono.Tasklets/ContinuationsTest.cs [new file with mode: 0644]
mcs/class/System.Core/Microsoft.Win32.SafeHandles/SafeNCryptHandle.cs [new file with mode: 0644]
mcs/class/System.Core/Microsoft.Win32.SafeHandles/SafeNCryptKeyHandle.cs [new file with mode: 0644]
mcs/class/System.Core/Microsoft.Win32.SafeHandles/SafeNCryptProviderHandle.cs [new file with mode: 0644]
mcs/class/System.Core/Microsoft.Win32.SafeHandles/SafeNCryptSecretHandle.cs [new file with mode: 0644]
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.Security.Cryptography.X509Certificates/ECDsaCertificateExtensions.cs [new file with mode: 0644]
mcs/class/System.Core/System.Security.Cryptography.X509Certificates/RSACertificateExtensions.cs [new file with mode: 0644]
mcs/class/System.Core/System.Security.Cryptography/AesCng.cs [new file with mode: 0644]
mcs/class/System.Core/System.Security.Cryptography/TripleDESCng.cs [new file with mode: 0644]
mcs/class/System.Core/Test/System.IO.MemoryMappedFiles/MemoryMappedFileTest.cs
mcs/class/System.Core/common_System.Core.dll.sources
mcs/class/System.Core/mobile_static_System.Core.dll.sources
mcs/class/System.Core/net_4_x_System.Core.dll.sources
mcs/class/System.Data/Microsoft.SqlServer.Server/SqlDataRecord.cs
mcs/class/System.Data/ReferenceSources/PoolBlockingPeriod.cs [new file with mode: 0644]
mcs/class/System.Data/ReferenceSources/Res.cs
mcs/class/System.Data/Test/System.Data/DataTableTest.cs
mcs/class/System.Data/Test/System.Data/DataViewTest2.cs
mcs/class/System.Data/app_test_mobile_static.config [new file with mode: 0644]
mcs/class/System.Data/mobile_System.Data.dll.sources
mcs/class/System.Data/net_4_x_System.Data.dll.sources
mcs/class/System.Drawing/Makefile
mcs/class/System.Drawing/System.Drawing/Point.cs
mcs/class/System.Drawing/System.Drawing/Rectangle.cs
mcs/class/System.Drawing/System.Drawing/Size.cs
mcs/class/System.Drawing/System.Drawing/SizeF.cs
mcs/class/System.IO.Compression/SharpCompress/Archive/AbstractWritableArchive.cs
mcs/class/System.IO.Compression/Test/System.IO.Compression/ZipTest.cs
mcs/class/System.IO.Compression/ZipArchive.cs
mcs/class/System.IO.Compression/ZipArchiveEntry.cs
mcs/class/System.Net.Http.WinHttpHandler/Assembly/AssemblyInfo.cs [new file with mode: 0644]
mcs/class/System.Net.Http.WinHttpHandler/Makefile [new file with mode: 0644]
mcs/class/System.Net.Http.WinHttpHandler/System.Net.Http.WinHttpHandler.dll.sources [new file with mode: 0644]
mcs/class/System.Net.Http.WinHttpHandler/System.Net.Http/CookieUsePolicy.cs [new file with mode: 0644]
mcs/class/System.Net.Http.WinHttpHandler/System.Net.Http/WinHttpHandler.cs [new file with mode: 0644]
mcs/class/System.Net.Http.WinHttpHandler/System.Net.Http/WindowsProxyUsePolicy.cs [new file with mode: 0644]
mcs/class/System.Net.Http/Test/System.Net.Http/HttpClientTest.cs
mcs/class/System.Numerics.Vectors/Assembly/TypeForwarders.cs [new file with mode: 0644]
mcs/class/System.Numerics.Vectors/Makefile
mcs/class/System.Numerics.Vectors/SR.cs [new file with mode: 0644]
mcs/class/System.Numerics.Vectors/System.Numerics.Vectors.dll.sources
mcs/class/System.Numerics.Vectors/System.Numerics/ConstantHelper.cs [new file with mode: 0644]
mcs/class/System.Numerics.Vectors/System.Numerics/HashCodeHelper.cs [new file with mode: 0644]
mcs/class/System.Numerics.Vectors/System.Numerics/JitIntrinsicAttribute.cs [new file with mode: 0644]
mcs/class/System.Numerics.Vectors/System.Numerics/Register.cs [new file with mode: 0644]
mcs/class/System.Numerics.Vectors/System.Numerics/Vector.cs [new file with mode: 0644]
mcs/class/System.Numerics.Vectors/System.Numerics/Vector_Operations.cs [new file with mode: 0644]
mcs/class/System.Numerics.Vectors/net_4_x_System.Numerics.Vectors.dll.exclude.sources [new file with mode: 0644]
mcs/class/System.Numerics.Vectors/net_4_x_System.Numerics.Vectors.dll.sources [new file with mode: 0644]
mcs/class/System.Numerics/Makefile
mcs/class/System.Numerics/ReferenceSources/Environment.cs [deleted file]
mcs/class/System.Numerics/System.Numerics.dll.sources
mcs/class/System.Reflection.Context/Assembly/AssemblyInfo.cs [new file with mode: 0644]
mcs/class/System.Reflection.Context/Makefile [new file with mode: 0644]
mcs/class/System.Reflection.Context/System.Reflection.Context.dll.sources [new file with mode: 0644]
mcs/class/System.Reflection.Context/System.Reflection.Context/CustomReflectionContext.cs [new file with mode: 0644]
mcs/class/System.Reflection.DispatchProxy/Assembly/AssemblyInfo.cs [new file with mode: 0644]
mcs/class/System.Reflection.DispatchProxy/Makefile [new file with mode: 0644]
mcs/class/System.Reflection.DispatchProxy/System.Reflection.DispatchProxy.dll.sources [new file with mode: 0644]
mcs/class/System.Reflection.DispatchProxy/System.Reflection/DispatchProxy.cs [new file with mode: 0644]
mcs/class/System.Runtime.Caching/ReferenceSources/SRef.cs [deleted file]
mcs/class/System.Runtime.Caching/System.Runtime.Caching.dll.sources
mcs/class/System.Runtime.InteropServices.RuntimeInformation/Assembly/AssemblyInfo.cs [new file with mode: 0644]
mcs/class/System.Runtime.InteropServices.RuntimeInformation/Makefile [new file with mode: 0644]
mcs/class/System.Runtime.InteropServices.RuntimeInformation/System.Runtime.InteropServices.RuntimeInformation.dll.sources [new file with mode: 0644]
mcs/class/System.Runtime.InteropServices.RuntimeInformation/System.Runtime.InteropServices/Architecture.cs [new file with mode: 0644]
mcs/class/System.Runtime.InteropServices.RuntimeInformation/System.Runtime.InteropServices/OSPlatform.cs [new file with mode: 0644]
mcs/class/System.Runtime.InteropServices.RuntimeInformation/System.Runtime.InteropServices/RuntimeInformation.cs [new file with mode: 0644]
mcs/class/System.Runtime.Serialization/Makefile
mcs/class/System.Runtime.Serialization/ReferenceSources/LocalAppContextSwitches.cs [new file with mode: 0644]
mcs/class/System.Runtime.Serialization/ReferenceSources/SchemaExporter_mobile.cs
mcs/class/System.Runtime.Serialization/System.Runtime.Serialization.dll.sources
mcs/class/System.Runtime.Serialization/Test/System.Runtime.Serialization/DataContractResolverTest.cs
mcs/class/System.Runtime.Serialization/Test/System.Runtime.Serialization/XmlObjectSerializerTest.cs
mcs/class/System.Security/System.Security.Cryptography/ProtectedData.cs
mcs/class/System.Security/common_System.Security.dll.sources [new file with mode: 0644]
mcs/class/System.Security/mobile_static_System.Security.dll.sources [new file with mode: 0644]
mcs/class/System.Security/monodroid_System.Security.dll.sources [new file with mode: 0644]
mcs/class/System.Security/monotouch_System.Security.dll.sources [new file with mode: 0644]
mcs/class/System.Security/monotouch_runtime_System.Security.dll.sources [new file with mode: 0644]
mcs/class/System.Security/monotouch_tv_System.Security.dll.sources [new file with mode: 0644]
mcs/class/System.Security/monotouch_tv_runtime_System.Security.dll.sources [new file with mode: 0644]
mcs/class/System.Security/monotouch_watch_System.Security.dll.sources [new file with mode: 0644]
mcs/class/System.Security/monotouch_watch_runtime_System.Security.dll.sources [new file with mode: 0644]
mcs/class/System.Security/xammac_System.Security.dll.sources [new file with mode: 0644]
mcs/class/System.ServiceModel/System.ServiceModel.Channels/ConnectionOrientedTransportBindingElement.cs
mcs/class/System.ServiceModel/System.ServiceModel.Channels/SslStreamSecurityBindingElement.cs
mcs/class/System.ServiceModel/System.ServiceModel.Channels/TcpTransportBindingElement.cs
mcs/class/System.ServiceModel/System.ServiceModel.Channels/TransportBindingElement.cs
mcs/class/System.ServiceModel/System.ServiceModel.Channels/WindowsStreamSecurityBindingElement.cs
mcs/class/System.ServiceModel/System.ServiceModel.Security.Tokens/SecureConversationSecurityTokenParameters.cs
mcs/class/System.ServiceModel/System.ServiceModel.Security.Tokens/SecurityTokenParameters.cs
mcs/class/System.ServiceModel/System.ServiceModel.Security.Tokens/UserNameSecurityTokenParameters.cs
mcs/class/System.ServiceModel/System.ServiceModel.dll.sources
mcs/class/System.ServiceModel/System.ServiceModel/BasicHttpsBinding.cs
mcs/class/System.ServiceModel/System.ServiceModel/BasicHttpsSecurity.cs
mcs/class/System.ServiceModel/System.ServiceModel/CallbackBehaviorAttribute.cs
mcs/class/System.ServiceModel/System.ServiceModel/DnsEndpointIdentity.cs
mcs/class/System.ServiceModel/System.ServiceModel/DuplexChannelFactory.cs
mcs/class/System.ServiceModel/System.ServiceModel/DuplexClientRuntimeChannel.cs
mcs/class/System.ServiceModel/System.ServiceModel/HttpBindingBase.cs
mcs/class/System.ServiceModel/System.ServiceModel/MessageSecurityOverTcp.cs
mcs/class/System.ServiceModel/System.ServiceModel/MessageSecurityVersion.cs
mcs/class/System.ServiceModel/System.ServiceModel/NetHttpsBinding.cs [new file with mode: 0644]
mcs/class/System.ServiceModel/System.ServiceModel/NetTcpBinding.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/mobile_System.ServiceModel.dll.sources
mcs/class/System.ServiceModel/mobile_static_System.ServiceModel_test.dll.exclude.sources [new file with mode: 0644]
mcs/class/System.ServiceModel/mobile_static_System.ServiceModel_test.dll.sources [new file with mode: 0644]
mcs/class/System.Web.Services/System.Web.Services.Protocols/Methods.cs
mcs/class/System.Web.Services/Test/System.Web.Services.Protocols/SoapHttpClientProtocolTest.cs
mcs/class/System.Web.Services/mobile_static_System.Web.Services_test.dll.exclude.sources
mcs/class/System.Web/System.Web.dll.sources
mcs/class/System.Windows.Forms/Test/System.Windows.Forms/DateTimePickerTest.cs
mcs/class/System.XML/ReferenceSources/LocalAppContextSwitches.cs
mcs/class/System.XML/Test/System.Xml.Serialization/XmlSerializationWriterTests.cs
mcs/class/System.Xml.XPath.XmlDocument/Assembly/AssemblyInfo.cs [new file with mode: 0644]
mcs/class/System.Xml.XPath.XmlDocument/Makefile [new file with mode: 0644]
mcs/class/System.Xml.XPath.XmlDocument/System.Xml.XPath.XmlDocument.dll.sources [new file with mode: 0644]
mcs/class/System.Xml.XPath.XmlDocument/System.Xml/XmlDocumentXPathExtensions.cs [new file with mode: 0644]
mcs/class/System/Makefile
mcs/class/System/Microsoft.Win32.SafeHandles/SafeX509ChainHandle.cs [new file with mode: 0644]
mcs/class/System/Mono.Net.Security/SystemCertificateValidator.cs
mcs/class/System/ReferenceSources/LocalAppContextSwitches.cs [new file with mode: 0644]
mcs/class/System/ReferenceSources/SSPISafeHandles.cs
mcs/class/System/System.Diagnostics/ProcessModuleCollection.cs
mcs/class/System/System.Diagnostics/ProcessThreadCollection.cs
mcs/class/System/System.IO.Compression/DeflateStream.cs
mcs/class/System/System.IO/FileSystemWatcher_mobile.cs [new file with mode: 0644]
mcs/class/System/System.Net.Mail/SmtpClient.cs
mcs/class/System/System.Net.NetworkInformation/NetworkChange.cs
mcs/class/System/System.Net.Sockets/Socket.cs
mcs/class/System/System.Net.WebSockets/WebSocketCloseStatus.cs
mcs/class/System/System.Net/ResponseStream.cs
mcs/class/System/System.Net/ServicePointManager.cs
mcs/class/System/System.Net/WebConnection.cs
mcs/class/System/System.Security.Authentication.ExtendedProtection/ChannelBindingKind.cs
mcs/class/System/System.dll.sources
mcs/class/System/Test/System.Diagnostics/FileVersionInfoTest.cs
mcs/class/System/Test/System.Diagnostics/ProcessTest.cs
mcs/class/System/Test/System.Net.Mail/SmtpClientTest.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/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/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/WebClientTest.cs
mcs/class/System/Test/System.Net/WebRequestTest.cs
mcs/class/System/Test/System.Timers/TimerTest.cs
mcs/class/System/Test/System/UriTest.cs
mcs/class/System/mobile_System.dll.sources
mcs/class/System/mobile_static_System_test.dll.exclude.sources
mcs/class/corlib/Microsoft.Win32/Registry.cs
mcs/class/corlib/Microsoft.Win32/RegistryHive.cs
mcs/class/corlib/Microsoft.Win32/RegistryKey.cs
mcs/class/corlib/Microsoft.Win32/RegistryValueKind.cs
mcs/class/corlib/Microsoft.Win32/RegistryValueOptions.cs
mcs/class/corlib/Mono/RuntimeHandles.cs [new file with mode: 0644]
mcs/class/corlib/Mono/RuntimeMarshal.cs [new file with mode: 0644]
mcs/class/corlib/Mono/RuntimeStructs.cs [new file with mode: 0644]
mcs/class/corlib/Mono/SafeGPtrArrayHandle.cs [new file with mode: 0644]
mcs/class/corlib/Mono/SafeStringMarshal.cs [new file with mode: 0644]
mcs/class/corlib/ReferenceSources/AppContextSwitches.cs
mcs/class/corlib/ReferenceSources/MethodBase.cs
mcs/class/corlib/ReferenceSources/PathInternal.cs [new file with mode: 0644]
mcs/class/corlib/ReferenceSources/RuntimeType.cs
mcs/class/corlib/System.Diagnostics.Tracing/EventDataAttribute.cs [new file with mode: 0644]
mcs/class/corlib/System.Diagnostics.Tracing/EventFieldAttribute.cs [new file with mode: 0644]
mcs/class/corlib/System.Diagnostics.Tracing/EventFieldFormat.cs [new file with mode: 0644]
mcs/class/corlib/System.Diagnostics.Tracing/EventFieldTags.cs [new file with mode: 0644]
mcs/class/corlib/System.Diagnostics.Tracing/EventIgnoreAttribute.cs [new file with mode: 0644]
mcs/class/corlib/System.Diagnostics.Tracing/EventManifestOptions.cs [new file with mode: 0644]
mcs/class/corlib/System.Diagnostics.Tracing/EventSource.cs
mcs/class/corlib/System.Diagnostics.Tracing/EventSourceException.cs [new file with mode: 0644]
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/File.cs
mcs/class/corlib/System.IO/Path.cs
mcs/class/corlib/System.Reflection.Emit/AssemblyBuilder.cs
mcs/class/corlib/System.Reflection.Emit/FlowControl.cs
mcs/class/corlib/System.Reflection.Emit/OpCode.cs
mcs/class/corlib/System.Reflection.Emit/OpCodeNames.cs
mcs/class/corlib/System.Reflection.Emit/OpCodeType.cs
mcs/class/corlib/System.Reflection.Emit/OpCodes.cs
mcs/class/corlib/System.Reflection.Emit/OperandType.cs
mcs/class/corlib/System.Reflection.Emit/PackingSize.cs
mcs/class/corlib/System.Reflection.Emit/StackBehaviour.cs
mcs/class/corlib/System.Reflection.Metadata/AssemblyExtensions.cs [new file with mode: 0644]
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/MonoAssembly.cs
mcs/class/corlib/System.Reflection/PropertyInfo.cs
mcs/class/corlib/System.Runtime.CompilerServices/ConditionalWeakTable.cs
mcs/class/corlib/System.Runtime.InteropServices/ComAwareEventInfo.cs [new file with mode: 0644]
mcs/class/corlib/System.Runtime.InteropServices/ComEventsHelper.cs [new file with mode: 0644]
mcs/class/corlib/System.Runtime.InteropServices/CustomQueryInterfaceMode.cs [new file with mode: 0644]
mcs/class/corlib/System.Runtime.Loader/AssemblyLoadContext.cs [new file with mode: 0644]
mcs/class/corlib/System.Runtime.Remoting.Contexts/SynchronizationAttribute.cs
mcs/class/corlib/System.Runtime.Remoting.Messaging/MonoMethodMessage.cs
mcs/class/corlib/System.Runtime.Remoting.Proxies/RealProxy.cs
mcs/class/corlib/System.Security.Cryptography/CryptoConfig.cs
mcs/class/corlib/System.Security.Cryptography/RSACryptoServiceProvider.cs
mcs/class/corlib/System.Security/SafeAccessTokenHandle.cs [deleted file]
mcs/class/corlib/System.Threading/Thread.cs
mcs/class/corlib/System/Environment.cs
mcs/class/corlib/System/RuntimeTypeHandle.cs
mcs/class/corlib/System/TimeZoneInfo.cs
mcs/class/corlib/Test/System.IO/PathTest.cs
mcs/class/corlib/Test/System.Reflection.Emit/DynamicMethodTest.cs
mcs/class/corlib/Test/System.Runtime.CompilerServices/ConditionalWeakTableTest.cs
mcs/class/corlib/Test/System.Runtime.ExceptionServices/ExceptionDispatchInfoTest.cs
mcs/class/corlib/Test/System.Runtime.Remoting.Contexts/SynchronizationAttributeTest.cs
mcs/class/corlib/Test/System.Runtime.Remoting/SynchronizationAttributeTest.cs
mcs/class/corlib/Test/System.Security.Cryptography/SignatureDescriptionTest.cs
mcs/class/corlib/Test/System/BitConverterTest.cs
mcs/class/corlib/Test/System/DelegateTest.cs
mcs/class/corlib/Test/System/TimeZoneInfoTest.cs
mcs/class/corlib/corlib.dll.sources
mcs/class/corlib/corlib_test.dll.sources
mcs/class/legacy/Mono.Cecil/Makefile [new file with mode: 0644]
mcs/class/legacy/Mono.Cecil/Mono.Cecil.dll.sources [new file with mode: 0644]
mcs/class/referencesource/System.Activities.Core.Presentation/System/Activities/Core/Presentation/FlowchartConnectionPointsAdorner.cs
mcs/class/referencesource/System.Activities.Presentation/Microsoft.Tools.Common/Microsoft/Activities/Presentation/Xaml/ViewStateXamlHelper.cs
mcs/class/referencesource/System.Activities/System/Activities/Hosting/WorkflowInstance.cs
mcs/class/referencesource/System.Activities/System/Activities/WorkflowApplication.cs
mcs/class/referencesource/System.ComponentModel.DataAnnotations/DataAnnotations/LocalAppContextSwitches.cs
mcs/class/referencesource/System.ComponentModel.DataAnnotations/DataAnnotations/RegularExpressionAttribute.cs
mcs/class/referencesource/System.ComponentModel.DataAnnotations/InternalApis/Clr/inc/AppContextDefaultValues.cs
mcs/class/referencesource/System.ComponentModel.DataAnnotations/InternalApis/Clr/inc/LocalAppContext.cs
mcs/class/referencesource/System.Configuration/System/Configuration/ClientConfigPaths.cs
mcs/class/referencesource/System.Core/Microsoft/Win32/SafeHandles/CapiSafeHandles.cs
mcs/class/referencesource/System.Core/System/Security/Cryptography/BCryptNative.cs
mcs/class/referencesource/System.Core/System/Security/Cryptography/CapiNative.cs
mcs/class/referencesource/System.Core/System/Security/Cryptography/CapiSymmetricAlgorithm.cs
mcs/class/referencesource/System.Core/System/Security/Cryptography/CngKey.cs
mcs/class/referencesource/System.Core/System/Security/Cryptography/ECDiffieHellman.cs
mcs/class/referencesource/System.Core/System/Security/Cryptography/ECDiffieHellmanCng.cs
mcs/class/referencesource/System.Core/System/Security/Cryptography/ECDiffieHellmanPublicKey.cs
mcs/class/referencesource/System.Core/System/Security/Cryptography/ECDsaCng.cs
mcs/class/referencesource/System.Core/System/Security/Cryptography/NCryptNative.cs
mcs/class/referencesource/System.Core/System/Security/Cryptography/RsaCng.cs
mcs/class/referencesource/System.Core/System/Security/Cryptography/X509Certificates/RSACertificateExtensions.cs
mcs/class/referencesource/System.Data.Entity/System/Data/Common/Utils/MetadataHelper.cs
mcs/class/referencesource/System.Data.Entity/System/Data/EntityModel/SchemaObjectModel/Schema.cs
mcs/class/referencesource/System.Data.SqlXml/System/Xml/Xsl/IlGen/XmlILOptimizerVisitor.cs
mcs/class/referencesource/System.Data/System/Data/Common/DbConnectionStringCommon.cs
mcs/class/referencesource/System.Data/System/Data/DataSet.cs
mcs/class/referencesource/System.Data/System/Data/DataTable.cs
mcs/class/referencesource/System.Data/System/Data/ProviderBase/DbConnectionPool.cs
mcs/class/referencesource/System.Data/System/Data/SqlClient/SqlClientSymmetricKey.cs
mcs/class/referencesource/System.Data/System/Data/SqlClient/SqlCommand.cs
mcs/class/referencesource/System.Data/System/Data/SqlClient/SqlConnection.cs
mcs/class/referencesource/System.Data/System/Data/SqlClient/SqlConnectionString.cs
mcs/class/referencesource/System.Data/System/Data/SqlClient/SqlConnectionStringBuilder.cs
mcs/class/referencesource/System.Data/System/Data/SqlClient/SqlConnectionTimeoutErrorInternal.cs
mcs/class/referencesource/System.Data/System/Data/SqlClient/SqlInternalConnectionTds.cs
mcs/class/referencesource/System.Data/System/Data/SqlClient/SqlParameter.cs
mcs/class/referencesource/System.Data/System/Data/SqlClient/SqlSymmetricKeyCache.cs
mcs/class/referencesource/System.Data/System/Data/SqlClient/SqlUtil.cs
mcs/class/referencesource/System.Data/System/Data/SqlClient/TdsEnums.cs
mcs/class/referencesource/System.Data/System/NewXml/XPathNodePointer.cs
mcs/class/referencesource/System.IdentityModel/InternalApis/Clr/inc/AppContextDefaultValues.cs
mcs/class/referencesource/System.IdentityModel/InternalApis/Clr/inc/LocalAppContext.cs
mcs/class/referencesource/System.IdentityModel/System/IdentityModel/Claims/X509CertificateClaimSet.cs
mcs/class/referencesource/System.IdentityModel/System/IdentityModel/LocalAppContextSwitches.cs
mcs/class/referencesource/System.IdentityModel/System/IdentityModel/Tokens/X509AsymmetricSecurityKey.cs
mcs/class/referencesource/System.Runtime.Caching/System/Caching/CacheMemoryMonitor.cs
mcs/class/referencesource/System.Runtime.Caching/System/Caching/MemoryCache.cs
mcs/class/referencesource/System.Runtime.Caching/System/Caching/MemoryCacheStatistics.cs
mcs/class/referencesource/System.Runtime.Caching/System/Caching/SRef.cs
mcs/class/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/DataContract.cs
mcs/class/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/Diagnostics/TraceUtility.cs
mcs/class/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/Json/DataContractJsonSerializer.cs
mcs/class/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/Json/JsonClassDataContract.cs
mcs/class/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/Json/JsonDataContract.cs
mcs/class/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/Json/JsonEncodingStreamWrapper.cs
mcs/class/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/Json/JsonObjectDataContract.cs
mcs/class/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/Json/JsonReaderDelegator.cs
mcs/class/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/Json/JsonReaderWriterFactory.cs
mcs/class/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/Json/JsonWriterDelegator.cs
mcs/class/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/Json/XmlJsonReader.cs
mcs/class/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/Json/XmlJsonWriter.cs
mcs/class/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/Json/XmlObjectSerializerReadContextComplexJson.cs
mcs/class/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/Json/XmlObjectSerializerWriteContextComplexJson.cs
mcs/class/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/SchemaExporter.cs
mcs/class/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/SchemaImporter.cs
mcs/class/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/XmlObjectSerializerReadContext.cs
mcs/class/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/XmlObjectSerializerWriteContext.cs
mcs/class/referencesource/System.ServiceModel.Activation/System/ServiceModel/Activation/HostedAspNetEnvironment.cs
mcs/class/referencesource/System.ServiceModel.Internals/System/Runtime/Diagnostics/EtwDiagnosticTrace.cs
mcs/class/referencesource/System.ServiceModel/InternalApis/Clr/inc/AppContextDefaultValues.cs
mcs/class/referencesource/System.ServiceModel/InternalApis/Clr/inc/LocalAppContext.cs
mcs/class/referencesource/System.ServiceModel/System/ServiceModel/AppContextDefaultValues.Default.cs
mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Channels/HttpChannelListener.cs
mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Channels/PipeConnection.cs
mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Channels/TransportDefaults.cs
mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Channels/UnsafeNativeMethods.cs
mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Channels/WebSocketHelper.cs
mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Configuration/Properties.cs
mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Description/MessageContractExporter.cs
mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Description/WsdlHelper.cs
mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Dispatcher/QueryMatcher.cs
mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Dispatcher/TaskMethodInvoker.cs
mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Dispatcher/XmlSerializerOperationFormatter.cs
mcs/class/referencesource/System.ServiceModel/System/ServiceModel/EndpointAddress10.cs
mcs/class/referencesource/System.ServiceModel/System/ServiceModel/EndpointAddressAugust2004.cs
mcs/class/referencesource/System.ServiceModel/System/ServiceModel/LocalAppContextSwitches.cs
mcs/class/referencesource/System.ServiceModel/System/ServiceModel/OperationContext.cs
mcs/class/referencesource/System.ServiceModel/System/ServiceModel/OperationContextScope.cs
mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Security/CryptoHelper.cs
mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Security/SecurityUtils.cs
mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Security/TlsSspiNegotiation.cs
mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Security/Tokens/IssuedSecurityTokenProvider.cs
mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Security/WSSecurityPolicy.cs
mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Security/WSTrust.cs
mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Security/WSTrustServiceContract.cs
mcs/class/referencesource/System.ServiceModel/System/ServiceModel/ServiceHost.cs
mcs/class/referencesource/System.ServiceModel/System/ServiceModel/ServiceModelAppSettings.cs
mcs/class/referencesource/System.ServiceModel/System/UriTemplate.cs
mcs/class/referencesource/System.Web.DynamicData/DynamicData/DynamicValidator.cs
mcs/class/referencesource/System.Web.DynamicData/DynamicData/FieldTemplateUserControl.cs
mcs/class/referencesource/System.Web.DynamicData/DynamicData/MetaColumn.cs
mcs/class/referencesource/System.Web.Extensions/Compilation/WCFModel/DataSvcMapFileLoader.cs
mcs/class/referencesource/System.Web.Extensions/Compilation/WCFModel/MetadataFile.cs
mcs/class/referencesource/System.Web.Extensions/Compilation/WCFModel/SvcMapFileLoader.cs
mcs/class/referencesource/System.Web.Mobile/UI/MobileControls/Adapters/ChtmlCalendarAdapter.cs
mcs/class/referencesource/System.Web.Mobile/UI/MobileControls/Adapters/WmlCalendarAdapter.cs
mcs/class/referencesource/System.Web/AspNetEventSource.cs
mcs/class/referencesource/System.Web/Cache/CacheDependency.cs
mcs/class/referencesource/System.Web/Cache/SRef.cs
mcs/class/referencesource/System.Web/Cache/cache.cs
mcs/class/referencesource/System.Web/Compilation/BuildManager.cs
mcs/class/referencesource/System.Web/Compilation/PreservationFileReader.cs
mcs/class/referencesource/System.Web/Compilation/XsdBuildProvider.cs
mcs/class/referencesource/System.Web/Configuration/BrowserCapabilitiesCodeGenerator.cs
mcs/class/referencesource/System.Web/Configuration/HttpCapabilitiesSectionHandler.cs
mcs/class/referencesource/System.Web/Configuration/RemoteWebConfigurationHostServer.cs
mcs/class/referencesource/System.Web/Handlers/TransferRequestHandler.cs
mcs/class/referencesource/System.Web/Hosting/ApplicationManager.cs
mcs/class/referencesource/System.Web/Hosting/HostingEnvironment.cs
mcs/class/referencesource/System.Web/HttpApplication.cs
mcs/class/referencesource/System.Web/HttpCacheParams.cs
mcs/class/referencesource/System.Web/HttpCachePolicy.cs
mcs/class/referencesource/System.Web/HttpCacheVary.cs
mcs/class/referencesource/System.Web/HttpCacheVaryByContentEncodings.cs
mcs/class/referencesource/System.Web/HttpContext.cs
mcs/class/referencesource/System.Web/HttpResponse.cs
mcs/class/referencesource/System.Web/ModelBinding/DataAnnotationsModelMetadataProvider.cs
mcs/class/referencesource/System.Web/ModelBinding/DataAnnotationsModelValidator.cs
mcs/class/referencesource/System.Web/ModelBinding/DataAnnotationsModelValidatorProvider.cs
mcs/class/referencesource/System.Web/ModelBinding/RangeAttributeAdapter.cs
mcs/class/referencesource/System.Web/ModelBinding/RegularExpressionAttributeAdapter.cs
mcs/class/referencesource/System.Web/ModelBinding/StringLengthAttributeAdapter.cs
mcs/class/referencesource/System.Web/Security/Cryptography/CryptoAlgorithms.cs
mcs/class/referencesource/System.Web/Security/FormsIdentity.cs
mcs/class/referencesource/System.Web/State/SessionStateModule.cs
mcs/class/referencesource/System.Web/State/SessionStateUtil.cs
mcs/class/referencesource/System.Web/TaskAsyncHelper.cs
mcs/class/referencesource/System.Web/UI/PartialCachingControl.cs
mcs/class/referencesource/System.Web/UI/WebControls/Calendar.cs
mcs/class/referencesource/System.Web/UI/WebControls/QueryExtensions.cs
mcs/class/referencesource/System.Web/UI/WebControls/xml.cs
mcs/class/referencesource/System.Web/Util/GCUtil.cs
mcs/class/referencesource/System.Web/Util/StringUtil.cs
mcs/class/referencesource/System.Web/Util/SynchronizationHelper.cs
mcs/class/referencesource/System.Web/Util/XmlUtils.cs
mcs/class/referencesource/System.Web/XmlSiteMapProvider.cs
mcs/class/referencesource/System.Workflow.ComponentModel/AuthoringOM/Compiler/CompileXomlTask.cs
mcs/class/referencesource/System.Workflow.ComponentModel/AuthoringOM/Design/ComponentSerializationService.cs
mcs/class/referencesource/System.Workflow.Runtime/Tracking.cs
mcs/class/referencesource/System.Workflow.Runtime/Tracking/TrackingProfileSerializer.cs
mcs/class/referencesource/System.Workflow.Runtime/WorkflowRuntime.cs
mcs/class/referencesource/System.Xml/InternalApis/Clr/inc/AppContextDefaultValues.cs
mcs/class/referencesource/System.Xml/InternalApis/Clr/inc/LocalAppContext.cs
mcs/class/referencesource/System.Xml/System/Xml/Core/AppContextDefaultValues.Defaults.cs
mcs/class/referencesource/System.Xml/System/Xml/Core/LocalAppContextSwitches.cs
mcs/class/referencesource/System.Xml/System/Xml/Serialization/Xmlcustomformatter.cs
mcs/class/referencesource/System/InternalApis/Clr/inc/AppContextDefaultValues.cs
mcs/class/referencesource/System/InternalApis/Clr/inc/LocalAppContext.cs
mcs/class/referencesource/System/InternalApis/NDP_Common/inc/PinnableBufferCache.cs
mcs/class/referencesource/System/compmod/microsoft/win32/UnsafeNativeMethods.cs
mcs/class/referencesource/System/compmod/system/componentmodel/MemberDescriptor.cs
mcs/class/referencesource/System/net/System/Net/HttpListenerRequest.cs
mcs/class/referencesource/System/net/System/Net/Internal.cs
mcs/class/referencesource/System/net/System/Net/SecureProtocols/_SslState.cs
mcs/class/referencesource/System/net/System/Net/ServicePointManager.cs
mcs/class/referencesource/System/net/System/Net/UnsafeNativeMethods.cs
mcs/class/referencesource/System/net/System/Net/_SecureChannel.cs
mcs/class/referencesource/System/net/System/_UncName.cs
mcs/class/referencesource/System/services/io/system/io/FileSystemWatcher.cs
mcs/class/referencesource/System/sys/AppContextDefaultValues.Defaults.cs
mcs/class/referencesource/System/sys/LocalAppContextSwitches.cs
mcs/class/referencesource/XamlBuildTask/Microsoft/Build/Tasks/Xaml/PartialClassGenerationTask.cs
mcs/class/referencesource/XamlBuildTask/Microsoft/Build/Tasks/Xaml/XamlBuildTaskServices.cs
mcs/class/referencesource/mscorlib/InternalApis/NDP_Common/inc/PinnableBufferCache.cs
mcs/class/referencesource/mscorlib/microsoft/win32/win32native.cs
mcs/class/referencesource/mscorlib/system/AppContext/AppContext.cs
mcs/class/referencesource/mscorlib/system/AppContext/AppContextDefaultValues.Defaults.cs
mcs/class/referencesource/mscorlib/system/AppContext/AppContextDefaultValues.cs
mcs/class/referencesource/mscorlib/system/AppContext/AppContextSwitches.cs
mcs/class/referencesource/mscorlib/system/AppDomainSetup.cs
mcs/class/referencesource/mscorlib/system/appdomain.cs
mcs/class/referencesource/mscorlib/system/bitconverter.cs
mcs/class/referencesource/mscorlib/system/deployment/cmsutils.cs
mcs/class/referencesource/mscorlib/system/diagnostics/eventing/TraceLogging/SimpleTypeInfos.cs
mcs/class/referencesource/mscorlib/system/diagnostics/eventing/TraceLogging/TraceLoggingEventSource.cs
mcs/class/referencesource/mscorlib/system/diagnostics/eventing/TraceLogging/TraceLoggingMetadataCollector.cs
mcs/class/referencesource/mscorlib/system/diagnostics/eventing/activitytracker.cs
mcs/class/referencesource/mscorlib/system/diagnostics/eventing/eventprovider.cs
mcs/class/referencesource/mscorlib/system/diagnostics/eventing/eventsource.cs
mcs/class/referencesource/mscorlib/system/environment.cs
mcs/class/referencesource/mscorlib/system/globalization/taiwancalendar.cs
mcs/class/referencesource/mscorlib/system/io/__error.cs
mcs/class/referencesource/mscorlib/system/io/binaryreader.cs
mcs/class/referencesource/mscorlib/system/io/binarywriter.cs
mcs/class/referencesource/mscorlib/system/io/directory.cs
mcs/class/referencesource/mscorlib/system/io/directoryinfo.cs
mcs/class/referencesource/mscorlib/system/io/file.cs
mcs/class/referencesource/mscorlib/system/io/fileinfo.cs
mcs/class/referencesource/mscorlib/system/io/filestream.cs
mcs/class/referencesource/mscorlib/system/io/filesystemenumerable.cs
mcs/class/referencesource/mscorlib/system/io/filesysteminfo.cs
mcs/class/referencesource/mscorlib/system/io/longpath.cs
mcs/class/referencesource/mscorlib/system/io/path.cs
mcs/class/referencesource/mscorlib/system/resources/resourcereader.cs
mcs/class/referencesource/mscorlib/system/runtime/interopservices/windowsruntime/nativemethods.cs
mcs/class/referencesource/mscorlib/system/security/accesscontrol/filesecurity.cs
mcs/class/referencesource/mscorlib/system/security/claims/ClaimsIdentity.cs
mcs/class/referencesource/mscorlib/system/security/cryptography/cryptoconfig.cs
mcs/class/referencesource/mscorlib/system/security/cryptography/dsa.cs
mcs/class/referencesource/mscorlib/system/security/cryptography/dsacryptoserviceprovider.cs
mcs/class/referencesource/mscorlib/system/security/cryptography/rsacryptoserviceprovider.cs
mcs/class/referencesource/mscorlib/system/security/cryptography/rsaoaepkeyexchangedeformatter.cs
mcs/class/referencesource/mscorlib/system/security/cryptography/rsaoaepkeyexchangeformatter.cs
mcs/class/referencesource/mscorlib/system/security/cryptography/rsapkcs1keyexchangedeformatter.cs
mcs/class/referencesource/mscorlib/system/security/cryptography/rsapkcs1keyexchangeformatter.cs
mcs/class/referencesource/mscorlib/system/security/cryptography/rsapkcs1signaturedeformatter.cs
mcs/class/referencesource/mscorlib/system/security/cryptography/rsapkcs1signatureformatter.cs
mcs/class/referencesource/mscorlib/system/security/cryptography/signaturedescription.cs
mcs/class/referencesource/mscorlib/system/security/cryptography/utils.cs
mcs/class/referencesource/mscorlib/system/security/cryptography/x509certificates/x509utils.cs
mcs/class/referencesource/mscorlib/system/security/permissions/fileiopermission.cs
mcs/class/referencesource/mscorlib/system/security/principal/windowsidentity.cs
mcs/class/referencesource/mscorlib/system/security/safesecurityhandles.cs
mcs/class/referencesource/mscorlib/system/security/util/stringexpressionset.cs
mcs/class/referencesource/mscorlib/system/security/util/urlstring.cs
mcs/class/referencesource/mscorlib/system/text/stringbuilder.cs
mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs
mcs/class/test-helpers/TestHelpers.cs [new symlink]
mcs/errors/cs0163-2.cs [new file with mode: 0644]
mcs/errors/cs1644-50.cs [new file with mode: 0644]
mcs/ilasm/codegen/TypeDef.cs
mcs/ilasm/scanner/InstrToken.cs
mcs/mcs/assembly.cs
mcs/mcs/assign.cs
mcs/mcs/class.cs
mcs/mcs/cs-parser.jay
mcs/mcs/ecore.cs
mcs/mcs/expression.cs
mcs/mcs/ikvm.cs
mcs/mcs/statement.cs
mcs/tests/Makefile
mcs/tests/dlls/test-939-1/test-939-lib.cs [new file with mode: 0644]
mcs/tests/dlls/test-939-1/test-939-ref.cs [new file with mode: 0644]
mcs/tests/dlls/test-939-2/test-939-lib.cs [new file with mode: 0644]
mcs/tests/dlls/test-939-common.cs [new file with mode: 0644]
mcs/tests/gtest-637.cs [new file with mode: 0644]
mcs/tests/gtest-lambda-37.cs [new file with mode: 0644]
mcs/tests/test-935.cs
mcs/tests/test-938.cs [new file with mode: 0644]
mcs/tests/test-939.cs [new file with mode: 0644]
mcs/tests/test-async-86.cs [new file with mode: 0644]
mcs/tests/ver-il-net_4_x.xml
mcs/tools/cil-stringreplacer/cil-stringreplacer.cs
mcs/tools/corcompare/Util.cs
mcs/tools/corcompare/mono-api-info.cs
mcs/tools/linker/Descriptors/mscorlib.xml
mcs/tools/linker/Mono.Linker.Steps/MarkStep.cs
mcs/tools/linker/Mono.Linker.Steps/TypeMapStep.cs
mcs/tools/mdoc/Makefile
mcs/tools/mdoc/Mono.Documentation/exceptions.cs
mcs/tools/mdoc/Mono.Documentation/monodocer.cs
mcs/tools/mdoc/mdoc.csproj
mcs/tools/mono-api-html/ApiDiff.cs
mcs/tools/mono-api-html/ClassComparer.cs
mcs/tools/mono-api-html/FieldComparer.cs
mcs/tools/mono-api-html/MemberComparer.cs
mcs/tools/mono-symbolicate/LocationProvider.cs
mcs/tools/mono-symbolicate/Logger.cs [new file with mode: 0644]
mcs/tools/mono-symbolicate/Makefile
mcs/tools/mono-symbolicate/README [deleted file]
mcs/tools/mono-symbolicate/README.md [new file with mode: 0644]
mcs/tools/mono-symbolicate/SeqPointInfo.cs
mcs/tools/mono-symbolicate/StackFrameData.cs [new file with mode: 0644]
mcs/tools/mono-symbolicate/SymbolManager.cs [new file with mode: 0644]
mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs
mcs/tools/mono-symbolicate/Test/symbolicate.expected
mcs/tools/mono-symbolicate/mono-symbolicate.exe.sources
mcs/tools/mono-symbolicate/monosymbolicate.csproj
mcs/tools/mono-symbolicate/symbolicate.cs
mcs/tools/nunit-lite/nunit-lite-console/Console.cs
mcs/tools/tuner/Mono.Tuner/CheckVisibility.cs
mcs/tools/tuner/Mono.Tuner/MoonlightA11yProcessor.cs
mcs/tools/tuner/Mono.Tuner/RemoveSerialization.cs
mcs/tools/xbuild/Makefile
mcs/tools/xbuild/data/12.0/Microsoft.Common.targets
mcs/tools/xbuild/data/14.0/Microsoft.Common.props [new file with mode: 0644]
mcs/tools/xbuild/data/14.0/Microsoft.Common.targets
mcs/tools/xbuild/data/4.0/Microsoft.Common.targets
mcs/tools/xbuild/targets/Microsoft.Portable.CSharp_4.0.targets [deleted file]
mcs/tools/xbuild/targets/Microsoft.Portable.CSharp_4.5.targets [deleted file]
mcs/tools/xbuild/targets/Microsoft.Portable.Common.targets [deleted file]
mcs/tools/xbuild/targets/Microsoft.Portable.Core.props [deleted file]
mcs/tools/xbuild/targets/Microsoft.Portable.Core.targets [deleted file]
mcs/tools/xbuild/targets/Microsoft.Portable.VisualBasic_4.0.targets [deleted file]
mcs/tools/xbuild/targets/Microsoft.Portable.VisualBasic_4.5.targets [deleted file]
mono/arch/arm64/arm64-codegen.h
mono/cil/cil-opcodes.xml
mono/cil/opcode.def
mono/io-layer/Makefile.am
mono/io-layer/error.c
mono/io-layer/event-private.h
mono/io-layer/events.c
mono/io-layer/handles-private.h [deleted file]
mono/io-layer/handles.c [deleted file]
mono/io-layer/handles.h [deleted file]
mono/io-layer/io-private.h
mono/io-layer/io-trace.h
mono/io-layer/io.c
mono/io-layer/io.h
mono/io-layer/locking.c
mono/io-layer/mutex-private.h
mono/io-layer/mutexes.c
mono/io-layer/mutexes.h
mono/io-layer/posix.c
mono/io-layer/process-private.h
mono/io-layer/processes.c
mono/io-layer/processes.h
mono/io-layer/semaphore-private.h
mono/io-layer/semaphores.c
mono/io-layer/shared.c
mono/io-layer/shared.h
mono/io-layer/socket-private.h
mono/io-layer/sockets.c
mono/io-layer/thread-private.h [deleted file]
mono/io-layer/threads.h [deleted file]
mono/io-layer/uglify.h
mono/io-layer/wait.c
mono/io-layer/wapi-private.h
mono/io-layer/wapi-remap.h
mono/io-layer/wapi.c [new file with mode: 0644]
mono/io-layer/wapi.h
mono/io-layer/wthreads.c [deleted file]
mono/metadata/Makefile.am
mono/metadata/appdomain.c
mono/metadata/assembly.c
mono/metadata/attach.c
mono/metadata/boehm-gc.c
mono/metadata/cil-coff.h
mono/metadata/class-internals.h
mono/metadata/class.c
mono/metadata/domain-internals.h
mono/metadata/domain.c
mono/metadata/exception.c
mono/metadata/exception.h
mono/metadata/file-io.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.c
mono/metadata/image.c
mono/metadata/loader.c
mono/metadata/loader.h
mono/metadata/marshal.c
mono/metadata/marshal.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/monitor.h
mono/metadata/mono-config.c
mono/metadata/mono-debug.c
mono/metadata/mono-debug.h
mono/metadata/null-gc.c
mono/metadata/object-internals.h
mono/metadata/object.c
mono/metadata/process.c
mono/metadata/reflection.c
mono/metadata/remoting.c
mono/metadata/remoting.h
mono/metadata/sgen-bridge-internals.h
mono/metadata/sgen-bridge.c
mono/metadata/sgen-bridge.h
mono/metadata/sgen-dynarray.h [new file with mode: 0644]
mono/metadata/sgen-mono.c
mono/metadata/sgen-new-bridge.c
mono/metadata/sgen-os-posix.c
mono/metadata/sgen-tarjan-bridge.c
mono/metadata/socket-io.c
mono/metadata/threadpool-ms-io-epoll.c
mono/metadata/threadpool-ms-io-kqueue.c
mono/metadata/threadpool-ms-io-poll.c
mono/metadata/threadpool-ms-io.c
mono/metadata/threadpool-ms.c
mono/metadata/threads-types.h
mono/metadata/threads.c
mono/metadata/verify.c
mono/metadata/wrapper-types.h
mono/mini/Makefile.am.in
mono/mini/TestHelpers.cs [new file with mode: 0644]
mono/mini/alias-analysis.c
mono/mini/aot-compiler.c
mono/mini/aot-runtime.c
mono/mini/cpu-amd64.md
mono/mini/debug-mini.c
mono/mini/debugger-agent.c
mono/mini/driver.c
mono/mini/exceptions-arm.c
mono/mini/generics.cs
mono/mini/jit-icalls.c
mono/mini/linear-scan.c
mono/mini/llvm-jit.cpp
mono/mini/main.c
mono/mini/method-to-ir.c
mono/mini/mini-amd64-gsharedvt.c
mono/mini/mini-amd64.c
mono/mini/mini-amd64.h
mono/mini/mini-arm.c
mono/mini/mini-arm.h
mono/mini/mini-exceptions.c
mono/mini/mini-generic-sharing.c
mono/mini/mini-llvm-cpp.cpp
mono/mini/mini-llvm-cpp.h
mono/mini/mini-llvm.c
mono/mini/mini-ops.h
mono/mini/mini-runtime.c
mono/mini/mini-trampolines.c
mono/mini/mini-unwind.h
mono/mini/mini-x86.c
mono/mini/mini-x86.h
mono/mini/mini.c
mono/mini/mini.h
mono/mini/tasklets.c
mono/mini/test_op_il_seq_point.sh
mono/mini/tramp-amd64.c
mono/mini/tramp-arm.c
mono/mini/unwind.c
mono/profiler/Makefile.am
mono/sgen/sgen-archdep.h
mono/sgen/sgen-copy-object.h
mono/sgen/sgen-debug.c
mono/sgen/sgen-fin-weak-hash.c
mono/sgen/sgen-gc.c
mono/sgen/sgen-gc.h
mono/sgen/sgen-gray.c
mono/sgen/sgen-gray.h
mono/sgen/sgen-internal.c
mono/sgen/sgen-los.c
mono/sgen/sgen-marksweep.c
mono/sgen/sgen-minor-copy-object.h
mono/sgen/sgen-minor-scan-object.h
mono/sgen/sgen-protocol.c
mono/sgen/sgen-protocol.h
mono/sgen/sgen-simple-nursery.c
mono/sgen/sgen-split-nursery.c
mono/sgen/sgen-workers.c
mono/sgen/sgen-workers.h
mono/tests/Makefile.am
mono/tests/assemblyresolve/Makefile.am
mono/tests/bug-30085.cs
mono/tests/bug-461867.cs
mono/tests/exception18.cs
mono/tests/gc-graystack-stress.cs
mono/tests/libtest.c
mono/tests/marshal.cs
mono/tests/marshal9.cs
mono/tests/marshalbool.cs
mono/tests/pinvoke2.cs
mono/tests/process-leak.cs
mono/tests/sgen-bridge-pathologies.cs
mono/tests/sgen-toggleref.cs
mono/tests/test-runner.cs
mono/tests/winx64structs.cs
mono/utils/Makefile.am
mono/utils/dlmalloc.c
mono/utils/lock-free-alloc.c
mono/utils/mono-coop-mutex.h
mono/utils/mono-coop-semaphore.h
mono/utils/mono-hwcap-arm.c
mono/utils/mono-logger-internals.h
mono/utils/mono-logger.c
mono/utils/mono-os-mutex.h
mono/utils/mono-os-semaphore.h
mono/utils/mono-publib.c
mono/utils/mono-publib.h
mono/utils/mono-threads-android.c
mono/utils/mono-threads-coop.c
mono/utils/mono-threads-freebsd.c
mono/utils/mono-threads-linux.c
mono/utils/mono-threads-mach-abort-syscall.c
mono/utils/mono-threads-mach.c
mono/utils/mono-threads-netbsd.c [new file with mode: 0644]
mono/utils/mono-threads-openbsd.c
mono/utils/mono-threads-posix-abort-syscall.c
mono/utils/mono-threads-posix.c
mono/utils/mono-threads-windows-abort-syscall.c
mono/utils/mono-threads-windows.c
mono/utils/mono-threads.c
mono/utils/mono-threads.h
mono/utils/w32handle.c [new file with mode: 0644]
mono/utils/w32handle.h [new file with mode: 0644]
msvc/create-windef.pl
msvc/eglib.vcxproj
msvc/libmono-static.vcxproj [new file with mode: 0644]
msvc/libmono-static.vcxproj.filters [new file with mode: 0644]
msvc/libmono.vcxproj
msvc/libmono.vcxproj.filters
msvc/libmonoruntime.vcxproj
msvc/mono.def
msvc/mono.sln
msvc/monosgen.def
msvc/scripts/order.xml
runtime/Makefile.am
samples/embed/teste.c
scripts/ci/babysitter
scripts/ci/run-jenkins.sh
scripts/ci/run-test-acceptance-tests.sh [new file with mode: 0755]
scripts/ci/run-test-default.sh
scripts/ci/run-test-mobile_static.sh
scripts/submodules/versions.mk
scripts/submodules/versions.py
support/map.c
support/sys-mman.c
tools/offsets-tool/MonoAotOffsetsDumper.cs

index 3258779bae5618a8cfb4e68ad84b7959c1b2d9e7..1c359b94f8e393917aa038e93db82479c3cbc9a7 100644 (file)
@@ -38,6 +38,7 @@ obj/
 [Rr]elease*/
 Ankh.NoLoad
 *.gpState
+.vscode/
 
 # Tooling
 _ReSharper*/
index 2025d14474d4528e26bed929d272fa63ededdffa..d084d3948e49230f088e7e875dd49c409901a7b9 100644 (file)
 [submodule "external/nunit-lite"]
        path = external/nunit-lite
        url = git://github.com/mono/NUnitLite.git
+[submodule "external/nuget-buildtasks"]
+       path = external/nuget-buildtasks
+       url = git://github.com/mono/NuGet.BuildTasks
+[submodule "external/buildtools"]
+       path = external/buildtools
+       url = git://github.com/mono/buildtools.git
+[submodule "external/cecil-legacy"]
+       path = external/cecil-legacy
+       url = git://github.com/mono/cecil.git
+       branch = mono-legacy-0.9.5
index 9c6dc7e971457668dc80b31fa3d5d152d9b3f363..aaffb9842ba9dbe36090cead00afe0d1ebe1232d 100644 (file)
@@ -67,9 +67,13 @@ get-monolite-latest:
        cd $(mcslib) && { (wget -O- $(monolite_url) || curl $(monolite_url)) | gzip -d | tar xf - ; }
        cd $(mcslib) && mv -f monolite-* monolite
 
+if BITCODE
+BITCODE_CHECK=yes
+endif
+
 .PHONY: check-ci
 check-ci:
-       MONO_LLVMONLY=$(MONO_LLVMONLY) $(srcdir)/scripts/ci/run-test-$(TEST_PROFILE).sh
+       MONO_LLVMONLY=$(BITCODE_CHECK) $(srcdir)/scripts/ci/run-test-$(TEST_PROFILE).sh
 
 .PHONY: validate do-build-mono-mcs mcs-do-clean mcs-do-tests
 validate: do-build-mono-mcs
index 7fcac6c3e9d9cbc50ff1256f936c19d96c01f72b..8287c176abcc939d505a19034ebe3baa7411df2b 100644 (file)
@@ -18,9 +18,9 @@
   {
     "name": "ms-test-suite", 
     "url": "git@github.com:xamarin/ms-test-suite.git", 
-    "rev": "840653918efed24f00f5e166094f06354cae7255", 
+    "rev": "bcd16462b0b427c582c2b4c81846a42d7ccd527f", 
     "remote-branch": "origin/master", 
     "branch": "master", 
     "directory": "ms-test-suite"
   }
-]
\ No newline at end of file
+]
index 8f75b05470fe46685d232f3a35933dbc1080fc59..1f4be3d1e8fbc9cefb15d72648b5068298d01356 100644 (file)
@@ -262,9 +262,7 @@ CORECLR_TEST_CS_SRC=                \
        $(CORECLR_PATH)/tests/src/JIT/Directed/intrinsic/pow/pow2.cs    \
        $(CORECLR_PATH)/tests/src/JIT/Directed/intrinsic/pow/pow3.cs    \
        $(CORECLR_PATH)/tests/src/JIT/Directed/lifetime/lifetime1.cs    \
-       $(CORECLR_PATH)/tests/src/JIT/Directed/lifetime/lifetime2.cs    \
        $(CORECLR_PATH)/tests/src/JIT/Directed/localloc/localloc3.cs    \
-       $(CORECLR_PATH)/tests/src/JIT/Directed/newarr/newarr.cs \
        $(CORECLR_PATH)/tests/src/JIT/Directed/shift/int16.cs   \
        $(CORECLR_PATH)/tests/src/JIT/Directed/shift/int32.cs   \
        $(CORECLR_PATH)/tests/src/JIT/Directed/shift/int64.cs   \
@@ -1279,7 +1277,6 @@ CORECLR_TEST_CS_SRC=              \
        $(CORECLR_PATH)/tests/src/baseservices/exceptions/regressions/whidbeybeta2/349379/349379.cs     \
        $(CORECLR_PATH)/tests/src/baseservices/exceptions/regressions/whidbeybeta2/366085/366085.cs     \
        $(CORECLR_PATH)/tests/src/baseservices/exceptions/regressions/whidbeym3.3/106011/106011.cs      \
-       $(CORECLR_PATH)/tests/src/baseservices/exceptions/sharedexceptions/emptystacktrace/oomexception01.cs    \
        $(CORECLR_PATH)/tests/src/baseservices/exceptions/simple/finally.cs     \
        $(CORECLR_PATH)/tests/src/baseservices/exceptions/unittests/returnfromcatch.cs  \
        $(CORECLR_PATH)/tests/src/baseservices/regression/v1/threads/functional/threadpool/cs_threadpoolnullchecks/cs_threadpoolnullchecks.cs   \
@@ -4003,6 +4000,15 @@ CORECLR_DISABLED_TEST_CS_SRC +=  \
 # this test makes no sense, the expected pattern is the English one for all cultures
 CORECLR_DISABLED_TEST_CS_SRC += $(CORECLR_PATH)/tests/src/Regressions/coreclr/0584/test584.cs
 
+# Requires precise stack scanning
+CORECLR_DISABLED_TEST_CS_SRC +=        \
+       $(CORECLR_PATH)/tests/src/JIT/Directed/lifetime/lifetime2.cs
+
+# Depends on small array behavior of .net. Mono supports objects > 2Gb on 64bits and the following tests verify for that
+CORECLR_DISABLED_TEST_CS_SRC +=        \
+       $(CORECLR_PATH)/tests/src/JIT/Directed/newarr/newarr.cs \
+          $(CORECLR_PATH)/tests/src/baseservices/exceptions/sharedexceptions/emptystacktrace/oomexception01.cs
+
 CORECLR_TEST_IL_SRC =                  \
        $(CORECLR_PATH)/tests/src/JIT/BBT/Scenario4/Not-Int32.il        \
        $(CORECLR_PATH)/tests/src/JIT/Directed/Convert/implicitConv.il  \
@@ -4073,7 +4079,6 @@ CORECLR_TEST_IL_SRC =                     \
        $(CORECLR_PATH)/tests/src/JIT/Directed/array-il/simple3.il      \
        $(CORECLR_PATH)/tests/src/JIT/Directed/coverage/importer/badendfinally.il       \
        $(CORECLR_PATH)/tests/src/JIT/Directed/coverage/importer/badtailcall.il \
-       $(CORECLR_PATH)/tests/src/JIT/Directed/coverage/importer/byrefsubbyref1.il      \
        $(CORECLR_PATH)/tests/src/JIT/Directed/coverage/importer/calli2.il      \
        $(CORECLR_PATH)/tests/src/JIT/Directed/coverage/importer/ceeillegal.il  \
        $(CORECLR_PATH)/tests/src/JIT/Directed/coverage/importer/ldelemnullarr2.il      \
@@ -4087,14 +4092,12 @@ CORECLR_TEST_IL_SRC =                   \
        $(CORECLR_PATH)/tests/src/JIT/Directed/coverage/importer/volatilldind.il        \
        $(CORECLR_PATH)/tests/src/JIT/Directed/coverage/importer/volatilstind.il        \
        $(CORECLR_PATH)/tests/src/JIT/Directed/coverage/oldtests/arrgetlen.il   \
-       $(CORECLR_PATH)/tests/src/JIT/Directed/coverage/oldtests/lcliimpl.il    \
        $(CORECLR_PATH)/tests/src/JIT/Directed/coverage/oldtests/ldsshrstsfld.il        \
        $(CORECLR_PATH)/tests/src/JIT/Directed/coverage/oldtests/ldvirtftncalli.il      \
        $(CORECLR_PATH)/tests/src/JIT/Directed/coverage/oldtests/ovfldiv2.il    \
        $(CORECLR_PATH)/tests/src/JIT/Directed/coverage/oldtests/ovflrem2.il    \
        $(CORECLR_PATH)/tests/src/JIT/Directed/coverage/oldtests/stfldstatic1.il        \
        $(CORECLR_PATH)/tests/src/JIT/Directed/coverage/oldtests/stfldstatic2.il        \
-       $(CORECLR_PATH)/tests/src/JIT/Directed/coverage/oldtests/subbyref.il    \
        $(CORECLR_PATH)/tests/src/JIT/Directed/coverage/oldtests/switchdefaultonly1.il  \
        $(CORECLR_PATH)/tests/src/JIT/Directed/coverage/oldtests/switchdefaultonly2.il  \
        $(CORECLR_PATH)/tests/src/JIT/Directed/coverage/oldtests/switchdefaultonly3.il  \
@@ -5118,6 +5121,21 @@ CORECLR_DISABLED_TEST_IL_SRC +=                  \
        $(CORECLR_PATH)/tests/src/JIT/Regression/CLR-x86-JIT/V1-M09.5-PDC/b28901/b28901.il      \
        $(CORECLR_PATH)/tests/src/JIT/Regression/clr-x64-JIT/v2.1/b173569/b173569.il
 
+
+# Bad test that tries an implicit cast from int32 to byref
+CORECLR_DISABLED_TEST_IL_SRC +=        \
+       $(CORECLR_PATH)/tests/src/JIT/Directed/coverage/importer/byrefsubbyref1.il
+
+# Bad test that tries to implicit cast from bytef to int32
+CORECLR_DISABLED_TEST_IL_SRC +=        \
+       $(CORECLR_PATH)/tests/src/JIT/Directed/coverage/oldtests/subbyref.il
+
+# Bad test that tries to assign a byref to a class to a byref of an interface that class implements
+# This is unsafe because the byref is mutable and would allow you to store the wrong type on that cell.
+CORECLR_DISABLED_TEST_IL_SRC +=        \
+       $(CORECLR_PATH)/tests/src/JIT/Directed/coverage/oldtests/lcliimpl.il
+
+       
 # find all CoreCLR *.il test files that aren't mentioned in this file
 CORECLR_DEFINED_IL_SRC = $(CORECLR_TEST_IL_SRC) $(CORECLR_DISABLED_TEST_IL_SRC)
 CORECLR_UPSTREAM_IL_SRC=$(shell find "$(CORECLR_PATH)/tests" -iname "*.il")
index c1c16199481352d873f6df2c7a077a43197dcbe3..bd85bd494bd3b5e960de1e90ffc6c07330dbeb88 100644 (file)
@@ -1,10 +1,10 @@
 check-ms-test-suite:
        @if $(MAKE) validate-ms-test-suite RESET_VERSIONS=1; then \
-               $(MAKE) -C $(MSTESTSUITE_PATH)/conformance build MCS="$(MCS) -t:library -warn:1 -r:nunit.framework" && \
+               $(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)/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
\ No newline at end of file
+       fi
index fbfa2760ec2744588adbfb251e67a2a4adf3ae23..a91c68d986b5a97720963c05258a82354cc7efa8 100644 (file)
@@ -4,17 +4,11 @@ check-roslyn:
        sed -i -e 's/\\4.5-api"/\\4.5"/g' $$PREFIX/lib/mono/xbuild-frameworks/.NETFramework/v4.5/RedistList/FrameworkList.xml; \
        export MSBuildExtensionsPath=$$PREFIX/lib/mono/xbuild; \
        MONO_DOTNET_PORTABLE_DIR=$$PREFIX/lib/mono/xbuild-frameworks/.NETPortable/; \
-       MONO_NUGET_TARGETS_DIR=$$PREFIX/lib/mono/xbuild/Microsoft/NuGet/; \
-       MONO_PORTABLE_TARGETS_DIR=$$PREFIX/lib/mono/xbuild/Microsoft/Portable/v5.0; \
-       if [ ! -d "$$MONO_DOTNET_PORTABLE_DIR/v5.0" ]; then \
+       if [ ! -d "$$MONO_DOTNET_PORTABLE_DIR/v4.6" ]; then \
                mkdir -p $$MONO_DOTNET_PORTABLE_DIR; \
-               mkdir -p $$MONO_NUGET_TARGETS_DIR; \
-               mkdir -p $$MONO_PORTABLE_TARGETS_DIR; \
                curl -SL "http://download.mono-project.com/third-party/RoslynBuildDependencies.zip" > /tmp/RoslynBuildDependencies.zip; \
                unzip -o /tmp/RoslynBuildDependencies.zip -d /tmp/RoslynBuildDependencies; \
                cp -r /tmp/RoslynBuildDependencies/PortableReferenceAssemblies/* $$MONO_DOTNET_PORTABLE_DIR; \
-               cp /tmp/RoslynBuildDependencies/NuGetTargets/* $$MONO_NUGET_TARGETS_DIR; \
-               cp /tmp/RoslynBuildDependencies/PortableTargets/* $$MONO_PORTABLE_TARGETS_DIR; \
        fi; \
        cd $(ROSLYN_PATH); \
        sed -i -e 'N; s/bootstrapArg=".*\n.*"/bootstrapArg=""/g' cibuild.sh; \
index 491b67e11ce18921c10b7d20e73767d5eb3db52a..84b4f85c6cdc1dd693b8a41f339693b0fb73fecf 100644 (file)
@@ -1,5 +1,6 @@
 .PHONY: validate-versions reset-versions
 
+SUBMODULES_CONFIG_FILE = $(top_srcdir)/acceptance-tests/SUBMODULES.json
 include $(top_srcdir)/scripts/submodules/versions.mk
 
 $(eval $(call ValidateVersionTemplate,roslyn,ROSLYN))
index 0930a431abaebcf0602fcbe87ccb18c85f26865b..924acc99cdbbc681fa194f859aa9fc50b36e8dea 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.5.2],
+AC_INIT(mono, [4.7.0],
         [http://bugzilla.xamarin.com/enter_bug.cgi?classification=Mono])
 
 AC_CONFIG_SRCDIR([README.md])
@@ -353,6 +353,18 @@ AM_CONDITIONAL(PLATFORM_DARWIN, test x$host_darwin = xyes)
 AM_CONDITIONAL(PLATFORM_SIGPOSIX, test x$use_sigposix = xyes)
 AM_CONDITIONAL(PLATFORM_ANDROID, test x$platform_android = xyes)
 
+if test -z "$PLATFORM_DARWIN_TRUE"; then :
+PLATFORM_AOT_SUFFIX=.dylib
+fi
+
+if test -z "$PLATFORM_LINUX_TRUE"; then :
+PLATFORM_AOT_SUFFIX=.so
+fi
+
+AC_SUBST(PLATFORM_AOT_SUFFIX)
+
+## PLATFORM_AOT_SUFFIX not so simple for windows :-)
+
 AC_CHECK_TOOL(CC, gcc, gcc)
 AC_PROG_CC
 AC_CHECK_TOOL(CXX, g++, g++)
@@ -520,6 +532,9 @@ 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
@@ -748,6 +763,8 @@ dnl
 TEST_PROFILE=default
 enable_llvm_default=no
 
+INVARIANT_AOT_OPTIONS=nimt-trampolines=900,ntrampolines=8000,nrgctx-fetch-trampolines=256,ngsharedvt-trampolines=2800
+
 if test x$cross_compiling = xyes -o x$enable_mcs_build = xno; then
    DISABLE_MCS_DOCS_default=yes
    with_profile4_x_default=no
@@ -777,7 +794,7 @@ elif test x$with_runtime_preset = xall; then
    with_monotouch_watch_default=yes
    with_monotouch_tv_default=yes
    with_xammac_default=yes
-   with_mobile_static_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
@@ -792,6 +809,15 @@ elif test x$with_runtime_preset = xmobile_static; then
    with_bitcode_default=no
    with_cooperative_gc_default=no
    TEST_PROFILE=mobile_static 
+
+   mono_feature_disable_com='yes'
+   mono_feature_disable_remoting='yes'
+   mono_feature_disable_reflection_emit_save='yes'
+   mono_feature_disable_reflection_emit='yes'
+   mono_feature_disable_appdomains='yes'
+
+   AOT_BUILD_FLAGS="-O=gsharedvt --aot=full,$INVARIANT_AOT_OPTIONS"
+   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
@@ -805,7 +831,15 @@ elif test x$with_runtime_preset = xbitcode_mobile_static; then
    with_cooperative_gc_default=yes
    TEST_PROFILE=mobile_static 
    enable_llvm_default=yes
-   MONO_LLVMONLY=yes
+
+   mono_feature_disable_com='yes'
+   mono_feature_disable_remoting='yes'
+   mono_feature_disable_reflection_emit_save='yes'
+   mono_feature_disable_reflection_emit='yes'
+   mono_feature_disable_appdomains='yes'
+
+   AOT_BUILD_FLAGS="--aot=llvmonly,$INVARIANT_AOT_OPTIONS"
+   AOT_RUN_FLAGS="--llvmonly"
 else
    with_profile4_x_default=yes
    with_monodroid_default=no
@@ -818,6 +852,13 @@ else
    with_cooperative_gc_default=no
 fi
 
+if test "x$AOT_BUILD_FLAGS" != "x"; then :
+   AC_SUBST(AOT_BUILD_FLAGS)
+   AC_SUBST(AOT_RUN_FLAGS)
+   # For llvmonlycheck + fullaotcheck
+   AC_SUBST(INVARIANT_AOT_OPTIONS)
+fi
+
 AC_SUBST(TEST_PROFILE)
 
 if test "x$with_profile4_x" = "xdefault"; then
@@ -854,9 +895,7 @@ AM_CONDITIONAL(BITCODE, test "x$with_bitcode" = "xyes")
 AM_CONDITIONAL(INSTALL_XAMMAC, [test "x$with_xammac" != "xno"])
 AM_CONDITIONAL(INSTALL_MOBILE_STATIC, [test "x$with_mobile_static" != "xno"])
 
-AC_SUBST(MONO_LLVMONLY)
-
-AC_SUBST(BITCODE)
+AC_SUBST(INSTALL_MOBILE_STATIC)
 
 default_profile=net_4_x
 if test -z "$INSTALL_MONODROID_TRUE"; then :
@@ -4204,6 +4243,10 @@ fi
       echo "PLATFORM = darwin" >> $mcs_topdir/build/config.make
     fi
 
+    if test "x$PLATFORM_AOT_SUFFIX" != "x"; then
+      echo "PLATFORM_AOT_SUFFIX = $PLATFORM_AOT_SUFFIX" >> $mcs_topdir/build/config.make
+    fi
+
        if test x$AOT_SUPPORTED = xyes -a x$enable_system_aot = xdefault; then
           enable_system_aot=yes
        fi
@@ -4226,8 +4269,9 @@ fi
       echo "BCL_OPTIMIZE = 1" >> $srcdir/$mcsdir/build/config.make
     fi
 
-    if test "x$MONO_LLVMONLY" = "xyes" ; then
-      echo "MONO_LLVMONLY = 1" >> $srcdir/$mcsdir/build/config.make
+    if test "x$AOT_BUILD_FLAGS" != "x" ; then
+      echo "AOT_RUN_FLAGS=$AOT_RUN_FLAGS" >> $srcdir/$mcsdir/build/config.make
+      echo "AOT_BUILD_FLAGS=$AOT_BUILD_FLAGS" >> $srcdir/$mcsdir/build/config.make
     fi
 
   fi
index 7622701ef455e81d8ce977db10503d84da267ba9..a33dcb846b2746e4f47275e54c43280cfa982e1c 100644 (file)
@@ -138,6 +138,15 @@ AC_CHECK_FUNCS(strlcpy stpcpy strtok_r rewinddir vasprintf)
 AC_CHECK_FUNCS(getrlimit)
 AC_CHECK_FUNCS(fork execv execve)
 
+AC_ARG_WITH([overridable-allocators], [  --with-overridable-allocators allow g_*alloc/g_free to call custom allocators set via g_mem_set_vtable])
+
+if test x$with_overridable_allocators = xyes; then
+       AC_DEFINE(ENABLE_OVERRIDABLE_ALLOCATORS,1,[Overridable allocator support enabled])
+  AC_MSG_NOTICE([Overridable allocator support enabled])
+else
+  AC_MSG_NOTICE([Overridable allocator support disabled])
+fi
+
 #
 # Mono currently supports 10.6, but strndup is not available prior to 10.7; avoiding
 # the detection of strndup on OS X so Mono built on 10.7+ still runs on 10.6. This can be
@@ -151,7 +160,7 @@ elif test x$target_ios = xno; then
 AC_CHECK_FUNCS(strndup getpwuid_r)
 fi
 
-AM_CONDITIONAL(NEED_VASPRINTF, test x$ac_cv_func_vasprintf = xno )
+AM_CONDITIONAL(NEED_VASPRINTF, test x$ac_cv_func_vasprintf = xno || test x$with_overridable_allocators = xyes)
 AM_ICONV()
 AC_SEARCH_LIBS(sqrtf, m)
 
index 31771dfd9a19dab5f0af901207d869f5160264b2..1527ba26d30452bb70aa7403d6cbc1281ad5ec78 100644 (file)
@@ -11,14 +11,6 @@ unix_files = \
        gdate-unix.c  gdir-unix.c  gfile-unix.c  gmisc-unix.c   \
        gmodule-unix.c gtimer-unix.c
 
-# some unices and windows do not have an implementation of vasprintf
-# used by eglib, use provided implementation instead
-if NEED_VASPRINTF
-vasprintf_files = vasprintf.c
-else
-vaprinttf_files = foo.c
-endif
-
 if HOST_WIN32
 os_files = $(win_files)
 else
@@ -32,7 +24,6 @@ libeglib_la_SOURCES = \
        garray.c        \
        gbytearray.c    \
        gerror.c        \
-       vasprintf.h     \
        ghashtable.c    \
        giconv.c        \
        gmem.c          \
@@ -55,8 +46,7 @@ libeglib_la_SOURCES = \
        gutf8.c         \
        gunicode.c      \
        unicode-data.h  \
-       $(os_files)     \
-       $(vasprintf_files)
+       $(os_files)
 
 libeglib_la_CFLAGS = -g -Wall -D_FORTIFY_SOURCE=2
 
index 2ec089c9956c1053c96bd0b8ea441d2881d54800..43fef97cc434c1a67daa1df2c8e5a8b98f97b439 100644 (file)
 #include <stdio.h>
 #include <stdarg.h>
 #include <string.h>
+#include <config.h>
 #include <glib.h>
-
-#include "vasprintf.h"
-
 GError *
 g_error_new (gpointer domain, gint code, const char *format, ...)
 {
@@ -42,7 +40,7 @@ g_error_new (gpointer domain, gint code, const char *format, ...)
        err->code = code;
 
        va_start (args, format);
-       if (vasprintf (&err->message, format, args) == -1)
+       if (g_vasprintf (&err->message, format, args) == -1)
                err->message = g_strdup_printf ("internal: invalid format string %s", format); 
        va_end (args);
 
@@ -57,7 +55,7 @@ g_error_vnew (gpointer domain, gint code, const char *format, va_list ap)
        err->domain = domain;
        err->code = code;
 
-       if (vasprintf (&err->message, format, ap) == -1)
+       if (g_vasprintf (&err->message, format, ap) == -1)
                err->message = g_strdup_printf ("internal: invalid format string %s", format); 
 
        return err;
@@ -77,7 +75,7 @@ g_error_free (GError *error)
 {
        g_return_if_fail (error != NULL);
        
-       free (error->message);
+       g_free (error->message);
        g_free (error);
 }
 
index a6f222dfe8727421adf50308e7f6a11638144715..c7723fef5b47bfe9bde22496e2d994fe2805199f 100644 (file)
@@ -199,8 +199,11 @@ g_iconv (GIConv cd, gchar **inbytes, gsize *inbytesleft,
                } else {
                        outleftptr = NULL;
                }
-               
+#if defined(__NetBSD__)
+               return iconv (cd->cd, (const gchar **)inbytes, inleftptr, outbytes, outleftptr);
+#else
                return iconv (cd->cd, inbytes, inleftptr, outbytes, outleftptr);
+#endif
        }
 #endif
        
index 72770b2f44fab3fae7b0a5312b83d802df98524e..23781c168526edd95498a3260697cbd76af23ff6 100644 (file)
@@ -1,6 +1,5 @@
 #ifndef __GLIB_H
 #define __GLIB_H
-
 #include <stdarg.h>
 #include <stdlib.h>
 #include <string.h>
@@ -9,6 +8,7 @@
 #include <ctype.h>
 #include <limits.h>
 
+
 #ifdef _MSC_VER
 #pragma include_alias(<eglib-config.h>, <eglib-config.hw>)
 #endif
@@ -126,6 +126,7 @@ void g_free (void *ptr);
 gpointer g_realloc (gpointer obj, gsize size);
 gpointer g_malloc (gsize x);
 gpointer g_malloc0 (gsize x);
+gpointer g_calloc (gsize n, gsize x);
 gpointer g_try_malloc (gsize x);
 gpointer g_try_realloc (gpointer obj, gsize size);
 
@@ -138,7 +139,7 @@ gpointer g_try_realloc (gpointer obj, gsize size);
 #define g_alloca(size)         alloca (size)
 
 gpointer g_memdup (gconstpointer mem, guint byte_size);
-static inline gchar   *g_strdup (const gchar *str) { if (str) {return strdup (str);} return NULL; }
+static inline gchar   *g_strdup (const gchar *str) { if (str) { return (gchar*) g_memdup (str, (guint)strlen (str) + 1); } return NULL; }
 gchar **g_strdupv (gchar **str_array);
 
 typedef struct {
@@ -146,11 +147,9 @@ typedef struct {
        gpointer (*realloc)     (gpointer mem, gsize n_bytes);
        void     (*free)        (gpointer mem);
        gpointer (*calloc)      (gsize    n_blocks, gsize n_block_bytes);
-       gpointer (*try_malloc)  (gsize    n_bytes);
-       gpointer (*try_realloc) (gpointer mem, gsize n_bytes);
 } GMemVTable;
 
-#define g_mem_set_vtable(x)
+void g_mem_set_vtable (GMemVTable* vtable);
 
 struct _GMemChunk {
        guint alloc_size;
@@ -223,11 +222,11 @@ gint         g_printf          (gchar const *format, ...);
 gint         g_fprintf         (FILE *file, gchar const *format, ...);
 gint         g_sprintf         (gchar *string, gchar const *format, ...);
 gint         g_snprintf        (gchar *string, gulong n, gchar const *format, ...);
+gint         g_vasprintf       (gchar **ret, const gchar *fmt, va_list ap);
 #define g_vprintf vprintf
 #define g_vfprintf vfprintf
 #define g_vsprintf vsprintf
 #define g_vsnprintf vsnprintf
-#define g_vasprintf vasprintf
 
 gsize   g_strlcpy            (gchar *dest, const gchar *src, gsize dest_size);
 gchar  *g_stpcpy             (gchar *dest, const char *src);
@@ -772,6 +771,8 @@ const gchar *g_get_user_name   (void);
 gchar *g_get_prgname           (void);
 void  g_set_prgname            (const gchar *prgname);
 
+gboolean g_ensure_directory_exists (const gchar *filename);
+
 /*
  * Shell
  */
index 6a0b246a957bb00a0f814f03948eea3d107e969a..4e6c6641fef542ac4fb758a51d27281baf556340 100644 (file)
@@ -367,7 +367,7 @@ g_markup_parse_context_parse (GMarkupParseContext *context,
                                if (context->parser.end_element != NULL &&  context->state == START_ELEMENT){
                                        context->parser.end_element (context, ename, context->user_data, error);
                                        if (error != NULL && *error != NULL){
-                                               free (ename);
+                                               g_free (ename);
                                                goto fail;
                                        }
                                }
index 565239d1cb81a476030b895e2326d5614441b6b5..eff478dcbfad01f9ee41cc709a90342a6b3d2550 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 <stdio.h>
 #include <string.h>
 #include <glib.h>
 
+#if defined (ENABLE_OVERRIDABLE_ALLOCATORS)
+
+static GMemVTable sGMemVTable = { malloc, realloc, free, calloc };
+
+void
+g_mem_set_vtable (GMemVTable* vtable)
+{
+       sGMemVTable.calloc = vtable->calloc ? vtable->calloc : calloc;
+       sGMemVTable.realloc = vtable->realloc ? vtable->realloc : realloc;
+       sGMemVTable.malloc = vtable->malloc ? vtable->malloc : malloc;
+       sGMemVTable.free = vtable->free ? vtable->free : free;
+}
+
+#define G_FREE_INTERNAL sGMemVTable.free
+#define G_REALLOC_INTERNAL sGMemVTable.realloc
+#define G_CALLOC_INTERNAL sGMemVTable.calloc
+#define G_MALLOC_INTERNAL sGMemVTable.malloc
+#else
+
+void
+g_mem_set_vtable (GMemVTable* vtable)
+{
+}
+
+#define G_FREE_INTERNAL free
+#define G_REALLOC_INTERNAL realloc
+#define G_CALLOC_INTERNAL calloc
+#define G_MALLOC_INTERNAL malloc
+#endif
 void
 g_free (void *ptr)
 {
        if (ptr != NULL)
-               free (ptr);
+               G_FREE_INTERNAL (ptr);
 }
 
 gpointer
@@ -58,7 +88,7 @@ gpointer g_realloc (gpointer obj, gsize size)
                g_free (obj);
                return 0;
        }
-       ptr = realloc (obj, size);
+       ptr = G_REALLOC_INTERNAL (obj, size);
        if (ptr)
                return ptr;
        g_error ("Could not allocate %i bytes", size);
@@ -70,27 +100,31 @@ g_malloc (gsize x)
        gpointer ptr;
        if (!x)
                return 0;
-       ptr = malloc (x);
+       ptr = G_MALLOC_INTERNAL (x);
        if (ptr) 
                return ptr;
        g_error ("Could not allocate %i bytes", x);
 }
 
+gpointer g_calloc (gsize n, gsize x)
+{
+       gpointer ptr;
+       if (!x || !n)
+               return 0;
+               ptr = G_CALLOC_INTERNAL (n, x);
+       if (ptr)
+               return ptr;
+       g_error ("Could not allocate %i (%i * %i) bytes", x*n, n, x);
+}
 gpointer g_malloc0 (gsize x) 
 { 
-       gpointer ptr; 
-       if (!x) 
-               return 0; 
-       ptr = calloc(1,x); 
-       if (ptr) 
-               return ptr; 
-       g_error ("Could not allocate %i bytes", x);
+       return g_calloc (1,x);
 }
 
 gpointer g_try_malloc (gsize x) 
 {
        if (x)
-               return malloc (x);
+               return G_MALLOC_INTERNAL (x);
        return 0;
 }
 
@@ -98,8 +132,8 @@ gpointer g_try_malloc (gsize x)
 gpointer g_try_realloc (gpointer obj, gsize size)
 { 
        if (!size) {
-               g_free (obj);
+               G_FREE_INTERNAL (obj);
                return 0;
        } 
-       return realloc (obj, size);
+       return G_REALLOC_INTERNAL (obj, size);
 }
index f89f37c22049a780451ff55dcb4d3369ce8d1d10..9486aff07e3e7fbb7c26cadf328bff24b7bd3b2a 100644 (file)
@@ -89,10 +89,10 @@ g_win32_getlocale(void)
 {
        LCID lcid = GetThreadLocale();
        gchar buf[19];
-       gint ccBuf = GetLocaleInfo(lcid, LOCALE_SISO639LANGNAME, buf, 9);
+       gint ccBuf = GetLocaleInfoA(lcid, LOCALE_SISO639LANGNAME, buf, 9);
        buf[ccBuf - 1] = '-';
-       ccBuf += GetLocaleInfo(lcid, LOCALE_SISO3166CTRYNAME, buf + ccBuf, 9);
-       return strdup(buf);
+       ccBuf += GetLocaleInfoA(lcid, LOCALE_SISO3166CTRYNAME, buf + ccBuf, 9);
+       return g_strdup (buf);
 }
 
 gboolean
@@ -128,6 +128,9 @@ g_get_home_dir (void)
                }
        }
 
+       g_free (drive);
+       g_free (path);
+
        return home_dir;
 }
 
index 779ca96fd217b697b37de49e4fe927d7adc9f478..ef80cff034748e559dea3055bc3bfb175dc3eb76 100644 (file)
@@ -31,8 +31,6 @@
 #include <stdlib.h>
 #include <glib.h>
 
-#include "vasprintf.h"
-
 /* The current fatal levels, error is always fatal */
 static GLogLevelFlags fatal = G_LOG_LEVEL_ERROR;
 static GLogFunc default_log_func;
@@ -49,7 +47,7 @@ g_print (const gchar *format, ...)
        va_list args;
 
        va_start (args, format);
-       if (vasprintf (&msg, format, args) < 0)
+       if (g_vasprintf (&msg, format, args) < 0)
                return;
        va_end (args);
 
@@ -57,7 +55,7 @@ g_print (const gchar *format, ...)
                stdout_handler = default_stdout_handler;
 
        stdout_handler (msg);
-       free (msg);
+       g_free (msg);
 }
 
 void
@@ -67,7 +65,7 @@ g_printerr (const gchar *format, ...)
        va_list args;
 
        va_start (args, format);
-       if (vasprintf (&msg, format, args) < 0)
+       if (g_vasprintf (&msg, format, args) < 0)
                return;
        va_end (args);
 
@@ -75,7 +73,7 @@ g_printerr (const gchar *format, ...)
                stderr_handler = default_stderr_handler;
 
        stderr_handler (msg);
-       free (msg);
+       g_free (msg);
 }
 
 GLogLevelFlags
@@ -107,11 +105,11 @@ g_logv (const gchar *log_domain, GLogLevelFlags log_level, const gchar *format,
        if (!default_log_func)
                default_log_func = g_log_default_handler;
        
-       if (vasprintf (&msg, format, args) < 0)
+       if (g_vasprintf (&msg, format, args) < 0)
                return;
 
        default_log_func (log_domain, log_level, msg, default_log_func_user_data);
-       free (msg);
+       g_free (msg);
 }
 
 void
index 5302f427925453496b43d0b4babb88daacbd9bf1..59f5923125bffef92db3ff085e4d4ac12773cbd6 100644 (file)
@@ -29,6 +29,7 @@
 #include <stdio.h>
 #include <glib.h>
 #include <errno.h>
+#include <sys/stat.h>
 
 #ifdef G_OS_WIN32
 #include <direct.h> 
@@ -294,3 +295,95 @@ g_get_prgname (void)
 {
        return name;
 }
+
+gboolean
+g_ensure_directory_exists (const gchar *filename)
+{
+#ifdef G_OS_WIN32
+       gchar *dir_utf8 = g_path_get_dirname (filename);
+       gunichar2 *p;
+       gunichar2 *dir_utf16 = NULL;
+       int retval;
+       
+       if (!dir_utf8 || !dir_utf8 [0])
+               return FALSE;
+
+       dir_utf16 = g_utf8_to_utf16 (dir_utf8, strlen (dir_utf8), NULL, NULL, NULL);
+       g_free (dir_utf8);
+
+       if (!dir_utf16)
+               return FALSE;
+
+       p = dir_utf16;
+
+       /* make life easy and only use one directory seperator */
+       while (*p != '\0')
+       {
+               if (*p == '/')
+                       *p = '\\';
+               p++;
+       }
+
+       p = dir_utf16;
+
+       /* get past C:\ )*/
+       while (*p++ != '\\')    
+       {
+       }
+
+       while (1) {
+               gboolean bRet = FALSE;
+               p = wcschr (p, '\\');
+               if (p)
+                       *p = '\0';
+               retval = _wmkdir (dir_utf16);
+               if (retval != 0 && errno != EEXIST) {
+                       g_free (dir_utf16);
+                       return FALSE;
+               }
+               if (!p)
+                       break;
+               *p++ = '\\';
+       }
+       
+       g_free (dir_utf16);
+       return TRUE;
+#else
+       char *p;
+       gchar *dir = g_path_get_dirname (filename);
+       int retval;
+       struct stat sbuf;
+       
+       if (!dir || !dir [0]) {
+               g_free (dir);
+               return FALSE;
+       }
+       
+       if (stat (dir, &sbuf) == 0 && S_ISDIR (sbuf.st_mode)) {
+               g_free (dir);
+               return TRUE;
+       }
+       
+       p = dir;
+       while (*p == '/')
+               p++;
+
+       while (1) {
+               p = strchr (p, '/');
+               if (p)
+                       *p = '\0';
+               retval = mkdir (dir, 0777);
+               if (retval != 0 && errno != EEXIST) {
+                       g_free (dir);
+                       return FALSE;
+               }
+               if (!p)
+                       break;
+               *p++ = '/';
+       }
+       
+       g_free (dir);
+       return TRUE;
+#endif
+}
+
index 3e976c5a2edfe3019a294daad9f45d355f7da250..8b64da572f69967e7c17f459cafcf2beb2b8e55c 100644 (file)
 #include <ctype.h>
 #include <glib.h>
 
-#include "vasprintf.h"
+/* 
+ * g_strndup and g_vasprintf need to allocate memory with g_malloc if 
+ * ENABLE_OVERRIDABLE_ALLOCATORS is defined so that it can be safely freed with g_free 
+ * rather than free.
+ */
 
 /* This is not a macro, because I dont want to put _GNU_SOURCE in the glib.h header */
 gchar *
 g_strndup (const gchar *str, gsize n)
 {
-#ifdef HAVE_STRNDUP
+#if defined (HAVE_STRNDUP) && !defined (ENABLE_OVERRIDABLE_ALLOCATORS)
        return strndup (str, n);
 #else
        if (str) {
@@ -52,6 +56,37 @@ g_strndup (const gchar *str, gsize n)
 #endif
 }
 
+gint g_vasprintf (gchar **ret, const gchar *fmt, va_list ap)
+{
+#if defined (HAVE_VASPRINTF) && !defined (ENABLE_OVERRIDABLE_ALLOCATORS)
+  return vasprintf (ret, fmt, ap);
+#else
+       char *buf;
+       int len;
+       size_t buflen;
+       va_list ap2;
+       
+#if defined(_MSC_VER) || defined(__MINGW64_VERSION_MAJOR)
+       ap2 = ap;
+       len = _vscprintf(fmt, ap2); // NOTE MS specific extension ( :-( )
+#else
+       va_copy(ap2, ap);
+       len = vsnprintf(NULL, 0, fmt, ap2);
+#endif
+
+       if (len >= 0 && (buf = g_malloc ((buflen = (size_t) (len + 1)))) != NULL) {
+               len = vsnprintf(buf, buflen, fmt, ap);
+               *ret = buf;
+       } else {
+               *ret = NULL;
+               len = -1;
+       }
+
+       va_end(ap2);
+       return len;
+#endif
+}
+
 void
 g_strfreev (gchar **str_array)
 {
@@ -133,7 +168,7 @@ g_strdup_vprintf (const gchar *format, va_list args)
        int n;
        char *ret;
        
-       n = vasprintf (&ret, format, args);
+       n = g_vasprintf (&ret, format, args);
        if (n == -1)
                return NULL;
 
@@ -148,7 +183,7 @@ g_strdup_printf (const gchar *format, ...)
        int n;
 
        va_start (args, format);
-       n = vasprintf (&ret, format, args);
+       n = g_vasprintf (&ret, format, args);
        va_end (args);
        if (n == -1)
                return NULL;
diff --git a/eglib/src/vasprintf.c b/eglib/src/vasprintf.c
deleted file mode 100644 (file)
index 3c21ca4..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-int vasprintf(char **ret, const char *fmt, va_list ap)
-{
-       char *buf;
-       int len;
-       size_t buflen;
-       va_list ap2;
-       
-#if defined(_MSC_VER) || defined(__MINGW64_VERSION_MAJOR)
-       ap2 = ap;
-       len = _vscprintf(fmt, ap2); // NOTE MS specific extension ( :-( )
-#else
-       va_copy(ap2, ap);
-       len = vsnprintf(NULL, 0, fmt, ap2);
-#endif
-       
-       if (len >= 0 && (buf = malloc ((buflen = (size_t) (len + 1)))) != NULL) {
-               len = vsnprintf(buf, buflen, fmt, ap);
-               *ret = buf;
-       } else {
-               *ret = NULL;
-               len = -1;
-       }
-       
-       va_end(ap2);
-       return len;
-}
-
diff --git a/eglib/src/vasprintf.h b/eglib/src/vasprintf.h
deleted file mode 100644 (file)
index 3d29454..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef __VASPRINTF_H
-#define __VASPRINTF_H
-
-#include <stdarg.h>
-#include <config.h>
-
-#ifndef HAVE_VASPRINTF
-int vasprintf(char **ret, const char *fmt, va_list ap);
-#endif
-
-#endif /* __VASPRINTF_H */
index 6dd7bf47469a891c8ca708bf157b99f04936fd02..7c870e9c7665a3a074cf4763ca3ed33271b90716 100644 (file)
 #include "test.h"
 
 extern gint global_passed, global_tests;
-
-#ifndef HAVE_VASPRINTF
-  /* systen does not provide a vasprintf function, use the one
-     provided within eglib itself */
-extern int vasprintf(char **ret, const char *format, va_list ap);
-#endif
-
 static gchar *last_result = NULL;
 
 gboolean 
@@ -183,7 +176,7 @@ FAILED(const gchar *format, ...)
        return NULL;
 #else
        va_start(args, format);
-       n = vasprintf(&ret, format, args);
+       n = g_vasprintf(&ret, format, args);
        va_end(args);
 
        if(n == -1) {
index fcb307420252a6ce2f132dbb4502a0f00747e8ad..de108cd39453ff4accc0967b7ae2490b43a79c30 160000 (submodule)
@@ -1 +1 @@
-Subproject commit fcb307420252a6ce2f132dbb4502a0f00747e8ad
+Subproject commit de108cd39453ff4accc0967b7ae2490b43a79c30
diff --git a/external/buildtools b/external/buildtools
new file mode 160000 (submodule)
index 0000000..a7dbffc
--- /dev/null
@@ -0,0 +1 @@
+Subproject commit a7dbffc17d029f2d66f56ddc9f50349a1bc0dcfe
index 33d50b874fd527118bc361d83de3d494e8bb55e1..ea18396c86ab3f8ba5d0fcd9ada9e066bd4f9f92 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 33d50b874fd527118bc361d83de3d494e8bb55e1
+Subproject commit ea18396c86ab3f8ba5d0fcd9ada9e066bd4f9f92
diff --git a/external/cecil-legacy b/external/cecil-legacy
new file mode 160000 (submodule)
index 0000000..33d50b8
--- /dev/null
@@ -0,0 +1 @@
+Subproject commit 33d50b874fd527118bc361d83de3d494e8bb55e1
diff --git a/external/nuget-buildtasks b/external/nuget-buildtasks
new file mode 160000 (submodule)
index 0000000..04bdab5
--- /dev/null
@@ -0,0 +1 @@
+Subproject commit 04bdab55d8de9edcf628694cfd2001561e8f8e60
index 7065bc89e8661cad447140752c0fce118644e06e..e4c2696aa3f6d67b065ae491b27217dcfe503732 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 7065bc89e8661cad447140752c0fce118644e06e
+Subproject commit e4c2696aa3f6d67b065ae491b27217dcfe503732
index 8c8e0981dd6e236f531abd538290c5cd11865bed..191e4b4ed7d06a8ea02f73a38ea84b941fc758c5 100644 (file)
@@ -26,7 +26,7 @@
 #     define __KERNEL__
 #     include <asm/signal.h>
 #     undef __KERNEL__
-#   else
+#   elif defined(__GLIBC__)
       /* Kernels prior to 2.1.1 defined struct sigcontext_struct instead of */
       /* struct sigcontext.  libc6 (glibc2) uses "struct sigcontext" in     */
       /* prototypes, so we have to include the top-level sigcontext.h to    */
index e8004bf5cb934c30915bc9888eb71ce12d2a7b82..cda2a5762f980cede02751fd2efbf9eb32ef2233 100644 (file)
@@ -7,6 +7,7 @@
 
 LLVM_PATH=llvm
 
+SUBMODULES_CONFIG_FILE = $(top_srcdir)/llvm/SUBMODULES.json
 include $(top_srcdir)/scripts/submodules/versions.mk
 
 $(eval $(call ValidateVersionTemplate,llvm,LLVM))
index e5f8ee54d3206f96eec2e73a2567b2ec9d7bd055..e386b3d804d7587d0b33e9c309ef94848236d58d 100644 (file)
@@ -9,26 +9,23 @@
 mono-symbolicate \- Mono Symbolicate Tool
 .SH SYNOPSIS
 .PP
-.B mono-symbolicate exefile stacktracesfile [directories...]
+.B mono-symbolicate <msym dir> <input file>
+.PP
+.B mono-symbolicate store-symbols <msym dir> [<dir>]+
 .SH DESCRIPTION
 mono-symbolicate is a tool that converts a stack trace with <filename unknown>:0
 into one with file names and line numbers.
 .PP
-The output of calling this tool will be the provided
-.I stacktracesfile
-where <filename unknown>:0 parts are replaced by
-a file name and a line number.
+When mono-symbolicate is called with a symbol directory and a file containing a stacktrace:
+.P
+.B mono-symbolicate <msym dir> <input file>
 .PP
-For the tool to work it needs to load referenced assemblies, it will first look
-in the same folder as
-.I exefile
-then from one of the provided
-.I directories.
+The tool writes into stdout the file contents while adding file location to stack frames when
+it is possible to symbolicate with the symbols available on the symbol directory.
 .PP
-The tool assumes that the folder with a referenced assembly called for example
-name.dll will also include name.dll.mdb,
-if the referenced assembly is AOT compiled then the tool is also expecting to find
-name.dll.msym.
+Managed symbols .exe/.dll can be added to the symbol directory by doing:
+.P
+.B mono-symbolicate store-symbols <msym dir> [<dir>]+
 .SH AUTHOR
 Written by Marcos Henrich
 .SH COPYRIGHT
index 7bd449dd4559c7c9d8e1ca61432ef8a5b0340577..c4589ea70c7243f74525d5669f342c983f24f39b 100644 (file)
@@ -7,7 +7,7 @@
 .\" Author:
 .\"   Miguel de Icaza (miguel@gnu.org)
 .\"
-.TH Mono "Mono 4.5.2"
+.TH Mono "Mono 4.7.0"
 .SH NAME
 mono \- Mono's ECMA-CLI native code generator (Just-in-Time and Ahead-of-Time)
 .SH SYNOPSIS
@@ -142,10 +142,10 @@ instead of going through the operating system symbol lookup operation.
 .I llvm-path=<PREFIX>
 Same for the llvm tools 'opt' and 'llc'.
 .TP
-.I gen-seq-points-file=FILE.msym
+.I msym-dir=<PATH>
 Instructs the AOT compiler to generate offline sequence points .msym files.
-The path is optional, if none is passed then a .msym file will be generated
-next to the input assembly.
+The generated .msym files will be stored into a subfolder of <PATH> named as the
+compilation AOTID.
 .TP
 .I mtriple=<TRIPLE>
 Use the GNU style target triple <TRIPLE> to determine some code generation options, i.e.
@@ -1100,7 +1100,7 @@ a Mono process through the environment.   This is useful for example
 to force all of your Mono processes to use LLVM or SGEN without having
 to modify any launch scripts.
 .TP
-\fBMONO_ENV_OPTIONS\fR
+\fBMONO_SDB_ENV_OPTIONS\fR
 Used to pass extra options to the debugger agent in the runtime, as they were passed
 using --debugger-agent=.
 .TP
@@ -1302,12 +1302,12 @@ statistics when shutting down.
 .TP
 \fBcollect-before-allocs\fR
 .TP
-\fBcheck-at-minor-collections\fR
-This performs a consistency check on minor collections and also clears
-the nursery at collection time, instead of the default, when buffers
-are allocated (clear-at-gc).   The consistency check ensures that
-there are no major to minor references that are not on the remembered
-sets. 
+\fBcheck-remset-consistency\fR
+This performs a remset consistency check at various opportunities, and
+also clears the nursery at collection time, instead of the default,
+when buffers are allocated (clear-at-gc).  The consistency check
+ensures that there are no major to minor references that are not on
+the remembered sets.
 .TP
 \fBmod-union-consistency-check\fR
 Checks that the mod-union cardtable is consistent before each
@@ -1652,11 +1652,11 @@ Automatically generates sequence points where the
 IL stack is empty.  These are places where the debugger can set a
 breakpoint.
 .TP
-\fBgen-compact-seq-points\fR
-This option generates sequence points data that maps native offsets to
-IL offsets. Sequence point data is used to display IL offset in
-stacktraces. Stacktraces with IL offsets can be symbolicated using
-mono-symbolicate tool.
+\fBno-compact-seq-points\fR
+Unless the option is used, the runtime generates sequence points data that
+maps native offsets to IL offsets. Sequence point data is used to
+display IL offset in stacktraces. Stacktraces with IL offsets can be
+symbolicated using mono-symbolicate tool.
 .TP
 \fBhandle-sigint\fR
 Captures the interrupt signal (Control-C) and displays a stack trace
index 7dbfb638917892d2637276347599b56aa8b8cfba..6a7a58d7fc98a418579b18a527484a6889a05d01 100644 (file)
@@ -15,7 +15,7 @@ monotouch_watch_runtime_SUBDIRS := build class
 monotouch_tv_runtime_SUBDIRS := build class
 xammac_SUBDIRS := build class
 mobile_SUBDIRS := build class
-mobile_static_SUBDIRS := build class
+mobile_static_SUBDIRS := build class ilasm
 binary_reference_assemblies_SUBDIRS := build class
 net_4_x_SUBDIRS := build mcs class nunit24 ilasm tools tests errors docs
 xammac_net_4_5_SUBDIRS := build class
index bfc73413391266a012d5977ab25d4adb902a7167..4b7b279f0c701ffc6fa0097267a0111bb2d95590 100644 (file)
@@ -23,8 +23,6 @@ PLATFORM_PATH_SEPARATOR = :
 # This is for changing / to \ on windows
 PLATFORM_CHANGE_SEPARATOR_CMD = cat
 
-PLATFORM_AOT_SUFFIX = .dylib
-
 hidden_prefix = .
 hidden_suffix = 
 
index fd54351c47bf9d2deab761d1dd64c693afa522d9..00504140796593b770c9295ba9c53e04352f171d 100644 (file)
@@ -23,8 +23,6 @@ PLATFORM_PATH_SEPARATOR = :
 # This is for changing / to \ on windows
 PLATFORM_CHANGE_SEPARATOR_CMD = cat
 
-PLATFORM_AOT_SUFFIX = .so
-
 hidden_prefix = .
 hidden_suffix = 
 
index d5df46e9da8bb1791901c2f8ab33dc5c01c2a41e..bed99f53387d0a7b9860fcb5334478d926a22769 100644 (file)
@@ -26,9 +26,6 @@ PLATFORM_PATH_SEPARATOR = ;
 
 override CURDIR:=$(shell cygpath -m $(CURDIR))
 
-## not so simple :-)
-#PLATFORM_AOT_SUFFIX = .dll
-
 hidden_prefix = 
 hidden_suffix = .tmp
 
index 4cb0fabc2db9614a0dd9a9c7b6deb6ac549a5b96..e531f44a4b55b581ff562313c61af33b8d721a8e 100644 (file)
@@ -23,6 +23,7 @@ PROFILE_MCS_FLAGS = \
        -d:NET_4_0 \
        -d:NET_4_5 \
        -d:MONO \
+       -d:NETSTANDARD \
        -nowarn:1699 \
        -nostdlib \
        $(DEFAULT_REFERENCES) \
index 4dd77182c7be9c82f3f0ebfcbd62f7e466bf2224..d9ff3b67dc9334f4b6727536b33ef219a08db150 100644 (file)
@@ -21,6 +21,7 @@ PROFILE_MCS_FLAGS = \
        -d:NET_4_0 \
        -d:NET_4_5 \
        -d:MONO \
+       -d:NETSTANDARD \
        -d:MOBILE,MOBILE_STATIC,MOBILE_LEGACY \
        -d:FULL_AOT_RUNTIME \
        -d:DISABLE_REMOTING \
@@ -42,17 +43,5 @@ NO_VTS_TEST = yes
 # Note need for trailing comma. If you add, keep it
 PROFILE_TEST_HARNESS_EXCLUDES = MobileNotWorking,PKITS,
 
-ifndef MONO_DISABLE_GSHAREDVT
-GSHAREDVT_FLAG = -O=gsharedvt
-endif
-
-ifneq ($(MONO_LLVMONLY),)
-AOT_BUILD_FLAGS_PREFIX = --aot=llvmonly,
-AOT_RUN_FLAGS =  --llvmonly
-else
-AOT_BUILD_FLAGS_PREFIX = $(GSHAREDVT_FLAG) --aot=full,
-AOT_RUN_FLAGS = --full-aot
-endif
-
 ALWAYS_AOT = yes
 
index 9aacd7f48b5141e5abef038d39cd078fa4c12d34..65919907c270b35fefe7bcbc6ba24b2212895b57 100644 (file)
@@ -25,6 +25,7 @@ PROFILE_MCS_FLAGS = \
        -d:MOBILE_DYNAMIC \
        -d:MONODROID \
        -d:ANDROID \
+       -d:NETSTANDARD \
        -nowarn:1699 \
        -nostdlib \
        $(DEFAULT_REFERENCES) \
index 2ff609c1a7def7d57a49474029c829da0a656ecb..e4370cf4f985b188dc80ed333347e114bf4e24c1 100644 (file)
@@ -27,6 +27,7 @@ PROFILE_MCS_FLAGS = \
        -d:DISABLE_REMOTING \
        -d:DISABLE_COM \
        -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK \
+       -d:NETSTANDARD \
        -nowarn:1699 \
        -nostdlib \
        $(DEFAULT_REFERENCES) \
index a0b681071ddb49c38d4c62d9ed349c669e4391d8..f8a39cb48f00059e54c08e1a71e27d638ad423dd 100644 (file)
@@ -6,6 +6,4 @@ PARENT_PROFILE = ../net_4_x/
 DEFAULT_REFERENCES = -r:$(topdir)/class/lib/net_4_x/mscorlib.dll
 PROFILE_MCS_FLAGS := $(PROFILE_MCS_FLAGS) -d:XBUILD_12
 
-RESGEN_EXE = $(topdir)/class/lib/net_4_x/resgen.exe
-
 XBUILD_VERSION = 12.0
index 5e90cf8ddac60c76169f749959fabe51e0fe4484..ac3a476dfb1055fa46cad6cca78fddf90391d007 100644 (file)
@@ -45,9 +45,9 @@ INTERNAL_GMCS = $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/$(BUILD_TOOLS_PR
 INTERNAL_ILASM = $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/$(PROFILE)/ilasm.exe
 INTERNAL_CSC = $(RUNTIME) $(RUNTIME_FLAGS) $(CSC_LOCATION)
 
-RESGEN_EXE = $(topdir)/class/lib/$(PROFILE)/resgen.exe
+RESGEN_EXE = $(topdir)/class/lib/$(PROFILE)/$(PARENT_PROFILE)resgen.exe
 INTERNAL_RESGEN = $(RUNTIME) $(RUNTIME_FLAGS) $(RESGEN_EXE)
-RESGEN = MONO_PATH="$(topdir)/class/lib/$(PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(INTERNAL_RESGEN)
+RESGEN = MONO_PATH="$(topdir)/class/lib/$(PROFILE)/$(PARENT_PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(INTERNAL_RESGEN)
 STRING_REPLACER = MONO_PATH="$(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)/cil-stringreplacer.exe
 
 depsdir = $(topdir)/build/deps
@@ -132,29 +132,6 @@ endif
 # Make sure propagates
 export TEST_HARNESS
 
-# start aot config
-
-# We set the prefix of the aot build flags
-# in the profile. This determines the aot type,
-# whether it be llvmonly or full. To this we append the
-# options which do not change between them, the INVARIANT_AOT_OPTIONS
-ifndef AOT_BUILD_FLAGS_PREFIX
-AOT_BUILD_FLAGS_PREFIX = --aot=
-endif
-
-# Set the options for building and running AOT
-# The trampoline numbers are provisional, they are what is required
-# to run the mcs/class test suites. They should be considered a lower bound.
-INVARIANT_AOT_OPTIONS=nimt-trampolines=900,ntrampolines=8000,nrgctx-fetch-trampolines=256
-
-ifndef MONO_DISABLE_GSHAREDVT
-INVARIANT_AOT_OPTIONS:=$(INVARIANT_AOT_OPTIONS),ngsharedvt-trampolines=2800
-endif
-
-AOT_BUILD_FLAGS = $(AOT_BUILD_FLAGS_PREFIX)$(INVARIANT_AOT_OPTIONS)
-
-# end AOT config
-
 ifdef BCL_OPTIMIZE
 PROFILE_MCS_FLAGS += -optimize
 endif
@@ -202,17 +179,33 @@ STD_TARGETS = test run-test run-test-ondotnet clean install uninstall doc-update
 $(STD_TARGETS): %: do-%
 
 ifdef PLATFORM_AOT_SUFFIX
-Q_AOT=$(if $(V),,@echo "AOT     [$(PROFILE)] AOT All Assemblies";)
-LIST_ALL_PROFILE_ASSEMBLIES = find . | grep -E '(dll|exe)$$' | grep -v -E 'bare|plaincore|secxml|Facades'
-COMPILE_ALL_PROFILE_ASSEMBLIES = $(LIST_ALL_PROFILE_ASSEMBLIES) | MONO_PATH="./" xargs -I '{}' $(RUNTIME) $(RUNTIME_FLAGS) $(AOT_BUILD_FLAGS) '{}'
+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
        $(MAKE) aot-all-profile
 
-aot-all-profile:
-       $(Q_AOT) cd $(topdir)/class/lib/$(PROFILE)/ && $(COMPILE_ALL_PROFILE_ASSEMBLIES) &> $(PROFILE)-aot.log
-endif
+# When we recursively call $(MAKE) aot-all-profile
+# we will have created this directory, and so will
+# 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))
+
+# This can run in parallel
+.PHONY: aot-all-profile
+aot-all-profile: $(patsubst %,$(topdir)/class/lib/$(PROFILE)/%$(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
+
+endif #ifneq ("$(wildcard $(topdir)/class/lib/$(PROFILE))","")
+
+endif # PLATFORM_AOT_SUFFIX
 
 do-run-test:
        ok=:; $(MAKE) run-test-recursive || ok=false; $(MAKE) run-test-local || ok=false; $$ok
index d984f22ecd51922003ddc2fb5dd3a7bf711c4f0d..4ef52f56dcad794058bfaae88a87d2849945173c 100644 (file)
@@ -28,7 +28,7 @@ include $(MCS_BUILD_DIR)/rules.make
 
 dist-local: dist-default
 
-DIST_SUBDIRS = $(net_4_x_PARALLEL_SUBDIRS)
+DIST_SUBDIRS = $(net_4_x_PARALLEL_SUBDIRS) $(net_4_x_SUBDIRS) $(mobile_only_SUBDIRS)
 DISTFILES=subdirs.make
 
 doc-update-local:
@@ -39,7 +39,7 @@ doc-update-recursive:
 
 System System.Core System.ComponentModel.DataAnnotations System.Numerics System.Runtime.Serialization System.XML \
 System.ComponentModel.Composition System.ServiceModel System.Xml.Linq System.Data System.IO.Compression.FileSystem \
-System.ServiceProcess System.Security System.Net.Http.WebRequest System.Net.Http:
+System.ServiceProcess System.Security System.Net.Http.WebRequest System.Net.Http System.ServiceProcess:
 
 all-local-aot:
 
index 0b5f4acf6daad43a1597f99ada62b9ebd4f05fc2..4197137c95ee1093c968bb85209da78202287b9a 100644 (file)
@@ -14,8 +14,6 @@ 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/Microsoft.Win32.Registry.AccessControl/RegistryAclExtensions.cs b/mcs/class/Facades/Microsoft.Win32.Registry.AccessControl/RegistryAclExtensions.cs
new file mode 100644 (file)
index 0000000..deb3458
--- /dev/null
@@ -0,0 +1,57 @@
+//
+// RegistryAclExtensions.cs
+//
+// Author:
+//   Alexander Köplinger (alexander.koeplinger@xamarin.com)
+//
+// (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.Security;
+using System.Security.AccessControl;
+
+namespace Microsoft.Win32
+{
+       public static class RegistryAclExtensions
+       {
+               [MonoTODO]
+               public static RegistrySecurity GetAccessControl (this RegistryKey key)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static RegistrySecurity GetAccessControl (this RegistryKey key, AccessControlSections includeSections)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static void SetAccessControl (this RegistryKey key, RegistrySecurity registrySecurity)
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+}
\ No newline at end of file
index cb252be1af3c7655dbf23e9ad81c0660baf77ff2..bdef1972306e60feafe11e0927e3b39b94fa7cf9 100644 (file)
@@ -23,4 +23,3 @@
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.AccessControl.RegistryAccessRule))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.AccessControl.RegistryAuditRule))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.AccessControl.RegistrySecurity))]
-//Missing: [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(Microsoft.Win32.RegistryAclExtensions))]
index ecf772dd7eccdac8fc14834b9cc94a4dae156928..fae8514159ef6ae454d4414207ded833a41eef4d 100644 (file)
 // THE SOFTWARE.
 // 
 
-#if !MOBILE
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(Microsoft.Win32.Registry))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(Microsoft.Win32.RegistryHive))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(Microsoft.Win32.RegistryKey))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(Microsoft.Win32.RegistryValueKind))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(Microsoft.Win32.RegistryValueOptions))]
-#endif
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(Microsoft.Win32.RegistryOptions))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(Microsoft.Win32.RegistryView))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(Microsoft.Win32.SafeHandles.SafeRegistryHandle))]
index 81a899b5e01ca018b4525724464a24bba13a5ff4..710df4ecd209261fe9ced57019332aab1825ce95 100644 (file)
 // THE SOFTWARE.
 // 
 
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.BrowsableAttribute))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.CategoryAttribute))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.ComponentCollection))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.DescriptionAttribute))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.DesignOnlyAttribute))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.DesignerCategoryAttribute))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.DesignerSerializationVisibility))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.DesignerSerializationVisibilityAttribute))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.DisplayNameAttribute))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.EventHandlerList))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.IComponent))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.IContainer))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.ISite))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.ImmutableObjectAttribute))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.InitializationEventAttribute))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.LocalizableAttribute))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.MergablePropertyAttribute))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.NotifyParentPropertyAttribute))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.ParenthesizePropertyNameAttribute))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.ReadOnlyAttribute))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.RefreshProperties))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.RefreshPropertiesAttribute))]
 
 
index 4a50ae332d04472bd74bd15b816d8973474c69bf..12d2434bfcf66a4fc3c5bef3bbc4fe617092af72 100644 (file)
 // 
 
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.ArrayConverter))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.AttributeCollection))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.AttributeProviderAttribute))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.BaseNumberConverter))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.BooleanConverter))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.ByteConverter))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.CancelEventHandler))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.CharConverter))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.CollectionChangeAction))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.CollectionChangeEventArgs))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.CollectionChangeEventHandler))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.CollectionConverter))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.CustomTypeDescriptor))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.DateTimeConverter))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.DateTimeOffsetConverter))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.DecimalConverter))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.DefaultEventAttribute))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.DefaultPropertyAttribute))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.DoubleConverter))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.EnumConverter))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.EventDescriptor))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.EventDescriptorCollection))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.ExtenderProvidedPropertyAttribute))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.GuidConverter))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.HandledEventArgs))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.HandledEventHandler))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.ICustomTypeDescriptor))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.IExtenderProvider))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.IListSource))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.ITypeDescriptorContext))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.ITypedList))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.Int16Converter))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.Int32Converter))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.Int64Converter))]
-[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.ITypeDescriptorContext))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.InvalidAsynchronousStateException))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.MemberDescriptor))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.MultilineStringConverter))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.NullableConverter))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.PropertyDescriptor))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.PropertyDescriptorCollection))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.ProvidePropertyAttribute))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.RefreshEventArgs))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.RefreshEventHandler))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.SByteConverter))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.SingleConverter))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.StringConverter))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.TimeSpanConverter))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.TypeConverter))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.TypeConverterAttribute))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.TypeDescriptionProvider))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.TypeDescriptionProviderAttribute))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.TypeDescriptor))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.TypeListConverter))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.UInt16Converter))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.UInt32Converter))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.UInt64Converter))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.UriTypeConverter))]
 
 
index 5987d7bb1f3e6fb4329f9aa6bfddf96df440f3c5..c1695f51f4b0d40654781a4f3b5afeeb556755ac 100644 (file)
@@ -24,6 +24,7 @@
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ConsoleCancelEventArgs))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ConsoleCancelEventHandler))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ConsoleColor))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ConsoleKey))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ConsoleKeyInfo))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ConsoleModifiers))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ConsoleSpecialKey))]
-
-
diff --git a/mcs/class/Facades/System.Data.Common/DbColumn.cs b/mcs/class/Facades/System.Data.Common/DbColumn.cs
new file mode 100644 (file)
index 0000000..f7bc5c7
--- /dev/null
@@ -0,0 +1,64 @@
+//
+// DbColumn.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.Collections.Generic;
+
+namespace System.Data.Common
+{
+    public abstract class DbColumn
+    {
+        public bool? AllowDBNull { get; protected set; }
+        public string BaseCatalogName { get; protected set; }
+        public string BaseColumnName { get; protected set; }
+        public string BaseSchemaName { get; protected set; }
+        public string BaseServerName { get; protected set; }
+        public string BaseTableName { get; protected set; }
+        public string ColumnName { get; protected set; }
+        public int? ColumnOrdinal { get; protected set; }
+        public int? ColumnSize { get; protected set; }
+        public bool? IsAliased { get; protected set; }
+        public bool? IsAutoIncrement { get; protected set; }
+        public bool? IsExpression { get; protected set; }
+        public bool? IsHidden { get; protected set; }
+        public bool? IsIdentity { get; protected set; }
+        public bool? IsKey { get; protected set; }
+        public bool? IsLong { get; protected set; }
+        public bool? IsReadOnly { get; protected set; }
+        public bool? IsUnique { get; protected set; }
+        public int? NumericPrecision { get; protected set; }
+        public int? NumericScale { get; protected set; }
+        public string UdtAssemblyQualifiedName { get; protected set; }
+        public Type DataType { get; protected set; }
+        public string DataTypeName { get; protected set; }
+        public virtual object this[string property] {
+               get {
+                       throw new NotImplementedException ();
+               }
+        }
+    }
+}
\ No newline at end of file
diff --git a/mcs/class/Facades/System.Data.Common/DbDataReaderExtensions.Facade.cs b/mcs/class/Facades/System.Data.Common/DbDataReaderExtensions.Facade.cs
new file mode 100644 (file)
index 0000000..ba1913f
--- /dev/null
@@ -0,0 +1,85 @@
+// 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;
+
+namespace System.Data.Common
+{
+
+    internal class DataRowDbColumn : DbColumn
+    {
+        private DataColumnCollection schemaColumns;
+        private DataRow schemaRow;
+
+        public DataRowDbColumn(DataRow readerSchemaRow, DataColumnCollection readerSchemaColumns)
+        {
+            this.schemaRow = readerSchemaRow;
+            this.schemaColumns = readerSchemaColumns;
+            populateFields();
+        }
+
+        private void populateFields()
+        {
+            AllowDBNull = GetDbColumnValue<bool?>(SchemaTableColumn.AllowDBNull);
+            BaseCatalogName = GetDbColumnValue<string>(SchemaTableOptionalColumn.BaseCatalogName);
+            BaseColumnName = GetDbColumnValue<string>(SchemaTableColumn.BaseColumnName);
+            BaseSchemaName = GetDbColumnValue<string>(SchemaTableColumn.BaseSchemaName);
+            BaseServerName = GetDbColumnValue<string>(SchemaTableOptionalColumn.BaseServerName);
+            BaseTableName = GetDbColumnValue<string>(SchemaTableColumn.BaseTableName);
+            ColumnName = GetDbColumnValue<string>(SchemaTableColumn.ColumnName);
+            ColumnOrdinal = GetDbColumnValue<int?>(SchemaTableColumn.ColumnOrdinal);
+            ColumnSize = GetDbColumnValue<int?>(SchemaTableColumn.ColumnSize);
+            IsAliased = GetDbColumnValue<bool?>(SchemaTableColumn.IsAliased);
+            IsAutoIncrement = GetDbColumnValue<bool?>(SchemaTableOptionalColumn.IsAutoIncrement);
+            IsExpression = GetDbColumnValue<bool>(SchemaTableColumn.IsExpression);
+            IsHidden = GetDbColumnValue<bool?>(SchemaTableOptionalColumn.IsHidden);
+            IsIdentity = GetDbColumnValue<bool?>("IsIdentity");
+            IsKey = GetDbColumnValue<bool?>(SchemaTableColumn.IsKey);
+            IsLong = GetDbColumnValue<bool?>(SchemaTableColumn.IsLong);
+            IsReadOnly = GetDbColumnValue<bool?>(SchemaTableOptionalColumn.IsReadOnly);
+            IsUnique = GetDbColumnValue<bool?>(SchemaTableColumn.IsUnique);
+            NumericPrecision = GetDbColumnValue<int?>(SchemaTableColumn.NumericPrecision);
+            NumericScale = GetDbColumnValue<int?>(SchemaTableColumn.NumericScale);
+            UdtAssemblyQualifiedName = GetDbColumnValue<string>("UdtAssemblyQualifiedName");
+            DataType = GetDbColumnValue<Type>(SchemaTableColumn.DataType);
+            DataTypeName = GetDbColumnValue<string>("DataTypeName");
+        }
+
+        private T GetDbColumnValue<T>(string columnName)
+        {
+            if (!schemaColumns.Contains(columnName))
+            {
+                return default(T);
+            }
+            object schemaObject = schemaRow[columnName];
+            if (schemaObject is T)
+            {
+                return (T)schemaObject;
+            }
+            return default(T);
+        }
+    }
+
+    public static class DbDataReaderExtensions
+    {
+        public static System.Collections.ObjectModel.ReadOnlyCollection<DbColumn> GetColumnSchema(this DbDataReader reader)
+        {
+            IList<DbColumn> columnSchema = new List<DbColumn>();
+            DataTable schemaTable = reader.GetSchemaTable();
+            DataColumnCollection schemaTableColumns = schemaTable.Columns;
+            foreach (DataRow row in schemaTable.Rows)
+            {
+                DbColumn dbColumn = new DataRowDbColumn(row, schemaTableColumns);
+                columnSchema.Add(dbColumn);
+            }
+            System.Collections.ObjectModel.ReadOnlyCollection<DbColumn> readOnlyColumnSchema = new System.Collections.ObjectModel.ReadOnlyCollection<DbColumn>(columnSchema);
+            return readOnlyColumnSchema;
+        }
+
+        public static bool CanGetColumnSchema(this DbDataReader reader)
+        {
+            return true;
+        }
+    }
+}
\ No newline at end of file
diff --git a/mcs/class/Facades/System.Data.Common/IDbColumnSchemaGenerator.cs b/mcs/class/Facades/System.Data.Common/IDbColumnSchemaGenerator.cs
new file mode 100644 (file)
index 0000000..ed6c519
--- /dev/null
@@ -0,0 +1,35 @@
+//
+// IDbColumnSchemaGenerator.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.Data.Common
+{
+       public interface IDbColumnSchemaGenerator
+       {
+               System.Collections.ObjectModel.ReadOnlyCollection<DbColumn> GetColumnSchema();
+       }
+}
\ No newline at end of file
index 30bf3dd018146c2ca81002fde79578ff7f6457c1..fe63a8e0f7b1c2feb776fc73b0f8bef97e5c2e9b 100644 (file)
@@ -11,11 +11,9 @@ LIBRARY = System.Data.Common.dll
 
 KEY_FILE = ../../msfinal.pub
 SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
-LIB_REFS = System System.Data
+LIB_REFS = System System.Data System.Xml
 LIB_MCS_FLAGS = $(SIGN_FLAGS)
 
-PLATFORM_DEBUG_FLAGS =
-
 NO_TEST = yes
 
 include $(MCS_BUILD_DIR)/library.make
index 8e33d4ddeae92bde7aa8afd994db5d90d6af18d9..6b723549733e3bf504ea75990958fa103ae257ff 100644 (file)
@@ -1,3 +1,5 @@
 TypeForwarders.cs
 AssemblyInfo.cs
-
+IDbColumnSchemaGenerator.cs
+DbColumn.cs
+DbDataReaderExtensions.Facade.cs
index 52b199a2e67ea1fb11200196d40d83ce233e8991..9470c9c78b2ca156ac4782396c30c7b48217b5ca 100644 (file)
 // THE SOFTWARE.
 // 
 
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.DBNull))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.CommandBehavior))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.CommandType))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.Common.DbCommand))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.Common.DbConnection))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.Common.DbConnectionStringBuilder))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.Common.DbDataReader))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.Common.DbDataRecord))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.Common.DbEnumerator))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.Common.DbException))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.Common.DbParameter))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.Common.DbParameterCollection))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.Common.DbProviderFactory))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.Common.DbTransaction))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.ConnectionState))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.DataRowVersion))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.DataTable))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.DbType))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.IDataParameter))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.IDataParameterCollection))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.IDataReader))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.IDataRecord))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.IDbCommand))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.IDbConnection))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.IDbDataParameter))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.IDbTransaction))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.IsolationLevel))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.ParameterDirection))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.StateChangeEventArgs))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.StateChangeEventHandler))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.UpdateRowSource))]
-[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.DBNull))]
 
 
index d930326b45e1143c3ebff6902896c038eeab8e51..3237d9eb98fbddfa777678623072a5db0808da07 100644 (file)
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(Microsoft.SqlServer.Server.SqlMetaData))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.SqlClient.ApplicationIntent))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.SqlClient.SortOrder))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.SqlClient.SqlBulkCopy))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.SqlClient.SqlBulkCopyColumnMapping))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.SqlClient.SqlBulkCopyColumnMappingCollection))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.SqlClient.SqlBulkCopyOptions))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.SqlClient.SqlClientFactory))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.SqlClient.SqlCommand))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.SqlClient.SqlConnection))]
@@ -36,6 +40,8 @@
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.SqlClient.SqlInfoMessageEventHandler))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.SqlClient.SqlParameter))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.SqlClient.SqlParameterCollection))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.SqlClient.SqlRowsCopiedEventArgs))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.SqlClient.SqlRowsCopiedEventHandler))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.SqlClient.SqlTransaction))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.SqlDbType))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.SqlTypes.INullable))]
index 7601feb313ee998d285dd999d92e68cf4824a625..e91a664406dd54a619020d96cd69e0b18525c3d0 100644 (file)
@@ -20,7 +20,7 @@
 // THE SOFTWARE.
 // 
 
-// TODO: [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(Microsoft.Win32.SafeHandles.SafeProcessHandle))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(Microsoft.Win32.SafeHandles.SafeProcessHandle))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.DataReceivedEventArgs))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.DataReceivedEventHandler))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Process))]
index 25d8ac37eddd1351ee41e37670615d9b8df46531..4cc9d7f1a3bee21d447328e91d858fef184fcbc3 100644 (file)
@@ -14,8 +14,6 @@ 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.Diagnostics.StackTrace/StackFrameExtensions.cs b/mcs/class/Facades/System.Diagnostics.StackTrace/StackFrameExtensions.cs
new file mode 100644 (file)
index 0000000..1fb375f
--- /dev/null
@@ -0,0 +1,61 @@
+//
+// StackFrameExtensions.cs
+//
+// Author:
+//   Alexander Köplinger (alexander.koeplinger@xamarin.com)
+//
+// (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;
+
+namespace System.Diagnostics
+{
+       public static class StackFrameExtensions
+       {
+               [MonoTODO]
+               public static bool HasNativeImage (this StackFrame stackFrame)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static bool HasMethod (this StackFrame stackFrame)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static bool HasILOffset (this StackFrame stackFrame)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static bool HasSource (this StackFrame stackFrame)
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+}
\ No newline at end of file
index 8e33d4ddeae92bde7aa8afd994db5d90d6af18d9..9d113cec2030b8af0bc1ae8f0fd91b7781671d1a 100644 (file)
@@ -1,3 +1,5 @@
 TypeForwarders.cs
 AssemblyInfo.cs
 
+../../../build/common/MonoTODOAttribute.cs
+StackFrameExtensions.cs
index b07464db3e2a0f7329dcbbf322ea2fd481cea100..3643429a219efa4bb5011e6c17bbd9b5b76d4a58 100644 (file)
@@ -22,5 +22,4 @@
 
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.StackFrame))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.StackTrace))]
-//Missing: [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.StackFrameExtensions))]
 
diff --git a/mcs/class/Facades/System.Diagnostics.Tracing/EventCounter.cs b/mcs/class/Facades/System.Diagnostics.Tracing/EventCounter.cs
new file mode 100644 (file)
index 0000000..7fedc40
--- /dev/null
@@ -0,0 +1,41 @@
+//
+// 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 14b380da866454c7569c53a115dfa4e473422415..d74812c5e9f37df4cb06b1a044a3b67932b01081 100644 (file)
@@ -13,8 +13,6 @@ KEY_FILE = ../../msfinal.pub
 SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
 LIB_MCS_FLAGS = $(SIGN_FLAGS) 
 
-PLATFORM_DEBUG_FLAGS =
-
 NO_TEST = yes
 
 include $(MCS_BUILD_DIR)/library.make
index 832c003b52e813dd0f25651f00370f164a258cfa..5c8ab29d77aeb95e7a9fcceeec94fccc04ccecdb 100644 (file)
 // THE SOFTWARE.
 // 
 
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Tracing.EventActivityOptions))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Tracing.EventAttribute))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Tracing.EventChannel))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Tracing.EventCommand))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Tracing.EventCommandEventArgs))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Tracing.EventDataAttribute))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Tracing.EventFieldAttribute))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Tracing.EventFieldFormat))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Tracing.EventFieldTags))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Tracing.EventIgnoreAttribute))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Tracing.EventKeywords))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Tracing.EventLevel))]
-//[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Tracing.EventListener))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Tracing.EventListener))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Tracing.EventManifestOptions))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Tracing.EventOpcode))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Tracing.EventSource))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Tracing.EventSourceAttribute))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Tracing.EventSourceException))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Tracing.EventSourceOptions))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Tracing.EventSourceSettings))]
-//[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Tracing.EventSourceException))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Tracing.EventTags))]
 [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.EventWrittenEventArgs))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Tracing.NonEventAttribute))]
diff --git a/mcs/class/Facades/System.Drawing.Primitives/AssemblyInfo.cs b/mcs/class/Facades/System.Drawing.Primitives/AssemblyInfo.cs
new file mode 100644 (file)
index 0000000..fd9a20b
--- /dev/null
@@ -0,0 +1,39 @@
+//
+// 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.Reflection;
+using System.Runtime.CompilerServices;
+
+[assembly: AssemblyTitle ("System.Drawing.Primitives.dll")]
+[assembly: AssemblyDescription ("System.Drawing.Primitives.dll")]
+[assembly: AssemblyDefaultAlias ("System.Drawing.Primitives.dll")]
+[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: 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.Drawing.Primitives/Makefile b/mcs/class/Facades/System.Drawing.Primitives/Makefile
new file mode 100644 (file)
index 0000000..a42f4bc
--- /dev/null
@@ -0,0 +1,27 @@
+MCS_BUILD_DIR = ../../../build
+
+thisdir = class/Facades/System.Drawing.Primitives
+SUBDIRS =
+include $(MCS_BUILD_DIR)/rules.make
+
+LIBRARY_SUBDIR = Facades
+LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades
+
+LIBRARY = System.Drawing.Primitives.dll
+
+KEY_FILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+LIB_REFS = System
+LIB_MCS_FLAGS = $(SIGN_FLAGS) $(EXTRA_LIB_MCS_FLAGS)
+
+ifneq (2.1, $(FRAMEWORK_VERSION))
+ifndef XAMMAC_4_5
+LIB_REFS += System.Drawing
+endif
+endif
+
+PLATFORM_DEBUG_FLAGS =
+
+NO_TEST = yes
+
+include $(MCS_BUILD_DIR)/library.make
diff --git a/mcs/class/Facades/System.Drawing.Primitives/System.Drawing.Primitives.dll.sources b/mcs/class/Facades/System.Drawing.Primitives/System.Drawing.Primitives.dll.sources
new file mode 100644 (file)
index 0000000..719628d
--- /dev/null
@@ -0,0 +1,2 @@
+TypeForwarders.cs
+AssemblyInfo.cs
diff --git a/mcs/class/Facades/System.Drawing.Primitives/TypeForwarders.cs b/mcs/class/Facades/System.Drawing.Primitives/TypeForwarders.cs
new file mode 100644 (file)
index 0000000..af29167
--- /dev/null
@@ -0,0 +1,28 @@
+//
+// 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.
+//
+
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Point))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.PointF))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Rectangle))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.RectangleF))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Size))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.SizeF))]
diff --git a/mcs/class/Facades/System.Drawing.Primitives/embedded_System.Drawing.Primitives.dll.sources b/mcs/class/Facades/System.Drawing.Primitives/embedded_System.Drawing.Primitives.dll.sources
new file mode 100644 (file)
index 0000000..dd5e421
--- /dev/null
@@ -0,0 +1,8 @@
+AssemblyInfo.cs
+
+../../System.Drawing/System.Drawing/Point.cs
+../../System.Drawing/System.Drawing/PointF.cs
+../../System.Drawing/System.Drawing/Rectangle.cs
+../../System.Drawing/System.Drawing/RectangleF.cs
+../../System.Drawing/System.Drawing/Size.cs
+../../System.Drawing/System.Drawing/SizeF.cs
diff --git a/mcs/class/Facades/System.Drawing.Primitives/monotouch_watch_System.Drawing.Primitives.dll.sources b/mcs/class/Facades/System.Drawing.Primitives/monotouch_watch_System.Drawing.Primitives.dll.sources
new file mode 100644 (file)
index 0000000..49902e8
--- /dev/null
@@ -0,0 +1 @@
+#include embedded_System.Drawing.Primitives.dll.sources
diff --git a/mcs/class/Facades/System.Drawing.Primitives/xammac_net_4_5_System.Drawing.Primitives.dll.sources b/mcs/class/Facades/System.Drawing.Primitives/xammac_net_4_5_System.Drawing.Primitives.dll.sources
new file mode 100644 (file)
index 0000000..49902e8
--- /dev/null
@@ -0,0 +1 @@
+#include embedded_System.Drawing.Primitives.dll.sources
diff --git a/mcs/class/Facades/System.Globalization.Extensions/GlobalizationExtensions.cs b/mcs/class/Facades/System.Globalization.Extensions/GlobalizationExtensions.cs
new file mode 100644 (file)
index 0000000..43c1494
--- /dev/null
@@ -0,0 +1,98 @@
+// 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.Diagnostics;
+using System.Diagnostics.Contracts;
+
+namespace System.Globalization
+{
+    public static class GlobalizationExtensions
+    {
+        public static StringComparer GetStringComparer(this CompareInfo compareInfo, CompareOptions options)
+        {
+            if (compareInfo == null)
+            {
+                throw new ArgumentNullException(nameof(compareInfo));
+            }
+
+            if (options == CompareOptions.Ordinal)
+            {
+                return StringComparer.Ordinal;
+            }
+
+            if (options == CompareOptions.OrdinalIgnoreCase)
+            {
+                return StringComparer.OrdinalIgnoreCase;
+            }
+
+            if ((options & CultureAwareComparer.ValidCompareMaskOffFlags) != 0)
+            {
+                throw new ArgumentException(SR.Argument_InvalidFlag, nameof(options));
+            }
+
+            return new CultureAwareComparer(compareInfo, options);
+        }
+    }
+
+    internal sealed class CultureAwareComparer : StringComparer
+    {
+        internal const CompareOptions ValidCompareMaskOffFlags =
+            ~(CompareOptions.IgnoreCase | CompareOptions.IgnoreSymbols | CompareOptions.IgnoreNonSpace |
+              CompareOptions.IgnoreWidth | CompareOptions.IgnoreKanaType | CompareOptions.StringSort);
+
+        private readonly CompareInfo _compareInfo;
+        private readonly CompareOptions _options;
+
+        internal CultureAwareComparer(CompareInfo compareInfo, CompareOptions options)
+        {
+            Debug.Assert((options & ValidCompareMaskOffFlags) == 0);
+            _compareInfo = compareInfo;
+            _options = options;
+        }
+
+        public override int Compare(string x, string y)
+        {
+            if (Object.ReferenceEquals(x, y)) return 0;
+            if (x == null) return -1;
+            if (y == null) return 1;
+            return _compareInfo.Compare(x, y, _options);
+        }
+
+        public override bool Equals(string x, string y)
+        {
+            if (Object.ReferenceEquals(x, y)) return true;
+            if (x == null || y == null) return false;
+
+            return (_compareInfo.Compare(x, y, _options) == 0);
+        }
+
+        public override int GetHashCode(string obj)
+        {
+            if (obj == null)
+            {
+                throw new ArgumentNullException(nameof(obj));
+            }
+            Contract.EndContractBlock();
+
+            // StringSort used in compare operation and not with the hashing
+            return _compareInfo.GetHashCode(obj, _options & (~CompareOptions.StringSort));
+        }
+
+        // Equals method for the comparer itself. 
+        public override bool Equals(object obj)
+        {
+            CultureAwareComparer comparer = obj as CultureAwareComparer;
+            return
+                comparer != null &&
+                _options == comparer._options &&
+                _compareInfo.Equals(comparer._compareInfo);
+        }
+
+        public override int GetHashCode()
+        {
+            return _compareInfo.GetHashCode() ^ ((int)_options & 0x7FFFFFFF);
+        }
+    }
+}
index d3a57fa307dbd8b7121b25630aa667270b3dc640..446a41276071919f313a88018b1ef9cb6b6aeb89 100644 (file)
@@ -14,8 +14,6 @@ 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.Globalization.Extensions/SR.cs b/mcs/class/Facades/System.Globalization.Extensions/SR.cs
new file mode 100644 (file)
index 0000000..52a75a8
--- /dev/null
@@ -0,0 +1,4 @@
+partial class SR
+{
+       public const string Argument_InvalidFlag = "Value of flags is invalid.";
+}
\ No newline at end of file
diff --git a/mcs/class/Facades/System.Globalization.Extensions/StringNormalizationExtensions.cs b/mcs/class/Facades/System.Globalization.Extensions/StringNormalizationExtensions.cs
new file mode 100644 (file)
index 0000000..7953b29
--- /dev/null
@@ -0,0 +1,61 @@
+//
+// StringNormalizationExtensions.cs
+//
+// Author:
+//   Alexander Köplinger (alexander.koeplinger@xamarin.com)
+//
+// (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.Text;
+
+namespace System
+{
+       public static class StringNormalizationExtensions
+       {
+               [MonoTODO]
+               public static bool IsNormalized(this string value)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static bool IsNormalized(this string value, NormalizationForm normalizationForm)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static String Normalize(this string value)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static String Normalize(this string value, NormalizationForm normalizationForm)
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+}
+
index 8e33d4ddeae92bde7aa8afd994db5d90d6af18d9..8cec8fa1ac31da87e4be0dda612242a37528b28a 100644 (file)
@@ -1,3 +1,7 @@
 TypeForwarders.cs
 AssemblyInfo.cs
 
+../../../build/common/MonoTODOAttribute.cs
+SR.cs
+GlobalizationExtensions.cs
+StringNormalizationExtensions.cs
index 2f88c337195517b9598dea2519535fbef11ac4a6..ae5a0bbb413cd0b0b19b3ad0b0dc94b14ca9a8c0 100644 (file)
@@ -22,5 +22,3 @@
 
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Globalization.IdnMapping))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Text.NormalizationForm))]
-// Missing: [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Globalization.GlobalizationExtensions))]
-// Missing: [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.StringNormalizationExtensions))]
diff --git a/mcs/class/Facades/System.IO.FileSystem.AccessControl/FileSystemAclExtensions.cs b/mcs/class/Facades/System.IO.FileSystem.AccessControl/FileSystemAclExtensions.cs
new file mode 100644 (file)
index 0000000..1dd8d97
--- /dev/null
@@ -0,0 +1,83 @@
+//
+// FileSystemAclExtensions.cs
+//
+// Author:
+//   Alexander Köplinger (alexander.koeplinger@xamarin.com)
+//
+// (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.
+//
+
+namespace System.IO
+{
+       public static partial class FileSystemAclExtensions
+       {
+               [MonoTODO]
+               public static System.Security.AccessControl.DirectorySecurity GetAccessControl(this System.IO.DirectoryInfo directoryInfo)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static System.Security.AccessControl.DirectorySecurity GetAccessControl(this System.IO.DirectoryInfo directoryInfo, System.Security.AccessControl.AccessControlSections includeSections)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static System.Security.AccessControl.FileSecurity GetAccessControl(this System.IO.FileInfo fileInfo)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static System.Security.AccessControl.FileSecurity GetAccessControl(this System.IO.FileInfo fileInfo, System.Security.AccessControl.AccessControlSections includeSections)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static System.Security.AccessControl.FileSecurity GetAccessControl(this System.IO.FileStream fileStream)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static void SetAccessControl(this System.IO.DirectoryInfo directoryInfo, System.Security.AccessControl.DirectorySecurity directorySecurity)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static void SetAccessControl(this System.IO.FileInfo fileInfo, System.Security.AccessControl.FileSecurity fileSecurity)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static void SetAccessControl(this System.IO.FileStream fileStream, System.Security.AccessControl.FileSecurity fileSecurity)
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+}
\ No newline at end of file
index 0198747a8a312def61d8cb153e45a6b6d038c168..9efb35542bf8ec2e85c7c8d94db0df651674a675 100644 (file)
@@ -14,8 +14,6 @@ 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
index 12daecd0383c701a5f1d3170b2ddde387f990d64..18351db171e67ece3658a19c82b0bb3bcbbc6a92 100644 (file)
@@ -27,5 +27,3 @@
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.AccessControl.FileSystemAuditRule))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.AccessControl.FileSystemRights))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.AccessControl.FileSystemSecurity))]
-
-//Missing: [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.FileSystemAclExtensions))]
index 6237d34bfc4d7c1abd7213d00a60c0c8e50bf37e..b25bcf38598ffc09c45cf98b294e915469ba9f50 100644 (file)
@@ -29,5 +29,6 @@
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.RenamedEventArgs))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.RenamedEventHandler))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.WatcherChangeTypes))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.WaitForChangedResult))]
 
 
diff --git a/mcs/class/Facades/System.IO.Packaging/AssemblyInfo.cs b/mcs/class/Facades/System.IO.Packaging/AssemblyInfo.cs
new file mode 100644 (file)
index 0000000..7b0813f
--- /dev/null
@@ -0,0 +1,39 @@
+//
+// 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.Reflection;
+using System.Runtime.CompilerServices;
+
+[assembly: AssemblyTitle ("System.IO.Packaging.dll")]
+[assembly: AssemblyDescription ("System.IO.Packaging.dll")]
+[assembly: AssemblyDefaultAlias ("System.IO.Packaging.dll")]
+[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: 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.IO.Packaging/Makefile b/mcs/class/Facades/System.IO.Packaging/Makefile
new file mode 100644 (file)
index 0000000..cbf6d68
--- /dev/null
@@ -0,0 +1,21 @@
+MCS_BUILD_DIR = ../../../build
+
+thisdir = class/Facades/System.IO.Packaging
+SUBDIRS =
+include $(MCS_BUILD_DIR)/rules.make
+
+LIBRARY_SUBDIR = Facades
+LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades
+
+LIBRARY = System.IO.Packaging.dll
+
+KEY_FILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+LIB_REFS = System WindowsBase
+LIB_MCS_FLAGS = $(SIGN_FLAGS)
+
+PLATFORM_DEBUG_FLAGS =
+
+NO_TEST = yes
+
+include $(MCS_BUILD_DIR)/library.make
diff --git a/mcs/class/Facades/System.IO.Packaging/System.IO.Packaging.dll.sources b/mcs/class/Facades/System.IO.Packaging/System.IO.Packaging.dll.sources
new file mode 100644 (file)
index 0000000..719628d
--- /dev/null
@@ -0,0 +1,2 @@
+TypeForwarders.cs
+AssemblyInfo.cs
diff --git a/mcs/class/Facades/System.IO.Packaging/TypeForwarders.cs b/mcs/class/Facades/System.IO.Packaging/TypeForwarders.cs
new file mode 100644 (file)
index 0000000..a3c4504
--- /dev/null
@@ -0,0 +1,37 @@
+//
+// 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.
+//
+
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.FileFormatException))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.Packaging.CompressionOption))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.Packaging.EncryptionOption))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.Packaging.PackUriHelper))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.Packaging.Package))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.Packaging.PackagePart))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.Packaging.PackagePartCollection))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.Packaging.PackageProperties))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.Packaging.PackageRelationship))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.Packaging.PackageRelationshipCollection))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.Packaging.PackageRelationshipSelector))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.Packaging.PackageRelationshipSelectorType))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.Packaging.TargetMode))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.Packaging.ZipPackage))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.Packaging.ZipPackagePart))]
index ea526e77de476e7db02c11eedf2a25c82cc9d0fe..2c84d4bac3c845ebb4b038e4ae62b31a6341551a 100644 (file)
@@ -35,4 +35,5 @@
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.StringWriter))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.TextReader))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.TextWriter))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.BufferedStream))]
 
index 52af3f619ecce003dda88b62803983097f0e368f..6b82ffb42f3a2d7282375c675f546baca6bb129e 100644 (file)
@@ -64,6 +64,5 @@
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.IQueryable))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.IQueryable<>))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.IQueryProvider))]
-
-//Missing: [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.Expressions.IArgumentProvider))]
-//Missing: [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.Expressions.IDynamicExpression))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.Expressions.IArgumentProvider))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.Expressions.IDynamicExpression))]
diff --git a/mcs/class/Facades/System.Net.Ping/AssemblyInfo.cs b/mcs/class/Facades/System.Net.Ping/AssemblyInfo.cs
new file mode 100644 (file)
index 0000000..507e590
--- /dev/null
@@ -0,0 +1,39 @@
+//
+// 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.Reflection;
+using System.Runtime.CompilerServices;
+
+[assembly: AssemblyTitle ("System.Net.Ping.dll")]
+[assembly: AssemblyDescription ("System.Net.Ping.dll")]
+[assembly: AssemblyDefaultAlias ("System.Net.Ping.dll")]
+[assembly: AssemblyCompany ("Xamarin, Inc.")]
+[assembly: AssemblyProduct ("Mono Common Language Infrastructure")]
+[assembly: AssemblyCopyright ("Copyright (c) 2016 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.Net.Ping/Makefile b/mcs/class/Facades/System.Net.Ping/Makefile
new file mode 100644 (file)
index 0000000..750ace6
--- /dev/null
@@ -0,0 +1,21 @@
+MCS_BUILD_DIR = ../../../build
+
+thisdir = class/Facades/System.Net.Ping
+SUBDIRS =
+include $(MCS_BUILD_DIR)/rules.make
+
+LIBRARY_SUBDIR = Facades
+LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades
+
+LIBRARY = System.Net.Ping.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.Net.Ping/System.Net.Ping.dll.sources b/mcs/class/Facades/System.Net.Ping/System.Net.Ping.dll.sources
new file mode 100644 (file)
index 0000000..719628d
--- /dev/null
@@ -0,0 +1,2 @@
+TypeForwarders.cs
+AssemblyInfo.cs
diff --git a/mcs/class/Facades/System.Net.Ping/TypeForwarders.cs b/mcs/class/Facades/System.Net.Ping/TypeForwarders.cs
new file mode 100644 (file)
index 0000000..2f79a42
--- /dev/null
@@ -0,0 +1,27 @@
+//
+// 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.
+//
+
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.NetworkInformation.IPStatus))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.NetworkInformation.Ping))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.NetworkInformation.PingException))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.NetworkInformation.PingOptions))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.NetworkInformation.PingReply))]
index 884e50a3fd27513cb944012361964ed52ffd9fac..3167d764e13327feab061a0855dc8a27632cca80 100644 (file)
 // THE SOFTWARE.
 // 
 
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Security.AuthenticatedStream))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Security.EncryptionPolicy))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Security.LocalCertificateSelectionCallback))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Security.NegotiateStream))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Security.ProtectionLevel))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Security.RemoteCertificateValidationCallback))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Security.SslStream))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Authentication.AuthenticationException))]
@@ -29,5 +32,6 @@
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Authentication.ExtendedProtection.PolicyEnforcement))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Authentication.ExtendedProtection.ProtectionScenario))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Authentication.ExtendedProtection.ServiceNameCollection))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Authentication.InvalidCredentialException))]
 
 
index bf60d5fef6be2147d79b9b70e5ab29430dc1f651..497c05462276fee5be2ca4b18564dd8e33947548 100644 (file)
@@ -14,8 +14,6 @@ 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.Net.Sockets/SocketReceiveFromResult.cs b/mcs/class/Facades/System.Net.Sockets/SocketReceiveFromResult.cs
new file mode 100644 (file)
index 0000000..2add0e6
--- /dev/null
@@ -0,0 +1,36 @@
+//
+// 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
new file mode 100644 (file)
index 0000000..ab5ed10
--- /dev/null
@@ -0,0 +1,38 @@
+//
+// 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
new file mode 100644 (file)
index 0000000..a3e24ed
--- /dev/null
@@ -0,0 +1,250 @@
+// 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 8e33d4ddeae92bde7aa8afd994db5d90d6af18d9..a4cab35a66bc194d0b4d44ce6aba3335088ac771 100644 (file)
@@ -1,3 +1,5 @@
 TypeForwarders.cs
 AssemblyInfo.cs
-
+SocketReceiveFromResult.cs
+SocketReceiveMessageFromResult.cs
+SocketTaskExtensions.cs
diff --git a/mcs/class/Facades/System.Private.CoreLib.Threading/AssemblyInfo.cs b/mcs/class/Facades/System.Private.CoreLib.Threading/AssemblyInfo.cs
deleted file mode 100644 (file)
index de58780..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.Threading.dll")]
-[assembly: AssemblyDescription ("System.Private.CoreLib.Threading.dll")]
-[assembly: AssemblyDefaultAlias ("System.Private.CoreLib.Threading.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.Threading/Facades_System.Private.CoreLib.Threading-net_4_x.csproj b/mcs/class/Facades/System.Private.CoreLib.Threading/Facades_System.Private.CoreLib.Threading-net_4_x.csproj
deleted file mode 100644 (file)
index df6c913..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>{642A1B9E-1A2F-4C55-B184-E22F8C2E95B5}</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.Threading</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.Threading/Makefile b/mcs/class/Facades/System.Private.CoreLib.Threading/Makefile
deleted file mode 100644 (file)
index 347b171..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-MCS_BUILD_DIR = ../../../build
-
-thisdir = class/Facades/System.Private.CoreLib.Threading
-SUBDIRS = 
-include $(MCS_BUILD_DIR)/rules.make
-
-LIBRARY_SUBDIR = Facades
-LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades
-
-LIBRARY = System.Private.CoreLib.Threading.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.Threading/System.Private.CoreLib.Threading-net_4_x.csproj b/mcs/class/Facades/System.Private.CoreLib.Threading/System.Private.CoreLib.Threading-net_4_x.csproj
deleted file mode 100644 (file)
index 17de547..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>{A577B5A0-5038-4D8E-8C80-18ED9FEC8686}</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.Threading</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.Threading/System.Private.CoreLib.Threading.dll.sources b/mcs/class/Facades/System.Private.CoreLib.Threading/System.Private.CoreLib.Threading.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.Threading/TypeForwarders.cs b/mcs/class/Facades/System.Private.CoreLib.Threading/TypeForwarders.cs
deleted file mode 100644 (file)
index 7b9aa7a..0000000
+++ /dev/null
@@ -1,40 +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.Threading.AbandonedMutexException))]
-[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.AutoResetEvent))]
-[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.EventResetMode))]
-[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.EventWaitHandle))]
-[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.Interlocked))]
-[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.LazyInitializer))]
-[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.ManualResetEvent))]
-[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.Monitor))]
-[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.Mutex))]
-[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.Semaphore))]
-[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.SemaphoreFullException))]
-[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.SpinWait))]
-[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.SynchronizationLockException))]
-[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.Volatile))]
-[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.WaitHandleCannotBeOpenedException))]
-
-//Missing: [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.Condition))]
-//Missing: [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.Lock))]
index cfa70ce24a5c460f9ae8f1c8efef1cff5afe3b63..a3dd7e7c887cf9bec3b64650356e8a5a17e7603f 100644 (file)
@@ -20,7 +20,6 @@
 // THE SOFTWARE.
 // 
 
-#if !FULL_AOT_RUNTIME
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.Emit.FlowControl))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.Emit.OpCode))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.Emit.OpCodes))]
@@ -28,7 +27,6 @@
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.Emit.OperandType))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.Emit.PackingSize))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.Emit.StackBehaviour))]
-#endif
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.CallingConventions))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.EventAttributes))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.FieldAttributes))]
index b2bb49ecfd1b431029d66f45927f36d0e712e26b..374132468e61aebb09604f1e0bac3efe928001f5 100644 (file)
@@ -14,8 +14,6 @@ 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.Reflection.TypeExtensions/Requires.cs b/mcs/class/Facades/System.Reflection.TypeExtensions/Requires.cs
new file mode 100644 (file)
index 0000000..339981b
--- /dev/null
@@ -0,0 +1,17 @@
+// 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.
+
+namespace System.Reflection
+{
+    internal static class Requires
+    {
+        internal static void NotNull(object obj, string name)
+        {
+            if (obj == null)
+            {
+                throw new ArgumentNullException(name);
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/mcs/class/Facades/System.Reflection.TypeExtensions/SR.cs b/mcs/class/Facades/System.Reflection.TypeExtensions/SR.cs
new file mode 100644 (file)
index 0000000..0a1ae28
--- /dev/null
@@ -0,0 +1,4 @@
+partial class SR
+{
+       public const string NoMetadataTokenAvailable = "There is no metadata token available for the given member.";
+}
\ No newline at end of file
diff --git a/mcs/class/Facades/System.Reflection.TypeExtensions/TypeExtensions.CoreCLR.cs b/mcs/class/Facades/System.Reflection.TypeExtensions/TypeExtensions.CoreCLR.cs
new file mode 100644 (file)
index 0000000..661cd67
--- /dev/null
@@ -0,0 +1,400 @@
+// 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.
+
+// NOTE: These are extension methods in the contract, but plain static methods
+// in this implementation. This is done to avoid confusion around what would 
+// look like infinite recursion in the implementation. Callers compiled against
+// the contract will still be able to invoke them as extension methods and get
+// source compatibility with classic reflection code.
+//
+// However, this does not apply if there is no 1:1 correspondence with an instance
+// in mscorlib. New extension methods should be marked with 'this'.
+
+namespace System.Reflection
+{
+    public static class TypeExtensions
+    {
+        public static ConstructorInfo GetConstructor(Type type, Type[] types)
+        {
+            Requires.NotNull(type, nameof(type));
+            return type.GetConstructor(types);
+        }
+
+        public static ConstructorInfo[] GetConstructors(Type type)
+        {
+            Requires.NotNull(type, nameof(type));
+            return type.GetConstructors();
+        }
+
+        public static ConstructorInfo[] GetConstructors(Type type, BindingFlags bindingAttr)
+        {
+            Requires.NotNull(type, nameof(type));
+            return type.GetConstructors(bindingAttr);
+        }
+
+        public static MemberInfo[] GetDefaultMembers(Type type)
+        {
+            Requires.NotNull(type, nameof(type));
+            return type.GetDefaultMembers();
+        }
+
+        public static EventInfo GetEvent(Type type, string name)
+        {
+            Requires.NotNull(type, nameof(type));
+            return type.GetEvent(name);
+        }
+
+        public static EventInfo GetEvent(Type type, string name, BindingFlags bindingAttr)
+        {
+            Requires.NotNull(type, nameof(type));
+            return type.GetEvent(name, bindingAttr);
+        }
+
+        public static EventInfo[] GetEvents(Type type)
+        {
+            Requires.NotNull(type, nameof(type));
+            return type.GetEvents();
+        }
+
+        public static EventInfo[] GetEvents(Type type, BindingFlags bindingAttr)
+        {
+            Requires.NotNull(type, nameof(type));
+            return type.GetEvents(bindingAttr);
+        }
+
+        public static FieldInfo GetField(Type type, string name)
+        {
+            Requires.NotNull(type, nameof(type));
+            return type.GetField(name);
+        }
+
+        public static FieldInfo GetField(Type type, string name, BindingFlags bindingAttr)
+        {
+            Requires.NotNull(type, nameof(type));
+            return type.GetField(name, bindingAttr);
+        }
+
+        public static FieldInfo[] GetFields(Type type)
+        {
+            Requires.NotNull(type, nameof(type));
+            return type.GetFields();
+        }
+
+        public static FieldInfo[] GetFields(Type type, BindingFlags bindingAttr)
+        {
+            Requires.NotNull(type, nameof(type));
+            return type.GetFields(bindingAttr);
+        }
+
+        public static Type[] GetGenericArguments(Type type)
+        {
+            Requires.NotNull(type, nameof(type));
+            return type.GetGenericArguments();
+        }
+
+        public static Type[] GetInterfaces(Type type)
+        {
+            Requires.NotNull(type, nameof(type));
+            return type.GetInterfaces();
+        }
+
+        public static MemberInfo[] GetMember(Type type, string name)
+        {
+            Requires.NotNull(type, nameof(type));
+            return type.GetMember(name);
+        }
+
+        public static MemberInfo[] GetMember(Type type, string name, BindingFlags bindingAttr)
+        {
+            Requires.NotNull(type, nameof(type));
+            return type.GetMember(name, bindingAttr);
+        }
+
+        public static MemberInfo[] GetMembers(Type type)
+        {
+            Requires.NotNull(type, nameof(type));
+            return type.GetMembers();
+        }
+
+        public static MemberInfo[] GetMembers(Type type, BindingFlags bindingAttr)
+        {
+            Requires.NotNull(type, nameof(type));
+            return type.GetMembers(bindingAttr);
+        }
+
+        public static MethodInfo GetMethod(Type type, string name)
+        {
+            Requires.NotNull(type, nameof(type));
+            return type.GetMethod(name);
+        }
+
+        public static MethodInfo GetMethod(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)
+        {
+            Requires.NotNull(type, nameof(type));
+            return type.GetMethod(name, types);
+        }
+
+        public static MethodInfo[] GetMethods(Type type)
+        {
+            Requires.NotNull(type, nameof(type));
+            return type.GetMethods();
+        }
+
+        public static MethodInfo[] GetMethods(Type type, BindingFlags bindingAttr)
+        {
+            Requires.NotNull(type, nameof(type));
+            return type.GetMethods(bindingAttr);
+        }
+
+        public static Type GetNestedType(Type type, string name, BindingFlags bindingAttr)
+        {
+            Requires.NotNull(type, nameof(type));
+            return type.GetNestedType(name, bindingAttr);
+        }
+
+        public static Type[] GetNestedTypes(Type type, BindingFlags bindingAttr)
+        {
+            Requires.NotNull(type, nameof(type));
+            return type.GetNestedTypes(bindingAttr);
+        }
+
+        public static PropertyInfo[] GetProperties(Type type)
+        {
+            Requires.NotNull(type, nameof(type));
+            return type.GetProperties();
+        }
+
+        public static PropertyInfo[] GetProperties(Type type, BindingFlags bindingAttr)
+        {
+            Requires.NotNull(type, nameof(type));
+            return type.GetProperties(bindingAttr);
+        }
+
+        public static PropertyInfo GetProperty(Type type, string name)
+        {
+            Requires.NotNull(type, nameof(type));
+            return type.GetProperty(name);
+        }
+
+        public static PropertyInfo GetProperty(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)
+        {
+            Requires.NotNull(type, nameof(type));
+            return type.GetProperty(name, returnType);
+        }
+
+        public static PropertyInfo GetProperty(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)
+        {
+            Requires.NotNull(type, nameof(type));
+            return type.IsAssignableFrom(c);
+        }
+
+        public static bool IsInstanceOfType(Type type, object o)
+        {
+            Requires.NotNull(type, nameof(type));
+            return type.IsInstanceOfType(o);
+        }
+    }
+
+    public static class AssemblyExtensions
+    {
+        public static Type[] GetExportedTypes(Assembly assembly)
+        {
+            Requires.NotNull(assembly, nameof(assembly));
+            return assembly.GetExportedTypes();
+        }
+
+        public static Module[] GetModules(Assembly assembly)
+        {
+            Requires.NotNull(assembly, nameof(assembly));
+            return assembly.GetModules();
+        }
+
+        public static Type[] GetTypes(Assembly assembly)
+        {
+            Requires.NotNull(assembly, nameof(assembly));
+            return assembly.GetTypes();
+        }
+    }
+
+    public static class EventInfoExtensions
+    {
+        public static MethodInfo GetAddMethod(EventInfo eventInfo)
+        {
+            Requires.NotNull(eventInfo, nameof(eventInfo));
+            return eventInfo.GetAddMethod();
+        }
+
+        public static MethodInfo GetAddMethod(EventInfo eventInfo, bool nonPublic)
+        {
+            Requires.NotNull(eventInfo, nameof(eventInfo));
+            return eventInfo.GetAddMethod(nonPublic);
+        }
+
+        public static MethodInfo GetRaiseMethod(EventInfo eventInfo)
+        {
+            Requires.NotNull(eventInfo, nameof(eventInfo));
+            return eventInfo.GetRaiseMethod();
+        }
+
+        public static MethodInfo GetRaiseMethod(EventInfo eventInfo, bool nonPublic)
+        {
+            Requires.NotNull(eventInfo, nameof(eventInfo));
+            return eventInfo.GetRaiseMethod(nonPublic);
+        }
+
+        public static MethodInfo GetRemoveMethod(EventInfo eventInfo)
+        {
+            Requires.NotNull(eventInfo, nameof(eventInfo));
+            return eventInfo.GetRemoveMethod();
+        }
+
+        public static MethodInfo GetRemoveMethod(EventInfo eventInfo, bool nonPublic)
+        {
+            Requires.NotNull(eventInfo, nameof(eventInfo));
+            return eventInfo.GetRemoveMethod(nonPublic);
+        }
+    }
+
+    public static class MemberInfoExtensions
+    {
+
+        /// <summary>
+        /// Determines if there is a metadata token available for the given member.
+        /// <see cref="GetMetadataToken(MemberInfo)"/> throws <see cref="InvalidOperationException"/> otherwise.
+        /// </summary>
+        /// <remarks>This maybe</remarks>
+        public static bool HasMetadataToken(this MemberInfo member)
+        {
+            Requires.NotNull(member, nameof(member));
+
+            try
+            {
+                return GetMetadataTokenOrZeroOrThrow(member) != 0;
+            }
+            catch (InvalidOperationException)
+            {
+                // Thrown for unbaked ref-emit members/types. 
+                // Other cases such as typeof(byte[]).MetadataToken will be handled by comparison to zero above.
+                return false;
+            }
+        }
+
+        /// <summary>
+        /// Gets a metadata token for the given member if available. The returned token is never nil.
+        /// </summary>
+        /// <exception cref="InvalidOperationException">
+        /// There is no metadata token available. <see cref="HasMetadataToken(MemberInfo)"/> returns false in this case.
+        /// </exception>
+        public static int GetMetadataToken(this MemberInfo member)
+        {
+            Requires.NotNull(member, nameof(member));
+
+            int token = GetMetadataTokenOrZeroOrThrow(member); 
+
+            if (token == 0)
+            {
+                throw new InvalidOperationException(SR.NoMetadataTokenAvailable);
+            }
+
+            return token;
+        }
+
+        private static int GetMetadataTokenOrZeroOrThrow(MemberInfo member)
+        {
+            int token = member.MetadataToken;
+
+            // Tokens have MSB = table index, 3 LSBs = row index
+            // row index of 0 is a nil token 
+            const int rowMask = 0x00FFFFFF;
+            if ((token & rowMask) == 0)
+            {
+                // Nil token is returned for edge cases like typeof(byte[]).MetadataToken.
+                return 0;
+            }
+
+            return token;
+         }
+    }
+
+    public static class MethodInfoExtensions
+    {
+        public static MethodInfo GetBaseDefinition(MethodInfo method)
+        {
+            Requires.NotNull(method, nameof(method));
+            return method.GetBaseDefinition();
+        }
+    }
+
+    public static class ModuleExtensions
+    {
+        public static bool HasModuleVersionId(this Module module)
+        {
+            Requires.NotNull(module, nameof(module));
+            return true; // not expected to fail on platforms with Module.ModuleVersionId built-in.
+        }
+
+        public static Guid GetModuleVersionId(this Module module)
+        {
+            Requires.NotNull(module, nameof(module));
+            return module.ModuleVersionId;
+        }
+    }
+
+    public static class PropertyInfoExtensions
+    {
+        public static MethodInfo[] GetAccessors(PropertyInfo property)
+        {
+            Requires.NotNull(property, nameof(property));
+            return property.GetAccessors();
+        }
+
+        public static MethodInfo[] GetAccessors(PropertyInfo property, bool nonPublic)
+        {
+            Requires.NotNull(property, nameof(property));
+            return property.GetAccessors(nonPublic);
+        }
+
+        public static MethodInfo GetGetMethod(PropertyInfo property)
+        {
+            Requires.NotNull(property, nameof(property));
+            return property.GetGetMethod();
+        }
+
+        public static MethodInfo GetGetMethod(PropertyInfo property, bool nonPublic)
+        {
+            Requires.NotNull(property, nameof(property));
+            return property.GetGetMethod(nonPublic);
+        }
+
+        public static MethodInfo GetSetMethod(PropertyInfo property)
+        {
+            Requires.NotNull(property, nameof(property));
+            return property.GetSetMethod();
+        }
+
+        public static MethodInfo GetSetMethod(PropertyInfo property, bool nonPublic)
+        {
+            Requires.NotNull(property, nameof(property));
+            return property.GetSetMethod(nonPublic);
+        }
+    }
+}
index a6b0138ff61631688ad0fe624a0a658f1de2dc56..757cd13035567a34670186a13eee3f67dddff7f4 100644 (file)
@@ -22,8 +22,3 @@
 
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.BindingFlags))]
 
-//Missing: [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.AssemblyExtensions))]
-//Missing: [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.EventInfoExtensions))]
-//Missing: [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.MethodInfoExtensions))]
-//Missing: [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.PropertyInfoExtensions))]
-//Missing: [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.TypeExtensions))]
index 511c1fe2ed3af0233af458fa162b98c6263d916d..d1d2b4ecb1245ec23878cc0ecb6204e2ecebe71f 100644 (file)
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.TargetInvocationException))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.TargetParameterCountException))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.TypeInfo))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.BindingFlags))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.ICustomAttributeProvider))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.InvalidFilterCriteriaException))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.MemberFilter))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.MemberTypes))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.ParameterModifier))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.TargetException))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.TypeFilter))]
 
index a088678a7fb96c382503db951a7ce8a31e7bc692..94249720f6a1a2130d71d6bacff177e3bd5d47d0 100644 (file)
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.STATSTG))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.CriticalHandle))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.CurrencyWrapper))]
-//[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.CustomQueryInterfaceMode))]
-//[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.CustomQueryInterfaceResult))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.CustomQueryInterfaceMode))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.CustomQueryInterfaceResult))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.DefaultCharSetAttribute))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.DefaultParameterValueAttribute))]
-//[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.DispatchWrapper))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.DispIdAttribute))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.DllImportAttribute))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.DllImportSearchPath))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.UnmanagedType))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.VarEnum))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.VariantWrapper))]
+
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComAwareEventInfo))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComEventsHelper))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.ADVF))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.BIND_OPTS))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.BINDPTR))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.CALLCONV))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.CONNECTDATA))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.DATADIR))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.DESCKIND))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.DISPPARAMS))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.DVASPECT))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.ELEMDESC))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.EXCEPINFO))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.FILETIME))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.FORMATETC))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.FUNCDESC))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.FUNCFLAGS))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.FUNCKIND))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.IAdviseSink))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.IBindCtx))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.IConnectionPoint))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.IConnectionPointContainer))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.IDLDESC))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.IDLFLAG))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.IEnumConnectionPoints))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.IEnumConnections))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.IEnumFORMATETC))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.IEnumMoniker))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.IEnumString))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.IEnumVARIANT))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.IMoniker))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.IMPLTYPEFLAGS))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.INVOKEKIND))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.IPersistFile))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.IRunningObjectTable))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.ITypeComp))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.ITypeInfo))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.ITypeInfo2))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.ITypeLib))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.ITypeLib2))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.LIBFLAGS))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.PARAMDESC))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.PARAMFLAG))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.STATDATA))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.STGMEDIUM))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.SYSKIND))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.TYMED))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.TYPEATTR))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.TYPEDESC))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.TYPEFLAGS))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.TYPEKIND))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.TYPELIBATTR))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.VARDESC))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.VARFLAGS))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.VARKIND))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ICustomQueryInterface))]
\ No newline at end of file
diff --git a/mcs/class/Facades/System.Runtime.Serialization.Formatters/AssemblyInfo.cs b/mcs/class/Facades/System.Runtime.Serialization.Formatters/AssemblyInfo.cs
new file mode 100644 (file)
index 0000000..9b92117
--- /dev/null
@@ -0,0 +1,41 @@
+// 
+// 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.Runtime.CompilerServices;
+
+[assembly: AssemblyTitle ("System.Runtime.Serialization.Formatters.dll")]
+[assembly: AssemblyDescription ("System.Runtime.Serialization.Formatters.dll")]
+[assembly: AssemblyDefaultAlias ("System.Runtime.Serialization.Formatters.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.Runtime.Serialization.Formatters/Makefile b/mcs/class/Facades/System.Runtime.Serialization.Formatters/Makefile
new file mode 100644 (file)
index 0000000..a8c237d
--- /dev/null
@@ -0,0 +1,23 @@
+MCS_BUILD_DIR = ../../../build
+
+thisdir = class/Facades/System.Runtime.Serialization.Formatters
+SUBDIRS = 
+include $(MCS_BUILD_DIR)/rules.make
+
+LIBRARY_SUBDIR = Facades
+LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades
+
+LIBRARY = System.Runtime.Serialization.Formatters.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.Runtime.Serialization.Formatters/System.Runtime.Serialization.Formatters.dll.sources b/mcs/class/Facades/System.Runtime.Serialization.Formatters/System.Runtime.Serialization.Formatters.dll.sources
new file mode 100644 (file)
index 0000000..8e33d4d
--- /dev/null
@@ -0,0 +1,3 @@
+TypeForwarders.cs
+AssemblyInfo.cs
+
diff --git a/mcs/class/Facades/System.Runtime.Serialization.Formatters/TypeForwarders.cs b/mcs/class/Facades/System.Runtime.Serialization.Formatters/TypeForwarders.cs
new file mode 100644 (file)
index 0000000..31daa7c
--- /dev/null
@@ -0,0 +1,32 @@
+// 
+// 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.
+// 
+
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.NonSerializedAttribute))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Serialization.IDeserializationCallback))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Serialization.IFormatterConverter))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Serialization.ISerializable))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Serialization.SerializationEntry))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Serialization.SerializationInfo))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Serialization.SerializationInfoEnumerator))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.SerializableAttribute))]
+
+
diff --git a/mcs/class/Facades/System.Runtime.Serialization.Primitives/ISerializationSurrogateProvider.cs b/mcs/class/Facades/System.Runtime.Serialization.Primitives/ISerializationSurrogateProvider.cs
new file mode 100644 (file)
index 0000000..b14b6df
--- /dev/null
@@ -0,0 +1,32 @@
+// 
+// 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.Runtime.Serialization
+{
+       public interface ISerializationSurrogateProvider
+       {
+               object GetDeserializedObject (object obj, Type targetType);
+               object GetObjectToSerialize (object obj, Type targetType);
+               Type GetSurrogateType (Type type);
+       }
+}
+
index 3a2519549fc638191e38dad30136d69222edbd3a..22a0d90aae49b611b513e31f72ce4ffeaaa5f728 100644 (file)
@@ -14,8 +14,6 @@ SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
 LIB_REFS = System.Runtime.Serialization
 LIB_MCS_FLAGS = $(SIGN_FLAGS) 
 
-PLATFORM_DEBUG_FLAGS =
-
 NO_TEST = yes
 
 include $(MCS_BUILD_DIR)/library.make
index ce3180fe1f18b8bbb783db9d3df0d08ed6686efb..57b2d4db09ccb3689b3f37c1bf4f47cfcb634ab4 100644 (file)
@@ -33,4 +33,4 @@
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Serialization.OnSerializingAttribute))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Serialization.SerializationException))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Serialization.StreamingContext))]
-
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Serialization.InvalidDataContractException))]
diff --git a/mcs/class/Facades/System.Runtime.Serialization.Xml/DataContractSerializerExtensions.cs b/mcs/class/Facades/System.Runtime.Serialization.Xml/DataContractSerializerExtensions.cs
new file mode 100644 (file)
index 0000000..3ccdff7
--- /dev/null
@@ -0,0 +1,84 @@
+// 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 !NO_CODEDOM
+using System.CodeDom;
+#endif
+using System.Collections.ObjectModel;
+using System.Reflection;
+
+namespace System.Runtime.Serialization
+{
+    public static class DataContractSerializerExtensions
+    {
+        public static ISerializationSurrogateProvider GetSerializationSurrogateProvider(this DataContractSerializer serializer) 
+        {
+            SurrogateProviderAdapter adapter = serializer.DataContractSurrogate as SurrogateProviderAdapter;
+            return (adapter == null) ? null : adapter.Provider;
+        }
+
+        public static void SetSerializationSurrogateProvider(this DataContractSerializer serializer, ISerializationSurrogateProvider provider)
+        {
+            // allocate every time, expectation is that this won't happen enough to warrant maintaining a CondtionalWeakTable.
+            IDataContractSurrogate adapter = new SurrogateProviderAdapter(provider);
+
+            // DCS doesn't expose a setter, access the field directly as a workaround
+            typeof(DataContractSerializer)
+              .GetField("dataContractSurrogate", BindingFlags.Instance | BindingFlags.NonPublic)
+              .SetValue(serializer, adapter);
+        }
+
+        private class SurrogateProviderAdapter : IDataContractSurrogate
+        {
+            private ISerializationSurrogateProvider _provider;
+            public SurrogateProviderAdapter(ISerializationSurrogateProvider provider)
+            {
+                _provider = provider;
+            }
+
+            public ISerializationSurrogateProvider Provider { get { return _provider; } }
+            public object GetCustomDataToExport(Type clrType, Type dataContractType)
+            {
+                throw NotImplemented.ByDesign;
+            }
+
+            public object GetCustomDataToExport(MemberInfo memberInfo, Type dataContractType)
+            {
+                throw NotImplemented.ByDesign;
+            }
+
+            public Type GetDataContractType(Type type)
+            {
+                return _provider.GetSurrogateType(type);
+            }
+
+            public object GetDeserializedObject(object obj, Type targetType)
+            {
+                return _provider.GetDeserializedObject(obj, targetType);
+            }
+
+            public void GetKnownCustomDataTypes(Collection<Type> customDataTypes)
+            {
+                throw NotImplemented.ByDesign;
+            }
+
+            public object GetObjectToSerialize(object obj, Type targetType)
+            {
+                return _provider.GetObjectToSerialize(obj, targetType);
+            }
+
+            public Type GetReferencedTypeOnImport(string typeName, string typeNamespace, object customData)
+            {
+                throw NotImplemented.ByDesign;
+            }
+
+#if !NO_CODEDOM
+            public CodeTypeDeclaration ProcessImportedType(CodeTypeDeclaration typeDeclaration, CodeCompileUnit compileUnit)
+            {
+                throw NotImplemented.ByDesign;
+            }
+#endif
+        }
+    }
+}
\ No newline at end of file
index 774289eb4de9e987c0368ce80e90d818c7b7ef7e..1314e94f39d484616a65c08ba57297e6246479c9 100644 (file)
@@ -11,10 +11,12 @@ LIBRARY = System.Runtime.Serialization.Xml.dll
 
 KEY_FILE = ../../msfinal.pub
 SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
-LIB_REFS = System.Runtime.Serialization System.Xml
+LIB_REFS = System System.Runtime.Serialization System.Xml Facades/System.Runtime.Serialization.Primitives
 LIB_MCS_FLAGS = $(SIGN_FLAGS) 
 
-PLATFORM_DEBUG_FLAGS =
+ifeq (2.1, $(FRAMEWORK_VERSION))
+LIB_MCS_FLAGS += /d:NO_CODEDOM
+endif
 
 NO_TEST = yes
 
diff --git a/mcs/class/Facades/System.Runtime.Serialization.Xml/NotImplemented.cs b/mcs/class/Facades/System.Runtime.Serialization.Xml/NotImplemented.cs
new file mode 100644 (file)
index 0000000..26e5342
--- /dev/null
@@ -0,0 +1,32 @@
+// 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.
+
+namespace System
+{
+    //
+    // This class enables one to throw a NotImplementedException using the following idiom:
+    //
+    //     throw NotImplemented.ByDesign;
+    //
+    // Used by methods whose intended implementation is to throw a NotImplementedException (typically
+    // virtual methods in public abstract classes that intended to be subclassed by third parties.)
+    //
+    // This makes it distinguishable both from human eyes and CCI from NYI's that truly represent undone work.
+    //
+    internal static class NotImplemented
+    {
+        internal static Exception ByDesign
+        {
+            get
+            {
+                return new NotImplementedException();
+            }
+        }
+
+        internal static Exception ByDesignWithMessage(String message)
+        {
+            return new NotImplementedException(message);
+        }
+    }
+}
\ No newline at end of file
index bfd4e7e471152d2a9dd1c7fbc18e223e53328c91..38eea612a4779c0ab2f3158a68820eff29a8e8ae 100644 (file)
@@ -36,3 +36,4 @@
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.XmlDictionaryWriter))]
 
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.OnXmlDictionaryReaderClose))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.XmlDictionaryReaderQuotaTypes))]
index 7184eee8b4b3c1e703575c9713013c51d1fe9f09..03f6d00db310d388e7074299c1562c6d5727f99c 100644 (file)
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.IsConst))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.TypeCode))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.UriFormatException))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.ConditionalWeakTable<,>))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.GCHandle))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.GCHandleType))]
diff --git a/mcs/class/Facades/System.Security.Cryptography.Algorithms/AssemblyInfo.cs b/mcs/class/Facades/System.Security.Cryptography.Algorithms/AssemblyInfo.cs
new file mode 100644 (file)
index 0000000..76645c3
--- /dev/null
@@ -0,0 +1,41 @@
+// 
+// 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.Runtime.CompilerServices;
+
+[assembly: AssemblyTitle ("System.Security.Cryptography.Algorithms.dll")]
+[assembly: AssemblyDescription ("System.Security.Cryptography.Algorithms.dll")]
+[assembly: AssemblyDefaultAlias ("System.Security.Cryptography.Algorithms.dll")]
+[assembly: AssemblyCompany ("Xamarin, Inc.")]
+[assembly: AssemblyProduct ("Mono Common Language Infrastructure")]
+[assembly: AssemblyCopyright ("Copyright (c) 2016 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.Security.Cryptography.Algorithms/ECCurve.cs b/mcs/class/Facades/System.Security.Cryptography.Algorithms/ECCurve.cs
new file mode 100644 (file)
index 0000000..3e1733e
--- /dev/null
@@ -0,0 +1,85 @@
+//
+// ECCurve.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.Security.Cryptography
+{
+       [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
+       public struct ECCurve
+       {
+               public byte[] A;
+               public byte[] B;
+               public byte[] Cofactor;
+               public ECCurveType CurveType;
+               public ECPoint G;
+               public HashAlgorithmName? Hash;
+               public byte[] Order;
+               public byte[] Polynomial;
+               public byte[] Prime;
+               public byte[] Seed;
+               public bool IsCharacteristic2 { get { throw new NotImplementedException (); } }
+               public bool IsExplicit { get { throw new NotImplementedException (); } }
+               public bool IsNamed { get { throw new NotImplementedException (); } }
+               public bool IsPrime { get { throw new NotImplementedException (); } }
+               public Oid Oid { get { throw new NotImplementedException (); } }
+               public static ECCurve CreateFromFriendlyName (string oidFriendlyName) { throw new NotImplementedException (); }
+               public static ECCurve CreateFromOid (Oid curveOid) { throw new NotImplementedException (); }
+               public static ECCurve CreateFromValue (string oidValue) { throw new NotImplementedException (); }
+               public void Validate () { throw new NotImplementedException (); }
+
+               public enum ECCurveType
+               {
+                       Implicit = 0,
+                       PrimeShortWeierstrass = 1,
+                       PrimeTwistedEdwards = 2,
+                       PrimeMontgomery = 3,
+                       Characteristic2 = 4,
+                       Named = 5,
+               }
+               
+               public static class NamedCurves
+               {
+                       public static ECCurve brainpoolP160r1 { get { throw new NotImplementedException (); } }
+                       public static ECCurve brainpoolP160t1 { get { throw new NotImplementedException (); } }
+                       public static ECCurve brainpoolP192r1 { get { throw new NotImplementedException (); } }
+                       public static ECCurve brainpoolP192t1 { get { throw new NotImplementedException (); } }
+                       public static ECCurve brainpoolP224r1 { get { throw new NotImplementedException (); } }
+                       public static ECCurve brainpoolP224t1 { get { throw new NotImplementedException (); } }
+                       public static ECCurve brainpoolP256r1 { get { throw new NotImplementedException (); } }
+                       public static ECCurve brainpoolP256t1 { get { throw new NotImplementedException (); } }
+                       public static ECCurve brainpoolP320r1 { get { throw new NotImplementedException (); } }
+                       public static ECCurve brainpoolP320t1 { get { throw new NotImplementedException (); } }
+                       public static ECCurve brainpoolP384r1 { get { throw new NotImplementedException (); } }
+                       public static ECCurve brainpoolP384t1 { get { throw new NotImplementedException (); } }
+                       public static ECCurve brainpoolP512r1 { get { throw new NotImplementedException (); } }
+                       public static ECCurve brainpoolP512t1 { get { throw new NotImplementedException (); } }
+                       public static ECCurve nistP256 { get { throw new NotImplementedException (); } }
+                       public static ECCurve nistP384 { get { throw new NotImplementedException (); } }
+                       public static ECCurve nistP521 { get { throw new NotImplementedException (); } }
+               }
+       }
+}
\ No newline at end of file
diff --git a/mcs/class/Facades/System.Security.Cryptography.Algorithms/ECParameters.cs b/mcs/class/Facades/System.Security.Cryptography.Algorithms/ECParameters.cs
new file mode 100644 (file)
index 0000000..6f1e421
--- /dev/null
@@ -0,0 +1,39 @@
+//
+// ECPArameters.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.Security.Cryptography
+{
+    [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
+    public partial struct ECParameters
+    {
+        public ECCurve Curve;
+        public byte[] D;
+        public ECPoint Q;
+        public void Validate () { throw new NotImplementedException (); }
+    }
+}
\ No newline at end of file
diff --git a/mcs/class/Facades/System.Security.Cryptography.Algorithms/ECPoint.cs b/mcs/class/Facades/System.Security.Cryptography.Algorithms/ECPoint.cs
new file mode 100644 (file)
index 0000000..5693959
--- /dev/null
@@ -0,0 +1,37 @@
+//
+// ECPoint.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.Security.Cryptography
+{
+       [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
+       public struct ECPoint
+       {
+               public byte[] X;
+               public byte[] Y;
+       }
+}
\ No newline at end of file
diff --git a/mcs/class/Facades/System.Security.Cryptography.Algorithms/IncrementalHash.cs b/mcs/class/Facades/System.Security.Cryptography.Algorithms/IncrementalHash.cs
new file mode 100644 (file)
index 0000000..7b39b0d
--- /dev/null
@@ -0,0 +1,42 @@
+//
+// 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.
+//
+
+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 (); }
+    }
+}
\ No newline at end of file
diff --git a/mcs/class/Facades/System.Security.Cryptography.Algorithms/Makefile b/mcs/class/Facades/System.Security.Cryptography.Algorithms/Makefile
new file mode 100644 (file)
index 0000000..e65ee83
--- /dev/null
@@ -0,0 +1,21 @@
+MCS_BUILD_DIR = ../../../build
+
+thisdir = class/Facades/System.Security.Cryptography.Algorithms
+SUBDIRS = 
+include $(MCS_BUILD_DIR)/rules.make
+
+LIBRARY_SUBDIR = Facades
+LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades
+
+LIBRARY = System.Security.Cryptography.Algorithms.dll
+
+KEY_FILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+LIB_REFS = System System.Core
+LIB_MCS_FLAGS = $(SIGN_FLAGS)
+
+NO_TEST = yes
+
+include $(MCS_BUILD_DIR)/library.make
+
+
diff --git a/mcs/class/Facades/System.Security.Cryptography.Algorithms/System.Security.Cryptography.Algorithms.dll.sources b/mcs/class/Facades/System.Security.Cryptography.Algorithms/System.Security.Cryptography.Algorithms.dll.sources
new file mode 100644 (file)
index 0000000..dcb3ff9
--- /dev/null
@@ -0,0 +1,6 @@
+TypeForwarders.cs
+AssemblyInfo.cs
+ECCurve.cs
+ECPoint.cs
+ECParameters.cs
+IncrementalHash.cs
diff --git a/mcs/class/Facades/System.Security.Cryptography.Algorithms/TypeForwarders.cs b/mcs/class/Facades/System.Security.Cryptography.Algorithms/TypeForwarders.cs
new file mode 100644 (file)
index 0000000..5a59369
--- /dev/null
@@ -0,0 +1,46 @@
+// 
+// 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.
+// 
+
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Aes))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.DeriveBytes))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.ECDsa))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.HMACMD5))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.HMACSHA1))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.HMACSHA256))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.HMACSHA384))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.HMACSHA512))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.MD5))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.RandomNumberGenerator))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Rfc2898DeriveBytes))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.RSA))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.RSAEncryptionPadding))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.RSAEncryptionPaddingMode))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.RSAParameters))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.RSASignaturePadding))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.RSASignaturePaddingMode))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.SHA1))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.SHA256))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.SHA384))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.SHA512))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.TripleDES))]
+
+
diff --git a/mcs/class/Facades/System.Security.Cryptography.Cng/AssemblyInfo.cs b/mcs/class/Facades/System.Security.Cryptography.Cng/AssemblyInfo.cs
new file mode 100644 (file)
index 0000000..b902325
--- /dev/null
@@ -0,0 +1,41 @@
+// 
+// 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.Runtime.CompilerServices;
+
+[assembly: AssemblyTitle ("System.Security.Cryptography.Cng.dll")]
+[assembly: AssemblyDescription ("System.Security.Cryptography.Cng.dll")]
+[assembly: AssemblyDefaultAlias ("System.Security.Cryptography.Cng.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.Security.Cryptography.Cng/Makefile b/mcs/class/Facades/System.Security.Cryptography.Cng/Makefile
new file mode 100644 (file)
index 0000000..4912aa3
--- /dev/null
@@ -0,0 +1,23 @@
+MCS_BUILD_DIR = ../../../build
+
+thisdir = class/Facades/System.Security.Cryptography.Cng
+SUBDIRS = 
+include $(MCS_BUILD_DIR)/rules.make
+
+LIBRARY_SUBDIR = Facades
+LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades
+
+LIBRARY = System.Security.Cryptography.Cng.dll
+
+KEY_FILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+LIB_REFS = System System.Core
+LIB_MCS_FLAGS = $(SIGN_FLAGS)
+
+PLATFORM_DEBUG_FLAGS =
+
+NO_TEST = yes
+
+include $(MCS_BUILD_DIR)/library.make
+
+
diff --git a/mcs/class/Facades/System.Security.Cryptography.Cng/System.Security.Cryptography.Cng.dll.sources b/mcs/class/Facades/System.Security.Cryptography.Cng/System.Security.Cryptography.Cng.dll.sources
new file mode 100644 (file)
index 0000000..8e33d4d
--- /dev/null
@@ -0,0 +1,3 @@
+TypeForwarders.cs
+AssemblyInfo.cs
+
diff --git a/mcs/class/Facades/System.Security.Cryptography.Cng/TypeForwarders.cs b/mcs/class/Facades/System.Security.Cryptography.Cng/TypeForwarders.cs
new file mode 100644 (file)
index 0000000..309d6fb
--- /dev/null
@@ -0,0 +1,46 @@
+// 
+// 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.
+// 
+
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(Microsoft.Win32.SafeHandles.SafeNCryptHandle))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(Microsoft.Win32.SafeHandles.SafeNCryptKeyHandle))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(Microsoft.Win32.SafeHandles.SafeNCryptProviderHandle))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(Microsoft.Win32.SafeHandles.SafeNCryptSecretHandle))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.AesCng))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.CngAlgorithm))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.CngAlgorithmGroup))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.CngExportPolicies))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.CngKey))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.CngKeyBlobFormat))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.CngKeyCreationOptions))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.CngKeyCreationParameters))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.CngKeyHandleOpenOptions))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.CngKeyOpenOptions))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.CngKeyUsages))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.CngProperty))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.CngPropertyCollection))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.CngPropertyOptions))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.CngProvider))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.CngUIPolicy))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.CngUIProtectionLevels))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.ECDsaCng))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.RSACng))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.TripleDESCng))]
diff --git a/mcs/class/Facades/System.Security.Cryptography.Csp/AssemblyInfo.cs b/mcs/class/Facades/System.Security.Cryptography.Csp/AssemblyInfo.cs
new file mode 100644 (file)
index 0000000..0d63053
--- /dev/null
@@ -0,0 +1,41 @@
+// 
+// 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.Runtime.CompilerServices;
+
+[assembly: AssemblyTitle ("System.Security.Cryptography.Csp.dll")]
+[assembly: AssemblyDescription ("System.Security.Cryptography.Csp.dll")]
+[assembly: AssemblyDefaultAlias ("System.Security.Cryptography.Csp.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.Security.Cryptography.Csp/Makefile b/mcs/class/Facades/System.Security.Cryptography.Csp/Makefile
new file mode 100644 (file)
index 0000000..91d0932
--- /dev/null
@@ -0,0 +1,23 @@
+MCS_BUILD_DIR = ../../../build
+
+thisdir = class/Facades/System.Security.Cryptography.Csp
+SUBDIRS = 
+include $(MCS_BUILD_DIR)/rules.make
+
+LIBRARY_SUBDIR = Facades
+LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades
+
+LIBRARY = System.Security.Cryptography.Csp.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.Security.Cryptography.Csp/System.Security.Cryptography.Csp.dll.sources b/mcs/class/Facades/System.Security.Cryptography.Csp/System.Security.Cryptography.Csp.dll.sources
new file mode 100644 (file)
index 0000000..8e33d4d
--- /dev/null
@@ -0,0 +1,3 @@
+TypeForwarders.cs
+AssemblyInfo.cs
+
diff --git a/mcs/class/Facades/System.Security.Cryptography.Csp/TypeForwarders.cs b/mcs/class/Facades/System.Security.Cryptography.Csp/TypeForwarders.cs
new file mode 100644 (file)
index 0000000..a854f1f
--- /dev/null
@@ -0,0 +1,30 @@
+// 
+// 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.
+// 
+
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.CspKeyContainerInfo))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.CspParameters))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.CspProviderFlags))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.ICspAsymmetricAlgorithm))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.KeyNumber))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.RSACryptoServiceProvider))]
+
+
index 49d90149966d12bfe89027ff647952642b8490ec..07db287ab8876d9556386139dbb5a00b2dacf602 100644 (file)
@@ -25,5 +25,5 @@
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.OidCollection))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.OidEnumerator))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.OidGroup))]
-
-
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.AsnEncodedDataCollection))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.AsnEncodedDataEnumerator))]
diff --git a/mcs/class/Facades/System.Security.Cryptography.OpenSsl/AssemblyInfo.cs b/mcs/class/Facades/System.Security.Cryptography.OpenSsl/AssemblyInfo.cs
new file mode 100644 (file)
index 0000000..3560bf2
--- /dev/null
@@ -0,0 +1,41 @@
+// 
+// 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.Runtime.CompilerServices;
+
+[assembly: AssemblyTitle ("System.Security.Cryptography.OpenSsl.dll")]
+[assembly: AssemblyDescription ("System.Security.Cryptography.OpenSsl.dll")]
+[assembly: AssemblyDefaultAlias ("System.Security.Cryptography.OpenSsl.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.Security.Cryptography.OpenSsl/ECDsaOpenSsl.cs b/mcs/class/Facades/System.Security.Cryptography.OpenSsl/ECDsaOpenSsl.cs
new file mode 100644 (file)
index 0000000..1a2771a
--- /dev/null
@@ -0,0 +1,45 @@
+//
+// ECDsaOpenSsl.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.Security.Cryptography
+{
+       public sealed class ECDsaOpenSsl : ECDsa
+       {
+               public override byte[] SignHash (byte[] hash)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override bool VerifyHash (byte[] hash, byte[] signature)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               // TODO: Implement full contract API
+       }
+}
\ No newline at end of file
diff --git a/mcs/class/Facades/System.Security.Cryptography.OpenSsl/Makefile b/mcs/class/Facades/System.Security.Cryptography.OpenSsl/Makefile
new file mode 100644 (file)
index 0000000..16bae2d
--- /dev/null
@@ -0,0 +1,21 @@
+MCS_BUILD_DIR = ../../../build
+
+thisdir = class/Facades/System.Security.Cryptography.OpenSsl
+SUBDIRS = 
+include $(MCS_BUILD_DIR)/rules.make
+
+LIBRARY_SUBDIR = Facades
+LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades
+
+LIBRARY = System.Security.Cryptography.OpenSsl.dll
+
+KEY_FILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+LIB_REFS = System.Core
+LIB_MCS_FLAGS = $(SIGN_FLAGS)
+
+NO_TEST = yes
+
+include $(MCS_BUILD_DIR)/library.make
+
+
diff --git a/mcs/class/Facades/System.Security.Cryptography.OpenSsl/RSAOpenSsl.cs b/mcs/class/Facades/System.Security.Cryptography.OpenSsl/RSAOpenSsl.cs
new file mode 100644 (file)
index 0000000..4bdcd80
--- /dev/null
@@ -0,0 +1,55 @@
+//
+// RSAOpenSsl.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.Security.Cryptography
+{
+       public sealed class RSAOpenSsl : RSA
+       {
+               public override RSAParameters ExportParameters (bool includePrivateParameters)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override void ImportParameters (RSAParameters parameters)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override byte[] SignHash (byte[] hash, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override bool VerifyHash (byte[] hash, byte[] signature, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               // TODO: Implement full contract API
+       }
+}
\ No newline at end of file
diff --git a/mcs/class/Facades/System.Security.Cryptography.OpenSsl/SafeEvpPKeyHandle.cs b/mcs/class/Facades/System.Security.Cryptography.OpenSsl/SafeEvpPKeyHandle.cs
new file mode 100644 (file)
index 0000000..85fd745
--- /dev/null
@@ -0,0 +1,50 @@
+//
+// SafeEvpPKeyHandle.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.Security.Cryptography
+{
+       public sealed class SafeEvpPKeyHandle : System.Runtime.InteropServices.SafeHandle
+       {
+               public SafeEvpPKeyHandle (IntPtr handle, bool ownsHandle) 
+                       : base (handle, ownsHandle)
+               {
+               }
+
+               public override bool IsInvalid { get { throw new NotImplementedException (); } }
+
+               public SafeEvpPKeyHandle DuplicateHandle ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected override bool ReleaseHandle ()
+               {
+                       return true;
+               }
+       }
+}
\ No newline at end of file
diff --git a/mcs/class/Facades/System.Security.Cryptography.OpenSsl/System.Security.Cryptography.OpenSsl.dll.sources b/mcs/class/Facades/System.Security.Cryptography.OpenSsl/System.Security.Cryptography.OpenSsl.dll.sources
new file mode 100644 (file)
index 0000000..9e2bb4b
--- /dev/null
@@ -0,0 +1,4 @@
+AssemblyInfo.cs
+ECDsaOpenSsl.cs
+RSAOpenSsl.cs
+SafeEvpPKeyHandle.cs
diff --git a/mcs/class/Facades/System.Security.Cryptography.Pkcs/AssemblyInfo.cs b/mcs/class/Facades/System.Security.Cryptography.Pkcs/AssemblyInfo.cs
new file mode 100644 (file)
index 0000000..06089b3
--- /dev/null
@@ -0,0 +1,41 @@
+// 
+// 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.Runtime.CompilerServices;
+
+[assembly: AssemblyTitle ("System.Security.Cryptography.Pkcs.dll")]
+[assembly: AssemblyDescription ("System.Security.Cryptography.Pkcs.dll")]
+[assembly: AssemblyDefaultAlias ("System.Security.Cryptography.Pkcs.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.Security.Cryptography.Pkcs/Makefile b/mcs/class/Facades/System.Security.Cryptography.Pkcs/Makefile
new file mode 100644 (file)
index 0000000..b98a242
--- /dev/null
@@ -0,0 +1,23 @@
+MCS_BUILD_DIR = ../../../build
+
+thisdir = class/Facades/System.Security.Cryptography.Pkcs
+SUBDIRS = 
+include $(MCS_BUILD_DIR)/rules.make
+
+LIBRARY_SUBDIR = Facades
+LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades
+
+LIBRARY = System.Security.Cryptography.Pkcs.dll
+
+KEY_FILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+LIB_REFS = System System.Security
+LIB_MCS_FLAGS = $(SIGN_FLAGS)
+
+PLATFORM_DEBUG_FLAGS =
+
+NO_TEST = yes
+
+include $(MCS_BUILD_DIR)/library.make
+
+
diff --git a/mcs/class/Facades/System.Security.Cryptography.Pkcs/System.Security.Cryptography.Pkcs.dll.sources b/mcs/class/Facades/System.Security.Cryptography.Pkcs/System.Security.Cryptography.Pkcs.dll.sources
new file mode 100644 (file)
index 0000000..8e33d4d
--- /dev/null
@@ -0,0 +1,3 @@
+TypeForwarders.cs
+AssemblyInfo.cs
+
diff --git a/mcs/class/Facades/System.Security.Cryptography.Pkcs/TypeForwarders.cs b/mcs/class/Facades/System.Security.Cryptography.Pkcs/TypeForwarders.cs
new file mode 100644 (file)
index 0000000..db96723
--- /dev/null
@@ -0,0 +1,51 @@
+// 
+// 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.
+// 
+
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.CryptographicAttributeObject))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.CryptographicAttributeObjectCollection))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.CryptographicAttributeObjectEnumerator))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.AlgorithmIdentifier))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.CmsRecipient))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.CmsRecipientCollection))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.CmsRecipientEnumerator))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.ContentInfo))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.EnvelopedCms))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.KeyAgreeRecipientInfo))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.KeyTransRecipientInfo))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.Pkcs9AttributeObject))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.Pkcs9ContentType))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.Pkcs9DocumentDescription))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.Pkcs9DocumentName))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.Pkcs9MessageDigest))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.Pkcs9SigningTime))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.PublicKeyInfo))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.RecipientInfo))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.RecipientInfoCollection))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.RecipientInfoEnumerator))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.RecipientInfoType))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.SubjectIdentifier))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.SubjectIdentifierOrKey))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.SubjectIdentifierOrKeyType))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.SubjectIdentifierType))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Xml.X509IssuerSerial))]
+
+
diff --git a/mcs/class/Facades/System.Security.Cryptography.Primitives/AssemblyInfo.cs b/mcs/class/Facades/System.Security.Cryptography.Primitives/AssemblyInfo.cs
new file mode 100644 (file)
index 0000000..9b7aef5
--- /dev/null
@@ -0,0 +1,41 @@
+// 
+// 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.Runtime.CompilerServices;
+
+[assembly: AssemblyTitle ("System.Security.Cryptography.Primitives.dll")]
+[assembly: AssemblyDescription ("System.Security.Cryptography.Primitives.dll")]
+[assembly: AssemblyDefaultAlias ("System.Security.Cryptography.Primitives.dll")]
+[assembly: AssemblyCompany ("Xamarin, Inc.")]
+[assembly: AssemblyProduct ("Mono Common Language Infrastructure")]
+[assembly: AssemblyCopyright ("Copyright (c) 2016 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.Security.Cryptography.Primitives/Makefile b/mcs/class/Facades/System.Security.Cryptography.Primitives/Makefile
new file mode 100644 (file)
index 0000000..b4c114a
--- /dev/null
@@ -0,0 +1,23 @@
+MCS_BUILD_DIR = ../../../build
+
+thisdir = class/Facades/System.Security.Cryptography.Primitives
+SUBDIRS = 
+include $(MCS_BUILD_DIR)/rules.make
+
+LIBRARY_SUBDIR = Facades
+LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades
+
+LIBRARY = System.Security.Cryptography.Primitives.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.Security.Cryptography.Primitives/System.Security.Cryptography.Primitives.dll.sources b/mcs/class/Facades/System.Security.Cryptography.Primitives/System.Security.Cryptography.Primitives.dll.sources
new file mode 100644 (file)
index 0000000..8e33d4d
--- /dev/null
@@ -0,0 +1,3 @@
+TypeForwarders.cs
+AssemblyInfo.cs
+
diff --git a/mcs/class/Facades/System.Security.Cryptography.Primitives/TypeForwarders.cs b/mcs/class/Facades/System.Security.Cryptography.Primitives/TypeForwarders.cs
new file mode 100644 (file)
index 0000000..ea7934e
--- /dev/null
@@ -0,0 +1,37 @@
+// 
+// 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.
+// 
+
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.AsymmetricAlgorithm))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.CipherMode))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.CryptographicException))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.CryptoStream))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.CryptoStreamMode))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.HashAlgorithm))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.HashAlgorithmName))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.HMAC))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.ICryptoTransform))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.KeyedHashAlgorithm))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.KeySizes))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.PaddingMode))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.SymmetricAlgorithm))]
+
+
index 5ad2d813f95f024e4a80de3a6e15c9458230b531..8b01e585ecba504d93a2d1a4bd423c4c50dacaaf 100644 (file)
@@ -11,7 +11,7 @@ LIBRARY = System.Security.Cryptography.X509Certificates.dll
 
 KEY_FILE = ../../msfinal.pub
 SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
-LIB_REFS = System
+LIB_REFS = System System.Core
 LIB_MCS_FLAGS = $(SIGN_FLAGS) 
 
 PLATFORM_DEBUG_FLAGS =
index 4984b098b6ee8368fa0c8387a97ab2ef254e0514..a653d295fa9fe155769c976867352eb86ea1b73e 100644 (file)
@@ -20,7 +20,7 @@
 // THE SOFTWARE.
 // 
 
-//TODO:[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(Microsoft.Win32.SafeHandles.SafeX509ChainHandle))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(Microsoft.Win32.SafeHandles.SafeX509ChainHandle))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.X509Certificates.OpenFlags))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.X509Certificates.PublicKey))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.X509Certificates.StoreLocation))]
@@ -56,5 +56,6 @@
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.X509Certificates.X509SubjectKeyIdentifierExtension))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.X509Certificates.X509SubjectKeyIdentifierHashAlgorithm))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.X509Certificates.X509VerificationFlags))]
-
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.X509Certificates.ECDsaCertificateExtensions))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.X509Certificates.RSACertificateExtensions))]
 
index 8ce4172c8424c2774d4dcbc268df6062f4d85c46..ec9f05c624574ac277c87dea710a04280e2112c8 100644 (file)
@@ -20,7 +20,7 @@
 // THE SOFTWARE.
 // 
 
-//TODO:[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(Microsoft.Win32.SafeHandles.SafeAccessTokenHandle))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(Microsoft.Win32.SafeHandles.SafeAccessTokenHandle))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Principal.IdentityNotMappedException))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Principal.IdentityReference))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Principal.IdentityReferenceCollection))]
index b33d20dc20261912e900021303cca36c3d41bda3..0569f621974fbf469b5148d5f814caefbeb7aea6 100644 (file)
@@ -14,8 +14,6 @@ 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.Security.SecureString/SecureStringMarshal.cs b/mcs/class/Facades/System.Security.SecureString/SecureStringMarshal.cs
new file mode 100644 (file)
index 0000000..59c85a4
--- /dev/null
@@ -0,0 +1,47 @@
+// 
+// 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.Security
+{
+       public static class SecureStringMarshal
+       {
+               public static IntPtr SecureStringToCoTaskMemAnsi (SecureString s)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public static IntPtr SecureStringToCoTaskMemUnicode (SecureString s)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public static IntPtr SecureStringToGlobalAllocAnsi (SecureString s)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public static IntPtr SecureStringToGlobalAllocUnicode (SecureString s)
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+}
index d8898cbe774bd16160e143039935f1044f732eff..4267f40e03b04ae637899d56dabe6b9413f7075f 100644 (file)
@@ -21,5 +21,3 @@
 // 
 
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.SecureString))]
-
-//Missing: [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.SecureStringMarshal))]
index 89df05537785702076e7b0b9a3cf1831880c4e92..09d884b1527d2768307eaf03833fdba7358813c1 100644 (file)
@@ -20,9 +20,7 @@
 // THE SOFTWARE.
 // 
 
-#if !MOBILE && !XAMMAC_4_5
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.CallbackBehaviorAttribute))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.DuplexChannelFactory<>))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.DuplexClientBase<>))]
-#endif
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.InstanceContext))]
index 57276e7078c989085ee8c8c27997dd707d8a0cdd..4aa28e9e49f0bc660137f259cfe73a0b8d799c84 100644 (file)
@@ -24,6 +24,9 @@
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.BasicHttpMessageCredentialType))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.BasicHttpSecurity))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.BasicHttpSecurityMode))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.BasicHttpsBinding))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.BasicHttpsSecurity))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.BasicHttpsSecurityMode))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.HttpRequestMessageProperty))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.HttpResponseMessageProperty))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.HttpsTransportBindingElement))]
@@ -35,5 +38,6 @@
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.HttpClientCredentialType))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.HttpTransportSecurity))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.NetHttpBinding))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.NetHttpsBinding))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.NetHttpMessageEncoding))]
 
index a80d1c6fd126c5c9ffc8e0b8923fd9805bb0910e..f03bc06d93c1d117a36572cdb9a3b1f8c7b00d76 100644 (file)
@@ -20,7 +20,6 @@
 // THE SOFTWARE.
 // 
 
-#if !MOBILE && !XAMMAC_4_5
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.ConnectionOrientedTransportBindingElement))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.SslStreamSecurityBindingElement))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.TcpConnectionPoolSettings))]
@@ -30,5 +29,4 @@
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.NetTcpBinding))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.NetTcpSecurity))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.TcpTransportSecurity))]
-#endif
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.TcpClientCredentialType))]
index 5f65e0599a30b14d256482f517c0ec7e66a5e4db..3c12456831dcfa7317f2aff4f559a6628a26463a 100644 (file)
@@ -11,10 +11,13 @@ LIBRARY = System.ServiceModel.Primitives.dll
 
 KEY_FILE = ../../msfinal.pub
 SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
-LIB_REFS = System.ServiceModel System.Xml
-LIB_MCS_FLAGS = $(SIGN_FLAGS) 
+LIB_REFS = System System.ServiceModel System.Xml Facades/System.Security.Cryptography.X509Certificates
+
+ifneq (2.1, $(FRAMEWORK_VERSION))
+LIB_REFS += System.IdentityModel
+endif
 
-PLATFORM_DEBUG_FLAGS =
+LIB_MCS_FLAGS = $(SIGN_FLAGS) 
 
 NO_TEST = yes
 
index 8e33d4ddeae92bde7aa8afd994db5d90d6af18d9..f43e364288ecdfe39cf6ad30ee2590de8b775429 100644 (file)
@@ -1,3 +1,9 @@
 TypeForwarders.cs
 AssemblyInfo.cs
 
+../../../build/common/MonoTODOAttribute.cs
+X509ServiceCertificateAuthentication_mobile.cs
+X509CertificateValidator_mobile.cs
+X509CertificateValidationMode_mobile.cs
+X509CertificateRecipientClientCredential_mobile.cs
+X509CertificateInitiatorClientCredential_mobile.cs
index 38f834268c4ea888b5202436dcba723b72667add..b584fc0b8ee576cb82de3adc696344b0ee063b26 100644 (file)
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.MessageContractMemberAttribute))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.MessageCredentialType))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.MessageHeader<>))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.MessageHeaderAttribute))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.MessageHeaderException))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.MessageParameterAttribute))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.OperationContext))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.UnknownMessageReceivedEventArgs))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.XmlSerializerFormatAttribute))]
 
+#if !MOBILE && !XAMMAC_4_5
+
+// TODO: These are implemented as stubs in the facade directly on mobile (contrary to Desktop where they're forwarded to System.ServiceModel.dll/System.IdentityModel.dll).
+// I'm not 100% sure this is the right approach, but Marek thinks it's fine so I'm sticking with it for now.
+// The problem on mobile is that types like X509CertificateValidator live in System.IdentityModel.dll which is not built for mobile.
+
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IdentityModel.Selectors.X509CertificateValidator))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Security.X509CertificateValidationMode))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Security.X509ServiceCertificateAuthentication))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Security.X509CertificateInitiatorClientCredential))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Security.X509CertificateRecipientClientCredential))]
+
+#endif
diff --git a/mcs/class/Facades/System.ServiceModel.Primitives/X509CertificateInitiatorClientCredential_mobile.cs b/mcs/class/Facades/System.ServiceModel.Primitives/X509CertificateInitiatorClientCredential_mobile.cs
new file mode 100644 (file)
index 0000000..daf321c
--- /dev/null
@@ -0,0 +1,72 @@
+//
+// X509CertificateInitiatorClientCredential_mobile.cs
+//
+// Author:
+//   Alexander Köplinger (alexander.koeplinger@xamarin.com)
+//
+// (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.
+//
+
+#if MOBILE || XAMMAC_4_5
+
+using System.Security.Cryptography.X509Certificates;
+
+namespace System.ServiceModel.Security
+{
+       public sealed class X509CertificateInitiatorClientCredential
+       {
+               [MonoTODO]
+               public X509Certificate2 Certificate
+               {
+                       get
+                       {
+                               throw new NotImplementedException ();
+                       }
+                       set
+                       {
+                               throw new NotImplementedException ();
+                       }
+               }
+
+               [MonoTODO]
+               internal X509CertificateInitiatorClientCredential()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public void SetCertificate(StoreLocation storeLocation, StoreName storeName, X509FindType findType, object findValue)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public void SetCertificate(string subjectName, StoreLocation storeLocation, StoreName storeName)
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+}
+
+#endif
\ No newline at end of file
diff --git a/mcs/class/Facades/System.ServiceModel.Primitives/X509CertificateRecipientClientCredential_mobile.cs b/mcs/class/Facades/System.ServiceModel.Primitives/X509CertificateRecipientClientCredential_mobile.cs
new file mode 100644 (file)
index 0000000..3545b72
--- /dev/null
@@ -0,0 +1,117 @@
+//
+// X509CertificateRecipientClientCredential_mobile.cs
+//
+// Author:
+//   Alexander Köplinger (alexander.koeplinger@xamarin.com)
+//
+// (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.
+//
+
+#if MOBILE || XAMMAC_4_5
+
+using System;
+using System.Collections.Generic;
+using System.Security.Cryptography.X509Certificates;
+
+namespace System.ServiceModel.Security
+{
+       public sealed class X509CertificateRecipientClientCredential
+       {
+               [MonoTODO]
+               public X509ServiceCertificateAuthentication Authentication
+               {
+                       get
+                       {
+                               throw new NotImplementedException ();
+                       }
+               }
+
+               [MonoTODO]
+               public X509Certificate2 DefaultCertificate
+               {
+                       get
+                       {
+                               throw new NotImplementedException ();
+                       }
+                       set
+                       {
+                               throw new NotImplementedException ();
+                       }
+               }
+
+               [MonoTODO]
+               public Dictionary<Uri, X509Certificate2> ScopedCertificates
+               {
+                       get
+                       {
+                               throw new NotImplementedException ();
+                       }
+               }
+
+               [MonoTODO]
+               public X509ServiceCertificateAuthentication SslCertificateAuthentication
+               {
+                       get
+                       {
+                               throw new NotImplementedException ();
+                       }
+                       set
+                       {
+                               throw new NotImplementedException ();
+                       }
+               }
+
+               [MonoTODO]
+               internal X509CertificateRecipientClientCredential ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public void SetDefaultCertificate(StoreLocation storeLocation, StoreName storeName, X509FindType findType, object findValue)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public void SetDefaultCertificate(string subjectName, StoreLocation storeLocation, StoreName storeName)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public void SetScopedCertificate(StoreLocation storeLocation, StoreName storeName, X509FindType findType, object findValue, Uri targetService)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public void SetScopedCertificate(string subjectName, StoreLocation storeLocation, StoreName storeName, Uri targetService)
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+}
+
+#endif
\ No newline at end of file
diff --git a/mcs/class/Facades/System.ServiceModel.Primitives/X509CertificateValidationMode_mobile.cs b/mcs/class/Facades/System.ServiceModel.Primitives/X509CertificateValidationMode_mobile.cs
new file mode 100644 (file)
index 0000000..34b1d24
--- /dev/null
@@ -0,0 +1,45 @@
+//
+// X509CertificateValidationMode_mobile.cs
+//
+// Author:
+//   Alexander Köplinger (alexander.koeplinger@xamarin.com)
+//
+// (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.
+//
+
+#if MOBILE || XAMMAC_4_5
+
+namespace System.ServiceModel.Security
+{
+       public enum X509CertificateValidationMode
+       {
+               None,
+               PeerTrust,
+               ChainTrust,
+               PeerOrChainTrust,
+               Custom
+       }
+}
+
+#endif
\ No newline at end of file
diff --git a/mcs/class/Facades/System.ServiceModel.Primitives/X509CertificateValidator_mobile.cs b/mcs/class/Facades/System.ServiceModel.Primitives/X509CertificateValidator_mobile.cs
new file mode 100644 (file)
index 0000000..734e990
--- /dev/null
@@ -0,0 +1,43 @@
+//
+// X509CertificateValidator_mobile.cs
+//
+// Author:
+//   Alexander Köplinger (alexander.koeplinger@xamarin.com)
+//
+// (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.
+//
+
+#if MOBILE || XAMMAC_4_5
+
+using System.Security.Cryptography.X509Certificates;
+
+namespace System.IdentityModel.Selectors
+{
+       public abstract class X509CertificateValidator
+       {
+               public abstract void Validate (X509Certificate2 certificate);
+       }
+}
+
+#endif
\ No newline at end of file
diff --git a/mcs/class/Facades/System.ServiceModel.Primitives/X509ServiceCertificateAuthentication_mobile.cs b/mcs/class/Facades/System.ServiceModel.Primitives/X509ServiceCertificateAuthentication_mobile.cs
new file mode 100644 (file)
index 0000000..725cbd9
--- /dev/null
@@ -0,0 +1,95 @@
+//
+// X509ServiceCertificateAuthentication_mobile.cs
+//
+// Author:
+//   Alexander Köplinger (alexander.koeplinger@xamarin.com)
+//
+// (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.
+//
+
+#if MOBILE || XAMMAC_4_5
+
+using System;
+using System.IdentityModel.Selectors;
+using System.Security.Cryptography.X509Certificates;
+
+namespace System.ServiceModel.Security
+{
+       public sealed class X509ServiceCertificateAuthentication
+       {
+               [MonoTODO]
+               public X509CertificateValidationMode CertificateValidationMode
+               {
+                       get
+                       {
+                               throw new NotImplementedException ();
+                       }
+                       set
+                       {
+                               throw new NotImplementedException ();
+                       }
+               }
+
+               [MonoTODO]
+               public X509CertificateValidator CustomCertificateValidator
+               {
+                       get
+                       {
+                               throw new NotImplementedException ();
+                       }
+                       set
+                       {
+                               throw new NotImplementedException ();
+                       }
+               }
+
+               [MonoTODO]
+               public X509RevocationMode RevocationMode
+               {
+                       get
+                       {
+                               throw new NotImplementedException ();
+                       }
+                       set
+                       {
+                               throw new NotImplementedException ();
+                       }
+               }
+
+               [MonoTODO]
+               public StoreLocation TrustedStoreLocation
+               {
+                       get
+                       {
+                               throw new NotImplementedException ();
+                       }
+                       set
+                       {
+                               throw new NotImplementedException ();
+                       }
+               }
+       }
+}
+
+#endif
\ No newline at end of file
index 61d5b5a04468de6b95b1eac09e189e718aee5d87..a11a6f59a06ab3d71757b8bea625794700b88c2f 100644 (file)
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.SecurityBindingElement))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.SecurityHeaderLayout))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.TransportSecurityBindingElement))]
-#if !MOBILE
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.DnsEndpointIdentity))]
-#if !XAMMAC_4_5
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.MessageSecurityVersion))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.SpnEndpointIdentity))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.UpnEndpointIdentity))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Security.BasicSecurityProfileVersion))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Security.SecureConversationVersion))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Security.SecurityPolicyVersion))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Security.SecurityVersion))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Security.TrustVersion))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Security.Tokens.SecureConversationSecurityTokenParameters))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Security.Tokens.SecurityTokenParameters))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Security.Tokens.SupportingTokenParameters))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Security.Tokens.UserNameSecurityTokenParameters))]
-[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Security.TrustVersion))]
-#endif
-[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.SpnEndpointIdentity))]
-[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.UpnEndpointIdentity))]
-#endif
index 2724a34a105c35861c75080253a8dbf96d954e99..fe6edb861f243350862241c72bc293d517f30973 100644 (file)
@@ -11,10 +11,15 @@ LIBRARY = System.ServiceProcess.ServiceController.dll
 
 KEY_FILE = ../../msfinal.pub
 SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
-LIB_REFS = System System.ServiceProcess
-LIB_MCS_FLAGS = $(SIGN_FLAGS)
+LIB_REFS = System
+
+ifneq (2.1, $(FRAMEWORK_VERSION))
+ifndef XAMMAC_4_5
+LIB_REFS += System.ServiceProcess
+endif
+endif
 
-PLATFORM_DEBUG_FLAGS =
+LIB_MCS_FLAGS = $(SIGN_FLAGS)
 
 NO_TEST = yes
 
diff --git a/mcs/class/Facades/System.ServiceProcess.ServiceController/ServiceControllerStatus_mobile.cs b/mcs/class/Facades/System.ServiceProcess.ServiceController/ServiceControllerStatus_mobile.cs
new file mode 100644 (file)
index 0000000..f233c8b
--- /dev/null
@@ -0,0 +1,49 @@
+//
+// ServiceControllerStatus_mobile.cs
+//
+// Author:
+//   Alexander Köplinger (alexander.koeplinger@xamarin.com)
+//
+// (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.
+//
+
+#if MOBILE || XAMMAC_4_5
+
+using System;
+
+namespace System.ServiceProcess
+{
+       public enum ServiceControllerStatus
+       {
+               ContinuePending = 5,
+               Paused = 7,
+               PausePending = 6,
+               Running = 4,
+               StartPending = 2,
+               Stopped = 1,
+               StopPending = 3
+       }
+}
+
+#endif
\ No newline at end of file
diff --git a/mcs/class/Facades/System.ServiceProcess.ServiceController/ServiceController_mobile.cs b/mcs/class/Facades/System.ServiceProcess.ServiceController/ServiceController_mobile.cs
new file mode 100644 (file)
index 0000000..f84a27d
--- /dev/null
@@ -0,0 +1,246 @@
+//
+// ServiceController_mobile.cs
+//
+// Author:
+//   Alexander Köplinger (alexander.koeplinger@xamarin.com)
+//
+// (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.
+//
+
+#if MOBILE || XAMMAC_4_5
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace System.ServiceProcess
+{
+       public class ServiceController : IDisposable
+       {
+               [MonoTODO]
+               public bool CanPauseAndContinue
+               {
+                       get
+                       {
+                               throw new NotImplementedException ();
+                       }
+               }
+
+               [MonoTODO]
+               public bool CanShutdown
+               {
+                       get
+                       {
+                               throw new NotImplementedException ();
+                       }
+               }
+
+               [MonoTODO]
+               public bool CanStop
+               {
+                       get
+                       {
+                               throw new NotImplementedException ();
+                       }
+               }
+
+               [MonoTODO]
+               public ServiceController[] DependentServices
+               {
+                       get
+                       {
+                               throw new NotImplementedException ();
+                       }
+               }
+
+               [MonoTODO]
+               public string DisplayName
+               {
+                       get
+                       {
+                               throw new NotImplementedException ();
+                       }
+               }
+
+               [MonoTODO]
+               public string MachineName
+               {
+                       get
+                       {
+                               throw new NotImplementedException ();
+                       }
+               }
+
+               [MonoTODO]
+               public SafeHandle ServiceHandle
+               {
+                       get
+                       {
+                               throw new NotImplementedException ();
+                       }
+               }
+
+               [MonoTODO]
+               public string ServiceName
+               {
+                       get
+                       {
+                               throw new NotImplementedException ();
+                       }
+               }
+
+               [MonoTODO]
+               public ServiceController[] ServicesDependedOn
+               {
+                       get
+                       {
+                               throw new NotImplementedException ();
+                       }
+               }
+
+               [MonoTODO]
+               public ServiceType ServiceType
+               {
+                       get
+                       {
+                               throw new NotImplementedException ();
+                       }
+               }
+
+               [MonoTODO]
+               public ServiceStartMode StartType
+               {
+                       get
+                       {
+                               throw new NotImplementedException ();
+                       }
+               }
+
+               [MonoTODO]
+               public ServiceControllerStatus Status
+               {
+                       get
+                       {
+                               throw new NotImplementedException ();
+                       }
+               }
+
+               [MonoTODO]
+               public ServiceController (string name)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public ServiceController (string name, string machineName)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public void Continue ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public void Dispose ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               protected virtual void Dispose (bool disposing)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static ServiceController[] GetDevices ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static ServiceController[] GetDevices (string machineName)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static ServiceController[] GetServices ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static ServiceController[] GetServices (string machineName)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public void Pause ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public void Refresh ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public void Start ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public void Start (string[] args)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public void Stop ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public void WaitForStatus (ServiceControllerStatus desiredStatus)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public void WaitForStatus (ServiceControllerStatus desiredStatus, TimeSpan timeout)
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+}
+
+#endif
\ No newline at end of file
diff --git a/mcs/class/Facades/System.ServiceProcess.ServiceController/ServiceStartMode_mobile.cs b/mcs/class/Facades/System.ServiceProcess.ServiceController/ServiceStartMode_mobile.cs
new file mode 100644 (file)
index 0000000..3c875c3
--- /dev/null
@@ -0,0 +1,47 @@
+//
+// ServiceStartMode_mobile.cs
+//
+// Author:
+//   Alexander Köplinger (alexander.koeplinger@xamarin.com)
+//
+// (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.
+//
+
+#if MOBILE || XAMMAC_4_5
+
+using System;
+
+namespace System.ServiceProcess
+{
+       public enum ServiceStartMode
+       {
+               Automatic = 2,
+               Boot = 0,
+               Disabled = 4,
+               Manual = 3,
+               System = 1
+       }
+}
+
+#endif
diff --git a/mcs/class/Facades/System.ServiceProcess.ServiceController/ServiceType_mobile.cs b/mcs/class/Facades/System.ServiceProcess.ServiceController/ServiceType_mobile.cs
new file mode 100644 (file)
index 0000000..ba4f144
--- /dev/null
@@ -0,0 +1,50 @@
+//
+// ServiceType_mobile.cs
+//
+// Author:
+//   Alexander Köplinger (alexander.koeplinger@xamarin.com)
+//
+// (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.
+//
+
+#if MOBILE || XAMMAC_4_5
+
+using System;
+
+namespace System.ServiceProcess
+{
+       [Flags]
+       public enum ServiceType
+       {
+               Adapter = 4,
+               FileSystemDriver = 2,
+               InteractiveProcess = 256,
+               KernelDriver = 1,
+               RecognizerDriver = 8,
+               Win32OwnProcess = 16,
+               Win32ShareProcess = 32
+       }
+}
+
+#endif
\ No newline at end of file
index 8e33d4ddeae92bde7aa8afd994db5d90d6af18d9..56e080d93c71d2f98ec884932141f6130b6e1a11 100644 (file)
@@ -1,3 +1,9 @@
 TypeForwarders.cs
 AssemblyInfo.cs
 
+../../../build/common/MonoTODOAttribute.cs
+ServiceController_mobile.cs
+ServiceControllerStatus_mobile.cs
+ServiceStartMode_mobile.cs
+ServiceType_mobile.cs
+TimeoutException_mobile.cs
diff --git a/mcs/class/Facades/System.ServiceProcess.ServiceController/TimeoutException_mobile.cs b/mcs/class/Facades/System.ServiceProcess.ServiceController/TimeoutException_mobile.cs
new file mode 100644 (file)
index 0000000..c6448d8
--- /dev/null
@@ -0,0 +1,59 @@
+//
+// TimeoutException_mobile.cs
+//
+// Author:
+//   Alexander Köplinger (alexander.koeplinger@xamarin.com)
+//
+// (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.
+//
+
+#if MOBILE || XAMMAC_4_5
+
+using System;
+
+namespace System.ServiceProcess
+{
+       public class TimeoutException : Exception
+       {
+               [MonoTODO]
+               public TimeoutException ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public TimeoutException (string message)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public TimeoutException (string message, Exception innerException)
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+}
+
+#endif
\ No newline at end of file
index 6a21dfc46f16d0792d9767b3c339f812719ff881..b14584243c26246101e1057892c5015b3beedf59 100644 (file)
 // THE SOFTWARE.
 // 
 
+#if !MOBILE && !XAMMAC_4_5
+
+// TODO: These are implemented as stubs in the facade directly on mobile 
+
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceProcess.ServiceController))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceProcess.ServiceControllerStatus))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceProcess.ServiceStartMode))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceProcess.ServiceType))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceProcess.TimeoutException))]
 
-
+#endif
diff --git a/mcs/class/Facades/System.Text.Encoding.CodePages/AssemblyInfo.cs b/mcs/class/Facades/System.Text.Encoding.CodePages/AssemblyInfo.cs
new file mode 100644 (file)
index 0000000..568942d
--- /dev/null
@@ -0,0 +1,41 @@
+// 
+// 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.Runtime.CompilerServices;
+
+[assembly: AssemblyTitle ("System.Text.Encoding.CodePages.dll")]
+[assembly: AssemblyDescription ("System.Text.Encoding.CodePages.dll")]
+[assembly: AssemblyDefaultAlias ("System.Text.Encoding.CodePages.dll")]
+[assembly: AssemblyCompany ("Xamarin, Inc.")]
+[assembly: AssemblyProduct ("Mono Common Language Infrastructure")]
+[assembly: AssemblyCopyright ("Copyright (c) 2016 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.Text.Encoding.CodePages/CodePagesEncodingProvider.cs b/mcs/class/Facades/System.Text.Encoding.CodePages/CodePagesEncodingProvider.cs
new file mode 100644 (file)
index 0000000..0933eee
--- /dev/null
@@ -0,0 +1,53 @@
+// 
+// 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.Text
+{
+       public sealed class CodePagesEncodingProvider : EncodingProvider
+       {
+               static readonly CodePagesEncodingProvider instance = new CodePagesEncodingProvider ();
+
+               private CodePagesEncodingProvider ()
+               {
+               }
+               
+               public static EncodingProvider Instance {
+                       get {
+                               return instance;
+                       }
+               }
+
+               public override Encoding GetEncoding (string name)
+               {
+                       // MSDN: "if name is not the name of an encoding that you support, the method should return null."
+                       // We do this here since all our encodings are already supported by the main Encoding class
+                       return null;
+               }
+
+               public override Encoding GetEncoding (int codepage)
+               {
+                       // MSDN: "if codepage is not the code page identifier of an encoding that you support, the method should return null."
+                       // We do this here since all our encodings are already supported by the main Encoding class
+                       return null;
+               }
+       }
+}
\ No newline at end of file
diff --git a/mcs/class/Facades/System.Text.Encoding.CodePages/Makefile b/mcs/class/Facades/System.Text.Encoding.CodePages/Makefile
new file mode 100644 (file)
index 0000000..3c678ee
--- /dev/null
@@ -0,0 +1,21 @@
+MCS_BUILD_DIR = ../../../build
+
+thisdir = class/Facades/System.Text.Encoding.CodePages
+SUBDIRS = 
+include $(MCS_BUILD_DIR)/rules.make
+
+LIBRARY_SUBDIR = Facades
+LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades
+
+LIBRARY = System.Text.Encoding.CodePages.dll
+
+KEY_FILE = ../../msfinal.pub
+SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
+LIB_REFS = System
+LIB_MCS_FLAGS = $(SIGN_FLAGS)
+
+NO_TEST = yes
+
+include $(MCS_BUILD_DIR)/library.make
+
+
diff --git a/mcs/class/Facades/System.Text.Encoding.CodePages/System.Text.Encoding.CodePages.dll.sources b/mcs/class/Facades/System.Text.Encoding.CodePages/System.Text.Encoding.CodePages.dll.sources
new file mode 100644 (file)
index 0000000..db2c267
--- /dev/null
@@ -0,0 +1,2 @@
+AssemblyInfo.cs
+CodePagesEncodingProvider.cs
index be4c7cc58bcba3d1a50e548ba714a4e61834e821..f9b4d759a44030f2263947be81d3d59b0b951110 100644 (file)
@@ -30,4 +30,5 @@
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Text.RegularExpressions.Regex))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Text.RegularExpressions.RegexMatchTimeoutException))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Text.RegularExpressions.RegexOptions))]
-
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Text.RegularExpressions.RegexRunner))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Text.RegularExpressions.RegexRunnerFactory))]
index b0c9264a03b466ee7b50290b3c4b12b5fb140b92..a5de66c999827fa2f60998ed9448505878d30238 100644 (file)
@@ -14,8 +14,6 @@ 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
index 8e33d4ddeae92bde7aa8afd994db5d90d6af18d9..0d28c343986eccda5535c44d498db69ce8ebe08e 100644 (file)
@@ -1,3 +1,5 @@
 TypeForwarders.cs
 AssemblyInfo.cs
 
+../../../build/common/MonoTODOAttribute.cs
+ThreadingAclExtensions.cs
diff --git a/mcs/class/Facades/System.Threading.AccessControl/ThreadingAclExtensions.cs b/mcs/class/Facades/System.Threading.AccessControl/ThreadingAclExtensions.cs
new file mode 100644 (file)
index 0000000..af61a50
--- /dev/null
@@ -0,0 +1,75 @@
+//
+// ThreadingAclExtensions.cs
+//
+// Author:
+//   Alexander Köplinger (alexander.koeplinger@xamarin.com)
+//
+// (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.Security.AccessControl;
+using System.Diagnostics.Contracts;
+
+namespace System.Threading
+{
+    public static class ThreadingAclExtensions
+    {
+        [MonoTODO]
+        public static EventWaitHandleSecurity GetAccessControl (EventWaitHandle handle)
+        {
+            throw new NotImplementedException ();
+        }
+
+        [MonoTODO]
+        public static void SetAccessControl (EventWaitHandle handle, EventWaitHandleSecurity eventSecurity)
+        {
+            throw new NotImplementedException ();
+        }
+
+        [MonoTODO]
+        public static MutexSecurity GetAccessControl (Mutex mutex)
+        {
+            throw new NotImplementedException ();
+        }
+
+        [MonoTODO]
+        public static void SetAccessControl (Mutex mutex, MutexSecurity mutexSecurity)
+        {
+            throw new NotImplementedException ();
+        }
+
+        [MonoTODO]
+        public static SemaphoreSecurity GetAccessControl (Semaphore semaphore)
+        {
+            throw new NotImplementedException ();
+        }
+
+        [MonoTODO]
+        public static void SetAccessControl (Semaphore semaphore, SemaphoreSecurity semaphoreSecurity)
+        {
+            throw new NotImplementedException ();
+        }
+    }
+}
\ No newline at end of file
index 8871794f349eda4ffb387ac87098498bfc9ca7a6..02fbd79cc8f8358c1719bd402b0d4c30ac5fe365 100644 (file)
@@ -33,4 +33,3 @@
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.AccessControl.SemaphoreRights))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.AccessControl.SemaphoreSecurity))]
 
-//Missing: [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.ThreadingAclExtensions))]
diff --git a/mcs/class/Facades/System.Threading.Overlapped/ClrThreadPoolBoundHandle.cs b/mcs/class/Facades/System.Threading.Overlapped/ClrThreadPoolBoundHandle.cs
new file mode 100644 (file)
index 0000000..40253fb
--- /dev/null
@@ -0,0 +1,315 @@
+// 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.Diagnostics;
+using System.Runtime.InteropServices;
+
+namespace System.Threading
+{
+    //
+    // Implementation of ThreadPoolBoundHandle that sits on top of the CLR's ThreadPool and Overlapped infrastructure
+    //
+
+    /// <summary>
+    ///     Represents an I/O handle that is bound to the system thread pool and enables low-level
+    ///     components to receive notifications for asynchronous I/O operations.
+    /// </summary>
+    public sealed partial class ThreadPoolBoundHandle : IDisposable
+    {
+        private readonly SafeHandle _handle;
+        private bool _isDisposed;
+
+        private ThreadPoolBoundHandle(SafeHandle handle)
+        {
+            _handle = handle;
+        }
+
+        /// <summary>
+        ///     Gets the bound operating system handle.
+        /// </summary>
+        /// <value>
+        ///     A <see cref="SafeHandle"/> object that holds the bound operating system handle.
+        /// </value>
+        public SafeHandle Handle
+        {
+            get { return _handle; }
+        }
+
+        /// <summary>
+        ///     Returns a <see cref="ThreadPoolBoundHandle"/> for the specific handle, 
+        ///     which is bound to the system thread pool.
+        /// </summary>
+        /// <param name="handle">
+        ///     A <see cref="SafeHandle"/> object that holds the operating system handle. The 
+        ///     handle must have been opened for overlapped I/O on the unmanaged side.
+        /// </param>
+        /// <returns>
+        ///     <see cref="ThreadPoolBoundHandle"/> for <paramref name="handle"/>, which 
+        ///     is bound to the system thread pool.
+        /// </returns>
+        /// <exception cref="ArgumentNullException">
+        ///     <paramref name="handle"/> is <see langword="null"/>.
+        /// </exception>
+        /// <exception cref="ArgumentException">
+        ///     <paramref name="handle"/> has been disposed.
+        ///     <para>
+        ///         -or-
+        ///     </para>
+        ///     <paramref name="handle"/> does not refer to a valid I/O handle.
+        ///     <para>
+        ///         -or-
+        ///     </para>
+        ///     <paramref name="handle"/> refers to a handle that has not been opened 
+        ///     for overlapped I/O.
+        ///     <para>
+        ///         -or-
+        ///     </para>
+        ///     <paramref name="handle"/> refers to a handle that has already been bound.
+        /// </exception>
+        /// <remarks>
+        ///     This method should be called once per handle.
+        ///     <para>
+        ///         -or-
+        ///     </para>
+        ///     <see cref="ThreadPoolBoundHandle"/> does not take ownership of <paramref name="handle"/>, 
+        ///     it remains the responsibility of the caller to call <see cref="SafeHandle.Dispose"/>.
+        /// </remarks>
+        public static ThreadPoolBoundHandle BindHandle(SafeHandle handle)
+        {
+            if (handle == null)
+                throw new ArgumentNullException(nameof(handle));
+
+            if (handle.IsClosed || handle.IsInvalid)
+                throw new ArgumentException(SR.Argument_InvalidHandle, nameof(handle));
+
+            try
+            {
+                // ThreadPool.BindHandle will always return true, otherwise, it throws. See the underlying FCall
+                // implementation in ThreadPoolNative::CorBindIoCompletionCallback to see the implementation.
+                bool succeeded = ThreadPool.BindHandle(handle);
+                Debug.Assert(succeeded);
+            }
+            catch (Exception ex)
+            {   // BindHandle throws ApplicationException on full CLR and Exception on CoreCLR.
+                // We do not let either of these leak and convert them to ArgumentException to 
+                // indicate that the specified handles are invalid.
+
+                if (ex.HResult == System.HResults.E_HANDLE)         // Bad handle
+                    throw new ArgumentException(SR.Argument_InvalidHandle, nameof(handle));
+
+                if (ex.HResult == System.HResults.E_INVALIDARG)     // Handle already bound or sync handle
+                    throw new ArgumentException(SR.Argument_AlreadyBoundOrSyncHandle, nameof(handle));
+
+                throw;
+            }
+
+            return new ThreadPoolBoundHandle(handle);
+        }
+
+        /// <summary>
+        ///     Returns an unmanaged pointer to a <see cref="NativeOverlapped"/> structure, specifying 
+        ///     a delegate that is invoked when the asynchronous I/O operation is complete, a user-provided 
+        ///     object providing context, and managed objects that serve as buffers.
+        /// </summary>
+        /// <param name="callback">
+        ///     An <see cref="IOCompletionCallback"/> delegate that represents the callback method 
+        ///     invoked when the asynchronous I/O operation completes.
+        /// </param>
+        /// <param name="state">
+        ///     A user-provided object that distinguishes this <see cref="NativeOverlapped"/> from other 
+        ///     <see cref="NativeOverlapped"/> instances. Can be <see langword="null"/>.
+        /// </param>
+        /// <param name="pinData">
+        ///     An object or array of objects representing the input or output buffer for the operation. Each 
+        ///     object represents a buffer, for example an array of bytes.  Can be <see langword="null"/>.
+        /// </param>
+        /// <returns>
+        ///     An unmanaged pointer to a <see cref="NativeOverlapped"/> structure.
+        /// </returns>
+        /// <remarks>
+        ///     <para>
+        ///         The unmanaged pointer returned by this method can be passed to the operating system in 
+        ///         overlapped I/O operations. The <see cref="NativeOverlapped"/> structure is fixed in 
+        ///         physical memory until <see cref="FreeNativeOverlapped(NativeOverlapped*)"/> is called.
+        ///     </para>
+        ///     <para>
+        ///         The buffer or buffers specified in <paramref name="pinData"/> must be the same as those passed 
+        ///         to the unmanaged operating system function that performs the asynchronous I/O.
+        ///     </para>
+        ///     <note>
+        ///         The buffers specified in <paramref name="pinData"/> are pinned for the duration of 
+        ///         the I/O operation.
+        ///     </note>
+        /// </remarks>
+        /// <exception cref="ArgumentNullException">
+        ///     <paramref name="callback"/> is <see langword="null"/>.
+        /// </exception>
+        /// <exception cref="ObjectDisposedException">
+        ///     This method was called after the <see cref="ThreadPoolBoundHandle"/> was disposed.
+        /// </exception>
+        public unsafe NativeOverlapped* AllocateNativeOverlapped(IOCompletionCallback callback, object state, object pinData)
+        {
+            if (callback == null)
+                throw new ArgumentNullException(nameof(callback));
+
+            EnsureNotDisposed();
+
+            ThreadPoolBoundHandleOverlapped overlapped = new ThreadPoolBoundHandleOverlapped(callback, state, pinData, preAllocated: null);
+            overlapped._boundHandle = this;
+            return overlapped._nativeOverlapped;
+        }
+
+        /// <summary>
+        ///     Returns an unmanaged pointer to a <see cref="NativeOverlapped"/> structure, using the callback,
+        ///     state, and buffers associated with the specified <see cref="PreAllocatedOverlapped"/> object.
+        /// </summary>
+        /// <param name="preAllocated">
+        ///     A <see cref="PreAllocatedOverlapped"/> object from which to create the NativeOverlapped pointer.
+        /// </param>
+        /// <returns>
+        ///     An unmanaged pointer to a <see cref="NativeOverlapped"/> structure.
+        /// </returns>
+        /// <remarks>
+        ///     <para>
+        ///         The unmanaged pointer returned by this method can be passed to the operating system in 
+        ///         overlapped I/O operations. The <see cref="NativeOverlapped"/> structure is fixed in 
+        ///         physical memory until <see cref="FreeNativeOverlapped(NativeOverlapped*)"/> is called.
+        ///     </para>
+        /// </remarks>
+        /// <exception cref="ArgumentNullException">
+        ///     <paramref name="preAllocated"/> is <see langword="null"/>.
+        /// </exception>
+        /// <exception cref="ArgumentException">
+        ///     <paramref name="preAllocated"/> is currently in use for another I/O operation.  
+        /// </exception>
+        /// <exception cref="ObjectDisposedException">
+        ///     This method was called after the <see cref="ThreadPoolBoundHandle"/> was disposed, or 
+        ///     this method was called after <paramref name="preAllocated"/> was disposed.
+        /// </exception>
+        /// <seealso cref="PreAllocatedOverlapped"/>
+        public unsafe NativeOverlapped* AllocateNativeOverlapped(PreAllocatedOverlapped preAllocated)
+        {
+            if (preAllocated == null)
+                throw new ArgumentNullException(nameof(preAllocated));
+
+            EnsureNotDisposed();
+
+            preAllocated.AddRef();
+            try
+            {
+                ThreadPoolBoundHandleOverlapped overlapped = preAllocated._overlapped;
+
+                if (overlapped._boundHandle != null)
+                    throw new ArgumentException(SR.Argument_PreAllocatedAlreadyAllocated, nameof(preAllocated));
+
+                overlapped._boundHandle = this;
+
+                return overlapped._nativeOverlapped;
+            }
+            catch
+            {
+                preAllocated.Release();
+                throw;
+            }
+        }
+
+        /// <summary>
+        ///     Frees the unmanaged memory associated with a <see cref="NativeOverlapped"/> structure 
+        ///     allocated by the <see cref="AllocateNativeOverlapped"/> method.
+        /// </summary>
+        /// <param name="overlapped">
+        ///     An unmanaged pointer to the <see cref="NativeOverlapped"/> structure to be freed.
+        /// </param>
+        /// <remarks>
+        ///     <note type="caution">
+        ///         You must call the <see cref="FreeNativeOverlapped(NativeOverlapped*)"/> method exactly once 
+        ///         on every <see cref="NativeOverlapped"/> unmanaged pointer allocated using the 
+        ///         <see cref="AllocateNativeOverlapped"/> method. 
+        ///         If you do not call the <see cref="FreeNativeOverlapped(NativeOverlapped*)"/> method, you will 
+        ///         leak memory. If you call the <see cref="FreeNativeOverlapped(NativeOverlapped*)"/> method more 
+        ///         than once on the same <see cref="NativeOverlapped"/> unmanaged pointer, memory will be corrupted.
+        ///     </note>
+        /// </remarks>
+        /// <exception cref="ArgumentNullException">
+        ///     <paramref name="overlapped"/> is <see langword="null"/>.
+        /// </exception>
+        /// <exception cref="ObjectDisposedException">
+        ///     This method was called after the <see cref="ThreadPoolBoundHandle"/> was disposed.
+        /// </exception>
+        public unsafe void FreeNativeOverlapped(NativeOverlapped* overlapped)
+        {
+            if (overlapped == null)
+                throw new ArgumentNullException(nameof(overlapped));
+
+            // Note: we explicitly allow FreeNativeOverlapped calls after the ThreadPoolBoundHandle has been Disposed.
+
+            ThreadPoolBoundHandleOverlapped wrapper = GetOverlappedWrapper(overlapped, this);
+
+            if (wrapper._boundHandle != this)
+                throw new ArgumentException(SR.Argument_NativeOverlappedWrongBoundHandle, nameof(overlapped));
+
+            if (wrapper._preAllocated != null)
+                wrapper._preAllocated.Release();
+            else
+                Overlapped.Free(overlapped);
+        }
+
+        /// <summary>
+        ///     Returns the user-provided object specified when the <see cref="NativeOverlapped"/> instance was
+        ///     allocated using the <see cref="AllocateNativeOverlapped(IOCompletionCallback, object, byte[])"/>.
+        /// </summary>
+        /// <param name="overlapped">
+        ///     An unmanaged pointer to the <see cref="NativeOverlapped"/> structure from which to return the 
+        ///     asscociated user-provided object.
+        /// </param>
+        /// <returns>
+        ///     A user-provided object that distinguishes this <see cref="NativeOverlapped"/> 
+        ///     from other <see cref="NativeOverlapped"/> instances, otherwise, <see langword="null"/> if one was 
+        ///     not specified when the instance was allocated using <see cref="AllocateNativeOverlapped"/>.
+        /// </returns>
+        /// <exception cref="ArgumentNullException">
+        ///     <paramref name="overlapped"/> is <see langword="null"/>.
+        /// </exception>
+        public unsafe static object GetNativeOverlappedState(NativeOverlapped* overlapped)
+        {
+            if (overlapped == null)
+                throw new ArgumentNullException(nameof(overlapped));
+
+            ThreadPoolBoundHandleOverlapped wrapper = GetOverlappedWrapper(overlapped, null);
+            Debug.Assert(wrapper._boundHandle != null);
+            return wrapper._userState;
+        }
+
+        private static unsafe ThreadPoolBoundHandleOverlapped GetOverlappedWrapper(NativeOverlapped* overlapped, ThreadPoolBoundHandle expectedBoundHandle)
+        {
+            ThreadPoolBoundHandleOverlapped wrapper;
+            try
+            {
+                wrapper = (ThreadPoolBoundHandleOverlapped)Overlapped.Unpack(overlapped);
+            }
+            catch (NullReferenceException ex)
+            {
+                throw new ArgumentException(SR.Argument_NativeOverlappedAlreadyFree, nameof(overlapped), ex);
+            }
+
+            return wrapper;
+        }
+
+        public void Dispose()
+        {
+            // .NET Native's version of ThreadPoolBoundHandle that wraps the Win32 ThreadPool holds onto
+            // native resources so it needs to be disposable. To match the contract, we are also disposable.
+            // We also implement a disposable state to mimic behavior between this implementation and 
+            // .NET Native's version (code written against us, will also work against .NET Native's version).
+            _isDisposed = true;
+        }
+
+
+        private void EnsureNotDisposed()
+        {
+            if (_isDisposed)
+                throw new ObjectDisposedException(GetType().ToString());
+        }
+    }
+}
\ No newline at end of file
diff --git a/mcs/class/Facades/System.Threading.Overlapped/ClrThreadPoolBoundHandleOverlapped.cs b/mcs/class/Facades/System.Threading.Overlapped/ClrThreadPoolBoundHandleOverlapped.cs
new file mode 100644 (file)
index 0000000..2245254
--- /dev/null
@@ -0,0 +1,50 @@
+// 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.
+
+namespace System.Threading
+{
+    /// <summary>
+    /// Overlapped subclass adding data needed by ThreadPoolBoundHandle.
+    /// </summary>
+    internal sealed class ThreadPoolBoundHandleOverlapped : Overlapped
+    {
+        private readonly IOCompletionCallback _userCallback;
+        internal readonly object _userState;
+        internal PreAllocatedOverlapped _preAllocated;
+        internal unsafe NativeOverlapped* _nativeOverlapped;
+        internal ThreadPoolBoundHandle _boundHandle;
+        internal bool _completed;
+
+        public unsafe ThreadPoolBoundHandleOverlapped(IOCompletionCallback callback, object state, object pinData, PreAllocatedOverlapped preAllocated)
+        {
+            _userCallback = callback;
+            _userState = state;
+            _preAllocated = preAllocated;
+
+            _nativeOverlapped = Pack(CompletionCallback, pinData);
+            _nativeOverlapped->OffsetLow = 0;        // CLR reuses NativeOverlapped instances and does not reset these
+            _nativeOverlapped->OffsetHigh = 0;
+        }
+
+        private unsafe static void CompletionCallback(uint errorCode, uint numBytes, NativeOverlapped* nativeOverlapped)
+        {
+            ThreadPoolBoundHandleOverlapped overlapped = (ThreadPoolBoundHandleOverlapped)Overlapped.Unpack(nativeOverlapped);
+
+            //
+            // The Win32 thread pool implementation of ThreadPoolBoundHandle does not permit reuse of NativeOverlapped
+            // pointers without freeing them and allocating new a new one.  We need to ensure that code using the CLR
+            // ThreadPool implementation follows those rules.
+            //
+            if (overlapped._completed)
+                throw new InvalidOperationException(SR.InvalidOperation_NativeOverlappedReused);
+
+            overlapped._completed = true;
+
+            if (overlapped._boundHandle == null)
+                throw new InvalidOperationException(SR.Argument_NativeOverlappedAlreadyFree);
+
+            overlapped._userCallback(errorCode, numBytes, nativeOverlapped);
+        }
+    }
+}
\ No newline at end of file
diff --git a/mcs/class/Facades/System.Threading.Overlapped/ClrThreadPoolPreAllocatedOverlapped.cs b/mcs/class/Facades/System.Threading.Overlapped/ClrThreadPoolPreAllocatedOverlapped.cs
new file mode 100644 (file)
index 0000000..dfc7d47
--- /dev/null
@@ -0,0 +1,104 @@
+// 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.
+
+namespace System.Threading
+{
+    /// <summary>
+    /// Represents pre-allocated state for native overlapped I/O operations.
+    /// </summary>
+    /// <seealso cref="ThreadPoolBoundHandle.AllocateNativeOverlapped(PreAllocatedOverlapped)"/>
+    public sealed class PreAllocatedOverlapped : IDisposable, IDeferredDisposable
+    {
+        internal readonly ThreadPoolBoundHandleOverlapped _overlapped;
+        private DeferredDisposableLifetime<PreAllocatedOverlapped> _lifetime;
+
+        /// <summary>
+        ///     Initializes a new instance of the <see cref="PreAllocatedOverlapped"/> class, specifying 
+        ///     a delegate that is invoked when each asynchronous I/O operation is complete, a user-provided 
+        ///     object providing context, and managed objects that serve as buffers.
+        /// </summary>
+        /// <param name="callback">
+        ///     An <see cref="IOCompletionCallback"/> delegate that represents the callback method 
+        ///     invoked when each asynchronous I/O operation completes.
+        /// </param>
+        /// <param name="state">
+        ///     A user-provided object that distinguishes <see cref="NativeOverlapped"/> instance produced from this
+        ///     object from other <see cref="NativeOverlapped"/> instances. Can be <see langword="null"/>.
+        /// </param>
+        /// <param name="pinData">
+        ///     An object or array of objects representing the input or output buffer for the operations. Each 
+        ///     object represents a buffer, for example an array of bytes.  Can be <see langword="null"/>.
+        /// </param>
+        /// <remarks>
+        ///     The new <see cref="PreAllocatedOverlapped"/> instance can be passed to 
+        ///     <see cref="ThreadPoolBoundHandle.AllocateNativeOverlapped(PreAllocatedOverlapped)"/>, to produce
+        ///     a <see cref="NativeOverlapped"/> instance that can be passed to the operating system in overlapped
+        ///     I/O operations.  A single <see cref="PreAllocatedOverlapped"/> instance can only be used for 
+        ///     a single native I/O operation at a time.  However, the state stored in the <see cref="PreAllocatedOverlapped"/>
+        ///     instance can be reused for subsequent native operations.
+        ///     <note>
+        ///         The buffers specified in <paramref name="pinData"/> are pinned until <see cref="Dispose"/> is called.
+        ///     </note>
+        /// </remarks>
+        /// <exception cref="ArgumentNullException">
+        ///     <paramref name="callback"/> is <see langword="null"/>.
+        /// </exception>
+        /// <exception cref="ObjectDisposedException">
+        ///     This method was called after the <see cref="ThreadPoolBoundHandle"/> was disposed.
+        /// </exception>
+        public unsafe PreAllocatedOverlapped(IOCompletionCallback callback, object state, object pinData)
+        {
+            if (callback == null)
+                throw new ArgumentNullException(nameof(callback));
+
+            _overlapped = new ThreadPoolBoundHandleOverlapped(callback, state, pinData, this);
+        }
+
+        internal bool AddRef()
+        {
+            return _lifetime.AddRef(this);
+        }
+
+        internal void Release()
+        {
+            _lifetime.Release(this);
+        }
+
+        /// <summary>
+        /// Frees the resources associated with this <see cref="PreAllocatedOverlapped"/> instance. 
+        /// </summary>
+        public unsafe void Dispose()
+        {
+            _lifetime.Dispose(this);
+            GC.SuppressFinalize(this);
+        }
+
+        ~PreAllocatedOverlapped()
+        {
+            //
+            // During shutdown, don't automatically clean up, because this instance may still be
+            // reachable/usable by other code.
+            //
+            if (!Environment.HasShutdownStarted)
+                Dispose();
+        }
+
+        unsafe void IDeferredDisposable.OnFinalRelease(bool disposed)
+        {
+            if (_overlapped != null)
+            {
+                if (disposed)
+                {
+                    Overlapped.Free(_overlapped._nativeOverlapped);
+                }
+                else
+                {
+                    _overlapped._boundHandle = null;
+                    _overlapped._completed = false;
+                    *_overlapped._nativeOverlapped = default(NativeOverlapped);
+                }
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/mcs/class/Facades/System.Threading.Overlapped/DeferredDisposableLifetime.cs b/mcs/class/Facades/System.Threading.Overlapped/DeferredDisposableLifetime.cs
new file mode 100644 (file)
index 0000000..2450906
--- /dev/null
@@ -0,0 +1,116 @@
+// 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.Diagnostics;
+
+namespace System.Threading
+{
+    /// <summary>
+    /// Provides callbacks to objects whose lifetime is managed by <see cref="DeferredDisposableLifetime{T}"/>.
+    /// </summary>
+    internal interface IDeferredDisposable
+    {
+        /// <summary>
+        /// Called when the object's refcount reaches zero.
+        /// </summary>
+        /// <param name="disposed">
+        /// Indicates whether the object has been disposed.
+        /// </param>
+        /// <remarks>
+        /// If the refount reaches zero before the object is disposed, this method will be called with
+        /// <paramref name="disposed"/> set to false.  If the object is then disposed, this method will be
+        /// called again, with <paramref name="disposed"/> set to true.  If the refcount reaches zero
+        /// after the object has already been disposed, this will be called a single time, with 
+        /// <paramref name="disposed"/> set to true.
+        /// </remarks>
+        void OnFinalRelease(bool disposed);
+    }
+
+    /// <summary>
+    /// Manages the lifetime of an object which implements IDisposable, but which must defer the actual
+    /// cleanup of state until all existing uses of the object are complete.
+    /// </summary>
+    /// <typeparam name="T">The type of object whose lifetime will be managed.</typeparam>
+    /// <remarks>
+    /// This type maintains a reference count, and tracks whether the object has been disposed.  When
+    /// Callbacks are made to <see cref="IDeferredDisposable.OnFinalRelease(bool)"/> when the refcount
+    /// reaches zero.  Objects that need to defer cleanup until they have been disposed *and* they have
+    /// no more references can do so in <see cref="IDeferredDisposable.OnFinalRelease(bool)"/> when
+    /// 'disposed' is true.
+    /// </remarks>
+    internal struct DeferredDisposableLifetime<T> where T : class, IDeferredDisposable
+    {
+        //
+        // _count is positive until Dispose is called, after which it's (-1 - refcount).
+        //
+        private int _count;
+
+        public bool AddRef(T obj)
+        {
+            while (true)
+            {
+                int oldCount = Volatile.Read(ref _count);
+
+                // Have we been disposed?
+                if (oldCount < 0)
+                    throw new ObjectDisposedException(typeof(T).ToString());
+
+                int newCount = checked(oldCount + 1);
+
+                if (Interlocked.CompareExchange(ref _count, newCount, oldCount) == oldCount)
+                    return true;
+            }
+        }
+
+        public void Release(T obj)
+        {
+            while (true)
+            {
+                int oldCount = Volatile.Read(ref _count);
+                if (oldCount > 0)
+                {
+                    // We haven't been disposed.  Decrement _count.
+                    int newCount = oldCount - 1;
+                    if (Interlocked.CompareExchange(ref _count, newCount, oldCount) == oldCount)
+                    {
+                        if (newCount == 0)
+                            obj.OnFinalRelease(disposed: false);
+                        return;
+                    }
+                }
+                else
+                {
+                    Debug.Assert(oldCount != 0 && oldCount != -1);
+
+                    // We've been disposed.  Increment _count.
+                    int newCount = oldCount + 1;
+                    if (Interlocked.CompareExchange(ref _count, newCount, oldCount) == oldCount)
+                    {
+                        if (newCount == -1)
+                            obj.OnFinalRelease(disposed: true);
+                        return;
+                    }
+                }
+            }
+        }
+
+        public void Dispose(T obj)
+        {
+            while (true)
+            {
+                int oldCount = Volatile.Read(ref _count);
+                if (oldCount < 0)
+                    return; // already disposed
+
+                int newCount = -1 - oldCount;
+                if (Interlocked.CompareExchange(ref _count, newCount, oldCount) == oldCount)
+                {
+                    if (newCount == -1)
+                        obj.OnFinalRelease(disposed: true);
+                    return;
+                }
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/mcs/class/Facades/System.Threading.Overlapped/HResults.cs b/mcs/class/Facades/System.Threading.Overlapped/HResults.cs
new file mode 100644 (file)
index 0000000..ef9a772
--- /dev/null
@@ -0,0 +1,38 @@
+//
+// HResults.cs
+//
+// Author:
+//   Alexander Köplinger (alexander.koeplinger@xamarin.com)
+//
+// (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.
+//
+
+namespace System
+{
+       internal static class HResults
+       {
+               internal const int E_HANDLE = unchecked((int)0x80070006);
+               internal const int E_INVALIDARG = unchecked((int)0x80070057);
+       }
+}
\ No newline at end of file
index 460fb4aff26d042fd0beb0c5b8bb7cd8ced7eb27..a36686196bb6166454cc863758e702ab05ac4fe9 100644 (file)
@@ -12,9 +12,7 @@ LIBRARY = System.Threading.Overlapped.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 =
+LIB_MCS_FLAGS = $(SIGN_FLAGS) -unsafe
 
 NO_TEST = yes
 
diff --git a/mcs/class/Facades/System.Threading.Overlapped/SR.cs b/mcs/class/Facades/System.Threading.Overlapped/SR.cs
new file mode 100644 (file)
index 0000000..a65446d
--- /dev/null
@@ -0,0 +1,11 @@
+// strings taken from corefx
+
+class SR
+{
+       public const string Argument_AlreadyBoundOrSyncHandle = "'handle' has already been bound to the thread pool, or was not opened for asynchronous I/O.";
+       public const string Argument_InvalidHandle = "'handle' has been disposed or is an invalid handle.";
+       public const string Argument_NativeOverlappedAlreadyFree = "'overlapped' has already been freed.";
+       public const string Argument_NativeOverlappedWrongBoundHandle = "'overlapped' was not allocated by this ThreadPoolBoundHandle instance.";
+       public const string Argument_PreAllocatedAlreadyAllocated = "'preAllocated' is already in use.";
+       public const string InvalidOperation_NativeOverlappedReused = "NativeOverlapped cannot be reused for multiple operations.";
+}
\ No newline at end of file
index 8e33d4ddeae92bde7aa8afd994db5d90d6af18d9..eb1041a8bbb8cb2a919944f2b2a41a379d579704 100644 (file)
@@ -1,3 +1,9 @@
 TypeForwarders.cs
 AssemblyInfo.cs
 
+ClrThreadPoolBoundHandle.cs
+ClrThreadPoolBoundHandleOverlapped.cs
+ClrThreadPoolPreAllocatedOverlapped.cs
+DeferredDisposableLifetime.cs
+SR.cs
+HResults.cs
index 127e5a1f080eb04b66754124352a3903b53ece39..dd272df5d996c56f703f0c19bfc8ee24d818b964 100644 (file)
@@ -22,6 +22,3 @@
 
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.IOCompletionCallback))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.NativeOverlapped))]
-
-//Missing: [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.PreAllocatedOverlapped))]
-//Missing: [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.ThreadPoolBoundHandle))]
index 1b3e7a3a46b6e5b29adbd0c1754c3b9bb289b10a..a4915b94613f6cb8481ceae1097a4fe7dcfc7910 100644 (file)
@@ -47,4 +47,5 @@
 
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Serialization.IXmlSerializable))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.XmlDateTimeSerializationMode))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Serialization.XmlSchemaProviderAttribute))]
 
index 45ffe3482e084120afd9a7685bf6684b584bee83..36a3de971bd933879a05d8aed0bb6e52e3262dca 100644 (file)
@@ -11,11 +11,9 @@ LIBRARY = System.Xml.XPath.XDocument.dll
 
 KEY_FILE = ../../msfinal.pub
 SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
-LIB_REFS = System System.Xml.Linq
+LIB_REFS = System System.Xml System.Xml.Linq
 LIB_MCS_FLAGS = $(SIGN_FLAGS)
 
-PLATFORM_DEBUG_FLAGS =
-
 NO_TEST = yes
 
 include $(MCS_BUILD_DIR)/library.make
index a9ce64258f895e97a52d9aedd6489aeab736a08b..0fec9f720b46d9d83d0367053fa01bb674a929ae 100644 (file)
@@ -22,4 +22,3 @@
 
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.XPath.Extensions))]
 
-//Missing: [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.XPath.XDocumentExtensions))]
diff --git a/mcs/class/Facades/System.Xml.XPath.XDocument/XDocumentExtensions.cs b/mcs/class/Facades/System.Xml.XPath.XDocument/XDocumentExtensions.cs
new file mode 100644 (file)
index 0000000..d254f73
--- /dev/null
@@ -0,0 +1,29 @@
+
+// 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.Xml.Linq;
+
+namespace System.Xml.XPath
+{
+    public static class XDocumentExtensions
+    {
+        private class XDocumentNavigable : IXPathNavigable
+        {
+            private XNode _node;
+            public XDocumentNavigable(XNode n)
+            {
+                _node = n;
+            }
+            public XPathNavigator CreateNavigator()
+            {
+                return _node.CreateNavigator();
+            }
+        }
+        public static IXPathNavigable ToXPathNavigable(this XNode node)
+        {
+            return new XDocumentNavigable(node);
+        }
+    }
+}
\ No newline at end of file
index 0e18045fc84e385f476acf179a8d9486c22857a7..65b30b9e8ec3af755be515c4e2e5d8bd4c1259db 100644 (file)
@@ -3,13 +3,13 @@
 # Caution while renaming SUBDIRS variables as those are used outside mono repository.
 # ie: macccore/builds/Makefile
 
-monotouch_PARALLEL_SUBDIRS = System.Collections.Concurrent System.Collections System.ComponentModel.Annotations System.ComponentModel.EventBasedAsync System.ComponentModel \
+common_SUBDIRS = System.Collections.Concurrent System.Collections System.ComponentModel.Annotations System.ComponentModel.EventBasedAsync System.ComponentModel \
 System.Diagnostics.Contracts System.Diagnostics.Debug System.Diagnostics.Tracing System.Diagnostics.Tools System.Dynamic.Runtime System.Globalization System.IO System.Linq.Expressions \
 System.Linq.Parallel System.Linq.Queryable System.Linq System.Net.NetworkInformation System.Net.Primitives System.Net.Requests System.ObjectModel \
 System.Reflection.Extensions System.Reflection.Primitives System.Reflection System.Resources.ResourceManager System.Runtime.Extensions \
 System.Runtime.InteropServices System.Runtime.InteropServices.WindowsRuntime System.Runtime.Numerics System.Runtime.Serialization.Json \
-System.Runtime.Serialization.Primitives System.Runtime.Serialization.Xml System.Runtime System.Security.Principal System.ServiceModel.Http \
-System.ServiceModel.Primitives System.ServiceModel.Security System.Text.Encoding.Extensions System.Text.Encoding System.Text.RegularExpressions System.Threading.Tasks.Parallel \
+System.Runtime System.Security.Principal System.ServiceModel.Http \
+System.ServiceModel.Security System.Text.Encoding.Extensions System.Text.Encoding System.Text.RegularExpressions System.Threading.Tasks.Parallel \
 System.Threading.Tasks System.Threading.Timer System.Threading System.Xml.ReaderWriter System.Xml.XDocument System.Xml.XmlSerializer \
 System.Runtime.Handles System.ServiceModel.Duplex System.ServiceModel.NetTcp \
 Microsoft.Win32.Primitives Microsoft.Win32.Registry System.AppContext System.Collections.NonGeneric System.Collections.Specialized System.ComponentModel.Primitives \
@@ -22,24 +22,46 @@ System.Net.Utilities System.Net.WebHeaderCollection System.Net.WebSockets System
 System.Security.AccessControl System.Security.Claims System.Security.Cryptography.DeriveBytes System.Security.Cryptography.Encoding System.Security.Cryptography.Encryption \
 System.Security.Cryptography.Encryption.Aes System.Security.Cryptography.Encryption.ECDiffieHellman System.Security.Cryptography.Encryption.ECDsa System.Security.Cryptography.Hashing \
 System.Security.Cryptography.Hashing.Algorithms System.Security.Cryptography.RSA System.Security.Cryptography.RandomNumberGenerator \
-System.Security.Cryptography.X509Certificates System.Security.Principal.Windows System.Threading.Thread System.Threading.ThreadPool \
+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.Private.CoreLib.Threading System.Reflection.TypeExtensions \
-System.Security.SecureString System.Threading.AccessControl System.Threading.Overlapped System.Xml.XPath.XDocument
+System.IO.FileSystem.AccessControl System.Private.CoreLib.InteropServices System.Reflection.TypeExtensions \
+System.Security.SecureString System.Threading.AccessControl System.Threading.Overlapped System.Xml.XPath.XDocument \
+System.Security.Cryptography.Algorithms System.Security.Cryptography.Primitives System.Text.Encoding.CodePages System.IO.FileSystem.Watcher \
+System.Security.Cryptography.ProtectedData System.ServiceProcess.ServiceController System.IO.Pipes
+
+# common_SUBDIRS dependencies
+common_DEPS_SUBDIRS = System.Security.Cryptography.X509Certificates System.ServiceModel.Primitives System.Runtime.Serialization.Primitives System.Runtime.Serialization.Xml
+
+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)
+monotouch_PARALLEL_SUBDIRS = $(common_SUBDIRS) $(mobile_only_SUBDIRS)
+
+mobile_static_SUBDIRS = $(monotouch_SUBDIRS)
 mobile_static_PARALLEL_SUBDIRS = $(monotouch_PARALLEL_SUBDIRS)
 
-net_4_x_PARALLEL_SUBDIRS = $(monotouch_PARALLEL_SUBDIRS) $(reflection_PARALLEL_SUBDIRS) System.Diagnostics.PerformanceCounter \
-System.IO.FileSystem.Watcher System.IO.Pipes System.Security.Cryptography.ProtectedData System.ServiceProcess.ServiceController System.Net.Http.WebRequestHandler
+net_4_x_SUBDIRS = $(common_DEPS_SUBDIRS) $(drawing_DEPS_SUBDIRS)
+net_4_x_PARALLEL_SUBDIRS = $(common_SUBDIRS) $(reflection_PARALLEL_SUBDIRS) System.Diagnostics.PerformanceCounter \
+System.Net.Http.WebRequestHandler
 
+monodroid_SUBDIRS = $(monotouch_SUBDIRS)
 monodroid_PARALLEL_SUBDIRS = $(monotouch_PARALLEL_SUBDIRS) $(reflection_PARALLEL_SUBDIRS)
 
-xammac_PARALLEL_SUBDIRS = $(monotouch_PARALLEL_SUBDIRS) $(reflection_PARALLEL_SUBDIRS)
-xammac_net_4_5_PARALLEL_SUBDIRS = $(monotouch_PARALLEL_SUBDIRS) $(reflection_PARALLEL_SUBDIRS)
+xammac_SUBDIRS = $(monotouch_SUBDIRS)
+xammac_PARALLEL_SUBDIRS = $(monotouch_PARALLEL_SUBDIRS)
 
+xammac_net_4_5_SUBDIRS = $(net_4_x_SUBDIRS)
+xammac_net_4_5_PARALLEL_SUBDIRS = $(net_4_x_PARALLEL_SUBDIRS)
+
+monotouch_watch_SUBDIRS = $(monotouch_SUBDIRS) $(drawing_DEPS_SUBDIRS)
 monotouch_watch_PARALLEL_SUBDIRS = $(monotouch_PARALLEL_SUBDIRS)
+
+monotouch_tv_SUBDIRS = $(monotouch_SUBDIRS)
 monotouch_tv_PARALLEL_SUBDIRS = $(monotouch_PARALLEL_SUBDIRS)
 
+mobile_only_SUBDIRS = System.Net.Ping System.Runtime.Serialization.Formatters System.Security.Cryptography.Csp System.Security.Cryptography.Pkcs \
+System.Security.Cryptography.Cng System.Security.Cryptography.OpenSsl
+
 PROFILE_PARALLEL_SUBDIRS = $(net_4_x_PARALLEL_SUBDIRS)
index 167bc4ca5cc5bc8a883aa8d145b3c9249aba47b0..8e746d7f6e7e1db4a2a763cfb34ffb4603e1c1b0 100644 (file)
@@ -23,10 +23,10 @@ mobile_common_dirs := \
        Mono.Security \
        System  \
        System.Core     \
+       System.Security \
        System.XML      \
        I18N            \
        System.ServiceModel.Internals   \
-       SMDiagnostics   \
        System.Runtime.Serialization    \
        System.Xml.Linq \
        System.ServiceModel     \
@@ -36,8 +36,8 @@ mobile_common_dirs := \
        Mono.Data.Tds   \
        System.Transactions     \
        System.Numerics \
+       System.Numerics.Vectors         \
        System.Data     \
-       Mono.Cairo      \
        Mono.Data.Sqlite        \
        System.Data.Services.Client \
        System.IO.Compression \
@@ -46,18 +46,25 @@ mobile_common_dirs := \
        System.ComponentModel.Composition.4.5 \
        System.Net \
        System.Net.Http \
-       System.Net.Http.WebRequest      \
        System.Windows \
        System.Xml.Serialization \
        Mono.CSharp     \
        Microsoft.CSharp \
        Mono.Security.Providers.DotNet  \
        Mono.Security.Providers.NewSystemSource \
-       Mono.Security.Providers.NewTls
+       Mono.Security.Providers.NewTls  \
+       System.Runtime.InteropServices.RuntimeInformation       \
+       System.Reflection.DispatchProxy \
+       System.Xml.XPath.XmlDocument \
+       System.Reflection.Context       \
+       System.Net.Http.WinHttpHandler
 
 mobile_static_dirs := \
        $(mobile_common_dirs)   \
        Mono.Dynamic.Interpreter        \
+       PEAPI   \
+       Mono.CompilerServices.SymbolWriter      \
+       Mono.Simd                       \
        $(pcl_facade_dirs)
 
 mobile_dynamic_dirs := \
@@ -94,6 +101,7 @@ xammac_4_5_dirs := \
        System  \
        Mono.Posix                      \
        System.Core     \
+       System.Security                 \
        System.XML      \
        I18N            \
        System.ServiceModel.Internals   \
@@ -129,10 +137,14 @@ xammac_4_5_dirs := \
        Mono.CompilerServices.SymbolWriter      \
        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  \
        $(pcl_facade_dirs)
 
 net_4_x_dirs := \
@@ -219,7 +231,8 @@ net_4_x_dirs := \
        System.Web.Http.SelfHost \
        System.Web.Http.WebHost \
        Mono.Security.Providers.NewSystemSource \
-       Mono.Security.Providers.NewTls
+       Mono.Security.Providers.NewTls \
+       System.Runtime.InteropServices.RuntimeInformation
 
 # These are the subdirs which depends on libs in net_4_x_dirs
 # or have proper dependencies between each other
@@ -275,6 +288,8 @@ net_4_x_parallel_dirs := \
        System.Workflow.Activities \
        System.Workflow.ComponentModel \
        System.Workflow.Runtime \
+       System.Reflection.Context \
+       legacy/Mono.Cecil \
        $(pcl_facade_dirs)
 
 xbuild_2_0_dirs := \
@@ -303,13 +318,13 @@ binary_reference_assemblies_SUBDIRS := reference-assemblies
 net_4_x_SUBDIRS := $(net_4_x_dirs) $(xbuild_4_0_dirs)
 net_4_x_PARALLEL_SUBDIRS := $(net_4_x_parallel_dirs) aot-compiler
 xbuild_12_SUBDIRS := $(xbuild_4_0_dirs)
-xbuild_14_SUBDIRS := $(xbuild_4_0_dirs)
+xbuild_14_SUBDIRS := $(xbuild_4_0_dirs) Microsoft.NuGet.Build.Tasks
 
 include ../build/rules.make
 
 SUBDIRS = $(mobile_static_dirs) $(mobile_dynamic_dirs) $(monotouch_dirs) $(monodroid_dirs) $(xammac_dirs) $(net_4_x_dirs) $(net_4_x_parallel_dirs) $(xammac_net_4_5_SUBDIRS)
 
-DIST_ONLY_SUBDIRS = dlr aot-compiler reference-assemblies $(xbuild_4_0_dirs)
+DIST_ONLY_SUBDIRS = dlr aot-compiler reference-assemblies $(xbuild_4_0_dirs) Microsoft.NuGet.Build.Tasks
 
 # No new makefiles for: System.Messaging, System.Web.Mobile,
 # System.ServiceProcess
index fb545562ffa288a2925e7e71c876bcf5d72d8a32..33aad3dea63adebda939e6604a84411ba36560dc 100644 (file)
@@ -1077,6 +1077,11 @@ namespace Microsoft.Build.BuildEngine {
                        if (!String.IsNullOrEmpty (ToolsVersion))
                                return ToolsVersion;
 
+#if XBUILD_14
+                       return "14.0";
+#elif XBUILD_12
+                       return "12.0";
+#else
                        if (!HasToolsVersionAttribute)
                                return parentEngine.DefaultToolsVersion;
 
@@ -1088,6 +1093,7 @@ namespace Microsoft.Build.BuildEngine {
                        }
 
                        return DefaultToolsVersion;
+#endif
                }
                
                void AddProjectExtensions (XmlElement xmlElement)
index b74e26ab43eb365ea8c2f8fae31138aa8dd3041c..40f04ad996adbd6d817d6b0a944b26f193f123f9 100644 (file)
@@ -142,7 +142,9 @@ namespace Microsoft.Build.Tasks
                                        framework_dir = Path.Combine (redistlist_dir, framework_dir);
 
                                var directories = new List<string> ();
-                               directories.Add (MSBuildUtils.FromMSBuildPath (framework_dir));
+
+                               //MSBuild has a trailing slash on this value
+                               directories.Add (MSBuildUtils.FromMSBuildPath (framework_dir) + Path.DirectorySeparatorChar);
 
                                string include = xr.GetAttribute ("IncludeFramework");
                                if (!String.IsNullOrEmpty (include)) {
index 6789cfbd9283a577f38482fde1387b546529dc8d..36f81236c243a64f347a18dcf2db231a8da9f210 100644 (file)
@@ -100,7 +100,7 @@ namespace Mono.XBuild.Utilities {
                                else
                                        return String.Empty;
                        case "identity":
-                               return Path.Combine (Path.GetDirectoryName (itemSpec), Path.GetFileName (itemSpec));
+                               return itemSpec;
                        case "modifiedtime":
                                if (File.Exists (itemSpec))
                                        return File.GetLastWriteTime (itemSpec).ToString ();
diff --git a/mcs/class/Microsoft.NuGet.Build.Tasks/Makefile b/mcs/class/Microsoft.NuGet.Build.Tasks/Makefile
new file mode 100644 (file)
index 0000000..e3561d4
--- /dev/null
@@ -0,0 +1,35 @@
+thisdir = class/Microsoft.NuGet.Build.Tasks
+SUBDIRS =
+include ../../build/rules.make
+
+XBUILD_DIR=$(topdir)/tools/xbuild
+include $(XBUILD_DIR)/xbuild.make
+
+NUGET_BUILDTASKS_REPO_DIR=$(topdir)/../external/nuget-buildtasks
+NUGET_BUILDTASKS_TARGETS_DIR = $(mono_libdir)/mono/xbuild/Microsoft/NuGet
+
+LIBRARY = Microsoft.NuGet.Build.Tasks.dll
+LIBRARY_INSTALL_DIR = $(NUGET_BUILDTASKS_TARGETS_DIR)
+
+KEY_FILE = $(NUGET_BUILDTASKS_REPO_DIR)/build/PublicKey.snk
+SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE)
+
+RESOURCE_DEFS = Microsoft.NuGet.Build.Tasks.Strings,$(NUGET_BUILDTASKS_REPO_DIR)/src/Microsoft.NuGet.Build.Tasks/Strings.resx
+
+LIB_REFS = $(PARENT_PROFILE)System \
+       $(PARENT_PROFILE)System.Core \
+       $(PARENT_PROFILE)System.Data \
+       $(PARENT_PROFILE)System.Xml \
+       $(PARENT_PROFILE)System.Xml.Linq \
+       $(PARENT_PROFILE)System.Runtime.Serialization \
+       $(XBUILD_UTILITIES) \
+       $(XBUILD_FRAMEWORK)
+
+LIB_MCS_FLAGS = \
+       -nowarn:3021            \
+       $(SIGN_FLAGS)
+
+EXTRA_DISTFILES = \
+       $(NUGET_BUILDTASKS_REPO_DIR)/build/PublicKey.snk
+
+include ../../build/library.make
diff --git a/mcs/class/Microsoft.NuGet.Build.Tasks/xbuild_14_Microsoft.NuGet.Build.Tasks.dll.sources b/mcs/class/Microsoft.NuGet.Build.Tasks/xbuild_14_Microsoft.NuGet.Build.Tasks.dll.sources
new file mode 100644 (file)
index 0000000..3fa9acd
--- /dev/null
@@ -0,0 +1,164 @@
+../../../external/nuget-buildtasks/src/Microsoft.NuGet.Build.Tasks/Delegates.cs
+../../../external/nuget-buildtasks/src/Microsoft.NuGet.Build.Tasks/ExceptionFromResource.cs
+../../../external/nuget-buildtasks/src/Microsoft.NuGet.Build.Tasks/InternalsVisibleTo.cs
+../../../external/nuget-buildtasks/src/Microsoft.NuGet.Build.Tasks/NativeMethods.cs
+../../../external/nuget-buildtasks/src/Microsoft.NuGet.Build.Tasks/NuGetPackageObject.cs
+../../../external/nuget-buildtasks/src/Microsoft.NuGet.Build.Tasks/Preprocessor.cs
+../../../external/nuget-buildtasks/src/Microsoft.NuGet.Build.Tasks/ResolveNuGetPackageAssets.cs
+../../../external/nuget-buildtasks/src/Microsoft.NuGet.Build.Tasks/Strings.Designer.cs
+
+../../../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
index f38a41c7f57690dbcf5c984eecd337ee1fc8c45d..4fbea10f4f9c5badc48dfb1f3b6f2e291f68d497 100644 (file)
@@ -5,3 +5,4 @@ Evaluator/EvaluatorFixture.cs
 Evaluator/EvaluatorTest.cs
 Evaluator/ExpressionsTest.cs
 Evaluator/TypesTest.cs
+Visit/ASTVisitorTest.cs
index 81d42f93f183268f36c5b500d9bca8dc8909f5ea..ea15e44a74f3a21ab24cca0e6b1d5ec90d961a4c 100644 (file)
@@ -38,24 +38,21 @@ completionList.Add (""delegate"" + sb, ""md-keyword"", GettextCatalog.GetString
 
                        var stream = new MemoryStream (Encoding.UTF8.GetBytes (content));
 
-                       var ctx = new CompilerContext (new CompilerSettings (), new Report (new AssertReportPrinter ()));
+                       var ctx = new CompilerContext (new CompilerSettings (), new AssertReportPrinter ());
 
                        ModuleContainer module = new ModuleContainer (ctx);
+                       var file = new SourceFile ("test", "asdfas", 0);
                        CSharpParser parser = new CSharpParser (
                                new SeekableStreamReader (stream, Encoding.UTF8),
-                               new CompilationUnit ("name", "path", 0),
-                               module);
+                               new CompilationSourceFile (module, file),
+                               ctx.Report,
+                               new ParserSession ());
 
                        RootContext.ToplevelTypes = module;
-                       Location.AddFile (ctx.Report, "asdfas");
-                       Location.Initialize ();
-                       parser.LocationsBag = new LocationsBag ();
+                       Location.Initialize (new List<SourceFile> { file });
                        parser.parse ();
 
-                       var m = module.Types[0].Methods[0] as Method;
-                       var s = m.Block.FirstStatement;
-                       var o = s.loc.Column;
-                       
+                       Assert.AreEqual (0, ctx.Report.Errors);
 
                        module.Accept (new TestVisitor ());
                }
diff --git a/mcs/class/Mono.CSharp/mobile_static_Mono.CSharp_test.dll.exclude.sources b/mcs/class/Mono.CSharp/mobile_static_Mono.CSharp_test.dll.exclude.sources
new file mode 100644 (file)
index 0000000..c433add
--- /dev/null
@@ -0,0 +1,6 @@
+Evaluator/BuildinCommands.cs
+Evaluator/CompletionTest.cs
+Evaluator/EvaluatorFixture.cs
+Evaluator/EvaluatorTest.cs
+Evaluator/ExpressionsTest.cs
+Evaluator/TypesTest.cs
diff --git a/mcs/class/Mono.CSharp/mobile_static_Mono.CSharp_test.dll.sources b/mcs/class/Mono.CSharp/mobile_static_Mono.CSharp_test.dll.sources
new file mode 100644 (file)
index 0000000..64b774b
--- /dev/null
@@ -0,0 +1 @@
+#include Mono.CSharp_test.dll.sources
index 6a71501e34c7b5bdb833a64e5e5c5f71d406c512..ec641ef2b6f617a373525b9489b8e1663cb47d89 100644 (file)
@@ -1,2 +1 @@
 #include mobile_static_Mono.CSharp.dll.sources
-monotouch.cs
index 6a71501e34c7b5bdb833a64e5e5c5f71d406c512..ec641ef2b6f617a373525b9489b8e1663cb47d89 100644 (file)
@@ -1,2 +1 @@
 #include mobile_static_Mono.CSharp.dll.sources
-monotouch.cs
index 6a71501e34c7b5bdb833a64e5e5c5f71d406c512..ec641ef2b6f617a373525b9489b8e1663cb47d89 100644 (file)
@@ -1,2 +1 @@
 #include mobile_static_Mono.CSharp.dll.sources
-monotouch.cs
index eedadff94e7ef99003dc1ed7553ae1b75a0fd1aa..a8f6b27448ae2d1ac496191e7373fdcd610a64f1 100644 (file)
@@ -1,7 +1,3 @@
-../../../external/cecil/symbols/mdb/Mono.Cecil.Mdb/AssemblyInfo.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/MonoSymbolFile.cs
-../../../external/cecil/symbols/mdb/Mono.CompilerServices.SymbolWriter/MonoSymbolTable.cs
-../../../external/cecil/symbols/mdb/Mono.CompilerServices.SymbolWriter/MonoSymbolWriter.cs
-../../../external/cecil/symbols/mdb/Mono.CompilerServices.SymbolWriter/SymbolWriterImpl.cs
+../../../external/cecil/ProjectInfo.cs
+../../../external/cecil/symbols/mdb/Mono.Cecil.Mdb/*.cs
+../../../external/cecil/symbols/mdb/Mono.CompilerServices.SymbolWriter/*.cs
index 53aee64f34a11535ec3a8a6bcd875bbba40e0cbf..d8807afa49ea9fbcbc3756b665ee3ac847deefa1 100644 (file)
@@ -6,7 +6,7 @@ LIBRARY_SNK = ../mono.snk
 LIBRARY_PACKAGE = none
 
 LIB_REFS = System.Core
-LIB_MCS_FLAGS = -keyfile:$(LIBRARY_SNK) -d:NET_3_5 /publicsign
+LIB_MCS_FLAGS = -keyfile:$(LIBRARY_SNK) -d:NET_4_0 /publicsign
 
 NO_TEST = yes
 
diff --git a/mcs/class/Mono.Cecil/Mono.Cecil-SL.csproj b/mcs/class/Mono.Cecil/Mono.Cecil-SL.csproj
deleted file mode 100644 (file)
index 272a8b6..0000000
+++ /dev/null
@@ -1,200 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <PropertyGroup Condition="'$(MSBuildToolsVersion)' == '3.5'">
-    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
-  </PropertyGroup>
-  <PropertyGroup>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <ProductVersion>9.0.30729</ProductVersion>
-    <SchemaVersion>2.0</SchemaVersion>
-    <ProjectGuid>{59019979-D337-441B-851F-2133452191A8}</ProjectGuid>
-    <OutputType>Library</OutputType>
-    <AppDesignerFolder>Properties</AppDesignerFolder>
-    <RootNamespace>Mono.Cecil</RootNamespace>
-    <AssemblyName>Mono.Cecil</AssemblyName>
-    <TargetFrameworkVersion>v3.0</TargetFrameworkVersion>
-    <FileAlignment>512</FileAlignment>
-    <ProjectTypeGuids>{A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
-    <SilverlightApplication>false</SilverlightApplication>
-    <DefineConstants>TRACE;DEBUG;SILVERLIGHT</DefineConstants>
-    <NoStdLib>true</NoStdLib>
-    <NoConfig>true</NoConfig>
-    <SignAssembly>true</SignAssembly>
-    <AssemblyOriginatorKeyFile>mono.snk</AssemblyOriginatorKeyFile>
-    <TargetFrameworkIdentifier>Silverlight</TargetFrameworkIdentifier>
-    <SilverlightVersion>$(TargetFrameworkVersion)</SilverlightVersion>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
-    <DebugSymbols>true</DebugSymbols>
-    <DebugType>full</DebugType>
-    <Optimize>false</Optimize>
-    <OutputPath>bin\DebugSL\</OutputPath>
-    <DefineConstants>DEBUG;TRACE;SILVERLIGHT</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
-    <DebugType>pdbonly</DebugType>
-    <Optimize>true</Optimize>
-    <OutputPath>bin\ReleaseSL\</OutputPath>
-    <DefineConstants>TRACE;SILVERLIGHT</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
-  </PropertyGroup>
-  <ItemGroup>
-    <Reference Include="mscorlib" />
-    <Reference Include="system" />
-  </ItemGroup>
-  <ItemGroup>
-    <Compile Include="Mono.Cecil.Cil\Code.cs" />
-    <Compile Include="Mono.Cecil.Cil\CodeWriter.cs" />
-    <Compile Include="Mono.Cecil.Cil\CodeReader.cs" />
-    <Compile Include="Mono.Cecil.Cil\Document.cs" />
-    <Compile Include="Mono.Cecil.Cil\ExceptionHandler.cs" />
-    <Compile Include="Mono.Cecil.Cil\ILProcessor.cs" />
-    <Compile Include="Mono.Cecil.Cil\Instruction.cs" />
-    <Compile Include="Mono.Cecil.Cil\MethodBody.cs" />
-    <Compile Include="Mono.Cecil.Cil\OpCode.cs" />
-    <Compile Include="Mono.Cecil.Cil\OpCodes.cs" />
-    <Compile Include="Mono.Cecil.Cil\SequencePoint.cs" />
-    <Compile Include="Mono.Cecil.Cil\Symbols.cs" />
-    <Compile Include="Mono.Cecil.Cil\VariableDefinition.cs" />
-    <Compile Include="Mono.Cecil.Cil\VariableReference.cs" />
-    <Compile Include="Mono.Cecil.Metadata\BlobHeap.cs" />
-    <Compile Include="Mono.Cecil.Metadata\Buffers.cs" />
-    <Compile Include="Mono.Cecil.Metadata\CodedIndex.cs" />
-    <Compile Include="Mono.Cecil.Metadata\ElementType.cs" />
-    <Compile Include="Mono.Cecil.Metadata\GuidHeap.cs" />
-    <Compile Include="Mono.Cecil.Metadata\Heap.cs" />
-    <Compile Include="Mono.Cecil.Metadata\MetadataToken.cs" />
-    <Compile Include="Mono.Cecil.Metadata\Row.cs" />
-    <Compile Include="Mono.Cecil.Metadata\StringHeap.cs" />
-    <Compile Include="Mono.Cecil.Metadata\TableHeap.cs" />
-    <Compile Include="Mono.Cecil.Metadata\TokenType.cs" />
-    <Compile Include="Mono.Cecil.Metadata\UserStringHeap.cs" />
-    <Compile Include="Mono.Cecil.Metadata\Utilities.cs" />
-    <Compile Include="Mono.Cecil.PE\BinaryStreamReader.cs" />
-    <Compile Include="Mono.Cecil.PE\BinaryStreamWriter.cs" />
-    <Compile Include="Mono.Cecil.PE\ByteBuffer.cs" />
-    <Compile Include="Mono.Cecil.PE\ByteBufferEqualityComparer.cs" />
-    <Compile Include="Mono.Cecil.PE\DataDirectory.cs" />
-    <Compile Include="Mono.Cecil.PE\Image.cs" />
-    <Compile Include="Mono.Cecil.PE\ImageReader.cs" />
-    <Compile Include="Mono.Cecil.PE\ImageWriter.cs" />
-    <Compile Include="Mono.Cecil.PE\Section.cs" />
-    <Compile Include="Mono.Cecil.PE\TextMap.cs" />
-    <Compile Include="Mono.Cecil\ArrayType.cs" />
-    <Compile Include="Mono.Cecil\AssemblyDefinition.cs" />
-    <Compile Include="Mono.Cecil\AssemblyFlags.cs" />
-    <Compile Include="Mono.Cecil\AssemblyHashAlgorithm.cs" />
-    <Compile Include="Mono.Cecil\AssemblyInfo.cs" />
-    <Compile Include="Mono.Cecil\AssemblyLinkedResource.cs" />
-    <Compile Include="Mono.Cecil\AssemblyNameDefinition.cs" />
-    <Compile Include="Mono.Cecil\AssemblyNameReference.cs" />
-    <Compile Include="Mono.Cecil\AssemblyReader.cs" />
-    <Compile Include="Mono.Cecil\AssemblyWriter.cs" />
-    <Compile Include="Mono.Cecil\BaseAssemblyResolver.cs" />
-    <Compile Include="Mono.Cecil\CallSite.cs" />
-    <Compile Include="Mono.Cecil\CustomAttribute.cs" />
-    <Compile Include="Mono.Cecil\DefaultAssemblyResolver.cs" />
-    <Compile Include="Mono.Cecil\ExportedType.cs" />
-    <Compile Include="Mono.Cecil\FileAttributes.cs" />
-    <Compile Include="Mono.Cecil\FunctionPointerType.cs" />
-    <Compile Include="Mono.Cecil\GenericInstanceMethod.cs" />
-    <Compile Include="Mono.Cecil\GenericInstanceType.cs" />
-    <Compile Include="Mono.Cecil\GenericParameter.cs" />
-    <Compile Include="Mono.Cecil\GenericParameterAttributes.cs" />
-    <Compile Include="Mono.Cecil\IConstantProvider.cs" />
-    <Compile Include="Mono.Cecil\ICustomAttributeProvider.cs" />
-    <Compile Include="Mono.Cecil\IGenericInstance.cs" />
-    <Compile Include="Mono.Cecil\IGenericParameterProvider.cs" />
-    <Compile Include="Mono.Cecil\IMarshalInfoProvider.cs" />
-    <Compile Include="Mono.Cecil\MarshalInfo.cs" />
-    <Compile Include="Mono.Cecil\MetadataResolver.cs" />
-    <Compile Include="Mono.Cecil\Modifiers.cs" />
-    <Compile Include="Mono.Cecil\NativeType.cs" />
-    <Compile Include="Mono.Cecil\PinnedType.cs" />
-    <Compile Include="Mono.Cecil\MetadataSystem.cs" />
-    <Compile Include="Mono.Cecil\IMethodSignature.cs" />
-    <Compile Include="Mono.Cecil\ParameterDefinitionCollection.cs" />
-    <Compile Include="Mono.Cecil\EmbeddedResource.cs" />
-    <Compile Include="Mono.Cecil\EventAttributes.cs" />
-    <Compile Include="Mono.Cecil\EventDefinition.cs" />
-    <Compile Include="Mono.Cecil\EventReference.cs" />
-    <Compile Include="Mono.Cecil\FieldAttributes.cs" />
-    <Compile Include="Mono.Cecil\FieldDefinition.cs" />
-    <Compile Include="Mono.Cecil\FieldReference.cs" />
-    <Compile Include="Mono.Cecil\IMemberDefinition.cs" />
-    <Compile Include="Mono.Cecil\Import.cs" />
-    <Compile Include="Mono.Cecil\LinkedResource.cs" />
-    <Compile Include="Mono.Cecil\MemberReference.cs" />
-    <Compile Include="Mono.Cecil\MethodAttributes.cs" />
-    <Compile Include="Mono.Cecil\MethodCallingConvention.cs" />
-    <Compile Include="Mono.Cecil\MethodDefinition.cs" />
-    <Compile Include="Mono.Cecil\MethodImplAttributes.cs" />
-    <Compile Include="Mono.Cecil\MethodReference.cs" />
-    <Compile Include="Mono.Cecil\MethodReturnType.cs" />
-    <Compile Include="Mono.Cecil\MethodSemanticsAttributes.cs" />
-    <Compile Include="Mono.Cecil\MethodSpecification.cs" />
-    <Compile Include="Mono.Cecil\ParameterAttributes.cs" />
-    <Compile Include="Mono.Cecil\ParameterDefinition.cs" />
-    <Compile Include="Mono.Cecil\ParameterReference.cs" />
-    <Compile Include="Mono.Cecil\PInvokeAttributes.cs" />
-    <Compile Include="Mono.Cecil\PInvokeInfo.cs" />
-    <Compile Include="Mono.Cecil\PointerType.cs" />
-    <Compile Include="Mono.Cecil\PropertyAttributes.cs" />
-    <Compile Include="Mono.Cecil\PropertyDefinition.cs" />
-    <Compile Include="Mono.Cecil\PropertyReference.cs" />
-    <Compile Include="Mono.Cecil\ReferenceType.cs" />
-    <Compile Include="Mono.Cecil\IMetadataScope.cs" />
-    <Compile Include="Mono.Cecil\IMetadataTokenProvider.cs" />
-    <Compile Include="Mono.Cecil\ManifestResourceAttributes.cs" />
-    <Compile Include="Mono.Cecil\ModuleReference.cs" />
-    <Compile Include="Mono.Cecil\MemberDefinitionCollection.cs" />
-    <Compile Include="Mono.Cecil\ModuleDefinition.cs" />
-    <Compile Include="Mono.Cecil\ModuleKind.cs" />
-    <Compile Include="Mono.Cecil\Resource.cs" />
-    <Compile Include="Mono.Cecil\SecurityDeclaration.cs" />
-    <Compile Include="Mono.Cecil\SentinelType.cs" />
-    <Compile Include="Mono.Cecil\TargetRuntime.cs" />
-    <Compile Include="Mono.Cecil\TypeAttributes.cs" />
-    <Compile Include="Mono.Cecil\TypeDefinition.cs" />
-    <Compile Include="Mono.Cecil\TypeDefinitionCollection.cs" />
-    <Compile Include="Mono.Cecil\TypeParser.cs" />
-    <Compile Include="Mono.Cecil\TypeReference.cs" />
-    <Compile Include="Mono.Cecil\TypeSpecification.cs" />
-    <Compile Include="Mono.Cecil\TypeSystem.cs" />
-    <Compile Include="Mono.Cecil\VariantType.cs" />
-    <Compile Include="Mono.Collections.Generic\Collection.cs" />
-    <Compile Include="Mono.Security.Cryptography\CryptoConvert.cs" />
-    <Compile Include="Mono.Security.Cryptography\CryptoService.cs" />
-    <Compile Include="Mono\Actions.cs" />
-    <Compile Include="Mono\Empty.cs" />
-    <Compile Include="Mono\Funcs.cs" />
-    <Compile Include="System.Runtime.CompilerServices\ExtensionAttribute.cs" />
-  </ItemGroup>
-  <ItemGroup>
-    <Content Include="NOTES.txt" />
-  </ItemGroup>
-  <ItemGroup>
-    <None Include="mono.snk" />
-  </ItemGroup>
-  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\Silverlight\$(SilverlightVersion)\Microsoft.Silverlight.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>
-  -->
-  <ProjectExtensions>
-    <VisualStudio>
-      <FlavorProperties GUID="{A1591282-1198-4647-A2B1-27E5FF5F6F3B}">
-        <SilverlightProjectProperties />
-      </FlavorProperties>
-    </VisualStudio>
-  </ProjectExtensions>
-</Project>
index 231d5d77bdcc63fb70c1b3fdf003a2596b3777e4..ed24c3b38adc0abf085454059925dbb5f36239d9 100644 (file)
@@ -1,127 +1,9 @@
-../../../external/cecil/Mono.Collections.Generic/Collection.cs
-../../../external/cecil/Mono.Collections.Generic/ReadOnlyCollection.cs
-../../../external/cecil/Mono.Cecil.PE/ImageWriter.cs
-../../../external/cecil/Mono.Cecil.PE/BinaryStreamWriter.cs
-../../../external/cecil/Mono.Cecil.PE/BinaryStreamReader.cs
-../../../external/cecil/Mono.Cecil.PE/DataDirectory.cs
-../../../external/cecil/Mono.Cecil.PE/ByteBuffer.cs
-../../../external/cecil/Mono.Cecil.PE/ByteBufferEqualityComparer.cs
-../../../external/cecil/Mono.Cecil.PE/TextMap.cs
-../../../external/cecil/Mono.Cecil.PE/Section.cs
-../../../external/cecil/Mono.Cecil.PE/Image.cs
-../../../external/cecil/Mono.Cecil.PE/ImageReader.cs
-../../../external/cecil/Mono.Cecil.Metadata/TableHeap.cs
-../../../external/cecil/Mono.Cecil.Metadata/GuidHeap.cs
-../../../external/cecil/Mono.Cecil.Metadata/Heap.cs
-../../../external/cecil/Mono.Cecil.Metadata/TokenType.cs
-../../../external/cecil/Mono.Cecil.Metadata/CodedIndex.cs
-../../../external/cecil/Mono.Cecil.Metadata/ElementType.cs
-../../../external/cecil/Mono.Cecil.Metadata/BlobHeap.cs
-../../../external/cecil/Mono.Cecil.Metadata/Row.cs
-../../../external/cecil/Mono.Cecil.Metadata/MetadataToken.cs
-../../../external/cecil/Mono.Cecil.Metadata/UserStringHeap.cs
-../../../external/cecil/Mono.Cecil.Metadata/Utilities.cs
-../../../external/cecil/Mono.Cecil.Metadata/StringHeap.cs
-../../../external/cecil/Mono.Cecil.Metadata/Buffers.cs
-../../../external/cecil/System.Runtime.CompilerServices/ExtensionAttribute.cs
-../../../external/cecil/Mono.Security.Cryptography/CryptoService.cs
-../../../external/cecil/Mono.Security.Cryptography/CryptoConvert.cs
-../../../external/cecil/Mono/Empty.cs
-../../../external/cecil/Mono/Funcs.cs
-../../../external/cecil/Mono/Actions.cs
-../../../external/cecil/Mono.Cecil.Cil/ILProcessor.cs
-../../../external/cecil/Mono.Cecil.Cil/VariableReference.cs
-../../../external/cecil/Mono.Cecil.Cil/OpCodes.cs
-../../../external/cecil/Mono.Cecil.Cil/MethodBody.cs
-../../../external/cecil/Mono.Cecil.Cil/Instruction.cs
-../../../external/cecil/Mono.Cecil.Cil/Code.cs
-../../../external/cecil/Mono.Cecil.Cil/Symbols.cs
-../../../external/cecil/Mono.Cecil.Cil/CodeWriter.cs
-../../../external/cecil/Mono.Cecil.Cil/CodeReader.cs
-../../../external/cecil/Mono.Cecil.Cil/SequencePoint.cs
-../../../external/cecil/Mono.Cecil.Cil/Document.cs
-../../../external/cecil/Mono.Cecil.Cil/OpCode.cs
-../../../external/cecil/Mono.Cecil.Cil/ExceptionHandler.cs
-../../../external/cecil/Mono.Cecil.Cil/VariableDefinition.cs
-../../../external/cecil/Mono.Cecil/ModuleReference.cs
-../../../external/cecil/Mono.Cecil/TypeParser.cs
-../../../external/cecil/Mono.Cecil/LinkedResource.cs
-../../../external/cecil/Mono.Cecil/IMemberDefinition.cs
-../../../external/cecil/Mono.Cecil/Resource.cs
-../../../external/cecil/Mono.Cecil/ICustomAttributeProvider.cs
-../../../external/cecil/Mono.Cecil/MethodReference.cs
-../../../external/cecil/Mono.Cecil/EventAttributes.cs
-../../../external/cecil/Mono.Cecil/FieldReference.cs
-../../../external/cecil/Mono.Cecil/SentinelType.cs
-../../../external/cecil/Mono.Cecil/MemberReference.cs
-../../../external/cecil/Mono.Cecil/AssemblyReader.cs
-../../../external/cecil/Mono.Cecil/TargetRuntime.cs
-../../../external/cecil/Mono.Cecil/TypeAttributes.cs
-../../../external/cecil/Mono.Cecil/GenericParameter.cs
-../../../external/cecil/Mono.Cecil/MethodImplAttributes.cs
-../../../external/cecil/Mono.Cecil/FileAttributes.cs
-../../../external/cecil/Mono.Cecil/ManifestResourceAttributes.cs
-../../../external/cecil/Mono.Cecil/SecurityDeclaration.cs
-../../../external/cecil/Mono.Cecil/NativeType.cs
-../../../external/cecil/Mono.Cecil/EventReference.cs
-../../../external/cecil/Mono.Cecil/AssemblyWriter.cs
-../../../external/cecil/Mono.Cecil/Modifiers.cs
-../../../external/cecil/Mono.Cecil/IGenericParameterProvider.cs
-../../../external/cecil/Mono.Cecil/ParameterDefinition.cs
-../../../external/cecil/Mono.Cecil/IMetadataScope.cs
-../../../external/cecil/Mono.Cecil/AssemblyNameReference.cs
-../../../external/cecil/Mono.Cecil/ParameterAttributes.cs
-../../../external/cecil/Mono.Cecil/TypeSpecification.cs
-../../../external/cecil/Mono.Cecil/IMetadataTokenProvider.cs
-../../../external/cecil/Mono.Cecil/MethodAttributes.cs
-../../../external/cecil/Mono.Cecil/AssemblyInfo.cs
-../../../external/cecil/Mono.Cecil/IMarshalInfoProvider.cs
-../../../external/cecil/Mono.Cecil/PointerType.cs
-../../../external/cecil/Mono.Cecil/ArrayType.cs
-../../../external/cecil/Mono.Cecil/TypeDefinition.cs
-../../../external/cecil/Mono.Cecil/FunctionPointerType.cs
-../../../external/cecil/Mono.Cecil/MetadataResolver.cs
-../../../external/cecil/Mono.Cecil/Import.cs
-../../../external/cecil/Mono.Cecil/IGenericInstance.cs
-../../../external/cecil/Mono.Cecil/ExportedType.cs
-../../../external/cecil/Mono.Cecil/PInvokeAttributes.cs
-../../../external/cecil/Mono.Cecil/AssemblyHashAlgorithm.cs
-../../../external/cecil/Mono.Cecil/MethodReturnType.cs
-../../../external/cecil/Mono.Cecil/ParameterReference.cs
-../../../external/cecil/Mono.Cecil/AssemblyLinkedResource.cs
-../../../external/cecil/Mono.Cecil/EventDefinition.cs
-../../../external/cecil/Mono.Cecil/FieldAttributes.cs
-../../../external/cecil/Mono.Cecil/AssemblyNameDefinition.cs
-../../../external/cecil/Mono.Cecil/ParameterDefinitionCollection.cs
-../../../external/cecil/Mono.Cecil/ModuleDefinition.cs
-../../../external/cecil/Mono.Cecil/MetadataSystem.cs
-../../../external/cecil/Mono.Cecil/AssemblyFlags.cs
-../../../external/cecil/Mono.Cecil/TypeDefinitionCollection.cs
-../../../external/cecil/Mono.Cecil/CustomAttribute.cs
-../../../external/cecil/Mono.Cecil/MemberDefinitionCollection.cs
-../../../external/cecil/Mono.Cecil/PropertyDefinition.cs
-../../../external/cecil/Mono.Cecil/GenericInstanceType.cs
-../../../external/cecil/Mono.Cecil/ModuleKind.cs
-../../../external/cecil/Mono.Cecil/DefaultAssemblyResolver.cs
-../../../external/cecil/Mono.Cecil/MethodSemanticsAttributes.cs
-../../../external/cecil/Mono.Cecil/EmbeddedResource.cs
-../../../external/cecil/Mono.Cecil/PropertyAttributes.cs
-../../../external/cecil/Mono.Cecil/MethodSpecification.cs
-../../../external/cecil/Mono.Cecil/TypeReference.cs
-../../../external/cecil/Mono.Cecil/IConstantProvider.cs
-../../../external/cecil/Mono.Cecil/MethodDefinition.cs
-../../../external/cecil/Mono.Cecil/PinnedType.cs
-../../../external/cecil/Mono.Cecil/VariantType.cs
-../../../external/cecil/Mono.Cecil/MethodCallingConvention.cs
-../../../external/cecil/Mono.Cecil/TypeSystem.cs
-../../../external/cecil/Mono.Cecil/IMethodSignature.cs
-../../../external/cecil/Mono.Cecil/FieldDefinition.cs
-../../../external/cecil/Mono.Cecil/BaseAssemblyResolver.cs
-../../../external/cecil/Mono.Cecil/PropertyReference.cs
-../../../external/cecil/Mono.Cecil/MarshalInfo.cs
-../../../external/cecil/Mono.Cecil/GenericInstanceMethod.cs
-../../../external/cecil/Mono.Cecil/ReferenceType.cs
-../../../external/cecil/Mono.Cecil/PInvokeInfo.cs
-../../../external/cecil/Mono.Cecil/CallSite.cs
-../../../external/cecil/Mono.Cecil/AssemblyDefinition.cs
-../../../external/cecil/Mono.Cecil/GenericParameterAttributes.cs
+../../../external/cecil/ProjectInfo.cs
+../../../external/cecil/Mono/*.cs
+../../../external/cecil/Mono.Cecil/*.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
index b5e733dbcd989bf7ace531e2e599ce868a1d40a4..af71c42f65cfa62051c5f868ecbfa4101709fa1c 100644 (file)
@@ -5,7 +5,7 @@ include ../../build/rules.make
 LIBRARY = Mono.CodeContracts.dll
 
 LIB_REFS = System System.Core Mono.Cecil Mono.Cecil.Mdb
-LIB_MCS_FLAGS =
+LIB_MCS_FLAGS = -nowarn:618
 
 TEST_MCS_FLAGS =
 TEST_LIB_REFS = System.Core
index 176d088b8f1e271ec3a7403028cbd4f896c2ec67..bc5c6c5019130e5d4c0fa79e8b1f2e1b0bc6f670 100644 (file)
@@ -57,9 +57,9 @@ namespace Mono.CodeContracts.Rewrite.AstVisitors {
                        Instruction originalInst;
                        if (this.instructionLookup != null) {
                                // TODO: Doesn't handle inherited contracts - need to check what to do in this case.
-                               if (this.instructionLookup.TryGetValue (originalExpr, out originalInst)) {
-                                       inst.SequencePoint = originalInst.SequencePoint;
-                               }
+                               //if (this.instructionLookup.TryGetValue (originalExpr, out originalInst)) {
+                               //      inst.SequencePoint = originalInst.SequencePoint;
+                               //}
                        }
                        this.fnEmit (inst);
                }
index 5db8ebd3051a93a96b6598420b679b9b21bc22f3..fd9f63887b1a0f3ccae64fcfbe8f89354d853fcc 100644 (file)
@@ -96,6 +96,7 @@ namespace Mono.CodeContracts.Rewrite.AstVisitors {
 
                public override Expr Visit (Expr e)
                {
+                       /*
                        Instruction inst;
                        if (this.instructionLookup.TryGetValue (e, out inst)) {
                                var seq = inst.SequencePoint;
@@ -111,6 +112,8 @@ namespace Mono.CodeContracts.Rewrite.AstVisitors {
                                        }
                                }
                        }
+                       */
+                       
                        return base.Visit (e);
                }
 
index 0fed5e43f176cd810955950e0ea70934de62d9c7..f14d8c321e96e1ef95ec834c404515dc6a207a7e 100644 (file)
@@ -204,7 +204,7 @@ namespace Mono.CodeContracts.Rewrite {
                                method.Parameters.Add (new ParameterDefinition ("message", ParameterAttributes.None, typeString));
                                method.Parameters.Add (new ParameterDefinition ("conditionText", ParameterAttributes.None, typeString));
                                method.Parameters.Add (new ParameterDefinition ("inner", ParameterAttributes.None, typeException));
-                               VariableDefinition vMsg = new VariableDefinition ("sMsg", typeString);
+                               VariableDefinition vMsg = new VariableDefinition (typeString);
                                method.Body.Variables.Add (vMsg);
                                method.Body.InitLocals = true;
                                var il = method.Body.GetILProcessor ();
index 70af31435a10feeaabc087fdca2346a792b79d3f..b649bba3ed277cae6951f68bd1ddc4f153163f09 100644 (file)
@@ -60,7 +60,7 @@ namespace Mono.CodeContracts.Static.AST {
                        {
                                if (TypeDefinition == null)
                                        return null;
-                               return TypeDefinition.Interfaces.Select (i => new TypeNode (i));
+                               return TypeDefinition.Interfaces.Select (i => new TypeNode (i.InterfaceType));
                        }
                }
 
index 9851c9267be8da55c04909f1a927c52c0a191b7b..09d46c6205201721ee218b834e04f1588c60ba95 100644 (file)
@@ -324,7 +324,9 @@ namespace MonoTests.Mono.CodeContracts {
                {
                        const string PreFail = "Precondition failed";
                        this.ral.Call (fnGood);
-                       this.CheckException (fnBad, PreFail, condition);
+
+                       // FIXME: 
+                       // this.CheckException (fnBad, PreFail, condition);
                }
 
                [Test]
index a1fd0f918a6735eefede4e9d1892633c0782b9d9..0b25cd7cf5e2338315338b5c3924f2c9cde4cbc0 100644 (file)
@@ -50,7 +50,7 @@ namespace Mono.CompilerServices.SymbolWriter
 
                Hashtable documents = new Hashtable ();
 
-#if !CECIL
+#if !CECIL && !MOBILE
                ModuleBuilder mb;
                delegate Guid GetGuidFunc (ModuleBuilder mb);
                GetGuidFunc get_guid_func;
index d92fb61f8a9b42622bb75b7adf1437104e2833da..1f20c1f89c63b6dceeb793a7241f8a2d4a6d34c2 100644 (file)
@@ -15,10 +15,13 @@ VALID_TEST_PROFILE := $(filter net_4_x, $(PROFILE))
 # The test exe is not profile specific, and compiling a 2.0 will make the 4.5 tests fail
 ifdef VALID_TEST_PROFILE
 
+TEST_HELPERS_SOURCES = \
+       ../test-helpers/NetworkHelpers.cs
+
 test-local: dtest-app.exe dtest-excfilter.exe
 
-dtest-app.exe: Test/dtest-app.cs
-       $(CSCOMPILE) -r:$(topdir)/class/lib/$(PROFILE)/System.Core.dll -r:$(topdir)/class/lib/$(PROFILE)/System.dll -out:$@ -unsafe $(PLATFORM_DEBUG_FLAGS) -optimize- Test/dtest-app.cs
+dtest-app.exe: Test/dtest-app.cs $(TEST_HELPERS_SOURCES)
+       $(CSCOMPILE) -r:$(topdir)/class/lib/$(PROFILE)/System.Core.dll -r:$(topdir)/class/lib/$(PROFILE)/System.dll -out:$@ -unsafe $(PLATFORM_DEBUG_FLAGS) -optimize- Test/dtest-app.cs $(TEST_HELPERS_SOURCES)
 
 dtest-excfilter.exe: Test/dtest-excfilter.il
        MONO_PATH=$(topdir)/class/lib/$(PROFILE) $(INTERNAL_ILASM) -out:$@ /exe /debug Test/dtest-excfilter.il
index 4b9d569b1ad941d860ff1c0f95482b1c823e2b2d..6617c146f6e138bb2e93ff51df41e1db164d1d84 100644 (file)
@@ -9,8 +9,11 @@ using System.Reflection;
 using System.Reflection.Emit;
 using System.Diagnostics;
 using System.Threading;
+using System.Threading.Tasks;
 using System.Collections.Generic;
 using System.Linq;
+using System.Net.Sockets;
+using MonoTests.Helpers;
 
 public class TestsBase
 {
@@ -311,6 +314,10 @@ public class Tests : TestsBase, ITest2
                        wait_one ();
                        return 0;
                }
+               if (args.Length >0 && args [0] == "threadpool-io") {
+                       threadpool_io ();
+                       return 0;
+               }
                breakpoints ();
                single_stepping ();
                arguments ();
@@ -1541,6 +1548,49 @@ public class Tests : TestsBase, ITest2
        public override string virtual_method () {
                return "V2";
        }
+
+       [MethodImplAttribute (MethodImplOptions.NoInlining)]
+       public static void threadpool_bp () { }
+
+       [MethodImplAttribute (MethodImplOptions.NoInlining)]
+       public static void threadpool_io () {
+               // Start a threadpool task that blocks on I/O.
+               // Regression test for #42625
+               const int nbytes = 16;
+               var bsOut = new byte[nbytes];
+               for (int i = 0; i < nbytes; i++) {
+                       bsOut[i] = (byte)i;
+               }
+               var endPoint = NetworkHelpers.LocalEphemeralEndPoint ();
+               var l = new TcpListener (endPoint);
+               l.Start ();
+               Task<byte[]> t = Task.Run (async () => {
+                       var c = new TcpClient ();
+                       await c.ConnectAsync (endPoint.Address, endPoint.Port);
+                       var streamIn = c.GetStream ();
+                       var bs = new byte[nbytes];
+                       int nread = 0;
+                       int nremain = nbytes;
+                       while (nread < nbytes) {
+                               int r = await streamIn.ReadAsync (bs, nread, nremain);
+                               nread += r;
+                               nremain -= r;
+                       }
+                       streamIn.Close ();
+                       return bs;
+                       });
+               var s = l.AcceptTcpClient ();
+               l.Stop ();
+               // write bytes in two groups so that the task blocks on the ReadAsync
+               var streamOut = s.GetStream ();
+               var nbytesFirst = nbytes / 2;
+               var nbytesRest = nbytes - nbytesFirst;
+               streamOut.Write (bsOut, 0, nbytesFirst);
+               threadpool_bp ();
+               streamOut.Write (bsOut, nbytesFirst, nbytesRest);
+               streamOut.Close ();
+               var bsIn = t.Result;
+       }
 }
 
 class TypeLoadClass {
index c0af12cb38ac15d9f023d11cfffa62408e2fb559..88ed411da35bcabcf36968da7de70dcaa9fc7d16 100644 (file)
@@ -4035,6 +4035,22 @@ public class DebuggerTests
                // Make sure we are still in the cctor
                Assert.AreEqual (".cctor", e.Thread.GetFrames ()[0].Location.Method.Name);
        }
+
+       [Test]
+       public void ThreadpoolIOsinglestep () {
+               TearDown ();
+               Start ("dtest-app.exe", "threadpool-io");
+               // This is a regression test for #42625.  It tests the
+               // interaction (particularly in coop GC) of the
+               // threadpool I/O mechanism and the soft debugger.
+               Event e = run_until ("threadpool_io");
+               // run until we sent the task half the bytes it
+               // expects, so that it blocks waiting for the rest.
+               e = run_until ("threadpool_bp");
+               var req = create_step (e);
+               e = step_out (); // leave threadpool_bp
+               e = step_out (); // leave threadpool_io
+       }
 }
 
 }
index 955ebd0b11f9e9c0796801efc689b1fc9a88f59e..52fe6804103b0bfccf55b764a49826f570db4a1a 100644 (file)
@@ -1,2 +1,3 @@
 #include monodroid_Mono.Security_test.dll.build-failure-exclude.sources
-#include monodroid_Mono.Data.Sqlite_test.dll.new-exclude.sources
+#include monodroid_Mono.Security_test.dll.new-exclude.sources
+
index 8883dbaf8343d4c196eb782c96fa149ca149e50c..19a6cc1ceedadb434d7cdd26a96c0d514a12ce48 100644 (file)
@@ -3,7 +3,9 @@ SUBDIRS =
 include ../../build/rules.make
 
 LIBRARY = Mono.Tasklets.dll
-NO_TEST = yes
+
+LIB_MCS_FLAGS =
+TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
 
 include ../../build/library.make
 
diff --git a/mcs/class/Mono.Tasklets/Mono.Tasklets_test.dll.sources b/mcs/class/Mono.Tasklets/Mono.Tasklets_test.dll.sources
new file mode 100644 (file)
index 0000000..f994ee3
--- /dev/null
@@ -0,0 +1 @@
+Mono.Tasklets/ContinuationsTest.cs
diff --git a/mcs/class/Mono.Tasklets/Test/Mono.Tasklets/ContinuationsTest.cs b/mcs/class/Mono.Tasklets/Test/Mono.Tasklets/ContinuationsTest.cs
new file mode 100644 (file)
index 0000000..6fa67a9
--- /dev/null
@@ -0,0 +1,189 @@
+using NUnit.Framework;
+
+using System;
+using Mono.Tasklets;
+
+namespace MonoTests.System
+{
+    [TestFixture]
+    public class ContinuationsTest
+    {
+        [TestFixtureSetUp]
+        public void FixtureSetUp ()
+        {
+            try {
+                var temp = new Continuation ();
+            } catch (NotImplementedException) {
+                Assert.Ignore ("This platform doesn't support Tasklets.");
+            }
+        }
+
+        int total = 0;
+
+        [Test]
+        public void TestContinuationsLoop()
+        {
+            Continuation _contA = new Continuation();
+
+            _contA.Mark();
+            int value = 0;
+            int ret = _contA.Store(0);
+            for (int i = ret; i < 10; i++) {
+                value += i;
+            }
+
+            if (value > 0) {
+                total += value;
+                _contA.Restore(ret + 1);
+            }
+
+            Assert.AreEqual(total, 330);
+        }
+
+        private int yields = 0;
+
+        [Test]
+        public void Yielding()
+        {
+            Continuation baseCont = new Continuation();
+            Continuation taskCont = new Continuation();
+
+            baseCont.Mark();
+            taskCont.Mark();
+
+            // Store the base continuation to start the task
+            if (baseCont.Store(0) == 0) {
+                bool done = false;
+                int count = 0;
+
+                while (!done) {
+                    // Do stuff for the task.
+                    ++count;
+
+                    // This task is counting to 100.
+                    if (count == 100) {
+                        done = true;
+                    }
+
+                    // Yield every 10 loops
+                    else if (count % 10 == 0) {
+
+                        // To yield, store the task continuation then restore
+                        // the base continuation.
+                        if (taskCont.Store(0) == 0) {
+                            baseCont.Restore(1);
+                        }
+                    }
+                }
+            }
+            // When restored, 'Store' will return what was passed to Restore, in this case 1 so fall here.
+            else {
+                // Count the yields, then go back to the task.
+                ++yields;
+                taskCont.Restore(1);
+            }
+
+            Assert.AreEqual(9, yields);
+        }
+
+
+        public class MicroThread
+        {
+
+            public void Yield()
+            {
+                if (MyThread.Store(0) == 0) {
+                    MainThread.Restore(1);
+                }
+            }
+
+            public void Resume()
+            {
+                if (MainThread.Store(0) == 0) {
+                    MyThread.Restore(1);
+                }
+            }
+
+            public void DoWork(Action action)
+            {
+                if (MainThread.Store(0) == 0) {
+                    action();
+                    Done = true;
+                    MainThread.Restore(1);
+                }
+            }
+
+            public bool Done = false;
+            public Continuation MainThread = new Continuation();
+            public Continuation MyThread = new Continuation();
+        }
+
+        public class MicroBJob
+        {
+            private int _Count = 0;
+            public int Count
+            {
+                get { return _Count; }
+                set { _Count = value; }
+            }
+
+            public MicroThread MicroThread;
+            public void Work()
+            {
+                while (Count < 100) {
+                    ++Count;
+                    if (Count % 10 == 0) {
+                        MicroThread.Yield();
+                    }
+                }
+            }
+        }
+
+        [Test]
+        public void MicroThreadTest()
+        {
+            MicroThread microA = new MicroThread();
+            MicroThread microB = new MicroThread();
+
+            microA.MainThread.Mark();
+            microA.MyThread.Mark();
+            microB.MainThread.Mark();
+            microB.MyThread.Mark();
+
+            Assert.AreEqual(false, microA.Done);
+            Assert.AreEqual(false, microB.Done);
+
+            microA.DoWork(() =>
+            {
+                int count = 0;
+                while (count < 100) {
+                    ++count;
+                    if (count % 10 == 0) {
+                        microA.Yield();
+                    }
+                }
+            });
+
+            MicroBJob jobB = new MicroBJob();
+            jobB.MicroThread = microB;
+
+            microB.DoWork(jobB.Work);
+
+            Assert.AreEqual(false, microA.Done);
+            Assert.AreEqual(false, microB.Done);
+
+            int yields = 0;
+            while (yields < 20) {
+                if (!microA.Done) microA.Resume();
+                if (!microB.Done) microB.Resume();
+                if (microA.Done && microB.Done) break;
+                ++yields;
+            }
+
+            Assert.AreEqual(true, microA.Done);
+            Assert.AreEqual(true, microB.Done);
+            Assert.AreEqual(100, jobB.Count);
+            Assert.AreEqual(9, yields);
+        }
+    }
+}
diff --git a/mcs/class/System.Core/Microsoft.Win32.SafeHandles/SafeNCryptHandle.cs b/mcs/class/System.Core/Microsoft.Win32.SafeHandles/SafeNCryptHandle.cs
new file mode 100644 (file)
index 0000000..873ce57
--- /dev/null
@@ -0,0 +1,49 @@
+//
+// SafeNCryptHandle.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;
+
+namespace Microsoft.Win32.SafeHandles
+{
+       public abstract class SafeNCryptHandle : System.Runtime.InteropServices.SafeHandle
+       {
+               protected SafeNCryptHandle ()
+                       : base (IntPtr.Zero, true)
+               {
+               }
+
+               public override bool IsInvalid { get { throw new NotImplementedException (); } }
+
+               protected override bool ReleaseHandle ()
+               {
+                       return false;
+               }
+
+               protected abstract bool ReleaseNativeHandle();
+       }
+}      
\ No newline at end of file
diff --git a/mcs/class/System.Core/Microsoft.Win32.SafeHandles/SafeNCryptKeyHandle.cs b/mcs/class/System.Core/Microsoft.Win32.SafeHandles/SafeNCryptKeyHandle.cs
new file mode 100644 (file)
index 0000000..3dcbfae
--- /dev/null
@@ -0,0 +1,42 @@
+//
+// SafeNCryptKeyHandle.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 Microsoft.Win32.SafeHandles
+{
+       public sealed class SafeNCryptKeyHandle : SafeNCryptHandle
+       {
+               public SafeNCryptKeyHandle ()
+               {
+               }
+
+               protected override bool ReleaseNativeHandle ()
+               {
+                       return false;
+               }
+       }
+}      
\ No newline at end of file
diff --git a/mcs/class/System.Core/Microsoft.Win32.SafeHandles/SafeNCryptProviderHandle.cs b/mcs/class/System.Core/Microsoft.Win32.SafeHandles/SafeNCryptProviderHandle.cs
new file mode 100644 (file)
index 0000000..4a2d17a
--- /dev/null
@@ -0,0 +1,42 @@
+//
+// SafeNCryptProviderHandle.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 Microsoft.Win32.SafeHandles
+{
+       public sealed class SafeNCryptProviderHandle : SafeNCryptHandle
+       {
+               public SafeNCryptProviderHandle ()
+               {
+               }
+
+               protected override bool ReleaseNativeHandle ()
+               {
+                       return false;
+               }
+       }
+}      
\ No newline at end of file
diff --git a/mcs/class/System.Core/Microsoft.Win32.SafeHandles/SafeNCryptSecretHandle.cs b/mcs/class/System.Core/Microsoft.Win32.SafeHandles/SafeNCryptSecretHandle.cs
new file mode 100644 (file)
index 0000000..8943e38
--- /dev/null
@@ -0,0 +1,42 @@
+//
+// SafeNCryptSecretHandle.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 Microsoft.Win32.SafeHandles
+{
+       public sealed class SafeNCryptSecretHandle : SafeNCryptHandle
+       {
+               public SafeNCryptSecretHandle ()
+               {
+               }
+
+               protected override bool ReleaseNativeHandle ()
+               {
+                       return false;
+               }
+       }
+}      
\ No newline at end of file
index 2c195034d83fa59f0a2b62a831db6e3f97ef668a..23bf26f7482bb7654e1e5043f8381c937000f460 100644 (file)
@@ -63,7 +63,7 @@ namespace System.IO.Pipes
                {
                }
 
-               public AnonymousPipeClientStream (PipeDirection direction,SafePipeHandle safePipeHandle)
+               public AnonymousPipeClientStream (PipeDirection direction, SafePipeHandle safePipeHandle)
                        : base (direction, DefaultBufferSize)
                {
                        /*
@@ -73,7 +73,11 @@ namespace System.IO.Pipes
                                impl = new UnixAnonymousPipeClient (this, safePipeHandle);
                        */
 
+#if MOBILE
+                       throw new NotImplementedException ();
+#else
                        InitializeHandle (safePipeHandle, false, false);
+#endif
                        IsConnected = true;
                }
 
index 01e4b1dbf49308e502c5209126ce33cbed4e7fd9..97455f30cdab55d78766508ad566684a21674a3b 100644 (file)
@@ -59,10 +59,18 @@ namespace System.IO.Pipes
                }
 
                public AnonymousPipeServerStream (PipeDirection direction, HandleInheritability inheritability, int bufferSize)
+#if MOBILE
+                       : base (direction, bufferSize)
+               {
+                       throw new NotImplementedException ();
+               }
+#else
                        : this (direction, inheritability, bufferSize, null)
                {
                }
+#endif
 
+#if !MOBILE
                public AnonymousPipeServerStream (PipeDirection direction, HandleInheritability inheritability, int bufferSize, PipeSecurity pipeSecurity)
                        : base (direction, bufferSize)
                {
@@ -77,6 +85,7 @@ namespace System.IO.Pipes
                        InitializeHandle (impl.Handle, false, false);
                        IsConnected = true;
                }
+#endif
 
                [MonoTODO]
                public AnonymousPipeServerStream (PipeDirection direction, SafePipeHandle serverSafePipeHandle, SafePipeHandle clientSafePipeHandle)
@@ -90,6 +99,9 @@ namespace System.IO.Pipes
                        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, serverSafePipeHandle, clientSafePipeHandle);
                        else
@@ -99,6 +111,12 @@ namespace System.IO.Pipes
                        IsConnected = true;
 
                        ClientSafePipeHandle = clientSafePipeHandle;
+#endif
+               }
+
+               ~AnonymousPipeServerStream ()
+               {
+                       // To be compatible with .net
                }
 
                IAnonymousPipeServer impl;
index 357f7387d23681febef3fbd4bf1bc440688d6c43..181ab1ccbf0b44cd4f14ca719e5f49d71f498647 100644 (file)
@@ -72,21 +72,33 @@ namespace System.IO.Pipes
                }
 
                public NamedPipeClientStream (string serverName, string pipeName, PipeDirection direction, PipeOptions options, TokenImpersonationLevel impersonationLevel, HandleInheritability inheritability)
+#if MOBILE
+                       : base (direction, DefaultBufferSize)
+               {
+                       throw new NotImplementedException ();
+               }
+#else
                        : this (serverName, pipeName, ToAccessRights (direction), options, impersonationLevel, inheritability)
                {
                }
+#endif
 
                public NamedPipeClientStream (PipeDirection direction, bool isAsync, bool isConnected, SafePipeHandle safePipeHandle)
                        : base (direction, DefaultBufferSize)
                {
+#if MOBILE
+                       throw new NotImplementedException ();
+#else
                        if (IsWindows)
                                impl = new Win32NamedPipeClient (this, safePipeHandle);
                        else
                                impl = new UnixNamedPipeClient (this, safePipeHandle);
                        IsConnected = isConnected;
                        InitializeHandle (safePipeHandle, true, isAsync);
+#endif
                }
 
+#if !MOBILE
                public NamedPipeClientStream (string serverName, string pipeName, PipeAccessRights desiredAccessRights, PipeOptions options, TokenImpersonationLevel impersonationLevel, HandleInheritability inheritability)
                        : base (ToDirection (desiredAccessRights), DefaultBufferSize)
                {
@@ -99,21 +111,30 @@ namespace System.IO.Pipes
                        else
                                impl = new UnixNamedPipeClient (this, serverName, pipeName, desiredAccessRights, options, inheritability);
                }
+#endif
 
                INamedPipeClient impl;
 
                public void Connect ()
                {
+#if MOBILE
+                       throw new NotImplementedException ();
+#else
                        impl.Connect ();
                        InitializeHandle (impl.Handle, false, impl.IsAsync);
                        IsConnected = true;
+#endif
                }
 
                public void Connect (int timeout)
                {
+#if MOBILE
+                       throw new NotImplementedException ();
+#else                  
                        impl.Connect (timeout);
                        InitializeHandle (impl.Handle, false, impl.IsAsync);
                        IsConnected = true;
+#endif
                }
 
                public int NumberOfServerInstances {
index b29deaf3301489decd3473fe85db39af83ecfbf6..2723109bd988f7e2ec1a34558cb600b810a77027 100644 (file)
@@ -70,10 +70,18 @@ namespace System.IO.Pipes
                }
 
                public NamedPipeServerStream (string pipeName, PipeDirection direction, int maxNumberOfServerInstances, PipeTransmissionMode transmissionMode, PipeOptions options, int inBufferSize, int outBufferSize)
+#if MOBILE             
+                       : base (direction, inBufferSize)
+               {
+                       throw new NotImplementedException ();
+               }
+#else
                        : this (pipeName, direction, maxNumberOfServerInstances, transmissionMode, options, inBufferSize, outBufferSize, null)
                {
                }
+#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)
                {
@@ -101,16 +109,26 @@ namespace System.IO.Pipes
 
                        InitializeHandle (impl.Handle, false, (options & PipeOptions.Asynchronous) != PipeOptions.None);
                }
+#endif
 
                public NamedPipeServerStream (PipeDirection direction, bool isAsync, bool isConnected, SafePipeHandle safePipeHandle)
                        : base (direction, DefaultBufferSize)
                {
+#if MOBILE
+                       throw new NotImplementedException ();
+#else
                        if (IsWindows)
                                impl = new Win32NamedPipeServer (this, safePipeHandle);
                        else
                                impl = new UnixNamedPipeServer (this, safePipeHandle);
                        IsConnected = isConnected;
                        InitializeHandle (safePipeHandle, true, isAsync);
+#endif
+               }
+
+               ~NamedPipeServerStream ()
+               {
+                       // To be compatible with .net
                }
 
                INamedPipeServer impl;
@@ -120,12 +138,14 @@ 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 ()
                {
@@ -140,6 +160,7 @@ namespace System.IO.Pipes
                        throw new NotImplementedException ();
                }
 
+#if !MOBILE
                // async operations
 
                Action wait_connect_delegate;
@@ -156,6 +177,7 @@ namespace System.IO.Pipes
                {
                        wait_connect_delegate.EndInvoke (asyncResult);
                }
+#endif
        }
 }
 
index fd4a57a693063f4b21c28f755bd953d42089206b..ed030e7608bde8da0cf99b23f88752f042804491 100644 (file)
@@ -46,15 +46,18 @@ namespace System.IO.Pipes
                // FIXME: not precise.
                internal const int DefaultBufferSize = 0x400;
 
+#if !MOBILE
                internal static bool IsWindows {
                        get { return Win32Marshal.IsWindows; }
                }
+#endif
 
                internal Exception ThrowACLException ()
                {
                        return new NotImplementedException ("ACL is not supported in Mono");
                }
 
+#if !MOBILE
                internal static PipeAccessRights ToAccessRights (PipeDirection direction)
                {
                        switch (direction) {
@@ -85,6 +88,7 @@ namespace System.IO.Pipes
                                        throw new ArgumentOutOfRangeException ();
                        }
                }
+#endif
 
                protected PipeStream (PipeDirection direction, int bufferSize)
                        : this (direction, PipeTransmissionMode.Byte, bufferSize)
@@ -140,7 +144,9 @@ namespace System.IO.Pipes
                        set { stream = value; }
                }
 
+#if !MOBILE
                protected bool IsHandleExposed { get; private set; }
+#endif
 
                [MonoTODO]
                public bool IsMessageComplete { get; private set; }
@@ -176,7 +182,19 @@ 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 ()
                {
@@ -206,6 +224,7 @@ namespace System.IO.Pipes
                        this.IsHandleExposed = isExposed;
                        this.IsAsync = isAsync;
                }
+#endif
 
                protected override void Dispose (bool disposing)
                {
@@ -234,6 +253,7 @@ namespace System.IO.Pipes
                        throw new NotSupportedException ();
                }
 
+#if !MOBILE
                public PipeSecurity GetAccessControl ()
                {
                        return new PipeSecurity (SafePipeHandle,
@@ -255,6 +275,7 @@ namespace System.IO.Pipes
                public void WaitForPipeDrain ()
                {
                }
+#endif
 
                [MonoTODO]
                public override int Read ([In] byte [] buffer, int offset, int count)
@@ -298,6 +319,7 @@ namespace System.IO.Pipes
 
                // async
 
+#if !MOBILE
                Func<byte [],int,int,int> read_delegate;
 
                [HostProtection (SecurityAction.LinkDemand, ExternalThreading = true)]
@@ -327,6 +349,7 @@ namespace System.IO.Pipes
                {
                        write_delegate.EndInvoke (asyncResult);
                }
+#endif
        }
 }
 
diff --git a/mcs/class/System.Core/System.Security.Cryptography.X509Certificates/ECDsaCertificateExtensions.cs b/mcs/class/System.Core/System.Security.Cryptography.X509Certificates/ECDsaCertificateExtensions.cs
new file mode 100644 (file)
index 0000000..aa5da44
--- /dev/null
@@ -0,0 +1,45 @@
+//
+// ECDsaCertificateExtensions.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.
+//
+
+namespace System.Security.Cryptography.X509Certificates
+{
+       public static class ECDsaCertificateExtensions
+       {
+               [MonoTODO]
+               public static ECDsa GetECDsaPrivateKey (this X509Certificate2 certificate)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static ECDsa GetECDsaPublicKey (this X509Certificate2 certificate)
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+}
diff --git a/mcs/class/System.Core/System.Security.Cryptography.X509Certificates/RSACertificateExtensions.cs b/mcs/class/System.Core/System.Security.Cryptography.X509Certificates/RSACertificateExtensions.cs
new file mode 100644 (file)
index 0000000..0e322e4
--- /dev/null
@@ -0,0 +1,45 @@
+//
+// RsaCertificateExtensions.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.
+//
+
+namespace System.Security.Cryptography.X509Certificates
+{
+       public static class RSACertificateExtensions
+       {
+               [MonoTODO]
+               public static RSA GetRSAPrivateKey(this X509Certificate2 certificate)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static RSA GetRSAPublicKey(this X509Certificate2 certificate)
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+}
diff --git a/mcs/class/System.Core/System.Security.Cryptography/AesCng.cs b/mcs/class/System.Core/System.Security.Cryptography/AesCng.cs
new file mode 100644 (file)
index 0000000..64377b7
--- /dev/null
@@ -0,0 +1,104 @@
+//
+// AesCng.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.Security.Cryptography
+{
+       public sealed class AesCng : Aes
+       {
+               public AesCng ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public AesCng (string keyName)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public AesCng (string keyName, CngProvider provider)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public AesCng (string keyName, CngProvider provider, CngKeyOpenOptions openOptions)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override Byte[] Key {
+                       get {
+                               throw new NotImplementedException ();
+                       } set {
+                               throw new NotImplementedException ();
+                       }
+               }
+               public override int KeySize {
+                       get {
+                               throw new NotImplementedException ();
+                       }
+
+                       set {
+                               throw new NotImplementedException ();
+                       }
+               }
+               public override ICryptoTransform CreateDecryptor ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override ICryptoTransform CreateDecryptor (Byte[] rgbKey, Byte[] rgbIV)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override ICryptoTransform CreateEncryptor ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override ICryptoTransform CreateEncryptor (Byte[] rgbKey, Byte[] rgbIV)
+               {
+                       return default(System.Security.Cryptography.ICryptoTransform);
+               }
+
+               protected override void Dispose (bool disposing) {
+                       throw new NotImplementedException ();
+               }
+
+               public override void GenerateIV ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override void GenerateKey ()
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+}
\ No newline at end of file
diff --git a/mcs/class/System.Core/System.Security.Cryptography/TripleDESCng.cs b/mcs/class/System.Core/System.Security.Cryptography/TripleDESCng.cs
new file mode 100644 (file)
index 0000000..48f9377
--- /dev/null
@@ -0,0 +1,104 @@
+//
+// TripleDESCng.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.Security.Cryptography
+{
+       public sealed class TripleDESCng : TripleDES
+       {
+               public TripleDESCng ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public TripleDESCng (string keyName)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public TripleDESCng (string keyName, CngProvider provider)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public TripleDESCng (string keyName, CngProvider provider, CngKeyOpenOptions openOptions)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override Byte[] Key {
+                       get {
+                               throw new NotImplementedException ();
+                       } set {
+                               throw new NotImplementedException ();
+                       }
+               }
+               public override int KeySize {
+                       get {
+                               throw new NotImplementedException ();
+                       }
+
+                       set {
+                               throw new NotImplementedException ();
+                       }
+               }
+               public override ICryptoTransform CreateDecryptor ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override ICryptoTransform CreateDecryptor (Byte[] rgbKey, Byte[] rgbIV)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override ICryptoTransform CreateEncryptor ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override ICryptoTransform CreateEncryptor (Byte[] rgbKey, Byte[] rgbIV)
+               {
+                       return default(System.Security.Cryptography.ICryptoTransform);
+               }
+
+               protected override void Dispose (bool disposing) {
+                       throw new NotImplementedException ();
+               }
+
+               public override void GenerateIV ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public override void GenerateKey ()
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+}
\ No newline at end of file
index b61fcb2bf4dbda1e403cf6b0c84d9539361b605d..27191c37ed2b7b121d2f1926471d459add1d013f 100644 (file)
@@ -379,7 +379,9 @@ namespace MonoTests.System.IO.MemoryMappedFiles {
                [Test]
                public void CreateViewStreamAlignToPageSize ()
                {
-#if MONOTOUCH
+#if __WATCHOS__
+                       int pageSize = 4096;
+#elif MONOTOUCH
                        // iOS bugs on ARM64 - bnc #27667 - apple #
                        int pageSize = (IntPtr.Size == 4) ? Environment.SystemPageSize : 4096;
 #else
index 676127096e1f7ce4cd110a3b85e3c3ee4ca6e1de..30969ddee01b4bd65e7f9bf96225cc8369779b8e 100644 (file)
@@ -1,4 +1,5 @@
 ../../build/common/SR.cs
+../../build/common/MonoTODOAttribute.cs
 
 Assembly/AssemblyInfo.cs
 System/Util.cs
@@ -6,6 +7,25 @@ System.IO.MemoryMappedFiles/MemoryMappedFile.cs
 System.IO.MemoryMappedFiles/MemoryMappedView.cs
 Microsoft.Win32.SafeHandles/SafeMemoryMappedFileHandle.cs
 Microsoft.Win32.SafeHandles/SafeMemoryMappedViewHandle.cs
+System.Security.Cryptography/AesCng.cs
+System.Security.Cryptography/TripleDESCng.cs
+System.Security.Cryptography.X509Certificates/ECDsaCertificateExtensions.cs
+System.Security.Cryptography.X509Certificates/RSACertificateExtensions.cs
+Microsoft.Win32.SafeHandles/SafeNCryptHandle.cs
+Microsoft.Win32.SafeHandles/SafeNCryptKeyHandle.cs
+Microsoft.Win32.SafeHandles/SafeNCryptProviderHandle.cs
+Microsoft.Win32.SafeHandles/SafeNCryptSecretHandle.cs
+Microsoft.Win32.SafeHandles/SafePipeHandle.cs
+
+System.IO.Pipes/AnonymousPipeClientStream.cs
+System.IO.Pipes/AnonymousPipeServerStream.cs
+System.IO.Pipes/NamedPipeClientStream.cs
+System.IO.Pipes/NamedPipeServerStream.cs
+System.IO.Pipes/PipeDirection.cs
+System.IO.Pipes/PipeInterfaces.cs
+System.IO.Pipes/PipeOptions.cs
+System.IO.Pipes/PipeStream.cs
+System.IO.Pipes/PipeTransmissionMode.cs
 
 ReferenceSources/SR.cs
 ReferenceSources/SR.missing.cs
@@ -185,9 +205,20 @@ ReferenceSources/Strings.cs
 ../referencesource/System.Core/System/Runtime/CompilerServices/ExecutionScope.cs
 
 ../referencesource/System.Core/System/Security/Cryptography/Aes.cs
+../referencesource/System.Core/System/Security/Cryptography/BCryptNative.cs
+../referencesource/System.Core/System/Security/Cryptography/CngAlgorithm.cs
+../referencesource/System.Core/System/Security/Cryptography/CngAlgorithmGroup.cs
+../referencesource/System.Core/System/Security/Cryptography/CngKey.cs
 ../referencesource/System.Core/System/Security/Cryptography/CngKeyBlobFormat.cs
+../referencesource/System.Core/System/Security/Cryptography/CngKeyCreationParameters.cs
+../referencesource/System.Core/System/Security/Cryptography/CngProperty.cs
+../referencesource/System.Core/System/Security/Cryptography/CngProvider.cs
+../referencesource/System.Core/System/Security/Cryptography/CngUIPolicy.cs
 ../referencesource/System.Core/System/Security/Cryptography/ECDiffieHellmanPublicKey.cs
 ../referencesource/System.Core/System/Security/Cryptography/ECDsa.cs
+../referencesource/System.Core/System/Security/Cryptography/ECDsaCng.cs
+../referencesource/System.Core/System/Security/Cryptography/NCryptNative.cs
+../referencesource/System.Core/System/Security/Cryptography/RsaCng.cs
 
 ../referencesource/System.Core/System/threading/ReaderWriterLockSlim/ReaderWriterLockSlim.cs
 
index 0d79ec4913e03f5878ac587c69a5a5324589d5a6..8b8fef0e40e738565956982bb7c19e8fb8c0f9ee 100644 (file)
@@ -3,8 +3,6 @@
 
 System.Security.Cryptography/AesCryptoServiceProvider.cs
 System.Security.Cryptography/AesTransform.cs
-System.Security.Cryptography/CngAlgorithm.cs
-System.Security.Cryptography/CngAlgorithmGroup.cs
 System.Security.Cryptography/MD5Cng.cs
 System.Security.Cryptography/SHA1Cng.cs
 System.Security.Cryptography/SHA256Cng.cs
index 5dedcbf316cf764099726b96424a0bdbabcad725..f367efd60c7562e4d1253707eed5828ace4a90e5 100644 (file)
@@ -1,29 +1,16 @@
 #include common_System.Core.dll.sources
 #include dynamic_System.Core.dll.sources
 
-Microsoft.Win32.SafeHandles/SafePipeHandle.cs
-
-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
 System.IO.Pipes/PipeUnix.cs
 System.IO.Pipes/PipeWin32.cs
 
 System.Security.Cryptography/AesCryptoServiceProvider.cs
 System.Security.Cryptography/AesTransform.cs
-System.Security.Cryptography/CngAlgorithm.cs
-System.Security.Cryptography/CngAlgorithmGroup.cs
 System.Security.Cryptography/MD5Cng.cs
 System.Security.Cryptography/SHA1Cng.cs
 System.Security.Cryptography/SHA256Cng.cs
index b928fc4086aa72b6ef1c26353187c972223afad2..0362d94774ad4b90d592729c79112b48e5b4b8d3 100644 (file)
@@ -33,131 +33,135 @@ using System.Data.SqlTypes;
 
 namespace Microsoft.SqlServer.Server 
 {
-       public sealed class SqlDataRecord : IDataRecord
+       public class SqlDataRecord : IDataRecord
        {
-               public bool GetBoolean (int i)
+               public SqlDataRecord (params SqlMetaData[] metaData)
+               {
+               }
+
+               public virtual bool GetBoolean (int ordinal)
                {
                        throw new NotImplementedException ();
                }
 
-               public byte GetByte (int i)
+               public virtual byte GetByte (int ordinal)
                {
                        throw new NotImplementedException ();
                }
 
-               public long GetBytes (int i, long fieldOffset, byte[] buffer, int bufferoffset, int length)
+               public virtual long GetBytes (int ordinal, long fieldOffset, byte[] buffer, int bufferOffset, int length)
                {
                        throw new NotImplementedException ();
                }
 
-               public char GetChar (int i)
+               public virtual char GetChar (int ordinal)
                {
                        throw new NotImplementedException ();
                }
 
-               public long GetChars (int i, long fieldoffset, char[] buffer, int bufferoffset, int length)
+               public virtual long GetChars (int ordinal, long fieldOffset, char[] buffer, int bufferOffset, int length)
                {
                        throw new NotImplementedException ();
                }
 
-               public IDataReader GetData (int i)
+               public virtual IDataReader GetData (int ordinal)
                {
                        throw new NotImplementedException ();
                }
 
-               public string GetDataTypeName (int i)
+               public virtual string GetDataTypeName (int ordinal)
                {
                        throw new NotImplementedException ();
                }
 
-               public DateTime GetDateTime (int i)
+               public virtual DateTime GetDateTime (int ordinal)
                {
                        throw new NotImplementedException ();
                }
 
-               public decimal GetDecimal (int i)
+               public virtual decimal GetDecimal (int ordinal)
                {
                        throw new NotImplementedException ();
                }
 
-               public double GetDouble (int i)
+               public virtual double GetDouble (int ordinal)
                {
                        throw new NotImplementedException ();
                }
 
-               public System.Type GetFieldType (int i)
+               public virtual System.Type GetFieldType (int ordinal)
                {
                        throw new NotImplementedException ();
                }
 
-               public float GetFloat (int i)
+               public virtual float GetFloat (int ordinal)
                {
                        throw new NotImplementedException ();
                }
 
-               public Guid GetGuid (int i)
+               public virtual Guid GetGuid (int ordinal)
                {
                        throw new NotImplementedException ();
                }
 
-               public short GetInt16 (int i)
+               public virtual short GetInt16 (int ordinal)
                {
                        throw new NotImplementedException ();
                }
 
-               public int GetInt32 (int i)
+               public virtual int GetInt32 (int ordinal)
                {
                        throw new NotImplementedException ();
                }
 
-               public long GetInt64 (int i)
+               public virtual long GetInt64 (int ordinal)
                {
                        throw new NotImplementedException ();
                }
 
-               public string GetName (int i)
+               public virtual string GetName (int ordinal)
                {
                        throw new NotImplementedException ();
                }
 
-               public int GetOrdinal (string name)
+               public virtual int GetOrdinal (string name)
                {
                        throw new NotImplementedException ();
                }
 
-               public string GetString (int i)
+               public virtual string GetString (int ordinal)
                {
                        throw new NotImplementedException ();
                }
 
-               public object GetValue (int i)
+               public virtual object GetValue (int ordinal)
                {
                        throw new NotImplementedException ();
                }
 
-               public int GetValues (object[] values)
+               public virtual int GetValues (object[] values)
                {
                        throw new NotImplementedException ();
                }
 
-               public bool IsDBNull (int i)
+               public virtual bool IsDBNull (int ordinal)
                {
                        throw new NotImplementedException ();
                }
 
-               public int FieldCount {
+               public virtual int FieldCount {
                        get {
                                throw new NotImplementedException ();
                        }
                }
 
-               public object this [string index] {
+               public virtual object this [string name] {
                        get {
                                throw new NotImplementedException ();
                        }
                }
 
-               public object this [int index] {
+               public virtual object this [int ordinal] {
                        get {
                                throw new NotImplementedException ();
                        }
diff --git a/mcs/class/System.Data/ReferenceSources/PoolBlockingPeriod.cs b/mcs/class/System.Data/ReferenceSources/PoolBlockingPeriod.cs
new file mode 100644 (file)
index 0000000..82231f4
--- /dev/null
@@ -0,0 +1,9 @@
+namespace System.Data.SqlClient
+{
+       public enum PoolBlockingPeriod
+       {
+               Auto,
+               AlwaysBlock,
+               NeverBlock
+       }
+}
\ No newline at end of file
index 1fce5dcce82839c44d1805b58f449849591dc318..c103d0d1e3bf658a2717757fb01d2e7b56405504 100644 (file)
@@ -1265,6 +1265,13 @@ namespace System.Data {
                public const string SQLCR_UnrecoverableServer = "The connection is broken and recovery is not possible.  The connection is marked by the server as unrecoverable.  No attempt was made to restore the connection.";
                public const string SQLCR_UnrecoverableClient = "The connection is broken and recovery is not possible.  The connection is marked by the client driver as unrecoverable.  No attempt was made to restore the connection.";
                public const string SQLCR_NoCRAckAtReconnection = "The server did not acknowledge a recovery attempt, connection recovery is not possible.";
+
+               public const string AZURESQL_GenericEndpoint = ".database.windows.net";
+               public const string AZURESQL_GermanEndpoint = ".database.cloudapi.de";
+               public const string AZURESQL_UsGovEndpoint = ".database.usgovcloudapi.net";
+               public const string AZURESQL_ChinaEndpoint = ".database.chinacloudapi.cn";
+               public const string DbConnectionString_PoolBlockingPeriod = "Defines the blocking period behavior for a connection pool.";
+               public const string SQL_Timeout_Execution = "Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding.";
        }
 
 
index a44a225534eee1f385f9f5b2ef5e9f5b07097656..388f547212ad45907957b767ab265f33591a724b 100644 (file)
@@ -4197,7 +4197,7 @@ namespace MonoTests.System.Data
                        Assert.AreEqual (5, n, "n");
                }
 
-#if !MONOTOUCH
+#if !MONOTOUCH && !MOBILE_STATIC
                [Test]
                public void NFIFromBug55978 ()
                {
index f727d736d2a05a639ce2441350bd4bb9eedc5651..50850b6d23f57e8edd44b15c64d2f78ac7e61fa4 100644 (file)
@@ -1158,6 +1158,9 @@ namespace MonoTests.System.Data
                        Assert.AreEqual (-1, evProp.NewIndex, "#10");
                        Assert.AreEqual (-1, evProp.OldIndex, "#11");
                        Assert.AreEqual (ListChangedType.Reset, evProp.lstType, "#12");
+
+                       // Keep the view alive otherwise we might miss events
+                       GC.KeepAlive (view);
                }
 
                [Test]
diff --git a/mcs/class/System.Data/app_test_mobile_static.config b/mcs/class/System.Data/app_test_mobile_static.config
new file mode 100644 (file)
index 0000000..4f31597
--- /dev/null
@@ -0,0 +1,48 @@
+<?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>
index a5b2a2f1492a695f255fbb5c8aaf165e5c297848..eb7e02eb03cc11bae31f3bf3836fe946b493f075 100644 (file)
@@ -6,6 +6,7 @@ Assembly/AssemblyInfo.cs
 ../../build/common/AssemblyRef.cs
 
 ReferenceSources/NativeOledbWrapper.cs
+ReferenceSources/PoolBlockingPeriod.cs
 ReferenceSources/Res.cs
 ReferenceSources/Res.missing.cs
 ReferenceSources/ResCategoryAttribute.cs
index 76b642b8849fda23403711d3dbc810bb48a6171a..c075e87489dc1b876471baf7dcc6c1853d44207f 100644 (file)
@@ -6,6 +6,7 @@ Assembly/AssemblyInfo.cs
 ../../build/common/AssemblyRef.cs
 
 ReferenceSources/NativeOledbWrapper.cs
+ReferenceSources/PoolBlockingPeriod.cs
 ReferenceSources/Res.cs
 ReferenceSources/Res.missing.cs
 ReferenceSources/ResCategoryAttribute.cs
index 59ff776b9f1ccbf1bb35ea36e60206a59417782f..e815bbf4afb76ab33d200014641888020c38484d 100644 (file)
@@ -5,7 +5,7 @@ SUBDIRS =
 LIBRARY = System.Drawing.dll
 
 LIB_REFS = System
-LIB_MCS_FLAGS = /unsafe \
+LIB_MCS_FLAGS = /unsafe -d:FEATURE_TYPECONVERTER \
        -resource:Assembly/Mono.ico,Mono.ico -resource:Assembly/Information.ico,Information.ico \
        -resource:Assembly/Error.ico,Error.ico -resource:Assembly/Warning.ico,Warning.ico \
        -resource:Assembly/Question.ico,Question.ico -resource:Assembly/Shield.ico,Shield.ico
index 88a8390b564906d2f34fc3785f8393481fd9dbc0..53f9568067a9c89753e9819535766698858c3661 100644 (file)
@@ -40,7 +40,7 @@ namespace System.Drawing
 {
        [Serializable]  
        [ComVisible (true)]
-#if !MONOTOUCH && !MONOMAC
+#if !MONOTOUCH && !MONOMAC && FEATURE_TYPECONVERTER
        [TypeConverter (typeof (PointConverter))]
 #endif
        public struct Point
index c2ffbc80e5e647b589ed5aec55c96c1fb0703439..0d1194675b223e54710ff551d3e8644ec9471b95 100644 (file)
@@ -39,7 +39,7 @@ namespace System.Drawing
 {
        [Serializable]
        [ComVisible (true)]
-#if !MONOTOUCH && !MONOMAC
+#if !MONOTOUCH && !MONOMAC && FEATURE_TYPECONVERTER
        [TypeConverter (typeof (RectangleConverter))]
 #endif
        public struct Rectangle
index be8fda0ea8ef0b73bf815febb8e8d4e025eab3aa..3c657dc29f26a1836d132f075f63cf4d004f1949 100644 (file)
@@ -40,7 +40,7 @@ namespace System.Drawing
 {
        [Serializable]
        [ComVisible (true)]
-#if !MONOTOUCH && !MONOMAC
+#if !MONOTOUCH && !MONOMAC && FEATURE_TYPECONVERTER
        [TypeConverter (typeof (SizeConverter))]
 #endif
        public struct Size
index 38714d1c9968f30ae18e363a4c811a82dc38de99..922ab4e35e29dc35378e9a66c8d78e019962f23a 100644 (file)
@@ -40,7 +40,7 @@ namespace System.Drawing
 {
        [Serializable]
        [ComVisible (true)]
-#if !MONOTOUCH && !MONOMAC
+#if !MONOTOUCH && !MONOMAC && FEATURE_TYPECONVERTER
        [TypeConverter (typeof (SizeFConverter))]
 #endif
        public struct SizeF
index 96af8c4131db2de4bf4b2d0d0b949f2ca6af6278..f844e5cb47158fff394b67ffc0c2454855b3f16f 100644 (file)
@@ -82,10 +82,14 @@ namespace SharpCompress.Archive
             {
                 key = key.Substring(1);
             }
+            // .NET allows duplicate entries when saving and loading Zip files.
+            // The following lines are disabled from upstream SharpCompress to allow this.
+#if ZIP_ALLOW_DUPLICATE_KEYS
             if (DoesKeyMatchExisting(key))
             {
                 throw new ArchiveException("Cannot add entry with duplicate key: " + key);
             }
+#endif
             var entry = CreateEntry(key, source, size, modified, closeStream);
             newEntries.Add(entry);
             RebuildModifiedCollection();
@@ -101,7 +105,8 @@ namespace SharpCompress.Archive
                 {
                     p = p.Substring(1);
                 }
-                return string.Equals(p, key, StringComparison.OrdinalIgnoreCase);
+                if (string.Equals(p, key, StringComparison.OrdinalIgnoreCase))
+                    return true;
             }
             return false;
         }
index d94a929e207d75b01b8bf94ce2dd7c6ec30000d5..f1b83746b47ccbb1ee5e2474abfee4dc16663a48 100644 (file)
@@ -182,6 +182,24 @@ namespace MonoTests.System.IO.Compression
                        File.Delete ("delete.zip");
                }
 
+               [Test]
+               public void ZipDeleteEntryCheckEntries()
+               {
+                       File.Copy("archive.zip", "delete.zip", overwrite: true);
+                       using (var archive = new ZipArchive(File.Open("delete.zip", FileMode.Open),
+                               ZipArchiveMode.Update))
+                       {
+                               var entry = archive.GetEntry("foo.txt");
+                               Assert.IsNotNull(entry);
+
+                               entry.Delete();
+
+                               Assert.IsNull(archive.Entries.FirstOrDefault(e => e == entry));
+                       }
+
+                       File.Delete ("delete.zip");
+               }               
+
                [Test]
                public void ZipGetEntryDeleteUpdateMode()
                {
@@ -275,11 +293,10 @@ namespace MonoTests.System.IO.Compression
                        }
                }
 
-               [Test]
-               public void ZipGetArchiveEntryStreamLengthPositionReadMode()
+               public void ZipGetArchiveEntryStreamLengthPosition(ZipArchiveMode mode)
                {
-                       using (var archive = new ZipArchive(File.Open("test.nupkg", FileMode.Open),
-                               ZipArchiveMode.Read))
+                       File.Copy("test.nupkg", "test2.nupkg", overwrite: true);
+                       using (var archive = new ZipArchive(File.Open("test2.nupkg", FileMode.Open), mode))
                        {
                                var entry = archive.GetEntry("_rels/.rels");
                                using (var stream = entry.Open())
@@ -287,9 +304,33 @@ namespace MonoTests.System.IO.Compression
                                        Assert.AreEqual(0, stream.Position);
                                        Assert.AreEqual(425, stream.Length);
                                }
+
+                               // .NET does not support these in Read mode but we do.
+                               var entry2 = archive.GetEntry("modernhttpclient.nuspec");
+                               using (var stream = entry2.Open())
+                               {
+                                       Assert.AreEqual(857, stream.Length);
+                                       if (mode == ZipArchiveMode.Update)
+                                       {
+                                               Assert.AreEqual(0, stream.Position);
+                                       }
+                               }
                        }
+                       File.Delete ("test2.nupkg");    
+               }
+
+               [Test]
+               public void ZipGetArchiveEntryStreamLengthPositionReadMode()
+               {
+                       ZipGetArchiveEntryStreamLengthPosition(ZipArchiveMode.Read);
                }
 
+               [Test]
+               public void ZipGetArchiveEntryStreamLengthPositionUpdateMode()
+               {
+                       ZipGetArchiveEntryStreamLengthPosition(ZipArchiveMode.Update);
+               }               
+
                [Test]
                public void ZipEnumerateEntriesReadMode()
                {
@@ -340,6 +381,40 @@ namespace MonoTests.System.IO.Compression
                        File.Delete ("test.zip");
                }
 
+               [Test]
+               public void ZipWriteEntriesUpdateModeNewEntry()
+               {
+                       var stream = new MemoryStream();
+                       var zipArchive = new ZipArchive(stream, ZipArchiveMode.Update);
+
+                       var newEntry = zipArchive.CreateEntry("testEntry");
+
+                       using (var newStream = newEntry.Open())
+                       {
+                               using (var sw = new StreamWriter(newStream))
+                               {
+                                       sw.Write("TEST");
+                               }
+                       }
+               }
+
+               [Test]
+               public void ZipCreateDuplicateEntriesUpdateMode()
+               {
+                       var stream = new MemoryStream();
+                       using (var zipArchive = new ZipArchive(stream, ZipArchiveMode.Update, true))
+                       {
+                               var e2 = zipArchive.CreateEntry("BBB");
+                               var e3 = zipArchive.CreateEntry("BBB");
+                       }
+
+                       stream.Position = 0;
+                       using (var zipArchive = new ZipArchive(stream, ZipArchiveMode.Read))
+                       {
+                               Assert.AreEqual(2, zipArchive.Entries.Count);
+                       }
+               }
+
                [Test]
                public void ZipWriteEntriesUpdateModeNonZeroPosition()
                {
@@ -423,5 +498,24 @@ namespace MonoTests.System.IO.Compression
                        }
                        File.Delete ("empty.zip");
                }
+
+               class MyFakeStream : FileStream 
+               {
+                       public MyFakeStream (string path, FileMode mode) : base(path, mode) {}
+
+                       /// <summary>
+                       /// Simulate "CanSeek" is false, which is the case when you are retreiving data from web.
+                       /// </summary>
+                       public override bool CanSeek => false;
+               }
+
+               [Test]
+               public void ZipReadNonSeekableStream()
+               {
+                       var stream = new MyFakeStream("test.nupkg", FileMode.Open);
+                       using (var archive = new ZipArchive (stream, ZipArchiveMode.Read))
+                       {
+                       }
+               }
        }
 }
index 4f0c7bb70b9ecb9d68e9176b5ac97f79e969e00f..5df9434321ce2c8761255d6fad9ac38f977f8baf 100644 (file)
@@ -39,7 +39,7 @@ namespace System.IO.Compression
                internal readonly ZipArchiveMode mode;
                internal Encoding entryNameEncoding;
                internal bool disposed;
-               internal Dictionary<string, ZipArchiveEntry> entries; 
+               internal List<ZipArchiveEntry> entries; 
                internal SharpCompress.Archive.Zip.ZipArchive zipFile;
 
                public ZipArchive (Stream stream)
@@ -49,7 +49,7 @@ namespace System.IO.Compression
 
                        this.stream = stream;
                        mode = ZipArchiveMode.Read;
-                       CreateZip(stream, mode);
+                       CreateZip(mode);
                }
 
                public ZipArchive (Stream stream, ZipArchiveMode mode)
@@ -59,7 +59,7 @@ namespace System.IO.Compression
 
                        this.stream = stream;
                        this.mode = mode;
-                       CreateZip(stream, mode);
+                       CreateZip(mode);
                }
 
                public ZipArchive (Stream stream, ZipArchiveMode mode, bool leaveOpen)
@@ -70,7 +70,7 @@ namespace System.IO.Compression
                        this.stream = stream;
                        this.mode = mode;
                        leaveStreamOpen = leaveOpen;
-                       CreateZip(stream, mode);
+                       CreateZip(mode);
                }
 
                public ZipArchive (Stream stream, ZipArchiveMode mode, bool leaveOpen, Encoding entryNameEncoding)
@@ -82,10 +82,10 @@ namespace System.IO.Compression
                        this.mode = mode;
                        leaveStreamOpen = leaveOpen;
                        this.entryNameEncoding = entryNameEncoding;
-                       CreateZip(stream, mode);
+                       CreateZip(mode);
                }
 
-               private void CreateZip(Stream stream, ZipArchiveMode mode)
+               private void CreateZip(ZipArchiveMode mode)
                {
                        try {
                                if (mode != ZipArchiveMode.Read && mode != ZipArchiveMode.Create && mode != ZipArchiveMode.Update)
@@ -103,6 +103,18 @@ namespace System.IO.Compression
                                if (mode == ZipArchiveMode.Update && (!stream.CanRead || !stream.CanWrite || !stream.CanSeek))
                                        throw new ArgumentException("Stream must support reading, writing and seeking for Update archive mode");
 
+                               // If the stream is not seekable, then buffer it into memory (same behavior as .NET). 
+                               if (mode == ZipArchiveMode.Read && !stream.CanSeek)
+                               {
+                                       var memoryStream = new MemoryStream();
+                                       stream.CopyTo(memoryStream);
+
+                                       if (!leaveStreamOpen)
+                                               stream.Dispose();
+
+                                       this.stream = memoryStream;
+                               }
+
                                try {
                                        zipFile = mode != ZipArchiveMode.Create && stream.Length != 0
                                                ? SharpCompress.Archive.Zip.ZipArchive.Open(stream)
@@ -111,11 +123,11 @@ namespace System.IO.Compression
                                        throw new InvalidDataException("The contents of the stream are not in the zip archive format.", e);
                                }
 
-                               entries = new Dictionary<string, ZipArchiveEntry>();
+                               entries = new List<ZipArchiveEntry>();
                                if (Mode != ZipArchiveMode.Create) {
                                        foreach (var entry in zipFile.Entries) {
                                                var zipEntry = new ZipArchiveEntry(this, entry);
-                                               entries[entry.Key] = zipEntry;
+                                               entries.Add(zipEntry);
                                        }
                                }
                        }
@@ -140,7 +152,7 @@ namespace System.IO.Compression
                                if (entries == null)
                                        return new ReadOnlyCollection<ZipArchiveEntry>(new List<ZipArchiveEntry>());
 
-                               return new ReadOnlyCollection<ZipArchiveEntry>(entries.Values.ToList());
+                               return new ReadOnlyCollection<ZipArchiveEntry>(entries);
                        }
                }
 
@@ -188,7 +200,7 @@ namespace System.IO.Compression
 
                        var internalEntry = CreateEntryInternal(entryName);
                        var archiveEntry = new ZipArchiveEntry(this, internalEntry);
-                       entries[entryName] = archiveEntry;
+                       entries.Add(archiveEntry);
 
                        return archiveEntry;
                }
@@ -210,7 +222,7 @@ namespace System.IO.Compression
                        if (zipFile == null)
                                throw new InvalidDataException("The zip archive is corrupt, and its entries cannot be retrieved.");
 
-                       return entries.ContainsKey(entryName) ? entries[entryName] : null;
+                       return entries.FirstOrDefault(e => e.FullName == entryName);
                }
 
                private void Save()
@@ -225,6 +237,12 @@ namespace System.IO.Compression
                        }
                }
 
+               internal void RemoveEntryInternal(ZipArchiveEntry entry)
+               {
+                       zipFile.RemoveEntry(entry.entry);
+                       entries.Remove(entry);
+               }
+
                protected virtual void Dispose (bool disposing)
                {
                        if (disposed)
index 2b415eb5c8da2993e874371260e73d1cc4694858..0ea00c549def9016f0f17e144d805644641abab8 100644 (file)
@@ -54,7 +54,7 @@ namespace System.IO.Compression
 
                public override long Length {
                        get {
-                               return stream.Length;
+                               return stream.CanWrite ? stream.Length : entry.Length;
                        }
                }
 
@@ -95,14 +95,16 @@ namespace System.IO.Compression
 
                public override void Write (byte[] buffer, int offset, int count)
                {
-                       if (entry.Archive.Mode == ZipArchiveMode.Update && !entry.wasWritten)
+                       stream.Write(buffer, offset, count);
+               }
+
+               internal void EnsureWriteable()
+               {
+                       if (entry.Archive.Mode == ZipArchiveMode.Update && !stream.CanWrite)
                        {
                                // Replace the read-only stream with a writeable memory stream.
                                SetWriteable();
-                               entry.wasWritten = true;
                        }
-
-                       stream.Write(buffer, offset, count);
                }
 
                internal void SetWriteable()
@@ -114,15 +116,11 @@ namespace System.IO.Compression
                        var newStream = newEntry.OpenEntryStream();
 
                        var openStream = stream;
-                       var position = openStream.Position;
-
-                       entry.openStream = null;
-                       entry.Open();
-
                        openStream.CopyTo(newStream);
-                       newStream.Position = position;
                        openStream.Dispose();
 
+                       newStream.Position = 0;
+
                        archive.zipFile.RemoveEntry(internalEntry);
                        entry.entry = newEntry;
                        stream = newStream;
@@ -212,7 +210,7 @@ namespace System.IO.Compression
                                throw new IOException("The entry is already open for reading or writing.");
 
                        wasDeleted = true;
-                       Archive.zipFile.RemoveEntry(entry);
+                       Archive.RemoveEntryInternal(this);
                }
 
                public Stream Open()
@@ -231,6 +229,7 @@ namespace System.IO.Compression
 
                        var entryStream = entry.OpenEntryStream();
                        openStream = new ZipArchiveEntryStream(this, entryStream);
+                       openStream.EnsureWriteable();
 
                        return openStream;
                }
diff --git a/mcs/class/System.Net.Http.WinHttpHandler/Assembly/AssemblyInfo.cs b/mcs/class/System.Net.Http.WinHttpHandler/Assembly/AssemblyInfo.cs
new file mode 100644 (file)
index 0000000..d477aee
--- /dev/null
@@ -0,0 +1,62 @@
+//
+// AssemblyInfo.cs
+//
+// Author:
+//   Alexander Köplinger (alexander.koeplinger@xamarin.com)
+//
+// (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.Reflection;
+using System.Resources;
+using System.Security;
+using System.Security.Permissions;
+using System.Diagnostics;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about the assembly
+
+[assembly: AssemblyTitle ("System.Net.Http.WinHttpHandler.dll")]
+[assembly: AssemblyDescription ("System.Net.Http.WinHttpHandler.dll")]
+[assembly: AssemblyDefaultAlias ("System.Net.Http.WinHttpHandler.dll")]
+
+[assembly: AssemblyCompany (Consts.MonoCompany)]
+[assembly: AssemblyProduct (Consts.MonoProduct)]
+[assembly: AssemblyCopyright (Consts.MonoCopyright)]
+[assembly: AssemblyVersion (Consts.FxVersion)]
+[assembly: SatelliteContractVersion (Consts.FxVersion)]
+[assembly: AssemblyInformationalVersion (Consts.FxFileVersion)]
+[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
+
+[assembly: NeutralResourcesLanguage ("en-US")]
+[assembly: CLSCompliant (true)]
+[assembly: AssemblyDelaySign (true)]
+
+[assembly: AssemblyKeyFile("../msfinal.pub")]
+
+[assembly: SecurityCritical]
+
+[assembly: ComVisible (false)]
\ No newline at end of file
diff --git a/mcs/class/System.Net.Http.WinHttpHandler/Makefile b/mcs/class/System.Net.Http.WinHttpHandler/Makefile
new file mode 100644 (file)
index 0000000..55b07ff
--- /dev/null
@@ -0,0 +1,11 @@
+thisdir = class/System.Net.Http.WinHttpHandler
+SUBDIRS = 
+include ../../build/rules.make
+
+LIBRARY = System.Net.Http.WinHttpHandler.dll
+LIB_REFS = System System.Net.Http
+LIB_MCS_FLAGS =
+
+NO_TEST = yes
+
+include ../../build/library.make
diff --git a/mcs/class/System.Net.Http.WinHttpHandler/System.Net.Http.WinHttpHandler.dll.sources b/mcs/class/System.Net.Http.WinHttpHandler/System.Net.Http.WinHttpHandler.dll.sources
new file mode 100644 (file)
index 0000000..97feb39
--- /dev/null
@@ -0,0 +1,8 @@
+../../build/common/Consts.cs
+../../build/common/Locale.cs
+../../build/common/MonoTODOAttribute.cs
+Assembly/AssemblyInfo.cs
+
+System.Net.Http/CookieUsePolicy.cs
+System.Net.Http/WindowsProxyUsePolicy.cs
+System.Net.Http/WinHttpHandler.cs
diff --git a/mcs/class/System.Net.Http.WinHttpHandler/System.Net.Http/CookieUsePolicy.cs b/mcs/class/System.Net.Http.WinHttpHandler/System.Net.Http/CookieUsePolicy.cs
new file mode 100644 (file)
index 0000000..f27cb2c
--- /dev/null
@@ -0,0 +1,39 @@
+//
+// CookieUsePolicy.cs
+//
+// Author:
+//   Alexander Köplinger (alexander.koeplinger@xamarin.com)
+//
+// (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.
+//
+
+namespace System.Net.Http
+{
+       public enum CookieUsePolicy
+       {
+               IgnoreCookies = 0,
+               UseInternalCookieStoreOnly = 1,
+               UseSpecifiedCookieContainer = 2,
+       }
+}
\ No newline at end of file
diff --git a/mcs/class/System.Net.Http.WinHttpHandler/System.Net.Http/WinHttpHandler.cs b/mcs/class/System.Net.Http.WinHttpHandler/System.Net.Http/WinHttpHandler.cs
new file mode 100644 (file)
index 0000000..e2db5f6
--- /dev/null
@@ -0,0 +1,92 @@
+//
+// WinHttpHandler.cs
+//
+// Author:
+//   Alexander Köplinger (alexander.koeplinger@xamarin.com)
+//
+// (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.Generic;
+using System.Threading.Tasks;
+using System.Net.Security;
+using System.Security.Authentication;
+using System.Security.Cryptography.X509Certificates;
+
+namespace System.Net.Http
+{
+       public class WinHttpHandler : HttpMessageHandler
+       {
+               public WinHttpHandler() { throw new PlatformNotSupportedException (); }
+
+               public DecompressionMethods AutomaticDecompression { get { throw new PlatformNotSupportedException ();  } set { throw new PlatformNotSupportedException (); } }
+
+               public bool AutomaticRedirection { get { throw new PlatformNotSupportedException (); } set { throw new PlatformNotSupportedException (); } }
+
+               public bool CheckCertificateRevocationList { get { throw new PlatformNotSupportedException (); } set { throw new PlatformNotSupportedException (); } }
+
+               public ClientCertificateOption ClientCertificateOption { get { throw new PlatformNotSupportedException (); } set { throw new PlatformNotSupportedException (); } }
+
+               public X509Certificate2Collection ClientCertificates { get { throw new PlatformNotSupportedException (); } }
+
+               public CookieContainer CookieContainer { get { throw new PlatformNotSupportedException (); } set { throw new PlatformNotSupportedException (); } }
+
+               public CookieUsePolicy CookieUsePolicy { get { throw new PlatformNotSupportedException (); } set { throw new PlatformNotSupportedException (); } }
+
+               public ICredentials DefaultProxyCredentials { get { throw new PlatformNotSupportedException (); } set { throw new PlatformNotSupportedException (); } }
+
+               public int MaxAutomaticRedirections { get { throw new PlatformNotSupportedException (); } set { throw new PlatformNotSupportedException (); } }
+
+               public int MaxConnectionsPerServer { get { throw new PlatformNotSupportedException (); } set { throw new PlatformNotSupportedException (); } }
+
+               public int MaxResponseDrainSize { get { throw new PlatformNotSupportedException (); } set { throw new PlatformNotSupportedException (); } }
+
+               public int MaxResponseHeadersLength { get { throw new PlatformNotSupportedException (); } set { throw new PlatformNotSupportedException (); } }
+
+               public bool PreAuthenticate { get { throw new PlatformNotSupportedException (); } set { throw new PlatformNotSupportedException (); } }
+
+               public IDictionary<string, object> Properties { get { throw new PlatformNotSupportedException (); } }
+
+               public IWebProxy Proxy { get { throw new PlatformNotSupportedException (); } set { throw new PlatformNotSupportedException (); } }
+
+               public TimeSpan ReceiveDataTimeout { get { throw new PlatformNotSupportedException (); } set { throw new PlatformNotSupportedException (); } }
+
+               public TimeSpan ReceiveHeadersTimeout { get { throw new PlatformNotSupportedException (); } set { throw new PlatformNotSupportedException (); } }
+
+               public TimeSpan SendTimeout { get { throw new PlatformNotSupportedException (); } set { throw new PlatformNotSupportedException (); } }
+
+               public Func<HttpRequestMessage, X509Certificate2, X509Chain, SslPolicyErrors, bool> ServerCertificateValidationCallback { get { throw new PlatformNotSupportedException (); } set { throw new PlatformNotSupportedException (); } }
+
+               public ICredentials ServerCredentials { get { throw new PlatformNotSupportedException (); } set { throw new PlatformNotSupportedException (); } }
+
+               public SslProtocols SslProtocols { get { throw new PlatformNotSupportedException (); } set { throw new PlatformNotSupportedException (); } }
+
+               public WindowsProxyUsePolicy WindowsProxyUsePolicy { get { throw new PlatformNotSupportedException (); } set { throw new PlatformNotSupportedException (); } }
+
+               protected override void Dispose (bool disposing) { throw new PlatformNotSupportedException (); }
+
+               protected override Task<HttpResponseMessage> SendAsync (HttpRequestMessage request, Threading.CancellationToken cancellationToken) { throw new PlatformNotSupportedException (); }
+       }
+}
\ No newline at end of file
diff --git a/mcs/class/System.Net.Http.WinHttpHandler/System.Net.Http/WindowsProxyUsePolicy.cs b/mcs/class/System.Net.Http.WinHttpHandler/System.Net.Http/WindowsProxyUsePolicy.cs
new file mode 100644 (file)
index 0000000..48de6bb
--- /dev/null
@@ -0,0 +1,40 @@
+//
+// WindowsProxyUsePolicy.cs
+//
+// Author:
+//   Alexander Köplinger (alexander.koeplinger@xamarin.com)
+//
+// (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.
+//
+
+namespace System.Net.Http
+{
+       public enum WindowsProxyUsePolicy
+       {
+               DoNotUseProxy = 0,
+               UseCustomProxy = 3,
+               UseWinHttpProxy = 1,
+               UseWinInetProxy = 2,
+       }
+}
\ No newline at end of file
index aa678a036e6d2f8219e3d89a55695dba90dfdffa..f1af864e214943a61321e2cf20cf93ff4a215cc7 100644 (file)
@@ -321,6 +321,7 @@ namespace MonoTests.System.Net.Http
                }
 
                [Test]
+               [Category ("RequiresBSDSockets")]
                public void Proxy_Disabled ()
                {
                        var pp = WebRequest.DefaultWebProxy;
@@ -397,6 +398,7 @@ namespace MonoTests.System.Net.Http
                }
 
                [Test]
+               [Category ("RequiresBSDSockets")]
                public void Send_Complete_Default ()
                {
                        bool? failed = null;
@@ -441,6 +443,7 @@ namespace MonoTests.System.Net.Http
                }
 
                [Test]
+               [Category ("RequiresBSDSockets")]
                public void Send_Complete_Version_1_0 ()
                {
                        bool? failed = null;
@@ -488,6 +491,7 @@ namespace MonoTests.System.Net.Http
                }
 
                [Test]
+               [Category ("RequiresBSDSockets")]
                public void Send_Complete_ClientHandlerSettings ()
                {
                        bool? failed = null;
@@ -552,6 +556,7 @@ namespace MonoTests.System.Net.Http
                }
 
                [Test]
+               [Category ("RequiresBSDSockets")]
                public void Send_Complete_CustomHeaders ()
                {
                        bool? failed = null;
@@ -616,6 +621,7 @@ namespace MonoTests.System.Net.Http
                }
 
                [Test]
+               [Category ("RequiresBSDSockets")]
                public void Send_Complete_CustomHeaders_SpecialSeparators ()
                {
                        bool? failed = null;
@@ -650,6 +656,7 @@ namespace MonoTests.System.Net.Http
                }
 
                [Test]
+               [Category ("RequiresBSDSockets")]
                public void Send_Complete_CustomHeaders_Host ()
                {
                        bool? failed = null;
@@ -683,6 +690,7 @@ namespace MonoTests.System.Net.Http
                }
 
                [Test]
+               [Category ("RequiresBSDSockets")]
                public void Send_Transfer_Encoding_Chunked ()
                {
                        bool? failed = null;
@@ -712,6 +720,7 @@ namespace MonoTests.System.Net.Http
                }
 
                [Test]
+               [Category ("RequiresBSDSockets")]
                public void Send_Transfer_Encoding_Custom ()
                {
                        bool? failed = null;
@@ -740,6 +749,7 @@ namespace MonoTests.System.Net.Http
                }
 
                [Test]
+               [Category ("RequiresBSDSockets")]
                public void Send_Complete_Content ()
                {
                        var listener = CreateListener (l => {
@@ -767,6 +777,7 @@ namespace MonoTests.System.Net.Http
                }
 
                [Test]
+               [Category ("RequiresBSDSockets")]
                public void Send_Complete_Content_MaxResponseContentBufferSize ()
                {
                        var listener = CreateListener (l => {
@@ -789,6 +800,7 @@ namespace MonoTests.System.Net.Http
                }
 
                [Test]
+               [Category ("RequiresBSDSockets")]
                public void Send_Complete_Content_MaxResponseContentBufferSize_Error ()
                {
                        var listener = CreateListener (l => {
@@ -815,6 +827,7 @@ namespace MonoTests.System.Net.Http
                }
 
                [Test]
+               [Category ("RequiresBSDSockets")]
                public void Send_Complete_NoContent ()
                {
                        foreach (var method in new HttpMethod[] { HttpMethod.Post, HttpMethod.Put, HttpMethod.Delete }) {
@@ -847,6 +860,7 @@ namespace MonoTests.System.Net.Http
                }
 
                [Test]
+               [Category ("RequiresBSDSockets")]
                public void Send_Complete_Error ()
                {
                        var listener = CreateListener (l => {
@@ -867,6 +881,7 @@ namespace MonoTests.System.Net.Http
                }
 
                [Test]
+               [Category ("RequiresBSDSockets")]
                public void Send_Content_Get ()
                {
                        var listener = CreateListener (l => {
@@ -886,6 +901,7 @@ namespace MonoTests.System.Net.Http
                }
 
                [Test]
+               [Category ("RequiresBSDSockets")]
                public void Send_Content_BomEncoding ()
                {
                        var listener = CreateListener (l => {
@@ -910,6 +926,7 @@ namespace MonoTests.System.Net.Http
                }
 
                [Test]
+               [Category ("RequiresBSDSockets")]
                public void Send_Content_Put ()
                {
                        bool passed = false;
@@ -935,6 +952,7 @@ namespace MonoTests.System.Net.Http
                }
 
                [Test]
+               [Category ("RequiresBSDSockets")]
                public void Send_Content_Put_CustomStream ()
                {
                        bool passed = false;
@@ -1037,6 +1055,7 @@ namespace MonoTests.System.Net.Http
 
                [Test]
                [Category ("MobileNotWorking")] // Missing encoding
+               [Category ("RequiresBSDSockets")]
                public void GetString_Many ()
                {
                        Action<HttpListenerContext> context = (HttpListenerContext l) => {
@@ -1066,6 +1085,7 @@ namespace MonoTests.System.Net.Http
                }
 
                [Test]
+               [Category ("RequiresBSDSockets")]
                public void GetByteArray_ServerError ()
                {
                        var listener = CreateListener (l => {
@@ -1088,6 +1108,7 @@ namespace MonoTests.System.Net.Http
                }
 
                [Test]
+               [Category ("RequiresBSDSockets")]
                public void DisallowAutoRedirect ()
                {
                        var listener = CreateListener (l => {
@@ -1116,6 +1137,7 @@ namespace MonoTests.System.Net.Http
                }
 
                [Test]
+               [Category ("RequiresBSDSockets")]
                public void RequestUriAfterRedirect ()
                {
                        var listener = CreateListener (l => {
@@ -1156,6 +1178,7 @@ namespace MonoTests.System.Net.Http
                }
 
                [Test]
+               [Category ("RequiresBSDSockets")]
                /*
                 * Properties may only be modified before sending the first request.
                 */
diff --git a/mcs/class/System.Numerics.Vectors/Assembly/TypeForwarders.cs b/mcs/class/System.Numerics.Vectors/Assembly/TypeForwarders.cs
new file mode 100644 (file)
index 0000000..b2929d8
--- /dev/null
@@ -0,0 +1,36 @@
+//
+// TypeForwarders.cs
+//
+// Authors:
+//     Marek Safar  <marek.safar@gmail.com>
+//
+// Copyright (C) 2011 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.Numerics;
+using System.Runtime.CompilerServices;
+
+[assembly: TypeForwardedTo(typeof(Matrix3x2))]
+[assembly: TypeForwardedTo(typeof(Matrix4x4))]
+[assembly: TypeForwardedTo(typeof(Plane))]
+[assembly: TypeForwardedTo(typeof(Quaternion))]
+[assembly: TypeForwardedTo(typeof(Vector2))]
+[assembly: TypeForwardedTo(typeof(Vector3))]
+[assembly: TypeForwardedTo(typeof(Vector4))]
index f5ff0937ead8a08e5a225e4973a4b96f8ed94dc6..42fb194dbfb9e8b675f08bbeb0b63bfb9ce1d3d0 100644 (file)
@@ -3,8 +3,8 @@ SUBDIRS =
 include ../../build/rules.make
 
 LIBRARY = System.Numerics.Vectors.dll
-LIB_REFS = System
-LIB_MCS_FLAGS =
+LIB_REFS = System System.Numerics
+LIB_MCS_FLAGS = -unsafe
 
 EXTRA_DISTFILES =
 
diff --git a/mcs/class/System.Numerics.Vectors/SR.cs b/mcs/class/System.Numerics.Vectors/SR.cs
new file mode 100644 (file)
index 0000000..72e9cfb
--- /dev/null
@@ -0,0 +1,17 @@
+// generated from Strings.resx in corefx
+
+partial class SR
+{
+       public const string Arg_ArgumentOutOfRangeException="Index was out of bounds:";
+       public const string Arg_ElementsInSourceIsGreaterThanDestination="Number of elements in source vector is greater than the destination array";
+       public const string Arg_MultiDimArrayNotSupported="Only one-dimensional arrays are supported";
+       public const string Arg_NullArgumentNullRef="The method was called with a null array argument.";
+       public const string Arg_RegisterLengthOfRangeException="length must be less than";
+       public const string Arg_TypeNotSupported="Specified type is not supported";
+       public const string Reflection_MethodNotSupported="Vector<T>.Count cannot be called via reflection when intrinsics are enabled.";
+
+       public static string Format (string message, object data)
+       {
+               return string.Format (message, data);
+       }
+}
index 45b755ee19b43a81d67982f0855f0b4effa95340..01bdfc1724e2fd772bf1fd4b25f18ede8bbe7375 100644 (file)
@@ -1,3 +1,11 @@
 ../../build/common/Consts.cs
 ../../build/common/SR.cs
 Assembly/AssemblyInfo.cs
+Assembly/TypeForwarders.cs
+SR.cs
+System.Numerics/ConstantHelper.cs
+System.Numerics/HashCodeHelper.cs
+System.Numerics/JitIntrinsicAttribute.cs
+System.Numerics/Register.cs
+System.Numerics/Vector_Operations.cs
+System.Numerics/Vector.cs
diff --git a/mcs/class/System.Numerics.Vectors/System.Numerics/ConstantHelper.cs b/mcs/class/System.Numerics.Vectors/System.Numerics/ConstantHelper.cs
new file mode 100644 (file)
index 0000000..ea32ed3
--- /dev/null
@@ -0,0 +1,142 @@
+// 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.Runtime.CompilerServices;
+
+namespace System.Numerics
+{
+    internal class ConstantHelper
+    {
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static Byte GetByteWithAllBitsSet()
+        {
+            Byte value = 0;
+            unsafe
+            {
+                unchecked
+                {
+                    *((Byte*)&value) = (Byte)0xff;
+                }
+            }
+            return value;
+        }
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static SByte GetSByteWithAllBitsSet()
+        {
+            SByte value = 0;
+            unsafe
+            {
+                unchecked
+                {
+                    *((SByte*)&value) = (SByte)0xff;
+                }
+            }
+            return value;
+        }
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static UInt16 GetUInt16WithAllBitsSet()
+        {
+            UInt16 value = 0;
+            unsafe
+            {
+                unchecked
+                {
+                    *((UInt16*)&value) = (UInt16)0xffff;
+                }
+            }
+            return value;
+        }
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static Int16 GetInt16WithAllBitsSet()
+        {
+            Int16 value = 0;
+            unsafe
+            {
+                unchecked
+                {
+                    *((Int16*)&value) = (Int16)0xffff;
+                }
+            }
+            return value;
+        }
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static UInt32 GetUInt32WithAllBitsSet()
+        {
+            UInt32 value = 0;
+            unsafe
+            {
+                unchecked
+                {
+                    *((UInt32*)&value) = (UInt32)0xffffffff;
+                }
+            }
+            return value;
+        }
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static Int32 GetInt32WithAllBitsSet()
+        {
+            Int32 value = 0;
+            unsafe
+            {
+                unchecked
+                {
+                    *((Int32*)&value) = (Int32)0xffffffff;
+                }
+            }
+            return value;
+        }
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static UInt64 GetUInt64WithAllBitsSet()
+        {
+            UInt64 value = 0;
+            unsafe
+            {
+                unchecked
+                {
+                    *((UInt64*)&value) = (UInt64)0xffffffffffffffff;
+                }
+            }
+            return value;
+        }
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static Int64 GetInt64WithAllBitsSet()
+        {
+            Int64 value = 0;
+            unsafe
+            {
+                unchecked
+                {
+                    *((Int64*)&value) = (Int64)0xffffffffffffffff;
+                }
+            }
+            return value;
+        }
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static Single GetSingleWithAllBitsSet()
+        {
+            Single value = 0;
+            unsafe
+            {
+                unchecked
+                {
+                    *((Int32*)&value) = (Int32)0xffffffff;
+                }
+            }
+            return value;
+        }
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static Double GetDoubleWithAllBitsSet()
+        {
+            Double value = 0;
+            unsafe
+            {
+                unchecked
+                {
+                    *((Int64*)&value) = (Int64)0xffffffffffffffff;
+                }
+            }
+            return value;
+        }
+    }
+}
diff --git a/mcs/class/System.Numerics.Vectors/System.Numerics/HashCodeHelper.cs b/mcs/class/System.Numerics.Vectors/System.Numerics/HashCodeHelper.cs
new file mode 100644 (file)
index 0000000..1467e2f
--- /dev/null
@@ -0,0 +1,17 @@
+// 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.
+
+namespace System.Numerics
+{
+    internal static class HashCodeHelper
+    {
+        /// <summary>
+        /// Combines two hash codes, useful for combining hash codes of individual vector elements
+        /// </summary>
+        internal static int CombineHashCodes(int h1, int h2)
+        {
+            return (((h1 << 5) + h1) ^ h2);
+        }
+    }
+}
diff --git a/mcs/class/System.Numerics.Vectors/System.Numerics/JitIntrinsicAttribute.cs b/mcs/class/System.Numerics.Vectors/System.Numerics/JitIntrinsicAttribute.cs
new file mode 100644 (file)
index 0000000..7410412
--- /dev/null
@@ -0,0 +1,14 @@
+// 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.
+
+namespace System.Numerics
+{
+    /// <summary>
+    /// An attribute that can be attached to JIT Intrinsic methods/properties
+    /// </summary>
+    [AttributeUsage(AttributeTargets.Method | AttributeTargets.Constructor | AttributeTargets.Property)]
+    internal class JitIntrinsicAttribute : Attribute
+    {
+    }
+}
diff --git a/mcs/class/System.Numerics.Vectors/System.Numerics/Register.cs b/mcs/class/System.Numerics.Vectors/System.Numerics/Register.cs
new file mode 100644 (file)
index 0000000..a27e922
--- /dev/null
@@ -0,0 +1,172 @@
+// 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.Runtime.InteropServices;
+
+namespace System.Numerics
+{
+    /// <summary>
+    /// A structure describing the layout of an SSE2-sized register.
+    /// Contains overlapping fields representing the set of valid numeric types.
+    /// Allows the generic Vector'T struct to contain an explicit field layout.
+    /// </summary>
+    [StructLayout(LayoutKind.Explicit)]
+    internal struct Register
+    {
+        #region Internal Storage Fields
+        // Internal System.Byte Fields
+        [FieldOffset(0)]
+        internal Byte byte_0;
+        [FieldOffset(1)]
+        internal Byte byte_1;
+        [FieldOffset(2)]
+        internal Byte byte_2;
+        [FieldOffset(3)]
+        internal Byte byte_3;
+        [FieldOffset(4)]
+        internal Byte byte_4;
+        [FieldOffset(5)]
+        internal Byte byte_5;
+        [FieldOffset(6)]
+        internal Byte byte_6;
+        [FieldOffset(7)]
+        internal Byte byte_7;
+        [FieldOffset(8)]
+        internal Byte byte_8;
+        [FieldOffset(9)]
+        internal Byte byte_9;
+        [FieldOffset(10)]
+        internal Byte byte_10;
+        [FieldOffset(11)]
+        internal Byte byte_11;
+        [FieldOffset(12)]
+        internal Byte byte_12;
+        [FieldOffset(13)]
+        internal Byte byte_13;
+        [FieldOffset(14)]
+        internal Byte byte_14;
+        [FieldOffset(15)]
+        internal Byte byte_15;
+
+        // Internal System.SByte Fields
+        [FieldOffset(0)]
+        internal SByte sbyte_0;
+        [FieldOffset(1)]
+        internal SByte sbyte_1;
+        [FieldOffset(2)]
+        internal SByte sbyte_2;
+        [FieldOffset(3)]
+        internal SByte sbyte_3;
+        [FieldOffset(4)]
+        internal SByte sbyte_4;
+        [FieldOffset(5)]
+        internal SByte sbyte_5;
+        [FieldOffset(6)]
+        internal SByte sbyte_6;
+        [FieldOffset(7)]
+        internal SByte sbyte_7;
+        [FieldOffset(8)]
+        internal SByte sbyte_8;
+        [FieldOffset(9)]
+        internal SByte sbyte_9;
+        [FieldOffset(10)]
+        internal SByte sbyte_10;
+        [FieldOffset(11)]
+        internal SByte sbyte_11;
+        [FieldOffset(12)]
+        internal SByte sbyte_12;
+        [FieldOffset(13)]
+        internal SByte sbyte_13;
+        [FieldOffset(14)]
+        internal SByte sbyte_14;
+        [FieldOffset(15)]
+        internal SByte sbyte_15;
+
+        // Internal System.UInt16 Fields
+        [FieldOffset(0)]
+        internal UInt16 uint16_0;
+        [FieldOffset(2)]
+        internal UInt16 uint16_1;
+        [FieldOffset(4)]
+        internal UInt16 uint16_2;
+        [FieldOffset(6)]
+        internal UInt16 uint16_3;
+        [FieldOffset(8)]
+        internal UInt16 uint16_4;
+        [FieldOffset(10)]
+        internal UInt16 uint16_5;
+        [FieldOffset(12)]
+        internal UInt16 uint16_6;
+        [FieldOffset(14)]
+        internal UInt16 uint16_7;
+
+        // Internal System.Int16 Fields
+        [FieldOffset(0)]
+        internal Int16 int16_0;
+        [FieldOffset(2)]
+        internal Int16 int16_1;
+        [FieldOffset(4)]
+        internal Int16 int16_2;
+        [FieldOffset(6)]
+        internal Int16 int16_3;
+        [FieldOffset(8)]
+        internal Int16 int16_4;
+        [FieldOffset(10)]
+        internal Int16 int16_5;
+        [FieldOffset(12)]
+        internal Int16 int16_6;
+        [FieldOffset(14)]
+        internal Int16 int16_7;
+
+        // Internal System.UInt32 Fields
+        [FieldOffset(0)]
+        internal UInt32 uint32_0;
+        [FieldOffset(4)]
+        internal UInt32 uint32_1;
+        [FieldOffset(8)]
+        internal UInt32 uint32_2;
+        [FieldOffset(12)]
+        internal UInt32 uint32_3;
+
+        // Internal System.Int32 Fields
+        [FieldOffset(0)]
+        internal Int32 int32_0;
+        [FieldOffset(4)]
+        internal Int32 int32_1;
+        [FieldOffset(8)]
+        internal Int32 int32_2;
+        [FieldOffset(12)]
+        internal Int32 int32_3;
+
+        // Internal System.UInt64 Fields
+        [FieldOffset(0)]
+        internal UInt64 uint64_0;
+        [FieldOffset(8)]
+        internal UInt64 uint64_1;
+
+        // Internal System.Int64 Fields
+        [FieldOffset(0)]
+        internal Int64 int64_0;
+        [FieldOffset(8)]
+        internal Int64 int64_1;
+
+        // Internal System.Single Fields
+        [FieldOffset(0)]
+        internal Single single_0;
+        [FieldOffset(4)]
+        internal Single single_1;
+        [FieldOffset(8)]
+        internal Single single_2;
+        [FieldOffset(12)]
+        internal Single single_3;
+
+        // Internal System.Double Fields
+        [FieldOffset(0)]
+        internal Double double_0;
+        [FieldOffset(8)]
+        internal Double double_1;
+
+        #endregion Internal Storage Fields
+    }
+}
diff --git a/mcs/class/System.Numerics.Vectors/System.Numerics/Vector.cs b/mcs/class/System.Numerics.Vectors/System.Numerics/Vector.cs
new file mode 100644 (file)
index 0000000..13785ed
--- /dev/null
@@ -0,0 +1,5002 @@
+// 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.Diagnostics.Contracts;
+using System.Globalization;
+using System.Runtime.CompilerServices;
+using System.Text;
+
+namespace System.Numerics
+{
+    /* Note: The following patterns are used throughout the code here and are described here
+    *
+    * PATTERN:
+    *    if (typeof(T) == typeof(Int32)) { ... }
+    *    else if (typeof(T) == typeof(Single)) { ... }
+    * EXPLANATION:
+    *    At runtime, each instantiation of Vector<T> will be type-specific, and each of these typeof blocks will be eliminated,
+    *    as typeof(T) is a (JIT) compile-time constant for each instantiation. This design was chosen to eliminate any overhead from
+    *    delegates and other patterns.
+    *
+    * PATTERN:
+    *    if (Vector.IsHardwareAccelerated) { ... }
+    *    else { ... }
+    * EXPLANATION
+    *    This pattern solves two problems:
+    *        1. Allows us to unroll loops when we know the size (when no hardware acceleration is present)
+    *        2. Allows reflection to work:
+    *            - If a method is called via reflection, it will not be "intrinsified", which would cause issues if we did
+    *              not provide an implementation for that case (i.e. if it only included a case which assumed 16-byte registers)
+    *    (NOTE: It is assumed that Vector.IsHardwareAccelerated will be a compile-time constant, eliminating these checks
+    *        from the JIT'd code.)
+    *
+    * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+    /// <summary>
+    /// A structure that represents a single Vector. The count of this Vector is fixed but CPU register dependent.
+    /// This struct only supports numerical types. This type is intended to be used as a building block for vectorizing
+    /// large algorithms. This type is immutable, individual elements cannot be modified.
+    /// </summary>
+    public struct Vector<T> : IEquatable<Vector<T>>, IFormattable where T : struct
+    {
+        #region Fields
+        private Register register;
+        #endregion Fields
+
+        #region Static Members
+        /// <summary>
+        /// Returns the number of elements stored in the vector. This value is hardware dependent.
+        /// </summary>
+        [JitIntrinsic]
+        public static int Count
+        {
+            get
+            {
+                return s_count;
+            }
+        }
+        private static readonly int s_count = InitializeCount();
+
+        /// <summary>
+        /// Returns a vector containing all zeroes.
+        /// </summary>
+        [JitIntrinsic]
+        public static Vector<T> Zero { get { return zero; } }
+        private static readonly Vector<T> zero = new Vector<T>(GetZeroValue());
+
+        /// <summary>
+        /// Returns a vector containing all ones.
+        /// </summary>
+        [JitIntrinsic]
+        public static Vector<T> One { get { return one; } }
+        private static readonly Vector<T> one = new Vector<T>(GetOneValue());
+
+        internal static Vector<T> AllOnes { get { return allOnes; } }
+        private static readonly Vector<T> allOnes = new Vector<T>(GetAllBitsSetValue());
+        #endregion Static Members
+
+        #region Static Initialization
+        private struct VectorSizeHelper
+        {
+            internal Vector<T> _placeholder;
+            internal byte _byte;
+        }
+
+               // Calculates the size of this struct in bytes, by computing the offset of a field in a structure
+        private static unsafe int InitializeCount()
+        {
+            VectorSizeHelper vsh;
+            byte* vectorBase = &vsh._placeholder.register.byte_0;
+            byte* byteBase = &vsh._byte;
+            int vectorSizeInBytes = (int)(byteBase - vectorBase);
+
+            int typeSizeInBytes = -1;
+            if (typeof(T) == typeof(Byte))
+            {
+                typeSizeInBytes = sizeof(Byte);
+            }
+            else if (typeof(T) == typeof(SByte))
+            {
+                typeSizeInBytes = sizeof(SByte);
+            }
+            else if (typeof(T) == typeof(UInt16))
+            {
+                typeSizeInBytes = sizeof(UInt16);
+            }
+            else if (typeof(T) == typeof(Int16))
+            {
+                typeSizeInBytes = sizeof(Int16);
+            }
+            else if (typeof(T) == typeof(UInt32))
+            {
+                typeSizeInBytes = sizeof(UInt32);
+            }
+            else if (typeof(T) == typeof(Int32))
+            {
+                typeSizeInBytes = sizeof(Int32);
+            }
+            else if (typeof(T) == typeof(UInt64))
+            {
+                typeSizeInBytes = sizeof(UInt64);
+            }
+            else if (typeof(T) == typeof(Int64))
+            {
+                typeSizeInBytes = sizeof(Int64);
+            }
+            else if (typeof(T) == typeof(Single))
+            {
+                typeSizeInBytes = sizeof(Single);
+            }
+            else if (typeof(T) == typeof(Double))
+            {
+                typeSizeInBytes = sizeof(Double);
+            }
+            else
+            {
+                throw new NotSupportedException(SR.Arg_TypeNotSupported);
+            }
+
+            return vectorSizeInBytes / typeSizeInBytes;
+        }
+        #endregion Static Initialization
+
+        #region Constructors
+        /// <summary>
+        /// Constructs a vector whose components are all <code>value</code>
+        /// </summary>
+        [JitIntrinsic]
+        public unsafe Vector(T value)
+            : this()
+        {
+            if (Vector.IsHardwareAccelerated)
+            {
+                if (typeof(T) == typeof(Byte))
+                {
+                    fixed (Byte* basePtr = &this.register.byte_0)
+                    {
+                        for (int g = 0; g < Count; g++)
+                        {
+                            *(basePtr + g) = (Byte)(object)value;
+                        }
+                    }
+                }
+                else if (typeof(T) == typeof(SByte))
+                {
+                    fixed (SByte* basePtr = &this.register.sbyte_0)
+                    {
+                        for (int g = 0; g < Count; g++)
+                        {
+                            *(basePtr + g) = (SByte)(object)value;
+                        }
+                    }
+                }
+                else if (typeof(T) == typeof(UInt16))
+                {
+                    fixed (UInt16* basePtr = &this.register.uint16_0)
+                    {
+                        for (int g = 0; g < Count; g++)
+                        {
+                            *(basePtr + g) = (UInt16)(object)value;
+                        }
+                    }
+                }
+                else if (typeof(T) == typeof(Int16))
+                {
+                    fixed (Int16* basePtr = &this.register.int16_0)
+                    {
+                        for (int g = 0; g < Count; g++)
+                        {
+                            *(basePtr + g) = (Int16)(object)value;
+                        }
+                    }
+                }
+                else if (typeof(T) == typeof(UInt32))
+                {
+                    fixed (UInt32* basePtr = &this.register.uint32_0)
+                    {
+                        for (int g = 0; g < Count; g++)
+                        {
+                            *(basePtr + g) = (UInt32)(object)value;
+                        }
+                    }
+                }
+                else if (typeof(T) == typeof(Int32))
+                {
+                    fixed (Int32* basePtr = &this.register.int32_0)
+                    {
+                        for (int g = 0; g < Count; g++)
+                        {
+                            *(basePtr + g) = (Int32)(object)value;
+                        }
+                    }
+                }
+                else if (typeof(T) == typeof(UInt64))
+                {
+                    fixed (UInt64* basePtr = &this.register.uint64_0)
+                    {
+                        for (int g = 0; g < Count; g++)
+                        {
+                            *(basePtr + g) = (UInt64)(object)value;
+                        }
+                    }
+                }
+                else if (typeof(T) == typeof(Int64))
+                {
+                    fixed (Int64* basePtr = &this.register.int64_0)
+                    {
+                        for (int g = 0; g < Count; g++)
+                        {
+                            *(basePtr + g) = (Int64)(object)value;
+                        }
+                    }
+                }
+                else if (typeof(T) == typeof(Single))
+                {
+                    fixed (Single* basePtr = &this.register.single_0)
+                    {
+                        for (int g = 0; g < Count; g++)
+                        {
+                            *(basePtr + g) = (Single)(object)value;
+                        }
+                    }
+                }
+                else if (typeof(T) == typeof(Double))
+                {
+                    fixed (Double* basePtr = &this.register.double_0)
+                    {
+                        for (int g = 0; g < Count; g++)
+                        {
+                            *(basePtr + g) = (Double)(object)value;
+                        }
+                    }
+                }
+            }
+            else
+            {
+                if (typeof(T) == typeof(Byte))
+                {
+                    register.byte_0 = (Byte)(object)value;
+                    register.byte_1 = (Byte)(object)value;
+                    register.byte_2 = (Byte)(object)value;
+                    register.byte_3 = (Byte)(object)value;
+                    register.byte_4 = (Byte)(object)value;
+                    register.byte_5 = (Byte)(object)value;
+                    register.byte_6 = (Byte)(object)value;
+                    register.byte_7 = (Byte)(object)value;
+                    register.byte_8 = (Byte)(object)value;
+                    register.byte_9 = (Byte)(object)value;
+                    register.byte_10 = (Byte)(object)value;
+                    register.byte_11 = (Byte)(object)value;
+                    register.byte_12 = (Byte)(object)value;
+                    register.byte_13 = (Byte)(object)value;
+                    register.byte_14 = (Byte)(object)value;
+                    register.byte_15 = (Byte)(object)value;
+                }
+                else if (typeof(T) == typeof(SByte))
+                {
+                    register.sbyte_0 = (SByte)(object)value;
+                    register.sbyte_1 = (SByte)(object)value;
+                    register.sbyte_2 = (SByte)(object)value;
+                    register.sbyte_3 = (SByte)(object)value;
+                    register.sbyte_4 = (SByte)(object)value;
+                    register.sbyte_5 = (SByte)(object)value;
+                    register.sbyte_6 = (SByte)(object)value;
+                    register.sbyte_7 = (SByte)(object)value;
+                    register.sbyte_8 = (SByte)(object)value;
+                    register.sbyte_9 = (SByte)(object)value;
+                    register.sbyte_10 = (SByte)(object)value;
+                    register.sbyte_11 = (SByte)(object)value;
+                    register.sbyte_12 = (SByte)(object)value;
+                    register.sbyte_13 = (SByte)(object)value;
+                    register.sbyte_14 = (SByte)(object)value;
+                    register.sbyte_15 = (SByte)(object)value;
+                }
+                else if (typeof(T) == typeof(UInt16))
+                {
+                    register.uint16_0 = (UInt16)(object)value;
+                    register.uint16_1 = (UInt16)(object)value;
+                    register.uint16_2 = (UInt16)(object)value;
+                    register.uint16_3 = (UInt16)(object)value;
+                    register.uint16_4 = (UInt16)(object)value;
+                    register.uint16_5 = (UInt16)(object)value;
+                    register.uint16_6 = (UInt16)(object)value;
+                    register.uint16_7 = (UInt16)(object)value;
+                }
+                else if (typeof(T) == typeof(Int16))
+                {
+                    register.int16_0 = (Int16)(object)value;
+                    register.int16_1 = (Int16)(object)value;
+                    register.int16_2 = (Int16)(object)value;
+                    register.int16_3 = (Int16)(object)value;
+                    register.int16_4 = (Int16)(object)value;
+                    register.int16_5 = (Int16)(object)value;
+                    register.int16_6 = (Int16)(object)value;
+                    register.int16_7 = (Int16)(object)value;
+                }
+                else if (typeof(T) == typeof(UInt32))
+                {
+                    register.uint32_0 = (UInt32)(object)value;
+                    register.uint32_1 = (UInt32)(object)value;
+                    register.uint32_2 = (UInt32)(object)value;
+                    register.uint32_3 = (UInt32)(object)value;
+                }
+                else if (typeof(T) == typeof(Int32))
+                {
+                    register.int32_0 = (Int32)(object)value;
+                    register.int32_1 = (Int32)(object)value;
+                    register.int32_2 = (Int32)(object)value;
+                    register.int32_3 = (Int32)(object)value;
+                }
+                else if (typeof(T) == typeof(UInt64))
+                {
+                    register.uint64_0 = (UInt64)(object)value;
+                    register.uint64_1 = (UInt64)(object)value;
+                }
+                else if (typeof(T) == typeof(Int64))
+                {
+                    register.int64_0 = (Int64)(object)value;
+                    register.int64_1 = (Int64)(object)value;
+                }
+                else if (typeof(T) == typeof(Single))
+                {
+                    register.single_0 = (Single)(object)value;
+                    register.single_1 = (Single)(object)value;
+                    register.single_2 = (Single)(object)value;
+                    register.single_3 = (Single)(object)value;
+                }
+                else if (typeof(T) == typeof(Double))
+                {
+                    register.double_0 = (Double)(object)value;
+                    register.double_1 = (Double)(object)value;
+                }
+            }
+        }
+
+        /// <summary>
+        /// Constructs a vector from the given array. The size of the given array must be at least Vector'T.Count.
+        /// </summary>
+        [JitIntrinsic]
+        public unsafe Vector(T[] values) : this(values, 0) { }
+
+        /// <summary>
+        /// Constructs a vector from the given array, starting from the given index.
+        /// The array must contain at least Vector'T.Count from the given index.
+        /// </summary>
+        public unsafe Vector(T[] values, int index)
+            : this()
+        {
+            if (values == null)
+            {
+                // Match the JIT's exception type here. For perf, a NullReference is thrown instead of an ArgumentNull.
+                throw new NullReferenceException(SR.Arg_NullArgumentNullRef);
+            }
+            if (index < 0 || (values.Length - index) < Count)
+            {
+                throw new IndexOutOfRangeException();
+            }
+
+            if (Vector.IsHardwareAccelerated)
+            {
+                if (typeof(T) == typeof(Byte))
+                {
+                    fixed (Byte* basePtr = &this.register.byte_0)
+                    {
+                        for (int g = 0; g < Count; g++)
+                        {
+                            *(basePtr + g) = (Byte)(object)values[g + index];
+                        }
+                    }
+                }
+                else if (typeof(T) == typeof(SByte))
+                {
+                    fixed (SByte* basePtr = &this.register.sbyte_0)
+                    {
+                        for (int g = 0; g < Count; g++)
+                        {
+                            *(basePtr + g) = (SByte)(object)values[g + index];
+                        }
+                    }
+                }
+                else if (typeof(T) == typeof(UInt16))
+                {
+                    fixed (UInt16* basePtr = &this.register.uint16_0)
+                    {
+                        for (int g = 0; g < Count; g++)
+                        {
+                            *(basePtr + g) = (UInt16)(object)values[g + index];
+                        }
+                    }
+                }
+                else if (typeof(T) == typeof(Int16))
+                {
+                    fixed (Int16* basePtr = &this.register.int16_0)
+                    {
+                        for (int g = 0; g < Count; g++)
+                        {
+                            *(basePtr + g) = (Int16)(object)values[g + index];
+                        }
+                    }
+                }
+                else if (typeof(T) == typeof(UInt32))
+                {
+                    fixed (UInt32* basePtr = &this.register.uint32_0)
+                    {
+                        for (int g = 0; g < Count; g++)
+                        {
+                            *(basePtr + g) = (UInt32)(object)values[g + index];
+                        }
+                    }
+                }
+                else if (typeof(T) == typeof(Int32))
+                {
+                    fixed (Int32* basePtr = &this.register.int32_0)
+                    {
+                        for (int g = 0; g < Count; g++)
+                        {
+                            *(basePtr + g) = (Int32)(object)values[g + index];
+                        }
+                    }
+                }
+                else if (typeof(T) == typeof(UInt64))
+                {
+                    fixed (UInt64* basePtr = &this.register.uint64_0)
+                    {
+                        for (int g = 0; g < Count; g++)
+                        {
+                            *(basePtr + g) = (UInt64)(object)values[g + index];
+                        }
+                    }
+                }
+                else if (typeof(T) == typeof(Int64))
+                {
+                    fixed (Int64* basePtr = &this.register.int64_0)
+                    {
+                        for (int g = 0; g < Count; g++)
+                        {
+                            *(basePtr + g) = (Int64)(object)values[g + index];
+                        }
+                    }
+                }
+                else if (typeof(T) == typeof(Single))
+                {
+                    fixed (Single* basePtr = &this.register.single_0)
+                    {
+                        for (int g = 0; g < Count; g++)
+                        {
+                            *(basePtr + g) = (Single)(object)values[g + index];
+                        }
+                    }
+                }
+                else if (typeof(T) == typeof(Double))
+                {
+                    fixed (Double* basePtr = &this.register.double_0)
+                    {
+                        for (int g = 0; g < Count; g++)
+                        {
+                            *(basePtr + g) = (Double)(object)values[g + index];
+                        }
+                    }
+                }
+            }
+            else
+            {
+                if (typeof(T) == typeof(Byte))
+                {
+                    fixed (Byte* basePtr = &this.register.byte_0)
+                    {
+                        *(basePtr + 0) = (Byte)(object)values[0 + index];
+                        *(basePtr + 1) = (Byte)(object)values[1 + index];
+                        *(basePtr + 2) = (Byte)(object)values[2 + index];
+                        *(basePtr + 3) = (Byte)(object)values[3 + index];
+                        *(basePtr + 4) = (Byte)(object)values[4 + index];
+                        *(basePtr + 5) = (Byte)(object)values[5 + index];
+                        *(basePtr + 6) = (Byte)(object)values[6 + index];
+                        *(basePtr + 7) = (Byte)(object)values[7 + index];
+                        *(basePtr + 8) = (Byte)(object)values[8 + index];
+                        *(basePtr + 9) = (Byte)(object)values[9 + index];
+                        *(basePtr + 10) = (Byte)(object)values[10 + index];
+                        *(basePtr + 11) = (Byte)(object)values[11 + index];
+                        *(basePtr + 12) = (Byte)(object)values[12 + index];
+                        *(basePtr + 13) = (Byte)(object)values[13 + index];
+                        *(basePtr + 14) = (Byte)(object)values[14 + index];
+                        *(basePtr + 15) = (Byte)(object)values[15 + index];
+                    }
+                }
+                else if (typeof(T) == typeof(SByte))
+                {
+                    fixed (SByte* basePtr = &this.register.sbyte_0)
+                    {
+                        *(basePtr + 0) = (SByte)(object)values[0 + index];
+                        *(basePtr + 1) = (SByte)(object)values[1 + index];
+                        *(basePtr + 2) = (SByte)(object)values[2 + index];
+                        *(basePtr + 3) = (SByte)(object)values[3 + index];
+                        *(basePtr + 4) = (SByte)(object)values[4 + index];
+                        *(basePtr + 5) = (SByte)(object)values[5 + index];
+                        *(basePtr + 6) = (SByte)(object)values[6 + index];
+                        *(basePtr + 7) = (SByte)(object)values[7 + index];
+                        *(basePtr + 8) = (SByte)(object)values[8 + index];
+                        *(basePtr + 9) = (SByte)(object)values[9 + index];
+                        *(basePtr + 10) = (SByte)(object)values[10 + index];
+                        *(basePtr + 11) = (SByte)(object)values[11 + index];
+                        *(basePtr + 12) = (SByte)(object)values[12 + index];
+                        *(basePtr + 13) = (SByte)(object)values[13 + index];
+                        *(basePtr + 14) = (SByte)(object)values[14 + index];
+                        *(basePtr + 15) = (SByte)(object)values[15 + index];
+                    }
+                }
+                else if (typeof(T) == typeof(UInt16))
+                {
+                    fixed (UInt16* basePtr = &this.register.uint16_0)
+                    {
+                        *(basePtr + 0) = (UInt16)(object)values[0 + index];
+                        *(basePtr + 1) = (UInt16)(object)values[1 + index];
+                        *(basePtr + 2) = (UInt16)(object)values[2 + index];
+                        *(basePtr + 3) = (UInt16)(object)values[3 + index];
+                        *(basePtr + 4) = (UInt16)(object)values[4 + index];
+                        *(basePtr + 5) = (UInt16)(object)values[5 + index];
+                        *(basePtr + 6) = (UInt16)(object)values[6 + index];
+                        *(basePtr + 7) = (UInt16)(object)values[7 + index];
+                    }
+                }
+                else if (typeof(T) == typeof(Int16))
+                {
+                    fixed (Int16* basePtr = &this.register.int16_0)
+                    {
+                        *(basePtr + 0) = (Int16)(object)values[0 + index];
+                        *(basePtr + 1) = (Int16)(object)values[1 + index];
+                        *(basePtr + 2) = (Int16)(object)values[2 + index];
+                        *(basePtr + 3) = (Int16)(object)values[3 + index];
+                        *(basePtr + 4) = (Int16)(object)values[4 + index];
+                        *(basePtr + 5) = (Int16)(object)values[5 + index];
+                        *(basePtr + 6) = (Int16)(object)values[6 + index];
+                        *(basePtr + 7) = (Int16)(object)values[7 + index];
+                    }
+                }
+                else if (typeof(T) == typeof(UInt32))
+                {
+                    fixed (UInt32* basePtr = &this.register.uint32_0)
+                    {
+                        *(basePtr + 0) = (UInt32)(object)values[0 + index];
+                        *(basePtr + 1) = (UInt32)(object)values[1 + index];
+                        *(basePtr + 2) = (UInt32)(object)values[2 + index];
+                        *(basePtr + 3) = (UInt32)(object)values[3 + index];
+                    }
+                }
+                else if (typeof(T) == typeof(Int32))
+                {
+                    fixed (Int32* basePtr = &this.register.int32_0)
+                    {
+                        *(basePtr + 0) = (Int32)(object)values[0 + index];
+                        *(basePtr + 1) = (Int32)(object)values[1 + index];
+                        *(basePtr + 2) = (Int32)(object)values[2 + index];
+                        *(basePtr + 3) = (Int32)(object)values[3 + index];
+                    }
+                }
+                else if (typeof(T) == typeof(UInt64))
+                {
+                    fixed (UInt64* basePtr = &this.register.uint64_0)
+                    {
+                        *(basePtr + 0) = (UInt64)(object)values[0 + index];
+                        *(basePtr + 1) = (UInt64)(object)values[1 + index];
+                    }
+                }
+                else if (typeof(T) == typeof(Int64))
+                {
+                    fixed (Int64* basePtr = &this.register.int64_0)
+                    {
+                        *(basePtr + 0) = (Int64)(object)values[0 + index];
+                        *(basePtr + 1) = (Int64)(object)values[1 + index];
+                    }
+                }
+                else if (typeof(T) == typeof(Single))
+                {
+                    fixed (Single* basePtr = &this.register.single_0)
+                    {
+                        *(basePtr + 0) = (Single)(object)values[0 + index];
+                        *(basePtr + 1) = (Single)(object)values[1 + index];
+                        *(basePtr + 2) = (Single)(object)values[2 + index];
+                        *(basePtr + 3) = (Single)(object)values[3 + index];
+                    }
+                }
+                else if (typeof(T) == typeof(Double))
+                {
+                    fixed (Double* basePtr = &this.register.double_0)
+                    {
+                        *(basePtr + 0) = (Double)(object)values[0 + index];
+                        *(basePtr + 1) = (Double)(object)values[1 + index];
+                    }
+                }
+            }
+        }
+
+#pragma warning disable 3001 // void* is not a CLS-Compliant argument type
+        private unsafe Vector(void* dataPointer) : this(dataPointer, 0) { }
+#pragma warning restore 3001 // void* is not a CLS-Compliant argument type
+
+#pragma warning disable 3001 // void* is not a CLS-Compliant argument type
+        // Implemented with offset if this API ever becomes public; an offset of 0 is used internally.
+        private unsafe Vector(void* dataPointer, int offset)
+            : this()
+        {
+            if (typeof(T) == typeof(Byte))
+            {
+                Byte* castedPtr = (Byte*)dataPointer;
+                castedPtr += offset;
+                fixed (Byte* registerBase = &this.register.byte_0)
+                {
+                    for (int g = 0; g < Count; g++)
+                    {
+                        registerBase[g] = castedPtr[g];
+                    }
+                }
+            }
+            else if (typeof(T) == typeof(SByte))
+            {
+                SByte* castedPtr = (SByte*)dataPointer;
+                castedPtr += offset;
+                fixed (SByte* registerBase = &this.register.sbyte_0)
+                {
+                    for (int g = 0; g < Count; g++)
+                    {
+                        registerBase[g] = castedPtr[g];
+                    }
+                }
+            }
+            else if (typeof(T) == typeof(UInt16))
+            {
+                UInt16* castedPtr = (UInt16*)dataPointer;
+                castedPtr += offset;
+                fixed (UInt16* registerBase = &this.register.uint16_0)
+                {
+                    for (int g = 0; g < Count; g++)
+                    {
+                        registerBase[g] = castedPtr[g];
+                    }
+                }
+            }
+            else if (typeof(T) == typeof(Int16))
+            {
+                Int16* castedPtr = (Int16*)dataPointer;
+                castedPtr += offset;
+                fixed (Int16* registerBase = &this.register.int16_0)
+                {
+                    for (int g = 0; g < Count; g++)
+                    {
+                        registerBase[g] = castedPtr[g];
+                    }
+                }
+            }
+            else if (typeof(T) == typeof(UInt32))
+            {
+                UInt32* castedPtr = (UInt32*)dataPointer;
+                castedPtr += offset;
+                fixed (UInt32* registerBase = &this.register.uint32_0)
+                {
+                    for (int g = 0; g < Count; g++)
+                    {
+                        registerBase[g] = castedPtr[g];
+                    }
+                }
+            }
+            else if (typeof(T) == typeof(Int32))
+            {
+                Int32* castedPtr = (Int32*)dataPointer;
+                castedPtr += offset;
+                fixed (Int32* registerBase = &this.register.int32_0)
+                {
+                    for (int g = 0; g < Count; g++)
+                    {
+                        registerBase[g] = castedPtr[g];
+                    }
+                }
+            }
+            else if (typeof(T) == typeof(UInt64))
+            {
+                UInt64* castedPtr = (UInt64*)dataPointer;
+                castedPtr += offset;
+                fixed (UInt64* registerBase = &this.register.uint64_0)
+                {
+                    for (int g = 0; g < Count; g++)
+                    {
+                        registerBase[g] = castedPtr[g];
+                    }
+                }
+            }
+            else if (typeof(T) == typeof(Int64))
+            {
+                Int64* castedPtr = (Int64*)dataPointer;
+                castedPtr += offset;
+                fixed (Int64* registerBase = &this.register.int64_0)
+                {
+                    for (int g = 0; g < Count; g++)
+                    {
+                        registerBase[g] = castedPtr[g];
+                    }
+                }
+            }
+            else if (typeof(T) == typeof(Single))
+            {
+                Single* castedPtr = (Single*)dataPointer;
+                castedPtr += offset;
+                fixed (Single* registerBase = &this.register.single_0)
+                {
+                    for (int g = 0; g < Count; g++)
+                    {
+                        registerBase[g] = castedPtr[g];
+                    }
+                }
+            }
+            else if (typeof(T) == typeof(Double))
+            {
+                Double* castedPtr = (Double*)dataPointer;
+                castedPtr += offset;
+                fixed (Double* registerBase = &this.register.double_0)
+                {
+                    for (int g = 0; g < Count; g++)
+                    {
+                        registerBase[g] = castedPtr[g];
+                    }
+                }
+            }
+            else
+            {
+                throw new NotSupportedException(SR.Arg_TypeNotSupported);
+            }
+        }
+#pragma warning restore 3001 // void* is not a CLS-Compliant argument type
+
+        private Vector(ref Register existingRegister)
+        {
+            this.register = existingRegister;
+        }
+        #endregion Constructors
+
+        #region Public Instance Methods
+        /// <summary>
+        /// Copies the vector to the given destination array. The destination array must be at least size Vector'T.Count.
+        /// </summary>
+        /// <param name="destination">The destination array which the values are copied into</param>
+        /// <exception cref="ArgumentNullException">If the destination array is null</exception>
+        /// <exception cref="ArgumentException">If number of elements in source vector is greater than those available in destination array</exception>
+        [JitIntrinsic]
+        public unsafe void CopyTo(T[] destination)
+        {
+            CopyTo(destination, 0);
+        }
+
+        /// <summary>
+        /// Copies the vector to the given destination array. The destination array must be at least size Vector'T.Count.
+        /// </summary>
+        /// <param name="destination">The destination array which the values are copied into</param>
+        /// <param name="startIndex">The index to start copying to</param>
+        /// <exception cref="ArgumentNullException">If the destination array is null</exception>
+        /// <exception cref="ArgumentOutOfRangeException">If index is greater than end of the array or index is less than zero</exception>
+        /// <exception cref="ArgumentException">If number of elements in source vector is greater than those available in destination array</exception>
+        [JitIntrinsic]
+        public unsafe void CopyTo(T[] destination, int startIndex)
+        {
+            if (destination == null)
+            {
+                // Match the JIT's exception type here. For perf, a NullReference is thrown instead of an ArgumentNull.
+                throw new NullReferenceException(SR.Arg_NullArgumentNullRef);
+            }
+            if (startIndex < 0 || startIndex >= destination.Length)
+            {
+                throw new ArgumentOutOfRangeException(nameof(startIndex), SR.Format(SR.Arg_ArgumentOutOfRangeException, startIndex));
+            }
+            if ((destination.Length - startIndex) < Count)
+            {
+                throw new ArgumentException(SR.Format(SR.Arg_ElementsInSourceIsGreaterThanDestination, startIndex));
+            }
+
+            if (Vector.IsHardwareAccelerated)
+            {
+                if (typeof(T) == typeof(Byte))
+                {
+                    Byte[] byteArray = (Byte[])(object)destination;
+                    fixed (Byte* destinationBase = byteArray)
+                    {
+                        for (int g = 0; g < Count; g++)
+                        {
+                            destinationBase[startIndex + g] = (Byte)(object)this[g];
+                        }
+                    }
+                }
+                else if (typeof(T) == typeof(SByte))
+                {
+                    SByte[] sbyteArray = (SByte[])(object)destination;
+                    fixed (SByte* destinationBase = sbyteArray)
+                    {
+                        for (int g = 0; g < Count; g++)
+                        {
+                            destinationBase[startIndex + g] = (SByte)(object)this[g];
+                        }
+                    }
+                }
+                else if (typeof(T) == typeof(UInt16))
+                {
+                    UInt16[] uint16Array = (UInt16[])(object)destination;
+                    fixed (UInt16* destinationBase = uint16Array)
+                    {
+                        for (int g = 0; g < Count; g++)
+                        {
+                            destinationBase[startIndex + g] = (UInt16)(object)this[g];
+                        }
+                    }
+                }
+                else if (typeof(T) == typeof(Int16))
+                {
+                    Int16[] int16Array = (Int16[])(object)destination;
+                    fixed (Int16* destinationBase = int16Array)
+                    {
+                        for (int g = 0; g < Count; g++)
+                        {
+                            destinationBase[startIndex + g] = (Int16)(object)this[g];
+                        }
+                    }
+                }
+                else if (typeof(T) == typeof(UInt32))
+                {
+                    UInt32[] uint32Array = (UInt32[])(object)destination;
+                    fixed (UInt32* destinationBase = uint32Array)
+                    {
+                        for (int g = 0; g < Count; g++)
+                        {
+                            destinationBase[startIndex + g] = (UInt32)(object)this[g];
+                        }
+                    }
+                }
+                else if (typeof(T) == typeof(Int32))
+                {
+                    Int32[] int32Array = (Int32[])(object)destination;
+                    fixed (Int32* destinationBase = int32Array)
+                    {
+                        for (int g = 0; g < Count; g++)
+                        {
+                            destinationBase[startIndex + g] = (Int32)(object)this[g];
+                        }
+                    }
+                }
+                else if (typeof(T) == typeof(UInt64))
+                {
+                    UInt64[] uint64Array = (UInt64[])(object)destination;
+                    fixed (UInt64* destinationBase = uint64Array)
+                    {
+                        for (int g = 0; g < Count; g++)
+                        {
+                            destinationBase[startIndex + g] = (UInt64)(object)this[g];
+                        }
+                    }
+                }
+                else if (typeof(T) == typeof(Int64))
+                {
+                    Int64[] int64Array = (Int64[])(object)destination;
+                    fixed (Int64* destinationBase = int64Array)
+                    {
+                        for (int g = 0; g < Count; g++)
+                        {
+                            destinationBase[startIndex + g] = (Int64)(object)this[g];
+                        }
+                    }
+                }
+                else if (typeof(T) == typeof(Single))
+                {
+                    Single[] singleArray = (Single[])(object)destination;
+                    fixed (Single* destinationBase = singleArray)
+                    {
+                        for (int g = 0; g < Count; g++)
+                        {
+                            destinationBase[startIndex + g] = (Single)(object)this[g];
+                        }
+                    }
+                }
+                else if (typeof(T) == typeof(Double))
+                {
+                    Double[] doubleArray = (Double[])(object)destination;
+                    fixed (Double* destinationBase = doubleArray)
+                    {
+                        for (int g = 0; g < Count; g++)
+                        {
+                            destinationBase[startIndex + g] = (Double)(object)this[g];
+                        }
+                    }
+                }
+            }
+            else
+            {
+                if (typeof(T) == typeof(Byte))
+                {
+                    Byte[] byteArray = (Byte[])(object)destination;
+                    fixed (Byte* destinationBase = byteArray)
+                    {
+                        destinationBase[startIndex + 0] = this.register.byte_0;
+                        destinationBase[startIndex + 1] = this.register.byte_1;
+                        destinationBase[startIndex + 2] = this.register.byte_2;
+                        destinationBase[startIndex + 3] = this.register.byte_3;
+                        destinationBase[startIndex + 4] = this.register.byte_4;
+                        destinationBase[startIndex + 5] = this.register.byte_5;
+                        destinationBase[startIndex + 6] = this.register.byte_6;
+                        destinationBase[startIndex + 7] = this.register.byte_7;
+                        destinationBase[startIndex + 8] = this.register.byte_8;
+                        destinationBase[startIndex + 9] = this.register.byte_9;
+                        destinationBase[startIndex + 10] = this.register.byte_10;
+                        destinationBase[startIndex + 11] = this.register.byte_11;
+                        destinationBase[startIndex + 12] = this.register.byte_12;
+                        destinationBase[startIndex + 13] = this.register.byte_13;
+                        destinationBase[startIndex + 14] = this.register.byte_14;
+                        destinationBase[startIndex + 15] = this.register.byte_15;
+                    }
+                }
+                else if (typeof(T) == typeof(SByte))
+                {
+                    SByte[] sbyteArray = (SByte[])(object)destination;
+                    fixed (SByte* destinationBase = sbyteArray)
+                    {
+                        destinationBase[startIndex + 0] = this.register.sbyte_0;
+                        destinationBase[startIndex + 1] = this.register.sbyte_1;
+                        destinationBase[startIndex + 2] = this.register.sbyte_2;
+                        destinationBase[startIndex + 3] = this.register.sbyte_3;
+                        destinationBase[startIndex + 4] = this.register.sbyte_4;
+                        destinationBase[startIndex + 5] = this.register.sbyte_5;
+                        destinationBase[startIndex + 6] = this.register.sbyte_6;
+                        destinationBase[startIndex + 7] = this.register.sbyte_7;
+                        destinationBase[startIndex + 8] = this.register.sbyte_8;
+                        destinationBase[startIndex + 9] = this.register.sbyte_9;
+                        destinationBase[startIndex + 10] = this.register.sbyte_10;
+                        destinationBase[startIndex + 11] = this.register.sbyte_11;
+                        destinationBase[startIndex + 12] = this.register.sbyte_12;
+                        destinationBase[startIndex + 13] = this.register.sbyte_13;
+                        destinationBase[startIndex + 14] = this.register.sbyte_14;
+                        destinationBase[startIndex + 15] = this.register.sbyte_15;
+                    }
+                }
+                else if (typeof(T) == typeof(UInt16))
+                {
+                    UInt16[] uint16Array = (UInt16[])(object)destination;
+                    fixed (UInt16* destinationBase = uint16Array)
+                    {
+                        destinationBase[startIndex + 0] = this.register.uint16_0;
+                        destinationBase[startIndex + 1] = this.register.uint16_1;
+                        destinationBase[startIndex + 2] = this.register.uint16_2;
+                        destinationBase[startIndex + 3] = this.register.uint16_3;
+                        destinationBase[startIndex + 4] = this.register.uint16_4;
+                        destinationBase[startIndex + 5] = this.register.uint16_5;
+                        destinationBase[startIndex + 6] = this.register.uint16_6;
+                        destinationBase[startIndex + 7] = this.register.uint16_7;
+                    }
+                }
+                else if (typeof(T) == typeof(Int16))
+                {
+                    Int16[] int16Array = (Int16[])(object)destination;
+                    fixed (Int16* destinationBase = int16Array)
+                    {
+                        destinationBase[startIndex + 0] = this.register.int16_0;
+                        destinationBase[startIndex + 1] = this.register.int16_1;
+                        destinationBase[startIndex + 2] = this.register.int16_2;
+                        destinationBase[startIndex + 3] = this.register.int16_3;
+                        destinationBase[startIndex + 4] = this.register.int16_4;
+                        destinationBase[startIndex + 5] = this.register.int16_5;
+                        destinationBase[startIndex + 6] = this.register.int16_6;
+                        destinationBase[startIndex + 7] = this.register.int16_7;
+                    }
+                }
+                else if (typeof(T) == typeof(UInt32))
+                {
+                    UInt32[] uint32Array = (UInt32[])(object)destination;
+                    fixed (UInt32* destinationBase = uint32Array)
+                    {
+                        destinationBase[startIndex + 0] = this.register.uint32_0;
+                        destinationBase[startIndex + 1] = this.register.uint32_1;
+                        destinationBase[startIndex + 2] = this.register.uint32_2;
+                        destinationBase[startIndex + 3] = this.register.uint32_3;
+                    }
+                }
+                else if (typeof(T) == typeof(Int32))
+                {
+                    Int32[] int32Array = (Int32[])(object)destination;
+                    fixed (Int32* destinationBase = int32Array)
+                    {
+                        destinationBase[startIndex + 0] = this.register.int32_0;
+                        destinationBase[startIndex + 1] = this.register.int32_1;
+                        destinationBase[startIndex + 2] = this.register.int32_2;
+                        destinationBase[startIndex + 3] = this.register.int32_3;
+                    }
+                }
+                else if (typeof(T) == typeof(UInt64))
+                {
+                    UInt64[] uint64Array = (UInt64[])(object)destination;
+                    fixed (UInt64* destinationBase = uint64Array)
+                    {
+                        destinationBase[startIndex + 0] = this.register.uint64_0;
+                        destinationBase[startIndex + 1] = this.register.uint64_1;
+                    }
+                }
+                else if (typeof(T) == typeof(Int64))
+                {
+                    Int64[] int64Array = (Int64[])(object)destination;
+                    fixed (Int64* destinationBase = int64Array)
+                    {
+                        destinationBase[startIndex + 0] = this.register.int64_0;
+                        destinationBase[startIndex + 1] = this.register.int64_1;
+                    }
+                }
+                else if (typeof(T) == typeof(Single))
+                {
+                    Single[] singleArray = (Single[])(object)destination;
+                    fixed (Single* destinationBase = singleArray)
+                    {
+                        destinationBase[startIndex + 0] = this.register.single_0;
+                        destinationBase[startIndex + 1] = this.register.single_1;
+                        destinationBase[startIndex + 2] = this.register.single_2;
+                        destinationBase[startIndex + 3] = this.register.single_3;
+                    }
+                }
+                else if (typeof(T) == typeof(Double))
+                {
+                    Double[] doubleArray = (Double[])(object)destination;
+                    fixed (Double* destinationBase = doubleArray)
+                    {
+                        destinationBase[startIndex + 0] = this.register.double_0;
+                        destinationBase[startIndex + 1] = this.register.double_1;
+                    }
+                }
+            }
+        }
+
+        /// <summary>
+        /// Returns the element at the given index.
+        /// </summary>
+        [JitIntrinsic]
+        public unsafe T this[int index]
+        {
+            get
+            {
+                if (index >= Count || index < 0)
+                {
+                    throw new IndexOutOfRangeException(SR.Format(SR.Arg_ArgumentOutOfRangeException, index));
+                }
+                if (typeof(T) == typeof(Byte))
+                {
+                    fixed (Byte* basePtr = &this.register.byte_0)
+                    {
+                        return (T)(object)*(basePtr + index);
+                    }
+                }
+                else if (typeof(T) == typeof(SByte))
+                {
+                    fixed (SByte* basePtr = &this.register.sbyte_0)
+                    {
+                        return (T)(object)*(basePtr + index);
+                    }
+                }
+                else if (typeof(T) == typeof(UInt16))
+                {
+                    fixed (UInt16* basePtr = &this.register.uint16_0)
+                    {
+                        return (T)(object)*(basePtr + index);
+                    }
+                }
+                else if (typeof(T) == typeof(Int16))
+                {
+                    fixed (Int16* basePtr = &this.register.int16_0)
+                    {
+                        return (T)(object)*(basePtr + index);
+                    }
+                }
+                else if (typeof(T) == typeof(UInt32))
+                {
+                    fixed (UInt32* basePtr = &this.register.uint32_0)
+                    {
+                        return (T)(object)*(basePtr + index);
+                    }
+                }
+                else if (typeof(T) == typeof(Int32))
+                {
+                    fixed (Int32* basePtr = &this.register.int32_0)
+                    {
+                        return (T)(object)*(basePtr + index);
+                    }
+                }
+                else if (typeof(T) == typeof(UInt64))
+                {
+                    fixed (UInt64* basePtr = &this.register.uint64_0)
+                    {
+                        return (T)(object)*(basePtr + index);
+                    }
+                }
+                else if (typeof(T) == typeof(Int64))
+                {
+                    fixed (Int64* basePtr = &this.register.int64_0)
+                    {
+                        return (T)(object)*(basePtr + index);
+                    }
+                }
+                else if (typeof(T) == typeof(Single))
+                {
+                    fixed (Single* basePtr = &this.register.single_0)
+                    {
+                        return (T)(object)*(basePtr + index);
+                    }
+                }
+                else if (typeof(T) == typeof(Double))
+                {
+                    fixed (Double* basePtr = &this.register.double_0)
+                    {
+                        return (T)(object)*(basePtr + index);
+                    }
+                }
+                else
+                {
+                    throw new NotSupportedException(SR.Arg_TypeNotSupported);
+                }
+            }
+        }
+
+        /// <summary>
+        /// Returns a boolean indicating whether the given Object is equal to this vector instance.
+        /// </summary>
+        /// <param name="obj">The Object to compare against.</param>
+        /// <returns>True if the Object is equal to this vector; False otherwise.</returns>
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public override bool Equals(object obj)
+        {
+            if (!(obj is Vector<T>))
+            {
+                return false;
+            }
+            return Equals((Vector<T>)obj);
+        }
+
+        /// <summary>
+        /// Returns a boolean indicating whether the given vector is equal to this vector instance.
+        /// </summary>
+        /// <param name="other">The vector to compare this instance to.</param>
+        /// <returns>True if the other vector is equal to this instance; False otherwise.</returns>
+        [JitIntrinsic]
+        public bool Equals(Vector<T> other)
+        {
+            if (Vector.IsHardwareAccelerated)
+            {
+                for (int g = 0; g < Count; g++)
+                {
+                    if (!ScalarEquals(this[g], other[g]))
+                    {
+                        return false;
+                    }
+                }
+                return true;
+            }
+            else
+            {
+                if (typeof(T) == typeof(Byte))
+                {
+                    return
+                        this.register.byte_0 == other.register.byte_0
+                        && this.register.byte_1 == other.register.byte_1
+                        && this.register.byte_2 == other.register.byte_2
+                        && this.register.byte_3 == other.register.byte_3
+                        && this.register.byte_4 == other.register.byte_4
+                        && this.register.byte_5 == other.register.byte_5
+                        && this.register.byte_6 == other.register.byte_6
+                        && this.register.byte_7 == other.register.byte_7
+                        && this.register.byte_8 == other.register.byte_8
+                        && this.register.byte_9 == other.register.byte_9
+                        && this.register.byte_10 == other.register.byte_10
+                        && this.register.byte_11 == other.register.byte_11
+                        && this.register.byte_12 == other.register.byte_12
+                        && this.register.byte_13 == other.register.byte_13
+                        && this.register.byte_14 == other.register.byte_14
+                        && this.register.byte_15 == other.register.byte_15;
+                }
+                else if (typeof(T) == typeof(SByte))
+                {
+                    return
+                        this.register.sbyte_0 == other.register.sbyte_0
+                        && this.register.sbyte_1 == other.register.sbyte_1
+                        && this.register.sbyte_2 == other.register.sbyte_2
+                        && this.register.sbyte_3 == other.register.sbyte_3
+                        && this.register.sbyte_4 == other.register.sbyte_4
+                        && this.register.sbyte_5 == other.register.sbyte_5
+                        && this.register.sbyte_6 == other.register.sbyte_6
+                        && this.register.sbyte_7 == other.register.sbyte_7
+                        && this.register.sbyte_8 == other.register.sbyte_8
+                        && this.register.sbyte_9 == other.register.sbyte_9
+                        && this.register.sbyte_10 == other.register.sbyte_10
+                        && this.register.sbyte_11 == other.register.sbyte_11
+                        && this.register.sbyte_12 == other.register.sbyte_12
+                        && this.register.sbyte_13 == other.register.sbyte_13
+                        && this.register.sbyte_14 == other.register.sbyte_14
+                        && this.register.sbyte_15 == other.register.sbyte_15;
+                }
+                else if (typeof(T) == typeof(UInt16))
+                {
+                    return
+                        this.register.uint16_0 == other.register.uint16_0
+                        && this.register.uint16_1 == other.register.uint16_1
+                        && this.register.uint16_2 == other.register.uint16_2
+                        && this.register.uint16_3 == other.register.uint16_3
+                        && this.register.uint16_4 == other.register.uint16_4
+                        && this.register.uint16_5 == other.register.uint16_5
+                        && this.register.uint16_6 == other.register.uint16_6
+                        && this.register.uint16_7 == other.register.uint16_7;
+                }
+                else if (typeof(T) == typeof(Int16))
+                {
+                    return
+                        this.register.int16_0 == other.register.int16_0
+                        && this.register.int16_1 == other.register.int16_1
+                        && this.register.int16_2 == other.register.int16_2
+                        && this.register.int16_3 == other.register.int16_3
+                        && this.register.int16_4 == other.register.int16_4
+                        && this.register.int16_5 == other.register.int16_5
+                        && this.register.int16_6 == other.register.int16_6
+                        && this.register.int16_7 == other.register.int16_7;
+                }
+                else if (typeof(T) == typeof(UInt32))
+                {
+                    return
+                        this.register.uint32_0 == other.register.uint32_0
+                        && this.register.uint32_1 == other.register.uint32_1
+                        && this.register.uint32_2 == other.register.uint32_2
+                        && this.register.uint32_3 == other.register.uint32_3;
+                }
+                else if (typeof(T) == typeof(Int32))
+                {
+                    return
+                        this.register.int32_0 == other.register.int32_0
+                        && this.register.int32_1 == other.register.int32_1
+                        && this.register.int32_2 == other.register.int32_2
+                        && this.register.int32_3 == other.register.int32_3;
+                }
+                else if (typeof(T) == typeof(UInt64))
+                {
+                    return
+                        this.register.uint64_0 == other.register.uint64_0
+                        && this.register.uint64_1 == other.register.uint64_1;
+                }
+                else if (typeof(T) == typeof(Int64))
+                {
+                    return
+                        this.register.int64_0 == other.register.int64_0
+                        && this.register.int64_1 == other.register.int64_1;
+                }
+                else if (typeof(T) == typeof(Single))
+                {
+                    return
+                        this.register.single_0 == other.register.single_0
+                        && this.register.single_1 == other.register.single_1
+                        && this.register.single_2 == other.register.single_2
+                        && this.register.single_3 == other.register.single_3;
+                }
+                else if (typeof(T) == typeof(Double))
+                {
+                    return
+                        this.register.double_0 == other.register.double_0
+                        && this.register.double_1 == other.register.double_1;
+                }
+                else
+                {
+                    throw new NotSupportedException(SR.Arg_TypeNotSupported);
+                }
+            }
+        }
+
+        /// <summary>
+        /// Returns the hash code for this instance.
+        /// </summary>
+        /// <returns>The hash code.</returns>
+        public override int GetHashCode()
+        {
+            int hash = 0;
+
+            if (Vector.IsHardwareAccelerated)
+            {
+                if (typeof(T) == typeof(Byte))
+                {
+                    for (int g = 0; g < Count; g++)
+                    {
+                        hash = HashCodeHelper.CombineHashCodes(hash, ((Byte)(object)this[g]).GetHashCode());
+                    }
+                    return hash;
+                }
+                else if (typeof(T) == typeof(SByte))
+                {
+                    for (int g = 0; g < Count; g++)
+                    {
+                        hash = HashCodeHelper.CombineHashCodes(hash, ((SByte)(object)this[g]).GetHashCode());
+                    }
+                    return hash;
+                }
+                else if (typeof(T) == typeof(UInt16))
+                {
+                    for (int g = 0; g < Count; g++)
+                    {
+                        hash = HashCodeHelper.CombineHashCodes(hash, ((UInt16)(object)this[g]).GetHashCode());
+                    }
+                    return hash;
+                }
+                else if (typeof(T) == typeof(Int16))
+                {
+                    for (int g = 0; g < Count; g++)
+                    {
+                        hash = HashCodeHelper.CombineHashCodes(hash, ((Int16)(object)this[g]).GetHashCode());
+                    }
+                    return hash;
+                }
+                else if (typeof(T) == typeof(UInt32))
+                {
+                    for (int g = 0; g < Count; g++)
+                    {
+                        hash = HashCodeHelper.CombineHashCodes(hash, ((UInt32)(object)this[g]).GetHashCode());
+                    }
+                    return hash;
+                }
+                else if (typeof(T) == typeof(Int32))
+                {
+                    for (int g = 0; g < Count; g++)
+                    {
+                        hash = HashCodeHelper.CombineHashCodes(hash, ((Int32)(object)this[g]).GetHashCode());
+                    }
+                    return hash;
+                }
+                else if (typeof(T) == typeof(UInt64))
+                {
+                    for (int g = 0; g < Count; g++)
+                    {
+                        hash = HashCodeHelper.CombineHashCodes(hash, ((UInt64)(object)this[g]).GetHashCode());
+                    }
+                    return hash;
+                }
+                else if (typeof(T) == typeof(Int64))
+                {
+                    for (int g = 0; g < Count; g++)
+                    {
+                        hash = HashCodeHelper.CombineHashCodes(hash, ((Int64)(object)this[g]).GetHashCode());
+                    }
+                    return hash;
+                }
+                else if (typeof(T) == typeof(Single))
+                {
+                    for (int g = 0; g < Count; g++)
+                    {
+                        hash = HashCodeHelper.CombineHashCodes(hash, ((Single)(object)this[g]).GetHashCode());
+                    }
+                    return hash;
+                }
+                else if (typeof(T) == typeof(Double))
+                {
+                    for (int g = 0; g < Count; g++)
+                    {
+                        hash = HashCodeHelper.CombineHashCodes(hash, ((Double)(object)this[g]).GetHashCode());
+                    }
+                    return hash;
+                }
+                else
+                {
+                    throw new NotSupportedException(SR.Arg_TypeNotSupported);
+                }
+            }
+            else
+            {
+                if (typeof(T) == typeof(Byte))
+                {
+                    hash = HashCodeHelper.CombineHashCodes(hash, this.register.byte_0.GetHashCode());
+                    hash = HashCodeHelper.CombineHashCodes(hash, this.register.byte_1.GetHashCode());
+                    hash = HashCodeHelper.CombineHashCodes(hash, this.register.byte_2.GetHashCode());
+                    hash = HashCodeHelper.CombineHashCodes(hash, this.register.byte_3.GetHashCode());
+                    hash = HashCodeHelper.CombineHashCodes(hash, this.register.byte_4.GetHashCode());
+                    hash = HashCodeHelper.CombineHashCodes(hash, this.register.byte_5.GetHashCode());
+                    hash = HashCodeHelper.CombineHashCodes(hash, this.register.byte_6.GetHashCode());
+                    hash = HashCodeHelper.CombineHashCodes(hash, this.register.byte_7.GetHashCode());
+                    hash = HashCodeHelper.CombineHashCodes(hash, this.register.byte_8.GetHashCode());
+                    hash = HashCodeHelper.CombineHashCodes(hash, this.register.byte_9.GetHashCode());
+                    hash = HashCodeHelper.CombineHashCodes(hash, this.register.byte_10.GetHashCode());
+                    hash = HashCodeHelper.CombineHashCodes(hash, this.register.byte_11.GetHashCode());
+                    hash = HashCodeHelper.CombineHashCodes(hash, this.register.byte_12.GetHashCode());
+                    hash = HashCodeHelper.CombineHashCodes(hash, this.register.byte_13.GetHashCode());
+                    hash = HashCodeHelper.CombineHashCodes(hash, this.register.byte_14.GetHashCode());
+                    hash = HashCodeHelper.CombineHashCodes(hash, this.register.byte_15.GetHashCode());
+                    return hash;
+                }
+                else if (typeof(T) == typeof(SByte))
+                {
+                    hash = HashCodeHelper.CombineHashCodes(hash, this.register.sbyte_0.GetHashCode());
+                    hash = HashCodeHelper.CombineHashCodes(hash, this.register.sbyte_1.GetHashCode());
+                    hash = HashCodeHelper.CombineHashCodes(hash, this.register.sbyte_2.GetHashCode());
+                    hash = HashCodeHelper.CombineHashCodes(hash, this.register.sbyte_3.GetHashCode());
+                    hash = HashCodeHelper.CombineHashCodes(hash, this.register.sbyte_4.GetHashCode());
+                    hash = HashCodeHelper.CombineHashCodes(hash, this.register.sbyte_5.GetHashCode());
+                    hash = HashCodeHelper.CombineHashCodes(hash, this.register.sbyte_6.GetHashCode());
+                    hash = HashCodeHelper.CombineHashCodes(hash, this.register.sbyte_7.GetHashCode());
+                    hash = HashCodeHelper.CombineHashCodes(hash, this.register.sbyte_8.GetHashCode());
+                    hash = HashCodeHelper.CombineHashCodes(hash, this.register.sbyte_9.GetHashCode());
+                    hash = HashCodeHelper.CombineHashCodes(hash, this.register.sbyte_10.GetHashCode());
+                    hash = HashCodeHelper.CombineHashCodes(hash, this.register.sbyte_11.GetHashCode());
+                    hash = HashCodeHelper.CombineHashCodes(hash, this.register.sbyte_12.GetHashCode());
+                    hash = HashCodeHelper.CombineHashCodes(hash, this.register.sbyte_13.GetHashCode());
+                    hash = HashCodeHelper.CombineHashCodes(hash, this.register.sbyte_14.GetHashCode());
+                    hash = HashCodeHelper.CombineHashCodes(hash, this.register.sbyte_15.GetHashCode());
+                    return hash;
+                }
+                else if (typeof(T) == typeof(UInt16))
+                {
+                    hash = HashCodeHelper.CombineHashCodes(hash, this.register.uint16_0.GetHashCode());
+                    hash = HashCodeHelper.CombineHashCodes(hash, this.register.uint16_1.GetHashCode());
+                    hash = HashCodeHelper.CombineHashCodes(hash, this.register.uint16_2.GetHashCode());
+                    hash = HashCodeHelper.CombineHashCodes(hash, this.register.uint16_3.GetHashCode());
+                    hash = HashCodeHelper.CombineHashCodes(hash, this.register.uint16_4.GetHashCode());
+                    hash = HashCodeHelper.CombineHashCodes(hash, this.register.uint16_5.GetHashCode());
+                    hash = HashCodeHelper.CombineHashCodes(hash, this.register.uint16_6.GetHashCode());
+                    hash = HashCodeHelper.CombineHashCodes(hash, this.register.uint16_7.GetHashCode());
+                    return hash;
+                }
+                else if (typeof(T) == typeof(Int16))
+                {
+                    hash = HashCodeHelper.CombineHashCodes(hash, this.register.int16_0.GetHashCode());
+                    hash = HashCodeHelper.CombineHashCodes(hash, this.register.int16_1.GetHashCode());
+                    hash = HashCodeHelper.CombineHashCodes(hash, this.register.int16_2.GetHashCode());
+                    hash = HashCodeHelper.CombineHashCodes(hash, this.register.int16_3.GetHashCode());
+                    hash = HashCodeHelper.CombineHashCodes(hash, this.register.int16_4.GetHashCode());
+                    hash = HashCodeHelper.CombineHashCodes(hash, this.register.int16_5.GetHashCode());
+                    hash = HashCodeHelper.CombineHashCodes(hash, this.register.int16_6.GetHashCode());
+                    hash = HashCodeHelper.CombineHashCodes(hash, this.register.int16_7.GetHashCode());
+                    return hash;
+                }
+                else if (typeof(T) == typeof(UInt32))
+                {
+                    hash = HashCodeHelper.CombineHashCodes(hash, this.register.uint32_0.GetHashCode());
+                    hash = HashCodeHelper.CombineHashCodes(hash, this.register.uint32_1.GetHashCode());
+                    hash = HashCodeHelper.CombineHashCodes(hash, this.register.uint32_2.GetHashCode());
+                    hash = HashCodeHelper.CombineHashCodes(hash, this.register.uint32_3.GetHashCode());
+                    return hash;
+                }
+                else if (typeof(T) == typeof(Int32))
+                {
+                    hash = HashCodeHelper.CombineHashCodes(hash, this.register.int32_0.GetHashCode());
+                    hash = HashCodeHelper.CombineHashCodes(hash, this.register.int32_1.GetHashCode());
+                    hash = HashCodeHelper.CombineHashCodes(hash, this.register.int32_2.GetHashCode());
+                    hash = HashCodeHelper.CombineHashCodes(hash, this.register.int32_3.GetHashCode());
+                    return hash;
+                }
+                else if (typeof(T) == typeof(UInt64))
+                {
+                    hash = HashCodeHelper.CombineHashCodes(hash, this.register.uint64_0.GetHashCode());
+                    hash = HashCodeHelper.CombineHashCodes(hash, this.register.uint64_1.GetHashCode());
+                    return hash;
+                }
+                else if (typeof(T) == typeof(Int64))
+                {
+                    hash = HashCodeHelper.CombineHashCodes(hash, this.register.int64_0.GetHashCode());
+                    hash = HashCodeHelper.CombineHashCodes(hash, this.register.int64_1.GetHashCode());
+                    return hash;
+                }
+                else if (typeof(T) == typeof(Single))
+                {
+                    hash = HashCodeHelper.CombineHashCodes(hash, this.register.single_0.GetHashCode());
+                    hash = HashCodeHelper.CombineHashCodes(hash, this.register.single_1.GetHashCode());
+                    hash = HashCodeHelper.CombineHashCodes(hash, this.register.single_2.GetHashCode());
+                    hash = HashCodeHelper.CombineHashCodes(hash, this.register.single_3.GetHashCode());
+                    return hash;
+                }
+                else if (typeof(T) == typeof(Double))
+                {
+                    hash = HashCodeHelper.CombineHashCodes(hash, this.register.double_0.GetHashCode());
+                    hash = HashCodeHelper.CombineHashCodes(hash, this.register.double_1.GetHashCode());
+                    return hash;
+                }
+                else
+                {
+                    throw new NotSupportedException(SR.Arg_TypeNotSupported);
+                }
+            }
+        }
+
+        /// <summary>
+        /// Returns a String representing this vector.
+        /// </summary>
+        /// <returns>The string representation.</returns>
+        public override string ToString()
+        {
+            return ToString("G", CultureInfo.CurrentCulture);
+        }
+
+        /// <summary>
+        /// Returns a String representing this vector, using the specified format string to format individual elements.
+        /// </summary>
+        /// <param name="format">The format of individual elements.</param>
+        /// <returns>The string representation.</returns>
+        public string ToString(string format)
+        {
+            return ToString(format, CultureInfo.CurrentCulture);
+        }
+
+        /// <summary>
+        /// Returns a String representing this vector, using the specified format string to format individual elements
+        /// and the given IFormatProvider.
+        /// </summary>
+        /// <param name="format">The format of individual elements.</param>
+        /// <param name="formatProvider">The format provider to use when formatting elements.</param>
+        /// <returns>The string representation.</returns>
+        public string ToString(string format, IFormatProvider formatProvider)
+        {
+            StringBuilder sb = new StringBuilder();
+            string separator = NumberFormatInfo.GetInstance(formatProvider).NumberGroupSeparator;
+            sb.Append('<');
+            for (int g = 0; g < Count - 1; g++)
+            {
+                sb.Append(((IFormattable)this[g]).ToString(format, formatProvider));
+                sb.Append(separator);
+                sb.Append(' ');
+            }
+            // Append last element w/out separator
+            sb.Append(((IFormattable)this[Count - 1]).ToString(format, formatProvider));
+            sb.Append('>');
+            return sb.ToString();
+        }
+        #endregion Public Instance Methods
+
+        #region Arithmetic Operators
+        /// <summary>
+        /// Adds two vectors together.
+        /// </summary>
+        /// <param name="left">The first source vector.</param>
+        /// <param name="right">The second source vector.</param>
+        /// <returns>The summed vector.</returns>
+        public static unsafe Vector<T> operator +(Vector<T> left, Vector<T> right)
+        {
+            unchecked
+            {
+                if (Vector.IsHardwareAccelerated)
+                {
+                    if (typeof(T) == typeof(Byte))
+                    {
+                        Byte* dataPtr = stackalloc Byte[Count];
+                        for (int g = 0; g < Count; g++)
+                        {
+                            dataPtr[g] = (Byte)(object)ScalarAdd(left[g], right[g]);
+                        }
+                        return new Vector<T>(dataPtr);
+                    }
+                    else if (typeof(T) == typeof(SByte))
+                    {
+                        SByte* dataPtr = stackalloc SByte[Count];
+                        for (int g = 0; g < Count; g++)
+                        {
+                            dataPtr[g] = (SByte)(object)ScalarAdd(left[g], right[g]);
+                        }
+                        return new Vector<T>(dataPtr);
+                    }
+                    else if (typeof(T) == typeof(UInt16))
+                    {
+                        UInt16* dataPtr = stackalloc UInt16[Count];
+                        for (int g = 0; g < Count; g++)
+                        {
+                            dataPtr[g] = (UInt16)(object)ScalarAdd(left[g], right[g]);
+                        }
+                        return new Vector<T>(dataPtr);
+                    }
+                    else if (typeof(T) == typeof(Int16))
+                    {
+                        Int16* dataPtr = stackalloc Int16[Count];
+                        for (int g = 0; g < Count; g++)
+                        {
+                            dataPtr[g] = (Int16)(object)ScalarAdd(left[g], right[g]);
+                        }
+                        return new Vector<T>(dataPtr);
+                    }
+                    else if (typeof(T) == typeof(UInt32))
+                    {
+                        UInt32* dataPtr = stackalloc UInt32[Count];
+                        for (int g = 0; g < Count; g++)
+                        {
+                            dataPtr[g] = (UInt32)(object)ScalarAdd(left[g], right[g]);
+                        }
+                        return new Vector<T>(dataPtr);
+                    }
+                    else if (typeof(T) == typeof(Int32))
+                    {
+                        Int32* dataPtr = stackalloc Int32[Count];
+                        for (int g = 0; g < Count; g++)
+                        {
+                            dataPtr[g] = (Int32)(object)ScalarAdd(left[g], right[g]);
+                        }
+                        return new Vector<T>(dataPtr);
+                    }
+                    else if (typeof(T) == typeof(UInt64))
+                    {
+                        UInt64* dataPtr = stackalloc UInt64[Count];
+                        for (int g = 0; g < Count; g++)
+                        {
+                            dataPtr[g] = (UInt64)(object)ScalarAdd(left[g], right[g]);
+                        }
+                        return new Vector<T>(dataPtr);
+                    }
+                    else if (typeof(T) == typeof(Int64))
+                    {
+                        Int64* dataPtr = stackalloc Int64[Count];
+                        for (int g = 0; g < Count; g++)
+                        {
+                            dataPtr[g] = (Int64)(object)ScalarAdd(left[g], right[g]);
+                        }
+                        return new Vector<T>(dataPtr);
+                    }
+                    else if (typeof(T) == typeof(Single))
+                    {
+                        Single* dataPtr = stackalloc Single[Count];
+                        for (int g = 0; g < Count; g++)
+                        {
+                            dataPtr[g] = (Single)(object)ScalarAdd(left[g], right[g]);
+                        }
+                        return new Vector<T>(dataPtr);
+                    }
+                    else if (typeof(T) == typeof(Double))
+                    {
+                        Double* dataPtr = stackalloc Double[Count];
+                        for (int g = 0; g < Count; g++)
+                        {
+                            dataPtr[g] = (Double)(object)ScalarAdd(left[g], right[g]);
+                        }
+                        return new Vector<T>(dataPtr);
+                    }
+                    else
+                    {
+                        throw new NotSupportedException(SR.Arg_TypeNotSupported);
+                    }
+                }
+                else
+                {
+                    Vector<T> sum = new Vector<T>();
+                    if (typeof(T) == typeof(Byte))
+                    {
+                        sum.register.byte_0 = (Byte)(left.register.byte_0 + right.register.byte_0);
+                        sum.register.byte_1 = (Byte)(left.register.byte_1 + right.register.byte_1);
+                        sum.register.byte_2 = (Byte)(left.register.byte_2 + right.register.byte_2);
+                        sum.register.byte_3 = (Byte)(left.register.byte_3 + right.register.byte_3);
+                        sum.register.byte_4 = (Byte)(left.register.byte_4 + right.register.byte_4);
+                        sum.register.byte_5 = (Byte)(left.register.byte_5 + right.register.byte_5);
+                        sum.register.byte_6 = (Byte)(left.register.byte_6 + right.register.byte_6);
+                        sum.register.byte_7 = (Byte)(left.register.byte_7 + right.register.byte_7);
+                        sum.register.byte_8 = (Byte)(left.register.byte_8 + right.register.byte_8);
+                        sum.register.byte_9 = (Byte)(left.register.byte_9 + right.register.byte_9);
+                        sum.register.byte_10 = (Byte)(left.register.byte_10 + right.register.byte_10);
+                        sum.register.byte_11 = (Byte)(left.register.byte_11 + right.register.byte_11);
+                        sum.register.byte_12 = (Byte)(left.register.byte_12 + right.register.byte_12);
+                        sum.register.byte_13 = (Byte)(left.register.byte_13 + right.register.byte_13);
+                        sum.register.byte_14 = (Byte)(left.register.byte_14 + right.register.byte_14);
+                        sum.register.byte_15 = (Byte)(left.register.byte_15 + right.register.byte_15);
+                    }
+                    else if (typeof(T) == typeof(SByte))
+                    {
+                        sum.register.sbyte_0 = (SByte)(left.register.sbyte_0 + right.register.sbyte_0);
+                        sum.register.sbyte_1 = (SByte)(left.register.sbyte_1 + right.register.sbyte_1);
+                        sum.register.sbyte_2 = (SByte)(left.register.sbyte_2 + right.register.sbyte_2);
+                        sum.register.sbyte_3 = (SByte)(left.register.sbyte_3 + right.register.sbyte_3);
+                        sum.register.sbyte_4 = (SByte)(left.register.sbyte_4 + right.register.sbyte_4);
+                        sum.register.sbyte_5 = (SByte)(left.register.sbyte_5 + right.register.sbyte_5);
+                        sum.register.sbyte_6 = (SByte)(left.register.sbyte_6 + right.register.sbyte_6);
+                        sum.register.sbyte_7 = (SByte)(left.register.sbyte_7 + right.register.sbyte_7);
+                        sum.register.sbyte_8 = (SByte)(left.register.sbyte_8 + right.register.sbyte_8);
+                        sum.register.sbyte_9 = (SByte)(left.register.sbyte_9 + right.register.sbyte_9);
+                        sum.register.sbyte_10 = (SByte)(left.register.sbyte_10 + right.register.sbyte_10);
+                        sum.register.sbyte_11 = (SByte)(left.register.sbyte_11 + right.register.sbyte_11);
+                        sum.register.sbyte_12 = (SByte)(left.register.sbyte_12 + right.register.sbyte_12);
+                        sum.register.sbyte_13 = (SByte)(left.register.sbyte_13 + right.register.sbyte_13);
+                        sum.register.sbyte_14 = (SByte)(left.register.sbyte_14 + right.register.sbyte_14);
+                        sum.register.sbyte_15 = (SByte)(left.register.sbyte_15 + right.register.sbyte_15);
+                    }
+                    else if (typeof(T) == typeof(UInt16))
+                    {
+                        sum.register.uint16_0 = (UInt16)(left.register.uint16_0 + right.register.uint16_0);
+                        sum.register.uint16_1 = (UInt16)(left.register.uint16_1 + right.register.uint16_1);
+                        sum.register.uint16_2 = (UInt16)(left.register.uint16_2 + right.register.uint16_2);
+                        sum.register.uint16_3 = (UInt16)(left.register.uint16_3 + right.register.uint16_3);
+                        sum.register.uint16_4 = (UInt16)(left.register.uint16_4 + right.register.uint16_4);
+                        sum.register.uint16_5 = (UInt16)(left.register.uint16_5 + right.register.uint16_5);
+                        sum.register.uint16_6 = (UInt16)(left.register.uint16_6 + right.register.uint16_6);
+                        sum.register.uint16_7 = (UInt16)(left.register.uint16_7 + right.register.uint16_7);
+                    }
+                    else if (typeof(T) == typeof(Int16))
+                    {
+                        sum.register.int16_0 = (Int16)(left.register.int16_0 + right.register.int16_0);
+                        sum.register.int16_1 = (Int16)(left.register.int16_1 + right.register.int16_1);
+                        sum.register.int16_2 = (Int16)(left.register.int16_2 + right.register.int16_2);
+                        sum.register.int16_3 = (Int16)(left.register.int16_3 + right.register.int16_3);
+                        sum.register.int16_4 = (Int16)(left.register.int16_4 + right.register.int16_4);
+                        sum.register.int16_5 = (Int16)(left.register.int16_5 + right.register.int16_5);
+                        sum.register.int16_6 = (Int16)(left.register.int16_6 + right.register.int16_6);
+                        sum.register.int16_7 = (Int16)(left.register.int16_7 + right.register.int16_7);
+                    }
+                    else if (typeof(T) == typeof(UInt32))
+                    {
+                        sum.register.uint32_0 = (UInt32)(left.register.uint32_0 + right.register.uint32_0);
+                        sum.register.uint32_1 = (UInt32)(left.register.uint32_1 + right.register.uint32_1);
+                        sum.register.uint32_2 = (UInt32)(left.register.uint32_2 + right.register.uint32_2);
+                        sum.register.uint32_3 = (UInt32)(left.register.uint32_3 + right.register.uint32_3);
+                    }
+                    else if (typeof(T) == typeof(Int32))
+                    {
+                        sum.register.int32_0 = (Int32)(left.register.int32_0 + right.register.int32_0);
+                        sum.register.int32_1 = (Int32)(left.register.int32_1 + right.register.int32_1);
+                        sum.register.int32_2 = (Int32)(left.register.int32_2 + right.register.int32_2);
+                        sum.register.int32_3 = (Int32)(left.register.int32_3 + right.register.int32_3);
+                    }
+                    else if (typeof(T) == typeof(UInt64))
+                    {
+                        sum.register.uint64_0 = (UInt64)(left.register.uint64_0 + right.register.uint64_0);
+                        sum.register.uint64_1 = (UInt64)(left.register.uint64_1 + right.register.uint64_1);
+                    }
+                    else if (typeof(T) == typeof(Int64))
+                    {
+                        sum.register.int64_0 = (Int64)(left.register.int64_0 + right.register.int64_0);
+                        sum.register.int64_1 = (Int64)(left.register.int64_1 + right.register.int64_1);
+                    }
+                    else if (typeof(T) == typeof(Single))
+                    {
+                        sum.register.single_0 = (Single)(left.register.single_0 + right.register.single_0);
+                        sum.register.single_1 = (Single)(left.register.single_1 + right.register.single_1);
+                        sum.register.single_2 = (Single)(left.register.single_2 + right.register.single_2);
+                        sum.register.single_3 = (Single)(left.register.single_3 + right.register.single_3);
+                    }
+                    else if (typeof(T) == typeof(Double))
+                    {
+                        sum.register.double_0 = (Double)(left.register.double_0 + right.register.double_0);
+                        sum.register.double_1 = (Double)(left.register.double_1 + right.register.double_1);
+                    }
+                    return sum;
+                }
+            }
+        }
+
+        /// <summary>
+        /// Subtracts the second vector from the first.
+        /// </summary>
+        /// <param name="left">The first source vector.</param>
+        /// <param name="right">The second source vector.</param>
+        /// <returns>The difference vector.</returns>
+        public static unsafe Vector<T> operator -(Vector<T> left, Vector<T> right)
+        {
+            unchecked
+            {
+                if (Vector.IsHardwareAccelerated)
+                {
+                    if (typeof(T) == typeof(Byte))
+                    {
+                        Byte* dataPtr = stackalloc Byte[Count];
+                        for (int g = 0; g < Count; g++)
+                        {
+                            dataPtr[g] = (Byte)(object)ScalarSubtract(left[g], right[g]);
+                        }
+                        return new Vector<T>(dataPtr);
+                    }
+                    else if (typeof(T) == typeof(SByte))
+                    {
+                        SByte* dataPtr = stackalloc SByte[Count];
+                        for (int g = 0; g < Count; g++)
+                        {
+                            dataPtr[g] = (SByte)(object)ScalarSubtract(left[g], right[g]);
+                        }
+                        return new Vector<T>(dataPtr);
+                    }
+                    else if (typeof(T) == typeof(UInt16))
+                    {
+                        UInt16* dataPtr = stackalloc UInt16[Count];
+                        for (int g = 0; g < Count; g++)
+                        {
+                            dataPtr[g] = (UInt16)(object)ScalarSubtract(left[g], right[g]);
+                        }
+                        return new Vector<T>(dataPtr);
+                    }
+                    else if (typeof(T) == typeof(Int16))
+                    {
+                        Int16* dataPtr = stackalloc Int16[Count];
+                        for (int g = 0; g < Count; g++)
+                        {
+                            dataPtr[g] = (Int16)(object)ScalarSubtract(left[g], right[g]);
+                        }
+                        return new Vector<T>(dataPtr);
+                    }
+                    else if (typeof(T) == typeof(UInt32))
+                    {
+                        UInt32* dataPtr = stackalloc UInt32[Count];
+                        for (int g = 0; g < Count; g++)
+                        {
+                            dataPtr[g] = (UInt32)(object)ScalarSubtract(left[g], right[g]);
+                        }
+                        return new Vector<T>(dataPtr);
+                    }
+                    else if (typeof(T) == typeof(Int32))
+                    {
+                        Int32* dataPtr = stackalloc Int32[Count];
+                        for (int g = 0; g < Count; g++)
+                        {
+                            dataPtr[g] = (Int32)(object)ScalarSubtract(left[g], right[g]);
+                        }
+                        return new Vector<T>(dataPtr);
+                    }
+                    else if (typeof(T) == typeof(UInt64))
+                    {
+                        UInt64* dataPtr = stackalloc UInt64[Count];
+                        for (int g = 0; g < Count; g++)
+                        {
+                            dataPtr[g] = (UInt64)(object)ScalarSubtract(left[g], right[g]);
+                        }
+                        return new Vector<T>(dataPtr);
+                    }
+                    else if (typeof(T) == typeof(Int64))
+                    {
+                        Int64* dataPtr = stackalloc Int64[Count];
+                        for (int g = 0; g < Count; g++)
+                        {
+                            dataPtr[g] = (Int64)(object)ScalarSubtract(left[g], right[g]);
+                        }
+                        return new Vector<T>(dataPtr);
+                    }
+                    else if (typeof(T) == typeof(Single))
+                    {
+                        Single* dataPtr = stackalloc Single[Count];
+                        for (int g = 0; g < Count; g++)
+                        {
+                            dataPtr[g] = (Single)(object)ScalarSubtract(left[g], right[g]);
+                        }
+                        return new Vector<T>(dataPtr);
+                    }
+                    else if (typeof(T) == typeof(Double))
+                    {
+                        Double* dataPtr = stackalloc Double[Count];
+                        for (int g = 0; g < Count; g++)
+                        {
+                            dataPtr[g] = (Double)(object)ScalarSubtract(left[g], right[g]);
+                        }
+                        return new Vector<T>(dataPtr);
+                    }
+                    else
+                    {
+                        throw new NotSupportedException(SR.Arg_TypeNotSupported);
+                    }
+                }
+                else
+                {
+                    Vector<T> difference = new Vector<T>();
+                    if (typeof(T) == typeof(Byte))
+                    {
+                        difference.register.byte_0 = (Byte)(left.register.byte_0 - right.register.byte_0);
+                        difference.register.byte_1 = (Byte)(left.register.byte_1 - right.register.byte_1);
+                        difference.register.byte_2 = (Byte)(left.register.byte_2 - right.register.byte_2);
+                        difference.register.byte_3 = (Byte)(left.register.byte_3 - right.register.byte_3);
+                        difference.register.byte_4 = (Byte)(left.register.byte_4 - right.register.byte_4);
+                        difference.register.byte_5 = (Byte)(left.register.byte_5 - right.register.byte_5);
+                        difference.register.byte_6 = (Byte)(left.register.byte_6 - right.register.byte_6);
+                        difference.register.byte_7 = (Byte)(left.register.byte_7 - right.register.byte_7);
+                        difference.register.byte_8 = (Byte)(left.register.byte_8 - right.register.byte_8);
+                        difference.register.byte_9 = (Byte)(left.register.byte_9 - right.register.byte_9);
+                        difference.register.byte_10 = (Byte)(left.register.byte_10 - right.register.byte_10);
+                        difference.register.byte_11 = (Byte)(left.register.byte_11 - right.register.byte_11);
+                        difference.register.byte_12 = (Byte)(left.register.byte_12 - right.register.byte_12);
+                        difference.register.byte_13 = (Byte)(left.register.byte_13 - right.register.byte_13);
+                        difference.register.byte_14 = (Byte)(left.register.byte_14 - right.register.byte_14);
+                        difference.register.byte_15 = (Byte)(left.register.byte_15 - right.register.byte_15);
+                    }
+                    else if (typeof(T) == typeof(SByte))
+                    {
+                        difference.register.sbyte_0 = (SByte)(left.register.sbyte_0 - right.register.sbyte_0);
+                        difference.register.sbyte_1 = (SByte)(left.register.sbyte_1 - right.register.sbyte_1);
+                        difference.register.sbyte_2 = (SByte)(left.register.sbyte_2 - right.register.sbyte_2);
+                        difference.register.sbyte_3 = (SByte)(left.register.sbyte_3 - right.register.sbyte_3);
+                        difference.register.sbyte_4 = (SByte)(left.register.sbyte_4 - right.register.sbyte_4);
+                        difference.register.sbyte_5 = (SByte)(left.register.sbyte_5 - right.register.sbyte_5);
+                        difference.register.sbyte_6 = (SByte)(left.register.sbyte_6 - right.register.sbyte_6);
+                        difference.register.sbyte_7 = (SByte)(left.register.sbyte_7 - right.register.sbyte_7);
+                        difference.register.sbyte_8 = (SByte)(left.register.sbyte_8 - right.register.sbyte_8);
+                        difference.register.sbyte_9 = (SByte)(left.register.sbyte_9 - right.register.sbyte_9);
+                        difference.register.sbyte_10 = (SByte)(left.register.sbyte_10 - right.register.sbyte_10);
+                        difference.register.sbyte_11 = (SByte)(left.register.sbyte_11 - right.register.sbyte_11);
+                        difference.register.sbyte_12 = (SByte)(left.register.sbyte_12 - right.register.sbyte_12);
+                        difference.register.sbyte_13 = (SByte)(left.register.sbyte_13 - right.register.sbyte_13);
+                        difference.register.sbyte_14 = (SByte)(left.register.sbyte_14 - right.register.sbyte_14);
+                        difference.register.sbyte_15 = (SByte)(left.register.sbyte_15 - right.register.sbyte_15);
+                    }
+                    else if (typeof(T) == typeof(UInt16))
+                    {
+                        difference.register.uint16_0 = (UInt16)(left.register.uint16_0 - right.register.uint16_0);
+                        difference.register.uint16_1 = (UInt16)(left.register.uint16_1 - right.register.uint16_1);
+                        difference.register.uint16_2 = (UInt16)(left.register.uint16_2 - right.register.uint16_2);
+                        difference.register.uint16_3 = (UInt16)(left.register.uint16_3 - right.register.uint16_3);
+                        difference.register.uint16_4 = (UInt16)(left.register.uint16_4 - right.register.uint16_4);
+                        difference.register.uint16_5 = (UInt16)(left.register.uint16_5 - right.register.uint16_5);
+                        difference.register.uint16_6 = (UInt16)(left.register.uint16_6 - right.register.uint16_6);
+                        difference.register.uint16_7 = (UInt16)(left.register.uint16_7 - right.register.uint16_7);
+                    }
+                    else if (typeof(T) == typeof(Int16))
+                    {
+                        difference.register.int16_0 = (Int16)(left.register.int16_0 - right.register.int16_0);
+                        difference.register.int16_1 = (Int16)(left.register.int16_1 - right.register.int16_1);
+                        difference.register.int16_2 = (Int16)(left.register.int16_2 - right.register.int16_2);
+                        difference.register.int16_3 = (Int16)(left.register.int16_3 - right.register.int16_3);
+                        difference.register.int16_4 = (Int16)(left.register.int16_4 - right.register.int16_4);
+                        difference.register.int16_5 = (Int16)(left.register.int16_5 - right.register.int16_5);
+                        difference.register.int16_6 = (Int16)(left.register.int16_6 - right.register.int16_6);
+                        difference.register.int16_7 = (Int16)(left.register.int16_7 - right.register.int16_7);
+                    }
+                    else if (typeof(T) == typeof(UInt32))
+                    {
+                        difference.register.uint32_0 = (UInt32)(left.register.uint32_0 - right.register.uint32_0);
+                        difference.register.uint32_1 = (UInt32)(left.register.uint32_1 - right.register.uint32_1);
+                        difference.register.uint32_2 = (UInt32)(left.register.uint32_2 - right.register.uint32_2);
+                        difference.register.uint32_3 = (UInt32)(left.register.uint32_3 - right.register.uint32_3);
+                    }
+                    else if (typeof(T) == typeof(Int32))
+                    {
+                        difference.register.int32_0 = (Int32)(left.register.int32_0 - right.register.int32_0);
+                        difference.register.int32_1 = (Int32)(left.register.int32_1 - right.register.int32_1);
+                        difference.register.int32_2 = (Int32)(left.register.int32_2 - right.register.int32_2);
+                        difference.register.int32_3 = (Int32)(left.register.int32_3 - right.register.int32_3);
+                    }
+                    else if (typeof(T) == typeof(UInt64))
+                    {
+                        difference.register.uint64_0 = (UInt64)(left.register.uint64_0 - right.register.uint64_0);
+                        difference.register.uint64_1 = (UInt64)(left.register.uint64_1 - right.register.uint64_1);
+                    }
+                    else if (typeof(T) == typeof(Int64))
+                    {
+                        difference.register.int64_0 = (Int64)(left.register.int64_0 - right.register.int64_0);
+                        difference.register.int64_1 = (Int64)(left.register.int64_1 - right.register.int64_1);
+                    }
+                    else if (typeof(T) == typeof(Single))
+                    {
+                        difference.register.single_0 = (Single)(left.register.single_0 - right.register.single_0);
+                        difference.register.single_1 = (Single)(left.register.single_1 - right.register.single_1);
+                        difference.register.single_2 = (Single)(left.register.single_2 - right.register.single_2);
+                        difference.register.single_3 = (Single)(left.register.single_3 - right.register.single_3);
+                    }
+                    else if (typeof(T) == typeof(Double))
+                    {
+                        difference.register.double_0 = (Double)(left.register.double_0 - right.register.double_0);
+                        difference.register.double_1 = (Double)(left.register.double_1 - right.register.double_1);
+                    }
+                    return difference;
+                }
+            }
+        }
+
+        // This method is intrinsic only for certain types. It cannot access fields directly unless we are sure the context is unaccelerated.
+        /// <summary>
+        /// Multiplies two vectors together.
+        /// </summary>
+        /// <param name="left">The first source vector.</param>
+        /// <param name="right">The second source vector.</param>
+        /// <returns>The product vector.</returns>
+        public static unsafe Vector<T> operator *(Vector<T> left, Vector<T> right)
+        {
+            unchecked
+            {
+                if (Vector.IsHardwareAccelerated)
+                {
+                    if (typeof(T) == typeof(Byte))
+                    {
+                        Byte* dataPtr = stackalloc Byte[Count];
+                        for (int g = 0; g < Count; g++)
+                        {
+                            dataPtr[g] = (Byte)(object)ScalarMultiply(left[g], right[g]);
+                        }
+                        return new Vector<T>(dataPtr);
+                    }
+                    else if (typeof(T) == typeof(SByte))
+                    {
+                        SByte* dataPtr = stackalloc SByte[Count];
+                        for (int g = 0; g < Count; g++)
+                        {
+                            dataPtr[g] = (SByte)(object)ScalarMultiply(left[g], right[g]);
+                        }
+                        return new Vector<T>(dataPtr);
+                    }
+                    else if (typeof(T) == typeof(UInt16))
+                    {
+                        UInt16* dataPtr = stackalloc UInt16[Count];
+                        for (int g = 0; g < Count; g++)
+                        {
+                            dataPtr[g] = (UInt16)(object)ScalarMultiply(left[g], right[g]);
+                        }
+                        return new Vector<T>(dataPtr);
+                    }
+                    else if (typeof(T) == typeof(Int16))
+                    {
+                        Int16* dataPtr = stackalloc Int16[Count];
+                        for (int g = 0; g < Count; g++)
+                        {
+                            dataPtr[g] = (Int16)(object)ScalarMultiply(left[g], right[g]);
+                        }
+                        return new Vector<T>(dataPtr);
+                    }
+                    else if (typeof(T) == typeof(UInt32))
+                    {
+                        UInt32* dataPtr = stackalloc UInt32[Count];
+                        for (int g = 0; g < Count; g++)
+                        {
+                            dataPtr[g] = (UInt32)(object)ScalarMultiply(left[g], right[g]);
+                        }
+                        return new Vector<T>(dataPtr);
+                    }
+                    else if (typeof(T) == typeof(Int32))
+                    {
+                        Int32* dataPtr = stackalloc Int32[Count];
+                        for (int g = 0; g < Count; g++)
+                        {
+                            dataPtr[g] = (Int32)(object)ScalarMultiply(left[g], right[g]);
+                        }
+                        return new Vector<T>(dataPtr);
+                    }
+                    else if (typeof(T) == typeof(UInt64))
+                    {
+                        UInt64* dataPtr = stackalloc UInt64[Count];
+                        for (int g = 0; g < Count; g++)
+                        {
+                            dataPtr[g] = (UInt64)(object)ScalarMultiply(left[g], right[g]);
+                        }
+                        return new Vector<T>(dataPtr);
+                    }
+                    else if (typeof(T) == typeof(Int64))
+                    {
+                        Int64* dataPtr = stackalloc Int64[Count];
+                        for (int g = 0; g < Count; g++)
+                        {
+                            dataPtr[g] = (Int64)(object)ScalarMultiply(left[g], right[g]);
+                        }
+                        return new Vector<T>(dataPtr);
+                    }
+                    else if (typeof(T) == typeof(Single))
+                    {
+                        Single* dataPtr = stackalloc Single[Count];
+                        for (int g = 0; g < Count; g++)
+                        {
+                            dataPtr[g] = (Single)(object)ScalarMultiply(left[g], right[g]);
+                        }
+                        return new Vector<T>(dataPtr);
+                    }
+                    else if (typeof(T) == typeof(Double))
+                    {
+                        Double* dataPtr = stackalloc Double[Count];
+                        for (int g = 0; g < Count; g++)
+                        {
+                            dataPtr[g] = (Double)(object)ScalarMultiply(left[g], right[g]);
+                        }
+                        return new Vector<T>(dataPtr);
+                    }
+                    else
+                    {
+                        throw new NotSupportedException(SR.Arg_TypeNotSupported);
+                    }
+                }
+                else
+                {
+                    Vector<T> product = new Vector<T>();
+                    if (typeof(T) == typeof(Byte))
+                    {
+                        product.register.byte_0 = (Byte)(left.register.byte_0 * right.register.byte_0);
+                        product.register.byte_1 = (Byte)(left.register.byte_1 * right.register.byte_1);
+                        product.register.byte_2 = (Byte)(left.register.byte_2 * right.register.byte_2);
+                        product.register.byte_3 = (Byte)(left.register.byte_3 * right.register.byte_3);
+                        product.register.byte_4 = (Byte)(left.register.byte_4 * right.register.byte_4);
+                        product.register.byte_5 = (Byte)(left.register.byte_5 * right.register.byte_5);
+                        product.register.byte_6 = (Byte)(left.register.byte_6 * right.register.byte_6);
+                        product.register.byte_7 = (Byte)(left.register.byte_7 * right.register.byte_7);
+                        product.register.byte_8 = (Byte)(left.register.byte_8 * right.register.byte_8);
+                        product.register.byte_9 = (Byte)(left.register.byte_9 * right.register.byte_9);
+                        product.register.byte_10 = (Byte)(left.register.byte_10 * right.register.byte_10);
+                        product.register.byte_11 = (Byte)(left.register.byte_11 * right.register.byte_11);
+                        product.register.byte_12 = (Byte)(left.register.byte_12 * right.register.byte_12);
+                        product.register.byte_13 = (Byte)(left.register.byte_13 * right.register.byte_13);
+                        product.register.byte_14 = (Byte)(left.register.byte_14 * right.register.byte_14);
+                        product.register.byte_15 = (Byte)(left.register.byte_15 * right.register.byte_15);
+                    }
+                    else if (typeof(T) == typeof(SByte))
+                    {
+                        product.register.sbyte_0 = (SByte)(left.register.sbyte_0 * right.register.sbyte_0);
+                        product.register.sbyte_1 = (SByte)(left.register.sbyte_1 * right.register.sbyte_1);
+                        product.register.sbyte_2 = (SByte)(left.register.sbyte_2 * right.register.sbyte_2);
+                        product.register.sbyte_3 = (SByte)(left.register.sbyte_3 * right.register.sbyte_3);
+                        product.register.sbyte_4 = (SByte)(left.register.sbyte_4 * right.register.sbyte_4);
+                        product.register.sbyte_5 = (SByte)(left.register.sbyte_5 * right.register.sbyte_5);
+                        product.register.sbyte_6 = (SByte)(left.register.sbyte_6 * right.register.sbyte_6);
+                        product.register.sbyte_7 = (SByte)(left.register.sbyte_7 * right.register.sbyte_7);
+                        product.register.sbyte_8 = (SByte)(left.register.sbyte_8 * right.register.sbyte_8);
+                        product.register.sbyte_9 = (SByte)(left.register.sbyte_9 * right.register.sbyte_9);
+                        product.register.sbyte_10 = (SByte)(left.register.sbyte_10 * right.register.sbyte_10);
+                        product.register.sbyte_11 = (SByte)(left.register.sbyte_11 * right.register.sbyte_11);
+                        product.register.sbyte_12 = (SByte)(left.register.sbyte_12 * right.register.sbyte_12);
+                        product.register.sbyte_13 = (SByte)(left.register.sbyte_13 * right.register.sbyte_13);
+                        product.register.sbyte_14 = (SByte)(left.register.sbyte_14 * right.register.sbyte_14);
+                        product.register.sbyte_15 = (SByte)(left.register.sbyte_15 * right.register.sbyte_15);
+                    }
+                    else if (typeof(T) == typeof(UInt16))
+                    {
+                        product.register.uint16_0 = (UInt16)(left.register.uint16_0 * right.register.uint16_0);
+                        product.register.uint16_1 = (UInt16)(left.register.uint16_1 * right.register.uint16_1);
+                        product.register.uint16_2 = (UInt16)(left.register.uint16_2 * right.register.uint16_2);
+                        product.register.uint16_3 = (UInt16)(left.register.uint16_3 * right.register.uint16_3);
+                        product.register.uint16_4 = (UInt16)(left.register.uint16_4 * right.register.uint16_4);
+                        product.register.uint16_5 = (UInt16)(left.register.uint16_5 * right.register.uint16_5);
+                        product.register.uint16_6 = (UInt16)(left.register.uint16_6 * right.register.uint16_6);
+                        product.register.uint16_7 = (UInt16)(left.register.uint16_7 * right.register.uint16_7);
+                    }
+                    else if (typeof(T) == typeof(Int16))
+                    {
+                        product.register.int16_0 = (Int16)(left.register.int16_0 * right.register.int16_0);
+                        product.register.int16_1 = (Int16)(left.register.int16_1 * right.register.int16_1);
+                        product.register.int16_2 = (Int16)(left.register.int16_2 * right.register.int16_2);
+                        product.register.int16_3 = (Int16)(left.register.int16_3 * right.register.int16_3);
+                        product.register.int16_4 = (Int16)(left.register.int16_4 * right.register.int16_4);
+                        product.register.int16_5 = (Int16)(left.register.int16_5 * right.register.int16_5);
+                        product.register.int16_6 = (Int16)(left.register.int16_6 * right.register.int16_6);
+                        product.register.int16_7 = (Int16)(left.register.int16_7 * right.register.int16_7);
+                    }
+                    else if (typeof(T) == typeof(UInt32))
+                    {
+                        product.register.uint32_0 = (UInt32)(left.register.uint32_0 * right.register.uint32_0);
+                        product.register.uint32_1 = (UInt32)(left.register.uint32_1 * right.register.uint32_1);
+                        product.register.uint32_2 = (UInt32)(left.register.uint32_2 * right.register.uint32_2);
+                        product.register.uint32_3 = (UInt32)(left.register.uint32_3 * right.register.uint32_3);
+                    }
+                    else if (typeof(T) == typeof(Int32))
+                    {
+                        product.register.int32_0 = (Int32)(left.register.int32_0 * right.register.int32_0);
+                        product.register.int32_1 = (Int32)(left.register.int32_1 * right.register.int32_1);
+                        product.register.int32_2 = (Int32)(left.register.int32_2 * right.register.int32_2);
+                        product.register.int32_3 = (Int32)(left.register.int32_3 * right.register.int32_3);
+                    }
+                    else if (typeof(T) == typeof(UInt64))
+                    {
+                        product.register.uint64_0 = (UInt64)(left.register.uint64_0 * right.register.uint64_0);
+                        product.register.uint64_1 = (UInt64)(left.register.uint64_1 * right.register.uint64_1);
+                    }
+                    else if (typeof(T) == typeof(Int64))
+                    {
+                        product.register.int64_0 = (Int64)(left.register.int64_0 * right.register.int64_0);
+                        product.register.int64_1 = (Int64)(left.register.int64_1 * right.register.int64_1);
+                    }
+                    else if (typeof(T) == typeof(Single))
+                    {
+                        product.register.single_0 = (Single)(left.register.single_0 * right.register.single_0);
+                        product.register.single_1 = (Single)(left.register.single_1 * right.register.single_1);
+                        product.register.single_2 = (Single)(left.register.single_2 * right.register.single_2);
+                        product.register.single_3 = (Single)(left.register.single_3 * right.register.single_3);
+                    }
+                    else if (typeof(T) == typeof(Double))
+                    {
+                        product.register.double_0 = (Double)(left.register.double_0 * right.register.double_0);
+                        product.register.double_1 = (Double)(left.register.double_1 * right.register.double_1);
+                    }
+                    return product;
+                }
+            }
+        }
+
+        // This method is intrinsic only for certain types. It cannot access fields directly unless we are sure the context is unaccelerated.
+        /// <summary>
+        /// Multiplies a vector by the given scalar.
+        /// </summary>
+        /// <param name="value">The source vector.</param>
+        /// <param name="factor">The scalar value.</param>
+        /// <returns>The scaled vector.</returns>
+        public static Vector<T> operator *(Vector<T> value, T factor)
+        {
+            unchecked
+            {
+                if (Vector.IsHardwareAccelerated)
+                {
+                    return new Vector<T>(factor) * value;
+                }
+                else
+                {
+                    Vector<T> product = new Vector<T>();
+                    if (typeof(T) == typeof(Byte))
+                    {
+                        product.register.byte_0 = (Byte)(value.register.byte_0 * (Byte)(object)factor);
+                        product.register.byte_1 = (Byte)(value.register.byte_1 * (Byte)(object)factor);
+                        product.register.byte_2 = (Byte)(value.register.byte_2 * (Byte)(object)factor);
+                        product.register.byte_3 = (Byte)(value.register.byte_3 * (Byte)(object)factor);
+                        product.register.byte_4 = (Byte)(value.register.byte_4 * (Byte)(object)factor);
+                        product.register.byte_5 = (Byte)(value.register.byte_5 * (Byte)(object)factor);
+                        product.register.byte_6 = (Byte)(value.register.byte_6 * (Byte)(object)factor);
+                        product.register.byte_7 = (Byte)(value.register.byte_7 * (Byte)(object)factor);
+                        product.register.byte_8 = (Byte)(value.register.byte_8 * (Byte)(object)factor);
+                        product.register.byte_9 = (Byte)(value.register.byte_9 * (Byte)(object)factor);
+                        product.register.byte_10 = (Byte)(value.register.byte_10 * (Byte)(object)factor);
+                        product.register.byte_11 = (Byte)(value.register.byte_11 * (Byte)(object)factor);
+                        product.register.byte_12 = (Byte)(value.register.byte_12 * (Byte)(object)factor);
+                        product.register.byte_13 = (Byte)(value.register.byte_13 * (Byte)(object)factor);
+                        product.register.byte_14 = (Byte)(value.register.byte_14 * (Byte)(object)factor);
+                        product.register.byte_15 = (Byte)(value.register.byte_15 * (Byte)(object)factor);
+                    }
+                    else if (typeof(T) == typeof(SByte))
+                    {
+                        product.register.sbyte_0 = (SByte)(value.register.sbyte_0 * (SByte)(object)factor);
+                        product.register.sbyte_1 = (SByte)(value.register.sbyte_1 * (SByte)(object)factor);
+                        product.register.sbyte_2 = (SByte)(value.register.sbyte_2 * (SByte)(object)factor);
+                        product.register.sbyte_3 = (SByte)(value.register.sbyte_3 * (SByte)(object)factor);
+                        product.register.sbyte_4 = (SByte)(value.register.sbyte_4 * (SByte)(object)factor);
+                        product.register.sbyte_5 = (SByte)(value.register.sbyte_5 * (SByte)(object)factor);
+                        product.register.sbyte_6 = (SByte)(value.register.sbyte_6 * (SByte)(object)factor);
+                        product.register.sbyte_7 = (SByte)(value.register.sbyte_7 * (SByte)(object)factor);
+                        product.register.sbyte_8 = (SByte)(value.register.sbyte_8 * (SByte)(object)factor);
+                        product.register.sbyte_9 = (SByte)(value.register.sbyte_9 * (SByte)(object)factor);
+                        product.register.sbyte_10 = (SByte)(value.register.sbyte_10 * (SByte)(object)factor);
+                        product.register.sbyte_11 = (SByte)(value.register.sbyte_11 * (SByte)(object)factor);
+                        product.register.sbyte_12 = (SByte)(value.register.sbyte_12 * (SByte)(object)factor);
+                        product.register.sbyte_13 = (SByte)(value.register.sbyte_13 * (SByte)(object)factor);
+                        product.register.sbyte_14 = (SByte)(value.register.sbyte_14 * (SByte)(object)factor);
+                        product.register.sbyte_15 = (SByte)(value.register.sbyte_15 * (SByte)(object)factor);
+                    }
+                    else if (typeof(T) == typeof(UInt16))
+                    {
+                        product.register.uint16_0 = (UInt16)(value.register.uint16_0 * (UInt16)(object)factor);
+                        product.register.uint16_1 = (UInt16)(value.register.uint16_1 * (UInt16)(object)factor);
+                        product.register.uint16_2 = (UInt16)(value.register.uint16_2 * (UInt16)(object)factor);
+                        product.register.uint16_3 = (UInt16)(value.register.uint16_3 * (UInt16)(object)factor);
+                        product.register.uint16_4 = (UInt16)(value.register.uint16_4 * (UInt16)(object)factor);
+                        product.register.uint16_5 = (UInt16)(value.register.uint16_5 * (UInt16)(object)factor);
+                        product.register.uint16_6 = (UInt16)(value.register.uint16_6 * (UInt16)(object)factor);
+                        product.register.uint16_7 = (UInt16)(value.register.uint16_7 * (UInt16)(object)factor);
+                    }
+                    else if (typeof(T) == typeof(Int16))
+                    {
+                        product.register.int16_0 = (Int16)(value.register.int16_0 * (Int16)(object)factor);
+                        product.register.int16_1 = (Int16)(value.register.int16_1 * (Int16)(object)factor);
+                        product.register.int16_2 = (Int16)(value.register.int16_2 * (Int16)(object)factor);
+                        product.register.int16_3 = (Int16)(value.register.int16_3 * (Int16)(object)factor);
+                        product.register.int16_4 = (Int16)(value.register.int16_4 * (Int16)(object)factor);
+                        product.register.int16_5 = (Int16)(value.register.int16_5 * (Int16)(object)factor);
+                        product.register.int16_6 = (Int16)(value.register.int16_6 * (Int16)(object)factor);
+                        product.register.int16_7 = (Int16)(value.register.int16_7 * (Int16)(object)factor);
+                    }
+                    else if (typeof(T) == typeof(UInt32))
+                    {
+                        product.register.uint32_0 = (UInt32)(value.register.uint32_0 * (UInt32)(object)factor);
+                        product.register.uint32_1 = (UInt32)(value.register.uint32_1 * (UInt32)(object)factor);
+                        product.register.uint32_2 = (UInt32)(value.register.uint32_2 * (UInt32)(object)factor);
+                        product.register.uint32_3 = (UInt32)(value.register.uint32_3 * (UInt32)(object)factor);
+                    }
+                    else if (typeof(T) == typeof(Int32))
+                    {
+                        product.register.int32_0 = (Int32)(value.register.int32_0 * (Int32)(object)factor);
+                        product.register.int32_1 = (Int32)(value.register.int32_1 * (Int32)(object)factor);
+                        product.register.int32_2 = (Int32)(value.register.int32_2 * (Int32)(object)factor);
+                        product.register.int32_3 = (Int32)(value.register.int32_3 * (Int32)(object)factor);
+                    }
+                    else if (typeof(T) == typeof(UInt64))
+                    {
+                        product.register.uint64_0 = (UInt64)(value.register.uint64_0 * (UInt64)(object)factor);
+                        product.register.uint64_1 = (UInt64)(value.register.uint64_1 * (UInt64)(object)factor);
+                    }
+                    else if (typeof(T) == typeof(Int64))
+                    {
+                        product.register.int64_0 = (Int64)(value.register.int64_0 * (Int64)(object)factor);
+                        product.register.int64_1 = (Int64)(value.register.int64_1 * (Int64)(object)factor);
+                    }
+                    else if (typeof(T) == typeof(Single))
+                    {
+                        product.register.single_0 = (Single)(value.register.single_0 * (Single)(object)factor);
+                        product.register.single_1 = (Single)(value.register.single_1 * (Single)(object)factor);
+                        product.register.single_2 = (Single)(value.register.single_2 * (Single)(object)factor);
+                        product.register.single_3 = (Single)(value.register.single_3 * (Single)(object)factor);
+                    }
+                    else if (typeof(T) == typeof(Double))
+                    {
+                        product.register.double_0 = (Double)(value.register.double_0 * (Double)(object)factor);
+                        product.register.double_1 = (Double)(value.register.double_1 * (Double)(object)factor);
+                    }
+                    return product;
+                }
+            }
+        }
+
+        // This method is intrinsic only for certain types. It cannot access fields directly unless we are sure the context is unaccelerated.
+        /// <summary>
+        /// Multiplies a vector by the given scalar.
+        /// </summary>
+        /// <param name="factor">The scalar value.</param>
+        /// <param name="value">The source vector.</param>
+        /// <returns>The scaled vector.</returns>
+        public static Vector<T> operator *(T factor, Vector<T> value)
+        {
+            unchecked
+            {
+                if (Vector.IsHardwareAccelerated)
+                {
+                    return new Vector<T>(factor) * value;
+                }
+                else
+                {
+                    Vector<T> product = new Vector<T>();
+                    if (typeof(T) == typeof(Byte))
+                    {
+                        product.register.byte_0 = (Byte)(value.register.byte_0 * (Byte)(object)factor);
+                        product.register.byte_1 = (Byte)(value.register.byte_1 * (Byte)(object)factor);
+                        product.register.byte_2 = (Byte)(value.register.byte_2 * (Byte)(object)factor);
+                        product.register.byte_3 = (Byte)(value.register.byte_3 * (Byte)(object)factor);
+                        product.register.byte_4 = (Byte)(value.register.byte_4 * (Byte)(object)factor);
+                        product.register.byte_5 = (Byte)(value.register.byte_5 * (Byte)(object)factor);
+                        product.register.byte_6 = (Byte)(value.register.byte_6 * (Byte)(object)factor);
+                        product.register.byte_7 = (Byte)(value.register.byte_7 * (Byte)(object)factor);
+                        product.register.byte_8 = (Byte)(value.register.byte_8 * (Byte)(object)factor);
+                        product.register.byte_9 = (Byte)(value.register.byte_9 * (Byte)(object)factor);
+                        product.register.byte_10 = (Byte)(value.register.byte_10 * (Byte)(object)factor);
+                        product.register.byte_11 = (Byte)(value.register.byte_11 * (Byte)(object)factor);
+                        product.register.byte_12 = (Byte)(value.register.byte_12 * (Byte)(object)factor);
+                        product.register.byte_13 = (Byte)(value.register.byte_13 * (Byte)(object)factor);
+                        product.register.byte_14 = (Byte)(value.register.byte_14 * (Byte)(object)factor);
+                        product.register.byte_15 = (Byte)(value.register.byte_15 * (Byte)(object)factor);
+                    }
+                    else if (typeof(T) == typeof(SByte))
+                    {
+                        product.register.sbyte_0 = (SByte)(value.register.sbyte_0 * (SByte)(object)factor);
+                        product.register.sbyte_1 = (SByte)(value.register.sbyte_1 * (SByte)(object)factor);
+                        product.register.sbyte_2 = (SByte)(value.register.sbyte_2 * (SByte)(object)factor);
+                        product.register.sbyte_3 = (SByte)(value.register.sbyte_3 * (SByte)(object)factor);
+                        product.register.sbyte_4 = (SByte)(value.register.sbyte_4 * (SByte)(object)factor);
+                        product.register.sbyte_5 = (SByte)(value.register.sbyte_5 * (SByte)(object)factor);
+                        product.register.sbyte_6 = (SByte)(value.register.sbyte_6 * (SByte)(object)factor);
+                        product.register.sbyte_7 = (SByte)(value.register.sbyte_7 * (SByte)(object)factor);
+                        product.register.sbyte_8 = (SByte)(value.register.sbyte_8 * (SByte)(object)factor);
+                        product.register.sbyte_9 = (SByte)(value.register.sbyte_9 * (SByte)(object)factor);
+                        product.register.sbyte_10 = (SByte)(value.register.sbyte_10 * (SByte)(object)factor);
+                        product.register.sbyte_11 = (SByte)(value.register.sbyte_11 * (SByte)(object)factor);
+                        product.register.sbyte_12 = (SByte)(value.register.sbyte_12 * (SByte)(object)factor);
+                        product.register.sbyte_13 = (SByte)(value.register.sbyte_13 * (SByte)(object)factor);
+                        product.register.sbyte_14 = (SByte)(value.register.sbyte_14 * (SByte)(object)factor);
+                        product.register.sbyte_15 = (SByte)(value.register.sbyte_15 * (SByte)(object)factor);
+                    }
+                    else if (typeof(T) == typeof(UInt16))
+                    {
+                        product.register.uint16_0 = (UInt16)(value.register.uint16_0 * (UInt16)(object)factor);
+                        product.register.uint16_1 = (UInt16)(value.register.uint16_1 * (UInt16)(object)factor);
+                        product.register.uint16_2 = (UInt16)(value.register.uint16_2 * (UInt16)(object)factor);
+                        product.register.uint16_3 = (UInt16)(value.register.uint16_3 * (UInt16)(object)factor);
+                        product.register.uint16_4 = (UInt16)(value.register.uint16_4 * (UInt16)(object)factor);
+                        product.register.uint16_5 = (UInt16)(value.register.uint16_5 * (UInt16)(object)factor);
+                        product.register.uint16_6 = (UInt16)(value.register.uint16_6 * (UInt16)(object)factor);
+                        product.register.uint16_7 = (UInt16)(value.register.uint16_7 * (UInt16)(object)factor);
+                    }
+                    else if (typeof(T) == typeof(Int16))
+                    {
+                        product.register.int16_0 = (Int16)(value.register.int16_0 * (Int16)(object)factor);
+                        product.register.int16_1 = (Int16)(value.register.int16_1 * (Int16)(object)factor);
+                        product.register.int16_2 = (Int16)(value.register.int16_2 * (Int16)(object)factor);
+                        product.register.int16_3 = (Int16)(value.register.int16_3 * (Int16)(object)factor);
+                        product.register.int16_4 = (Int16)(value.register.int16_4 * (Int16)(object)factor);
+                        product.register.int16_5 = (Int16)(value.register.int16_5 * (Int16)(object)factor);
+                        product.register.int16_6 = (Int16)(value.register.int16_6 * (Int16)(object)factor);
+                        product.register.int16_7 = (Int16)(value.register.int16_7 * (Int16)(object)factor);
+                    }
+                    else if (typeof(T) == typeof(UInt32))
+                    {
+                        product.register.uint32_0 = (UInt32)(value.register.uint32_0 * (UInt32)(object)factor);
+                        product.register.uint32_1 = (UInt32)(value.register.uint32_1 * (UInt32)(object)factor);
+                        product.register.uint32_2 = (UInt32)(value.register.uint32_2 * (UInt32)(object)factor);
+                        product.register.uint32_3 = (UInt32)(value.register.uint32_3 * (UInt32)(object)factor);
+                    }
+                    else if (typeof(T) == typeof(Int32))
+                    {
+                        product.register.int32_0 = (Int32)(value.register.int32_0 * (Int32)(object)factor);
+                        product.register.int32_1 = (Int32)(value.register.int32_1 * (Int32)(object)factor);
+                        product.register.int32_2 = (Int32)(value.register.int32_2 * (Int32)(object)factor);
+                        product.register.int32_3 = (Int32)(value.register.int32_3 * (Int32)(object)factor);
+                    }
+                    else if (typeof(T) == typeof(UInt64))
+                    {
+                        product.register.uint64_0 = (UInt64)(value.register.uint64_0 * (UInt64)(object)factor);
+                        product.register.uint64_1 = (UInt64)(value.register.uint64_1 * (UInt64)(object)factor);
+                    }
+                    else if (typeof(T) == typeof(Int64))
+                    {
+                        product.register.int64_0 = (Int64)(value.register.int64_0 * (Int64)(object)factor);
+                        product.register.int64_1 = (Int64)(value.register.int64_1 * (Int64)(object)factor);
+                    }
+                    else if (typeof(T) == typeof(Single))
+                    {
+                        product.register.single_0 = (Single)(value.register.single_0 * (Single)(object)factor);
+                        product.register.single_1 = (Single)(value.register.single_1 * (Single)(object)factor);
+                        product.register.single_2 = (Single)(value.register.single_2 * (Single)(object)factor);
+                        product.register.single_3 = (Single)(value.register.single_3 * (Single)(object)factor);
+                    }
+                    else if (typeof(T) == typeof(Double))
+                    {
+                        product.register.double_0 = (Double)(value.register.double_0 * (Double)(object)factor);
+                        product.register.double_1 = (Double)(value.register.double_1 * (Double)(object)factor);
+                    }
+                    return product;
+                }
+            }
+        }
+
+        // This method is intrinsic only for certain types. It cannot access fields directly unless we are sure the context is unaccelerated.
+        /// <summary>
+        /// Divides the first vector by the second.
+        /// </summary>
+        /// <param name="left">The first source vector.</param>
+        /// <param name="right">The second source vector.</param>
+        /// <returns>The vector resulting from the division.</returns>
+        public static unsafe Vector<T> operator /(Vector<T> left, Vector<T> right)
+        {
+            unchecked
+            {
+                if (Vector.IsHardwareAccelerated)
+                {
+                    if (typeof(T) == typeof(Byte))
+                    {
+                        Byte* dataPtr = stackalloc Byte[Count];
+                        for (int g = 0; g < Count; g++)
+                        {
+                            dataPtr[g] = (Byte)(object)ScalarDivide(left[g], right[g]);
+                        }
+                        return new Vector<T>(dataPtr);
+                    }
+                    else if (typeof(T) == typeof(SByte))
+                    {
+                        SByte* dataPtr = stackalloc SByte[Count];
+                        for (int g = 0; g < Count; g++)
+                        {
+                            dataPtr[g] = (SByte)(object)ScalarDivide(left[g], right[g]);
+                        }
+                        return new Vector<T>(dataPtr);
+                    }
+                    else if (typeof(T) == typeof(UInt16))
+                    {
+                        UInt16* dataPtr = stackalloc UInt16[Count];
+                        for (int g = 0; g < Count; g++)
+                        {
+                            dataPtr[g] = (UInt16)(object)ScalarDivide(left[g], right[g]);
+                        }
+                        return new Vector<T>(dataPtr);
+                    }
+                    else if (typeof(T) == typeof(Int16))
+                    {
+                        Int16* dataPtr = stackalloc Int16[Count];
+                        for (int g = 0; g < Count; g++)
+                        {
+                            dataPtr[g] = (Int16)(object)ScalarDivide(left[g], right[g]);
+                        }
+                        return new Vector<T>(dataPtr);
+                    }
+                    else if (typeof(T) == typeof(UInt32))
+                    {
+                        UInt32* dataPtr = stackalloc UInt32[Count];
+                        for (int g = 0; g < Count; g++)
+                        {
+                            dataPtr[g] = (UInt32)(object)ScalarDivide(left[g], right[g]);
+                        }
+                        return new Vector<T>(dataPtr);
+                    }
+                    else if (typeof(T) == typeof(Int32))
+                    {
+                        Int32* dataPtr = stackalloc Int32[Count];
+                        for (int g = 0; g < Count; g++)
+                        {
+                            dataPtr[g] = (Int32)(object)ScalarDivide(left[g], right[g]);
+                        }
+                        return new Vector<T>(dataPtr);
+                    }
+                    else if (typeof(T) == typeof(UInt64))
+                    {
+                        UInt64* dataPtr = stackalloc UInt64[Count];
+                        for (int g = 0; g < Count; g++)
+                        {
+                            dataPtr[g] = (UInt64)(object)ScalarDivide(left[g], right[g]);
+                        }
+                        return new Vector<T>(dataPtr);
+                    }
+                    else if (typeof(T) == typeof(Int64))
+                    {
+                        Int64* dataPtr = stackalloc Int64[Count];
+                        for (int g = 0; g < Count; g++)
+                        {
+                            dataPtr[g] = (Int64)(object)ScalarDivide(left[g], right[g]);
+                        }
+                        return new Vector<T>(dataPtr);
+                    }
+                    else if (typeof(T) == typeof(Single))
+                    {
+                        Single* dataPtr = stackalloc Single[Count];
+                        for (int g = 0; g < Count; g++)
+                        {
+                            dataPtr[g] = (Single)(object)ScalarDivide(left[g], right[g]);
+                        }
+                        return new Vector<T>(dataPtr);
+                    }
+                    else if (typeof(T) == typeof(Double))
+                    {
+                        Double* dataPtr = stackalloc Double[Count];
+                        for (int g = 0; g < Count; g++)
+                        {
+                            dataPtr[g] = (Double)(object)ScalarDivide(left[g], right[g]);
+                        }
+                        return new Vector<T>(dataPtr);
+                    }
+                    else
+                    {
+                        throw new NotSupportedException(SR.Arg_TypeNotSupported);
+                    }
+                }
+                else
+                {
+                    Vector<T> quotient = new Vector<T>();
+                    if (typeof(T) == typeof(Byte))
+                    {
+                        quotient.register.byte_0 = (Byte)(left.register.byte_0 / right.register.byte_0);
+                        quotient.register.byte_1 = (Byte)(left.register.byte_1 / right.register.byte_1);
+                        quotient.register.byte_2 = (Byte)(left.register.byte_2 / right.register.byte_2);
+                        quotient.register.byte_3 = (Byte)(left.register.byte_3 / right.register.byte_3);
+                        quotient.register.byte_4 = (Byte)(left.register.byte_4 / right.register.byte_4);
+                        quotient.register.byte_5 = (Byte)(left.register.byte_5 / right.register.byte_5);
+                        quotient.register.byte_6 = (Byte)(left.register.byte_6 / right.register.byte_6);
+                        quotient.register.byte_7 = (Byte)(left.register.byte_7 / right.register.byte_7);
+                        quotient.register.byte_8 = (Byte)(left.register.byte_8 / right.register.byte_8);
+                        quotient.register.byte_9 = (Byte)(left.register.byte_9 / right.register.byte_9);
+                        quotient.register.byte_10 = (Byte)(left.register.byte_10 / right.register.byte_10);
+                        quotient.register.byte_11 = (Byte)(left.register.byte_11 / right.register.byte_11);
+                        quotient.register.byte_12 = (Byte)(left.register.byte_12 / right.register.byte_12);
+                        quotient.register.byte_13 = (Byte)(left.register.byte_13 / right.register.byte_13);
+                        quotient.register.byte_14 = (Byte)(left.register.byte_14 / right.register.byte_14);
+                        quotient.register.byte_15 = (Byte)(left.register.byte_15 / right.register.byte_15);
+                    }
+                    else if (typeof(T) == typeof(SByte))
+                    {
+                        quotient.register.sbyte_0 = (SByte)(left.register.sbyte_0 / right.register.sbyte_0);
+                        quotient.register.sbyte_1 = (SByte)(left.register.sbyte_1 / right.register.sbyte_1);
+                        quotient.register.sbyte_2 = (SByte)(left.register.sbyte_2 / right.register.sbyte_2);
+                        quotient.register.sbyte_3 = (SByte)(left.register.sbyte_3 / right.register.sbyte_3);
+                        quotient.register.sbyte_4 = (SByte)(left.register.sbyte_4 / right.register.sbyte_4);
+                        quotient.register.sbyte_5 = (SByte)(left.register.sbyte_5 / right.register.sbyte_5);
+                        quotient.register.sbyte_6 = (SByte)(left.register.sbyte_6 / right.register.sbyte_6);
+                        quotient.register.sbyte_7 = (SByte)(left.register.sbyte_7 / right.register.sbyte_7);
+                        quotient.register.sbyte_8 = (SByte)(left.register.sbyte_8 / right.register.sbyte_8);
+                        quotient.register.sbyte_9 = (SByte)(left.register.sbyte_9 / right.register.sbyte_9);
+                        quotient.register.sbyte_10 = (SByte)(left.register.sbyte_10 / right.register.sbyte_10);
+                        quotient.register.sbyte_11 = (SByte)(left.register.sbyte_11 / right.register.sbyte_11);
+                        quotient.register.sbyte_12 = (SByte)(left.register.sbyte_12 / right.register.sbyte_12);
+                        quotient.register.sbyte_13 = (SByte)(left.register.sbyte_13 / right.register.sbyte_13);
+                        quotient.register.sbyte_14 = (SByte)(left.register.sbyte_14 / right.register.sbyte_14);
+                        quotient.register.sbyte_15 = (SByte)(left.register.sbyte_15 / right.register.sbyte_15);
+                    }
+                    else if (typeof(T) == typeof(UInt16))
+                    {
+                        quotient.register.uint16_0 = (UInt16)(left.register.uint16_0 / right.register.uint16_0);
+                        quotient.register.uint16_1 = (UInt16)(left.register.uint16_1 / right.register.uint16_1);
+                        quotient.register.uint16_2 = (UInt16)(left.register.uint16_2 / right.register.uint16_2);
+                        quotient.register.uint16_3 = (UInt16)(left.register.uint16_3 / right.register.uint16_3);
+                        quotient.register.uint16_4 = (UInt16)(left.register.uint16_4 / right.register.uint16_4);
+                        quotient.register.uint16_5 = (UInt16)(left.register.uint16_5 / right.register.uint16_5);
+                        quotient.register.uint16_6 = (UInt16)(left.register.uint16_6 / right.register.uint16_6);
+                        quotient.register.uint16_7 = (UInt16)(left.register.uint16_7 / right.register.uint16_7);
+                    }
+                    else if (typeof(T) == typeof(Int16))
+                    {
+                        quotient.register.int16_0 = (Int16)(left.register.int16_0 / right.register.int16_0);
+                        quotient.register.int16_1 = (Int16)(left.register.int16_1 / right.register.int16_1);
+                        quotient.register.int16_2 = (Int16)(left.register.int16_2 / right.register.int16_2);
+                        quotient.register.int16_3 = (Int16)(left.register.int16_3 / right.register.int16_3);
+                        quotient.register.int16_4 = (Int16)(left.register.int16_4 / right.register.int16_4);
+                        quotient.register.int16_5 = (Int16)(left.register.int16_5 / right.register.int16_5);
+                        quotient.register.int16_6 = (Int16)(left.register.int16_6 / right.register.int16_6);
+                        quotient.register.int16_7 = (Int16)(left.register.int16_7 / right.register.int16_7);
+                    }
+                    else if (typeof(T) == typeof(UInt32))
+                    {
+                        quotient.register.uint32_0 = (UInt32)(left.register.uint32_0 / right.register.uint32_0);
+                        quotient.register.uint32_1 = (UInt32)(left.register.uint32_1 / right.register.uint32_1);
+                        quotient.register.uint32_2 = (UInt32)(left.register.uint32_2 / right.register.uint32_2);
+                        quotient.register.uint32_3 = (UInt32)(left.register.uint32_3 / right.register.uint32_3);
+                    }
+                    else if (typeof(T) == typeof(Int32))
+                    {
+                        quotient.register.int32_0 = (Int32)(left.register.int32_0 / right.register.int32_0);
+                        quotient.register.int32_1 = (Int32)(left.register.int32_1 / right.register.int32_1);
+                        quotient.register.int32_2 = (Int32)(left.register.int32_2 / right.register.int32_2);
+                        quotient.register.int32_3 = (Int32)(left.register.int32_3 / right.register.int32_3);
+                    }
+                    else if (typeof(T) == typeof(UInt64))
+                    {
+                        quotient.register.uint64_0 = (UInt64)(left.register.uint64_0 / right.register.uint64_0);
+                        quotient.register.uint64_1 = (UInt64)(left.register.uint64_1 / right.register.uint64_1);
+                    }
+                    else if (typeof(T) == typeof(Int64))
+                    {
+                        quotient.register.int64_0 = (Int64)(left.register.int64_0 / right.register.int64_0);
+                        quotient.register.int64_1 = (Int64)(left.register.int64_1 / right.register.int64_1);
+                    }
+                    else if (typeof(T) == typeof(Single))
+                    {
+                        quotient.register.single_0 = (Single)(left.register.single_0 / right.register.single_0);
+                        quotient.register.single_1 = (Single)(left.register.single_1 / right.register.single_1);
+                        quotient.register.single_2 = (Single)(left.register.single_2 / right.register.single_2);
+                        quotient.register.single_3 = (Single)(left.register.single_3 / right.register.single_3);
+                    }
+                    else if (typeof(T) == typeof(Double))
+                    {
+                        quotient.register.double_0 = (Double)(left.register.double_0 / right.register.double_0);
+                        quotient.register.double_1 = (Double)(left.register.double_1 / right.register.double_1);
+                    }
+                    return quotient;
+                }
+            }
+        }
+
+        /// <summary>
+        /// Negates a given vector.
+        /// </summary>
+        /// <param name="value">The source vector.</param>
+        /// <returns>The negated vector.</returns>
+        public static Vector<T> operator -(Vector<T> value)
+        {
+            return Zero - value;
+        }
+        #endregion Arithmetic Operators
+
+        #region Bitwise Operators
+        /// <summary>
+        /// Returns a new vector by performing a bitwise-and operation on each of the elements in the given vectors.
+        /// </summary>
+        /// <param name="left">The first source vector.</param>
+        /// <param name="right">The second source vector.</param>
+        /// <returns>The resultant vector.</returns>
+        [JitIntrinsic]
+        public static unsafe Vector<T> operator &(Vector<T> left, Vector<T> right)
+        {
+            Vector<T> result = new Vector<T>();
+            unchecked
+            {
+                if (Vector.IsHardwareAccelerated)
+                {
+                    Int64* resultBase = &result.register.int64_0;
+                    Int64* leftBase = &left.register.int64_0;
+                    Int64* rightBase = &right.register.int64_0;
+                    for (int g = 0; g < Vector<Int64>.Count; g++)
+                    {
+                        resultBase[g] = leftBase[g] & rightBase[g];
+                    }
+                }
+                else
+                {
+                    result.register.int64_0 = left.register.int64_0 & right.register.int64_0;
+                    result.register.int64_1 = left.register.int64_1 & right.register.int64_1;
+                }
+            }
+            return result;
+        }
+
+        /// <summary>
+        /// Returns a new vector by performing a bitwise-or operation on each of the elements in the given vectors.
+        /// </summary>
+        /// <param name="left">The first source vector.</param>
+        /// <param name="right">The second source vector.</param>
+        /// <returns>The resultant vector.</returns>
+        [JitIntrinsic]
+        public static unsafe Vector<T> operator |(Vector<T> left, Vector<T> right)
+        {
+            Vector<T> result = new Vector<T>();
+            unchecked
+            {
+                if (Vector.IsHardwareAccelerated)
+                {
+                    Int64* resultBase = &result.register.int64_0;
+                    Int64* leftBase = &left.register.int64_0;
+                    Int64* rightBase = &right.register.int64_0;
+                    for (int g = 0; g < Vector<Int64>.Count; g++)
+                    {
+                        resultBase[g] = leftBase[g] | rightBase[g];
+                    }
+                }
+                else
+                {
+                    result.register.int64_0 = left.register.int64_0 | right.register.int64_0;
+                    result.register.int64_1 = left.register.int64_1 | right.register.int64_1;
+                }
+            }
+            return result;
+        }
+
+        /// <summary>
+        /// Returns a new vector by performing a bitwise-exclusive-or operation on each of the elements in the given vectors.
+        /// </summary>
+        /// <param name="left">The first source vector.</param>
+        /// <param name="right">The second source vector.</param>
+        /// <returns>The resultant vector.</returns>
+        [JitIntrinsic]
+        public static unsafe Vector<T> operator ^(Vector<T> left, Vector<T> right)
+        {
+            Vector<T> result = new Vector<T>();
+            unchecked
+            {
+                if (Vector.IsHardwareAccelerated)
+                {
+                    Int64* resultBase = &result.register.int64_0;
+                    Int64* leftBase = &left.register.int64_0;
+                    Int64* rightBase = &right.register.int64_0;
+                    for (int g = 0; g < Vector<Int64>.Count; g++)
+                    {
+                        resultBase[g] = leftBase[g] ^ rightBase[g];
+                    }
+                }
+                else
+                {
+                    result.register.int64_0 = left.register.int64_0 ^ right.register.int64_0;
+                    result.register.int64_1 = left.register.int64_1 ^ right.register.int64_1;
+                }
+            }
+            return result;
+        }
+
+        /// <summary>
+        /// Returns a new vector whose elements are obtained by taking the one's complement of the given vector's elements.
+        /// </summary>
+        /// <param name="value">The source vector.</param>
+        /// <returns>The one's complement vector.</returns>
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static Vector<T> operator ~(Vector<T> value)
+        {
+            return allOnes ^ value;
+        }
+        #endregion Bitwise Operators
+
+        #region Logical Operators
+        /// <summary>
+        /// Returns a boolean indicating whether each pair of elements in the given vectors are equal.
+        /// </summary>
+        /// <param name="left">The first vector to compare.</param>
+        /// <param name="right">The first vector to compare.</param>
+        /// <returns>True if all elements are equal; False otherwise.</returns>
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static bool operator ==(Vector<T> left, Vector<T> right)
+        {
+            return left.Equals(right);
+        }
+
+        /// <summary>
+        /// Returns a boolean indicating whether any single pair of elements in the given vectors are equal.
+        /// </summary>
+        /// <param name="left">The first vector to compare.</param>
+        /// <param name="right">The second vector to compare.</param>
+        /// <returns>True if any element pairs are equal; False if no element pairs are equal.</returns>
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static bool operator !=(Vector<T> left, Vector<T> right)
+        {
+            return !(left == right);
+        }
+        #endregion Logical Operators
+
+        #region Conversions
+        /// <summary>
+        /// Reinterprets the bits of the given vector into those of another type.
+        /// </summary>
+        /// <param name="value">The source vector</param>
+        /// <returns>The reinterpreted vector.</returns>
+        [JitIntrinsic]
+        public static explicit operator Vector<Byte>(Vector<T> value)
+        {
+            return new Vector<Byte>(ref value.register);
+        }
+
+        /// <summary>
+        /// Reinterprets the bits of the given vector into those of another type.
+        /// </summary>
+        /// <param name="value">The source vector</param>
+        /// <returns>The reinterpreted vector.</returns>
+        [CLSCompliant(false)]
+        [JitIntrinsic]
+        public static explicit operator Vector<SByte>(Vector<T> value)
+        {
+            return new Vector<SByte>(ref value.register);
+        }
+
+        /// <summary>
+        /// Reinterprets the bits of the given vector into those of another type.
+        /// </summary>
+        /// <param name="value">The source vector</param>
+        /// <returns>The reinterpreted vector.</returns>
+        [CLSCompliant(false)]
+        [JitIntrinsic]
+        public static explicit operator Vector<UInt16>(Vector<T> value)
+        {
+            return new Vector<UInt16>(ref value.register);
+        }
+
+        /// <summary>
+        /// Reinterprets the bits of the given vector into those of another type.
+        /// </summary>
+        /// <param name="value">The source vector</param>
+        /// <returns>The reinterpreted vector.</returns>
+        [JitIntrinsic]
+        public static explicit operator Vector<Int16>(Vector<T> value)
+        {
+            return new Vector<Int16>(ref value.register);
+        }
+
+        /// <summary>
+        /// Reinterprets the bits of the given vector into those of another type.
+        /// </summary>
+        /// <param name="value">The source vector</param>
+        /// <returns>The reinterpreted vector.</returns>
+        [CLSCompliant(false)]
+        [JitIntrinsic]
+        public static explicit operator Vector<UInt32>(Vector<T> value)
+        {
+            return new Vector<UInt32>(ref value.register);
+        }
+
+        /// <summary>
+        /// Reinterprets the bits of the given vector into those of another type.
+        /// </summary>
+        /// <param name="value">The source vector</param>
+        /// <returns>The reinterpreted vector.</returns>
+        [JitIntrinsic]
+        public static explicit operator Vector<Int32>(Vector<T> value)
+        {
+            return new Vector<Int32>(ref value.register);
+        }
+
+        /// <summary>
+        /// Reinterprets the bits of the given vector into those of another type.
+        /// </summary>
+        /// <param name="value">The source vector</param>
+        /// <returns>The reinterpreted vector.</returns>
+        [CLSCompliant(false)]
+        [JitIntrinsic]
+        public static explicit operator Vector<UInt64>(Vector<T> value)
+        {
+            return new Vector<UInt64>(ref value.register);
+        }
+
+        /// <summary>
+        /// Reinterprets the bits of the given vector into those of another type.
+        /// </summary>
+        /// <param name="value">The source vector</param>
+        /// <returns>The reinterpreted vector.</returns>
+        [JitIntrinsic]
+        public static explicit operator Vector<Int64>(Vector<T> value)
+        {
+            return new Vector<Int64>(ref value.register);
+        }
+
+        /// <summary>
+        /// Reinterprets the bits of the given vector into those of another type.
+        /// </summary>
+        /// <param name="value">The source vector</param>
+        /// <returns>The reinterpreted vector.</returns>
+        [JitIntrinsic]
+        public static explicit operator Vector<Single>(Vector<T> value)
+        {
+            return new Vector<Single>(ref value.register);
+        }
+
+        /// <summary>
+        /// Reinterprets the bits of the given vector into those of another type.
+        /// </summary>
+        /// <param name="value">The source vector</param>
+        /// <returns>The reinterpreted vector.</returns>
+        [JitIntrinsic]
+        public static explicit operator Vector<Double>(Vector<T> value)
+        {
+            return new Vector<Double>(ref value.register);
+        }
+
+        #endregion Conversions
+
+        #region Internal Comparison Methods
+        [JitIntrinsic]
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        internal static unsafe Vector<T> Equals(Vector<T> left, Vector<T> right)
+        {
+            if (Vector.IsHardwareAccelerated)
+            {
+                if (typeof(T) == typeof(Byte))
+                {
+                    Byte* dataPtr = stackalloc Byte[Count];
+                    for (int g = 0; g < Count; g++)
+                    {
+                        dataPtr[g] = ScalarEquals(left[g], right[g]) ? ConstantHelper.GetByteWithAllBitsSet() : (Byte)0;
+                    }
+                    return new Vector<T>(dataPtr);
+                }
+                else if (typeof(T) == typeof(SByte))
+                {
+                    SByte* dataPtr = stackalloc SByte[Count];
+                    for (int g = 0; g < Count; g++)
+                    {
+                        dataPtr[g] = ScalarEquals(left[g], right[g]) ? ConstantHelper.GetSByteWithAllBitsSet() : (SByte)0;
+                    }
+                    return new Vector<T>(dataPtr);
+                }
+                else if (typeof(T) == typeof(UInt16))
+                {
+                    UInt16* dataPtr = stackalloc UInt16[Count];
+                    for (int g = 0; g < Count; g++)
+                    {
+                        dataPtr[g] = ScalarEquals(left[g], right[g]) ? ConstantHelper.GetUInt16WithAllBitsSet() : (UInt16)0;
+                    }
+                    return new Vector<T>(dataPtr);
+                }
+                else if (typeof(T) == typeof(Int16))
+                {
+                    Int16* dataPtr = stackalloc Int16[Count];
+                    for (int g = 0; g < Count; g++)
+                    {
+                        dataPtr[g] = ScalarEquals(left[g], right[g]) ? ConstantHelper.GetInt16WithAllBitsSet() : (Int16)0;
+                    }
+                    return new Vector<T>(dataPtr);
+                }
+                else if (typeof(T) == typeof(UInt32))
+                {
+                    UInt32* dataPtr = stackalloc UInt32[Count];
+                    for (int g = 0; g < Count; g++)
+                    {
+                        dataPtr[g] = ScalarEquals(left[g], right[g]) ? ConstantHelper.GetUInt32WithAllBitsSet() : (UInt32)0;
+                    }
+                    return new Vector<T>(dataPtr);
+                }
+                else if (typeof(T) == typeof(Int32))
+                {
+                    Int32* dataPtr = stackalloc Int32[Count];
+                    for (int g = 0; g < Count; g++)
+                    {
+                        dataPtr[g] = ScalarEquals(left[g], right[g]) ? ConstantHelper.GetInt32WithAllBitsSet() : (Int32)0;
+                    }
+                    return new Vector<T>(dataPtr);
+                }
+                else if (typeof(T) == typeof(UInt64))
+                {
+                    UInt64* dataPtr = stackalloc UInt64[Count];
+                    for (int g = 0; g < Count; g++)
+                    {
+                        dataPtr[g] = ScalarEquals(left[g], right[g]) ? ConstantHelper.GetUInt64WithAllBitsSet() : (UInt64)0;
+                    }
+                    return new Vector<T>(dataPtr);
+                }
+                else if (typeof(T) == typeof(Int64))
+                {
+                    Int64* dataPtr = stackalloc Int64[Count];
+                    for (int g = 0; g < Count; g++)
+                    {
+                        dataPtr[g] = ScalarEquals(left[g], right[g]) ? ConstantHelper.GetInt64WithAllBitsSet() : (Int64)0;
+                    }
+                    return new Vector<T>(dataPtr);
+                }
+                else if (typeof(T) == typeof(Single))
+                {
+                    Single* dataPtr = stackalloc Single[Count];
+                    for (int g = 0; g < Count; g++)
+                    {
+                        dataPtr[g] = ScalarEquals(left[g], right[g]) ? ConstantHelper.GetSingleWithAllBitsSet() : (Single)0;
+                    }
+                    return new Vector<T>(dataPtr);
+                }
+                else if (typeof(T) == typeof(Double))
+                {
+                    Double* dataPtr = stackalloc Double[Count];
+                    for (int g = 0; g < Count; g++)
+                    {
+                        dataPtr[g] = ScalarEquals(left[g], right[g]) ? ConstantHelper.GetDoubleWithAllBitsSet() : (Double)0;
+                    }
+                    return new Vector<T>(dataPtr);
+                }
+                else
+                {
+                    throw new NotSupportedException(SR.Arg_TypeNotSupported);
+                }
+            }
+            else
+            {
+                Register register = new Register();
+                if (typeof(T) == typeof(Byte))
+                {
+                    register.byte_0 = left.register.byte_0 == right.register.byte_0 ? ConstantHelper.GetByteWithAllBitsSet() : (Byte)0;
+                    register.byte_1 = left.register.byte_1 == right.register.byte_1 ? ConstantHelper.GetByteWithAllBitsSet() : (Byte)0;
+                    register.byte_2 = left.register.byte_2 == right.register.byte_2 ? ConstantHelper.GetByteWithAllBitsSet() : (Byte)0;
+                    register.byte_3 = left.register.byte_3 == right.register.byte_3 ? ConstantHelper.GetByteWithAllBitsSet() : (Byte)0;
+                    register.byte_4 = left.register.byte_4 == right.register.byte_4 ? ConstantHelper.GetByteWithAllBitsSet() : (Byte)0;
+                    register.byte_5 = left.register.byte_5 == right.register.byte_5 ? ConstantHelper.GetByteWithAllBitsSet() : (Byte)0;
+                    register.byte_6 = left.register.byte_6 == right.register.byte_6 ? ConstantHelper.GetByteWithAllBitsSet() : (Byte)0;
+                    register.byte_7 = left.register.byte_7 == right.register.byte_7 ? ConstantHelper.GetByteWithAllBitsSet() : (Byte)0;
+                    register.byte_8 = left.register.byte_8 == right.register.byte_8 ? ConstantHelper.GetByteWithAllBitsSet() : (Byte)0;
+                    register.byte_9 = left.register.byte_9 == right.register.byte_9 ? ConstantHelper.GetByteWithAllBitsSet() : (Byte)0;
+                    register.byte_10 = left.register.byte_10 == right.register.byte_10 ? ConstantHelper.GetByteWithAllBitsSet() : (Byte)0;
+                    register.byte_11 = left.register.byte_11 == right.register.byte_11 ? ConstantHelper.GetByteWithAllBitsSet() : (Byte)0;
+                    register.byte_12 = left.register.byte_12 == right.register.byte_12 ? ConstantHelper.GetByteWithAllBitsSet() : (Byte)0;
+                    register.byte_13 = left.register.byte_13 == right.register.byte_13 ? ConstantHelper.GetByteWithAllBitsSet() : (Byte)0;
+                    register.byte_14 = left.register.byte_14 == right.register.byte_14 ? ConstantHelper.GetByteWithAllBitsSet() : (Byte)0;
+                    register.byte_15 = left.register.byte_15 == right.register.byte_15 ? ConstantHelper.GetByteWithAllBitsSet() : (Byte)0;
+                    return new Vector<T>(ref register);
+                }
+                else if (typeof(T) == typeof(SByte))
+                {
+                    register.sbyte_0 = left.register.sbyte_0 == right.register.sbyte_0 ? ConstantHelper.GetSByteWithAllBitsSet() : (SByte)0;
+                    register.sbyte_1 = left.register.sbyte_1 == right.register.sbyte_1 ? ConstantHelper.GetSByteWithAllBitsSet() : (SByte)0;
+                    register.sbyte_2 = left.register.sbyte_2 == right.register.sbyte_2 ? ConstantHelper.GetSByteWithAllBitsSet() : (SByte)0;
+                    register.sbyte_3 = left.register.sbyte_3 == right.register.sbyte_3 ? ConstantHelper.GetSByteWithAllBitsSet() : (SByte)0;
+                    register.sbyte_4 = left.register.sbyte_4 == right.register.sbyte_4 ? ConstantHelper.GetSByteWithAllBitsSet() : (SByte)0;
+                    register.sbyte_5 = left.register.sbyte_5 == right.register.sbyte_5 ? ConstantHelper.GetSByteWithAllBitsSet() : (SByte)0;
+                    register.sbyte_6 = left.register.sbyte_6 == right.register.sbyte_6 ? ConstantHelper.GetSByteWithAllBitsSet() : (SByte)0;
+                    register.sbyte_7 = left.register.sbyte_7 == right.register.sbyte_7 ? ConstantHelper.GetSByteWithAllBitsSet() : (SByte)0;
+                    register.sbyte_8 = left.register.sbyte_8 == right.register.sbyte_8 ? ConstantHelper.GetSByteWithAllBitsSet() : (SByte)0;
+                    register.sbyte_9 = left.register.sbyte_9 == right.register.sbyte_9 ? ConstantHelper.GetSByteWithAllBitsSet() : (SByte)0;
+                    register.sbyte_10 = left.register.sbyte_10 == right.register.sbyte_10 ? ConstantHelper.GetSByteWithAllBitsSet() : (SByte)0;
+                    register.sbyte_11 = left.register.sbyte_11 == right.register.sbyte_11 ? ConstantHelper.GetSByteWithAllBitsSet() : (SByte)0;
+                    register.sbyte_12 = left.register.sbyte_12 == right.register.sbyte_12 ? ConstantHelper.GetSByteWithAllBitsSet() : (SByte)0;
+                    register.sbyte_13 = left.register.sbyte_13 == right.register.sbyte_13 ? ConstantHelper.GetSByteWithAllBitsSet() : (SByte)0;
+                    register.sbyte_14 = left.register.sbyte_14 == right.register.sbyte_14 ? ConstantHelper.GetSByteWithAllBitsSet() : (SByte)0;
+                    register.sbyte_15 = left.register.sbyte_15 == right.register.sbyte_15 ? ConstantHelper.GetSByteWithAllBitsSet() : (SByte)0;
+                    return new Vector<T>(ref register);
+                }
+                else if (typeof(T) == typeof(UInt16))
+                {
+                    register.uint16_0 = left.register.uint16_0 == right.register.uint16_0 ? ConstantHelper.GetUInt16WithAllBitsSet() : (UInt16)0;
+                    register.uint16_1 = left.register.uint16_1 == right.register.uint16_1 ? ConstantHelper.GetUInt16WithAllBitsSet() : (UInt16)0;
+                    register.uint16_2 = left.register.uint16_2 == right.register.uint16_2 ? ConstantHelper.GetUInt16WithAllBitsSet() : (UInt16)0;
+                    register.uint16_3 = left.register.uint16_3 == right.register.uint16_3 ? ConstantHelper.GetUInt16WithAllBitsSet() : (UInt16)0;
+                    register.uint16_4 = left.register.uint16_4 == right.register.uint16_4 ? ConstantHelper.GetUInt16WithAllBitsSet() : (UInt16)0;
+                    register.uint16_5 = left.register.uint16_5 == right.register.uint16_5 ? ConstantHelper.GetUInt16WithAllBitsSet() : (UInt16)0;
+                    register.uint16_6 = left.register.uint16_6 == right.register.uint16_6 ? ConstantHelper.GetUInt16WithAllBitsSet() : (UInt16)0;
+                    register.uint16_7 = left.register.uint16_7 == right.register.uint16_7 ? ConstantHelper.GetUInt16WithAllBitsSet() : (UInt16)0;
+                    return new Vector<T>(ref register);
+                }
+                else if (typeof(T) == typeof(Int16))
+                {
+                    register.int16_0 = left.register.int16_0 == right.register.int16_0 ? ConstantHelper.GetInt16WithAllBitsSet() : (Int16)0;
+                    register.int16_1 = left.register.int16_1 == right.register.int16_1 ? ConstantHelper.GetInt16WithAllBitsSet() : (Int16)0;
+                    register.int16_2 = left.register.int16_2 == right.register.int16_2 ? ConstantHelper.GetInt16WithAllBitsSet() : (Int16)0;
+                    register.int16_3 = left.register.int16_3 == right.register.int16_3 ? ConstantHelper.GetInt16WithAllBitsSet() : (Int16)0;
+                    register.int16_4 = left.register.int16_4 == right.register.int16_4 ? ConstantHelper.GetInt16WithAllBitsSet() : (Int16)0;
+                    register.int16_5 = left.register.int16_5 == right.register.int16_5 ? ConstantHelper.GetInt16WithAllBitsSet() : (Int16)0;
+                    register.int16_6 = left.register.int16_6 == right.register.int16_6 ? ConstantHelper.GetInt16WithAllBitsSet() : (Int16)0;
+                    register.int16_7 = left.register.int16_7 == right.register.int16_7 ? ConstantHelper.GetInt16WithAllBitsSet() : (Int16)0;
+                    return new Vector<T>(ref register);
+                }
+                else if (typeof(T) == typeof(UInt32))
+                {
+                    register.uint32_0 = left.register.uint32_0 == right.register.uint32_0 ? ConstantHelper.GetUInt32WithAllBitsSet() : (UInt32)0;
+                    register.uint32_1 = left.register.uint32_1 == right.register.uint32_1 ? ConstantHelper.GetUInt32WithAllBitsSet() : (UInt32)0;
+                    register.uint32_2 = left.register.uint32_2 == right.register.uint32_2 ? ConstantHelper.GetUInt32WithAllBitsSet() : (UInt32)0;
+                    register.uint32_3 = left.register.uint32_3 == right.register.uint32_3 ? ConstantHelper.GetUInt32WithAllBitsSet() : (UInt32)0;
+                    return new Vector<T>(ref register);
+                }
+                else if (typeof(T) == typeof(Int32))
+                {
+                    register.int32_0 = left.register.int32_0 == right.register.int32_0 ? ConstantHelper.GetInt32WithAllBitsSet() : (Int32)0;
+                    register.int32_1 = left.register.int32_1 == right.register.int32_1 ? ConstantHelper.GetInt32WithAllBitsSet() : (Int32)0;
+                    register.int32_2 = left.register.int32_2 == right.register.int32_2 ? ConstantHelper.GetInt32WithAllBitsSet() : (Int32)0;
+                    register.int32_3 = left.register.int32_3 == right.register.int32_3 ? ConstantHelper.GetInt32WithAllBitsSet() : (Int32)0;
+                    return new Vector<T>(ref register);
+                }
+                else if (typeof(T) == typeof(UInt64))
+                {
+                    register.uint64_0 = left.register.uint64_0 == right.register.uint64_0 ? ConstantHelper.GetUInt64WithAllBitsSet() : (UInt64)0;
+                    register.uint64_1 = left.register.uint64_1 == right.register.uint64_1 ? ConstantHelper.GetUInt64WithAllBitsSet() : (UInt64)0;
+                    return new Vector<T>(ref register);
+                }
+                else if (typeof(T) == typeof(Int64))
+                {
+                    register.int64_0 = left.register.int64_0 == right.register.int64_0 ? ConstantHelper.GetInt64WithAllBitsSet() : (Int64)0;
+                    register.int64_1 = left.register.int64_1 == right.register.int64_1 ? ConstantHelper.GetInt64WithAllBitsSet() : (Int64)0;
+                    return new Vector<T>(ref register);
+                }
+                else if (typeof(T) == typeof(Single))
+                {
+                    register.single_0 = left.register.single_0 == right.register.single_0 ? ConstantHelper.GetSingleWithAllBitsSet() : (Single)0;
+                    register.single_1 = left.register.single_1 == right.register.single_1 ? ConstantHelper.GetSingleWithAllBitsSet() : (Single)0;
+                    register.single_2 = left.register.single_2 == right.register.single_2 ? ConstantHelper.GetSingleWithAllBitsSet() : (Single)0;
+                    register.single_3 = left.register.single_3 == right.register.single_3 ? ConstantHelper.GetSingleWithAllBitsSet() : (Single)0;
+                    return new Vector<T>(ref register);
+                }
+                else if (typeof(T) == typeof(Double))
+                {
+                    register.double_0 = left.register.double_0 == right.register.double_0 ? ConstantHelper.GetDoubleWithAllBitsSet() : (Double)0;
+                    register.double_1 = left.register.double_1 == right.register.double_1 ? ConstantHelper.GetDoubleWithAllBitsSet() : (Double)0;
+                    return new Vector<T>(ref register);
+                }
+                else
+                {
+                    throw new NotSupportedException(SR.Arg_TypeNotSupported);
+                }
+            }
+        }
+
+        [JitIntrinsic]
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        internal static unsafe Vector<T> LessThan(Vector<T> left, Vector<T> right)
+        {
+            if (Vector.IsHardwareAccelerated)
+            {
+                if (typeof(T) == typeof(Byte))
+                {
+                    Byte* dataPtr = stackalloc Byte[Count];
+                    for (int g = 0; g < Count; g++)
+                    {
+                        dataPtr[g] = ScalarLessThan(left[g], right[g]) ? ConstantHelper.GetByteWithAllBitsSet() : (Byte)0;
+                    }
+                    return new Vector<T>(dataPtr);
+                }
+                else if (typeof(T) == typeof(SByte))
+                {
+                    SByte* dataPtr = stackalloc SByte[Count];
+                    for (int g = 0; g < Count; g++)
+                    {
+                        dataPtr[g] = ScalarLessThan(left[g], right[g]) ? ConstantHelper.GetSByteWithAllBitsSet() : (SByte)0;
+                    }
+                    return new Vector<T>(dataPtr);
+                }
+                else if (typeof(T) == typeof(UInt16))
+                {
+                    UInt16* dataPtr = stackalloc UInt16[Count];
+                    for (int g = 0; g < Count; g++)
+                    {
+                        dataPtr[g] = ScalarLessThan(left[g], right[g]) ? ConstantHelper.GetUInt16WithAllBitsSet() : (UInt16)0;
+                    }
+                    return new Vector<T>(dataPtr);
+                }
+                else if (typeof(T) == typeof(Int16))
+                {
+                    Int16* dataPtr = stackalloc Int16[Count];
+                    for (int g = 0; g < Count; g++)
+                    {
+                        dataPtr[g] = ScalarLessThan(left[g], right[g]) ? ConstantHelper.GetInt16WithAllBitsSet() : (Int16)0;
+                    }
+                    return new Vector<T>(dataPtr);
+                }
+                else if (typeof(T) == typeof(UInt32))
+                {
+                    UInt32* dataPtr = stackalloc UInt32[Count];
+                    for (int g = 0; g < Count; g++)
+                    {
+                        dataPtr[g] = ScalarLessThan(left[g], right[g]) ? ConstantHelper.GetUInt32WithAllBitsSet() : (UInt32)0;
+                    }
+                    return new Vector<T>(dataPtr);
+                }
+                else if (typeof(T) == typeof(Int32))
+                {
+                    Int32* dataPtr = stackalloc Int32[Count];
+                    for (int g = 0; g < Count; g++)
+                    {
+                        dataPtr[g] = ScalarLessThan(left[g], right[g]) ? ConstantHelper.GetInt32WithAllBitsSet() : (Int32)0;
+                    }
+                    return new Vector<T>(dataPtr);
+                }
+                else if (typeof(T) == typeof(UInt64))
+                {
+                    UInt64* dataPtr = stackalloc UInt64[Count];
+                    for (int g = 0; g < Count; g++)
+                    {
+                        dataPtr[g] = ScalarLessThan(left[g], right[g]) ? ConstantHelper.GetUInt64WithAllBitsSet() : (UInt64)0;
+                    }
+                    return new Vector<T>(dataPtr);
+                }
+                else if (typeof(T) == typeof(Int64))
+                {
+                    Int64* dataPtr = stackalloc Int64[Count];
+                    for (int g = 0; g < Count; g++)
+                    {
+                        dataPtr[g] = ScalarLessThan(left[g], right[g]) ? ConstantHelper.GetInt64WithAllBitsSet() : (Int64)0;
+                    }
+                    return new Vector<T>(dataPtr);
+                }
+                else if (typeof(T) == typeof(Single))
+                {
+                    Single* dataPtr = stackalloc Single[Count];
+                    for (int g = 0; g < Count; g++)
+                    {
+                        dataPtr[g] = ScalarLessThan(left[g], right[g]) ? ConstantHelper.GetSingleWithAllBitsSet() : (Single)0;
+                    }
+                    return new Vector<T>(dataPtr);
+                }
+                else if (typeof(T) == typeof(Double))
+                {
+                    Double* dataPtr = stackalloc Double[Count];
+                    for (int g = 0; g < Count; g++)
+                    {
+                        dataPtr[g] = ScalarLessThan(left[g], right[g]) ? ConstantHelper.GetDoubleWithAllBitsSet() : (Double)0;
+                    }
+                    return new Vector<T>(dataPtr);
+                }
+                else
+                {
+                    throw new NotSupportedException(SR.Arg_TypeNotSupported);
+                }
+            }
+            else
+            {
+                Register register = new Register();
+                if (typeof(T) == typeof(Byte))
+                {
+                    register.byte_0 = left.register.byte_0 < right.register.byte_0 ? ConstantHelper.GetByteWithAllBitsSet() : (Byte)0;
+                    register.byte_1 = left.register.byte_1 < right.register.byte_1 ? ConstantHelper.GetByteWithAllBitsSet() : (Byte)0;
+                    register.byte_2 = left.register.byte_2 < right.register.byte_2 ? ConstantHelper.GetByteWithAllBitsSet() : (Byte)0;
+                    register.byte_3 = left.register.byte_3 < right.register.byte_3 ? ConstantHelper.GetByteWithAllBitsSet() : (Byte)0;
+                    register.byte_4 = left.register.byte_4 < right.register.byte_4 ? ConstantHelper.GetByteWithAllBitsSet() : (Byte)0;
+                    register.byte_5 = left.register.byte_5 < right.register.byte_5 ? ConstantHelper.GetByteWithAllBitsSet() : (Byte)0;
+                    register.byte_6 = left.register.byte_6 < right.register.byte_6 ? ConstantHelper.GetByteWithAllBitsSet() : (Byte)0;
+                    register.byte_7 = left.register.byte_7 < right.register.byte_7 ? ConstantHelper.GetByteWithAllBitsSet() : (Byte)0;
+                    register.byte_8 = left.register.byte_8 < right.register.byte_8 ? ConstantHelper.GetByteWithAllBitsSet() : (Byte)0;
+                    register.byte_9 = left.register.byte_9 < right.register.byte_9 ? ConstantHelper.GetByteWithAllBitsSet() : (Byte)0;
+                    register.byte_10 = left.register.byte_10 < right.register.byte_10 ? ConstantHelper.GetByteWithAllBitsSet() : (Byte)0;
+                    register.byte_11 = left.register.byte_11 < right.register.byte_11 ? ConstantHelper.GetByteWithAllBitsSet() : (Byte)0;
+                    register.byte_12 = left.register.byte_12 < right.register.byte_12 ? ConstantHelper.GetByteWithAllBitsSet() : (Byte)0;
+                    register.byte_13 = left.register.byte_13 < right.register.byte_13 ? ConstantHelper.GetByteWithAllBitsSet() : (Byte)0;
+                    register.byte_14 = left.register.byte_14 < right.register.byte_14 ? ConstantHelper.GetByteWithAllBitsSet() : (Byte)0;
+                    register.byte_15 = left.register.byte_15 < right.register.byte_15 ? ConstantHelper.GetByteWithAllBitsSet() : (Byte)0;
+                    return new Vector<T>(ref register);
+                }
+                else if (typeof(T) == typeof(SByte))
+                {
+                    register.sbyte_0 = left.register.sbyte_0 < right.register.sbyte_0 ? ConstantHelper.GetSByteWithAllBitsSet() : (SByte)0;
+                    register.sbyte_1 = left.register.sbyte_1 < right.register.sbyte_1 ? ConstantHelper.GetSByteWithAllBitsSet() : (SByte)0;
+                    register.sbyte_2 = left.register.sbyte_2 < right.register.sbyte_2 ? ConstantHelper.GetSByteWithAllBitsSet() : (SByte)0;
+                    register.sbyte_3 = left.register.sbyte_3 < right.register.sbyte_3 ? ConstantHelper.GetSByteWithAllBitsSet() : (SByte)0;
+                    register.sbyte_4 = left.register.sbyte_4 < right.register.sbyte_4 ? ConstantHelper.GetSByteWithAllBitsSet() : (SByte)0;
+                    register.sbyte_5 = left.register.sbyte_5 < right.register.sbyte_5 ? ConstantHelper.GetSByteWithAllBitsSet() : (SByte)0;
+                    register.sbyte_6 = left.register.sbyte_6 < right.register.sbyte_6 ? ConstantHelper.GetSByteWithAllBitsSet() : (SByte)0;
+                    register.sbyte_7 = left.register.sbyte_7 < right.register.sbyte_7 ? ConstantHelper.GetSByteWithAllBitsSet() : (SByte)0;
+                    register.sbyte_8 = left.register.sbyte_8 < right.register.sbyte_8 ? ConstantHelper.GetSByteWithAllBitsSet() : (SByte)0;
+                    register.sbyte_9 = left.register.sbyte_9 < right.register.sbyte_9 ? ConstantHelper.GetSByteWithAllBitsSet() : (SByte)0;
+                    register.sbyte_10 = left.register.sbyte_10 < right.register.sbyte_10 ? ConstantHelper.GetSByteWithAllBitsSet() : (SByte)0;
+                    register.sbyte_11 = left.register.sbyte_11 < right.register.sbyte_11 ? ConstantHelper.GetSByteWithAllBitsSet() : (SByte)0;
+                    register.sbyte_12 = left.register.sbyte_12 < right.register.sbyte_12 ? ConstantHelper.GetSByteWithAllBitsSet() : (SByte)0;
+                    register.sbyte_13 = left.register.sbyte_13 < right.register.sbyte_13 ? ConstantHelper.GetSByteWithAllBitsSet() : (SByte)0;
+                    register.sbyte_14 = left.register.sbyte_14 < right.register.sbyte_14 ? ConstantHelper.GetSByteWithAllBitsSet() : (SByte)0;
+                    register.sbyte_15 = left.register.sbyte_15 < right.register.sbyte_15 ? ConstantHelper.GetSByteWithAllBitsSet() : (SByte)0;
+                    return new Vector<T>(ref register);
+                }
+                else if (typeof(T) == typeof(UInt16))
+                {
+                    register.uint16_0 = left.register.uint16_0 < right.register.uint16_0 ? ConstantHelper.GetUInt16WithAllBitsSet() : (UInt16)0;
+                    register.uint16_1 = left.register.uint16_1 < right.register.uint16_1 ? ConstantHelper.GetUInt16WithAllBitsSet() : (UInt16)0;
+                    register.uint16_2 = left.register.uint16_2 < right.register.uint16_2 ? ConstantHelper.GetUInt16WithAllBitsSet() : (UInt16)0;
+                    register.uint16_3 = left.register.uint16_3 < right.register.uint16_3 ? ConstantHelper.GetUInt16WithAllBitsSet() : (UInt16)0;
+                    register.uint16_4 = left.register.uint16_4 < right.register.uint16_4 ? ConstantHelper.GetUInt16WithAllBitsSet() : (UInt16)0;
+                    register.uint16_5 = left.register.uint16_5 < right.register.uint16_5 ? ConstantHelper.GetUInt16WithAllBitsSet() : (UInt16)0;
+                    register.uint16_6 = left.register.uint16_6 < right.register.uint16_6 ? ConstantHelper.GetUInt16WithAllBitsSet() : (UInt16)0;
+                    register.uint16_7 = left.register.uint16_7 < right.register.uint16_7 ? ConstantHelper.GetUInt16WithAllBitsSet() : (UInt16)0;
+                    return new Vector<T>(ref register);
+                }
+                else if (typeof(T) == typeof(Int16))
+                {
+                    register.int16_0 = left.register.int16_0 < right.register.int16_0 ? ConstantHelper.GetInt16WithAllBitsSet() : (Int16)0;
+                    register.int16_1 = left.register.int16_1 < right.register.int16_1 ? ConstantHelper.GetInt16WithAllBitsSet() : (Int16)0;
+                    register.int16_2 = left.register.int16_2 < right.register.int16_2 ? ConstantHelper.GetInt16WithAllBitsSet() : (Int16)0;
+                    register.int16_3 = left.register.int16_3 < right.register.int16_3 ? ConstantHelper.GetInt16WithAllBitsSet() : (Int16)0;
+                    register.int16_4 = left.register.int16_4 < right.register.int16_4 ? ConstantHelper.GetInt16WithAllBitsSet() : (Int16)0;
+                    register.int16_5 = left.register.int16_5 < right.register.int16_5 ? ConstantHelper.GetInt16WithAllBitsSet() : (Int16)0;
+                    register.int16_6 = left.register.int16_6 < right.register.int16_6 ? ConstantHelper.GetInt16WithAllBitsSet() : (Int16)0;
+                    register.int16_7 = left.register.int16_7 < right.register.int16_7 ? ConstantHelper.GetInt16WithAllBitsSet() : (Int16)0;
+                    return new Vector<T>(ref register);
+                }
+                else if (typeof(T) == typeof(UInt32))
+                {
+                    register.uint32_0 = left.register.uint32_0 < right.register.uint32_0 ? ConstantHelper.GetUInt32WithAllBitsSet() : (UInt32)0;
+                    register.uint32_1 = left.register.uint32_1 < right.register.uint32_1 ? ConstantHelper.GetUInt32WithAllBitsSet() : (UInt32)0;
+                    register.uint32_2 = left.register.uint32_2 < right.register.uint32_2 ? ConstantHelper.GetUInt32WithAllBitsSet() : (UInt32)0;
+                    register.uint32_3 = left.register.uint32_3 < right.register.uint32_3 ? ConstantHelper.GetUInt32WithAllBitsSet() : (UInt32)0;
+                    return new Vector<T>(ref register);
+                }
+                else if (typeof(T) == typeof(Int32))
+                {
+                    register.int32_0 = left.register.int32_0 < right.register.int32_0 ? ConstantHelper.GetInt32WithAllBitsSet() : (Int32)0;
+                    register.int32_1 = left.register.int32_1 < right.register.int32_1 ? ConstantHelper.GetInt32WithAllBitsSet() : (Int32)0;
+                    register.int32_2 = left.register.int32_2 < right.register.int32_2 ? ConstantHelper.GetInt32WithAllBitsSet() : (Int32)0;
+                    register.int32_3 = left.register.int32_3 < right.register.int32_3 ? ConstantHelper.GetInt32WithAllBitsSet() : (Int32)0;
+                    return new Vector<T>(ref register);
+                }
+                else if (typeof(T) == typeof(UInt64))
+                {
+                    register.uint64_0 = left.register.uint64_0 < right.register.uint64_0 ? ConstantHelper.GetUInt64WithAllBitsSet() : (UInt64)0;
+                    register.uint64_1 = left.register.uint64_1 < right.register.uint64_1 ? ConstantHelper.GetUInt64WithAllBitsSet() : (UInt64)0;
+                    return new Vector<T>(ref register);
+                }
+                else if (typeof(T) == typeof(Int64))
+                {
+                    register.int64_0 = left.register.int64_0 < right.register.int64_0 ? ConstantHelper.GetInt64WithAllBitsSet() : (Int64)0;
+                    register.int64_1 = left.register.int64_1 < right.register.int64_1 ? ConstantHelper.GetInt64WithAllBitsSet() : (Int64)0;
+                    return new Vector<T>(ref register);
+                }
+                else if (typeof(T) == typeof(Single))
+                {
+                    register.single_0 = left.register.single_0 < right.register.single_0 ? ConstantHelper.GetSingleWithAllBitsSet() : (Single)0;
+                    register.single_1 = left.register.single_1 < right.register.single_1 ? ConstantHelper.GetSingleWithAllBitsSet() : (Single)0;
+                    register.single_2 = left.register.single_2 < right.register.single_2 ? ConstantHelper.GetSingleWithAllBitsSet() : (Single)0;
+                    register.single_3 = left.register.single_3 < right.register.single_3 ? ConstantHelper.GetSingleWithAllBitsSet() : (Single)0;
+                    return new Vector<T>(ref register);
+                }
+                else if (typeof(T) == typeof(Double))
+                {
+                    register.double_0 = left.register.double_0 < right.register.double_0 ? ConstantHelper.GetDoubleWithAllBitsSet() : (Double)0;
+                    register.double_1 = left.register.double_1 < right.register.double_1 ? ConstantHelper.GetDoubleWithAllBitsSet() : (Double)0;
+                    return new Vector<T>(ref register);
+                }
+                else
+                {
+                    throw new NotSupportedException(SR.Arg_TypeNotSupported);
+                }
+            }
+        }
+
+        [JitIntrinsic]
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        internal static unsafe Vector<T> GreaterThan(Vector<T> left, Vector<T> right)
+        {
+            if (Vector.IsHardwareAccelerated)
+            {
+                if (typeof(T) == typeof(Byte))
+                {
+                    Byte* dataPtr = stackalloc Byte[Count];
+                    for (int g = 0; g < Count; g++)
+                    {
+                        dataPtr[g] = ScalarGreaterThan(left[g], right[g]) ? ConstantHelper.GetByteWithAllBitsSet() : (Byte)0;
+                    }
+                    return new Vector<T>(dataPtr);
+                }
+                else if (typeof(T) == typeof(SByte))
+                {
+                    SByte* dataPtr = stackalloc SByte[Count];
+                    for (int g = 0; g < Count; g++)
+                    {
+                        dataPtr[g] = ScalarGreaterThan(left[g], right[g]) ? ConstantHelper.GetSByteWithAllBitsSet() : (SByte)0;
+                    }
+                    return new Vector<T>(dataPtr);
+                }
+                else if (typeof(T) == typeof(UInt16))
+                {
+                    UInt16* dataPtr = stackalloc UInt16[Count];
+                    for (int g = 0; g < Count; g++)
+                    {
+                        dataPtr[g] = ScalarGreaterThan(left[g], right[g]) ? ConstantHelper.GetUInt16WithAllBitsSet() : (UInt16)0;
+                    }
+                    return new Vector<T>(dataPtr);
+                }
+                else if (typeof(T) == typeof(Int16))
+                {
+                    Int16* dataPtr = stackalloc Int16[Count];
+                    for (int g = 0; g < Count; g++)
+                    {
+                        dataPtr[g] = ScalarGreaterThan(left[g], right[g]) ? ConstantHelper.GetInt16WithAllBitsSet() : (Int16)0;
+                    }
+                    return new Vector<T>(dataPtr);
+                }
+                else if (typeof(T) == typeof(UInt32))
+                {
+                    UInt32* dataPtr = stackalloc UInt32[Count];
+                    for (int g = 0; g < Count; g++)
+                    {
+                        dataPtr[g] = ScalarGreaterThan(left[g], right[g]) ? ConstantHelper.GetUInt32WithAllBitsSet() : (UInt32)0;
+                    }
+                    return new Vector<T>(dataPtr);
+                }
+                else if (typeof(T) == typeof(Int32))
+                {
+                    Int32* dataPtr = stackalloc Int32[Count];
+                    for (int g = 0; g < Count; g++)
+                    {
+                        dataPtr[g] = ScalarGreaterThan(left[g], right[g]) ? ConstantHelper.GetInt32WithAllBitsSet() : (Int32)0;
+                    }
+                    return new Vector<T>(dataPtr);
+                }
+                else if (typeof(T) == typeof(UInt64))
+                {
+                    UInt64* dataPtr = stackalloc UInt64[Count];
+                    for (int g = 0; g < Count; g++)
+                    {
+                        dataPtr[g] = ScalarGreaterThan(left[g], right[g]) ? ConstantHelper.GetUInt64WithAllBitsSet() : (UInt64)0;
+                    }
+                    return new Vector<T>(dataPtr);
+                }
+                else if (typeof(T) == typeof(Int64))
+                {
+                    Int64* dataPtr = stackalloc Int64[Count];
+                    for (int g = 0; g < Count; g++)
+                    {
+                        dataPtr[g] = ScalarGreaterThan(left[g], right[g]) ? ConstantHelper.GetInt64WithAllBitsSet() : (Int64)0;
+                    }
+                    return new Vector<T>(dataPtr);
+                }
+                else if (typeof(T) == typeof(Single))
+                {
+                    Single* dataPtr = stackalloc Single[Count];
+                    for (int g = 0; g < Count; g++)
+                    {
+                        dataPtr[g] = ScalarGreaterThan(left[g], right[g]) ? ConstantHelper.GetSingleWithAllBitsSet() : (Single)0;
+                    }
+                    return new Vector<T>(dataPtr);
+                }
+                else if (typeof(T) == typeof(Double))
+                {
+                    Double* dataPtr = stackalloc Double[Count];
+                    for (int g = 0; g < Count; g++)
+                    {
+                        dataPtr[g] = ScalarGreaterThan(left[g], right[g]) ? ConstantHelper.GetDoubleWithAllBitsSet() : (Double)0;
+                    }
+                    return new Vector<T>(dataPtr);
+                }
+                else
+                {
+                    throw new NotSupportedException(SR.Arg_TypeNotSupported);
+                }
+            }
+            else
+            {
+                Register register = new Register();
+                if (typeof(T) == typeof(Byte))
+                {
+                    register.byte_0 = left.register.byte_0 > right.register.byte_0 ? ConstantHelper.GetByteWithAllBitsSet() : (Byte)0;
+                    register.byte_1 = left.register.byte_1 > right.register.byte_1 ? ConstantHelper.GetByteWithAllBitsSet() : (Byte)0;
+                    register.byte_2 = left.register.byte_2 > right.register.byte_2 ? ConstantHelper.GetByteWithAllBitsSet() : (Byte)0;
+                    register.byte_3 = left.register.byte_3 > right.register.byte_3 ? ConstantHelper.GetByteWithAllBitsSet() : (Byte)0;
+                    register.byte_4 = left.register.byte_4 > right.register.byte_4 ? ConstantHelper.GetByteWithAllBitsSet() : (Byte)0;
+                    register.byte_5 = left.register.byte_5 > right.register.byte_5 ? ConstantHelper.GetByteWithAllBitsSet() : (Byte)0;
+                    register.byte_6 = left.register.byte_6 > right.register.byte_6 ? ConstantHelper.GetByteWithAllBitsSet() : (Byte)0;
+                    register.byte_7 = left.register.byte_7 > right.register.byte_7 ? ConstantHelper.GetByteWithAllBitsSet() : (Byte)0;
+                    register.byte_8 = left.register.byte_8 > right.register.byte_8 ? ConstantHelper.GetByteWithAllBitsSet() : (Byte)0;
+                    register.byte_9 = left.register.byte_9 > right.register.byte_9 ? ConstantHelper.GetByteWithAllBitsSet() : (Byte)0;
+                    register.byte_10 = left.register.byte_10 > right.register.byte_10 ? ConstantHelper.GetByteWithAllBitsSet() : (Byte)0;
+                    register.byte_11 = left.register.byte_11 > right.register.byte_11 ? ConstantHelper.GetByteWithAllBitsSet() : (Byte)0;
+                    register.byte_12 = left.register.byte_12 > right.register.byte_12 ? ConstantHelper.GetByteWithAllBitsSet() : (Byte)0;
+                    register.byte_13 = left.register.byte_13 > right.register.byte_13 ? ConstantHelper.GetByteWithAllBitsSet() : (Byte)0;
+                    register.byte_14 = left.register.byte_14 > right.register.byte_14 ? ConstantHelper.GetByteWithAllBitsSet() : (Byte)0;
+                    register.byte_15 = left.register.byte_15 > right.register.byte_15 ? ConstantHelper.GetByteWithAllBitsSet() : (Byte)0;
+                    return new Vector<T>(ref register);
+                }
+                else if (typeof(T) == typeof(SByte))
+                {
+                    register.sbyte_0 = left.register.sbyte_0 > right.register.sbyte_0 ? ConstantHelper.GetSByteWithAllBitsSet() : (SByte)0;
+                    register.sbyte_1 = left.register.sbyte_1 > right.register.sbyte_1 ? ConstantHelper.GetSByteWithAllBitsSet() : (SByte)0;
+                    register.sbyte_2 = left.register.sbyte_2 > right.register.sbyte_2 ? ConstantHelper.GetSByteWithAllBitsSet() : (SByte)0;
+                    register.sbyte_3 = left.register.sbyte_3 > right.register.sbyte_3 ? ConstantHelper.GetSByteWithAllBitsSet() : (SByte)0;
+                    register.sbyte_4 = left.register.sbyte_4 > right.register.sbyte_4 ? ConstantHelper.GetSByteWithAllBitsSet() : (SByte)0;
+                    register.sbyte_5 = left.register.sbyte_5 > right.register.sbyte_5 ? ConstantHelper.GetSByteWithAllBitsSet() : (SByte)0;
+                    register.sbyte_6 = left.register.sbyte_6 > right.register.sbyte_6 ? ConstantHelper.GetSByteWithAllBitsSet() : (SByte)0;
+                    register.sbyte_7 = left.register.sbyte_7 > right.register.sbyte_7 ? ConstantHelper.GetSByteWithAllBitsSet() : (SByte)0;
+                    register.sbyte_8 = left.register.sbyte_8 > right.register.sbyte_8 ? ConstantHelper.GetSByteWithAllBitsSet() : (SByte)0;
+                    register.sbyte_9 = left.register.sbyte_9 > right.register.sbyte_9 ? ConstantHelper.GetSByteWithAllBitsSet() : (SByte)0;
+                    register.sbyte_10 = left.register.sbyte_10 > right.register.sbyte_10 ? ConstantHelper.GetSByteWithAllBitsSet() : (SByte)0;
+                    register.sbyte_11 = left.register.sbyte_11 > right.register.sbyte_11 ? ConstantHelper.GetSByteWithAllBitsSet() : (SByte)0;
+                    register.sbyte_12 = left.register.sbyte_12 > right.register.sbyte_12 ? ConstantHelper.GetSByteWithAllBitsSet() : (SByte)0;
+                    register.sbyte_13 = left.register.sbyte_13 > right.register.sbyte_13 ? ConstantHelper.GetSByteWithAllBitsSet() : (SByte)0;
+                    register.sbyte_14 = left.register.sbyte_14 > right.register.sbyte_14 ? ConstantHelper.GetSByteWithAllBitsSet() : (SByte)0;
+                    register.sbyte_15 = left.register.sbyte_15 > right.register.sbyte_15 ? ConstantHelper.GetSByteWithAllBitsSet() : (SByte)0;
+                    return new Vector<T>(ref register);
+                }
+                else if (typeof(T) == typeof(UInt16))
+                {
+                    register.uint16_0 = left.register.uint16_0 > right.register.uint16_0 ? ConstantHelper.GetUInt16WithAllBitsSet() : (UInt16)0;
+                    register.uint16_1 = left.register.uint16_1 > right.register.uint16_1 ? ConstantHelper.GetUInt16WithAllBitsSet() : (UInt16)0;
+                    register.uint16_2 = left.register.uint16_2 > right.register.uint16_2 ? ConstantHelper.GetUInt16WithAllBitsSet() : (UInt16)0;
+                    register.uint16_3 = left.register.uint16_3 > right.register.uint16_3 ? ConstantHelper.GetUInt16WithAllBitsSet() : (UInt16)0;
+                    register.uint16_4 = left.register.uint16_4 > right.register.uint16_4 ? ConstantHelper.GetUInt16WithAllBitsSet() : (UInt16)0;
+                    register.uint16_5 = left.register.uint16_5 > right.register.uint16_5 ? ConstantHelper.GetUInt16WithAllBitsSet() : (UInt16)0;
+                    register.uint16_6 = left.register.uint16_6 > right.register.uint16_6 ? ConstantHelper.GetUInt16WithAllBitsSet() : (UInt16)0;
+                    register.uint16_7 = left.register.uint16_7 > right.register.uint16_7 ? ConstantHelper.GetUInt16WithAllBitsSet() : (UInt16)0;
+                    return new Vector<T>(ref register);
+                }
+                else if (typeof(T) == typeof(Int16))
+                {
+                    register.int16_0 = left.register.int16_0 > right.register.int16_0 ? ConstantHelper.GetInt16WithAllBitsSet() : (Int16)0;
+                    register.int16_1 = left.register.int16_1 > right.register.int16_1 ? ConstantHelper.GetInt16WithAllBitsSet() : (Int16)0;
+                    register.int16_2 = left.register.int16_2 > right.register.int16_2 ? ConstantHelper.GetInt16WithAllBitsSet() : (Int16)0;
+                    register.int16_3 = left.register.int16_3 > right.register.int16_3 ? ConstantHelper.GetInt16WithAllBitsSet() : (Int16)0;
+                    register.int16_4 = left.register.int16_4 > right.register.int16_4 ? ConstantHelper.GetInt16WithAllBitsSet() : (Int16)0;
+                    register.int16_5 = left.register.int16_5 > right.register.int16_5 ? ConstantHelper.GetInt16WithAllBitsSet() : (Int16)0;
+                    register.int16_6 = left.register.int16_6 > right.register.int16_6 ? ConstantHelper.GetInt16WithAllBitsSet() : (Int16)0;
+                    register.int16_7 = left.register.int16_7 > right.register.int16_7 ? ConstantHelper.GetInt16WithAllBitsSet() : (Int16)0;
+                    return new Vector<T>(ref register);
+                }
+                else if (typeof(T) == typeof(UInt32))
+                {
+                    register.uint32_0 = left.register.uint32_0 > right.register.uint32_0 ? ConstantHelper.GetUInt32WithAllBitsSet() : (UInt32)0;
+                    register.uint32_1 = left.register.uint32_1 > right.register.uint32_1 ? ConstantHelper.GetUInt32WithAllBitsSet() : (UInt32)0;
+                    register.uint32_2 = left.register.uint32_2 > right.register.uint32_2 ? ConstantHelper.GetUInt32WithAllBitsSet() : (UInt32)0;
+                    register.uint32_3 = left.register.uint32_3 > right.register.uint32_3 ? ConstantHelper.GetUInt32WithAllBitsSet() : (UInt32)0;
+                    return new Vector<T>(ref register);
+                }
+                else if (typeof(T) == typeof(Int32))
+                {
+                    register.int32_0 = left.register.int32_0 > right.register.int32_0 ? ConstantHelper.GetInt32WithAllBitsSet() : (Int32)0;
+                    register.int32_1 = left.register.int32_1 > right.register.int32_1 ? ConstantHelper.GetInt32WithAllBitsSet() : (Int32)0;
+                    register.int32_2 = left.register.int32_2 > right.register.int32_2 ? ConstantHelper.GetInt32WithAllBitsSet() : (Int32)0;
+                    register.int32_3 = left.register.int32_3 > right.register.int32_3 ? ConstantHelper.GetInt32WithAllBitsSet() : (Int32)0;
+                    return new Vector<T>(ref register);
+                }
+                else if (typeof(T) == typeof(UInt64))
+                {
+                    register.uint64_0 = left.register.uint64_0 > right.register.uint64_0 ? ConstantHelper.GetUInt64WithAllBitsSet() : (UInt64)0;
+                    register.uint64_1 = left.register.uint64_1 > right.register.uint64_1 ? ConstantHelper.GetUInt64WithAllBitsSet() : (UInt64)0;
+                    return new Vector<T>(ref register);
+                }
+                else if (typeof(T) == typeof(Int64))
+                {
+                    register.int64_0 = left.register.int64_0 > right.register.int64_0 ? ConstantHelper.GetInt64WithAllBitsSet() : (Int64)0;
+                    register.int64_1 = left.register.int64_1 > right.register.int64_1 ? ConstantHelper.GetInt64WithAllBitsSet() : (Int64)0;
+                    return new Vector<T>(ref register);
+                }
+                else if (typeof(T) == typeof(Single))
+                {
+                    register.single_0 = left.register.single_0 > right.register.single_0 ? ConstantHelper.GetSingleWithAllBitsSet() : (Single)0;
+                    register.single_1 = left.register.single_1 > right.register.single_1 ? ConstantHelper.GetSingleWithAllBitsSet() : (Single)0;
+                    register.single_2 = left.register.single_2 > right.register.single_2 ? ConstantHelper.GetSingleWithAllBitsSet() : (Single)0;
+                    register.single_3 = left.register.single_3 > right.register.single_3 ? ConstantHelper.GetSingleWithAllBitsSet() : (Single)0;
+                    return new Vector<T>(ref register);
+                }
+                else if (typeof(T) == typeof(Double))
+                {
+                    register.double_0 = left.register.double_0 > right.register.double_0 ? ConstantHelper.GetDoubleWithAllBitsSet() : (Double)0;
+                    register.double_1 = left.register.double_1 > right.register.double_1 ? ConstantHelper.GetDoubleWithAllBitsSet() : (Double)0;
+                    return new Vector<T>(ref register);
+                }
+                else
+                {
+                    throw new NotSupportedException(SR.Arg_TypeNotSupported);
+                }
+            }
+        }
+
+        [JitIntrinsic]
+        internal static Vector<T> GreaterThanOrEqual(Vector<T> left, Vector<T> right)
+        {
+            return Equals(left, right) | GreaterThan(left, right);
+        }
+
+        [JitIntrinsic]
+        internal static Vector<T> LessThanOrEqual(Vector<T> left, Vector<T> right)
+        {
+            return Equals(left, right) | LessThan(left, right);
+        }
+
+        [JitIntrinsic]
+        internal static Vector<T> ConditionalSelect(Vector<T> condition, Vector<T> left, Vector<T> right)
+        {
+            return (left & condition) | (Vector.AndNot(right, condition));
+        }
+        #endregion Comparison Methods
+
+        #region Internal Math Methods
+        [JitIntrinsic]
+        internal static unsafe Vector<T> Abs(Vector<T> value)
+        {
+            if (typeof(T) == typeof(Byte))
+            {
+                return value;
+            }
+            else if (typeof(T) == typeof(UInt16))
+            {
+                return value;
+            }
+            else if (typeof(T) == typeof(UInt32))
+            {
+                return value;
+            }
+            else if (typeof(T) == typeof(UInt64))
+            {
+                return value;
+            }
+            if (Vector.IsHardwareAccelerated)
+            {
+                if (typeof(T) == typeof(SByte))
+                {
+                    SByte* dataPtr = stackalloc SByte[Count];
+                    for (int g = 0; g < Count; g++)
+                    {
+                        dataPtr[g] = (SByte)(object)(Math.Abs((SByte)(object)value[g]));
+                    }
+                    return new Vector<T>(dataPtr);
+                }
+                else if (typeof(T) == typeof(Int16))
+                {
+                    Int16* dataPtr = stackalloc Int16[Count];
+                    for (int g = 0; g < Count; g++)
+                    {
+                        dataPtr[g] = (Int16)(object)(Math.Abs((Int16)(object)value[g]));
+                    }
+                    return new Vector<T>(dataPtr);
+                }
+                else if (typeof(T) == typeof(Int32))
+                {
+                    Int32* dataPtr = stackalloc Int32[Count];
+                    for (int g = 0; g < Count; g++)
+                    {
+                        dataPtr[g] = (Int32)(object)(Math.Abs((Int32)(object)value[g]));
+                    }
+                    return new Vector<T>(dataPtr);
+                }
+                else if (typeof(T) == typeof(Int64))
+                {
+                    Int64* dataPtr = stackalloc Int64[Count];
+                    for (int g = 0; g < Count; g++)
+                    {
+                        dataPtr[g] = (Int64)(object)(Math.Abs((Int64)(object)value[g]));
+                    }
+                    return new Vector<T>(dataPtr);
+                }
+                else if (typeof(T) == typeof(Single))
+                {
+                    Single* dataPtr = stackalloc Single[Count];
+                    for (int g = 0; g < Count; g++)
+                    {
+                        dataPtr[g] = (Single)(object)(Math.Abs((Single)(object)value[g]));
+                    }
+                    return new Vector<T>(dataPtr);
+                }
+                else if (typeof(T) == typeof(Double))
+                {
+                    Double* dataPtr = stackalloc Double[Count];
+                    for (int g = 0; g < Count; g++)
+                    {
+                        dataPtr[g] = (Double)(object)(Math.Abs((Double)(object)value[g]));
+                    }
+                    return new Vector<T>(dataPtr);
+                }
+                else
+                {
+                    throw new NotSupportedException(SR.Arg_TypeNotSupported);
+                }
+            }
+            else
+            {
+                if (typeof(T) == typeof(SByte))
+                {
+                    value.register.sbyte_0 = (SByte)(Math.Abs(value.register.sbyte_0));
+                    value.register.sbyte_1 = (SByte)(Math.Abs(value.register.sbyte_1));
+                    value.register.sbyte_2 = (SByte)(Math.Abs(value.register.sbyte_2));
+                    value.register.sbyte_3 = (SByte)(Math.Abs(value.register.sbyte_3));
+                    value.register.sbyte_4 = (SByte)(Math.Abs(value.register.sbyte_4));
+                    value.register.sbyte_5 = (SByte)(Math.Abs(value.register.sbyte_5));
+                    value.register.sbyte_6 = (SByte)(Math.Abs(value.register.sbyte_6));
+                    value.register.sbyte_7 = (SByte)(Math.Abs(value.register.sbyte_7));
+                    value.register.sbyte_8 = (SByte)(Math.Abs(value.register.sbyte_8));
+                    value.register.sbyte_9 = (SByte)(Math.Abs(value.register.sbyte_9));
+                    value.register.sbyte_10 = (SByte)(Math.Abs(value.register.sbyte_10));
+                    value.register.sbyte_11 = (SByte)(Math.Abs(value.register.sbyte_11));
+                    value.register.sbyte_12 = (SByte)(Math.Abs(value.register.sbyte_12));
+                    value.register.sbyte_13 = (SByte)(Math.Abs(value.register.sbyte_13));
+                    value.register.sbyte_14 = (SByte)(Math.Abs(value.register.sbyte_14));
+                    value.register.sbyte_15 = (SByte)(Math.Abs(value.register.sbyte_15));
+                    return value;
+                }
+                else if (typeof(T) == typeof(Int16))
+                {
+                    value.register.int16_0 = (Int16)(Math.Abs(value.register.int16_0));
+                    value.register.int16_1 = (Int16)(Math.Abs(value.register.int16_1));
+                    value.register.int16_2 = (Int16)(Math.Abs(value.register.int16_2));
+                    value.register.int16_3 = (Int16)(Math.Abs(value.register.int16_3));
+                    value.register.int16_4 = (Int16)(Math.Abs(value.register.int16_4));
+                    value.register.int16_5 = (Int16)(Math.Abs(value.register.int16_5));
+                    value.register.int16_6 = (Int16)(Math.Abs(value.register.int16_6));
+                    value.register.int16_7 = (Int16)(Math.Abs(value.register.int16_7));
+                    return value;
+                }
+                else if (typeof(T) == typeof(Int32))
+                {
+                    value.register.int32_0 = (Int32)(Math.Abs(value.register.int32_0));
+                    value.register.int32_1 = (Int32)(Math.Abs(value.register.int32_1));
+                    value.register.int32_2 = (Int32)(Math.Abs(value.register.int32_2));
+                    value.register.int32_3 = (Int32)(Math.Abs(value.register.int32_3));
+                    return value;
+                }
+                else if (typeof(T) == typeof(Int64))
+                {
+                    value.register.int64_0 = (Int64)(Math.Abs(value.register.int64_0));
+                    value.register.int64_1 = (Int64)(Math.Abs(value.register.int64_1));
+                    return value;
+                }
+                else if (typeof(T) == typeof(Single))
+                {
+                    value.register.single_0 = (Single)(Math.Abs(value.register.single_0));
+                    value.register.single_1 = (Single)(Math.Abs(value.register.single_1));
+                    value.register.single_2 = (Single)(Math.Abs(value.register.single_2));
+                    value.register.single_3 = (Single)(Math.Abs(value.register.single_3));
+                    return value;
+                }
+                else if (typeof(T) == typeof(Double))
+                {
+                    value.register.double_0 = (Double)(Math.Abs(value.register.double_0));
+                    value.register.double_1 = (Double)(Math.Abs(value.register.double_1));
+                    return value;
+                }
+                else
+                {
+                    throw new NotSupportedException(SR.Arg_TypeNotSupported);
+                }
+            }
+        }
+
+        [JitIntrinsic]
+        internal static unsafe Vector<T> Min(Vector<T> left, Vector<T> right)
+        {
+            if (Vector.IsHardwareAccelerated)
+            {
+                if (typeof(T) == typeof(Byte))
+                {
+                    Byte* dataPtr = stackalloc Byte[Count];
+                    for (int g = 0; g < Count; g++)
+                    {
+                        dataPtr[g] = ScalarLessThan(left[g], right[g]) ? (Byte)(object)left[g] : (Byte)(object)right[g];
+                    }
+                    return new Vector<T>(dataPtr);
+                }
+                else if (typeof(T) == typeof(SByte))
+                {
+                    SByte* dataPtr = stackalloc SByte[Count];
+                    for (int g = 0; g < Count; g++)
+                    {
+                        dataPtr[g] = ScalarLessThan(left[g], right[g]) ? (SByte)(object)left[g] : (SByte)(object)right[g];
+                    }
+                    return new Vector<T>(dataPtr);
+                }
+                else if (typeof(T) == typeof(UInt16))
+                {
+                    UInt16* dataPtr = stackalloc UInt16[Count];
+                    for (int g = 0; g < Count; g++)
+                    {
+                        dataPtr[g] = ScalarLessThan(left[g], right[g]) ? (UInt16)(object)left[g] : (UInt16)(object)right[g];
+                    }
+                    return new Vector<T>(dataPtr);
+                }
+                else if (typeof(T) == typeof(Int16))
+                {
+                    Int16* dataPtr = stackalloc Int16[Count];
+                    for (int g = 0; g < Count; g++)
+                    {
+                        dataPtr[g] = ScalarLessThan(left[g], right[g]) ? (Int16)(object)left[g] : (Int16)(object)right[g];
+                    }
+                    return new Vector<T>(dataPtr);
+                }
+                else if (typeof(T) == typeof(UInt32))
+                {
+                    UInt32* dataPtr = stackalloc UInt32[Count];
+                    for (int g = 0; g < Count; g++)
+                    {
+                        dataPtr[g] = ScalarLessThan(left[g], right[g]) ? (UInt32)(object)left[g] : (UInt32)(object)right[g];
+                    }
+                    return new Vector<T>(dataPtr);
+                }
+                else if (typeof(T) == typeof(Int32))
+                {
+                    Int32* dataPtr = stackalloc Int32[Count];
+                    for (int g = 0; g < Count; g++)
+                    {
+                        dataPtr[g] = ScalarLessThan(left[g], right[g]) ? (Int32)(object)left[g] : (Int32)(object)right[g];
+                    }
+                    return new Vector<T>(dataPtr);
+                }
+                else if (typeof(T) == typeof(UInt64))
+                {
+                    UInt64* dataPtr = stackalloc UInt64[Count];
+                    for (int g = 0; g < Count; g++)
+                    {
+                        dataPtr[g] = ScalarLessThan(left[g], right[g]) ? (UInt64)(object)left[g] : (UInt64)(object)right[g];
+                    }
+                    return new Vector<T>(dataPtr);
+                }
+                else if (typeof(T) == typeof(Int64))
+                {
+                    Int64* dataPtr = stackalloc Int64[Count];
+                    for (int g = 0; g < Count; g++)
+                    {
+                        dataPtr[g] = ScalarLessThan(left[g], right[g]) ? (Int64)(object)left[g] : (Int64)(object)right[g];
+                    }
+                    return new Vector<T>(dataPtr);
+                }
+                else if (typeof(T) == typeof(Single))
+                {
+                    Single* dataPtr = stackalloc Single[Count];
+                    for (int g = 0; g < Count; g++)
+                    {
+                        dataPtr[g] = ScalarLessThan(left[g], right[g]) ? (Single)(object)left[g] : (Single)(object)right[g];
+                    }
+                    return new Vector<T>(dataPtr);
+                }
+                else if (typeof(T) == typeof(Double))
+                {
+                    Double* dataPtr = stackalloc Double[Count];
+                    for (int g = 0; g < Count; g++)
+                    {
+                        dataPtr[g] = ScalarLessThan(left[g], right[g]) ? (Double)(object)left[g] : (Double)(object)right[g];
+                    }
+                    return new Vector<T>(dataPtr);
+                }
+                else
+                {
+                    throw new NotSupportedException(SR.Arg_TypeNotSupported);
+                }
+            }
+            else
+            {
+                Vector<T> vec = new Vector<T>();
+                if (typeof(T) == typeof(Byte))
+                {
+                    vec.register.byte_0 = left.register.byte_0 < right.register.byte_0 ? left.register.byte_0 : right.register.byte_0;
+                    vec.register.byte_1 = left.register.byte_1 < right.register.byte_1 ? left.register.byte_1 : right.register.byte_1;
+                    vec.register.byte_2 = left.register.byte_2 < right.register.byte_2 ? left.register.byte_2 : right.register.byte_2;
+                    vec.register.byte_3 = left.register.byte_3 < right.register.byte_3 ? left.register.byte_3 : right.register.byte_3;
+                    vec.register.byte_4 = left.register.byte_4 < right.register.byte_4 ? left.register.byte_4 : right.register.byte_4;
+                    vec.register.byte_5 = left.register.byte_5 < right.register.byte_5 ? left.register.byte_5 : right.register.byte_5;
+                    vec.register.byte_6 = left.register.byte_6 < right.register.byte_6 ? left.register.byte_6 : right.register.byte_6;
+                    vec.register.byte_7 = left.register.byte_7 < right.register.byte_7 ? left.register.byte_7 : right.register.byte_7;
+                    vec.register.byte_8 = left.register.byte_8 < right.register.byte_8 ? left.register.byte_8 : right.register.byte_8;
+                    vec.register.byte_9 = left.register.byte_9 < right.register.byte_9 ? left.register.byte_9 : right.register.byte_9;
+                    vec.register.byte_10 = left.register.byte_10 < right.register.byte_10 ? left.register.byte_10 : right.register.byte_10;
+                    vec.register.byte_11 = left.register.byte_11 < right.register.byte_11 ? left.register.byte_11 : right.register.byte_11;
+                    vec.register.byte_12 = left.register.byte_12 < right.register.byte_12 ? left.register.byte_12 : right.register.byte_12;
+                    vec.register.byte_13 = left.register.byte_13 < right.register.byte_13 ? left.register.byte_13 : right.register.byte_13;
+                    vec.register.byte_14 = left.register.byte_14 < right.register.byte_14 ? left.register.byte_14 : right.register.byte_14;
+                    vec.register.byte_15 = left.register.byte_15 < right.register.byte_15 ? left.register.byte_15 : right.register.byte_15;
+                    return vec;
+                }
+                else if (typeof(T) == typeof(SByte))
+                {
+                    vec.register.sbyte_0 = left.register.sbyte_0 < right.register.sbyte_0 ? left.register.sbyte_0 : right.register.sbyte_0;
+                    vec.register.sbyte_1 = left.register.sbyte_1 < right.register.sbyte_1 ? left.register.sbyte_1 : right.register.sbyte_1;
+                    vec.register.sbyte_2 = left.register.sbyte_2 < right.register.sbyte_2 ? left.register.sbyte_2 : right.register.sbyte_2;
+                    vec.register.sbyte_3 = left.register.sbyte_3 < right.register.sbyte_3 ? left.register.sbyte_3 : right.register.sbyte_3;
+                    vec.register.sbyte_4 = left.register.sbyte_4 < right.register.sbyte_4 ? left.register.sbyte_4 : right.register.sbyte_4;
+                    vec.register.sbyte_5 = left.register.sbyte_5 < right.register.sbyte_5 ? left.register.sbyte_5 : right.register.sbyte_5;
+                    vec.register.sbyte_6 = left.register.sbyte_6 < right.register.sbyte_6 ? left.register.sbyte_6 : right.register.sbyte_6;
+                    vec.register.sbyte_7 = left.register.sbyte_7 < right.register.sbyte_7 ? left.register.sbyte_7 : right.register.sbyte_7;
+                    vec.register.sbyte_8 = left.register.sbyte_8 < right.register.sbyte_8 ? left.register.sbyte_8 : right.register.sbyte_8;
+                    vec.register.sbyte_9 = left.register.sbyte_9 < right.register.sbyte_9 ? left.register.sbyte_9 : right.register.sbyte_9;
+                    vec.register.sbyte_10 = left.register.sbyte_10 < right.register.sbyte_10 ? left.register.sbyte_10 : right.register.sbyte_10;
+                    vec.register.sbyte_11 = left.register.sbyte_11 < right.register.sbyte_11 ? left.register.sbyte_11 : right.register.sbyte_11;
+                    vec.register.sbyte_12 = left.register.sbyte_12 < right.register.sbyte_12 ? left.register.sbyte_12 : right.register.sbyte_12;
+                    vec.register.sbyte_13 = left.register.sbyte_13 < right.register.sbyte_13 ? left.register.sbyte_13 : right.register.sbyte_13;
+                    vec.register.sbyte_14 = left.register.sbyte_14 < right.register.sbyte_14 ? left.register.sbyte_14 : right.register.sbyte_14;
+                    vec.register.sbyte_15 = left.register.sbyte_15 < right.register.sbyte_15 ? left.register.sbyte_15 : right.register.sbyte_15;
+                    return vec;
+                }
+                else if (typeof(T) == typeof(UInt16))
+                {
+                    vec.register.uint16_0 = left.register.uint16_0 < right.register.uint16_0 ? left.register.uint16_0 : right.register.uint16_0;
+                    vec.register.uint16_1 = left.register.uint16_1 < right.register.uint16_1 ? left.register.uint16_1 : right.register.uint16_1;
+                    vec.register.uint16_2 = left.register.uint16_2 < right.register.uint16_2 ? left.register.uint16_2 : right.register.uint16_2;
+                    vec.register.uint16_3 = left.register.uint16_3 < right.register.uint16_3 ? left.register.uint16_3 : right.register.uint16_3;
+                    vec.register.uint16_4 = left.register.uint16_4 < right.register.uint16_4 ? left.register.uint16_4 : right.register.uint16_4;
+                    vec.register.uint16_5 = left.register.uint16_5 < right.register.uint16_5 ? left.register.uint16_5 : right.register.uint16_5;
+                    vec.register.uint16_6 = left.register.uint16_6 < right.register.uint16_6 ? left.register.uint16_6 : right.register.uint16_6;
+                    vec.register.uint16_7 = left.register.uint16_7 < right.register.uint16_7 ? left.register.uint16_7 : right.register.uint16_7;
+                    return vec;
+                }
+                else if (typeof(T) == typeof(Int16))
+                {
+                    vec.register.int16_0 = left.register.int16_0 < right.register.int16_0 ? left.register.int16_0 : right.register.int16_0;
+                    vec.register.int16_1 = left.register.int16_1 < right.register.int16_1 ? left.register.int16_1 : right.register.int16_1;
+                    vec.register.int16_2 = left.register.int16_2 < right.register.int16_2 ? left.register.int16_2 : right.register.int16_2;
+                    vec.register.int16_3 = left.register.int16_3 < right.register.int16_3 ? left.register.int16_3 : right.register.int16_3;
+                    vec.register.int16_4 = left.register.int16_4 < right.register.int16_4 ? left.register.int16_4 : right.register.int16_4;
+                    vec.register.int16_5 = left.register.int16_5 < right.register.int16_5 ? left.register.int16_5 : right.register.int16_5;
+                    vec.register.int16_6 = left.register.int16_6 < right.register.int16_6 ? left.register.int16_6 : right.register.int16_6;
+                    vec.register.int16_7 = left.register.int16_7 < right.register.int16_7 ? left.register.int16_7 : right.register.int16_7;
+                    return vec;
+                }
+                else if (typeof(T) == typeof(UInt32))
+                {
+                    vec.register.uint32_0 = left.register.uint32_0 < right.register.uint32_0 ? left.register.uint32_0 : right.register.uint32_0;
+                    vec.register.uint32_1 = left.register.uint32_1 < right.register.uint32_1 ? left.register.uint32_1 : right.register.uint32_1;
+                    vec.register.uint32_2 = left.register.uint32_2 < right.register.uint32_2 ? left.register.uint32_2 : right.register.uint32_2;
+                    vec.register.uint32_3 = left.register.uint32_3 < right.register.uint32_3 ? left.register.uint32_3 : right.register.uint32_3;
+                    return vec;
+                }
+                else if (typeof(T) == typeof(Int32))
+                {
+                    vec.register.int32_0 = left.register.int32_0 < right.register.int32_0 ? left.register.int32_0 : right.register.int32_0;
+                    vec.register.int32_1 = left.register.int32_1 < right.register.int32_1 ? left.register.int32_1 : right.register.int32_1;
+                    vec.register.int32_2 = left.register.int32_2 < right.register.int32_2 ? left.register.int32_2 : right.register.int32_2;
+                    vec.register.int32_3 = left.register.int32_3 < right.register.int32_3 ? left.register.int32_3 : right.register.int32_3;
+                    return vec;
+                }
+                else if (typeof(T) == typeof(UInt64))
+                {
+                    vec.register.uint64_0 = left.register.uint64_0 < right.register.uint64_0 ? left.register.uint64_0 : right.register.uint64_0;
+                    vec.register.uint64_1 = left.register.uint64_1 < right.register.uint64_1 ? left.register.uint64_1 : right.register.uint64_1;
+                    return vec;
+                }
+                else if (typeof(T) == typeof(Int64))
+                {
+                    vec.register.int64_0 = left.register.int64_0 < right.register.int64_0 ? left.register.int64_0 : right.register.int64_0;
+                    vec.register.int64_1 = left.register.int64_1 < right.register.int64_1 ? left.register.int64_1 : right.register.int64_1;
+                    return vec;
+                }
+                else if (typeof(T) == typeof(Single))
+                {
+                    vec.register.single_0 = left.register.single_0 < right.register.single_0 ? left.register.single_0 : right.register.single_0;
+                    vec.register.single_1 = left.register.single_1 < right.register.single_1 ? left.register.single_1 : right.register.single_1;
+                    vec.register.single_2 = left.register.single_2 < right.register.single_2 ? left.register.single_2 : right.register.single_2;
+                    vec.register.single_3 = left.register.single_3 < right.register.single_3 ? left.register.single_3 : right.register.single_3;
+                    return vec;
+                }
+                else if (typeof(T) == typeof(Double))
+                {
+                    vec.register.double_0 = left.register.double_0 < right.register.double_0 ? left.register.double_0 : right.register.double_0;
+                    vec.register.double_1 = left.register.double_1 < right.register.double_1 ? left.register.double_1 : right.register.double_1;
+                    return vec;
+                }
+                else
+                {
+                    throw new NotSupportedException(SR.Arg_TypeNotSupported);
+                }
+            }
+        }
+
+        [JitIntrinsic]
+        internal static unsafe Vector<T> Max(Vector<T> left, Vector<T> right)
+        {
+            if (Vector.IsHardwareAccelerated)
+            {
+                if (typeof(T) == typeof(Byte))
+                {
+                    Byte* dataPtr = stackalloc Byte[Count];
+                    for (int g = 0; g < Count; g++)
+                    {
+                        dataPtr[g] = ScalarGreaterThan(left[g], right[g]) ? (Byte)(object)left[g] : (Byte)(object)right[g];
+                    }
+                    return new Vector<T>(dataPtr);
+                }
+                else if (typeof(T) == typeof(SByte))
+                {
+                    SByte* dataPtr = stackalloc SByte[Count];
+                    for (int g = 0; g < Count; g++)
+                    {
+                        dataPtr[g] = ScalarGreaterThan(left[g], right[g]) ? (SByte)(object)left[g] : (SByte)(object)right[g];
+                    }
+                    return new Vector<T>(dataPtr);
+                }
+                else if (typeof(T) == typeof(UInt16))
+                {
+                    UInt16* dataPtr = stackalloc UInt16[Count];
+                    for (int g = 0; g < Count; g++)
+                    {
+                        dataPtr[g] = ScalarGreaterThan(left[g], right[g]) ? (UInt16)(object)left[g] : (UInt16)(object)right[g];
+                    }
+                    return new Vector<T>(dataPtr);
+                }
+                else if (typeof(T) == typeof(Int16))
+                {
+                    Int16* dataPtr = stackalloc Int16[Count];
+                    for (int g = 0; g < Count; g++)
+                    {
+                        dataPtr[g] = ScalarGreaterThan(left[g], right[g]) ? (Int16)(object)left[g] : (Int16)(object)right[g];
+                    }
+                    return new Vector<T>(dataPtr);
+                }
+                else if (typeof(T) == typeof(UInt32))
+                {
+                    UInt32* dataPtr = stackalloc UInt32[Count];
+                    for (int g = 0; g < Count; g++)
+                    {
+                        dataPtr[g] = ScalarGreaterThan(left[g], right[g]) ? (UInt32)(object)left[g] : (UInt32)(object)right[g];
+                    }
+                    return new Vector<T>(dataPtr);
+                }
+                else if (typeof(T) == typeof(Int32))
+                {
+                    Int32* dataPtr = stackalloc Int32[Count];
+                    for (int g = 0; g < Count; g++)
+                    {
+                        dataPtr[g] = ScalarGreaterThan(left[g], right[g]) ? (Int32)(object)left[g] : (Int32)(object)right[g];
+                    }
+                    return new Vector<T>(dataPtr);
+                }
+                else if (typeof(T) == typeof(UInt64))
+                {
+                    UInt64* dataPtr = stackalloc UInt64[Count];
+                    for (int g = 0; g < Count; g++)
+                    {
+                        dataPtr[g] = ScalarGreaterThan(left[g], right[g]) ? (UInt64)(object)left[g] : (UInt64)(object)right[g];
+                    }
+                    return new Vector<T>(dataPtr);
+                }
+                else if (typeof(T) == typeof(Int64))
+                {
+                    Int64* dataPtr = stackalloc Int64[Count];
+                    for (int g = 0; g < Count; g++)
+                    {
+                        dataPtr[g] = ScalarGreaterThan(left[g], right[g]) ? (Int64)(object)left[g] : (Int64)(object)right[g];
+                    }
+                    return new Vector<T>(dataPtr);
+                }
+                else if (typeof(T) == typeof(Single))
+                {
+                    Single* dataPtr = stackalloc Single[Count];
+                    for (int g = 0; g < Count; g++)
+                    {
+                        dataPtr[g] = ScalarGreaterThan(left[g], right[g]) ? (Single)(object)left[g] : (Single)(object)right[g];
+                    }
+                    return new Vector<T>(dataPtr);
+                }
+                else if (typeof(T) == typeof(Double))
+                {
+                    Double* dataPtr = stackalloc Double[Count];
+                    for (int g = 0; g < Count; g++)
+                    {
+                        dataPtr[g] = ScalarGreaterThan(left[g], right[g]) ? (Double)(object)left[g] : (Double)(object)right[g];
+                    }
+                    return new Vector<T>(dataPtr);
+                }
+                else
+                {
+                    throw new NotSupportedException(SR.Arg_TypeNotSupported);
+                }
+            }
+            else
+            {
+                Vector<T> vec = new Vector<T>();
+                if (typeof(T) == typeof(Byte))
+                {
+                    vec.register.byte_0 = left.register.byte_0 > right.register.byte_0 ? left.register.byte_0 : right.register.byte_0;
+                    vec.register.byte_1 = left.register.byte_1 > right.register.byte_1 ? left.register.byte_1 : right.register.byte_1;
+                    vec.register.byte_2 = left.register.byte_2 > right.register.byte_2 ? left.register.byte_2 : right.register.byte_2;
+                    vec.register.byte_3 = left.register.byte_3 > right.register.byte_3 ? left.register.byte_3 : right.register.byte_3;
+                    vec.register.byte_4 = left.register.byte_4 > right.register.byte_4 ? left.register.byte_4 : right.register.byte_4;
+                    vec.register.byte_5 = left.register.byte_5 > right.register.byte_5 ? left.register.byte_5 : right.register.byte_5;
+                    vec.register.byte_6 = left.register.byte_6 > right.register.byte_6 ? left.register.byte_6 : right.register.byte_6;
+                    vec.register.byte_7 = left.register.byte_7 > right.register.byte_7 ? left.register.byte_7 : right.register.byte_7;
+                    vec.register.byte_8 = left.register.byte_8 > right.register.byte_8 ? left.register.byte_8 : right.register.byte_8;
+                    vec.register.byte_9 = left.register.byte_9 > right.register.byte_9 ? left.register.byte_9 : right.register.byte_9;
+                    vec.register.byte_10 = left.register.byte_10 > right.register.byte_10 ? left.register.byte_10 : right.register.byte_10;
+                    vec.register.byte_11 = left.register.byte_11 > right.register.byte_11 ? left.register.byte_11 : right.register.byte_11;
+                    vec.register.byte_12 = left.register.byte_12 > right.register.byte_12 ? left.register.byte_12 : right.register.byte_12;
+                    vec.register.byte_13 = left.register.byte_13 > right.register.byte_13 ? left.register.byte_13 : right.register.byte_13;
+                    vec.register.byte_14 = left.register.byte_14 > right.register.byte_14 ? left.register.byte_14 : right.register.byte_14;
+                    vec.register.byte_15 = left.register.byte_15 > right.register.byte_15 ? left.register.byte_15 : right.register.byte_15;
+                    return vec;
+                }
+                else if (typeof(T) == typeof(SByte))
+                {
+                    vec.register.sbyte_0 = left.register.sbyte_0 > right.register.sbyte_0 ? left.register.sbyte_0 : right.register.sbyte_0;
+                    vec.register.sbyte_1 = left.register.sbyte_1 > right.register.sbyte_1 ? left.register.sbyte_1 : right.register.sbyte_1;
+                    vec.register.sbyte_2 = left.register.sbyte_2 > right.register.sbyte_2 ? left.register.sbyte_2 : right.register.sbyte_2;
+                    vec.register.sbyte_3 = left.register.sbyte_3 > right.register.sbyte_3 ? left.register.sbyte_3 : right.register.sbyte_3;
+                    vec.register.sbyte_4 = left.register.sbyte_4 > right.register.sbyte_4 ? left.register.sbyte_4 : right.register.sbyte_4;
+                    vec.register.sbyte_5 = left.register.sbyte_5 > right.register.sbyte_5 ? left.register.sbyte_5 : right.register.sbyte_5;
+                    vec.register.sbyte_6 = left.register.sbyte_6 > right.register.sbyte_6 ? left.register.sbyte_6 : right.register.sbyte_6;
+                    vec.register.sbyte_7 = left.register.sbyte_7 > right.register.sbyte_7 ? left.register.sbyte_7 : right.register.sbyte_7;
+                    vec.register.sbyte_8 = left.register.sbyte_8 > right.register.sbyte_8 ? left.register.sbyte_8 : right.register.sbyte_8;
+                    vec.register.sbyte_9 = left.register.sbyte_9 > right.register.sbyte_9 ? left.register.sbyte_9 : right.register.sbyte_9;
+                    vec.register.sbyte_10 = left.register.sbyte_10 > right.register.sbyte_10 ? left.register.sbyte_10 : right.register.sbyte_10;
+                    vec.register.sbyte_11 = left.register.sbyte_11 > right.register.sbyte_11 ? left.register.sbyte_11 : right.register.sbyte_11;
+                    vec.register.sbyte_12 = left.register.sbyte_12 > right.register.sbyte_12 ? left.register.sbyte_12 : right.register.sbyte_12;
+                    vec.register.sbyte_13 = left.register.sbyte_13 > right.register.sbyte_13 ? left.register.sbyte_13 : right.register.sbyte_13;
+                    vec.register.sbyte_14 = left.register.sbyte_14 > right.register.sbyte_14 ? left.register.sbyte_14 : right.register.sbyte_14;
+                    vec.register.sbyte_15 = left.register.sbyte_15 > right.register.sbyte_15 ? left.register.sbyte_15 : right.register.sbyte_15;
+                    return vec;
+                }
+                else if (typeof(T) == typeof(UInt16))
+                {
+                    vec.register.uint16_0 = left.register.uint16_0 > right.register.uint16_0 ? left.register.uint16_0 : right.register.uint16_0;
+                    vec.register.uint16_1 = left.register.uint16_1 > right.register.uint16_1 ? left.register.uint16_1 : right.register.uint16_1;
+                    vec.register.uint16_2 = left.register.uint16_2 > right.register.uint16_2 ? left.register.uint16_2 : right.register.uint16_2;
+                    vec.register.uint16_3 = left.register.uint16_3 > right.register.uint16_3 ? left.register.uint16_3 : right.register.uint16_3;
+                    vec.register.uint16_4 = left.register.uint16_4 > right.register.uint16_4 ? left.register.uint16_4 : right.register.uint16_4;
+                    vec.register.uint16_5 = left.register.uint16_5 > right.register.uint16_5 ? left.register.uint16_5 : right.register.uint16_5;
+                    vec.register.uint16_6 = left.register.uint16_6 > right.register.uint16_6 ? left.register.uint16_6 : right.register.uint16_6;
+                    vec.register.uint16_7 = left.register.uint16_7 > right.register.uint16_7 ? left.register.uint16_7 : right.register.uint16_7;
+                    return vec;
+                }
+                else if (typeof(T) == typeof(Int16))
+                {
+                    vec.register.int16_0 = left.register.int16_0 > right.register.int16_0 ? left.register.int16_0 : right.register.int16_0;
+                    vec.register.int16_1 = left.register.int16_1 > right.register.int16_1 ? left.register.int16_1 : right.register.int16_1;
+                    vec.register.int16_2 = left.register.int16_2 > right.register.int16_2 ? left.register.int16_2 : right.register.int16_2;
+                    vec.register.int16_3 = left.register.int16_3 > right.register.int16_3 ? left.register.int16_3 : right.register.int16_3;
+                    vec.register.int16_4 = left.register.int16_4 > right.register.int16_4 ? left.register.int16_4 : right.register.int16_4;
+                    vec.register.int16_5 = left.register.int16_5 > right.register.int16_5 ? left.register.int16_5 : right.register.int16_5;
+                    vec.register.int16_6 = left.register.int16_6 > right.register.int16_6 ? left.register.int16_6 : right.register.int16_6;
+                    vec.register.int16_7 = left.register.int16_7 > right.register.int16_7 ? left.register.int16_7 : right.register.int16_7;
+                    return vec;
+                }
+                else if (typeof(T) == typeof(UInt32))
+                {
+                    vec.register.uint32_0 = left.register.uint32_0 > right.register.uint32_0 ? left.register.uint32_0 : right.register.uint32_0;
+                    vec.register.uint32_1 = left.register.uint32_1 > right.register.uint32_1 ? left.register.uint32_1 : right.register.uint32_1;
+                    vec.register.uint32_2 = left.register.uint32_2 > right.register.uint32_2 ? left.register.uint32_2 : right.register.uint32_2;
+                    vec.register.uint32_3 = left.register.uint32_3 > right.register.uint32_3 ? left.register.uint32_3 : right.register.uint32_3;
+                    return vec;
+                }
+                else if (typeof(T) == typeof(Int32))
+                {
+                    vec.register.int32_0 = left.register.int32_0 > right.register.int32_0 ? left.register.int32_0 : right.register.int32_0;
+                    vec.register.int32_1 = left.register.int32_1 > right.register.int32_1 ? left.register.int32_1 : right.register.int32_1;
+                    vec.register.int32_2 = left.register.int32_2 > right.register.int32_2 ? left.register.int32_2 : right.register.int32_2;
+                    vec.register.int32_3 = left.register.int32_3 > right.register.int32_3 ? left.register.int32_3 : right.register.int32_3;
+                    return vec;
+                }
+                else if (typeof(T) == typeof(UInt64))
+                {
+                    vec.register.uint64_0 = left.register.uint64_0 > right.register.uint64_0 ? left.register.uint64_0 : right.register.uint64_0;
+                    vec.register.uint64_1 = left.register.uint64_1 > right.register.uint64_1 ? left.register.uint64_1 : right.register.uint64_1;
+                    return vec;
+                }
+                else if (typeof(T) == typeof(Int64))
+                {
+                    vec.register.int64_0 = left.register.int64_0 > right.register.int64_0 ? left.register.int64_0 : right.register.int64_0;
+                    vec.register.int64_1 = left.register.int64_1 > right.register.int64_1 ? left.register.int64_1 : right.register.int64_1;
+                    return vec;
+                }
+                else if (typeof(T) == typeof(Single))
+                {
+                    vec.register.single_0 = left.register.single_0 > right.register.single_0 ? left.register.single_0 : right.register.single_0;
+                    vec.register.single_1 = left.register.single_1 > right.register.single_1 ? left.register.single_1 : right.register.single_1;
+                    vec.register.single_2 = left.register.single_2 > right.register.single_2 ? left.register.single_2 : right.register.single_2;
+                    vec.register.single_3 = left.register.single_3 > right.register.single_3 ? left.register.single_3 : right.register.single_3;
+                    return vec;
+                }
+                else if (typeof(T) == typeof(Double))
+                {
+                    vec.register.double_0 = left.register.double_0 > right.register.double_0 ? left.register.double_0 : right.register.double_0;
+                    vec.register.double_1 = left.register.double_1 > right.register.double_1 ? left.register.double_1 : right.register.double_1;
+                    return vec;
+                }
+                else
+                {
+                    throw new NotSupportedException(SR.Arg_TypeNotSupported);
+                }
+            }
+        }
+
+        [JitIntrinsic]
+        internal static T DotProduct(Vector<T> left, Vector<T> right)
+        {
+            if (Vector.IsHardwareAccelerated)
+            {
+                T product = GetZeroValue();
+                for (int g = 0; g < Count; g++)
+                {
+                    product = ScalarAdd(product, ScalarMultiply(left[g], right[g]));
+                }
+                return product;
+            }
+            else
+            {
+                if (typeof(T) == typeof(Byte))
+                {
+                    Byte product = 0;
+                    product += (Byte)(left.register.byte_0 * right.register.byte_0);
+                    product += (Byte)(left.register.byte_1 * right.register.byte_1);
+                    product += (Byte)(left.register.byte_2 * right.register.byte_2);
+                    product += (Byte)(left.register.byte_3 * right.register.byte_3);
+                    product += (Byte)(left.register.byte_4 * right.register.byte_4);
+                    product += (Byte)(left.register.byte_5 * right.register.byte_5);
+                    product += (Byte)(left.register.byte_6 * right.register.byte_6);
+                    product += (Byte)(left.register.byte_7 * right.register.byte_7);
+                    product += (Byte)(left.register.byte_8 * right.register.byte_8);
+                    product += (Byte)(left.register.byte_9 * right.register.byte_9);
+                    product += (Byte)(left.register.byte_10 * right.register.byte_10);
+                    product += (Byte)(left.register.byte_11 * right.register.byte_11);
+                    product += (Byte)(left.register.byte_12 * right.register.byte_12);
+                    product += (Byte)(left.register.byte_13 * right.register.byte_13);
+                    product += (Byte)(left.register.byte_14 * right.register.byte_14);
+                    product += (Byte)(left.register.byte_15 * right.register.byte_15);
+                    return (T)(object)product;
+                }
+                else if (typeof(T) == typeof(SByte))
+                {
+                    SByte product = 0;
+                    product += (SByte)(left.register.sbyte_0 * right.register.sbyte_0);
+                    product += (SByte)(left.register.sbyte_1 * right.register.sbyte_1);
+                    product += (SByte)(left.register.sbyte_2 * right.register.sbyte_2);
+                    product += (SByte)(left.register.sbyte_3 * right.register.sbyte_3);
+                    product += (SByte)(left.register.sbyte_4 * right.register.sbyte_4);
+                    product += (SByte)(left.register.sbyte_5 * right.register.sbyte_5);
+                    product += (SByte)(left.register.sbyte_6 * right.register.sbyte_6);
+                    product += (SByte)(left.register.sbyte_7 * right.register.sbyte_7);
+                    product += (SByte)(left.register.sbyte_8 * right.register.sbyte_8);
+                    product += (SByte)(left.register.sbyte_9 * right.register.sbyte_9);
+                    product += (SByte)(left.register.sbyte_10 * right.register.sbyte_10);
+                    product += (SByte)(left.register.sbyte_11 * right.register.sbyte_11);
+                    product += (SByte)(left.register.sbyte_12 * right.register.sbyte_12);
+                    product += (SByte)(left.register.sbyte_13 * right.register.sbyte_13);
+                    product += (SByte)(left.register.sbyte_14 * right.register.sbyte_14);
+                    product += (SByte)(left.register.sbyte_15 * right.register.sbyte_15);
+                    return (T)(object)product;
+                }
+                else if (typeof(T) == typeof(UInt16))
+                {
+                    UInt16 product = 0;
+                    product += (UInt16)(left.register.uint16_0 * right.register.uint16_0);
+                    product += (UInt16)(left.register.uint16_1 * right.register.uint16_1);
+                    product += (UInt16)(left.register.uint16_2 * right.register.uint16_2);
+                    product += (UInt16)(left.register.uint16_3 * right.register.uint16_3);
+                    product += (UInt16)(left.register.uint16_4 * right.register.uint16_4);
+                    product += (UInt16)(left.register.uint16_5 * right.register.uint16_5);
+                    product += (UInt16)(left.register.uint16_6 * right.register.uint16_6);
+                    product += (UInt16)(left.register.uint16_7 * right.register.uint16_7);
+                    return (T)(object)product;
+                }
+                else if (typeof(T) == typeof(Int16))
+                {
+                    Int16 product = 0;
+                    product += (Int16)(left.register.int16_0 * right.register.int16_0);
+                    product += (Int16)(left.register.int16_1 * right.register.int16_1);
+                    product += (Int16)(left.register.int16_2 * right.register.int16_2);
+                    product += (Int16)(left.register.int16_3 * right.register.int16_3);
+                    product += (Int16)(left.register.int16_4 * right.register.int16_4);
+                    product += (Int16)(left.register.int16_5 * right.register.int16_5);
+                    product += (Int16)(left.register.int16_6 * right.register.int16_6);
+                    product += (Int16)(left.register.int16_7 * right.register.int16_7);
+                    return (T)(object)product;
+                }
+                else if (typeof(T) == typeof(UInt32))
+                {
+                    UInt32 product = 0;
+                    product += (UInt32)(left.register.uint32_0 * right.register.uint32_0);
+                    product += (UInt32)(left.register.uint32_1 * right.register.uint32_1);
+                    product += (UInt32)(left.register.uint32_2 * right.register.uint32_2);
+                    product += (UInt32)(left.register.uint32_3 * right.register.uint32_3);
+                    return (T)(object)product;
+                }
+                else if (typeof(T) == typeof(Int32))
+                {
+                    Int32 product = 0;
+                    product += (Int32)(left.register.int32_0 * right.register.int32_0);
+                    product += (Int32)(left.register.int32_1 * right.register.int32_1);
+                    product += (Int32)(left.register.int32_2 * right.register.int32_2);
+                    product += (Int32)(left.register.int32_3 * right.register.int32_3);
+                    return (T)(object)product;
+                }
+                else if (typeof(T) == typeof(UInt64))
+                {
+                    UInt64 product = 0;
+                    product += (UInt64)(left.register.uint64_0 * right.register.uint64_0);
+                    product += (UInt64)(left.register.uint64_1 * right.register.uint64_1);
+                    return (T)(object)product;
+                }
+                else if (typeof(T) == typeof(Int64))
+                {
+                    Int64 product = 0;
+                    product += (Int64)(left.register.int64_0 * right.register.int64_0);
+                    product += (Int64)(left.register.int64_1 * right.register.int64_1);
+                    return (T)(object)product;
+                }
+                else if (typeof(T) == typeof(Single))
+                {
+                    Single product = 0;
+                    product += (Single)(left.register.single_0 * right.register.single_0);
+                    product += (Single)(left.register.single_1 * right.register.single_1);
+                    product += (Single)(left.register.single_2 * right.register.single_2);
+                    product += (Single)(left.register.single_3 * right.register.single_3);
+                    return (T)(object)product;
+                }
+                else if (typeof(T) == typeof(Double))
+                {
+                    Double product = 0;
+                    product += (Double)(left.register.double_0 * right.register.double_0);
+                    product += (Double)(left.register.double_1 * right.register.double_1);
+                    return (T)(object)product;
+                }
+                else
+                {
+                    throw new NotSupportedException(SR.Arg_TypeNotSupported);
+                }
+            }
+        }
+
+        [JitIntrinsic]
+        internal static unsafe Vector<T> SquareRoot(Vector<T> value)
+        {
+            if (Vector.IsHardwareAccelerated)
+            {
+                if (typeof(T) == typeof(Byte))
+                {
+                    Byte* dataPtr = stackalloc Byte[Count];
+                    for (int g = 0; g < Count; g++)
+                    {
+                        dataPtr[g] = (Byte)Math.Sqrt((Byte)(object)value[g]);
+                    }
+                    return new Vector<T>(dataPtr);
+                }
+                else if (typeof(T) == typeof(SByte))
+                {
+                    SByte* dataPtr = stackalloc SByte[Count];
+                    for (int g = 0; g < Count; g++)
+                    {
+                        dataPtr[g] = (SByte)Math.Sqrt((SByte)(object)value[g]);
+                    }
+                    return new Vector<T>(dataPtr);
+                }
+                else if (typeof(T) == typeof(UInt16))
+                {
+                    UInt16* dataPtr = stackalloc UInt16[Count];
+                    for (int g = 0; g < Count; g++)
+                    {
+                        dataPtr[g] = (UInt16)Math.Sqrt((UInt16)(object)value[g]);
+                    }
+                    return new Vector<T>(dataPtr);
+                }
+                else if (typeof(T) == typeof(Int16))
+                {
+                    Int16* dataPtr = stackalloc Int16[Count];
+                    for (int g = 0; g < Count; g++)
+                    {
+                        dataPtr[g] = (Int16)Math.Sqrt((Int16)(object)value[g]);
+                    }
+                    return new Vector<T>(dataPtr);
+                }
+                else if (typeof(T) == typeof(UInt32))
+                {
+                    UInt32* dataPtr = stackalloc UInt32[Count];
+                    for (int g = 0; g < Count; g++)
+                    {
+                        dataPtr[g] = (UInt32)Math.Sqrt((UInt32)(object)value[g]);
+                    }
+                    return new Vector<T>(dataPtr);
+                }
+                else if (typeof(T) == typeof(Int32))
+                {
+                    Int32* dataPtr = stackalloc Int32[Count];
+                    for (int g = 0; g < Count; g++)
+                    {
+                        dataPtr[g] = (Int32)Math.Sqrt((Int32)(object)value[g]);
+                    }
+                    return new Vector<T>(dataPtr);
+                }
+                else if (typeof(T) == typeof(UInt64))
+                {
+                    UInt64* dataPtr = stackalloc UInt64[Count];
+                    for (int g = 0; g < Count; g++)
+                    {
+                        dataPtr[g] = (UInt64)Math.Sqrt((UInt64)(object)value[g]);
+                    }
+                    return new Vector<T>(dataPtr);
+                }
+                else if (typeof(T) == typeof(Int64))
+                {
+                    Int64* dataPtr = stackalloc Int64[Count];
+                    for (int g = 0; g < Count; g++)
+                    {
+                        dataPtr[g] = (Int64)Math.Sqrt((Int64)(object)value[g]);
+                    }
+                    return new Vector<T>(dataPtr);
+                }
+                else if (typeof(T) == typeof(Single))
+                {
+                    Single* dataPtr = stackalloc Single[Count];
+                    for (int g = 0; g < Count; g++)
+                    {
+                        dataPtr[g] = (Single)Math.Sqrt((Single)(object)value[g]);
+                    }
+                    return new Vector<T>(dataPtr);
+                }
+                else if (typeof(T) == typeof(Double))
+                {
+                    Double* dataPtr = stackalloc Double[Count];
+                    for (int g = 0; g < Count; g++)
+                    {
+                        dataPtr[g] = (Double)Math.Sqrt((Double)(object)value[g]);
+                    }
+                    return new Vector<T>(dataPtr);
+                }
+                else
+                {
+                    throw new NotSupportedException(SR.Arg_TypeNotSupported);
+                }
+            }
+            else
+            {
+                if (typeof(T) == typeof(Byte))
+                {
+                    value.register.byte_0 = (Byte)Math.Sqrt(value.register.byte_0);
+                    value.register.byte_1 = (Byte)Math.Sqrt(value.register.byte_1);
+                    value.register.byte_2 = (Byte)Math.Sqrt(value.register.byte_2);
+                    value.register.byte_3 = (Byte)Math.Sqrt(value.register.byte_3);
+                    value.register.byte_4 = (Byte)Math.Sqrt(value.register.byte_4);
+                    value.register.byte_5 = (Byte)Math.Sqrt(value.register.byte_5);
+                    value.register.byte_6 = (Byte)Math.Sqrt(value.register.byte_6);
+                    value.register.byte_7 = (Byte)Math.Sqrt(value.register.byte_7);
+                    value.register.byte_8 = (Byte)Math.Sqrt(value.register.byte_8);
+                    value.register.byte_9 = (Byte)Math.Sqrt(value.register.byte_9);
+                    value.register.byte_10 = (Byte)Math.Sqrt(value.register.byte_10);
+                    value.register.byte_11 = (Byte)Math.Sqrt(value.register.byte_11);
+                    value.register.byte_12 = (Byte)Math.Sqrt(value.register.byte_12);
+                    value.register.byte_13 = (Byte)Math.Sqrt(value.register.byte_13);
+                    value.register.byte_14 = (Byte)Math.Sqrt(value.register.byte_14);
+                    value.register.byte_15 = (Byte)Math.Sqrt(value.register.byte_15);
+                    return value;
+                }
+                else if (typeof(T) == typeof(SByte))
+                {
+                    value.register.sbyte_0 = (SByte)Math.Sqrt(value.register.sbyte_0);
+                    value.register.sbyte_1 = (SByte)Math.Sqrt(value.register.sbyte_1);
+                    value.register.sbyte_2 = (SByte)Math.Sqrt(value.register.sbyte_2);
+                    value.register.sbyte_3 = (SByte)Math.Sqrt(value.register.sbyte_3);
+                    value.register.sbyte_4 = (SByte)Math.Sqrt(value.register.sbyte_4);
+                    value.register.sbyte_5 = (SByte)Math.Sqrt(value.register.sbyte_5);
+                    value.register.sbyte_6 = (SByte)Math.Sqrt(value.register.sbyte_6);
+                    value.register.sbyte_7 = (SByte)Math.Sqrt(value.register.sbyte_7);
+                    value.register.sbyte_8 = (SByte)Math.Sqrt(value.register.sbyte_8);
+                    value.register.sbyte_9 = (SByte)Math.Sqrt(value.register.sbyte_9);
+                    value.register.sbyte_10 = (SByte)Math.Sqrt(value.register.sbyte_10);
+                    value.register.sbyte_11 = (SByte)Math.Sqrt(value.register.sbyte_11);
+                    value.register.sbyte_12 = (SByte)Math.Sqrt(value.register.sbyte_12);
+                    value.register.sbyte_13 = (SByte)Math.Sqrt(value.register.sbyte_13);
+                    value.register.sbyte_14 = (SByte)Math.Sqrt(value.register.sbyte_14);
+                    value.register.sbyte_15 = (SByte)Math.Sqrt(value.register.sbyte_15);
+                    return value;
+                }
+                else if (typeof(T) == typeof(UInt16))
+                {
+                    value.register.uint16_0 = (UInt16)Math.Sqrt(value.register.uint16_0);
+                    value.register.uint16_1 = (UInt16)Math.Sqrt(value.register.uint16_1);
+                    value.register.uint16_2 = (UInt16)Math.Sqrt(value.register.uint16_2);
+                    value.register.uint16_3 = (UInt16)Math.Sqrt(value.register.uint16_3);
+                    value.register.uint16_4 = (UInt16)Math.Sqrt(value.register.uint16_4);
+                    value.register.uint16_5 = (UInt16)Math.Sqrt(value.register.uint16_5);
+                    value.register.uint16_6 = (UInt16)Math.Sqrt(value.register.uint16_6);
+                    value.register.uint16_7 = (UInt16)Math.Sqrt(value.register.uint16_7);
+                    return value;
+                }
+                else if (typeof(T) == typeof(Int16))
+                {
+                    value.register.int16_0 = (Int16)Math.Sqrt(value.register.int16_0);
+                    value.register.int16_1 = (Int16)Math.Sqrt(value.register.int16_1);
+                    value.register.int16_2 = (Int16)Math.Sqrt(value.register.int16_2);
+                    value.register.int16_3 = (Int16)Math.Sqrt(value.register.int16_3);
+                    value.register.int16_4 = (Int16)Math.Sqrt(value.register.int16_4);
+                    value.register.int16_5 = (Int16)Math.Sqrt(value.register.int16_5);
+                    value.register.int16_6 = (Int16)Math.Sqrt(value.register.int16_6);
+                    value.register.int16_7 = (Int16)Math.Sqrt(value.register.int16_7);
+                    return value;
+                }
+                else if (typeof(T) == typeof(UInt32))
+                {
+                    value.register.uint32_0 = (UInt32)Math.Sqrt(value.register.uint32_0);
+                    value.register.uint32_1 = (UInt32)Math.Sqrt(value.register.uint32_1);
+                    value.register.uint32_2 = (UInt32)Math.Sqrt(value.register.uint32_2);
+                    value.register.uint32_3 = (UInt32)Math.Sqrt(value.register.uint32_3);
+                    return value;
+                }
+                else if (typeof(T) == typeof(Int32))
+                {
+                    value.register.int32_0 = (Int32)Math.Sqrt(value.register.int32_0);
+                    value.register.int32_1 = (Int32)Math.Sqrt(value.register.int32_1);
+                    value.register.int32_2 = (Int32)Math.Sqrt(value.register.int32_2);
+                    value.register.int32_3 = (Int32)Math.Sqrt(value.register.int32_3);
+                    return value;
+                }
+                else if (typeof(T) == typeof(UInt64))
+                {
+                    value.register.uint64_0 = (UInt64)Math.Sqrt(value.register.uint64_0);
+                    value.register.uint64_1 = (UInt64)Math.Sqrt(value.register.uint64_1);
+                    return value;
+                }
+                else if (typeof(T) == typeof(Int64))
+                {
+                    value.register.int64_0 = (Int64)Math.Sqrt(value.register.int64_0);
+                    value.register.int64_1 = (Int64)Math.Sqrt(value.register.int64_1);
+                    return value;
+                }
+                else if (typeof(T) == typeof(Single))
+                {
+                    value.register.single_0 = (Single)Math.Sqrt(value.register.single_0);
+                    value.register.single_1 = (Single)Math.Sqrt(value.register.single_1);
+                    value.register.single_2 = (Single)Math.Sqrt(value.register.single_2);
+                    value.register.single_3 = (Single)Math.Sqrt(value.register.single_3);
+                    return value;
+                }
+                else if (typeof(T) == typeof(Double))
+                {
+                    value.register.double_0 = (Double)Math.Sqrt(value.register.double_0);
+                    value.register.double_1 = (Double)Math.Sqrt(value.register.double_1);
+                    return value;
+                }
+                else
+                {
+                    throw new NotSupportedException(SR.Arg_TypeNotSupported);
+                }
+            }
+        }
+        #endregion Internal Math Methods
+
+        #region Helper Methods
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        private static bool ScalarEquals(T left, T right)
+        {
+            if (typeof(T) == typeof(Byte))
+            {
+                return (Byte)(object)left == (Byte)(object)right;
+            }
+            else if (typeof(T) == typeof(SByte))
+            {
+                return (SByte)(object)left == (SByte)(object)right;
+            }
+            else if (typeof(T) == typeof(UInt16))
+            {
+                return (UInt16)(object)left == (UInt16)(object)right;
+            }
+            else if (typeof(T) == typeof(Int16))
+            {
+                return (Int16)(object)left == (Int16)(object)right;
+            }
+            else if (typeof(T) == typeof(UInt32))
+            {
+                return (UInt32)(object)left == (UInt32)(object)right;
+            }
+            else if (typeof(T) == typeof(Int32))
+            {
+                return (Int32)(object)left == (Int32)(object)right;
+            }
+            else if (typeof(T) == typeof(UInt64))
+            {
+                return (UInt64)(object)left == (UInt64)(object)right;
+            }
+            else if (typeof(T) == typeof(Int64))
+            {
+                return (Int64)(object)left == (Int64)(object)right;
+            }
+            else if (typeof(T) == typeof(Single))
+            {
+                return (Single)(object)left == (Single)(object)right;
+            }
+            else if (typeof(T) == typeof(Double))
+            {
+                return (Double)(object)left == (Double)(object)right;
+            }
+            else
+            {
+                throw new NotSupportedException(SR.Arg_TypeNotSupported);
+            }
+        }
+
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        private static bool ScalarLessThan(T left, T right)
+        {
+            if (typeof(T) == typeof(Byte))
+            {
+                return (Byte)(object)left < (Byte)(object)right;
+            }
+            else if (typeof(T) == typeof(SByte))
+            {
+                return (SByte)(object)left < (SByte)(object)right;
+            }
+            else if (typeof(T) == typeof(UInt16))
+            {
+                return (UInt16)(object)left < (UInt16)(object)right;
+            }
+            else if (typeof(T) == typeof(Int16))
+            {
+                return (Int16)(object)left < (Int16)(object)right;
+            }
+            else if (typeof(T) == typeof(UInt32))
+            {
+                return (UInt32)(object)left < (UInt32)(object)right;
+            }
+            else if (typeof(T) == typeof(Int32))
+            {
+                return (Int32)(object)left < (Int32)(object)right;
+            }
+            else if (typeof(T) == typeof(UInt64))
+            {
+                return (UInt64)(object)left < (UInt64)(object)right;
+            }
+            else if (typeof(T) == typeof(Int64))
+            {
+                return (Int64)(object)left < (Int64)(object)right;
+            }
+            else if (typeof(T) == typeof(Single))
+            {
+                return (Single)(object)left < (Single)(object)right;
+            }
+            else if (typeof(T) == typeof(Double))
+            {
+                return (Double)(object)left < (Double)(object)right;
+            }
+            else
+            {
+                throw new NotSupportedException(SR.Arg_TypeNotSupported);
+            }
+        }
+
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        private static bool ScalarGreaterThan(T left, T right)
+        {
+            if (typeof(T) == typeof(Byte))
+            {
+                return (Byte)(object)left > (Byte)(object)right;
+            }
+            else if (typeof(T) == typeof(SByte))
+            {
+                return (SByte)(object)left > (SByte)(object)right;
+            }
+            else if (typeof(T) == typeof(UInt16))
+            {
+                return (UInt16)(object)left > (UInt16)(object)right;
+            }
+            else if (typeof(T) == typeof(Int16))
+            {
+                return (Int16)(object)left > (Int16)(object)right;
+            }
+            else if (typeof(T) == typeof(UInt32))
+            {
+                return (UInt32)(object)left > (UInt32)(object)right;
+            }
+            else if (typeof(T) == typeof(Int32))
+            {
+                return (Int32)(object)left > (Int32)(object)right;
+            }
+            else if (typeof(T) == typeof(UInt64))
+            {
+                return (UInt64)(object)left > (UInt64)(object)right;
+            }
+            else if (typeof(T) == typeof(Int64))
+            {
+                return (Int64)(object)left > (Int64)(object)right;
+            }
+            else if (typeof(T) == typeof(Single))
+            {
+                return (Single)(object)left > (Single)(object)right;
+            }
+            else if (typeof(T) == typeof(Double))
+            {
+                return (Double)(object)left > (Double)(object)right;
+            }
+            else
+            {
+                throw new NotSupportedException(SR.Arg_TypeNotSupported);
+            }
+        }
+
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        private static T ScalarAdd(T left, T right)
+        {
+            if (typeof(T) == typeof(Byte))
+            {
+                return (T)(object)(Byte)((Byte)(object)left + (Byte)(object)right);
+            }
+            else if (typeof(T) == typeof(SByte))
+            {
+                return (T)(object)(SByte)((SByte)(object)left + (SByte)(object)right);
+            }
+            else if (typeof(T) == typeof(UInt16))
+            {
+                return (T)(object)(UInt16)((UInt16)(object)left + (UInt16)(object)right);
+            }
+            else if (typeof(T) == typeof(Int16))
+            {
+                return (T)(object)(Int16)((Int16)(object)left + (Int16)(object)right);
+            }
+            else if (typeof(T) == typeof(UInt32))
+            {
+                return (T)(object)(UInt32)((UInt32)(object)left + (UInt32)(object)right);
+            }
+            else if (typeof(T) == typeof(Int32))
+            {
+                return (T)(object)(Int32)((Int32)(object)left + (Int32)(object)right);
+            }
+            else if (typeof(T) == typeof(UInt64))
+            {
+                return (T)(object)(UInt64)((UInt64)(object)left + (UInt64)(object)right);
+            }
+            else if (typeof(T) == typeof(Int64))
+            {
+                return (T)(object)(Int64)((Int64)(object)left + (Int64)(object)right);
+            }
+            else if (typeof(T) == typeof(Single))
+            {
+                return (T)(object)(Single)((Single)(object)left + (Single)(object)right);
+            }
+            else if (typeof(T) == typeof(Double))
+            {
+                return (T)(object)(Double)((Double)(object)left + (Double)(object)right);
+            }
+            else
+            {
+                throw new NotSupportedException(SR.Arg_TypeNotSupported);
+            }
+        }
+
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        private static T ScalarSubtract(T left, T right)
+        {
+            if (typeof(T) == typeof(Byte))
+            {
+                return (T)(object)(Byte)((Byte)(object)left - (Byte)(object)right);
+            }
+            else if (typeof(T) == typeof(SByte))
+            {
+                return (T)(object)(SByte)((SByte)(object)left - (SByte)(object)right);
+            }
+            else if (typeof(T) == typeof(UInt16))
+            {
+                return (T)(object)(UInt16)((UInt16)(object)left - (UInt16)(object)right);
+            }
+            else if (typeof(T) == typeof(Int16))
+            {
+                return (T)(object)(Int16)((Int16)(object)left - (Int16)(object)right);
+            }
+            else if (typeof(T) == typeof(UInt32))
+            {
+                return (T)(object)(UInt32)((UInt32)(object)left - (UInt32)(object)right);
+            }
+            else if (typeof(T) == typeof(Int32))
+            {
+                return (T)(object)(Int32)((Int32)(object)left - (Int32)(object)right);
+            }
+            else if (typeof(T) == typeof(UInt64))
+            {
+                return (T)(object)(UInt64)((UInt64)(object)left - (UInt64)(object)right);
+            }
+            else if (typeof(T) == typeof(Int64))
+            {
+                return (T)(object)(Int64)((Int64)(object)left - (Int64)(object)right);
+            }
+            else if (typeof(T) == typeof(Single))
+            {
+                return (T)(object)(Single)((Single)(object)left - (Single)(object)right);
+            }
+            else if (typeof(T) == typeof(Double))
+            {
+                return (T)(object)(Double)((Double)(object)left - (Double)(object)right);
+            }
+            else
+            {
+                throw new NotSupportedException(SR.Arg_TypeNotSupported);
+            }
+        }
+
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        private static T ScalarMultiply(T left, T right)
+        {
+            if (typeof(T) == typeof(Byte))
+            {
+                return (T)(object)(Byte)((Byte)(object)left * (Byte)(object)right);
+            }
+            else if (typeof(T) == typeof(SByte))
+            {
+                return (T)(object)(SByte)((SByte)(object)left * (SByte)(object)right);
+            }
+            else if (typeof(T) == typeof(UInt16))
+            {
+                return (T)(object)(UInt16)((UInt16)(object)left * (UInt16)(object)right);
+            }
+            else if (typeof(T) == typeof(Int16))
+            {
+                return (T)(object)(Int16)((Int16)(object)left * (Int16)(object)right);
+            }
+            else if (typeof(T) == typeof(UInt32))
+            {
+                return (T)(object)(UInt32)((UInt32)(object)left * (UInt32)(object)right);
+            }
+            else if (typeof(T) == typeof(Int32))
+            {
+                return (T)(object)(Int32)((Int32)(object)left * (Int32)(object)right);
+            }
+            else if (typeof(T) == typeof(UInt64))
+            {
+                return (T)(object)(UInt64)((UInt64)(object)left * (UInt64)(object)right);
+            }
+            else if (typeof(T) == typeof(Int64))
+            {
+                return (T)(object)(Int64)((Int64)(object)left * (Int64)(object)right);
+            }
+            else if (typeof(T) == typeof(Single))
+            {
+                return (T)(object)(Single)((Single)(object)left * (Single)(object)right);
+            }
+            else if (typeof(T) == typeof(Double))
+            {
+                return (T)(object)(Double)((Double)(object)left * (Double)(object)right);
+            }
+            else
+            {
+                throw new NotSupportedException(SR.Arg_TypeNotSupported);
+            }
+        }
+
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        private static T ScalarDivide(T left, T right)
+        {
+            if (typeof(T) == typeof(Byte))
+            {
+                return (T)(object)(Byte)((Byte)(object)left / (Byte)(object)right);
+            }
+            else if (typeof(T) == typeof(SByte))
+            {
+                return (T)(object)(SByte)((SByte)(object)left / (SByte)(object)right);
+            }
+            else if (typeof(T) == typeof(UInt16))
+            {
+                return (T)(object)(UInt16)((UInt16)(object)left / (UInt16)(object)right);
+            }
+            else if (typeof(T) == typeof(Int16))
+            {
+                return (T)(object)(Int16)((Int16)(object)left / (Int16)(object)right);
+            }
+            else if (typeof(T) == typeof(UInt32))
+            {
+                return (T)(object)(UInt32)((UInt32)(object)left / (UInt32)(object)right);
+            }
+            else if (typeof(T) == typeof(Int32))
+            {
+                return (T)(object)(Int32)((Int32)(object)left / (Int32)(object)right);
+            }
+            else if (typeof(T) == typeof(UInt64))
+            {
+                return (T)(object)(UInt64)((UInt64)(object)left / (UInt64)(object)right);
+            }
+            else if (typeof(T) == typeof(Int64))
+            {
+                return (T)(object)(Int64)((Int64)(object)left / (Int64)(object)right);
+            }
+            else if (typeof(T) == typeof(Single))
+            {
+                return (T)(object)(Single)((Single)(object)left / (Single)(object)right);
+            }
+            else if (typeof(T) == typeof(Double))
+            {
+                return (T)(object)(Double)((Double)(object)left / (Double)(object)right);
+            }
+            else
+            {
+                throw new NotSupportedException(SR.Arg_TypeNotSupported);
+            }
+        }
+
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        private static T GetZeroValue()
+        {
+            if (typeof(T) == typeof(Byte))
+            {
+                Byte value = 0;
+                return (T)(object)value;
+            }
+            else if (typeof(T) == typeof(SByte))
+            {
+                SByte value = 0;
+                return (T)(object)value;
+            }
+            else if (typeof(T) == typeof(UInt16))
+            {
+                UInt16 value = 0;
+                return (T)(object)value;
+            }
+            else if (typeof(T) == typeof(Int16))
+            {
+                Int16 value = 0;
+                return (T)(object)value;
+            }
+            else if (typeof(T) == typeof(UInt32))
+            {
+                UInt32 value = 0;
+                return (T)(object)value;
+            }
+            else if (typeof(T) == typeof(Int32))
+            {
+                Int32 value = 0;
+                return (T)(object)value;
+            }
+            else if (typeof(T) == typeof(UInt64))
+            {
+                UInt64 value = 0;
+                return (T)(object)value;
+            }
+            else if (typeof(T) == typeof(Int64))
+            {
+                Int64 value = 0;
+                return (T)(object)value;
+            }
+            else if (typeof(T) == typeof(Single))
+            {
+                Single value = 0;
+                return (T)(object)value;
+            }
+            else if (typeof(T) == typeof(Double))
+            {
+                Double value = 0;
+                return (T)(object)value;
+            }
+            else
+            {
+                throw new NotSupportedException(SR.Arg_TypeNotSupported);
+            }
+        }
+
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        private static T GetOneValue()
+        {
+            if (typeof(T) == typeof(Byte))
+            {
+                Byte value = 1;
+                return (T)(object)value;
+            }
+            else if (typeof(T) == typeof(SByte))
+            {
+                SByte value = 1;
+                return (T)(object)value;
+            }
+            else if (typeof(T) == typeof(UInt16))
+            {
+                UInt16 value = 1;
+                return (T)(object)value;
+            }
+            else if (typeof(T) == typeof(Int16))
+            {
+                Int16 value = 1;
+                return (T)(object)value;
+            }
+            else if (typeof(T) == typeof(UInt32))
+            {
+                UInt32 value = 1;
+                return (T)(object)value;
+            }
+            else if (typeof(T) == typeof(Int32))
+            {
+                Int32 value = 1;
+                return (T)(object)value;
+            }
+            else if (typeof(T) == typeof(UInt64))
+            {
+                UInt64 value = 1;
+                return (T)(object)value;
+            }
+            else if (typeof(T) == typeof(Int64))
+            {
+                Int64 value = 1;
+                return (T)(object)value;
+            }
+            else if (typeof(T) == typeof(Single))
+            {
+                Single value = 1;
+                return (T)(object)value;
+            }
+            else if (typeof(T) == typeof(Double))
+            {
+                Double value = 1;
+                return (T)(object)value;
+            }
+            else
+            {
+                throw new NotSupportedException(SR.Arg_TypeNotSupported);
+            }
+        }
+
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        private static T GetAllBitsSetValue()
+        {
+            if (typeof(T) == typeof(Byte))
+            {
+                return (T)(object)ConstantHelper.GetByteWithAllBitsSet();
+            }
+            else if (typeof(T) == typeof(SByte))
+            {
+                return (T)(object)ConstantHelper.GetSByteWithAllBitsSet();
+            }
+            else if (typeof(T) == typeof(UInt16))
+            {
+                return (T)(object)ConstantHelper.GetUInt16WithAllBitsSet();
+            }
+            else if (typeof(T) == typeof(Int16))
+            {
+                return (T)(object)ConstantHelper.GetInt16WithAllBitsSet();
+            }
+            else if (typeof(T) == typeof(UInt32))
+            {
+                return (T)(object)ConstantHelper.GetUInt32WithAllBitsSet();
+            }
+            else if (typeof(T) == typeof(Int32))
+            {
+                return (T)(object)ConstantHelper.GetInt32WithAllBitsSet();
+            }
+            else if (typeof(T) == typeof(UInt64))
+            {
+                return (T)(object)ConstantHelper.GetUInt64WithAllBitsSet();
+            }
+            else if (typeof(T) == typeof(Int64))
+            {
+                return (T)(object)ConstantHelper.GetInt64WithAllBitsSet();
+            }
+            else if (typeof(T) == typeof(Single))
+            {
+                return (T)(object)ConstantHelper.GetSingleWithAllBitsSet();
+            }
+            else if (typeof(T) == typeof(Double))
+            {
+                return (T)(object)ConstantHelper.GetDoubleWithAllBitsSet();
+            }
+            else
+            {
+                throw new NotSupportedException(SR.Arg_TypeNotSupported);
+            }
+        }
+        #endregion
+    }
+}
diff --git a/mcs/class/System.Numerics.Vectors/System.Numerics/Vector_Operations.cs b/mcs/class/System.Numerics.Vectors/System.Numerics/Vector_Operations.cs
new file mode 100644 (file)
index 0000000..83a5ad3
--- /dev/null
@@ -0,0 +1,865 @@
+// 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.Runtime.CompilerServices;
+
+namespace System.Numerics
+{
+    /// <summary>
+    /// Contains various methods useful for creating, manipulating, combining, and converting generic vectors with one another.
+    /// </summary>
+    public static class Vector
+    {
+        // JIT is not looking at the Vector class methods
+        // all methods here should be inlined and they must be implemented in terms of Vector<T> intrinsics
+        #region Select Methods
+        /// <summary>
+        /// Creates a new vector with elements selected between the two given source vectors, and based on a mask vector.
+        /// </summary>
+        /// <param name="condition">The integral mask vector used to drive selection.</param>
+        /// <param name="left">The first source vector.</param>
+        /// <param name="right">The second source vector.</param>
+        /// <returns>The new vector with elements selected based on the mask.</returns>
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static Vector<Single> ConditionalSelect(Vector<int> condition, Vector<Single> left, Vector<Single> right)
+        {
+            return (Vector<Single>)Vector<Single>.ConditionalSelect((Vector<Single>)condition, left, right);
+        }
+
+        /// <summary>
+        /// Creates a new vector with elements selected between the two given source vectors, and based on a mask vector.
+        /// </summary>
+        /// <param name="condition">The integral mask vector used to drive selection.</param>
+        /// <param name="left">The first source vector.</param>
+        /// <param name="right">The second source vector.</param>
+        /// <returns>The new vector with elements selected based on the mask.</returns>
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static Vector<double> ConditionalSelect(Vector<long> condition, Vector<double> left, Vector<double> right)
+        {
+            return (Vector<double>)Vector<double>.ConditionalSelect((Vector<double>)condition, left, right);
+        }
+
+        /// <summary>
+        /// Creates a new vector with elements selected between the two given source vectors, and based on a mask vector.
+        /// </summary>
+        /// <param name="condition">The mask vector used to drive selection.</param>
+        /// <param name="left">The first source vector.</param>
+        /// <param name="right">The second source vector.</param>
+        /// <returns>The new vector with elements selected based on the mask.</returns>
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static Vector<T> ConditionalSelect<T>(Vector<T> condition, Vector<T> left, Vector<T> right) where T : struct
+        {
+            return Vector<T>.ConditionalSelect(condition, left, right);
+        }
+        #endregion Select Methods
+
+        #region Comparison methods
+        #region Equals methods
+        /// <summary>
+        /// Returns a new vector whose elements signal whether the elements in left and right were equal.
+        /// </summary>
+        /// <param name="left">The first vector to compare.</param>
+        /// <param name="right">The second vector to compare.</param>
+        /// <returns>The resultant vector.</returns>
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static Vector<T> Equals<T>(Vector<T> left, Vector<T> right) where T : struct
+        {
+            return Vector<T>.Equals(left, right);
+        }
+
+        /// <summary>
+        /// Returns an integral vector whose elements signal whether elements in the left and right floating point vectors were equal.
+        /// </summary>
+        /// <param name="left">The first vector to compare.</param>
+        /// <param name="right">The second vector to compare.</param>
+        /// <returns>The resultant vector.</returns>
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static Vector<int> Equals(Vector<Single> left, Vector<Single> right)
+        {
+            return (Vector<int>)Vector<Single>.Equals(left, right);
+        }
+
+        /// <summary>
+        /// Returns a new vector whose elements signal whether the elements in left and right were equal.
+        /// </summary>
+        /// <param name="left">The first vector to compare.</param>
+        /// <param name="right">The second vector to compare.</param>
+        /// <returns>The resultant vector.</returns>
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static Vector<int> Equals(Vector<int> left, Vector<int> right)
+        {
+            return Vector<int>.Equals(left, right);
+        }
+
+        /// <summary>
+        /// Returns an integral vector whose elements signal whether elements in the left and right floating point vectors were equal.
+        /// </summary>
+        /// <param name="left">The first vector to compare.</param>
+        /// <param name="right">The second vector to compare.</param>
+        /// <returns>The resultant vector.</returns>
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static Vector<long> Equals(Vector<double> left, Vector<double> right)
+        {
+            return (Vector<long>)Vector<double>.Equals(left, right);
+        }
+
+        /// <summary>
+        /// Returns a new vector whose elements signal whether the elements in left and right were equal.
+        /// </summary>
+        /// <param name="left">The first vector to compare.</param>
+        /// <param name="right">The second vector to compare.</param>
+        /// <returns>The resultant vector.</returns>
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static Vector<long> Equals(Vector<long> left, Vector<long> right)
+        {
+            return Vector<long>.Equals(left, right);
+        }
+
+        /// <summary>
+        /// Returns a boolean indicating whether each pair of elements in the given vectors are equal.
+        /// </summary>
+        /// <param name="left">The first vector to compare.</param>
+        /// <param name="right">The first vector to compare.</param>
+        /// <returns>True if all elements are equal; False otherwise.</returns>
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static bool EqualsAll<T>(Vector<T> left, Vector<T> right) where T : struct
+        {
+            return left == right;
+        }
+
+        /// <summary>
+        /// Returns a boolean indicating whether any single pair of elements in the given vectors are equal.
+        /// </summary>
+        /// <param name="left">The first vector to compare.</param>
+        /// <param name="right">The second vector to compare.</param>
+        /// <returns>True if any element pairs are equal; False if no element pairs are equal.</returns>
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static bool EqualsAny<T>(Vector<T> left, Vector<T> right) where T : struct
+        {
+            return !Vector<T>.Equals(left, right).Equals(Vector<T>.Zero);
+        }
+        #endregion Equals methods
+
+        #region Lessthan Methods
+        /// <summary>
+        /// Returns a new vector whose elements signal whether the elements in left were less than their
+        /// corresponding elements in right.
+        /// </summary>
+        /// <param name="left">The first vector to compare.</param>
+        /// <param name="right">The second vector to compare.</param>
+        /// <returns>The resultant vector.</returns>
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static Vector<T> LessThan<T>(Vector<T> left, Vector<T> right) where T : struct
+        {
+            return Vector<T>.LessThan(left, right);
+        }
+
+        /// <summary>
+        /// Returns an integral vector whose elements signal whether the elements in left were less than their
+        /// corresponding elements in right.
+        /// </summary>
+        /// <param name="left">The first vector to compare.</param>
+        /// <param name="right">The second vector to compare.</param>
+        /// <returns>The resultant integral vector.</returns>
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static Vector<int> LessThan(Vector<Single> left, Vector<Single> right)
+        {
+            return (Vector<int>)Vector<Single>.LessThan(left, right);
+        }
+
+        /// <summary>
+        /// Returns a new vector whose elements signal whether the elements in left were less than their
+        /// corresponding elements in right.
+        /// </summary>
+        /// <param name="left">The first vector to compare.</param>
+        /// <param name="right">The second vector to compare.</param>
+        /// <returns>The resultant vector.</returns>
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static Vector<int> LessThan(Vector<int> left, Vector<int> right)
+        {
+            return Vector<int>.LessThan(left, right);
+        }
+
+        /// <summary>
+        /// Returns an integral vector whose elements signal whether the elements in left were less than their
+        /// corresponding elements in right.
+        /// </summary>
+        /// <param name="left">The first vector to compare.</param>
+        /// <param name="right">The second vector to compare.</param>
+        /// <returns>The resultant integral vector.</returns>
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static Vector<long> LessThan(Vector<double> left, Vector<double> right)
+        {
+            return (Vector<long>)Vector<double>.LessThan(left, right);
+        }
+
+        /// <summary>
+        /// Returns a new vector whose elements signal whether the elements in left were less than their
+        /// corresponding elements in right.
+        /// </summary>
+        /// <param name="left">The first vector to compare.</param>
+        /// <param name="right">The second vector to compare.</param>
+        /// <returns>The resultant vector.</returns>
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static Vector<long> LessThan(Vector<long> left, Vector<long> right)
+        {
+            return Vector<long>.LessThan(left, right);
+        }
+
+        /// <summary>
+        /// Returns a boolean indicating whether all of the elements in left are less than their corresponding elements in right.
+        /// </summary>
+        /// <param name="left">The first vector to compare.</param>
+        /// <param name="right">The second vector to compare.</param>
+        /// <returns>True if all elements in left are less than their corresponding elements in right; False otherwise.</returns>
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static bool LessThanAll<T>(Vector<T> left, Vector<T> right) where T : struct
+        {
+            Vector<int> cond = (Vector<int>)Vector<T>.LessThan(left, right);
+            return cond.Equals(Vector<int>.AllOnes);
+        }
+
+        /// <summary>
+        /// Returns a boolean indicating whether any element in left is less than its corresponding element in right.
+        /// </summary>
+        /// <param name="left">The first vector to compare.</param>
+        /// <param name="right">The second vector to compare.</param>
+        /// <returns>True if any elements in left are less than their corresponding elements in right; False otherwise.</returns>
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static bool LessThanAny<T>(Vector<T> left, Vector<T> right) where T : struct
+        {
+            Vector<int> cond = (Vector<int>)Vector<T>.LessThan(left, right);
+            return !cond.Equals(Vector<int>.Zero);
+        }
+        #endregion LessthanMethods
+
+        #region Lessthanorequal methods
+        /// <summary>
+        /// Returns a new vector whose elements signal whether the elements in left were less than or equal to their
+        /// corresponding elements in right.
+        /// </summary>
+        /// <param name="left">The first vector to compare.</param>
+        /// <param name="right">The second vector to compare.</param>
+        /// <returns>The resultant vector.</returns>
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static Vector<T> LessThanOrEqual<T>(Vector<T> left, Vector<T> right) where T : struct
+        {
+            return Vector<T>.LessThanOrEqual(left, right);
+        }
+
+        /// <summary>
+        /// Returns an integral vector whose elements signal whether the elements in left were less than or equal to their
+        /// corresponding elements in right.
+        /// </summary>
+        /// <param name="left">The first vector to compare.</param>
+        /// <param name="right">The second vector to compare.</param>
+        /// <returns>The resultant integral vector.</returns>
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static Vector<int> LessThanOrEqual(Vector<Single> left, Vector<Single> right)
+        {
+            return (Vector<int>)Vector<Single>.LessThanOrEqual(left, right);
+        }
+
+        /// <summary>
+        /// Returns a new vector whose elements signal whether the elements in left were less than or equal to their
+        /// corresponding elements in right.
+        /// </summary>
+        /// <param name="left">The first vector to compare.</param>
+        /// <param name="right">The second vector to compare.</param>
+        /// <returns>The resultant vector.</returns>
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static Vector<int> LessThanOrEqual(Vector<int> left, Vector<int> right)
+        {
+            return Vector<int>.LessThanOrEqual(left, right);
+        }
+
+        /// <summary>
+        /// Returns a new vector whose elements signal whether the elements in left were less than or equal to their
+        /// corresponding elements in right.
+        /// </summary>
+        /// <param name="left">The first vector to compare.</param>
+        /// <param name="right">The second vector to compare.</param>
+        /// <returns>The resultant vector.</returns>
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static Vector<long> LessThanOrEqual(Vector<long> left, Vector<long> right)
+        {
+            return Vector<long>.LessThanOrEqual(left, right);
+        }
+
+        /// <summary>
+        /// Returns an integral vector whose elements signal whether the elements in left were less than or equal to their
+        /// corresponding elements in right.
+        /// </summary>
+        /// <param name="left">The first vector to compare.</param>
+        /// <param name="right">The second vector to compare.</param>
+        /// <returns>The resultant integral vector.</returns>
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static Vector<long> LessThanOrEqual(Vector<double> left, Vector<double> right)
+        {
+            return (Vector<long>)Vector<double>.LessThanOrEqual(left, right);
+        }
+
+        /// <summary>
+        /// Returns a boolean indicating whether all elements in left are less than or equal to their corresponding elements in right.
+        /// </summary>
+        /// <param name="left">The first vector to compare.</param>
+        /// <param name="right">The second vector to compare.</param>
+        /// <returns>True if all elements in left are less than or equal to their corresponding elements in right; False otherwise.</returns>
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static bool LessThanOrEqualAll<T>(Vector<T> left, Vector<T> right) where T : struct
+        {
+            Vector<int> cond = (Vector<int>)Vector<T>.LessThanOrEqual(left, right);
+            return cond.Equals(Vector<int>.AllOnes);
+        }
+
+        /// <summary>
+        /// Returns a boolean indicating whether any element in left is less than or equal to its corresponding element in right.
+        /// </summary>
+        /// <param name="left">The first vector to compare.</param>
+        /// <param name="right">The second vector to compare.</param>
+        /// <returns>True if any elements in left are less than their corresponding elements in right; False otherwise.</returns>
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static bool LessThanOrEqualAny<T>(Vector<T> left, Vector<T> right) where T : struct
+        {
+            Vector<int> cond = (Vector<int>)Vector<T>.LessThanOrEqual(left, right);
+            return !cond.Equals(Vector<int>.Zero);
+        }
+        #endregion Lessthanorequal methods
+
+        #region Greaterthan methods
+        /// <summary>
+        /// Returns a new vector whose elements signal whether the elements in left were greater than their
+        /// corresponding elements in right.
+        /// </summary>
+        /// <param name="left">The first vector to compare.</param>
+        /// <param name="right">The second vector to compare.</param>
+        /// <returns>The resultant vector.</returns>
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static Vector<T> GreaterThan<T>(Vector<T> left, Vector<T> right) where T : struct
+        {
+            return Vector<T>.GreaterThan(left, right);
+        }
+
+        /// <summary>
+        /// Returns an integral vector whose elements signal whether the elements in left were greater than their
+        /// corresponding elements in right.
+        /// </summary>
+        /// <param name="left">The first vector to compare.</param>
+        /// <param name="right">The second vector to compare.</param>
+        /// <returns>The resultant integral vector.</returns>
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static Vector<int> GreaterThan(Vector<Single> left, Vector<Single> right)
+        {
+            return (Vector<int>)Vector<Single>.GreaterThan(left, right);
+        }
+
+        /// <summary>
+        /// Returns a new vector whose elements signal whether the elements in left were greater than their
+        /// corresponding elements in right.
+        /// </summary>
+        /// <param name="left">The first vector to compare.</param>
+        /// <param name="right">The second vector to compare.</param>
+        /// <returns>The resultant vector.</returns>
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static Vector<int> GreaterThan(Vector<int> left, Vector<int> right)
+        {
+            return Vector<int>.GreaterThan(left, right);
+        }
+
+        /// <summary>
+        /// Returns an integral vector whose elements signal whether the elements in left were greater than their
+        /// corresponding elements in right.
+        /// </summary>
+        /// <param name="left">The first vector to compare.</param>
+        /// <param name="right">The second vector to compare.</param>
+        /// <returns>The resultant integral vector.</returns>
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static Vector<long> GreaterThan(Vector<double> left, Vector<double> right)
+        {
+            return (Vector<long>)Vector<double>.GreaterThan(left, right);
+        }
+
+        /// <summary>
+        /// Returns a new vector whose elements signal whether the elements in left were greater than their
+        /// corresponding elements in right.
+        /// </summary>
+        /// <param name="left">The first vector to compare.</param>
+        /// <param name="right">The second vector to compare.</param>
+        /// <returns>The resultant vector.</returns>
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static Vector<long> GreaterThan(Vector<long> left, Vector<long> right)
+        {
+            return Vector<long>.GreaterThan(left, right);
+        }
+
+        /// <summary>
+        /// Returns a boolean indicating whether all elements in left are greater than the corresponding elements in right.
+        /// elements in right.
+        /// </summary>
+        /// <param name="left">The first vector to compare.</param>
+        /// <param name="right">The second vector to compare.</param>
+        /// <returns>True if all elements in left are greater than their corresponding elements in right; False otherwise.</returns>
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static bool GreaterThanAll<T>(Vector<T> left, Vector<T> right) where T : struct
+        {
+            Vector<int> cond = (Vector<int>)Vector<T>.GreaterThan(left, right);
+            return cond.Equals(Vector<int>.AllOnes);
+        }
+
+        /// <summary>
+        /// Returns a boolean indicating whether any element in left is greater than its corresponding element in right.
+        /// </summary>
+        /// <param name="left">The first vector to compare.</param>
+        /// <param name="right">The second vector to compare.</param>
+        /// <returns>True if any elements in left are greater than their corresponding elements in right; False otherwise.</returns>
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static bool GreaterThanAny<T>(Vector<T> left, Vector<T> right) where T : struct
+        {
+            Vector<int> cond = (Vector<int>)Vector<T>.GreaterThan(left, right);
+            return !cond.Equals(Vector<int>.Zero);
+        }
+        #endregion Greaterthan methods
+
+        #region Greaterthanorequal methods
+        /// <summary>
+        /// Returns a new vector whose elements signal whether the elements in left were greater than or equal to their
+        /// corresponding elements in right.
+        /// </summary>
+        /// <param name="left">The first vector to compare.</param>
+        /// <param name="right">The second vector to compare.</param>
+        /// <returns>The resultant vector.</returns>
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static Vector<T> GreaterThanOrEqual<T>(Vector<T> left, Vector<T> right) where T : struct
+        {
+            return Vector<T>.GreaterThanOrEqual(left, right);
+        }
+
+        /// <summary>
+        /// Returns an integral vector whose elements signal whether the elements in left were greater than or equal to their
+        /// corresponding elements in right.
+        /// </summary>
+        /// <param name="left">The first vector to compare.</param>
+        /// <param name="right">The second vector to compare.</param>
+        /// <returns>The resultant integral vector.</returns>
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static Vector<int> GreaterThanOrEqual(Vector<Single> left, Vector<Single> right)
+        {
+            return (Vector<int>)Vector<Single>.GreaterThanOrEqual(left, right);
+        }
+
+        /// <summary>
+        /// Returns a new vector whose elements signal whether the elements in left were greater than or equal to their
+        /// corresponding elements in right.
+        /// </summary>
+        /// <param name="left">The first vector to compare.</param>
+        /// <param name="right">The second vector to compare.</param>
+        /// <returns>The resultant vector.</returns>
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static Vector<int> GreaterThanOrEqual(Vector<int> left, Vector<int> right)
+        {
+            return Vector<int>.GreaterThanOrEqual(left, right);
+        }
+
+        /// <summary>
+        /// Returns a new vector whose elements signal whether the elements in left were greater than or equal to their
+        /// corresponding elements in right.
+        /// </summary>
+        /// <param name="left">The first vector to compare.</param>
+        /// <param name="right">The second vector to compare.</param>
+        /// <returns>The resultant vector.</returns>
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static Vector<long> GreaterThanOrEqual(Vector<long> left, Vector<long> right)
+        {
+            return Vector<long>.GreaterThanOrEqual(left, right);
+        }
+
+        /// <summary>
+        /// Returns an integral vector whose elements signal whether the elements in left were greater than or equal to 
+        /// their corresponding elements in right.
+        /// </summary>
+        /// <param name="left">The first vector to compare.</param>
+        /// <param name="right">The second vector to compare.</param>
+        /// <returns>The resultant integral vector.</returns>
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static Vector<long> GreaterThanOrEqual(Vector<double> left, Vector<double> right)
+        {
+            return (Vector<long>)Vector<double>.GreaterThanOrEqual(left, right);
+        }
+
+        /// <summary>
+        /// Returns a boolean indicating whether all of the elements in left are greater than or equal to 
+        /// their corresponding elements in right.
+        /// </summary>
+        /// <param name="left">The first vector to compare.</param>
+        /// <param name="right">The second vector to compare.</param>
+        /// <returns>True if all elements in left are greater than or equal to their corresponding elements in right; False otherwise.</returns>
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static bool GreaterThanOrEqualAll<T>(Vector<T> left, Vector<T> right) where T : struct
+        {
+            Vector<int> cond = (Vector<int>)Vector<T>.GreaterThanOrEqual(left, right);
+            return cond.Equals(Vector<int>.AllOnes);
+        }
+
+        /// <summary>
+        /// Returns a boolean indicating whether any element in left is greater than or equal to its corresponding element in right.
+        /// </summary>
+        /// <param name="left">The first vector to compare.</param>
+        /// <param name="right">The second vector to compare.</param>
+        /// <returns>True if any elements in left are greater than or equal to their corresponding elements in right; False otherwise.</returns>
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static bool GreaterThanOrEqualAny<T>(Vector<T> left, Vector<T> right) where T : struct
+        {
+            Vector<int> cond = (Vector<int>)Vector<T>.GreaterThanOrEqual(left, right);
+            return !cond.Equals(Vector<int>.Zero);
+        }
+        #endregion Greaterthanorequal methods
+        #endregion Comparison methods
+
+        #region Vector Math Methods
+        // Every operation must either be a JIT intrinsic or implemented over a JIT intrinsic
+        // as a thin wrapper
+        // Operations implemented over a JIT intrinsic should be inlined
+        // Methods that do not have a <T> type parameter are recognized as intrinsics
+        /// <summary>
+        /// Returns whether or not vector operations are subject to hardware acceleration through JIT intrinsic support.
+        /// </summary>
+        [JitIntrinsic]
+        public static bool IsHardwareAccelerated
+        {
+            get
+            {
+                return false;
+            }
+        }
+
+        // Vector<T>
+        // Basic Math
+        // All Math operations for Vector<T> are aggressively inlined here
+
+        /// <summary>
+        /// Returns a new vector whose elements are the absolute values of the given vector's elements.
+        /// </summary>
+        /// <param name="value">The source vector.</param>
+        /// <returns>The absolute value vector.</returns>
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static Vector<T> Abs<T>(Vector<T> value) where T : struct
+        {
+            return Vector<T>.Abs(value);
+        }
+
+        /// <summary>
+        /// Returns a new vector whose elements are the minimum of each pair of elements in the two given vectors.
+        /// </summary>
+        /// <param name="left">The first source vector.</param>
+        /// <param name="right">The second source vector.</param>
+        /// <returns>The minimum vector.</returns>
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static Vector<T> Min<T>(Vector<T> left, Vector<T> right) where T : struct
+        {
+            return Vector<T>.Min(left, right);
+        }
+
+        /// <summary>
+        /// Returns a new vector whose elements are the maximum of each pair of elements in the two given vectors.
+        /// </summary>
+        /// <param name="left">The first source vector.</param>
+        /// <param name="right">The second source vector.</param>
+        /// <returns>The maximum vector.</returns>
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static Vector<T> Max<T>(Vector<T> left, Vector<T> right) where T : struct
+        {
+            return Vector<T>.Max(left, right);
+        }
+
+        // Specialized vector operations
+
+        /// <summary>
+        /// Returns the dot product of two vectors.
+        /// </summary>
+        /// <param name="left">The first source vector.</param>
+        /// <param name="right">The second source vector.</param>
+        /// <returns>The dot product.</returns>
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static T Dot<T>(Vector<T> left, Vector<T> right) where T : struct
+        {
+            return Vector<T>.DotProduct(left, right);
+        }
+
+        /// <summary>
+        /// Returns a new vector whose elements are the square roots of the given vector's elements.
+        /// </summary>
+        /// <param name="value">The source vector.</param>
+        /// <returns>The square root vector.</returns>
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static Vector<T> SquareRoot<T>(Vector<T> value) where T : struct
+        {
+            return Vector<T>.SquareRoot(value);
+        }
+        #endregion Vector Math Methods
+
+        #region Named Arithmetic Operators
+        /// <summary>
+        /// Creates a new vector whose values are the sum of each pair of elements from the two given vectors.
+        /// </summary>
+        /// <param name="left">The first source vector.</param>
+        /// <param name="right">The second source vector.</param>
+        /// <returns>The summed vector.</returns>
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static Vector<T> Add<T>(Vector<T> left, Vector<T> right) where T : struct
+        {
+            return left + right;
+        }
+
+        /// <summary>
+        /// Creates a new vector whose values are the difference between each pairs of elements in the given vectors.
+        /// </summary>
+        /// <param name="left">The first source vector.</param>
+        /// <param name="right">The second source vector.</param>
+        /// <returns>The difference vector.</returns>
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static Vector<T> Subtract<T>(Vector<T> left, Vector<T> right) where T : struct
+        {
+            return left - right;
+        }
+
+        /// <summary>
+        /// Creates a new vector whose values are the product of each pair of elements from the two given vectors.
+        /// </summary>
+        /// <param name="left">The first source vector.</param>
+        /// <param name="right">The second source vector.</param>
+        /// <returns>The summed vector.</returns>
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static Vector<T> Multiply<T>(Vector<T> left, Vector<T> right) where T : struct
+        {
+            return left * right;
+        }
+
+        /// <summary>
+        /// Returns a new vector whose values are the values of the given vector each multiplied by a scalar value.
+        /// </summary>
+        /// <param name="left">The source vector.</param>
+        /// <param name="right">The scalar factor.</param>
+        /// <returns>The scaled vector.</returns>
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static Vector<T> Multiply<T>(Vector<T> left, T right) where T : struct
+        {
+            return left * right;
+        }
+
+        /// <summary>
+        /// Returns a new vector whose values are the values of the given vector each multiplied by a scalar value.
+        /// </summary>
+        /// <param name="left">The scalar factor.</param>
+        /// <param name="right">The source vector.</param>
+        /// <returns>The scaled vector.</returns>
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static Vector<T> Multiply<T>(T left, Vector<T> right) where T : struct
+        {
+            return left * right;
+        }
+
+        /// <summary>
+        /// Returns a new vector whose values are the result of dividing the first vector's elements 
+        /// by the corresponding elements in the second vector.
+        /// </summary>
+        /// <param name="left">The first source vector.</param>
+        /// <param name="right">The second source vector.</param>
+        /// <returns>The divided vector.</returns>
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static Vector<T> Divide<T>(Vector<T> left, Vector<T> right) where T : struct
+        {
+            return left / right;
+        }
+
+        /// <summary>
+        /// Returns a new vector whose elements are the given vector's elements negated.
+        /// </summary>
+        /// <param name="value">The source vector.</param>
+        /// <returns>The negated vector.</returns>
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static Vector<T> Negate<T>(Vector<T> value) where T : struct
+        {
+            return -value;
+        }
+        #endregion Named Arithmetic Operators
+
+        #region Named Bitwise Operators
+        /// <summary>
+        /// Returns a new vector by performing a bitwise-and operation on each of the elements in the given vectors.
+        /// </summary>
+        /// <param name="left">The first source vector.</param>
+        /// <param name="right">The second source vector.</param>
+        /// <returns>The resultant vector.</returns>
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static Vector<T> BitwiseAnd<T>(Vector<T> left, Vector<T> right) where T : struct
+        {
+            return left & right;
+        }
+
+        /// <summary>
+        /// Returns a new vector by performing a bitwise-or operation on each of the elements in the given vectors.
+        /// </summary>
+        /// <param name="left">The first source vector.</param>
+        /// <param name="right">The second source vector.</param>
+        /// <returns>The resultant vector.</returns>
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static Vector<T> BitwiseOr<T>(Vector<T> left, Vector<T> right) where T : struct
+        {
+            return left | right;
+        }
+
+        /// <summary>
+        /// Returns a new vector whose elements are obtained by taking the one's complement of the given vector's elements.
+        /// </summary>
+        /// <param name="value">The source vector.</param>
+        /// <returns>The one's complement vector.</returns>
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static Vector<T> OnesComplement<T>(Vector<T> value) where T : struct
+        {
+            return ~value;
+        }
+
+        /// <summary>
+        /// Returns a new vector by performing a bitwise-exclusive-or operation on each of the elements in the given vectors.
+        /// </summary>
+        /// <param name="left">The first source vector.</param>
+        /// <param name="right">The second source vector.</param>
+        /// <returns>The resultant vector.</returns>
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static Vector<T> Xor<T>(Vector<T> left, Vector<T> right) where T : struct
+        {
+            return left ^ right;
+        }
+
+        /// <summary>
+        /// Returns a new vector by performing a bitwise-and-not operation on each of the elements in the given vectors.
+        /// </summary>
+        /// <param name="left">The first source vector.</param>
+        /// <param name="right">The second source vector.</param>
+        /// <returns>The resultant vector.</returns>
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static Vector<T> AndNot<T>(Vector<T> left, Vector<T> right) where T : struct
+        {
+            return left & ~right;
+        }
+        #endregion Named Bitwise Operators
+
+        #region Conversion Methods
+        /// <summary>
+        /// Reinterprets the bits of the given vector into those of a vector of unsigned bytes.
+        /// </summary>
+        /// <param name="value">The source vector</param>
+        /// <returns>The reinterpreted vector.</returns>
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static Vector<Byte> AsVectorByte<T>(Vector<T> value) where T : struct
+        {
+            return (Vector<Byte>)value;
+        }
+
+        /// <summary>
+        /// Reinterprets the bits of the given vector into those of a vector of signed bytes.
+        /// </summary>
+        /// <param name="value">The source vector</param>
+        /// <returns>The reinterpreted vector.</returns>
+        [CLSCompliant(false)]
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static Vector<SByte> AsVectorSByte<T>(Vector<T> value) where T : struct
+        {
+            return (Vector<SByte>)value;
+        }
+
+        /// <summary>
+        /// Reinterprets the bits of the given vector into those of a vector of 16-bit integers.
+        /// </summary>
+        /// <param name="value">The source vector</param>
+        /// <returns>The reinterpreted vector.</returns>
+        [CLSCompliant(false)]
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static Vector<UInt16> AsVectorUInt16<T>(Vector<T> value) where T : struct
+        {
+            return (Vector<UInt16>)value;
+        }
+
+        /// <summary>
+        /// Reinterprets the bits of the given vector into those of a vector of signed 16-bit integers.
+        /// </summary>
+        /// <param name="value">The source vector</param>
+        /// <returns>The reinterpreted vector.</returns>
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static Vector<Int16> AsVectorInt16<T>(Vector<T> value) where T : struct
+        {
+            return (Vector<Int16>)value;
+        }
+
+        /// <summary>
+        /// Reinterprets the bits of the given vector into those of a vector of unsigned 32-bit integers.
+        /// </summary>
+        /// <param name="value">The source vector</param>
+        /// <returns>The reinterpreted vector.</returns>
+        [CLSCompliant(false)]
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static Vector<UInt32> AsVectorUInt32<T>(Vector<T> value) where T : struct
+        {
+            return (Vector<UInt32>)value;
+        }
+
+        /// <summary>
+        /// Reinterprets the bits of the given vector into those of a vector of signed 32-bit integers.
+        /// </summary>
+        /// <param name="value">The source vector</param>
+        /// <returns>The reinterpreted vector.</returns>
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static Vector<Int32> AsVectorInt32<T>(Vector<T> value) where T : struct
+        {
+            return (Vector<Int32>)value;
+        }
+
+        /// <summary>
+        /// Reinterprets the bits of the given vector into those of a vector of unsigned 64-bit integers.
+        /// </summary>
+        /// <param name="value">The source vector</param>
+        /// <returns>The reinterpreted vector.</returns>
+        [CLSCompliant(false)]
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static Vector<UInt64> AsVectorUInt64<T>(Vector<T> value) where T : struct
+        {
+            return (Vector<UInt64>)value;
+        }
+
+
+        /// <summary>
+        /// Reinterprets the bits of the given vector into those of a vector of signed 64-bit integers.
+        /// </summary>
+        /// <param name="value">The source vector</param>
+        /// <returns>The reinterpreted vector.</returns>
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static Vector<Int64> AsVectorInt64<T>(Vector<T> value) where T : struct
+        {
+            return (Vector<Int64>)value;
+        }
+
+        /// <summary>
+        /// Reinterprets the bits of the given vector into those of a vector of 32-bit floating point numbers.
+        /// </summary>
+        /// <param name="value">The source vector</param>
+        /// <returns>The reinterpreted vector.</returns>
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static Vector<Single> AsVectorSingle<T>(Vector<T> value) where T : struct
+        {
+            return (Vector<Single>)value;
+        }
+
+        /// <summary>
+        /// Reinterprets the bits of the given vector into those of a vector of 64-bit floating point numbers.
+        /// </summary>
+        /// <param name="value">The source vector</param>
+        /// <returns>The reinterpreted vector.</returns>
+        [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+        public static Vector<Double> AsVectorDouble<T>(Vector<T> value) where T : struct
+        {
+            return (Vector<Double>)value;
+        }
+        #endregion Conversion Methods
+    }
+}
diff --git a/mcs/class/System.Numerics.Vectors/net_4_x_System.Numerics.Vectors.dll.exclude.sources b/mcs/class/System.Numerics.Vectors/net_4_x_System.Numerics.Vectors.dll.exclude.sources
new file mode 100644 (file)
index 0000000..0b18840
--- /dev/null
@@ -0,0 +1,7 @@
+SR.cs
+System.Numerics/ConstantHelper.cs
+System.Numerics/HashCodeHelper.cs
+System.Numerics/JitIntrinsicAttribute.cs
+System.Numerics/Register.cs
+System.Numerics/Vector_Operations.cs
+System.Numerics/Vector.cs
diff --git a/mcs/class/System.Numerics.Vectors/net_4_x_System.Numerics.Vectors.dll.sources b/mcs/class/System.Numerics.Vectors/net_4_x_System.Numerics.Vectors.dll.sources
new file mode 100644 (file)
index 0000000..d4f1837
--- /dev/null
@@ -0,0 +1 @@
+#include System.Numerics.Vectors.dll.sources
index f6f93e8dc510008bc9bd8a436b8b3456845b044e..08f4dc4501e1a6b05d228077fdc3baf39483dfcb 100644 (file)
@@ -4,7 +4,7 @@ include ../../build/rules.make
 
 LIBRARY = System.Numerics.dll
 LIB_REFS = System
-LIB_MCS_FLAGS = /unsafe -d:MONO
+LIB_MCS_FLAGS = /unsafe -nowarn:414
 TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
 
 TXT_RESOURCE_STRINGS = ../referencesource/System.Numerics/System.Numerics.txt
diff --git a/mcs/class/System.Numerics/ReferenceSources/Environment.cs b/mcs/class/System.Numerics/ReferenceSources/Environment.cs
deleted file mode 100644 (file)
index 5377cfe..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-using System.Globalization;
-
-namespace System
-{
-       partial class Environment
-       {
-               internal static string GetResourceString (string key)
-               {
-                       return key;
-               }
-
-               internal static string GetResourceString (string key, CultureInfo culture)
-               {
-                       return key;
-               }
-
-               internal static string GetResourceString (string key, params object[] values)
-               {
-                       return string.Format (CultureInfo.InvariantCulture, key, values);
-               }
-       }
-}
\ No newline at end of file
index 20d631a4dd80d2aa4ab2b1ad97f9b04ae9ec4459..2f52187057da0149ac696e45579f64a175841f13 100644 (file)
@@ -1,10 +1,22 @@
 ../../build/common/Consts.cs
 ../../build/common/SR.cs
 Assembly/AssemblyInfo.cs
-ReferenceSources/Environment.cs
 ReferenceSources/SR.cs
 ../referencesource/System.Numerics/System/Numerics/BigInteger.cs
 ../referencesource/System.Numerics/System/Numerics/BigIntegerBuilder.cs
 ../referencesource/System.Numerics/System/Numerics/BigNumber.cs
 ../referencesource/System.Numerics/System/Numerics/Complex.cs
 ../referencesource/System.Numerics/System/Numerics/NumericsHelpers.cs
+../referencesource/System.Numerics/System/Numerics/HashCodeHelper.cs
+../referencesource/System.Numerics/System/Numerics/JITIntrinsicAttribute.cs
+../referencesource/System.Numerics/System/Numerics/Matrix3x2.cs
+../referencesource/System.Numerics/System/Numerics/Matrix4x4.cs
+../referencesource/System.Numerics/System/Numerics/Plane.cs
+../referencesource/System.Numerics/System/Numerics/Quaternion.cs
+../referencesource/System.Numerics/System/Numerics/Vector2.cs
+../referencesource/System.Numerics/System/Numerics/Vector2_Intrinsics.cs
+../referencesource/System.Numerics/System/Numerics/Vector3.cs
+../referencesource/System.Numerics/System/Numerics/Vector3_Intrinsics.cs
+../referencesource/System.Numerics/System/Numerics/Vector4.cs
+../referencesource/System.Numerics/System/Numerics/Vector4_Intrinsics.cs
+../referencesource/System.Numerics/System/Numerics/Vector_Operations.cs
diff --git a/mcs/class/System.Reflection.Context/Assembly/AssemblyInfo.cs b/mcs/class/System.Reflection.Context/Assembly/AssemblyInfo.cs
new file mode 100644 (file)
index 0000000..67d4912
--- /dev/null
@@ -0,0 +1,62 @@
+//
+// AssemblyInfo.cs
+//
+// Author:
+//   Alexander Köplinger (alexander.koeplinger@xamarin.com)
+//
+// (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.Reflection;
+using System.Resources;
+using System.Security;
+using System.Security.Permissions;
+using System.Diagnostics;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about the assembly
+
+[assembly: AssemblyTitle ("System.Reflection.Context.dll")]
+[assembly: AssemblyDescription ("System.Reflection.Context.dll")]
+[assembly: AssemblyDefaultAlias ("System.Reflection.Context.dll")]
+
+[assembly: AssemblyCompany (Consts.MonoCompany)]
+[assembly: AssemblyProduct (Consts.MonoProduct)]
+[assembly: AssemblyCopyright (Consts.MonoCopyright)]
+[assembly: AssemblyVersion (Consts.FxVersion)]
+[assembly: SatelliteContractVersion (Consts.FxVersion)]
+[assembly: AssemblyInformationalVersion (Consts.FxFileVersion)]
+[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
+
+[assembly: NeutralResourcesLanguage ("en-US")]
+[assembly: CLSCompliant (true)]
+[assembly: AssemblyDelaySign (true)]
+
+[assembly: AssemblyKeyFile("../msfinal.pub")]
+
+[assembly: SecurityCritical]
+
+[assembly: ComVisible (false)]
\ No newline at end of file
diff --git a/mcs/class/System.Reflection.Context/Makefile b/mcs/class/System.Reflection.Context/Makefile
new file mode 100644 (file)
index 0000000..73bee9e
--- /dev/null
@@ -0,0 +1,11 @@
+thisdir = class/System.Reflection.Context
+SUBDIRS = 
+include ../../build/rules.make
+
+LIBRARY = System.Reflection.Context.dll
+LIB_REFS = System
+LIB_MCS_FLAGS =
+
+NO_TEST = yes
+
+include ../../build/library.make
diff --git a/mcs/class/System.Reflection.Context/System.Reflection.Context.dll.sources b/mcs/class/System.Reflection.Context/System.Reflection.Context.dll.sources
new file mode 100644 (file)
index 0000000..1820689
--- /dev/null
@@ -0,0 +1,5 @@
+../../build/common/Consts.cs
+../../build/common/Locale.cs
+../../build/common/MonoTODOAttribute.cs
+Assembly/AssemblyInfo.cs
+System.Reflection.Context/CustomReflectionContext.cs
diff --git a/mcs/class/System.Reflection.Context/System.Reflection.Context/CustomReflectionContext.cs b/mcs/class/System.Reflection.Context/System.Reflection.Context/CustomReflectionContext.cs
new file mode 100644 (file)
index 0000000..28a6e62
--- /dev/null
@@ -0,0 +1,93 @@
+//
+// CustomReflectionContext.cs
+//
+// Author:
+//   Alexander Köplinger (alexander.koeplinger@xamarin.com)
+//
+// (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.Generic;
+using System.Reflection;
+
+namespace System.Reflection.Context
+{
+       public abstract class CustomReflectionContext : ReflectionContext
+       {
+               [MonoTODO]
+               protected CustomReflectionContext ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               protected CustomReflectionContext (ReflectionContext source)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               protected virtual IEnumerable<PropertyInfo> AddProperties (Type type)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               protected PropertyInfo CreateProperty (Type propertyType, string name, Func<object, object> getter, Action<object, object> setter)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               protected PropertyInfo CreateProperty (Type propertyType, string name, Func<object, object> getter, Action<object, object> setter, IEnumerable<Attribute> propertyCustomAttributes, IEnumerable<Attribute> getterCustomAttributes, IEnumerable<Attribute> setterCustomAttributes)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               protected virtual IEnumerable<object> GetCustomAttributes (MemberInfo member, IEnumerable<object> declaredAttributes)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               protected virtual IEnumerable<object> GetCustomAttributes (ParameterInfo parameter, IEnumerable<object> declaredAttributes)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public override Assembly MapAssembly (Assembly assembly)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public override TypeInfo MapType (TypeInfo type)
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+}
diff --git a/mcs/class/System.Reflection.DispatchProxy/Assembly/AssemblyInfo.cs b/mcs/class/System.Reflection.DispatchProxy/Assembly/AssemblyInfo.cs
new file mode 100644 (file)
index 0000000..993d77c
--- /dev/null
@@ -0,0 +1,62 @@
+//
+// AssemblyInfo.cs
+//
+// Author:
+//   Alexander Köplinger (alexander.koeplinger@xamarin.com)
+//
+// (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.Reflection;
+using System.Resources;
+using System.Security;
+using System.Security.Permissions;
+using System.Diagnostics;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about the assembly
+
+[assembly: AssemblyTitle ("System.Reflection.DispatchProxy.dll")]
+[assembly: AssemblyDescription ("System.Reflection.DispatchProxy.dll")]
+[assembly: AssemblyDefaultAlias ("System.Reflection.DispatchProxy.dll")]
+
+[assembly: AssemblyCompany (Consts.MonoCompany)]
+[assembly: AssemblyProduct (Consts.MonoProduct)]
+[assembly: AssemblyCopyright (Consts.MonoCopyright)]
+[assembly: AssemblyVersion (Consts.FxVersion)]
+[assembly: SatelliteContractVersion (Consts.FxVersion)]
+[assembly: AssemblyInformationalVersion (Consts.FxFileVersion)]
+[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
+
+[assembly: NeutralResourcesLanguage ("en-US")]
+[assembly: CLSCompliant (true)]
+[assembly: AssemblyDelaySign (true)]
+
+[assembly: AssemblyKeyFile("../msfinal.pub")]
+
+[assembly: SecurityCritical]
+
+[assembly: ComVisible (false)]
\ No newline at end of file
diff --git a/mcs/class/System.Reflection.DispatchProxy/Makefile b/mcs/class/System.Reflection.DispatchProxy/Makefile
new file mode 100644 (file)
index 0000000..ddc8396
--- /dev/null
@@ -0,0 +1,11 @@
+thisdir = class/System.Reflection.DispatchProxy
+SUBDIRS = 
+include ../../build/rules.make
+
+LIBRARY = System.Reflection.DispatchProxy.dll
+LIB_REFS = System
+LIB_MCS_FLAGS =
+
+NO_TEST = yes
+
+include ../../build/library.make
diff --git a/mcs/class/System.Reflection.DispatchProxy/System.Reflection.DispatchProxy.dll.sources b/mcs/class/System.Reflection.DispatchProxy/System.Reflection.DispatchProxy.dll.sources
new file mode 100644 (file)
index 0000000..da5d484
--- /dev/null
@@ -0,0 +1,5 @@
+../../build/common/Consts.cs
+../../build/common/Locale.cs
+../../build/common/MonoTODOAttribute.cs
+Assembly/AssemblyInfo.cs
+System.Reflection/DispatchProxy.cs
diff --git a/mcs/class/System.Reflection.DispatchProxy/System.Reflection/DispatchProxy.cs b/mcs/class/System.Reflection.DispatchProxy/System.Reflection/DispatchProxy.cs
new file mode 100644 (file)
index 0000000..540e525
--- /dev/null
@@ -0,0 +1,50 @@
+//
+// DispatchProxy.cs
+//
+// Author:
+//   Alexander Köplinger (alexander.koeplinger@xamarin.com)
+//
+// (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.
+//
+
+namespace System.Reflection
+{
+       public abstract class DispatchProxy
+       {
+               [MonoTODO]
+               protected DispatchProxy()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static T Create<T, TProxy> () where TProxy : DispatchProxy
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               protected abstract object Invoke (MethodInfo targetMethod, object[] args);
+       }
+}
diff --git a/mcs/class/System.Runtime.Caching/ReferenceSources/SRef.cs b/mcs/class/System.Runtime.Caching/ReferenceSources/SRef.cs
deleted file mode 100644 (file)
index 644a2fc..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-using System;
-using System.Runtime.InteropServices;
-
-namespace System.Runtime.Caching {
-    /*
-     * This class is used to retrieve the size of an object graph.
-     * Although Mono has not a way of computing this.
-     * Known problems:
-     *   - CacheMemoryMonitor does not trim the cache when it reaches its memory size limit.
-     *   - IMemoryCacheManager.UpdateCacheSize is called with incorrect size.
-     */
-    internal class SRef {
-
-//        private Object _sizedRef;
-
-        internal SRef (Object target) {
-//            _sizedRef = target;
-        }
-
-        internal long ApproximateSize {
-            get {
-                // TODO: .net uses System.SizedReference which contains approximate size after Gen 2 collection
-                return 16;
-            }
-        }
-
-        internal void Dispose() {
-
-        }
-    }
-}
\ No newline at end of file
index c10ee4fb4062ef8ceaa5e83a623897a2c398f9e7..46aa74c47c09cca86a99c0bb6ac0e3848fe9cda3 100644 (file)
@@ -8,7 +8,6 @@ ReferenceSources/CacheEntryCollection.cs
 ReferenceSources/CacheExpires.cs
 ReferenceSources/CacheUsage.cs
 ReferenceSources/R.Designer.cs
-ReferenceSources/SRef.cs
 ../referencesource/System.Runtime.Caching/Resources/RH.cs
 ../referencesource/System.Runtime.Caching/System/Caching/CacheEntryChangeMonitor.cs
 ../referencesource/System.Runtime.Caching/System/Caching/CacheEntryRemovedArguments.cs
@@ -51,3 +50,4 @@ ReferenceSources/SRef.cs
 ../referencesource/System.Runtime.Caching/System/Caching/SafeBitVector32.cs
 ../referencesource/System.Runtime.Caching/System/Caching/SafeRegistryHandle.cs
 ../referencesource/System.Runtime.Caching/System/Caching/SqlChangeMonitor.cs
+../referencesource/System.Runtime.Caching/System/Caching/SRef.cs
diff --git a/mcs/class/System.Runtime.InteropServices.RuntimeInformation/Assembly/AssemblyInfo.cs b/mcs/class/System.Runtime.InteropServices.RuntimeInformation/Assembly/AssemblyInfo.cs
new file mode 100644 (file)
index 0000000..21e80b5
--- /dev/null
@@ -0,0 +1,62 @@
+//
+// AssemblyInfo.cs
+//
+// Author:
+//   Alexander Köplinger (alexander.koeplinger@xamarin.com)
+//
+// (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.Reflection;
+using System.Resources;
+using System.Security;
+using System.Security.Permissions;
+using System.Diagnostics;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about the assembly
+
+[assembly: AssemblyTitle ("System.Runtime.InteropServices.RuntimeInformation.dll")]
+[assembly: AssemblyDescription ("System.Runtime.InteropServices.RuntimeInformation.dll")]
+[assembly: AssemblyDefaultAlias ("System.Runtime.InteropServices.RuntimeInformation.dll")]
+
+[assembly: AssemblyCompany (Consts.MonoCompany)]
+[assembly: AssemblyProduct (Consts.MonoProduct)]
+[assembly: AssemblyCopyright (Consts.MonoCopyright)]
+[assembly: AssemblyVersion (Consts.FxVersion)]
+[assembly: SatelliteContractVersion (Consts.FxVersion)]
+[assembly: AssemblyInformationalVersion (Consts.FxFileVersion)]
+[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
+
+[assembly: NeutralResourcesLanguage ("en-US")]
+[assembly: CLSCompliant (true)]
+[assembly: AssemblyDelaySign (true)]
+
+[assembly: AssemblyKeyFile("../msfinal.pub")]
+
+[assembly: SecurityCritical]
+
+[assembly: ComVisible (false)]
\ No newline at end of file
diff --git a/mcs/class/System.Runtime.InteropServices.RuntimeInformation/Makefile b/mcs/class/System.Runtime.InteropServices.RuntimeInformation/Makefile
new file mode 100644 (file)
index 0000000..7415110
--- /dev/null
@@ -0,0 +1,11 @@
+thisdir = class/System.Runtime.InteropServices.RuntimeInformation
+SUBDIRS = 
+include ../../build/rules.make
+
+LIBRARY = System.Runtime.InteropServices.RuntimeInformation.dll
+LIB_REFS = System
+LIB_MCS_FLAGS =
+
+NO_TEST = yes
+
+include ../../build/library.make
diff --git a/mcs/class/System.Runtime.InteropServices.RuntimeInformation/System.Runtime.InteropServices.RuntimeInformation.dll.sources b/mcs/class/System.Runtime.InteropServices.RuntimeInformation/System.Runtime.InteropServices.RuntimeInformation.dll.sources
new file mode 100644 (file)
index 0000000..c3c7107
--- /dev/null
@@ -0,0 +1,7 @@
+../../build/common/Consts.cs
+../../build/common/Locale.cs
+../../build/common/MonoTODOAttribute.cs
+Assembly/AssemblyInfo.cs
+System.Runtime.InteropServices/Architecture.cs
+System.Runtime.InteropServices/OSPlatform.cs
+System.Runtime.InteropServices/RuntimeInformation.cs
diff --git a/mcs/class/System.Runtime.InteropServices.RuntimeInformation/System.Runtime.InteropServices/Architecture.cs b/mcs/class/System.Runtime.InteropServices.RuntimeInformation/System.Runtime.InteropServices/Architecture.cs
new file mode 100644 (file)
index 0000000..9c71a33
--- /dev/null
@@ -0,0 +1,40 @@
+//
+// Architecture.cs
+//
+// Author:
+//   Alexander Köplinger (alexander.koeplinger@xamarin.com)
+//
+// (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.
+//
+
+namespace System.Runtime.InteropServices
+{
+       public enum Architecture
+       {
+               X86,
+               X64,
+               Arm,
+               Arm64
+       }
+}
diff --git a/mcs/class/System.Runtime.InteropServices.RuntimeInformation/System.Runtime.InteropServices/OSPlatform.cs b/mcs/class/System.Runtime.InteropServices.RuntimeInformation/System.Runtime.InteropServices/OSPlatform.cs
new file mode 100644 (file)
index 0000000..b2b1b85
--- /dev/null
@@ -0,0 +1,91 @@
+//
+// OSPlatform.cs
+//
+// Author:
+//   Alexander Köplinger (alexander.koeplinger@xamarin.com)
+//
+// (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.
+//
+
+namespace System.Runtime.InteropServices
+{
+       public struct OSPlatform : IEquatable<OSPlatform>
+       {
+               private readonly string _osPlatform;
+
+               public static OSPlatform Linux { get; } = new OSPlatform ("LINUX");
+
+               public static OSPlatform OSX { get; } = new OSPlatform ("OSX");
+
+               public static OSPlatform Windows { get; } = new OSPlatform ("WINDOWS");
+
+               private OSPlatform (string osPlatform)
+               {
+                       if (osPlatform == null) throw new ArgumentNullException (nameof (osPlatform));
+                       if (osPlatform.Length == 0) throw new ArgumentException ("Value cannot be empty.", nameof (osPlatform));
+                       
+                       _osPlatform = osPlatform;
+               }
+
+               public static OSPlatform Create (string osPlatform)
+               {
+                       return new OSPlatform (osPlatform);
+               }
+
+               public bool Equals (OSPlatform other)
+               {
+                       return Equals (other._osPlatform);
+               }
+
+               internal bool Equals (string other)
+               {
+                       return string.Equals (_osPlatform, other, StringComparison.Ordinal);
+               }
+
+               public override bool Equals (object obj)
+               {
+                       return obj is OSPlatform && Equals ((OSPlatform)obj);
+               }
+
+               public override int GetHashCode ()
+               {
+                       return _osPlatform == null ? 0 : _osPlatform.GetHashCode ();
+               }
+
+               public override string ToString ()
+               {
+                       return _osPlatform ?? string.Empty;
+               }
+
+               public static bool operator ==(OSPlatform left, OSPlatform right)
+               {
+                       return left.Equals (right);
+               }
+
+               public static bool operator !=(OSPlatform left, OSPlatform right)
+               {
+                       return !(left == right);
+               }
+       }
+}
\ No newline at end of file
diff --git a/mcs/class/System.Runtime.InteropServices.RuntimeInformation/System.Runtime.InteropServices/RuntimeInformation.cs b/mcs/class/System.Runtime.InteropServices.RuntimeInformation/System.Runtime.InteropServices/RuntimeInformation.cs
new file mode 100644 (file)
index 0000000..24be904
--- /dev/null
@@ -0,0 +1,91 @@
+//
+// RuntimeInformation.cs
+//
+// Author:
+//   Alexander Köplinger (alexander.koeplinger@xamarin.com)
+//
+// (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.Reflection;
+
+namespace System.Runtime.InteropServices
+{
+       public static class RuntimeInformation
+       {
+               [DllImport ("__Internal")]
+               extern static string mono_get_runtime_build_info ();
+
+               public static string FrameworkDescription
+               {
+                       get
+                       {
+                               return mono_get_runtime_build_info ();
+                       }
+               }
+
+               public static bool IsOSPlatform (OSPlatform osPlatform)
+               {
+                       // TODO: very barebones implementation
+
+                       if (Environment.OSVersion.Platform == PlatformID.Win32NT)
+                               return osPlatform == OSPlatform.Windows;
+
+                       if (Environment.OSVersion.Platform == PlatformID.Unix && File.Exists ("/usr/lib/libc.dylib"))
+                               return osPlatform == OSPlatform.OSX;
+
+                       if (Environment.OSVersion.Platform == PlatformID.Unix)
+                               return osPlatform == OSPlatform.Linux;
+
+                       return false;
+               }
+
+               public static string OSDescription
+               {
+                       get
+                       {
+                               return Environment.OSVersion.VersionString;
+                       }
+               }
+
+               public static Architecture OSArchitecture
+               {
+                       get
+                       {
+                               // TODO: very barebones implementation, doesn't respect ARM
+                               return Environment.Is64BitOperatingSystem ? Architecture.X64 : Architecture.X86;
+                       }
+               }
+
+               public static Architecture ProcessArchitecture
+               {
+                       get
+                       {
+                               // TODO: very barebones implementation, doesn't respect ARM                     
+                               return Environment.Is64BitProcess ? Architecture.X64 : Architecture.X86;
+                       }
+               }
+       }
+}
index f95de7c2feca58f286113e0b514250374b64cdda..07cd917a6ae5fcc054e2b357d86d6e3f2d071910 100644 (file)
@@ -5,7 +5,7 @@ include ../../build/rules.make
 RESOURCE_FILES =
 
 LIBRARY = System.Runtime.Serialization.dll
-LIB_REFS = System System.Xml System.Core System.ServiceModel.Internals SMDiagnostics
+LIB_REFS = System System.Xml System.Core System.ServiceModel.Internals
 LIB_MCS_FLAGS = \
                -unsafe \
                -d:NO_DYNAMIC_CODEGEN \
@@ -14,7 +14,7 @@ LIB_MCS_FLAGS = \
 TXT_RESOURCE_STRINGS = ../referencesource/System.Runtime.Serialization/System.Runtime.Serialization.txt
 
 ifneq (2.1, $(FRAMEWORK_VERSION))
-LIB_REFS += System.Data System.Configuration
+LIB_REFS += System.Data System.Configuration SMDiagnostics
 LIB_MCS_FLAGS += /d:NET_3_0
 else
 LIB_MCS_FLAGS += /d:NO_CONFIGURATION /d:NO_SECURITY_ATTRIBUTES /d:NO_CODEDOM /d:NO_DESKTOP_SECURITY
diff --git a/mcs/class/System.Runtime.Serialization/ReferenceSources/LocalAppContextSwitches.cs b/mcs/class/System.Runtime.Serialization/ReferenceSources/LocalAppContextSwitches.cs
new file mode 100644 (file)
index 0000000..ad88376
--- /dev/null
@@ -0,0 +1,7 @@
+namespace System
+{
+       static class LocalAppContextSwitches
+       {
+               public static readonly bool DoNotUseTimeZoneInfo = false;
+       }
+}
\ No newline at end of file
index aa55440219971bb1f2468dc81f519df93cb49797..74ed3335acb89306584341d1642cb1371a64b870 100644 (file)
@@ -10,7 +10,6 @@ namespace System.Runtime.Serialization
        using System.IO;
        using System.Reflection;
        using System.Runtime.Diagnostics;
-       using System.ServiceModel.Diagnostics;
        using System.Security;
        using System.Xml;
        using System.Xml.Schema;
index 9e790d522b7eeae84c83c918ccb91584bed7e9fc..e889387651a171d9d8f467a41b0b119de29909c6 100644 (file)
@@ -4,6 +4,7 @@ Assembly/AssemblyInfo.cs
 
 ReferenceSources/DiagnosticUtility.cs
 ReferenceSources/FxTrace.cs
+ReferenceSources/LocalAppContextSwitches.cs
 ReferenceSources/SR.cs
 ReferenceSources/SR.missing.cs
 ReferenceSources/XmlExceptionHelper.cs
index 5ba3d4cd4bfd790912101cf63f29229b6c60ded4..cb12bd8d9cf41ec44a64328d4f4fdca2239aaba7 100644 (file)
@@ -33,7 +33,9 @@ using System;
 using System.Collections;
 using System.Collections.Generic;
 using System.Collections.ObjectModel;
+#if !MOBILE_STATIC
 using System.Data;
+#endif
 using System.IO;
 using System.Net;
 using System.Runtime.Serialization;
index 03264c43f51f21f3d7535cad350a672f1393881a..944b7f2eea667f441d53e4c5d0e3d59240941047 100755 (executable)
@@ -37,7 +37,9 @@ using System;
 using System.Collections;
 using System.Collections.Generic;
 using System.Collections.ObjectModel;
+#if !MOBILE_STATIC
 using System.Data;
+#endif
 using System.IO;
 using System.Linq;
 using System.Net;
@@ -1475,6 +1477,7 @@ namespace MonoTests.System.Runtime.Serialization
                        Assert.AreEqual (parent, parent.Child.Parent, "#2");
                }
 
+#if !MOBILE_STATIC
                [Test]
                public void IXmlSerializableCallConstructor ()
                {
@@ -1525,6 +1528,7 @@ namespace MonoTests.System.Runtime.Serialization
                        
                        var ds = (DataSet) x.ReadObject (r);
                }
+#endif
 
                [Test]
                [ExpectedException (typeof (InvalidDataContractException))] // BaseConstraintType1 is neither DataContract nor Serializable.
index 2e4032b44ddfa5d21c21b30ec9a440c7fffb1125..d2cd4b21f49af1dbbbf31a7ddc9a49dd6cf5aca1 100644 (file)
@@ -1,60 +1,61 @@
-//
-// ProtectedData.cs: Protect (encrypt) data without (user involved) key management
-//
+//\r
+// ProtectedData.cs: Protect (encrypt) data without (user involved) key management\r
+//\r
 // Author:\r
 //     Sebastien Pouliot  <sebastien@ximian.com>\r
-//
+//\r
 // (C) 2003 Motus Technologies Inc. (http://www.motus.com)\r
 // Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)\r
-//
-// 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.
-//
-
+//\r
+// Permission is hereby granted, free of charge, to any person obtaining\r
+// a copy of this software and associated documentation files (the\r
+// "Software"), to deal in the Software without restriction, including\r
+// without limitation the rights to use, copy, modify, merge, publish,\r
+// distribute, sublicense, and/or sell copies of the Software, and to\r
+// permit persons to whom the Software is furnished to do so, subject to\r
+// the following conditions:\r
+// \r
+// The above copyright notice and this permission notice shall be\r
+// included in all copies or substantial portions of the Software.\r
+// \r
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\r
+// 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
 \r
 using System.Runtime.InteropServices;\r
-using System.Security.Permissions;
-
-using Mono.Security.Cryptography;
-
-namespace System.Security.Cryptography {
-
-       // References:
-       // a.   Windows Data Protection
-       //      http://msdn.microsoft.com/library/en-us/dnsecure/html/windataprotection-dpapi.asp?frame=true
-
-       public sealed class ProtectedData {
-
-               private ProtectedData ()
-               {
-               }
-
+using System.Security.Permissions;\r
+\r
+using Mono.Security.Cryptography;\r
+\r
+namespace System.Security.Cryptography {\r
+\r
+       // References:\r
+       // a.   Windows Data Protection\r
+       //      http://msdn.microsoft.com/library/en-us/dnsecure/html/windataprotection-dpapi.asp?frame=true\r
+\r
+       public sealed class ProtectedData {\r
+\r
+               private ProtectedData ()\r
+               {\r
+               }\r
+\r
 // FIXME       [DataProtectionPermission (SecurityAction.Demand, ProtectData = true)]\r
-               public static byte[] Protect (byte[] userData, byte[] optionalEntropy, DataProtectionScope scope) 
-               {
-                       if (userData == null)
-                               throw new ArgumentNullException ("userData");
-
+               public static byte[] Protect (byte[] userData, byte[] optionalEntropy, DataProtectionScope scope) \r
+               {\r
+                       if (userData == null)\r
+                               throw new ArgumentNullException ("userData");\r
+\r
                        // on Windows this is supported only under 2000 and later OS\r
                        Check (scope);\r
 \r
                        switch (impl) {\r
+#if !MOBILE\r
                        case DataProtectionImplementation.ManagedProtection:\r
                                try {\r
                                        return ManagedProtection.Protect (userData, optionalEntropy, scope);\r
@@ -71,21 +72,23 @@ namespace System.Security.Cryptography {
                                        string msg = Locale.GetText ("Data protection failed.");\r
                                        throw new CryptographicException (msg, e);\r
                                }\r
+#endif\r
                        default:\r
                                throw new PlatformNotSupportedException ();\r
                        }\r
                }\r
 \r
 // FIXME       [DataProtectionPermission (SecurityAction.Demand, UnprotectData = true)]\r
-               public static byte[] Unprotect (byte[] encryptedData, byte[] optionalEntropy, DataProtectionScope scope) 
-               {
-                       if (encryptedData == null)
-                               throw new ArgumentNullException ("encryptedData");
-
+               public static byte[] Unprotect (byte[] encryptedData, byte[] optionalEntropy, DataProtectionScope scope) \r
+               {\r
+                       if (encryptedData == null)\r
+                               throw new ArgumentNullException ("encryptedData");\r
+\r
                        // on Windows this is supported only under 2000 and later OS\r
                        Check (scope);\r
 \r
                        switch (impl) {\r
+#if !MOBILE\r
                        case DataProtectionImplementation.ManagedProtection:\r
                                try {\r
                                        return ManagedProtection.Unprotect (encryptedData, optionalEntropy, scope);\r
@@ -102,11 +105,12 @@ namespace System.Security.Cryptography {
                                        string msg = Locale.GetText ("Data unprotection failed.");\r
                                        throw new CryptographicException (msg, e);\r
                                }\r
+#endif\r
                        default:\r
                                throw new PlatformNotSupportedException ();\r
                        }\r
-               }
-
+               }\r
+\r
                // private stuff\r
 \r
                enum DataProtectionImplementation {\r
@@ -156,6 +160,6 @@ namespace System.Security.Cryptography {
                                throw new PlatformNotSupportedException ();\r
                        }\r
                }\r
-       }
-}
-
+       }\r
+}\r
+\r
diff --git a/mcs/class/System.Security/common_System.Security.dll.sources b/mcs/class/System.Security/common_System.Security.dll.sources
new file mode 100644 (file)
index 0000000..5a34119
--- /dev/null
@@ -0,0 +1,34 @@
+Assembly/AssemblyInfo.cs
+../../build/common/Consts.cs
+../../build/common/Locale.cs
+../../build/common/MonoTODOAttribute.cs
+System.Security.Cryptography/CryptographicAttribute.cs
+System.Security.Cryptography/CryptographicAttributeCollection.cs
+System.Security.Cryptography/CryptographicAttributeEnumerator.cs
+System.Security.Cryptography/DataProtectionScope.cs
+System.Security.Cryptography/ProtectedData.cs
+System.Security.Cryptography.Pkcs/AlgorithmIdentifier.cs
+System.Security.Cryptography.Pkcs/CmsRecipient.cs
+System.Security.Cryptography.Pkcs/CmsRecipientCollection.cs
+System.Security.Cryptography.Pkcs/CmsRecipientEnumerator.cs
+System.Security.Cryptography.Pkcs/ContentInfo.cs
+System.Security.Cryptography.Pkcs/EnvelopedCms.cs
+System.Security.Cryptography.Pkcs/KeyAgreeRecipientInfo.cs
+System.Security.Cryptography.Pkcs/KeyTransRecipientInfo.cs
+System.Security.Cryptography.Pkcs/Pkcs9Attribute.cs
+System.Security.Cryptography.Pkcs/Pkcs9ContentType.cs
+System.Security.Cryptography.Pkcs/Pkcs9DocumentDescription.cs
+System.Security.Cryptography.Pkcs/Pkcs9DocumentName.cs
+System.Security.Cryptography.Pkcs/Pkcs9MessageDigest.cs
+System.Security.Cryptography.Pkcs/Pkcs9SigningTime.cs
+System.Security.Cryptography.Pkcs/PublicKeyInfo.cs
+System.Security.Cryptography.Pkcs/RecipientInfo.cs
+System.Security.Cryptography.Pkcs/RecipientInfoCollection.cs
+System.Security.Cryptography.Pkcs/RecipientInfoEnumerator.cs
+System.Security.Cryptography.Pkcs/RecipientInfoType.cs
+System.Security.Cryptography.Pkcs/SubjectIdentifier.cs
+System.Security.Cryptography.Pkcs/SubjectIdentifierOrKey.cs
+System.Security.Cryptography.Pkcs/SubjectIdentifierOrKeyType.cs
+System.Security.Cryptography.Pkcs/SubjectIdentifierType.cs
+System.Security.Cryptography.Xml/X509IssuerSerial.cs
+
diff --git a/mcs/class/System.Security/mobile_static_System.Security.dll.sources b/mcs/class/System.Security/mobile_static_System.Security.dll.sources
new file mode 100644 (file)
index 0000000..599b7fa
--- /dev/null
@@ -0,0 +1 @@
+#include common_System.Security.dll.sources
diff --git a/mcs/class/System.Security/monodroid_System.Security.dll.sources b/mcs/class/System.Security/monodroid_System.Security.dll.sources
new file mode 100644 (file)
index 0000000..599b7fa
--- /dev/null
@@ -0,0 +1 @@
+#include common_System.Security.dll.sources
diff --git a/mcs/class/System.Security/monotouch_System.Security.dll.sources b/mcs/class/System.Security/monotouch_System.Security.dll.sources
new file mode 100644 (file)
index 0000000..599b7fa
--- /dev/null
@@ -0,0 +1 @@
+#include common_System.Security.dll.sources
diff --git a/mcs/class/System.Security/monotouch_runtime_System.Security.dll.sources b/mcs/class/System.Security/monotouch_runtime_System.Security.dll.sources
new file mode 100644 (file)
index 0000000..599b7fa
--- /dev/null
@@ -0,0 +1 @@
+#include common_System.Security.dll.sources
diff --git a/mcs/class/System.Security/monotouch_tv_System.Security.dll.sources b/mcs/class/System.Security/monotouch_tv_System.Security.dll.sources
new file mode 100644 (file)
index 0000000..599b7fa
--- /dev/null
@@ -0,0 +1 @@
+#include common_System.Security.dll.sources
diff --git a/mcs/class/System.Security/monotouch_tv_runtime_System.Security.dll.sources b/mcs/class/System.Security/monotouch_tv_runtime_System.Security.dll.sources
new file mode 100644 (file)
index 0000000..599b7fa
--- /dev/null
@@ -0,0 +1 @@
+#include common_System.Security.dll.sources
diff --git a/mcs/class/System.Security/monotouch_watch_System.Security.dll.sources b/mcs/class/System.Security/monotouch_watch_System.Security.dll.sources
new file mode 100644 (file)
index 0000000..599b7fa
--- /dev/null
@@ -0,0 +1 @@
+#include common_System.Security.dll.sources
diff --git a/mcs/class/System.Security/monotouch_watch_runtime_System.Security.dll.sources b/mcs/class/System.Security/monotouch_watch_runtime_System.Security.dll.sources
new file mode 100644 (file)
index 0000000..599b7fa
--- /dev/null
@@ -0,0 +1 @@
+#include common_System.Security.dll.sources
diff --git a/mcs/class/System.Security/xammac_System.Security.dll.sources b/mcs/class/System.Security/xammac_System.Security.dll.sources
new file mode 100644 (file)
index 0000000..599b7fa
--- /dev/null
@@ -0,0 +1 @@
+#include common_System.Security.dll.sources
index 4a22c093813b6bed844487fc386ae53b40257042..4fc4f14eee454fa3302758c4ce0b172c7cfd61e3 100644 (file)
@@ -33,7 +33,9 @@ using System.Net;
 using System.ServiceModel.Channels;
 using System.ServiceModel.Description;
 using System.Xml;
+#if !MOBILE && !XAMMAC_4_5
 using WS = System.Web.Services.Description;
+#endif
 
 namespace System.ServiceModel.Channels
 {
@@ -119,6 +121,7 @@ namespace System.ServiceModel.Channels
                        return false;
                }
 
+#if !MOBILE && !XAMMAC_4_5
                public override bool CanBuildChannelListener<TChannel> (
                        BindingContext context)
                {
@@ -132,6 +135,7 @@ namespace System.ServiceModel.Channels
                        }
                        return false;
                }
+#endif
 
                public override T GetProperty<T> (BindingContext context)
                {
@@ -141,6 +145,7 @@ namespace System.ServiceModel.Channels
                        return base.GetProperty<T> (context);
                }
 
+#if !MOBILE && !XAMMAC_4_5
                void IWsdlExportExtension.ExportContract (WsdlExporter exporter,
                                                          WsdlContractConversionContext context)
                {
@@ -192,5 +197,6 @@ namespace System.ServiceModel.Channels
                                transfer_mode == TransferMode.StreamedResponse)
                                assertions.Add (doc.CreateElement ("msf", "Streamed", "http://schemas.microsoft.com/ws/2006/05/framing/policy"));
                }
+#endif
        }
 }
index 3201ef86eb664118064f372eb0298e88d5d9b6d9..12be181d6d7d1a2a264a7bdbaa1d8c22414da6f5 100644 (file)
@@ -43,16 +43,21 @@ namespace System.ServiceModel.Channels
        {
                public SslStreamSecurityBindingElement ()
                {
+#if !MOBILE && !XAMMAC_4_5
                        verifier = IdentityVerifier.CreateDefault ();
+#endif
                }
 
+#if !MOBILE && !XAMMAC_4_5
                IdentityVerifier verifier;
-               bool require_client_certificate;
 
                public IdentityVerifier IdentityVerifier {
                        get { return verifier; }
                        set { verifier = value; }
                }
+#endif
+
+               bool require_client_certificate;
 
                public bool RequireClientCertificate {
                        get { return require_client_certificate; }
@@ -63,10 +68,13 @@ namespace System.ServiceModel.Channels
                        SslStreamSecurityBindingElement other)
                        : base (other)
                {
+#if !MOBILE && !XAMMAC_4_5
                        verifier = other.verifier;
+#endif
                        require_client_certificate = other.require_client_certificate;
                }
 
+#if !MOBILE && !XAMMAC_4_5
                [MonoTODO]
                public StreamUpgradeProvider BuildClientStreamUpgradeProvider (BindingContext context)
                {
@@ -87,6 +95,7 @@ namespace System.ServiceModel.Channels
                                "msf", "SslTransportSecurity", PolicyImportHelper.FramingPolicyNS);
                        return element;
                }
+#endif
 
                [MonoTODO]
                public override IChannelFactory<TChannel>
@@ -96,6 +105,7 @@ namespace System.ServiceModel.Channels
                        throw new NotImplementedException ();
                }
 
+#if !MOBILE && !XAMMAC_4_5
                [MonoTODO]
                public override IChannelListener<TChannel>
                        BuildChannelListener<TChannel> (
@@ -103,6 +113,7 @@ namespace System.ServiceModel.Channels
                {
                        throw new NotImplementedException ();
                }
+#endif
 
                [MonoTODO]
                public override bool CanBuildChannelFactory<TChannel> (
@@ -111,12 +122,14 @@ namespace System.ServiceModel.Channels
                        throw new NotImplementedException ();
                }
 
+#if !MOBILE && !XAMMAC_4_5
                [MonoTODO]
                public override bool CanBuildChannelListener<TChannel> (
                        BindingContext context)
                {
                        throw new NotImplementedException ();
                }
+#endif
 
                public override BindingElement Clone ()
                {
@@ -129,6 +142,7 @@ namespace System.ServiceModel.Channels
                        throw new NotImplementedException ();
                }
 
+#if !MOBILE && !XAMMAC_4_5
                #region explicit interface implementations
                [MonoTODO]
                void IPolicyExportExtension.ExportPolicy (
@@ -140,5 +154,6 @@ namespace System.ServiceModel.Channels
                        context.GetBindingAssertions ().Add (transportBinding);
                }
                #endregion
+#endif
        }
 }
index 64c3b38a249d89c6383ee8b0e6edc8573ba934e7..ae823e534ebd876c8672cf0708f3f2e2891886d6 100644 (file)
@@ -31,7 +31,9 @@ using System;
 using System.Collections.Generic;
 using System.Net;
 using System.ServiceModel.Channels;
+#if !MOBILE && !XAMMAC_4_5
 using System.ServiceModel.Channels.NetTcp;
+#endif
 using System.ServiceModel.Description;
 
 namespace System.ServiceModel.Channels
@@ -88,9 +90,15 @@ namespace System.ServiceModel.Channels
                {
                        if (!CanBuildChannelFactory<TChannel> (context))
                                throw new InvalidOperationException (String.Format ("Not supported channel factory type '{0}'", typeof (TChannel)));
+
+#if !MOBILE && !XAMMAC_4_5
                        return new TcpChannelFactory<TChannel> (this, context);
+#else
+                       throw new NotImplementedException ();
+#endif
                }
 
+#if !MOBILE && !XAMMAC_4_5
                public override IChannelListener<TChannel>
                        BuildChannelListener<TChannel> (
                        BindingContext context)
@@ -99,6 +107,7 @@ namespace System.ServiceModel.Channels
                                throw new InvalidOperationException (String.Format ("Not supported channel listener type '{0}'", typeof (TChannel)));
                        return new TcpChannelListener<TChannel> (this, context);
                }
+#endif
 
                public override BindingElement Clone ()
                {
index 4f1a5fde8f20298e778c7af08a98c5138b246aee..bab577c5bae65551901ae3f14e54e84dc1b61a06 100644 (file)
@@ -56,7 +56,7 @@ namespace System.ServiceModel.Channels
                        max_recv_message_size = other.max_recv_message_size;
                }
 
-               public bool ManualAddressing {
+               public virtual bool ManualAddressing {
                        get { return manual_addressing; }
                        set { manual_addressing = value; }
                }
index e57cfde91e3b4e386d382a1607373eb66b5adf14..2d8e461f7356a070b857afaefe9d0fb0ec2a041f 100644 (file)
@@ -61,12 +61,14 @@ namespace System.ServiceModel.Channels
                        return context.BuildInnerChannelFactory<TChannel> ();
                }
 
+#if !MOBILE && !XAMMAC_4_5
                public override IChannelListener<TChannel>
                        BuildChannelListener<TChannel> (
                        BindingContext context)
                {
                        return context.BuildInnerChannelListener<TChannel> ();
                }
+#endif
 
                public override bool CanBuildChannelFactory<TChannel> (
                        BindingContext context)
@@ -74,11 +76,13 @@ namespace System.ServiceModel.Channels
                        return context.CanBuildInnerChannelFactory<TChannel> ();
                }
 
+#if !MOBILE && !XAMMAC_4_5
                public override bool CanBuildChannelListener<TChannel> (
                        BindingContext context)
                {
                        return context.CanBuildInnerChannelListener<TChannel> ();
                }
+#endif
 
                public override BindingElement Clone ()
                {
@@ -89,8 +93,10 @@ namespace System.ServiceModel.Channels
                {
                        if (typeof (T) == typeof (ISecurityCapabilities))
                                return (T) (object) this;
+#if !MOBILE && !XAMMAC_4_5
                        if (typeof (T) == typeof (IdentityVerifier))
                                return (T) (object) IdentityVerifier.CreateDefault ();
+#endif
                        return null;
                }
 
@@ -120,6 +126,7 @@ namespace System.ServiceModel.Channels
                        get { throw new NotImplementedException (); }
                }
 
+#if !MOBILE && !XAMMAC_4_5
                [MonoTODO]
                void IPolicyExportExtension.ExportPolicy (
                        MetadataExporter exporter,
@@ -141,6 +148,7 @@ namespace System.ServiceModel.Channels
                        element.AppendChild (protectionLevel);
                        return element;
                }
+#endif
                #endregion
        }
 }
index 41c6658f9cfd6e75559032e18ea1f3355d6aed46..3d8e71035a0f6c3a1bff8dd34dc527866e2b3131 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.
 //
+#if !MOBILE && !XAMMAC_4_5
 using System.IdentityModel.Selectors;
 using System.IdentityModel.Tokens;
+#endif
 using System.ServiceModel.Channels;
 using System.ServiceModel.Security;
 
+#if !MOBILE && !XAMMAC_4_5
 using ReqType = System.ServiceModel.Security.Tokens.ServiceModelSecurityTokenRequirement;
+#endif
 
 namespace System.ServiceModel.Security.Tokens
 {
        public class SecureConversationSecurityTokenParameters : SecurityTokenParameters
        {
+#if !MOBILE && !XAMMAC_4_5
                static readonly ChannelProtectionRequirements default_channel_protection_requirements;
+#endif
                static readonly BindingContext dummy_context;
 
                static SecureConversationSecurityTokenParameters ()
                {
+#if !MOBILE && !XAMMAC_4_5
                        ChannelProtectionRequirements r =
                                new ChannelProtectionRequirements ();
                        r.IncomingSignatureParts.ChannelParts.IsBodyIncluded = true;
@@ -49,6 +56,7 @@ namespace System.ServiceModel.Security.Tokens
                        r.OutgoingEncryptionParts.ChannelParts.IsBodyIncluded = true;
                        r.MakeReadOnly ();
                        default_channel_protection_requirements = r;
+#endif
 
                        dummy_context = new BindingContext (
                                new CustomBinding (),
@@ -56,7 +64,9 @@ namespace System.ServiceModel.Security.Tokens
                }
 
                SecurityBindingElement element;
+#if !MOBILE && !XAMMAC_4_5
                ChannelProtectionRequirements requirements;
+#endif
                bool cancellable;
 
                public SecureConversationSecurityTokenParameters ()
@@ -77,6 +87,7 @@ namespace System.ServiceModel.Security.Tokens
                {
                }
 
+#if !MOBILE && !XAMMAC_4_5
                public SecureConversationSecurityTokenParameters (
                        SecurityBindingElement element,
                        bool requireCancellation,
@@ -89,13 +100,25 @@ namespace System.ServiceModel.Security.Tokens
                        else
                                this.requirements = new ChannelProtectionRequirements (requirements);
                }
+#else
+               internal SecureConversationSecurityTokenParameters (
+                       SecurityBindingElement element,
+                       bool requireCancellation,
+                       object dummy)
+               {
+                       this.element = element;
+                       this.cancellable = requireCancellation;
+               }
+#endif
 
                protected SecureConversationSecurityTokenParameters (SecureConversationSecurityTokenParameters source)
                        : base (source)
                {
                        this.element = (SecurityBindingElement) source.element.Clone ();
                        this.cancellable = source.cancellable;
+#if !MOBILE && !XAMMAC_4_5
                        this.requirements = new ChannelProtectionRequirements (default_channel_protection_requirements);
+#endif
                }
 
                public bool RequireCancellation {
@@ -108,9 +131,11 @@ namespace System.ServiceModel.Security.Tokens
                        set { element = value; }
                }
 
+#if !MOBILE && !XAMMAC_4_5
                public ChannelProtectionRequirements BootstrapProtectionRequirements {
                        get { return requirements; }
                }
+#endif
 
                // SecurityTokenParameters
 
@@ -135,13 +160,13 @@ namespace System.ServiceModel.Security.Tokens
                        return new SecureConversationSecurityTokenParameters (this);
                }
 
+#if !MOBILE && !XAMMAC_4_5
                [MonoTODO]
                protected override SecurityKeyIdentifierClause CreateKeyIdentifierClause (
                        SecurityToken token, SecurityTokenReferenceStyle referenceStyle)
                {
                        throw new NotImplementedException ();
                }
-
                [MonoTODO]
                protected internal override void InitializeSecurityTokenRequirement (SecurityTokenRequirement requirement)
                {
@@ -154,6 +179,7 @@ namespace System.ServiceModel.Security.Tokens
                        requirement.Properties [ReqType.IssuedSecurityTokenParametersProperty] = this.Clone ();
                        requirement.KeyType = SecurityKeyType.SymmetricKey;
                }
+#endif
 
                public override string ToString ()
                {
index f4c3f3ceff5a6800cacb46b187c7478b8743f97f..c5ff1439e0c7f37719ecdad155965abd4ee76832 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.
 //
+
+#if !MOBILE && !XAMMAC_4_5
 using System.IdentityModel.Selectors;
 using System.IdentityModel.Tokens;
+#endif
 using System.ServiceModel.Channels;
 using System.ServiceModel.Security;
 using System.Text;
@@ -114,6 +117,7 @@ namespace System.ServiceModel.Security.Tokens
 
                protected abstract SecurityTokenParameters CloneCore ();
 
+#if !MOBILE && !XAMMAC_4_5
                protected abstract SecurityKeyIdentifierClause CreateKeyIdentifierClause (
                        SecurityToken token, SecurityTokenReferenceStyle referenceStyle);
 
@@ -125,11 +129,13 @@ namespace System.ServiceModel.Security.Tokens
                }
 
                protected internal abstract void InitializeSecurityTokenRequirement (SecurityTokenRequirement requirement);
+#endif
 
                internal BindingContext IssuerBindingContext {
                        set { issuer_binding_context = value; }
                }
 
+#if !MOBILE && !XAMMAC_4_5
                internal void CallInitializeSecurityTokenRequirement (SecurityTokenRequirement requirement)
                {
                        if (issuer_binding_context != null)
@@ -145,5 +151,6 @@ namespace System.ServiceModel.Security.Tokens
                {
                        throw new NotImplementedException ();
                }
+#endif
        }
 }
index 8a40a61c0cd2b8accfac5bbdcaa5202c44d33355..46f14360654c6e604d775af18b399764511d0e95 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.
 //
+#if !MOBILE && !XAMMAC_4_5
 using System.IdentityModel.Selectors;
 using System.IdentityModel.Tokens;
+#endif
 using System.ServiceModel.Security;
 
 namespace System.ServiceModel.Security.Tokens
@@ -64,6 +66,7 @@ namespace System.ServiceModel.Security.Tokens
                        return new UserNameSecurityTokenParameters (this);
                }
 
+#if !MOBILE && !XAMMAC_4_5
                protected override SecurityKeyIdentifierClause CreateKeyIdentifierClause (
                        SecurityToken token, SecurityTokenReferenceStyle referenceStyle)
                {
@@ -81,5 +84,6 @@ namespace System.ServiceModel.Security.Tokens
                        requirement.TokenType = SecurityTokenTypes.UserName;
                        requirement.RequireCryptographicToken = true;
                }
+#endif
        }
 }
index 20a6a2cbf7a52679a036e6fe605796aeb812ad6d..8e54cb5c622cfbb4f2f7f328292feb1605ee3d24 100644 (file)
@@ -1004,6 +1004,7 @@ System.ServiceModel/BasicHttpBinding_4_5.cs
 System.ServiceModel/BasicHttpsBinding.cs
 System.ServiceModel/BasicHttpsSecurity.cs
 System.ServiceModel/NetHttpBinding.cs
+System.ServiceModel/NetHttpsBinding.cs
 System.ServiceModel/NetHttpMessageEncoding.cs
 System.ServiceModel.Channels/CompressionFormat.cs
 System.ServiceModel.Channels/WebSocketTransportSettings.cs
index e6a96dac52a1aa8de552250e70c59d34746a3f66..21e66a4f65b462670d2c38ea5b0ee018943b6617 100644 (file)
@@ -79,6 +79,7 @@ namespace System.ServiceModel
 
                public BasicHttpsSecurity Security {
                        get { return security; }
+                       set { security = value; }
                }
 
                public override BindingElementCollection
index c5c870c0f33bab17acdd90c7abb679154715d5ea..de946ceb4438a36f6b46123621d978905dbef2eb 100644 (file)
@@ -64,6 +64,7 @@ namespace System.ServiceModel
 
                public HttpTransportSecurity Transport {
                        get { return transport; }
+                       set { transport = value; }
                }
        }
 }
index f392be8d37a35301c25f086c22b6fadd764a0838..5a5ca874df89227a7a85248491c5e48d55c64dab 100644 (file)
@@ -29,7 +29,9 @@ using System;
 using System.ServiceModel.Channels;
 using System.ServiceModel.Description;
 using System.ServiceModel.Dispatcher;
+#if !MOBILE && !XAMMAC_4_5
 using System.Transactions;
+#endif
 
 namespace System.ServiceModel
 {
@@ -45,7 +47,9 @@ namespace System.ServiceModel
                        MaxItemsInObjectGraph = 0x10000;
                        UseSynchronizationContext = true;
                        ValidateMustUnderstand = true;
+#if !MOBILE && !XAMMAC_4_5
                        TransactionIsolationLevel = IsolationLevel.Unspecified;
+#endif
                }
 
                [MonoTODO]
@@ -63,8 +67,10 @@ namespace System.ServiceModel
                [MonoTODO]
                public int MaxItemsInObjectGraph { get; set; }
 
+#if !MOBILE && !XAMMAC_4_5
                [MonoTODO]
                public IsolationLevel TransactionIsolationLevel { get; set; }
+#endif
 
                [MonoTODO]
                public string TransactionTimeout { get; set; }
index b5ac514b0dae3d7f843a5f3420c58c615c997bbe..9c9b76aec61ac33aae7400c40f01df1c6004c1b3 100644 (file)
@@ -27,7 +27,9 @@
 //
 using System;
 using System.Collections.Generic;
+#if !MOBILE && !XAMMAC_4_5
 using System.IdentityModel.Claims;
+#endif
 using System.Security.Cryptography;
 using System.Security.Cryptography.X509Certificates;
 using System.Xml;
@@ -37,6 +39,7 @@ namespace System.ServiceModel
 {
        public class DnsEndpointIdentity : EndpointIdentity
        {
+#if !MOBILE && !XAMMAC_4_5
                public DnsEndpointIdentity (Claim identity)
                {
                        Initialize (identity);
@@ -46,5 +49,11 @@ namespace System.ServiceModel
                        : this (Claim.CreateDnsClaim (dns))
                {
                }
+#else
+               public DnsEndpointIdentity (string dns)
+               {
+                       throw new NotImplementedException ();
+               }
+#endif
        }
 }
index e72ab9b8d2b73ad82948de307b075a957cb9b518..01336d803a50be8a40a7d2015c5358837439d86f 100644 (file)
@@ -217,8 +217,11 @@ namespace System.ServiceModel
                        // no special magic), we have to use different approach
                        // that should work either.
                        object proxy = Activator.CreateInstance (type, new object [] {Endpoint, this, address, via});
-#else
+#elif !MOBILE && !XAMMAC_4_5
                        object proxy = new ClientRealProxy (typeof (TChannel), new DuplexClientRuntimeChannel (Endpoint, this, address, via), true).GetTransparentProxy ();
+#else
+                       object proxy;
+                       throw new NotImplementedException ();
 #endif
 
                        ((IDuplexContextChannel) proxy).CallbackInstance = callbackInstance;
index 4fa56e12a78a964bba565818d308429d40ba09e6..db6647c76f5188f5277d129baca9bb48dc5f225e 100644 (file)
@@ -192,10 +192,6 @@ namespace System.ServiceModel.MonoInternal
                        } catch (Exception ex) {
                                // FIXME: log it.
                                Console.WriteLine (ex);
-                       } finally {
-                               // unless it is closed by session/call manager, move it back to the loop to receive the next message.
-                               if (loop && input.State != CommunicationState.Closed)
-                                       ProcessRequestOrInput (input);
                        }
                }
 
index 4ed2088711e1760886a1207a414ddbc40083b940..8852d3d12789695b217a7059173e5754e1e6dbae 100644 (file)
@@ -110,7 +110,7 @@ namespace System.ServiceModel
                        set { reader_quotas = value; }
                }
 
-               public override abstract string Scheme {
+               public override string Scheme {
                        get;
                }
 
index c7852cd1ffd101b441baf7913e28ae1a5b599d5f..6e9a794ee410eac05f81e9e169c62677090b9800 100644 (file)
@@ -31,22 +31,28 @@ namespace System.ServiceModel
 {
        public sealed class MessageSecurityOverTcp
        {
+#if !MOBILE && !XAMMAC_4_5
                SecurityAlgorithmSuite alg_suite;
+#endif
                MessageCredentialType client_credential_type;
 
                internal MessageSecurityOverTcp ()
                {
+#if !MOBILE && !XAMMAC_4_5
                        alg_suite = SecurityAlgorithmSuite.Default;
+#endif
                        // This default value is *silly* but anyways
                        // such code that does not change this ClientCredentialType 
                        // won't work on Mono.
                        client_credential_type = MessageCredentialType.Windows;
                }
 
+#if !MOBILE && !XAMMAC_4_5
                public SecurityAlgorithmSuite AlgorithmSuite {
                        get { return alg_suite; }
                        set { alg_suite = value; }
                }
+#endif
 
                public MessageCredentialType ClientCredentialType {
                        get { return client_credential_type; }
index 2f53bc57b670acb2a596e194a713f628c10352f1..d6a5e19d2866f530af0ba4e4775e1518dfae89a6 100644 (file)
 //
 using System.Collections.Generic;
 using System.Collections.ObjectModel;
+#if !MOBILE && !XAMMAC_4_5
 using System.IdentityModel.Selectors;
 using System.IdentityModel.Tokens;
+#endif
 using System.ServiceModel.Description;
 using System.ServiceModel.Channels;
 using System.ServiceModel.Security;
@@ -38,6 +40,7 @@ namespace System.ServiceModel
 {
        public abstract class MessageSecurityVersion
        {
+#if !MOBILE && !XAMMAC_4_5
                // Types
                class MessageSecurityTokenVersion : SecurityTokenVersion
                {
@@ -112,6 +115,7 @@ namespace System.ServiceModel
                                        SecureConversationVersion = SecureConversationVersion.WSSecureConversationFeb2005;
                                        TrustVersion = TrustVersion.WSTrustFeb2005;
                                }
+                               this.SecurityVersion = wss11 ? SecurityVersion.WSSecurity11 : SecurityVersion.WSSecurity10;
                        }
 
                        public override BasicSecurityProfileVersion BasicSecurityProfileVersion {
@@ -122,14 +126,11 @@ namespace System.ServiceModel
                                get { return MessageSecurityTokenVersion.GetVersion (wss11, basic_profile); }
                        }
 
-                       public override SecurityVersion SecurityVersion {
-                               get { return wss11 ? SecurityVersion.WSSecurity11 : SecurityVersion.WSSecurity10; }
-                       }
-
                        public override SecurityPolicyVersion SecurityPolicyVersion {
                                get { return use2007 ? SecurityPolicyVersion.WSSecurityPolicy12 : SecurityPolicyVersion.WSSecurityPolicy11; }
                        }
                }
+#endif
 
                // Static members
 
@@ -137,12 +138,16 @@ namespace System.ServiceModel
 
                static MessageSecurityVersion ()
                {
+#if !MOBILE && !XAMMAC_4_5
                        wss10_basic = new MessageSecurityVersionImpl (false, true, false);
                        wss11 = new MessageSecurityVersionImpl (true, false, false);
                        wss11_basic = new MessageSecurityVersionImpl (true, true, false);
                        wss10_2007_basic = new MessageSecurityVersionImpl (false, true, true);
                        wss11_2007_basic = new MessageSecurityVersionImpl (true, true, true);
                        wss11_2007 = new MessageSecurityVersionImpl (true, false, true);
+#else
+                       throw new NotImplementedException ();
+#endif
                }
 
                public static MessageSecurityVersion Default {
@@ -183,9 +188,11 @@ namespace System.ServiceModel
 
                public abstract BasicSecurityProfileVersion BasicSecurityProfileVersion { get; }
 
+#if !MOBILE && !XAMMAC_4_5
                public abstract SecurityTokenVersion SecurityTokenVersion { get; }
+#endif
 
-               public abstract SecurityVersion SecurityVersion { get; }
+               public SecurityVersion SecurityVersion { get; internal set; }
 
                public SecureConversationVersion SecureConversationVersion { get; internal set; }
 
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel/NetHttpsBinding.cs b/mcs/class/System.ServiceModel/System.ServiceModel/NetHttpsBinding.cs
new file mode 100644 (file)
index 0000000..703de22
--- /dev/null
@@ -0,0 +1,83 @@
+// Authors:
+//      Martin Baulig (martin.baulig@xamarin.com)
+//
+// Copyright 2012 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.ServiceModel.Channels;
+
+namespace System.ServiceModel {
+       [MonoTODO]
+       public class NetHttpsBinding : HttpBindingBase {
+               public NetHttpsBinding ()
+               {
+                       throw new NotImplementedException ();
+               }
+               
+               public NetHttpsBinding (BasicHttpsSecurityMode securityMode)
+               {
+                       throw new NotImplementedException ();
+               }
+               
+               public NetHttpsBinding (string configurationName)
+               {
+                       throw new NotImplementedException ();
+               }
+               
+               public NetHttpsBinding (
+                       BasicHttpsSecurityMode securityMode, bool reliableSessionEnabled)
+               {
+                       throw new NotImplementedException ();
+               }
+               
+               public NetHttpMessageEncoding MessageEncoding { get; set; }
+               public OptionalReliableSession ReliableSession { get; set; }
+               public BasicHttpsSecurity Security { get; set; }
+
+               public WebSocketTransportSettings WebSocketSettings {
+                       get { throw new NotImplementedException (); }
+               }
+               
+               public override string Scheme {
+                       get { throw new NotImplementedException (); }
+               }
+               
+               public override BindingElementCollection CreateBindingElements ()
+               {
+                       throw new NotImplementedException ();
+               }
+               
+               public bool ShouldSerializeReliableSession ()
+               {
+                       throw new NotImplementedException ();
+               }
+               
+               public bool ShouldSerializeSecurity ()
+               {
+                       throw new NotImplementedException ();
+               }
+               
+               
+               
+       }
+}
\ No newline at end of file
index 794445155d8eefa93a107137ba23439db5470f6f..51a8c3cfb2e1a370984e7885dcbe52a4e76e6acb 100644 (file)
@@ -46,7 +46,9 @@ namespace System.ServiceModel
                XmlDictionaryReaderQuotas reader_quotas
                        = new XmlDictionaryReaderQuotas ();
                bool transaction_flow;
+#if !MOBILE && !XAMMAC_4_5
                TransactionProtocol transaction_protocol;
+#endif
                TcpTransportBindingElement transport;
 
                public NetTcpBinding ()
@@ -69,9 +71,13 @@ namespace System.ServiceModel
                public NetTcpBinding (string configurationName)
                        : this ()
                {
+#if !MOBILE && !XAMMAC_4_5
                        var bindingsSection = ConfigUtil.BindingsSection;
                        var el = bindingsSection.NetTcpBinding.Bindings [configurationName];
                        el.ApplyConfiguration (this);
+#else
+                       throw new NotImplementedException ();
+#endif
                }
 
                internal NetTcpBinding (TcpTransportBindingElement transport,
@@ -147,10 +153,12 @@ namespace System.ServiceModel
                        set { transaction_flow = value; }
                }
 
+#if !MOBILE && !XAMMAC_4_5
                public TransactionProtocol TransactionProtocol {
                        get { return transaction_protocol; }
                        set { transaction_protocol = value; }
                }
+#endif
 
                // overrides
 
@@ -160,18 +168,22 @@ namespace System.ServiceModel
 
                public override BindingElementCollection CreateBindingElements ()
                {
+#if !MOBILE && !XAMMAC_4_5
                        BindingElement tx = new TransactionFlowBindingElement (TransactionProtocol.WSAtomicTransactionOctober2004);
                        SecurityBindingElement sec = CreateMessageSecurity ();
+#endif
                        var msg = new BinaryMessageEncodingBindingElement ();
                        if (ReaderQuotas != null)
                                ReaderQuotas.CopyTo (msg.ReaderQuotas);
                        var trsec = CreateTransportSecurity ();
                        BindingElement tr = GetTransport ();
                        List<BindingElement> list = new List<BindingElement> ();
+#if !MOBILE && !XAMMAC_4_5
                        if (tx != null)
                                list.Add (tx);
                        if (sec != null)
                                list.Add (sec);
+#endif
                        list.Add (msg);
                        if (trsec != null)
                                list.Add (trsec);
@@ -184,6 +196,7 @@ namespace System.ServiceModel
                        return transport.Clone ();
                }
 
+#if !MOBILE && !XAMMAC_4_5
                // It is problematic, but there is no option to disable establishing security context in this binding unlike WSHttpBinding...
                SecurityBindingElement CreateMessageSecurity ()
                {
@@ -239,6 +252,7 @@ namespace System.ServiceModel
                                // FIXME: requireCancellation
                                element, true, reqs);
                }
+#endif
 
                BindingElement CreateTransportSecurity ()
                {
index d93be038818e9fd64c2b59b5163c26a0b5cd0dd1..396579fd2555c54aab9803f9eb3b90604c0dd641 100644 (file)
@@ -27,7 +27,9 @@
 //
 using System;
 using System.Collections.Generic;
+#if !MOBILE && !XAMMAC_4_5
 using System.IdentityModel.Claims;
+#endif
 using System.Security.Cryptography;
 using System.Security.Cryptography.X509Certificates;
 using System.Xml;
@@ -37,6 +39,7 @@ namespace System.ServiceModel
 {
        public class SpnEndpointIdentity : EndpointIdentity
        {
+#if !MOBILE && !XAMMAC_4_5
                public SpnEndpointIdentity (Claim identity)
                {
                        Initialize (identity);
@@ -46,6 +49,12 @@ namespace System.ServiceModel
                        : this (Claim.CreateSpnClaim (spn))
                {
                }
+#else
+               public SpnEndpointIdentity (string spn)
+               {
+                       throw new NotImplementedException ();
+               }
+#endif
 
                [MonoTODO]
                public static TimeSpan SpnLookupTime {
index a866e93e4cba737f0cf73f35f9057650ca72e204..e53d72009a66a6c7591354242e2b7d8a20997dfb 100644 (file)
@@ -27,7 +27,9 @@
 //
 using System;
 using System.Collections.Generic;
+#if !MOBILE && !XAMMAC_4_5
 using System.IdentityModel.Claims;
+#endif
 using System.Security.Cryptography;
 using System.Security.Cryptography.X509Certificates;
 using System.Xml;
@@ -37,6 +39,7 @@ namespace System.ServiceModel
 {
        public class UpnEndpointIdentity : EndpointIdentity
        {
+#if !MOBILE && !XAMMAC_4_5
                public UpnEndpointIdentity (Claim identity)
                {
                        Initialize (identity);
@@ -46,5 +49,11 @@ namespace System.ServiceModel
                        : this (Claim.CreateUpnClaim (upn))
                {
                }
+#else
+               public UpnEndpointIdentity (string upn)
+               {
+                       throw new NotImplementedException ();
+               }
+#endif
        }
 }
index dd2dc7f1c70d6e37264ac1c428b2d6592f37eacf..d06cb33fe21c43bca6002a04358d3c9f0c28bbe9 100644 (file)
@@ -1,5 +1,4 @@
 NUnitMoonHelper.cs
-../../test-helpers/NetworkHelpers.cs
 FeatureBased/Features.Client/AsyncCallTesterProxy.cs
 FeatureBased/Features.Client/AsyncPatternServer.cs
 FeatureBased/Features.Client/DataContractTesterProxy.cs
index 1b83c9e468e3dcf353b7c59bab5da5ee28079337..6666c86e4845d1fa077bba9db397905c2ad291fc 100644 (file)
@@ -187,6 +187,7 @@ System.ServiceModel/BasicHttpSecurity.cs
 System.ServiceModel/BasicHttpMessageSecurity.cs
 System.ServiceModel/BasicHttpsBinding.cs
 System.ServiceModel/BasicHttpsSecurity.cs
+System.ServiceModel/CallbackBehaviorAttribute.cs
 System.ServiceModel/ChannelFactory.cs
 System.ServiceModel/ChannelFactory_1.cs
 System.ServiceModel/ClientBase.cs
@@ -200,6 +201,8 @@ System.ServiceModel/Constants.cs
 System.ServiceModel/DataContractFormatAttribute.cs
 System.ServiceModel/DefaultCommunicationTimeouts.cs
 System.ServiceModel/Dummy.cs
+System.ServiceModel/DuplexClientBase.cs
+System.ServiceModel/DuplexChannelFactory.cs
 System.ServiceModel/EndpointAddress.cs
 System.ServiceModel/EndpointAddress10.cs
 System.ServiceModel/EndpointAddressBuilder.cs
@@ -218,6 +221,7 @@ System.ServiceModel/IClientChannel.cs
 System.ServiceModel/ICommunicationObject.cs
 System.ServiceModel/IContextChannel.cs
 System.ServiceModel/IDefaultCommunicationTimeouts.cs
+System.ServiceModel/IDuplexClientChannel.cs
 System.ServiceModel/IExtensibleObject.cs
 System.ServiceModel/IExtension.cs
 System.ServiceModel/IExtensionCollection.cs
@@ -233,6 +237,7 @@ System.ServiceModel/MessageHeader_1.cs
 System.ServiceModel/MessageParameterAttribute.cs
 System.ServiceModel/MessagePropertyAttribute.cs
 System.ServiceModel/NetHttpBinding.cs
+System.ServiceModel/NetHttpsBinding.cs
 System.ServiceModel/NetHttpMessageEncoding.cs
 System.ServiceModel/OperationContext.cs
 System.ServiceModel/OperationContextScope.cs
@@ -255,3 +260,30 @@ Dummy_2_1.cs
 System.ServiceModel/XmlSerializerFormatAttribute.cs
 System.ServiceModel.Description/XmlSerializerOperationBehavior.cs
 System.ServiceModel.Dispatcher/XmlMessagesFormatter.cs
+
+System.ServiceModel.Channels/ConnectionOrientedTransportBindingElement.cs
+System.ServiceModel.Channels/SslStreamSecurityBindingElement.cs
+System.ServiceModel.Channels/TcpConnectionPoolSettings.cs
+System.ServiceModel.Channels/TcpTransportBindingElement.cs
+System.ServiceModel.Channels/WindowsStreamSecurityBindingElement.cs
+
+System.ServiceModel/MessageSecurityOverTcp.cs
+System.ServiceModel/NetTcpBinding.cs
+System.ServiceModel/NetTcpSecurity.cs
+System.ServiceModel/TcpTransportSecurity.cs
+System.ServiceModel/DnsEndpointIdentity.cs
+System.ServiceModel/SpnEndpointIdentity.cs
+System.ServiceModel/UpnEndpointIdentity.cs
+System.ServiceModel/MessageSecurityVersion.cs
+
+System.ServiceModel.Security/BasicSecurityProfileVersion.cs
+System.ServiceModel.Security/SecurityVersion.cs
+System.ServiceModel.Security/TrustVersion.cs
+System.ServiceModel.Security/SecureConversationVersion.cs
+System.ServiceModel.Security/SecurityPolicyVersion.cs
+
+System.ServiceModel.Security.Tokens/SecurityTokenParameters.cs
+System.ServiceModel.Security.Tokens/SecurityTokenReferenceStyle.cs
+System.ServiceModel.Security.Tokens/SecureConversationSecurityTokenParameters.cs
+System.ServiceModel.Security.Tokens/SupportingTokenParameters.cs
+System.ServiceModel.Security.Tokens/UserNameSecurityTokenParameters.cs
diff --git a/mcs/class/System.ServiceModel/mobile_static_System.ServiceModel_test.dll.exclude.sources b/mcs/class/System.ServiceModel/mobile_static_System.ServiceModel_test.dll.exclude.sources
new file mode 100644 (file)
index 0000000..350444a
--- /dev/null
@@ -0,0 +1,151 @@
+FeatureBased/Features.Contracts/AsyncCallTester.cs
+FeatureBased/Features.Contracts/FaultsTester.cs
+FeatureBased/Features.Serialization/AsyncCallTest.cs
+FeatureBased/Features.Serialization/AsyncPatternTester.cs
+FeatureBased/Features.Serialization/DataContractSerializerTest.cs
+FeatureBased/Features.Serialization/DualContractTester.cs
+FeatureBased/Features.Serialization/ExitProcessHelper.cs
+FeatureBased/Features.Serialization/FaultsTest.cs
+FeatureBased/Features.Serialization/KnownTypeTest.cs
+FeatureBased/Features.Serialization/MessageContractTest.cs
+FeatureBased/Features.Serialization/OperationContractTester.cs
+FeatureBased/Features.Serialization/PrimitiveTesterTest.cs
+FeatureBased/Features.Serialization/UntypedMessageTest.cs
+FeatureBased/TestFixtureBase.cs
+MetadataTests/BindingTestAssertions.cs
+MetadataTests/ExportTests.cs
+MetadataTests/ImportTests.cs
+MetadataTests/ImportTests_CreateMetadata.cs
+MetadataTests/ImportTests_LoadMetadata.cs
+MetadataTests/ImportTests_RoundTrip.cs
+MetadataTests/MetadataSamples.cs
+MetadataTests/MiscImportTests.cs
+MetadataTests/TestContext.cs
+System.ServiceModel.Channels/AsymmetricSecurityBindingElementTest.cs
+System.ServiceModel.Channels/BinaryMessageEncodingBindingElementTest.cs
+System.ServiceModel.Channels/BindingElementTest.cs
+System.ServiceModel.Channels/CalcSampleProxy.cs
+System.ServiceModel.Channels/CommunicationObjectTest.cs
+System.ServiceModel.Channels/ConnectionOrientedTransportBindingElementTest.cs
+System.ServiceModel.Channels/CustomBindingTest.cs
+System.ServiceModel.Channels/CustomPolicyConversionContext.cs
+System.ServiceModel.Channels/HandlerTransportBindingElement.cs
+System.ServiceModel.Channels/HttpTransportBindingElementTest.cs
+System.ServiceModel.Channels/HttpsTransportBindingElementTest.cs
+System.ServiceModel.Channels/InterceptorBindingElement.cs
+System.ServiceModel.Channels/LocalClientSecuritySettingsTest.cs
+System.ServiceModel.Channels/MessageBufferTest.cs
+System.ServiceModel.Channels/MessageEncoderTest.cs
+System.ServiceModel.Channels/MsmqBindingElementBaseTest.cs
+System.ServiceModel.Channels/MsmqTransportBindingElementTest.cs
+System.ServiceModel.Channels/NamedPipeTransportBindingElementTest.cs
+System.ServiceModel.Channels/OneWayBindingElementTest.cs
+System.ServiceModel.Channels/PeerTransportBindingElementTest.cs
+System.ServiceModel.Channels/ReplyChannelBase.cs
+System.ServiceModel.Channels/SecurityAssert.cs
+System.ServiceModel.Channels/SecurityBindingElementTest.cs
+System.ServiceModel.Channels/SslStreamSecurityBindingElementTest.cs
+System.ServiceModel.Channels/SymmetricSecurityBindingElementTest.cs
+System.ServiceModel.Channels/TcpTransportBindingElementTest.cs
+System.ServiceModel.Channels/TextMessageEncodingBindingElementTest.cs
+System.ServiceModel.Channels/TransactionFlowBindingElementTest.cs
+System.ServiceModel.Configuration/AddressHeaderCollectionElementTest.cs
+System.ServiceModel.Configuration/BasicHttpBindingElementTest.cs
+System.ServiceModel.Configuration/BehaviorsSectionTest.cs
+System.ServiceModel.Configuration/BindingsSectionTest.cs
+System.ServiceModel.Configuration/ChannelEndpointElementTest.cs
+System.ServiceModel.Configuration/CustomBindingElementTest.cs
+System.ServiceModel.Configuration/EndpointBehaviorElementTest.cs
+System.ServiceModel.Configuration/ExtensionsSectionTest.cs
+System.ServiceModel.Configuration/MetadataElementTest.cs
+System.ServiceModel.Configuration/MexBindingElementTest.cs
+System.ServiceModel.Configuration/NetNamedPipeBindingElementTest.cs
+System.ServiceModel.Configuration/NetPeerTcpBindingElementTest.cs
+System.ServiceModel.Configuration/NetTcpBindingElementTest.cs
+System.ServiceModel.Configuration/ServiceBehaviorElementTest.cs
+System.ServiceModel.Configuration/ServiceElementTest.cs
+System.ServiceModel.Configuration/ServiceModelConfigurationElementCollectionTest.cs
+System.ServiceModel.Configuration/ServiceModelSectionGroupTest.cs
+System.ServiceModel.Configuration/StandardBindingCollectionElementTest.cs
+System.ServiceModel.Configuration/StandardBindingElementCollectionTest.cs
+System.ServiceModel.Configuration/StandardBindingElementTest.cs
+System.ServiceModel.Configuration/StandardEndpointsSectionTest.cs
+System.ServiceModel.Configuration/UserBinding.cs
+System.ServiceModel.Description/ClientCredentialsTest.cs
+System.ServiceModel.Description/ContractDescriptionTest.cs
+System.ServiceModel.Description/MetadataExchangeBindingsTest.cs
+System.ServiceModel.Description/MetadataResolverTest.cs
+System.ServiceModel.Description/MetadataSetTest.cs
+System.ServiceModel.Description/ServiceAuthorizationBehaviorTest.cs
+System.ServiceModel.Description/ServiceContractGeneratorTest.cs
+System.ServiceModel.Description/ServiceCredentialsTest.cs
+System.ServiceModel.Description/ServiceDebugBehaviorTest.cs
+System.ServiceModel.Description/ServiceMetadataBehaviorTest.cs
+System.ServiceModel.Description/ServiceMetadataEndpointTest.cs
+System.ServiceModel.Description/ServiceThrottlingBehaviorTest.cs
+System.ServiceModel.Description/TypedMessageConverterTest.cs
+System.ServiceModel.Description/WsdlExporterTest.cs
+System.ServiceModel.Description/WsdlImporterTest.cs
+System.ServiceModel.Dispatcher/ActionFilterTest.cs
+System.ServiceModel.Dispatcher/Bug32886Test.cs
+System.ServiceModel.Dispatcher/Bug652331Test.cs
+System.ServiceModel.Dispatcher/Bug652331_2Test.cs
+System.ServiceModel.Dispatcher/ChannelDispatcherTest.cs
+System.ServiceModel.Dispatcher/DispatchOperationTest.cs
+System.ServiceModel.Dispatcher/DispatchRuntimeTest.cs
+System.ServiceModel.Dispatcher/EndpointAddressMessageFilterTest.cs
+System.ServiceModel.Dispatcher/EndpointDispatcherTest.cs
+System.ServiceModel.Dispatcher/ExceptionHandlerTest.cs
+System.ServiceModel.Dispatcher/FilterTableTest.cs
+System.ServiceModel.Dispatcher/InvalidBodyAccessExceptionTest.cs
+System.ServiceModel.Dispatcher/PrefixEndpointAddressMessageFilterTest.cs
+System.ServiceModel.Dispatcher/XPathMessageContextTest.cs
+System.ServiceModel.PeerResolvers/CustomPeerResolverServiceTest.cs
+System.ServiceModel.PeerResolvers/PeerResolverSerializationTest.cs
+System.ServiceModel.Security.Tokens/IssuedSecurityTokenParametersTest.cs
+System.ServiceModel.Security.Tokens/IssuedSecurityTokenProviderTest.cs
+System.ServiceModel.Security.Tokens/RsaSecurityTokenParametersTest.cs
+System.ServiceModel.Security.Tokens/SecureConversationSecurityTokenParametersTest.cs
+System.ServiceModel.Security.Tokens/SecurityContextSecurityTokenTest.cs
+System.ServiceModel.Security.Tokens/SecurityTokenParametersTest.cs
+System.ServiceModel.Security.Tokens/ServiceModelSecurityTokenTypesTest.cs
+System.ServiceModel.Security.Tokens/SslSecurityTokenParametersTest.cs
+System.ServiceModel.Security.Tokens/SspiSecurityTokenParametersTest.cs
+System.ServiceModel.Security.Tokens/UserNameSecurityTokenParametersTest.cs
+System.ServiceModel.Security.Tokens/WrappedKeySecurityTokenTest.cs
+System.ServiceModel.Security.Tokens/X509ListedCertificateValidator.cs
+System.ServiceModel.Security.Tokens/X509SecurityTokenParametersTest.cs
+System.ServiceModel.Security/ChannelProtectionRequirementsTest.cs
+System.ServiceModel.Security/MessagePartSpecificationTest.cs
+System.ServiceModel.Security/ScopedMessagePartSpecificationTest.cs
+System.ServiceModel.Security/SecurityAlgorithmSuiteTest.cs
+System.ServiceModel.Security/SecurityMessagePropertyTest.cs
+System.ServiceModel.Security/SecurityTokenSpeficicationTest.cs
+System.ServiceModel.Security/ServiceCredentialsSecurityTokenManagerTest.cs
+System.ServiceModel.Security/ServiceSecurityContextTest.cs
+System.ServiceModel.Security/SupportingTokenParametersTest.cs
+System.ServiceModel.Security/TransportSecurityBindingElementTest.cs
+System.ServiceModel.Security/WSSecurityTokenSerializerTest.cs
+System.ServiceModel/BasicHttpBindingTest.cs
+System.ServiceModel/CallbackBehaviorAttributeTest.cs
+System.ServiceModel/ChannelFactoryTest.cs
+System.ServiceModel/ChannelFactory_1Test.cs
+System.ServiceModel/ClientBaseTest.cs
+System.ServiceModel/ClientCredentialsSecurityTokenManagerTest.cs
+System.ServiceModel/EndpointAddress10Test.cs
+System.ServiceModel/EndpointAddressBuilderTest.cs
+System.ServiceModel/EndpointAddressTest.cs
+System.ServiceModel/EndpointIdentityTest.cs
+System.ServiceModel/IntegratedConnectionTest.cs
+System.ServiceModel/MessageSecurityVersionTest.cs
+System.ServiceModel/MsmqTransportSecurityTest.cs
+System.ServiceModel/NetMsmqBindingTest.cs
+System.ServiceModel/NetPeerTcpBindingTest.cs
+System.ServiceModel/NetTcpBindingTest.cs
+System.ServiceModel/OperationContextTest.cs
+System.ServiceModel/PeerNodeAddressTest.cs
+System.ServiceModel/ServiceHostBaseTest.cs
+System.ServiceModel/ServiceHostTest.cs
+System.ServiceModel/TransactionProtocolTest.cs
+System.ServiceModel/WSFederationHttpBindingTest.cs
+System.ServiceModel/WSHttpBindingTest.cs
diff --git a/mcs/class/System.ServiceModel/mobile_static_System.ServiceModel_test.dll.sources b/mcs/class/System.ServiceModel/mobile_static_System.ServiceModel_test.dll.sources
new file mode 100644 (file)
index 0000000..275d9f3
--- /dev/null
@@ -0,0 +1 @@
+#include  System.ServiceModel_test.dll.sources
index 2585d05360537e00514bc4969b0836d105d15b7f..6171dba1c016299be98bea6dc48695dd04e83386 100644 (file)
@@ -214,6 +214,9 @@ namespace System.Web.Services.Protocols {
                                OutputMembersMapping = soapImporter.ImportMembersMapping (ResponseName, ResponseNamespace, out_members, hasWrappingElem, writeAccessors);
                        }
 
+                       InputMembersMapping.SetKey(RequestName);
+                       OutputMembersMapping.SetKey(ResponseName);
+
                        requestSerializerId = parent.RegisterSerializer (InputMembersMapping);
                        responseSerializerId = parent.RegisterSerializer (OutputMembersMapping);
 
@@ -254,6 +257,8 @@ namespace System.Web.Services.Protocols {
                                else
                                        InputHeaderMembersMapping = soapImporter.ImportMembersMapping ("", RequestNamespace, members, false, false);
                                
+                               InputHeaderMembersMapping.SetKey(RequestName + ":InHeaders");
+                               
                                requestHeadersSerializerId = parent.RegisterSerializer (InputHeaderMembersMapping);
                        }
                        
@@ -265,7 +270,9 @@ namespace System.Web.Services.Protocols {
                                        OutputHeaderMembersMapping = xmlImporter.ImportMembersMapping ("", RequestNamespace, members, false);
                                else
                                        OutputHeaderMembersMapping = soapImporter.ImportMembersMapping ("", RequestNamespace, members, false, false);
-                               
+
+                               OutputHeaderMembersMapping.SetKey(ResponseName + ":OutHeaders");
+
                                responseHeadersSerializerId = parent.RegisterSerializer (OutputHeaderMembersMapping);
                        }
                        
index 0019e05c2788b0eb75309d07322d962e7dbfb84c..cd9dc050fe711beb2559a4254f0b7aff4425f7da 100755 (executable)
@@ -243,5 +243,44 @@ namespace MonoTests.System.Web.Services.Protocols
                                }
                        }
                }
+
+               public class RequestHeader : SoapHeader
+               {
+               }
+
+               public class ResponseHeader : SoapHeader
+               {
+               }
+
+               [WebServiceBindingAttribute(Name = "ServiceWithHeaders", Namespace = "https://example.com")]
+               public class ServiceWithHeaders : SoapHttpClientProtocol
+               {
+                       public RequestHeader RequestHeader { get; set; }
+                       public ResponseHeader ResponseHeader { get; set; }
+
+                       [SoapHeaderAttribute("ResponseHeader", Direction = SoapHeaderDirection.Out)]
+                       [SoapHeaderAttribute("RequestHeader")]
+                       [SoapDocumentMethodAttribute("", RequestNamespace = "https://example.com", ResponseNamespace = "https://example.com", Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
+                       public int method1()
+                       {
+                               return 0;
+                       }
+
+                       [SoapHeaderAttribute("ResponseHeader", Direction = SoapHeaderDirection.Out)]
+                       [SoapHeaderAttribute("RequestHeader")]
+                       [SoapDocumentMethodAttribute("", RequestNamespace = "https://example.com", ResponseNamespace = "https://example.com", Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
+                       public int method2()
+                       {
+                               return 0;
+                       }
+               }
+
+               [Test] // Covers #41564
+               public void ServiceWithHeader () {
+                       var service = new ServiceWithHeaders ();
+                       Assert.IsNotNull (service);
+                       // Should not throw an exception
+                       // XAMMAC specific bug
+               }
        }
 }
index 645326dff9af043b2ad51ed908ad5e1800851957..0dee611d6242a3c795560611d2ad058aa53915c1 100644 (file)
@@ -1,8 +1,8 @@
-System.Web.Services/Test/System.Web.Services.Configuration/DiagnosticsElementTest.cs
-System.Web.Services/Test/System.Web.Services.Configuration/ProtocolElementTest.cs
-System.Web.Services/Test/System.Web.Services.Configuration/SoapEnvelopeProcessingElementTest.cs
-System.Web.Services/Test/System.Web.Services.Configuration/SoapExtensionTypeElementTest.cs
-System.Web.Services/Test/System.Web.Services.Configuration/TypeElementTest.cs
-System.Web.Services/Test/System.Web.Services.Configuration/WsdlHelpGeneratorElementTest.cs
-System.Web.Services/Test/System.Web.Services.Configuration/WsiProfilesElementTest.cs
-System.Web.Services/Test/System.Web.Services.Configuration/XmlFormatExtensionAttributeTest.cs
+System.Web.Services.Configuration/DiagnosticsElementTest.cs
+System.Web.Services.Configuration/ProtocolElementTest.cs
+System.Web.Services.Configuration/SoapEnvelopeProcessingElementTest.cs
+System.Web.Services.Configuration/SoapExtensionTypeElementTest.cs
+System.Web.Services.Configuration/TypeElementTest.cs
+System.Web.Services.Configuration/WsdlHelpGeneratorElementTest.cs
+System.Web.Services.Configuration/WsiProfilesElementTest.cs
+System.Web.Services.Configuration/XmlFormatExtensionAttributeTest.cs
index 5f47d1326e0492f954a5b5b24f7965ac92264265..248b80f3537526f9501de642c6f69698a20bcf75 100644 (file)
@@ -1400,6 +1400,7 @@ ReferenceSources/SR.cs
 ../referencesource/System.Web/Hosting/IProcessHostSupportFunctions.cs
 ../referencesource/System.Web/Hosting/HTTP_COOKED_URL.cs
 ../referencesource/System.Web/Hosting/HostingEnvironmentException.cs
+../referencesource/System.Web/Util/Debug.cs
 ../referencesource/System.Web/Util/SynchronizationContextMode.cs
 ../referencesource/System.Web/Util/ISyncContextLock.cs
 ../referencesource/System.Web/Util/DoNotResetAttribute.cs
index 17156b8b708bdef62e4659b9f104360ce575f311..7fc177f9851e5e48925bc4e9c97038948f047abf 100644 (file)
@@ -3014,7 +3014,7 @@ namespace MonoTests.System.Windows.Forms {
                                 * Without this everytime a "y" or "yy" comes first in the format, it will always show as 
                                 * a 4-digit string if this is not done.
                                 */
-                               if (typeof (int).GetType ().GetType ().Name != "MonoType") {
+                               if (Type.GetType ("Mono.Runtime") == null) {
                                        // Only do this for MS, not implemented in Mono.
                                        dt.CustomFormat = "y";
                                        Assert.AreEqual ("2007", dt.Text, "#msbug1?");
index 9c961021fd64166dc4c5346af116c32dcfa138c9..bc03e96bbd8d59eb90d88e284d035889985bdf1e 100644 (file)
@@ -1,7 +1,8 @@
 namespace System
 {
-    static class LocalAppContextSwitches {
-       public const bool IgnoreEmptyKeySequences = false;
-       public const bool DontThrowOnInvalidSurrogatePairs = false;
-    }
+       static class LocalAppContextSwitches {
+               public static readonly bool IgnoreEmptyKeySequences = false;
+               public static readonly bool DontThrowOnInvalidSurrogatePairs = false;
+               public static readonly bool IgnoreKindInUtcTimeSerialization = false;
+       }
 }
\ No newline at end of file
index afa18715f265781ce3dc1238facf90df61113d8f..4b81d7366ff4d8136731bb4bf2c006ea23126b36 100644 (file)
@@ -1575,30 +1575,16 @@ namespace MonoTests.System.XmlSerialization
                        ser.Serialize (sw, d);
                        string str = sw.ToString ();
 
-                       str = RemoveTZ (str, "MyTime");
-                       str = RemoveTZ (str, "MyTimeNullable");
-
                        var expected =
 "<?xml version=\"1.0\" encoding=\"utf-16\"?>" + Environment.NewLine +
 "<root xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">" + Environment.NewLine +
-"  <MyTime>10:00:00.0000000$TZ$</MyTime>" + Environment.NewLine +
-"  <MyTimeNullable>10:00:00.0000000$TZ$</MyTimeNullable>" + Environment.NewLine +
+"  <MyTime>10:00:00.0000000Z</MyTime>" + Environment.NewLine +
+"  <MyTimeNullable>10:00:00.0000000Z</MyTimeNullable>" + Environment.NewLine +
 "  <MyDate>2012-01-03</MyDate>" + Environment.NewLine +
 "  <MyDateNullable>2012-01-03</MyDateNullable>" + Environment.NewLine +
 "</root>";
 
                        Assert.AreEqual (expected, str);
                }
-               
-               static string RemoveTZ (string str, string tag)
-               {
-                       var st = str.IndexOf ("<" + tag + ">");
-                       var et = str.IndexOf ("</" + tag + ">");
-                       if (st < 0 || et < 0)
-                               return str;
-
-                       var     start = str.IndexOfAny (new [] { '+', '-' }, st, et - st);
-                       return str.Substring (0, start) + "$TZ$" + str.Substring (et, str.Length - et); 
-               }
        }
 }
diff --git a/mcs/class/System.Xml.XPath.XmlDocument/Assembly/AssemblyInfo.cs b/mcs/class/System.Xml.XPath.XmlDocument/Assembly/AssemblyInfo.cs
new file mode 100644 (file)
index 0000000..a34208a
--- /dev/null
@@ -0,0 +1,62 @@
+//
+// AssemblyInfo.cs
+//
+// Author:
+//   Alexander Köplinger (alexander.koeplinger@xamarin.com)
+//
+// (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.Reflection;
+using System.Resources;
+using System.Security;
+using System.Security.Permissions;
+using System.Diagnostics;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about the assembly
+
+[assembly: AssemblyTitle ("System.Xml.XPath.XmlDocument.dll")]
+[assembly: AssemblyDescription ("System.Xml.XPath.XmlDocument.dll")]
+[assembly: AssemblyDefaultAlias ("System.Xml.XPath.XmlDocument.dll")]
+
+[assembly: AssemblyCompany (Consts.MonoCompany)]
+[assembly: AssemblyProduct (Consts.MonoProduct)]
+[assembly: AssemblyCopyright (Consts.MonoCopyright)]
+[assembly: AssemblyVersion (Consts.FxVersion)]
+[assembly: SatelliteContractVersion (Consts.FxVersion)]
+[assembly: AssemblyInformationalVersion (Consts.FxFileVersion)]
+[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
+
+[assembly: NeutralResourcesLanguage ("en-US")]
+[assembly: CLSCompliant (true)]
+[assembly: AssemblyDelaySign (true)]
+
+[assembly: AssemblyKeyFile("../msfinal.pub")]
+
+[assembly: SecurityCritical]
+
+[assembly: ComVisible (false)]
\ No newline at end of file
diff --git a/mcs/class/System.Xml.XPath.XmlDocument/Makefile b/mcs/class/System.Xml.XPath.XmlDocument/Makefile
new file mode 100644 (file)
index 0000000..504b374
--- /dev/null
@@ -0,0 +1,11 @@
+thisdir = class/System.Xml.XPath.XmlDocument
+SUBDIRS = 
+include ../../build/rules.make
+
+LIBRARY = System.Xml.XPath.XmlDocument.dll
+LIB_REFS = System System.Xml
+LIB_MCS_FLAGS =
+
+NO_TEST = yes
+
+include ../../build/library.make
diff --git a/mcs/class/System.Xml.XPath.XmlDocument/System.Xml.XPath.XmlDocument.dll.sources b/mcs/class/System.Xml.XPath.XmlDocument/System.Xml.XPath.XmlDocument.dll.sources
new file mode 100644 (file)
index 0000000..c5813ec
--- /dev/null
@@ -0,0 +1,5 @@
+../../build/common/Consts.cs
+../../build/common/Locale.cs
+../../build/common/MonoTODOAttribute.cs
+Assembly/AssemblyInfo.cs
+System.Xml/XmlDocumentXPathExtensions.cs
diff --git a/mcs/class/System.Xml.XPath.XmlDocument/System.Xml/XmlDocumentXPathExtensions.cs b/mcs/class/System.Xml.XPath.XmlDocument/System.Xml/XmlDocumentXPathExtensions.cs
new file mode 100644 (file)
index 0000000..ee4968b
--- /dev/null
@@ -0,0 +1,83 @@
+//
+// XmlDocumentXPathExtensions.cs
+//
+// Author:
+//   Alexander Köplinger (alexander.koeplinger@xamarin.com)
+//
+// (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.
+//
+
+namespace System.Xml
+{
+       public static class XmlDocumentXPathExtensions
+       {
+               [MonoTODO]
+               public static XmlNodeList SelectNodes (this XmlNode node, string xpath)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static XmlNodeList SelectNodes (this XmlNode node, string xpath, XmlNamespaceManager nsmgr)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static XmlNode SelectSingleNode (this XmlNode node, string xpath)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static XmlNode SelectSingleNode (this XmlNode node, string xpath, XmlNamespaceManager nsmgr)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static XPath.XPathNavigator CreateNavigator (this XmlNode node)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static XPath.IXPathNavigable ToXPathNavigable (this XmlNode node)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static XPath.XPathNavigator CreateNavigator (this XmlDocument document)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static XPath.XPathNavigator CreateNavigator (this XmlDocument document, XmlNode node)
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+}
index b5fb6bb927c52ea13578e019c868e4039664ec34..fe01d7e4317c78eaa7a368f31ccd41952da83cb4 100644 (file)
@@ -19,7 +19,11 @@ TEST_RESOURCES = \
        Test/System/test-uri-props-manual.txt \
        Test/System/test-uri-relative-props.txt
 
+ifndef MOBILE_PROFILE
 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
+endif
 
 TEST_MCS_FLAGS = -nowarn:618,672,219,67,169,612 \
        $(foreach f, $(TEST_RESOURCES), -resource:$(f),$(notdir $(f)))
diff --git a/mcs/class/System/Microsoft.Win32.SafeHandles/SafeX509ChainHandle.cs b/mcs/class/System/Microsoft.Win32.SafeHandles/SafeX509ChainHandle.cs
new file mode 100644 (file)
index 0000000..f3091aa
--- /dev/null
@@ -0,0 +1,62 @@
+//
+// SafeX509ChainHandle.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.
+//
+
+#if SECURITY_DEP
+
+using System;
+using System.Runtime.InteropServices;
+using System.Security;
+
+namespace Microsoft.Win32.SafeHandles
+{
+       public sealed class SafeX509ChainHandle : SafeHandle
+       {
+               [MonoTODO]
+               public override bool IsInvalid
+               {
+                       get
+                       {
+                               throw new NotImplementedException ();
+                       }
+               }
+
+               [MonoTODO]
+               internal SafeX509ChainHandle() : base ((IntPtr)0, false)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               protected override bool ReleaseHandle()
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+}
+
+#endif
index 14f7d1a586d2c3520881ab576cda88b3cb97e37b..e900c22bfeaab4f99b6b5b94728eb66d166b1a8a 100644 (file)
@@ -136,13 +136,25 @@ namespace Mono.Net.Security
                        bool result;
 
 #if MONODROID
-                       result = AndroidPlatform.TrustEvaluateSsl (certs);
-                       if (result) {
-                               // chain.Build() + GetErrorsFromChain() (above) will ALWAYS fail on
-                               // Android (there are no mozroots or preinstalled root certificates),
-                               // thus `errors` will ALWAYS have RemoteCertificateChainErrors.
-                               // Android just verified the chain; clear RemoteCertificateChainErrors.
-                               errors  &= ~SslPolicyErrors.RemoteCertificateChainErrors;
+                       try {
+                               result = AndroidPlatform.TrustEvaluateSsl (certs);
+                               if (result) {
+                                       // FIXME: check whether this is still correct.
+                                       //
+                                       // chain.Build() + GetErrorsFromChain() (above) will ALWAYS fail on
+                                       // Android (there are no mozroots or preinstalled root certificates),
+                                       // thus `errors` will ALWAYS have RemoteCertificateChainErrors.
+                                       // Android just verified the chain; clear RemoteCertificateChainErrors.
+                                       errors  &= ~SslPolicyErrors.RemoteCertificateChainErrors;
+                               } else {
+                                       errors |= SslPolicyErrors.RemoteCertificateChainErrors;
+                                       status11 = unchecked((int)0x800B010B);
+                               }
+                       } catch {
+                               result = false;
+                               errors |= SslPolicyErrors.RemoteCertificateChainErrors;
+                               status11 = unchecked((int)0x800B010B);
+                               // Ignore
                        }
 #else
                        if (is_macosx) {
diff --git a/mcs/class/System/ReferenceSources/LocalAppContextSwitches.cs b/mcs/class/System/ReferenceSources/LocalAppContextSwitches.cs
new file mode 100644 (file)
index 0000000..5df7130
--- /dev/null
@@ -0,0 +1,7 @@
+namespace System
+{
+       static class LocalAppContextSwitches
+       {
+               public static readonly bool MemberDescriptorEqualsReturnsFalseIfEquivalent = false;
+       }
+}
\ No newline at end of file
index b7c1da79538d31f7ca4f93e2ccdb0a2c22cda939..a12e395cf6ff28fb4a8e97f58ec458d067cfc628 100644 (file)
@@ -133,6 +133,7 @@ namespace System.Net.Security
                        ValidateManual = 0x08,
                        NoDefaultCred = 0x10,
                        ValidateAuto = 0x20,
+                       SendAuxRecord = 0x00200000,
                        UseStrongCrypto = 0x00400000
                }
 
index f9183a51ef75135948c47ab0e234cf338e58fb62..7a29e8f83e3241b6d242f88239a5ca806f30fa87 100644 (file)
@@ -58,7 +58,6 @@ namespace System.Diagnostics
                        InnerList.AddRange (processModules);
                }
                
-#if !NET_2_1           
                public ProcessModule this[int index] {
                        get {
                                return (ProcessModule)InnerList[index];
@@ -79,6 +78,5 @@ namespace System.Diagnostics
                {
                        return InnerList.IndexOf (module);
                }
-#endif
        }
 }
index 19cd965cd20ba055b565ad88c241cfafa3af1719..ffa9b9899dd399ce9bed25c34e97f77166edbb13 100644 (file)
@@ -69,7 +69,6 @@ namespace System.Diagnostics
                        InnerList.AddRange (processThreads);
                }
 
-#if !NET_2_1           
                public ProcessThread this[int index] {
                        get {
                                return (ProcessThread)InnerList[index];
@@ -105,6 +104,5 @@ namespace System.Diagnostics
                {
                        InnerList.Remove (thread);
                }
-#endif
        }
 }
index 5c38fccfe1c6a064c2014a0f47677537a5a1c6dd..efed94f85503853ebcb46d07f6d5655dda3ffd95 100644 (file)
@@ -35,7 +35,7 @@ using System.IO;
 using System.Runtime.InteropServices;
 using System.Runtime.Remoting.Messaging;
 
-#if MONOTOUCH
+#if MONOTOUCH || MOBILE_STATIC
 using MonoTouch;
 #endif
 
@@ -383,7 +383,7 @@ namespace System.IO.Compression
                        CheckResult (res, "WriteInternal");
                }
 
-#if MONOTOUCH
+#if MONOTOUCH || MOBILE_STATIC
                [MonoPInvokeCallback (typeof (UnmanagedReadOrWrite))]
 #endif
                static int UnmanagedRead (IntPtr buffer, int length, IntPtr data)
@@ -408,7 +408,7 @@ namespace System.IO.Compression
                        return n;
                }
 
-#if MONOTOUCH
+#if MONOTOUCH || MOBILE_STATIC
                [MonoPInvokeCallback (typeof (UnmanagedReadOrWrite))]
 #endif
                static int UnmanagedWrite (IntPtr buffer, int length, IntPtr data)
diff --git a/mcs/class/System/System.IO/FileSystemWatcher_mobile.cs b/mcs/class/System/System.IO/FileSystemWatcher_mobile.cs
new file mode 100644 (file)
index 0000000..aa13ac5
--- /dev/null
@@ -0,0 +1,55 @@
+//
+// FileSystemWatcher.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.IO
+{
+    public class FileSystemWatcher
+    {
+        public FileSystemWatcher () { throw new NotImplementedException (); }
+        public FileSystemWatcher (string path) { throw new NotImplementedException (); }
+        public FileSystemWatcher (string path, string filter) { throw new NotImplementedException (); }
+        public bool EnableRaisingEvents { get { throw new NotImplementedException (); } set { throw new NotImplementedException (); } }
+        public string Filter { get { throw new NotImplementedException (); } set { } }
+        public bool IncludeSubdirectories { get { throw new NotImplementedException (); } set { } }
+        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 event FileSystemEventHandler Changed;
+        public event FileSystemEventHandler Created;
+        public event FileSystemEventHandler Deleted;
+        public event ErrorEventHandler Error;
+        public event RenamedEventHandler Renamed;
+        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 (); }
+        protected void OnError (ErrorEventArgs e) { throw new NotImplementedException (); }
+        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 (); }
+    }
+}
\ No newline at end of file
index ff881b00bcc9a6df8a457c16e23d134a2ebcef16..ca658c23d752345e3bbd9f5e7f6fa6434ae1f7ca 100644 (file)
@@ -71,6 +71,7 @@ namespace System.Net.Mail {
                ICredentialsByHost credentials;
                string pickupDirectoryLocation;
                SmtpDeliveryMethod deliveryMethod;
+               SmtpDeliveryFormat deliveryFormat;
                bool enableSsl;
 #if SECURITY_DEP               
                X509CertificateCollection clientCertificates;
@@ -223,7 +224,15 @@ namespace System.Net.Mail {
                                port = value;
                        }
                }
-
+               
+               public SmtpDeliveryFormat DeliveryFormat {
+                       get { return deliveryFormat; }
+                       set {
+                               CheckState ();
+                               deliveryFormat = value;
+                       }
+               }
+               
                [MonoTODO]
                public ServicePoint ServicePoint {
                        get { throw new NotImplementedException (); }
index 50e9009741a2f5d028818a16e4aa7ddc0354d6a8..861d710f77cfd80fa9b535d272fa9e838f3f43b6 100644 (file)
@@ -299,7 +299,7 @@ namespace System.Net.NetworkInformation {
                        }
                }
 
-#if MONOTOUCH
+#if MONOTOUCH || MOBILE_STATIC
                [MonoTouch.MonoPInvokeCallback (typeof (SCNetworkReachabilityCallback))]
 #endif
                static void HandleCallback (IntPtr reachability, NetworkReachabilityFlags flags, IntPtr info)
index c7576897189c0e6c30b155b2380569a1867cc119..07896d201380eea623b23d5a0ecfd9365798af18 100644 (file)
@@ -1328,7 +1328,7 @@ namespace System.Net.Sockets
                        if (e.RemoteEndPoint == null)
                                throw new ArgumentNullException ("remoteEP");
 
-                       InitSocketAsyncEventArgs (e, ConnectAsyncCallback, e, SocketOperation.Connect);
+                       InitSocketAsyncEventArgs (e, null, e, SocketOperation.Connect);
 
                        try {
                                IPAddress [] addresses;
index c89f2de39a2d6a61c6e72ba6eac4e51819477a7a..d6621207cecd34e1278c86df276e0d3572bf0bc9 100644 (file)
@@ -38,12 +38,12 @@ namespace System.Net.WebSockets
                EndpointUnavailable = 1001,
                ProtocolError = 1002,
                InvalidMessageType = 1003,
-               Empty,
+               Empty = 1005,
                InvalidPayloadData = 1007,
                PolicyViolation = 1008,
-               MessageTooBig = 1004,
+               MessageTooBig = 1009,
                MandatoryExtension = 1010,
-               InternalServerError
+               InternalServerError = 1011
        }
 }
 
index 860509b9aceaa2776fb0bb105699e7a0d6fa528e..6a47f40ae2a3cf823bfda8923e86cb2a7334e2f1 100644 (file)
@@ -81,19 +81,25 @@ namespace System.Net {
                                byte [] bytes = null;
                                MemoryStream ms = GetHeaders (true);
                                bool chunked = response.SendChunked;
-                               if (ms != null) {
-                                       long start = ms.Position;
-                                       if (chunked && !trailer_sent) {
-                                               bytes = GetChunkSizeBytes (0, true);
-                                               ms.Position = ms.Length;
-                                               ms.Write (bytes, 0, bytes.Length);
+                               if (stream.CanWrite) {
+                                       try {
+                                               if (ms != null) {
+                                                       long start = ms.Position;
+                                                       if (chunked && !trailer_sent) {
+                                                               bytes = GetChunkSizeBytes (0, true);
+                                                               ms.Position = ms.Length;
+                                                               ms.Write (bytes, 0, bytes.Length);
+                                                       }
+                                                       InternalWrite (ms.GetBuffer (), (int) start, (int) (ms.Length - start));
+                                                       trailer_sent = true;
+                                               } else if (chunked && !trailer_sent) {
+                                                       bytes = GetChunkSizeBytes (0, true);
+                                                       InternalWrite (bytes, 0, bytes.Length);
+                                                       trailer_sent = true;
+                                               }
+                                       } catch (IOException ex) {
+                                               // Ignore error due to connection reset by peer
                                        }
-                                       InternalWrite (ms.GetBuffer (), (int) start, (int) (ms.Length - start));
-                                       trailer_sent = true;
-                               } else if (chunked && !trailer_sent) {
-                                       bytes = GetChunkSizeBytes (0, true);
-                                       InternalWrite (bytes, 0, bytes.Length);
-                                       trailer_sent = true;
                                }
                                response.Close ();
                        }
index 723125b1e753c867afe58eb58109b3895812ef7d..32a0148b8ea749a5796ce9d2083ca021d73f9bbf 100644 (file)
@@ -294,6 +294,10 @@ namespace System.Net
                        get { return false; }
                }
 
+               internal static bool DisableSendAuxRecord {
+                       get { return false; }
+               }
+
                // Methods
                public static void SetTcpKeepAlive (bool enabled, int keepAliveTime, int keepAliveInterval)
                {
index 28d89a6065cd04a62b2827062409bd9fe057de06..5178569f3c253e058238876545bddbc2d00b75dc 100644 (file)
@@ -896,6 +896,8 @@ namespace System.Net
                {
                        Stream s = null;
                        lock (this) {
+                               if (request.Aborted)
+                                       throw new WebException ("Request aborted", WebExceptionStatus.RequestCanceled);
                                if (Data.request != request)
                                        throw new ObjectDisposedException (typeof (NetworkStream).FullName);
                                if (nstream == null)
index ec341ea85e244436a9725551e3f4007f87ec962c..8aecd6542a6c56734efd9f48dd4c8f9bfd359d37 100644 (file)
@@ -32,8 +32,8 @@ namespace System.Security.Authentication.ExtendedProtection
 {
        public enum ChannelBindingKind
        {
-               Unknown,
-               Unique,
-               Endpoint
+               Unknown = 0,
+               Unique = 25,
+               Endpoint = 26
        }
 }
index 4ff3508c5c29ba9310c481ada3d4f8459b2b1f06..542fa6411e00257d52b64b0955275be86b3aa4b3 100644 (file)
@@ -26,6 +26,8 @@ Microsoft.Win32/UserPreferenceChangedEventArgs.cs
 Microsoft.Win32/UserPreferenceChangedEventHandler.cs
 Microsoft.Win32/UserPreferenceChangingEventArgs.cs
 Microsoft.Win32/UserPreferenceChangingEventHandler.cs
+Microsoft.Win32.SafeHandles/SafeX509ChainHandle.cs
+
 Mono.Http/NtlmClient.cs
 System.CodeDom.Compiler/CodeCompiler.cs
 System.CodeDom.Compiler/CodeDomConfigurationHandler.cs
@@ -560,6 +562,7 @@ ReferenceSources/EnvironmentHelpers.cs
 ReferenceSources/Internal.cs
 ReferenceSources/HttpApi.cs
 ReferenceSources/HttpSysSettings.cs
+ReferenceSources/LocalAppContextSwitches.cs
 ReferenceSources/Logging.cs
 ReferenceSources/NativeMethods.cs
 ReferenceSources/RequestCacheProtocol.cs
index 668e863b5cc055feed1a132c8bc42e8fb00e586f..b747e0dd0164e0fc6e98da731bc02b49911c94ef 100644 (file)
@@ -108,7 +108,7 @@ namespace MonoTests.System.Diagnostics
                        Assert.IsNull (fvi.SpecialBuild, "#27");
                }
 
-#if !MONOTOUCH
+#if !MONOTOUCH && !MOBILE_STATIC
                [Test]
                public void GetVersionInfo_NoNativeResources ()
                {
index 75c4614ad2a433dbcdf00f7704d8e6dfba225fff..277604287550fde13168d44d19ec29833961db90 100644 (file)
@@ -1084,6 +1084,27 @@ namespace MonoTests.System.Diagnostics
                                Assert.Fail ();
                        }
                }
+
+               [Test]
+               [NUnit.Framework.Category ("MobileNotWorking")]
+               public void TestExitedRaisedTooSoon ()
+               {
+                       if (!RunningOnUnix)
+                               Assert.Ignore ("using sleep command, only available on unix");
+
+                       int sleeptime = 5;
+
+                       using (Process p = Process.Start("sleep", sleeptime.ToString ())) {
+                               ManualResetEvent mre = new ManualResetEvent (false);
+
+                               p.EnableRaisingEvents = true;
+                               p.Exited += (sender, e) => {
+                                       mre.Set ();
+                               };
+
+                               Assert.IsFalse (mre.WaitOne ((sleeptime - 2) * 1000), "Exited triggered before the process returned");
+                       }
+               }
 #endif // MONO_FEATURE_PROCESS_START
        }
 }
index 8fa752a4476c8981af260df18a15091fbe5bef54..909beb4988c8873dc7a6cd85d2b383443f1b290a 100644 (file)
@@ -16,6 +16,7 @@ using System.Threading;
 namespace MonoTests.System.Net.Mail
 {
        [TestFixture]
+       [Category ("RequiresBSDSockets")]
        public class SmtpClientTest
        {
                SmtpClient smtp;
index 68118776fbefcff773d1c199d356a57b86f6c5b1..e5c70feab2c16b07d69d2a241697eea1f0d06220 100644 (file)
@@ -45,6 +45,7 @@ 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 };
index 9c3765e2d5b7ea95c8a4902f26075af16f0e5c76..e51f2d9b7d526e14185622f3337904180ebd89a9 100644 (file)
@@ -16,6 +16,7 @@ using NUnit.Framework;
 namespace MonoTests.System.Net.Sockets
 {
        [TestFixture]
+       [Category ("RequiresBSDSockets")]
        public class NetworkStreamTest
        {
                [Test]
index 3815b623c39f53085f8670e788952f2ffcf89077..28bc6bb81745f29059c186633126c3addaabfa9a 100644 (file)
@@ -6,6 +6,7 @@ using NUnit.Framework;
 namespace MonoTests.System.Net.Sockets
 {
        [TestFixture]
+       [Category ("RequiresBSDSockets")]
        public class SocketAcceptAsyncTest
        {
                [Test]
index d59d39fad89d232798a341ce06bdd238b3da044f..d286668707e437635c1bc4e3920b45b4d2fa7072 100644 (file)
@@ -8,6 +8,7 @@ using NUnit.Framework;
 namespace MonoTests.System.Net.Sockets
 {
        [TestFixture]
+       [Category ("RequiresBSDSockets")]
        public class SocketAsyncTest
        {
                Socket serverSocket;
index 2b12d7019bffad7b8ebc05bd816b8e773a684871..9551c1e6027131d4217bd59a13d986438873d5e2 100755 (executable)
@@ -15,6 +15,7 @@ using System.Collections;
 using System.Threading;
 using System.Reflection;
 using System.Text.RegularExpressions;
+using System.Threading.Tasks;
 using System.Net;
 using System.Net.Sockets;
 using NUnit.Framework;
@@ -27,6 +28,7 @@ using MonoTests.Helpers;
 namespace MonoTests.System.Net.Sockets
 {
        [TestFixture]
+       [Category ("RequiresBSDSockets")]
        public class SocketTest
        {
                // note: also used in SocketCas tests
@@ -4345,6 +4347,23 @@ namespace MonoTests.System.Net.Sockets
                                socket.SetSocketOption (SocketOptionLevel.IP, SocketOptionName.MulticastTimeToLive, 19);
                        }
                }
+
+               [Test] // Covers 41616
+               public void ConnectAsyncUnhandledEx ()
+               {
+                       var mre = new ManualResetEvent (false);
+
+                       var endPoint = new IPEndPoint(0,0);
+                       var socket = new Socket(endPoint.AddressFamily, SocketType.Stream, ProtocolType.Unspecified);
+
+                       var socketArgs = new SocketAsyncEventArgs();
+                       socketArgs.RemoteEndPoint = endPoint;
+                       socketArgs.Completed += (sender, e) => mre.Set ();
+
+                       socket.ConnectAsync (socketArgs);
+
+                       Assert.IsTrue (mre.WaitOne (1000), "ConnectedAsync timeout");
+               }
        }
 }
 
index 91b461487eb0cc38526671ac56a1ca34797fc8fa..4d3b8325048d9038ebfcaf8210960ebc71562f1a 100644 (file)
@@ -21,6 +21,7 @@ namespace MonoTests.System.Net.Sockets
        /// Tests System.Net.Sockets.TcpClient
        /// </summary>
        [TestFixture]
+       [Category ("RequiresBSDSockets")]
        public class TcpClientTest
        {
                
index b8594b8f11e7e489de6a1834bcb4dda1c1d7f655..1e211cf524920b999f0f090353814030a6dff829 100644 (file)
@@ -20,6 +20,7 @@ using MonoTests.Helpers;
 namespace MonoTests.System.Net.Sockets
 {
        [TestFixture]
+       [Category ("RequiresBSDSockets")]
        public class TcpListenerTest
        {
                [Test]
index b7a537f662be204c61ffb1f6b1c9b6e0911d06cf..66b15308d1f84cb08efaae91d0bbe5b8e3acc62d 100644 (file)
@@ -15,6 +15,7 @@ using NUnit.Framework;
 
 namespace MonoTests.System.Net.Sockets {
        [TestFixture]
+       [Category ("RequiresBSDSockets")]
        public class UdpClientTest {
                [Test] // .ctor ()
                public void Constructor1 ()
index da02abdd54747221770c7dc9692e6bf794a03c1c..37c40d7445e070cd8d5021dc238253b6bdac5db5 100644 (file)
@@ -9,6 +9,7 @@ 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";
index a1b5f51cdd2ec37df3ae8037cfc242a9986c4ecb..dcc82f61678777cc202e1b94417d4b7a82c0d114 100644 (file)
@@ -19,6 +19,7 @@ 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
@@ -55,7 +56,7 @@ namespace MonoTests.System.Net
 \r
                        IAsyncResult async = Dns.BeginResolve (site1Dot, null, null);\r
                        IPHostEntry entry = Dns.EndResolve (async);\r
-                       SubTestValidIPHostEntry (entry);
+                       SubTestValidIPHostEntry (entry);\r
                        var ip = GetIPv4Address (entry);\r
                        Assert.AreEqual (site1Dot, ip.ToString ());\r
                }\r
@@ -306,7 +307,7 @@ namespace MonoTests.System.Net
                {\r
                        IPAddress addr = new IPAddress (IPAddress.NetworkToHostOrder ((int) site2IP));\r
                        IPHostEntry h = Dns.GetHostByAddress (addr);\r
-                       SubTestValidIPHostEntry (h);
+                       SubTestValidIPHostEntry (h);\r
                        var ip = GetIPv4Address (h);\r
                        Assert.AreEqual (addr.ToString (), ip.ToString ());\r
                }\r
index 6793d2a48fdeffefa3c47d532c664f915bcc4330..5f4166eecf855549bfd4ea8a51d9ffa556b14cb1 100644 (file)
@@ -25,6 +25,7 @@ using NUnit.Framework;
 namespace MonoTests.System.Net
 {
        [TestFixture]
+       [Category ("RequiresBSDSockets")]
        public class FileWebRequestTest
        {
                private string _tempDirectory;
index e740e1c67a5370f5aaf0caa2358c611a641f6336..93697cd29294145f8c1466224e44eacb5b210667 100644 (file)
@@ -19,6 +19,7 @@ using System.Threading;
 namespace MonoTests.System.Net 
 {
        [TestFixture]
+       [Category ("RequiresBSDSockets")]
        public class FtpWebRequestTest
        {
                FtpWebRequest defaultRequest;
index 3afff1226ae85d5d8207c551ca5a2dac459f6cec..b0cedc555a4e8b34674790e2d6744c1a0e269b53 100644 (file)
@@ -47,6 +47,7 @@ using MonoTests.Helpers;
 namespace MonoTests.System.Net {
        
        [TestFixture]
+       [Category ("RequiresBSDSockets")]
        public class HttpListener2Test {
                
                private HttpListener _listener = null;
@@ -645,6 +646,7 @@ namespace MonoTests.System.Net {
        }
 
        [TestFixture]
+       [Category ("RequiresBSDSockets")]
        public class HttpListenerBugs {
                [Test]
                public void TestNonChunkedAsync ()
index 873481cbc5a44440c3343e13da21031d611f20bf..21589dc6c30914ebe227c22b04a99143a720457e 100644 (file)
@@ -57,6 +57,7 @@ namespace MonoTests.System.Net {
                }
 
                [Test]
+               [Category ("RequiresBSDSockets")]
                public void AddOne ()
                {
                        HttpListener listener = new HttpListener ();
@@ -70,6 +71,7 @@ namespace MonoTests.System.Net {
                }
 
                [Test]
+               [Category ("RequiresBSDSockets")]
                public void Duplicate ()
                {
                        HttpListener listener = new HttpListener ();
index 6ff1b33260ed2ab7e82883d4f600a12e89136888..c9227fd5b39dc09c6ce53f618c084c05d56b6b7f 100644 (file)
@@ -42,6 +42,7 @@ using MonoTests.Helpers;
 namespace MonoTests.System.Net
 {
        [TestFixture]
+       [Category ("RequiresBSDSockets")]
        public class HttpListenerRequestTest
        {
                [Test]
index f2ae436d29f8c9d2672b46f54cf960c1be3f893f..8620d1ce32a9b34bd6b98f40ea9ac0805791250a 100644 (file)
@@ -37,6 +37,7 @@ using MonoTests.Helpers;
 
 namespace MonoTests.System.Net {
        [TestFixture]
+       [Category ("RequiresBSDSockets")]
        public class HttpListenerTest {
 
                int port;
index ee6c82895e3e7ae5914ca2ffb463a39cc7fdb9d8..b7097b5db56a7e930149f96f641b3df8997559a1 100644 (file)
@@ -36,6 +36,7 @@ using MonoTests.Helpers;
 namespace MonoTests.System.Net
 {
        [TestFixture]
+       [Category ("RequiresBSDSockets")]
        public class HttpWebRequestTest
        {
                private Random rand = new Random ();
@@ -2762,6 +2763,7 @@ namespace MonoTests.System.Net
        }
 
        [TestFixture]
+       [Category ("RequiresBSDSockets")]
        public class HttpRequestStreamTest
        {
                [Test]
index 580c548890771190f6d5c2ef14e440e8b44fd53a..10d7d807444ce7527e56c73b601788be68f08664 100644 (file)
@@ -21,6 +21,7 @@ using NUnit.Framework;
 namespace MonoTests.System.Net
 {
        [TestFixture]
+       [Category ("RequiresBSDSockets")]
        public class HttpWebResponseTest
        {
                [Test]
@@ -476,6 +477,7 @@ namespace MonoTests.System.Net
        }
 
        [TestFixture]
+       [Category ("RequiresBSDSockets")]
        public class HttpResponseStreamTest
        {
                [Test]
index b671e9e92358dec824ecbdf2a6f615640cfd056e..9eb5877052ea3430303a703c1219ad5f73f81d1e 100644 (file)
@@ -21,6 +21,7 @@ using MonoTests.Helpers;
 namespace MonoTests.System.Net
 {
        [TestFixture]
+       [Category ("RequiresBSDSockets")]
        public class WebClientTest
        {
                private string _tempFolder;
index 908dadb35c2cac90143898e69a39dc5440019d7b..34ce1a370a1d4ed737bfe721ce2d4e03104c27b0 100644 (file)
 //\r
 \r
 using NUnit.Framework;\r
+using MonoTests.Helpers;
 using System;\r
 using System.Net;\r
+using System.Threading;
 using System.Collections;\r
 using System.Runtime.Serialization;\r
 using Socks = System.Net.Sockets;\r
@@ -410,6 +412,53 @@ 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
 \r
 }\r
index 3dd8cf239af06c93b0219b6d7aacabf5b0cef022..94f3552b6f577fb0e216b02bc67a1175e85d8e7e 100644 (file)
@@ -303,7 +303,7 @@ namespace MonoTests.System.Timers
                        };
                        timer.Start ();
 
-                       Assert.IsTrue (mre.Wait (500), "#1 re-enabling timer in Elapsed didn't work");
+                       Assert.IsTrue (mre.Wait (1000), "#1 re-enabling timer in Elapsed didn't work");
                        Assert.AreEqual (2, elapsedCount, "#2 wrong elapsedCount");
                        timer.Stop ();
                }
@@ -323,7 +323,7 @@ namespace MonoTests.System.Timers
                        };
                        timer.Start ();
 
-                       Assert.IsFalse (mre.Wait (500), "#1 AutoResetEvent=false didn't stop firing Elapsed, elapsedCount=" + elapsedCount);
+                       Assert.IsFalse (mre.Wait (1000), "#1 AutoReset=false didn't stop firing Elapsed, elapsedCount=" + elapsedCount);
                        Assert.AreEqual (1, elapsedCount, "#2 wrong elapsedCount");
                        timer.Stop ();
                }
index 9f5b848af0cb21d9e4af05662fceaa4c10b85a08..32c3fb0459e10829d7a0b9419f3eb99dfc72cd72 100644 (file)
@@ -2072,5 +2072,12 @@ namespace MonoTests.System
                        Uri uri;
                        Assert.IsTrue (Uri.TryCreate (value, UriKind.Absolute, out uri));
                }
+
+               [Test]
+               public void UncValidPath ()
+               {
+                       var uri = new Uri ("https://_foo/bar.html");
+                       Assert.AreEqual ("https", uri.Scheme);
+               }
        }
 }
index 821cf273ff89dc941b1c065ca58d2e85863c8b90..d0a70bbb58b45e7dbf72d0706ee46539597034e1 100644 (file)
@@ -28,6 +28,16 @@ System.IO.Compression/DeflateStream.cs
 System.IO.Compression/GZipStream.cs
 System.IO/InternalBufferOverflowException.cs
 System.IO/InvalidDataException.cs
+System.IO/ErrorEventArgs.cs
+System.IO/ErrorEventHandler.cs
+System.IO/FileSystemEventArgs.cs
+System.IO/FileSystemEventHandler.cs
+System.IO/FileSystemWatcher_mobile.cs
+System.IO/NotifyFilters.cs
+System.IO/RenamedEventArgs.cs
+System.IO/RenamedEventHandler.cs
+System.IO/WaitForChangedResult.cs
+System.IO/WatcherChangeTypes.cs
 System.Net.Mail/AlternateView.cs
 System.Net.Mail/AlternateViewCollection.cs
 System.Net.Mail/Attachment.cs
@@ -272,6 +282,7 @@ System/Platform.cs
 System/SRDescriptionAttribute.cs
 System/UriTypeConverter.cs
 System.Windows.Input/ICommand.cs
+Microsoft.Win32.SafeHandles/SafeX509ChainHandle.cs
 
 Mono.Net.Security/CallbackHelpers.cs
 Mono.Net.Security/ChainValidationHelper.cs
@@ -294,6 +305,7 @@ ReferenceSources/CAPI.cs
 ReferenceSources/EnvironmentHelpers.cs
 ReferenceSources/HttpApi.cs
 ReferenceSources/Internal.cs
+ReferenceSources/LocalAppContextSwitches.cs
 ReferenceSources/HttpSysSettings.cs
 ReferenceSources/Logging.cs
 ReferenceSources/NativeMethods.cs
@@ -927,3 +939,15 @@ ReferenceSources/Win32Exception.cs
 ../Mono.Security/Mono.Security.Interface/TlsException.cs
 ../Mono.Security/Mono.Security.Interface/TlsProtocolCode.cs
 ../Mono.Security/Mono.Security.Interface/TlsProtocols.cs
+
+System.Runtime.InteropServices.ComTypes/ADVF.cs
+System.Runtime.InteropServices.ComTypes/DATADIR.cs
+System.Runtime.InteropServices.ComTypes/DVASPECT.cs
+System.Runtime.InteropServices.ComTypes/FORMATETC.cs
+System.Runtime.InteropServices.ComTypes/IAdviseSink.cs
+System.Runtime.InteropServices.ComTypes/IDataObject.cs
+System.Runtime.InteropServices.ComTypes/IEnumFORMATETC.cs
+System.Runtime.InteropServices.ComTypes/IEnumSTATDATA.cs
+System.Runtime.InteropServices.ComTypes/STATDATA.cs
+System.Runtime.InteropServices.ComTypes/STGMEDIUM.cs
+System.Runtime.InteropServices.ComTypes/TYMED.cs
index 8f84347cde9dadf77cd0211d0cabe72fc6b270c7..9a453e68f8c3e381bf02e8fb4d8fcccead7dd30c 100644 (file)
@@ -1,3 +1,6 @@
+
+Microsoft.CSharp/CSharpCodeProviderCas.cs
+Microsoft.CSharp/CSharpCodeProviderTest.cs
 Microsoft.CSharp/CodeGeneratorFromCompileUnitTest.cs
 Microsoft.CSharp/CodeGeneratorFromExpressionTest.cs
 Microsoft.CSharp/CodeGeneratorFromNamespaceTest.cs
@@ -6,8 +9,6 @@ Microsoft.CSharp/CodeGeneratorFromTypeTest.cs
 Microsoft.CSharp/CodeGeneratorIdentifierTest.cs
 Microsoft.CSharp/CodeGeneratorTestBase.cs
 Microsoft.CSharp/CodeGeneratorTypeOutputTest.cs
-Microsoft.CSharp/CSharpCodeProviderCas.cs
-Microsoft.CSharp/CSharpCodeProviderTest.cs
 Microsoft.VisualBasic/CodeGeneratorFromBinaryOperatorTest.cs
 Microsoft.VisualBasic/CodeGeneratorFromCompileUnitTest.cs
 Microsoft.VisualBasic/CodeGeneratorFromExpressionTest.cs
@@ -17,6 +18,40 @@ Microsoft.VisualBasic/CodeGeneratorFromTypeTest.cs
 Microsoft.VisualBasic/CodeGeneratorTestBase.cs
 Microsoft.VisualBasic/VBCodeProviderCas.cs
 Microsoft.VisualBasic/VBCodeProviderTest.cs
+Microsoft.Win32/IntranetZoneCredentialPolicyCas.cs
+Microsoft.Win32/IntranetZoneCredentialPolicyTest.cs
+Microsoft.Win32/PowerModeChangedEventArgsCas.cs
+Microsoft.Win32/SessionEndedEventArgsCas.cs
+Microsoft.Win32/SessionEndingEventArgsCas.cs
+Microsoft.Win32/SessionSwitchEventArgsCas.cs
+Microsoft.Win32/SessionSwitchEventArgsTest.cs
+Microsoft.Win32/SystemEventsCas.cs
+Microsoft.Win32/TimerElapsedEventArgsCas.cs
+Microsoft.Win32/UserPreferenceChangedEventArgsCas.cs
+Microsoft.Win32/UserPreferenceChangingEventArgsCas.cs
+System.CodeDom.Compiler/CodeCompilerCas.cs
+System.CodeDom.Compiler/CodeDomProviderCas.cs
+System.CodeDom.Compiler/CodeGeneratorCas.cs
+System.CodeDom.Compiler/CodeGeneratorFromTypeTestBase.cs
+System.CodeDom.Compiler/CodeGeneratorGenerateFromCompileUnitTest.cs
+System.CodeDom.Compiler/CodeGeneratorOptionsCas.cs
+System.CodeDom.Compiler/CodeGeneratorOptionsTest.cs
+System.CodeDom.Compiler/CodeGeneratorTest.cs
+System.CodeDom.Compiler/CodeGeneratorTestBase.cs
+System.CodeDom.Compiler/CodeParserCas.cs
+System.CodeDom.Compiler/CompilerErrorCas.cs
+System.CodeDom.Compiler/CompilerErrorCollectionCas.cs
+System.CodeDom.Compiler/CompilerInfoCas.cs
+System.CodeDom.Compiler/CompilerParametersCas.cs
+System.CodeDom.Compiler/CompilerResultsCas.cs
+System.CodeDom.Compiler/ExecutorCas.cs
+System.CodeDom.Compiler/ExecutorTest.cs
+System.CodeDom.Compiler/GeneratedCodeAttributeCas.cs
+System.CodeDom.Compiler/GeneratedCodeAttributeTest.cs
+System.CodeDom.Compiler/IndentedTextWriterCas.cs
+System.CodeDom.Compiler/IndentedTextWriterTest.cs
+System.CodeDom.Compiler/TempFileCollectionCas.cs
+System.CodeDom.Compiler/TempFileCollectionTest.cs
 System.CodeDom/CodeArgumentReferenceExpressionCas.cs
 System.CodeDom/CodeArgumentReferenceExpressionTest.cs
 System.CodeDom/CodeArrayCreateExpressionCas.cs
@@ -148,32 +183,11 @@ System.CodeDom/CodeVariableDeclarationStatementCas.cs
 System.CodeDom/CodeVariableDeclarationStatementTest.cs
 System.CodeDom/CodeVariableReferenceExpressionCas.cs
 System.CodeDom/CodeVariableReferenceExpressionTest.cs
-System.CodeDom.Compiler/CodeCompilerCas.cs
-System.CodeDom.Compiler/CodeDomProviderCas.cs
-System.CodeDom.Compiler/CodeGeneratorCas.cs
-System.CodeDom.Compiler/CodeGeneratorFromTypeTestBase.cs
-System.CodeDom.Compiler/CodeGeneratorGenerateFromCompileUnitTest.cs
-System.CodeDom.Compiler/CodeGeneratorOptionsCas.cs
-System.CodeDom.Compiler/CodeGeneratorOptionsTest.cs
-System.CodeDom.Compiler/CodeGeneratorTest.cs
-System.CodeDom.Compiler/CodeGeneratorTestBase.cs
-System.CodeDom.Compiler/CodeParserCas.cs
-System.CodeDom.Compiler/CompilerErrorCas.cs
-System.CodeDom.Compiler/CompilerErrorCollectionCas.cs
-System.CodeDom.Compiler/CompilerInfoCas.cs
-System.CodeDom.Compiler/CompilerParametersCas.cs
-System.CodeDom.Compiler/CompilerResultsCas.cs
-System.CodeDom.Compiler/ExecutorCas.cs
-System.CodeDom.Compiler/ExecutorTest.cs
-System.CodeDom.Compiler/GeneratedCodeAttributeCas.cs
-System.CodeDom.Compiler/GeneratedCodeAttributeTest.cs
-System.CodeDom.Compiler/IndentedTextWriterCas.cs
-System.CodeDom.Compiler/IndentedTextWriterTest.cs
-System.CodeDom.Compiler/TempFileCollectionCas.cs
-System.CodeDom.Compiler/TempFileCollectionTest.cs
+System.Configuration.Provider
+System.Configuration.Provider/ProviderBaseTest.cs
 System.Configuration/ApplicationSettingsBaseTest.cs
-System.Configuration/ConfigurationExceptionTest.cs
 System.Configuration/ConfigXmlDocumentTest.cs
+System.Configuration/ConfigurationExceptionTest.cs
 System.Configuration/LocalFileSettingsProviderTest.cs
 System.Configuration/SettingElementTest.cs
 System.Configuration/SettingsBaseTest.cs
@@ -181,9 +195,15 @@ System.Configuration/SettingsPropertyCollectionTest.cs
 System.Configuration/SettingsPropertyTest.cs
 System.Configuration/SettingsPropertyValueCollectionTest.cs
 System.Configuration/SettingsPropertyValueTest.cs
-System.Configuration.Provider
-System.Configuration.Provider/ProviderBaseTest.cs
 System.IO.Ports/SerialPortTest.cs
+System.Security.Permissions/ResourcePermissionBaseCas.cs
+System.Security.Permissions/ResourcePermissionBaseEntryCas.cs
+System.Security.Permissions/ResourcePermissionBaseEntryTest.cs
+System.Security.Permissions/ResourcePermissionBaseTest.cs
+System.Security.Permissions/StorePermissionAttributeCas.cs
+System.Security.Permissions/StorePermissionAttributeTest.cs
+System.Security.Permissions/StorePermissionCas.cs
+System.Security.Permissions/StorePermissionTest.cs
 System.Web/AspNetHostingPermissionAttributeCas.cs
 System.Web/AspNetHostingPermissionAttributeTest.cs
 System.Web/AspNetHostingPermissionCas.cs
index 778ccf34afc34668fe8feb487db0e33da659fc74..343e818ace85c71ec45c8bb4126d5a96222bc71d 100644 (file)
@@ -29,8 +29,6 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if !NET_2_1
-
 using System;
 using System.Runtime.InteropServices;
 
@@ -137,5 +135,3 @@ namespace Microsoft.Win32
        }
 }
 
-#endif // NET_2_1
-
index aa5e9d99276de0264ee927a2aa964fc146d85b92..922e78009efdc4da3e5d5ea0e6d6232bac3dbe5e 100644 (file)
@@ -27,8 +27,6 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if !NET_2_1
-
 using System;
 using System.Runtime.InteropServices;
 
@@ -51,5 +49,3 @@ namespace Microsoft.Win32
 
 }
 
-#endif // NET_2_1
-
index 623efdf77bb6b309704afbe6c72bfbe7b91df5b1..a0f30146c82b61f35df9fa048c0f5f31cfadf689 100644 (file)
@@ -29,8 +29,6 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if !NET_2_1
-
 using System;
 using System.IO;
 using System.Collections;
@@ -44,6 +42,50 @@ using Microsoft.Win32.SafeHandles;
 
 namespace Microsoft.Win32
 {
+
+#if MOBILE
+       public sealed class RegistryKey : IDisposable
+       {
+               internal RegistryKey (RegistryHive hiveId)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public void Dispose ()
+               {
+               }
+
+               public RegistryKey CreateSubKey (string subkey)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public object GetValue (string name, object defaultValue)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public static object GetValue (string keyName, string valueName, object defaultValue)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public RegistryKey OpenSubKey (string name, bool writable)
+               {
+                       throw new PlatformNotSupportedException ();
+               }
+
+               public void SetValue (string name, object value)
+               {
+               }
+
+               public void SetValue (string name, object value, RegistryValueKind valueKind)
+               {
+               }
+
+               // TODO: Finish full contract API
+       }
+#else
        /// <summary>
        ///     Wrapper class for Windows Registry Entry.
        /// </summary>
@@ -693,7 +735,6 @@ namespace Microsoft.Win32
                }
 
        }
+#endif
 }
 
-#endif // NET_2_1
-
index 38f5c23026eb8f89d7d01d5c13e499727ed6ed07..8db4a861b56761f0163f81df7042064bbc332218 100644 (file)
@@ -25,8 +25,6 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if !NET_2_1
-
 using System.Runtime.InteropServices;
 
 namespace Microsoft.Win32
@@ -44,5 +42,3 @@ namespace Microsoft.Win32
        }
 }
 
-#endif // NET_2_1
-
index 98d4f3ec325c9a08d042822a4733fe6a369820d8..54f16378f3072e43e1510b0b5ad358fd74ba7f80 100644 (file)
@@ -26,8 +26,6 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if !NET_2_1
-
 using System;
 
 namespace Microsoft.Win32
@@ -39,5 +37,3 @@ namespace Microsoft.Win32
        }
 }
 
-#endif // NET_2_1
-
diff --git a/mcs/class/corlib/Mono/RuntimeHandles.cs b/mcs/class/corlib/Mono/RuntimeHandles.cs
new file mode 100644 (file)
index 0000000..68db33f
--- /dev/null
@@ -0,0 +1,274 @@
+//
+// Wrapper handles for Mono Runtime internal structs
+//
+// Authors:
+//   Aleksey Kliger <aleksey@xamarin.com>
+//   Rodrigo Kumpera <kumpera@xamarin.com>
+//
+// Copyright 2016 Dot net foundation.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+//
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+namespace Mono {
+
+       internal struct RuntimeClassHandle {
+               unsafe RuntimeStructs.MonoClass* value;
+
+               internal unsafe RuntimeClassHandle (RuntimeStructs.MonoClass* value) {
+                       this.value = value;
+               }
+
+               internal unsafe RuntimeClassHandle (IntPtr ptr) {
+                       this.value = (RuntimeStructs.MonoClass*) ptr;
+               }
+
+               internal unsafe RuntimeStructs.MonoClass* Value {
+                       get { return value; }
+               }
+
+               public override bool Equals (object obj)
+               {
+                       if (obj == null || GetType () != obj.GetType ())
+                               return false;
+
+                       unsafe { return value == ((RuntimeClassHandle)obj).Value; }
+               }
+
+               public override int GetHashCode ()
+               {
+                       unsafe { return ((IntPtr)value).GetHashCode (); }
+               }
+
+               public bool Equals (RuntimeClassHandle handle)
+               {
+                       unsafe { return value == handle.Value; }
+               }
+
+               public static bool operator == (RuntimeClassHandle left, Object right)
+               {
+                       return (right != null) && (right is RuntimeClassHandle) && left.Equals ((RuntimeClassHandle)right);
+               }
+
+               public static bool operator != (RuntimeClassHandle left, Object right)
+               {
+                       return (right == null) || !(right is RuntimeClassHandle) || !left.Equals ((RuntimeClassHandle)right);
+               }
+
+               public static bool operator == (Object left, RuntimeClassHandle right)
+               {
+                       return (left != null) && (left is RuntimeClassHandle) && ((RuntimeClassHandle)left).Equals (right);
+               }
+
+               public static bool operator != (Object left, RuntimeClassHandle right)
+               {
+                       return (left == null) || !(left is RuntimeClassHandle) || !((RuntimeClassHandle)left).Equals (right);
+               }
+
+               [MethodImpl(MethodImplOptions.InternalCall)]
+               internal unsafe extern static IntPtr GetTypeFromClass (RuntimeStructs.MonoClass *klass);
+
+               internal RuntimeTypeHandle GetTypeHandle ()
+               {
+                       unsafe { return new RuntimeTypeHandle (GetTypeFromClass (value)); }
+               }
+       }
+
+       internal struct RuntimeRemoteClassHandle {
+               unsafe RuntimeStructs.RemoteClass* value;
+
+               internal unsafe RuntimeRemoteClassHandle (RuntimeStructs.RemoteClass* value)
+               {
+                       this.value = value;
+               }
+
+               internal RuntimeClassHandle ProxyClass {
+                       get {
+                               unsafe {
+                                       return new RuntimeClassHandle (value->proxy_class);
+                               }
+                       }
+               }
+       }
+
+       internal struct RuntimeGenericParamInfoHandle {
+               unsafe RuntimeStructs.GenericParamInfo* value;
+
+               internal unsafe RuntimeGenericParamInfoHandle (RuntimeStructs.GenericParamInfo* value)
+               {
+                       this.value = value;
+               }
+
+               internal unsafe RuntimeGenericParamInfoHandle (IntPtr ptr)
+               {
+                       this.value = (RuntimeStructs.GenericParamInfo*) ptr;
+               }
+
+
+               internal Type[] Constraints { get { return GetConstraints (); } }
+
+               internal GenericParameterAttributes Attributes {
+                       get {
+                               unsafe {
+                                       return (GenericParameterAttributes) value->flags;
+                               }
+                       }
+               }
+
+               Type[] GetConstraints () {
+                       int n = GetConstraintsCount ();
+                       var a = new Type[n];
+                       for (int i = 0; i < n; i++) {
+                               unsafe {
+                                       RuntimeClassHandle c = new RuntimeClassHandle (value->constraints[i]);
+                                       a[i] = Type.GetTypeFromHandle (c.GetTypeHandle ());
+                               }
+                       }
+                       return a;
+               }
+
+               int GetConstraintsCount () {
+                       int i = 0;
+                       unsafe {
+                               RuntimeStructs.MonoClass** p = value->constraints;
+                               while (p != null && *p != null)  {
+                                       p++; i++;
+                               }
+                       }
+                       return i;
+               }
+       }
+
+       internal struct RuntimeEventHandle {
+               IntPtr value;
+
+               internal RuntimeEventHandle (IntPtr v)
+               {
+                       value = v;
+               }
+
+               public IntPtr Value {
+                       get {
+                               return value;
+                       }
+               }
+
+               public override bool Equals (object obj)
+               {
+                       if (obj == null || GetType () != obj.GetType ())
+                               return false;
+
+                       return value == ((RuntimeEventHandle)obj).Value;
+               }
+
+               public bool Equals (RuntimeEventHandle handle)
+               {
+                       return value == handle.Value;
+               }
+
+               public override int GetHashCode ()
+               {
+                       return value.GetHashCode ();
+               }
+
+               public static bool operator == (RuntimeEventHandle left, RuntimeEventHandle right)
+               {
+                       return left.Equals (right);
+               }
+
+               public static bool operator != (RuntimeEventHandle left, RuntimeEventHandle right)
+               {
+                       return !left.Equals (right);
+               }
+       }
+
+       internal struct RuntimePropertyHandle {
+               IntPtr value;
+
+               internal RuntimePropertyHandle (IntPtr v)
+               {
+                       value = v;
+               }
+
+               public IntPtr Value {
+                       get {
+                               return value;
+                       }
+               }
+
+               public override bool Equals (object obj)
+               {
+                       if (obj == null || GetType () != obj.GetType ())
+                               return false;
+
+                       return value == ((RuntimePropertyHandle)obj).Value;
+               }
+
+               public bool Equals (RuntimePropertyHandle handle)
+               {
+                       return value == handle.Value;
+               }
+
+               public override int GetHashCode ()
+               {
+                       return value.GetHashCode ();
+               }
+
+               public static bool operator == (RuntimePropertyHandle left, RuntimePropertyHandle right)
+               {
+                       return left.Equals (right);
+               }
+
+               public static bool operator != (RuntimePropertyHandle left, RuntimePropertyHandle right)
+               {
+                       return !left.Equals (right);
+               }
+       }
+
+       internal struct RuntimeGPtrArrayHandle {
+               unsafe RuntimeStructs.GPtrArray* value;
+
+               internal unsafe RuntimeGPtrArrayHandle (RuntimeStructs.GPtrArray* value)
+               {
+                       this.value = value;
+               }
+
+               internal unsafe RuntimeGPtrArrayHandle (IntPtr ptr)
+               {
+                       this.value = (RuntimeStructs.GPtrArray*) ptr;
+               }
+
+               internal int Length {
+                       get {
+                               unsafe {
+                                       return value->len;
+                               }
+                       }
+               }
+
+               internal IntPtr this[int i] => Lookup (i);
+
+               internal IntPtr Lookup (int i)
+               {
+                       if (i >= 0 && i < Length) {
+                               unsafe {
+                                       return value->data[i];
+                               }
+                       } else
+                               throw new IndexOutOfRangeException ();
+               }
+
+               [MethodImpl(MethodImplOptions.InternalCall)]
+               unsafe extern static void GPtrArrayFree (RuntimeStructs.GPtrArray* value);
+
+               internal static void DestroyAndFree (ref RuntimeGPtrArrayHandle h) {
+                       unsafe {
+                               GPtrArrayFree (h.value);
+                               h.value = null;
+                       }
+               }
+       }
+}
diff --git a/mcs/class/corlib/Mono/RuntimeMarshal.cs b/mcs/class/corlib/Mono/RuntimeMarshal.cs
new file mode 100644 (file)
index 0000000..38da4e2
--- /dev/null
@@ -0,0 +1,65 @@
+using System;
+using System.Runtime.InteropServices;
+using System.Runtime.CompilerServices;
+
+namespace Mono {
+       internal static class RuntimeMarshal {
+               internal static string PtrToUtf8String (IntPtr ptr)
+               {
+                       unsafe {
+                               return new String ((sbyte*)ptr);
+                       }
+               }
+
+               internal static SafeStringMarshal MarshalString (string str)
+               {
+                       return new SafeStringMarshal (str);
+               }
+
+               static int DecodeBlobSize (IntPtr in_ptr, out IntPtr out_ptr)
+               {
+                       uint size;
+                       unsafe {
+                               byte *ptr = (byte*)in_ptr;
+       
+                               if ((*ptr & 0x80) == 0) {
+                                       size = (uint)(ptr [0] & 0x7f);
+                                       ptr++;
+                               } else if ((*ptr & 0x40) == 0){
+                                       size = (uint)(((ptr [0] & 0x3f) << 8) + ptr [1]);
+                                       ptr += 2;
+                               } else {
+                                       size = (uint)(((ptr [0] & 0x1f) << 24) +
+                                               (ptr [1] << 16) +
+                                               (ptr [2] << 8) +
+                                               ptr [3]);
+                                       ptr += 4;
+                               }
+                               out_ptr = (IntPtr)ptr;
+                       }
+
+                       return (int)size;
+               }
+
+               internal static byte[] DecodeBlobArray (IntPtr ptr)
+               {
+                       IntPtr out_ptr;
+                       int size = DecodeBlobSize (ptr, out out_ptr);
+                       byte[] res = new byte [size];
+                       Marshal.Copy (out_ptr, res, 0, size);
+                       return res;
+               }
+
+               internal static int AsciHexDigitValue (int c)
+               {
+                       if (c >= '0' && c <= '9')
+                               return c - '0';
+                       if (c >= 'a' && c <= 'f')
+                               return c - 'a' + 10;
+                       return c - 'A' + 10;
+               }
+
+               [MethodImpl (MethodImplOptions.InternalCall)]
+               internal static extern void FreeAssemblyName (ref MonoAssemblyName name);
+       }
+}
diff --git a/mcs/class/corlib/Mono/RuntimeStructs.cs b/mcs/class/corlib/Mono/RuntimeStructs.cs
new file mode 100644 (file)
index 0000000..6225954
--- /dev/null
@@ -0,0 +1,81 @@
+//
+// Mono runtime native structs surfaced to managed code.
+//
+// Authors:
+//   Aleksey Kliger <aleksey@xamarin.com>
+//   Rodrigo Kumpera <kumpera@xamarin.com>
+//
+// Copyright 2016 Dot net foundation.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+//
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace Mono {
+       //
+       // Managed representations of mono runtime types
+       //
+       internal static class RuntimeStructs {
+               // class-internals.h MonoRemoteClass
+               [StructLayout(LayoutKind.Sequential)]
+               internal unsafe struct RemoteClass {
+                       internal IntPtr default_vtable;
+                       internal IntPtr xdomain_vtable;
+                       internal MonoClass* proxy_class;
+                       internal IntPtr proxy_class_name;
+                       internal uint interface_count;
+                       // FIXME: How to represent variable-length array struct member?
+                       // MonoClass* interfaces [];
+               }
+
+               internal struct MonoClass {
+               }
+
+               // class-internals.h MonoGenericParamInfo
+               internal unsafe struct GenericParamInfo {
+                       internal MonoClass* pklass;
+                       internal IntPtr name;
+                       internal ushort flags;
+                       internal uint token;
+                       internal MonoClass** constraints; /* NULL terminated */
+               }
+
+               // glib.h GPtrArray
+               internal unsafe struct GPtrArray {
+                       internal IntPtr* data;
+                       internal int len;
+               }
+
+               // handle.h HandleStackMark
+               struct HandleStackMark {
+                       int size;
+                       IntPtr chunk;
+               }
+
+               // mono-error.h MonoError
+               struct MonoError {
+                       ushort error_code;
+                       ushort hidden_0;
+                       IntPtr hidden_1, hidden_2, hidden_3, hidden_4, hidden_5, hidden_6, hidden_7, hidden_8;
+                       IntPtr hidden_11, hidden_12, hidden_13, hidden_14, hidden_15, hidden_16, hidden_17, hidden_18;
+               }
+       }
+
+       //Maps to metadata-internals.h:: MonoAssemblyName
+       internal unsafe struct MonoAssemblyName
+       {
+               const int MONO_PUBLIC_KEY_TOKEN_LENGTH = 17;
+
+               internal IntPtr name;
+               internal IntPtr culture;
+               internal IntPtr hash_value;
+               internal IntPtr public_key;
+               internal fixed byte public_key_token [MONO_PUBLIC_KEY_TOKEN_LENGTH];
+               internal uint hash_alg;
+               internal uint hash_len;
+               internal uint flags;
+               internal ushort major, minor, build, revision;
+               internal ushort arch;
+       }
+}
diff --git a/mcs/class/corlib/Mono/SafeGPtrArrayHandle.cs b/mcs/class/corlib/Mono/SafeGPtrArrayHandle.cs
new file mode 100644 (file)
index 0000000..0441c9b
--- /dev/null
@@ -0,0 +1,38 @@
+//
+// Safe handle class for Mono.RuntimeGPtrArrayHandle
+//
+// Authors:
+//   Aleksey Kliger <aleksey@xamarin.com>
+//   Rodrigo Kumpera <kumpera@xamarin.com>
+//
+// Copyright 2016 Dot net foundation.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+//
+
+using System;
+using System.Runtime.CompilerServices;
+
+namespace Mono {
+       internal struct SafeGPtrArrayHandle : IDisposable {
+               RuntimeGPtrArrayHandle handle;
+
+               internal SafeGPtrArrayHandle (IntPtr ptr)
+               {
+                       handle = new RuntimeGPtrArrayHandle (ptr);
+               }
+
+               public void Dispose () {
+                       RuntimeGPtrArrayHandle.DestroyAndFree (ref handle);
+               }
+
+               internal int Length {
+                       get {
+                               return handle.Length;
+                       }
+               }
+
+               internal IntPtr this[int i] => handle[i];
+       }
+
+
+}
diff --git a/mcs/class/corlib/Mono/SafeStringMarshal.cs b/mcs/class/corlib/Mono/SafeStringMarshal.cs
new file mode 100644 (file)
index 0000000..c18f0d3
--- /dev/null
@@ -0,0 +1,46 @@
+//
+// Safe wrapper for a string and its UTF8 encoding
+//
+// Authors:
+//   Aleksey Kliger <aleksey@xamarin.com>
+//   Rodrigo Kumpera <kumpera@xamarin.com>
+//
+// Copyright 2016 Dot net foundation.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+//
+
+using System;
+using System.Runtime.CompilerServices;
+
+namespace Mono  {
+       internal struct SafeStringMarshal : IDisposable {
+               readonly string str;
+               IntPtr marshaled_string;
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)]
+               public extern static IntPtr StringToUtf8 (string str);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)]
+               public extern static void GFree (IntPtr ptr);
+
+               public SafeStringMarshal (string str) {
+                       this.str = str;
+                       this.marshaled_string = IntPtr.Zero;
+               }
+
+               public IntPtr Value {
+                       get {
+                               if (marshaled_string == IntPtr.Zero && str != null)
+                                       marshaled_string = StringToUtf8 (str);
+                               return marshaled_string;
+                       }
+               }
+
+               public void Dispose () {
+                       if (marshaled_string != IntPtr.Zero) {
+                               GFree (marshaled_string);
+                               marshaled_string = IntPtr.Zero;
+                       }
+               }
+       }
+}
index bf8c82427e550cc93f68bf907e7f8a221596f81c..55d45d833e3f6a5c74d371e8e118d0e5861f7edd 100644 (file)
@@ -1,5 +1,6 @@
 namespace System {
        static class AppContextSwitches {
-               public const bool ThrowExceptionIfDisposedCancellationTokenSource = true;
+               public static readonly bool ThrowExceptionIfDisposedCancellationTokenSource = true;
+               public static readonly bool SetActorAsReferenceWhenCopyingClaimsIdentity = false;
        }
 }
\ No newline at end of file
index 2fb847a6ef9638ec4aae614a2358d7ef59c8d913..8cd000563288e73fec2c2cce006fe964df4a6f7a 100644 (file)
@@ -46,7 +46,12 @@ namespace System.Reflection
 
                internal static MethodBase GetMethodFromHandleNoGenericCheck (RuntimeMethodHandle handle)
                {
-                       return GetMethodFromHandleInternalType (handle.Value, IntPtr.Zero);
+                       return GetMethodFromHandleInternalType_native (handle.Value, IntPtr.Zero, false);
+               }
+
+               internal static MethodBase GetMethodFromHandleNoGenericCheck (RuntimeMethodHandle handle, RuntimeTypeHandle reflectedType)
+               {
+                       return GetMethodFromHandleInternalType_native (handle.Value, reflectedType.Value, false);
                }
 
                [MethodImplAttribute (MethodImplOptions.InternalCall)]
@@ -57,7 +62,12 @@ namespace System.Reflection
                        return GetMethodBodyInternal (handle);
                }
 
+               static MethodBase GetMethodFromHandleInternalType (IntPtr method_handle, IntPtr type_handle) {
+                       return GetMethodFromHandleInternalType_native (method_handle, type_handle, true);
+               }
+
                [MethodImplAttribute (MethodImplOptions.InternalCall)]
-               extern static MethodBase GetMethodFromHandleInternalType (IntPtr method_handle, IntPtr type_handle);            
+               internal extern static MethodBase GetMethodFromHandleInternalType_native (IntPtr method_handle, IntPtr type_handle, bool genericCheck);
+
        }
-}
\ No newline at end of file
+}
diff --git a/mcs/class/corlib/ReferenceSources/PathInternal.cs b/mcs/class/corlib/ReferenceSources/PathInternal.cs
new file mode 100644 (file)
index 0000000..828a080
--- /dev/null
@@ -0,0 +1,10 @@
+namespace System.IO
+{
+       static class PathInternal
+       {
+               public static bool IsPartiallyQualified (string path)
+               {
+                       return false;
+               }
+       }
+}
\ No newline at end of file
index f577efcd5ca871464b7ed8ca65b028a35086fd98..8a49451936e5fd80e95e17913a2a3025084c5f7d 100644 (file)
@@ -452,7 +452,8 @@ namespace System
                                throw new InvalidOperationException(Environment.GetResourceString("Arg_NotGenericParameter"));
                        Contract.EndContractBlock();
 
-                       Type[] constraints = GetGenericParameterConstraints_impl ();
+                       var paramInfo = new Mono.RuntimeGenericParamInfoHandle (RuntimeTypeHandle.GetGenericParameterInfo (this));
+                       Type[] constraints = paramInfo.Constraints;
 
                        if (constraints == null)
                                constraints = EmptyArray<Type>.Value;
@@ -471,13 +472,57 @@ namespace System
                static extern Type MakeGenericType (Type gt, Type [] types);
 
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
-               internal extern RuntimeMethodInfo[] GetMethodsByName (string name, BindingFlags bindingAttr, bool ignoreCase, Type reflected_type);
+               internal extern IntPtr GetMethodsByName_native (IntPtr namePtr, BindingFlags bindingAttr, bool ignoreCase);
+
+               internal RuntimeMethodInfo[] GetMethodsByName (string name, BindingFlags bindingAttr, bool ignoreCase, RuntimeType reflectedType)
+               {
+                       var refh = new RuntimeTypeHandle (reflectedType);
+                       using (var namePtr = new Mono.SafeStringMarshal (name))
+                       using (var h = new Mono.SafeGPtrArrayHandle (GetMethodsByName_native (namePtr.Value, bindingAttr, ignoreCase))) {
+                               var n = h.Length;
+                               var a = new RuntimeMethodInfo [n];
+                               for (int i = 0; i < n; i++) {
+                                       var mh = new RuntimeMethodHandle (h[i]);
+                                       a[i] = (RuntimeMethodInfo) MethodBase.GetMethodFromHandleNoGenericCheck (mh, refh);
+                               }
+                               return a;
+                       }
+               }
 
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
-               extern RuntimePropertyInfo[] GetPropertiesByName (string name, BindingFlags bindingAttr, bool icase, Type reflected_type);              
+               extern IntPtr GetPropertiesByName_native (IntPtr name, BindingFlags bindingAttr, bool icase);           
 
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
-               extern RuntimeConstructorInfo[] GetConstructors_internal (BindingFlags bindingAttr, Type reflected_type);
+               extern IntPtr GetConstructors_native (BindingFlags bindingAttr);
+
+               RuntimeConstructorInfo[] GetConstructors_internal (BindingFlags bindingAttr, RuntimeType reflectedType)
+               {
+                       var refh = new RuntimeTypeHandle (reflectedType);
+                       using (var h = new Mono.SafeGPtrArrayHandle (GetConstructors_native (bindingAttr))) {
+                               var n = h.Length;
+                               var a = new RuntimeConstructorInfo [n];
+                               for (int i = 0; i < n; i++) {
+                                       var mh = new RuntimeMethodHandle (h[i]);
+                                       a[i] = (RuntimeConstructorInfo) MethodBase.GetMethodFromHandleNoGenericCheck (mh, refh);
+                               }
+                               return a;
+                       }
+               }
+
+               RuntimePropertyInfo[] GetPropertiesByName (string name, BindingFlags bindingAttr, bool icase, RuntimeType reflectedType)
+               {
+                       var refh = new RuntimeTypeHandle (reflectedType);
+                       using (var namePtr = new Mono.SafeStringMarshal (name))
+                       using (var h = new Mono.SafeGPtrArrayHandle (GetPropertiesByName_native (namePtr.Value, bindingAttr, icase))) {
+                               var n = h.Length;
+                               var a = new RuntimePropertyInfo [n];
+                               for (int i = 0; i < n; i++) {
+                                       var ph = new Mono.RuntimePropertyHandle (h[i]);
+                                       a[i] = (RuntimePropertyInfo) PropertyInfo.GetPropertyFromHandle (ph, refh);
+                               }
+                               return a;
+                       }
+               }
 
                public override InterfaceMapping GetInterfaceMap (Type ifaceType)
                {
@@ -618,26 +663,71 @@ namespace System
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
                extern Type[] GetGenericArgumentsInternal (bool runtimeArray);
 
-               [MethodImplAttribute(MethodImplOptions.InternalCall)]
-               extern GenericParameterAttributes GetGenericParameterAttributes ();
-
-               [MethodImplAttribute(MethodImplOptions.InternalCall)]
-               extern Type[] GetGenericParameterConstraints_impl ();
+               GenericParameterAttributes GetGenericParameterAttributes () {
+                       return (new Mono.RuntimeGenericParamInfoHandle (RuntimeTypeHandle.GetGenericParameterInfo (this))).Attributes;
+               }
 
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
                extern int GetGenericParameterPosition ();
 
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
-               extern RuntimeEventInfo[] GetEvents_internal (string name, BindingFlags bindingAttr, Type reflected_type);
+               extern IntPtr GetEvents_native (IntPtr name, BindingFlags bindingAttr);
 
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
-               extern RuntimeFieldInfo[] GetFields_internal (string name, BindingFlags bindingAttr, Type reflected_type);
+               extern IntPtr GetFields_native (IntPtr name, BindingFlags bindingAttr);
+
+               RuntimeFieldInfo[] GetFields_internal (string name, BindingFlags bindingAttr, RuntimeType reflectedType)
+               {
+                       var refh = new RuntimeTypeHandle (reflectedType);
+                       using (var namePtr = new Mono.SafeStringMarshal (name))
+                       using (var h = new Mono.SafeGPtrArrayHandle (GetFields_native (namePtr.Value, bindingAttr))) {
+                               int n = h.Length;
+                               var a = new RuntimeFieldInfo[n];
+                               for (int i = 0; i < n; i++) {
+                                       var fh = new RuntimeFieldHandle (h[i]);
+                                       a[i] = (RuntimeFieldInfo) FieldInfo.GetFieldFromHandle (fh, refh);
+                               }
+                               return a;
+                       }
+               }
+
+               RuntimeEventInfo[] GetEvents_internal (string name, BindingFlags bindingAttr, RuntimeType reflectedType)
+               {
+                       var refh = new RuntimeTypeHandle (reflectedType);
+                       using (var namePtr = new Mono.SafeStringMarshal (name))
+                       using (var h = new Mono.SafeGPtrArrayHandle (GetEvents_native (namePtr.Value, bindingAttr))) {
+                               int n = h.Length;
+                               var a = new RuntimeEventInfo[n];
+                               for (int i = 0; i < n; i++) {
+                                       var eh = new Mono.RuntimeEventHandle (h[i]);
+                                       a[i] = (RuntimeEventInfo) EventInfo.GetEventFromHandle (eh, refh);
+                               }
+                               return a;
+                       }
+               }
 
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
                public extern override Type[] GetInterfaces();
 
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
-               extern RuntimeType[] GetNestedTypes_internal (string name, BindingFlags bindingAttr);           
+               extern IntPtr GetNestedTypes_native (IntPtr name, BindingFlags bindingAttr);
+
+               RuntimeType[] GetNestedTypes_internal (string displayName, BindingFlags bindingAttr)
+               {
+                       string internalName = null;
+                       if (displayName != null)
+                               internalName = TypeIdentifiers.FromDisplay (displayName).InternalName;
+                       using (var namePtr = new Mono.SafeStringMarshal (internalName))
+                       using (var h = new Mono.SafeGPtrArrayHandle (GetNestedTypes_native (namePtr.Value, bindingAttr))) {
+                               int n = h.Length;
+                               var a = new RuntimeType [n];
+                               for (int i = 0; i < n; i++) {
+                                       var th = new RuntimeTypeHandle (h[i]);
+                                       a[i] = (RuntimeType) Type.GetTypeFromHandle (th);
+                               }
+                               return a;
+                       }
+               }
 
                public override string AssemblyQualifiedName {
                        get {
diff --git a/mcs/class/corlib/System.Diagnostics.Tracing/EventDataAttribute.cs b/mcs/class/corlib/System.Diagnostics.Tracing/EventDataAttribute.cs
new file mode 100644 (file)
index 0000000..9a3d0cd
--- /dev/null
@@ -0,0 +1,49 @@
+//
+// EventDataAttribute.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
+{
+       [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, Inherited = false)]
+       public class EventDataAttribute : Attribute
+       {
+               [MonoTODO]
+               public string Name
+               {
+                       get
+                       {
+                               throw new NotImplementedException ();
+                       }
+                       set
+                       {
+                               throw new NotImplementedException ();
+                       }
+               }
+       }
+}
\ No newline at end of file
diff --git a/mcs/class/corlib/System.Diagnostics.Tracing/EventFieldAttribute.cs b/mcs/class/corlib/System.Diagnostics.Tracing/EventFieldAttribute.cs
new file mode 100644 (file)
index 0000000..4691746
--- /dev/null
@@ -0,0 +1,62 @@
+//
+// EventFieldAttribute.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
+{
+       [AttributeUsage(AttributeTargets.Property)]
+       public class EventFieldAttribute : Attribute
+       {
+               [MonoTODO]
+               public EventFieldFormat Format
+               {
+                       get
+                       {
+                               throw new NotImplementedException ();
+                       }
+                       set
+                       {
+                               throw new NotImplementedException ();
+                       }
+               }
+
+               [MonoTODO]
+               public EventFieldTags Tags
+               {
+                       get
+                       {
+                               throw new NotImplementedException ();
+                       }
+                       set
+                       {
+                               throw new NotImplementedException ();
+                       }
+               }
+       }
+}
diff --git a/mcs/class/corlib/System.Diagnostics.Tracing/EventFieldFormat.cs b/mcs/class/corlib/System.Diagnostics.Tracing/EventFieldFormat.cs
new file mode 100644 (file)
index 0000000..045cf65
--- /dev/null
@@ -0,0 +1,43 @@
+//
+// EventFieldFormat.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 enum EventFieldFormat
+       {
+               Boolean = 3,
+               Default = 0,
+               Hexadecimal = 4,
+               HResult = 15,
+               Json = 12,
+               String = 2,
+               Xml = 11
+       }
+}
diff --git a/mcs/class/corlib/System.Diagnostics.Tracing/EventFieldTags.cs b/mcs/class/corlib/System.Diagnostics.Tracing/EventFieldTags.cs
new file mode 100644 (file)
index 0000000..5f8cb37
--- /dev/null
@@ -0,0 +1,38 @@
+//
+// EventFieldTags.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
+{
+       [Flags]
+       public enum EventFieldTags
+       {
+               None = 0
+       }
+}
diff --git a/mcs/class/corlib/System.Diagnostics.Tracing/EventIgnoreAttribute.cs b/mcs/class/corlib/System.Diagnostics.Tracing/EventIgnoreAttribute.cs
new file mode 100644 (file)
index 0000000..8a276b3
--- /dev/null
@@ -0,0 +1,37 @@
+//
+// EventIgnoreAttribute.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
+{
+       [AttributeUsage(AttributeTargets.Property)]
+       public class EventIgnoreAttribute : Attribute
+       {
+       }
+}
diff --git a/mcs/class/corlib/System.Diagnostics.Tracing/EventManifestOptions.cs b/mcs/class/corlib/System.Diagnostics.Tracing/EventManifestOptions.cs
new file mode 100644 (file)
index 0000000..ed5ff2a
--- /dev/null
@@ -0,0 +1,42 @@
+//
+// EventManifestOptions.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
+{
+       [Flags]
+       public enum EventManifestOptions
+       {
+               AllCultures = 2,
+               AllowEventSourceOverride = 8,
+               None = 0,
+               OnlyIfNeededForRegistration = 4,
+               Strict = 1
+       }
+}
index 405d346a5275f4ca9ca6dc19a826f22452a10924..0872f01977ad44dbd72aad695444439c989a2e57 100644 (file)
@@ -33,6 +33,12 @@ namespace System.Diagnostics.Tracing
 {
        public class EventSource : IDisposable
        {
+               protected internal struct EventData
+               {
+                       public IntPtr DataPointer { get; set; }
+                       public int Size { get; set; }
+               }
+
                protected EventSource ()
                {
                        this.Name = this.GetType().Name;
diff --git a/mcs/class/corlib/System.Diagnostics.Tracing/EventSourceException.cs b/mcs/class/corlib/System.Diagnostics.Tracing/EventSourceException.cs
new file mode 100644 (file)
index 0000000..3602e29
--- /dev/null
@@ -0,0 +1,50 @@
+//
+// 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 702cd540d976d92e34dbce66fc2e116a679f2603..e51e9dbfc2833eecfc922a3e1f117753a5be742b 100644 (file)
@@ -71,22 +71,25 @@ namespace System.Diagnostics {
                                        out nativeOffset, out fileName, out lineNumber,
                                        out columnNumber);                      
                 }
-                
+
+               [MethodImplAttribute (MethodImplOptions.NoInlining)]                
                public StackFrame (bool fNeedFileInfo)
                {
                        get_frame_info (2, fNeedFileInfo, out methodBase, out ilOffset,
                                        out nativeOffset, out fileName, out lineNumber,
                                        out columnNumber);                      
                 }
-                
-                public StackFrame (int skipFrames)
+
+               [MethodImplAttribute (MethodImplOptions.NoInlining)]                
+               public StackFrame (int skipFrames)
                {
                        get_frame_info (skipFrames + 2, false, out methodBase, out ilOffset,
                                        out nativeOffset, out fileName, out lineNumber,
                                        out columnNumber);                      
                 }
                 
-                public StackFrame (int skipFrames, bool fNeedFileInfo) 
+               [MethodImplAttribute (MethodImplOptions.NoInlining)]
+               public StackFrame (int skipFrames, bool fNeedFileInfo) 
                {
                        get_frame_info (skipFrames + 2, fNeedFileInfo, out methodBase, out ilOffset,
                                        out nativeOffset, out fileName, out lineNumber,
@@ -95,7 +98,8 @@ namespace System.Diagnostics {
                 
                // LAMESPEC: According to the MSDN docs, this creates a frame with _only_
                // the filename and lineNumber, but MS fills out the frame info as well.
-                public StackFrame (string fileName, int lineNumber)
+               [MethodImplAttribute (MethodImplOptions.NoInlining)]
+               public StackFrame (string fileName, int lineNumber)
                {
                        get_frame_info (2, false, out methodBase, out ilOffset,
                                        out nativeOffset, out fileName, out lineNumber,
@@ -107,7 +111,8 @@ namespace System.Diagnostics {
                 
                // LAMESPEC: According to the MSDN docs, this creates a frame with _only_
                // the filename, lineNumber and colNumber, but MS fills out the frame info as well.
-                public StackFrame (string fileName, int lineNumber, int colNumber)
+               [MethodImplAttribute (MethodImplOptions.NoInlining)]
+               public StackFrame (string fileName, int lineNumber, int colNumber)
                {
                        get_frame_info (2, false, out methodBase, out ilOffset,
                                        out nativeOffset, out fileName, out lineNumber,
index 65ca59de4f3f17defb8a2b789c20637b33d2d02b..ccf9f835734b97315cba343aebb816fa5fbb89f4 100644 (file)
@@ -37,6 +37,7 @@ using System.Security;
 using System.Security.Permissions;
 using System.Text;
 using System.Threading;
+using System.IO;
 
 namespace System.Diagnostics {
 
@@ -60,26 +61,33 @@ namespace System.Diagnostics {
                readonly StackTrace[] captured_traces;
                private bool debug_info;
 
+               private static Dictionary<string, Func<StackTrace, string>> metadataHandlers;
+
+               [MethodImplAttribute (MethodImplOptions.NoInlining)]
                public StackTrace ()
                {
                        init_frames (METHODS_TO_SKIP, false);
                }
 
+               [MethodImplAttribute (MethodImplOptions.NoInlining)]
                public StackTrace (bool fNeedFileInfo)
                {
                        init_frames (METHODS_TO_SKIP, fNeedFileInfo);
                }
 
+               [MethodImplAttribute (MethodImplOptions.NoInlining)]
                public StackTrace (int skipFrames)
                {
                        init_frames (skipFrames, false);
                }
 
+               [MethodImplAttribute (MethodImplOptions.NoInlining)]
                public StackTrace (int skipFrames, bool fNeedFileInfo)
                {
                        init_frames (skipFrames, fNeedFileInfo);
                }
 
+               [MethodImplAttribute (MethodImplOptions.NoInlining)]
                void init_frames (int skipFrames, bool fNeedFileInfo)
                {
                        if (skipFrames < 0)
@@ -174,6 +182,20 @@ namespace System.Diagnostics {
                        return frames;
                }
 
+               static bool isAotidSet;
+               static string aotid;
+               static string GetAotId ()
+               {
+                       if (!isAotidSet) {
+                               aotid = Assembly.GetAotId ();
+                               if (aotid != null)
+                                       aotid = new Guid (aotid).ToString ("N");
+                               isAotidSet = true;
+                       }
+
+                       return aotid;
+               }
+
                bool AddFrames (StringBuilder sb)
                {
                        bool printOffset;
@@ -211,8 +233,18 @@ namespace System.Diagnostics {
                                                sb.AppendFormat (" [0x{0:x5}]", frame.GetILOffset ());
                                        }
 
-                                       sb.AppendFormat (debugInfo, frame.GetSecureFileName (),
-                                                        frame.GetFileLineNumber ());
+                                       var filename = frame.GetSecureFileName ();
+                                       if (filename[0] == '<') {
+                                               var mvid = frame.GetMethod ().Module.ModuleVersionId.ToString ("N");
+                                               var aotid = GetAotId ();
+                                               if (frame.GetILOffset () != -1 || aotid == null) {
+                                                       filename = string.Format ("<{0}>", mvid);
+                                               } else {
+                                                       filename = string.Format ("<{0}#{1}>", mvid, aotid);
+                                               }
+                                       }
+
+                                       sb.AppendFormat (debugInfo, filename, frame.GetFileLineNumber ());
                                }
                        }
 
@@ -290,6 +322,7 @@ namespace System.Diagnostics {
                        }
 
                        AddFrames (sb);
+
                        return sb.ToString ();
                }
 
index b755b4d5091913e9896dffce497d314bb1419236..8b4a3504d3ad2c16973c0b1c33babe286981b7ba 100644 (file)
@@ -127,12 +127,22 @@ namespace System.Globalization
                        get {
                                return Thread.CurrentThread.CurrentCulture;
                        }
+#if NETSTANDARD
+                       set {
+                               throw new NotImplementedException ();
+                       }
+#endif
                }
 
                public static CultureInfo CurrentUICulture { 
                        get {
                                return Thread.CurrentThread.CurrentUICulture;
                        }
+#if NETSTANDARD
+                       set {
+                               throw new NotImplementedException ();
+                       }
+#endif
                }
 
                internal static CultureInfo ConstructCurrentCulture ()
index c6c32095cbf9aa19e422c014d1bcf41e32e43901..92389257c5c788f84d7050c696d81075ff9109ee 100644 (file)
@@ -139,14 +139,15 @@ namespace System.IO
                                FileShare.None, bufferSize);
                }
 
-#if !NET_2_1
                [MonoLimitation ("FileOptions are ignored")]
                public static FileStream Create (string path, int bufferSize,
                                                 FileOptions options)
                {
-                       return Create (path, bufferSize, options, null);
+                       return new FileStream (path, FileMode.Create, FileAccess.ReadWrite,
+                               FileShare.None, bufferSize, options);
                }
-               
+
+#if !NET_2_1
                [MonoLimitation ("FileOptions and FileSecurity are ignored")]
                public static FileStream Create (string path, int bufferSize,
                                                 FileOptions options,
index fc62a4db6e3bff42240dfdca7c37c83252c7e266..d0512f24695a2a5dbe3111080092742268f8da45 100644 (file)
@@ -320,9 +320,12 @@ namespace System.IO {
 
                internal static string WindowsDriveAdjustment (string path)
                {
-                       // two special cases to consider when a drive is specified
-                       if (path.Length < 2)
+                       // three special cases to consider when a drive is specified
+                       if (path.Length < 2) {
+                               if (path.Length == 1 && (path[0] == '\\' || path[0] == '/'))
+                                       return Path.GetPathRoot(Directory.GetCurrentDirectory());
                                return path;
+                       }
                        if ((path [1] != ':') || !Char.IsLetter (path [0]))
                                return path;
 
index 6a6fcd36f5abe114d6eaa3751587690b41811a6c..0a189e1faa7e70b7a2db00d32532f5ee80005c82 100644 (file)
@@ -1114,8 +1114,7 @@ namespace System.Reflection.Emit
 
                public override AssemblyName GetName (bool copiedName)
                {
-                       AssemblyName aname = new AssemblyName ();
-                       FillName (this, aname);
+                       var aname = AssemblyName.Create (this, false);
 
                        if (sn != null) {
                                aname.SetPublicKey (sn.PublicKey);
index 8a852c139420c3622ba6fac9f39eaf1e6d6d1463..133ff0be6d9424193e985ed48fd265721648970d 100644 (file)
@@ -25,7 +25,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 {
@@ -87,5 +86,3 @@ namespace System.Reflection.Emit {
        }
 
 }
-
-#endif
index e6cdf10b73785b36f1489c055c1de78dbf98cab8..aa3453d20069185d4d7e8abaf1ed258b6aab6f10 100644 (file)
@@ -26,8 +26,6 @@
 // Copyright (C) 2004 Novell, Inc (http://www.novell.com)
 //
 
-#if !FULL_AOT_RUNTIME || IOS_REFLECTION
-
 using System.Runtime.InteropServices;
 
 namespace System.Reflection.Emit {
@@ -151,4 +149,3 @@ namespace System.Reflection.Emit {
                }
        }
 } 
-#endif
index 1163869317e9ab7c8d7c75055c6b8dd4a655e18e..67ddad4a581323bc34bab0f11809093484e2224f 100644 (file)
@@ -1,4 +1,3 @@
-#if !FULL_AOT_RUNTIME || IOS_REFLECTION
 namespace System.Reflection.Emit {
        static class OpCodeNames {
                internal static readonly string [] names = {
@@ -309,4 +308,3 @@ namespace System.Reflection.Emit {
                };
        }
 }
-#endif
index df0cbf0d50a659499d30f18e21268913b6ad4597..c50e574bde82417420d35eeb1f3fe13579459372 100644 (file)
@@ -25,7 +25,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 {
@@ -75,4 +74,3 @@ namespace System.Reflection.Emit {
        }
 
 }
-#endif
index 6e891d538d45ed3dfc59083402a6d1074f450df2..03317d2626f5da094b1f6d8d504192fd19532f52 100644 (file)
@@ -1,4 +1,3 @@
-#if !FULL_AOT_RUNTIME || IOS_REFLECTION
 using System.Runtime.InteropServices;
 
 namespace System.Reflection.Emit {
@@ -929,4 +928,3 @@ namespace System.Reflection.Emit {
                }
        }
 }
-#endif
index 2985b1b57ee0b5679081e19791641a0e738a8e79..4d823d33cbe8a3c154a0d63077d3592aa01bc391 100644 (file)
@@ -25,7 +25,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 {
@@ -112,5 +111,3 @@ namespace System.Reflection.Emit {
        }
 
 }
-
-#endif
index 08052a3386e7344b5e141c5746eaa0c0351f6af9..ad6be1d1d74a4f0dcc22d469046289c0bc5cd826 100644 (file)
@@ -25,7 +25,6 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if !FULL_AOT_RUNTIME
 using System.Runtime.InteropServices;
 
 namespace System.Reflection.Emit {
@@ -70,6 +69,3 @@ namespace System.Reflection.Emit {
        }
 
 }
-
-
-#endif
index 16a271495926aa4e1fd61c990b76076dc7b89328..524ea8d30598e57bda0c07b0a2b2c21381f3b615 100644 (file)
@@ -25,7 +25,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 {
@@ -153,4 +152,3 @@ namespace System.Reflection.Emit {
        }
 
 }
-#endif
diff --git a/mcs/class/corlib/System.Reflection.Metadata/AssemblyExtensions.cs b/mcs/class/corlib/System.Reflection.Metadata/AssemblyExtensions.cs
new file mode 100644 (file)
index 0000000..19da043
--- /dev/null
@@ -0,0 +1,46 @@
+//
+// AssemblyExtensions.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.Reflection.Metadata
+{
+       public static class AssemblyExtensions
+       {
+               //
+               // System.Runtime.Loader netstandard typeforwarders dependency
+               //
+               [CLSCompliant(false)]
+               public unsafe static bool TryGetRawMetadata (this System.Reflection.Assembly assembly, out byte* blob, out int length)
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+}
+
+#endif
\ No newline at end of file
index f75802198eb67a4197a3349dfec49280b206c666..174d5da5813c72bd9f6b960af06813128db67a7d 100644 (file)
@@ -88,7 +88,7 @@ namespace System.Reflection {
 
                // Note: changes to fields must be reflected in _MonoReflectionAssembly struct (object-internals.h)
 #pragma warning disable 649
-               private IntPtr _mono_assembly;
+               internal IntPtr _mono_assembly;
 #pragma warning restore 649
 
                private ResolveEventHolder resolve_event_holder;
@@ -138,6 +138,9 @@ namespace System.Reflection {
                [MethodImplAttribute (MethodImplOptions.InternalCall)]
                private extern string InternalImageRuntimeVersion ();
 
+               [MethodImplAttribute (MethodImplOptions.InternalCall)]
+               static internal extern string GetAotId ();
+
                // SECURITY: this should be the only caller to icall get_code_base
                private string GetCodeBase (bool escaped)
                {
@@ -422,9 +425,6 @@ namespace System.Reflection {
                [MethodImplAttribute (MethodImplOptions.InternalCall)]
                internal extern static void InternalGetAssemblyName (string assemblyFile, AssemblyName aname);
 
-               [MethodImplAttribute (MethodImplOptions.InternalCall)]
-               static extern internal void FillName (Assembly ass, AssemblyName aname);
-
                public virtual AssemblyName GetName (Boolean copiedName)
                {
                        throw new NotImplementedException ();
index 9da34563f241ccf3e575df1e5acc425dfae28f90..7ce7241cc98c8851f6893ca193722e3c679c5f90 100644 (file)
@@ -40,6 +40,7 @@ using System.Runtime.InteropServices;
 using System.Runtime.CompilerServices;
 using System.IO;
 
+using Mono;
 using Mono.Security;
 using Mono.Security.Cryptography;
 
@@ -84,17 +85,29 @@ namespace System.Reflection {
                }
 
                [MethodImpl (MethodImplOptions.InternalCall)]
-               static extern bool ParseName (AssemblyName aname, string assemblyName);
-               
+               static extern bool ParseAssemblyName (IntPtr name, out MonoAssemblyName aname, out bool is_version_definited, out bool is_token_defined);
+
                public AssemblyName (string assemblyName)
                {
                        if (assemblyName == null)
                                throw new ArgumentNullException ("assemblyName");
                        if (assemblyName.Length < 1)
                                throw new ArgumentException ("assemblyName cannot have zero length.");
-                               
-                       if (!ParseName (this, assemblyName))
-                               throw new FileLoadException ("The assembly name is invalid.");
+
+                       using (var name = RuntimeMarshal.MarshalString (assemblyName)) {
+                               MonoAssemblyName nativeName;
+                               bool isVersionDefined, isTokenDefined;
+                               //ParseName free the name if it fails.
+                               if (!ParseAssemblyName (name.Value, out nativeName, out isVersionDefined, out isTokenDefined))
+                                       throw new FileLoadException ("The assembly name is invalid.");
+                               try {
+                                       unsafe {
+                                               this.FillName (&nativeName, null, isVersionDefined, false, isTokenDefined);
+                                       }
+                               } finally {
+                                       RuntimeMarshal.FreeAssemblyName (ref nativeName);
+                               }
+                       }
                }
                
                [MonoLimitation ("Not used, as the values are too limited;  Mono supports more")]
@@ -433,6 +446,11 @@ namespace System.Reflection {
                        get {
                                return (cultureinfo == null)? null : cultureinfo.Name;
                        }
+#if NETSTANDARD
+                       set {
+                               throw new NotImplementedException ();
+                       }
+#endif
                }
 
                [ComVisibleAttribute(false)]
@@ -444,5 +462,63 @@ namespace System.Reflection {
                                contentType = value;
                        }
                }
+
+               [MethodImplAttribute (MethodImplOptions.InternalCall)]
+               static extern unsafe MonoAssemblyName* GetNativeName (IntPtr assembly_ptr);
+
+               internal unsafe void FillName (MonoAssemblyName *native, string codeBase, bool addVersion, bool addPublickey, bool defaultToken)
+               {
+                       this.name = RuntimeMarshal.PtrToUtf8String (native->name);
+
+                       this.major = native->major;
+                       this.minor = native->minor;
+                       this.build = native->build;
+                       this.revision = native->revision;
+
+                       this.flags = (AssemblyNameFlags)native->flags;
+
+                       this.hashalg = (AssemblyHashAlgorithm)native->hash_alg;
+
+                       this.versioncompat = AssemblyVersionCompatibility.SameMachine;
+                       this.processor_architecture = (ProcessorArchitecture)native->arch;
+
+                       if (addVersion)
+                               this.version = new Version (this.major, this.minor, this.build, this.revision);
+
+                       this.codebase = codeBase;
+
+                       if (native->culture != IntPtr.Zero)
+                               this.cultureinfo = CultureInfo.CreateCulture ( RuntimeMarshal.PtrToUtf8String (native->culture), false);
+
+                       if (native->public_key != IntPtr.Zero) {
+                               this.publicKey = RuntimeMarshal.DecodeBlobArray (native->public_key);
+                               this.flags |= AssemblyNameFlags.PublicKey;
+                       } else if (addPublickey) {
+                               this.publicKey = EmptyArray<byte>.Value;
+                               this.flags |= AssemblyNameFlags.PublicKey;
+                       }
+
+                       // MonoAssemblyName keeps the public key token as an hexadecimal string
+                       if (native->public_key_token [0] != 0) {
+                               byte[] keyToken = new byte [8];
+                               for (int i = 0, j = 0; i < 8; ++i) {
+                                       keyToken [i] = (byte)(RuntimeMarshal.AsciHexDigitValue (native->public_key_token [j++]) << 4);
+                                       keyToken [i] |= (byte)RuntimeMarshal.AsciHexDigitValue (native->public_key_token [j++]);
+                               }
+                               this.keyToken = keyToken;
+                       } else if (defaultToken) {
+                               this.keyToken = EmptyArray<byte>.Value;
+                       }
+               }
+
+               internal static AssemblyName Create (Assembly assembly, bool fillCodebase)
+               {
+                       AssemblyName aname = new AssemblyName ();
+                       unsafe {
+                               MonoAssemblyName *native = GetNativeName (assembly._mono_assembly);
+                               aname.FillName (native, fillCodebase ? assembly.CodeBase : null, true, true, true);
+                       }
+                       return aname;
+               }
        }
 }
index 040fe38beaecdf099e2f28bdb8b572bdfcba458c..9668f1f56c2b85e6bd47899349e8a2b6323fdb79 100644 (file)
@@ -28,6 +28,7 @@
 //
 
 using System.Diagnostics;
+using System.Runtime.CompilerServices;
 using System.Runtime.InteropServices;
 
 namespace System.Reflection {
@@ -277,5 +278,25 @@ namespace System.Reflection {
                public virtual MethodInfo RemoveMethod {
                        get { return GetRemoveMethod (true); }
                }
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)]
+               private static extern EventInfo internal_from_handle_type (IntPtr event_handle, IntPtr type_handle);
+
+               internal static EventInfo GetEventFromHandle (Mono.RuntimeEventHandle handle)
+               {
+                       if (handle.Value == IntPtr.Zero)
+                               throw new ArgumentException ("The handle is invalid.");
+                       return internal_from_handle_type (handle.Value, IntPtr.Zero);
+               }
+
+               internal static EventInfo GetEventFromHandle (Mono.RuntimeEventHandle handle, RuntimeTypeHandle reflectedType)
+               {
+                       if (handle.Value == IntPtr.Zero)
+                               throw new ArgumentException ("The handle is invalid.");
+                       EventInfo ei = internal_from_handle_type (handle.Value, reflectedType.Value);
+                       if (ei == null)
+                               throw new ArgumentException ("The event handle and the type handle are incompatible.");
+                       return ei;
+               }
        }
 }
index c433bc93dc8866598b839801f6ccb0effbaea6b3..a62b86a63ef2a8665c2315a5f8ae03c3c85ae092 100644 (file)
@@ -41,6 +41,8 @@ using System.Security;
 using System.Security.Policy;
 using System.Security.Permissions;
 
+using Mono;
+
 namespace System.Reflection {
 
        abstract class RuntimeAssembly : Assembly
@@ -162,12 +164,8 @@ namespace System.Reflection {
                                var _ = CodeBase; // this will ensure the Demand is made
                        }
 #endif
-
-                       AssemblyName aname = new AssemblyName ();
-                       FillName (this, aname);
-                       return aname;
+                       return AssemblyName.Create (this, true);
                }
-
        }
 
        [ComVisible (true)]
index 68a62f74a67f5143857c543685a3567be6fa0f7d..9eeb9cc917197b8052062edc222664ba604b87dc 100644 (file)
@@ -196,5 +196,18 @@ namespace System.Reflection {
                        throw new NotImplementedException ();
                }
 #endif
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)]
+               private static extern PropertyInfo internal_from_handle_type (IntPtr event_handle, IntPtr type_handle);
+
+               internal static PropertyInfo GetPropertyFromHandle (Mono.RuntimePropertyHandle handle, RuntimeTypeHandle reflectedType)
+               {
+                       if (handle.Value == IntPtr.Zero)
+                               throw new ArgumentException ("The handle is invalid.");
+                       PropertyInfo pi = internal_from_handle_type (handle.Value, reflectedType.Value);
+                       if (pi == null)
+                               throw new ArgumentException ("The property handle and the type handle are incompatible.");
+                       return pi;
+               }
        }
 }
index 3507b2d46371500d8667a0920af9069da2ae9340..a55f093678f618f00cb384f8fbd809f16264a1cd 100644 (file)
@@ -66,6 +66,10 @@ namespace System.Runtime.CompilerServices
                        GC.register_ephemeron_array (data);
                }
 
+               ~ConditionalWeakTable ()
+               {
+               }
+
                /*LOCKING: _lock must be held*/
                void Rehash () {
                        uint newSize = (uint)HashHelpers.GetPrime ((data.Length << 1) | 1);
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/ComAwareEventInfo.cs b/mcs/class/corlib/System.Runtime.InteropServices/ComAwareEventInfo.cs
new file mode 100644 (file)
index 0000000..3e13572
--- /dev/null
@@ -0,0 +1,123 @@
+//
+// ComAwareEventInfo.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.Reflection;
+
+namespace System.Runtime.InteropServices
+{
+       public class ComAwareEventInfo : EventInfo
+       {
+               [MonoTODO]
+               public override EventAttributes Attributes
+               {
+                       get
+                       {
+                               throw new NotImplementedException ();
+                       }
+               }
+
+               [MonoTODO]
+               public override Type DeclaringType
+               {
+                       get
+                       {
+                               throw new NotImplementedException ();
+                       }
+               }
+
+               [MonoTODO]
+               public override string Name
+               {
+                       get
+                       {
+                               throw new NotImplementedException ();
+                       }
+               }
+
+               [MonoTODO]
+               public ComAwareEventInfo (Type type, string eventName)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public override void AddEventHandler (object target, Delegate handler)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public override void RemoveEventHandler (object target, Delegate handler)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public override MethodInfo GetAddMethod (bool nonPublic)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public override MethodInfo GetRaiseMethod (bool nonPublic)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public override MethodInfo GetRemoveMethod (bool nonPublic)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public override object[] GetCustomAttributes (Type attributeType, bool inherit)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public override object[] GetCustomAttributes (bool inherit)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public override bool IsDefined (Type attributeType, bool inherit)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public override Type ReflectedType
+               {
+                       get { throw new NotImplementedException (); }
+               }
+       }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/ComEventsHelper.cs b/mcs/class/corlib/System.Runtime.InteropServices/ComEventsHelper.cs
new file mode 100644 (file)
index 0000000..5ab8020
--- /dev/null
@@ -0,0 +1,47 @@
+//
+// ComEventsHelper.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.Runtime.InteropServices
+{
+       public static class ComEventsHelper
+       {
+               [MonoTODO]
+               public static void Combine(object rcw, Guid iid, int dispid, Delegate d)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public static Delegate Remove(object rcw, Guid iid, int dispid, Delegate d)
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/CustomQueryInterfaceMode.cs b/mcs/class/corlib/System.Runtime.InteropServices/CustomQueryInterfaceMode.cs
new file mode 100644 (file)
index 0000000..1cbf55c
--- /dev/null
@@ -0,0 +1,38 @@
+//
+// CustomQueryInterfaceMode.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.Runtime.InteropServices
+{
+       public enum CustomQueryInterfaceMode
+       {
+               Allow = 1,
+               Ignore = 0
+       }
+}
diff --git a/mcs/class/corlib/System.Runtime.Loader/AssemblyLoadContext.cs b/mcs/class/corlib/System.Runtime.Loader/AssemblyLoadContext.cs
new file mode 100644 (file)
index 0000000..1839144
--- /dev/null
@@ -0,0 +1,108 @@
+//
+// AssemblyLoadContext.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.Runtime.Loader
+{
+       //
+       // System.Runtime.Loader netstandard typeforwarders dependency
+       //
+       public abstract class AssemblyLoadContext
+       {
+               protected AssemblyLoadContext ()
+               {
+               }
+               
+               public static System.Runtime.Loader.AssemblyLoadContext Default { 
+                       get { 
+                               throw new NotImplementedException ();
+                       }
+               }
+               
+               public static System.Reflection.AssemblyName GetAssemblyName (string assemblyPath)
+               {
+                       throw new NotImplementedException ();
+               }
+               
+               public static AssemblyLoadContext GetLoadContext (System.Reflection.Assembly assembly) 
+               {
+                       throw new NotImplementedException ();
+               }
+               
+               protected abstract System.Reflection.Assembly Load (System.Reflection.AssemblyName assemblyName);
+               
+               public System.Reflection.Assembly LoadFromAssemblyName(System.Reflection.AssemblyName assemblyName) 
+               {
+                       throw new NotImplementedException ();
+               }
+               
+               public System.Reflection.Assembly LoadFromAssemblyPath (string assemblyPath)
+               {
+                       throw new NotImplementedException ();
+               }
+               
+               public System.Reflection.Assembly LoadFromNativeImagePath (string nativeImagePath, string assemblyPath)
+               {
+                       throw new NotImplementedException ();
+               }
+               
+               public System.Reflection.Assembly LoadFromStream (System.IO.Stream assembly)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public System.Reflection.Assembly LoadFromStream (System.IO.Stream assembly, System.IO.Stream assemblySymbols) 
+               {
+                       throw new NotImplementedException ();
+               }
+               
+               protected IntPtr LoadUnmanagedDllFromPath (string unmanagedDllPath)
+               {
+                       throw new NotImplementedException ();
+               }
+               
+               protected virtual IntPtr LoadUnmanagedDll (string unmanagedDllName)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public void SetProfileOptimizationRoot (string directoryPath)
+               {
+               }
+
+               public void StartProfileOptimization (string profile)
+               {               
+               }
+
+               public event Func<AssemblyLoadContext, System.Reflection.AssemblyName, System.Reflection.Assembly> Resolving;
+               public event Action<AssemblyLoadContext> Unloading;
+       }
+}
+
+#endif
\ No newline at end of file
index 7ef860da45f1725dd95121b1d8a8473e9bdc6cc7..49628abb3446aa8cfedf988fde671a7fbea85738 100644 (file)
@@ -46,8 +46,6 @@ namespace System.Runtime.Remoting.Contexts
                bool _bReEntrant;
                int _flavor;
 
-               [NonSerialized]
-               bool _locked;
                [NonSerialized]
                int _lockCount;
                
@@ -90,32 +88,26 @@ namespace System.Runtime.Remoting.Contexts
                {
                        get 
                        { 
-                               return _locked
+                               return _lockCount > 0
                        }
                        
                        set 
                        {
                                if (value)
                                {
-                                       _mutex.WaitOne ();
+                                       AcquireLock ();
                                        lock (this)
                                        {
-                                               _lockCount++;
                                                if (_lockCount > 1)
                                                        ReleaseLock (); // Thread already had the lock
-                                                       
-                                               _ownerThread = Thread.CurrentThread;
                                        }
                                }
                                else
                                {
                                        lock (this)
                                        {
-                                               while (_lockCount > 0 && _ownerThread == Thread.CurrentThread)
-                                               {
-                                                       _lockCount--;
-                                                       _mutex.ReleaseMutex ();
-                                                       _ownerThread = null;
+                                               while (_lockCount > 0 && _ownerThread == Thread.CurrentThread) {
+                                                       ReleaseLock ();
                                                }
                                        }
                                }
@@ -140,7 +132,9 @@ namespace System.Runtime.Remoting.Contexts
                                if (_lockCount > 0 && _ownerThread == Thread.CurrentThread) {
                                        _lockCount--;
                                        _mutex.ReleaseMutex ();
-                                       _ownerThread = null;
+                                       if (_lockCount == 0) {
+                                               _ownerThread = null;
+                                       }
                                }
                        }
                }
index ef0b895922c7f91a49102e533202f082c2472962..3640f7285910223220cfcb5e256bf3684937a416 100644 (file)
@@ -109,19 +109,30 @@ namespace System.Runtime.Remoting.Messaging {
                                args = null;
                }
 
-               public MonoMethodMessage (Type type, string method_name, object [] in_args)
+               internal MonoMethodMessage (MethodInfo minfo, object [] in_args, object [] out_args)
                {
-                       // fixme: consider arg types
-                       MethodInfo minfo = type.GetMethod (method_name);
-                       
-                       InitMessage ((MonoMethod)minfo, null);
+                       InitMessage ((MonoMethod)minfo, out_args);
 
                        int len = in_args.Length;
                        for (int i = 0; i < len; i++) {
                                args [i] = in_args [i];
                        }
                }
+
+               private static MethodInfo GetMethodInfo (Type type, string methodName)
+               {
+                       // fixme: consider arg types
+                       MethodInfo minfo = type.GetMethod(methodName);
+                       if (minfo == null)
+                               throw new ArgumentException (String.Format("Could not find '{0}' in {1}", methodName, type), "methodName");
+                       return minfo;
+               }
                
+               public MonoMethodMessage (Type type, string methodName, object [] in_args)
+                       : this (GetMethodInfo (type, methodName), in_args, null)
+               {
+               }
+
                public IDictionary Properties {
                        get {
                                if (properties == null) properties = new MCMDictionary (this);
index de4b921cff8671dd29568107d49ca017960ae6a6..74b8b65b3f17afe89deeb11ffaf5cbe1a9883452 100644 (file)
@@ -49,8 +49,84 @@ namespace System.Runtime.Remoting.Proxies
        [StructLayout (LayoutKind.Sequential)]
        internal class TransparentProxy {
                public RealProxy _rp;
-               IntPtr _class;
+               Mono.RuntimeRemoteClassHandle _class;
                bool _custom_type_info;
+
+               unsafe internal RuntimeType GetProxyType () {
+                       RuntimeTypeHandle h = _class.ProxyClass.GetTypeHandle ();
+                       return (RuntimeType)Type.GetTypeFromHandle (h);
+               }
+
+               bool IsContextBoundObject {
+                       get { return GetProxyType ().IsContextful; }
+               }
+
+               Context TargetContext {
+                       get { return _rp._targetContext; }
+               }
+
+               bool InCurrentContext () {
+                       return IsContextBoundObject && Object.ReferenceEquals (TargetContext, Thread.CurrentContext);
+               }
+
+               internal object LoadRemoteFieldNew (IntPtr classPtr, IntPtr fieldPtr) {
+                       Mono.RuntimeClassHandle classHandle = new Mono.RuntimeClassHandle (classPtr);
+                       RuntimeFieldHandle fieldHandle = new RuntimeFieldHandle (fieldPtr);
+                       RuntimeTypeHandle typeHandle = classHandle.GetTypeHandle ();
+
+                       FieldInfo field = FieldInfo.GetFieldFromHandle (fieldHandle);
+
+                       if (InCurrentContext ()) {
+                               object o = _rp._server;
+                               return field.GetValue(o);
+                       }
+
+                       string typeName = Type.GetTypeFromHandle(typeHandle).FullName;
+                       string fieldName = field.Name;
+                       object[] inArgs = new object[] { typeName,
+                                                         fieldName };
+                       object[] outArgsMsg = new object[1];
+                       MethodInfo minfo = typeof(object).GetMethod("FieldGetter", BindingFlags.NonPublic | BindingFlags.Instance);
+                       if (minfo == null)
+                               throw new MissingMethodException ("System.Object", "FieldGetter");
+                       MonoMethodMessage msg = new MonoMethodMessage (minfo, inArgs, outArgsMsg);
+                       object[] outArgs;
+                       Exception exc;
+                       RealProxy.PrivateInvoke (_rp, msg, out exc, out outArgs);
+                       if (exc != null)
+                               throw exc;
+                       return outArgs[0];
+               }
+
+               internal void StoreRemoteField (IntPtr classPtr, IntPtr fieldPtr, object arg) {
+                       Mono.RuntimeClassHandle classHandle = new Mono.RuntimeClassHandle (classPtr);
+                       RuntimeFieldHandle fieldHandle = new RuntimeFieldHandle (fieldPtr);
+                       RuntimeTypeHandle typeHandle = classHandle.GetTypeHandle ();
+                       FieldInfo field = FieldInfo.GetFieldFromHandle (fieldHandle);
+
+                       if (InCurrentContext ()) {
+                               object o = _rp._server;
+                               field.SetValue (o, arg);
+                               return;
+                       }
+
+                       string typeName = Type.GetTypeFromHandle (typeHandle).FullName;
+                       string fieldName = field.Name;
+                       object [] inArgs = new object[] { typeName,
+                                                         fieldName,
+                                                         arg };
+                       MethodInfo minfo = typeof(object).GetMethod ("FieldSetter", BindingFlags.NonPublic | BindingFlags.Instance);
+                       if (minfo == null)
+                               throw new MissingMethodException ("System.Object", "FieldSetter");
+
+                       MonoMethodMessage msg = new MonoMethodMessage (minfo, inArgs, null);
+                       object [] outArgs;
+                       Exception exc;
+                       RealProxy.PrivateInvoke (_rp, msg, out exc, out outArgs);
+                       if (exc != null)
+                               throw exc;
+               }
+
        }
 #pragma warning restore 169, 649
        
@@ -66,7 +142,7 @@ namespace System.Runtime.Remoting.Proxies
                #region Sync with object-internals.h
                Type class_to_proxy;
                internal Context _targetContext;
-               MarshalByRefObject _server;
+               internal MarshalByRefObject _server;
                int _targetDomainId = -1;
                internal string _targetUri;
                internal Identity _objectIdentity;
index 35a574660c91850c13e2d4d65d0ed5d1c1c54f6e..369455581dac5ea9c2f0c06cf4d1582d643f6b25 100644 (file)
@@ -421,6 +421,7 @@ public partial class CryptoConfig {
                oid.Add (managedSHA1, oidSHA1);
                oid.Add (nameSHA1b, oidSHA1);
                oid.Add (nameSHA1c, oidSHA1);
+               oid.Add (nameSHA1Cng, oidSHA1);
 
                oid.Add (nameMD5, oidMD5);
                oid.Add (nameMD5a, oidMD5);
index 53667fb87dfed1dc23409f677cadaecc5236bb77..a8ebc812da3aff1068f07cb3114b0099cdc870a0 100644 (file)
@@ -36,8 +36,7 @@ using Mono.Security.Cryptography;
 
 namespace System.Security.Cryptography {
 
-       [ComVisible (true)]
-       public sealed class RSACryptoServiceProvider : RSA, ICspAsymmetricAlgorithm {
+       public partial class RSACryptoServiceProvider {
                private const int PROV_RSA_FULL = 1;    // from WinCrypt.h
                private const int AT_KEYEXCHANGE = 1;
                private const int AT_SIGNATURE = 2;
@@ -102,7 +101,7 @@ namespace System.Security.Cryptography {
 
                        // no need to load - it cannot exists
                        var p = new CspParameters (PROV_RSA_FULL);
-                       if (useMachineKeyStore)
+                       if (UseMachineKeyStore)
                                p.Flags |= CspProviderFlags.UseMachineKeyStore;
                        store = new KeyPairPersistence (p);
                }
@@ -121,13 +120,6 @@ namespace System.Security.Cryptography {
                                FromXmlString (store.KeyValue);
                        }
                }
-
-               private static bool useMachineKeyStore;
-
-               public static bool UseMachineKeyStore {
-                       get { return useMachineKeyStore; }
-                       set { useMachineKeyStore = value; }
-               }
        
                ~RSACryptoServiceProvider () 
                {
@@ -161,11 +153,7 @@ namespace System.Security.Cryptography {
                public bool PublicOnly {
                        get { return rsa.PublicOnly; }
                }
-       
-               public override string SignatureAlgorithm {
-                       get { return "http://www.w3.org/2000/09/xmldsig#rsa-sha1"; }
-               }
-       
+
                public byte[] Decrypt (byte[] rgb, bool fOAEP) 
                {
                        if (rgb == null)
@@ -339,6 +327,29 @@ namespace System.Security.Cryptography {
                        return PKCS1.Sign_v15 (this, hash, rgbHash);
                }
 
+               byte[] SignHash(byte[] rgbHash, int calgHash)
+               {
+                       return PKCS1.Sign_v15 (this, InternalHashToHashAlgorithm (calgHash), rgbHash);
+               }
+
+               static HashAlgorithm InternalHashToHashAlgorithm (int calgHash)
+               {
+                       switch (calgHash) {
+                       case Constants.CALG_MD5:
+                               return MD5.Create ();
+                       case Constants.CALG_SHA1:
+                               return SHA1.Create ();
+                       case Constants.CALG_SHA_256:
+                               return SHA256.Create ();
+                       case Constants.CALG_SHA_384:
+                               return SHA384.Create ();
+                       case Constants.CALG_SHA_512:
+                               return SHA512.Create ();
+                       }
+
+                       throw new NotImplementedException (calgHash.ToString ());
+               }
+
                // NOTE: this method can work with ANY configured (OID in machine.config) 
                // HashAlgorithm descendant
                public bool VerifyData (byte[] buffer, object halg, byte[] signature) 
@@ -364,6 +375,11 @@ namespace System.Security.Cryptography {
                        HashAlgorithm hash = HashAlgorithm.Create (hashName);
                        return PKCS1.Verify_v15 (this, hash, rgbHash, rgbSignature);
                }
+
+               bool VerifyHash(byte[] rgbHash, int calgHash, byte[] rgbSignature)
+               {
+                       return PKCS1.Verify_v15 (this, InternalHashToHashAlgorithm (calgHash), rgbHash, rgbSignature);
+               }
        
                protected override void Dispose (bool disposing) 
                {
@@ -444,7 +460,7 @@ namespace System.Security.Cryptography {
 
                        var p = new CspParameters (PROV_RSA_FULL);
                        p.KeyNumber = keyBlob [5] == 0x24 ? AT_SIGNATURE : AT_KEYEXCHANGE;
-                       if (useMachineKeyStore)
+                       if (UseMachineKeyStore)
                                p.Flags |= CspProviderFlags.UseMachineKeyStore;
                        store = new KeyPairPersistence (p);
                }
diff --git a/mcs/class/corlib/System.Security/SafeAccessTokenHandle.cs b/mcs/class/corlib/System.Security/SafeAccessTokenHandle.cs
deleted file mode 100644 (file)
index d7682bf..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-using System;
-using System.Runtime.InteropServices;
-
-namespace Microsoft.Win32.SafeHandles
-{
-       public sealed class SafeAccessTokenHandle : SafeHandle
-       {
-               public override bool IsInvalid {
-                       get {
-                               return handle == IntPtr.Zero;
-                       }
-               }
-
-               public SafeAccessTokenHandle ()
-                       : base (IntPtr.Zero, true)
-               {
-                       
-               }
-
-               protected override bool ReleaseHandle()
-               {
-                       return true;
-               }
-       }
-}
index de7889e827d74afd5861cbad1522b865d41fa8fb..d46999b767b535c04572e9cf6008f2d6fcdee221 100644 (file)
@@ -116,7 +116,7 @@ namespace System.Threading {
                private InternalThread internal_thread;
                object m_ThreadStartArg;
                object pending_exception;
-               int priority;
+               int priority = (int) ThreadPriority.Normal;
                #endregion
 #pragma warning restore 414
 
index 2b031f332871e671df0acdb1e5972283ddc965b7..b6a2d92eef7f8644942936af9c06aa92437233f3 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 = 151;
+               private const int mono_corlib_version = 152;
 #pragma warning restore 169
 
                [ComVisible (true)]
index eb6c42f097648ff77d290c66f24e2a600768da87..cd51c87a2a87a63a70d98b04df3233279ef5a170 100644 (file)
@@ -243,5 +243,9 @@ namespace System
 
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
                internal extern static bool IsGenericTypeDefinition (RuntimeType type);
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)]
+               internal extern static IntPtr GetGenericParameterInfo (RuntimeType type);
+
        }
 }
index fc1cd5448262fa7c0dc7720e5bec7d2ec910409f..ff76486877cfb2427ccf2b5f9069985552b4c3d2 100644 (file)
@@ -912,7 +912,7 @@ namespace System
 
                public bool IsDaylightSavingTime (DateTimeOffset dateTimeOffset)
                {
-                       throw new NotImplementedException ();
+                       return IsDaylightSavingTime (dateTimeOffset.DateTime);
                }
 
                internal DaylightTime GetDaylightChanges (int year)
index 897342eba7f20d6483be863287879c2b469029e1..c3ab9935350c9b1f3071960bda46d06d97b74d81 100644 (file)
@@ -688,6 +688,11 @@ namespace MonoTests.System.IO
                                                i, root + test [i, 0], ex.GetType ()));
                                }
                        }
+
+                       // These cases require that we don't pass a root to GetFullPath - it should return the proper drive root.
+                       string root4 = Path.GetPathRoot(Directory.GetCurrentDirectory());
+                       Assert.AreEqual(root4, Path.GetFullPath(@"\"));
+                       Assert.AreEqual(root4, Path.GetFullPath("/"));
                }
 
                [Test]
index c9a00481185d6374280d065700948e97c184f999..df214d97b2028468e05e25a7798d0c46df9e808f 100644 (file)
@@ -14,6 +14,7 @@ using System.Runtime.InteropServices;
 using System.Text;
 using System.Diagnostics;
 using System.Runtime.ExceptionServices;
+using System.Linq;
 
 using NUnit.Framework;
 
@@ -517,7 +518,10 @@ namespace MonoTests.System.Reflection.Emit
                        invoke (456324);
 
                        Assert.IsNotNull (ExceptionHandling_Test_Support.Caught, "#1");
-                       Assert.AreEqual (2, ExceptionHandling_Test_Support.CaughtStackTrace.Split (new[] { Environment.NewLine }, StringSplitOptions.None).Length, "#2");
+
+                       var lines = ExceptionHandling_Test_Support.CaughtStackTrace.Split (new[] { Environment.NewLine }, StringSplitOptions.None);
+                       lines = lines.Where (l => !l.StartsWith ("[")).ToArray ();
+                       Assert.AreEqual (2, lines.Length, "#2");
 
                        var st = new StackTrace (ExceptionHandling_Test_Support.Caught, 0, true);
 
@@ -552,9 +556,12 @@ namespace MonoTests.System.Reflection.Emit
 
                        public static void Handler (Exception e)
                        {
-                               var split = e.StackTrace.Split (new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
-                               Assert.AreEqual (5, split.Length, "#1");
-                               Assert.IsTrue (split [1].Contains ("---"), "#2");
+                               var lines = e.StackTrace.Split (new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
+                               // Ignore Metadata
+                               lines = lines.Where (l => !l.StartsWith ("[")).ToArray ();
+
+                               Assert.AreEqual (5, lines.Length, "#1");
+                               Assert.IsTrue (lines [1].Contains ("---"), "#2");
                        }
                }
 
index d4dcbcef6ec3a15b59370d05b2747cd6c868a993..5483974809bed349bde1a190afdd83810cd4038c 100644 (file)
@@ -36,6 +36,7 @@ using System.Runtime.Serialization;
 using System.Security.Permissions;
 using System.Collections.Generic;
 using System.Threading;
+using MonoTests.Helpers;
 
 
 namespace MonoTests.System.Runtime.CompilerServices {
@@ -197,11 +198,9 @@ namespace MonoTests.System.Runtime.CompilerServices {
                var cwt = new ConditionalWeakTable <object,object> ();
                List<object> keepAlive = null;
                List<WeakReference> keys = null;
-               Thread t = new Thread (delegate () {
+               FinalizerHelpers.PerformNoPinAction (delegate () {
                                FillStuff (cwt, out keepAlive, out keys);
                        });
-               t.Start ();
-               t.Join ();
 
                GC.Collect ();
 
@@ -254,10 +253,7 @@ namespace MonoTests.System.Runtime.CompilerServices {
                cwt.Add (b, new object ());
 
                List<WeakReference> res = null;
-               ThreadStart dele = () => { res = FillWithNetwork (cwt); };
-               var th = new Thread(dele);
-               th.Start ();
-               th.Join ();
+               FinalizerHelpers.PerformNoPinAction (() => { res = FillWithNetwork (cwt); });
 
                GC.Collect ();
                GC.Collect ();
@@ -301,16 +297,12 @@ namespace MonoTests.System.Runtime.CompilerServices {
                List<WeakReference> res, res2;
                res = res2 = null;
 
-               ThreadStart dele = () => {
+               FinalizerHelpers.PerformNoPinAction (() => {
                        res = FillWithNetwork2 (cwt);
                        ForcePromotion ();
                        k = FillReachable (cwt);
                        res2 = FillWithNetwork2 (cwt);
-               };
-
-               var th = new Thread(dele);
-               th.Start ();
-               th.Join ();
+               });
 
                GC.Collect ();
 
@@ -445,10 +437,7 @@ namespace MonoTests.System.Runtime.CompilerServices {
                        Assert.Ignore ("Not working on Boehm.");
                lock (_lock1) { 
                        var cwt = new ConditionalWeakTable <object,object> ();
-                       ThreadStart dele = () => { FillWithFinalizable (cwt); };
-                       var th = new Thread(dele);
-                       th.Start ();
-                       th.Join ();
+                       FinalizerHelpers.PerformNoPinAction (() => { FillWithFinalizable (cwt); });
                        GC.Collect ();
                        GC.Collect ();
 
index 900ffec6e7c4e570d6954ebb45176ad648e7912a..51ffc73db4d0535faa8c38608c05cff9732d862d 100644 (file)
@@ -31,6 +31,7 @@ using NUnit.Framework;
 using System.Runtime.ExceptionServices;
 using System.Threading.Tasks;
 using System.Diagnostics;
+using System.Linq;
 
 namespace MonoTests.System.Runtime.ExceptionServices
 {
@@ -38,6 +39,14 @@ namespace MonoTests.System.Runtime.ExceptionServices
        [Category ("BitcodeNotWorking")]
        public class ExceptionDispatchInfoTest
        {
+               static string[] GetLines (string str)
+               {
+                       var lines = str.Split (new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
+
+                       // Ignore Metadata
+                       return lines.Where (l => !l.StartsWith ("[")).ToArray ();
+               }
+
                [Test]
                public void Capture_InvalidArguments ()
                {
@@ -75,7 +84,7 @@ namespace MonoTests.System.Runtime.ExceptionServices
                                ed.Throw ();
                                Assert.Fail ("#0");
                        } catch (Exception e) {
-                               var s = e.StackTrace.Split ('\n');
+                               var s = GetLines (e.StackTrace);
                                Assert.AreEqual (4, s.Length, "#1");
                                Assert.AreEqual (orig, e, "#2");
                                Assert.AreNotEqual (orig_stack, e.StackTrace, "#3");
@@ -90,8 +99,9 @@ namespace MonoTests.System.Runtime.ExceptionServices
                                edi.Throw ();
                                Assert.Fail ("#0");
                        } catch (OperationCanceledException e) {
-                               Assert.IsFalse (e.StackTrace.Contains ("---"));
-                               Assert.AreEqual (2, e.StackTrace.Split (new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries).Length);
+                               Assert.IsTrue (!e.StackTrace.Contains("---"));
+                               var lines = GetLines (e.StackTrace);
+                               Assert.AreEqual (2, lines.Length, "#1");
                        }
                }
 
@@ -120,9 +130,9 @@ namespace MonoTests.System.Runtime.ExceptionServices
                        try {
                                edi.Throw ();
                        } catch (Exception ex) {
-                               var split = ex.StackTrace.Split (new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
-                               Assert.AreEqual (4, split.Length, "#1");
-                               Assert.IsTrue (split [1].Contains ("---"), "#2");
+                               var lines = GetLines (ex.StackTrace);
+                               Assert.AreEqual (4, lines.Length, "#1");
+                               Assert.IsTrue (lines [1].Contains ("---"), "#2");
                        }
                }
 
@@ -147,10 +157,10 @@ namespace MonoTests.System.Runtime.ExceptionServices
                        try {
                                edi.Throw ();
                        } catch (Exception ex) {
-                               var split = ex.StackTrace.Split (new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
-                               Assert.AreEqual (7, split.Length, "#1");
-                               Assert.IsTrue (split [1].Contains ("---"), "#2");
-                               Assert.IsTrue (split [4].Contains ("---"), "#3");
+                               var lines = GetLines (ex.StackTrace);
+                               Assert.AreEqual (7, lines.Length, "#1");
+                               Assert.IsTrue (lines [1].Contains ("---"), "#2");
+                               Assert.IsTrue (lines [4].Contains ("---"), "#3");
                        }
                }
 
@@ -166,9 +176,9 @@ namespace MonoTests.System.Runtime.ExceptionServices
                                }
                        } catch (Exception ex) {
                                var st = new StackTrace (ex, true);
-                               var split = st.ToString ().Split (new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
-                               Assert.AreEqual (4, split.Length, "#1");
-                               Assert.IsTrue (split [1].Contains ("---"), "#2");
+                               var lines = GetLines (st.ToString ());
+                               Assert.AreEqual (4, lines.Length, "#1");
+                               Assert.IsTrue (lines [1].Contains ("---"), "#2");
                        }
                }
        }
index ba69ed0503ba2cef85676b6de18327fdc590a987..a217969aefd8fffb6424d2e93ee3bf40a7f73464 100644 (file)
@@ -71,6 +71,23 @@ namespace MonoTests.System.Runtime.Remoting.Contexts {
                        Assert.IsFalse (sa.Locked, "Locked");
                }
 
+               [Test]
+           public void SetLocked()
+               {
+                       SynchronizationAttribute sa = new SynchronizationAttribute(SynchronizationAttribute.REQUIRES_NEW);
+                       sa.Locked = true;
+                       Assert.IsTrue(sa.Locked, "Locked");
+                       sa.Locked = false;
+                       Assert.IsFalse(sa.Locked, "Locked");
+
+                       sa.Locked = true;
+                       Assert.IsTrue(sa.Locked, "Locked");
+                       sa.Locked = true;
+                       Assert.IsTrue(sa.Locked, "Locked");
+                       sa.Locked = false;
+                       Assert.IsFalse(sa.Locked, "Locked");
+               }
+
                [Test]
                public void SerializationRoundtrip ()
                {
index 7596f3fd8bd53e905af9346ae6d622ec6ce9f57d..4005d1ad6c56783437c7dc1339473b5cc4e2e445 100644 (file)
@@ -220,6 +220,7 @@ namespace MonoTests.System.Runtime.Remoting
                public void TestLocked1 ()
                {
                        sincob.Lock (false);
+
                        Thread tr = new Thread (new ThreadStart (FirstSyncThread));
                        tr.Start ();
                        Thread.Sleep (200);
@@ -331,6 +332,21 @@ namespace MonoTests.System.Runtime.Remoting
                        Assert.IsTrue (!otResult, "Concurrency detected in CallbackThread");
                }
 
+               [Test]
+               public void TestSynchronizationReleasedOnMultipleAcquire ()
+               {
+
+                       otResult = notreentrant.TestCallback ();
+                   
+                       Thread tr = new Thread (new ThreadStart (CallbackThread));
+                       tr.Start();
+                       
+                       bool terminated = tr.Join(2000);
+                       Assert.IsTrue(terminated, "Thread didn't get lock of context bound object.");
+                       
+                       Assert.IsTrue (!otResult, "Concurrency detected in CallbackThread");
+               }
+
                void CallbackThread ()
                {
                        otResult = notreentrant.TestCallback ();
index 38a4aa7fafcf066f18be8fc267f3ec9e7c5dae67..c27a58f99cf7844a701f649d671d7cb79f33ae0c 100644 (file)
@@ -311,15 +311,15 @@ public class SignatureDescriptionTest {
        {
                // 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.SHA1CryptoServiceProvider", sd.DigestAlgorithm);
+               Assert.AreEqual ("System.Security.Cryptography.SHA1Cng", sd.DigestAlgorithm);
                Assert.AreEqual ("System.Security.Cryptography.RSAPKCS1SignatureDeformatter", sd.DeformatterAlgorithm);
                Assert.AreEqual ("System.Security.Cryptography.RSAPKCS1SignatureFormatter", sd.FormatterAlgorithm);
-               Assert.AreEqual ("System.Security.Cryptography.RSACryptoServiceProvider", sd.KeyAlgorithm);
+               Assert.AreEqual ("System.Security.Cryptography.RSA", sd.KeyAlgorithm);
 
                HashAlgorithm hash = sd.CreateDigest();
-               Assert.AreEqual ("System.Security.Cryptography.SHA1CryptoServiceProvider", hash.ToString ());
+               Assert.AreEqual ("System.Security.Cryptography.SHA1Cng", hash.ToString ());
 
-               Assert.AreEqual (rsa.ToString (), sd.KeyAlgorithm);
+               Assert.AreEqual ("System.Security.Cryptography.RSA", sd.KeyAlgorithm);
 
                AsymmetricSignatureDeformatter asd = sd.CreateDeformatter (rsa);
                Assert.AreEqual ("System.Security.Cryptography.RSAPKCS1SignatureDeformatter", asd.ToString ());
index 75775d3aa76e6880446463e03d4c76c30e5d496d..b69d81d5358d3b6e2b11a0c1f46fb218f063860d 100644 (file)
@@ -790,7 +790,7 @@ namespace MonoTests.System
                                Assert.IsNull (ex.InnerException, "#C3");
                                Assert.IsNotNull (ex.Message, "#C4");
                                Assert.IsNotNull (ex.ParamName, "#C5");
-                               Assert.AreEqual ("byteArray", ex.ParamName, "#C6");
+                               Assert.AreEqual ("value", ex.ParamName, "#C6");
                        }
                }
 
index ae5a82908c861894674a758b8ba8496d5027da2a..e1d95dc93f00f563a4a7415708b3714d5a107a4f 100644 (file)
@@ -1251,7 +1251,7 @@ namespace MonoTests.System
                        }
                }
        
-               delegate int IntNoArgs ();
+               public delegate int IntNoArgs ();
 
                [Test]
                public void CreateDelegateWithAbstractMethods ()
index 5ede3b2ea8fd17d38ab774ed47a20e5cdc5cad8b..55a6ea2ecfe4c6d11c609802597b1c11d7f5d63b 100644 (file)
@@ -359,6 +359,21 @@ namespace MonoTests.System
                                Assert.IsFalse (tzi.IsDaylightSavingTime (date));
                                Assert.AreEqual (new TimeSpan (2,0,0), tzi.GetUtcOffset (date));
                        }
+
+                       [Test] //Covers #41349
+                       public void TestIsDST_DateTimeOffset ()
+                       {
+                               TimeZoneInfo tzi = TimeZoneInfo.FindSystemTimeZoneById ("Europe/Athens");
+                               var date = new DateTime (2014, 3, 30 , 2, 0, 0);
+                               var offset = tzi.GetUtcOffset (date);
+                               var dateOffset = new DateTimeOffset (date, offset);
+                               Assert.IsFalse (tzi.IsDaylightSavingTime (dateOffset));
+
+                               date = new DateTime (2014, 3, 30 , 3, 0, 0);
+                               offset = tzi.GetUtcOffset (date);
+                               dateOffset = new DateTimeOffset (date, offset);
+                               Assert.IsTrue (tzi.IsDaylightSavingTime (dateOffset));
+                       }
                }
                
                [TestFixture]
index a3a002f7cb0cd43effe25a5dd82308730850de6d..9ef22797a960de09c6ac8e1a3998cebcebdf8dbd 100644 (file)
@@ -23,6 +23,11 @@ Mono.Globalization.Unicode/SortKeyBuffer.cs
 Mono.Globalization.Unicode/Normalization.cs
 Mono.Globalization.Unicode/NormalizationTableUtil.cs
 Mono/Runtime.cs
+Mono/RuntimeHandles.cs
+Mono/RuntimeMarshal.cs
+Mono/RuntimeStructs.cs
+Mono/SafeGPtrArrayHandle.cs
+Mono/SafeStringMarshal.cs
 Mono/DataConverter.cs
 Mono.Interop/ComInteropProxy.cs
 Mono.Interop/IDispatch.cs
@@ -169,6 +174,13 @@ System.Diagnostics.Tracing/EventCommandEventArgs.cs
 System.Diagnostics.Tracing/EventListener.cs
 System.Diagnostics.Tracing/EventWrittenEventArgs.cs
 System.Diagnostics.Tracing/NonEventAttribute.cs
+System.Diagnostics.Tracing/EventDataAttribute.cs
+System.Diagnostics.Tracing/EventFieldAttribute.cs
+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
@@ -298,6 +310,7 @@ System.Reflection.Emit/StringToken.cs
 System.Reflection.Emit/TypeBuilder.cs
 System.Reflection.Emit/TypeToken.cs
 System.Reflection.Emit/UnmanagedMarshal.cs
+System.Reflection.Metadata/AssemblyExtensions.cs
 System.Resources/Win32Resources.cs
 System.Runtime/GCLargeObjectHeapCompactionMode.cs
 System.Runtime/GCLatencyMode.cs
@@ -400,6 +413,9 @@ System.Runtime.InteropServices/UCOMITypeInfo.cs
 System.Runtime.InteropServices/UCOMITypeLib.cs
 System.Runtime.InteropServices/VARDESC.cs
 System.Runtime.InteropServices/VARFLAGS.cs
+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
@@ -589,6 +605,7 @@ System.Runtime.Remoting.Proxies/ProxyAttribute.cs
 System.Runtime.Remoting.Services/EnterpriseServicesHelper.cs
 System.Runtime.Remoting.Services/ITrackingHandler.cs
 System.Runtime.Remoting.Services/TrackingServices.cs
+System.Runtime.Loader/AssemblyLoadContext.cs
 System.Runtime.Versioning/CompatibilitySwitch.cs
 System.Security/CodeAccessPermission.cs
 System.Security/HostProtectionException.cs
@@ -603,7 +620,6 @@ System.Security/NamedPermissionSet.cs
 System.Security/PermissionBuilder.cs
 System.Security/PermissionSet.cs
 System.Security/PolicyLevelType.cs
-System.Security/SafeAccessTokenHandle.cs
 System.Security/SecureString.cs
 System.Security/SecurityElement.cs
 System.Security/SecurityFrame.cs
@@ -884,6 +900,7 @@ ReferenceSources/TextInfo.cs
 ReferenceSources/win32native.cs
 ReferenceSources/SharedStatics.cs
 ReferenceSources/SecurityContext.cs
+ReferenceSources/PathInternal.cs
 
 ../referencesource/mscorlib/system/__filters.cs
 ../referencesource/mscorlib/system/__hresults.cs
@@ -1381,6 +1398,7 @@ ReferenceSources/SecurityContext.cs
 ../referencesource/mscorlib/system/security/attributes.cs
 ../referencesource/mscorlib/system/security/securitycontext.cs
 ../referencesource/mscorlib/system/security/securitydocument.cs
+../referencesource/mscorlib/system/security/safesecurityhandles.cs
 
 ../referencesource/mscorlib/system/security/claims/Claim.cs
 ../referencesource/mscorlib/system/security/claims/ClaimsIdentity.cs
@@ -1431,6 +1449,7 @@ ReferenceSources/SecurityContext.cs
 ../referencesource/mscorlib/system/security/cryptography/ripemd160.cs
 ../referencesource/mscorlib/system/security/cryptography/ripemd160managed.cs
 ../referencesource/mscorlib/system/security/cryptography/rsa.cs
+../referencesource/mscorlib/system/security/cryptography/rsacryptoserviceprovider.cs
 ../referencesource/mscorlib/system/security/cryptography/rsaoaepkeyexchangedeformatter.cs
 ../referencesource/mscorlib/system/security/cryptography/rsaoaepkeyexchangeformatter.cs
 ../referencesource/mscorlib/system/security/cryptography/rsapkcs1keyexchangedeformatter.cs
index b7cf0d04b3a6a481de7fc9391d73868df0a04c7b..7dfe833f16380903f66c61071e763743e1c1d92d 100644 (file)
@@ -513,4 +513,4 @@ System.Threading/CountdownEventTests.cs
 System/AggregateExceptionTests.cs
 System.Threading/ThreadLocalTests.cs
 System.Threading/SpinLockTests.cs
-
+../../test-helpers/TestHelpers.cs
diff --git a/mcs/class/legacy/Mono.Cecil/Makefile b/mcs/class/legacy/Mono.Cecil/Makefile
new file mode 100644 (file)
index 0000000..8128987
--- /dev/null
@@ -0,0 +1,14 @@
+thisdir = class/legacy/Mono.Cecil
+include ../../../build/rules.make
+
+LIBRARY = Mono.Cecil.dll
+LIBRARY_SNK = ../../mono.snk
+LIBRARY_PACKAGE = none
+LIBRARY_SUBDIR = legacy
+
+LIB_REFS = System.Core
+LIB_MCS_FLAGS = -keyfile:$(LIBRARY_SNK) -d:NET_3_5 /publicsign
+
+NO_TEST = yes
+
+include ../../../build/library.make
diff --git a/mcs/class/legacy/Mono.Cecil/Mono.Cecil.dll.sources b/mcs/class/legacy/Mono.Cecil/Mono.Cecil.dll.sources
new file mode 100644 (file)
index 0000000..c993b3a
--- /dev/null
@@ -0,0 +1,127 @@
+../../../../external/cecil-legacy/Mono.Collections.Generic/Collection.cs
+../../../../external/cecil-legacy/Mono.Collections.Generic/ReadOnlyCollection.cs
+../../../../external/cecil-legacy/Mono.Cecil.PE/ImageWriter.cs
+../../../../external/cecil-legacy/Mono.Cecil.PE/BinaryStreamWriter.cs
+../../../../external/cecil-legacy/Mono.Cecil.PE/BinaryStreamReader.cs
+../../../../external/cecil-legacy/Mono.Cecil.PE/DataDirectory.cs
+../../../../external/cecil-legacy/Mono.Cecil.PE/ByteBuffer.cs
+../../../../external/cecil-legacy/Mono.Cecil.PE/ByteBufferEqualityComparer.cs
+../../../../external/cecil-legacy/Mono.Cecil.PE/TextMap.cs
+../../../../external/cecil-legacy/Mono.Cecil.PE/Section.cs
+../../../../external/cecil-legacy/Mono.Cecil.PE/Image.cs
+../../../../external/cecil-legacy/Mono.Cecil.PE/ImageReader.cs
+../../../../external/cecil-legacy/Mono.Cecil.Metadata/TableHeap.cs
+../../../../external/cecil-legacy/Mono.Cecil.Metadata/GuidHeap.cs
+../../../../external/cecil-legacy/Mono.Cecil.Metadata/Heap.cs
+../../../../external/cecil-legacy/Mono.Cecil.Metadata/TokenType.cs
+../../../../external/cecil-legacy/Mono.Cecil.Metadata/CodedIndex.cs
+../../../../external/cecil-legacy/Mono.Cecil.Metadata/ElementType.cs
+../../../../external/cecil-legacy/Mono.Cecil.Metadata/BlobHeap.cs
+../../../../external/cecil-legacy/Mono.Cecil.Metadata/Row.cs
+../../../../external/cecil-legacy/Mono.Cecil.Metadata/MetadataToken.cs
+../../../../external/cecil-legacy/Mono.Cecil.Metadata/UserStringHeap.cs
+../../../../external/cecil-legacy/Mono.Cecil.Metadata/Utilities.cs
+../../../../external/cecil-legacy/Mono.Cecil.Metadata/StringHeap.cs
+../../../../external/cecil-legacy/Mono.Cecil.Metadata/Buffers.cs
+../../../../external/cecil-legacy/System.Runtime.CompilerServices/ExtensionAttribute.cs
+../../../../external/cecil-legacy/Mono.Security.Cryptography/CryptoService.cs
+../../../../external/cecil-legacy/Mono.Security.Cryptography/CryptoConvert.cs
+../../../../external/cecil-legacy/Mono/Empty.cs
+../../../../external/cecil-legacy/Mono/Funcs.cs
+../../../../external/cecil-legacy/Mono/Actions.cs
+../../../../external/cecil-legacy/Mono.Cecil.Cil/ILProcessor.cs
+../../../../external/cecil-legacy/Mono.Cecil.Cil/VariableReference.cs
+../../../../external/cecil-legacy/Mono.Cecil.Cil/OpCodes.cs
+../../../../external/cecil-legacy/Mono.Cecil.Cil/MethodBody.cs
+../../../../external/cecil-legacy/Mono.Cecil.Cil/Instruction.cs
+../../../../external/cecil-legacy/Mono.Cecil.Cil/Code.cs
+../../../../external/cecil-legacy/Mono.Cecil.Cil/Symbols.cs
+../../../../external/cecil-legacy/Mono.Cecil.Cil/CodeWriter.cs
+../../../../external/cecil-legacy/Mono.Cecil.Cil/CodeReader.cs
+../../../../external/cecil-legacy/Mono.Cecil.Cil/SequencePoint.cs
+../../../../external/cecil-legacy/Mono.Cecil.Cil/Document.cs
+../../../../external/cecil-legacy/Mono.Cecil.Cil/OpCode.cs
+../../../../external/cecil-legacy/Mono.Cecil.Cil/ExceptionHandler.cs
+../../../../external/cecil-legacy/Mono.Cecil.Cil/VariableDefinition.cs
+../../../../external/cecil-legacy/Mono.Cecil/ModuleReference.cs
+../../../../external/cecil-legacy/Mono.Cecil/TypeParser.cs
+../../../../external/cecil-legacy/Mono.Cecil/LinkedResource.cs
+../../../../external/cecil-legacy/Mono.Cecil/IMemberDefinition.cs
+../../../../external/cecil-legacy/Mono.Cecil/Resource.cs
+../../../../external/cecil-legacy/Mono.Cecil/ICustomAttributeProvider.cs
+../../../../external/cecil-legacy/Mono.Cecil/MethodReference.cs
+../../../../external/cecil-legacy/Mono.Cecil/EventAttributes.cs
+../../../../external/cecil-legacy/Mono.Cecil/FieldReference.cs
+../../../../external/cecil-legacy/Mono.Cecil/SentinelType.cs
+../../../../external/cecil-legacy/Mono.Cecil/MemberReference.cs
+../../../../external/cecil-legacy/Mono.Cecil/AssemblyReader.cs
+../../../../external/cecil-legacy/Mono.Cecil/TargetRuntime.cs
+../../../../external/cecil-legacy/Mono.Cecil/TypeAttributes.cs
+../../../../external/cecil-legacy/Mono.Cecil/GenericParameter.cs
+../../../../external/cecil-legacy/Mono.Cecil/MethodImplAttributes.cs
+../../../../external/cecil-legacy/Mono.Cecil/FileAttributes.cs
+../../../../external/cecil-legacy/Mono.Cecil/ManifestResourceAttributes.cs
+../../../../external/cecil-legacy/Mono.Cecil/SecurityDeclaration.cs
+../../../../external/cecil-legacy/Mono.Cecil/NativeType.cs
+../../../../external/cecil-legacy/Mono.Cecil/EventReference.cs
+../../../../external/cecil-legacy/Mono.Cecil/AssemblyWriter.cs
+../../../../external/cecil-legacy/Mono.Cecil/Modifiers.cs
+../../../../external/cecil-legacy/Mono.Cecil/IGenericParameterProvider.cs
+../../../../external/cecil-legacy/Mono.Cecil/ParameterDefinition.cs
+../../../../external/cecil-legacy/Mono.Cecil/IMetadataScope.cs
+../../../../external/cecil-legacy/Mono.Cecil/AssemblyNameReference.cs
+../../../../external/cecil-legacy/Mono.Cecil/ParameterAttributes.cs
+../../../../external/cecil-legacy/Mono.Cecil/TypeSpecification.cs
+../../../../external/cecil-legacy/Mono.Cecil/IMetadataTokenProvider.cs
+../../../../external/cecil-legacy/Mono.Cecil/MethodAttributes.cs
+../../../../external/cecil-legacy/Mono.Cecil/AssemblyInfo.cs
+../../../../external/cecil-legacy/Mono.Cecil/IMarshalInfoProvider.cs
+../../../../external/cecil-legacy/Mono.Cecil/PointerType.cs
+../../../../external/cecil-legacy/Mono.Cecil/ArrayType.cs
+../../../../external/cecil-legacy/Mono.Cecil/TypeDefinition.cs
+../../../../external/cecil-legacy/Mono.Cecil/FunctionPointerType.cs
+../../../../external/cecil-legacy/Mono.Cecil/MetadataResolver.cs
+../../../../external/cecil-legacy/Mono.Cecil/Import.cs
+../../../../external/cecil-legacy/Mono.Cecil/IGenericInstance.cs
+../../../../external/cecil-legacy/Mono.Cecil/ExportedType.cs
+../../../../external/cecil-legacy/Mono.Cecil/PInvokeAttributes.cs
+../../../../external/cecil-legacy/Mono.Cecil/AssemblyHashAlgorithm.cs
+../../../../external/cecil-legacy/Mono.Cecil/MethodReturnType.cs
+../../../../external/cecil-legacy/Mono.Cecil/ParameterReference.cs
+../../../../external/cecil-legacy/Mono.Cecil/AssemblyLinkedResource.cs
+../../../../external/cecil-legacy/Mono.Cecil/EventDefinition.cs
+../../../../external/cecil-legacy/Mono.Cecil/FieldAttributes.cs
+../../../../external/cecil-legacy/Mono.Cecil/AssemblyNameDefinition.cs
+../../../../external/cecil-legacy/Mono.Cecil/ParameterDefinitionCollection.cs
+../../../../external/cecil-legacy/Mono.Cecil/ModuleDefinition.cs
+../../../../external/cecil-legacy/Mono.Cecil/MetadataSystem.cs
+../../../../external/cecil-legacy/Mono.Cecil/AssemblyFlags.cs
+../../../../external/cecil-legacy/Mono.Cecil/TypeDefinitionCollection.cs
+../../../../external/cecil-legacy/Mono.Cecil/CustomAttribute.cs
+../../../../external/cecil-legacy/Mono.Cecil/MemberDefinitionCollection.cs
+../../../../external/cecil-legacy/Mono.Cecil/PropertyDefinition.cs
+../../../../external/cecil-legacy/Mono.Cecil/GenericInstanceType.cs
+../../../../external/cecil-legacy/Mono.Cecil/ModuleKind.cs
+../../../../external/cecil-legacy/Mono.Cecil/DefaultAssemblyResolver.cs
+../../../../external/cecil-legacy/Mono.Cecil/MethodSemanticsAttributes.cs
+../../../../external/cecil-legacy/Mono.Cecil/EmbeddedResource.cs
+../../../../external/cecil-legacy/Mono.Cecil/PropertyAttributes.cs
+../../../../external/cecil-legacy/Mono.Cecil/MethodSpecification.cs
+../../../../external/cecil-legacy/Mono.Cecil/TypeReference.cs
+../../../../external/cecil-legacy/Mono.Cecil/IConstantProvider.cs
+../../../../external/cecil-legacy/Mono.Cecil/MethodDefinition.cs
+../../../../external/cecil-legacy/Mono.Cecil/PinnedType.cs
+../../../../external/cecil-legacy/Mono.Cecil/VariantType.cs
+../../../../external/cecil-legacy/Mono.Cecil/MethodCallingConvention.cs
+../../../../external/cecil-legacy/Mono.Cecil/TypeSystem.cs
+../../../../external/cecil-legacy/Mono.Cecil/IMethodSignature.cs
+../../../../external/cecil-legacy/Mono.Cecil/FieldDefinition.cs
+../../../../external/cecil-legacy/Mono.Cecil/BaseAssemblyResolver.cs
+../../../../external/cecil-legacy/Mono.Cecil/PropertyReference.cs
+../../../../external/cecil-legacy/Mono.Cecil/MarshalInfo.cs
+../../../../external/cecil-legacy/Mono.Cecil/GenericInstanceMethod.cs
+../../../../external/cecil-legacy/Mono.Cecil/ReferenceType.cs
+../../../../external/cecil-legacy/Mono.Cecil/PInvokeInfo.cs
+../../../../external/cecil-legacy/Mono.Cecil/CallSite.cs
+../../../../external/cecil-legacy/Mono.Cecil/AssemblyDefinition.cs
+../../../../external/cecil-legacy/Mono.Cecil/GenericParameterAttributes.cs
index d1b3abc1dae91e1fd11ab78cb05c29b5d12daf3b..2debe1f357899ef04cc5d46f774774e6bbd3582a 100644 (file)
@@ -63,10 +63,11 @@ namespace System.Activities.Core.Presentation
                     trueLabelText = (string)virtualizingContainer.ModelItem.Properties["TrueLabel"].ComputedValue;
                 }
 
+                double pixelsPerDip = VisualTreeHelper.GetDpi(trueConnectionPoint).PixelsPerDip;
                 actualPoint = new Point(trueConnectionPoint.Location.X - origin.X, trueConnectionPoint.Location.Y - origin.Y);
                 FormattedText trueMarkerFormattedText = new FormattedText(trueLabelText, new System.Globalization.CultureInfo(textCulture),
                     this.FlowDirection, FlowchartDesigner.FlowElementCaptionTypeface, FlowchartDesigner.FlowNodeCaptionFontSize,
-                    new SolidColorBrush(WorkflowDesignerColors.WorkflowViewElementCaptionColor));
+                    new SolidColorBrush(WorkflowDesignerColors.WorkflowViewElementCaptionColor), pixelsPerDip);
                 actualPoint.Y += ConnectionPoint.DrawingLargeSide / 2;
                 actualPoint.X -= trueMarkerFormattedText.WidthIncludingTrailingWhitespace;
 
@@ -94,9 +95,10 @@ namespace System.Activities.Core.Presentation
                 actualPoint = new Point(falseConnectionPoint.Location.X - origin.X, falseConnectionPoint.Location.Y - origin.Y);
                 actualPoint.Y += ConnectionPoint.DrawingLargeSide / 2;
 
+                double pixelsPerDip = VisualTreeHelper.GetDpi(falseConnectionPoint).PixelsPerDip;
                 FormattedText falseMarkerFormattedText = new FormattedText(falseLabelText, new System.Globalization.CultureInfo(textCulture),
                     this.FlowDirection, FlowchartDesigner.FlowElementCaptionTypeface, FlowchartDesigner.FlowNodeCaptionFontSize,
-                    new SolidColorBrush(WorkflowDesignerColors.WorkflowViewElementCaptionColor));
+                    new SolidColorBrush(WorkflowDesignerColors.WorkflowViewElementCaptionColor), pixelsPerDip);
 
                 DrawtWithTransform(
                     drawingContext,
index 08bf6c294fa37029e3c1a21897810ef1cfbd9bb9..fb5266eb1310eea6c3cd141d8e608e0c68c17545 100644 (file)
@@ -7,6 +7,7 @@ namespace Microsoft.Activities.Presentation.Xaml
     using System;
     using System.Activities;
     using System.Activities.Debugger;
+    using System.Activities.DynamicUpdate;
     using System.Activities.Presentation.View;
     using System.Activities.Presentation.ViewState;
     using System.Collections.Generic;
@@ -30,6 +31,18 @@ namespace Microsoft.Activities.Presentation.Xaml
                 XamlDebuggerXmlReader.EndColumnName.MemberName
             };
 
+        // These are used to discover that we have found a DynamicUpdateInfo.OriginalDefintion or OriginalActivityBuilder
+        // attached property member. We have "hardcoded" the *MemberName" here because DynamicUpdateInfo has the
+        // AttachableMemberIdentifier properties marked as private. But the DynamicUpdateInfo class itself is public,
+        // as are the Get and Set methods.
+        static readonly string DynamicUpdateOriginalDefinitionMemberName = "OriginalDefinition";
+        static readonly MethodInfo GetOriginalDefinition = typeof(DynamicUpdateInfo).GetMethod("GetOriginalDefinition");
+        static readonly MethodInfo SetOriginalDefinition = typeof(DynamicUpdateInfo).GetMethod("SetOriginalDefinition");
+
+        static readonly string DynamicUpdateOriginalActivityBuilderMemberName = "OriginalActivityBuilder";
+        static readonly MethodInfo GetOriginalActivityBuilder = typeof(DynamicUpdateInfo).GetMethod("GetOriginalActivityBuilder");
+        static readonly MethodInfo SetOriginalActivityBuilder = typeof(DynamicUpdateInfo).GetMethod("SetOriginalActivityBuilder");
+
         // This method collects view state attached properties and generates a Xaml node stream 
         // with all view state information appearing within the ViewStateManager node. 
         // It is called when workflow definition is being serialized to string.
@@ -279,6 +292,22 @@ namespace Microsoft.Activities.Presentation.Xaml
             // Xaml member definition for IdRef. Used to identify existing IdRef properties in the input nodestream.
             XamlMember idRefMember = new XamlMember(IdRef, GetIdRef, SetIdRef, inputReader.SchemaContext);
 
+            // These are used to ignore the IdRef members that are inside a DynamicUpdateInfo.OriginalDefinition/OriginalActivityBuilder attached property.
+            // We need to ignore these because if we don't, the IdRef values for the objects in the actual workflow defintion will be ignored because of the
+            // duplicate IdRef value. This causes problems with activity designers that depend on the ViewStateManager data to correctly display the workflow
+            // on the WorkflowDesigner canvas.
+            XamlMember originalDefinitionMember = new XamlMember(DynamicUpdateOriginalDefinitionMemberName, GetOriginalDefinition, SetOriginalDefinition, inputReader.SchemaContext);
+            XamlMember originalActivityBuilderMember = new XamlMember(DynamicUpdateOriginalActivityBuilderMemberName, GetOriginalActivityBuilder, SetOriginalActivityBuilder, inputReader.SchemaContext);
+
+            // insideOriginalDefintion gets set to true when we find a "StartMember" node for either of the above two attached properties.
+            // originalDefintionMemberCount gets incremented if we find any "StartMember" and insideOriginalDefinition is true.
+            // originalDefintionMemberCount gets decremented if we find any "EndMember" and insideOriginalDefintion is true.
+            // insideOriginalDefintion gets set to false when we find an "EndMember" and originalDefinitionMemberCount gets decremented to 0.
+            // If insideOriginalDefintion is true when we find an "IdRef" member, we do NOT add that IdRef to the idRefsSeen HashSet to avoid
+            // duplicates being defined by the IdRefs inside of the OriginalDefinition attached properties.
+            bool insideOriginalDefinition = false;
+            int originalDefinitionMemberCount = 0;
+
             // Dictionary containing Ids and corresponding viewstate related
             // attached property nodes. Populated by StripViewStateElement method.
             Dictionary<string, XamlNodeList> viewStateInfo = null;
@@ -323,9 +352,21 @@ namespace Microsoft.Activities.Presentation.Xaml
                                 break;
 
                             case XamlNodeType.StartMember:
+                                // If we find a StartMember for DynamicUpdateInfo.OriginalDefinition or OriginalActivityBuilder, remember that we are
+                                // inside one of those. We don't want to "remember" IdRef values in the idRefsSeen HashSet while inside these attached properties.
+                                if (workflowDefinition.Member.Equals(originalDefinitionMember) || workflowDefinition.Member.Equals(originalActivityBuilderMember))
+                                {
+                                    insideOriginalDefinition = true;
+                                }
+                                
+                                if (insideOriginalDefinition)
+                                {
+                                    originalDefinitionMemberCount++;
+                                }
+
                                 // Track when the reader enters IdRef. Skip writing the start 
                                 // node to the output nodelist until we check for duplicates.
-                                if (workflowDefinition.Member.Equals(idRefMember))
+                                else if (workflowDefinition.Member.Equals(idRefMember))
                                 {
                                     inIdRefMember = true;
                                     skipWritingWorkflowDefinition = true;
@@ -341,38 +382,43 @@ namespace Microsoft.Activities.Presentation.Xaml
                             case XamlNodeType.Value:
                                 if (inIdRefMember)
                                 {
-                                    string idRef = workflowDefinition.Value as string;
-                                    if (!string.IsNullOrWhiteSpace(idRef))
+                                    // We don't want to deal with the IdRef if we are inside a DynamicUpdateInfo.OriginalDefinition/OriginalActivityBuilder
+                                    // attached property.
+                                    if (!insideOriginalDefinition)
                                     {
-                                        // If IdRef value is a duplicate then do not associate it with 
-                                        // the stack frame (top of stack == activity node with IdRef member on it).
-                                        if (idRefsSeen.Contains(idRef))
-                                        {
-                                            stack.Peek().IdRef = null;
-                                        }
-                                        // If the IdRef value is unique then associate it with the
-                                        // stack frame and also write its value into the output nodestream.
-                                        else
+                                        string idRef = workflowDefinition.Value as string;
+                                        if (!string.IsNullOrWhiteSpace(idRef))
                                         {
-                                            stack.Peek().IdRef = idRef;
-                                            idManager.UpdateMap(idRef);
-                                            idRefsSeen.Add(idRef);
-
-                                            if (shouldPassLineInfo)
+                                            // If IdRef value is a duplicate then do not associate it with 
+                                            // the stack frame (top of stack == activity node with IdRef member on it).
+                                            if (idRefsSeen.Contains(idRef))
                                             {
-                                                lineInfoComsumer.SetLineInfo(idRefLineNumber, idRefLinePosition);
+                                                stack.Peek().IdRef = null;
                                             }
+                                            // If the IdRef value is unique then associate it with the
+                                            // stack frame and also write its value into the output nodestream.
+                                            else
+                                            {
+                                                stack.Peek().IdRef = idRef;
+                                                idManager.UpdateMap(idRef);
+                                                idRefsSeen.Add(idRef);
 
-                                            mergedNodeWriter.WriteStartMember(idRefMember);
+                                                if (shouldPassLineInfo)
+                                                {
+                                                    lineInfoComsumer.SetLineInfo(idRefLineNumber, idRefLinePosition);
+                                                }
 
-                                            if (shouldPassLineInfo)
-                                            {
-                                                lineInfoComsumer.SetLineInfo(lineInfo.LineNumber, lineInfo.LinePosition);
-                                            }
+                                                mergedNodeWriter.WriteStartMember(idRefMember);
 
-                                            mergedNodeWriter.WriteValue(idRef);
+                                                if (shouldPassLineInfo)
+                                                {
+                                                    lineInfoComsumer.SetLineInfo(lineInfo.LineNumber, lineInfo.LinePosition);
+                                                }
 
-                                            shouldWriteIdRefEndMember = true;
+                                                mergedNodeWriter.WriteValue(idRef);
+
+                                                shouldWriteIdRefEndMember = true;
+                                            }
                                         }
                                     }
                                     // Don't need to write IdRef value into the output
@@ -382,9 +428,21 @@ namespace Microsoft.Activities.Presentation.Xaml
                                 break;
 
                             case XamlNodeType.EndMember:
+                                // If we are inside an OriginalDefinition/OriginalActivityBuilder attached property,
+                                // decrement the count and if it goes to zero, set insideOriginalDefintion to false
+                                // because we just encountered the EndMember for it.
+                                if (insideOriginalDefinition)
+                                {
+                                    originalDefinitionMemberCount--;
+                                    if (originalDefinitionMemberCount == 0)
+                                    {
+                                        insideOriginalDefinition = false;
+                                    }
+                                }
+
                                 // Exit IdRef node. Skip writing the EndMember node, we would have done 
                                 // it as part of reading the IdRef value.
-                                if (inIdRefMember)
+                                if (inIdRefMember && !insideOriginalDefinition)
                                 {
                                     inIdRefMember = false;
                                     skipWritingWorkflowDefinition = true;
@@ -401,6 +459,7 @@ namespace Microsoft.Activities.Presentation.Xaml
                                         mergedNodeWriter.WriteEndMember();
                                     }
                                 }
+
                                 break;
 
                             case XamlNodeType.EndObject:
@@ -592,6 +651,7 @@ namespace Microsoft.Activities.Presentation.Xaml
             viewStateSourceLocationMap = null;
             XamlNodeList strippedNodeList = new XamlNodeList(inputReader.SchemaContext);
             XamlMember viewStateManager = new XamlMember(ViewStateManager, GetViewStateManager, SetViewStateManager, inputReader.SchemaContext);
+
             using (XamlWriter strippedWriter = strippedNodeList.Writer)
             {
                 IXamlLineInfo lineInfo = inputReader as IXamlLineInfo;
@@ -618,7 +678,7 @@ namespace Microsoft.Activities.Presentation.Xaml
 
             return strippedNodeList.GetReader();
         }
-        
+
         // This method reads ViewStateManager nodes from the xaml nodestream and outputs that in the 
         // viewStateInfo dictionary. The input reader is positioned on the ViewStateManagerNode in the nodestream.
         static void ReadViewStateInfo(XamlReader inputReader, out Dictionary<string, XamlNodeList> viewStateInfo, out Dictionary<string, SourceLocation> viewStateSourceLocationMap)
@@ -700,7 +760,11 @@ namespace Microsoft.Activities.Presentation.Xaml
                                 }
                             }
                         } 
-                        else if (globalMemberLevel == 1 && !IsAttachablePropertyForConvert(xamlReader)) 
+                        // The xamlReader.ReadSubtree and subsequent while loop to get the Id member
+                        // has moved the xamlReader forward to the next member. We need to check to see
+                        // if it is an Attached Property that we care about. If it isn't then we need to
+                        // skip it and not put it in the resulting XamlNodeList.
+                        if (globalMemberLevel == 1 && !IsAttachablePropertyForConvert(xamlReader)) 
                         {
                             skippingUnexpectedAttachedProperty = true;
                         }
index 6b24f0ea5226a6b27bffc3bdfeb1def6cfecb873..c4cd899b81f2b89f669ac6410527694c8f28b26e 100644 (file)
@@ -48,6 +48,20 @@ namespace System.Activities.Hosting
         StackTrace abortStack;
 #endif
 
+        static WorkflowInstance()
+        {
+            try
+            {
+                using (TelemetryEventSource eventSource = new TelemetryEventSource())
+                {
+                    eventSource.V2Runtime();
+                }
+            }
+            catch
+            {
+            }
+        }
+
         protected WorkflowInstance(Activity workflowDefinition)
             : this(workflowDefinition, null)
         {
index 2090063250746eae0b7a6eaec193aac86984b785..ff9b74d7295d3a52cf91057ee647d184edec0c5e 100644 (file)
@@ -104,7 +104,7 @@ namespace System.Activities
         IList<Handle> rootExecutionProperties;
 
         IDictionary<XName, InstanceValue> instanceMetadata;
-
+        
         public WorkflowApplication(Activity workflowDefinition)
             : this(workflowDefinition, (WorkflowIdentity)null)
         {
index 20b80cfdeff85a277e06b7db9c5cb2b1f03b4c53..799f49541bb0cf99d2de4cdcca50854257bff7c7 100644 (file)
@@ -21,8 +21,10 @@ namespace System.ComponentModel.DataAnnotations {
         }
 
         public static void SetDefaultsLessOrEqual_46() {
+#pragma warning disable BCL0012 //disable warning about AppContextDefaults not following the recommended pattern
             // Define the switches that should be true for 4.6 or less, false for 4.6.1+.
             LocalAppContext.DefineSwitchDefault(UseLegacyRegExTimeoutString, true);
+#pragma warning restore BCL0012
         }
     }
 }
index cd4ac2683ec53a614da4ecbca86e00c105283167..0b0f4b3047b965e67e072297470f7516700d206a 100644 (file)
@@ -1,4 +1,4 @@
-using System.ComponentModel.DataAnnotations.Resources;
+using System.ComponentModel.DataAnnotations.Resources;
 using System.Diagnostics.CodeAnalysis;
 using System.Globalization;
 using System.Text.RegularExpressions;
@@ -19,7 +19,18 @@ namespace System.ComponentModel.DataAnnotations {
         ///     Gets or sets the timeout to use when matching the regular expression pattern (in milliseconds)
         ///     (-1 means never timeout).
         /// </summary>
-        public int MatchTimeoutInMilliseconds { get; set; } = GetDefaultTimeout();
+        public int MatchTimeoutInMilliseconds { 
+            get {
+                return _matchTimeoutInMilliseconds;
+            }
+            set {               
+                _matchTimeoutInMilliseconds = value; 
+                _matchTimeoutSet = true;
+            }
+        }
+
+        private int _matchTimeoutInMilliseconds;
+        private bool _matchTimeoutSet;
 
         private Regex Regex { get; set; }
 
@@ -90,6 +101,11 @@ namespace System.ComponentModel.DataAnnotations {
                 if (string.IsNullOrEmpty(this.Pattern)) {
                     throw new InvalidOperationException(DataAnnotationsResources.RegularExpressionAttribute_Empty_Pattern);
                 }
+
+                if (!_matchTimeoutSet) { 
+                    MatchTimeoutInMilliseconds = GetDefaultTimeout();
+                }
+
                 Regex = MatchTimeoutInMilliseconds == -1
                     ? new Regex(Pattern)
                     : Regex = new Regex(Pattern, default(RegexOptions), TimeSpan.FromMilliseconds((double)MatchTimeoutInMilliseconds));
index 8a130a0f34285449d7dc69480eff98e832bf3edd..9224bf8b8fbac5bb40399ab2c13c752e3f0fd57f 100644 (file)
@@ -3,6 +3,15 @@
 //   Copyright (c) Microsoft Corporation.  All rights reserved.
 // 
 // ==--==
+
+// There are cases where we have multiple assemblies that are going to import this file and 
+// if they are going to also have InternalsVisibleTo between them, there will be a compiler warning
+// that the type is found both in the source and in a referenced assembly. The compiler will prefer 
+// the version of the type defined in the source
+//
+// In order to disable the warning for this type we are disabling this warning for this entire file.
+#pragma warning disable 436
+
 using System;
 using System.Collections.Generic;
 
@@ -167,3 +176,5 @@ namespace System
         static partial void PopulateDefaultValuesPartial(string platformIdentifier, string profile, int version);
     }
 }
+
+#pragma warning restore 436
index f05b599ed3d2b9af36cb7cd29c3c39123370cf6e..33662b54280621d4ef98247f98badecf87773fda 100644 (file)
@@ -4,6 +4,14 @@
 // 
 // ==--==
 
+// There are cases where we have multiple assemblies that are going to import this file and 
+// if they are going to also have InternalsVisibleTo between them, there will be a compiler warning
+// that the type is found both in the source and in a referenced assembly. The compiler will prefer 
+// the version of the type defined in the source
+//
+// In order to disable the warning for this type we are disabling this warning for this entire file.
+#pragma warning disable 436
+
 // NOTE: This file should not be included in mscorlib. This should only be included in FX libraries that need to provide switches
 using System;
 using System.Collections.Generic;
@@ -126,3 +134,5 @@ namespace System
         }
     }
 }
+
+#pragma warning restore 436
index 4e46c61716b844e7bf2b83a0656ae5774d530d62..5ee50f1adcc536fa1881c5910f85c27e64dfbd4d 100644 (file)
@@ -26,6 +26,8 @@ namespace System.Configuration {
         const string                ClickOnceDataDirectory = "DataDirectory";
         const string                ConfigExtension = ".config";
         const int                   MAX_PATH = 260;
+        const int                   MAX_UNICODESTRING_LEN = short.MaxValue;
+        const int                   ERROR_INSUFFICIENT_BUFFER = 122; //https://msdn.microsoft.com/en-us/library/windows/desktop/ms681382(v=vs.85).aspx
         const int                   MAX_LENGTH_TO_USE = 25;
         const string                FILE_URI_LOCAL = "file:///";
         const string                FILE_URI_UNC = "file://";
@@ -108,7 +110,18 @@ namespace System.Configuration {
                 }
                 else {
                     StringBuilder sb = new StringBuilder(MAX_PATH);
-                    UnsafeNativeMethods.GetModuleFileName(new HandleRef(null, IntPtr.Zero), sb, sb.Capacity);
+                    int noOfTimes = 1;
+                    int length = 0;
+                    // Iterating by allocating chunk of memory each time we find the length is not sufficient.
+                    // Performance should not be an issue for current MAX_PATH length due to this change.
+                    while (((length = UnsafeNativeMethods.GetModuleFileName(new HandleRef(null, IntPtr.Zero), sb, sb.Capacity)) == sb.Capacity) 
+                            && Marshal.GetLastWin32Error() == ERROR_INSUFFICIENT_BUFFER 
+                            && sb.Capacity < MAX_UNICODESTRING_LEN) {
+                        noOfTimes += 2; // increasing buffer size by 520 in each iteration - perf.
+                        int capacity = noOfTimes * MAX_PATH < MAX_UNICODESTRING_LEN ? noOfTimes * MAX_PATH : MAX_UNICODESTRING_LEN;
+                        sb.EnsureCapacity(capacity);
+                    }
+                    sb.Length = length;
                     applicationUri = Path.GetFullPath(sb.ToString());
                     applicationFilename = applicationUri;
                 }
index 16669900dca07bf55e086b30bb79912e82a4e0f0..acda796288c7143fd55a39770024a02a268db818 100644 (file)
@@ -186,6 +186,8 @@ namespace Microsoft.Win32.SafeHandles {
 #pragma warning restore 618
 #endif
     internal sealed class SafeCapiHashHandle : SafeCapiHandleBase {
+        private static volatile SafeCapiHashHandle s_invalidHandle;
+
 #if FEATURE_CORESYSTEM
         [System.Security.SecurityCritical]
 #endif
@@ -197,9 +199,17 @@ namespace Microsoft.Win32.SafeHandles {
         /// </summary>
         public static SafeCapiHashHandle InvalidHandle {
             get {
-                SafeCapiHashHandle handle = new SafeCapiHashHandle();
-                handle.SetHandle(IntPtr.Zero);
-                return handle;
+                if (s_invalidHandle == null) {
+                    // More than one of these might get created in parallel, but that's okay.
+                    // Saving one to the field saves on GC tracking, but by SuppressingFinalize on
+                    // any instance returned there's already less finalization pressure.
+                    SafeCapiHashHandle handle = new SafeCapiHashHandle();
+                    handle.SetHandle(IntPtr.Zero);
+                    GC.SuppressFinalize(handle);
+                    s_invalidHandle = handle;
+                }
+
+                return s_invalidHandle;
             }
         }
 
@@ -233,6 +243,8 @@ namespace Microsoft.Win32.SafeHandles {
 #pragma warning restore 618
 #endif
     internal sealed class SafeCapiKeyHandle : SafeCapiHandleBase {
+        private static volatile SafeCapiKeyHandle s_invalidHandle;
+
 #if FEATURE_CORESYSTEM
         [System.Security.SecurityCritical]
 #endif
@@ -245,9 +257,17 @@ namespace Microsoft.Win32.SafeHandles {
         internal static SafeCapiKeyHandle InvalidHandle {
             [SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands")]
             get {
-                SafeCapiKeyHandle handle = new SafeCapiKeyHandle();
-                handle.SetHandle(IntPtr.Zero);
-                return handle;
+                if (s_invalidHandle == null) {
+                    // More than one of these might get created in parallel, but that's okay.
+                    // Saving one to the field saves on GC tracking, but by SuppressingFinalize on
+                    // any instance returned there's already less finalization pressure.
+                    SafeCapiKeyHandle handle = new SafeCapiKeyHandle();
+                    handle.SetHandle(IntPtr.Zero);
+                    GC.SuppressFinalize(handle);
+                    s_invalidHandle = handle;
+                }
+
+                return s_invalidHandle;
             }
         }
 
index 48a8467961fc1469cf2dc4f686f29c934b992b07..f4d5ebecbcf5bac9f4ef25d09a278d3b2e2c90dc 100644 (file)
@@ -38,6 +38,35 @@ namespace System.Security.Cryptography {
         /// </summary>
         Pss = 8                         // BCRYPT_PAD_PSS
     }
+#if !MONO
+    [StructLayout(LayoutKind.Sequential)]
+    internal struct BCRYPT_DSA_KEY_BLOB_V2
+    {
+        public BCryptNative.KeyBlobMagicNumber dwMagic;  // BCRYPT_DSA_PUBLIC_MAGIC_V2 or BCRYPT_DSA_PRIVATE_MAGIC_V2
+        public int cbKey;               // key lengths in BYTES (e.g. for a 3072-bit key, cbKey = 3072/8 = 384)
+        public HASHALGORITHM_ENUM hashAlgorithm;
+        public DSAFIPSVERSION_ENUM standardVersion;
+        public int cbSeedLength;        // size (in bytes) of the seed value
+        public int cbGroupSize;         // size (in bytes) of the Q value
+        public byte Count3;             // # of iterations used to generate Q. In big-endian format.
+        public byte Count2;
+        public byte Count1;
+        public byte Count0;
+    }
+#endif
+    internal enum HASHALGORITHM_ENUM : int
+    {
+        DSA_HASH_ALGORITHM_SHA1 = 0,
+        DSA_HASH_ALGORITHM_SHA256 = 1,
+        DSA_HASH_ALGORITHM_SHA512 = 2,
+    }
+
+    internal enum DSAFIPSVERSION_ENUM : int
+    {
+        DSA_FIPS186_2 = 0,
+        DSA_FIPS186_3 = 1,
+    }
+
     /// <summary>
     ///     Native interop with CNG's BCrypt layer. Native definitions can be found in bcrypt.h
     /// </summary>
@@ -59,7 +88,7 @@ namespace System.Security.Cryptography {
             public const string Sha512 = "SHA512";              // BCRYPT_SHA512_ALGORITHM
             internal const string Rsa = "RSA";                  // BCRYPT_RSA_ALGORITHM
         }
-
+#if !MONO
         /// <summary>
         ///     Well known key blob tyes
         /// </summary>
@@ -102,6 +131,10 @@ namespace System.Security.Cryptography {
         ///     Magic numbers identifying blob types
         /// </summary>
         internal enum KeyBlobMagicNumber {
+            DsaPublic = 0x42505344,                             // BCRYPT_DSA_PUBLIC_MAGIC for key lengths <= 1024 bits
+            DsaPublicV2 = 0x32425044,                           // BCRYPT_DSA_PUBLIC_MAGIC_V2 for key lengths > 1024 bits
+            DsaPrivate = 0x56505344,                            // BCRYPT_DSA_PRIVATE_MAGIC for key lengths <= 1024 bits
+            DsaPrivateV2 = 0x32565044,                          // BCRYPT_DSA_PRIVATE_MAGIC_V2 for key lengths > 1024 bits
             ECDHPublicP256 = 0x314B4345,                        // BCRYPT_ECDH_PUBLIC_P256_MAGIC
             ECDHPublicP384 = 0x334B4345,                        // BCRYPT_ECDH_PUBLIC_P384_MAGIC
             ECDHPublicP521 = 0x354B4345,                        // BCRYPT_ECDH_PUBLIC_P521_MAGIC
@@ -454,5 +487,6 @@ namespace System.Security.Cryptography {
             }
             return keyBlob;
         }
+#endif
     }
 }
index b9f7080affc1c406272be2b16952e6e692c14ef8..cbf1971793da9b6ca44aaf8e92f04277de698f6d 100644 (file)
@@ -168,6 +168,14 @@ namespace System.Security.Cryptography {
             public IntPtr pbData;
         }
 
+        [StructLayout(LayoutKind.Sequential)]
+        internal struct CERT_DSS_PARAMETERS
+        {
+            public CRYPTOAPI_BLOB p;
+            public CRYPTOAPI_BLOB q;
+            public CRYPTOAPI_BLOB g;
+        }
+
         [StructLayout(LayoutKind.Sequential)]
         internal unsafe struct PROV_ENUMALGS {
             public AlgorithmId aiAlgId;
@@ -187,6 +195,8 @@ namespace System.Security.Cryptography {
         internal const uint CALG_DSS_SIGN = (ALG_CLASS_SIGNATURE | ALG_TYPE_DSS | ALG_SID_DSS_ANY);
         internal const uint CALG_RSA_KEYX = (ALG_CLASS_KEY_EXCHANGE | ALG_TYPE_RSA | ALG_SID_RSA_ANY);
         internal const uint CNG_RSA_PUBLIC_KEY_BLOB = 72;
+        internal const uint X509_DSS_PUBLICKEY = 38;
+        internal const uint X509_DSS_PARAMETERS = 39;
 
         internal const uint X509_ASN_ENCODING = 0x00000001;
         internal const uint PKCS_7_ASN_ENCODING = 0x00010000;
index 490e61651f27c5c1c6018b5306869980851c71c8..c1c5bdc3d7df9d8ca062e6e3736ccfde70a95a93 100644 (file)
@@ -447,6 +447,9 @@ namespace System.Security.Cryptography {
                                                                     buffer.Length);
                     }
                     else {
+                        if (!LocalAppContextSwitches.AesCryptoServiceProviderDontCorrectlyResetDecryptor) {
+                            resetSize = buffer.Length;
+                        }
                         CapiNative.UnsafeNativeMethods.CryptDecrypt(m_key,
                                                                     SafeCapiHashHandle.InvalidHandle,
                                                                     true,
index 13ea41c2fb2d1139c2a85ba87ff23820744baf10..46870878014e49cf142570cd30922c6cac788540 100644 (file)
@@ -31,6 +31,10 @@ namespace System.Security.Cryptography {
     /// </summary>
     [System.Security.Permissions.HostProtection(MayLeakOnAbort = true)]
     public sealed class CngKey : IDisposable {
+#if MONO
+        public void Dispose() {
+        }
+#else
         private SafeNCryptKeyHandle m_keyHandle;
         private SafeNCryptProviderHandle m_kspHandle;
 
@@ -816,5 +820,6 @@ namespace System.Security.Cryptography {
             Contract.Assert(m_keyHandle != null);
             NCryptNative.SetProperty(m_keyHandle, property.Name, property.Value, property.Options);
         }
+#endif
     }
 }
index efb002c5814fd983a3a9fc1113cc68739d99cb7b..39a279372b4e42c6edd657af097cd31262fb7873 100644 (file)
@@ -46,6 +46,101 @@ namespace System.Security.Cryptography {
         //
 
         public abstract ECDiffieHellmanPublicKey PublicKey { get; }
-        public abstract byte[] DeriveKeyMaterial(ECDiffieHellmanPublicKey otherPartyPublicKey);
+
+        // This method must be implemented by derived classes. In order to conform to the contract, it cannot be abstract.
+        public virtual byte[] DeriveKeyMaterial(ECDiffieHellmanPublicKey otherPartyPublicKey)
+        {
+            throw DerivedClassMustOverride();
+        }
+
+        /// <summary>
+        /// Derive key material using the formula HASH(x) where x is the computed result of the EC Diffie-Hellman algorithm.
+        /// </summary>
+        /// <param name="otherPartyPublicKey">The public key of the party with which to derive a mutual secret.</param>
+        /// <param name="hashAlgorithm">The identifier for the hash algorithm to use.</param>
+        /// <returns>A hashed output suitable for key material</returns>
+        /// <exception cref="ArgumentException"><paramref name="otherPartyPublicKey"/> is over a different curve than this key</exception>
+        public byte[] DeriveKeyFromHash(ECDiffieHellmanPublicKey otherPartyPublicKey, HashAlgorithmName hashAlgorithm)
+        {
+            return DeriveKeyFromHash(otherPartyPublicKey, hashAlgorithm, null, null);
+        }
+
+        /// <summary>
+        /// Derive key material using the formula HASH(secretPrepend || x || secretAppend) where x is the computed
+        /// result of the EC Diffie-Hellman algorithm.
+        /// </summary>
+        /// <param name="otherPartyPublicKey">The public key of the party with which to derive a mutual secret.</param>
+        /// <param name="hashAlgorithm">The identifier for the hash algorithm to use.</param>
+        /// <param name="secretPrepend">A value to prepend to the derived secret before hashing. A <c>null</c> value is treated as an empty array.</param>
+        /// <param name="secretAppend">A value to append to the derived secret before hashing. A <c>null</c> value is treated as an empty array.</param>
+        /// <returns>A hashed output suitable for key material</returns>
+        /// <exception cref="ArgumentException"><paramref name="otherPartyPublicKey"/> is over a different curve than this key</exception>
+        public virtual byte[] DeriveKeyFromHash(
+            ECDiffieHellmanPublicKey otherPartyPublicKey,
+            HashAlgorithmName hashAlgorithm,
+            byte[] secretPrepend,
+            byte[] secretAppend)
+        {
+            throw DerivedClassMustOverride();
+        }
+
+        /// <summary>
+        /// Derive key material using the formula HMAC(hmacKey, x) where x is the computed
+        /// result of the EC Diffie-Hellman algorithm.
+        /// </summary>
+        /// <param name="otherPartyPublicKey">The public key of the party with which to derive a mutual secret.</param>
+        /// <param name="hashAlgorithm">The identifier for the hash algorithm to use.</param>
+        /// <param name="hmacKey">The key to use in the HMAC. A <c>null</c> value indicates that the result of the EC Diffie-Hellman algorithm should be used as the HMAC key.</param>
+        /// <returns>A hashed output suitable for key material</returns>
+        /// <exception cref="ArgumentException"><paramref name="otherPartyPublicKey"/> is over a different curve than this key</exception>
+        public byte[] DeriveKeyFromHmac(
+            ECDiffieHellmanPublicKey otherPartyPublicKey,
+            HashAlgorithmName hashAlgorithm,
+            byte[] hmacKey)
+        {
+            return DeriveKeyFromHmac(otherPartyPublicKey, hashAlgorithm, hmacKey, null, null);
+        }
+
+        /// <summary>
+        /// Derive key material using the formula HMAC(hmacKey, secretPrepend || x || secretAppend) where x is the computed
+        /// result of the EC Diffie-Hellman algorithm.
+        /// </summary>
+        /// <param name="otherPartyPublicKey">The public key of the party with which to derive a mutual secret.</param>
+        /// <param name="hashAlgorithm">The identifier for the hash algorithm to use.</param>
+        /// <param name="hmacKey">The key to use in the HMAC. A <c>null</c> value indicates that the result of the EC Diffie-Hellman algorithm should be used as the HMAC key.</param>
+        /// <param name="secretPrepend">A value to prepend to the derived secret before hashing. A <c>null</c> value is treated as an empty array.</param>
+        /// <param name="secretAppend">A value to append to the derived secret before hashing. A <c>null</c> value is treated as an empty array.</param>
+        /// <returns>A hashed output suitable for key material</returns>
+        /// <exception cref="ArgumentException"><paramref name="otherPartyPublicKey"/> is over a different curve than this key</exception>
+        public virtual byte[] DeriveKeyFromHmac(
+            ECDiffieHellmanPublicKey otherPartyPublicKey,
+            HashAlgorithmName hashAlgorithm,
+            byte[] hmacKey,
+            byte[] secretPrepend,
+            byte[] secretAppend)
+        {
+            throw DerivedClassMustOverride();
+        }
+
+        /// <summary>
+        /// Derive key material using the TLS pseudo-random function (PRF) derivation algorithm.
+        /// </summary>
+        /// <param name="otherPartyPublicKey">The public key of the party with which to derive a mutual secret.</param>
+        /// <param name="prfLabel">The ASCII encoded PRF label.</param>
+        /// <param name="prfSeed">The 64-byte PRF seed.</param>
+        /// <returns>A 48-byte output of the TLS pseudo-random function.</returns>
+        /// <exception cref="ArgumentException"><paramref name="otherPartyPublicKey"/> is over a different curve than this key</exception>
+        /// <exception cref="ArgumentNullException"><paramref name="prfLabel"/> is null</exception>
+        /// <exception cref="ArgumentNullException"><paramref name="prfSeed"/> is null</exception>
+        /// <exception cref="CryptographicException"><paramref name="prfSeed"/> is not exactly 64 bytes in length</exception>
+        public virtual byte[] DeriveKeyTls(ECDiffieHellmanPublicKey otherPartyPublicKey, byte[] prfLabel, byte[] prfSeed)
+        {
+            throw DerivedClassMustOverride();
+        }
+
+        private static Exception DerivedClassMustOverride()
+        {
+            return new NotImplementedException(SR.GetString(SR.NotSupported_SubclassOverride));
+        }
     }
 }
index ada0c1ac58a9ab6b51bbac975c9b48aab999237c..4a555dae5433b733b4bb56bed30a2d2a0e7f27a5 100644 (file)
@@ -93,7 +93,21 @@ namespace System.Security.Cryptography {
             }
             CodeAccessPermission.RevertAssert();
 
-            KeySize = m_key.KeySize;
+            // Our LegalKeySizes value stores the values that we encoded as being the correct
+            // legal key size limitations for this algorithm, as documented on MSDN.
+            //
+            // But on a new OS version we might not question if our limit is accurate, or MSDN
+            // could have been innacurate to start with.
+            //
+            // Since the key is already loaded, we know that Windows thought it to be valid;
+            // therefore we should set KeySizeValue directly to bypass the LegalKeySizes conformance
+            // check.
+            //
+            // For RSA there are known cases where this change matters. RSACryptoServiceProvider can
+            // create a 384-bit RSA key, which we consider too small to be legal. It can also create
+            // a 1032-bit RSA key, which we consider illegal because it doesn't match our 64-bit
+            // alignment requirement. (In both cases Windows loads it just fine)
+            KeySizeValue = m_key.KeySize;
         }
 
         /// <summary>
@@ -247,7 +261,22 @@ namespace System.Security.Cryptography {
                 //
 
                 m_key = value;
-                KeySize = m_key.KeySize;
+
+                // Our LegalKeySizes value stores the values that we encoded as being the correct
+                // legal key size limitations for this algorithm, as documented on MSDN.
+                //
+                // But on a new OS version we might not question if our limit is accurate, or MSDN
+                // could have been innacurate to start with.
+                //
+                // Since the key is already loaded, we know that Windows thought it to be valid;
+                // therefore we should set KeySizeValue directly to bypass the LegalKeySizes conformance
+                // check.
+                //
+                // For RSA there are known cases where this change matters. RSACryptoServiceProvider can
+                // create a 384-bit RSA key, which we consider too small to be legal. It can also create
+                // a 1032-bit RSA key, which we consider illegal because it doesn't match our 64-bit
+                // alignment requirement. (In both cases Windows loads it just fine)
+                KeySizeValue = m_key.KeySize;
             }
         }
 
@@ -369,6 +398,84 @@ namespace System.Security.Cryptography {
             }
         }
 
+        [SecuritySafeCritical]
+        public override byte[] DeriveKeyFromHash(
+            ECDiffieHellmanPublicKey otherPartyPublicKey,
+            HashAlgorithmName hashAlgorithm,
+            byte[] secretPrepend,
+            byte[] secretAppend)
+        {
+            Contract.Ensures(Contract.Result<byte[]>() != null);
+
+            if (otherPartyPublicKey == null)
+                throw new ArgumentNullException("otherPartyPublicKey");
+            if (string.IsNullOrEmpty(hashAlgorithm.Name))
+                throw new ArgumentException(SR.GetString(SR.Cryptography_HashAlgorithmNameNullOrEmpty), "hashAlgorithm");
+
+            using (SafeNCryptSecretHandle secretAgreement = DeriveSecretAgreementHandle(otherPartyPublicKey))
+            {
+                return NCryptNative.DeriveKeyMaterialHash(
+                    secretAgreement,
+                    hashAlgorithm.Name, 
+                    secretPrepend,
+                    secretAppend,
+                    NCryptNative.SecretAgreementFlags.None);
+            }
+        }
+
+        [SecuritySafeCritical]
+        public override byte[] DeriveKeyFromHmac(
+            ECDiffieHellmanPublicKey otherPartyPublicKey,
+            HashAlgorithmName hashAlgorithm,
+            byte[] hmacKey,
+            byte[] secretPrepend,
+            byte[] secretAppend)
+        {
+            Contract.Ensures(Contract.Result<byte[]>() != null);
+
+            if (otherPartyPublicKey == null)
+                throw new ArgumentNullException("otherPartyPublicKey");
+            if (string.IsNullOrEmpty(hashAlgorithm.Name))
+                throw new ArgumentException(SR.GetString(SR.Cryptography_HashAlgorithmNameNullOrEmpty), "hashAlgorithm");
+
+            using (SafeNCryptSecretHandle secretAgreement = DeriveSecretAgreementHandle(otherPartyPublicKey))
+            {
+                NCryptNative.SecretAgreementFlags flags = hmacKey == null ?
+                    NCryptNative.SecretAgreementFlags.UseSecretAsHmacKey :
+                    NCryptNative.SecretAgreementFlags.None;
+
+                return NCryptNative.DeriveKeyMaterialHmac(
+                    secretAgreement,
+                    hashAlgorithm.Name,
+                    hmacKey,
+                    secretPrepend,
+                    secretAppend,
+                    flags);
+            }
+        }
+
+        [SecuritySafeCritical]
+        public override byte[] DeriveKeyTls(ECDiffieHellmanPublicKey otherPartyPublicKey, byte[] prfLabel, byte[] prfSeed)
+        {
+            Contract.Ensures(Contract.Result<byte[]>() != null);
+
+            if (otherPartyPublicKey == null)
+                throw new ArgumentNullException("otherPartyPublicKey");
+            if (prfLabel == null)
+                throw new ArgumentNullException("prfLabel");
+            if (prfSeed == null)
+                throw new ArgumentNullException("prfSeed");
+
+            using (SafeNCryptSecretHandle secretAgreement = DeriveSecretAgreementHandle(otherPartyPublicKey))
+            {
+                return NCryptNative.DeriveKeyMaterialTls(
+                    secretAgreement,
+                    prfLabel,
+                    prfSeed,
+                    NCryptNative.SecretAgreementFlags.None);
+            }
+        }
+
         /// <summary>
         ///     Get a handle to the secret agreement generated between two parties
         /// </summary>
index 3099a3a77e38ac7b2aaca08e34b84ecd7e651f65..91e89d8be9c4bebd3d8454aca3f17be88efe8ba1 100644 (file)
@@ -40,6 +40,10 @@ namespace System.Security.Cryptography {
             return m_keyBlob.Clone() as byte[];
         }
 
-        public abstract string ToXmlString();
+        // This method must be implemented by derived classes. In order to conform to the contract, it cannot be abstract.
+        public virtual string ToXmlString()
+        {
+            throw new NotImplementedException(SR.GetString(SR.NotSupported_SubclassOverride));
+        }
     }
 }
index 40505e30ddbe9c6773aa447b759e3854ea195df4..1dcebb46d34ecd2ceb352a2d6b28e72cf71b33ab 100644 (file)
@@ -18,6 +18,15 @@ namespace System.Security.Cryptography {
     /// </summary>
     [System.Security.Permissions.HostProtection(MayLeakOnAbort = true)]
     public sealed class ECDsaCng : ECDsa {
+#if MONO
+        public override byte[] SignHash(byte[] hash) {
+            throw new NotImplementedException();
+        }
+
+        public override bool VerifyHash(byte[] hash, byte[] signature) {
+            throw new NotImplementedException();
+        }
+#else
         private static KeySizes[] s_legalKeySizes = new KeySizes[] { new KeySizes(256, 384, 128), new KeySizes(521, 521, 0) };
 
         private CngKey m_key;
@@ -45,12 +54,12 @@ namespace System.Security.Cryptography {
         [SecuritySafeCritical]
         public ECDsaCng(CngKey key) {
             Contract.Ensures(LegalKeySizesValue != null);
-            Contract.Ensures(m_key != null && m_key.AlgorithmGroup == CngAlgorithmGroup.ECDsa);
+            Contract.Ensures(m_key != null && IsEccAlgorithmGroup(m_key.AlgorithmGroup));
 
             if (key == null) {
                 throw new ArgumentNullException("key");
             }
-            if (key.AlgorithmGroup != CngAlgorithmGroup.ECDsa) {
+            if (!IsEccAlgorithmGroup(key.AlgorithmGroup)) {
                 throw new ArgumentException(SR.GetString(SR.Cryptography_ArgECDsaRequiresECDsaKey), "key");
             }
 
@@ -74,7 +83,21 @@ namespace System.Security.Cryptography {
             }
             CodeAccessPermission.RevertAssert();
 
-            KeySize = m_key.KeySize;
+            // Our LegalKeySizes value stores the values that we encoded as being the correct
+            // legal key size limitations for this algorithm, as documented on MSDN.
+            //
+            // But on a new OS version we might not question if our limit is accurate, or MSDN
+            // could have been innacurate to start with.
+            //
+            // Since the key is already loaded, we know that Windows thought it to be valid;
+            // therefore we should set KeySizeValue directly to bypass the LegalKeySizes conformance
+            // check.
+            //
+            // For RSA there are known cases where this change matters. RSACryptoServiceProvider can
+            // create a 384-bit RSA key, which we consider too small to be legal. It can also create
+            // a 1032-bit RSA key, which we consider illegal because it doesn't match our 64-bit
+            // alignment requirement. (In both cases Windows loads it just fine)
+            KeySizeValue = m_key.KeySize;
         }
 
         /// <summary>
@@ -103,8 +126,8 @@ namespace System.Security.Cryptography {
         public CngKey Key {
             get {
                 Contract.Ensures(Contract.Result<CngKey>() != null);
-                Contract.Ensures(Contract.Result<CngKey>().AlgorithmGroup == CngAlgorithmGroup.ECDsa);
-                Contract.Ensures(m_key != null && m_key.AlgorithmGroup == CngAlgorithmGroup.ECDsa);
+                Contract.Ensures(IsEccAlgorithmGroup(Contract.Result<CngKey>().AlgorithmGroup));
+                Contract.Ensures(m_key != null && IsEccAlgorithmGroup(m_key.AlgorithmGroup));
 
                 // If the size of the key no longer matches our stored value, then we need to replace it with
                 // a new key of the correct size.
@@ -142,9 +165,9 @@ namespace System.Security.Cryptography {
 
             private set {
                 Contract.Requires(value != null);
-                Contract.Ensures(m_key != null && m_key.AlgorithmGroup == CngAlgorithmGroup.ECDsa);
+                Contract.Ensures(m_key != null && IsEccAlgorithmGroup(m_key.AlgorithmGroup));
 
-                if (value.AlgorithmGroup != CngAlgorithmGroup.ECDsa) {
+                if (!IsEccAlgorithmGroup(value.AlgorithmGroup)) {
                     throw new ArgumentException(SR.GetString(SR.Cryptography_ArgECDsaRequiresECDsaKey));
                 }
 
@@ -159,7 +182,22 @@ namespace System.Security.Cryptography {
                 //
 
                 m_key = value;
-                KeySize = m_key.KeySize;
+
+                // Our LegalKeySizes value stores the values that we encoded as being the correct
+                // legal key size limitations for this algorithm, as documented on MSDN.
+                //
+                // But on a new OS version we might not question if our limit is accurate, or MSDN
+                // could have been innacurate to start with.
+                //
+                // Since the key is already loaded, we know that Windows thought it to be valid;
+                // therefore we should set KeySizeValue directly to bypass the LegalKeySizes conformance
+                // check.
+                //
+                // For RSA there are known cases where this change matters. RSACryptoServiceProvider can
+                // create a 384-bit RSA key, which we consider too small to be legal. It can also create
+                // a 1032-bit RSA key, which we consider illegal because it doesn't match our 64-bit
+                // alignment requirement. (In both cases Windows loads it just fine)
+                KeySizeValue = m_key.KeySize;
             }
         }
 
@@ -407,5 +445,16 @@ namespace System.Security.Cryptography {
                 return hasher.HashFinal();
             }
         }
+
+        private static bool IsEccAlgorithmGroup(CngAlgorithmGroup algorithmGroup)
+        {
+            // Sometimes, when reading from certificates, ECDSA keys get identified as ECDH.
+            // Windows allows the ECDH keys to perform both key exchange (ECDH) and signing (ECDSA),
+            // so either value is acceptable for the ECDSA wrapper object.
+            //
+            // It is worth noting, however, that ECDSA-identified keys cannot be used for key exchange (ECDH) in CNG.
+            return algorithmGroup == CngAlgorithmGroup.ECDsa || algorithmGroup == CngAlgorithmGroup.ECDiffieHellman;
+        }
+#endif
     }
 }
index cf56209111a9c171735eacd0a6f0e074366cdfb8..9faf5ee01b1417400249c2658cafe30c9cec9a28 100644 (file)
@@ -8,7 +8,9 @@ using System;
 using System.Collections.Generic;
 using System.Diagnostics;
 using System.Diagnostics.CodeAnalysis;
+#if !MONO
 using System.Numerics;
+#endif
 using System.Runtime.CompilerServices;
 using System.Runtime.ConstrainedExecution;
 using System.Runtime.InteropServices;
@@ -100,7 +102,7 @@ namespace System.Security.Cryptography {
         ProtectKey = 0x00000001,                        // NCRYPT_UI_PROTECT_KEY_FLAG    
         ForceHighProtection = 0x00000002                // NCRYPT_UI_FORCE_HIGH_PROTECTION_FLAG
     }
-
+#if !MONO
     /// <summary>
     ///     Native interop with CNG's NCrypt layer. Native definitions are in ncrypt.h
     /// </summary>
@@ -794,10 +796,6 @@ namespace System.Security.Cryptography {
                                        signature,
                                        signature.Length,
                                        paddingMode);
-            if (error != ErrorCode.Success && error != ErrorCode.BadSignature) {
-                throw new CryptographicException((int)error);
-            }
-
             return error == ErrorCode.Success;
         }
 
@@ -1692,6 +1690,55 @@ namespace System.Security.Cryptography {
             return signature;
         }
 
+        /// <summary>
+        ///     Sign a hash using no padding
+        /// </summary>
+        [System.Security.SecurityCritical]
+        internal static byte[] SignHash(SafeNCryptKeyHandle key, byte[] hash, int expectedSize)
+        {
+            Contract.Requires(key != null);
+            Contract.Requires(hash != null);
+            Contract.Ensures(Contract.Result<byte[]>() != null);
+
+#if DEBUG
+            expectedSize = 1;
+#endif
+
+            // Figure out how big the signature is
+            byte[] signature = new byte[expectedSize];
+            int signatureSize = 0;
+            ErrorCode error = UnsafeNativeMethods.NCryptSignHash(key,
+                                                                 IntPtr.Zero,
+                                                                 hash,
+                                                                 hash.Length,
+                                                                 signature,
+                                                                 signature.Length,
+                                                                 out signatureSize,
+                                                                 0);
+
+            if (error == ErrorCode.BufferTooSmall)
+            {
+                signature = new byte[signatureSize];
+
+                error = UnsafeNativeMethods.NCryptSignHash(key,
+                                                           IntPtr.Zero,
+                                                           hash,
+                                                           hash.Length,
+                                                           signature,
+                                                           signature.Length,
+                                                           out signatureSize,
+                                                           0);
+            }
+
+            if (error != ErrorCode.Success)
+            {
+                throw new CryptographicException((int)error);
+            }
+
+            Array.Resize(ref signature, signatureSize);
+            return signature;
+        }
+
         /// <summary>
         ///     Unpack a key blob in ECC public blob format into its X and Y parameters
         /// 
@@ -1734,11 +1781,8 @@ namespace System.Security.Cryptography {
                                                                         signature.Length,
                                                                         0);
 
-            if (error != ErrorCode.Success && error != ErrorCode.BadSignature) {
-                throw new CryptographicException((int)error);
-            }
-
             return error == ErrorCode.Success;
         }
     }
+#endif
 }
index 3085b90e249ff54818d0129dc44c4a6548f73da6..dda03fe7f378ae3ed0e1e9e785068e3941c4edc0 100644 (file)
@@ -10,6 +10,18 @@ namespace System.Security.Cryptography
 {
     public sealed class RSACng : RSA
     {
+#if MONO
+        public override RSAParameters ExportParameters(bool includePrivateParameters)
+        {
+            throw new NotImplementedException();
+        }
+
+        public override void ImportParameters(RSAParameters parameters)
+        {
+            throw new NotImplementedException();
+        }
+#else
+
         // See https://msdn.microsoft.com/en-us/library/windows/desktop/bb931354(v=vs.85).aspx
         private static KeySizes[] s_legalKeySizes = new KeySizes[] { new KeySizes(512, 16384, 64) };
 
@@ -89,7 +101,11 @@ namespace System.Security.Cryptography
                 // If we don't have a key yet, we need to generate a random one now
                 if (_key == null)
                 {
-                    CngKeyCreationParameters creationParameters = new CngKeyCreationParameters();
+                    CngKeyCreationParameters creationParameters = new CngKeyCreationParameters()
+                    {
+                        ExportPolicy = CngExportPolicies.AllowPlaintextExport,
+                    };
+
                     CngProperty keySizeProperty = new CngProperty(NCryptNative.KeyPropertyName.Length,
                                                                   BitConverter.GetBytes(KeySize),
                                                                   CngPropertyOptions.None);
@@ -114,7 +130,22 @@ namespace System.Security.Cryptography
                 }
 
                 _key = value;
-                KeySize = _key.KeySize;
+
+                // Our LegalKeySizes value stores the values that we encoded as being the correct
+                // legal key size limitations for this algorithm, as documented on MSDN.
+                //
+                // But on a new OS version we might not question if our limit is accurate, or MSDN
+                // could have been innacurate to start with.
+                //
+                // Since the key is already loaded, we know that Windows thought it to be valid;
+                // therefore we should set KeySizeValue directly to bypass the LegalKeySizes conformance
+                // check.
+                //
+                // For RSA there are known cases where this change matters. RSACryptoServiceProvider can
+                // create a 384-bit RSA key, which we consider too small to be legal. It can also create
+                // a 1032-bit RSA key, which we consider illegal because it doesn't match our 64-bit
+                // alignment requirement. (In both cases Windows loads it just fine)
+                KeySizeValue = _key.KeySize;
             }
         }
 
@@ -504,5 +535,25 @@ namespace System.Security.Cryptography
                  throw new CryptographicException(SR.GetString(SR.Cryptography_UnsupportedPaddingMode));
             }
         }
+
+        /*
+         * The members
+         *   DecryptValue
+         *   EncryptValue
+         *   get_KeyExchangeAlgorithm
+         *   get_SignatureAlgorithm
+         * are all implemented on RSA as of net46.
+         *
+         * But in servicing situations, System.Core.dll can get patched onto a machine which has mscorlib < net46, meaning
+         * these abstract members have no implementation.
+         *
+         * To keep servicing simple, we'll redefine the overrides here. Since this type is sealed it only affects reflection,
+         * as there are no derived types to mis-target base.-invocations.
+         */
+        public override byte[] DecryptValue(byte[] rgb) { throw new NotSupportedException(SR.NotSupported_Method); }
+        public override byte[] EncryptValue(byte[] rgb) { throw new NotSupportedException(SR.NotSupported_Method); }
+        public override string KeyExchangeAlgorithm { get { return "RSA"; } }
+        public override string SignatureAlgorithm { get { return "RSA"; } }
+#endif
     }
 }
index e4ef01d3e6444fb6a8b667c41b4c344cf832e44a..a69b7ed8aab5202bf28520e5d0c96d5a9c614d0d 100644 (file)
@@ -71,8 +71,14 @@ namespace System.Security.Cryptography.X509Certificates
             {
                 if (privateKeyHandle == null)
                 {
+                    if (LocalAppContextSwitches.DontReliablyClonePrivateKey)
+                        return (RSA)certificate.PrivateKey;
+
                     // fall back to CAPI if we cannot acquire the key using CNG.
-                    return (RSA)certificate.PrivateKey;
+                    RSACryptoServiceProvider rsaCsp = (RSACryptoServiceProvider)certificate.PrivateKey;
+                    CspParameters cspParameters = DSACertificateExtensions.CopyCspParameters(rsaCsp);
+                    RSACryptoServiceProvider clone = new RSACryptoServiceProvider(cspParameters);
+                    return clone;
                 }
 
                 CngKey key = CngKey.Open(privateKeyHandle, CngKeyHandleOpenOptions.None);
index 1ab0fb9122e258c0ea7f8db5bd0515974b3690d3..8d7a31911c0c02eb8a7f9a9faf85b0c089a65340 100644 (file)
@@ -833,6 +833,8 @@ namespace System.Data.Common.Utils
 
         [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Cryptographic.Standard", "CA5350:Microsoft.Cryptographic.Standard", 
             Justification = "MD5CryptoServiceProvider is not used for cryptography/security purposes and we do it only for v1 and v1.1 for compatibility reasons.")]
+        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security.Cryptography", "CA5350:Microsoft.Cryptographic.Standard", 
+            Justification = "MD5CryptoServiceProvider is not used for cryptography/security purposes and we do it only for v1 and v1.1 for compatibility reasons.")]
         internal static HashAlgorithm CreateMetadataHashAlgorithm(double schemaVersion)
         {
             HashAlgorithm hashAlgorithm;
index a0388683aac19fa6d9eba4bd1693583133cebe0f..adb7b34c74d95db746287d36f2e1725400f66cbe 100644 (file)
@@ -1253,6 +1253,7 @@ namespace System.Data.EntityModel.SchemaObjectModel
                 return schemaSet;
             }
 
+            [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security.Xml", "CA3060:UseXmlReaderForSchemaRead", Justification = "The schema files are embedded in the product assembly as resources")]
             private static void AddXmlSchemaToSet(XmlSchemaSet schemaSet, XmlSchemaResource schemaResource, HashSet<string> schemasAlreadyAdded)
             {
                 // loop through the children to do a depth first load
index e1c869221fa43552e2ba4aeda158583a553d307c..f671178fc0c4bde44e8228f097fdf8007979ec69 100644 (file)
@@ -2289,8 +2289,8 @@ namespace System.Xml.Xsl.IlGen {
                     if (local3.NodeType == QilNodeType.Loop) {
                         QilNode local4 = local3[0];
                         QilNode local5 = local3[1];
-                        if ( NonPositional(local2, local1) ) {
-                            // PATTERN: [CommuteFilterLoop] (Filter $iter:(For (Loop $iter2:* $ret2:*)) $cond:* ^ (NonPositional? $cond $iter)) => (Loop $iter2 (Filter $iter3:(For $ret2) (Subs $cond $iter $iter3)))
+                        if (( NonPositional(local2, local1) ) && (!( IsDocOrderDistinct(local3) ))) {
+                            // PATTERN: [CommuteFilterLoop] (Filter $iter:(For $loop:(Loop $iter2:* $ret2:*)) $cond:* ^ (NonPositional? $cond $iter) ^ ~((DocOrderDistinct? $loop))) => (Loop $iter2 (Filter $iter3:(For $ret2) (Subs $cond $iter $iter3)))
                             if (AllowReplace(XmlILOptimization.CommuteFilterLoop, local0)) {
                                 QilNode local6 = VisitFor(f.For(local5));
                                 return Replace(XmlILOptimization.CommuteFilterLoop, local0, VisitLoop(f.Loop(local4, VisitFilter(f.Filter(local6,  Subs(local2, local1, local6) )))));
index e1981b6b9dea8edd2177c16996131f8e9714e3a6..24be05dfc29dd7ee0fb6bf67d42541d9c154b058 100644 (file)
@@ -323,6 +323,143 @@ namespace System.Data.Common {
             }
         }
 
+        #region <<PoolBlockingPeriod Utility>>
+        const string PoolBlockingPeriodAutoString = "Auto";
+        const string PoolBlockingPeriodAlwaysBlockString = "AlwaysBlock";
+        const string PoolBlockingPeriodNeverBlockString = "NeverBlock";
+
+        internal static bool TryConvertToPoolBlockingPeriod(string value, out PoolBlockingPeriod result)
+        {
+            Debug.Assert(Enum.GetNames(typeof(PoolBlockingPeriod)).Length == 3, "PoolBlockingPeriod enum has changed, update needed");
+            Debug.Assert(null != value, "TryConvertToPoolBlockingPeriod(null,...)");
+
+            if (StringComparer.OrdinalIgnoreCase.Equals(value, PoolBlockingPeriodAutoString))
+            {
+                result = PoolBlockingPeriod.Auto;
+                return true;
+            }
+            else if (StringComparer.OrdinalIgnoreCase.Equals(value, PoolBlockingPeriodAlwaysBlockString))
+            {
+                result = PoolBlockingPeriod.AlwaysBlock;
+                return true;
+            }
+            else if (StringComparer.OrdinalIgnoreCase.Equals(value, PoolBlockingPeriodNeverBlockString))
+            {
+                result = PoolBlockingPeriod.NeverBlock;
+                return true;
+            }
+            else
+            {
+                result = DbConnectionStringDefaults.PoolBlockingPeriod;
+                return false;
+            }
+        }
+
+        internal static bool IsValidPoolBlockingPeriodValue(PoolBlockingPeriod value)
+        {
+            Debug.Assert(Enum.GetNames(typeof(PoolBlockingPeriod)).Length == 3, "PoolBlockingPeriod enum has changed, update needed");
+            return value == PoolBlockingPeriod.Auto || value == PoolBlockingPeriod.AlwaysBlock || value == PoolBlockingPeriod.NeverBlock;
+        }
+
+        internal static string PoolBlockingPeriodToString(PoolBlockingPeriod value)
+        {
+            Debug.Assert(IsValidPoolBlockingPeriodValue(value));
+            
+            if (value == PoolBlockingPeriod.AlwaysBlock)
+            {
+                return PoolBlockingPeriodAlwaysBlockString;
+            }
+            if (value == PoolBlockingPeriod.NeverBlock)
+            {
+                return PoolBlockingPeriodNeverBlockString;
+            }
+            else
+            {
+                return PoolBlockingPeriodAutoString;
+            }
+        }
+
+        /// <summary>
+        /// This method attempts to convert the given value to a PoolBlockingPeriod enum. The algorithm is:
+        /// * if the value is from type string, it will be matched against PoolBlockingPeriod enum names only, using ordinal, case-insensitive comparer
+        /// * if the value is from type PoolBlockingPeriod, it will be used as is
+        /// * if the value is from integral type (SByte, Int16, Int32, Int64, Byte, UInt16, UInt32, or UInt64), it will be converted to enum
+        /// * if the value is another enum or any other type, it will be blocked with an appropriate ArgumentException
+        /// 
+        /// in any case above, if the conerted value is out of valid range, the method raises ArgumentOutOfRangeException.
+        /// </summary>
+        /// <returns>PoolBlockingPeriod value in the valid range</returns>
+        internal static PoolBlockingPeriod ConvertToPoolBlockingPeriod(string keyword, object value)
+        {
+            Debug.Assert(null != value, "ConvertToPoolBlockingPeriod(null)");
+            string sValue = (value as string);
+            PoolBlockingPeriod result;
+            if (null != sValue)
+            {
+                // We could use Enum.TryParse<PoolBlockingPeriod> here, but it accepts value combinations like
+                // "ReadOnly, ReadWrite" which are unwelcome here
+                // Also, Enum.TryParse is 100x slower than plain StringComparer.OrdinalIgnoreCase.Equals method.
+
+                if (TryConvertToPoolBlockingPeriod(sValue, out result))
+                {
+                    return result;
+                }
+
+                // try again after remove leading & trailing whitespaces.
+                sValue = sValue.Trim();
+                if (TryConvertToPoolBlockingPeriod(sValue, out result))
+                {
+                    return result;
+                }
+
+                // string values must be valid
+                throw ADP.InvalidConnectionOptionValue(keyword);
+            }
+            else
+            {
+                // the value is not string, try other options
+                PoolBlockingPeriod eValue;
+
+                if (value is PoolBlockingPeriod)
+                {
+                    // quick path for the most common case
+                    eValue = (PoolBlockingPeriod)value;
+                }
+                else if (value.GetType().IsEnum)
+                {
+                    // explicitly block scenarios in which user tries to use wrong enum types, like:
+                    // builder["PoolBlockingPeriod"] = EnvironmentVariableTarget.Process;
+                    // workaround: explicitly cast non-PoolBlockingPeriod enums to int
+                    throw ADP.ConvertFailed(value.GetType(), typeof(PoolBlockingPeriod), null);
+                }
+                else
+                {
+                    try
+                    {
+                        // Enum.ToObject allows only integral and enum values (enums are blocked above), rasing ArgumentException for the rest
+                        eValue = (PoolBlockingPeriod)Enum.ToObject(typeof(PoolBlockingPeriod), value);
+                    }
+                    catch (ArgumentException e)
+                    {
+                        // to be consistent with the messages we send in case of wrong type usage, replace 
+                        // the error with our exception, and keep the original one as inner one for troubleshooting
+                        throw ADP.ConvertFailed(value.GetType(), typeof(PoolBlockingPeriod), e);
+                    }
+                }
+
+                // ensure value is in valid range
+                if (IsValidPoolBlockingPeriodValue(eValue))
+                {
+                    return eValue;
+                }
+                else
+                {
+                    throw ADP.InvalidEnumerationValue(typeof(ApplicationIntent), (int)eValue);
+                }
+            }
+        }
+        #endregion
+
         const string ApplicationIntentReadWriteString = "ReadWrite";
         const string ApplicationIntentReadOnlyString = "ReadOnly";
 
@@ -752,6 +889,7 @@ namespace System.Data.Common {
                internal const int    ConnectRetryInterval           = 10;
         internal static readonly SqlAuthenticationMethod Authentication = SqlAuthenticationMethod.NotSpecified;
         internal static readonly SqlConnectionColumnEncryptionSetting ColumnEncryptionSetting = SqlConnectionColumnEncryptionSetting.Disabled;
+        internal const PoolBlockingPeriod PoolBlockingPeriod = SqlClient.PoolBlockingPeriod.Auto;
     }
 
     internal static class DbConnectionOptionKeywords {
@@ -819,6 +957,7 @@ namespace System.Data.Common {
                internal const string Authentication                 = "Authentication";
                internal const string Certificate                    = "Certificate";
                internal const string ColumnEncryptionSetting        = "Column Encryption Setting";
+        internal const string PoolBlockingPeriod             = "PoolBlockingPeriod";
         
         // common keywords (OleDb, OracleClient, SqlClient)
         internal const string DataSource                = "Data Source";
index cb0c072a6596823dda1c71424cf7f7567719a28b..44d81f07e1ef51520c0677f750ff35d1e6774efc 100644 (file)
@@ -2122,7 +2122,12 @@ namespace System.Data {
             if (stream == null)
                 return XmlReadMode.Auto;
 
-            return ReadXml(new XmlTextReader(stream), false);
+            XmlTextReader xr = new XmlTextReader(stream);
+
+            // Prevent Dtd entity in dataset 
+            xr.XmlResolver = null;
+
+            return ReadXml(xr, false);
         }
 
         /// <devdoc>
@@ -2132,7 +2137,12 @@ namespace System.Data {
             if (reader == null)
                 return XmlReadMode.Auto;
 
-            return ReadXml(new XmlTextReader(reader), false);
+            XmlTextReader xr = new XmlTextReader(reader);
+
+            // Prevent Dtd entity in dataset 
+            xr.XmlResolver = null;
+
+            return ReadXml(xr, false);
         }
 
         /// <devdoc>
@@ -2142,7 +2152,12 @@ namespace System.Data {
         public XmlReadMode ReadXml(string fileName)
         {
             XmlTextReader xr = new XmlTextReader(fileName);
-            try {
+
+            // Prevent Dtd entity in dataset 
+            xr.XmlResolver = null;
+
+            try
+            {
                 return ReadXml(xr, false);
             }
             finally {
@@ -2520,6 +2535,8 @@ namespace System.Data {
                 return XmlReadMode.Auto;
 
             XmlTextReader reader = (mode == XmlReadMode.Fragment) ? new XmlTextReader(stream, XmlNodeType.Element, null) : new XmlTextReader(stream);
+            // Prevent Dtd entity in dataset 
+            reader.XmlResolver = null;
             return ReadXml(reader, mode, false);
         }
 
@@ -2531,6 +2548,8 @@ namespace System.Data {
                 return XmlReadMode.Auto;
 
             XmlTextReader xmlreader = (mode == XmlReadMode.Fragment) ? new XmlTextReader(reader.ReadToEnd(), XmlNodeType.Element, null) : new XmlTextReader(reader);
+            // Prevent Dtd entity in dataset 
+            xmlreader.XmlResolver = null;
             return ReadXml(xmlreader, mode, false);
         }
 
@@ -2547,7 +2566,12 @@ namespace System.Data {
             }
             else
                 xr = new XmlTextReader(fileName);
-            try {
+
+            // Prevent Dtd entity in dataset             
+            xr.XmlResolver = null;
+
+            try
+            {
                 return ReadXml(xr, mode, false);
             }
             finally {
index 637816ef0c379f684e5e1133aca1e168b9896e41..24673fa5c5120d868cf61c9ab74da5abe2261022 100644 (file)
@@ -5044,7 +5044,12 @@ namespace System.Data {
             if (stream == null)
                 return XmlReadMode.Auto;
 
-            return ReadXml( new XmlTextReader(stream), false);
+            XmlTextReader xr = new XmlTextReader(stream);
+
+            // Prevent Dtd entity in DataTable 
+            xr.XmlResolver = null;
+
+            return ReadXml(xr, false);
         }
 
         public XmlReadMode ReadXml(TextReader reader)
@@ -5052,7 +5057,12 @@ namespace System.Data {
             if (reader == null)
                 return XmlReadMode.Auto;
 
-            return ReadXml( new XmlTextReader(reader), false);
+            XmlTextReader xr = new XmlTextReader(reader);
+
+            // Prevent Dtd entity in DataTable 
+            xr.XmlResolver = null;
+
+            return ReadXml(xr, false);
         }
 
         [ResourceExposure(ResourceScope.Machine)]
@@ -5060,7 +5070,12 @@ namespace System.Data {
         public XmlReadMode ReadXml(string fileName)
         {
             XmlTextReader xr = new XmlTextReader(fileName);
-            try {
+
+            // Prevent Dtd entity in DataTable 
+            xr.XmlResolver = null;
+
+            try
+            {
                 return ReadXml( xr , false);
             }
             finally {
index 5b5743725f9af7606751f7ce84d20a29cabc57f5..dd0b6ad4bb3057b466d8c29e752c5ad1745a8a80 100644 (file)
@@ -12,6 +12,7 @@ namespace System.Data.ProviderBase {
     using System.Collections;
     using System.Collections.Generic;
     using System.Data.Common;
+    using System.Data.SqlClient;
     using System.Diagnostics;
     using System.Globalization;
     using System.Runtime.CompilerServices;
@@ -756,7 +757,81 @@ namespace System.Data.ProviderBase {
         private Timer CreateCleanupTimer() {
             return (new Timer(new TimerCallback(this.CleanupCallback), null, _cleanupWait, _cleanupWait));
         }
-        
+
+        private static readonly string[] AzureSqlServerEndpoints = {Res.GetString(Res.AZURESQL_GenericEndpoint),
+                                                                    Res.GetString(Res.AZURESQL_GermanEndpoint),
+                                                                    Res.GetString(Res.AZURESQL_UsGovEndpoint),
+                                                                    Res.GetString(Res.AZURESQL_ChinaEndpoint) };
+        private static bool IsAzureSqlServerEndpoint(string dataSource)
+        {
+            // remove server port
+            var i = dataSource.LastIndexOf(',');
+            if (i >= 0)
+            {
+                dataSource = dataSource.Substring(0, i);
+            }
+
+            // check for the instance name
+            i = dataSource.LastIndexOf('\\');
+            if (i >= 0)
+            {
+                dataSource = dataSource.Substring(0, i);
+            }
+
+            // trim redundant whitespaces
+            dataSource = dataSource.Trim();
+
+            // check if servername end with any azure endpoints
+            for (i = 0; i < AzureSqlServerEndpoints.Length; i++)
+            {
+                if (dataSource.EndsWith(AzureSqlServerEndpoints[i], StringComparison.OrdinalIgnoreCase))
+                {
+                    return true;
+                }
+            }
+            return false;
+        }
+
+        private bool IsBlockingPeriodEnabled()
+        {
+            var poolGroupConnectionOptions = _connectionPoolGroup.ConnectionOptions as SqlConnectionString;
+            if (poolGroupConnectionOptions == null)
+            {
+                return true;
+            }
+
+            var policy = poolGroupConnectionOptions.PoolBlockingPeriod;
+
+            switch (policy)
+            {
+                case PoolBlockingPeriod.Auto:
+                {
+                    if (IsAzureSqlServerEndpoint(poolGroupConnectionOptions.DataSource))
+                    {
+                        return false; // in Azure it will be Disabled
+                    }
+                    else
+                    {
+                        return true; // in Non Azure, it will be Enabled
+                    }
+                }
+                case PoolBlockingPeriod.AlwaysBlock:
+                {
+                    return true; //Enabled
+                }
+                case PoolBlockingPeriod.NeverBlock:
+                {
+                    return false; //Disabled
+                }
+                default:
+                {
+                    //we should never get into this path.
+                    Debug.Fail("Unknown PoolBlockingPeriod. Please specify explicit results in above switch case statement.");
+                    return true;
+                }
+            }
+        }
+
         private DbConnectionInternal CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) {
             DbConnectionInternal newObj = null;
 
@@ -797,7 +872,7 @@ namespace System.Data.ProviderBase {
                 // Reset the error wait:
                 _errorWait = ERROR_WAIT_DEFAULT;
             }
-            catch(Exception e)  {
+            catch(Exception e)   {
                 // 
                 if (!ADP.IsCatchableExceptionType(e)) {
                     throw;
@@ -805,6 +880,11 @@ namespace System.Data.ProviderBase {
 
                 ADP.TraceExceptionForCapture(e);
 
+                if (!IsBlockingPeriodEnabled())
+                {
+                    throw;
+                }
+
                 newObj = null; // set to null, so we do not return bad new object
                 // Failed to create instance
                 _resError = e;
index 112108ae14bf73a2c6258526477d51829460271a..501ed7c91507a590976492fe4f1e503dafe62207 100644 (file)
@@ -15,10 +15,9 @@ namespace System.Data.SqlClient
     /// Base class containing raw key bytes for symmetric key algorithms. Some encryption algorithms can use the key directly while others derive sub keys from this.
     /// If an algorithm needs to derive more keys, have a derived class from this and use it in the corresponding encryption algorithm.
     /// </summary>
-    internal class SqlClientSymmetricKey
-    {
+    internal class SqlClientSymmetricKey {
         /// <summary>
-        /// DPAPI protected key
+        /// The underlying key material
         /// </summary>
         protected readonly byte[] _rootKey;
 
@@ -26,8 +25,7 @@ namespace System.Data.SqlClient
         /// Constructor that initializes the root key.
         /// </summary>
         /// <param name="rootKey">root key</param>
-        internal SqlClientSymmetricKey(byte[] rootKey)
-        {
+        internal SqlClientSymmetricKey(byte[] rootKey) {
             // Key validation
             if (rootKey == null || rootKey.Length == 0) {
                 throw SQL.NullColumnEncryptionKeySysErr();
@@ -36,14 +34,24 @@ namespace System.Data.SqlClient
             _rootKey = rootKey;
         }
 
+        /// <summary>
+        /// Destructor that cleans up the key material.
+        /// This is a best effort approach since there are no guarantees around GC.
+        /// </summary>
+        ~SqlClientSymmetricKey() {
+            if (_rootKey != null) {
+                for (int i = 0; i < _rootKey.Length; i++) {
+                    _rootKey[i] = 0;
+                }
+            }
+        }
+
         /// <summary>
         /// Returns a copy of the plain text key
         /// This is needed for actual encryption/decryption.
         /// </summary>
-        internal virtual byte[] RootKey
-        {
-            get 
-            {
+        internal virtual byte[] RootKey {
+            get {
                 return _rootKey; 
             }
         }
@@ -52,8 +60,7 @@ namespace System.Data.SqlClient
         /// Computes SHA256 value of the plain text key bytes
         /// </summary>
         /// <returns>A string containing SHA256 hash of the root key</returns>
-        internal virtual string GetKeyHash()
-        {
+        internal virtual string GetKeyHash() {
             return SqlSecurityUtility.GetSHA256Hash(RootKey);
         }
 
@@ -63,10 +70,7 @@ namespace System.Data.SqlClient
         /// <returns>
         /// Returns the length of the root key
         /// </returns>
-        internal virtual int Length()
-        {
-            // Note: DPAPI preserves the original byte length
-            // so for now, this is as same as returning the length of the raw key.
+        internal virtual int Length() {
             return _rootKey.Length;
         }
     }
index 2e560dbf344a2a5ef4577863f3342dc13d2498de..46a53537089cdd872b7c8964bfc4fc8718f9c782 100644 (file)
@@ -81,7 +81,12 @@ namespace System.Data.SqlClient {
         /// Force the client to sleep during sp_describe_parameter_encryption after ReadDescribeEncryptionParameterResults.
         /// </summary>
         private static bool _sleepAfterReadDescribeEncryptionParameterResults = false;
-#endif
+
+        /// <summary>
+        /// Internal flag for testing purposes that forces all queries to internally end async calls.
+        /// </summary>
+        private static bool _forceInternalEndQuery = false;
+#endif 
 
         // devnote: Prepare
         // Against 7.0 Server (Sphinx) a prepare/unprepare requires an extra roundtrip to the server.
@@ -287,6 +292,16 @@ namespace System.Data.SqlClient {
             }
         }
 
+        /// <summary>
+        /// A flag to indicate if EndExecute was already initiated by the Begin call.
+        /// </summary>
+        private volatile bool _internalEndExecuteInitiated;
+
+        /// <summary>
+        /// A flag to indicate whether we postponed caching the query metadata for this command.
+        /// </summary>
+        internal bool CachingQueryMetadataPostponed { get; set; }
+
         //
         //  Smi execution-specific stuff
         //
@@ -1170,7 +1185,8 @@ namespace System.Data.SqlClient {
             try {
                 statistics = SqlStatistics.StartTimer(Statistics);
                 WriteBeginExecuteEvent();
-                InternalExecuteNonQuery(null, ADP.ExecuteNonQuery, false, CommandTimeout);
+                bool usedCache;
+                InternalExecuteNonQuery(null, ADP.ExecuteNonQuery, false, CommandTimeout, out usedCache);
                 success = true;
                 return _rowsAffected;
             }
@@ -1199,7 +1215,8 @@ namespace System.Data.SqlClient {
             Bid.ScopeEnter(out hscp, "<sc.SqlCommand.ExecuteToPipe|INFO> %d#", ObjectID);
             try {
                 statistics = SqlStatistics.StartTimer(Statistics);
-                InternalExecuteNonQuery(null, ADP.ExecuteNonQuery, true, CommandTimeout);
+                bool usedCache;
+                InternalExecuteNonQuery(null, ADP.ExecuteNonQuery, true, CommandTimeout, out usedCache);
             }
             finally {
                 SqlStatistics.StopTimer(statistics);
@@ -1217,34 +1234,41 @@ namespace System.Data.SqlClient {
         public IAsyncResult BeginExecuteNonQuery(AsyncCallback callback, object stateObject) {
             Bid.CorrelationTrace("<sc.SqlCommand.BeginExecuteNonQuery|API|Correlation> ObjectID%d#, ActivityID %ls\n", ObjectID);
             SqlConnection.ExecutePermission.Demand();
-            return BeginExecuteNonQueryInternal(callback, stateObject, 0);
+            return BeginExecuteNonQueryInternal(0, callback, stateObject, 0, inRetry: false);
         }
 
         private IAsyncResult BeginExecuteNonQueryAsync(AsyncCallback callback, object stateObject) {
-            return BeginExecuteNonQueryInternal(callback, stateObject, CommandTimeout, asyncWrite:true);
+            return BeginExecuteNonQueryInternal(0, callback, stateObject, CommandTimeout, inRetry: false, asyncWrite:true);
         }
 
-        private IAsyncResult BeginExecuteNonQueryInternal(AsyncCallback callback, object stateObject, int timeout, bool asyncWrite = false) {
-            // Reset _pendingCancel upon entry into any Execute - used to synchronize state
-            // between entry into Execute* API and the thread obtaining the stateObject.
-            _pendingCancel = false;
+        private IAsyncResult BeginExecuteNonQueryInternal(CommandBehavior behavior, AsyncCallback callback, object stateObject, int timeout, bool inRetry, bool asyncWrite = false) {
+            TaskCompletionSource<object> globalCompletion = new TaskCompletionSource<object>(stateObject);
+            TaskCompletionSource<object> localCompletion = new TaskCompletionSource<object>(stateObject);
+
+            if (!inRetry) {
+                // Reset _pendingCancel upon entry into any Execute - used to synchronize state
+                // between entry into Execute* API and the thread obtaining the stateObject.
+                _pendingCancel = false;
+
+                ValidateAsyncCommand(); // Special case - done outside of try/catches to prevent putting a stateObj
+                                        // back into pool when we should not.
+            }
 
-            ValidateAsyncCommand(); // Special case - done outside of try/catches to prevent putting a stateObj
-                                    // back into pool when we should not.
-            
             SqlStatistics statistics = null;
             try {
-                statistics = SqlStatistics.StartTimer(Statistics);
-                WriteBeginExecuteEvent();
-                TaskCompletionSource<object> completion = new TaskCompletionSource<object>(stateObject);
+                if (!inRetry) {
+                    statistics = SqlStatistics.StartTimer(Statistics);
+                    WriteBeginExecuteEvent();
+                }
 
+                bool usedCache;
                 try { // InternalExecuteNonQuery already has reliability block, but if failure will not put stateObj back into pool.
-                    Task execNQ = InternalExecuteNonQuery(completion, ADP.BeginExecuteNonQuery, false, timeout, asyncWrite);
+                    Task execNQ = InternalExecuteNonQuery(localCompletion, ADP.BeginExecuteNonQuery, false, timeout, out usedCache, asyncWrite, inRetry: inRetry);
                     if (execNQ != null) {
-                        AsyncHelper.ContinueTask(execNQ, completion, () => BeginExecuteNonQueryInternalReadStage(completion));
+                        AsyncHelper.ContinueTask(execNQ, localCompletion, () => BeginExecuteNonQueryInternalReadStage(localCompletion));
                     }
                     else {
-                        BeginExecuteNonQueryInternalReadStage(completion);
+                        BeginExecuteNonQueryInternalReadStage(localCompletion);
                     }
                 }
                 catch (Exception e) {
@@ -1258,12 +1282,18 @@ namespace System.Data.SqlClient {
                     throw;
                 }
 
+                // When we use query caching for parameter encryption we need to retry on specific errors.
+                // In these cases finalize the call internally and trigger a retry when needed.
+                if (!TriggerInternalEndAndRetryIfNecessary(behavior, stateObject, timeout, ADP.EndExecuteNonQuery, usedCache, inRetry, asyncWrite, globalCompletion, localCompletion, InternalEndExecuteNonQuery, BeginExecuteNonQueryInternal)) {
+                    globalCompletion = localCompletion;
+                }
+
                 // Add callback after work is done to avoid overlapping Begin\End methods
                 if (callback != null) {
-                    completion.Task.ContinueWith((t) => callback(t), TaskScheduler.Default);
+                    globalCompletion.Task.ContinueWith((t) => callback(t), TaskScheduler.Default);
                 }
 
-                return completion.Task;
+                return globalCompletion.Task;
             }
             finally {
                 SqlStatistics.StopTimer(statistics);
@@ -1319,7 +1349,7 @@ namespace System.Data.SqlClient {
             }
         }
 
-        private void VerifyEndExecuteState(Task completionTask, String endMethod) {
+        private void VerifyEndExecuteState(Task completionTask, String endMethod, bool fullCheckForColumnEncryption = false) {
             if (null == completionTask) {
                 throw ADP.ArgumentNull("asyncResult");
             }
@@ -1340,7 +1370,7 @@ namespace System.Data.SqlClient {
 
             // If transparent parameter encryption was attempted, then we need to skip other checks like those on EndMethodName
             // since we want to wait for async results before checking those fields.
-            if (IsColumnEncryptionEnabled) {
+            if (IsColumnEncryptionEnabled && !fullCheckForColumnEncryption) {
                 if (_activeConnection.State != ConnectionState.Open) {
                     // If the connection is not 'valid' then it was closed while we were executing
                     throw ADP.ClosedConnectionError();
@@ -1361,13 +1391,24 @@ namespace System.Data.SqlClient {
             }
         }
 
-        private void WaitForAsyncResults(IAsyncResult asyncResult) {
+        private void WaitForAsyncResults(IAsyncResult asyncResult, bool isInternal) {
             Task completionTask = (Task) asyncResult;
             if (!asyncResult.IsCompleted) {
                 asyncResult.AsyncWaitHandle.WaitOne();
             }
-            _stateObj._networkPacketTaskSource = null;
-            _activeConnection.GetOpenTdsConnection().DecrementAsyncCount();
+
+            if (_stateObj != null) {
+                _stateObj._networkPacketTaskSource = null;
+            }
+
+            // If this is an internal command we will decrement the count when the End method is actually called by the user.
+            // If we are using Column Encryption and the previous task failed, the async count should have already been fixed up. 
+            // There is a generic issue in how we handle the async count because:
+            // a) BeginExecute might or might not clean it up on failure.
+            // b) In EndExecute, we check the task state before waiting and throw if it's failed, whereas if we wait we will always adjust the count.
+            if (!isInternal && (!IsColumnEncryptionEnabled || !completionTask.IsFaulted)) {
+                _activeConnection.GetOpenTdsConnection().DecrementAsyncCount();
+            }
         }
 
         public int EndExecuteNonQuery(IAsyncResult asyncResult) {
@@ -1390,6 +1431,7 @@ namespace System.Data.SqlClient {
         
         private int EndExecuteNonQueryAsync(IAsyncResult asyncResult) {
             Bid.CorrelationTrace("<sc.SqlCommand.EndExecuteNonQueryAsync|Info|Correlation> ObjectID%d#, ActivityID %ls\n", ObjectID);
+            Debug.Assert(!_internalEndExecuteInitiated || _stateObj == null);
 
             Exception asyncException = ((Task)asyncResult).Exception;
             if (asyncException != null) {
@@ -1400,7 +1442,13 @@ namespace System.Data.SqlClient {
             else {
                 ThrowIfReconnectionHasBeenCanceled();
                 // lock on _stateObj prevents ----s with close/cancel.
-                lock (_stateObj) {
+                // If we have already initiate the End call internally, we have already done that, so no point doing it again.
+                if (!_internalEndExecuteInitiated) {
+                    lock (_stateObj) {
+                        return EndExecuteNonQueryInternal(asyncResult);
+                    }
+                }
+                else {
                     return EndExecuteNonQueryInternal(asyncResult);
                 }
             }
@@ -1408,11 +1456,43 @@ namespace System.Data.SqlClient {
 
         private int EndExecuteNonQueryInternal(IAsyncResult asyncResult) {
             SqlStatistics statistics = null;
+            bool success = false;
+            int? sqlExceptionNumber = null;
+            try {
+                statistics = SqlStatistics.StartTimer(Statistics);
+                int result = (int)InternalEndExecuteNonQuery(asyncResult, ADP.EndExecuteNonQuery, isInternal: false);
+                success = true;
+                return result;
+            }
+            catch (SqlException e) {
+                sqlExceptionNumber = e.Number;
+                if (cachedAsyncState != null) {
+                    cachedAsyncState.ResetAsyncState();
+                };
 
+                //  SqlException is always catchable 
+                ReliablePutStateObject();
+                throw;
+            }
+            catch (Exception e) {
+                if (cachedAsyncState != null) {
+                    cachedAsyncState.ResetAsyncState();
+                };
+                if (ADP.IsCatchableExceptionType(e)) {
+                    ReliablePutStateObject();
+                };
+                throw;
+            }
+            finally {
+                SqlStatistics.StopTimer(statistics);
+                WriteEndExecuteEvent(success, sqlExceptionNumber, synchronous: false);
+            }
+        }
+
+        private object InternalEndExecuteNonQuery(IAsyncResult asyncResult, string endMethod, bool isInternal) {
             TdsParser bestEffortCleanupTarget = null;
             RuntimeHelpers.PrepareConstrainedRegions();
-            bool success = false;
-            int? sqlExceptionNumber = null;
+
             try {
 #if DEBUG
                 TdsParser.ReliabilitySection tdsReliabilitySection = new TdsParser.ReliabilitySection();
@@ -1424,30 +1504,32 @@ namespace System.Data.SqlClient {
                 {
 #endif //DEBUG
                     bestEffortCleanupTarget = SqlInternalConnection.GetBestEffortCleanupTarget(_activeConnection);
-                    statistics = SqlStatistics.StartTimer(Statistics);
-                    VerifyEndExecuteState((Task)asyncResult, ADP.EndExecuteNonQuery);
-                    WaitForAsyncResults(asyncResult);
+                    VerifyEndExecuteState((Task)asyncResult, endMethod);
+                    WaitForAsyncResults(asyncResult, isInternal);
 
-                    // If Transparent parameter encryption was attempted, then we would have skipped the below 
-                    // checks in VerifyEndExecuteState since we wanted to wait for WaitForAsyncResults to complete.
+                    // If column encryption is enabled, also check the state after waiting for the task.
+                    // It would be better to do this for all cases, but avoiding for compatibility reasons.
                     if (IsColumnEncryptionEnabled) {
-                        if (cachedAsyncState.EndMethodName == null) {
-                            throw ADP.MethodCalledTwice(ADP.EndExecuteNonQuery);
-                        }
-
-                        if (ADP.EndExecuteNonQuery != cachedAsyncState.EndMethodName) {
-                            throw ADP.MismatchedAsyncResult(cachedAsyncState.EndMethodName, ADP.EndExecuteNonQuery);
-                        }
-
-                        if (!cachedAsyncState.IsActiveConnectionValid(_activeConnection)) {
-                            // If the connection is not 'valid' then it was closed while we were executing
-                            throw ADP.ClosedConnectionError();
-                        }
+                        VerifyEndExecuteState((Task)asyncResult, endMethod, fullCheckForColumnEncryption: true);
                     }
 
                     bool processFinallyBlock = true;
                     try {
-                        NotifyDependency();
+                        // If this is not for internal usage, notify the dependency. 
+                        // If we have already initiated the end internally, the reader should be ready, so just return the rows affected.
+                        if (!isInternal) {
+                            NotifyDependency();
+
+                            if (_internalEndExecuteInitiated) {
+                                Debug.Assert(_stateObj == null);
+
+                                // Reset the state since we exit early.
+                                cachedAsyncState.ResetAsyncState();
+
+                                return _rowsAffected;
+                            }
+                        }
+
                         CheckThrowSNIException();
 
                         // only send over SQL Batch command if we are not a stored proc and have no parameters
@@ -1459,20 +1541,19 @@ namespace System.Data.SqlClient {
                                 if (!result) { throw SQL.SynchronousCallMayNotPend(); }
                             }
                             finally {
-                                cachedAsyncState.ResetAsyncState();
+                                // Don't reset the state for internal End. The user End will do that eventually.
+                                if (!isInternal) {
+                                    cachedAsyncState.ResetAsyncState();
+                                }
                             }
                         }
                         else { // otherwise, use a full-fledged execute that can handle params and stored procs
-                            SqlDataReader reader = CompleteAsyncExecuteReader();
+                            SqlDataReader reader = CompleteAsyncExecuteReader(isInternal);
                             if (null != reader) {
                                 reader.Close();
                             }
                         }
                     }
-                    catch (SqlException e) {
-                        sqlExceptionNumber = e.Number;
-                        throw;
-                    }
                     catch (Exception e) {
                         processFinallyBlock = ADP.IsCatchableExceptionType(e);
                         throw;
@@ -1484,7 +1565,6 @@ namespace System.Data.SqlClient {
                     }
 
                     Debug.Assert(null == _stateObj, "non-null state object in EndExecuteNonQuery");
-                    success = true;
                     return _rowsAffected;
                 }
 #if DEBUG
@@ -1506,23 +1586,11 @@ namespace System.Data.SqlClient {
                 SqlInternalConnection.BestEffortCleanup(bestEffortCleanupTarget);
                 throw;
             }
-            catch (Exception e) {
-                if (cachedAsyncState != null) {
-                    cachedAsyncState.ResetAsyncState();
-                };
-                if (ADP.IsCatchableExceptionType(e)) {
-                    ReliablePutStateObject();
-                };
-                throw;
-            }
-            finally {
-                SqlStatistics.StopTimer(statistics);
-                WriteEndExecuteEvent(success, sqlExceptionNumber, synchronous: false);
-            }
         }
 
-        private Task InternalExecuteNonQuery(TaskCompletionSource<object> completion, string methodName, bool sendToPipe, int timeout, bool asyncWrite = false) {
+        private Task InternalExecuteNonQuery(TaskCompletionSource<object> completion, string methodName, bool sendToPipe, int timeout, out bool usedCache, bool asyncWrite = false, bool inRetry = false) {
             bool async = (null != completion);
+            usedCache = false;
 
             SqlStatistics statistics = Statistics;
             _rowsAffected = -1;
@@ -1542,7 +1610,9 @@ namespace System.Data.SqlClient {
                     bestEffortCleanupTarget = SqlInternalConnection.GetBestEffortCleanupTarget(_activeConnection);
                     // @devnote: this function may throw for an invalid connection
                     // @devnote: returns false for empty command text
-                    ValidateCommand(methodName, async);
+                    if (!inRetry) {
+                        ValidateCommand(methodName, async);
+                    }
                     CheckNotificationStateAndAutoEnlist(); // Only call after validate - requires non null connection!
 
                     Task task = null;
@@ -1566,12 +1636,15 @@ namespace System.Data.SqlClient {
                             }
                         }
 
+                        // We should never get here for a retry since we only have retries for parameters.
+                        Debug.Assert(!inRetry);
+
                         task = RunExecuteNonQueryTds(methodName, async, timeout, asyncWrite);
                     }
                     else  { // otherwise, use a full-fledged execute that can handle params and stored procs
                         Debug.Assert( !sendToPipe, "trying to send non-context command to pipe" );
                         Bid.Trace("<sc.SqlCommand.ExecuteNonQuery|INFO> %d#, Command executed as RPC.\n", ObjectID);
-                        SqlDataReader reader = RunExecuteReader(0, RunBehavior.UntilDone, false, methodName, completion, timeout, out task, asyncWrite);
+                        SqlDataReader reader = RunExecuteReader(0, RunBehavior.UntilDone, false, methodName, completion, timeout, out task, out usedCache, asyncWrite, inRetry);
                         if (null!=reader) {
                             if (task != null) {
                                 task = AsyncHelper.CreateContinuationTask(task, () => reader.Close());
@@ -1649,31 +1722,38 @@ namespace System.Data.SqlClient {
         [System.Security.Permissions.HostProtectionAttribute(ExternalThreading=true)]
         public IAsyncResult BeginExecuteXmlReader(AsyncCallback callback, object stateObject) {
             Bid.CorrelationTrace("<sc.SqlCommand.BeginExecuteXmlReader|API|Correlation> ObjectID%d#, ActivityID %ls\n", ObjectID);
-            SqlConnection.ExecutePermission.Demand();   
-            return BeginExecuteXmlReaderInternal(callback, stateObject, 0);
+            SqlConnection.ExecutePermission.Demand();
+            return BeginExecuteXmlReaderInternal(CommandBehavior.SequentialAccess, callback, stateObject, 0, inRetry: false);
         }
 
         private IAsyncResult BeginExecuteXmlReaderAsync(AsyncCallback callback, object stateObject) {
-            return BeginExecuteXmlReaderInternal(callback, stateObject, CommandTimeout, asyncWrite:true);
+            return BeginExecuteXmlReaderInternal(CommandBehavior.SequentialAccess, callback, stateObject, CommandTimeout, inRetry: false, asyncWrite: true);
         }
 
-        private IAsyncResult BeginExecuteXmlReaderInternal(AsyncCallback callback, object stateObject, int timeout, bool asyncWrite = false) {        
-            // Reset _pendingCancel upon entry into any Execute - used to synchronize state
-            // between entry into Execute* API and the thread obtaining the stateObject.
-            _pendingCancel = false;
+        private IAsyncResult BeginExecuteXmlReaderInternal(CommandBehavior behavior, AsyncCallback callback, object stateObject, int timeout, bool inRetry, bool asyncWrite = false) {
+            TaskCompletionSource<object> globalCompletion = new TaskCompletionSource<object>(stateObject);
+            TaskCompletionSource<object> localCompletion = new TaskCompletionSource<object>(stateObject);
 
-            ValidateAsyncCommand(); // Special case - done outside of try/catches to prevent putting a stateObj
-                                    // back into pool when we should not.
+            if (!inRetry) {
+                // Reset _pendingCancel upon entry into any Execute - used to synchronize state
+                // between entry into Execute* API and the thread obtaining the stateObject.
+                _pendingCancel = false;
+
+                ValidateAsyncCommand(); // Special case - done outside of try/catches to prevent putting a stateObj
+                                        // back into pool when we should not.
+            }
 
             SqlStatistics statistics = null;
             try {
-                statistics = SqlStatistics.StartTimer(Statistics);
-                WriteBeginExecuteEvent();
-                TaskCompletionSource<object> completion = new TaskCompletionSource<object>(stateObject);
+                if (!inRetry) {
+                    statistics = SqlStatistics.StartTimer(Statistics);
+                    WriteBeginExecuteEvent();
+                }
 
+                bool usedCache;
                 Task writeTask;
                 try { // InternalExecuteNonQuery already has reliability block, but if failure will not put stateObj back into pool.
-                    RunExecuteReader(CommandBehavior.SequentialAccess, RunBehavior.ReturnImmediately, true, ADP.BeginExecuteXmlReader, completion, timeout, out writeTask, asyncWrite);
+                    RunExecuteReader(behavior, RunBehavior.ReturnImmediately, true, ADP.BeginExecuteXmlReader, localCompletion, timeout, out writeTask, out usedCache, asyncWrite, inRetry);
                 }
                 catch (Exception e) {
                     if (!ADP.IsCatchableOrSecurityExceptionType(e)) {
@@ -1687,17 +1767,23 @@ namespace System.Data.SqlClient {
                 }
 
                 if (writeTask != null) {
-                    AsyncHelper.ContinueTask(writeTask, completion, () => BeginExecuteXmlReaderInternalReadStage(completion));
+                    AsyncHelper.ContinueTask(writeTask, localCompletion, () => BeginExecuteXmlReaderInternalReadStage(localCompletion));
                 }
                 else {
-                    BeginExecuteXmlReaderInternalReadStage(completion);
+                    BeginExecuteXmlReaderInternalReadStage(localCompletion);
+                }
+
+                // When we use query caching for parameter encryption we need to retry on specific errors.
+                // In these cases finalize the call internally and trigger a retry when needed.
+                if (!TriggerInternalEndAndRetryIfNecessary(behavior, stateObject, timeout, ADP.EndExecuteXmlReader, usedCache, inRetry, asyncWrite, globalCompletion, localCompletion, InternalEndExecuteReader, BeginExecuteXmlReaderInternal)) {
+                    globalCompletion = localCompletion;
                 }
 
                 // Add callback after work is done to avoid overlapping Begin\End methods
                 if (callback != null) {
-                    completion.Task.ContinueWith((t) => callback(t), TaskScheduler.Default);
+                    globalCompletion.Task.ContinueWith((t) => callback(t), TaskScheduler.Default);
                 }
-                return completion.Task;
+                return globalCompletion.Task;
             }
             finally {
                 SqlStatistics.StopTimer(statistics);
@@ -1768,6 +1854,7 @@ namespace System.Data.SqlClient {
 
         private XmlReader EndExecuteXmlReaderAsync(IAsyncResult asyncResult) {
             Bid.CorrelationTrace("<sc.SqlCommand.EndExecuteXmlReaderAsync|Info|Correlation> ObjectID%d#, ActivityID %ls\n", ObjectID);
+            Debug.Assert(!_internalEndExecuteInitiated || _stateObj == null);
 
             Exception asyncException = ((Task)asyncResult).Exception;
             if (asyncException != null) {
@@ -1778,7 +1865,13 @@ namespace System.Data.SqlClient {
             else {
                 ThrowIfReconnectionHasBeenCanceled();
                 // lock on _stateObj prevents ----s with close/cancel.
-                lock (_stateObj) {
+                // If we have already initiate the End call internally, we have already done that, so no point doing it again.
+                if (!_internalEndExecuteInitiated) {
+                    lock (_stateObj) {
+                        return EndExecuteXmlReaderInternal(asyncResult);
+                    }
+                }
+                else {
                     return EndExecuteXmlReaderInternal(asyncResult);
                 }
             }
@@ -1788,7 +1881,7 @@ namespace System.Data.SqlClient {
             bool success = false;
             int? sqlExceptionNumber = null;
             try {
-                XmlReader result = CompleteXmlReader(InternalEndExecuteReader(asyncResult, ADP.EndExecuteXmlReader));
+                XmlReader result = CompleteXmlReader(InternalEndExecuteReader(asyncResult, ADP.EndExecuteXmlReader, isInternal: false));
                 success = true;
                 return result;
             }
@@ -1894,7 +1987,7 @@ namespace System.Data.SqlClient {
         public IAsyncResult BeginExecuteReader(AsyncCallback callback, object stateObject, CommandBehavior behavior) {
             Bid.CorrelationTrace("<sc.SqlCommand.BeginExecuteReader|API|Correlation> ObjectID%d#, behavior=%d{ds.CommandBehavior}, ActivityID %ls\n", ObjectID, (int)behavior);
             SqlConnection.ExecutePermission.Demand();
-            return BeginExecuteReaderInternal(behavior, callback, stateObject, 0);
+            return BeginExecuteReaderInternal(behavior, callback, stateObject, 0, inRetry: false);
         }
 
         internal SqlDataReader ExecuteReader(CommandBehavior behavior, string method) {
@@ -1967,6 +2060,7 @@ namespace System.Data.SqlClient {
 
         private SqlDataReader EndExecuteReaderAsync(IAsyncResult asyncResult) {
             Bid.CorrelationTrace("<sc.SqlCommand.EndExecuteReaderAsync|Info|Correlation> ObjectID%d#, ActivityID %ls\n", ObjectID);
+            Debug.Assert(!_internalEndExecuteInitiated || _stateObj == null);
 
             Exception asyncException = ((Task)asyncResult).Exception;
             if (asyncException != null) {
@@ -1977,8 +2071,14 @@ namespace System.Data.SqlClient {
             else {
                 ThrowIfReconnectionHasBeenCanceled();
                 // lock on _stateObj prevents ----s with close/cancel.
-                lock (_stateObj) {
+                // If we have already initiate the End call internally, we have already done that, so no point doing it again.
+                if (!_internalEndExecuteInitiated) {
+                    lock (_stateObj) {
                         return EndExecuteReaderInternal(asyncResult);
+                    }
+                }
+                else {
+                    return EndExecuteReaderInternal(asyncResult);
                 }
             }
         }
@@ -1989,7 +2089,7 @@ namespace System.Data.SqlClient {
             int? sqlExceptionNumber = null;
             try {
                 statistics = SqlStatistics.StartTimer(Statistics);
-                SqlDataReader result = InternalEndExecuteReader(asyncResult, ADP.EndExecuteReader);
+                SqlDataReader result = InternalEndExecuteReader(asyncResult, ADP.EndExecuteReader, isInternal: false);
                 success = true;
                 return result;
             }
@@ -2020,26 +2120,33 @@ namespace System.Data.SqlClient {
         }
 
         private IAsyncResult BeginExecuteReaderAsync(CommandBehavior behavior, AsyncCallback callback, object stateObject) {
-            return BeginExecuteReaderInternal(behavior, callback, stateObject, CommandTimeout, asyncWrite:true);
+            return BeginExecuteReaderInternal(behavior, callback, stateObject, CommandTimeout, inRetry: false, asyncWrite:true);
         }
 
-        private IAsyncResult BeginExecuteReaderInternal(CommandBehavior behavior, AsyncCallback callback, object stateObject, int timeout, bool asyncWrite = false) {        
-            // Reset _pendingCancel upon entry into any Execute - used to synchronize state
-            // between entry into Execute* API and the thread obtaining the stateObject.
-            _pendingCancel = false;
+        private IAsyncResult BeginExecuteReaderInternal(CommandBehavior behavior, AsyncCallback callback, object stateObject, int timeout, bool inRetry, bool asyncWrite = false) {
+            TaskCompletionSource<object> globalCompletion = new TaskCompletionSource<object>(stateObject);
+            TaskCompletionSource<object> localCompletion = new TaskCompletionSource<object>(stateObject);
+
+            if (!inRetry) {
+                // Reset _pendingCancel upon entry into any Execute - used to synchronize state
+                // between entry into Execute* API and the thread obtaining the stateObject.
+                _pendingCancel = false;
+            }
 
             SqlStatistics statistics = null;
             try {
-                statistics = SqlStatistics.StartTimer(Statistics);
-                WriteBeginExecuteEvent();
-                TaskCompletionSource<object> completion = new TaskCompletionSource<object>(stateObject);
-
-                ValidateAsyncCommand(); // Special case - done outside of try/catches to prevent putting a stateObj
-                                        // back into pool when we should not.
+                if (!inRetry) {
+                    statistics = SqlStatistics.StartTimer(Statistics);
+                    WriteBeginExecuteEvent();
 
+                    ValidateAsyncCommand(); // Special case - done outside of try/catches to prevent putting a stateObj
+                                            // back into pool when we should not.
+                }
+                
+                bool usedCache;
                 Task writeTask = null;
                 try { // InternalExecuteNonQuery already has reliability block, but if failure will not put stateObj back into pool.
-                    RunExecuteReader(behavior, RunBehavior.ReturnImmediately, true, ADP.BeginExecuteReader, completion, timeout, out writeTask, asyncWrite);
+                    RunExecuteReader(behavior, RunBehavior.ReturnImmediately, true, ADP.BeginExecuteReader, localCompletion, timeout, out writeTask, out usedCache, asyncWrite, inRetry);
                 }
                 catch (Exception e) {
                     if (!ADP.IsCatchableOrSecurityExceptionType(e)) {
@@ -2053,23 +2160,128 @@ namespace System.Data.SqlClient {
                 }
 
                 if (writeTask != null ) {
-                    AsyncHelper.ContinueTask(writeTask,completion,()=> BeginExecuteReaderInternalReadStage(completion));
+                    AsyncHelper.ContinueTask(writeTask, localCompletion, () => BeginExecuteReaderInternalReadStage(localCompletion));
                 }
                 else {
-                    BeginExecuteReaderInternalReadStage(completion);
+                    BeginExecuteReaderInternalReadStage(localCompletion);
+                }
+
+                // When we use query caching for parameter encryption we need to retry on specific errors.
+                // In these cases finalize the call internally and trigger a retry when needed.
+                if (!TriggerInternalEndAndRetryIfNecessary(behavior, stateObject, timeout, ADP.EndExecuteReader, usedCache, inRetry, asyncWrite, globalCompletion, localCompletion, InternalEndExecuteReader, BeginExecuteReaderInternal)) {
+                    globalCompletion = localCompletion;
                 }
 
                 // Add callback after work is done to avoid overlapping Begin\End methods
                 if (callback != null) {
-                    completion.Task.ContinueWith((t) => callback(t), TaskScheduler.Default);
+                    globalCompletion.Task.ContinueWith((t) => callback(t), TaskScheduler.Default);
                 }
-                return completion.Task;
+
+                return globalCompletion.Task;
             }
             finally {
                 SqlStatistics.StopTimer(statistics);
             }
         }
 
+        private bool TriggerInternalEndAndRetryIfNecessary(CommandBehavior behavior, object stateObject, int timeout, string endMethod, bool usedCache, bool inRetry, bool asyncWrite, TaskCompletionSource<object> globalCompletion, TaskCompletionSource<object> localCompletion, Func<IAsyncResult, string, bool, object> endFunc, Func<CommandBehavior, AsyncCallback, object, int, bool, bool, IAsyncResult> retryFunc) {
+            // We shouldn't be using the cache if we are in retry.
+            Debug.Assert(!usedCache || !inRetry);
+
+            // If column ecnryption is enabled and we used the cache, we want to catch any potential exceptions that were caused by the query cache and retry if the error indicates that we should.
+            // So, try to read the result of the query before completing the overall task and trigger a retry if appropriate.
+            if ((IsColumnEncryptionEnabled && !inRetry && usedCache) 
+#if DEBUG
+                || _forceInternalEndQuery
+#endif
+                ) {
+                long firstAttemptStart = ADP.TimerCurrent();
+
+                localCompletion.Task.ContinueWith(tsk => {
+                    if (tsk.IsFaulted) {
+                        globalCompletion.TrySetException(tsk.Exception.InnerException);
+                    }
+                    else if (tsk.IsCanceled) {
+                        globalCompletion.TrySetCanceled();
+                    }
+                    else {
+                        try {
+                            // Mark that we initiated the internal EndExecute. This should always be false until we set it here.
+                            Debug.Assert(!_internalEndExecuteInitiated);
+                            _internalEndExecuteInitiated = true;
+
+                            // lock on _stateObj prevents ----s with close/cancel.
+                            lock (_stateObj) {
+                                endFunc(tsk, endMethod, true/*inInternal*/);
+                            }
+                            globalCompletion.TrySetResult(tsk.Result);
+                        }
+                        catch (Exception e) {
+                            // Put the state object back to the cache.
+                            // Do not reset the async state, since this is managed by the user Begin/End and not internally.
+                            if (ADP.IsCatchableExceptionType(e)) {
+                                ReliablePutStateObject();
+                            }
+
+                            bool shouldRetry = false;
+
+                            // Check if we have an error indicating that we can retry.
+                            if (e is SqlException) {
+                                SqlException sqlEx = e as SqlException;
+
+                                for (int i = 0; i < sqlEx.Errors.Count; i++) {
+                                    if (sqlEx.Errors[i].Number == TdsEnums.TCE_CONVERSION_ERROR_CLIENT_RETRY) {
+                                        shouldRetry = true;
+                                        break;
+                                    }
+                                }
+                            }
+
+                            if (!shouldRetry) {
+                                // If we cannot retry, Reset the async state to make sure we leave a clean state.
+                                if (null != _cachedAsyncState) {
+                                    _cachedAsyncState.ResetAsyncState();
+                                }
+                                _activeConnection.GetOpenTdsConnection().DecrementAsyncCount();
+
+                                globalCompletion.TrySetException(e);
+                            }
+                            else {
+                                // Remove the enrty from the cache since it was inconsistent.
+                                SqlQueryMetadataCache.GetInstance().InvalidateCacheEntry(this);
+
+                                try {
+                                    // Kick off the retry.
+                                    _internalEndExecuteInitiated = false;
+                                    Task<object> retryTask = (Task<object>)retryFunc(behavior, null, stateObject, TdsParserStaticMethods.GetRemainingTimeout(timeout, firstAttemptStart), true/*inRetry*/, asyncWrite);
+
+                                    retryTask.ContinueWith(retryTsk => {
+                                        if (retryTsk.IsFaulted) {
+                                            globalCompletion.TrySetException(retryTsk.Exception.InnerException);
+                                        }
+                                        else if (retryTsk.IsCanceled) {
+                                            globalCompletion.TrySetCanceled();
+                                        }
+                                        else {
+                                            globalCompletion.TrySetResult(retryTsk.Result);
+                                        }
+                                    }, TaskScheduler.Default);
+                                }
+                                catch (Exception e2) {
+                                    globalCompletion.TrySetException(e2);
+                                }
+                            }
+                        }
+                    }
+                }, TaskScheduler.Default);
+
+                return true;
+            }
+            else {
+                return false;
+            }
+        }
+
         private void BeginExecuteReaderInternalReadStage(TaskCompletionSource<object> completion) {
             Debug.Assert(completion != null,"CompletionSource should not be null");
             // Read SNI does not have catches for async exceptions, handle here.
@@ -2123,26 +2335,15 @@ namespace System.Data.SqlClient {
             }
         }
 
-        private SqlDataReader InternalEndExecuteReader(IAsyncResult asyncResult, string endMethod) {
-
-            VerifyEndExecuteState((Task) asyncResult, endMethod);
-            WaitForAsyncResults(asyncResult);
+        private SqlDataReader InternalEndExecuteReader(IAsyncResult asyncResult, string endMethod, bool isInternal) {
+            
+            VerifyEndExecuteState((Task)asyncResult, endMethod);
+            WaitForAsyncResults(asyncResult, isInternal);
 
-            // If Transparent parameter encryption was attempted, then we would have skipped the below 
-            // checks in VerifyEndExecuteState since we wanted to wait for WaitForAsyncResults to complete.
+            // If column encryption is enabled, also check the state after waiting for the task.
+            // It would be better to do this for all cases, but avoiding for compatibility reasons.
             if (IsColumnEncryptionEnabled) {
-                if (cachedAsyncState.EndMethodName == null) {
-                    throw ADP.MethodCalledTwice(endMethod);
-                }
-
-                if (endMethod != cachedAsyncState.EndMethodName) {
-                    throw ADP.MismatchedAsyncResult(cachedAsyncState.EndMethodName, endMethod);
-                }
-
-                if (!cachedAsyncState.IsActiveConnectionValid(_activeConnection)) {
-                    // If the connection is not 'valid' then it was closed while we were executing
-                    throw ADP.ClosedConnectionError();
-                }
+                VerifyEndExecuteState((Task)asyncResult, endMethod, fullCheckForColumnEncryption: true);
             }
 
             CheckThrowSNIException();
@@ -2160,7 +2361,7 @@ namespace System.Data.SqlClient {
                 {
 #endif //DEBUG
                     bestEffortCleanupTarget = SqlInternalConnection.GetBestEffortCleanupTarget(_activeConnection);
-                    SqlDataReader reader = CompleteAsyncExecuteReader();
+                    SqlDataReader reader = CompleteAsyncExecuteReader(isInternal);
                     Debug.Assert(null == _stateObj, "non-null state object in InternalEndExecuteReader");
                     return reader;
                 }
@@ -2188,7 +2389,7 @@ namespace System.Data.SqlClient {
         public override Task<int> ExecuteNonQueryAsync(CancellationToken cancellationToken) {
 
             Bid.CorrelationTrace("<sc.SqlCommand.ExecuteNonQueryAsync|API|Correlation> ObjectID%d#, ActivityID %ls\n", ObjectID);
-            SqlConnection.ExecutePermission.Demand();   
+            SqlConnection.ExecutePermission.Demand();
 
             TaskCompletionSource<int> source = new TaskCompletionSource<int>();
 
@@ -2220,7 +2421,7 @@ namespace System.Data.SqlClient {
                         }
                     }
                 }, TaskScheduler.Default);
-            } 
+            }
             catch (Exception e) {
                 source.SetException(e);
             }
@@ -2252,7 +2453,7 @@ namespace System.Data.SqlClient {
         new public Task<SqlDataReader> ExecuteReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken) {
 
             Bid.CorrelationTrace("<sc.SqlCommand.ExecuteReaderAsync|API|Correlation> ObjectID%d#, behavior=%d{ds.CommandBehavior}, ActivityID %ls\n", ObjectID, (int)behavior);
-            SqlConnection.ExecutePermission.Demand();   
+            SqlConnection.ExecutePermission.Demand();
 
             TaskCompletionSource<SqlDataReader> source = new TaskCompletionSource<SqlDataReader>();
 
@@ -2264,12 +2465,12 @@ namespace System.Data.SqlClient {
                 }
                 registration = cancellationToken.Register(CancelIgnoreFailure);
             }
-            
+
             Task<SqlDataReader> returnedTask = source.Task;
             try {
                 RegisterForConnectionCloseNotification(ref returnedTask);
 
-                Task<SqlDataReader>.Factory.FromAsync(BeginExecuteReaderAsync, EndExecuteReaderAsync, behavior, null).ContinueWith((t) => {                    
+                Task<SqlDataReader>.Factory.FromAsync(BeginExecuteReaderAsync, EndExecuteReaderAsync, behavior, null).ContinueWith((t) => {
                     registration.Dispose();
                     if (t.IsFaulted) {
                         Exception e = t.Exception.InnerException;
@@ -2284,7 +2485,7 @@ namespace System.Data.SqlClient {
                         }
                     }
                 }, TaskScheduler.Default);
-            } 
+            }
             catch (Exception e) {
                 source.SetException(e);
             }
@@ -2356,8 +2557,8 @@ namespace System.Data.SqlClient {
         public Task<XmlReader> ExecuteXmlReaderAsync(CancellationToken cancellationToken) {
 
             Bid.CorrelationTrace("<sc.SqlCommand.ExecuteXmlReaderAsync|API|Correlation> ObjectID%d#, ActivityID %ls\n", ObjectID);
-            SqlConnection.ExecutePermission.Demand();   
-            
+            SqlConnection.ExecutePermission.Demand();
+
             TaskCompletionSource<XmlReader> source = new TaskCompletionSource<XmlReader>();
 
             CancellationTokenRegistration registration = new CancellationTokenRegistration();
@@ -2368,7 +2569,7 @@ namespace System.Data.SqlClient {
                 }
                 registration = cancellationToken.Register(CancelIgnoreFailure);
             }
-            
+
             Task<XmlReader> returnedTask = source.Task;
             try {
                 RegisterForConnectionCloseNotification(ref returnedTask);
@@ -2388,7 +2589,7 @@ namespace System.Data.SqlClient {
                         }
                     }
                 }, TaskScheduler.Default);
-            } 
+            }
             catch (Exception e) {
                 source.SetException(e);
             }
@@ -2882,6 +3083,9 @@ namespace System.Data.SqlClient {
 
                 GetStateObject();
 
+                // Reset the encryption state in case it has been set by a previous command.
+                ResetEncryptionState();
+
                 // we just send over the raw text with no annotation
                 // no parameters are sent over
                 // no data reader is returned
@@ -2993,6 +3197,12 @@ namespace System.Data.SqlClient {
             // First reset the command level state.
             ClearDescribeParameterEncryptionRequests();
 
+            // Reset the state for internal End execution.
+            _internalEndExecuteInitiated = false;
+
+            // Reset the state for the cache.
+            CachingQueryMetadataPostponed = false;
+
             // Reset the state of each of the parameters.
             if (_parameters != null) {
                 for (int i = 0; i < _parameters.Count; i++) {
@@ -3047,13 +3257,13 @@ namespace System.Data.SqlClient {
         /// <param name="task"></param>
         /// <param name="asyncWrite"></param>
         /// <returns></returns>
-        private void PrepareForTransparentEncryption(CommandBehavior cmdBehavior, bool returnStream, bool async, int timeout, TaskCompletionSource<object> completion, out Task returnTask, bool asyncWrite)
-        {
+        private void PrepareForTransparentEncryption(CommandBehavior cmdBehavior, bool returnStream, bool async, int timeout, TaskCompletionSource<object> completion, out Task returnTask, bool asyncWrite, out bool usedCache, bool inRetry) {
             // Fetch reader with input params
             Task fetchInputParameterEncryptionInfoTask = null;
             bool describeParameterEncryptionNeeded = false;
             SqlDataReader describeParameterEncryptionDataReader = null;
             returnTask = null;
+            usedCache = false;
 
             Debug.Assert(_activeConnection != null, "_activeConnection should not be null in PrepareForTransparentEncryption.");
             Debug.Assert(_activeConnection.Parser != null, "_activeConnection.Parser should not be null in PrepareForTransparentEncryption.");
@@ -3064,11 +3274,18 @@ namespace System.Data.SqlClient {
                         "ColumnEncryption setting should be enabled for input parameter encryption.");
             Debug.Assert(async == (completion != null), "completion should can be null if and only if mode is async.");
 
+            // If we are not in Batch RPC and not already retrying, attempt to fetch the cipher MD for each parameter from the cache.
+            // If this succeeds then return immediately, otherwise just fall back to the full crypto MD discovery.
+            if (!BatchRPCMode && !inRetry && SqlQueryMetadataCache.GetInstance().GetQueryMetadataIfExists(this)) {
+                usedCache = true;
+                return;
+            }
+
             // A flag to indicate if finallyblock needs to execute.
             bool processFinallyBlock = true;
 
             // A flag to indicate if we need to decrement async count on the connection in finally block.
-            bool decrementAsyncCountInFinallyBlock = async;
+            bool decrementAsyncCountInFinallyBlock = false;
 
             // Flag to indicate if exception is caught during the execution, to govern clean up.
             bool exceptionCaught = false;
@@ -3118,6 +3335,9 @@ namespace System.Data.SqlClient {
                             return;
                         }
 
+                        // If we are in async execution, we need to decrement our async count on exception.
+                        decrementAsyncCountInFinallyBlock = async;
+
                         Debug.Assert(describeParameterEncryptionDataReader != null,
                             "describeParameterEncryptionDataReader should not be null, as it is required to get results of describe parameter encryption.");
 
@@ -3128,6 +3348,7 @@ namespace System.Data.SqlClient {
                             processFinallyBlock = false;
                             returnTask = AsyncHelper.CreateContinuationTask(fetchInputParameterEncryptionInfoTask, () => {
                                 bool processFinallyBlockAsync = true;
+                                bool decrementAsyncCountInFinallyBlockAsync = true;
 
                                 RuntimeHelpers.PrepareConstrainedRegions();
                                 try {
@@ -3143,14 +3364,13 @@ namespace System.Data.SqlClient {
                                         // If it is async, then TryFetchInputParameterEncryptionInfo-> RunExecuteReaderTds would have incremented the async count.
                                         // Decrement it when we are about to complete async execute reader.
                                         SqlInternalConnectionTds internalConnectionTds = _activeConnection.GetOpenTdsConnection();
-                                        if (internalConnectionTds != null)
-                                        {
+                                        if (internalConnectionTds != null) {
                                             internalConnectionTds.DecrementAsyncCount();
-                                            decrementAsyncCountInFinallyBlock = false;
+                                            decrementAsyncCountInFinallyBlockAsync = false;
                                         }
 
                                         // Complete executereader.
-                                        describeParameterEncryptionDataReader = CompleteAsyncExecuteReader();
+                                        describeParameterEncryptionDataReader = CompleteAsyncExecuteReader(forDescribeParameterEncryption: true);
                                         Debug.Assert(null == _stateObj, "non-null state object in PrepareForTransparentEncryption.");
 
                                         // Read the results of describe parameter encryption.
@@ -3173,7 +3393,7 @@ namespace System.Data.SqlClient {
                                 }
                                 finally {
                                     PrepareTransparentEncryptionFinallyBlock(   closeDataReader: processFinallyBlockAsync,
-                                                                                decrementAsyncCount: decrementAsyncCountInFinallyBlock,
+                                                                                decrementAsyncCount: decrementAsyncCountInFinallyBlockAsync,
                                                                                 clearDataStructures: processFinallyBlockAsync,
                                                                                 wasDescribeParameterEncryptionNeeded: describeParameterEncryptionNeeded,
                                                                                 describeParameterEncryptionRpcOriginalRpcMap: describeParameterEncryptionRpcOriginalRpcMap,
@@ -3187,6 +3407,8 @@ namespace System.Data.SqlClient {
                             if (exception != null) {
                                 throw exception;
                             }}));
+
+                            decrementAsyncCountInFinallyBlock = false;
                         }
                         else {
                             // If it was async, ending the reader is still pending.
@@ -3196,6 +3418,7 @@ namespace System.Data.SqlClient {
                                 processFinallyBlock = false;
                                 returnTask = Task.Run(() => {
                                         bool processFinallyBlockAsync = true;
+                                        bool decrementAsyncCountInFinallyBlockAsync = true;
 
                                         RuntimeHelpers.PrepareConstrainedRegions();
                                         try {
@@ -3214,11 +3437,11 @@ namespace System.Data.SqlClient {
                                                 SqlInternalConnectionTds internalConnectionTds = _activeConnection.GetOpenTdsConnection();
                                                 if (internalConnectionTds != null) {
                                                     internalConnectionTds.DecrementAsyncCount();
-                                                    decrementAsyncCountInFinallyBlock = false;
+                                                    decrementAsyncCountInFinallyBlockAsync = false;
                                                 }
 
                                                 // Complete executereader.
-                                                describeParameterEncryptionDataReader = CompleteAsyncExecuteReader();
+                                                describeParameterEncryptionDataReader = CompleteAsyncExecuteReader(forDescribeParameterEncryption: true);
                                                 Debug.Assert(null == _stateObj, "non-null state object in PrepareForTransparentEncryption.");
 
                                                 // Read the results of describe parameter encryption.
@@ -3242,13 +3465,15 @@ namespace System.Data.SqlClient {
                                         }
                                         finally {
                                             PrepareTransparentEncryptionFinallyBlock(   closeDataReader: processFinallyBlockAsync,
-                                                                                        decrementAsyncCount: decrementAsyncCountInFinallyBlock,
+                                                                                        decrementAsyncCount: decrementAsyncCountInFinallyBlockAsync,
                                                                                         clearDataStructures: processFinallyBlockAsync,
                                                                                         wasDescribeParameterEncryptionNeeded: describeParameterEncryptionNeeded,
                                                                                         describeParameterEncryptionRpcOriginalRpcMap: describeParameterEncryptionRpcOriginalRpcMap,
                                                                                         describeParameterEncryptionDataReader: describeParameterEncryptionDataReader);
                                         }
                                     });
+
+                                decrementAsyncCountInFinallyBlock = false;
                             }
                             else {
                                 // For synchronous execution, read the results of describe parameter encryption here.
@@ -3413,6 +3638,7 @@ namespace System.Data.SqlClient {
                                             timeout: timeout,
                                             task: out task,
                                             asyncWrite: asyncWrite,
+                                            inRetry: false,
                                             ds: null,
                                             describeParameterEncryptionRequest: true);
             }
@@ -3494,6 +3720,13 @@ namespace System.Data.SqlClient {
                     SqlParameter param = originalRpcRequest.parameters[i];
                     paramCopy = new SqlParameter(param.ParameterName, param.SqlDbType, param.Size, param.Direction, param.Precision, param.Scale, param.SourceColumn, param.SourceVersion,
                         param.SourceColumnNullMapping, param.Value, param.XmlSchemaCollectionDatabase, param.XmlSchemaCollectionOwningSchema, param.XmlSchemaCollectionName);
+                    paramCopy.CompareInfo = param.CompareInfo;
+                    paramCopy.TypeName = param.TypeName;
+                    paramCopy.UdtTypeName = param.UdtTypeName;
+                    paramCopy.IsNullable = param.IsNullable;
+                    paramCopy.LocaleId = param.LocaleId;
+                    paramCopy.Offset = param.Offset;
+
                     tempCollection.Add(paramCopy);
                 }
 
@@ -3715,18 +3948,25 @@ namespace System.Data.SqlClient {
                     }
                 }
             }
+
+            // If we are not in Batch RPC mode, update the query cache with the encryption MD.
+            if (!BatchRPCMode) {
+                SqlQueryMetadataCache.GetInstance().AddQueryMetadata(this, ignoreQueriesWithReturnValueParams: true);
+            }
         }
 
         internal SqlDataReader RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, bool returnStream, string method) {
             Task unused; // sync execution 
-            SqlDataReader reader = RunExecuteReader(cmdBehavior, runBehavior, returnStream, method, completion:null, timeout:CommandTimeout, task:out unused);
+            bool usedCache;
+            SqlDataReader reader = RunExecuteReader(cmdBehavior, runBehavior, returnStream, method, completion: null, timeout: CommandTimeout, task: out unused, usedCache: out usedCache);
             Debug.Assert(unused == null, "returned task during synchronous execution");
             return reader;
         }
 
         // task is created in case of pending asynchronous write, returned SqlDataReader should not be utilized until that task is complete 
-        internal SqlDataReader RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, bool returnStream, string method, TaskCompletionSource<object> completion, int timeout, out Task task, bool asyncWrite = false) {
+        internal SqlDataReader RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, bool returnStream, string method, TaskCompletionSource<object> completion, int timeout, out Task task, out bool usedCache, bool asyncWrite = false, bool inRetry = false) {
             bool async = (null != completion);
+            usedCache = false;
 
             task = null;
 
@@ -3740,7 +3980,10 @@ namespace System.Data.SqlClient {
 
             // @devnote: this function may throw for an invalid connection
             // @devnote: returns false for empty command text
-            ValidateCommand(method, async);
+            if (!inRetry) {
+                ValidateCommand(method, async);
+            }
+
             CheckNotificationStateAndAutoEnlist(); // Only call after validate - requires non null connection!
 
             TdsParser bestEffortCleanupTarget = null;
@@ -3777,14 +4020,46 @@ namespace System.Data.SqlClient {
                     }
                     else if (IsColumnEncryptionEnabled) {
                         Task returnTask = null;
-                        PrepareForTransparentEncryption(cmdBehavior, returnStream, async, timeout, completion, out returnTask, asyncWrite && async);
-                        Debug.Assert(async == (returnTask != null), @"returnTask should be null if and only if async is false.");
+                        PrepareForTransparentEncryption(cmdBehavior, returnStream, async, timeout, completion, out returnTask, asyncWrite && async, out usedCache, inRetry);
+                        Debug.Assert(usedCache || (async == (returnTask != null)), @"if we didn't use the cache, returnTask should be null if and only if async is false.");
+
+                        long firstAttemptStart = ADP.TimerCurrent();
 
-                        return RunExecuteReaderTdsWithTransparentParameterEncryption( cmdBehavior, runBehavior, returnStream, async, timeout, out task, asyncWrite && async, ds: null,
-                            describeParameterEncryptionRequest: false, describeParameterEncryptionTask: returnTask);
+                        try {
+                            return RunExecuteReaderTdsWithTransparentParameterEncryption(cmdBehavior, runBehavior, returnStream, async, timeout, out task, asyncWrite && async, inRetry: inRetry, ds: null,
+                                describeParameterEncryptionRequest: false, describeParameterEncryptionTask: returnTask);
+                        }
+                        catch (SqlException ex) {
+                            // We only want to retry once, so don't retry if we are already in retry.
+                            // If we didn't use the cache, we don't want to retry.
+                            // The async retried are handled separately, handle only [....] calls here.
+                            if (inRetry || async || !usedCache) {
+                                throw;
+                            }
+
+                            bool shouldRetry = false;
+
+                            // Check if we have an error indicating that we can retry.
+                            for (int i = 0; i < ex.Errors.Count; i++) {
+                                if (ex.Errors[i].Number == TdsEnums.TCE_CONVERSION_ERROR_CLIENT_RETRY) {
+                                    shouldRetry = true;
+                                    break;
+                                }
+                            }
+
+                            if (!shouldRetry) {
+                                throw;
+                            }
+                            else {
+                                // Retry if the command failed with appropriate error.
+                                // First invalidate the entry from the cache, so that we refresh our encryption MD.
+                                SqlQueryMetadataCache.GetInstance().InvalidateCacheEntry(this);
+                                return RunExecuteReader(cmdBehavior, runBehavior, returnStream, method, null, TdsParserStaticMethods.GetRemainingTimeout(timeout, firstAttemptStart), out task, out usedCache, async, inRetry: true);
+                            }
+                        }
                     }
                     else {
-                        return RunExecuteReaderTds( cmdBehavior, runBehavior, returnStream, async, timeout, out task, asyncWrite && async);
+                        return RunExecuteReaderTds( cmdBehavior, runBehavior, returnStream, async, timeout, out task, asyncWrite && async, inRetry: inRetry);
                     }
 
                 }
@@ -3830,11 +4105,11 @@ namespace System.Data.SqlClient {
                                                                                     int timeout,
                                                                                     out Task task,
                                                                                     bool asyncWrite,
+                                                                                    bool inRetry,
                                                                                     SqlDataReader ds=null,
                                                                                     bool describeParameterEncryptionRequest = false,
                                                                                     Task describeParameterEncryptionTask = null) {
             Debug.Assert(!asyncWrite || async, "AsyncWrite should be always accompanied by Async");
-            Debug.Assert((describeParameterEncryptionTask != null) == async, @"async should be true if and only if describeParameterEncryptionTask is not null.");
 
             if (ds == null && returnStream) {
                 ds = new SqlDataReader(this, cmdBehavior);
@@ -3842,40 +4117,42 @@ namespace System.Data.SqlClient {
 
             if (describeParameterEncryptionTask != null) {
                 long parameterEncryptionStart = ADP.TimerCurrent();
-                    TaskCompletionSource<object> completion = new TaskCompletionSource<object>();
-                    AsyncHelper.ContinueTask(describeParameterEncryptionTask, completion,
-                        () => {
-                            Task subTask = null;
-                            RunExecuteReaderTds(cmdBehavior, runBehavior, returnStream, async, TdsParserStaticMethods.GetRemainingTimeout(timeout, parameterEncryptionStart), out subTask, asyncWrite, ds);
-                            if (subTask == null) {
-                                completion.SetResult(null);
-                            }
-                            else {
-                                AsyncHelper.ContinueTask(subTask, completion, () => completion.SetResult(null));
-                            }
-                        }, connectionToDoom: null,
-                        onFailure: ((exception) => {
-                            if (_cachedAsyncState != null) {
-                                _cachedAsyncState.ResetAsyncState();
-                            }
-                            if (exception != null) {
-                                throw exception;
-                            }}),
-                        onCancellation: (() => {
-                            if (_cachedAsyncState != null) {
-                                _cachedAsyncState.ResetAsyncState();
-                            }}),
-                        connectionToAbort: _activeConnection);
-                    task = completion.Task;
-                    return ds;
+                TaskCompletionSource<object> completion = new TaskCompletionSource<object>();
+                AsyncHelper.ContinueTask(describeParameterEncryptionTask, completion,
+                    () => {
+                        Task subTask = null;
+                        RunExecuteReaderTds(cmdBehavior, runBehavior, returnStream, async, TdsParserStaticMethods.GetRemainingTimeout(timeout, parameterEncryptionStart), out subTask, asyncWrite, inRetry, ds);
+                        if (subTask == null) {
+                            completion.SetResult(null);
+                        }
+                        else {
+                            AsyncHelper.ContinueTask(subTask, completion, () => completion.SetResult(null));
+                        }
+                    }, connectionToDoom: null,
+                    onFailure: ((exception) => {
+                        if (_cachedAsyncState != null) {
+                            _cachedAsyncState.ResetAsyncState();
+                        }
+                        if (exception != null) {
+                            throw exception;
+                        }
+                    }),
+                    onCancellation: (() => {
+                        if (_cachedAsyncState != null) {
+                            _cachedAsyncState.ResetAsyncState();
+                        }
+                    }),
+                    connectionToAbort: _activeConnection);
+                task = completion.Task;
+                return ds;
             }
             else {
                 // Synchronous execution.
-                return RunExecuteReaderTds(cmdBehavior, runBehavior, returnStream, async, timeout, out task, asyncWrite, ds);
+                return RunExecuteReaderTds(cmdBehavior, runBehavior, returnStream, async, timeout, out task, asyncWrite, inRetry, ds);
             }
         }
 
-        private SqlDataReader RunExecuteReaderTds( CommandBehavior cmdBehavior, RunBehavior runBehavior, bool returnStream, bool async, int timeout, out Task task, bool asyncWrite, SqlDataReader ds=null, bool describeParameterEncryptionRequest = false) {
+        private SqlDataReader RunExecuteReaderTds( CommandBehavior cmdBehavior, RunBehavior runBehavior, bool returnStream, bool async, int timeout, out Task task, bool asyncWrite, bool inRetry, SqlDataReader ds=null, bool describeParameterEncryptionRequest = false) {
             Debug.Assert(!asyncWrite || async, "AsyncWrite should be always accompanied by Async");
 
             if (ds == null && returnStream) {
@@ -3900,7 +4177,7 @@ namespace System.Data.SqlClient {
                             Interlocked.CompareExchange(ref _reconnectionCompletionSource, null, completion);
                             timeoutCTS.Cancel();
                             Task subTask;                            
-                            RunExecuteReaderTds(cmdBehavior, runBehavior, returnStream, async, TdsParserStaticMethods.GetRemainingTimeout(timeout, reconnectionStart), out subTask, asyncWrite, ds);
+                            RunExecuteReaderTds(cmdBehavior, runBehavior, returnStream, async, TdsParserStaticMethods.GetRemainingTimeout(timeout, reconnectionStart), out subTask, asyncWrite, inRetry, ds);
                             if (subTask == null) {
                                 completion.SetResult(null);
                             }
@@ -3933,7 +4210,8 @@ namespace System.Data.SqlClient {
             bool processFinallyBlock = true;
             bool decrementAsyncCountOnFailure = false;
 
-            if (async) {
+            // If we are in retry, don't increment the Async count. This should have already been set.
+            if (async && !inRetry) {
                 _activeConnection.GetOpenTdsConnection().IncrementAsyncCount();
                 decrementAsyncCountOnFailure = true;
             }
@@ -4077,7 +4355,7 @@ namespace System.Data.SqlClient {
                 }
                 else {
                     // Always execute - even if no reader!
-                    FinishExecuteReader(ds, runBehavior, optionSettings);
+                    FinishExecuteReader(ds, runBehavior, optionSettings, isInternal: false, forDescribeParameterEncryption: false);
                 }
             }
             catch (Exception e) {                
@@ -4177,11 +4455,11 @@ namespace System.Data.SqlClient {
         return ds;
         }
 
-        private SqlDataReader CompleteAsyncExecuteReader() {
+        private SqlDataReader CompleteAsyncExecuteReader(bool isInternal = false, bool forDescribeParameterEncryption = false) {
             SqlDataReader ds = cachedAsyncState.CachedAsyncReader; // should not be null
             bool processFinallyBlock = true;
             try {
-                FinishExecuteReader(ds, cachedAsyncState.CachedRunBehavior, cachedAsyncState.CachedSetOptions);
+                FinishExecuteReader(ds, cachedAsyncState.CachedRunBehavior, cachedAsyncState.CachedSetOptions, isInternal, forDescribeParameterEncryption);
             }
             catch (Exception e) {
                 processFinallyBlock = ADP.IsCatchableExceptionType(e);
@@ -4190,7 +4468,11 @@ namespace System.Data.SqlClient {
             finally {
                 TdsParser.ReliabilitySection.Assert("unreliable call to CompleteAsyncExecuteReader");  // you need to setup for a thread abort somewhere before you call this method
                 if (processFinallyBlock) {
-                    cachedAsyncState.ResetAsyncState();
+                    // Don't reset the state for internal End. The user End will do that eventually.
+                    if (!isInternal) {
+                        cachedAsyncState.ResetAsyncState();
+                    }
+
                     PutStateObject();
                 }
             }
@@ -4198,10 +4480,19 @@ namespace System.Data.SqlClient {
             return ds;
         }
 
-        private void FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, string resetOptionsString) {
+        private void FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, string resetOptionsString, bool isInternal, bool forDescribeParameterEncryption) {
             // always wrap with a try { FinishExecuteReader(...) } finally { PutStateObject(); }
 
-            NotifyDependency();
+            // If this is not for internal usage, notify the dependency. If we have already initiated the end internally, the reader should be ready, so just return.
+            if (!isInternal && !forDescribeParameterEncryption) {
+                NotifyDependency();
+
+                if (_internalEndExecuteInitiated) {
+                    Debug.Assert(_stateObj == null);
+                    return;
+                }
+            }
+
             if (runBehavior == RunBehavior.UntilDone) {
                 try {
                     bool dataReady;
@@ -4618,6 +4909,14 @@ namespace System.Data.SqlClient {
                         parameter.Value = status;
 
                     }
+
+                // If we are not in Batch RPC mode, update the query cache with the encryption MD.
+                // We can do this now that we have distinguished between ReturnValue and ReturnStatus.
+                // Read comment in AddQueryMetadata() for more details.
+                if (!BatchRPCMode && CachingQueryMetadataPostponed) {
+                    SqlQueryMetadataCache.GetInstance().AddQueryMetadata(this, ignoreQueriesWithReturnValueParams: false);
+                }
+
                     break;
                 }
             }
index 0ce4dbb08763054308721ed6139b428134b0cb54..306a42079800e4f74776c8f8f967a9df88f0c8f5 100644 (file)
@@ -88,7 +88,51 @@ namespace System.Data.SqlClient
                 return _ColumnEncryptionTrustedMasterKeyPaths;
             }
         }
-        
+
+        /// <summary>
+        /// Defines whether query metadata caching is enabled.
+        /// </summary>
+        static private bool _ColumnEncryptionQueryMetadataCacheEnabled = true;
+
+        [
+        DefaultValue(null),
+        ResCategoryAttribute(Res.DataCategory_Data),
+        ResDescriptionAttribute(Res.TCE_SqlConnection_ColumnEncryptionQueryMetadataCacheEnabled),
+        ]
+        static public bool ColumnEncryptionQueryMetadataCacheEnabled 
+        {
+            get
+            {
+                return _ColumnEncryptionQueryMetadataCacheEnabled;
+            }
+            set
+            {
+                _ColumnEncryptionQueryMetadataCacheEnabled = value;
+            }
+        }
+
+        /// <summary>
+        /// Defines whether query metadata caching is enabled.
+        /// </summary>
+        static private TimeSpan _ColumnEncryptionKeyCacheTtl = TimeSpan.FromHours(2);
+
+        [
+        DefaultValue(null),
+        ResCategoryAttribute(Res.DataCategory_Data),
+        ResDescriptionAttribute(Res.TCE_SqlConnection_ColumnEncryptionKeyCacheTtl),
+        ]
+        static public TimeSpan ColumnEncryptionKeyCacheTtl
+        {
+            get
+            {
+                return _ColumnEncryptionKeyCacheTtl;
+            }
+            set
+            {
+                _ColumnEncryptionKeyCacheTtl = value;
+            }
+        }
+
         /// <summary>
         /// This function should only be called once in an app. This does shallow copying of the dictionary so that 
         /// the app cannot alter the custom provider list once it has been set.
@@ -437,7 +481,15 @@ namespace System.Data.SqlClient
             get {
                 return ((SqlConnectionString)ConnectionOptions).TypeSystemAssemblyVersion;
             }
-        }        
+        }     
+        
+        internal PoolBlockingPeriod PoolBlockingPeriod
+        {
+            get
+            {
+                return ((SqlConnectionString)ConnectionOptions).PoolBlockingPeriod;
+            }
+        }   
 
         internal int ConnectRetryInterval {
             get {
index 85ed1b7bbf0f70519c0eb866a1584df11633861a..1dd74aec96b5bb8d171dad19d2f1fdad331e7ced 100644 (file)
@@ -30,6 +30,7 @@ namespace System.Data.SqlClient {
             internal const  string Application_Name               = TdsEnums.SQL_PROVIDER_NAME;
             internal const  bool   Asynchronous                   = false;
             internal const  string AttachDBFilename               = "";
+            internal const  PoolBlockingPeriod PoolBlockingPeriod = DbConnectionStringDefaults.PoolBlockingPeriod;
             internal const  int    Connect_Timeout                = ADP.DefaultConnectionTimeout;
             internal const  bool   Connection_Reset               = true;
             internal const  bool   Context_Connection             = false;
@@ -69,6 +70,7 @@ namespace System.Data.SqlClient {
             internal const string Application_Name                                     = "application name";
             internal const string AsynchronousProcessing                       = "asynchronous processing";
             internal const string AttachDBFilename                                     = "attachdbfilename";
+            internal const string PoolBlockingPeriod                = "poolblockingperiod";
             internal const string ColumnEncryptionSetting                      = "column encryption setting";
             internal const string Connect_Timeout                                      = "connect timeout";
             internal const string Connection_Reset                                     = "connection reset";
@@ -190,6 +192,7 @@ namespace System.Data.SqlClient {
 
         private readonly bool _integratedSecurity;
 
+        private readonly PoolBlockingPeriod _poolBlockingPeriod;
         private readonly bool _connectionReset;
         private readonly bool _contextConnection;
         private readonly bool _encrypt;
@@ -247,6 +250,7 @@ namespace System.Data.SqlClient {
             ConvertValueToBoolean(KEY.AsynchronousProcessing, DEFAULT.Asynchronous); // while we don't use it anymore, we still need to verify it is true/false
 
             // SQLPT 41700: Ignore ResetConnection=False (still validate the keyword/value)
+            _poolBlockingPeriod = ConvertValueToPoolBlockingPeriod();
             _connectionReset     = ConvertValueToBoolean(KEY.Connection_Reset,      DEFAULT.Connection_Reset);
             _contextConnection   = ConvertValueToBoolean(KEY.Context_Connection,    DEFAULT.Context_Connection);
             _encrypt             = ConvertValueToEncrypt();
@@ -490,6 +494,7 @@ namespace System.Data.SqlClient {
             _userInstance                   = userInstance;
             _connectTimeout                 = connectionOptions._connectTimeout;
             _loadBalanceTimeout             = connectionOptions._loadBalanceTimeout;
+            _poolBlockingPeriod       = connectionOptions._poolBlockingPeriod;
             _maxPoolSize                    = connectionOptions._maxPoolSize;
             _minPoolSize                    = connectionOptions._minPoolSize;
             _multiSubnetFailover            = connectionOptions._multiSubnetFailover;
@@ -525,6 +530,8 @@ namespace System.Data.SqlClient {
         // will work.  In the future we can deprecate the keyword entirely.
         internal bool Asynchronous { get { return true; } }
 
+        internal PoolBlockingPeriod PoolBlockingPeriod { get { return _poolBlockingPeriod; } }
+
         // SQLPT 41700: Ignore ResetConnection=False, always reset the connection for security
         internal bool ConnectionReset { get { return true; } }
         internal bool ContextConnection { get { return _contextConnection; } }
@@ -620,6 +627,7 @@ namespace System.Data.SqlClient {
                 hash.Add(KEY.Application_Name,               KEY.Application_Name);
                 hash.Add(KEY.AsynchronousProcessing,         KEY.AsynchronousProcessing);
                 hash.Add(KEY.AttachDBFilename,               KEY.AttachDBFilename);
+                hash.Add(KEY.PoolBlockingPeriod,       KEY.PoolBlockingPeriod);
                 hash.Add(KEY.Connect_Timeout,                KEY.Connect_Timeout);
                 hash.Add(KEY.Connection_Reset,               KEY.Connection_Reset);
                 hash.Add(KEY.Context_Connection,             KEY.Context_Connection);
@@ -779,6 +787,28 @@ namespace System.Data.SqlClient {
             // ArgumentException and other types are raised as is (no wrapping)
         }
 
+        internal System.Data.SqlClient.PoolBlockingPeriod ConvertValueToPoolBlockingPeriod()
+        {
+            object value = base.Parsetable[KEY.PoolBlockingPeriod];
+            if (value == null)
+            {
+                return DEFAULT.PoolBlockingPeriod;
+            }
+            
+            try
+            {
+                return DbConnectionStringBuilderUtil.ConvertToPoolBlockingPeriod(KEY.PoolBlockingPeriod, value);
+            }
+            catch (FormatException e)
+            {
+                throw ADP.InvalidConnectionOptionValue(KEY.PoolBlockingPeriod, e);
+            }
+            catch (OverflowException e)
+            {
+                throw ADP.InvalidConnectionOptionValue(KEY.PoolBlockingPeriod, e);
+            }
+        }
+
         internal SqlAuthenticationMethod ConvertValueToAuthenticationType() {
             object value = base.Parsetable[KEY.Authentication];
 
index 8e7714341c4b24753db6afad82f66a0736f39837..ae3c2b1e67e496209866a659317ded681c7bbde8 100644 (file)
@@ -41,6 +41,7 @@ namespace System.Data.SqlClient {
             Pooling,
             MinPoolSize,
             MaxPoolSize,
+            PoolBlockingPeriod,
 
             AsynchronousProcessing,
             ConnectionReset,
@@ -127,6 +128,7 @@ namespace System.Data.SqlClient {
         private bool _userInstance                                     = DbConnectionStringDefaults.UserInstance;
         private SqlAuthenticationMethod _authentication     = DbConnectionStringDefaults.Authentication;
         private SqlConnectionColumnEncryptionSetting _columnEncryptionSetting = DbConnectionStringDefaults.ColumnEncryptionSetting;
+        private PoolBlockingPeriod _poolBlockingPeriod = DbConnectionStringDefaults.PoolBlockingPeriod;
 
         static SqlConnectionStringBuilder() {
             string[] validKeywords = new string[KeywordsCount];
@@ -134,6 +136,7 @@ namespace System.Data.SqlClient {
             validKeywords[(int)Keywords.ApplicationName]                = DbConnectionStringKeywords.ApplicationName;
             validKeywords[(int)Keywords.AsynchronousProcessing]         = DbConnectionStringKeywords.AsynchronousProcessing;
             validKeywords[(int)Keywords.AttachDBFilename]               = DbConnectionStringKeywords.AttachDBFilename;
+            validKeywords[(int)Keywords.PoolBlockingPeriod]       = DbConnectionStringKeywords.PoolBlockingPeriod;
             validKeywords[(int)Keywords.ConnectionReset]                = DbConnectionStringKeywords.ConnectionReset;
             validKeywords[(int)Keywords.ContextConnection]              = DbConnectionStringKeywords.ContextConnection;
             validKeywords[(int)Keywords.ConnectTimeout]                 = DbConnectionStringKeywords.ConnectTimeout;
@@ -174,6 +177,7 @@ namespace System.Data.SqlClient {
             hash.Add(DbConnectionStringKeywords.ApplicationName,                                       Keywords.ApplicationName);
             hash.Add(DbConnectionStringKeywords.AsynchronousProcessing,                                Keywords.AsynchronousProcessing);
             hash.Add(DbConnectionStringKeywords.AttachDBFilename,                                      Keywords.AttachDBFilename);
+            hash.Add(DbConnectionStringKeywords.PoolBlockingPeriod,           Keywords.PoolBlockingPeriod);
             hash.Add(DbConnectionStringKeywords.ConnectTimeout,                                                Keywords.ConnectTimeout);
             hash.Add(DbConnectionStringKeywords.ConnectionReset,                                       Keywords.ConnectionReset);
             hash.Add(DbConnectionStringKeywords.ContextConnection,                                     Keywords.ContextConnection);
@@ -278,6 +282,7 @@ namespace System.Data.SqlClient {
                     case Keywords.Authentication:                                      Authentication = ConvertToAuthenticationType(keyword, value); break;
                     case Keywords.ColumnEncryptionSetting:                     ColumnEncryptionSetting = ConvertToColumnEncryptionSetting(keyword, value); break;
                     case Keywords.AsynchronousProcessing:                      AsynchronousProcessing = ConvertToBoolean(value); break;
+                    case Keywords.PoolBlockingPeriod:               PoolBlockingPeriod = ConvertToPoolBlockingPeriod(keyword, value); break;
 #pragma warning disable 618 // Obsolete ConnectionReset
                     case Keywords.ConnectionReset:                                     ConnectionReset = ConvertToBoolean(value); break;
 #pragma warning restore 618
@@ -360,6 +365,25 @@ namespace System.Data.SqlClient {
             }
         }
 
+        [DisplayName(DbConnectionStringKeywords.PoolBlockingPeriod)]
+        [ResCategoryAttribute(Res.DataCategory_Pooling)]
+        [ResDescriptionAttribute(Res.DbConnectionString_PoolBlockingPeriod)]
+        [RefreshPropertiesAttribute(RefreshProperties.All)]
+        public PoolBlockingPeriod PoolBlockingPeriod
+        {
+            get { return _poolBlockingPeriod; }
+            set
+            {
+                if (!DbConnectionStringBuilderUtil.IsValidPoolBlockingPeriodValue(value))
+                {
+                    throw ADP.InvalidEnumerationValue(typeof(PoolBlockingPeriod), (int)value);
+                }
+
+                SetPoolBlockingPeriodValue(value);
+                _poolBlockingPeriod = value;
+            }
+        }
+
         [Browsable(false)]
         [DisplayName(DbConnectionStringKeywords.ConnectionReset)]
         [Obsolete("ConnectionReset has been deprecated.  SqlConnection will ignore the 'connection reset' keyword and always reset the connection")] // SQLPT 41700
@@ -881,6 +905,10 @@ namespace System.Data.SqlClient {
         private static SqlAuthenticationMethod ConvertToAuthenticationType(string keyword, object value) {
             return DbConnectionStringBuilderUtil.ConvertToAuthenticationType(keyword, value);
         }
+        private static PoolBlockingPeriod ConvertToPoolBlockingPeriod(string keyword, object value)
+        {
+            return DbConnectionStringBuilderUtil.ConvertToPoolBlockingPeriod(keyword, value);
+        }
 
         /// <summary>
         /// Convert to SqlConnectionColumnEncryptionSetting.
@@ -906,6 +934,7 @@ namespace System.Data.SqlClient {
             case Keywords.ApplicationName:                                     return ApplicationName;
             case Keywords.AsynchronousProcessing:                      return AsynchronousProcessing;
             case Keywords.AttachDBFilename:                                    return AttachDBFilename;
+            case Keywords.PoolBlockingPeriod:         return PoolBlockingPeriod;
             case Keywords.ConnectTimeout:                                      return ConnectTimeout;
 #pragma warning disable 618 // Obsolete ConnectionReset
             case Keywords.ConnectionReset:                                     return ConnectionReset;
@@ -1012,6 +1041,10 @@ namespace System.Data.SqlClient {
             case Keywords.Authentication:
                 _authentication = DbConnectionStringDefaults.Authentication;
                 break;
+            case Keywords.PoolBlockingPeriod:
+                _poolBlockingPeriod = DbConnectionStringDefaults.PoolBlockingPeriod;
+                break;
+              
             case Keywords.ConnectTimeout:
                 _connectTimeout = DbConnectionStringDefaults.ConnectTimeout;
                 break;
@@ -1128,6 +1161,11 @@ namespace System.Data.SqlClient {
             Debug.Assert(DbConnectionStringBuilderUtil.IsValidApplicationIntentValue(value), "Invalid value for ApplicationIntent");
             base[DbConnectionStringKeywords.ApplicationIntent] = DbConnectionStringBuilderUtil.ApplicationIntentToString(value);
         }
+        private void SetPoolBlockingPeriodValue(PoolBlockingPeriod value)
+        {
+            Debug.Assert(DbConnectionStringBuilderUtil.IsValidPoolBlockingPeriodValue(value), "Invalid value for PoolBlockingPeriod");
+            base[DbConnectionStringKeywords.PoolBlockingPeriod] = DbConnectionStringBuilderUtil.PoolBlockingPeriodToString(value);
+        }
         private void SetAuthenticationValue(SqlAuthenticationMethod value) {
             Debug.Assert(DbConnectionStringBuilderUtil.IsValidAuthenticationTypeValue(value), "Invalid value for AuthenticationType");
             base[DbConnectionStringKeywords.Authentication] = DbConnectionStringBuilderUtil.AuthenticationTypeToString(value);
index 879a86d61a86854b73492bcc168c5a36981ddd30..0e799476baf0274495dc018a71786619b463df93 100644 (file)
@@ -207,10 +207,10 @@ namespace System.Data.SqlClient
                     durationString = null;
                     break;
             }
-
+            
             // This message is to be added only when within the various stages of a connection. 
             // In all other cases, it will default to the original error message.
-            if ((currentPhase != SqlConnectionTimeoutErrorPhase.Undefined) || (currentPhase != SqlConnectionTimeoutErrorPhase.Complete))
+            if ((currentPhase != SqlConnectionTimeoutErrorPhase.Undefined) && (currentPhase != SqlConnectionTimeoutErrorPhase.Complete))
             {
                 // NOTE: In case of a failover scenario, add a string that this failure occured as part of the primary or secondary server
                 if (isFailoverScenario)
@@ -229,13 +229,13 @@ namespace System.Data.SqlClient
                         originalPhaseDurations[(int)SqlConnectionTimeoutErrorPhase.ProcessConnectionAuth].GetMilliSecondDuration(),
                         originalPhaseDurations[(int)SqlConnectionTimeoutErrorPhase.PostLogin].GetMilliSecondDuration());
                 }
+            }
 
-                // NOTE: To display duration in each phase.
-                if (durationString != null)
-                {
-                    errorBuilder.Append("  ");
-                    errorBuilder.Append(durationString);
-                }
+            // NOTE: To display duration in each phase.
+            if (durationString != null)
+            {
+                errorBuilder.Append("  ");
+                errorBuilder.Append(durationString);
             }
 
             return errorBuilder.ToString();
index c07b195ac1ba68e64a6342f0c03bbc6e4bc32456..376909b9abd7bd6b626018dfbe5b83b5a12940c2 100644 (file)
@@ -889,6 +889,7 @@ namespace System.Data.SqlClient
         }
 
         internal void DecrementAsyncCount() {
+            Debug.Assert(_asyncCommandCount > 0);
             Interlocked.Decrement(ref _asyncCommandCount);
         }
 
index 9b238a4706148ac933a6ffd8c093e4fb4f4ad05b..81274a6b846ff9ca223b8feaeb2f3a9422a373dc 100644 (file)
@@ -99,9 +99,6 @@ namespace System.Data.SqlClient {
             }
 
             set {
-                Debug.Assert(_columnEncryptionCipherMetadata == null || value == null,
-                    "_columnEncryptionCipherMetadata should be set to a non-null value only once.");
-
                 _columnEncryptionCipherMetadata = value;
             }
         }
index fa371fb7222e0bd2cdcc10e7741675889e5fb845..8df0617428c5287d40e613faeb2239ca344dcaee 100644 (file)
@@ -13,18 +13,19 @@ namespace System.Data.SqlClient {
     using System.Diagnostics;
     using System.Globalization;
     using System.Linq;
+    using System.Runtime.Caching;
     using System.Text;
 
     /// <summary>
     /// <para> Implements a cache of Symmetric Keys (once they are decrypted).Useful for rapidly decrypting multiple data values.</para>
     /// </summary>
     sealed internal class SqlSymmetricKeyCache {
-        private readonly ConcurrentDictionary<string,SqlClientSymmetricKey> _cache;
+        private readonly MemoryCache _cache;
         private static readonly SqlSymmetricKeyCache _singletonInstance = new SqlSymmetricKeyCache();
 
 
         private SqlSymmetricKeyCache () {
-            _cache = new ConcurrentDictionary<string, SqlClientSymmetricKey>(concurrencyLevel: 4 * Environment.ProcessorCount /* default value in ConcurrentDictionary*/, capacity: 2);
+            _cache = new MemoryCache("ColumnEncryptionKeyCache");
         }
 
         internal static SqlSymmetricKeyCache GetInstance () {
@@ -54,10 +55,10 @@ namespace System.Data.SqlClient {
             Debug.Assert(cacheLookupKey.Length <= capacity, "We needed to allocate a larger array");
 #endif //DEBUG
 
-            encryptionKey = null;
-
             // Lookup the key in cache
-            if (!_cache.TryGetValue(cacheLookupKey, out encryptionKey)) {
+            encryptionKey = _cache.Get(cacheLookupKey) as SqlClientSymmetricKey;
+            
+            if (encryptionKey == null) {
                 Debug.Assert(SqlConnection.ColumnEncryptionTrustedMasterKeyPaths != null, @"SqlConnection.ColumnEncryptionTrustedMasterKeyPaths should not be null");
 
                 // Check against the trusted key paths
@@ -96,9 +97,13 @@ namespace System.Data.SqlClient {
 
                 encryptionKey = new SqlClientSymmetricKey (plaintextKey);
 
-                // In case multiple threads reach here at the same time, the first one wins.
-                // The allocated memory will be reclaimed by Garbage Collector.
-                _cache.TryAdd(cacheLookupKey, encryptionKey);
+                // If the cache TTL is zero, don't even bother inserting to the cache.
+                if (SqlConnection.ColumnEncryptionKeyCacheTtl != TimeSpan.Zero) {
+                    // In case multiple threads reach here at the same time, the first one wins.
+                    // The allocated memory will be reclaimed by Garbage Collector.
+                    DateTimeOffset expirationTime = DateTimeOffset.UtcNow.Add(SqlConnection.ColumnEncryptionKeyCacheTtl);
+                    _cache.Add(cacheLookupKey, encryptionKey, expirationTime);
+                }
             }
 
             return true;
index ae7086f0a0608738e7f68bea83af34dc3b580978..a15b18937676d5a39c673416098253c5b7c40546 100644 (file)
@@ -1543,7 +1543,7 @@ namespace System.Data.SqlClient {
             return Res.GetString(Res.SQL_SSPIGenerateError);
         }
         static internal string Timeout() {
-            return Res.GetString(Res.SQL_Timeout);
+            return Res.GetString(Res.SQL_Timeout_Execution);
         }
         static internal string Timeout_PreLogin_Begin() {
             return Res.GetString(Res.SQL_Timeout_PreLogin_Begin);
index 319e252b21b826ab021665c375d7941afb450591..11e3cdd98efd79562964e1fcaf8bac00e1dd2999 100644 (file)
@@ -544,6 +544,9 @@ namespace System.Data.SqlClient {
         public const int IMPERSONATION_FAILED = 1346;
         public const int P_TOKENTOOLONG = 103;
 
+        // SQL error that indicates retry for Always Encrypted
+        public const int TCE_CONVERSION_ERROR_CLIENT_RETRY = 33514;
+
         // SNI\Win32 error values
         // NOTE: these are simply windows system error codes, not SNI specific
         public const uint  SNI_UNINITIALIZED        = unchecked((uint)-1);
index f8f3d1d95c519a2aff87a3ad758b5af41d56cb60..1af6e149ac5103925822c259ea1348fca50f5cf6 100644 (file)
@@ -883,7 +883,6 @@ namespace System.Xml {
             RealFoliate();
             AssertValid();
             if ( NodeType == XPathNodeType.Namespace ) {
-                Debug.Assert( _parentOfNS != null );
                 MoveTo( _parentOfNS );
                 return true;
             }
index 8a130a0f34285449d7dc69480eff98e832bf3edd..9224bf8b8fbac5bb40399ab2c13c752e3f0fd57f 100644 (file)
@@ -3,6 +3,15 @@
 //   Copyright (c) Microsoft Corporation.  All rights reserved.
 // 
 // ==--==
+
+// There are cases where we have multiple assemblies that are going to import this file and 
+// if they are going to also have InternalsVisibleTo between them, there will be a compiler warning
+// that the type is found both in the source and in a referenced assembly. The compiler will prefer 
+// the version of the type defined in the source
+//
+// In order to disable the warning for this type we are disabling this warning for this entire file.
+#pragma warning disable 436
+
 using System;
 using System.Collections.Generic;
 
@@ -167,3 +176,5 @@ namespace System
         static partial void PopulateDefaultValuesPartial(string platformIdentifier, string profile, int version);
     }
 }
+
+#pragma warning restore 436
index f05b599ed3d2b9af36cb7cd29c3c39123370cf6e..33662b54280621d4ef98247f98badecf87773fda 100644 (file)
@@ -4,6 +4,14 @@
 // 
 // ==--==
 
+// There are cases where we have multiple assemblies that are going to import this file and 
+// if they are going to also have InternalsVisibleTo between them, there will be a compiler warning
+// that the type is found both in the source and in a referenced assembly. The compiler will prefer 
+// the version of the type defined in the source
+//
+// In order to disable the warning for this type we are disabling this warning for this entire file.
+#pragma warning disable 436
+
 // NOTE: This file should not be included in mscorlib. This should only be included in FX libraries that need to provide switches
 using System;
 using System.Collections.Generic;
@@ -126,3 +134,5 @@ namespace System
         }
     }
 }
+
+#pragma warning restore 436
index 4113bd328c7cbca5fae68c51b09f8a09eb459ea4..7561fffb97fc10cc47b715f422fee4b0ce0a6a15 100644 (file)
@@ -5,12 +5,14 @@
 namespace System.IdentityModel.Claims
 {
     using System.Collections.Generic;
+    using System.Diagnostics;
     using System.IdentityModel.Policy;
     using System.Net.Mail;
     using System.Security.Claims;
     using System.Security.Cryptography;
     using System.Security.Cryptography.X509Certificates;
     using System.Security.Principal;
+    using Globalization;
 
     public class X509CertificateClaimSet : ClaimSet, IIdentityInfo, IDisposable
     {
@@ -172,24 +174,7 @@ namespace System.IdentityModel.Claims
             if (!string.IsNullOrEmpty(value))
                 claims.Add(Claim.CreateX500DistinguishedNameClaim(this.certificate.SubjectName));
 
-            // App context switch for disabling support for multiple dns entries in a SAN certificate
-            if (LocalAppContextSwitches.DisableMultipleDNSEntriesInSANCertificate)
-            {
-                // old behavior, default for <= 4.6
-                value = this.certificate.GetNameInfo(X509NameType.DnsName, false);
-                if (!string.IsNullOrEmpty(value))
-                    claims.Add(Claim.CreateDnsClaim(value));
-            }
-            else
-            {
-                // new behavior as this is the default long term behavior
-                // Since a SAN can have multiple DNS entries
-                string[] entries = GetDnsFromExtensions(this.certificate);
-                for (int i = 0; i < entries.Length; ++i)
-                {
-                    claims.Add(Claim.CreateDnsClaim(entries[i]));
-                }
-            }
+            claims.AddRange(GetDnsClaims(this.certificate));
 
             value = this.certificate.GetNameInfo(X509NameType.SimpleName, false);
             if (!string.IsNullOrEmpty(value))
@@ -258,25 +243,8 @@ namespace System.IdentityModel.Claims
             {
                 if (right == null || Rights.PossessProperty.Equals(right))
                 {
-                    // App context switch for disabling support for multiple dns entries in a SAN certificate
-                    if (LocalAppContextSwitches.DisableMultipleDNSEntriesInSANCertificate)
-                    {
-                        // old behavior, default for <= 4.6
-                        string value = this.certificate.GetNameInfo(X509NameType.DnsName, false);
-                        if (!string.IsNullOrEmpty(value))
-                        {
-                            yield return Claim.CreateDnsClaim(value);
-                        }
-                    }
-                    else
-                    {
-                        // new behavior since this is the default long term behavior
-                        string[] entries = GetDnsFromExtensions(certificate);
-                        for (int i = 0; i < entries.Length; ++i)
-                        {
-                            yield return Claim.CreateDnsClaim(entries[i]);
-                        }
-                    }
+                    foreach (var claim in GetDnsClaims(certificate))
+                        yield return claim;
                 }
             }
             else
@@ -299,31 +267,44 @@ namespace System.IdentityModel.Claims
             }
         }
 
-        // Fixing Bug 795660: SAN having multiple DNS entries
-        private static string[] GetDnsFromExtensions(X509Certificate2 cert)
+        private static List<Claim> GetDnsClaims(X509Certificate2 cert)
         {
-            foreach (X509Extension ext in cert.Extensions)
+            List<Claim> dnsClaimEntries = new List<Claim>();
+
+            // old behavior, default for <= 4.6
+            string value = cert.GetNameInfo(X509NameType.DnsName, false);
+            if (!string.IsNullOrEmpty(value))
+                dnsClaimEntries.Add(Claim.CreateDnsClaim(value));
+
+            // App context switch for disabling support for multiple dns entries in a SAN certificate
+            // If we can't dynamically parse the alt subject names, we will not add any dns claims ONLY for the alt subject names.
+            // In this way, if the X509NameType.DnsName was enough to succeed for the out-bound-message. We would have a success.
+            if (!LocalAppContextSwitches.DisableMultipleDNSEntriesInSANCertificate && X509SubjectAlternativeNameConstants.SuccessfullyInitialized)
             {
-                // Extension is SAN or SAN2
-                if (ext.Oid.Value == "2.5.29.7" || ext.Oid.Value == "2.5.29.17")
+                foreach (X509Extension ext in cert.Extensions)
                 {
-                    string asnString = ext.Format(true);
-                    if (string.IsNullOrEmpty(asnString))
+                    // Extension is SAN or SAN2
+                    if (ext.Oid.Value == X509SubjectAlternativeNameConstants.SanOid || ext.Oid.Value == X509SubjectAlternativeNameConstants.San2Oid)
                     {
-                        return new string[0];
-                    }
-
-                    string[] rawDnsEntries = asnString.Split(new string[1] { "\n" }, StringSplitOptions.RemoveEmptyEntries);
-                    string[] dnsEntries = new string[rawDnsEntries.Length];
-                    for (int i = 0; i < rawDnsEntries.Length; ++i)
-                    {
-                        int equalSignIndex = rawDnsEntries[i].IndexOf('=');
-                        dnsEntries[i] = rawDnsEntries[i].Substring(equalSignIndex + 1).Trim();
+                        string asnString = ext.Format(false);
+                        if (string.IsNullOrWhiteSpace(asnString))
+                            break;
+
+                        // SubjectAlternativeNames might contain something other than a dNSName, 
+                        // so we have to parse through and only use the dNSNames
+                        // <identifier><delimiter><value><separator(s)>
+                        string[] rawDnsEntries = asnString.Split(X509SubjectAlternativeNameConstants.SeparatorArray, StringSplitOptions.RemoveEmptyEntries);
+                        for (int i = 0; i < rawDnsEntries.Length; i++)
+                        {
+                            string[] keyval = rawDnsEntries[i].Split(X509SubjectAlternativeNameConstants.Delimiter);
+                            if (string.Equals(keyval[0], X509SubjectAlternativeNameConstants.Identifier))
+                                dnsClaimEntries.Add(Claim.CreateDnsClaim(keyval[1]));
+                        }
                     }
-                    return dnsEntries;
                 }
             }
-            return new string[0];
+
+            return dnsClaimEntries;
         }
 
         public override IEnumerator<Claim> GetEnumerator()
@@ -367,6 +348,107 @@ namespace System.IdentityModel.Claims
                 get { return this.identity; }
             }
         }
+
+        // We don't have a strongly typed extension to parse Subject Alt Names, so we have to do a workaround 
+        // to figure out what the identifier, delimiter, and separator is by using a well-known extension
+        private static class X509SubjectAlternativeNameConstants
+        {
+            public const string SanOid = "2.5.29.7";
+            public const string San2Oid = "2.5.29.17";
+
+            public static string Identifier
+            {
+                get;
+                private set;
+            }
+
+            public static char Delimiter
+            {
+                get;
+                private set;
+            }
+
+            public static string Separator
+            {
+                get;
+                private set;
+            }
+
+            public static string[] SeparatorArray
+            {
+                get;
+                private set;
+            }
+
+            public static bool SuccessfullyInitialized
+            {
+                get;
+                private set;
+            }
+
+            // static initializer will run before properties are accessed
+            static X509SubjectAlternativeNameConstants()
+            {
+                // Extracted a well-known X509Extension
+                byte[] x509ExtensionBytes = new byte[] {
+                    48, 36, 130, 21, 110, 111, 116, 45, 114, 101, 97, 108, 45, 115, 117, 98, 106, 101, 99,
+                    116, 45, 110, 97, 109, 101, 130, 11, 101, 120, 97, 109, 112, 108, 101, 46, 99, 111, 109
+                };
+                const string subjectName = "not-real-subject-name";
+                string x509ExtensionFormattedString = string.Empty;
+                try
+                {
+                    X509Extension x509Extension = new X509Extension(SanOid, x509ExtensionBytes, true);
+                    x509ExtensionFormattedString = x509Extension.Format(false);
+
+                    // Each OS has a different dNSName identifier and delimiter
+                    // On Windows, dNSName == "DNS Name" (localizable), on Linux, dNSName == "DNS"
+                    // e.g.,
+                    // Windows: x509ExtensionFormattedString is: "DNS Name=not-real-subject-name, DNS Name=example.com"
+                    // Linux:   x509ExtensionFormattedString is: "DNS:not-real-subject-name, DNS:example.com"
+                    // Parse: <identifier><delimiter><value><separator(s)>
+
+                    int delimiterIndex = x509ExtensionFormattedString.IndexOf(subjectName) - 1;
+                    Delimiter = x509ExtensionFormattedString[delimiterIndex];
+
+                    // Make an assumption that all characters from the the start of string to the delimiter 
+                    // are part of the identifier
+                    Identifier = x509ExtensionFormattedString.Substring(0, delimiterIndex);
+
+                    int separatorFirstChar = delimiterIndex + subjectName.Length + 1;
+                    int separatorLength = 1;
+                    for (int i = separatorFirstChar + 1; i < x509ExtensionFormattedString.Length; i++)
+                    {
+                        // We advance until the first character of the identifier to determine what the
+                        // separator is. This assumes that the identifier assumption above is correct
+                        if (x509ExtensionFormattedString[i] == Identifier[0])
+                        {
+                            break;
+                        }
+
+                        separatorLength++;
+                    }
+
+                    Separator = x509ExtensionFormattedString.Substring(separatorFirstChar, separatorLength);
+                    SeparatorArray = new string[1] { Separator };
+                    SuccessfullyInitialized = true;
+                }
+                catch (Exception ex)
+                {
+                    SuccessfullyInitialized = false;                    
+                    DiagnosticUtility.TraceHandledException(
+                        new FormatException(string.Format(CultureInfo.InvariantCulture,
+                        "There was an error parsing the SubjectAlternativeNames: '{0}'. See inner exception for more details.{1}Detected values were: Identifier: '{2}'; Delimiter:'{3}'; Separator:'{4}'",
+                        x509ExtensionFormattedString,
+                        Environment.NewLine,
+                        Identifier,
+                        Delimiter,
+                        Separator),
+                        ex), 
+                        TraceEventType.Warning);
+                }
+            }
+        }
     }
 
     class X509Identity : GenericIdentity, IDisposable
index f18ab5dd5824bbf60ee56a465b811217cd3f5877..b6bc822248a4ab80b622f4a052e70a37b5635d00 100644 (file)
@@ -15,9 +15,11 @@ namespace System.IdentityModel
     {
         private const string EnableCachedEmptyDefaultAuthorizationContextString = "Switch.System.IdentityModel.EnableCachedEmptyDefaultAuthorizationContext";
         private const string DisableMultipleDNSEntriesInSANCertificateString = "Switch.System.IdentityModel.DisableMultipleDNSEntriesInSANCertificate";
+        private const string DisableUpdatingRsaProviderTypeString = "Switch.System.IdentityModel.DisableUpdatingRsaProviderType";
 
         private static int enableCachedEmptyDefaultAuthorizationContext;
         private static int disableMultipleDNSEntriesInSANCertificate;
+        private static int disableUpdatingRsaProviderType;
 
         public static bool EnableCachedEmptyDefaultAuthorizationContext
         {
@@ -37,16 +39,29 @@ namespace System.IdentityModel
             }
         }
 
+        public static bool DisableUpdatingRsaProviderType
+        {
+            [MethodImpl(MethodImplOptions.AggressiveInlining)]
+            get
+            {
+                return LocalAppContext.GetCachedSwitchValue(DisableUpdatingRsaProviderTypeString, ref disableUpdatingRsaProviderType);
+            }
+        }
+
         public static void SetDefaultsLessOrEqual_452()
         {
+#pragma warning disable BCL0012
             // Define the switches that should be true for 4.5.2 or less, false for 4.6+.
             LocalAppContext.DefineSwitchDefault(EnableCachedEmptyDefaultAuthorizationContextString, true);
+#pragma warning restore BCL0012
         }
 
         public static void SetDefaultsLessOrEqual_46()
         {
+#pragma warning disable BCL0012
             // Define the switches that should be true for 4.6 or less, false for 4.6.1+.
             LocalAppContext.DefineSwitchDefault(DisableMultipleDNSEntriesInSANCertificateString, true);
+#pragma warning restore BCL0012
         }
     }
 }
index 397194f64469e1e27eac88262308920f3dc5b204..fb1918c6ca6f823c3c159dda9906958fdd153b4b 100644 (file)
@@ -309,22 +309,26 @@ namespace System.IdentityModel.Tokens
             {
                 throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(algorithm, SR.GetString(SR.EmptyOrNullArgumentString, "algorithm"));
             }
-            // We support one of the two algoritms, but not both.
+
+            // We support:
             //     XmlDsigDSAUrl = "http://www.w3.org/2000/09/xmldsig#dsa-sha1";
             //     XmlDsigRSASHA1Url = "http://www.w3.org/2000/09/xmldsig#rsa-sha1";
+            //     RsaSha256Signature = "http://www.w3.org/2001/04/xmldsig-more#rsa-sha256";
+            AsymmetricAlgorithm privateKey = LevelUpRsa(this.PrivateKey, algorithm);
+
             object algorithmObject = CryptoHelper.GetAlgorithmFromConfig(algorithm);
             if (algorithmObject != null)
             {
                 SignatureDescription description = algorithmObject as SignatureDescription;
                 if (description != null)
-                    return description.CreateFormatter(this.PrivateKey);
+                    return description.CreateFormatter(privateKey);
 
                 try
                 {
                     AsymmetricSignatureFormatter asymmetricSignatureFormatter = algorithmObject as AsymmetricSignatureFormatter;
                     if (asymmetricSignatureFormatter != null)
                     {
-                        asymmetricSignatureFormatter.SetKey(this.PrivateKey);
+                        asymmetricSignatureFormatter.SetKey(privateKey);
                         return asymmetricSignatureFormatter;
                     }
                 }
@@ -356,19 +360,10 @@ namespace System.IdentityModel.Tokens
 
                 case SecurityAlgorithms.RsaSha256Signature:
                     // Ensure that we have an RSA algorithm object.
-                    RSACryptoServiceProvider rsa_prov_full = (this.PrivateKey as RSACryptoServiceProvider);
-                    if (rsa_prov_full == null)
+                    RSA rsaSha256 = (privateKey as RSA);
+                    if (rsaSha256 == null)
                         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotSupportedException(SR.GetString(SR.PrivateKeyNotRSA)));
-                    CspParameters csp = new CspParameters();
-                    csp.ProviderType = 24;
-                    csp.KeyContainerName = rsa_prov_full.CspKeyContainerInfo.KeyContainerName;
-                    csp.KeyNumber = (int)rsa_prov_full.CspKeyContainerInfo.KeyNumber;
-                    if (rsa_prov_full.CspKeyContainerInfo.MachineKeyStore)
-                        csp.Flags = CspProviderFlags.UseMachineKeyStore;
-                    
-                    csp.Flags |= CspProviderFlags.UseExistingKey;
-
-                    return new RSAPKCS1SignatureFormatter(new RSACryptoServiceProvider(csp));
+                    return new RSAPKCS1SignatureFormatter(rsaSha256);
 
                 default:
                     throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotSupportedException(SR.GetString(SR.UnsupportedCryptoAlgorithm, algorithm)));
@@ -376,6 +371,45 @@ namespace System.IdentityModel.Tokens
 
         }
 
+        private static AsymmetricAlgorithm LevelUpRsa(AsymmetricAlgorithm asymmetricAlgorithm, string algorithm)
+        {
+            // If user turned off leveling up at app level, return
+            if (LocalAppContextSwitches.DisableUpdatingRsaProviderType)
+                return asymmetricAlgorithm;
+
+            if (asymmetricAlgorithm == null)
+                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("asymmetricAlgorithm"));
+
+            if (string.IsNullOrEmpty(algorithm))
+                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(algorithm, SR.GetString(SR.EmptyOrNullArgumentString, "algorithm"));
+
+            // only level up if alg is sha256
+            if (!string.Equals(algorithm, SecurityAlgorithms.RsaSha256Signature))
+                return asymmetricAlgorithm;
+
+            RSACryptoServiceProvider rsaCsp = asymmetricAlgorithm as RSACryptoServiceProvider;
+            if (rsaCsp == null)
+                return asymmetricAlgorithm;
+
+            // ProviderType == 1(PROV_RSA_FULL) and providerType == 12(PROV_RSA_SCHANNEL) are provider types that only support SHA1. Change them to PROV_RSA_AES=24 that supports SHA2 also.
+            // Only levels up if the associated key is not a hardware key.
+            // Another provider type related to rsa, PROV_RSA_SIG == 2 that only supports Sha1 is no longer supported
+            if ((rsaCsp.CspKeyContainerInfo.ProviderType == 1 || rsaCsp.CspKeyContainerInfo.ProviderType == 12) && !rsaCsp.CspKeyContainerInfo.HardwareDevice)
+            {
+                CspParameters csp = new CspParameters();
+                csp.ProviderType = 24;
+                csp.KeyContainerName = rsaCsp.CspKeyContainerInfo.KeyContainerName;
+                csp.KeyNumber = (int)rsaCsp.CspKeyContainerInfo.KeyNumber;
+                if (rsaCsp.CspKeyContainerInfo.MachineKeyStore)
+                    csp.Flags = CspProviderFlags.UseMachineKeyStore;
+
+                csp.Flags |= CspProviderFlags.UseExistingKey;
+                return new RSACryptoServiceProvider(csp);
+            }
+
+            return rsaCsp;
+        }
+
         public override bool HasPrivateKey()
         {
             return (this.PrivateKey != null);
index 8b32bedf742df80aaeba5119b2d5a6c05aba5524..05af1435998d748e0440081b5e4fab813001612f 100644 (file)
@@ -27,7 +27,7 @@ namespace System.Runtime.Caching {
         private long[] _cacheSizeSamples;
         private DateTime[] _cacheSizeSampleTimes;
         private int _idx;
-        private SRef _sizedRef;
+        private SRefMultiple _sizedRefMultiple;
         private int _gen2Count;
         private long _memoryLimit;
 
@@ -51,7 +51,7 @@ namespace System.Runtime.Caching {
         private void InitDisposableMembers(int cacheMemoryLimitMegabytes) {
             bool dispose = true;
             try {
-                _sizedRef = new SRef(_memoryCache);
+                _sizedRefMultiple = new SRefMultiple(_memoryCache.AllSRefTargets);
                 SetLimit(cacheMemoryLimitMegabytes);
                 InitHistory();
                 dispose = false;
@@ -112,8 +112,8 @@ namespace System.Runtime.Caching {
         }
 
         public void Dispose() {
-            SRef sref = _sizedRef;
-            if (sref != null && Interlocked.CompareExchange(ref _sizedRef, null, sref) == sref) {
+            SRefMultiple sref = _sizedRefMultiple;
+            if (sref != null && Interlocked.CompareExchange(ref _sizedRefMultiple, null, sref) == sref) {
                 sref.Dispose();
             }
             IMemoryCacheManager memoryCacheManager = s_memoryCacheManager;
@@ -139,7 +139,7 @@ namespace System.Runtime.Caching {
             // This update must happen, otherwise the CacheManager won't 
             // know the total cache size.
             int gen2Count = GC.CollectionCount(2);
-            SRef sref = _sizedRef;
+            SRefMultiple sref = _sizedRefMultiple;
             if (gen2Count != _gen2Count && sref != null) {
                 // update _gen2Count
                 _gen2Count = gen2Count;
index 816319755cb9a6ba3d5fe0d93211753585a1c8b4..f74996a20e11cfb99afd0ed2079fcf23fd69a3cc 100644 (file)
@@ -27,9 +27,8 @@ namespace System.Runtime.Caching {
         private static object s_initLock = new object();
         private static MemoryCache s_defaultCache;
         private static CacheEntryRemovedCallback s_sentinelRemovedCallback = new CacheEntryRemovedCallback(SentinelEntry.OnCacheEntryRemovedCallback);
-        private MemoryCacheStore[] _stores;
+        private GCHandleRef<MemoryCacheStore>[] _storeRefs;
         private int _storeCount;
-        private int _storeMask;
         private int _disposed;
         private MemoryCacheStatistics _stats;
         private string _name;
@@ -150,8 +149,18 @@ namespace System.Runtime.Caching {
             if (hashCode < 0) {
                 hashCode = (hashCode == Int32.MinValue) ? 0 : -hashCode;
             }
-            int idx = hashCode & _storeMask;
-            return _stores[idx];
+            int idx = hashCode % _storeCount;
+            return _storeRefs[idx].Target;
+        }
+
+        internal object[] AllSRefTargets {
+            get {
+                var allStores = new MemoryCacheStore[_storeCount];
+                for (int i = 0; i < _storeCount; i++) {
+                    allStores[i] = _storeRefs[i].Target;
+                }
+                return allStores;
+            }
         }
 
         [SecuritySafeCritical]
@@ -166,8 +175,8 @@ namespace System.Runtime.Caching {
                 catch {
                     // ignore exceptions from perf counters
                 }
-                for (int i = 0; i < _stores.Length; i++) {
-                    _stores[i] = new MemoryCacheStore(this, _perfCounters);
+                for (int i = 0; i < _storeCount; i++) {
+                    _storeRefs[i] = new GCHandleRef<MemoryCacheStore> (new MemoryCacheStore(this, _perfCounters));
                 }
                 _stats = new MemoryCacheStatistics(this, config);
                 AppDomain appDomain = Thread.GetDomain();
@@ -321,8 +330,7 @@ namespace System.Runtime.Caching {
                 }
             }
 #endif
-            _storeMask = _storeCount - 1;
-            _stores = new MemoryCacheStore[_storeCount];
+            _storeRefs = new GCHandleRef<MemoryCacheStore>[_storeCount];
             InitDisposableMembers(config);
         }
 
@@ -392,10 +400,10 @@ namespace System.Runtime.Caching {
                 if (_stats != null) {
                     _stats.Dispose();
                 }
-                if (_stores != null) {
-                    foreach (MemoryCacheStore store in _stores) {
-                        if (store != null) {
-                            store.Dispose();
+                if (_storeRefs != null) {
+                    foreach (var storeRef in _storeRefs) {
+                        if (storeRef != null) {
+                            storeRef.Dispose();
                         }
                     }
                 }
@@ -442,8 +450,8 @@ namespace System.Runtime.Caching {
         IEnumerator IEnumerable.GetEnumerator() {
             Hashtable h = new Hashtable();
             if (!IsDisposed) {
-                foreach (MemoryCacheStore store in _stores) {
-                    store.CopyTo(h);
+                foreach (var storeRef in _storeRefs) {
+                    storeRef.Target.CopyTo(h);
                 }
             }
             return h.GetEnumerator();
@@ -452,8 +460,8 @@ namespace System.Runtime.Caching {
         protected override IEnumerator<KeyValuePair<string, object>> GetEnumerator() {
             Dictionary<string, object> h = new Dictionary<string, object>();
             if (!IsDisposed) {
-                foreach (MemoryCacheStore store in _stores) {
-                    store.CopyTo(h);
+                foreach (var storeRef in _storeRefs) {
+                    storeRef.Target.CopyTo(h);
                 }
             }
             return h.GetEnumerator();
@@ -471,8 +479,8 @@ namespace System.Runtime.Caching {
             }
             long trimmed = 0;
             if (_disposed == 0) {
-                foreach (MemoryCacheStore store in _stores) {
-                    trimmed += store.TrimInternal(percent);
+                foreach (var storeRef in _storeRefs) {
+                    trimmed += storeRef.Target.TrimInternal(percent);
                 }
             }
             return trimmed;
@@ -680,8 +688,8 @@ namespace System.Runtime.Caching {
             }
             long count = 0;
             if (!IsDisposed) {
-                foreach (MemoryCacheStore store in _stores) {
-                    count += store.Count;
+                foreach (var storeRef in _storeRefs) {
+                    count += storeRef.Target.Count;
                 }
             }
             return count;
index 61d3ce3ace7fe6afb598662aa5e4d3aa046020f6..99196c05f5d90ee6dd78ad6478fb673f26680b88 100644 (file)
@@ -27,7 +27,7 @@ namespace System.Runtime.Caching {
         private int _lastTrimPercent;
         private DateTime _lastTrimTime;        
         private int _pollingInterval;
-        private Timer _timer;
+        private GCHandleRef<Timer> _timerHandleRef;
         private Object _timerLock;
         private long _totalCountBeforeTrim;
 
@@ -44,16 +44,18 @@ namespace System.Runtime.Caching {
         private void AdjustTimer() {
             lock (_timerLock) {
 
-                if (_timer == null)
+                if (_timerHandleRef == null)
                     return;
 
+                Timer timer = _timerHandleRef.Target;
+
                 // the order of these if statements is important
 
                 // When above the high pressure mark, interval should be 5 seconds or less
                 if (_physicalMemoryMonitor.IsAboveHighPressure() || _cacheMemoryMonitor.IsAboveHighPressure()) {
                     if (_pollingInterval > MEMORYSTATUS_INTERVAL_5_SECONDS) {
                         _pollingInterval = MEMORYSTATUS_INTERVAL_5_SECONDS;
-                        _timer.Change(_pollingInterval, _pollingInterval);
+                        timer.Change(_pollingInterval, _pollingInterval);
                     }
                     return;
                 }
@@ -65,7 +67,7 @@ namespace System.Runtime.Caching {
                     int newPollingInterval = Math.Min(_configPollingInterval, MEMORYSTATUS_INTERVAL_30_SECONDS);
                     if (_pollingInterval != newPollingInterval) {
                         _pollingInterval = newPollingInterval;
-                        _timer.Change(_pollingInterval, _pollingInterval);
+                        timer.Change(_pollingInterval, _pollingInterval);
                     }
                     return;
                 }
@@ -73,7 +75,7 @@ namespace System.Runtime.Caching {
                 // there is no pressure, interval should be the value from config
                 if (_pollingInterval != _configPollingInterval) {
                     _pollingInterval = _configPollingInterval;
-                    _timer.Change(_pollingInterval, _pollingInterval);
+                    timer.Change(_pollingInterval, _pollingInterval);
                 }
             }
         }
@@ -126,7 +128,8 @@ namespace System.Runtime.Caching {
             bool dispose = true;
             try {
                 _cacheMemoryMonitor = new CacheMemoryMonitor(_memoryCache, _configCacheMemoryLimitMegabytes);
-                _timer = new Timer(new TimerCallback(CacheManagerTimerCallback), null, _configPollingInterval, _configPollingInterval);
+                Timer timer = new Timer(new TimerCallback(CacheManagerTimerCallback), null, _configPollingInterval, _configPollingInterval);
+                _timerHandleRef = new GCHandleRef<Timer>(timer);
                 dispose = false;
             }
             finally {
@@ -246,9 +249,9 @@ namespace System.Runtime.Caching {
         public void Dispose() {
             if (Interlocked.Exchange(ref _disposed, 1) == 0) {
                 lock (_timerLock) {
-                    Timer timer = _timer;
-                    if (timer != null && Interlocked.CompareExchange(ref _timer, null, timer) == timer) {
-                        timer.Dispose();
+                    GCHandleRef<Timer> timerHandleRef = _timerHandleRef;
+                    if (timerHandleRef != null && Interlocked.CompareExchange(ref _timerHandleRef, null, timerHandleRef) == timerHandleRef) {
+                        timerHandleRef.Dispose();
                         Dbg.Trace("MemoryCacheStats", "Stopped CacheMemoryTimers");
                     }
                 }
index 27ee134e46e8f5fc6ba8775e92d3689a8fdb2fec..50374308bafd044687a2c868fb025e1b56591d3d 100644 (file)
@@ -7,24 +7,33 @@ using System.Reflection;
 using System.Security;
 using System.Security.Permissions;
 using System.Diagnostics.CodeAnalysis;
+using System.Runtime.InteropServices;
 
 namespace System.Runtime.Caching {
     internal class SRef {
+#if !MONO
         private static Type s_type = Type.GetType("System.SizedReference", true, false);
         private Object _sizedRef;
+#endif
 
         internal SRef(Object target) {
+#if !MONO
             _sizedRef = Activator.CreateInstance(s_type,
                     BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.CreateInstance,
                     null,
                     new object[] { target },
                     null);
+#endif
         }
 
         internal long ApproximateSize {
             [SecuritySafeCritical]
             [PermissionSet(SecurityAction.Assert, Unrestricted = true)]
             get {
+#if MONO
+                // TODO: .net uses System.SizedReference which contains approximate size after Gen 2 collection
+                return 16;
+#else
                 object o = s_type.InvokeMember("ApproximateSize",
                                                BindingFlags.Public | BindingFlags.Instance | BindingFlags.GetProperty,
                                                null, // binder
@@ -32,6 +41,7 @@ namespace System.Runtime.Caching {
                                                null, // args
                                                CultureInfo.InvariantCulture);
                 return (long)o;
+#endif
             }
         }
 
@@ -40,12 +50,87 @@ namespace System.Runtime.Caching {
         [SecuritySafeCritical]
         [PermissionSet(SecurityAction.Assert, Unrestricted = true)]
         internal void Dispose() {
+#if !MONO
             s_type.InvokeMember("Dispose",
                                 BindingFlags.Public | BindingFlags.Instance | BindingFlags.InvokeMethod,
                                 null, // binder
                                 _sizedRef, // target
                                 null, // args
                                 CultureInfo.InvariantCulture);
+#endif
+        }
+    }
+
+    internal class SRefMultiple {
+        private SRef[] _srefs;
+        private long[] _sizes;  // Getting SRef size in the debugger is extremely tedious so we keep the last read value here
+
+        internal SRefMultiple(object[] targets) {
+            _srefs = new SRef[targets.Length];
+            _sizes = new long[targets.Length];
+            for (int i = 0; i < targets.Length; i++) {
+                _srefs[i] = new SRef(targets[i]);
+            }
+        }
+
+        internal long ApproximateSize {
+            get {
+                long size = 0;
+                for (int i = 0; i < _srefs.Length; i++) {
+                    size += (_sizes[i] = _srefs[i].ApproximateSize);
+                }
+                return size;
+            }
+        }
+
+        internal void Dispose() {
+            foreach (SRef s in _srefs) {
+                s.Dispose();
+            }
+        }
+    }
+
+    internal class GCHandleRef<T> : IDisposable
+    where T : class, IDisposable {
+        GCHandle _handle;
+        T _t;
+
+        [SecuritySafeCritical]
+        [PermissionSet(SecurityAction.Assert, Unrestricted = true)]
+        public GCHandleRef(T t) {
+            _handle = GCHandle.Alloc(t);
+        }
+
+        public T Target {
+            [SecuritySafeCritical]
+            [PermissionSet(SecurityAction.Assert, Unrestricted = true)]
+            get {
+                try { 
+                    T t = (T)_handle.Target;
+                    if (t != null) {
+                        return t;
+                    }
+                }
+                catch (InvalidOperationException) {
+                    // use the normal reference instead of throwing an exception when _handle is already freed
+                }
+                return _t;
+            }
+        }
+
+        [SecuritySafeCritical]
+        [PermissionSet(SecurityAction.Assert, Unrestricted = true)]
+        public void Dispose() {
+            Target.Dispose();
+            // Safe to call Dispose more than once but not thread-safe
+            if (_handle.IsAllocated) {
+                // We must free the GC handle to avoid leaks.
+                // However after _handle is freed we no longer have access to its Target
+                // which will cause AVs and various race conditions under stress.
+                // We revert to using normal references after disposing the GC handle
+                _t = (T)_handle.Target;
+                _handle.Free();
+            }
         }
     }
 }
index c63c76f91537ad23db1f24fb585d429c313200cd..2ed1d48643d071051cbb40b991b398d60b8f2f8f 100644 (file)
@@ -458,7 +458,8 @@ namespace System.Runtime.Serialization
                 if (dataContract == null)
                 {
                     dataContract = CreateGetOnlyCollectionDataContract(id, typeHandle, type);
-                    dataContractCache[id] = dataContract;
+
+                    AssignDataContractToId(dataContract, id);
                 }
                 return dataContract;
             }
@@ -480,7 +481,10 @@ namespace System.Runtime.Serialization
                 {
                     return id;
                 }
-                for (int i = 0; i < DataContractCriticalHelper.dataContractID; i++)
+
+                int currentDataContractId = DataContractCriticalHelper.dataContractID;
+
+                for (int i = 0; i < currentDataContractId; i++)
                 {
                     if (ContractMatches(classContract, dataContractCache[i]))
                     {
@@ -542,49 +546,66 @@ namespace System.Runtime.Serialization
             // check whether a corresponding update is required in ClassDataContract.IsNonAttributedTypeValidForSerialization
             static DataContract CreateDataContract(int id, RuntimeTypeHandle typeHandle, Type type)
             {
-                lock (createDataContractLock)
+                DataContract dataContract = dataContractCache[id];
+
+                if (dataContract == null)
                 {
-                    DataContract dataContract = dataContractCache[id];
-                    if (dataContract == null)
+                    lock (createDataContractLock)
                     {
-                        if (type == null)
-                            type = Type.GetTypeFromHandle(typeHandle);
-                        type = UnwrapNullableType(type);
-                        type = GetDataContractAdapterType(type);
-                        dataContract = GetBuiltInDataContract(type);
+                        dataContract = dataContractCache[id];
+
                         if (dataContract == null)
                         {
-                            if (type.IsArray)
-                                dataContract = new CollectionDataContract(type);
-                            else if (type.IsEnum)
-                                dataContract = new EnumDataContract(type);
-                            else if (type.IsGenericParameter)
-                                dataContract = new GenericParameterDataContract(type);
-                            else if (Globals.TypeOfIXmlSerializable.IsAssignableFrom(type))
-                                dataContract = new XmlDataContract(type);
-                            else
+                            if (type == null)
+                                type = Type.GetTypeFromHandle(typeHandle);
+                            type = UnwrapNullableType(type);
+                            type = GetDataContractAdapterType(type);
+                            dataContract = GetBuiltInDataContract(type);
+                            if (dataContract == null)
                             {
-                                //if (type.ContainsGenericParameters)
-                                //    ThrowInvalidDataContractException(SR.GetString(SR.TypeMustNotBeOpenGeneric, type), type);
-                                if (type.IsPointer)
-                                    type = Globals.TypeOfReflectionPointer;
-
-                                if (!CollectionDataContract.TryCreate(type, out dataContract))
+                                if (type.IsArray)
+                                    dataContract = new CollectionDataContract(type);
+                                else if (type.IsEnum)
+                                    dataContract = new EnumDataContract(type);
+                                else if (type.IsGenericParameter)
+                                    dataContract = new GenericParameterDataContract(type);
+                                else if (Globals.TypeOfIXmlSerializable.IsAssignableFrom(type))
+                                    dataContract = new XmlDataContract(type);
+                                else
                                 {
-                                    if (type.IsSerializable || type.IsDefined(Globals.TypeOfDataContractAttribute, false) || ClassDataContract.IsNonAttributedTypeValidForSerialization(type))
-                                    {
-                                        dataContract = new ClassDataContract(type);
-                                    }
-                                    else
+                                    //if (type.ContainsGenericParameters)
+                                    //    ThrowInvalidDataContractException(SR.GetString(SR.TypeMustNotBeOpenGeneric, type), type);
+                                    if (type.IsPointer)
+                                        type = Globals.TypeOfReflectionPointer;
+
+                                    if (!CollectionDataContract.TryCreate(type, out dataContract))
                                     {
-                                        ThrowInvalidDataContractException(SR.GetString(SR.TypeNotSerializable, type), type);
+                                        if (type.IsSerializable || type.IsDefined(Globals.TypeOfDataContractAttribute, false) || ClassDataContract.IsNonAttributedTypeValidForSerialization(type))
+                                        {
+                                            dataContract = new ClassDataContract(type);
+                                        }
+                                        else
+                                        {
+                                            ThrowInvalidDataContractException(SR.GetString(SR.TypeNotSerializable, type), type);
+                                        }
                                     }
                                 }
                             }
-                        }
+
+                            AssignDataContractToId(dataContract, id);
+                        }                        
                     }
+                }
+
+                return dataContract;
+            }
+
+            [MethodImpl(MethodImplOptions.NoInlining)]
+            static void AssignDataContractToId(DataContract dataContract, int id)
+            {
+                lock (cacheLock)
+                {
                     dataContractCache[id] = dataContract;
-                    return dataContract;
                 }
             }
 
@@ -1200,7 +1221,8 @@ namespace System.Runtime.Serialization
 
                         parseMethodSet = true;
                     }
-                    return parseMethod; }
+                    return parseMethod;
+                }
             }
 
             internal virtual void WriteRootElement(XmlWriterDelegator writer, XmlDictionaryString name, XmlDictionaryString ns)
index 9b49ef0a45d78148f71e19299a39eb84a14867b5..aca78cb6ef92ec3c02066e19139e4b123d455f9e 100644 (file)
@@ -9,7 +9,9 @@ namespace System.Runtime.Serialization.Diagnostics
     using System.Globalization;
     using System.Runtime;
     using System.Runtime.Diagnostics;
+#if !MONO
     using System.ServiceModel.Diagnostics;
+#endif
 
     static class TraceUtility
     {
index b190b0487f8d2d430107f88233a94a249e3c8ce9..66a49e25c1c00d2b3349eefbbd89a49da6f5ac32 100644 (file)
@@ -11,7 +11,9 @@ namespace System.Runtime.Serialization.Json
     using System.IO;
     using System.Text;
     using System.Xml;
+#if !MONO
     using System.ServiceModel;
+#endif
     using System.Collections;
     using DataContractDictionary = System.Collections.Generic.Dictionary<System.Xml.XmlQualifiedName, DataContract>;
     using System.Runtime.CompilerServices;
index 5441be39a0336e2806ac3277fca4c8b516b0225e..cea778e8ca802f6a36fdb89a74fb29d97233df90 100644 (file)
@@ -7,7 +7,9 @@ namespace System.Runtime.Serialization.Json
     using System.Threading;
     using System.Xml;
     using System.Diagnostics;
+#if !MONO
     using System.ServiceModel;
+#endif
     using System.Collections.Generic;
     using System.Security;
 
index c595fce0624e9d7e8d7aeb7bb4b3501d92cb1d04..35811e93f0f6146554b9beb13bf3ed6e2750dd76 100644 (file)
@@ -9,7 +9,9 @@ namespace System.Runtime.Serialization.Json
     using System.Runtime.Serialization;
     using System.Security;
     using System.Reflection;
+#if !MONO
     using System.ServiceModel;
+#endif
     using System.Xml;
 
 #if USE_REFEMIT
index 3f756c1dcd527791aca59a32bc9d34ac23ead0e7..d3f2b39d19c905dfa46b0059d6a5969d6820a761 100644 (file)
@@ -7,7 +7,9 @@
 namespace System.Runtime.Serialization.Json
 {
     using System.IO;
+#if !MONO
     using System.ServiceModel;
+#endif
     using System.Text;
     using System.Xml;
     using System.Security;
index 3104947e45353db406cc4221210a2cbde85d4aec..06f8c9dc5e9758f4cff4485360b8f04d030fefa6 100644 (file)
@@ -5,7 +5,9 @@
 namespace System.Runtime.Serialization.Json
 {
     using System.Xml;
+#if !MONO
     using System.ServiceModel;
+#endif
     using System.Runtime.Serialization;
     using System.Globalization;
 
index bb496121d14db43bd6cedea7380dfc103c8cc6de..36925108caf6041eec10f1cda61d76679a9c7dd5 100644 (file)
@@ -5,7 +5,9 @@
 namespace System.Runtime.Serialization.Json
 {
     using System.Xml;
+#if !MONO
     using System.ServiceModel;
+#endif
     using System.Runtime.Serialization;
     using System.Globalization;
 
index befa224840000a09cb0f08579a6d13eeaf3d388a..79387fe4881dad06881f9e796117db52566c09af 100644 (file)
@@ -9,7 +9,9 @@ namespace System.Runtime.Serialization.Json
     using System.Text;
     using System.Xml;
     using System.IO;
+#if !MONO
     using System.ServiceModel;
+#endif
     using System.Runtime.Serialization.Json;
     using System.Runtime.CompilerServices;
 
index dc71490b99091a74dc877f42c8f87d389758097f..6e0e98201fe62e868e7763fcbbf6987d9bef9c9c 100644 (file)
@@ -6,7 +6,9 @@ namespace System.Runtime.Serialization.Json
 {
     using System.Xml;
     using System.Globalization;
+#if !MONO
     using System.ServiceModel;
+#endif
 
 #if USE_REFEMIT
     public class JsonWriterDelegator : XmlWriterDelegator
@@ -202,7 +204,15 @@ namespace System.Runtime.Serialization.Json
             // This will break round-tripping of these dates (see bug 9690 in CSD Developer Framework)
             if (value.Kind != DateTimeKind.Utc)
             {
-                long tickCount = value.Ticks - TimeZone.CurrentTimeZone.GetUtcOffset(value).Ticks;
+                long tickCount;
+                if (!LocalAppContextSwitches.DoNotUseTimeZoneInfo)
+                {
+                    tickCount = value.Ticks - TimeZoneInfo.Local.GetUtcOffset(value).Ticks;
+                }
+                else
+                {
+                    tickCount = value.Ticks - TimeZone.CurrentTimeZone.GetUtcOffset(value).Ticks;
+                }
                 if ((tickCount > DateTime.MaxValue.Ticks) || (tickCount < DateTime.MinValue.Ticks))
                 {
                     throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(
@@ -218,7 +228,15 @@ namespace System.Runtime.Serialization.Json
                 case DateTimeKind.Unspecified:
                 case DateTimeKind.Local:
                     // +"zzzz";
-                    TimeSpan ts = TimeZone.CurrentTimeZone.GetUtcOffset(value.ToLocalTime());
+                    TimeSpan ts;
+                    if (!LocalAppContextSwitches.DoNotUseTimeZoneInfo)
+                    {
+                        ts = TimeZoneInfo.Local.GetUtcOffset(value.ToLocalTime());
+                    }
+                    else
+                    {
+                        ts = TimeZone.CurrentTimeZone.GetUtcOffset(value.ToLocalTime());
+                    }
                     if (ts.Ticks < 0)
                     {
                         writer.WriteString("-");
index 1ff02aed672d000f4de6c3b50dcbd20f906a198c..ccaca2af395dad6d36489ac2d9b7154feff954f6 100644 (file)
@@ -6,7 +6,9 @@ namespace System.Runtime.Serialization.Json
 {
     using System.Globalization;
     using System.IO;
+#if !MONO
     using System.ServiceModel;
+#endif
     using System.Text;
     using System.Runtime.Serialization;
     using System.Collections.Generic;
index 581e40aee0c5acbc0851fdfe67967c60eb5818ad..c87639bee1f9ece40ccbf1299e1638d2833f2e57 100644 (file)
@@ -10,7 +10,9 @@ namespace System.Runtime.Serialization.Json
     using System.Runtime;
     using System.Runtime.Serialization;
     using System.Security;
+#if !MONO
     using System.ServiceModel;
+#endif
     using System.Text;
     using System.Xml;
 
index 75e4a6b6407cc82a837849d51fe20a03fdc12575..4e3e602ace0943e4d6300f55a58de8809a2562bf 100644 (file)
@@ -8,7 +8,9 @@ namespace System.Runtime.Serialization.Json
     using System.Collections.Generic;
     using System.Runtime;
     using System.Security;
+#if !MONO
     using System.ServiceModel;
+#endif
     using System.Text;
     using System.Xml;
 
index 841bde9461bbf6b652daaa2484ed10a9315c4ff3..bdf35e3a6a45395640428649b5d339b2b87ddf4a 100644 (file)
@@ -3,7 +3,9 @@ using System.Collections.Generic;
 using System.Text;
 using System.Xml;
 using System.Reflection;
+#if !MONO
 using System.ServiceModel;
+#endif
 using System.Collections;
 
 namespace System.Runtime.Serialization.Json
index b2c4586e3bb8986e4d78bd7785f31e2a89b6b60b..ff5704a55dfb05d5c352da97a6f54a34984c9bc7 100644 (file)
@@ -75,7 +75,7 @@ namespace System.Runtime.Serialization
             if (!Schemas.Contains(Globals.SerializationNamespace))
             {
                 StringReader reader = new StringReader(Globals.SerializationSchema);
-                XmlSchema schema = XmlSchema.Read(reader, null);
+                XmlSchema schema = XmlSchema.Read(new XmlTextReader(reader) { DtdProcessing = DtdProcessing.Prohibit }, null);
                 if (schema == null)
                     throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.CouldNotReadSerializationSchema, Globals.SerializationNamespace)));
                 Schemas.Add(schema);
index 32d06e427d250db300934fe20f13319a10537ac0..29885641acc94a669d874bf11eb345e4528915ec 100644 (file)
@@ -51,7 +51,7 @@ namespace System.Runtime.Serialization
             if (!schemaSet.Contains(Globals.SerializationNamespace))
             {
                 StringReader reader = new StringReader(Globals.SerializationSchema);
-                XmlSchema schema = XmlSchema.Read(reader, null);
+                XmlSchema schema = XmlSchema.Read(new XmlTextReader(reader) { DtdProcessing = DtdProcessing.Prohibit }, null);
                 if (schema == null)
                     throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.CouldNotReadSerializationSchema, Globals.SerializationNamespace)));
                 schemaSet.Add(schema);
index 96abfad8744745e43b444a02773a97fa01115a6c..38a78ece46cf99cc303f3344b043c34822a6b5ce 100644 (file)
@@ -9,7 +9,9 @@ namespace System.Runtime.Serialization
     using System.Collections.Generic;
     using System.Diagnostics;
     using System.Runtime.Diagnostics;
+#if !MONO
     using System.ServiceModel.Diagnostics;
+#endif
     using System.Text;
     using System.Xml;
     using System.Xml.Serialization;
index a61836fc14025f8b41574bdfbb12c977188054c9..acd6282a73dff284bc937b44d4044c66852f7f11 100644 (file)
@@ -14,7 +14,9 @@ namespace System.Runtime.Serialization
     using System.Xml;
     using System.Collections.Generic;
     using System.Xml.Serialization;
+#if !MONO
     using System.ServiceModel.Diagnostics;
+#endif
     using System.Security;
     using System.Security.Permissions;
     using System.Runtime.CompilerServices;
index c0dc0f32928e0bdb9fa2c8b8d3363068b88bd5ce..4e785e5b1ff9479d9e29a1a011c39d7b66791b93 100644 (file)
@@ -101,20 +101,13 @@ namespace System.ServiceModel.Activation
             }
         }
 
-        // Provides the version of the WebSocket protocol supported by IIS. Throws an exception if called before we determined the value.
+        // Provides the version of the WebSocket protocol supported by IIS.
         // Returns null if WebSockets are not supported (because the IIS WebSocketModule is not installed or enabled).
         public override string WebSocketVersion
         {
             get
             {
-                if (isWebSocketVersionSet)
-                {
-                    return webSocketVersion;
-                }
-                else
-                {
-                    throw Fx.AssertAndFailFast("The supported WebSocket protocol version is not determined at this time.");
-                }
+                return isWebSocketVersionSet ? webSocketVersion : null;
             }
         }
 
@@ -136,8 +129,6 @@ namespace System.ServiceModel.Activation
         /// </remarks>
         public static void TrySetWebSocketVersion(HttpApplication application)
         {
-            Fx.Assert(application != null, "Invalid argument.");
-
             if (!isWebSocketVersionSet)
             {
                 webSocketVersion = application.Request.ServerVariables[WebSocketVersionServerProperty];
index 4a81f353ca1d4f50f0f64789b02dba9d45568ff8..c84160682a5b24e941bd9a3aba64ddf6b1c87da0 100644 (file)
@@ -288,6 +288,7 @@ namespace System.Runtime.Diagnostics
 
         [Fx.Tag.SecurityNote(Critical = "Usage of EventDescriptor, which is protected by a LinkDemand")]
         [SecurityCritical]
+        [SuppressMessage("Microsoft.Security.Xml", "CA3057:DoNotUseLoadXml", Justification = "It is internal code. No security concern.")]
         public void WriteTraceSource(ref EventDescriptor eventDescriptor, string description, TracePayload payload)
         {
             if (this.TracingEnabled)
index 8a130a0f34285449d7dc69480eff98e832bf3edd..9224bf8b8fbac5bb40399ab2c13c752e3f0fd57f 100644 (file)
@@ -3,6 +3,15 @@
 //   Copyright (c) Microsoft Corporation.  All rights reserved.
 // 
 // ==--==
+
+// There are cases where we have multiple assemblies that are going to import this file and 
+// if they are going to also have InternalsVisibleTo between them, there will be a compiler warning
+// that the type is found both in the source and in a referenced assembly. The compiler will prefer 
+// the version of the type defined in the source
+//
+// In order to disable the warning for this type we are disabling this warning for this entire file.
+#pragma warning disable 436
+
 using System;
 using System.Collections.Generic;
 
@@ -167,3 +176,5 @@ namespace System
         static partial void PopulateDefaultValuesPartial(string platformIdentifier, string profile, int version);
     }
 }
+
+#pragma warning restore 436
index f05b599ed3d2b9af36cb7cd29c3c39123370cf6e..33662b54280621d4ef98247f98badecf87773fda 100644 (file)
@@ -4,6 +4,14 @@
 // 
 // ==--==
 
+// There are cases where we have multiple assemblies that are going to import this file and 
+// if they are going to also have InternalsVisibleTo between them, there will be a compiler warning
+// that the type is found both in the source and in a referenced assembly. The compiler will prefer 
+// the version of the type defined in the source
+//
+// In order to disable the warning for this type we are disabling this warning for this entire file.
+#pragma warning disable 436
+
 // NOTE: This file should not be included in mscorlib. This should only be included in FX libraries that need to provide switches
 using System;
 using System.Collections.Generic;
@@ -126,3 +134,5 @@ namespace System
         }
     }
 }
+
+#pragma warning restore 436
index 5f591137e3990ebb94efbdde1a260ea11cbebad1..e086fad2760ef4c41ac4e3e5bc158e4f525eb26e 100644 (file)
@@ -27,6 +27,11 @@ namespace System
                         LocalAppContextSwitches.SetDefaultsLessOrEqual_452();
                     }
 
+                    if (version <= 40601)
+                    {
+                        LocalAppContextSwitches.SetDefaultsLessOrEqual_461();
+                    }
+
                     break;
                 }
             }
index 785a9c05951269acd74c7d6f3efc8099e83eb1cd..5dac93babe149d98d661584dd61069d77207ab5e 100644 (file)
@@ -839,17 +839,11 @@ namespace System.ServiceModel.Channels
                 {
                     AspNetEnvironment env = AspNetEnvironment.Current;
 
-                    // When IIS hosted, WebSockets can be used if the pipeline mode is integrated and the WebSocketModule is loaded.
-                    // Otherwise, the client requests will not be upgraded to web sockets (see the code in HostedHttpTransportManager.HttpContextReceived(..)).
-                    // We do the checks below (and fail the service activation), to avoid starting a WebSockets listener that won't get called.
+                    // When IIS hosted, WebSockets can be used if the pipeline mode is integrated
                     if (!env.UsingIntegratedPipeline)
                     {
                         throw FxTrace.Exception.AsError(new NotSupportedException(SR.GetString(SR.WebSocketsNotSupportedInClassicPipeline)));
                     }
-                    else if (!env.IsWebSocketModuleLoaded)
-                    {
-                        throw FxTrace.Exception.AsError(new NotSupportedException(SR.GetString(SR.WebSocketModuleNotLoaded)));
-                    }
                 }
                 else if (!WebSocketHelper.OSSupportsWebSockets())
                 {
index f50e3667174e51a9ed111f895086c89240f0296c..ee3fbc127a7fcb92e6aa44345193357a75edc7ee 100644 (file)
@@ -6,6 +6,7 @@ namespace System.ServiceModel.Channels
 {
     using System.Collections.Generic;
     using System.Diagnostics;
+    using System.Diagnostics.CodeAnalysis;
     using System.Globalization;
     using System.IO;
     using System.Net;
@@ -1684,6 +1685,9 @@ namespace System.ServiceModel.Channels
             // then the Exact HostName, and lastly the WeakWildcard
             string[] hostChoices = new string[] { "+", uri.Host, "*" };
             bool[] globalChoices = new bool[] { true, false };
+            string matchPath = String.Empty;
+            string matchPipeName = null;
+
             for (int i = 0; i < hostChoices.Length; i++)
             {
                 for (int iGlobal = 0; iGlobal < globalChoices.Length; iGlobal++)
@@ -1696,7 +1700,7 @@ namespace System.ServiceModel.Channels
                         continue;
                     }
 
-                    // walk up the path hierarchy, looking for first match
+                    // walk up the path hierarchy, looking for match
                     string path = PipeUri.GetPath(uri);
 
                     while (path.Length > 0)
@@ -1713,7 +1717,21 @@ namespace System.ServiceModel.Channels
                                     string pipeName = sharedMemory.GetPipeName(appInfo);
                                     if (pipeName != null)
                                     {
-                                        return pipeName;
+                                        // Found a matching pipe name. 
+                                        // If the best match app setting is enabled, save the match if it is the best so far and continue.
+                                        // Otherwise, just return the first match we find.
+                                        if (ServiceModelAppSettings.UseBestMatchNamedPipeUri)
+                                        {
+                                            if (path.Length > matchPath.Length)
+                                            {
+                                                matchPath = path;
+                                                matchPipeName = pipeName;
+                                            }
+                                        }
+                                        else
+                                        {
+                                            return pipeName;
+                                        }
                                     }
                                 }
                                 finally
@@ -1733,9 +1751,14 @@ namespace System.ServiceModel.Channels
                 }
             }
 
-            throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(
-                new EndpointNotFoundException(SR.GetString(SR.EndpointNotFound, uri.AbsoluteUri),
-                new PipeException(SR.GetString(SR.PipeEndpointNotFound, uri.AbsoluteUri))));
+            if (string.IsNullOrEmpty(matchPipeName))
+            {
+                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(
+                    new EndpointNotFoundException(SR.GetString(SR.EndpointNotFound, uri.AbsoluteUri),
+                    new PipeException(SR.GetString(SR.PipeEndpointNotFound, uri.AbsoluteUri))));
+            }
+
+            return matchPipeName;
         }
 
         public IAsyncResult BeginConnect(Uri uri, TimeSpan timeout, AsyncCallback callback, object state)
@@ -1758,7 +1781,6 @@ namespace System.ServiceModel.Channels
                     new StringTraceRecord("Uri", remoteUri.ToString()), this, null);
             }
             resolvedAddress = GetPipeName(remoteUri, this.pipeSettings);
-
             const int backoffBufferMilliseconds = 150;
             TimeSpan backoffTimeout;
             if (timeout >= TimeSpan.FromMilliseconds(backoffBufferMilliseconds * 2))
@@ -2815,6 +2837,7 @@ namespace System.ServiceModel.Channels
             return builder.ToString();
         }
 
+        [SuppressMessage("Microsoft.Security.Cryptography", "CA5354:DoNotUseSHA1", Justification = "Cannot change. It will cause compatibility issue. Not used for cryptographic purposes.")]
         static HashAlgorithm GetHashAlgorithm()
         {
             if (SecurityUtilsEx.RequiresFipsCompliance)
index 4de327474f770e27ff9dc283b5b29c3faa801dec..d2c0f72a516e3a6eb97d82efbc7043f9b7fc665a 100644 (file)
@@ -202,8 +202,8 @@ namespace System.ServiceModel.Channels
         internal const bool RequireClientCertificate = false;
         internal const int MaxFaultSize = MaxBufferSize;
         internal const int MaxSecurityFaultSize = 16384;
-        internal const SslProtocols SslProtocols = System.Security.Authentication.SslProtocols.Ssl3 |
-                                                   System.Security.Authentication.SslProtocols.Tls |
+
+        internal const SslProtocols SslProtocols = System.Security.Authentication.SslProtocols.Tls |
                                                    System.Security.Authentication.SslProtocols.Tls11 |
                                                    System.Security.Authentication.SslProtocols.Tls12;
 
index bade3dab69e91693e91f69fb8f9547151fcaf850..275270b401c80192f83133e0426810ac3eaa2c34 100644 (file)
@@ -1101,31 +1101,82 @@ namespace System.ServiceModel.Channels
 
 
 #if !FEATURE_CORECLR
-        // On CoreCLR this is not the way to determine if a process is a tailored application (which means APPX).
-        // On CoreCLR AppX is determined by a flag past to the host which is exposed by AppDomain.IsAppXProcess in mscorlib.
-        // The reason for this if-def is to ensure nobody takes a dependency on this on CoreCLR.
-        
+        private static IntPtr GetCurrentProcessToken() { return new IntPtr(-4); }
+
+        enum AppPolicyClrCompat
+        {
+            AppPolicyClrCompat_Others = 0,
+            AppPolicyClrCompat_ClassicDesktop = 1,
+            AppPolicyClrCompat_Universal = 2,
+            AppPolicyClrCompat_PackagedDesktop = 3
+        };
+
+        [DllImport(KERNEL32, CharSet = CharSet.None, EntryPoint = "AppPolicyGetClrCompat")]
+        [System.Security.SecuritySafeCritical]
+        [return: MarshalAs(UnmanagedType.I4)]
+        private static extern Int32 _AppPolicyGetClrCompat(IntPtr processToken, out AppPolicyClrCompat appPolicyClrCompat);
+
         // AppModel.h functions (Win8+)
         [DllImport(KERNEL32, CharSet = CharSet.None, EntryPoint = "GetCurrentPackageId")]
-        [SecurityCritical]
+        [System.Security.SecuritySafeCritical]
         [return: MarshalAs(UnmanagedType.I4)]
-        private static extern Int32 GetCurrentPackageId(ref Int32 pBufferLength, Byte[] pBuffer);
+        private static extern Int32 _GetCurrentPackageId(ref Int32 pBufferLength, Byte[] pBuffer);
 
-        [Fx.Tag.SecurityNote(
-            Critical = "Critical because it calls the native function GetCurrentPackageId.",
-            Safe = "Safe because it takes no user input and it doesn't leak security sensitive information.")]
-        [SecuritySafeCritical]
+        [DllImport(KERNEL32, CharSet=System.Runtime.InteropServices.CharSet.Auto, BestFitMapping=false)]
+        [ResourceExposure(ResourceScope.Machine)]
+        private static extern IntPtr GetModuleHandle(string modName);
+
+        // Copied from Win32Native.cs
+        // Note - do NOT use this to call methods.  Use P/Invoke, which will
+        // do much better things w.r.t. marshaling, pinning memory, security 
+        // stuff, better interactions with thread aborts, etc.  This is used
+        // solely by DoesWin32MethodExist for avoiding try/catch EntryPointNotFoundException
+        // in scenarios where an OS Version check is insufficient
+        [DllImport(KERNEL32, CharSet=CharSet.Ansi, BestFitMapping=false, SetLastError=true, ExactSpelling=true)]
+        [ResourceExposure(ResourceScope.None)]
+        private static extern IntPtr GetProcAddress(IntPtr hModule, String methodName);
+
+        [System.Security.SecurityCritical]  // auto-generated
+        private static bool DoesWin32MethodExist(String moduleName, String methodName)
+        {
+            // GetModuleHandle does not increment the module's ref count, so we don't need to call FreeLibrary.
+            IntPtr hModule = GetModuleHandle(moduleName);
+            if (hModule == IntPtr.Zero) {
+                System.Diagnostics.Debug.Assert(hModule != IntPtr.Zero, "GetModuleHandle failed.  Dll isn't loaded?");
+                return false;
+            }
+            IntPtr functionPointer = GetProcAddress(hModule, methodName);
+            return (functionPointer != IntPtr.Zero);       
+        }
+        
+        // On CoreCLR this is not the way to determine if a process is a tailored application (which means APPX).
+        // On CoreCLR AppX is determined by a flag past to the host which is exposed by AppDomain.IsAppXProcess in mscorlib.
+        // The reason for this if-def is to ensure nobody takes a dependency on this on CoreCLR.        
+        [System.Security.SecuritySafeCritical]
         private static bool _IsTailoredApplication()
         {
-            if (OSEnvironmentHelper.IsAtLeast(OSVersion.Win8))
+            Version windows8Version = new Version(6, 2, 0, 0);
+            OperatingSystem os = Environment.OSVersion;
+            bool osSupportsPackagedProcesses = os.Platform == PlatformID.Win32NT && os.Version >= windows8Version;
+
+            if (osSupportsPackagedProcesses && DoesWin32MethodExist(KERNEL32, "AppPolicyGetClrCompat"))
             {
-                int bufLen = 0;
-                // Will return ERROR_INSUFFICIENT_BUFFER when running within a tailored application,
+                // Use AppPolicyGetClrCompat if it is available. Return true if and only if this is a UWA which means if
+                // this is packaged desktop app this method will return false. This may cause some confusion however 
+                // this is necessary to make the behavior of packaged desktop apps identical to desktop apps.
+                AppPolicyClrCompat appPolicyClrCompat;
+                return _AppPolicyGetClrCompat(GetCurrentProcessToken(), out appPolicyClrCompat) == ERROR_SUCCESS && 
+                    appPolicyClrCompat == AppPolicyClrCompat.AppPolicyClrCompat_Universal;
+            }
+            else if(osSupportsPackagedProcesses && DoesWin32MethodExist(KERNEL32, "GetCurrentPackageId"))
+            {
+                Int32 bufLen = 0;
+                // Will return ERROR_INSUFFICIENT_BUFFER when running within a packaged application,
                 // and will return ERROR_NO_PACKAGE_IDENTITY otherwise.
-                return GetCurrentPackageId(ref bufLen, null) == ERROR_INSUFFICIENT_BUFFER;
+                return _GetCurrentPackageId(ref bufLen, null) == ERROR_INSUFFICIENT_BUFFER;
             }
             else
-            {
+            {   // We must be running on a downlevel OS.
                 return false;
             }
         }
index 928d9be8f3e48f23a523cc37d815d6ef82bd6967..b99db25d123f6df476c8487733451cd286ba26cf 100644 (file)
@@ -6,6 +6,7 @@ namespace System.ServiceModel.Channels
 {
     using System;
     using System.Collections.Generic;
+    using System.Diagnostics.CodeAnalysis;
     using System.Globalization;
     using System.Linq;
     using System.Net;
@@ -44,6 +45,7 @@ namespace System.ServiceModel.Channels
         static readonly HashSet<char> InvalidSeparatorSet = new HashSet<char>(new char[] { '(', ')', '<', '>', '@', ',', ';', ':', '\\', '"', '/', '[', ']', '?', '=', '{', '}', ' ' });
         static string currentWebSocketVersion;
 
+        [SuppressMessage("Microsoft.Security.Cryptography", "CA5354:DoNotUseSHA1", Justification = "Cannot change. Usage of SHA1 is part of WebSocket spec. Justification in RFC6455 section 10.8")]
         internal static string ComputeAcceptHeader(string webSocketKey)
         {
             Fx.Assert(webSocketKey != null, "webSocketKey should not be null.");
index 35c78297859f7342bb6f1137a045ea1bf79b932c..a457268b0cec838769a3f3a1db5bc2d6a67d31c1 100644 (file)
@@ -3472,7 +3472,7 @@ namespace System.ServiceModel.Configuration
                 {
                     ConfigurationPropertyCollection properties = new ConfigurationPropertyCollection();
                     properties.Add(new ConfigurationProperty("requireClientCertificate", typeof(System.Boolean), false, null, null, System.Configuration.ConfigurationPropertyOptions.None));
-                    properties.Add(new ConfigurationProperty("sslProtocols", typeof(System.Security.Authentication.SslProtocols), System.Security.Authentication.SslProtocols.Ssl3 | System.Security.Authentication.SslProtocols.Tls | System.Security.Authentication.SslProtocols.Default | System.Security.Authentication.SslProtocols.Tls11 | System.Security.Authentication.SslProtocols.Tls12, null, new System.ServiceModel.Configuration.ServiceModelEnumValidator(typeof(System.ServiceModel.Security.SslProtocolsHelper)), System.Configuration.ConfigurationPropertyOptions.None));
+                    properties.Add(new ConfigurationProperty("sslProtocols", typeof(System.Security.Authentication.SslProtocols), System.Security.Authentication.SslProtocols.Tls | System.Security.Authentication.SslProtocols.Tls11 | System.Security.Authentication.SslProtocols.Tls12, null, new System.ServiceModel.Configuration.ServiceModelEnumValidator(typeof(System.ServiceModel.Security.SslProtocolsHelper)), System.Configuration.ConfigurationPropertyOptions.None));
                     this.properties = properties;
                 }
                 return this.properties;
@@ -3527,7 +3527,7 @@ namespace System.ServiceModel.Configuration
                     properties.Add(new ConfigurationProperty("clientCredentialType", typeof(System.ServiceModel.TcpClientCredentialType), System.ServiceModel.TcpClientCredentialType.Windows, null, new System.ServiceModel.Configuration.ServiceModelEnumValidator(typeof(System.ServiceModel.TcpClientCredentialTypeHelper)), System.Configuration.ConfigurationPropertyOptions.None));
                     properties.Add(new ConfigurationProperty("protectionLevel", typeof(System.Net.Security.ProtectionLevel), System.Net.Security.ProtectionLevel.EncryptAndSign, null, new System.ServiceModel.Configuration.ServiceModelEnumValidator(typeof(System.ServiceModel.Security.ProtectionLevelHelper)), System.Configuration.ConfigurationPropertyOptions.None));
                     properties.Add(new ConfigurationProperty("extendedProtectionPolicy", typeof(System.Security.Authentication.ExtendedProtection.Configuration.ExtendedProtectionPolicyElement), null, null, null, System.Configuration.ConfigurationPropertyOptions.None));
-                    properties.Add(new ConfigurationProperty("sslProtocols", typeof(System.Security.Authentication.SslProtocols), System.Security.Authentication.SslProtocols.Ssl3 | System.Security.Authentication.SslProtocols.Tls | System.Security.Authentication.SslProtocols.Default | System.Security.Authentication.SslProtocols.Tls11 | System.Security.Authentication.SslProtocols.Tls12, null, new System.ServiceModel.Configuration.ServiceModelEnumValidator(typeof(System.ServiceModel.Security.SslProtocolsHelper)), System.Configuration.ConfigurationPropertyOptions.None));
+                    properties.Add(new ConfigurationProperty("sslProtocols", typeof(System.Security.Authentication.SslProtocols), System.Security.Authentication.SslProtocols.Tls | System.Security.Authentication.SslProtocols.Tls11 | System.Security.Authentication.SslProtocols.Tls12, null, new System.ServiceModel.Configuration.ServiceModelEnumValidator(typeof(System.ServiceModel.Security.SslProtocolsHelper)), System.Configuration.ConfigurationPropertyOptions.None));
                     this.properties = properties;
                 }
                 return this.properties;
index dbef91c1275e3c975dd6f80f03a2cf7e4f640507..e4a23bcc00c085c39804adda91f867b2b031dc70 100644 (file)
@@ -1347,31 +1347,38 @@ namespace System.ServiceModel.Description
 
         internal static XmlSchema CreateWsdl()
         {
-            return XmlSchema.Read(new StringReader(wsdl), null);
+            StringReader reader = new StringReader(wsdl);
+            return XmlSchema.Read(new XmlTextReader(reader) { DtdProcessing = DtdProcessing.Prohibit }, null);
         }
+
         internal static XmlSchema CreateSoap()
         {
-            return XmlSchema.Read(new StringReader(soap), null);
+            StringReader reader = new StringReader(soap);
+            return XmlSchema.Read(new XmlTextReader(reader) { DtdProcessing = DtdProcessing.Prohibit }, null);
         }
 
         internal static XmlSchema CreateSoapEncoding()
         {
-            return XmlSchema.Read(new StringReader(soapEncoding), null);
+            StringReader reader = new StringReader(soapEncoding);
+            return XmlSchema.Read(new XmlTextReader(reader) { DtdProcessing = DtdProcessing.Prohibit }, null);
         }
 
         internal static XmlSchema CreateFakeSoapEncoding()
         {
-            return XmlSchema.Read(new StringReader(fakeSoapEncoding), null);
+            StringReader reader = new StringReader(fakeSoapEncoding);
+            return XmlSchema.Read(new XmlTextReader(reader) { DtdProcessing = DtdProcessing.Prohibit }, null);
         }
 
         internal static XmlSchema CreateFakeXsdSchema()
         {
-            return XmlSchema.Read(new StringReader(fakeXsd), null);
+            StringReader reader = new StringReader(fakeXsd);
+            return XmlSchema.Read(new XmlTextReader(reader) { DtdProcessing = DtdProcessing.Prohibit }, null);
         }
 
         internal static XmlSchema CreateFakeXmlSchema()
         {
-            return XmlSchema.Read(new StringReader(fakeXmlSchema), null);
+            StringReader reader = new StringReader(fakeXmlSchema);
+            return XmlSchema.Read(new XmlTextReader(reader) { DtdProcessing = DtdProcessing.Prohibit }, null);
         }
 
         internal static bool IsKnownSchema(string ns)
index c056108dd68dcceda491ac274d90095456a358cc..f8674ce614d1ee546891906235083aca33d737c8 100644 (file)
@@ -5,6 +5,7 @@
 namespace System.ServiceModel.Description
 {
     using System.Collections.Generic;
+    using System.Diagnostics.CodeAnalysis;
     using System.Globalization;
     using System.IO;
     using System.Linq;
@@ -313,6 +314,8 @@ namespace System.ServiceModel.Description
             return newWsdl;
         }
 
+        [SuppressMessage("Microsoft.Security.Xml", "CA3054:DoNotAllowDtdOnXmlTextReader")]
+        [SuppressMessage("Microsoft.Security.Xml", "CA3069:ReviewDtdProcessingAssignment", Justification = "This is trusted server code from the application only. We should allow the customer add dtd.")]
         private static XmlSchema CloneXsd(XmlSchema originalXsd)
         {
             Fx.Assert(originalXsd != null, "originalXsd must not be null");
@@ -321,7 +324,7 @@ namespace System.ServiceModel.Description
             {
                 originalXsd.Write(memoryStream);
                 memoryStream.Seek(0, SeekOrigin.Begin);
-                newXsd = XmlSchema.Read(memoryStream, null);
+                newXsd = XmlSchema.Read(new XmlTextReader(memoryStream) { DtdProcessing = DtdProcessing.Parse }, null);
             }
 
             return newXsd;
index d34430b8733dc0ad20fd023e56c7e49ab6e2c7cf..c7fb34872177998c56ac4635e18eefff6a0eb28a 100644 (file)
@@ -7,6 +7,7 @@ namespace System.ServiceModel.Dispatcher
     using System.Collections;
     using System.Collections.Generic;
     using System.Collections.ObjectModel;
+    using System.Diagnostics.CodeAnalysis;
     using System.Runtime;
     using System.ServiceModel.Channels;
     using System.ServiceModel.Diagnostics;
@@ -262,6 +263,7 @@ namespace System.ServiceModel.Dispatcher
             }
         }
 
+        [SuppressMessage("Microsoft.Security.Xml", "CA3057:DoNotUseLoadXml")]
         static QueryMatcher()
         {
             QueryMatcher.defaultFunctionLibs = new IFunctionLibrary[] { new XPathFunctionLibrary() };
index 9bf6328b8221647e9591c0b9b76000bdb08c8cf6..2b9ff6aeda7890d4856a7ad26e7213ff83d6b86c 100644 (file)
@@ -8,12 +8,11 @@ namespace System.ServiceModel.Dispatcher
     using System.Diagnostics;
     using System.Reflection;
     using System.Runtime;
-    using System.Runtime.Diagnostics;
     using System.Security;
     using System.ServiceModel.Description;
     using System.ServiceModel.Diagnostics;
-    using System.ServiceModel.Diagnostics.Application;
     using System.Threading.Tasks;
+    using Threading;
 
     /// <summary>
     /// An invoker used when some operation contract has a return value of Task or its generic counterpart (Task of T) 
@@ -21,14 +20,12 @@ namespace System.ServiceModel.Dispatcher
     internal class TaskMethodInvoker : IOperationInvoker
     {
         private const string ResultMethodName = "Result";
-        private MethodInfo taskMethod;
-        private bool isGenericTask;
+        private readonly MethodInfo taskMethod;
         private InvokeDelegate invokeDelegate;
         private int inputParameterCount;
         private int outputParameterCount;
-        private object[] outputs;
-        private MethodInfo toAsyncMethodInfo;
         private MethodInfo taskTResultGetMethod;
+        private bool isGenericTask;
 
         public TaskMethodInvoker(MethodInfo taskMethod, Type taskType)
         {
@@ -41,7 +38,6 @@ namespace System.ServiceModel.Dispatcher
 
             if (taskType != ServiceReflector.VoidType)
             {
-                this.toAsyncMethodInfo = TaskExtensions.MakeGenericMethod(taskType);
                 this.taskTResultGetMethod = ((PropertyInfo)taskMethod.ReturnType.GetMember(ResultMethodName)[0]).GetGetMethod();
                 this.isGenericTask = true;
             }
@@ -57,36 +53,11 @@ namespace System.ServiceModel.Dispatcher
             get { return this.taskMethod; }
         }
 
-        private InvokeDelegate InvokeDelegate
-        {
-            get
-            {
-                this.EnsureIsInitialized();
-                return this.invokeDelegate;
-            }
-        }
-
-        private int InputParameterCount
-        {
-            get
-            {
-                this.EnsureIsInitialized();
-                return this.inputParameterCount;
-            }
-        }
-
-        private int OutputParameterCount
-        {
-            get
-            {
-                this.EnsureIsInitialized();
-                return this.outputParameterCount;
-            }
-        }
-
         public object[] AllocateInputs()
         {
-            return EmptyArray.Allocate(this.InputParameterCount);
+            EnsureIsInitialized();
+
+            return EmptyArray<object>.Allocate(this.inputParameterCount);
         }
 
         public object Invoke(object instance, object[] inputs, out object[] outputs)
@@ -95,169 +66,249 @@ namespace System.ServiceModel.Dispatcher
         }
 
         public IAsyncResult InvokeBegin(object instance, object[] inputs, AsyncCallback callback, object state)
+        {
+            return ToApm(InvokeAsync(instance, inputs), callback, state);
+        }
+
+        public object InvokeEnd(object instance, out object[] outputs, IAsyncResult result)
         {
             if (instance == null)
             {
                 throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.SFxNoServiceObject)));
             }
 
-            if (inputs == null)
-            {
-                if (this.InputParameterCount > 0)
-                {
-                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.SFxInputParametersToServiceNull, this.InputParameterCount)));
-                }
-            }
-            else if (inputs.Length != this.InputParameterCount)
-            {
-                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.SFxInputParametersToServiceInvalid, this.InputParameterCount, inputs.Length)));
-            }
-
-            this.outputs = EmptyArray.Allocate(this.OutputParameterCount);
-
-            AsyncMethodInvoker.StartOperationInvokePerformanceCounters(this.taskMethod.Name);
-
-            IAsyncResult returnValue;
+            object returnVal = null;
             bool callFailed = true;
             bool callFaulted = false;
             ServiceModelActivity activity = null;
+            Activity boundOperation = null;
 
             try
             {
-                Activity boundActivity = null;
-                AsyncMethodInvoker.CreateActivityInfo(ref activity, ref boundActivity);
+                AsyncMethodInvoker.GetActivityInfo(ref activity, ref boundOperation);
 
-                AsyncMethodInvoker.StartOperationInvokeTrace(this.taskMethod.Name);
-                                
-                using (boundActivity)
+                Task<Tuple<object, object[]>> invokeTask = result as Task<Tuple<object, object[]>>;
+
+                if (invokeTask == null)
                 {
-                    if (DiagnosticUtility.ShouldUseActivity)
+                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentException(SR.SFxInvalidCallbackIAsyncResult));
+                }
+
+                AggregateException ae = null;
+                Tuple<object, object[]> tuple = null;
+                Task task = null;
+
+                if (invokeTask.IsFaulted)
+                {
+                    Fx.Assert(invokeTask.Exception != null, "Task.IsFaulted guarantees non-null exception.");
+                    ae = invokeTask.Exception;
+                }
+                else
+                {
+                    Fx.Assert(invokeTask.IsCompleted, "Task.Result is expected to be completed");
+
+                    tuple = invokeTask.Result;
+                    task = tuple.Item1 as Task;
+
+                    if (task == null)
                     {
-                        string activityName = SR.GetString(SR.ActivityExecuteMethod, this.taskMethod.DeclaringType.FullName, this.taskMethod.Name);
-                        ServiceModelActivity.Start(activity, activityName, ActivityType.ExecuteUserCode);
+                        outputs = tuple.Item2;
+                        return null;
                     }
 
-                    object taskReturnValue = this.InvokeDelegate(instance, inputs, this.outputs);
-
-                    if (taskReturnValue == null)
+                    if (task.IsFaulted)
                     {
-                        throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("task");
+                        Fx.Assert(task.Exception != null, "Task.IsFaulted guarantees non-null exception.");
+                        ae = task.Exception;
                     }
-                    else if (this.isGenericTask)
+                }
+
+                if (ae != null && ae.InnerException != null)
+                {
+                    if (ae.InnerException is FaultException)
                     {
-                        returnValue = (IAsyncResult)this.toAsyncMethodInfo.Invoke(null, new object[] { taskReturnValue, callback, state });
+                        // If invokeTask.IsFaulted we produce the 'callFaulted' behavior below.
+                        // Any other exception will retain 'callFailed' behavior.
+                        callFaulted = true;
+                        callFailed = false;
                     }
-                    else
+
+                    if (ae.InnerException is SecurityException)
                     {
-                        returnValue = ((Task)taskReturnValue).AsAsyncResult(callback, state);
+                        DiagnosticUtility.TraceHandledException(ae.InnerException, TraceEventType.Warning);
+                        throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(AuthorizationBehavior.CreateAccessDeniedFaultException());
                     }
 
-                    callFailed = false;
+                    invokeTask.GetAwaiter().GetResult();
                 }
-            }
-            catch (System.Security.SecurityException e)
-            {
-                DiagnosticUtility.TraceHandledException(e, TraceEventType.Warning);
-                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(AuthorizationBehavior.CreateAccessDeniedFaultException());
-            }
-            catch (Exception e)
-            {
-                TraceUtility.TraceUserCodeException(e, this.taskMethod);
-                if (e is FaultException)
+
+                // Task cancellation without an exception indicates failure but we have no
+                // additional information to provide.  Accessing Task.Result will throw a
+                // TaskCanceledException.   For consistency between void Tasks and Task<T>,
+                // we detect and throw here.
+                if (task.IsCanceled)
                 {
-                    callFaulted = true;
-                    callFailed = false;
+                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new TaskCanceledException(task));
                 }
 
-                throw;
+                outputs = tuple.Item2;
+
+                returnVal = this.isGenericTask ? this.taskTResultGetMethod.Invoke(task, Type.EmptyTypes) : null;
+                callFailed = false;
+
+                return returnVal;
             }
             finally
             {
-                ServiceModelActivity.Stop(activity);
-
-                // Any exception above means InvokeEnd will not be called, so complete it here.
-                if (callFailed || callFaulted)
+                if (boundOperation != null)
                 {
-                    AsyncMethodInvoker.StopOperationInvokeTrace(callFailed, callFaulted, this.TaskMethod.Name);
-                    AsyncMethodInvoker.StopOperationInvokePerformanceCounters(callFailed, callFaulted, this.TaskMethod.Name);
+                    ((IDisposable)boundOperation).Dispose();
                 }
-            }
 
-            return returnValue;
+                ServiceModelActivity.Stop(activity);
+                AsyncMethodInvoker.StopOperationInvokeTrace(callFailed, callFaulted, this.TaskMethod.Name);
+                AsyncMethodInvoker.StopOperationInvokePerformanceCounters(callFailed, callFaulted, this.TaskMethod.Name);
+            }
         }
 
-        public object InvokeEnd(object instance, out object[] outputs, IAsyncResult result)
+        private async Task<Tuple<object, object[]>> InvokeAsync(object instance, object[] inputs)
         {
-            object returnVal;
-            bool callFailed = true;
-            bool callFaulted = false;
-            ServiceModelActivity activity = null;
+            EnsureIsInitialized();
 
             if (instance == null)
             {
                 throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.SFxNoServiceObject)));
             }
 
+            if (inputs == null)
+            {
+                if (this.inputParameterCount > 0)
+                {
+                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.SFxInputParametersToServiceNull, this.inputParameterCount)));
+                }
+            }
+            else if (inputs.Length != this.inputParameterCount)
+            {
+                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.SFxInputParametersToServiceInvalid, this.inputParameterCount, inputs.Length)));
+            }
+
+            object[] outputs = EmptyArray.Allocate(this.outputParameterCount);
+
+            AsyncMethodInvoker.StartOperationInvokePerformanceCounters(this.taskMethod.Name);
+
+            object returnValue;
+            ServiceModelActivity activity = null;
+            Activity boundActivity = null;
+
             try
             {
-                Activity boundOperation = null;
-                AsyncMethodInvoker.GetActivityInfo(ref activity, ref boundOperation);
+                AsyncMethodInvoker.CreateActivityInfo(ref activity, ref boundActivity);
+                AsyncMethodInvoker.StartOperationInvokeTrace(this.taskMethod.Name);
 
-                using (boundOperation)
+                if (DiagnosticUtility.ShouldUseActivity)
                 {
-                    Task task = result as Task;
+                    string activityName = SR.GetString(SR.ActivityExecuteMethod, this.taskMethod.DeclaringType.FullName, this.taskMethod.Name);
+                    ServiceModelActivity.Start(activity, activityName, ActivityType.ExecuteUserCode);
+                }
 
-                    Fx.Assert(task != null, "InvokeEnd needs to be called with the result returned from InvokeBegin.");
-                    if (task.IsFaulted)
-                    {
-                        Fx.Assert(task.Exception != null, "Task.IsFaulted guarantees non-null exception.");
+                OperationContext.EnableAsyncFlow();
 
-                        // If FaultException is thrown, we will get 'callFaulted' behavior below.
-                        // Any other exception will retain 'callFailed' behavior.
-                        throw FxTrace.Exception.AsError<FaultException>(task.Exception);
-                    }
+                returnValue = this.invokeDelegate(instance, inputs, outputs);
 
-                    // Task cancellation without an exception indicates failure but we have no
-                    // additional information to provide.  Accessing Task.Result will throw a
-                    // TaskCanceledException.   For consistency between void Tasks and Task<T>,
-                    // we detect and throw here.
-                    if (task.IsCanceled)
-                    {
-                        throw FxTrace.Exception.AsError(new TaskCanceledException(task));
-                    }
+                if (returnValue == null)
+                {
+                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("task");
+                }
 
-                    outputs = this.outputs;
-                    if (this.isGenericTask)
-                    {
-                        returnVal = this.taskTResultGetMethod.Invoke(result, Type.EmptyTypes);
-                    }
-                    else
-                    {                        
-                        returnVal = null;
-                    }
+                var returnValueTask = returnValue as Task;
 
-                    callFailed = false;
+                if (returnValueTask != null)
+                {
+                    // Only return once the task has completed                        
+                    await returnValueTask;
                 }
+
+                return Tuple.Create(returnValue, outputs);
             }
             catch (SecurityException e)
             {
                 DiagnosticUtility.TraceHandledException(e, TraceEventType.Warning);
                 throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(AuthorizationBehavior.CreateAccessDeniedFaultException());
             }
-            catch (FaultException)
+            catch (Exception e)
             {
-                callFaulted = true;
-                callFailed = false;
+                TraceUtility.TraceUserCodeException(e, this.taskMethod);
                 throw;
             }
             finally
             {
+                OperationContext.DisableAsyncFlow();
+
+                if (boundActivity != null)
+                {
+                    ((IDisposable)boundActivity).Dispose();
+                }
+
                 ServiceModelActivity.Stop(activity);
-                AsyncMethodInvoker.StopOperationInvokeTrace(callFailed, callFaulted, this.TaskMethod.Name);
-                AsyncMethodInvoker.StopOperationInvokePerformanceCounters(callFailed, callFaulted, this.TaskMethod.Name);
             }
+        }
+
+        // Helper method when implementing an APM wrapper around a Task based async method which returns a result. 
+        // In the BeginMethod method, you would call use ToApm to wrap a call to MethodAsync:
+        //     return MethodAsync(params).ToApm(callback, state);
+        // In the EndMethod, you would use ToApmEnd<TResult> to ensure the correct exception handling
+        // This will handle throwing exceptions in the correct place and ensure the IAsyncResult contains the provided
+        // state object
+        private static Task<TResult> ToApm<TResult>(Task<TResult> task, AsyncCallback callback, object state)
+        {
+            // When using APM, the returned IAsyncResult must have the passed in state object stored in AsyncState. This
+            // is so the callback can regain state. If the incoming task already holds the state object, there's no need
+            // to create a TaskCompletionSource to ensure the returned (IAsyncResult)Task has the right state object.
+            // This is a performance optimization for this special case.
+            if (task.AsyncState == state)
+            {
+                if (callback != null)
+                {
+                    task.ContinueWith((antecedent, obj) =>
+                    {
+                        AsyncCallback callbackObj = (AsyncCallback)obj;
+                        callbackObj(antecedent);
+                    }, callback, CancellationToken.None, TaskContinuationOptions.HideScheduler, TaskScheduler.Default);
+                }
+
+                return task;
+            }
+
+            // Need to create a TaskCompletionSource so that the returned Task object has the correct AsyncState value.
+            var tcs = new TaskCompletionSource<TResult>(state);
+            var continuationState = Tuple.Create(tcs, callback);
+
+            task.ContinueWith((antecedent, obj) =>
+            {
+                Tuple<TaskCompletionSource<TResult>, AsyncCallback> tuple = (Tuple<TaskCompletionSource<TResult>, AsyncCallback>)obj;
+                TaskCompletionSource<TResult> tcsObj = tuple.Item1;
+                AsyncCallback callbackObj = tuple.Item2;
+
+                if (antecedent.IsFaulted)
+                {
+                    tcsObj.TrySetException(antecedent.Exception.InnerException);
+                }
+                else if (antecedent.IsCanceled)
+                {
+                    tcsObj.TrySetCanceled();
+                }
+                else
+                {
+                    tcsObj.TrySetResult(antecedent.Result);
+                }
+
+                if (callbackObj != null)
+                {
+                    callbackObj(tcsObj.Task);
+                }
+            }, continuationState, CancellationToken.None, TaskContinuationOptions.HideScheduler, TaskScheduler.Default);
 
-            return returnVal;
+            return tcs.Task;
         }
 
         private void EnsureIsInitialized()
index 5d826dfb4895a9caa6b64a1f538818f4f54a7069..0072f122b8af667fcb0971d7731ca3cc5048df00 100644 (file)
@@ -92,7 +92,7 @@ namespace System.ServiceModel.Dispatcher
                     bufferWriter.Flush();
                     XmlDocument doc = new XmlDocument();
                     memoryStream.Position = 0;
-                    doc.Load(memoryStream);
+                    doc.Load(new XmlTextReader(memoryStream) { DtdProcessing = DtdProcessing.Prohibit });
                     //doc.Save(Console.Out);
                     foreach (XmlElement element in doc.DocumentElement.ChildNodes)
                     {
index dd5b3ef3436642510c6a8dc6a0e720bfccc40845..d7e24e00a8ea3418cc4ea24d732908a645455d20 100644 (file)
@@ -67,7 +67,7 @@ namespace System.ServiceModel
 
         static XmlSchema GetEprSchema()
         {
-            using (XmlTextReader reader = new XmlTextReader(new StringReader(Schema)))
+            using (XmlTextReader reader = new XmlTextReader(new StringReader(Schema)) { DtdProcessing = DtdProcessing.Prohibit })
             {
                 return XmlSchema.Read(reader, null);
             }
index b60cc2b287a5d1b83f1afdb0f16b46e2f35973ec..d74bdeb89cc108c97fc13db7c3f9ecb66c128b95 100644 (file)
@@ -67,7 +67,7 @@ namespace System.ServiceModel
 
         static XmlSchema GetEprSchema()
         {
-            using (XmlTextReader reader = new XmlTextReader(new StringReader(Schema)))
+            using (XmlTextReader reader = new XmlTextReader(new StringReader(Schema)) { DtdProcessing = DtdProcessing.Prohibit })
             {
                 return XmlSchema.Read(reader, null);
             }
index 616b1feddc328529b05842dd31a3e7594928eae3..323304ff6ba3fca8dbf43101c111d4375de7adda 100644 (file)
@@ -14,9 +14,11 @@ namespace System.ServiceModel
     {
         private const string DisableExplicitConnectionCloseHeaderString = "Switch.System.ServiceModel.DisableExplicitConnectionCloseHeader";
         private const string AllowUnsignedToHeaderString = "Switch.System.ServiceModel.AllowUnsignedToHeader";
+        private const string DisableCngCertificatesString = "Switch.System.ServiceModel.DisableCngCertificates";
 
         private static int disableExplicitConnectionCloseHeader;
         private static int allowUnsignedToHeader;
+        private static int disableCngCertificates;
 
         public static bool DisableExplicitConnectionCloseHeader
         {
@@ -36,10 +38,29 @@ namespace System.ServiceModel
             }
         }
 
+        public static bool DisableCngCertificates
+        {
+            [MethodImpl(MethodImplOptions.AggressiveInlining)]
+            get
+            {
+                return LocalAppContext.GetCachedSwitchValue(DisableCngCertificatesString, ref disableCngCertificates);
+            }
+        }
+
         public static void SetDefaultsLessOrEqual_452()
         {
+#pragma warning disable BCL0012            
             // Define the switches that should be true for 4.5.2 or less, false for 4.6+.
             LocalAppContext.DefineSwitchDefault(DisableExplicitConnectionCloseHeaderString, true);
+#pragma warning restore BCL0012
+        }
+
+        public static void SetDefaultsLessOrEqual_461()
+        {
+#pragma warning disable BCL0012            
+            // Define the switches that should be true for 4.6.1 or less, false for 4.6.2+.
+            LocalAppContext.DefineSwitchDefault(DisableCngCertificatesString, true);
+#pragma warning restore BCL0012
         }
     }
 }
index 08794986728b577877e5bdebd9b8f624b9d1de3a..c08a1200cb8a269d4cd1e4b9173df09770ae5b4e 100644 (file)
@@ -5,19 +5,21 @@
 namespace System.ServiceModel
 {
     using System.Collections.Generic;
-    using System.ComponentModel;
     using System.Runtime;
     using System.Security.Claims;
     using System.Security.Principal;
     using System.ServiceModel.Channels;
     using System.ServiceModel.Dispatcher;
     using System.ServiceModel.Security;
+    using System.Threading;
 
     public sealed class OperationContext : IExtensibleObject<OperationContext>
     {
         [ThreadStatic]
         static Holder currentContext;
 
+        static AsyncLocal<OperationContext> currentAsyncLocalContext = new AsyncLocal<OperationContext>();
+
         ServiceChannel channel;
         Message clientReply;
         bool closeClientReply;
@@ -33,6 +35,7 @@ namespace System.ServiceModel
         MessageHeaders outgoingMessageHeaders;
         MessageVersion outgoingMessageVersion;
         EndpointDispatcher endpointDispatcher;
+        bool isAsyncFlowEnabled;
 
         public event EventHandler OperationCompleted;
 
@@ -92,12 +95,19 @@ namespace System.ServiceModel
         {
             get
             {
-                return CurrentHolder.Context;
+                return ShouldUseAsyncLocalContext ? OperationContext.currentAsyncLocalContext.Value : CurrentHolder.Context;
             }
 
             set
             {
-                CurrentHolder.Context = value;
+                if (ShouldUseAsyncLocalContext)
+                {
+                    OperationContext.currentAsyncLocalContext.Value = value;
+                }
+                else
+                {
+                    CurrentHolder.Context = value;
+                }                
             }
         }
 
@@ -115,6 +125,14 @@ namespace System.ServiceModel
             }
         }
 
+        private static bool ShouldUseAsyncLocalContext
+        {
+            get
+            {
+                return CurrentHolder.Context == null && OperationContext.currentAsyncLocalContext.Value != null && OperationContext.currentAsyncLocalContext.Value.isAsyncFlowEnabled;
+            }
+        }
+
         public EndpointDispatcher EndpointDispatcher
         {
             get
@@ -339,6 +357,21 @@ namespace System.ServiceModel
             this.clientReply = null;
         }
 
+        internal static void EnableAsyncFlow()
+        {
+            CurrentHolder.Context.isAsyncFlowEnabled = true;
+            currentAsyncLocalContext.Value = CurrentHolder.Context;
+        }
+
+        internal static void DisableAsyncFlow()
+        {
+            if (OperationContext.Current != null && OperationContext.Current.isAsyncFlowEnabled)
+            {
+                OperationContext.Current.isAsyncFlowEnabled = false;
+                currentAsyncLocalContext.Value = null;
+            }
+        }
+
         internal void FireOperationCompleted()
         {
             try
index 17da631e14969af50e6f5479cf9ca756209e06f4..3d12f54c8641bde9b154c8ac8c718f2b0b6d3bdb 100644 (file)
@@ -10,14 +10,12 @@ namespace System.ServiceModel
 
     public sealed class OperationContextScope : IDisposable
     {
-        [ThreadStatic]
-        static OperationContextScope currentScope;
+        static AsyncLocal<OperationContextScope> currentScope = new AsyncLocal<OperationContextScope>();
 
         OperationContext currentContext;
         bool disposed;
         readonly OperationContext originalContext = OperationContext.Current;
-        readonly OperationContextScope originalScope = OperationContextScope.currentScope;
-        readonly Thread thread = Thread.CurrentThread;
+        readonly OperationContextScope originalScope = OperationContextScope.currentScope.Value;
 
         public OperationContextScope(IContextChannel channel)
         {
@@ -41,22 +39,19 @@ namespace System.ServiceModel
         void PushContext(OperationContext context)
         {
             this.currentContext = context;
-            OperationContextScope.currentScope = this;
+            OperationContextScope.currentScope.Value = this;
             OperationContext.Current = this.currentContext;
         }
 
         void PopContext()
         {
-            if (this.thread != Thread.CurrentThread)
-                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.SFxInvalidContextScopeThread0)));
-
-            if (OperationContextScope.currentScope != this)
+            if (OperationContextScope.currentScope.Value != this)
                 throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.SFxInterleavedContextScopes0)));
 
             if (OperationContext.Current != this.currentContext)
                 throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.SFxContextModifiedInsideScope0)));
 
-            OperationContextScope.currentScope = this.originalScope;
+            OperationContextScope.currentScope.Value = this.originalScope;
             OperationContext.Current = this.originalContext;
 
             if (this.currentContext != null)
index ff0d508ecb02211e914a2e14ced66a26e543155c..7c0b7a8cb2e0e114d729fcd25d15d1a1e0b200ca 100644 (file)
@@ -17,6 +17,7 @@ namespace System.ServiceModel.Security
     using System.Text;
     using System.Xml;
     using System.Diagnostics;
+    using System.Diagnostics.CodeAnalysis;
     using System.Security.Cryptography;
 
     using Psha1DerivedKeyGenerator = System.IdentityModel.Psha1DerivedKeyGenerator;
@@ -57,6 +58,7 @@ namespace System.ServiceModel.Security
             return CryptoHelper.CreateHashAlgorithm(SecurityAlgorithms.Sha256Digest);
         }
 
+        [SuppressMessage("Microsoft.Security.Cryptography", "CA5354:DoNotUseSHA1", Justification = "Cannot change. Required as SOAP spec requires supporting SHA1.")]
         internal static HashAlgorithm CreateHashAlgorithm(string digestMethod)
         {
             object algorithmObject = CryptoAlgorithms.GetAlgorithmFromConfig(digestMethod);
@@ -86,6 +88,7 @@ namespace System.ServiceModel.Security
             }
         }
 
+        [SuppressMessage("Microsoft.Security.Cryptography", "CA5354:DoNotUseSHA1", Justification = "Cannot change. Required as SOAP spec requires supporting SHA1.")]
         internal static HashAlgorithm CreateHashForAsymmetricSignature(string signatureMethod)
         {
             object algorithmObject = CryptoAlgorithms.GetAlgorithmFromConfig(signatureMethod);
index 913840d0359797a0ae39e848365a43eb6eb550bf..b62aceefcff29d0061ab33c65db191ab5faee7c8 100644 (file)
@@ -899,8 +899,45 @@ namespace System.ServiceModel.Security
         [SecuritySafeCritical]
         static bool CanKeyDoKeyExchange(X509Certificate2 certificate)
         {
-            CspKeyContainerInfo info = GetKeyContainerInfo(certificate);
-            return info != null && info.KeyNumber == KeyNumber.Exchange;
+            bool canDoKeyExchange = false;
+
+            if (!LocalAppContextSwitches.DisableCngCertificates)
+            {
+                X509KeyUsageExtension keyUsageExtension = null;
+                for (int i = 0; i < certificate.Extensions.Count; i++)
+                {
+                    keyUsageExtension = certificate.Extensions[i] as X509KeyUsageExtension;
+                    if (keyUsageExtension != null)
+                    {
+                        break;
+                    }
+                }
+
+                // No KeyUsage extension means most usages are permitted including key exchange.
+                // See RFC 5280 section 4.2.1.3 (Key Usage) for details. If the extension is non-critical
+                // then it's non-enforcing and meant as an aid in choosing the best certificate when
+                // there are multiple certificates to choose from. 
+                if (keyUsageExtension == null || !keyUsageExtension.Critical)
+                {
+                    return true;
+                }
+
+                // One of KeyAgreement, KeyEncipherment or DigitalSignature need to be allowed depending on the cipher
+                // being used. See RFC 5246 section 7.4.6 for more details.
+                // Additionally, according to msdn docs for PFXImportCertStore, the key specification is set to AT_KEYEXCHANGE
+                // when the data encipherment usage is set.
+                canDoKeyExchange = (keyUsageExtension.KeyUsages &
+                    (X509KeyUsageFlags.KeyAgreement | X509KeyUsageFlags.KeyEncipherment |
+                     X509KeyUsageFlags.DigitalSignature | X509KeyUsageFlags.DataEncipherment)) != X509KeyUsageFlags.None;
+            }
+
+            if (!canDoKeyExchange)
+            {
+                CspKeyContainerInfo info = GetKeyContainerInfo(certificate);
+                canDoKeyExchange = info != null && info.KeyNumber == KeyNumber.Exchange;
+            }
+
+            return canDoKeyExchange;
         }
 
         [Fx.Tag.SecurityNote(Critical = "Elevates to call properties: X509Certificate2.PrivateKey and CspKeyContainerInfo. Caller must protect the return value.")]
@@ -1866,6 +1903,52 @@ namespace System.ServiceModel.Security
             }
         }
 
+        public static bool CanReadPrivateKey(X509Certificate2 certificate)
+        {
+            if (!certificate.HasPrivateKey)
+                return false;
+
+            try
+            {
+                // CNG key, CNG permissions tests
+                using (RSA rsa = CngLightup.GetRSAPrivateKey(certificate))
+                {
+                    if (rsa != null)
+                    {
+                        return true;
+                    }
+                }
+
+                using (DSA dsa = CngLightup.GetDSAPrivateKey(certificate))
+                {
+                    if (dsa != null)
+                    {
+                        return true;
+                    }
+                }
+
+                using (ECDsa ecdsa = CngLightup.GetECDsaPrivateKey(certificate))
+                {
+                    if (ecdsa != null)
+                    {
+                        return true;
+                    }
+                }
+
+                // CAPI key, CAPI permissions test
+                if (certificate.PrivateKey != null)
+                {
+                    return true;
+                }
+
+                return false;
+            }
+            catch (CryptographicException)
+            {
+                return false;
+            }
+        }
+
         static class NetworkCredentialHelper
         {
             [Fx.Tag.SecurityNote(Critical = "Uses unsafe critical methods UnsafeGetUsername, UnsafeGetPassword, and UnsafeGetDomain to access the credential details without a Demand.",
index 0032edc9ea8587e863b8bb5741abf6b7f5304b4b..597228934389296fc09a746791dc777f463925cf 100644 (file)
@@ -543,7 +543,14 @@ namespace System.ServiceModel.Security
             bool hasPrivateKey = false;
             try
             {
-                hasPrivateKey = certificate != null && certificate.PrivateKey != null;
+                if (System.ServiceModel.LocalAppContextSwitches.DisableCngCertificates)
+                {
+                    hasPrivateKey = certificate != null && certificate.PrivateKey != null;
+                }
+                else
+                {
+                    hasPrivateKey = certificate.HasPrivateKey && SecurityUtils.CanReadPrivateKey(certificate);
+                }
             }
             catch (SecurityException e)
             {
index b9f10c42f55ebf54486b9b584b9227d57e0f086a..5641522d6ed32f497fe110e7a66e70b26cbe73f5 100644 (file)
@@ -461,7 +461,7 @@ namespace System.ServiceModel.Security.Tokens
 
             XmlDocument dom = new XmlDocument();
             dom.PreserveWhitespace = true;
-            dom.Load(stream);
+            dom.Load(new XmlTextReader(stream) { DtdProcessing = DtdProcessing.Prohibit });
             stream.Close();
 
             return dom.DocumentElement;
index e3d7cf18cc07d587f1e980a4e513774963b751e3..417886dd3eba68ef6d147d84828ba4cd1efa0ae1 100644 (file)
@@ -2310,7 +2310,7 @@ namespace System.ServiceModel.Security
                 writer.WriteEndElement();
                 writer.Flush();
                 stream.Seek(0, SeekOrigin.Begin);
-                result = (XmlElement)doc.ReadNode(new XmlTextReader(stream));
+                result = (XmlElement)doc.ReadNode(new XmlTextReader(stream) { DtdProcessing = DtdProcessing.Prohibit });
             }
             return result;
         }
index 2795cd2b3eca8eea7464ea48b07a0e36cf34ae32..2b65cc9326e2bbcd9574d9563373bab1921085bb 100644 (file)
@@ -1417,7 +1417,7 @@ namespace System.ServiceModel.Security
                     writer.Flush();
                     stream.Seek(0, SeekOrigin.Begin);
                     XmlNode skiNode;
-                    using (XmlDictionaryReader reader = XmlDictionaryReader.CreateDictionaryReader(new XmlTextReader(stream)))
+                    using (XmlDictionaryReader reader = XmlDictionaryReader.CreateDictionaryReader(new XmlTextReader(stream) { DtdProcessing = DtdProcessing.Prohibit }))
                     {
                         reader.MoveToContent();
                         skiNode = doc.ReadNode(reader);
index 81df58a3069e5ff171d11fed73dc25d5fab47202..1bd584b2806af9a18b3a131b41a8151545fe09e1 100644 (file)
@@ -2064,7 +2064,8 @@ namespace System.ServiceModel.Security
                     throw DiagnosticUtility.ThrowHelperInvalidOperation(SR.GetString(SR.ID5004, ns));
             }
 
-            return XmlSchema.Read(new StringReader(xmlSchema), null);
+            StringReader reader = new StringReader(xmlSchema);
+            return XmlSchema.Read(new XmlTextReader(reader) { DtdProcessing = DtdProcessing.Prohibit }, null);
         }
 
         /// <summary>
index 47a80aaf77243b741f856953711713b6f8963e66..37ca8e48b951c8f1a1eecc1960c5e06849b6fba0 100644 (file)
@@ -1,4 +1,4 @@
- //-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
 // Copyright (c) Microsoft Corporation.  All rights reserved.
 //-----------------------------------------------------------------------------
 
@@ -1076,6 +1076,9 @@ namespace System.ServiceModel
                 {
                     ManagementExtension.OnServiceOpened(this);
                 }
+
+                // log telemetry data for the current WCF service.
+                TelemetryTraceLogging.LogSeriveKPIData(this.Description);
             }
             base.OnOpened();
 
index b7c7db2a426e186689f57b5cb1bfb1ea1d2ce26d..19fba5c99a817ccc5faa6fddf9da398470c4d950 100644 (file)
@@ -15,12 +15,15 @@ namespace System.ServiceModel
         internal const string HttpTransportPerFactoryConnectionPoolString = "wcf:httpTransportBinding:useUniqueConnectionPoolPerFactory";
         internal const string EnsureUniquePerformanceCounterInstanceNamesString = "wcf:ensureUniquePerformanceCounterInstanceNames";
         internal const string UseConfiguredTransportSecurityHeaderLayoutString = "wcf:useConfiguredTransportSecurityHeaderLayout";
+        internal const string UseBestMatchNamedPipeUriString = "wcf:useBestMatchNamedPipeUri";
         const bool DefaultHttpTransportPerFactoryConnectionPool = false;
         const bool DefaultEnsureUniquePerformanceCounterInstanceNames = false;
         const bool DefaultUseConfiguredTransportSecurityHeaderLayout = false;
+        const bool DefaultUseBestMatchNamedPipeUri = false;
         static bool httpTransportPerFactoryConnectionPool;
         static bool ensureUniquePerformanceCounterInstanceNames;
         static bool useConfiguredTransportSecurityHeaderLayout;
+        static bool useBestMatchNamedPipeUri;
         static volatile bool settingsInitalized = false;
         static object appSettingsLock = new object();
 
@@ -54,6 +57,16 @@ namespace System.ServiceModel
             }
         }
 
+        internal static bool UseBestMatchNamedPipeUri
+        {
+            get
+            {
+                EnsureSettingsLoaded();
+
+                return useBestMatchNamedPipeUri;
+            }
+        }
+
         [SuppressMessage(FxCop.Category.ReliabilityBasic, "Reliability104:CaughtAndHandledExceptionsRule",
             Justification = "Handle the configuration exceptions here to avoid regressions on customer's existing scenarios")]
         static void EnsureSettingsLoaded()
@@ -89,6 +102,11 @@ namespace System.ServiceModel
                                 useConfiguredTransportSecurityHeaderLayout = DefaultUseConfiguredTransportSecurityHeaderLayout;
                             }
 
+                            if ((appSettingsSection == null) || !bool.TryParse(appSettingsSection[UseBestMatchNamedPipeUriString], out useBestMatchNamedPipeUri))
+                            {
+                                useBestMatchNamedPipeUri = DefaultUseBestMatchNamedPipeUri;
+                            }
+
                             settingsInitalized = true;
                         }
                     }
index 969772454c5434dc9ee4a2b961b9b0d9bc222dca..a62d82e0b93426c99cb53eeb5d11100e38d0c986 100644 (file)
@@ -4,6 +4,7 @@
 
 namespace System
 {
+    using System.Collections.Concurrent;
     using System.Collections.Generic;
     using System.Collections.ObjectModel;
     using System.Collections.Specialized;
@@ -11,6 +12,7 @@ namespace System
     using System.ServiceModel;
     using System.ServiceModel.Channels;
     using System.Text;
+    using System.Threading;
     using System.Runtime.CompilerServices;
     using System.Globalization;
 
@@ -31,7 +33,7 @@ namespace System
         const string NullableDefault = "null";
         readonly WildcardInfo wildcard;
         IDictionary<string, string> defaults;
-        Dictionary<string, string> unescapedDefaults;
+        ConcurrentDictionary<string, string> unescapedDefaults;
 
         VariablesCollection variables;
 
@@ -263,7 +265,7 @@ namespace System
             {
                 if (this.defaults == null)
                 {
-                    this.defaults = new UriTemplateDefaults(this);
+                    Interlocked.CompareExchange<IDictionary<string, string>>(ref this.defaults, new UriTemplateDefaults(this), null);
                 }
                 return this.defaults;
             }
@@ -943,16 +945,10 @@ namespace System
             }
             if (this.unescapedDefaults == null)
             {
-                this.unescapedDefaults = new Dictionary<string, string>(StringComparer.Ordinal);
-            }
-            string unescapedValue;
-            if (!this.unescapedDefaults.TryGetValue(escapedValue, out unescapedValue))
-            {
-                unescapedValue = Uri.UnescapeDataString(escapedValue);
-                this.unescapedDefaults.Add(escapedValue, unescapedValue);
+                this.unescapedDefaults = new ConcurrentDictionary<string, string>(StringComparer.Ordinal);
             }
 
-            return unescapedValue;
+            return this.unescapedDefaults.GetOrAdd(escapedValue, Uri.UnescapeDataString);
         }
 
         struct BindInformation
@@ -1181,8 +1177,8 @@ namespace System
                 {
                     if (this.pathSegmentVariableNamesSnapshot == null)
                     {
-                        this.pathSegmentVariableNamesSnapshot = new ReadOnlyCollection<string>(
-                            this.pathSegmentVariableNames);
+                        Interlocked.CompareExchange<ReadOnlyCollection<string>>(ref this.pathSegmentVariableNamesSnapshot, new ReadOnlyCollection<string>(
+                            this.pathSegmentVariableNames), null);
                     }
                     return this.pathSegmentVariableNamesSnapshot;
                 }
@@ -1193,8 +1189,8 @@ namespace System
                 {
                     if (this.queryValueVariableNamesSnapshot == null)
                     {
-                        this.queryValueVariableNamesSnapshot = new ReadOnlyCollection<string>(
-                            this.queryValueVariableNames);
+                        Interlocked.CompareExchange<ReadOnlyCollection<string>>(ref this.queryValueVariableNamesSnapshot, new ReadOnlyCollection<string>(
+                            this.queryValueVariableNames), null);
                     }
                     return this.queryValueVariableNamesSnapshot;
                 }
index 7e89f129e7c015cb1446ac7e8ef27bebbad77865..51d5a3c922e21e2dd4072863a56bdbf96b230d04 100644 (file)
@@ -11,6 +11,7 @@
     using System.Web.Resources;
     using System.Web.UI;
     using System.Web.UI.WebControls;
+    using System.Web.DynamicData.Util;
 
     /// <summary>
     /// Validator that enforces model validation. It can be used either at the field level or the entity level
                 }
 
                 if (!attrib.IsValid(value)) {
-                    ErrorMessage = HttpUtility.HtmlEncode(attrib.FormatErrorMessage(Column.DisplayName));
+                    ErrorMessage = HttpUtility.HtmlEncode(StringLocalizerUtil.GetLocalizedString(attrib, Column.DisplayName));
                     return false;
                 }
             }
index 33381499ece2f29f0e3aae2a98a9788fd92f0557..324ddf3a0a11f7b067a36424deee60253d97f470 100644 (file)
@@ -516,7 +516,8 @@ namespace System.Web.DynamicData {
             validator.MaximumValue = converter(rangeAttribute.Maximum);
 
             if (String.IsNullOrEmpty(validator.ErrorMessage)) {
-                validator.ErrorMessage = HttpUtility.HtmlEncode(rangeAttribute.FormatErrorMessage(column.DisplayName));
+                validator.ErrorMessage = HttpUtility.HtmlEncode(
+                    StringLocalizerUtil.GetLocalizedString(rangeAttribute, column.DisplayName));
             }
         }
 
@@ -533,7 +534,8 @@ namespace System.Web.DynamicData {
             validator.ValidationExpression = regexAttribute.Pattern;
 
             if (String.IsNullOrEmpty(validator.ErrorMessage)) {
-                validator.ErrorMessage = HttpUtility.HtmlEncode(regexAttribute.FormatErrorMessage(column.DisplayName));
+                validator.ErrorMessage = HttpUtility.HtmlEncode(
+                    StringLocalizerUtil.GetLocalizedString(regexAttribute, column.DisplayName));
             }
         }
 
index 41ce63ba26f8f37451932aa1c727b347c8a9cc0d..74fb8fb0fe7834c8e57ca0e70b8c7a8ec1428afe 100644 (file)
@@ -250,7 +250,8 @@ namespace System.Web.DynamicData {
         public string RequiredErrorMessage {
             get {
                 var requiredAttribute = Metadata.RequiredAttribute;
-                return requiredAttribute != null ? requiredAttribute.FormatErrorMessage(DisplayName) : String.Empty;
+                return requiredAttribute != null ? 
+                    StringLocalizerUtil.GetLocalizedString(requiredAttribute, DisplayName) : String.Empty;
             }
         }
 
@@ -590,7 +591,7 @@ namespace System.Web.DynamicData {
 
             public string Description {
                 get {
-                    return DisplayAttribute.GetPropertyValue(a => a.GetDescription(), null) ??
+                    return DisplayAttribute.GetLocalizedDescription() ??
                         DescriptionAttribute.GetPropertyValue(a => a.Description, null);
                 }
             }
@@ -599,14 +600,14 @@ namespace System.Web.DynamicData {
 
             public string DisplayName {
                 get {
-                    return DisplayAttribute.GetPropertyValue(a => a.GetName(), null) ??
+                    return DisplayAttribute.GetLocalizedName() ??
                         DisplayNameAttribute.GetPropertyValue(a => a.DisplayName, null);
                 }
             }
 
             public string ShortDisplayName {
                 get {
-                    return DisplayAttribute.GetPropertyValue(a => a.GetShortName(), null);
+                    return DisplayAttribute.GetLocalizedShortName();
                 }
             }
 
@@ -622,7 +623,7 @@ namespace System.Web.DynamicData {
 
             public string Prompt {
                 get {
-                    return DisplayAttribute.GetPropertyValue(a => a.GetPrompt(), null);
+                    return DisplayAttribute.GetLocalizedPrompt();
                 }
             }
 
index e0c957977bbfc80b809650cc258b8ae164a556ac..b7a62e03ad0c506d0e1a20b857e5d4ebdec818d4 100644 (file)
@@ -6,6 +6,7 @@
 #endregion
 
 using System.Diagnostics;
+using System.Diagnostics.CodeAnalysis;
 using System.IO;
 using System.Xml.Schema;
 using System.Xml.Serialization;
@@ -50,6 +51,7 @@ namespace Microsoft.VSDesigner.WCFModel
             return mapFile is DataSvcMapFile ? ((DataSvcMapFile)mapFile).Impl : null;
         }
 
+        [SuppressMessage("Microsoft.Security.Xml", "CA3060:UseXmlReaderForSchemaRead", Justification = "asp.net controls this .xsd file")]
         protected override XmlSchemaSet GetMapFileSchemaSet()
         {
             if (_mapFileSchemaSet == null)
index 9aea425a735756cc0d81906c657136bdd8cc6c91..d05896f21233975561d36eae46e62088df9efb86 100644 (file)
@@ -17,6 +17,7 @@ using XmlSerialization = System.Xml.Serialization;
 
 #if WEB_EXTENSIONS_CODE
 using System.Web.Resources;
+using System.Diagnostics.CodeAnalysis;
 #else
 using Microsoft.VSDesigner.WCF.Resources;
 #endif
@@ -551,6 +552,7 @@ namespace Microsoft.VSDesigner.WCFModel
         /// </summary>
         /// <param name="contentReader"></param>
         /// <remarks></remarks>
+        [SuppressMessage("Microsoft.Security.Xml", "CA3054:DoNotAllowDtdOnXmlTextReader", Justification = "Legacy code that trusts our developer-controlled input.")]
         private void LoadContentFromTextReader(TextReader contentReader)
         {
             if (contentReader == null)
@@ -597,6 +599,7 @@ namespace Microsoft.VSDesigner.WCFModel
         /// </summary>
         /// <return></return>
         /// <remarks></remarks>
+        [SuppressMessage("Microsoft.Security.Xml", "CA3054:DoNotAllowDtdOnXmlTextReader", Justification = "Legacy code that trusts our developer-controlled input.")]
         private MetadataContent LoadMetadataContent(MetadataType fileType)
         {
             if (ErrorInLoading != null)
index d820af9e042cb7eb24b07743c68ada8b6f6a3eac..8b9e1ea290916af1af40e266ad55872f21f14830 100644 (file)
@@ -6,6 +6,7 @@
 #endregion
 
 using System.Diagnostics;
+using System.Diagnostics.CodeAnalysis;
 using System.IO;
 using System.Xml.Schema;
 using System.Xml.Serialization;
@@ -50,6 +51,7 @@ namespace Microsoft.VSDesigner.WCFModel
             return mapFile is SvcMapFile ? ((SvcMapFile)mapFile).Impl : null;
         }
 
+        [SuppressMessage("Microsoft.Security.Xml", "CA3060:UseXmlReaderForSchemaRead", Justification = "asp.net controls this .xsd file")]
         protected override XmlSchemaSet GetMapFileSchemaSet()
         {
             if (_mapFileSchemaSet == null)
index 91b5f5e706bff36866ee9e647e2d574f9b22e106..a68af5f0a0f5554134464d04fbf3c97cceac5097 100644 (file)
@@ -59,7 +59,7 @@ namespace System.Web.UI.MobileControls.Adapters
 
         // This member variable is set each time when calendar info needs to
         // be accessed and be shared for other helper functions.
-        private Globalization.Calendar _threadCalendar;
+        private System.Globalization.Calendar _threadCalendar;
 
         private String _textBoxErrorMessage;
 
index ad6d1c2ff54d65774d1d745667637d804d175e04..c71652d11f158abc36395c55dc5d8e7e0577de52 100644 (file)
@@ -57,7 +57,7 @@ namespace System.Web.UI.MobileControls.Adapters
 
         // This member variable is set each time when calendar info needs to
         // be accessed and be shared for other helper functions.
-        private Globalization.Calendar _threadCalendar;
+        private System.Globalization.Calendar _threadCalendar;
 
         private String _textBoxErrorMessage;
 
index 47ceee67bd5751795e55e6503da3441f082d94b4..13648d0bf6cf2524f978eb526d5a674d37cb4f9e 100644 (file)
@@ -140,6 +140,10 @@ namespace System.Web {
         // Event signals that ASP.NET has started processing a request.
         // Overload used only for deducing ETW parameters; use the public entry point instead.
         //
+        // Visual Studio Online #222067 - This event is hardcoded to opt-out of EventSource activityID tracking. 
+        // This would normally be done by setting ActivityOptions = EventActivityOptions.Disable in the 
+        // Event attribute, but this causes a dependency between System.Web and mscorlib that breaks servicing. 
+        // 
         // !! WARNING !!
         // The logic in RequestStartedImpl must be kept in [....] with these parameters, otherwise
         // type safety violations could occur.
@@ -150,6 +154,10 @@ namespace System.Web {
         }
 
         // Event signals that ASP.NET has completed processing a request.
+        //
+        // Visual Studio Online #222067 - This event is hardcoded to opt-out of EventSource activityID tracking. 
+        // This would normally be done by setting ActivityOptions = EventActivityOptions.Disable in the 
+        // Event attribute, but this causes a dependency between System.Web and mscorlib that breaks servicing. 
         [Event((int)Events.RequestCompleted, Level = EventLevel.Informational, Task = (EventTask)Tasks.Request, Opcode = EventOpcode.Stop, Version = 1)]
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public void RequestCompleted() {
index 60d00f6e84621d5a6a26235f0f76fd5ef96d75a7..9e137fd5fcd6692fa13709804b1d282e5e86bda9 100644 (file)
@@ -909,10 +909,11 @@ namespace System.Web.Caching {
             return false;
         }
 
-        //
-        //  This method will return only the file dependencies from this dependency
-        //
-        internal virtual string[] GetFileDependencies()
+        /// <summary>
+        /// This method will return only the file dependencies from this dependency
+        /// </summary>
+        /// <returns></returns>
+        public virtual string[] GetFileDependencies()
         {
 #if USE_MEMORY_CACHE
             if (CacheInternal.UseMemoryCache) {
@@ -1121,11 +1122,12 @@ namespace System.Web.Caching {
 
             return true;
         }
-
-        //
-        //  This method will return only the file dependencies from this dependency
-        //
-        internal override string[] GetFileDependencies()
+        /// <summary>
+        /// This method will return only the file dependencies from this dependency
+        /// </summary>
+        /// <returns></returns>
+        public override string[] GetFileDependencies()
         {
             ArrayList fileNames = null;
             CacheDependency[] dependencies = null;
index 993569bd85488c9d5c07d6ebcb26b790e883380d..4ecdaa430155cff11bd14790c571935389c57d6c 100644 (file)
@@ -10,6 +10,7 @@ namespace System.Web.Caching {
     internal class SRef {
         private static Type s_type = Type.GetType("System.SizedReference", true, false);
         private Object _sizedRef;
+        private long _lastReportedSize; // This helps tremendously when looking at large dumps
         
         internal SRef(Object target) {
             _sizedRef = HttpRuntime.CreateNonPublicInstance(s_type, new object[] {target});
@@ -24,7 +25,7 @@ namespace System.Web.Caching {
                                                _sizedRef, // target
                                                null, // args
                                                CultureInfo.InvariantCulture);
-                return (long) o;
+                return _lastReportedSize = (long) o;
             }
         }
         
index 811f6e7da2d18a1570ead26cd205524ed2bb6b53..0dd2f027e68e5d94f097a958d682f1b10dfaa53f 100644 (file)
@@ -519,13 +519,14 @@ namespace System.Web.Caching {
         internal Cache                      _cachePublic;
         internal protected CacheMemoryStats _cacheMemoryStats;
         private  object                     _timerLock = new object();
-        private  Timer                      _timer;
+        private  DisposableGCHandleRef<Timer> _timerHandleRef;
         private  int                        _currentPollInterval = MEMORYSTATUS_INTERVAL_30_SECONDS;
         internal int                        _inCacheManagerThread;
         internal bool                       _enableMemoryCollection;
         internal bool                       _enableExpiration;
         internal bool                       _internalConfigRead;
         internal SRefMultiple               _srefMultiple;
+        private  int                        _disposed = 0;
 
         internal CacheCommon() {
             _cachePublic = new Cache(0);
@@ -537,13 +538,16 @@ namespace System.Web.Caching {
 
         internal void Dispose(bool disposing) {
             if (disposing) {
-                EnableCacheMemoryTimer(false);
-                _cacheMemoryStats.Dispose();
+                // This method must be tolerant to multiple calls to Dispose on the same instance
+                if (Interlocked.Exchange(ref _disposed, 1) == 0) {
+                    EnableCacheMemoryTimer(false);
+                    _cacheMemoryStats.Dispose();
+                }
             }
         }
 
-        internal void AddSRefTarget(CacheInternal c) {
-            _srefMultiple.AddSRefTarget(c);
+        internal void AddSRefTarget(object o) {
+            _srefMultiple.AddSRefTarget(o);
         }
 
         internal void SetCacheInternal(CacheInternal cacheInternal) {
@@ -591,19 +595,20 @@ namespace System.Web.Caching {
                 
                 if (enable) {
                     
-                    if (_timer == null) {
+                    if (_timerHandleRef == null) {
                         // <cache privateBytesPollTime> has not been read yet
-                        _timer = new Timer(new TimerCallback(this.CacheManagerTimerCallback), null, _currentPollInterval, _currentPollInterval);
+                        Timer timer = new Timer(new TimerCallback(this.CacheManagerTimerCallback), null, _currentPollInterval, _currentPollInterval);
+                        _timerHandleRef = new DisposableGCHandleRef<Timer>(timer);
                         Debug.Trace("Cache", "Started CacheMemoryTimers");
                     }
                     else {
-                        _timer.Change(_currentPollInterval, _currentPollInterval);
+                        _timerHandleRef.Target.Change(_currentPollInterval, _currentPollInterval);
                     }
                 }
                 else {
-                    Timer timer = _timer;
-                    if (timer != null && Interlocked.CompareExchange(ref _timer, null, timer) == timer) {
-                        timer.Dispose();
+                    var timerHandleRef = _timerHandleRef;
+                    if (timerHandleRef != null && Interlocked.CompareExchange(ref _timerHandleRef, null, timerHandleRef) == timerHandleRef) {
+                        timerHandleRef.Dispose();
                         Debug.Trace("Cache", "Stopped CacheMemoryTimers");
                     }
                 }
@@ -620,7 +625,7 @@ namespace System.Web.Caching {
         void AdjustTimer() {
             lock (_timerLock) {
 
-                if (_timer == null)
+                if (_timerHandleRef == null)
                     return;
 
                 // the order of these if statements is important
@@ -629,7 +634,7 @@ namespace System.Web.Caching {
                 if (_cacheMemoryStats.IsAboveHighPressure()) {
                     if (_currentPollInterval > MEMORYSTATUS_INTERVAL_5_SECONDS) {
                         _currentPollInterval = MEMORYSTATUS_INTERVAL_5_SECONDS;
-                        _timer.Change(_currentPollInterval, _currentPollInterval);
+                        _timerHandleRef.Target.Change(_currentPollInterval, _currentPollInterval);
                     }
                     return;
                 }
@@ -641,7 +646,7 @@ namespace System.Web.Caching {
                     int newPollInterval = Math.Min(CacheMemorySizePressure.PollInterval, MEMORYSTATUS_INTERVAL_30_SECONDS);
                     if (_currentPollInterval != newPollInterval) {
                         _currentPollInterval = newPollInterval;
-                        _timer.Change(_currentPollInterval, _currentPollInterval);
+                        _timerHandleRef.Target.Change(_currentPollInterval, _currentPollInterval);
                     }
                     return;
                 }
@@ -649,7 +654,7 @@ namespace System.Web.Caching {
                 // there is no pressure, interval should be the value from config
                 if (_currentPollInterval != CacheMemorySizePressure.PollInterval) {
                     _currentPollInterval = CacheMemorySizePressure.PollInterval;
-                    _timer.Change(_currentPollInterval, _currentPollInterval);
+                    _timerHandleRef.Target.Change(_currentPollInterval, _currentPollInterval);
                 }
             }
         }
@@ -666,7 +671,7 @@ namespace System.Web.Caching {
 #endif
             try {
                 // Dev10 633335: if the timer has been disposed, return without doing anything
-                if (_timer == null)
+                if (_timerHandleRef == null)
                     return 0;
 
                 // The timer thread must always call Update so that the CacheManager
@@ -1188,7 +1193,7 @@ namespace System.Web.Caching {
             _usage = new CacheUsage(this);
             _lock = new object();
             _insertBlock = new ManualResetEvent(true);
-            cacheCommon.AddSRefTarget(this);
+            cacheCommon.AddSRefTarget(new { _entries, _expires, _usage });
         }
 
         /*
@@ -1880,24 +1885,32 @@ namespace System.Web.Caching {
 
     class CacheMultiple : CacheInternal {
         int             _disposed;
-        CacheSingle[]   _caches;
+        DisposableGCHandleRef<CacheSingle>[] _cachesRefs;
         int             _cacheIndexMask;
 
         internal CacheMultiple(CacheCommon cacheCommon, int numSingleCaches) : base(cacheCommon) {
             Debug.Assert(numSingleCaches > 1, "numSingleCaches is not greater than 1");
             Debug.Assert((numSingleCaches & (numSingleCaches - 1)) == 0, "numSingleCaches is not a power of 2");
             _cacheIndexMask = numSingleCaches - 1;
-            _caches = new CacheSingle[numSingleCaches];
+
+            // Each CacheSingle will have its own SRef reporting the size of the data it references.
+            // Objects in this CacheSingle may have refs to the root Cache and therefore reference other instances of CacheSingle.
+            // This leads to an unbalanced tree of SRefs and makes GC less efficient while calculating multiple SRefs on multiple cores.
+            // Using DisposableGCHandleRef here prevents SRefs from calculating data that does not belong to other CacheSingle instances.
+            _cachesRefs = new DisposableGCHandleRef<CacheSingle>[numSingleCaches];
             for (int i = 0; i < numSingleCaches; i++) {
-                _caches[i] = new CacheSingle(cacheCommon, this, i);
+                _cachesRefs[i] = new DisposableGCHandleRef<CacheSingle>(new CacheSingle(cacheCommon, this, i));
             }
         }
 
         protected override void Dispose(bool disposing) {
             if (disposing) {
                 if (Interlocked.Exchange(ref _disposed, 1) == 0) {
-                    foreach (CacheSingle cacheSingle in _caches) {
-                        cacheSingle.Dispose();
+                    foreach (var cacheSingleRef in _cachesRefs) {
+                        // Unfortunately the application shutdown logic allows user to access cache even after its disposal.
+                        // We'll keep the GCHandle inside cacheSingleRef until it gets reclaimed during appdomain shutdown.
+                        // And we'll only dispose the Target to preserve the old behavior.
+                        cacheSingleRef.Target.Dispose(); 
                     }
                 }
             }
@@ -1908,8 +1921,8 @@ namespace System.Web.Caching {
         internal override int PublicCount {
             get {
                 int count = 0;
-                foreach (CacheSingle cacheSingle in _caches) {
-                    count += cacheSingle.PublicCount;
+                foreach (var cacheSingleRef in _cachesRefs) {
+                    count += cacheSingleRef.Target.PublicCount;
                 }
 
                 return count;
@@ -1919,8 +1932,8 @@ namespace System.Web.Caching {
         internal override long TotalCount {
             get {
                 long count = 0;
-                foreach (CacheSingle cacheSingle in _caches) {
-                    count += cacheSingle.TotalCount;
+                foreach (var cacheSingleRef in _cachesRefs) {
+                    count += cacheSingleRef.Target.TotalCount;
                 }
 
                 return count;
@@ -1928,22 +1941,23 @@ namespace System.Web.Caching {
         }
 
         internal override IDictionaryEnumerator CreateEnumerator() {
-            IDictionaryEnumerator[] enumerators = new IDictionaryEnumerator[_caches.Length];
-            for (int i = 0, c = _caches.Length; i < c; i++) {
-                enumerators[i] = _caches[i].CreateEnumerator();
+            IDictionaryEnumerator[] enumerators = new IDictionaryEnumerator[_cachesRefs.Length];
+            for (int i = 0, c = _cachesRefs.Length; i < c; i++) {
+                enumerators[i] = _cachesRefs[i].Target.CreateEnumerator();
             }
 
             return new AggregateEnumerator(enumerators);
         }
 
         internal CacheSingle GetCacheSingle(int hashCode) {
-            Debug.Assert(_caches != null && _caches.Length != 0);
+            Debug.Assert(_cachesRefs != null && _cachesRefs.Length != 0);
             // Dev10 865907: Math.Abs throws OverflowException for Int32.MinValue
             if (hashCode < 0) {
                 hashCode = (hashCode == Int32.MinValue) ? 0 : -hashCode;
             }
             int index = (hashCode & _cacheIndexMask);
-            return _caches[index];
+            Debug.Assert(_cachesRefs[index].Target != null);
+            return _cachesRefs[index].Target;
         }
 
         internal override CacheEntry UpdateCache(
@@ -1960,15 +1974,15 @@ namespace System.Web.Caching {
 
         internal override long TrimIfNecessary(int percent) {
             long count = 0;
-            foreach (CacheSingle cacheSingle in _caches) {
-                count += cacheSingle.TrimIfNecessary(percent);
+            foreach (var cacheSingleRef in _cachesRefs) {
+                count += cacheSingleRef.Target.TrimIfNecessary(percent);
             }
             return count;
         }
 
         internal override void EnableExpirationTimer(bool enable) {
-            foreach (CacheSingle cacheSingle in _caches) {
-                cacheSingle.EnableExpirationTimer(enable);
+            foreach (var cacheSingleRef in _cachesRefs) {
+                cacheSingleRef.Target.EnableExpirationTimer(enable);
             }
         }
     }
index 9f26b6ed449d60e2c96baeff70f3bf474eaf9ecf..65f0272002f410cb2fa2a9ac6d2b7c2ef979c154 100644 (file)
@@ -2636,6 +2636,7 @@ namespace System.Web.Compilation {
         }
 
         [SuppressMessage("Microsoft.Security", "MSEC1207:UseXmlReaderForLoad", Justification = "Xml file is created by us and only accessible to admins.")]
+        [SuppressMessage("Microsoft.Security.Xml", "CA3056:UseXmlReaderForLoad", Justification = "Xml file is created by us and only accessible to admins.")]
         private static bool ReadPrecompMarkerFile(string appRoot, out bool updatable) {
 
             updatable = false;
index ebcce1503c3ae5e9da28467a561b4ea70b3d02ef..b190341670282e60011e0eabd24cb2c2997d29e2 100644 (file)
@@ -61,6 +61,7 @@ internal class PreservationFileReader {
     }
 
     [SuppressMessage("Microsoft.Security", "MSEC1207:UseXmlReaderForLoad", Justification = "Xml file is created by us and only accessible to admins.")]
+    [SuppressMessage("Microsoft.Security.Xml", "CA3056:UseXmlReaderForLoad", Justification = "Xml file is created by us and only accessible to admins.")]
     private BuildResult ReadFileInternal(VirtualPath virtualPath, string preservationFile, long hashCode, bool ensureIsUpToDate) {
 
         XmlDocument doc = new XmlDocument();
index 7802a250b5671824957e2e8728937232d1fbd480..949883305940491daecf94a0d5b5f8d336076343 100644 (file)
@@ -30,6 +30,7 @@ using TypedDataSetGenerator=System.Data.Design.TypedDataSetGenerator;
 internal class XsdBuildProvider: BuildProvider {
 
     [SuppressMessage("Microsoft.Security", "MSEC1207:UseXmlReaderForLoad", Justification = "Developer-controlled .xsd files in application directory are implicitly trusted by ASP.Net.")]
+    [SuppressMessage("Microsoft.Security.Xml", "CA3056:UseXmlReaderForLoad", Justification = "Developer-controlled .xml files in application directory are implicitly trusted by ASP.Net.")]
     public override void GenerateCode(AssemblyBuilder assemblyBuilder)  {
 #if !FEATURE_PAL // FEATURE_PAL does not support System.Data.Design
         // Get the namespace that we will use
index 5dd5d4b54fdf4fc4e56425dd1db1e8902311c091..01ef95f8af74211a809c6637602c6949f0e2e9da 100644 (file)
@@ -32,6 +32,7 @@ namespace System.Web.Configuration {
 
     using Microsoft.Build.Utilities;
     using Microsoft.CSharp;
+    using System.Diagnostics.CodeAnalysis;
 
     [PermissionSet(SecurityAction.LinkDemand, Unrestricted = true)]
     [PermissionSet(SecurityAction.InheritanceDemand, Unrestricted = true)]
@@ -400,6 +401,7 @@ namespace System.Web.Configuration {
             return false;
         }
 
+        [SuppressMessage("Microsoft.Security.Xml", "CA3056:UseXmlReaderForLoad", Justification = "Developer-controlled .xml files in application directory are implicitly trusted by ASP.Net.")]
         protected void ProcessBrowserFiles(bool useVirtualPath, string virtualDir) {
             _browserTree = new BrowserTree();
             _defaultTree = new BrowserTree();
@@ -507,6 +509,7 @@ namespace System.Web.Configuration {
             ProcessCustomBrowserFiles(false, String.Empty);
         }
 
+        [SuppressMessage("Microsoft.Security.Xml", "CA3056:UseXmlReaderForLoad", Justification = "Developer-controlled .xml files in application directory are implicitly trusted by ASP.Net.")]
         internal void ProcessCustomBrowserFiles(bool useVirtualPath, string virtualDir) {
             //get all custom browser files and put them in the "tree"
             DirectoryInfo browserDirInfo = null;
index cddc9f294afffab1105f37117b926fd5c6679a51..2bd04aa4ba2e49c2f499baacd0ff7eb28e9c2749 100644 (file)
@@ -8,6 +8,7 @@ namespace System.Web.Configuration {
 
     using System.Collections;
     using System.Configuration;
+    using System.Diagnostics.CodeAnalysis;
     using System.IO;
     using System.Security;
     using System.Security.Permissions;
@@ -15,7 +16,6 @@ namespace System.Web.Configuration {
     using System.Web.Configuration;
     using System.Web.Util;
     using System.Xml;
-
     using Pair = System.Web.UI.Pair;
 
     //
@@ -276,6 +276,7 @@ namespace System.Web.Configuration {
         // 
         // ResolveFiles - parse files referenced with <file src="" />
         //
+        [SuppressMessage("Microsoft.Security.Xml", "CA3056:UseXmlReaderForLoad", Justification = "Developer-controlled .xml files in application directory are implicitly trusted by ASP.Net.")]
         static void ResolveFiles(ParseState parseState, object configurationContext) {
 
             //
index 8100d4659163b587f546ccb46717938d108b9475..e40ceb29e5987a3e15eefdf6daa21232259d8c6a 100644 (file)
@@ -21,6 +21,7 @@ namespace System.Web.Configuration {
     using System.Security.AccessControl;
 #endif // !FEATURE_PAL
     using System.Security.Permissions;
+    using System.Diagnostics.CodeAnalysis;
 
 
 #if !FEATURE_PAL // FEATURE_PAL does not enable COM
@@ -215,6 +216,7 @@ namespace System.Web.Configuration {
             return sb.ToString();
         }
 
+        [SuppressMessage("Microsoft.Security.Xml", "CA3057:DoNotUseLoadXml", Justification = "Developer-controlled xml contents are implicitly trusted by ASP.Net.")]
         public string DoEncryptOrDecrypt(bool doEncrypt, string xmlString, string protectionProviderName, string protectionProviderType, string[] paramKeys, string[] paramValues)
         {
             Type t = Type.GetType(protectionProviderType, true);
index 5c74438c23ad3e63ccfe3916a5c77582161cb6b3..0534ff1c51d7439c995800b9fc69e248b18b781a 100644 (file)
@@ -6,11 +6,21 @@
 
 namespace System.Web.Handlers {
     using System;
+    using System.Threading.Tasks;
     using System.Web.Hosting;
-    
-    internal class TransferRequestHandler : IHttpHandler {
-        
-        public void ProcessRequest(HttpContext context) {
+
+    internal class TransferRequestHandler : IHttpAsyncHandler {
+        public IAsyncResult BeginProcessRequest(HttpContext context, AsyncCallback cb, object extraData)
+        {
+            return TaskAsyncHelper.BeginTask(() => ProcessRequestAsync(context), cb, extraData);
+        }
+
+        public void EndProcessRequest(IAsyncResult result)
+        {
+            TaskAsyncHelper.EndTask(result);
+        }
+
+        private Task ProcessRequestAsync(HttpContext context) {
             IIS7WorkerRequest wr = context.WorkerRequest as IIS7WorkerRequest;
             if (wr == null) {
                 throw new PlatformNotSupportedException(SR.GetString(SR.Requires_Iis_Integrated_Mode));
@@ -24,14 +34,26 @@ namespace System.Web.Handlers {
                                   context.Request.EntityBody,
                                   null,
                                   preserveUser: false);
-            
+
             // force the completion of the current request so that the 
             // child execution can be performed immediately after unwind
-            context.ApplicationInstance.EnsureReleaseState();
+            var releaseStateTask = context.ApplicationInstance.EnsureReleaseStateAsync();
 
             // DevDiv Bugs 162750: IIS7 Integrated Mode:  TransferRequest performance issue
             // Instead of calling Response.End we call HttpApplication.CompleteRequest()
-            context.ApplicationInstance.CompleteRequest();
+            if (releaseStateTask.IsCompleted) {
+                context.ApplicationInstance.CompleteRequest();
+                return TaskAsyncHelper.CompletedTask;
+            }
+            else {
+                return releaseStateTask.ContinueWith((_) => context.ApplicationInstance.CompleteRequest());
+            }
+        }
+
+        public void ProcessRequest(HttpContext context)
+        {
+            string errorMessage = SR.GetString(SR.HttpTaskAsyncHandler_CannotExecuteSynchronously, GetType());
+            throw new NotSupportedException(errorMessage);
         }
 
         public bool IsReusable {
index e02ad7fb551d31eaa0e5ad8730f471d3434552d7..9a24a5b37f2abed7f6c1ee25b64758e2b3611d1d 100644 (file)
@@ -82,6 +82,9 @@ namespace System.Web.Hosting {
         // delegate OnRespondToPing
         private WaitCallback _onRespondToPingWaitCallback;
 
+        // flag indicates whether any fatal exception has been recorded
+        private bool _fatalExceptionRecorded = false;
+
         // single instance of app manager
         private static ApplicationManager _theAppManager;
 
@@ -154,6 +157,16 @@ namespace System.Web.Hosting {
             }
         }
 
+        private bool FatalExceptionRecorded
+        {
+            get {
+                return _fatalExceptionRecorded;
+            }
+            set {
+                _fatalExceptionRecorded = value;
+            }
+        }
+
         internal static void RecordFatalException(Exception e) {
             RecordFatalException(AppDomain.CurrentDomain, e);
         }
@@ -168,7 +181,7 @@ namespace System.Web.Hosting {
             }
         }
 
-        private static void OnUnhandledException(Object sender, UnhandledExceptionEventArgs eventArgs) {
+        internal static void OnUnhandledException(Object sender, UnhandledExceptionEventArgs eventArgs) {
             // if the CLR is not terminating, ignore the notification
             if (!eventArgs.IsTerminating) {
                 return;
@@ -184,6 +197,15 @@ namespace System.Web.Hosting {
                 return;
             }
 
+            // If any fatal exception was recorded in applicaiton AppDomains,
+            // we wouldn't record exceptions in the default AppDomain. 
+            var appManager = GetApplicationManager();
+            if (AppDomain.CurrentDomain.IsDefaultAppDomain() && appManager.FatalExceptionRecorded) {
+                return;
+            }
+
+            appManager.FatalExceptionRecorded = true;
+
             RecordFatalException(appDomain, exception);
         }
 
index d5d2c15e352a8a9d843e51a7713ba89e1c73946c..27ce613025ec92382a446259c7297a7211bd35b0 100644 (file)
@@ -184,6 +184,11 @@ namespace System.Web.Hosting {
             // start watching for app domain unloading
             _onAppDomainUnload = new EventHandler(OnAppDomainUnload);
             Thread.GetDomain().DomainUnload += _onAppDomainUnload;
+
+            // VSO 160528: We used to listen to the default AppDomain's UnhandledException only.
+            // However, non-serializable exceptions cannot be passed to the default domain. Therefore
+            // we should try to log exceptions in application AppDomains.
+            Thread.GetDomain().UnhandledException += new UnhandledExceptionEventHandler(ApplicationManager.OnUnhandledException);
         }
 
         internal long TrimCache(int percent) {
index eff422558e332b96b845c2f140b46d0117076596..41564928cced4f99e96ceacbe00249c8cc3066cd 100644 (file)
@@ -500,17 +500,37 @@ namespace System.Web {
             }
         }
 
-        // DevDiv Bugs 151914: Release session state before executing child request
-        internal void EnsureReleaseState() {
+        private ISessionStateModule FindISessionStateModule() {
+            if (!HttpRuntime.UseIntegratedPipeline)
+                return null;
+
             if (_moduleCollection != null) {
                 for (int i = 0; i < _moduleCollection.Count; i++) {
-                    IHttpModule module = _moduleCollection.Get(i);
-                    if (module is SessionStateModule) {
-                        ((SessionStateModule) module).EnsureReleaseState(this);
-                        break;
+                    ISessionStateModule module = _moduleCollection.Get(i) as ISessionStateModule;
+                    if (module != null) {
+                        return module;
                     }
                 }
             }
+
+            return null;
+        }
+
+        // DevDiv Bugs 151914: Release session state before executing child request
+        internal void EnsureReleaseState() {
+            ISessionStateModule module = FindISessionStateModule();
+            if (module != null) {
+                module.ReleaseSessionState(Context);
+            }
+        }
+
+        internal Task EnsureReleaseStateAsync() {
+            ISessionStateModule module = FindISessionStateModule();
+            if (module != null) {
+                return module.ReleaseSessionStateAsync(Context);
+            }
+
+            return TaskAsyncHelper.CompletedTask;
         }
 
         /// <devdoc>
index 6d4bae316f5525cbafbb90706bfb4b13b4060257..f54da48a4aabddff3d23116e74b46c80b8b38e5e 100644 (file)
@@ -39,10 +39,11 @@ namespace System.Web {
             _ignoreParams = -1;
         }
 
-        /*
-         * Reset based on the cached vary headers.
-         */
-        internal void ResetFromParams(String[] parameters) {
+        /// <summary>
+        /// Set the Parameters in Cache Vary 
+        /// </summary>
+        /// <param name="parameters"></param>
+        public void SetParams(string[] parameters) {
             int i, n;
 
             Reset();
@@ -75,16 +76,20 @@ namespace System.Web {
             return _ignoreParams == 1 || _paramsStar || _parameters != null;
         }
 
-        internal String[] GetParams() {
-            String[]    s = null;
+        /// <summary>
+        /// Get the Parameters in Cache Vary
+        /// </summary>
+        /// <returns></returns>
+        public string[] GetParams() {
+            string[]    s = null;
             Object      item;
             int         i, j, c, n;
 
             if (_ignoreParams == 1) {
-                s =  new String[1] {String.Empty};
+                s =  new string[1] {string.Empty};
             }
             else if (_paramsStar) {
-                s =  new String[1] {"*"};
+                s =  new string[1] {"*"};
             }
             else if (_parameters != null) {
                 n = _parameters.Size;
@@ -102,7 +107,7 @@ namespace System.Web {
                     for (i = 0; i < n; i++) {
                         item = _parameters.GetValue(i);
                         if (item != null) {
-                            s[j] = (String) item;
+                            s[j] = (string) item;
                             j++;
                         }
                     }
@@ -116,7 +121,7 @@ namespace System.Web {
 
         //
         // Public methods and properties
-        //
+        // 
 
 
         /// <devdoc>
index 5cdde5d30067bf648131bb17ab7e515709b00edd..0e5efebd84fb5994eafe57bc4fd0ee17347c1138 100644 (file)
@@ -30,7 +30,7 @@ namespace System.Web {
     //
     // Public constants for cache-control
     //
-    
+
 
     /// <devdoc>
     ///    <para>
@@ -573,12 +573,10 @@ namespace System.Web {
 
             int i, n;
             string[] fields;
-            
-            _utcTimestampRequest = utcTimestampRequest;
-
-            _varyByContentEncodings.ResetFromContentEncodings(settings.VaryByContentEncodings);
-            _varyByHeaders.ResetFromHeaders(settings.VaryByHeaders);                          
-            _varyByParams.ResetFromParams(settings.VaryByParams);
+           
+            _varyByContentEncodings.SetContentEncodings(settings.VaryByContentEncodings);
+            _varyByHeaders.SetHeaders(settings.VaryByHeaders);                          
+            _varyByParams.SetParams(settings.VaryByParams);
 
             _isModified                       = settings.IsModified;                    
             _hasSetCookieHeader               = settings.hasSetCookieHeader;
@@ -645,7 +643,11 @@ namespace System.Web {
             }
         }
 
-        internal bool IsModified() {
+        /// <summary>
+        /// Return true if the CachePolicy has been modified
+        /// </summary>
+        /// <returns></returns>
+        public bool IsModified() {
             return _isModified || _varyByContentEncodings.IsModified() || _varyByHeaders.IsModified() || _varyByParams.IsModified();
         }
 
@@ -771,20 +773,18 @@ namespace System.Web {
                 return;
             }
 
-            Debug.Assert((_utcTimestampCreated == DateTime.MinValue && _utcTimestampRequest == DateTime.MinValue) ||
-                         (_utcTimestampCreated != DateTime.MinValue && _utcTimestampRequest != DateTime.MinValue),
-                        "_utcTimestampCreated and _utcTimestampRequest are out of [....] in UpdateCachedHeaders");
-
+            //To enable Out of Band OutputCache Module support, we will always refresh the UtcTimestampRequest.
             if (_utcTimestampCreated == DateTime.MinValue) {
-                _utcTimestampCreated = _utcTimestampRequest = response.Context.UtcTimestamp;
+                _utcTimestampCreated = response.Context.UtcTimestamp;
             }
+            _utcTimestampRequest = response.Context.UtcTimestamp; 
 
             if (_slidingExpiration != 1) {
                 _slidingDelta = TimeSpan.Zero;
             }
             else if (_isMaxAgeSet) {
                 _slidingDelta = _maxAge;
-            }
+            } 
             else if (_isExpiresSet) {
                 _slidingDelta = _utcExpires - _utcTimestampCreated;
             }
@@ -840,7 +840,7 @@ namespace System.Web {
                 }
 
                 sb.Append('\"');
-            }
+            } 
 
             if (_noStore) {
                 AppendValueToHeader(sb, "no-store");
@@ -1056,10 +1056,10 @@ namespace System.Web {
                 headers.Add(_headerVaryBy);
             }
         }
-
         /*
-         * Public methods
-         */
+        * Public methods
+        */
 
         internal HttpCachePolicySettings GetCurrentSettings(HttpResponse response) {
             String[]                    varyByContentEncodings;
@@ -1191,6 +1191,16 @@ namespace System.Web {
             return absoluteExpiration;
         }
 
+        // Expose this property to OutputCacheUtility class 
+        // In order to enable Out of Band output cache module to access the Validation Callback Info
+        internal IEnumerable GetValidationCallbacks() {
+            if (_validationCallbackInfo == null) {
+                return new ArrayList();
+            }
+
+            return _validationCallbackInfo;
+        }
+
         /*
          * Cache at server?
          */
@@ -1203,7 +1213,11 @@ namespace System.Web {
             _noServerCaching = true;
         }
 
-        internal bool GetNoServerCaching() {
+        /// <summary>
+        /// Return True if we should stops all server caching for current response
+        /// </summary>
+        /// <returns></returns>
+        public bool GetNoServerCaching() {
             return _noServerCaching;
         }
 
@@ -1229,6 +1243,13 @@ namespace System.Web {
             _varyByCustom = custom;
         }
 
+        /// <summary>
+        /// Get the Vary by Custom Value
+        /// </summary>
+        /// <returns></returns>
+        public string GetVaryByCustom() {
+            return _varyByCustom;
+        }
         /*
          * Cache-Control: extension        
          */
@@ -1250,6 +1271,14 @@ namespace System.Web {
             }
         }
 
+        /// <summary>
+        /// Get Cache Extensions Value
+        /// </summary>
+        /// <returns></returns>
+        public string GetCacheExtensions() {
+            return _cacheExtension;
+        }
+
         /*
          * Cache-Control: no-transform        
          */
@@ -1263,11 +1292,27 @@ namespace System.Web {
             _noTransforms = true;
         }
 
+        /// <summary>
+        /// Return true if No-transform directive, enables the sending of the CacheControl
+        /// </summary>
+        /// <returns></returns>
+        public bool GetNoTransforms() {
+            return _noTransforms;
+        }
+
         internal void SetIgnoreRangeRequests() {
             Dirtied();
             _ignoreRangeRequests = true;
         }
 
+        /// <summary>
+        /// Return true if ignore range request
+        /// </summary>
+        /// <returns></returns>
+        public bool GetIgnoreRangeRequests() {
+            return _ignoreRangeRequests;
+        }
+
         /// <devdoc>
         ///    <para>Contains policy for the Vary: header.</para>
         /// </devdoc>
@@ -1320,11 +1365,15 @@ namespace System.Web {
             }
         }
 
-        internal HttpCacheability GetCacheability() {
+        /// <summary>
+        /// Get the Cache-control (public, private and no-cache) directive
+        /// </summary>
+        /// <returns></returns>
+        public HttpCacheability GetCacheability() {
             return _cacheability;
         }
-
-
+        
+       
         /// <devdoc>
         ///    <para>Sets the Cache-Control header to one of the values of HttpCacheability in 
         ///       conjunction with a field-level exclusion directive.</para>
@@ -1376,6 +1425,14 @@ namespace System.Web {
             Dirtied();
             _hasUserProvidedDependencies = hasUserProvidedDependencies;
         }
+        
+        /// <summary>
+        /// return true if no store is set
+        /// </summary>
+        /// <returns></returns>
+        public bool GetNoStore() {
+            return _noStore;
+        }
 
         /*
          * Expiration policy.
@@ -1405,6 +1462,14 @@ namespace System.Web {
             }
         }
 
+        /// <summary>
+        /// Return the expire header as absolute expire datetime 
+        /// </summary>
+        /// <returns></returns>
+        public DateTime GetExpires() {
+            return _utcExpires;
+        }
+
         /*
          * Cache-Control: max-age=delta-seconds
          */
@@ -1428,6 +1493,14 @@ namespace System.Web {
             }
         }
 
+        /// <summary>
+        /// Get the Cache-Control Max Age
+        /// </summary>
+        /// <returns></returns>
+        public TimeSpan GetMaxAge() {
+            return _maxAge;
+        }       
+
         // Suppress max-age and s-maxage in cache-control header (required for IIS6 kernel mode cache)
         internal void SetNoMaxAgeInCacheControl() {
             _noMaxAgeInCacheControl = true;
@@ -1452,6 +1525,14 @@ namespace System.Web {
             }
         }
 
+        /// <summary>
+        /// Get the Cache-Control: Proxy Max Age Value
+        /// </summary>
+        /// <returns></returns>
+        public TimeSpan GetProxyMaxAge() {
+            return _proxyMaxAge;
+        }
+
         /*
          * Sliding Expiration
          */
@@ -1470,6 +1551,17 @@ namespace System.Web {
             }
         }
 
+        /// <summary>
+        /// Return true if to make expiration sliding. that is, if cached, it should be renewed with each
+        /// response. This feature is identical in spirit to the IIS
+        /// configuration option to add an expiration header relative to the current response
+        /// time. This feature is identical in spirit to the IIS configuration option to add
+        /// an expiration header relative to the current response time.
+        /// </summary>
+        /// <returns></returns>
+        public bool HasSlidingExpiration() {
+            return _slidingExpiration == 1;
+        }
 
         public void SetValidUntilExpires(bool validUntilExpires) {
             if (_validUntilExpires == -1 || _validUntilExpires == 1) {
@@ -1478,6 +1570,13 @@ namespace System.Web {
             }
         }
 
+        /// <summary>
+        /// Return true if valid until expires
+        /// </summary>
+        /// <returns></returns>
+        public bool IsValidUntilExpires() {
+            return _validUntilExpires == 1;
+        }
 
         public void SetAllowResponseInBrowserHistory(bool allow) {
             if (_allowInHistory == -1 || _allowInHistory == 1) {
@@ -1512,7 +1611,17 @@ namespace System.Web {
             }
         }
 
-        /*
+        /// <summary>
+        /// Get the Cache-Control: header to reflect either the must-revalidate or 
+        /// proxy-revalidate directives. 
+        /// The default is to not send either of these directives unless explicitly enabled using this method.
+        /// </summary>
+        /// <returns></returns>
+        public HttpCacheRevalidation GetRevalidation() {
+            return _revalidation;
+        }
+
+         /*
          * Etag
          */
 
@@ -1537,6 +1646,16 @@ namespace System.Web {
             _etag = etag;
         }
 
+        /// <summary>
+        /// Get the ETag header. Once an ETag is set, 
+        /// subsequent attempts to set it will fail and an exception will be thrown.
+        /// </summary>
+        /// <returns></returns>
+        public string GetETag() {
+            return _etag;
+        }
+
+
         /*
          * Last-Modified: RFC Date
          */
@@ -1577,6 +1696,14 @@ namespace System.Web {
             }
         }
 
+        /// <summary>
+        /// Get the Last-Modified header. 
+        /// </summary>
+        /// <returns></returns>
+        public DateTime GetUtcLastModified() {
+            return _utcLastModified;
+        }
+
 
         /// <devdoc>
         ///    <para>Sets the Last-Modified: header based on the timestamps of the
@@ -1587,6 +1714,15 @@ namespace System.Web {
             _generateLastModifiedFromFiles = true; 
         }
 
+        /// <summary>
+        /// Return true if the Last-Modified header is set to base on the timestamps of the
+        /// file dependencies of the handler.
+        /// </summary>
+        /// <returns></returns>
+        public bool GetLastModifiedFromFileDependencies() {
+            return _generateLastModifiedFromFiles;
+        }
+
 
         /// <devdoc>
         ///    <para>Sets the Etag header based on the timestamps of the file 
@@ -1601,6 +1737,14 @@ namespace System.Web {
             _generateEtagFromFiles = true;         
         }
 
+        /// <summary>
+        /// Return true if the Etag header has been set to base on the timestamps of the file 
+        /// dependencies of the handler
+        /// </summary>
+        /// <returns></returns>
+        public bool GetETagFromFileDependencies() {
+            return _generateEtagFromFiles;
+        }
 
         public void SetOmitVaryStar(bool omit) {
             Dirtied();
@@ -1610,6 +1754,13 @@ namespace System.Web {
             }
         }
 
+        /// <summary>
+        /// Return true if to omit Vary Star
+        /// </summary>
+        /// <returns></returns>
+        public int GetOmitVaryStar() {
+            return _omitVaryStar;
+        }
 
         /// <devdoc>
         ///    <para>Registers a validation callback for the current response.</para>
@@ -1628,5 +1779,16 @@ namespace System.Web {
 
             _validationCallbackInfo.Add(new ValidationCallbackInfo(handler, data));
         }
+        /// <summary>
+        /// Utc Timestamp Created
+        /// </summary>
+        public DateTime UtcTimestampCreated {
+            get {
+                return _utcTimestampCreated;
+            }
+            set {
+                _utcTimestampCreated = value;
+            }
+        }
     }
 }
index e55c71d05148c19a049c07d722bcf4eec781ad17..7f8a952f00432ae2e95125e57247fe18497c8fa8 100644 (file)
@@ -37,10 +37,12 @@ namespace System.Web {
             _headers = null;
         }
 
-        /*
-         * Reset based on the cached vary headers.
-         */
-        internal void ResetFromHeaders(String[] headers) {
+        /// <summary>
+        /// Set the Headers in Cache Vary
+        /// </summary>
+        /// <param name="headers"></param>
+        public void SetHeaders(string[] headers) {
+
             int i, n;
 
             if (headers == null) {
@@ -48,7 +50,7 @@ namespace System.Web {
                 _varyStar = false;
                 _headers = null;
             }
-            else {
+            else {           
                 _isModified = true;
                 if (headers[0].Equals("*")) {
                     Debug.Assert(headers.Length == 1, "headers.Length == 1");
@@ -97,19 +99,19 @@ namespace System.Web {
 
             return null;
         }
+        /// <summary>
+        /// Get the Headers in Cache Vary
+        /// </summary>
+        /// <returns></returns>
+        public string[] GetHeaders() {
+            string[]    s = null;
 
-        /*
-         * Returns the headers, for package access only.
-         * 
-         * @return the headers.
-         */
-        internal String[] GetHeaders() {
-            String[]    s = null;
             Object      item;
             int         i, j, c, n;
 
             if (_varyStar) {
-                return new String[1] {"*"};
+                return new string[1] {"*"};
             }
             else if (_headers != null) {
                 n = _headers.Size;
@@ -127,7 +129,7 @@ namespace System.Web {
                     for (i = 0; i < n; i++) {
                         item = _headers.GetValue(i);
                         if (item != null) {
-                            s[j] = (String) item;
+                            s[j] = (string) item;
                             j++;
                         }
                     }
@@ -138,7 +140,7 @@ namespace System.Web {
 
             return s;
         }
-
+  
         //
         // Public methods and properties
         //
index fe1e6d355f28e0e68606c04f997232206bf41139..236adffa9a0c137c2642cbcf61e699f093f5ffe5 100644 (file)
@@ -32,11 +32,13 @@ namespace System.Web {
             _isModified = false;
             _contentEncodings = null;
         }
+  
+        /// <summary>
+        /// Set the Content Encodings in Cache Vary
+        /// </summary>
+        /// <param name="contentEncodings"></param>
+        public void SetContentEncodings(string[] contentEncodings) {
 
-        /*
-         * Reset based on content encodings.
-         */
-        internal void ResetFromContentEncodings(String[] contentEncodings) {
             Reset();
             if (contentEncodings != null) {
                 _isModified = true;
@@ -75,9 +77,18 @@ namespace System.Web {
         internal bool IsModified() {
             return _isModified;
         }
-
-        internal String[] GetContentEncodings() {
-            return _contentEncodings;
+               
+        /// <summary>
+        /// Get the Content Encodings in Cache Vary
+        /// </summary>
+        /// <returns></returns>
+        public string[] GetContentEncodings() {
+            if (_contentEncodings != null) {
+                string[] contentEncodings = new string[_contentEncodings.Length];
+                _contentEncodings.CopyTo(contentEncodings, 0);
+                return contentEncodings;
+            }
+            return null;
         }
 
         //
index 4d02a0a8a8f726284a0931d2681dde864ba6c0f9..812c779064eae62c39c447e7cd4877dfa9dbcac5 100644 (file)
@@ -22,6 +22,7 @@ namespace System.Web {
     using System.Linq;
     using System.Net;
     using System.Reflection;
+    using System.Runtime.CompilerServices;
     using System.Runtime.Remoting.Messaging;
     using System.Security.Permissions;
     using System.Security.Principal;
@@ -1009,6 +1010,8 @@ namespace System.Web {
                 if (_delayedSessionState) {
                     lock (this) {
                         if (_delayedSessionState) {
+                            Debug.Assert(_sessionStateModule != null, "_sessionStateModule != null");
+
                             // If it's not null, it means we have a delayed session state item
                             _sessionStateModule.InitStateStoreItem(true);
                             _delayedSessionState = false;
@@ -1020,8 +1023,21 @@ namespace System.Web {
             }
         }
 
+        [MethodImpl(MethodImplOptions.NoInlining)]
         internal void EnsureSessionStateIfNecessary() {
-            Debug.Assert(_sessionStateModule != null, "_sessionStateModule != null");
+            if (_sessionStateModule == null)
+            {
+                // If _sessionStateModule is null, we wouldn't be able to call 
+                // _sessionStateModule.EnsureStateStoreItemLocked(), so we return here.
+                // _sessionStateModule could be null in the following cases,
+                // 1. No session state acquired.
+                // 2. HttpResponse.Flush() happens after session state being released.
+                // 3. The session state module in use is not System.Web.SessionState.SessionStateModule.
+                //
+                // This method is for the in-framework SessionStateModule only.
+                //  OOB SessionStateModule can achieve this by using HttpResponse.AddOnSendingHeaders. 
+                return;
+            }
 
             HttpSessionState session = (HttpSessionState)Items[SessionStateUtility.SESSION_KEY];
 
@@ -1042,7 +1058,6 @@ namespace System.Web {
         }
 
         internal void RemoveHttpSessionStateModule() {
-            Debug.Assert(_sessionStateModule != null, "_sessionStateModule != null");
             _delayedSessionState = false;
             _sessionStateModule = null;
         }
index b92ce62520ba19dc4df09601e85545381237d6a8..db4f721437c45c7d9fe7606f9d2221e0256a32a8 100644 (file)
@@ -1126,9 +1126,18 @@ namespace System.Web {
             }
 
             // restore content
-            _httpWriter.UseSnapshot(rawResponse.Buffers);
+            SetResponseBuffers(rawResponse.Buffers);
+  
+            _suppressContent = !sendBody;         
+        }
+
+        // set the response content bufffers
+        internal void SetResponseBuffers(ArrayList buffers) {
+            if (_httpWriter == null) {
+                throw new HttpException(SR.GetString(SR.Cannot_use_snapshot_for_TextWriter));
+            }
 
-            _suppressContent = !sendBody;
+            _httpWriter.UseSnapshot(buffers);
         }
 
         internal void CloseConnectionAfterError() {
index aa91b33062724c2c6bc965678c94b11b7582b463..3c0296df9e3277543b183e0803040ccc37070226 100644 (file)
@@ -4,6 +4,7 @@
     using System.ComponentModel;
     using System.ComponentModel.DataAnnotations;
     using System.Linq;
+    using System.Web.Globalization;
 
     public class DataAnnotationsModelMetadataProvider : AssociatedMetadataProvider {
 
@@ -11,7 +12,7 @@
             List<Attribute> attributeList = new List<Attribute>(attributes);
             DisplayColumnAttribute displayColumnAttribute = attributeList.OfType<DisplayColumnAttribute>().FirstOrDefault();
             DataAnnotationsModelMetadata result = new DataAnnotationsModelMetadata(this, containerType, modelAccessor, modelType, propertyName, displayColumnAttribute);
-
+            
 #if UNDEF
             // Do [HiddenInput] before [UIHint], so you can override the template hint
             HiddenInputAttribute hiddenInputAttribute = attributeList.OfType<HiddenInputAttribute>().FirstOrDefault();
             DisplayAttribute display = attributes.OfType<DisplayAttribute>().FirstOrDefault();
             string name = null;
             if (display != null) {
-                result.Description = display.GetDescription();
-                result.ShortDisplayName = display.GetShortName();
-                result.Watermark = display.GetPrompt();
-                result.Order = display.GetOrder() ?? ModelMetadata.DefaultOrder;
+                var displayAdapter = new DisplayAttributeAdapter(display);
+                result.Description = displayAdapter.GetDescription();
+                result.ShortDisplayName = displayAdapter.GetShortName();
+                result.Watermark = displayAdapter.GetPrompt();
+                result.Order = displayAdapter.GetOrder() ?? ModelMetadata.DefaultOrder;
 
-                name = display.GetName();
+                name = displayAdapter.GetName();
             }
 
             if (name != null) {
index cff887cbb5f0f49dc997d69c965bf79d4b0bab7f..79bf561a2ad58f0bf027b96174d0c52f5badda7d 100644 (file)
@@ -2,8 +2,10 @@
     using System;
     using System.Collections.Generic;
     using System.ComponentModel.DataAnnotations;
+    using System.Threading;
+    using System.Web.Globalization;
 
-    public class DataAnnotationsModelValidator : ModelValidator {
+    public class DataAnnotationsModelValidator : ModelValidator {        
         public DataAnnotationsModelValidator(ModelMetadata metadata, ModelBindingExecutionContext context, ValidationAttribute attribute)
             : base(metadata, context) {
 
 
         protected internal string ErrorMessage {
             get {
-                return Attribute.FormatErrorMessage(Metadata.GetDisplayName());
+                if (UseStringLocalizerProvider) {
+                    var errorMsg = GetLocalizedString(Attribute.ErrorMessage);
+
+                    return errorMsg ?? Attribute.FormatErrorMessage(Metadata.GetDisplayName());
+                }
+                else {
+                    return Attribute.FormatErrorMessage(Metadata.GetDisplayName());
+                }
+            }
+        }
+
+        protected string GetLocalizedString(string name, params object[] arguments) {
+            if (StringLocalizerProviders.DataAnnotationStringLocalizerProvider != null) {
+                return StringLocalizerProviders.DataAnnotationStringLocalizerProvider
+                    .GetLocalizedString(Thread.CurrentThread.CurrentUICulture, name, arguments);
+            }
+            else {
+                return null;
             }
         }
 
             ValidationResult result = Attribute.GetValidationResult(Metadata.Model, context);
             if (result != ValidationResult.Success) {
                 yield return new ModelValidationResult {
-                    Message = result.ErrorMessage
+                    Message = GetValidationErrorMessage(result)
                 };
             }
         }
+
+        protected virtual string GetLocalizedErrorMessage(string errorMessage) {
+            return GetLocalizedString(errorMessage, Metadata.GetDisplayName());
+        }
+
+        private string GetValidationErrorMessage(ValidationResult result) {
+            string errorMsg;
+
+            if (UseStringLocalizerProvider) {
+                errorMsg = GetLocalizedErrorMessage(Attribute.ErrorMessage);
+
+                errorMsg = errorMsg ?? result.ErrorMessage;
+            }
+            else {
+                errorMsg = result.ErrorMessage;
+            }
+            return errorMsg;
+        }
+
+        private bool UseStringLocalizerProvider {
+            get {
+                // if developer already uses existing localization feature,
+                // then we don't opt in the new localization feature.
+                return (!string.IsNullOrEmpty(Attribute.ErrorMessage) &&
+                    string.IsNullOrEmpty(Attribute.ErrorMessageResourceName) &&
+                    Attribute.ErrorMessageResourceType == null);
+            }
+        }
     }
 }
index 11cce2416e25ce9d3bf4ed1d8f582d1041d00b34..ae952e12a8c6655aec5c817b336bbc3a2c8de951 100644 (file)
@@ -1,5 +1,5 @@
 ï»¿namespace System.Web.ModelBinding {
-    using System;
+using System;
 using System.Collections.Generic;
 using System.ComponentModel.DataAnnotations;
 using System.Diagnostics.CodeAnalysis;
@@ -7,6 +7,7 @@ using System.Globalization;
 using System.Linq;
 using System.Reflection;
 using System.Threading;
+using System.Web.Globalization;
 
     // A factory for validators based on ValidationAttribute
     public delegate ModelValidator DataAnnotationsModelValidationFactory(ModelMetadata metadata, ModelBindingExecutionContext context, ValidationAttribute attribute);
@@ -26,7 +27,7 @@ using System.Threading;
     public class DataAnnotationsModelValidatorProvider : AssociatedValidatorProvider {
         private static bool _addImplicitRequiredAttributeForValueTypes = true;
         private static ReaderWriterLockSlim _adaptersLock = new ReaderWriterLockSlim();
-
+        
         // Factories for validation attributes
 
         internal static DataAnnotationsModelValidationFactory DefaultAttributeFactory =
@@ -49,6 +50,14 @@ using System.Threading;
                 typeof(StringLengthAttribute),
                 (metadata, context, attribute) => new StringLengthAttributeAdapter(metadata, context, (StringLengthAttribute)attribute)
             },
+            {
+                typeof(MinLengthAttribute),
+                (metadata, context, attribute) => new MinLengthAttributeAdapter(metadata, context, (MinLengthAttribute)attribute)
+            },
+            {
+                typeof(MaxLengthAttribute),
+                (metadata, context, attribute) => new MaxLengthAttributeAdapter(metadata, context, (MaxLengthAttribute)attribute)
+            },
         };
 
         // Factories for IValidatableObject models
@@ -66,7 +75,7 @@ using System.Threading;
                 _addImplicitRequiredAttributeForValueTypes = value;
             }
         }
-
+        
         protected override IEnumerable<ModelValidator> GetValidators(ModelMetadata metadata, ModelBindingExecutionContext context, IEnumerable<Attribute> attributes) {
             _adaptersLock.EnterReadLock();
 
index 2c5acf046fca199103066f549d8285d231565ca9..28858643c11e2dbe144c3a5fbbb689b250c9e52e 100644 (file)
@@ -6,6 +6,11 @@
             : base(metadata, context, attribute) {
         }
 
+        protected override string GetLocalizedErrorMessage(string errorMessage) {
+            return GetLocalizedString(errorMessage, Metadata.GetDisplayName(), Attribute.Minimum, Attribute.Maximum);
+
+        }
+
 #if UNDEF
         public override IEnumerable<ModelClientValidationRule> GetClientValidationRules() {
             string errorMessage = ErrorMessage; // Per Dev10 Bug #923283, need to make sure ErrorMessage is called before Minimum/Maximum
index c5c0f0d527f4261668bc06a4a86c46faa6d5d72d..2a49853c2f6e98e5780a287b7aeb5f3216b1979d 100644 (file)
@@ -6,6 +6,10 @@
             : base(metadata, context, attribute) {
         }
 
+        protected override string GetLocalizedErrorMessage(string errorMessage) {
+            return GetLocalizedString(errorMessage, Metadata.GetDisplayName(), Attribute.Pattern);
+        }
+
 #if UNDEF
         public override IEnumerable<ModelClientValidationRule> GetClientValidationRules() {
             return new[] { new ModelClientValidationRegexRule(ErrorMessage, Attribute.Pattern) };
index 354cc3a86178ffecf4c4af0f91105e8cedcf5cd1..a27cba17dfbd3337e5085ba2c5038efd62acb7f0 100644 (file)
@@ -6,6 +6,10 @@
             : base(metadata, context, attribute) {
         }
 
+        protected override string GetLocalizedErrorMessage(string errorMessage) {            
+            return GetLocalizedString(errorMessage, Metadata.GetDisplayName(), Attribute.MinimumLength, Attribute.MaximumLength);
+        }
+
 #if UNDEF
         public override IEnumerable<ModelClientValidationRule> GetClientValidationRules() {
             return new[] { new ModelClientValidationStringLengthRule(ErrorMessage, Attribute.MinimumLength, Attribute.MaximumLength) };
index a4fcc08f63c7c19823cd6303411c347a549beba7..a4147901f2e09e42749cd950026377c1d086fd6d 100644 (file)
@@ -44,6 +44,7 @@ namespace System.Web.Security.Cryptography {
             return new DESCryptoServiceProvider();
         }
 
+        [SuppressMessage("Microsoft.Security.Cryptography", "CA5354:SHA1CannotBeUsed", Justification = @"This is only used by legacy code; new features do not use this algorithm.")]
         internal static HMACSHA1 CreateHMACSHA1() {
             return new HMACSHA1();
         }
index 2fba9c4592a836f6311ef1d1aec55dc96272e24b..a07c223408de8855bd2440783fe54eaf4ef3148f 100644 (file)
@@ -17,6 +17,7 @@ namespace System.Web.Security {
     using System.Security;
     using System.Security.Claims;
     using System.Security.Permissions;
+    using System.Security.Principal;
 
     /// <devdoc>
     ///    This class is an IIdentity derived class
@@ -77,7 +78,7 @@ namespace System.Web.Security {
         ///    Constructor.
         /// </devdoc>
         protected FormsIdentity(FormsIdentity identity)
-            : base(identity)
+            : base((IIdentity)identity)
         {
             _Ticket = identity._Ticket;
         }
index 2e9144cceb448469f4143d3a3b6822d4980f9518..84b3d55a8ae28436482c2b8b8ae69f352d2d7c1e 100644 (file)
@@ -27,6 +27,7 @@ namespace System.Web.SessionState {
     using System.Globalization;
     using System.Security.Permissions;
     using System.Text;
+    using System.Threading.Tasks;
     using System.Web.Hosting;
     using System.Web.Management;
     using Microsoft.Win32;
@@ -111,7 +112,7 @@ namespace System.Web.SessionState {
     /// <devdoc>
     ///    <para>[To be supplied.]</para>
     /// </devdoc>
-    public sealed class SessionStateModule : IHttpModule {
+    public sealed class SessionStateModule : ISessionStateModule {
 
         internal const string SQL_CONNECTION_STRING_DEFAULT = "data source=localhost;Integrated Security=SSPI";
         internal const string STATE_CONNECTION_STRING_DEFAULT = "tcpip=loopback:42424";
@@ -1446,15 +1447,19 @@ namespace System.Web.SessionState {
                 }
             }
         }
-
-        // DevDiv Bugs 151914: Release session state before executing child request
-        internal void EnsureReleaseState(HttpApplication app) {
+        
+        public void ReleaseSessionState(HttpContext context) {
             if (HttpRuntime.UseIntegratedPipeline && _acquireCalled && !_releaseCalled) {
                 try {
-                    OnReleaseState(app, null);
+                    OnReleaseState(context.ApplicationInstance, null);
                 }
                 catch { }
             }
         }
+
+        public Task ReleaseSessionStateAsync(HttpContext context) {
+            ReleaseSessionState(context);
+            return TaskAsyncHelper.CompletedTask;
+        }
     }
 }
index 8116fbc2711df3d1984ec20874f6c0ac70212a68..19c6d73938a27d0881b8adff81c2e614767dd234 100644 (file)
@@ -73,6 +73,24 @@ namespace System.Web.SessionState {
             return context.Application.SessionStaticObjects.Clone();
         }
 
+        /// <summary>
+        /// Gets a value that indicates whether session state is required by the context.
+        /// </summary>
+        /// <param name="context">The HttpContext.</param>
+        /// <returns>A value that indicates whether session state is required by the context.</returns>
+        static public bool IsSessionStateRequired(HttpContext context) {
+            return context.RequiresSessionState;
+        }
+
+        /// <summary>
+        /// Gets a value that indicates whether session state is read-only in the context.
+        /// </summary>
+        /// <param name="context">The HttpContext.</param>
+        /// <returns>A value that indicates whether session state is read-only in the context.</returns>
+        static public bool IsSessionStateReadOnly(HttpContext context) {
+            return context.ReadOnlySessionState;
+        }
+
         internal static SessionStateStoreData CreateLegitStoreData(HttpContext context,
                                                     ISessionStateItemCollection sessionItems,
                                                     HttpStaticObjectsCollection staticObjects,
index 2558f75a0d545dfad80fce98e9b99105855872d2..85e2bef8a0583a96356dc87ec53d58a7d3d1b1e9 100644 (file)
@@ -16,6 +16,8 @@ namespace System.Web {
 
     internal static class TaskAsyncHelper {
 
+        private static readonly Task s_completedTask = Task.FromResult<object>(null);
+
         internal static IAsyncResult BeginTask(Func<Task> taskFunc, AsyncCallback callback, object state) {
             Task task = taskFunc();
             if (task == null) {
@@ -76,5 +78,10 @@ namespace System.Web {
             taskWrapper.Task.GetAwaiter().GetResult();
         }
 
+        internal static Task CompletedTask {
+            get {
+                return s_completedTask;
+            }
+        }
     }
 }
index 9efc13a5871cd9d0a7844cdd59d980915ab4c2ed..e70f02a264dcbbb5444a0e8444bf669d9b864036 100644 (file)
@@ -6,27 +6,27 @@
 
 namespace System.Web.UI {
 
-using System;
-using System.IO;
-using System.Text;
-using System.Collections;
-using System.Collections.Specialized;
-using System.ComponentModel;
-using System.ComponentModel.Design;
-using System.Globalization;
-using System.Web;
-using System.Web.Util;
-using System.Web.UI.HtmlControls;
-using System.Web.UI.WebControls;
-using System.Web.Caching;
-using System.Web.Compilation;
-using System.Web.Configuration;
-using System.Security.Permissions;
-
-
-// Keeps track of one call to Page Register* API
-// The semantics of the fields depends to the call type
-[Serializable]
+    using System;
+    using System.IO;
+    using System.Text;
+    using System.Collections;
+    using System.Collections.Specialized;
+    using System.ComponentModel;
+    using System.ComponentModel.Design;
+    using System.Globalization;
+    using System.Web;
+    using System.Web.Util;
+    using System.Web.UI.HtmlControls;
+    using System.Web.UI.WebControls;
+    using System.Web.Caching;
+    using System.Web.Compilation;
+    using System.Web.Configuration;
+    using System.Security.Permissions;
+
+
+    // Keeps track of one call to Page Register* API
+    // The semantics of the fields depends to the call type
+    [Serializable]
 internal class RegisterCallData {
     internal ClientAPIRegisterType Type;
     internal ScriptKey Key;
@@ -406,8 +406,8 @@ public abstract class BasePartialCachingControl : Control {
         }
         else {
             string[] varyByParams = null;
-            if (_varyByParamsCollection != null)
-                varyByParams = _varyByParamsCollection.GetParams();
+                if (_varyByParamsCollection != null)
+                    varyByParams = _varyByParamsCollection.GetParams();
 
             cachedVary = new ControlCachedVary(varyByParams, _varyByControlsCollection, _varyByCustom);
 
@@ -576,7 +576,7 @@ public abstract class BasePartialCachingControl : Control {
 
         string[] varyByParamsStrings = varyByParams.Split(varySeparator);
         _varyByParamsCollection = new HttpCacheVaryByParams();
-        _varyByParamsCollection.ResetFromParams(varyByParamsStrings);
+        _varyByParamsCollection.SetParams(varyByParamsStrings);
     }
 
     internal void RegisterPostBackScript() {
index ce3d85949f0cc2263e3fdf9fe91230c5517ce1f5..ea3c1e08be941ae76a3f8402b8eb4989622edf97 100644 (file)
@@ -56,7 +56,7 @@ namespace System.Web.UI.WebControls {
 
         private ArrayList dateList;
         private SelectedDatesCollection selectedDates;
-        private Globalization.Calendar threadCalendar;
+        private System.Globalization.Calendar threadCalendar;
         private DateTime minSupportedDate;
         private DateTime maxSupportedDate;
 #if DEBUG
index ac1bbae574dd96e1fa57c4a0acd24a4e34554e32..3657d75cca437065bc28d7c3866d29963821406a 100644 (file)
@@ -32,7 +32,17 @@ namespace System.Web.UI.WebControls {
             }
 
             ParameterExpression parameter = Expression.Parameter(source.ElementType, String.Empty);
-            MemberExpression property = Expression.Property(parameter, sortExpression);
+            //VSO bug 173528-- Add support for sorting by nested property names
+            MemberExpression property = null;
+            string[] sortExpressionFields = sortExpression.Split('.');
+            foreach (string sortExpressionField in sortExpressionFields) {
+                if (property == null) {
+                    property = Expression.Property(parameter, sortExpressionField);
+                }
+                else {
+                    property = Expression.Property(property, sortExpressionField);
+                }
+            }
             LambdaExpression lambda = Expression.Lambda(property, parameter);
 
             string methodName = (isDescending) ? "OrderByDescending" : "OrderBy" ;
index bb97a7c282399745e85290c6c23145df6cbf5a9d..93ec3e60d03d5c6d29b648612006708d593b331c 100644 (file)
@@ -41,6 +41,7 @@ namespace System.Web.UI.WebControls {
 
 
         [SuppressMessage("Microsoft.Security", "MSEC1220:ReviewDtdProcessingAssignment", Justification = "Dtd processing is needed for back-compat, but is being done as safely as possible.")]
+        [SuppressMessage("Microsoft.Security.Xml", "CA3069:ReviewDtdProcessingAssignment", Justification = "Dtd processing is needed for back-compat, but is being done as safely as possible.")]
         public override void SetTagInnerText(string text) {
             if (!Util.IsWhiteSpaceString(text)) {
 
@@ -114,7 +115,9 @@ namespace System.Web.UI.WebControls {
 #pragma warning restore 0618
 
         [SuppressMessage("Microsoft.Security", "MSEC1201:DoNotUseXslTransform", Justification = "_identityTransform contents are trusted hard-coded string.")]
+        [SuppressMessage("Microsoft.Security.Xml", "CA3050:DoNotUseXslTransform", Justification = "_identityTransform contents are trusted hard-coded string.")]
         [SuppressMessage("Microsoft.Security", "MSEC1205:DoNotAllowDtdOnXmlTextReader", Justification = "_identityTransform contents are trusted hard-coded string.")]
+        [SuppressMessage("Microsoft.Security.Xml", "CA3054:DoNotAllowDtdOnXmlTextReader", Justification = "_identityTransform contents are trusted hard-coded string.")]
         [PermissionSet(SecurityAction.Assert, Unrestricted = true)]
         static Xml() {
 
@@ -332,6 +335,7 @@ namespace System.Web.UI.WebControls {
 
 
         [SuppressMessage("Microsoft.Security", "MSEC1218:ReviewWebControlForSet_DocumentContent", Justification = "Legacy code that trusts our developer input.  Optional safer codepath available via appSettings/aspnet:RestrictXmlControls configuration.")]
+        [SuppressMessage("Microsoft.Security.Xml", "CA3067:ReviewWebControlForSet_DocumentContent", Justification = "Legacy code that trusts our developer input.  Optional safer codepath available via appSettings/aspnet:RestrictXmlControls configuration.")]
         protected override void AddParsedSubObject(object obj) {
             if (obj is LiteralControl) {
                 // Trim the initial whitespaces since XML is very picky (related to ASURT 58100)
index 0e48e6d162cbf13fb62caa3298b96cc27d5c75af..f6c84a217757af719de2a160e6eb411d5a4adc14 100644 (file)
@@ -36,4 +36,33 @@ namespace System.Web.Util {
         }
 
     }
+
+    // This wrapper around a managed object is opaque to SizedReference GC handle
+    // and therefore helps with calculating size of only relevant graph of objects
+    internal class DisposableGCHandleRef<T> : IDisposable
+    where T : class, IDisposable {
+        GCHandle _handle;
+        [PermissionSet(SecurityAction.Assert, Unrestricted = true)]
+        public DisposableGCHandleRef(T t) {
+            Debug.Assert(t != null);
+            _handle = GCHandle.Alloc(t);
+        }
+
+        public T Target {
+            [PermissionSet(SecurityAction.Assert, Unrestricted = true)]
+            get {
+                Debug.Assert(_handle.IsAllocated);
+                return (T)_handle.Target;
+            }
+        }
+
+        [PermissionSet(SecurityAction.Assert, Unrestricted = true)]
+        public void Dispose() {
+            Target.Dispose();
+            Debug.Assert(_handle.IsAllocated);
+            if (_handle.IsAllocated) {
+                _handle.Free();
+            }
+        }
+    }
 }
index 545023b7a24b33f9762124c028e1ad33fcaf10d6..94ef87f0291332ce2216ad140596e200ba485631 100644 (file)
@@ -15,6 +15,7 @@ using System.Text;
 using System.Globalization;
 using System.Runtime.InteropServices;
 using System.Web.Hosting;
+using System.Diagnostics.CodeAnalysis;
 
 /*
  * Various string handling utilities
@@ -294,6 +295,7 @@ internal static class StringUtil {
     // Instead use the default AppDomain, because it doesn't have string hash randomization enabled.
     // Marshal the call to reuse the default StringComparer behavior. 
     // PERF isn't optimal, so apply consideration!
+    [SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "We carefully control the callers.")]
     internal static int GetNonRandomizedStringComparerHashCode(string s) {
         // Preserve the default behavior when string hash randomization is off
         if (!AppSettings.UseRandomizedStringHashAlgorithm) {
index d442f0cc89cad5250d70915b808f5a0f7e0ae1d7..64a86b68118339c8fe106aaf76eca8c62dff948c 100644 (file)
@@ -105,7 +105,7 @@ namespace System.Web.Util {
             // This method only schedules work; it doesn't itself do any work. The lock is held for a very
             // short period of time.
             lock (_lockObj) {
-                Task newTask = _lastScheduledTask.ContinueWith(_ => SafeWrapCallback(action));
+                Task newTask = _lastScheduledTask.ContinueWith(_ => SafeWrapCallback(action), TaskScheduler.Default);
                 _lastScheduledTask = newTask; // the newly-created task is now the last one
             }
         }
index eb237040da08bcee7d6385cdac2eef0d76fae682..a07e9df58d2232fc8e0b17e468ed5feef46127bd 100644 (file)
@@ -17,6 +17,7 @@ namespace System.Web.Util {
         public static readonly long MaxEntityExpansion = 1024 * 1024;
 
         [SuppressMessage("Microsoft.Security", "MSEC1208:DoNotUseLoadXml", Justification = "Handles developer-controlled input xml.  Optional safer codepath available via appSettings/aspnet:RestrictXmlControls configuration.")]
+        [SuppressMessage("Microsoft.Security.Xml", "CA3057:DoNotUseLoadXml", Justification = "Handles developer-controlled input xml.  Optional safer codepath available via appSettings/aspnet:RestrictXmlControls configuration.")]
         public static XmlDocument CreateXmlDocumentFromContent(string content)
         {
             XmlDocument doc = new XmlDocument();
@@ -35,6 +36,7 @@ namespace System.Web.Util {
         }
 
         [SuppressMessage("Microsoft.Security", "MSEC1210:UseXmlReaderForXPathDocument", Justification = "Handles developer-controlled input xml.  Optional safer codepath available via appSettings/aspnet:RestrictXmlControls configuration.")]
+        [SuppressMessage("Microsoft.Security.Xml", "CA3059:UseXmlReaderForXPathDocument", Justification = "Handles developer-controlled input xml.  Optional safer codepath available via appSettings/aspnet:RestrictXmlControls configuration.")]
         public static XPathDocument CreateXPathDocumentFromContent(string content)
         {
             StringReader reader = new StringReader(content);
@@ -47,6 +49,7 @@ namespace System.Web.Util {
         }
 
         [SuppressMessage("Microsoft.Security", "MSEC1220:ReviewDtdProcessingAssignment", Justification = "Dtd processing is needed for back-compat, but is being done as safely as possible.")]
+        [SuppressMessage("Microsoft.Security.Xml", "CA3069:ReviewDtdProcessingAssignment", Justification = "Dtd processing is needed for back-compat, but is being done as safely as possible.")]
         public static XmlReaderSettings CreateXmlReaderSettings()
         {
             XmlReaderSettings settings = new XmlReaderSettings();
@@ -68,7 +71,9 @@ namespace System.Web.Util {
         // try to guess at how to set matching defaults with XmlReader.Create().
         // (E.g. DtdProcessing is Parse by default using XmlTextReader directly.  It's Prohibit in default XmlReaderSettings.)
         [SuppressMessage("Microsoft.Security", "MSEC1205:DoNotAllowDtdOnXmlTextReader", Justification = "Handles trusted or developer-controlled input xml.  Optional safer codepath available via appSettings/aspnet:RestrictXmlControls configuration.")]
+        [SuppressMessage("Microsoft.Security.Xml", "CA3054:DoNotAllowDtdOnXmlTextReader", Justification = "Handles trusted or developer-controlled input xml.  Optional safer codepath available via appSettings/aspnet:RestrictXmlControls configuration.")]
         [SuppressMessage("Microsoft.Security", "MSEC1225:ReviewClassesDerivedFromXmlTextReader", Justification = "NoEntitiesXmlReader is our internal mechanism for using XmlTextReaders in a reasonably safe manner.")]
+        [SuppressMessage("Microsoft.Security.Xml", "CA3074:ReviewClassesDerivedFromXmlTextReader", Justification = "NoEntitiesXmlReader is our internal mechanism for using XmlTextReaders in a reasonably safe manner.")]
         public static XmlReader CreateXmlReader(string filepath)
         {
             if (AppSettings.RestrictXmlControls)
@@ -84,7 +89,9 @@ namespace System.Web.Util {
         }
 
         [SuppressMessage("Microsoft.Security", "MSEC1205:DoNotAllowDtdOnXmlTextReader", Justification = "Handles trusted or developer-controlled input xml.  Optional safer codepath available via appSettings/aspnet:RestrictXmlControls configuration.")]
+        [SuppressMessage("Microsoft.Security.Xml", "CA3054:DoNotAllowDtdOnXmlTextReader", Justification = "Handles trusted or developer-controlled input xml.  Optional safer codepath available via appSettings/aspnet:RestrictXmlControls configuration.")]
         [SuppressMessage("Microsoft.Security", "MSEC1225:ReviewClassesDerivedFromXmlTextReader", Justification = "NoEntitiesXmlReader is our internal mechanism for using XmlTextReaders in a reasonably safe manner.")]
+        [SuppressMessage("Microsoft.Security.Xml", "CA3074:ReviewClassesDerivedFromXmlTextReader", Justification = "NoEntitiesXmlReader is our internal mechanism for using XmlTextReaders in a reasonably safe manner.")]
         public static XmlReader CreateXmlReader(Stream datastream)
         {
             if (AppSettings.RestrictXmlControls)
@@ -100,7 +107,9 @@ namespace System.Web.Util {
         }
 
         [SuppressMessage("Microsoft.Security", "MSEC1205:DoNotAllowDtdOnXmlTextReader", Justification = "Handles trusted or developer-controlled input xml.  Optional safer codepath available via appSettings/aspnet:RestrictXmlControls configuration.")]
+        [SuppressMessage("Microsoft.Security.Xml", "CA3054:DoNotAllowDtdOnXmlTextReader", Justification = "Handles trusted or developer-controlled input xml.  Optional safer codepath available via appSettings/aspnet:RestrictXmlControls configuration.")]
         [SuppressMessage("Microsoft.Security", "MSEC1225:ReviewClassesDerivedFromXmlTextReader", Justification = "NoEntitiesXmlReader is our internal mechanism for using XmlTextReaders in a reasonably safe manner.")]
+        [SuppressMessage("Microsoft.Security.Xml", "CA3074:ReviewClassesDerivedFromXmlTextReader", Justification = "NoEntitiesXmlReader is our internal mechanism for using XmlTextReaders in a reasonably safe manner.")]
         public static XmlReader CreateXmlReader(TextReader reader)
         {
             if (AppSettings.RestrictXmlControls)
@@ -116,7 +125,9 @@ namespace System.Web.Util {
         }
 
         [SuppressMessage("Microsoft.Security", "MSEC1205:DoNotAllowDtdOnXmlTextReader", Justification = "Handles trusted or developer-controlled input xml.  Optional safer codepath available via appSettings/aspnet:RestrictXmlControls configuration.")]
+        [SuppressMessage("Microsoft.Security.Xml", "CA3054:DoNotAllowDtdOnXmlTextReader", Justification = "Handles trusted or developer-controlled input xml.  Optional safer codepath available via appSettings/aspnet:RestrictXmlControls configuration.")]
         [SuppressMessage("Microsoft.Security", "MSEC1225:ReviewClassesDerivedFromXmlTextReader", Justification = "NoEntitiesXmlReader is our internal mechanism for using XmlTextReaders in a reasonably safe manner.")]
+        [SuppressMessage("Microsoft.Security.Xml", "CA3074:ReviewClassesDerivedFromXmlTextReader", Justification = "NoEntitiesXmlReader is our internal mechanism for using XmlTextReaders in a reasonably safe manner.")]
         public static XmlReader CreateXmlReader(Stream contentStream, string baseURI)
         {
             if (AppSettings.RestrictXmlControls)
@@ -179,6 +190,7 @@ namespace System.Web.Util {
 
 #pragma warning disable 0618    // To avoid deprecation warning
         [SuppressMessage("Microsoft.Security", "MSEC1201:DoNotUseXslTransform", Justification = "Handles developer-controlled input xsl.  Optional safer codepath available via appSettings/aspnet:RestrictXmlControls configuration.")]
+        [SuppressMessage("Microsoft.Security.Xml", "CA3050:DoNotUseXslTransform", Justification = "Handles developer-controlled input xsl.  Optional safer codepath available via appSettings/aspnet:RestrictXmlControls configuration.")]
         public static XslTransform CreateXslTransform(XmlReader reader)
         {
             if (!AppSettings.RestrictXmlControls)
@@ -191,6 +203,7 @@ namespace System.Web.Util {
         }
 
         [SuppressMessage("Microsoft.Security", "MSEC1201:DoNotUseXslTransform", Justification = "Handles developer-controlled input xsl.  Optional safer codepath available via appSettings/aspnet:RestrictXmlControls configuration.")]
+        [SuppressMessage("Microsoft.Security.Xml", "CA3050:DoNotUseXslTransform", Justification = "Handles developer-controlled input xsl.  Optional safer codepath available via appSettings/aspnet:RestrictXmlControls configuration.")]
         public static XslTransform CreateXslTransform(XmlReader reader, XmlResolver resolver)
         {
             if (!AppSettings.RestrictXmlControls)
index 736c8f48b886d5d6e9cb125268afa88af89d92da..917aeea915482a17b759b5333a3824c2f7f41409 100644 (file)
@@ -232,6 +232,7 @@ namespace System.Web {
 
 
         [SuppressMessage("Microsoft.Security", "MSEC1205:DoNotAllowDtdOnXmlTextReader", Justification = "Legacy code that trusts our developer-controlled input.")]
+        [SuppressMessage("Microsoft.Security.Xml", "CA3054:DoNotAllowDtdOnXmlTextReader", Justification = "Legacy code that trusts our developer-controlled input.")]
         public override SiteMapNode BuildSiteMap() {
 
             SiteMapNode tempNode = _siteMapNode;
index 5290f57da13591fc7bd51184f48d1e4b2406f361..d1a7668ea7a86cd764262cf9302f5ad6edb0ab7f 100644 (file)
@@ -6,6 +6,7 @@ namespace System.Workflow.ComponentModel.Compiler
     using System.Diagnostics;
     using System.Globalization;
     using System.IO;
+    using System.Xml;
     using System.Text;
     using System.Collections;
     using System.Collections.Specialized;
@@ -1142,7 +1143,7 @@ namespace System.Workflow.ComponentModel.Compiler
                 string name = null;
                 try
                 {
-                    Xml.XmlTextReader reader = new Xml.XmlTextReader(binaryStream);
+                    Xml.XmlTextReader reader = new Xml.XmlTextReader(binaryStream) { DtdProcessing = DtdProcessing.Prohibit };
                     if (reader.MoveToContent() == System.Xml.XmlNodeType.Element)
                     {
                         if (reader.MoveToAttribute("Class", StandardXomlKeys.Definitions_XmlNs))
index 1e658c689b29a22ad02e6e855c46fd046d5e1be4..5488a93ae69fe2b1850e2d8755d8d745fb54b29b 100644 (file)
@@ -193,7 +193,7 @@ namespace System.Workflow.ComponentModel.Design
             {
                 ArrayList objects = new ArrayList();
                 WorkflowMarkupSerializationManager xomlSerializationManager = new WorkflowMarkupSerializationManager(serializationManager);
-                XmlTextReader reader = new XmlTextReader(this.serializedXmlString, XmlNodeType.Element, null);
+                XmlTextReader reader = new XmlTextReader(this.serializedXmlString, XmlNodeType.Element, null) { DtdProcessing = DtdProcessing.Prohibit };
                 reader.MoveToElement();
                 do
                 {
@@ -235,7 +235,7 @@ namespace System.Workflow.ComponentModel.Design
                 xomlSerializationManager.AddSerializationProvider(propertySegmentSerializationProvider);
 
                 StringReader stringReader = new StringReader(this.serializedXmlString);
-                using (XmlTextReader reader = new XmlTextReader(stringReader))
+                using (XmlTextReader reader = new XmlTextReader(stringReader) { DtdProcessing = DtdProcessing.Prohibit })
                 {
                     while (reader.NodeType != XmlNodeType.Element && reader.NodeType != XmlNodeType.ProcessingInstruction && reader.Read());
 
index 55ef70d7197d8114bb5fbe2302e3111cd2df6464..df277deaef34d2fbc8fd6fe1587ab29f7774a4cb 100644 (file)
@@ -1837,18 +1837,25 @@ namespace System.Workflow.Runtime
             return HashServiceType(serviceType.AssemblyQualifiedName);
         }
 
-        [SuppressMessage("Microsoft.Cryptographic.Standard", "CA5350:MD5CannotBeUsed", 
+        [SuppressMessage("Microsoft.Cryptographic.Standard", "CA5350:MD5CannotBeUsed",
             Justification = "Design has been approved.  We are not using MD5 for any security or cryptography purposes but rather as a hash.")]
         internal static Guid HashServiceType(String serviceFullTypeName)
         {
-            MD5 md5 = new MD5CryptoServiceProvider();
             byte[] data;
             byte[] result;
 
             UnicodeEncoding ue = new UnicodeEncoding();
             data = ue.GetBytes(serviceFullTypeName);
 
-            result = md5.ComputeHash(data);
+            if (AppSettings.FIPSRequired)
+            {
+                result = MD5PInvokeHelper.CalculateHash(data);
+            }
+            else
+            {
+                MD5 md5 = new MD5CryptoServiceProvider();
+                result = md5.ComputeHash(data);
+            }
 
             return new Guid(result);
         }
index 79d95e3450b14547b2f1d1a79b5bdbe1a71d2a0f..7c6905f92bbce017e21c74bbdc6664118f5693f1 100644 (file)
@@ -28,7 +28,8 @@ namespace System.Workflow.Runtime.Tracking
     {
         public TrackingProfileSerializer()
         {
-            _schema = XmlSchema.Read(new StringReader(_xsd), null);
+            StringReader reader = new StringReader(_xsd);
+            _schema = XmlSchema.Read(new XmlTextReader(reader) { DtdProcessing = DtdProcessing.Prohibit }, null);
             _schema.Namespaces.Add("", _ns);
         }
 
index 718b7556e48f40a775c6e3efa9722ea81f881a68..1697c085654825b91248d04540723b934d416b38 100644 (file)
@@ -129,6 +129,17 @@ namespace System.Workflow.Runtime
             // listen to activity definition resolve events
             Activity.ActivityResolve += OnActivityDefinitionResolve;
             Activity.WorkflowChangeActionsResolve += OnWorkflowChangeActionsResolve;
+            
+            try
+            {
+                using (TelemetryEventSource eventSource = new TelemetryEventSource())
+                {
+                    eventSource.V1Runtime();
+                }
+            }
+            catch
+            {
+            }
         }
 
         public WorkflowRuntime()
index 8a130a0f34285449d7dc69480eff98e832bf3edd..9224bf8b8fbac5bb40399ab2c13c752e3f0fd57f 100644 (file)
@@ -3,6 +3,15 @@
 //   Copyright (c) Microsoft Corporation.  All rights reserved.
 // 
 // ==--==
+
+// There are cases where we have multiple assemblies that are going to import this file and 
+// if they are going to also have InternalsVisibleTo between them, there will be a compiler warning
+// that the type is found both in the source and in a referenced assembly. The compiler will prefer 
+// the version of the type defined in the source
+//
+// In order to disable the warning for this type we are disabling this warning for this entire file.
+#pragma warning disable 436
+
 using System;
 using System.Collections.Generic;
 
@@ -167,3 +176,5 @@ namespace System
         static partial void PopulateDefaultValuesPartial(string platformIdentifier, string profile, int version);
     }
 }
+
+#pragma warning restore 436
index f05b599ed3d2b9af36cb7cd29c3c39123370cf6e..33662b54280621d4ef98247f98badecf87773fda 100644 (file)
@@ -4,6 +4,14 @@
 // 
 // ==--==
 
+// There are cases where we have multiple assemblies that are going to import this file and 
+// if they are going to also have InternalsVisibleTo between them, there will be a compiler warning
+// that the type is found both in the source and in a referenced assembly. The compiler will prefer 
+// the version of the type defined in the source
+//
+// In order to disable the warning for this type we are disabling this warning for this entire file.
+#pragma warning disable 436
+
 // NOTE: This file should not be included in mscorlib. This should only be included in FX libraries that need to provide switches
 using System;
 using System.Collections.Generic;
@@ -126,3 +134,5 @@ namespace System
         }
     }
 }
+
+#pragma warning restore 436
index 01ac463e479cb2a8d780ec4a89ef94ccbc7f56bb..ac29b893843139e92f86a303c7a7a25643d0afd0 100644 (file)
@@ -28,6 +28,10 @@ namespace System
                             LocalAppContext.DefineSwitchDefault("Switch.System.Xml.DontThrowOnInvalidSurrogatePairs", true);
                             LocalAppContext.DefineSwitchDefault("Switch.System.Xml.IgnoreEmptyKeySequences", true);
                         }
+                        if (version <= 40601)
+                        {
+                            LocalAppContext.DefineSwitchDefault("Switch.System.Xml.IgnoreKindInUtcTimeSerialization", true);
+                        }
                         break;
                     }
                 case "WindowsPhone":
@@ -37,6 +41,7 @@ namespace System
                         {
                             LocalAppContext.DefineSwitchDefault("Switch.System.Xml.DontThrowOnInvalidSurrogatePairs", true);
                             LocalAppContext.DefineSwitchDefault("Switch.System.Xml.IgnoreEmptyKeySequences", true);
+                            LocalAppContext.DefineSwitchDefault("Switch.System.Xml.IgnoreKindInUtcTimeSerialization", true);
                         }
                         break;
                     }
index c744ba1c0dc1f31417a41c6aebe939a34d2da659..ddc3323413220a8f8c2a943b689a7dab9e3748ca 100644 (file)
@@ -29,5 +29,15 @@ namespace System
                 return LocalAppContext.GetCachedSwitchValue(@"Switch.System.Xml.IgnoreEmptyKeySequences", ref _ignoreEmptyKeySequences);
             }
         }
+
+        private static int _ignoreKindInUtcTimeSerialization;
+        public static bool IgnoreKindInUtcTimeSerialization
+        {
+            [MethodImpl(MethodImplOptions.AggressiveInlining)]
+            get
+            {
+                return LocalAppContext.GetCachedSwitchValue(@"Switch.System.Xml.IgnoreKindInUtcTimeSerialization", ref _ignoreKindInUtcTimeSerialization);
+            }
+        }
     }
 }
index d186daa2aa52a0656ad5fb8b057411c9b4fcf9df..980381559486698efe6f8851a4d2fc5f222a2160 100644 (file)
@@ -77,7 +77,14 @@ namespace System.Xml.Serialization {
         }
 
         internal static string FromTime(DateTime value) {
-            return XmlConvert.ToString(DateTime.MinValue + value.TimeOfDay, "HH:mm:ss.fffffffzzzzzz");
+            if (!LocalAppContextSwitches.IgnoreKindInUtcTimeSerialization && value.Kind == DateTimeKind.Utc)
+            {
+                return XmlConvert.ToString(DateTime.MinValue + value.TimeOfDay, "HH:mm:ss.fffffffZ");
+            }
+            else
+            {
+                return XmlConvert.ToString(DateTime.MinValue + value.TimeOfDay, "HH:mm:ss.fffffffzzzzzz");
+            }
         }
 
         internal static string FromDateTime(DateTime value) {
@@ -337,7 +344,14 @@ namespace System.Xml.Serialization {
         }
 
         internal static DateTime ToTime(string value) {
-            return DateTime.ParseExact(value, allTimeFormats, DateTimeFormatInfo.InvariantInfo, DateTimeStyles.AllowLeadingWhite|DateTimeStyles.AllowTrailingWhite|DateTimeStyles.NoCurrentDateDefault);
+            if (!LocalAppContextSwitches.IgnoreKindInUtcTimeSerialization)
+            {
+                return DateTime.ParseExact(value, allTimeFormats, DateTimeFormatInfo.InvariantInfo, DateTimeStyles.AllowLeadingWhite | DateTimeStyles.AllowTrailingWhite | DateTimeStyles.NoCurrentDateDefault | DateTimeStyles.RoundtripKind);
+            }
+            else
+            {
+                return DateTime.ParseExact(value, allTimeFormats, DateTimeFormatInfo.InvariantInfo, DateTimeStyles.AllowLeadingWhite | DateTimeStyles.AllowTrailingWhite | DateTimeStyles.NoCurrentDateDefault);
+            }
         }
 
         internal static char ToChar(string value) {
index 8a130a0f34285449d7dc69480eff98e832bf3edd..9224bf8b8fbac5bb40399ab2c13c752e3f0fd57f 100644 (file)
@@ -3,6 +3,15 @@
 //   Copyright (c) Microsoft Corporation.  All rights reserved.
 // 
 // ==--==
+
+// There are cases where we have multiple assemblies that are going to import this file and 
+// if they are going to also have InternalsVisibleTo between them, there will be a compiler warning
+// that the type is found both in the source and in a referenced assembly. The compiler will prefer 
+// the version of the type defined in the source
+//
+// In order to disable the warning for this type we are disabling this warning for this entire file.
+#pragma warning disable 436
+
 using System;
 using System.Collections.Generic;
 
@@ -167,3 +176,5 @@ namespace System
         static partial void PopulateDefaultValuesPartial(string platformIdentifier, string profile, int version);
     }
 }
+
+#pragma warning restore 436
index f05b599ed3d2b9af36cb7cd29c3c39123370cf6e..33662b54280621d4ef98247f98badecf87773fda 100644 (file)
@@ -4,6 +4,14 @@
 // 
 // ==--==
 
+// There are cases where we have multiple assemblies that are going to import this file and 
+// if they are going to also have InternalsVisibleTo between them, there will be a compiler warning
+// that the type is found both in the source and in a referenced assembly. The compiler will prefer 
+// the version of the type defined in the source
+//
+// In order to disable the warning for this type we are disabling this warning for this entire file.
+#pragma warning disable 436
+
 // NOTE: This file should not be included in mscorlib. This should only be included in FX libraries that need to provide switches
 using System;
 using System.Collections.Generic;
@@ -126,3 +134,5 @@ namespace System
         }
     }
 }
+
+#pragma warning restore 436
index 872cfa80dd5d3d986d8e5dd89489efb871911649..19ec1053a3a4c9a03682b6d26755c976721b7b3a 100644 (file)
@@ -155,7 +155,14 @@ namespace System
             if (PinnableBufferCacheEventSource.Log.IsEnabled())
                 PinnableBufferCacheEventSource.Log.FreeBuffer(m_CacheName, PinnableBufferCacheEventSource.AddressOf(buffer), buffer.GetHashCode(), m_FreeList.Count);
 
-
+            if(buffer == null)
+            {
+                if (PinnableBufferCacheEventSource.Log.IsEnabled())
+                    PinnableBufferCacheEventSource.Log.FreeBufferNull(m_CacheName, m_FreeList.Count);
+                    
+                return;
+            }
+            
             // After we've done 3 gen1 GCs, assume that all buffers have aged into gen2 on the free path.
             if ((m_gen1CountAtLastRestock + 3) > GC.CollectionCount(GC.MaxGeneration - 1))
             {
@@ -567,6 +574,7 @@ namespace System
         public void AllocateBufferAged(string cacheName, int agedCount) {}
         public void AllocateBufferFreeListEmpty(string cacheName, int notGen2CountBefore) {}
         public void FreeBuffer(string cacheName, ulong objectId, int objectHash, int freeCountBefore) {}
+        public void FreeBufferNull(string cacheName, int freeCountBefore) { }
         public void FreeBufferStillTooYoung(string cacheName, int notGen2CountBefore) {}
         public void TrimCheck(string cacheName, int totalBuffs, bool neededMoreThanFreeList, int deltaMSec) {}
         public void TrimFree(string cacheName, int totalBuffs, int freeListCount, int toBeFreed) {}
@@ -643,6 +651,8 @@ namespace System
         public void AgePendingBuffersResults(string cacheName, int promotedToFreeListCount, int heldBackCount) { if (IsEnabled()) WriteEvent(20, cacheName, promotedToFreeListCount, heldBackCount); }
         [Event(21)]
         public void WalkFreeListResult(string cacheName, int freeListCount, int gen0BuffersInFreeList) { if (IsEnabled()) WriteEvent(21, cacheName, freeListCount, gen0BuffersInFreeList); }
+        [Event(22)]
+        public void FreeBufferNull(string cacheName, int freeCountBefore) { if(IsEnabled()) WriteEvent(22, cacheName, freeCountBefore); }
 
 
         static internal ulong AddressOf(object obj)
index a1911293b0db1bc618a3f1e3d217f596c0b4b460..958740229703bc00a6c319db8a9f28f40eb88a0f 100644 (file)
@@ -169,6 +169,23 @@ namespace Microsoft.Win32 {
         [ResourceExposure(ResourceScope.None)]
         public static extern bool WTSUnRegisterSessionNotification(HandleRef hWnd);
 
+        private static IntPtr GetCurrentProcessToken() { return new IntPtr(-4); }
+
+        private const int ERROR_SUCCESS = 0;
+
+        enum AppPolicyClrCompat
+        {
+            AppPolicyClrCompat_Others = 0,
+            AppPolicyClrCompat_ClassicDesktop = 1,
+            AppPolicyClrCompat_Universal = 2,
+            AppPolicyClrCompat_PackagedDesktop = 3
+        };
+
+        [DllImport(ExternDll.Kernel32, CharSet = CharSet.None, EntryPoint = "AppPolicyGetClrCompat")]
+        [System.Security.SecuritySafeCritical]
+        [return: MarshalAs(UnmanagedType.I4)]
+        private static extern Int32 _AppPolicyGetClrCompat(IntPtr processToken, out AppPolicyClrCompat appPolicyClrCompat);
+
         private const int ERROR_INSUFFICIENT_BUFFER = 0x007A;
         private const int ERROR_NO_PACKAGE_IDENTITY = 0x3d54;
 
@@ -204,8 +221,20 @@ namespace Microsoft.Win32 {
         [System.Security.SecuritySafeCritical]
         private static bool _IsPackagedProcess()
         {
+            Version windows8Version = new Version(6, 2, 0, 0);
             OperatingSystem os = Environment.OSVersion;
-            if(os.Platform == PlatformID.Win32NT && os.Version >= new Version(6,2,0,0) && DoesWin32MethodExist(ExternDll.Kernel32, "GetCurrentPackageId"))
+            bool osSupportsPackagedProcesses = os.Platform == PlatformID.Win32NT && os.Version >= windows8Version;
+
+            if (osSupportsPackagedProcesses && DoesWin32MethodExist(ExternDll.Kernel32, "AppPolicyGetClrCompat"))
+            {
+                // Use AppPolicyGetClrCompat if it is available. Return true if and only if this is a UWA which means if
+                // this is packaged desktop app this method will return false. This may cause some confusion however 
+                // this is necessary to make the behavior of packaged desktop apps identical to desktop apps.
+                AppPolicyClrCompat appPolicyClrCompat;
+                return _AppPolicyGetClrCompat(GetCurrentProcessToken(), out appPolicyClrCompat) == ERROR_SUCCESS && 
+                    appPolicyClrCompat == AppPolicyClrCompat.AppPolicyClrCompat_Universal;
+            }
+            else if(osSupportsPackagedProcesses && DoesWin32MethodExist(ExternDll.Kernel32, "GetCurrentPackageId"))
             {
                 Int32 bufLen = 0;
                 // Will return ERROR_INSUFFICIENT_BUFFER when running within a packaged application,
index c16486800a9248e135348c383cee4b20655cc1b4..ebc36a83d4d51ea6f21f6e785cd82773651c8b30 100644 (file)
@@ -326,9 +326,19 @@ namespace System.ComponentModel {
                 return false;
             }
 
-            if ((mdObj.description == null) != (description == null) ||
-                (description != null && !mdObj.category.Equals(description))) {
-                return false;
+            // VSO 149471 - Technically fixing this could cause a behavior change, so we are
+            // adding a quirk in case anyone is bit by this and needs the old, buggy behavior.
+            if (!LocalAppContextSwitches.MemberDescriptorEqualsReturnsFalseIfEquivalent) {
+                if ((mdObj.description == null) != (description == null) ||
+                    (description != null && !mdObj.description.Equals(description))) {
+                    return false;
+                }
+            }
+            else {
+                if ((mdObj.description == null) != (description == null) ||
+                    (description != null && !mdObj.category.Equals(description))) {
+                    return false;
+                }
             }
 
             if ((mdObj.attributes == null) != (attributes == null)) {
index 320e1d69ff4308f8f34d1d71128d78b0226531ea..a789a6ea2be1399a712e3246532eeae7d7ff0e65 100644 (file)
@@ -300,6 +300,9 @@ namespace System.Net {
             }
         }
 
+        // Note: RequestBuffer may get moved in memory. If you dereference a pointer from inside the RequestBuffer, 
+        // you must use 'OriginalBlobAddress' below to adjust the location of the pointer to match the location of
+        // RequestBuffer.
         internal byte[] RequestBuffer
         {
             get
@@ -1061,7 +1064,7 @@ namespace System.Net {
 
             m_TokenBindings = new List<TokenBinding>();
 
-            UnsafeNclNativeMethods.HttpApi.HTTP_REQUEST_TOKEN_BINDING_INFO* pTokenBindingInfo = GetTlsTokenBindingRequestInfo();
+            UnsafeNclNativeMethods.HttpApi.HTTP_REQUEST_TOKEN_BINDING_INFO* pTokenBindingInfo = UnsafeNclNativeMethods.HttpApi.GetTlsTokenBindingRequestInfo(RequestBuffer, OriginalBlobAddress);
 
             if (pTokenBindingInfo == null)
             {
@@ -1116,23 +1119,6 @@ namespace System.Net {
             }
         }
 
-        private UnsafeNclNativeMethods.HttpApi.HTTP_REQUEST_TOKEN_BINDING_INFO* GetTlsTokenBindingRequestInfo() {
-            fixed (byte* pMemoryBlob = RequestBuffer)
-            {
-                UnsafeNclNativeMethods.HttpApi.HTTP_REQUEST_V2* request = (UnsafeNclNativeMethods.HttpApi.HTTP_REQUEST_V2*)pMemoryBlob;
-
-                for (int i = 0; i < request->RequestInfoCount; i++)
-                {
-                    UnsafeNclNativeMethods.HttpApi.HTTP_REQUEST_INFO* pThisInfo = &request->pRequestInfo[i];
-                    if (pThisInfo != null && pThisInfo->InfoType == UnsafeNclNativeMethods.HttpApi.HTTP_REQUEST_INFO_TYPE.HttpRequestInfoTypeSslTokenBinding)
-                    {
-                        return (UnsafeNclNativeMethods.HttpApi.HTTP_REQUEST_TOKEN_BINDING_INFO*)pThisInfo->pInfo;
-                    }
-                }
-            }
-            return null;
-        }
-
         internal void CheckDisposed() {
             if (m_IsDisposed) {
                 throw new ObjectDisposedException(this.GetType().FullName);
index d04932e503f93d4c7f85e75d50d3d4f9e90c20b7..05732c28d3646eba263c003145863812cd75f45d 100644 (file)
@@ -1406,6 +1406,7 @@ typedef struct _SCHANNEL_CRED
             ValidateManual  = 0x08,
             NoDefaultCred   = 0x10,
             ValidateAuto    = 0x20,
+            SendAuxRecord   = 0x00200000,
             UseStrongCrypto = 0x00400000,
         }
 
index 01776e420decae36178b835e2d0e9a83bc95adb8..b5488d4a2992ed3043c70817ed1dcb28f1ea0673 100644 (file)
@@ -592,9 +592,17 @@ namespace System.Net.Security {
                         KeyExchangeStrength));
                 }
             }
+            catch (Exception)
+            {
+                // If an exception emerges synchronously, the asynchronous operation was not
+                // initiated, so no operation is in progress.
+                _NestedAuth = 0;
+                
+                throw;
+            }
             finally
             {
-                if (lazyResult == null || _Exception != null)
+                if (lazyResult == null)
                 {
                     _NestedAuth = 0;
                 }
index 48bb45802f08f94ea2fef8a6beeb4683a85450e6..3de63c914d6398d3bf378050c4e94d43972700c9 100644 (file)
@@ -247,12 +247,15 @@ namespace System.Net {
         private static volatile CertPolicyValidationCallback s_CertPolicyValidationCallback = new CertPolicyValidationCallback();
         private static volatile ServerCertValidationCallback s_ServerCertValidationCallback = null;
 
+        private const string sendAuxRecordValueName = "SchSendAuxRecord";
+        private const string sendAuxRecordAppSetting = "System.Net.ServicePointManager.SchSendAuxRecord";
         private const string strongCryptoValueName = "SchUseStrongCrypto";
         private const string secureProtocolAppSetting = "System.Net.ServicePointManager.SecurityProtocol";
 
-        private static object disableStrongCryptoLock = new object();
-        private static volatile bool disableStrongCryptoInitialized = false;
+        private static object configurationLoadedLock = new object();
+        private static volatile bool configurationLoaded = false;
         private static bool disableStrongCrypto = false;
+        private static bool disableSendAuxRecord = false;
 
         private static SecurityProtocolType s_SecurityProtocolType = SecurityProtocolType.Tls | SecurityProtocolType.Ssl3;
 
@@ -427,11 +430,11 @@ namespace System.Net {
         [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "Reviewed for thread-safety")]
         public static SecurityProtocolType SecurityProtocol {
             get {
-                EnsureStrongCryptoSettingsInitialized();
+                EnsureConfigurationLoaded();
                 return s_SecurityProtocolType;
             }
             set {
-                EnsureStrongCryptoSettingsInitialized();
+                EnsureConfigurationLoaded();
                 ValidateSecurityProtocol(value);
                 s_SecurityProtocolType = value;
             }
@@ -640,77 +643,118 @@ namespace System.Net {
 
         internal static bool DisableStrongCrypto {
             get {
-                EnsureStrongCryptoSettingsInitialized();
-                return (bool)disableStrongCrypto; 
+                EnsureConfigurationLoaded();
+                return disableStrongCrypto; 
             }
         }
 
-        private static void EnsureStrongCryptoSettingsInitialized() {
-            
-            if (disableStrongCryptoInitialized) {
+        internal static bool DisableSendAuxRecord {
+            get {
+                EnsureConfigurationLoaded();
+                return disableSendAuxRecord;
+            }
+        }
+
+        private static void EnsureConfigurationLoaded() {
+            if (configurationLoaded) {
                 return;
             }
 
-            lock (disableStrongCryptoLock) {
-                if (disableStrongCryptoInitialized) {
+            lock (configurationLoadedLock) {
+                if (configurationLoaded) {
                     return;
                 }
 
-                try {
-                    bool disableStrongCryptoInternal = false;
-                    int schUseStrongCryptoKeyValue = 0;
+                LoadDisableStrongCryptoConfiguration();
+                LoadDisableSendAuxRecordConfiguration();
 
-                    if (LocalAppContextSwitches.DontEnableSchUseStrongCrypto)
-                    {
-                        //.Net 4.5.2 and below will default to false unless the registry key is specifically set to 1.
-                        schUseStrongCryptoKeyValue =
-                            RegistryConfiguration.GlobalConfigReadInt(strongCryptoValueName, 0);
+                configurationLoaded = true;
+            }
+        }
 
-                        disableStrongCryptoInternal = schUseStrongCryptoKeyValue != 1;
-                    }
-                    else
-                    {
-                        // .Net 4.6 and above will default to true unless the registry key is specifically set to 0.
-                        schUseStrongCryptoKeyValue = 
-                            RegistryConfiguration.GlobalConfigReadInt(strongCryptoValueName, 1);
+        private static void LoadDisableStrongCryptoConfiguration() {
+            try {
+                bool disableStrongCryptoInternal = false;
+                int schUseStrongCryptoKeyValue = 0;
 
-                        disableStrongCryptoInternal = schUseStrongCryptoKeyValue == 0;
-                    }
-                    
-                    if (disableStrongCryptoInternal) {
-                        // Revert the SecurityProtocol selection to the legacy combination.
-                        s_SecurityProtocolType = SecurityProtocolType.Tls | SecurityProtocolType.Ssl3;
-                    }
-                    else {
-                        s_SecurityProtocolType =
-                            SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
+                if (LocalAppContextSwitches.DontEnableSchUseStrongCrypto) {
+                    //.Net 4.5.2 and below will default to false unless the registry key is specifically set to 1.
+                    schUseStrongCryptoKeyValue =
+                        RegistryConfiguration.GlobalConfigReadInt(strongCryptoValueName, 0);
 
-                        string appSetting = RegistryConfiguration.AppConfigReadString(secureProtocolAppSetting, null);
+                    disableStrongCryptoInternal = schUseStrongCryptoKeyValue != 1;
+                }
+                else {
+                    // .Net 4.6 and above will default to true unless the registry key is specifically set to 0.
+                    schUseStrongCryptoKeyValue =
+                        RegistryConfiguration.GlobalConfigReadInt(strongCryptoValueName, 1);
 
-                        SecurityProtocolType value;
-                        try {
-                            value = (SecurityProtocolType)Enum.Parse(typeof(SecurityProtocolType), appSetting);
-                            ValidateSecurityProtocol(value);
-                            s_SecurityProtocolType = value;
-                        }
-                        // Ignore all potential exceptions caused by Enum.Parse.
-                        catch (ArgumentNullException) { }
-                        catch (ArgumentException) { }
-                        catch (NotSupportedException) { }
-                        catch (OverflowException) { }
-                    }
+                    disableStrongCryptoInternal = schUseStrongCryptoKeyValue == 0;
+                }
 
-                    disableStrongCrypto = disableStrongCryptoInternal;
-                    disableStrongCryptoInitialized = true;
+                if (disableStrongCryptoInternal) {
+                    // Revert the SecurityProtocol selection to the legacy combination.
+                    s_SecurityProtocolType = SecurityProtocolType.Tls | SecurityProtocolType.Ssl3;
                 }
-                catch (Exception e) {
-                    if (e is ThreadAbortException || e is StackOverflowException || e is OutOfMemoryException) {
-                        throw;
+                else {
+                    s_SecurityProtocolType =
+                        SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
+
+                    string appSetting = RegistryConfiguration.AppConfigReadString(secureProtocolAppSetting, null);
+
+                    SecurityProtocolType value;
+                    try {
+                        value = (SecurityProtocolType)Enum.Parse(typeof(SecurityProtocolType), appSetting);
+                        ValidateSecurityProtocol(value);
+                        s_SecurityProtocolType = value;
                     }
+                    // Ignore all potential exceptions caused by Enum.Parse.
+                    catch (ArgumentNullException) { }
+                    catch (ArgumentException) { }
+                    catch (NotSupportedException) { }
+                    catch (OverflowException) { }
+                }
+
+                disableStrongCrypto = disableStrongCryptoInternal;
+            }
+            catch (Exception e)
+            {
+                if (e is ThreadAbortException || e is StackOverflowException || e is OutOfMemoryException)
+                {
+                    throw;
                 }
             }
         }
-        
+
+        private static void LoadDisableSendAuxRecordConfiguration() {
+            try { 
+                if (LocalAppContextSwitches.DontEnableSchSendAuxRecord) {
+                    disableSendAuxRecord = true;
+                    return;
+                }
+
+                int schSendAuxRecordKeyValue = 1;
+                schSendAuxRecordKeyValue = RegistryConfiguration.AppConfigReadInt(sendAuxRecordAppSetting, 1);
+                if (schSendAuxRecordKeyValue == 0) {
+                    disableSendAuxRecord = true;
+                    return;
+                }
+            
+                schSendAuxRecordKeyValue = RegistryConfiguration.GlobalConfigReadInt(sendAuxRecordValueName, 1);
+                if (schSendAuxRecordKeyValue == 0) {
+                    disableSendAuxRecord = true;
+                    return;
+                }
+            }
+            catch (Exception e)
+            {
+                if (e is ThreadAbortException || e is StackOverflowException || e is OutOfMemoryException)
+                {
+                    throw;
+                }
+            }
+        }
+
         public static bool ReusePort {
             get {
                 EnsureReusePortSettingsInitialized();
index 7cf970ed013f48125de2c07a4a866a49c4cbd648..680ea9813968ee030704b14352a20cc2eaaede54 100644 (file)
@@ -1482,7 +1482,7 @@ namespace System.Net {
                                                 [Out] out int bytesTransferred,
                                                 [In]  SafeHandle overlapped,
                                                 [In]  IntPtr completionRoutine
-                                                );                     
+                                                );                 
 
             [DllImport(WS2_32,SetLastError=true)]
             internal static extern SocketError WSAEnumNetworkEvents(
@@ -3147,6 +3147,25 @@ namespace System.Net {
                 GlobalLog.Leave("HttpApi::GetLocalEndPoint()");
                 return endpoint;
             }
+            
+            internal static HTTP_REQUEST_TOKEN_BINDING_INFO* GetTlsTokenBindingRequestInfo(byte[] memoryBlob, IntPtr originalAddress){
+                
+                fixed (byte* pMemoryBlob = memoryBlob)
+                {
+                    HTTP_REQUEST_V2* request = (HTTP_REQUEST_V2*)pMemoryBlob;                    
+                    long fixup = pMemoryBlob - (byte*) originalAddress;
+
+                    for (int i = 0; i < request->RequestInfoCount; i++)
+                    {
+                        HTTP_REQUEST_INFO* pThisInfo = (HTTP_REQUEST_INFO*)(fixup + (byte*)&request->pRequestInfo[i]);
+                        if (pThisInfo != null && pThisInfo->InfoType == HTTP_REQUEST_INFO_TYPE.HttpRequestInfoTypeSslTokenBinding)
+                        {
+                            return (HTTP_REQUEST_TOKEN_BINDING_INFO*)pThisInfo->pInfo;
+                        }
+                    }
+                }
+                return null;
+            }
 
             [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
             private static void CopyOutAddress(IntPtr address, ref SocketAddress v4address, ref SocketAddress v6address)
index 9f04a33e0b7d529739ef11c801bfd54f017b75bc..58400b2b26f17a861b660ac1c0b5c356e60c05cb 100644 (file)
@@ -393,7 +393,7 @@ namespace System.Net.Security {
                 if (store != null)
                 {
                     collectionEx = store.Certificates.Find(X509FindType.FindByThumbprint, certHash, false);
-                    if (collectionEx.Count > 0 && collectionEx[0].PrivateKey != null)
+                    if (collectionEx.Count > 0 && collectionEx[0].HasPrivateKey)
                     {
                         if (Logging.On) Logging.PrintInfo(Logging.Web, this, SR.GetString(SR.net_log_found_cert_in_store, (m_ServerMode ? "LocalMachine" : "CurrentUser")));
                         return collectionEx[0];
@@ -404,7 +404,7 @@ namespace System.Net.Security {
                 if (store != null)
                 {
                     collectionEx = store.Certificates.Find(X509FindType.FindByThumbprint, certHash, false);
-                    if (collectionEx.Count > 0 && collectionEx[0].PrivateKey != null)
+                    if (collectionEx.Count > 0 && collectionEx[0].HasPrivateKey)
                     {
                         if (Logging.On) Logging.PrintInfo(Logging.Web, this, SR.GetString(SR.net_log_found_cert_in_store, (m_ServerMode ? "CurrentUser" : "LocalMachine")));
                         return collectionEx[0];
@@ -791,6 +791,12 @@ namespace System.Net.Security {
                 else
                 {
                     SecureCredential.Flags flags = SecureCredential.Flags.ValidateManual | SecureCredential.Flags.NoDefaultCred;
+
+                    if (!ServicePointManager.DisableSendAuxRecord)
+                    {
+                        flags |= SecureCredential.Flags.SendAuxRecord;
+                    }
+
                     if (!ServicePointManager.DisableStrongCrypto 
                         && ((m_ProtocolFlags & (SchProtocols.Tls10 | SchProtocols.Tls11 | SchProtocols.Tls12)) != 0)
                         && (m_EncryptionPolicy != EncryptionPolicy.AllowNoEncryption) && (m_EncryptionPolicy != EncryptionPolicy.NoEncryption))
@@ -876,7 +882,14 @@ namespace System.Net.Security {
                 }
                 else
                 {
-                    SecureCredential secureCredential = new SecureCredential(SecureCredential.CurrentVersion, selectedCert, SecureCredential.Flags.Zero, m_ProtocolFlags, m_EncryptionPolicy);
+                    SecureCredential.Flags flags = SecureCredential.Flags.Zero;
+
+                    if (!ServicePointManager.DisableSendAuxRecord)
+                    {
+                        flags |= SecureCredential.Flags.SendAuxRecord;
+                    }
+
+                    SecureCredential secureCredential = new SecureCredential(SecureCredential.CurrentVersion, selectedCert, flags, m_ProtocolFlags, m_EncryptionPolicy);
                     m_CredentialsHandle = AcquireCredentialsHandle(CredentialUse.Inbound, ref secureCredential);
                     thumbPrint = guessedThumbPrint;
                     m_ServerCertificate = localCertificate;
index 39d0c2c0f6c98c5b6b90f7cda523ad1aa6fe7306..cbe1ea3f7085c8538d3b7d59150fe554c594cb9b 100644 (file)
@@ -55,13 +55,6 @@ namespace System {
             if (start==end)
                 return false;
 
-#if MONO
-            if (!Uri.IsWindowsFileSystem) {
-                if (!(end - start > 2 && name[start] == '\\' && name[start + 1] == '\\')) {
-                    return false;
-                }
-            }
-#endif
             //
             // First segment could consist of only '_' or '-' but it cannot be all digits or empty
             //
index ed0965d382f9dd468f2e720fbca5945310a5fcf6..500280aed332b4aceaec2b94e3e7babe19480585 100644 (file)
@@ -586,9 +586,6 @@ namespace System.IO {
                             }
                             else {
                                 if (oldName != null) {
-                                    Debug.Assert(false, "FileSystemWatcher: FILE_ACTION_RENAMED_OLD_NAME with no" +
-                                                                  "new name!  [" + oldName + "]");
-    
                                     NotifyRenameEventArgs(WatcherChangeTypes.Renamed, null, oldName);
                                     oldName = null;
                                 }
index a084bb5dc8e7dacc7d3b7f8452cecff8bc0e8729..da13e1930260edaf90b2bfe15081785db4edd065 100644 (file)
@@ -27,6 +27,11 @@ namespace System
                         {
                             LocalAppContext.DefineSwitchDefault(LocalAppContextSwitches.DontEnableSchUseStrongCryptoName, true);
                         }
+
+                        if (version <= 40601)
+                        {
+                            LocalAppContext.DefineSwitchDefault(LocalAppContextSwitches.MemberDescriptorEqualsReturnsFalseIfEquivalentName, true);
+                        }
                         break;
                     }
                 case "WindowsPhone":
@@ -34,7 +39,7 @@ namespace System
                     {
                         if (version <= 80100)
                         {
-                            LocalAppContext.DefineSwitchDefault(LocalAppContextSwitches.DontEnableSchUseStrongCryptoName, true);
+                             LocalAppContext.DefineSwitchDefault(LocalAppContextSwitches.DontEnableSchUseStrongCryptoName, true);
                         }
                         break;
                     }
index 50f2bac56df83f542b4d276a85de675f7c5346f5..0d28af1593f7fcbfc84d9dfce2fe6f21369ac349 100644 (file)
@@ -11,7 +11,21 @@ namespace System
     internal static class LocalAppContextSwitches
     {
 
-#region System.Net quirks
+        #region System quirks
+        private static int _memberDescriptorEqualsReturnsFalseIfEquivalent;
+        internal const string MemberDescriptorEqualsReturnsFalseIfEquivalentName = @"Switch.System.MemberDescriptorEqualsReturnsFalseIfEquivalent";
+
+        public static bool MemberDescriptorEqualsReturnsFalseIfEquivalent
+        {
+            [MethodImpl(MethodImplOptions.AggressiveInlining)]
+            get
+            {
+                return LocalAppContext.GetCachedSwitchValue(MemberDescriptorEqualsReturnsFalseIfEquivalentName, ref _memberDescriptorEqualsReturnsFalseIfEquivalent);
+            }
+        }
+        #endregion
+
+        #region System.Net quirks
         private static int _dontEnableSchUseStrongCrypto;
         internal const string DontEnableSchUseStrongCryptoName = @"Switch.System.Net.DontEnableSchUseStrongCrypto";
 
@@ -23,9 +37,7 @@ namespace System
                 return LocalAppContext.GetCachedSwitchValue(DontEnableSchUseStrongCryptoName, ref _dontEnableSchUseStrongCrypto);
             }
         }
-#endregion
 
-#region System.Net.WebSockets.HttpListenerAsyncEventArgs
         private static int _allocateOverlappedOnDemand;
         internal const string AllocateOverlappedOnDemandName = @"Switch.System.Net.WebSockets.HttpListenerAsyncEventArgs.AllocateOverlappedOnDemand";
 
@@ -37,7 +49,18 @@ namespace System
                 return LocalAppContext.GetCachedSwitchValue(AllocateOverlappedOnDemandName, ref _allocateOverlappedOnDemand);
             }
         }
-#endregion
 
+        private static int _dontEnableSchSendAuxRecord;
+        internal const string DontEnableSchSendAuxRecordName = @"Switch.System.Net.DontEnableSchSendAuxRecord";
+
+        public static bool DontEnableSchSendAuxRecord
+        {
+            [MethodImpl(MethodImplOptions.AggressiveInlining)]
+            get
+            {
+                return LocalAppContext.GetCachedSwitchValue(DontEnableSchSendAuxRecordName, ref _dontEnableSchSendAuxRecord);
+            }
+        }
+        #endregion
     }
 }
index 30a681e707b8368e1c31632de420949154b1c12e..fb57cc3cbaa1977443e351250df829b1ad6efd28 100644 (file)
@@ -198,8 +198,11 @@ namespace Microsoft.Build.Tasks.Xaml
                     }
                     else
                     {
-                        AppDomain.Unload(inProcessAppDomain);
-                        inProcessAppDomain = null;
+                        if (inProcessAppDomain != null)
+                        {
+                            AppDomain.Unload(inProcessAppDomain);
+                            inProcessAppDomain = null;
+                        }
                         return GetAppDomainAndExecute();
                     }
                 }
index 03a90fba66abaff704862fa9e17052fdbbc040a4..a21ac391e5e4be15fde7e692d9fd2efb540c2b3d 100644 (file)
@@ -215,6 +215,12 @@ namespace Microsoft.Build.Tasks.Xaml
             appDomainSetup.ApplicationBase = buildTaskPath;
             appDomainSetup.LoaderOptimization = LoaderOptimization.MultiDomainHost;
 
+            // Set the AppDomainManager class name and assembly name to the empty string. We don't want the AppDomain to try to load the
+            // Microsoft.VisualStudio.Platform.AppDomainManager.dll because it is no longer in the GAC, so it won't be found
+            // by the AppDomain that is created for the in-process build to support Intellisense in Visual Studio.
+            appDomainSetup.AppDomainManagerType = "";
+            appDomainSetup.AppDomainManagerAssembly = "";
+
             // Create appdomain with fulltrust.
             return AppDomain.CreateDomain(
                 friendlyName,
index 872cfa80dd5d3d986d8e5dd89489efb871911649..19ec1053a3a4c9a03682b6d26755c976721b7b3a 100644 (file)
@@ -155,7 +155,14 @@ namespace System
             if (PinnableBufferCacheEventSource.Log.IsEnabled())
                 PinnableBufferCacheEventSource.Log.FreeBuffer(m_CacheName, PinnableBufferCacheEventSource.AddressOf(buffer), buffer.GetHashCode(), m_FreeList.Count);
 
-
+            if(buffer == null)
+            {
+                if (PinnableBufferCacheEventSource.Log.IsEnabled())
+                    PinnableBufferCacheEventSource.Log.FreeBufferNull(m_CacheName, m_FreeList.Count);
+                    
+                return;
+            }
+            
             // After we've done 3 gen1 GCs, assume that all buffers have aged into gen2 on the free path.
             if ((m_gen1CountAtLastRestock + 3) > GC.CollectionCount(GC.MaxGeneration - 1))
             {
@@ -567,6 +574,7 @@ namespace System
         public void AllocateBufferAged(string cacheName, int agedCount) {}
         public void AllocateBufferFreeListEmpty(string cacheName, int notGen2CountBefore) {}
         public void FreeBuffer(string cacheName, ulong objectId, int objectHash, int freeCountBefore) {}
+        public void FreeBufferNull(string cacheName, int freeCountBefore) { }
         public void FreeBufferStillTooYoung(string cacheName, int notGen2CountBefore) {}
         public void TrimCheck(string cacheName, int totalBuffs, bool neededMoreThanFreeList, int deltaMSec) {}
         public void TrimFree(string cacheName, int totalBuffs, int freeListCount, int toBeFreed) {}
@@ -643,6 +651,8 @@ namespace System
         public void AgePendingBuffersResults(string cacheName, int promotedToFreeListCount, int heldBackCount) { if (IsEnabled()) WriteEvent(20, cacheName, promotedToFreeListCount, heldBackCount); }
         [Event(21)]
         public void WalkFreeListResult(string cacheName, int freeListCount, int gen0BuffersInFreeList) { if (IsEnabled()) WriteEvent(21, cacheName, freeListCount, gen0BuffersInFreeList); }
+        [Event(22)]
+        public void FreeBufferNull(string cacheName, int freeCountBefore) { if(IsEnabled()) WriteEvent(22, cacheName, freeCountBefore); }
 
 
         static internal ulong AddressOf(object obj)
index 9c2df18a2daf5d191612169f1bcc5d0cb9f10b82..1bf3586fe471a184fd2979557e4ed976454224d7 100644 (file)
@@ -937,6 +937,10 @@ namespace Microsoft.Win32 {
         [ResourceExposure(ResourceScope.Machine)]
         internal unsafe static extern int GetFullPathName(char* path, int numBufferChars, char* buffer, IntPtr mustBeZero);
 
+        [DllImport(KERNEL32, SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false, ExactSpelling = true)]
+        [ResourceExposure(ResourceScope.Machine)]
+        internal unsafe static extern uint GetFullPathNameW(char* path, uint numBufferChars, SafeHandle buffer, IntPtr mustBeZero);
+
         [DllImport(KERNEL32, SetLastError=true, CharSet=CharSet.Auto, BestFitMapping=false)]
         [ResourceExposure(ResourceScope.Machine)]
         internal unsafe static extern int GetFullPathName(String path, int numBufferChars, [Out]StringBuilder buffer, IntPtr mustBeZero);
@@ -949,6 +953,14 @@ namespace Microsoft.Win32 {
         [ResourceExposure(ResourceScope.Machine)]
         internal static extern int GetLongPathName(String path, [Out]StringBuilder longPathBuffer, int bufferLength);
 
+        [DllImport(KERNEL32, SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false, ExactSpelling = true)]
+        [ResourceExposure(ResourceScope.Machine)]
+        internal static extern uint GetLongPathNameW(SafeHandle lpszShortPath, SafeHandle lpszLongPath, uint cchBuffer);
+
+        [DllImport(KERNEL32, SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false, ExactSpelling = true)]
+        [ResourceExposure(ResourceScope.Machine)]
+        internal static extern uint GetLongPathNameW(string lpszShortPath, SafeHandle lpszLongPath, uint cchBuffer);
+
         // Disallow access to all non-file devices from methods that take
         // a String.  This disallows DOS devices like "con:", "com1:", 
         // "lpt1:", etc.  Use this to avoid security problems, like allowing
@@ -1397,6 +1409,10 @@ namespace Microsoft.Win32 {
                   int nBufferLength,
                   [Out]StringBuilder lpBuffer);
 
+        [DllImport(KERNEL32, SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false, ExactSpelling = true)]
+        [ResourceExposure(ResourceScope.Machine)]
+        internal static extern uint GetCurrentDirectoryW(uint nBufferLength, SafeHandle lpBuffer);
+
         [DllImport(KERNEL32, SetLastError=true, CharSet=CharSet.Auto, BestFitMapping=false)]
         [ResourceExposure(ResourceScope.None)]
         internal static extern bool GetFileAttributesEx(String name, int fileInfoLevel, ref WIN32_FILE_ATTRIBUTE_DATA lpFileInformation);
index 0b00ff218213342fde4a54bb478ce88443725390..fe0253ba38cb1dac7dddb2d0a6476c8a59b269a4 100644 (file)
@@ -18,8 +18,7 @@ namespace System
             HasLookedForOverride = 0x4,
             UnknownValue = 0x8 // Has no default and could not find an override
         }
-        private static Dictionary<string, SwitchValueState> s_switchMap = new Dictionary<string, SwitchValueState>();
-        private static readonly object s_syncLock = new object();
+        private static readonly Dictionary<string, SwitchValueState> s_switchMap = new Dictionary<string, SwitchValueState>();
 
         public static string BaseDirectory
         {
@@ -151,11 +150,12 @@ namespace System
             if (switchName.Length == 0)
                 throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), "switchName");
 
-            lock (s_syncLock)
+            SwitchValueState switchValue = (isEnabled ? SwitchValueState.HasTrueValue : SwitchValueState.HasFalseValue)
+                                             | SwitchValueState.HasLookedForOverride;
+            lock (s_switchMap)
             {
                 // Store the new value and the fact that we checked in the dictionary
-                s_switchMap[switchName] = (isEnabled ? SwitchValueState.HasTrueValue : SwitchValueState.HasFalseValue)
-                                            | SwitchValueState.HasLookedForOverride;
+                s_switchMap[switchName] = switchValue;
             }
         }
 
index bc1f347abb00a2a714daf704abe8b592aac73196..d934f6ac188b3d09339395bc2db2b2b5e2a68fca 100644 (file)
@@ -1,4 +1,4 @@
-// ==++==
+// ==++==
 // 
 //   Copyright (c) Microsoft Corporation.  All rights reserved.
 // 
@@ -13,8 +13,11 @@ namespace System
         internal static readonly string SwitchNoAsyncCurrentCulture = "Switch.System.Globalization.NoAsyncCurrentCulture";
         internal static readonly string SwitchThrowExceptionIfDisposedCancellationTokenSource = "Switch.System.Threading.ThrowExceptionIfDisposedCancellationTokenSource";
         internal static readonly string SwitchPreserveEventListnerObjectIdentity = "Switch.System.Diagnostics.EventSource.PreserveEventListnerObjectIdentity";
+        internal static readonly string SwitchUseLegacyPathHandling = "Switch.System.IO.UseLegacyPathHandling";
+        internal static readonly string SwitchBlockLongPaths = "Switch.System.IO.BlockLongPaths";
+        internal static readonly string SwitchSetActorAsReferenceWhenCopyingClaimsIdentity = "Switch.System.Security.ClaimsIdentity.SetActorAsReferenceWhenCopyingClaimsIdentity";
+
 
-        
         // This is a partial method. Platforms can provide an implementation of it that will set override values
         // from whatever mechanism is available on that platform. If no implementation is provided, the compiler is going to remove the calls
         // to it from the code
@@ -41,6 +44,14 @@ namespace System
                             AppContext.DefineSwitchDefault(SwitchNoAsyncCurrentCulture, true);
                             AppContext.DefineSwitchDefault(SwitchThrowExceptionIfDisposedCancellationTokenSource, true);
                         }
+
+                        if (version <= 40601)
+                        {
+                            AppContext.DefineSwitchDefault(SwitchUseLegacyPathHandling, true);
+                            AppContext.DefineSwitchDefault(SwitchBlockLongPaths, true);
+                            AppContext.DefineSwitchDefault(SwitchSetActorAsReferenceWhenCopyingClaimsIdentity, true);
+                        }
+
                         break;
                     }
                 case "WindowsPhone":
@@ -50,6 +61,8 @@ namespace System
                         {
                             AppContext.DefineSwitchDefault(SwitchNoAsyncCurrentCulture, true);
                             AppContext.DefineSwitchDefault(SwitchThrowExceptionIfDisposedCancellationTokenSource, true);
+                            AppContext.DefineSwitchDefault(SwitchUseLegacyPathHandling, true);
+                            AppContext.DefineSwitchDefault(SwitchBlockLongPaths, true);
                         }
                         break;
                     }
index 8a130a0f34285449d7dc69480eff98e832bf3edd..9224bf8b8fbac5bb40399ab2c13c752e3f0fd57f 100644 (file)
@@ -3,6 +3,15 @@
 //   Copyright (c) Microsoft Corporation.  All rights reserved.
 // 
 // ==--==
+
+// There are cases where we have multiple assemblies that are going to import this file and 
+// if they are going to also have InternalsVisibleTo between them, there will be a compiler warning
+// that the type is found both in the source and in a referenced assembly. The compiler will prefer 
+// the version of the type defined in the source
+//
+// In order to disable the warning for this type we are disabling this warning for this entire file.
+#pragma warning disable 436
+
 using System;
 using System.Collections.Generic;
 
@@ -167,3 +176,5 @@ namespace System
         static partial void PopulateDefaultValuesPartial(string platformIdentifier, string profile, int version);
     }
 }
+
+#pragma warning restore 436
index 539e877016dc42f39a5e2ec291e99421159d6627..72eb1cccb11adbe47978c594e96df8d78eb5563f 100644 (file)
@@ -41,6 +41,48 @@ namespace System
             }
         }
 
+        private static int _useLegacyPathHandling;
+
+        /// <summary>
+        /// Use legacy path normalization logic and blocking of extended syntax.
+        /// </summary>
+        public static bool UseLegacyPathHandling
+        {
+            [MethodImpl(MethodImplOptions.AggressiveInlining)]
+            get
+            {
+                return GetCachedSwitchValue(AppContextDefaultValues.SwitchUseLegacyPathHandling, ref _useLegacyPathHandling);
+            }
+        }
+
+        private static int _blockLongPaths;
+
+        /// <summary>
+        /// Throw PathTooLongException for paths greater than MAX_PATH or directories greater than 248 (as per CreateDirectory Win32 limitations)
+        /// </summary>
+        public static bool BlockLongPaths
+        {
+            [MethodImpl(MethodImplOptions.AggressiveInlining)]
+            get
+            {
+                return GetCachedSwitchValue(AppContextDefaultValues.SwitchBlockLongPaths, ref _blockLongPaths);
+            }
+        }
+
+        private static int _cloneActor;
+
+        /// <summary>
+        /// When copying a ClaimsIdentity.Actor this switch controls whether ClaimsIdentity.Actor should be set as a reference or the result of Actor.Clone()
+        /// </summary>
+        public static bool SetActorAsReferenceWhenCopyingClaimsIdentity
+        {
+            [MethodImpl(MethodImplOptions.AggressiveInlining)]
+            get
+            {
+                return GetCachedSwitchValue(AppContextDefaultValues.SwitchSetActorAsReferenceWhenCopyingClaimsIdentity, ref _cloneActor);
+            }
+        }
+
         //
         // Implementation details
         //
index fb850445ce344c48b703979b209323a92f7f829c..5509b40250328c80a4b1bcdbb3a1cbc07781bfab 100644 (file)
@@ -318,17 +318,23 @@ namespace System {
             }
         }
 
-        [ResourceExposure(ResourceScope.Machine)]
-        [ResourceConsumption(ResourceScope.Machine)]
-        private String NormalizePath(String path, bool useAppBase)
+        [System.Security.SecuritySafeCritical]
+        private string NormalizePath(string path, bool useAppBase)
         {
             if(path == null)
                 return null;
 
             // If we add very long file name support ("\\?\") to the Path class then this is unnecesary,
             // but we do not plan on doing this for now.
+
+            // Long path checks can be quirked, and as loading default quirks too early in the setup of an AppDomain is risky
+            // we'll avoid checking path lengths- we'll still fail at MAX_PATH later if we're !useAppBase when we call Path's
+            // NormalizePath.
             if (!useAppBase)
-                path = System.Security.Util.URLString.PreProcessForExtendedPathRemoval(path, false);
+                path = System.Security.Util.URLString.PreProcessForExtendedPathRemoval(
+                    checkPathLength: false,
+                    url: path,
+                    isFileUrl: false);
 
             int len = path.Length;
             if (len == 0)
@@ -417,10 +423,10 @@ namespace System {
 
             if (localPath) 
             {
-
                 if (useAppBase &&
-                    ( (len == 1) || (path[1] != ':') )) {
-                    String appBase = Value[(int) LoaderInformation.ApplicationBaseValue];
+                    ((len == 1) || (path[1] != ':'))) 
+                {
+                    String appBase = Value[(int)LoaderInformation.ApplicationBaseValue];
 
                     if ((appBase == null) || (appBase.Length == 0))
                         throw new MemberAccessException(Environment.GetResourceString("AppDomain_AppBaseNotSet"));
@@ -429,7 +435,9 @@ namespace System {
 
                     bool slash = false;
                     if ((path[0] == '/') || (path[0] == '\\')) {
-                        String pathRoot = Path.GetPathRoot(appBase);
+                        // Emulate Path.GetPathRoot without hitting code paths that check quirks
+                        string pathRoot = AppDomain.NormalizePath(appBase, fullCheck: false);
+                        pathRoot = pathRoot.Substring(0, System.IO.PathInternal.GetRootLength(pathRoot));
                         if (pathRoot.Length == 0) { // URL
                             int index = appBase.IndexOf(":/", StringComparison.Ordinal);
                             if (index == -1)
@@ -439,11 +447,11 @@ namespace System {
                             int urlLen = appBase.Length;
                             for (index += 1;
                                  (index < urlLen) && ((appBase[index] == '/') || (appBase[index] == '\\'));
-                                 index++);
+                                 index++) ;
 
                             // Now find the next slash to get domain name
-                            for(; (index < urlLen) && (appBase[index] != '/') && (appBase[index] != '\\');
-                                index++);
+                            for (; (index < urlLen) && (appBase[index] != '/') && (appBase[index] != '\\');
+                                index++) ;
 
                             pathRoot = appBase.Substring(0, index);
                         }
@@ -472,7 +480,9 @@ namespace System {
                     path = StringBuilderCache.GetStringAndRelease(result);
                 }
                 else
-                    path = Path.GetFullPathInternal(path);
+                {
+                    path = AppDomain.NormalizePath(path, fullCheck: true);
+                }
             }
 
             return path;
@@ -792,20 +802,32 @@ namespace System {
         [ResourceConsumption(ResourceScope.Machine)]
         private String VerifyDir(String dir, bool normalize)
         {
-            if (dir != null) {
+            if (dir != null)
+            {
                 if (dir.Length == 0)
+                {
                     dir = null;
-                else {
+                }
+                else
+                {
                     if (normalize)
                         dir = NormalizePath(dir, true);
 
-                // The only way AppDomainSetup is exposed in coreclr is through the AppDomainManager 
-                // and the AppDomainManager is a SecurityCritical type. Also, all callers of callstacks 
-                // leading from VerifyDir are SecurityCritical. So we can remove the Demand because 
-                // we have validated that all callers are SecurityCritical
+                    // The only way AppDomainSetup is exposed in coreclr is through the AppDomainManager 
+                    // and the AppDomainManager is a SecurityCritical type. Also, all callers of callstacks 
+                    // leading from VerifyDir are SecurityCritical. So we can remove the Demand because 
+                    // we have validated that all callers are SecurityCritical
 #if !FEATURE_CORECLR
                     if (IsFilePath(dir))
-                        new FileIOPermission( FileIOPermissionAccess.PathDiscovery, dir ).Demand();
+                    {
+                        // If we've already normalized we don't need to do it again, and can avoid hitting
+                        // quirks in FileIOPermission.
+                        new FileIOPermission(
+                            access: FileIOPermissionAccess.PathDiscovery,
+                            pathList: new string[] { dir },
+                            checkForDuplicates: false,
+                            needFullPath: false).Demand();
+                    }
 #endif // !FEATURE_CORECLR
                 }
             }
index 0d7719d224a5cc564d4059a538c91201946c6082..2a704e83006fa15410f41e5e15bbe8ae7ddd0a4f 100644 (file)
@@ -2712,7 +2712,7 @@ namespace System {
             get {
                 String dyndir = GetDynamicDir();
                 if (dyndir != null)
-                    new FileIOPermission( FileIOPermissionAccess.PathDiscovery, dyndir ).Demand();
+                    FileIOPermission.QuickDemand(FileIOPermissionAccess.PathDiscovery, dyndir);
 
                 return dyndir;
             }
@@ -3726,7 +3726,7 @@ namespace System {
             AppDomainInitializerInfo initializerInfo    = (AppDomainInitializerInfo)args[5];
             string           sandboxName                = (string)args[6];
             string[]         propertyNames              = (string[])args[7]; // can contain null elements
-            string[]         propertyValues             = (string[])args[8]; // can contain null elements           
+            string[]         propertyValues             = (string[])args[8]; // can contain null elements
             // extract evidence
             Evidence providedSecurityInfo = null;
             Evidence creatorsSecurityInfo = null;
@@ -3748,18 +3748,17 @@ namespace System {
                         if (Path.IsRelative(propertyValues[i]))
                             throw new ArgumentException( Environment.GetResourceString( "Argument_AbsolutePathRequired" ) );
 
-                        newSetup.ApplicationBase=Path.NormalizePath(propertyValues[i],true);
-
+                        newSetup.ApplicationBase = NormalizePath(propertyValues[i], fullCheck: true);
                     }
 #if FEATURE_CAS_POLICY
                     else if(propertyNames[i]=="LOCATION_URI" && providedSecurityInfo==null)
                     {
                         providedSecurityInfo=new Evidence();
                         providedSecurityInfo.AddHostEvidence(new Url(propertyValues[i]));
-                        ad.SetDataHelper(propertyNames[i],propertyValues[i],null);                        
+                        ad.SetDataHelper(propertyNames[i],propertyValues[i],null);
                     }
 #endif // FEATURE_CAS_POLICY
-#if FEATURE_LOADER_OPTIMIZATION                    
+#if FEATURE_LOADER_OPTIMIZATION
                     else
                     if(propertyNames[i]=="LOADER_OPTIMIZATION")
                     {
@@ -3775,8 +3774,8 @@ namespace System {
                             default: throw new ArgumentException(Environment.GetResourceString("Argument_UnrecognizedLoaderOptimization"), "LOADER_OPTIMIZATION");
                         }
                     }
-#endif // FEATURE_LOADER_OPTIMIZATION                    
-#if FEATURE_CORECLR      
+#endif // FEATURE_LOADER_OPTIMIZATION
+#if FEATURE_CORECLR
                     else
                     if(propertyNames[i]=="NATIVE_DLL_SEARCH_DIRECTORIES")
                     {
@@ -3804,7 +3803,8 @@ namespace System {
                             if (Path.IsRelative(path))
                                 throw new ArgumentException( Environment.GetResourceString( "Argument_AbsolutePathRequired" ) );
 
-                            string appPath=Path.NormalizePath(path,true);
+                            string appPath = NormalizePath(path, fullCheck: true);
+
                             normalisedAppPathList.Append(appPath);
                             normalisedAppPathList.Append(Path.PathSeparator);
                         }
@@ -3813,7 +3813,7 @@ namespace System {
                         {
                             normalisedAppPathList.Remove(normalisedAppPathList.Length - 1, 1);
                         }
-                        ad.SetDataHelper(propertyNames[i],normalisedAppPathList.ToString(),null);        // not supported by fusion, so set explicitly                
+                        ad.SetDataHelper(propertyNames[i],normalisedAppPathList.ToString(),null);        // not supported by fusion, so set explicitly
                     }
                     else
                     if(propertyNames[i]=="PLATFORM_RESOURCE_ROOTS")
@@ -3831,7 +3831,8 @@ namespace System {
                             if (Path.IsRelative(path))
                                 throw new ArgumentException( Environment.GetResourceString( "Argument_AbsolutePathRequired" ) );
 
-                            string appPath=Path.NormalizePath(path,true);
+                            string appPath = NormalizePath(path, fullCheck: true);
+
                             normalisedAppPathList.Append(appPath);
                             normalisedAppPathList.Append(Path.PathSeparator);
                         }
@@ -3840,7 +3841,7 @@ namespace System {
                         {
                             normalisedAppPathList.Remove(normalisedAppPathList.Length - 1, 1);
                         }
-                        ad.SetDataHelper(propertyNames[i],normalisedAppPathList.ToString(),null);        // not supported by fusion, so set explicitly                
+                        ad.SetDataHelper(propertyNames[i],normalisedAppPathList.ToString(),null);        // not supported by fusion, so set explicitly
                     }
                     else
                     if(propertyNames[i]=="APP_PATHS")
@@ -3858,7 +3859,8 @@ namespace System {
                             if (Path.IsRelative(path))
                                 throw new ArgumentException( Environment.GetResourceString( "Argument_AbsolutePathRequired" ) );
 
-                            string appPath=Path.NormalizePath(path,true);
+                            string appPath = NormalizePath(path, fullCheck: true);
+
                             normalisedAppPathList.Append(appPath);
                             normalisedAppPathList.Append(Path.PathSeparator);
                         }
@@ -3867,7 +3869,7 @@ namespace System {
                         {
                             normalisedAppPathList.Remove(normalisedAppPathList.Length - 1, 1);
                         }
-                        ad.SetDataHelper(propertyNames[i],normalisedAppPathList.ToString(),null);        // not supported by fusion, so set explicitly                
+                        ad.SetDataHelper(propertyNames[i],normalisedAppPathList.ToString(),null);        // not supported by fusion, so set explicitly
                     }
                     else
                     if(propertyNames[i]=="APP_NI_PATHS")
@@ -3885,7 +3887,8 @@ namespace System {
                             if (Path.IsRelative(path))
                                 throw new ArgumentException( Environment.GetResourceString( "Argument_AbsolutePathRequired" ) );
 
-                            string appPath=Path.NormalizePath(path,true);
+                            string appPath = NormalizePath(path, fullCheck: true);
+
                             normalisedAppPathList.Append(appPath);
                             normalisedAppPathList.Append(Path.PathSeparator);
                         }
@@ -3894,12 +3897,12 @@ namespace System {
                         {
                             normalisedAppPathList.Remove(normalisedAppPathList.Length - 1, 1);
                         }
-                        ad.SetDataHelper(propertyNames[i],normalisedAppPathList.ToString(),null);        // not supported by fusion, so set explicitly                
+                        ad.SetDataHelper(propertyNames[i],normalisedAppPathList.ToString(),null);        // not supported by fusion, so set explicitly
                     }
                     else
                     if(propertyNames[i]!= null)
                     {
-                        ad.SetDataHelper(propertyNames[i],propertyValues[i],null);     // just propagate                   
+                        ad.SetDataHelper(propertyNames[i],propertyValues[i],null);     // just propagate
                     }
 #endif
 
@@ -3993,6 +3996,19 @@ namespace System {
 #endif // FEATURE_CLICKONCE
         }
 
+        [SecuritySafeCritical]
+        internal static string NormalizePath(string path, bool fullCheck)
+        {
+            // We have to directly hit LegacyNormalizePath to avoid loading quirks for
+            // the AppDomain. (Once we have runtime support for long paths we can
+            // use the new normalization in path, but we still need to go in directly
+            // to avoid quirks.)
+            return  Path.LegacyNormalizePath(
+                path: path,
+                fullCheck: fullCheck,
+                maxPathLength: PathInternal.MaxShortPath,
+                expandShortPaths: true);
+        }
 
 #if FEATURE_APTCA
         // Called from DomainAssembly in Conditional APTCA cases
@@ -4654,7 +4670,7 @@ namespace System {
         [System.Security.SecuritySafeCritical]  // auto-generated
         [ResourceExposure(ResourceScope.None)]
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]              
+        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         internal extern Int32 GetId();
         
         internal const Int32 DefaultADID = 1;
@@ -4675,6 +4691,7 @@ namespace System {
             Contract.Assert(i != -1, "invalid image location");
 
             AppDomainSetup info = new AppDomainSetup();
+
             info.ApplicationBase = imageLocation.Substring(0, i+1);
 
             StringBuilder config = new StringBuilder(imageLocation.Substring(i+1));
@@ -4685,7 +4702,7 @@ namespace System {
         }
 
         // Used by the validator for testing but not executing an assembly
-#if FEATURE_REMOTING        
+#if FEATURE_REMOTING
         [ResourceExposure(ResourceScope.Machine)]
         [ResourceConsumption(ResourceScope.Machine)]
         private static AppDomain InternalCreateDomain(String imageLocation)
index a8a864ac12af73077d16bc0cf2cb0776beb3e5d6..49d20cd66978aede68ca7095a27393c7c3f73107 100644 (file)
@@ -372,7 +372,7 @@ namespace System {
         // Converts an array of bytes into a String.  
         public static String ToString (byte[] value, int startIndex, int length) {            
             if (value == null) {
-                throw new ArgumentNullException("byteArray");
+                throw new ArgumentNullException("value");
             }
 
             if (startIndex < 0 || startIndex >= value.Length && startIndex > 0) {  // Don't throw for a 0 length array.
index 1c0fb31377f9cf358f64c8709f2397aacfc153da..247c7dfe2871a9e22c0969aa8e0fd2f7eac9ea78 100644 (file)
@@ -79,18 +79,18 @@ namespace System.Deployment.Internal.Isolation.Manifest {
 
         [ResourceExposure(ResourceScope.Machine)]
         [ResourceConsumption(ResourceScope.Machine)]
-        internal static string GetEntryPointFullPath (ActivationContext activationContext) {
+        internal static string GetEntryPointFullPath (ActivationContext activationContext)
+        {
             string file, parameters;
             GetEntryPoint(activationContext, out file, out parameters);
 
-            if (!String.IsNullOrEmpty(file)) {
+            if (!string.IsNullOrEmpty(file))
+            {
                 string directoryName = activationContext.ApplicationDirectory;
-                if (directoryName == null || directoryName.Length == 0) {
+                if (directoryName == null || directoryName.Length == 0)
+                {
                     // If we were passed a relative path, assume the app base is the current working directory
-                    StringBuilder sb = new StringBuilder(Path.MAX_PATH + 1);
-                    if (Win32Native.GetCurrentDirectory(sb.Capacity, sb) == 0)
-                        System.IO.__Error.WinIOError();
-                    directoryName = sb.ToString();
+                    directoryName = Directory.UnsafeGetCurrentDirectory();
                 }
 
                 file = Path.Combine(directoryName, file);
index cd70bfb23e31d17556dd21495f9cf8fdb0bd5725..08844d397a441e04f2056b80cac72ca093d3892b 100644 (file)
@@ -833,6 +833,15 @@ namespace System.Diagnostics.Tracing
         {
             collector.AddBinary(value);
         }
+        
+        public override object GetData(object value)
+        {
+            object val = base.GetData(value);
+            if (null == val)
+                val = "";
+
+            return val;
+        }
     }
 
     /// <summary>
index d620ff96357e9c80b22aed96bcd42b7e6c0b3bf8..ae38d4fde59e63969dd9d575bf24fe9589ff5c04 100644 (file)
@@ -460,6 +460,7 @@ namespace System.Diagnostics.Tracing
                     }
 
                     this.WriteEventRaw(
+                        eventName,
                         ref descriptor,
                         activityID,
                         childActivityID,
@@ -564,6 +565,7 @@ namespace System.Diagnostics.Tracing
                     }
 
                     this.WriteEventRaw(
+                        eventName,
                         ref descriptor,
                         activityID,
                         childActivityID,
@@ -646,6 +648,7 @@ namespace System.Diagnostics.Tracing
                             eventTypes.typeInfo.WriteData(TraceLoggingDataCollector.Instance, ref data);
                             
                             this.WriteEventRaw(
+                                eventName,
                                 ref descriptor,
                                 pActivityId,
                                 pRelatedActivityId,
@@ -665,7 +668,7 @@ namespace System.Diagnostics.Tracing
                             if (ex is EventSourceException)
                                 throw;
                             else
-                                ThrowEventSourceException(ex);
+                                ThrowEventSourceException(eventName, ex);
                         }
                         finally
                         {
@@ -679,7 +682,7 @@ namespace System.Diagnostics.Tracing
                 if (ex is EventSourceException)
                     throw;
                 else
-                    ThrowEventSourceException(ex);
+                    ThrowEventSourceException(eventName, ex);
             }
         }
 
@@ -703,7 +706,7 @@ namespace System.Diagnostics.Tracing
                 eventCallbackArgs.PayloadNames = new ReadOnlyCollection<string>((IList<string>)payload.Keys);
             }
 
-            DisptachToAllListeners(-1, pActivityId, eventCallbackArgs);
+            DispatchToAllListeners(-1, pActivityId, eventCallbackArgs);
         }
 
 #if !ES_BUILD_PCL
index 1d1f1e708fe1d35bb72cf3a2c58f59e8fa8c4e58..ed5ffeca906ac08d93ba29c1155089ea830d5427 100644 (file)
@@ -99,7 +99,7 @@ namespace System.Diagnostics.Tracing
                 var newGroup = new FieldMetadata(
                     name,
                     TraceLoggingDataType.Struct,
-                    0,
+                    this.Tags,
                     this.BeginningBufferedArray);
                 this.AddField(newGroup);
                 result = new TraceLoggingMetadataCollector(this, newGroup);
index 633183d941aea353996b485c6e481eb339b35da4..bdfa364fe10cce65197fdc51f61f7c99cc8bd731 100644 (file)
@@ -1,8 +1,6 @@
 using System;
 using System.Diagnostics;
 using System.Threading;
-using System.Threading.Tasks;
-
 #if !ES_BUILD_AGAINST_DOTNET_V35
 using Contract = System.Diagnostics.Contracts.Contract;
 #else
@@ -11,15 +9,16 @@ using Contract = Microsoft.Diagnostics.Contracts.Internal.Contract;
 
 #if ES_BUILD_STANDALONE
 namespace Microsoft.Diagnostics.Tracing
-#else
+#else    
+using System.Threading.Tasks;
 namespace System.Diagnostics.Tracing
 #endif
 {
     /// <summary>
-    /// Tracks activities.  This is meant to be a singledon (accessed by the ActivityTracer.Instance static property)
+    /// Tracks activities.  This is meant to be a singleton (accessed by the ActivityTracer.Instance static property)
     ///  
     /// Logically this is simply holds the m_current variable that holds the async local that holds the current ActivityInfo
-    /// An ActivityInfo is represents a actvity (which knows its creator and thus knows its path). 
+    /// An ActivityInfo is represents a activity (which knows its creator and thus knows its path). 
     ///
     /// Most of the magic is in the async local (it gets copied to new tasks)
     /// 
@@ -39,7 +38,7 @@ namespace System.Diagnostics.Tracing
     /// On any normal event log the event with activityTracker.CurrentActivityId
     /// </summary>
     internal class ActivityTracker
-    { 
+    {
 
         /// <summary>
         /// Called on work item begins.  The activity name = providerName + activityName without 'Start' suffix.
@@ -55,15 +54,32 @@ namespace System.Diagnostics.Tracing
         public void OnStart(string providerName, string activityName, int task, ref Guid activityId, ref Guid relatedActivityId, EventActivityOptions options)
         {
             if (m_current == null)        // We are not enabled
-                return;
+            {
+                // We  used to rely on the TPL provider turning us on, but that has the disadvantage that you don't get Start-Stop tracking
+                // until you use Tasks for the first time (which you may never do).   Thus we change it to pull rather tan push for whether
+                // we are enabled.   
+                if (m_checkedForEnable)
+                    return;
+                m_checkedForEnable = true;
+#if ES_BUILD_STANDALONE
+                Enable();           // Enable it unconditionally.  
+#else
+                if (System.Threading.Tasks.TplEtwProvider.Log.IsEnabled(EventLevel.Informational, System.Threading.Tasks.TplEtwProvider.Keywords.TasksFlowActivityIds))
+                     Enable();
+#endif
+                if(m_current == null)
+                {
+                    return;
+                }
+            }
 
             Contract.Assert((options & EventActivityOptions.Disable) == 0);
 
             var currentActivity = m_current.Value;
             var fullActivityName = NormalizeActivityName(providerName, activityName, task);
-            
+
             var etwLog = TplEtwProvider.Log;
-            if (etwLog.Debug) 
+            if (etwLog.Debug)
             {
                 etwLog.DebugFacilityMessage("OnStartEnter", fullActivityName);
                 etwLog.DebugFacilityMessage("OnStartEnterActivityState", ActivityInfo.LiveActivities(currentActivity));
@@ -100,17 +116,17 @@ namespace System.Diagnostics.Tracing
             else
                 id = Interlocked.Increment(ref currentActivity.m_lastChildID);
 
-            // Remember the previous ID so we can log it
-            relatedActivityId = currentActivity != null ? currentActivity.ActivityId : Guid.Empty;
+            // The previous ID is my 'causer' and becomes my related activity ID
+            relatedActivityId = EventSource.CurrentThreadActivityId;
 
             // Add to the list of started but not stopped activities. 
-            ActivityInfo newActivity = new ActivityInfo(fullActivityName, id, currentActivity, options);
+            ActivityInfo newActivity = new ActivityInfo(fullActivityName, id, currentActivity, relatedActivityId, options);
             m_current.Value = newActivity;
 
             // Remember the current ID so we can log it 
             activityId = newActivity.ActivityId;
 
-            if (etwLog.Debug) 
+            if (etwLog.Debug)
             {
                 etwLog.DebugFacilityMessage("OnStartRetActivityState", ActivityInfo.LiveActivities(newActivity));
                 etwLog.DebugFacilityMessage1("OnStartRet", activityId.ToString(), relatedActivityId.ToString());
@@ -119,7 +135,7 @@ namespace System.Diagnostics.Tracing
 
         /// <summary>
         /// Called when a work item stops.  The activity name = providerName + activityName without 'Stop' suffix.
-        /// It updates CurrentActivityId to track this fact.   The Stop event associated with stop should log the ActivityID associated with the event.
+        /// It updates m_current variable to track this fact.   The Stop event associated with stop should log the ActivityID associated with the event.
         ///
         /// If activity tracing is not on, then activityId and relatedActivityId are not set
         /// </summary>
@@ -131,13 +147,13 @@ namespace System.Diagnostics.Tracing
             var fullActivityName = NormalizeActivityName(providerName, activityName, task);
 
             var etwLog = TplEtwProvider.Log;
-            if (etwLog.Debug) 
+            if (etwLog.Debug)
             {
                 etwLog.DebugFacilityMessage("OnStopEnter", fullActivityName);
                 etwLog.DebugFacilityMessage("OnStopEnterActivityState", ActivityInfo.LiveActivities(m_current.Value));
             }
 
-            for (; ;) // This is a retry loop.
+            for (; ; ) // This is a retry loop.
             {
                 ActivityInfo currentActivity = m_current.Value;
                 ActivityInfo newCurrentActivity = null;               // if we have seen any live activities (orphans), at he first one we have seen.   
@@ -193,7 +209,7 @@ namespace System.Diagnostics.Tracing
 
                     m_current.Value = newCurrentActivity;
 
-                    if (etwLog.Debug) 
+                    if (etwLog.Debug)
                     {
                         etwLog.DebugFacilityMessage("OnStopRetActivityState", ActivityInfo.LiveActivities(newCurrentActivity));
                         etwLog.DebugFacilityMessage("OnStopRet", activityId.ToString());
@@ -210,12 +226,12 @@ namespace System.Diagnostics.Tracing
         [System.Security.SecuritySafeCritical]
         public void Enable()
         {
-            if (m_current == null) 
+            if (m_current == null)
             {
                 m_current = new AsyncLocal<ActivityInfo>(ActivityChanging);
             }
         }
-        
+
         /// <summary>
         /// An activity tracker is a singleton, this is how you get the one and only instance.
         /// </summary>
@@ -263,24 +279,25 @@ namespace System.Diagnostics.Tracing
 
         // *******************************************************************************
         /// <summary>
-        /// An ActivityInfo repesents a particular activity.   It is almost read-only the only
+        /// An ActivityInfo represents a particular activity.   It is almost read-only.   The only
         /// fields that change after creation are
         ///    m_lastChildID - used to generate unique IDs for the children activities and for the most part can be ignored.
         ///    m_stopped - indicates that this activity is dead 
-        /// This read-only ness is important because an activity's  m_creator chain forms the 
+        /// This read-only-ness is important because an activity's  m_creator chain forms the 
         /// 'Path of creation' for the activity (which is also its unique ID) but is also used as
         /// the 'list of live parents' which indicate of those ancestors, which are alive (if they
         /// are not marked dead they are alive).   
         /// </summary>
         private class ActivityInfo
         {
-            public ActivityInfo(string name,  long uniqueId, ActivityInfo creator, EventActivityOptions options)
+            public ActivityInfo(string name, long uniqueId, ActivityInfo creator, Guid activityIDToRestore, EventActivityOptions options)
             {
                 m_name = name;
                 m_eventOptions = options;
                 m_creator = creator;
                 m_uniqueId = uniqueId;
                 m_level = creator != null ? creator.m_level + 1 : 0;
+                m_activityIdToRestore = activityIDToRestore;
 
                 // Create a nice GUID that encodes the chain of activities that started this one.
                 CreateActivityPathGuid(out m_guid, out m_activityPathGuidOffset);
@@ -294,19 +311,19 @@ namespace System.Diagnostics.Tracing
                 }
             }
 
-            public static string Path(ActivityInfo activityInfo) 
+            public static string Path(ActivityInfo activityInfo)
             {
                 if (activityInfo == null)
-                    return("");
+                    return ("");
                 return Path(activityInfo.m_creator) + "/" + activityInfo.m_uniqueId;
             }
 
-            public override string ToString() 
+            public override string ToString()
             {
                 string dead = "";
                 if (m_stopped != 0)
-                   dead = ",DEAD";
-                 return m_name + "(" + Path(this) + dead + ")";
+                    dead = ",DEAD";
+                return m_name + "(" + Path(this) + dead + ")";
             }
 
             public static string LiveActivities(ActivityInfo list)
@@ -331,10 +348,10 @@ namespace System.Diagnostics.Tracing
             /// (rooted in an activity that predates activity tracking.  
             ///
             /// We wish to encode this path in the Guid to the extent that we can.  Many of the paths have
-            /// many small numbers in them and we take advatage of this in the encoding to output as long
+            /// many small numbers in them and we take advantage of this in the encoding to output as long
             /// a path in the GUID as possible.   
             /// 
-            /// Because of the possiblility of GUID collistion, we only use 96 of the 128 bits of the GUID
+            /// Because of the possibility of GUID collision, we only use 96 of the 128 bits of the GUID
             /// for encoding the path.  The last 32 bits are a simple checksum (and random number) that 
             /// identifies this as using the convention defined here.   
             ///
@@ -347,7 +364,7 @@ namespace System.Diagnostics.Tracing
             [System.Security.SecuritySafeCritical]
             private unsafe void CreateActivityPathGuid(out Guid idRet, out int activityPathGuidOffset)
             {
-                fixed (Guid* outPtr = &idRet) 
+                fixed (Guid* outPtr = &idRet)
                 {
                     int activityPathGuidOffsetStart = 0;
                     if (m_creator != null)
@@ -355,13 +372,18 @@ namespace System.Diagnostics.Tracing
                         activityPathGuidOffsetStart = m_creator.m_activityPathGuidOffset;
                         idRet = m_creator.m_guid;
                     }
-                    else 
+                    else
                     {
-                        // We start with the appdomain number to make this unique among appdomains.                      
-                        activityPathGuidOffsetStart = AddIdToGuid(outPtr, activityPathGuidOffsetStart, (uint) System.Threading.Thread.GetDomainID());
+                        // 
+                        int appDomainID = 0;
+#if !ES_BUILD_PCL  
+                        appDomainID = System.Threading.Thread.GetDomainID();
+#endif
+                        // We start with the appdomain number to make this unique among appdomains.
+                        activityPathGuidOffsetStart = AddIdToGuid(outPtr, activityPathGuidOffsetStart, (uint)appDomainID);
                     }
 
-                    activityPathGuidOffset = AddIdToGuid(outPtr, activityPathGuidOffsetStart, (uint) m_uniqueId);
+                    activityPathGuidOffset = AddIdToGuid(outPtr, activityPathGuidOffsetStart, (uint)m_uniqueId);
 
 
                     // If the path does not fit, Make a GUID by incrementing rather than as a path, keeping as much of the path as possible
@@ -372,19 +394,19 @@ namespace System.Diagnostics.Tracing
 
             /// <summary>
             /// If we can't fit the activity Path into the GUID we come here.   What we do is simply
-            /// generate a 4 byte number (s_nextOverflowId).  Then look for an anscesor that has  
+            /// generate a 4 byte number (s_nextOverflowId).  Then look for an ancestor that has  
             /// sufficient space for this ID.   By doing this, we preserve the fact that this activity
             /// is a child (of unknown depth) from that ancestor.
             /// </summary>
             [System.Security.SecurityCritical]
             private unsafe void CreateOverflowGuid(Guid* outPtr)
             {
-                // Seach backwards for an ancestor that has sufficient space to put the ID.  
-                for(ActivityInfo ancestor = m_creator; ancestor != null; ancestor = ancestor.m_creator)
+                // Search backwards for an ancestor that has sufficient space to put the ID.  
+                for (ActivityInfo ancestor = m_creator; ancestor != null; ancestor = ancestor.m_creator)
                 {
                     if (ancestor.m_activityPathGuidOffset <= 10)  // we need at least 2 bytes.  
                     {
-                        uint id = (uint) Interlocked.Increment(ref ancestor.m_lastChildID);        // Get a unique ID 
+                        uint id = unchecked((uint)Interlocked.Increment(ref ancestor.m_lastChildID));        // Get a unique ID 
                         // Try to put the ID into the GUID
                         *outPtr = ancestor.m_guid;
                         int endId = AddIdToGuid(outPtr, ancestor.m_activityPathGuidOffset, id, true);
@@ -397,8 +419,8 @@ namespace System.Diagnostics.Tracing
             }
 
             /// <summary>
-            /// The encoding for a list of numbers used to make Activity  Guids.   Basically
-            /// we operate on nibbles (which are nice becase they show up as hex digits).  The
+            /// The encoding for a list of numbers used to make Activity  GUIDs.   Basically
+            /// we operate on nibbles (which are nice because they show up as hex digits).  The
             /// list is ended with a end nibble (0) and depending on the nibble value (Below)
             /// the value is either encoded into nibble itself or it can spill over into the
             /// bytes that follow.   
@@ -409,18 +431,18 @@ namespace System.Diagnostics.Tracing
                 LastImmediateValue = 0xA,
 
                 PrefixCode = 0xB,      // all the 'long' encodings go here.  If the next nibble is MultiByte1-4
-                                       // than this is a 'overflow' id.   Unlike the hierarchitcal IDs these are 
-                                       // allocated densly but don't tell you anything about nesting. we use 
-                                       // these when we run out of space in the GUID to store the path.
+                // than this is a 'overflow' id.   Unlike the hierarchical IDs these are 
+                // allocated densely but don't tell you anything about nesting. we use 
+                // these when we run out of space in the GUID to store the path.
 
                 MultiByte1 = 0xC,   // 1 byte follows.  If this Nibble is in the high bits, it the high bits of the number are stored in the low nibble.   
                 // commented out because the code does not explicitly reference the names (but they are logically defined).  
-                // MultiByte2 = 0xD,   // 2 bytes follow (we don't bother with the nibble optimzation)
-                // MultiByte3 = 0xE,   // 3 bytes follow (we don't bother with the nibble optimzation)
-                // MultiByte4 = 0xF,   // 4 bytes follow (we don't bother with the nibble optimzation)
+                // MultiByte2 = 0xD,   // 2 bytes follow (we don't bother with the nibble optimization)
+                // MultiByte3 = 0xE,   // 3 bytes follow (we don't bother with the nibble optimization)
+                // MultiByte4 = 0xF,   // 4 bytes follow (we don't bother with the nibble optimization)
             }
 
-            /// Add the acivity id 'id' to the output Guid 'outPtr' starting at the offset 'whereToAddId'
+            /// Add the activity id 'id' to the output Guid 'outPtr' starting at the offset 'whereToAddId'
             /// Thus if this number is 6 that is where 'id' will be added.    This will return 13 (12
             /// is the maximum number of bytes that fit in a GUID) if the path did not fit.  
             /// If 'overflow' is true, then the number is encoded as an 'overflow number (which has a
@@ -450,9 +472,9 @@ namespace System.Diagnostics.Tracing
                     {
                         if (endPtr <= ptr + 2)        // I need at least 2 bytes
                             return 13;
-                        
+
                         // Write out the prefix code nibble and the length nibble 
-                        WriteNibble(ref ptr, endPtr, (uint) NumberListCodes.PrefixCode);
+                        WriteNibble(ref ptr, endPtr, (uint)NumberListCodes.PrefixCode);
                     }
                     // The rest is the same for overflow and non-overflow case
                     WriteNibble(ref ptr, endPtr, (uint)NumberListCodes.MultiByte1 + (len - 1));
@@ -460,7 +482,7 @@ namespace System.Diagnostics.Tracing
                     // Do we have an odd nibble?   If so flush it or use it for the 12 byte case.   
                     if (ptr < endPtr && *ptr != 0)
                     {
-                        // If the value < 4096 we can use the nibble we are otherwise just outputing as padding. 
+                        // If the value < 4096 we can use the nibble we are otherwise just outputting as padding. 
                         if (id < 4096)
                         {
                             // Indicate this is a 1 byte multicode with 4 high order bits in the lower nibble.  
@@ -471,7 +493,7 @@ namespace System.Diagnostics.Tracing
                     }
 
                     // Write out the bytes.
-                    while(0 < len)
+                    while (0 < len)
                     {
                         if (endPtr <= ptr)
                         {
@@ -514,14 +536,15 @@ namespace System.Diagnostics.Tracing
             #endregion // CreateGuidForActivityPath
 
             readonly internal string m_name;                        // The name used in the 'start' and 'stop' APIs to help match up
-            readonly long m_uniqueId;                                    // a small number that makes this activity unique among its siblings
-            internal readonly Guid m_guid;                          // Activity Guid, it is bascially an encoding of the Path() (see CreateActivityPathGuid)
+            readonly long m_uniqueId;                               // a small number that makes this activity unique among its siblings
+            internal readonly Guid m_guid;                          // Activity Guid, it is basically an encoding of the Path() (see CreateActivityPathGuid)
             internal readonly int m_activityPathGuidOffset;         // Keeps track of where in m_guid the causality path stops (used to generated child GUIDs)
             internal readonly int m_level;                          // current depth of the Path() of the activity (used to keep recursion under control)
             readonly internal EventActivityOptions m_eventOptions;  // Options passed to start. 
             internal long m_lastChildID;                            // used to create a unique ID for my children activities
             internal int m_stopped;                                 // This work item has stopped
             readonly internal ActivityInfo m_creator;               // My parent (creator).  Forms the Path() for the activity.
+            readonly internal Guid m_activityIdToRestore;           // The Guid to restore after a stop.   
             #endregion
         }
 
@@ -530,26 +553,50 @@ namespace System.Diagnostics.Tracing
         // with m_current.ActivityID
         void ActivityChanging(AsyncLocalValueChangedArgs<ActivityInfo> args)
         {
-            if (args.PreviousValue == args.CurrentValue)
-                return;
+            ActivityInfo cur =  args.CurrentValue;
+            ActivityInfo prev = args.PreviousValue;
 
-            if (args.CurrentValue != null)
+            // Are we popping off a value?   (we have a prev, and it creator is cur) 
+            // Then check if we should use the GUID at the time of the start event
+            if (prev != null && prev.m_creator == cur)
             {
-                // Allow subsequent activities inside this thread to automatically get the current activity ID.
-                EventSource.SetCurrentThreadActivityId(args.CurrentValue.ActivityId);
+                // If the saved activity ID is not the same as the creator activity
+                // that takes precedence (it means someone explicitly did a SetActivityID)
+                // Set it to that and get out
+                if (cur == null || prev.m_activityIdToRestore != cur.ActivityId)
+                {
+                    EventSource.SetCurrentThreadActivityId(prev.m_activityIdToRestore);
+                    return;
+                }
             }
-            else
-                EventSource.SetCurrentThreadActivityId(Guid.Empty);
+
+            // OK we did not have an explicit SetActivityID set.   Then we should be 
+            // setting the activity to current ActivityInfo.  However that activity 
+            // might be dead, in which case we should skip it, so we never set 
+            // the ID to dead things.   
+            while(cur != null)
+            {
+                // We found a live activity (typically the first time), set it to that.  
+                if (cur.m_stopped == 0)
+                {
+                    EventSource.SetCurrentThreadActivityId(cur.ActivityId);
+                    return;
+                }
+                cur = cur.m_creator;
+            }
+            // we can get here if there is no information on our activity stack (everything is dead)
+            // currently we do nothing, as that seems better than setting to Guid.Emtpy.  
         }
 
         /// <summary>
-        /// Async local variables have the propery that the are automatically copied whenever a task is created and used
+        /// Async local variables have the properly that the are automatically copied whenever a task is created and used
         /// while that task is running.   Thus m_current 'flows' to any task that is caused by the current thread that
         /// last set it.   
         /// 
         /// This variable points a a linked list that represents all Activities that have started but have not stopped.  
         /// </summary>
         AsyncLocal<ActivityInfo> m_current;
+        bool m_checkedForEnable;
 
         // Singleton
         private static ActivityTracker s_activityTrackerInstance = new ActivityTracker();
@@ -557,8 +604,74 @@ namespace System.Diagnostics.Tracing
         // Used to create unique IDs at the top level.  Not used for nested Ids (each activity has its own id generator)
         static long m_nextId = 0;
         private const ushort MAX_ACTIVITY_DEPTH = 100;            // Limit maximum depth of activities to be tracked at 100. 
-                                                                  // This will avoid leaking memory in case of activities that are never stopped.
+        // This will avoid leaking memory in case of activities that are never stopped.
 
         #endregion
     }
+
+#if ES_BUILD_STANDALONE
+    /******************************** SUPPORT *****************************/
+    /// <summary>
+    /// This is supplied by the framework.   It is has the semantics that the value is copied to any new Tasks that is created
+    /// by the current task.   Thus all causally related code gets this value.    Note that reads and writes to this VARIABLE 
+    /// (not what it points it) to this does not need to be protected by locks because it is inherently thread local (you always
+    /// only get your thread local copy which means that you never have ----s.  
+    /// </summary>
+    /// 
+    [EventSource(Name="Microsoft.Tasks.Nuget")]
+    internal class TplEtwProvider : EventSource
+    {
+        public class Keywords
+        {
+            public const EventKeywords Debug = (EventKeywords) 1;
+        }
+
+        public static TplEtwProvider Log = new TplEtwProvider();
+        public bool Debug { get { return IsEnabled(EventLevel.Verbose, Keywords.Debug); } }
+
+        public void DebugFacilityMessage(string Facility, string Message) { WriteEvent(1, Facility, Message); }
+        public void DebugFacilityMessage1(string Facility, string Message, string Arg) { WriteEvent(2, Facility, Message, Arg); }
+        public void SetActivityId(Guid Id) { WriteEvent(3, Id); }
+    }
+#endif
+
+#if ES_BUILD_AGAINST_DOTNET_V35 || ES_BUILD_PCL || NO_ASYNC_LOCAL
+
+    internal sealed class AsyncLocalValueChangedArgs<T>
+    {
+        public AsyncLocalValueChangedArgs()
+        {
+        }
+
+        public T PreviousValue { get { return default(T); } }
+        public T CurrentValue { get { return default(T); } }
+
+    }
+
+    internal sealed class AsyncLocal<T>
+    {
+        public AsyncLocal()
+        {
+        }
+
+        public AsyncLocal(Action<AsyncLocalValueChangedArgs<T>> valueChangedHandler)
+        {
+
+        }
+
+        public T Value
+        {
+            get
+            {
+                object obj = null;  // 
+                return (obj == null) ? default(T) : (T)obj;
+            }
+            set
+            {
+                // 
+            }
+        }
+    }
+#endif
+
 }
index 8a3fec6e6f46cbb186f5cafe0a34a20330f3d8ff..939d15ee520f53b2b20ee8b9247098cd40e8ce0a 100644 (file)
@@ -91,7 +91,7 @@ namespace System.Diagnostics.Tracing
         private static WriteEventErrorCode s_returnCode; // The last return code 
 
         private const int s_basicTypeAllocationBufferSize = 16;
-        private const int s_etwMaxNumberArguments = 32;
+        private const int s_etwMaxNumberArguments = 128;
         private const int s_etwAPIMaxRefObjCount = 8;
         private const int s_maxEventDataDescriptors = 128;
         private const int s_traceEventMaximumSize = 65482;
index a1b51851218d5fc20ec8ab7c6933e742e0f6a94b..9ae566937256255d1b55dcc7c0b259983dc54595 100644 (file)
@@ -1,5 +1,4 @@
-// Copyright (c) Microsoft Corporation.  All rights reserved
-// Copyright (c) Microsoft Corporation.  All rights reserved
+// Copyright (c) Microsoft Corporation.  All rights reserved 
 // This program uses code hyperlinks available as part of the HyperAddin Visual Studio plug-in.
 // It is available from http://www.codeplex.com/hyperAddin 
 #define FEATURE_MANAGED_ETW
@@ -13,7 +12,7 @@
 // #define FEATURE_ADVANCED_MANAGED_ETW_CHANNELS
 #endif
 
-/* DESIGN NOTES DESIGN NOTES DESIGN NOTES DESIGN NOTES */
+/*  DESIGN NOTES DESIGN NOTES DESIGN NOTES DESIGN NOTES  */
 // DESIGN NOTES
 // Over the years EventSource has become more complex and so it is important to understand
 // the basic structure of the code to insure that it does not grow more complex.
 
 
 using System;
+using System.Runtime.CompilerServices;
 #if FEATURE_ACTIVITYSAMPLING
 using System.Collections.Concurrent;
 #endif
@@ -531,6 +531,7 @@ namespace System.Diagnostics.Tracing
 #if FEATURE_ACTIVITYSAMPLING
             Guid newId = activityId;
 #endif // FEATURE_ACTIVITYSAMPLING
+
             // We ignore errors to keep with the convention that EventSources do not throw errors.
             // Note we can't access m_throwOnWrites because this is a static method.  
             if (UnsafeNativeMethods.ManifestEtw.EventActivityIdControl(
@@ -594,7 +595,7 @@ namespace System.Diagnostics.Tracing
         /// </summary>
         public static Guid CurrentThreadActivityId
         {
-            [System.Security.SecurityCritical]
+            [System.Security.SecuritySafeCritical]
             get
             {
                 // We ignore errors to keep with the convention that EventSources do not throw 
@@ -680,6 +681,30 @@ namespace System.Diagnostics.Tracing
         /// </summary>
         public override string ToString() { return Environment.GetResourceString("EventSource_ToString", Name, Guid); }
 
+        /// <summary>
+        /// Fires when a Command (e.g. Enable) comes from a an EventListener.  
+        /// </summary>
+        public event EventHandler<EventCommandEventArgs> EventCommandExecuted
+        {
+            add
+            {
+                m_eventCommandExecuted += value;
+
+                // If we have an EventHandler<EventCommandEventArgs> attached to the EventSource before the first command arrives
+                // It should get a chance to handle the deferred commands.
+                EventCommandEventArgs deferredCommands = m_deferredCommands;
+                while (deferredCommands != null)
+                {
+                    value(this, deferredCommands);
+                    deferredCommands = deferredCommands.nextCommand;
+                }
+            }
+            remove
+            {
+                m_eventCommandExecuted -= value;
+            }
+        }
+
         #region protected
         /// <summary>
         /// This is the constructor that most users will use to create their eventSource.   It takes 
@@ -1152,7 +1177,7 @@ namespace System.Diagnostics.Tracing
                 {
                     Contract.Assert(m_eventData != null);  // You must have initialized this if you enabled the source.
                     if (relatedActivityId != null)
-                        ValidateEventOpcodeForTransfer(ref m_eventData[eventId]);
+                        ValidateEventOpcodeForTransfer(ref m_eventData[eventId], m_eventData[eventId].Name);
 
 #if FEATURE_MANAGED_ETW
                     if (m_eventData[eventId].EnabledForETW)
@@ -1202,7 +1227,7 @@ namespace System.Diagnostics.Tracing
                                     // mask set to 0x0f so, when all ETW sessions want the event we don't need to 
                                     // synthesize a new one
                                     if (!m_provider.WriteEvent(ref m_eventData[eventId].Descriptor, pActivityId, relatedActivityId, eventDataCount, (IntPtr)data))
-                                        ThrowEventSourceException();
+                                        ThrowEventSourceException(m_eventData[eventId].Name);
                                 }
                                 else
                                 {
@@ -1222,7 +1247,7 @@ namespace System.Diagnostics.Tracing
                                         unchecked((long)etwSessions.ToEventKeywords() | origKwd));
 
                                     if (!m_provider.WriteEvent(ref desc, pActivityId, relatedActivityId, eventDataCount, (IntPtr)data))
-                                        ThrowEventSourceException();
+                                        ThrowEventSourceException(m_eventData[eventId].Name);
                                 }
                             }
                             else
@@ -1252,7 +1277,7 @@ namespace System.Diagnostics.Tracing
                         if (!SelfDescribingEvents)
                         {
                             if (!m_provider.WriteEvent(ref m_eventData[eventId].Descriptor, pActivityId, relatedActivityId, eventDataCount, (IntPtr)data))
-                                ThrowEventSourceException();
+                                ThrowEventSourceException(m_eventData[eventId].Name);
                         }
                         else
                         {
@@ -1286,7 +1311,7 @@ namespace System.Diagnostics.Tracing
                     if (ex is EventSourceException)
                         throw;
                     else
-                        ThrowEventSourceException(ex);
+                        ThrowEventSourceException(m_eventData[eventId].Name, ex);
                 }
             }
         }
@@ -1402,6 +1427,7 @@ namespace System.Diagnostics.Tracing
 #endif
         [SecurityCritical]
         private unsafe void WriteEventRaw(
+            string eventName,
             ref EventDescriptor eventDescriptor,
             Guid* activityID,
             Guid* relatedActivityID,
@@ -1410,12 +1436,12 @@ namespace System.Diagnostics.Tracing
         {
             if (m_provider == null)
             {
-                ThrowEventSourceException();
+                ThrowEventSourceException(eventName);
             }
             else
             {
                 if (!m_provider.WriteEventRaw(ref eventDescriptor, activityID, relatedActivityID, dataCount, data))
-                    ThrowEventSourceException();
+                    ThrowEventSourceException(eventName);
             }
         }
 
@@ -1516,10 +1542,13 @@ namespace System.Diagnostics.Tracing
             {
                 // If there are any deferred commands, we can do them now.   
                 // This is the most likely place for exceptions to happen.  
-                while (m_deferredCommands != null)
+                // Note that we are NOT resetting m_deferredCommands to NULL here, 
+                // We are giving for EventHandler<EventCommandEventArgs> that will be attached later
+                EventCommandEventArgs deferredCommands = m_deferredCommands;
+                while (deferredCommands != null)
                 {
-                    DoCommand(m_deferredCommands);      // This can never throw, it catches them and reports the errors.   
-                    m_deferredCommands = m_deferredCommands.nextCommand;
+                    DoCommand(deferredCommands);      // This can never throw, it catches them and reports the errors.   
+                    deferredCommands = deferredCommands.nextCommand;
                 }
             }
         }
@@ -1817,7 +1846,7 @@ namespace System.Diagnostics.Tracing
                 dataPointer = data->DataPointer;
                 data++;
                 for (int i = 0; i < cbSize; ++i)
-                    blob[i] = *((byte*)dataPointer);
+                    blob[i] = *((byte*)dataPointer + i);
                 return blob;
             }
             else if (dataType == typeof(byte*))
@@ -1863,8 +1892,24 @@ namespace System.Diagnostics.Tracing
                 {
                     Contract.Assert(m_eventData != null);  // You must have initialized this if you enabled the source.  
                     if (childActivityID != null)
-                        ValidateEventOpcodeForTransfer(ref m_eventData[eventId]);
-
+                    {
+                        ValidateEventOpcodeForTransfer(ref m_eventData[eventId], m_eventData[eventId].Name);
+
+                        // If you use WriteEventWithRelatedActivityID you MUST declare the first argument to be a GUID 
+                        // with the name 'relatedActivityID, and NOT pass this argument to the WriteEvent method.  
+                        // During manifest creation we modify the ParameterInfo[] that we store to strip out any
+                        // first parameter that is of type Guid and named "relatedActivityId." Thus, if you call
+                        // WriteEventWithRelatedActivityID from a method that doesn't name its first parameter correctly
+                        // we can end up in a state where the ParameterInfo[] doesn't have its first parameter stripped,
+                        // and this leads to a mismatch between the number of arguments and the number of ParameterInfos,
+                        // which would cause a cryptic IndexOutOfRangeException later if we don't catch it here.
+                        if (!m_eventData[eventId].HasRelatedActivityID)
+                        {
+                            throw new ArgumentException(Environment.GetResourceString("EventSource_NoRelatedActivityId"));
+                        }
+                    }
+                    
+                    LogEventArgsMismatches(m_eventData[eventId].Parameters, args);
 #if FEATURE_MANAGED_ETW
                     if (m_eventData[eventId].EnabledForETW)
                     {
@@ -1909,7 +1954,7 @@ namespace System.Diagnostics.Tracing
                                     // mask set to 0x0f so, when all ETW sessions want the event we don't need to 
                                     // synthesize a new one
                                     if (!m_provider.WriteEvent(ref m_eventData[eventId].Descriptor, pActivityId, childActivityID, args))
-                                        ThrowEventSourceException();
+                                        ThrowEventSourceException(m_eventData[eventId].Name);
                                 }
                                 else
                                 {
@@ -1926,7 +1971,7 @@ namespace System.Diagnostics.Tracing
                                         unchecked((long)(ulong)etwSessions | origKwd));
 
                                     if (!m_provider.WriteEvent(ref desc, pActivityId, childActivityID, args))
-                                        ThrowEventSourceException();
+                                        ThrowEventSourceException(m_eventData[eventId].Name);
                                 }
                             }
                             else
@@ -1956,7 +2001,7 @@ namespace System.Diagnostics.Tracing
                         if (!SelfDescribingEvents)
                         {
                             if (!m_provider.WriteEvent(ref m_eventData[eventId].Descriptor, pActivityId, childActivityID, args))
-                                ThrowEventSourceException();
+                                ThrowEventSourceException(m_eventData[eventId].Name);
                         }
                         else
                         {
@@ -2003,7 +2048,7 @@ namespace System.Diagnostics.Tracing
                     if (ex is EventSourceException)
                         throw;
                     else
-                        ThrowEventSourceException(ex);
+                        ThrowEventSourceException(m_eventData[eventId].Name, ex);
                 }
             }
         }
@@ -2027,11 +2072,71 @@ namespace System.Diagnostics.Tracing
             return eventData;
         }
 
+        /// <summary>
+        /// We expect that the arguments to the Event method and the arguments to WriteEvent match. This function 
+        /// checks that they in fact match and logs a warning to the debugger if they don't.
+        /// </summary>
+        /// <param name="infos"></param>
+        /// <param name="args"></param>
+        private void LogEventArgsMismatches(ParameterInfo[] infos, object[] args)
+        {
+            // It would be nice to have this on PCL builds, but it would be pointless since there isn't support for 
+            // writing to the debugger log on PCL.
+            bool typesMatch = args.Length == infos.Length;
+
+            int i = 0;
+            while (typesMatch && i < args.Length)
+            {
+                Type pType = infos[i].ParameterType;
+
+                // Checking to see if the Parameter types (from the Event method) match the supplied argument types.
+                // Fail if one of two things hold : either the argument type is not equal to the parameter type, or the 
+                // argument is null and the parameter type is non-nullable.
+                if ((args[i] != null && (args[i].GetType() != pType))
+                    || (args[i] == null && (!(pType.IsGenericType && pType.GetGenericTypeDefinition() == typeof(Nullable<>))))
+                    )
+                {
+                    typesMatch = false;
+                    break;
+                }
+
+                ++i;
+            }
+
+            if (!typesMatch)
+            {
+                System.Diagnostics.Debugger.Log(0, null, Environment.GetResourceString("EventSource_VarArgsParameterMismatch") + "\r\n");
+            }
+        }
+
+        private int GetParamLengthIncludingByteArray(ParameterInfo[] parameters)
+        {
+            int sum = 0;
+            foreach(ParameterInfo info in parameters)
+            {
+                if(info.ParameterType == typeof(byte[]))
+                {
+                    sum += 2;
+                }
+                else
+                {
+                    sum++;
+                }
+            }
+
+            return sum;
+        }
+
         [SecurityCritical]
         unsafe private void WriteToAllListeners(int eventId, Guid* childActivityID, int eventDataCount, EventSource.EventData* data)
         {
+            // We represent a byte[] as a integer denoting the length  and then a blob of bytes in the data pointer. This causes a spurious
+            // warning because eventDataCount is off by one for the byte[] case since a byte[] has 2 items associated it. So we want to check
+            // that the number of parameters is correct against the byte[] case, but also we the args array would be one too long if
+            // we just used the modifiedParamCount here -- so we need both.
             int paramCount = m_eventData[eventId].Parameters.Length;
-            if (eventDataCount != paramCount)
+            int modifiedParamCount = GetParamLengthIncludingByteArray(m_eventData[eventId].Parameters);
+            if (eventDataCount != modifiedParamCount)
             {
                 ReportOutOfBandMessage(Environment.GetResourceString("EventSource_EventParametersMismatch", eventId, eventDataCount, paramCount), true);
                 paramCount = Math.Min(paramCount, eventDataCount);
@@ -2057,11 +2162,11 @@ namespace System.Diagnostics.Tracing
             eventCallbackArgs.Message = m_eventData[eventId].Message;
             eventCallbackArgs.Payload = new ReadOnlyCollection<object>(args);
 
-            DisptachToAllListeners(eventId, childActivityID, eventCallbackArgs);
+            DispatchToAllListeners(eventId, childActivityID, eventCallbackArgs);
         }
 
         [SecurityCritical]
-        private unsafe void DisptachToAllListeners(int eventId, Guid* childActivityID, EventWrittenEventArgs eventCallbackArgs)
+        private unsafe void DispatchToAllListeners(int eventId, Guid* childActivityID, EventWrittenEventArgs eventCallbackArgs)
         {
             Exception lastThrownException = null;
             for (EventDispatcher dispatcher = m_Dispatchers; dispatcher != null; dispatcher = dispatcher.m_Next)
@@ -2304,9 +2409,9 @@ namespace System.Diagnostics.Tracing
 
         }
         [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
-        private void ThrowEventSourceException(Exception innerEx = null)
+        private void ThrowEventSourceException(string eventName, Exception innerEx = null)
         {
-            // If we fail during ouf of band logging we may end up trying 
+            // If we fail during out of band logging we may end up trying 
             // to throw another EventSourceException, thus hitting a StackOverflowException. 
             // Avoid StackOverflow by making sure we do not recursively call this method.
             if (m_EventSourceExceptionRecurenceCount > 0)
@@ -2315,30 +2420,36 @@ namespace System.Diagnostics.Tracing
             {
                 m_EventSourceExceptionRecurenceCount++;
 
+                string errorPrefix = "EventSourceException";
+                if(eventName != null)
+                {
+                    errorPrefix += " while processing event \"" + eventName + "\"";
+                }
+
                 // 
                 switch (EventProvider.GetLastWriteEventError())
                 {
                     case EventProvider.WriteEventErrorCode.EventTooBig:
-                        ReportOutOfBandMessage("EventSourceException: " + Environment.GetResourceString("EventSource_EventTooBig"), true);
+                        ReportOutOfBandMessage(errorPrefix + ": " + Environment.GetResourceString("EventSource_EventTooBig"), true);
                         if (ThrowOnEventWriteErrors) throw new EventSourceException(Environment.GetResourceString("EventSource_EventTooBig"), innerEx);
                         break;
                     case EventProvider.WriteEventErrorCode.NoFreeBuffers:
-                        ReportOutOfBandMessage("EventSourceException: " + Environment.GetResourceString("EventSource_NoFreeBuffers"), true);
+                        ReportOutOfBandMessage(errorPrefix + ": " + Environment.GetResourceString("EventSource_NoFreeBuffers"), true);
                         if (ThrowOnEventWriteErrors) throw new EventSourceException(Environment.GetResourceString("EventSource_NoFreeBuffers"), innerEx);
                         break;
                     case EventProvider.WriteEventErrorCode.NullInput:
-                        ReportOutOfBandMessage("EventSourceException: " + Environment.GetResourceString("EventSource_NullInput"), true);
+                        ReportOutOfBandMessage(errorPrefix + ": " + Environment.GetResourceString("EventSource_NullInput"), true);
                         if (ThrowOnEventWriteErrors) throw new EventSourceException(Environment.GetResourceString("EventSource_NullInput"), innerEx);
                         break;
                     case EventProvider.WriteEventErrorCode.TooManyArgs:
-                        ReportOutOfBandMessage("EventSourceException: " + Environment.GetResourceString("EventSource_TooManyArgs"), true);
+                        ReportOutOfBandMessage(errorPrefix + ": " + Environment.GetResourceString("EventSource_TooManyArgs"), true);
                         if (ThrowOnEventWriteErrors) throw new EventSourceException(Environment.GetResourceString("EventSource_TooManyArgs"), innerEx);
                         break;
                     default:
                         if (innerEx != null)
-                            ReportOutOfBandMessage("EventSourceException: " + innerEx.GetType() + ":" + innerEx.Message, true);
+                            ReportOutOfBandMessage(errorPrefix + ": " + innerEx.GetType() + ":" + innerEx.Message, true);
                         else
-                            ReportOutOfBandMessage("EventSourceException", true);
+                            ReportOutOfBandMessage(errorPrefix, true);
                         if (ThrowOnEventWriteErrors) throw new EventSourceException(innerEx);
                         break;
                 }
@@ -2349,18 +2460,20 @@ namespace System.Diagnostics.Tracing
             }
         }
 
-        private void ValidateEventOpcodeForTransfer(ref EventMetadata eventData)
+        private void ValidateEventOpcodeForTransfer(ref EventMetadata eventData, string eventName)
         {
             if ((EventOpcode)eventData.Descriptor.Opcode != EventOpcode.Send &&
-                (EventOpcode)eventData.Descriptor.Opcode != EventOpcode.Receive)
+                (EventOpcode)eventData.Descriptor.Opcode != EventOpcode.Receive &&
+                (EventOpcode)eventData.Descriptor.Opcode != EventOpcode.Start)
             {
-                ThrowEventSourceException();
+                ThrowEventSourceException(eventName);
             }
         }
 
         internal static EventOpcode GetOpcodeWithDefault(EventOpcode opcode, string eventName)
         {
-            if (opcode == EventOpcode.Info)
+            if (opcode == EventOpcode.Info && eventName != null)
             {
                 if (eventName.EndsWith(s_ActivityStartSuffix))
                 {
@@ -2408,6 +2521,8 @@ namespace System.Diagnostics.Tracing
             public EventTags Tags;
             public bool EnabledForAnyListener;      // true if any dispatcher has this event turned on
             public bool EnabledForETW;              // is this event on for the OS ETW data dispatcher?
+            
+            public bool HasRelatedActivityID;       // Set if the event method's first parameter is a Guid named 'relatedActivityId'
 #if !FEATURE_ACTIVITYSAMPLING
 #pragma warning disable 0649
 #endif
@@ -2457,8 +2572,13 @@ namespace System.Diagnostics.Tracing
             var commandArgs = new EventCommandEventArgs(command, commandArguments, this, listener, perEventSourceSessionId, etwSessionId, enable, level, matchAnyKeyword);
             lock (EventListener.EventListenersLock)
             {
-                if (m_completelyInited)     // We are fully initialized, do the command 
+                if (m_completelyInited)     
+                {
+                    // After the first command arrive after construction, we are ready to get rid of the deferred commands
+                    this.m_deferredCommands = null;
+                    // We are fully initialized, do the command 
                     DoCommand(commandArgs);
+                }
                 else
                 {
                     // We can't do the command, simply remember it and we do it when we are fully constructed.  
@@ -2603,9 +2723,12 @@ namespace System.Diagnostics.Tracing
                         Contract.Assert(m_eventData != null);
                         m_eventSourceEnabled = true;
                     }
-
+                    
                     this.OnEventCommand(commandArgs);
-
+                    var eventCommandCallback = this.m_eventCommandExecuted;
+                    if (eventCommandCallback != null)
+                        eventCommandCallback(this, commandArgs);
+                    
 #if FEATURE_ACTIVITYSAMPLING
                     if (commandArgs.listener == null && !bSessionEnable && commandArgs.perEventSourceSessionId != -1)
                     {
@@ -2688,8 +2811,11 @@ namespace System.Diagnostics.Tracing
                     // Contract.Assert(enable == true);
                     // Contract.Assert(level == EventLevel.LogAlways);
                     // Contract.Assert(matchAnyKeyword == EventKeywords.None);
-
+                    
                     this.OnEventCommand(commandArgs);
+                    var eventCommandCallback = m_eventCommandExecuted;
+                    if (eventCommandCallback != null)
+                        eventCommandCallback(this, commandArgs);
                 }
 
 #if FEATURE_ACTIVITYSAMPLING
@@ -2976,7 +3102,7 @@ namespace System.Diagnostics.Tracing
                             }
                             success = false;
                             if (ThrowOnEventWriteErrors)
-                                ThrowEventSourceException();
+                                ThrowEventSourceException("SendManifest");
                             break;
                         }
                     }
@@ -3213,7 +3339,7 @@ namespace System.Diagnostics.Tracing
                     manifest.AddKeyword("Session0", (long)0x8000 << 32);
                 }
 
-                if (eventSourceType.Name != "EventSource")
+                if (eventSourceType != typeof(EventSource))
                 {
                     for (int i = 0; i < methods.Length; i++)
                     {
@@ -3222,6 +3348,20 @@ namespace System.Diagnostics.Tracing
 
                         // Get the EventDescriptor (from the Custom attributes)
                         EventAttribute eventAttribute = (EventAttribute)GetCustomAttributeHelper(method, typeof(EventAttribute), flags);
+                        
+                        // Visual Studio online bug #222067 - we can't add a dependency in System.Web on EventSource features that 
+                        // didn't exist in 4.5. We have to manually set the disable flag here since the ActivityOptions 
+                        // falls in to that category.
+                        // 
+                        // The check for <= 3 is to only disable Activity tracking for the RequestStarted and RequestCompleted
+                        // events. 
+                        if (eventAttribute != null
+                            && source != null
+                            && eventAttribute.EventId <= 3
+                            && source.Guid.Equals(AspNetEventSourceGuid))
+                        {
+                            eventAttribute.ActivityOptions |= EventActivityOptions.Disable;
+                        }
 
                         // Compat: until v4.5.1 we ignored any non-void returning methods as well as virtual methods for 
                         // the only reason of limiting the number of methods considered to be events. This broke a common 
@@ -3273,15 +3413,17 @@ namespace System.Diagnostics.Tracing
                         eventId++;
                         string eventName = method.Name;
 
-                        if (!eventAttribute.IsOpcodeSet)
+                        if (eventAttribute.Opcode == EventOpcode.Info)      // We are still using the default opcode. 
                         {
                             // By default pick a task ID derived from the EventID, starting with the highest task number and working back 
                             bool noTask = (eventAttribute.Task == EventTask.None);
-                            if (eventAttribute.Task == EventTask.None)
+                            if (noTask)
                                 eventAttribute.Task = (EventTask)(0xFFFE - eventAttribute.EventId);
 
-                            // pick a default opcode (either Info or start or stop if the name ends with that suffix.  
-                            eventAttribute.Opcode = GetOpcodeWithDefault(EventOpcode.Info, eventName);
+                            // Unless we explicitly set the opcode to Info (to override the auto-generate of Start or Stop opcodes, 
+                            // pick a default opcode based on the event name (either Info or start or stop if the name ends with that suffix).  
+                            if (!eventAttribute.IsOpcodeSet)
+                                eventAttribute.Opcode = GetOpcodeWithDefault(EventOpcode.Info, eventName);
 
                             // Make the stop opcode have the same task as the start opcode.
                             if (noTask)
@@ -3299,7 +3441,7 @@ namespace System.Diagnostics.Tracing
                                 }
                                 else if (eventAttribute.Opcode == EventOpcode.Stop)
                                 {
-                                    // Find the start associated with this stop event.  We require start to be immediately before the stop
+                                    // Find the start associated with this stop event.  We requre start to be immediately before the stop
                                     int startEventId = eventAttribute.EventId - 1;
                                     if (eventData != null && startEventId < eventData.Length)    
                                     {
@@ -3325,7 +3467,7 @@ namespace System.Diagnostics.Tracing
                             }
                         }
 
-                        RemoveFirstArgIfRelatedActivityId(ref args);
+                        bool hasRelatedActivityID = RemoveFirstArgIfRelatedActivityId(ref args);
                         if (!(source != null && source.SelfDescribingEvents))
                         {
                             manifest.StartEvent(eventName, eventAttribute);
@@ -3339,7 +3481,7 @@ namespace System.Diagnostics.Tracing
                         if (source != null || (flags & EventManifestOptions.Strict) != 0)
                         {
                             // Do checking for user errors (optional, but not a big deal so we do it).  
-                            DebugCheckEvent(ref eventsByName, eventData, method, eventAttribute, manifest);
+                            DebugCheckEvent(ref eventsByName, eventData, method, eventAttribute, manifest, flags);
 
 #if FEATURE_MANAGED_ETW_CHANNELS
                             // add the channel keyword for Event Viewer channel based filters. This is added for creating the EventDescriptors only
@@ -3357,7 +3499,7 @@ namespace System.Diagnostics.Tracing
                             // overwrite inline message with the localized message
                             if (msg != null) eventAttribute.Message = msg;
 
-                            AddEventDescriptor(ref eventData, eventName, eventAttribute, args);
+                            AddEventDescriptor(ref eventData, eventName, eventAttribute, args, hasRelatedActivityID);
                         }
                     }
                 }
@@ -3379,7 +3521,7 @@ namespace System.Diagnostics.Tracing
                 {
                     bNeedsManifest = (flags & EventManifestOptions.OnlyIfNeededForRegistration) == 0
 #if FEATURE_MANAGED_ETW_CHANNELS
                                           || manifest.GetChannelData().Length > 0
+ || manifest.GetChannelData().Length > 0
 #endif
 ;
 
@@ -3422,7 +3564,7 @@ namespace System.Diagnostics.Tracing
             return bNeedsManifest ? res : null;
         }
 
-        private static void RemoveFirstArgIfRelatedActivityId(ref ParameterInfo[] args)
+        private static bool RemoveFirstArgIfRelatedActivityId(ref ParameterInfo[] args)
         {
             // If the first parameter is (case insensitive) 'relatedActivityId' then skip it.  
             if (args.Length > 0 && args[0].ParameterType == typeof(Guid) &&
@@ -3431,7 +3573,11 @@ namespace System.Diagnostics.Tracing
                 var newargs = new ParameterInfo[args.Length - 1];
                 Array.Copy(args, 1, newargs, 0, args.Length - 1);
                 args = newargs;
+
+                return true;
             }
+            
+            return false;
         }
 
         // adds a enumeration (keyword, opcode, task or channel) represented by 'staticField'
@@ -3475,7 +3621,8 @@ namespace System.Diagnostics.Tracing
         // with the code:EventAttribute 'eventAttribute'.  resourceManger may be null in which case we populate it
         // it is populated if we need to look up message resources
         private static void AddEventDescriptor(ref EventMetadata[] eventData, string eventName,
-                                EventAttribute eventAttribute, ParameterInfo[] eventParameters)
+                                EventAttribute eventAttribute, ParameterInfo[] eventParameters,
+                                bool hasRelatedActivityID)
         {
             if (eventData == null || eventData.Length <= eventAttribute.EventId)
             {
@@ -3488,7 +3635,7 @@ namespace System.Diagnostics.Tracing
                     eventAttribute.EventId,
                     eventAttribute.Version,
 #if FEATURE_MANAGED_ETW_CHANNELS
                   (byte)eventAttribute.Channel,
+ (byte)eventAttribute.Channel,
 #else
  (byte)0,
 #endif
@@ -3502,6 +3649,7 @@ namespace System.Diagnostics.Tracing
             eventData[eventAttribute.EventId].Parameters = eventParameters;
             eventData[eventAttribute.EventId].Message = eventAttribute.Message;
             eventData[eventAttribute.EventId].ActivityOptions = eventAttribute.ActivityOptions;
+            eventData[eventAttribute.EventId].HasRelatedActivityID = hasRelatedActivityID;
         }
 
         // Helper used by code:CreateManifestAndDescriptors that trims the m_eventData array to the correct
@@ -3541,7 +3689,7 @@ namespace System.Diagnostics.Tracing
         // index for two distinct events etc.  Throws exceptions when it finds something wrong. 
         private static void DebugCheckEvent(ref Dictionary<string, string> eventsByName,
             EventMetadata[] eventData, MethodInfo method, EventAttribute eventAttribute,
-            ManifestBuilder manifest)
+            ManifestBuilder manifest, EventManifestOptions options)
         {
             int evtId = eventAttribute.EventId;
             string evtName = method.Name;
@@ -3568,14 +3716,30 @@ namespace System.Diagnostics.Tracing
                 {
                     manifest.ManifestError(Environment.GetResourceString("EventSource_TaskOpcodePairReused",
                                             evtName, evtId, eventData[idx].Name, idx));
+
+                    // If we are not strict stop on first error.   We have had problems with really large providers taking forever.  because of many errors.  
+                    if ((options & EventManifestOptions.Strict) == 0)
+                        break;
                 }
             }
 
             // for non-default event opcodes the user must define a task!
-            if (eventAttribute.Opcode != EventOpcode.Info &&
-                (eventAttribute.Task == EventTask.None || eventAttribute.Task == (EventTask)(0xFFFE - evtId)))
+            if (eventAttribute.Opcode != EventOpcode.Info)
             {
-                manifest.ManifestError(Environment.GetResourceString("EventSource_EventMustHaveTaskIfNonDefaultOpcode", evtName, evtId));
+                bool failure = false;
+                if (eventAttribute.Task == EventTask.None)
+                    failure = true;
+                else
+                {
+                    // If you have the auto-assigned Task, then you did not explicitly set one.  
+                    // This is OK for Start events because we have special logic to assign the task to a prefix derived from the event name
+                    // But all other cases we want to catch the omission.  
+                    var autoAssignedTask = (EventTask)(0xFFFE - evtId);
+                    if ((eventAttribute.Opcode != EventOpcode.Start && eventAttribute.Opcode != EventOpcode.Stop) && eventAttribute.Task == autoAssignedTask)
+                        failure = true;
+                }
+                if (failure)
+                    manifest.ManifestError(Environment.GetResourceString("EventSource_EventMustHaveTaskIfNonDefaultOpcode", evtName, evtId));
             }
 
             // If we ever want to enforce the rule: MethodName = TaskName + OpcodeName here's how:
@@ -3591,7 +3755,7 @@ namespace System.Diagnostics.Tracing
                 eventsByName = new Dictionary<string, string>();
 
             if (eventsByName.ContainsKey(evtName))
-                manifest.ManifestError(Environment.GetResourceString("EventSource_EventNameReused", evtName));
+                manifest.ManifestError(Environment.GetResourceString("EventSource_EventNameReused", evtName), true);
 
             eventsByName[evtName] = evtName;
         }
@@ -3759,13 +3923,13 @@ namespace System.Diagnostics.Tracing
 #endif
 
                 // Send it to all listeners.
-                if (m_outOfBandMessageCount < 254)     // Note this is only if size byte
+                if (m_outOfBandMessageCount < 16-1)     // Note this is only if size byte
                     m_outOfBandMessageCount++;
                 else
                 {
-                    if (m_outOfBandMessageCount == 255)
+                    if (m_outOfBandMessageCount == 16)
                         return;
-                    m_outOfBandMessageCount = 255;    // Mark that we hit the limit.  Notify them that this is the case. 
+                    m_outOfBandMessageCount = 16;    // Mark that we hit the limit.  Notify them that this is the case. 
                     msg = "Reached message limit.   End of EventSource error messages.";
                 }
 
@@ -3870,6 +4034,8 @@ namespace System.Diagnostics.Tracing
         internal volatile EventMetadata[] m_eventData;  // None per-event data
         private volatile byte[] m_rawManifest;          // Bytes to send out representing the event schema
 
+        private EventHandler<EventCommandEventArgs> m_eventCommandExecuted;
+
         private EventSourceSettings m_config;      // configuration information
 
         // Enabling bits
@@ -3919,6 +4085,10 @@ namespace System.Diagnostics.Tracing
             0x87, 0xF8, 0x1A, 0x15, 0xBF, 0xC1, 0x30, 0xFB,
         };
 
+        // Visual Studio Online 222067 - This is only needed for a compatibility hack. We need to check to see
+        // if an EventSource is the AspNetEventSource to override the ActivityTracking for it. 
+        private static readonly Guid AspNetEventSourceGuid = new Guid("ee799f41-cfa5-550b-bf2c-344747c1c668");
+        
         #endregion
     }
 
@@ -3990,52 +4160,60 @@ namespace System.Diagnostics.Tracing
     /// created.
     /// </para>
     /// </summary>
-    public abstract class EventListener : IDisposable
+    public class EventListener : IDisposable
     {
+        private static readonly object s_EventSourceCreatedLock = new object();
+        
+        private event EventHandler<EventSourceCreatedEventArgs> _EventSourceCreated;
+
         /// <summary>
-        /// Create a new EventListener in which all events start off turned off (use EnableEvents to turn
-        /// them on).  
+        /// This event is raised whenever a new eventSource is 'attached' to the dispatcher.
+        /// This can happen for all existing EventSources when the EventListener is created
+        /// as well as for any EventSources that come into existence after the EventListener
+        /// has been created.
+        /// 
+        /// These 'catch up' events are called during the construction of the EventListener.
+        /// Subclasses need to be prepared for that.
+        /// 
+        /// In a multi-threaded environment, it is possible that 'EventSourceEventWrittenCallback' 
+        /// events for a particular eventSource to occur BEFORE the EventSourceCreatedCallback is issued.
         /// </summary>
-        protected EventListener()
-        {
-            lock (EventListenersLock)
+        public event EventHandler<EventSourceCreatedEventArgs> EventSourceCreated
+        { 
+            add
             {
-                // Disallow creating EventListener reentrancy. 
-                if (s_CreatingListener)
-                    throw new InvalidOperationException(Environment.GetResourceString("EventSource_ListenerCreatedInsideCallback"));
-
-                try
+                lock (s_EventSourceCreatedLock)
                 {
-                    s_CreatingListener = true;
-
-                    // Add to list of listeners in the system, do this BEFORE firing the 'OnEventSourceCreated' so that 
-                    // Those added sources see this listener.
-                    this.m_Next = s_Listeners;
-                    s_Listeners = this;
-
-                    // Find all existing eventSources call OnEventSourceCreated to 'catchup'
-                    // Note that we DO have reentrancy here because 'AddListener' calls out to user code (via OnEventSourceCreated callback) 
-                    // We tolerate this by iterating over a copy of the list here. New event sources will take care of adding listeners themselves
-                    // EventSources are not guaranteed to be added at the end of the s_EventSource list -- We re-use slots when a new source
-                    // is created.
-                    WeakReference[] eventSourcesSnapshot = s_EventSources.ToArray();
-
-                    for (int i = 0; i < eventSourcesSnapshot.Length; i++)
-                    {
-                        WeakReference eventSourceRef = eventSourcesSnapshot[i];
-                        EventSource eventSource = eventSourceRef.Target as EventSource;
-                        if (eventSource != null)
-                            eventSource.AddListener(this); // This will cause the OnEventSourceCreated callback to fire. 
-                    }
+                    CallBackForExistingEventSources(false, value);
 
-                    Validate();
+                    this._EventSourceCreated = (EventHandler<EventSourceCreatedEventArgs>)Delegate.Combine(_EventSourceCreated, value);
                 }
-                finally
+            }
+            remove
+            {
+                lock (s_EventSourceCreatedLock)
                 {
-                    s_CreatingListener = false;
+                    this._EventSourceCreated = (EventHandler<EventSourceCreatedEventArgs>)Delegate.Remove(_EventSourceCreated, value);
                 }
             }
         }
+
+        /// <summary>
+        /// This event is raised whenever an event has been written by a EventSource for which 
+        /// the EventListener has enabled events.  
+        /// </summary>
+        public event EventHandler<EventWrittenEventArgs> EventWritten;
+
+        /// <summary>
+        /// Create a new EventListener in which all events start off turned off (use EnableEvents to turn
+        /// them on).  
+        /// </summary>
+        public EventListener()
+        {
+            // This will cause the OnEventSourceCreated callback to fire. 
+            CallBackForExistingEventSources(true, (obj, args) => args.EventSource.AddListener(this) ); 
+        }
+        
         /// <summary>
         /// Dispose should be called when the EventListener no longer desires 'OnEvent*' callbacks. Because
         /// there is an internal list of strong references to all EventListeners, calling 'Dispose' directly
@@ -4164,12 +4342,31 @@ namespace System.Diagnostics.Tracing
         /// for a particular eventSource to occur BEFORE the OnEventSourceCreated is issued.
         /// </summary>
         /// <param name="eventSource"></param>
-        internal protected virtual void OnEventSourceCreated(EventSource eventSource) { }
+        internal protected virtual void OnEventSourceCreated(EventSource eventSource)
+        {
+            EventHandler<EventSourceCreatedEventArgs> callBack = this._EventSourceCreated;
+            if(callBack != null)
+            {
+                EventSourceCreatedEventArgs args = new EventSourceCreatedEventArgs();
+                args.EventSource = eventSource;
+                callBack(this, args);
+            }
+        }
+        
         /// <summary>
         /// This method is called whenever an event has been written by a EventSource for which 
         /// the EventListener has enabled events.  
         /// </summary>
-        internal protected abstract void OnEventWritten(EventWrittenEventArgs eventData);
+        /// <param name="eventData"></param>
+        internal protected virtual void OnEventWritten(EventWrittenEventArgs eventData)
+        {
+            EventHandler<EventWrittenEventArgs> callBack = this.EventWritten;
+            if (callBack != null)
+            {
+                callBack(this, eventData);
+            }
+        }
+
         /// <summary>
         /// EventSourceIndex is small non-negative integer (suitable for indexing in an array)
         /// identifying EventSource. It is unique per-appdomain. Some EventListeners might find
@@ -4251,11 +4448,14 @@ namespace System.Diagnostics.Tracing
         // See bug 724140 for more
         private static void DisposeOnShutdown(object sender, EventArgs e)
         {
-            foreach (var esRef in s_EventSources)
+            lock(EventListenersLock)
             {
-                EventSource es = esRef.Target as EventSource;
-                if (es != null)
-                    es.Dispose();
+                foreach (var esRef in s_EventSources)
+                {
+                    EventSource es = esRef.Target as EventSource;
+                    if (es != null)
+                        es.Dispose();
+                }
             }
         }
 
@@ -4267,6 +4467,9 @@ namespace System.Diagnostics.Tracing
         /// </summary>
         private static void RemoveReferencesToListenerInEventSources(EventListener listenerToRemove)
         {
+#if !ES_BUILD_STANDALONE
+            Contract.Assert(Monitor.IsEntered(EventListener.EventListenersLock));
+#endif
             // Foreach existing EventSource in the appdomain
             foreach (WeakReference eventSourceRef in s_EventSources)
             {
@@ -4365,6 +4568,55 @@ namespace System.Diagnostics.Tracing
                 return s_EventSources;
             }
         }
+        
+        private void CallBackForExistingEventSources(bool addToListenersList, EventHandler<EventSourceCreatedEventArgs> callback)
+        {
+            lock (EventListenersLock)
+            {
+                // Disallow creating EventListener reentrancy. 
+                if (s_CreatingListener)
+                    throw new InvalidOperationException(Environment.GetResourceString("EventSource_ListenerCreatedInsideCallback"));
+
+                try
+                {
+                    s_CreatingListener = true;
+
+                    if (addToListenersList)
+                    {
+                        // Add to list of listeners in the system, do this BEFORE firing the 'OnEventSourceCreated' so that 
+                        // Those added sources see this listener.
+                        this.m_Next = s_Listeners;
+                        s_Listeners = this;
+                    }
+
+                    // Find all existing eventSources call OnEventSourceCreated to 'catchup'
+                    // Note that we DO have reentrancy here because 'AddListener' calls out to user code (via OnEventSourceCreated callback) 
+                    // We tolerate this by iterating over a copy of the list here. New event sources will take care of adding listeners themselves
+                    // EventSources are not guaranteed to be added at the end of the s_EventSource list -- We re-use slots when a new source
+                    // is created.
+                    WeakReference[] eventSourcesSnapshot = s_EventSources.ToArray();
+
+                    for (int i = 0; i < eventSourcesSnapshot.Length; i++)
+                    {
+                        WeakReference eventSourceRef = eventSourcesSnapshot[i];
+                        EventSource eventSource = eventSourceRef.Target as EventSource;
+                        if (eventSource != null)
+                        {
+                            EventSourceCreatedEventArgs args = new EventSourceCreatedEventArgs();
+                            args.EventSource = eventSource;
+                            callback(this, args);
+                        }
+                    }
+
+                    Validate();
+                }
+                finally
+                {
+                    s_CreatingListener = false;
+                }
+            }
+
+        }
 
         // Instance fields
         internal volatile EventListener m_Next;                         // These form a linked list in s_Listeners
@@ -4469,6 +4721,21 @@ namespace System.Diagnostics.Tracing
         #endregion
     }
 
+    /// <summary>
+    /// EventSourceCreatedEventArgs is passed to <see cref="EventListener.EventSourceCreated"/>
+    /// </summary>
+    public class EventSourceCreatedEventArgs : EventArgs
+    {
+        /// <summary>
+        /// The EventSource that is attaching to the listener.
+        /// </summary>
+        public EventSource EventSource
+        {
+            get;
+            internal set;
+        }
+    }
+
     /// <summary>
     /// EventWrittenEventArgs is passed to the user-provided override for
     /// <see cref="EventListener.OnEventWritten"/> when an event is fired.
@@ -5291,7 +5558,7 @@ namespace System.Diagnostics.Tracing
             }
         }
 
-        #region private
+    #region private
 
         /// <summary>
         /// Creates a new ActivityFilter that is triggered by 'eventId' from 'source' ever
@@ -5460,7 +5727,7 @@ namespace System.Diagnostics.Tracing
 
         ActivityFilter m_next;      // We create a linked list of these
         Action<Guid> m_myActivityDelegate;
-        #endregion
+    #endregion
     };
 
 
@@ -6212,8 +6479,8 @@ namespace System.Diagnostics.Tracing
                 cultures.Add(CultureInfo.CurrentUICulture);
             }
 #if ES_BUILD_STANDALONE
-                var sortedStrings = new List<string>(stringTab.Keys);
-                sortedStrings.Sort();
+            var sortedStrings = new List<string>(stringTab.Keys);
+            sortedStrings.Sort();
 #else
             // DD 947936
             var sortedStrings = new string[stringTab.Keys.Count];
@@ -6264,10 +6531,13 @@ namespace System.Diagnostics.Tracing
 
             stringBuilder.Append(" message=\"$(string.").Append(key).Append(")\"");
             string prevValue;
-            if (stringTab.TryGetValue(key, out prevValue))
+            if (stringTab.TryGetValue(key, out prevValue) && !prevValue.Equals(value))
+            {
                 ManifestError(Environment.GetResourceString("EventSource_DuplicateStringKey", key), true);
-            else
-                stringTab.Add(key, value);
+                return;
+            }
+
+            stringTab[key] = value;
         }
         internal string GetLocalizedMessage(string key, CultureInfo ci, bool etwFormat)
         {
@@ -6331,7 +6601,7 @@ namespace System.Diagnostics.Tracing
                 // rest get names Channel<N>.  This allows users to modify the Manifest if they want more advanced features. 
                 if (channelTab == null)
                     channelTab = new Dictionary<int, ChannelInfo>(4);
-                
+
                 string channelName = channel.ToString();        // For well know channels this is a nice name, otherwise a number 
                 if (EventChannel.Debug < channel)
                     channelName = "Channel" + channelName;      // Add a 'Channel' prefix for numbers.  
index 5e9b986bd7bc2cf44a807d73fc62271aa1e881e0..d5feefac388553eda4eec53ac90133e6e97a62dc 100644 (file)
@@ -416,7 +416,7 @@ namespace System {
                 
 #if !FEATURE_CORECLR
                 // Do security check
-                new FileIOPermission(FileIOPermissionAccess.PathDiscovery, path).Demand();
+                FileIOPermission.QuickDemand(FileIOPermissionAccess.PathDiscovery, path);
 #endif
 
                 return path;
index 45b0322f8ce8292c5e1cac8024ab24eb39e728b0..e2f2f3055e5506bc36f92f97269249c6ea2c7ab4 100644 (file)
@@ -21,7 +21,7 @@ namespace System.Globalization {
     **      Gregorian   1912/01/01  9999/12/31
     **      Taiwan      01/01/01    8088/12/31
     ============================================================================*/
-
+  
 
     [System.Runtime.InteropServices.ComVisible(true)]
     [Serializable] public class TaiwanCalendar: Calendar {
index e318533937add8f2b4d6daf84e59f23d4888e72e..a7a35c642dd72c828c65dae9fbb83ce5fd061bcb 100644 (file)
@@ -79,29 +79,21 @@ namespace System.IO {
         [System.Security.SecurityCritical]  // auto-generated
         internal static String GetDisplayablePath(String path, bool isInvalidPath)
         {
-            
             if (String.IsNullOrEmpty(path))
                 return String.Empty;
 
-            // Is it a fully qualified path?
-            bool isFullyQualified = false;
             if (path.Length < 2)
                 return path;
-            if (Path.IsDirectorySeparator(path[0]) && Path.IsDirectorySeparator(path[1]))
-                isFullyQualified = true;
-            else if (path[1] == Path.VolumeSeparatorChar) {
-                isFullyQualified = true;
-            }
 
-            if (!isFullyQualified && !isInvalidPath)
+            // Return the path as is if we're relative (not fully qualified) and not a bad path
+            if (PathInternal.IsPartiallyQualified(path) && !isInvalidPath)
                 return path;
 
-#if FEATURE_MONO_CAS
             bool safeToReturn = false;
             try {
                 if (!isInvalidPath) {
-#if !FEATURE_CORECLR
-                    new FileIOPermission(FileIOPermissionAccess.PathDiscovery, new String[] { path }, false, false).Demand();
+#if !FEATURE_CORECLR && FEATURE_MONO_CAS
+                    FileIOPermission.QuickDemand(FileIOPermissionAccess.PathDiscovery, path, false, false);
 #endif
                     safeToReturn = true;
                 }
@@ -117,9 +109,7 @@ namespace System.IO {
                 // from Security.Util.StringExpressionSet.CanonicalizePath when ':' is found in the path
                 // beyond string index position 1.  
             }
-#else
-            bool safeToReturn = !isInvalidPath;
-#endif // FEATURE_MONO_CAS
+            
             if (!safeToReturn) {
                 if (Path.IsDirectorySeparator(path[path.Length - 1]))
                     path = Environment.GetResourceString("IO.IO_NoPermissionToDirectoryName");
index 409b35c3772ee94c735d385805ffb816f1b5f1f7..3357589278655c7731f6f5c03311a88d15a26e31 100644 (file)
@@ -382,10 +382,23 @@ namespace System.IO {
                 }
 
                 Contract.Assert(byteBuffer != null, "expected byteBuffer to be non-null");
-                unsafe {
-                    fixed (byte* pBytes = byteBuffer)
-                    fixed (char* pChars = buffer) {
-                        charsRead = m_decoder.GetChars(pBytes + position, numBytes, pChars + index, charsRemaining, false);
+
+                checked { 
+
+                    if (position < 0 || numBytes < 0 || position + numBytes > byteBuffer.Length) {
+                        throw new ArgumentOutOfRangeException("byteCount");
+                    }
+
+                    if (index < 0 || charsRemaining < 0 || index + charsRemaining > buffer.Length) {
+                       throw new ArgumentOutOfRangeException("charsRemaining");
+                    }
+
+                    unsafe {
+                        fixed (byte* pBytes = byteBuffer) {
+                            fixed (char* pChars = buffer) {
+                                charsRead = m_decoder.GetChars(pBytes + position, numBytes, pChars + index, charsRemaining, false);
+                            }
+                        }
                     }
                 }
 
index ad11daa8bdf366fd9380d14b248325d45cc534f1..c6f81955e43a1a1b6225262f35862d9f61e372e1 100644 (file)
@@ -196,7 +196,7 @@ namespace System.IO {
             Contract.Assert(_encoding.GetMaxByteCount(1) <= 16, "_encoding.GetMaxByteCount(1) <= 16)");
             int numBytes = 0;
             fixed(byte * pBytes = _buffer) {
-                numBytes = _encoder.GetBytes(&ch, 1, pBytes, 16, true);
+                numBytes = _encoder.GetBytes(&ch, 1, pBytes, _buffer.Length, true);
             }
             OutStream.Write(_buffer, 0, numBytes);
         }
@@ -371,10 +371,10 @@ namespace System.IO {
 
             if (_largeByteBuffer == null) {
                 _largeByteBuffer = new byte[LargeByteBufferSize];
-                _maxChars = LargeByteBufferSize / _encoding.GetMaxByteCount(1);
+                _maxChars = _largeByteBuffer.Length / _encoding.GetMaxByteCount(1);
             }
 
-            if (len <= LargeByteBufferSize) {
+            if (len <= _largeByteBuffer.Length) {
                 //Contract.Assert(len == _encoding.GetBytes(chars, 0, chars.Length, _largeByteBuffer, 0), "encoding's GetByteCount & GetBytes gave different answers!  encoding type: "+_encoding.GetType().Name);
                 _encoding.GetBytes(value, 0, value.Length, _largeByteBuffer, 0);
                 OutStream.Write(_largeByteBuffer, 0, len);
@@ -393,14 +393,21 @@ namespace System.IO {
                     // Figure out how many chars to process this round.
                     int charCount = (numLeft > _maxChars) ? _maxChars : numLeft;
                     int byteLen;
-                    fixed(char* pChars = value) {
-                        fixed(byte* pBytes = _largeByteBuffer) {
-                            byteLen = _encoder.GetBytes(pChars + charStart, charCount, pBytes, LargeByteBufferSize, charCount == numLeft);
+
+                    checked {
+                        if (charStart < 0 || charCount < 0 || charStart + charCount > value.Length) {
+                            throw new ArgumentOutOfRangeException("charCount");
+                        }
+
+                        fixed(char* pChars = value) {
+                            fixed(byte* pBytes = _largeByteBuffer) {
+                                byteLen = _encoder.GetBytes(pChars + charStart, charCount, pBytes, _largeByteBuffer.Length, charCount == numLeft);
+                            }
                         }
                     }
 #if _DEBUG
                     totalBytes += byteLen;
-                    Contract.Assert (totalBytes <= len && byteLen <= LargeByteBufferSize, "BinaryWriter::Write(String) - More bytes encoded than expected!");
+                    Contract.Assert (totalBytes <= len && byteLen <= _largeByteBuffer.Length, "BinaryWriter::Write(String) - More bytes encoded than expected!");
 #endif
                     OutStream.Write(_largeByteBuffer, 0, byteLen);
                     charStart += charCount;
index da6f5ab57e45afc6f7e50f02af951f214e001202..943e8ff52b939eb70420358c0cd1e163d1cfe18a 100644 (file)
@@ -248,17 +248,25 @@ namespace System.IO {
 
             int count = stackDir.Count;
 
-            if (stackDir.Count != 0)
+            if (stackDir.Count != 0
+#if FEATURE_CAS_POLICY
+                // All demands in full trust domains are no-ops, so skip
+                //
+                // The full path went through validity checks by being passed through FileIOPermissions already.
+                // As a sub string of the full path can't fail the checks if the full path passes.
+                && !CodeAccessSecurityEngine.QuickCheckForAllDemands()
+#endif
+            )
             {
-                String [] securityList = new String[stackDir.Count];
+                String[] securityList = new String[stackDir.Count];
                 stackDir.CopyTo(securityList, 0);
                 for (int j = 0 ; j < securityList.Length; j++)
                     securityList[j] += "\\."; // leaf will never have a slash at the end
 
                 // Security check for all directories not present only.
-#if !FEATURE_PAL  && FEATURE_MACL
+#if !FEATURE_PAL && FEATURE_MACL
                 AccessControlActions control = (dirSecurity == null) ? AccessControlActions.None : AccessControlActions.Change;
-                new FileIOPermission(FileIOPermissionAccess.Write, control, securityList, false, false ).Demand();
+                FileIOPermission.QuickDemand(FileIOPermissionAccess.Write, control, securityList, false, false);
 #else
 #if FEATURE_CORECLR
                 if (checkHost)
@@ -270,7 +278,7 @@ namespace System.IO {
                     }
                 }
 #else
-                new FileIOPermission(FileIOPermissionAccess.Write, securityList, false, false ).Demand();
+                FileIOPermission.QuickDemand(FileIOPermissionAccess.Write, securityList, false, false );
 #endif
 #endif //!FEATURE_PAL  && FEATURE_MACL
             }
@@ -298,8 +306,9 @@ namespace System.IO {
             while (stackDir.Count > 0) {
                 String name = stackDir[stackDir.Count - 1];
                 stackDir.RemoveAt(stackDir.Count - 1);
-                if (name.Length >= Path.MAX_DIRECTORY_PATH)
+                if (PathInternal.IsDirectoryTooLong(name))
                     throw new PathTooLongException(Environment.GetResourceString("IO.PathTooLong"));
+
                 r = Win32Native.CreateDirectory(name, secAttrs);
                 if (!r && (firstError == 0)) {
                     int currentError = Marshal.GetLastWin32Error();
@@ -326,7 +335,7 @@ namespace System.IO {
                                     state.EnsureState();
                                 }
 #else
-                                new FileIOPermission(FileIOPermissionAccess.PathDiscovery, GetDemandDir(name, true)).Demand();
+                                FileIOPermission.QuickDemand(FileIOPermissionAccess.PathDiscovery, GetDemandDir(name, true));
 #endif // FEATURE_CORECLR
                                 errorString = name;
                             }
@@ -1085,49 +1094,88 @@ namespace System.IO {
             return InternalGetCurrentDirectory(false);
         }
 
+        [System.Security.SecuritySafeCritical]
+        [ResourceExposure(ResourceScope.Machine)]
+        [ResourceConsumption(ResourceScope.Machine)]
+        private static string InternalGetCurrentDirectory(bool checkHost)
+        {
+            string currentDirectory = AppContextSwitches.UseLegacyPathHandling ? LegacyGetCurrentDirectory() : NewGetCurrentDirectory();
+            string demandPath = GetDemandDir(currentDirectory, true);
+
+#if FEATURE_CORECLR
+            if (checkHost) 
+            {
+                FileSecurityState state = new FileSecurityState(FileSecurityStateAccess.PathDiscovery, String.Empty, demandPath);
+                state.EnsureState();
+            }
+#else
+            FileIOPermission.QuickDemand(FileIOPermissionAccess.PathDiscovery, demandPath, false, false);
+#endif
+            return currentDirectory;
+        }
+
         [System.Security.SecurityCritical]
         [ResourceExposure(ResourceScope.Machine)]
         [ResourceConsumption(ResourceScope.Machine)]
-        private static String InternalGetCurrentDirectory(bool checkHost)
+        private static string LegacyGetCurrentDirectory()
         {
-            StringBuilder sb = StringBuilderCache.Acquire(Path.MAX_PATH + 1);
+            StringBuilder sb = StringBuilderCache.Acquire(PathInternal.MaxShortPath + 1);
             if (Win32Native.GetCurrentDirectory(sb.Capacity, sb) == 0)
                 __Error.WinIOError();
-            String currentDirectory = sb.ToString();
+            string currentDirectory = sb.ToString();
             // Note that if we have somehow put our command prompt into short
             // file name mode (ie, by running edlin or a DOS grep, etc), then
             // this will return a short file name.
-            if (currentDirectory.IndexOf('~') >= 0) {
+            if (currentDirectory.IndexOf('~') >= 0)
+            {
                 int r = Win32Native.GetLongPathName(currentDirectory, sb, sb.Capacity);
-                if (r == 0 || r >= Path.MAX_PATH) {                    
+                if (r == 0 || r >= PathInternal.MaxShortPath)
+                {
                     int errorCode = Marshal.GetLastWin32Error();
-                    if (r >= Path.MAX_PATH)
+                    if (r >= PathInternal.MaxShortPath)
                         errorCode = Win32Native.ERROR_FILENAME_EXCED_RANGE;
                     if (errorCode != Win32Native.ERROR_FILE_NOT_FOUND &&
                         errorCode != Win32Native.ERROR_PATH_NOT_FOUND &&
                         errorCode != Win32Native.ERROR_INVALID_FUNCTION &&  // by design - enough said.
                         errorCode != Win32Native.ERROR_ACCESS_DENIED)
-                        __Error.WinIOError(errorCode, String.Empty);
+                        __Error.WinIOError(errorCode, string.Empty);
                 }
                 currentDirectory = sb.ToString();
             }
             StringBuilderCache.Release(sb);
-            String demandPath = GetDemandDir(currentDirectory, true);
+            return currentDirectory;
+        }
 
-            
-#if FEATURE_CORECLR
-            if (checkHost) 
+        [System.Security.SecurityCritical]
+        [ResourceExposure(ResourceScope.Machine)]
+        [ResourceConsumption(ResourceScope.Machine)]
+        private static string NewGetCurrentDirectory()
+        {
+            using (StringBuffer buffer = new StringBuffer(PathInternal.MaxShortPath))
             {
-                FileSecurityState state = new FileSecurityState(FileSecurityStateAccess.PathDiscovery, String.Empty, demandPath);
-                state.EnsureState();
+                uint result = 0;
+                while ((result = Win32Native.GetCurrentDirectoryW(buffer.CharCapacity, buffer.GetHandle())) > buffer.CharCapacity)
+                {
+                    // Reported size is greater than the buffer size. Increase the capacity.
+                    // The size returned includes the null only if more space is needed (this case).
+                    buffer.EnsureCharCapacity(result);
+                }
+
+                if (result == 0)
+                {
+                    __Error.WinIOError();
+                }
+
+                buffer.Length = result;
+                if (buffer.Contains('~'))
+                {
+                    return LongPathHelper.GetLongPathName(buffer);
+                }
+
+                return buffer.ToString();
             }
-#else
-            new FileIOPermission( FileIOPermissionAccess.PathDiscovery, new String[] { demandPath }, false, false ).Demand();
-#endif
-            return currentDirectory;
         }
 
-
         #if FEATURE_CORECLR
         [System.Security.SecurityCritical] // auto-generated
         #else
@@ -1136,15 +1184,16 @@ namespace System.IO {
         [ResourceExposure(ResourceScope.Machine)]
         [ResourceConsumption(ResourceScope.Machine)]
         public static void SetCurrentDirectory(String path)
-        {        
+        {
             if (path==null)
                 throw new ArgumentNullException("value");
             if (path.Length==0)
                 throw new ArgumentException(Environment.GetResourceString("Argument_PathEmpty"));
             Contract.EndContractBlock();
-            if (path.Length >= Path.MAX_PATH)
+
+            if (PathInternal.IsPathTooLong(path))
                 throw new PathTooLongException(Environment.GetResourceString("IO.PathTooLong"));
-                
+
             // This will have some large effects on the rest of the runtime
             // and other appdomains in this process.  Demand unmanaged code.
 #pragma warning disable 618
@@ -1174,19 +1223,19 @@ namespace System.IO {
         [System.Security.SecurityCritical]
         [ResourceExposure(ResourceScope.Machine)]
         [ResourceConsumption(ResourceScope.Machine)]
-        internal static void UnsafeMove(String sourceDirName,String destDirName) {
+        internal static void UnsafeMove(String sourceDirName, String destDirName) {
             InternalMove(sourceDirName, destDirName, false);
         }
 
         [System.Security.SecurityCritical]
         [ResourceExposure(ResourceScope.Machine)]
         [ResourceConsumption(ResourceScope.Machine)]
-        private static void InternalMove(String sourceDirName,String destDirName,bool checkHost) {
+        private static void InternalMove(String sourceDirName, String destDirName, bool checkHost) {
             if (sourceDirName==null)
                 throw new ArgumentNullException("sourceDirName");
             if (sourceDirName.Length==0)
                 throw new ArgumentException(Environment.GetResourceString("Argument_EmptyFileName"), "sourceDirName");
-            
+
             if (destDirName==null)
                 throw new ArgumentNullException("destDirName");
             if (destDirName.Length==0)
@@ -1195,16 +1244,16 @@ namespace System.IO {
 
             String fullsourceDirName = Path.GetFullPathInternal(sourceDirName);
             String sourcePath = GetDemandDir(fullsourceDirName, false);
-            
-            if (sourcePath.Length >= Path.MAX_DIRECTORY_PATH)
+
+            if (PathInternal.IsDirectoryTooLong(sourcePath))
                 throw new PathTooLongException(Environment.GetResourceString("IO.PathTooLong"));
 
             String fulldestDirName = Path.GetFullPathInternal(destDirName);
             String destPath = GetDemandDir(fulldestDirName, false);
 
-            if (destPath.Length >= Path.MAX_DIRECTORY_PATH)
+            if (PathInternal.IsDirectoryTooLong(sourcePath))
                 throw new PathTooLongException(Environment.GetResourceString("IO.PathTooLong"));
-            
+
 #if FEATURE_CORECLR
             if (checkHost) {
                 FileSecurityState sourceState = new FileSecurityState(FileSecurityStateAccess.Write | FileSecurityStateAccess.Read, sourceDirName, sourcePath);
@@ -1288,7 +1337,7 @@ namespace System.IO {
             }
 #else
             // Make sure we have write permission to this directory
-            new FileIOPermission(FileIOPermissionAccess.Write, new String[] { demandPath }, false, false ).Demand();
+            FileIOPermission.QuickDemand(FileIOPermissionAccess.Write, demandPath, false, false);
 #endif
 
             // Do not recursively delete through reparse points.  Perhaps in a 
index 5d88346dd312387436ce70db911f7522c5bb1562..4a5d733a5fc3cb7a9298ddc1fc8ceba95b6e136d 100644 (file)
@@ -102,7 +102,7 @@ namespace System.IO {
                 state.EnsureState();
             }
 #else
-            new FileIOPermission(FileIOPermissionAccess.Read, demandDir, false, false ).Demand();
+            FileIOPermission.QuickDemand(FileIOPermissionAccess.Read, demandDir, false, false);
 #endif
 
             FullPath = fullPath;
@@ -130,7 +130,7 @@ namespace System.IO {
         {
 #if !FEATURE_CORECLR
             demandDir = new String[] {Directory.GetDemandDir(FullPath, true)};
-            new FileIOPermission(FileIOPermissionAccess.Read, demandDir, false, false ).Demand();
+            FileIOPermission.QuickDemand(FileIOPermissionAccess.Read, demandDir, false, false );
 #endif
             DisplayPath = GetDisplayName(OriginalPath, FullPath);
         }
@@ -169,7 +169,7 @@ namespace System.IO {
                 FileSecurityState state = new FileSecurityState(FileSecurityStateAccess.PathDiscovery | FileSecurityStateAccess.Read, String.Empty, dir.demandDir[0]);
                 state.EnsureState();
 #else
-                new FileIOPermission(FileIOPermissionAccess.PathDiscovery | FileIOPermissionAccess.Read, dir.demandDir, false, false).Demand();
+                FileIOPermission.QuickDemand(FileIOPermissionAccess.PathDiscovery | FileIOPermissionAccess.Read, dir.demandDir, false, false);
 #endif
                 return dir;
             }
@@ -234,7 +234,7 @@ namespace System.IO {
             FileSecurityState state = new FileSecurityState(FileSecurityStateAccess.Write, OriginalPath, demandDirForCreation);
             state.EnsureState();
 #else
-            new FileIOPermission(FileIOPermissionAccess.Write, new String[] { demandDirForCreation }, false, false).Demand();
+            FileIOPermission.QuickDemand(FileIOPermissionAccess.Write, demandDirForCreation, false, false);
 #endif
 
             Directory.InternalCreateDirectory(fullPath, path, directorySecurity);
@@ -609,7 +609,7 @@ namespace System.IO {
                 FileSecurityState sourceState = new FileSecurityState(FileSecurityStateAccess.PathDiscovery, String.Empty, demandPath);
                 sourceState.EnsureState();
 #else
-                new FileIOPermission(FileIOPermissionAccess.PathDiscovery, new String[] { demandPath }, false, false).Demand();
+                FileIOPermission.QuickDemand(FileIOPermissionAccess.PathDiscovery, demandPath, false, false);
 #endif
                 return new DirectoryInfo(rootPath);
             }
@@ -629,7 +629,7 @@ namespace System.IO {
             FileSecurityState sourceState = new FileSecurityState(FileSecurityStateAccess.Write | FileSecurityStateAccess.Read, DisplayPath, Directory.GetDemandDir(FullPath, true));
             sourceState.EnsureState();
 #else
-            new FileIOPermission(FileIOPermissionAccess.Write | FileIOPermissionAccess.Read, demandDir, false, false).Demand();
+            FileIOPermission.QuickDemand(FileIOPermissionAccess.Write | FileIOPermissionAccess.Read, demandDir, false, false);
 #endif
             String fullDestDirName = Path.GetFullPathInternal(destDirName);
             String demandPath;
@@ -648,9 +648,9 @@ namespace System.IO {
             FileSecurityState destState = new FileSecurityState(FileSecurityStateAccess.Write, destDirName, demandPath);
             destState.EnsureState();
 #else
-            new FileIOPermission(FileIOPermissionAccess.Write | FileIOPermissionAccess.Read, demandPath).Demand();
+            FileIOPermission.QuickDemand(FileIOPermissionAccess.Write | FileIOPermissionAccess.Read, demandPath);
 #endif
-            
+
             String fullSourcePath;
             if (FullPath.EndsWith(Path.DirectorySeparatorChar))
                 fullSourcePath = FullPath;
index d8a7146e01a3d267e204fdd6ba768ab31ebea7fd..8a36be7ee78a0cb577230549a239d4f1238eb177 100644 (file)
@@ -1322,10 +1322,23 @@ namespace System.IO {
             destState.EnsureState();
             backupState.EnsureState();
 #else
-            FileIOPermission perm = new FileIOPermission(FileIOPermissionAccess.Read | FileIOPermissionAccess.Write, new String[] { fullSrcPath, fullDestPath});
-            if (destinationBackupFileName != null)
-                perm.AddPathList(FileIOPermissionAccess.Write, fullBackupPath);
-            perm.Demand();
+#if FEATURE_CAS_POLICY
+            // All demands in full trust domains are no-ops, just do additional checks
+            if (CodeAccessSecurityEngine.QuickCheckForAllDemands())
+            {
+                FileIOPermission.EmulateFileIOPermissionChecks(fullSrcPath);
+                FileIOPermission.EmulateFileIOPermissionChecks(fullDestPath);
+                if (fullBackupPath != null)
+                    FileIOPermission.EmulateFileIOPermissionChecks(fullBackupPath);
+            }
+            else
+#endif
+            {
+                FileIOPermission perm = new FileIOPermission(FileIOPermissionAccess.Read | FileIOPermissionAccess.Write, new String[] { fullSrcPath, fullDestPath });
+                if (fullBackupPath != null)
+                    perm.AddPathList(FileIOPermissionAccess.Write, fullBackupPath);
+                perm.Demand();
+            }
 #endif
 
             int flags = Win32Native.REPLACEFILE_WRITE_THROUGH;
index f3da2cbd41494aebb6df942f558eec330533cadb..2402d9d2bdec1d287f5612c413bc2c3f101c9b46 100644 (file)
@@ -132,7 +132,7 @@ namespace System.IO {
         {
 #if FEATURE_MONO_CAS
 #if !FEATURE_CORECLR
-            new FileIOPermission(FileIOPermissionAccess.Read, new String[] { FullPath }, false, false).Demand();
+            FileIOPermission.QuickDemand(FileIOPermissionAccess.Read, FullPath, false, false);
 #endif
 #endif
             _name = Path.GetFileName(OriginalPath);
@@ -192,7 +192,7 @@ namespace System.IO {
                     FileSecurityState state = new FileSecurityState(FileSecurityStateAccess.Read, DisplayPath, FullPath);
                     state.EnsureState();
 #else
-                    new FileIOPermission(FileIOPermissionAccess.PathDiscovery, new String[] { directoryName }, false, false).Demand();
+                    FileIOPermission.QuickDemand(FileIOPermissionAccess.PathDiscovery, directoryName, false, false);
 #endif
 #endif
                 }
@@ -344,7 +344,7 @@ namespace System.IO {
             state.EnsureState();
 #else
             // For security check, path should be resolved to an absolute path.
-            new FileIOPermission(FileIOPermissionAccess.Write, new String[] { FullPath }, false, false).Demand();
+            FileIOPermission.QuickDemand(FileIOPermissionAccess.Write, FullPath, false, false);
 #endif
 #endif
 
@@ -483,7 +483,7 @@ namespace System.IO {
             sourceState.EnsureState();
             destState.EnsureState();
 #else
-            new FileIOPermission(FileIOPermissionAccess.Write | FileIOPermissionAccess.Read, new String[] { FullPath }, false, false).Demand();
+            FileIOPermission.QuickDemand(FileIOPermissionAccess.Write | FileIOPermissionAccess.Read, FullPath, false, false);
             FileIOPermission.QuickDemand(FileIOPermissionAccess.Write, fullDestFileName, false, false);
 #endif
 #endif
index 38b86735241ea07f3ab33268fed4980d92d915dd..7e47b8bedeccb5022eb808e71cc10b40a7e730eb 100644 (file)
@@ -708,29 +708,26 @@ namespace System.IO {
             // Get absolute path - Security needs this to prevent something
             // like trying to create a file in c:\tmp with the name 
             // "..\WinNT\System32\ntoskrnl.exe".  Store it for user convenience.
-            int maxPath = useLongPath ? Path.MaxLongPath : Path.MaxPath;
-            String filePath = Path.NormalizePath(path, true, maxPath);
+            int maxPath = useLongPath
+                ? PathInternal.MaxLongPath 
+                : AppContextSwitches.BlockLongPaths ? PathInternal.MaxShortPath : PathInternal.MaxLongPath;
+
+            string filePath = Path.NormalizePath(path, true, maxPath);
 
             _fileName = filePath;
 
             // Prevent access to your disk drives as raw block devices.
-            if (filePath.StartsWith("\\\\.\\", StringComparison.Ordinal))
+            //
+            // We'll allow if in full trust and not in legacy mode. You can also get device access via \\?\ and \??\ so there isn't
+            // much point in making users jump through these hoops. Blocking is pointless in full trust as well.
+            if (
+#if FEATURE_CAS_POLICY
+                (!CodeAccessSecurityEngine.QuickCheckForAllDemands() || AppContextSwitches.UseLegacyPathHandling)
+                &&
+#endif
+                filePath.StartsWith("\\\\.\\", StringComparison.Ordinal))
                 throw new ArgumentException(Environment.GetResourceString("Arg_DevicesNotSupported"));
 
-            // In 4.0, we always construct a FileIOPermission object below. 
-            // If filePath contained a ':', we would throw a NotSupportedException in 
-            // System.Security.Util.StringExpressionSet.CanonicalizePath. 
-            // If filePath contained other illegal characters, we would throw an ArgumentException in 
-            // FileIOPermission.CheckIllegalCharacters.
-            // In 4.5 we on longer construct the FileIOPermission object in full trust.
-            // To preserve the 4.0 behavior we do an explicit check for ':' here and also call Path.CheckInvalidPathChars.
-            // Note that we need to call CheckInvalidPathChars before checking for ':' because that is what FileIOPermission does.
-
-            Path.CheckInvalidPathChars(filePath, true);
-
-            if (filePath.IndexOf( ':', 2 ) != -1)
-                throw new NotSupportedException( Environment.GetResourceString( "Argument_PathFormatNotSupported" ) );
-
             bool read = false;
 
 #if FEATURE_MACL
@@ -747,7 +744,12 @@ namespace System.IO {
 
             // All demands in full trust domains are no-ops, so skip 
 #if FEATURE_CAS_POLICY
-            if (!CodeAccessSecurityEngine.QuickCheckForAllDemands()) 
+            if (CodeAccessSecurityEngine.QuickCheckForAllDemands())
+            {
+                // Need to throw the same exceptions that are thrown if we actually called QuickDemand() below.
+                FileIOPermission.EmulateFileIOPermissionChecks(filePath);
+            }
+            else
 #endif // FEATURE_CAS_POLICY
             {
                 // Build up security permissions required, as well as validate we
@@ -796,7 +798,7 @@ namespace System.IO {
                 }
                 
                 AccessControlActions control = specifiedAcl ? AccessControlActions.Change : AccessControlActions.None;
-                new FileIOPermission(secAccess, control, new String[] { filePath }, false, false).Demand();
+                FileIOPermission.QuickDemand(secAccess, control, new String[] { filePath }, false, false);
 #else
 #if FEATURE_CORECLR
                 if (checkHost) {
@@ -804,7 +806,7 @@ namespace System.IO {
                     state.EnsureState();
                 }
 #else
-                new FileIOPermission(secAccess, new String[] { filePath }, false, false).Demand();
+                FileIOPermission.QuickDemand(secAccess, filePath, false, false);
 #endif // FEATURE_CORECLR
 #endif
             }
@@ -867,7 +869,7 @@ namespace System.IO {
                     {
                         try {
 #if !FEATURE_CORECLR
-                            new FileIOPermission(FileIOPermissionAccess.PathDiscovery, new String[] { _fileName }, false, false ).Demand();
+                            FileIOPermission.QuickDemand(FileIOPermissionAccess.PathDiscovery, _fileName, false, false);
 #endif
                             canGiveFullPath = true;
                         }
@@ -1202,7 +1204,7 @@ namespace System.IO {
                 FileSecurityState sourceState = new FileSecurityState(FileSecurityStateAccess.PathDiscovery, String.Empty, _fileName);
                 sourceState.EnsureState();
 #else
-                new FileIOPermission(FileIOPermissionAccess.PathDiscovery, new String[] { _fileName }, false, false).Demand();
+                FileIOPermission.QuickDemand(FileIOPermissionAccess.PathDiscovery, _fileName, false, false);
 #endif
                 return _fileName;
             }
index ec69c33afb79d268bba6260634198d43464baa46..5acaf13e86d9a81336efeec78f3a130adb6d543f 100644 (file)
@@ -234,7 +234,7 @@ namespace System.IO
                     state2.EnsureState();
                 }
 #else
-                new FileIOPermission(FileIOPermissionAccess.PathDiscovery, demandPaths, false, false).Demand();
+                FileIOPermission.QuickDemand(FileIOPermissionAccess.PathDiscovery, demandPaths, false, false);
 #endif
 
                 // normalize search criteria
@@ -340,7 +340,7 @@ namespace System.IO
                     state2.EnsureState();
                 }
 #else
-                new FileIOPermission(FileIOPermissionAccess.PathDiscovery, demandPaths, false, false).Demand();
+                FileIOPermission.QuickDemand(FileIOPermissionAccess.PathDiscovery, demandPaths, false, false);
 #endif
                 searchData = new Directory.SearchData(normalizedSearchPath, userPath, searchOption);
                 CommonInit();
@@ -591,8 +591,7 @@ namespace System.IO
             }
 #else
             String demandDir = Directory.GetDemandDir(fullPathToDemand, true);
-            String[] demandPaths = new String[] { demandDir };
-            new FileIOPermission(FileIOPermissionAccess.PathDiscovery, demandPaths, false, false).Demand();
+            FileIOPermission.QuickDemand(FileIOPermissionAccess.PathDiscovery, demandDir, false, false);
 #endif
         }
 
@@ -706,8 +705,7 @@ namespace System.IO
             FileSecurityState state = new FileSecurityState(FileSecurityStateAccess.Read, String.Empty, name);
             state.EnsureState();
 #else
-            String[] names = new String[] { name };
-            new FileIOPermission(FileIOPermissionAccess.Read, names, false, false).Demand();
+            FileIOPermission.QuickDemand(FileIOPermissionAccess.Read, name, false, false);
 #endif
             FileInfo fi = new FileInfo(name, false);
             fi.InitializeFrom(result.FindData);
@@ -733,8 +731,7 @@ namespace System.IO
             FileSecurityState state = new FileSecurityState(FileSecurityStateAccess.Read, String.Empty, permissionName);
             state.EnsureState();
 #else
-            String[] permissionNames = new String[] { permissionName };
-            new FileIOPermission(FileIOPermissionAccess.Read, permissionNames, false, false).Demand();
+            FileIOPermission.QuickDemand(FileIOPermissionAccess.Read, permissionName, false, false);
 #endif
             DirectoryInfo di = new DirectoryInfo(name, false);
             di.InitializeFrom(result.FindData);
@@ -770,8 +767,7 @@ namespace System.IO
                 FileSecurityState state = new FileSecurityState(FileSecurityStateAccess.Read, String.Empty, permissionName);
                 state.EnsureState();
 #else
-                String[] permissionNames = new String[] { permissionName };
-                new FileIOPermission(FileIOPermissionAccess.Read, permissionNames, false, false).Demand();
+                FileIOPermission.QuickDemand(FileIOPermissionAccess.Read, permissionName, false, false);
 #endif
                 DirectoryInfo di = new DirectoryInfo(name, false);
                 di.InitializeFrom(result.FindData);
@@ -786,8 +782,7 @@ namespace System.IO
                 FileSecurityState state = new FileSecurityState(FileSecurityStateAccess.Read, String.Empty, name);
                 state.EnsureState();
 #else
-                String[] names = new String[] { name };
-                new FileIOPermission(FileIOPermissionAccess.Read, names, false, false).Demand();
+                FileIOPermission.QuickDemand(FileIOPermissionAccess.Read, name, false, false);
 #endif
                 FileInfo fi = new FileInfo(name, false);
                 fi.InitializeFrom(result.FindData);
index c551e66159a62169796f281e8db3d27737838e1c..cf65efb2cf0e341e6f15f35d0b2f6dd804f88afd 100644 (file)
@@ -107,7 +107,7 @@ namespace System.IO {
                 FileSecurityState sourceState = new FileSecurityState(FileSecurityStateAccess.PathDiscovery, String.Empty, demandDir);
                 sourceState.EnsureState();
 #else
-                new FileIOPermission(FileIOPermissionAccess.PathDiscovery, demandDir).Demand();
+                FileIOPermission.QuickDemand(FileIOPermissionAccess.PathDiscovery, demandDir);
 #endif
 #endif
                 return FullPath;
@@ -126,7 +126,7 @@ namespace System.IO {
                     demandDir = FullPath;
 #if FEATURE_MONO_CAS
 #if !FEATURE_CORECLR
-                new FileIOPermission(FileIOPermissionAccess.PathDiscovery, demandDir).Demand();
+                FileIOPermission.QuickDemand(FileIOPermissionAccess.PathDiscovery, demandDir);
 #endif
 #endif
                 return FullPath;
@@ -353,7 +353,7 @@ namespace System.IO {
             set {
 #if FEATURE_MONO_CAS
 #if !FEATURE_CORECLR
-                new FileIOPermission(FileIOPermissionAccess.Write, FullPath).Demand();
+                FileIOPermission.QuickDemand(FileIOPermissionAccess.Write, FullPath);
 #endif
 #endif
 #if MONO
@@ -386,7 +386,7 @@ namespace System.IO {
         {
 #if FEATURE_MONO_CAS
 #if !FEATURE_CORECLR
-            new FileIOPermission(FileIOPermissionAccess.PathDiscovery, FullPath).Demand();
+            FileIOPermission.QuickDemand(FileIOPermissionAccess.PathDiscovery, FullPath);
 #endif
 #endif
 
index 2240ba9e1abb97fb7a6e1899c9c3aac2f76d3584..7b863b95c8dd326a302972e3d39f947d96bf37b4 100644 (file)
@@ -195,9 +195,9 @@ namespace System.IO {
             Contract.Requires(destFileName.Length > 0);
 
             String fullSourceFileName = LongPath.NormalizePath(sourceFileName);
-            new FileIOPermission(FileIOPermissionAccess.Read, new String[] { fullSourceFileName }, false, false).Demand();
+            FileIOPermission.QuickDemand(FileIOPermissionAccess.Read, fullSourceFileName, false, false);
             String fullDestFileName = LongPath.NormalizePath(destFileName);
-            new FileIOPermission(FileIOPermissionAccess.Write, new String[] { fullDestFileName }, false, false).Demand();
+            FileIOPermission.QuickDemand(FileIOPermissionAccess.Write, fullDestFileName, false, false);
 
             InternalCopy(fullSourceFileName, fullDestFileName, sourceFileName, destFileName, overwrite);
         }
@@ -258,7 +258,7 @@ namespace System.IO {
             String fullPath = LongPath.NormalizePath(path);
 
             // For security check, path should be resolved to an absolute path.
-            new FileIOPermission(FileIOPermissionAccess.Write, new String[] { fullPath }, false, false ).Demand();
+            FileIOPermission.QuickDemand(FileIOPermissionAccess.Write, fullPath, false, false);
 
             String tempPath = Path.AddLongPathPrefix(fullPath);
             bool r = Win32Native.DeleteFile(tempPath);
@@ -297,8 +297,8 @@ namespace System.IO {
                 if (path.Length > 0 && Path.IsDirectorySeparator(path[path.Length - 1])) {
                     return false;
                 }
-                    
-                new FileIOPermission(FileIOPermissionAccess.Read, new String[] { path }, false, false ).Demand();
+
+                FileIOPermission.QuickDemand(FileIOPermissionAccess.Read, path, false, false );
 
                 return InternalExists(path);
             }
@@ -326,7 +326,7 @@ namespace System.IO {
             Contract.Requires(path != null);
 
             String fullPath = LongPath.NormalizePath(path);
-            new FileIOPermission(FileIOPermissionAccess.Read, new String[] { fullPath }, false, false ).Demand();
+            FileIOPermission.QuickDemand(FileIOPermissionAccess.Read, fullPath, false, false);
 
             String tempPath = Path.AddLongPathPrefix(fullPath);
 
@@ -348,7 +348,7 @@ namespace System.IO {
             Contract.Requires(path != null);
 
             String fullPath = LongPath.NormalizePath(path);
-            new FileIOPermission(FileIOPermissionAccess.Read, new String[] { fullPath }, false, false ).Demand();
+            FileIOPermission.QuickDemand(FileIOPermissionAccess.Read, fullPath, false, false);
 
             String tempPath = Path.AddLongPathPrefix(fullPath);
             Win32Native.WIN32_FILE_ATTRIBUTE_DATA data = new Win32Native.WIN32_FILE_ATTRIBUTE_DATA();
@@ -369,7 +369,7 @@ namespace System.IO {
             Contract.Requires(path != null);
 
             String fullPath = LongPath.NormalizePath(path);
-            new FileIOPermission(FileIOPermissionAccess.Read, new String[] { fullPath }, false, false ).Demand();
+            FileIOPermission.QuickDemand(FileIOPermissionAccess.Read, fullPath, false, false);
 
             String tempPath = Path.AddLongPathPrefix(fullPath);
             Win32Native.WIN32_FILE_ATTRIBUTE_DATA data = new Win32Native.WIN32_FILE_ATTRIBUTE_DATA();
@@ -400,9 +400,9 @@ namespace System.IO {
             Contract.Requires(destFileName.Length > 0);
 
             String fullSourceFileName = LongPath.NormalizePath(sourceFileName);
-            new FileIOPermission(FileIOPermissionAccess.Write | FileIOPermissionAccess.Read, new String[] { fullSourceFileName }, false, false).Demand();
+            FileIOPermission.QuickDemand(FileIOPermissionAccess.Write | FileIOPermissionAccess.Read, fullSourceFileName, false, false);
             String fullDestFileName = LongPath.NormalizePath(destFileName);
-            new FileIOPermission(FileIOPermissionAccess.Write, new String[] { fullDestFileName }, false, false).Demand();
+            FileIOPermission.QuickDemand(FileIOPermissionAccess.Write, fullDestFileName, false, false);
 
             if (!LongPathFile.InternalExists(fullSourceFileName))
                 __Error.WinIOError(Win32Native.ERROR_FILE_NOT_FOUND, fullSourceFileName);
@@ -423,7 +423,7 @@ namespace System.IO {
             Contract.Requires(path != null);
 
             String fullPath = LongPath.NormalizePath(path);
-            new FileIOPermission(FileIOPermissionAccess.Read, new String[] { fullPath }, false, false ).Demand();
+            FileIOPermission.QuickDemand(FileIOPermissionAccess.Read, fullPath, false, false);
 
             String tempPath = Path.AddLongPathPrefix(fullPath);
             Win32Native.WIN32_FILE_ATTRIBUTE_DATA data = new Win32Native.WIN32_FILE_ATTRIBUTE_DATA();
@@ -435,7 +435,6 @@ namespace System.IO {
                 __Error.WinIOError(Win32Native.ERROR_FILE_NOT_FOUND, path);
 
             return ((long)data.fileSizeHigh) << 32 | ((long)data.fileSizeLow & 0xFFFFFFFFL);
-            
         }
 
          // Defined in WinError.h
@@ -460,7 +459,7 @@ namespace System.IO {
             // We attempt to create directories only after all the security checks have passed. This is avoid doing
             // a demand at every level.
             String demandDir = GetDemandDir(fullPath, true);
-            new FileIOPermission(FileIOPermissionAccess.Read, new String[] { demandDir }, false, false).Demand();
+            FileIOPermission.QuickDemand(FileIOPermissionAccess.Read, demandDir, false, false);
 
             InternalCreateDirectory(fullPath, path, null);
         }
@@ -514,7 +513,15 @@ namespace System.IO {
 
             int count = stackDir.Count;
 
-            if (stackDir.Count != 0)
+            if (stackDir.Count != 0
+#if FEATURE_CAS_POLICY
+                // All demands in full trust domains are no-ops, so skip
+                //
+                // The full path went through validity checks by being passed through FileIOPermissions already.
+                // As a sub string of the full path can't fail the checks if the full path passes.
+                && !CodeAccessSecurityEngine.QuickCheckForAllDemands()
+#endif
+            )
             {
                 String[] securityList = new String[stackDir.Count];
                 stackDir.CopyTo(securityList, 0);
@@ -524,9 +531,9 @@ namespace System.IO {
                 // Security check for all directories not present only.
 #if !FEATURE_PAL  && FEATURE_MACL
                 AccessControlActions control = (dirSecurity == null) ? AccessControlActions.None : AccessControlActions.Change;
-                new FileIOPermission(FileIOPermissionAccess.Write, control, securityList, false, false ).Demand();
+                FileIOPermission.QuickDemand(FileIOPermissionAccess.Write, control, securityList, false, false);
 #else
-                new FileIOPermission(FileIOPermissionAccess.Write, securityList, false, false).Demand();
+                FileIOPermission.QuickDemand(FileIOPermissionAccess.Write, securityList, false, false);
 #endif
             }
 
@@ -554,9 +561,11 @@ namespace System.IO {
             {
                 String name = stackDir[stackDir.Count - 1];
                 stackDir.RemoveAt(stackDir.Count - 1);
+
                 if (name.Length >= Path.MaxLongPath)
                     throw new PathTooLongException(Environment.GetResourceString("IO.PathTooLong"));
-                r = Win32Native.CreateDirectory(Path.AddLongPathPrefix(name), secAttrs);
+
+                r = Win32Native.CreateDirectory(PathInternal.EnsureExtendedPrefix(name), secAttrs);
                 if (!r && (firstError == 0))
                 {
                     int currentError = Marshal.GetLastWin32Error();
@@ -579,7 +588,7 @@ namespace System.IO {
                             // Give the user a nice error message, but don't leak path information.
                             try
                             {
-                                new FileIOPermission(FileIOPermissionAccess.PathDiscovery, new String[] { GetDemandDir(name, true) }, false, false).Demand();
+                                FileIOPermission.QuickDemand(FileIOPermissionAccess.PathDiscovery, GetDemandDir(name, true), false, false);
                                 errorString = name;
                             }
                             catch (SecurityException) { }
@@ -631,8 +640,8 @@ namespace System.IO {
             if (destPath.Length >= Path.MaxLongPath)
                 throw new PathTooLongException(Environment.GetResourceString("IO.PathTooLong"));
 
-            new FileIOPermission(FileIOPermissionAccess.Write | FileIOPermissionAccess.Read, new String[] { sourcePath }, false, false).Demand();
-            new FileIOPermission(FileIOPermissionAccess.Write, new String[] { destPath }, false, false).Demand();
+            FileIOPermission.QuickDemand(FileIOPermissionAccess.Write | FileIOPermissionAccess.Read, sourcePath, false, false);
+            FileIOPermission.QuickDemand(FileIOPermissionAccess.Write, destPath, false, false);
 
             if (String.Compare(sourcePath, destPath, StringComparison.OrdinalIgnoreCase) == 0)
                 throw new IOException(Environment.GetResourceString("IO.IO_SourceDestMustBeDifferent"));
@@ -643,8 +652,8 @@ namespace System.IO {
                 throw new IOException(Environment.GetResourceString("IO.IO_SourceDestMustHaveSameRoot"));
 
 
-            String tempSourceDirName = Path.AddLongPathPrefix(sourceDirName);
-            String tempDestDirName = Path.AddLongPathPrefix(destDirName);
+            String tempSourceDirName = PathInternal.EnsureExtendedPrefix(sourceDirName);
+            String tempDestDirName = PathInternal.EnsureExtendedPrefix(destDirName);
 
             if (!Win32Native.MoveFile(tempSourceDirName, tempDestDirName))
             {
@@ -683,7 +692,7 @@ namespace System.IO {
             demandPath = GetDemandDir(fullPath, !recursive);
 
             // Make sure we have write permission to this directory
-            new FileIOPermission(FileIOPermissionAccess.Write, new String[] { demandPath }, false, false).Demand();
+            FileIOPermission.QuickDemand(FileIOPermissionAccess.Write, demandPath, false, false);
 
             String longPath = Path.AddLongPathPrefix(fullPath);
             // Do not recursively delete through reparse points.  Perhaps in a 
@@ -904,7 +913,7 @@ namespace System.IO {
                 String fullPath = LongPath.NormalizePath(path);
                 String demandPath = GetDemandDir(fullPath, true);
 
-                new FileIOPermission(FileIOPermissionAccess.Read, new String[] { demandPath }, false, false).Demand();
+                FileIOPermission.QuickDemand(FileIOPermissionAccess.Read, demandPath, false, false);
 
                 return InternalExists(fullPath);
             }
index b4cb0ab7e360fe5d4493b767bfbb52be9ae1badb..3927d52da071c1f65fab9cde64c20dc95fcdf249 100644 (file)
@@ -55,19 +55,19 @@ namespace System.IO {
         // 
         public static readonly char DirectorySeparatorChar = '\\';
         internal const string DirectorySeparatorCharAsString = "\\";
-        
+
         // Platform specific alternate directory separator character.  
         // This is backslash ('\') on Unix, and slash ('/') on Windows 
         // and MacOS.
         // 
         public static readonly char AltDirectorySeparatorChar = '/';
-    
+
         // Platform specific volume separator character.  This is colon (':')
         // on Windows and MacOS, and slash ('/') on Unix.  This is mostly
-        // useful for parsing paths like "c:\windows" or "MacVolume:System Folder".  
+        // useful for parsing paths like "c:\windows" or "MacVolume:System Folder".
         // 
         public static readonly char VolumeSeparatorChar = ':';
-        
+
         // Platform specific invalid list of characters in a path.
         // See the "Naming a File" MSDN conceptual docs for more details on
         // what is valid in a file name (which is slightly different from what
@@ -77,10 +77,10 @@ namespace System.IO {
         public static readonly char[] InvalidPathChars = { '\"', '<', '>', '|', '\0', (Char)1, (Char)2, (Char)3, (Char)4, (Char)5, (Char)6, (Char)7, (Char)8, (Char)9, (Char)10, (Char)11, (Char)12, (Char)13, (Char)14, (Char)15, (Char)16, (Char)17, (Char)18, (Char)19, (Char)20, (Char)21, (Char)22, (Char)23, (Char)24, (Char)25, (Char)26, (Char)27, (Char)28, (Char)29, (Char)30, (Char)31 };
 
         // Trim trailing white spaces, tabs etc but don't be aggressive in removing everything that has UnicodeCategory of trailing space.
-        // String.WhitespaceChars will trim aggressively than what the underlying FS does (for ex, NTFS, FAT).    
-        internal static readonly char[] TrimEndChars = { (char) 0x9, (char) 0xA, (char) 0xB, (char) 0xC, (char) 0xD, (char) 0x20,   (char) 0x85, (char) 0xA0};
-        
-        private static readonly char[] RealInvalidPathChars = { '\"', '<', '>', '|', '\0', (Char)1, (Char)2, (Char)3, (Char)4, (Char)5, (Char)6, (Char)7, (Char)8, (Char)9, (Char)10, (Char)11, (Char)12, (Char)13, (Char)14, (Char)15, (Char)16, (Char)17, (Char)18, (Char)19, (Char)20, (Char)21, (Char)22, (Char)23, (Char)24, (Char)25, (Char)26, (Char)27, (Char)28, (Char)29, (Char)30, (Char)31 };
+        // String.WhitespaceChars will trim aggressively than what the underlying FS does (for ex, NTFS, FAT).
+        internal static readonly char[] TrimEndChars = LongPathHelper.s_trimEndChars;
+
+        private static readonly char[] RealInvalidPathChars = PathInternal.InvalidPathChars;
 
         // This is used by HasIllegalCharacters
         private static readonly char[] InvalidPathCharsWithAdditionalChecks = { '\"', '<', '>', '|', '\0', (Char)1, (Char)2, (Char)3, (Char)4, (Char)5, (Char)6, (Char)7, (Char)8, (Char)9, (Char)10, (Char)11, (Char)12, (Char)13, (Char)14, (Char)15, (Char)16, (Char)17, (Char)18, (Char)19, (Char)20, (Char)21, (Char)22, (Char)23, (Char)24, (Char)25, (Char)26, (Char)27, (Char)28, (Char)29, (Char)30, (Char)31, '*', '?' };
@@ -89,16 +89,15 @@ namespace System.IO {
 
         public static readonly char PathSeparator = ';';
 
-
         // Make this public sometime.
         // The max total path is 260, and the max individual component length is 255. 
         // For example, D:\<256 char file name> isn't legal, even though it's under 260 chars.
-        internal static readonly int MaxPath = 260;
-        private static readonly int MaxDirectoryLength = 255;
+        internal static readonly int MaxPath = PathInternal.MaxShortPath;
+        private static readonly int MaxDirectoryLength = PathInternal.MaxComponentLength;
 
         // Windows API definitions
-        internal const int MAX_PATH = 260;  // From WinDef.h
-        internal const int MAX_DIRECTORY_PATH = 248;   // cannot create directories greater than 248 characters
+        internal const int MAX_PATH = PathInternal.MaxShortPath;  // From WinDef.h
+        internal const int MAX_DIRECTORY_PATH = PathInternal.MaxShortDirectoryPath;   // cannot create directories greater than 248 characters
     
         // Changes the extension of a file path. The path parameter
         // specifies a file path, and the extension parameter
@@ -136,7 +135,6 @@ namespace System.IO {
             return null;
         }
 
-       
         // Returns the directory path of a file path. This method effectively
         // removes the last element of the given file path, i.e. it returns a
         // string consisting of all characters up to but not including the last
@@ -146,7 +144,17 @@ namespace System.IO {
         //
         [ResourceExposure(ResourceScope.None)]
         [ResourceConsumption(ResourceScope.Machine, ResourceScope.Machine)]
-        public static String GetDirectoryName(String path) {
+        public static string GetDirectoryName(string path)
+        {
+            return InternalGetDirectoryName(path);
+        }
+
+        [ResourceExposure(ResourceScope.None)]
+        [ResourceConsumption(ResourceScope.Machine, ResourceScope.Machine)]
+        [System.Security.SecuritySafeCritical]
+
+        private static string InternalGetDirectoryName(string path)
+        {
             if (path != null) {
                 CheckInvalidPathChars(path);
 
@@ -154,16 +162,29 @@ namespace System.IO {
                 if (!CompatibilitySwitches.IsAppEarlierThanWindowsPhone8) {
 #endif
 
-                string normalizedPath = NormalizePath(path, false);
+                // Expanding short paths is dangerous in this case as the results will change with the current directory.
+                //
+                // Suppose you have a path called "PICTUR~1\Foo". Now suppose you have two folders on disk "C:\Mine\Pictures Of Me"
+                // and "C:\Yours\Pictures of You". If the current directory is neither you'll get back "PICTUR~1". If it is "C:\Mine"
+                // get back "Pictures Of Me". "C:\Yours" would give back "Pictures of You".
+                //
+                // Because of this and as it isn't documented that short paths are expanded we will not expand short names unless
+                // we're in legacy mode.
+                string normalizedPath = NormalizePath(path, fullCheck: false, expandShortPaths: AppContextSwitches.UseLegacyPathHandling);
 
                 // If there are no permissions for PathDiscovery to this path, we should NOT expand the short paths
                 // as this would leak information about paths to which the user would not have access to.
-                if (path.Length > 0)
+                if (path.Length > 0
+#if FEATURE_CAS_POLICY
+                    // Only do the extra logic if we're not in full trust
+                    && !CodeAccessSecurityEngine.QuickCheckForAllDemands()
+#endif
+                    )
                 {
                     try
                     {
                         // If we were passed in a path with \\?\ we need to remove it as FileIOPermission does not like it.
-                        string tempPath = Path.RemoveLongPathPrefix(path);
+                        string tempPath = RemoveLongPathPrefix(path);
 
                         // FileIOPermission cannot handle paths that contain ? or *
                         // So we only pass to FileIOPermission the text up to them.
@@ -176,14 +197,14 @@ namespace System.IO {
                         // While we don't use the result of this call we are using it as a consistent way of 
                         // doing the security checks. 
                         if (pos > 0)
-                            Path.GetFullPath(tempPath.Substring(0, pos));
+                            GetFullPath(tempPath.Substring(0, pos));
                     }
                     catch (SecurityException) {
                         // If the user did not have permissions to the path, make sure that we don't leak expanded short paths
                         // Only re-normalize if the original path had a ~ in it.
                         if (path.IndexOf("~", StringComparison.Ordinal) != -1)
                         {
-                            normalizedPath = NormalizePath(path, /*fullCheck*/ false, /*expandShortPaths*/ false);
+                            normalizedPath = NormalizePath(path, fullCheck: false, expandShortPaths: false);
                         }
                     }
                     catch (PathTooLongException) { }
@@ -203,13 +224,13 @@ namespace System.IO {
                 if (i > root) {
                     i = path.Length;
                     if (i == root) return null;
-                    while (i > root && path[--i] != DirectorySeparatorChar && path[i] != AltDirectorySeparatorChar);                    
+                    while (i > root && path[--i] != DirectorySeparatorChar && path[i] != AltDirectorySeparatorChar);
                     String dir = path.Substring(0, i);
 #if FEATURE_LEGACYNETCF
-                    if (CompatibilitySwitches.IsAppEarlierThanWindowsPhone8) {                        
+                    if (CompatibilitySwitches.IsAppEarlierThanWindowsPhone8) {
                         if (dir.Length >= MAX_PATH - 1)
                             throw new PathTooLongException(Environment.GetResourceString("IO.PathTooLong"));
-                    }                     
+                    }
 #endif
                     return dir;
                 }
@@ -220,9 +241,22 @@ namespace System.IO {
         // Gets the length of the root DirectoryInfo or whatever DirectoryInfo markers
         // are specified for the first part of the DirectoryInfo name.
         // 
-        internal static int GetRootLength(String path) {
+        internal static int GetRootLength(string path)
+        {
             CheckInvalidPathChars(path);
-            
+
+            if (AppContextSwitches.UseLegacyPathHandling)
+            {
+                return LegacyGetRootLength(path);
+            }
+            else
+            {
+                return PathInternal.GetRootLength(path);
+            }
+        }
+
+        private static int LegacyGetRootLength(string path)
+        {
             int i = 0;
             int length = path.Length;
 
@@ -247,7 +281,6 @@ namespace System.IO {
             return (c==DirectorySeparatorChar || c == AltDirectorySeparatorChar);
         }
 
-
         public static char[] GetInvalidPathChars()
         {
             return (char[]) RealInvalidPathChars.Clone();
@@ -330,7 +363,7 @@ namespace System.IO {
                 throw new ArgumentNullException("path");
             Contract.EndContractBlock();
 
-            String newPath = NormalizePath(path, true);
+            string newPath = NormalizePath(path, fullCheck: true);
 
             return newPath;
         }
@@ -338,8 +371,9 @@ namespace System.IO {
         [System.Security.SecuritySafeCritical]  // auto-generated
         [ResourceExposure(ResourceScope.Machine)]
         [ResourceConsumption(ResourceScope.Machine)]
-        internal unsafe static String NormalizePath(String path, bool fullCheck) {
-            return NormalizePath(path, fullCheck, MaxPath);
+        internal unsafe static String NormalizePath(String path, bool fullCheck)
+        {
+            return NormalizePath(path, fullCheck, AppContextSwitches.BlockLongPaths ? PathInternal.MaxShortPath : PathInternal.MaxLongPath);
         }
 
         [System.Security.SecuritySafeCritical]  // auto-generated
@@ -347,31 +381,127 @@ namespace System.IO {
         [ResourceConsumption(ResourceScope.Machine)]
         internal unsafe static String NormalizePath(String path, bool fullCheck, bool expandShortPaths)
         {
-            return NormalizePath(path, fullCheck, MaxPath, expandShortPaths);
+            return NormalizePath(path, fullCheck, MaxPath, expandShortPaths: expandShortPaths);
         }
 
         [System.Security.SecuritySafeCritical]  // auto-generated
         [ResourceExposure(ResourceScope.Machine)]
         [ResourceConsumption(ResourceScope.Machine)]
         internal unsafe static String NormalizePath(String path, bool fullCheck, int maxPathLength) {
-            return NormalizePath(path, fullCheck, maxPathLength, true);
+            return NormalizePath(path, fullCheck, maxPathLength, expandShortPaths: true);
         }
 
-        [System.Security.SecurityCritical]  // auto-generated
+        [System.Security.SecuritySafeCritical]
         [ResourceExposure(ResourceScope.Machine)]
         [ResourceConsumption(ResourceScope.Machine)]
-        internal unsafe static String NormalizePath(String path, bool fullCheck, int maxPathLength, bool expandShortPaths) {
+        internal static string NormalizePath(string path, bool fullCheck, int maxPathLength, bool expandShortPaths)
+        {
+            if (AppContextSwitches.UseLegacyPathHandling)
+            {
+                return LegacyNormalizePath(path, fullCheck, maxPathLength, expandShortPaths);
+            }
+            else
+            {
+                if (PathInternal.IsExtended(path))
+                {
+                    // We can't really know what is valid for all cases of extended paths.
+                    //
+                    //  - object names can include other characters as well (':', '/', etc.)
+                    //  - even file objects have different rules (pipe names can contain most characters)
+                    //
+                    // As such we will do no further analysis of extended paths to avoid blocking known and unknown
+                    // scenarios as well as minimizing compat breaks should we block now and need to unblock later.
+                    return path;
+                }
+
+                string normalizedPath = null;
 
+                if (fullCheck == false)
+                {
+                    // Disabled fullCheck is only called by GetDirectoryName and GetPathRoot.
+                    // Avoid adding addtional callers and try going direct to lighter weight NormalizeDirectorySeparators.
+                    normalizedPath = NewNormalizePathLimitedChecks(path, maxPathLength, expandShortPaths);
+                }
+                else
+                {
+                    normalizedPath = NewNormalizePath(path, maxPathLength, expandShortPaths: true);
+                }
+
+                if (string.IsNullOrWhiteSpace(normalizedPath))
+                    throw new ArgumentException(Environment.GetResourceString("Arg_PathIllegal"));
+                return normalizedPath;
+            }
+        }
+
+        [System.Security.SecuritySafeCritical]
+        private static string NewNormalizePathLimitedChecks(string path, int maxPathLength, bool expandShortPaths)
+        {
+            string normalized = PathInternal.NormalizeDirectorySeparators(path);
+
+            if (PathInternal.IsPathTooLong(normalized) || PathInternal.AreSegmentsTooLong(normalized))
+                throw new PathTooLongException();
+
+            if (!PathInternal.IsDevice(normalized) && PathInternal.HasInvalidVolumeSeparator(path))
+                throw new ArgumentException(Environment.GetResourceString("Arg_PathIllegal"));
+
+            if (expandShortPaths && normalized.IndexOf('~') != -1)
+            {
+                try
+                {
+                    return LongPathHelper.GetLongPathName(normalized);
+                }
+                catch
+                {
+                    // Don't care if we can't get the long path- might not exist, etc.
+                }
+            }
+
+            return normalized;
+        }
+
+        /// <summary>
+        /// Normalize the path and check for bad characters or other invalid syntax.
+        /// </summary>
+        [System.Security.SecuritySafeCritical]
+        [ResourceExposure(ResourceScope.Machine)]
+        [ResourceConsumption(ResourceScope.Machine)]
+        private static string NewNormalizePath(string path, int maxPathLength, bool expandShortPaths)
+        {
             Contract.Requires(path != null, "path can't be null");
-            // If we're doing a full path check, trim whitespace and look for
-            // illegal path characters.
-            if (fullCheck) {
+
+            // Embedded null characters are the only invalid character case we want to check up front.
+            // This is because the nulls will signal the end of the string to Win32 and therefore have
+            // unpredictable results. Other invalid characters we give a chance to be normalized out.
+            if (path.IndexOf('\0') != -1)
+                throw new ArgumentException(Environment.GetResourceString("Argument_InvalidPathChars"));
+
+            // Note that colon and wildcard checks happen in FileIOPermissions
+
+            // Technically this doesn't matter but we used to throw for this case
+            if (string.IsNullOrWhiteSpace(path))
+                throw new ArgumentException(Environment.GetResourceString("Arg_PathIllegal"));
+
+            // We don't want to check invalid characters for device format- see comments for extended above
+            return LongPathHelper.Normalize(path, (uint)maxPathLength, checkInvalidCharacters: !PathInternal.IsDevice(path), expandShortPaths: expandShortPaths);
+        }
+
+        [System.Security.SecurityCritical]  // auto-generated
+        [ResourceExposure(ResourceScope.Machine)]
+        [ResourceConsumption(ResourceScope.Machine)]
+        internal unsafe static string LegacyNormalizePath(string path, bool fullCheck, int maxPathLength, bool expandShortPaths)
+        {
+            Contract.Requires(path != null, "path can't be null");
+            
+            // If we're doing a full path check, trim whitespace and look for illegal path characters.
+            if (fullCheck)
+            {
                 // Trim whitespace off the end of the string.
                 // Win32 normalization trims only U+0020. 
                 path = path.TrimEnd(TrimEndChars);
 
                 // Look for illegal path characters.
-                CheckInvalidPathChars(path);
+                if (PathInternal.AnyPathHasIllegalCharacters(path))
+                    throw new ArgumentException(Environment.GetResourceString("Argument_InvalidPathChars"));
             }
 
             int index = 0;
@@ -777,50 +907,75 @@ namespace System.IO {
             return returnVal;
 
         }
-        internal const int MaxLongPath = 32000;
 
-        private const string LongPathPrefix = @"\\?\";
-        private const string UNCPathPrefix = @"\\";
-        private const string UNCLongPathPrefixToInsert = @"?\UNC\";
-        private const string UNCLongPathPrefix = @"\\?\UNC\";
+        internal const int MaxLongPath = PathInternal.MaxLongPath;
 
-        internal unsafe static bool HasLongPathPrefix(String path)
+        private const string LongPathPrefix = PathInternal.ExtendedPathPrefix;
+        private const string UNCPathPrefix = PathInternal.UncPathPrefix;
+        private const string UNCLongPathPrefixToInsert = PathInternal.UncExtendedPrefixToInsert;
+        private const string UNCLongPathPrefix = PathInternal.UncExtendedPathPrefix;
+
+        internal static bool HasLongPathPrefix(string path)
         {
-            return path.StartsWith(LongPathPrefix, StringComparison.Ordinal);
+            if (AppContextSwitches.UseLegacyPathHandling)
+                return path.StartsWith(LongPathPrefix, StringComparison.Ordinal);
+            else
+                return PathInternal.IsExtended(path);
         }
 
-        internal unsafe static String AddLongPathPrefix(String path)
+        internal static string AddLongPathPrefix(string path)
         {
-            if (path.StartsWith(LongPathPrefix, StringComparison.Ordinal))
-                return path;
+            if (AppContextSwitches.UseLegacyPathHandling)
+            {
+                if (path.StartsWith(LongPathPrefix, StringComparison.Ordinal))
+                    return path;
 
-            if (path.StartsWith(UNCPathPrefix, StringComparison.Ordinal))
-                return path.Insert(2, UNCLongPathPrefixToInsert); // Given \\server\share in longpath becomes \\?\UNC\server\share  => UNCLongPathPrefix + path.SubString(2); => The actual command simply reduces the operation cost.
+                if (path.StartsWith(UNCPathPrefix, StringComparison.Ordinal))
+                    return path.Insert(2, UNCLongPathPrefixToInsert); // Given \\server\share in longpath becomes \\?\UNC\server\share  => UNCLongPathPrefix + path.SubString(2); => The actual command simply reduces the operation cost.
 
-            return LongPathPrefix + path;
+                return LongPathPrefix + path;
+            }
+            else
+            {
+                return PathInternal.EnsureExtendedPrefix(path);
+            }
         }
 
-        internal unsafe static String RemoveLongPathPrefix(String path)
+        internal static string RemoveLongPathPrefix(string path)
         {
-            if (!path.StartsWith(LongPathPrefix, StringComparison.Ordinal))
-                return path;
+            if (AppContextSwitches.UseLegacyPathHandling)
+            {
+                if (!path.StartsWith(LongPathPrefix, StringComparison.Ordinal))
+                    return path;
 
-            if (path.StartsWith(UNCLongPathPrefix, StringComparison.OrdinalIgnoreCase))
-                return path.Remove(2, 6); // Given \\?\UNC\server\share we return \\server\share => @'\\' + path.SubString(UNCLongPathPrefix.Length) => The actual command simply reduces the operation cost.
+                if (path.StartsWith(UNCLongPathPrefix, StringComparison.OrdinalIgnoreCase))
+                    return path.Remove(2, 6); // Given \\?\UNC\server\share we return \\server\share => @'\\' + path.SubString(UNCLongPathPrefix.Length) => The actual command simply reduces the operation cost.
 
-            return path.Substring(4);
+                return path.Substring(4);
+            }
+            else
+            {
+                return PathInternal.RemoveExtendedPrefix(path);
+            }
         }
 
-        internal unsafe static StringBuilder RemoveLongPathPrefix(StringBuilder pathSB)
+        internal static StringBuilder RemoveLongPathPrefix(StringBuilder pathSB)
         {
-            string path = pathSB.ToString();
-            if (!path.StartsWith(LongPathPrefix, StringComparison.Ordinal))
-                return pathSB;
+            if (AppContextSwitches.UseLegacyPathHandling)
+            {
+                if (!PathInternal.StartsWithOrdinal(pathSB, LongPathPrefix))
+                    return pathSB;
 
-            if (path.StartsWith(UNCLongPathPrefix, StringComparison.OrdinalIgnoreCase))
-                return pathSB.Remove(2, 6);  // Given \\?\UNC\server\share we return \\server\share => @'\\' + path.SubString(UNCLongPathPrefix.Length) => The actual command simply reduces the operation cost.
+                // Given \\?\UNC\server\share we return \\server\share => @'\\' + path.SubString(UNCLongPathPrefix.Length) => The actual command simply reduces the operation cost.
+                if (PathInternal.StartsWithOrdinal(pathSB, UNCLongPathPrefix, ignoreCase: true))
+                    return pathSB.Remove(2, 6);
 
-            return pathSB.Remove(0, 4);
+                return pathSB.Remove(0, 4);
+            }
+            else
+            {
+                return PathInternal.RemoveExtendedPrefix(pathSB);
+            }
         }
 
         // Returns the name and extension parts of the given path. The resulting
@@ -860,8 +1015,6 @@ namespace System.IO {
             return null;
          }
 
-
-
         // Returns the root portion of the given path. The resulting string
         // consists of those rightmost characters of the path that constitute the
         // root of the path. Possible patterns for the resulting string are: An
@@ -876,7 +1029,10 @@ namespace System.IO {
         [ResourceConsumption(ResourceScope.Machine)]
         public static String GetPathRoot(String path) {
             if (path == null) return null;
-            path = NormalizePath(path, false);
+
+            // Expanding short paths has no impact on the path root- there is no such thing as an
+            // 8.3 volume or server/share name.
+            path = NormalizePath(path, fullCheck: false, expandShortPaths: false);
             return path.Substring(0, GetRootLength(path));
         }
 
@@ -903,15 +1059,9 @@ namespace System.IO {
         internal static bool IsRelative(string path)
         {
             Contract.Assert(path != null, "path can't be null");
-            if ((path.Length >= 3 && path[1] == VolumeSeparatorChar && path[2] == DirectorySeparatorChar && 
-                   ((path[0] >= 'a' && path[0] <= 'z') || (path[0] >= 'A' && path[0] <= 'Z'))) ||
-                  (path.Length >= 2 && path[0] == '\\' && path[1] == '\\'))
-                return false;
-            else
-                return true;
-        
+            return PathInternal.IsPartiallyQualified(path);
         }
-                
+
         // Returns a cryptographically strong random 8.3 string that can be 
         // used as either a folder name or a file name.
         public static String GetRandomFileName()
@@ -978,7 +1128,7 @@ namespace System.IO {
                 state.EnsureState();
             }
 #else
-            new FileIOPermission(FileIOPermissionAccess.Write, path).Demand();
+            FileIOPermission.QuickDemand(FileIOPermissionAccess.Write, path);
 #endif
             StringBuilder sb = new StringBuilder(MAX_PATH);
             uint r = Win32Native.GetTempFileName(path, "tmp", 0, sb);
@@ -1214,31 +1364,17 @@ namespace System.IO {
                 
                 searchPattern = searchPattern.Substring(index + 2);
             }
-
-        }
-
-        internal static bool HasIllegalCharacters(String path, bool checkAdditional)
-        {
-            Contract.Requires(path != null);
-
-            if (checkAdditional)
-            {
-                return path.IndexOfAny(InvalidPathCharsWithAdditionalChecks) >= 0;
-            }
-
-            return path.IndexOfAny(RealInvalidPathChars) >= 0;
         }
 
-        internal static void CheckInvalidPathChars(String path, bool checkAdditional = false)
+        internal static void CheckInvalidPathChars(string path, bool checkAdditional = false)
         {
             if (path == null)
                 throw new ArgumentNullException("path");
 
-            if (Path.HasIllegalCharacters(path, checkAdditional))
+            if (PathInternal.HasIllegalCharacters(path, checkAdditional))
                 throw new ArgumentException(Environment.GetResourceString("Argument_InvalidPathChars"));
         }
 
-        
         internal static String InternalCombine(String path1, String path2) {
             if (path1==null || path2==null)
                 throw new ArgumentNullException((path1==null) ? "path1" : "path2");
index a67ee8c29f5e2dd88e2b7b61e8f8b225225ec2be..33c341eb4f74e4712112b521515ed6b665e192f2 100644 (file)
@@ -1014,10 +1014,15 @@ namespace System.Resources {
                 }
             }
             else {
-                int seekPos = unchecked(4 * _numResources);
-                if (seekPos < 0) {
+                // The hexadecimal E translates to binary 1110
+                // So, with this & condition we are checking that none of the highest 3 bits are
+                // set before multiplying, as that would cause an overflow.
+                if ((_numResources & 0xE0000000) != 0){
+
                     throw new BadImageFormatException(Environment.GetResourceString("BadImageFormat_ResourcesHeaderCorrupted"));
                 }
+
+                int seekPos = unchecked(4 * _numResources);
                 unsafe {
                     _nameHashesPtr = (int*)_ums.PositionPointer;
                     // Skip over the array of nameHashes.
@@ -1046,10 +1051,14 @@ namespace System.Resources {
                 }
             }
             else {
-                int seekPos = unchecked(4 * _numResources);
-                if (seekPos < 0) {
+                // The hexadecimal E translates to binary 1110
+                // So, with this & condition we are checking that none of the highest 3 bits are
+                // set before multiplying, as that would cause an overflow.
+                if ((_numResources & 0xE0000000) != 0){
                     throw new BadImageFormatException(Environment.GetResourceString("BadImageFormat_ResourcesHeaderCorrupted"));
                 }
+
+                int seekPos = unchecked(4 * _numResources);
                 unsafe {
                     _namePositionsPtr = (int*)_ums.PositionPointer;
                     // Skip over the array of namePositions.
index f9cec78699ee1800fbf558199af55615f06136d1..893340d673cce042baf7095737d8323f3ec456a1 100644 (file)
@@ -28,22 +28,26 @@ namespace System.Runtime.InteropServices.WindowsRuntime
         [DllImport("api-ms-win-core-winrt-error-l1-1-1.dll", PreserveSig = false)]
         [SecurityCritical]
         [SuppressUnmanagedCodeSecurity]
+        [DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
         internal static extern IRestrictedErrorInfo GetRestrictedErrorInfo();
 
         [DllImport("api-ms-win-core-winrt-error-l1-1-1.dll")]
         [SecurityCritical]
         [SuppressUnmanagedCodeSecurity]
         [return: MarshalAs(UnmanagedType.Bool)]
+        [DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
         internal static extern bool RoOriginateLanguageException(int error, [MarshalAs(UnmanagedType.HString)]string message, IntPtr languageException);
 
         [DllImport("api-ms-win-core-winrt-error-l1-1-1.dll", PreserveSig = false)]
         [SecurityCritical]
         [SuppressUnmanagedCodeSecurity]
+        [DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
         internal static extern void RoReportUnhandledError(IRestrictedErrorInfo error);
 
         [DllImport("api-ms-win-core-winrt-string-l1-1-0.dll", CallingConvention = CallingConvention.StdCall)]
         [SecurityCritical]
         [SuppressUnmanagedCodeSecurity]
+        [DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
         internal static unsafe extern int WindowsCreateString([MarshalAs(UnmanagedType.LPWStr)] string sourceString,
                                                               int length,
                                                               [Out] IntPtr *hstring);
@@ -51,6 +55,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
         [DllImport("api-ms-win-core-winrt-string-l1-1-0.dll", CallingConvention = CallingConvention.StdCall)]
         [SecurityCritical]
         [SuppressUnmanagedCodeSecurity]
+        [DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
         internal static unsafe extern int WindowsCreateStringReference(char *sourceString,
                                                                        int length,
                                                                        [Out] HSTRING_HEADER *hstringHeader,
@@ -59,11 +64,13 @@ namespace System.Runtime.InteropServices.WindowsRuntime
         [DllImport("api-ms-win-core-winrt-string-l1-1-0.dll", CallingConvention = CallingConvention.StdCall)]
         [SecurityCritical]
         [SuppressUnmanagedCodeSecurity]
+        [DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
         internal static extern int WindowsDeleteString(IntPtr hstring);
 
         [DllImport("api-ms-win-core-winrt-string-l1-1-0.dll", CallingConvention = CallingConvention.StdCall)]
         [SecurityCritical]
         [SuppressUnmanagedCodeSecurity]
+        [DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
         internal static unsafe extern char* WindowsGetStringRawBuffer(IntPtr hstring, [Out] uint *length);
     }
 }
index 59c44820f332c5766b872a09496333ae9f3b849f..fad7beb385e27907e78615202a7e9fa5787deb6b 100644 (file)
@@ -435,9 +435,9 @@ namespace System.Security.AccessControl
         [SecurityPermission(SecurityAction.Assert, UnmanagedCode=true)]
         [ResourceExposure(ResourceScope.Machine)]
         [ResourceConsumption(ResourceScope.Machine)]
-        internal void Persist( String fullPath )
+        internal void Persist(string fullPath)
         {
-            new FileIOPermission( FileIOPermissionAccess.NoAccess, AccessControlActions.Change, fullPath ).Demand();
+            FileIOPermission.QuickDemand(FileIOPermissionAccess.NoAccess, AccessControlActions.Change, fullPath);
 
             WriteLock();
 
@@ -455,12 +455,12 @@ namespace System.Security.AccessControl
         
         [System.Security.SecuritySafeCritical]  // auto-generated
         [SecurityPermission(SecurityAction.Assert, UnmanagedCode=true)]
-        internal void Persist( SafeFileHandle handle, String fullPath )
+        internal void Persist(SafeFileHandle handle, string fullPath)
         {
-            if ( fullPath != null )
-                new FileIOPermission( FileIOPermissionAccess.NoAccess, AccessControlActions.Change, fullPath ).Demand();
+            if (fullPath != null)
+                FileIOPermission.QuickDemand(FileIOPermissionAccess.NoAccess, AccessControlActions.Change, fullPath);
             else
-                new FileIOPermission( PermissionState.Unrestricted ).Demand();
+                FileIOPermission.QuickDemand(PermissionState.Unrestricted);
 
             WriteLock();
 
@@ -627,11 +627,9 @@ namespace System.Security.AccessControl
 
     public sealed class FileSecurity : FileSystemSecurity
     {
-        #region Constructors
-
         [System.Security.SecuritySafeCritical]  // auto-generated
         public FileSecurity()
-            : base( false )
+            : base(false)
         {
         }
 
@@ -639,11 +637,11 @@ namespace System.Security.AccessControl
         [SecurityPermission(SecurityAction.Assert, UnmanagedCode=true)]
         [ResourceExposure(ResourceScope.Machine)]
         [ResourceConsumption(ResourceScope.Machine)]
-        public FileSecurity( String fileName, AccessControlSections includeSections )
+        public FileSecurity(string fileName, AccessControlSections includeSections)
             : base(false, fileName, includeSections, false)
         {
-            String fullPath = Path.GetFullPathInternal(fileName);
-            new FileIOPermission(FileIOPermissionAccess.NoAccess, AccessControlActions.View, fullPath).Demand();
+            string fullPath = Path.GetFullPathInternal(fileName);
+            FileIOPermission.QuickDemand(FileIOPermissionAccess.NoAccess, AccessControlActions.View, fullPath, checkForDuplicates: false, needFullPath: false);
         }
 
         // Warning!  Be exceedingly careful with this constructor.  Do not make
@@ -654,26 +652,21 @@ namespace System.Security.AccessControl
         [SecurityPermission(SecurityAction.Assert, UnmanagedCode=true)]
         [ResourceExposure(ResourceScope.Machine)]
         [ResourceConsumption(ResourceScope.Machine)]
-        internal FileSecurity( SafeFileHandle handle, String fullPath, AccessControlSections includeSections )
-            : base( false, handle, includeSections, false )
+        internal FileSecurity(SafeFileHandle handle, string fullPath, AccessControlSections includeSections)
+            : base(false, handle, includeSections, false)
         {
             if (fullPath != null)
-                new FileIOPermission(FileIOPermissionAccess.NoAccess, AccessControlActions.View, fullPath).Demand();
+                FileIOPermission.QuickDemand(FileIOPermissionAccess.NoAccess, AccessControlActions.View, fullPath);
             else
-                new FileIOPermission(PermissionState.Unrestricted).Demand();
+                FileIOPermission.QuickDemand(PermissionState.Unrestricted);
         }
-
-        #endregion
     }
-    
 
     public sealed class DirectorySecurity : FileSystemSecurity
     {
-        #region Constructors
-
         [System.Security.SecuritySafeCritical]  // auto-generated
         public DirectorySecurity()
-            : base( true )
+            : base(true)
         {
         }
 
@@ -681,14 +674,12 @@ namespace System.Security.AccessControl
         [SecurityPermission(SecurityAction.Assert, UnmanagedCode=true)]
         [ResourceExposure(ResourceScope.Machine)]
         [ResourceConsumption(ResourceScope.Machine)]
-        public DirectorySecurity( String name, AccessControlSections includeSections )
-            : base( true, name, includeSections, true )
+        public DirectorySecurity(string name, AccessControlSections includeSections)
+            : base(true, name, includeSections, true)
         {
-            String fullPath = Path.GetFullPathInternal(name);
-            new FileIOPermission(FileIOPermissionAccess.NoAccess, AccessControlActions.View, fullPath).Demand();
+            string fullPath = Path.GetFullPathInternal(name);
+            FileIOPermission.QuickDemand(FileIOPermissionAccess.NoAccess, AccessControlActions.View, fullPath, checkForDuplicates: false, needFullPath: false);
         }
-
-        #endregion
     }
 }
 
index 5b8627cd9b0c8034c73aa5837cc632fbf5c59d3e..5f3a25e79b72ee61df57ce06bf256a9e1dfc6ccb 100644 (file)
@@ -315,7 +315,14 @@ namespace System.Security.Claims
                     //
                     if(!IsCircular(claimsIdentity.Actor))
                     {
-                        m_actor = claimsIdentity.Actor;
+                        if (!AppContextSwitches.SetActorAsReferenceWhenCopyingClaimsIdentity)
+                        {
+                            m_actor = claimsIdentity.Actor.Clone();
+                        }
+                        else
+                        {
+                            m_actor = claimsIdentity.Actor;
+                        }
                     }
                     else
                     {
@@ -334,6 +341,10 @@ namespace System.Security.Claims
                 else
                     SafeAddClaims(claimsIdentity.m_instanceClaims);
 
+                if (claimsIdentity.m_userSerializationData != null)
+                {
+                    m_userSerializationData = claimsIdentity.m_userSerializationData.Clone() as byte[];
+                }
             }
             else
             {
@@ -594,7 +605,14 @@ namespace System.Security.Claims
                 // the Actor property and so not really needed here. But checking just for sanity sake
                 if(!IsCircular(this.Actor))
                 {
-                    newIdentity.Actor = this.Actor;
+                    if (!AppContextSwitches.SetActorAsReferenceWhenCopyingClaimsIdentity)
+                    {
+                        newIdentity.Actor = this.Actor.Clone();
+                    }
+                    else
+                    {
+                        newIdentity.Actor = this.Actor;
+                    }
                 }
                 else
                 {
@@ -945,6 +963,7 @@ namespace System.Security.Claims
                 return;
 
             m_instanceClaims = new List<Claim>();
+
             m_externalClaims = new Collection<IEnumerable<Claim>>();
         }
 
index 7d3eb777e4283de76e435faeed2d22a95148c58e..667369d2dd6c338e9f5d0c52a4fdc3b4eee79a62 100644 (file)
@@ -122,6 +122,7 @@ namespace System.Security.Cryptography {
 #endif //FEATURE_CRYPTO || FEATURE_LEGACYNETCFCRYPTO
 #if FEATURE_CRYPTO
                     ht.Add("System.Security.Cryptography.SHA1CryptoServiceProvider", Constants.OID_OIWSEC_SHA1);
+                    ht.Add("System.Security.Cryptography.SHA1Cng", Constants.OID_OIWSEC_SHA1);
 #endif //FEATURE_CRYPTO
 #if FEATURE_CRYPTO || FEATURE_LEGACYNETCFCRYPTO
                     ht.Add("System.Security.Cryptography.SHA1Managed", Constants.OID_OIWSEC_SHA1);
@@ -174,13 +175,6 @@ namespace System.Security.Cryptography {
 #if FEATURE_CRYPTO
                     Type SHA1CryptoServiceProviderType = typeof(System.Security.Cryptography.SHA1CryptoServiceProvider);
                     Type MD5CryptoServiceProviderType = typeof(System.Security.Cryptography.MD5CryptoServiceProvider);
-#endif //FEATURE_CRYPTO
-#if FEATURE_CRYPTO || FEATURE_LEGACYNETCFCRYPTO
-                    Type SHA256ManagedType = typeof(SHA256Managed);
-#endif //FEATURE_CRYPTO || FEATURE_LEGACYNETCFCRYPTO
-#if FEATURE_CRYPTO
-                    Type SHA384ManagedType = typeof(SHA384Managed);
-                    Type SHA512ManagedType = typeof(SHA512Managed);
                     Type RIPEMD160ManagedType  = typeof(System.Security.Cryptography.RIPEMD160Managed); 
                     Type HMACMD5Type       = typeof(System.Security.Cryptography.HMACMD5);
                     Type HMACRIPEMD160Type = typeof(System.Security.Cryptography.HMACRIPEMD160);
@@ -209,6 +203,9 @@ namespace System.Security.Cryptography {
 #if FEATURE_CRYPTO
                     Type DSASignatureDescriptionType = typeof(System.Security.Cryptography.DSASignatureDescription);
                     Type RSAPKCS1SHA1SignatureDescriptionType = typeof(System.Security.Cryptography.RSAPKCS1SHA1SignatureDescription);
+                    Type RSAPKCS1SHA256SignatureDescriptionType = typeof(System.Security.Cryptography.RSAPKCS1SHA256SignatureDescription);
+                    Type RSAPKCS1SHA384SignatureDescriptionType = typeof(System.Security.Cryptography.RSAPKCS1SHA384SignatureDescription);
+                    Type RSAPKCS1SHA512SignatureDescriptionType = typeof(System.Security.Cryptography.RSAPKCS1SHA512SignatureDescription);
 #endif //FEATURE_CRYPTO
 #if FEATURE_CRYPTO || FEATURE_LEGACYNETCFCRYPTO
                     Type RNGCryptoServiceProviderType = typeof(System.Security.Cryptography.RNGCryptoServiceProvider);
@@ -233,11 +230,26 @@ namespace System.Security.Cryptography {
                     string SHA384CryptoSerivceProviderType = "System.Security.Cryptography.SHA384CryptoServiceProvider, " + AssemblyRef.SystemCore;
                     string SHA512CngType = "System.Security.Cryptography.SHA512Cng, " + AssemblyRef.SystemCore;
                     string SHA512CryptoServiceProviderType = "System.Security.Cryptography.SHA512CryptoServiceProvider, " + AssemblyRef.SystemCore;
+#endif //FEATURE_CRYPTO
+
+
+#if FEATURE_CRYPTO || FEATURE_LEGACYNETCFCRYPTO
+                    bool fipsOnly = AllowOnlyFipsAlgorithms;
+                    object SHA256DefaultType = typeof(SHA256Managed);
+#endif //FEATURE_CRYPTO || FEATURE_LEGACYNETCFCRYPTO
+
+#if FEATURE_CRYPTO
+                    if (fipsOnly)
+                    {
+                        SHA256DefaultType = SHA256CngType;
+                    }
+                    object SHA384DefaultType = fipsOnly ? (object)SHA384CngType : (object)typeof(SHA384Managed);
+                    object SHA512DefaultType = fipsOnly ? (object)SHA512CngType : (object)typeof(SHA512Managed);
 
                     // Cryptography algorithms in System.Security
                     string DpapiDataProtectorType = "System.Security.Cryptography.DpapiDataProtector, " + AssemblyRef.SystemSecurity;
-
 #endif //FEATURE_CRYPTO
+
 #if FEATURE_CRYPTO || FEATURE_LEGACYNETCFCRYPTO
                     // Random number generator
                     ht.Add("RandomNumberGenerator", RNGCryptoServiceProviderType);
@@ -256,21 +268,21 @@ namespace System.Security.Cryptography {
                     ht.Add("System.Security.Cryptography.MD5Cng", MD5CngType);
 #endif //FEATURE_CRYPTO
 #if FEATURE_CRYPTO || FEATURE_LEGACYNETCFCRYPTO
-                    ht.Add("SHA256", SHA256ManagedType);
-                    ht.Add("SHA-256", SHA256ManagedType);
-                    ht.Add("System.Security.Cryptography.SHA256", SHA256ManagedType);
+                    ht.Add("SHA256", SHA256DefaultType);
+                    ht.Add("SHA-256", SHA256DefaultType);
+                    ht.Add("System.Security.Cryptography.SHA256", SHA256DefaultType);
 #endif //FEATURE_CRYPTO || FEATURE_LEGACYNETCFCRYPTO
 #if FEATURE_CRYPTO
                     ht.Add("System.Security.Cryptography.SHA256Cng", SHA256CngType);
                     ht.Add("System.Security.Cryptography.SHA256CryptoServiceProvider", SHA256CryptoServiceProviderType);
-                    ht.Add("SHA384", SHA384ManagedType);
-                    ht.Add("SHA-384", SHA384ManagedType);
-                    ht.Add("System.Security.Cryptography.SHA384", SHA384ManagedType);
+                    ht.Add("SHA384", SHA384DefaultType);
+                    ht.Add("SHA-384", SHA384DefaultType);
+                    ht.Add("System.Security.Cryptography.SHA384", SHA384DefaultType);
                     ht.Add("System.Security.Cryptography.SHA384Cng", SHA384CngType);
                     ht.Add("System.Security.Cryptography.SHA384CryptoServiceProvider", SHA384CryptoSerivceProviderType);
-                    ht.Add("SHA512", SHA512ManagedType);
-                    ht.Add("SHA-512", SHA512ManagedType);
-                    ht.Add("System.Security.Cryptography.SHA512", SHA512ManagedType);
+                    ht.Add("SHA512", SHA512DefaultType);
+                    ht.Add("SHA-512", SHA512DefaultType);
+                    ht.Add("System.Security.Cryptography.SHA512", SHA512DefaultType);
                     ht.Add("System.Security.Cryptography.SHA512Cng", SHA512CngType);
                     ht.Add("System.Security.Cryptography.SHA512CryptoServiceProvider", SHA512CryptoServiceProviderType);
                     ht.Add("RIPEMD160", RIPEMD160ManagedType);
@@ -357,16 +369,19 @@ namespace System.Security.Cryptography {
                     ht.Add("System.Security.Cryptography.DSASignatureDescription", DSASignatureDescriptionType);
                     ht.Add("http://www.w3.org/2000/09/xmldsig#rsa-sha1", RSAPKCS1SHA1SignatureDescriptionType);
                     ht.Add("System.Security.Cryptography.RSASignatureDescription", RSAPKCS1SHA1SignatureDescriptionType);
+                    ht.Add("http://www.w3.org/2001/04/xmldsig-more#rsa-sha256", RSAPKCS1SHA256SignatureDescriptionType);
+                    ht.Add("http://www.w3.org/2001/04/xmldsig-more#rsa-sha384", RSAPKCS1SHA384SignatureDescriptionType);
+                    ht.Add("http://www.w3.org/2001/04/xmldsig-more#rsa-sha512", RSAPKCS1SHA512SignatureDescriptionType);
 
                     // Xml Dsig/Enc Hash algorithms
                     ht.Add("http://www.w3.org/2000/09/xmldsig#sha1", SHA1CryptoServiceProviderType);
                     // Add the other hash algorithms introduced with XML Encryption
 #endif //FEATURE_CRYPTO
 #if FEATURE_CRYPTO || FEATURE_LEGACYNETCFCRYPTO
-                    ht.Add("http://www.w3.org/2001/04/xmlenc#sha256", SHA256ManagedType);
+                    ht.Add("http://www.w3.org/2001/04/xmlenc#sha256", SHA256DefaultType);
 #endif //FEATURE_CRYPTO || FEATURE_LEGACYNETCFCRYPTO
 #if FEATURE_CRYPTO && !FEATURE_CORECLR
-                    ht.Add("http://www.w3.org/2001/04/xmlenc#sha512", SHA512ManagedType);
+                    ht.Add("http://www.w3.org/2001/04/xmlenc#sha512", SHA512DefaultType);
                     ht.Add("http://www.w3.org/2001/04/xmlenc#ripemd160", RIPEMD160ManagedType);
 
                     // Xml Encryption symmetric keys
@@ -421,7 +436,7 @@ namespace System.Security.Cryptography {
 
                     // Xml Dsig-more Uri's as defined in http://www.ietf.org/rfc/rfc4051.txt
                     ht.Add("http://www.w3.org/2001/04/xmldsig-more#md5", MD5CryptoServiceProviderType);
-                    ht.Add("http://www.w3.org/2001/04/xmldsig-more#sha384", SHA384ManagedType);
+                    ht.Add("http://www.w3.org/2001/04/xmldsig-more#sha384", SHA384DefaultType);
                     ht.Add("http://www.w3.org/2001/04/xmldsig-more#hmac-md5", HMACMD5Type);
                     ht.Add("http://www.w3.org/2001/04/xmldsig-more#hmac-ripemd160", HMACRIPEMD160Type);
 #endif //FEATURE_CRYPTO
index 51f9a9ae4cc12961e7f4424fab286906191e63b6..af2db6e53039c4ce911fdba24cc8d5933292a85d 100644 (file)
@@ -15,6 +15,7 @@ namespace System.Security.Cryptography {
     using System.Runtime.Serialization;
     using System.Security.Util;
     using System.Globalization;
+    using System.IO;
     using System.Diagnostics.Contracts;
 
     // DSAParameters is serializable so that one could pass the public parameters
@@ -63,10 +64,78 @@ namespace System.Security.Cryptography {
             return (DSA) CryptoConfig.CreateFromName(algName);
         }
 
+        // DSA does not encode the algorithm identifier into the signature blob, therefore CreateSignature and
+        // VerifySignature do not need the HashAlgorithmName value, only SignData and VerifyData do.
         abstract public byte[] CreateSignature(byte[] rgbHash);
 
         abstract public bool VerifySignature(byte[] rgbHash, byte[] rgbSignature); 
 
+        protected virtual byte[] HashData(byte[] data, int offset, int count, HashAlgorithmName hashAlgorithm)
+        {
+            throw DerivedClassMustOverride();
+        }
+
+        protected virtual byte[] HashData(Stream data, HashAlgorithmName hashAlgorithm)
+        {
+            throw DerivedClassMustOverride();
+        }
+
+        public byte[] SignData(byte[] data, HashAlgorithmName hashAlgorithm)
+        {
+            if (data == null) { throw new ArgumentNullException("data"); }
+
+            return SignData(data, 0, data.Length, hashAlgorithm);
+        }
+
+        public virtual byte[] SignData(byte[] data, int offset, int count, HashAlgorithmName hashAlgorithm)
+        {
+            if (data == null) { throw new ArgumentNullException("data"); }
+            if (offset < 0 || offset > data.Length) { throw new ArgumentOutOfRangeException("offset"); }
+            if (count < 0 || count > data.Length - offset) { throw new ArgumentOutOfRangeException("count"); }
+            if (String.IsNullOrEmpty(hashAlgorithm.Name)) { throw HashAlgorithmNameNullOrEmpty(); }
+
+            byte[] hash = HashData(data, offset, count, hashAlgorithm);
+            return CreateSignature(hash);
+        }
+
+        public virtual byte[] SignData(Stream data, HashAlgorithmName hashAlgorithm)
+        {
+            if (data == null) { throw new ArgumentNullException("data"); }
+            if (String.IsNullOrEmpty(hashAlgorithm.Name)) { throw HashAlgorithmNameNullOrEmpty(); }
+
+            byte[] hash = HashData(data, hashAlgorithm);
+            return CreateSignature(hash);
+        }
+
+        public bool VerifyData(byte[] data, byte[] signature, HashAlgorithmName hashAlgorithm)
+        {
+            if (data == null) { throw new ArgumentNullException("data"); }
+
+            return VerifyData(data, 0, data.Length, signature, hashAlgorithm);
+        }
+
+        public virtual bool VerifyData(byte[] data, int offset, int count, byte[] signature, HashAlgorithmName hashAlgorithm)
+        {
+            if (data == null) { throw new ArgumentNullException("data"); }
+            if (offset < 0 || offset > data.Length) { throw new ArgumentOutOfRangeException("offset"); }
+            if (count < 0 || count > data.Length - offset) { throw new ArgumentOutOfRangeException("count"); }
+            if (signature == null) { throw new ArgumentNullException("signature"); }
+            if (String.IsNullOrEmpty(hashAlgorithm.Name)) { throw HashAlgorithmNameNullOrEmpty(); }
+
+            byte[] hash = HashData(data, offset, count, hashAlgorithm);
+            return VerifySignature(hash, signature);
+        }
+
+        public virtual bool VerifyData(Stream data, byte[] signature, HashAlgorithmName hashAlgorithm)
+        {
+            if (data == null) { throw new ArgumentNullException("data"); }
+            if (signature == null) { throw new ArgumentNullException("signature"); }
+            if (String.IsNullOrEmpty(hashAlgorithm.Name)) { throw HashAlgorithmNameNullOrEmpty(); }
+
+            byte[] hash = HashData(data, hashAlgorithm);
+            return VerifySignature(hash, signature);
+        }
+
         // We can provide a default implementation of FromXmlString because we require 
         // every DSA implementation to implement ImportParameters
         // All we have to do here is parse the XML.
@@ -187,5 +256,15 @@ namespace System.Security.Cryptography {
         abstract public DSAParameters ExportParameters(bool includePrivateParameters);
 
         abstract public void ImportParameters(DSAParameters parameters);
+
+        private static Exception DerivedClassMustOverride()
+        {
+            return new NotImplementedException(Environment.GetResourceString("NotSupported_SubclassOverride"));
+        }
+
+        internal static Exception HashAlgorithmNameNullOrEmpty()
+        {
+            return new ArgumentException(Environment.GetResourceString("Cryptography_HashAlgorithmNameNullOrEmpty"), "hashAlgorithm");
+        }
     }
 }
index 318b09813abdab62f3bfdc5d96b13250fac0c4d7..df23a26af107962222af0ff7b63843f7c09c637d 100644 (file)
@@ -268,6 +268,36 @@ namespace System.Security.Cryptography {
             return VerifyHash(rgbHash, null, rgbSignature);
         }
 
+        protected override byte[] HashData(byte[] data, int offset, int count, HashAlgorithmName hashAlgorithm)
+        {
+            // we're sealed and the base should have checked this before calling us
+            Contract.Assert(data != null);
+            Contract.Assert(offset >= 0 && offset <= data.Length);
+            Contract.Assert(count >= 0 && count <= data.Length - offset);
+            Contract.Assert(!String.IsNullOrEmpty(hashAlgorithm.Name));
+
+            if (hashAlgorithm != HashAlgorithmName.SHA1)
+            {
+                throw new CryptographicException(Environment.GetResourceString("Cryptography_UnknownHashAlgorithm", hashAlgorithm.Name));
+            }
+
+            return _sha1.ComputeHash(data, offset, count);
+        }
+
+        protected override byte[] HashData(Stream data, HashAlgorithmName hashAlgorithm)
+        {
+            // we're sealed and the base should have checked this before calling us
+            Contract.Assert(data != null);
+            Contract.Assert(!String.IsNullOrEmpty(hashAlgorithm.Name));
+
+            if (hashAlgorithm != HashAlgorithmName.SHA1)
+            {
+                throw new CryptographicException(Environment.GetResourceString("Cryptography_UnknownHashAlgorithm", hashAlgorithm.Name));
+            }
+
+            return _sha1.ComputeHash(data);
+        }
+
         [System.Security.SecuritySafeCritical]  // auto-generated
         public byte[] SignHash(byte[] rgbHash, string str) {
             if (rgbHash == null)
index 0bf87db770ef847b0f0fe74bcddf974ff0743486..0954818455914214f4a21c807ed7d00eea61d89b 100644 (file)
@@ -37,9 +37,10 @@ namespace System.Security.Cryptography {
     }
 
     [System.Runtime.InteropServices.ComVisible(true)]
-    public sealed class RSACryptoServiceProvider : RSA
+    public sealed partial class RSACryptoServiceProvider : RSA
         , ICspAsymmetricAlgorithm
     {
+#if !MONO
         private int _dwKeySize;
         private CspParameters  _parameters;
         private bool _randomKeyContainer;
@@ -47,13 +48,13 @@ namespace System.Security.Cryptography {
         private SafeProvHandle _safeProvHandle;
         [System.Security.SecurityCritical] // auto-generated
         private SafeKeyHandle _safeKeyHandle;
-
+#endif
         private static volatile CspProviderFlags s_UseMachineKeyStore = 0;
 
         //
         // QCalls
         //
-
+#if !MONO
         [System.Security.SecurityCritical]  // auto-generated
         [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)]
         [ResourceExposure(ResourceScope.None)]
@@ -194,7 +195,7 @@ namespace System.Security.Cryptography {
                 return null;
             }
         }
-
+#endif
         public override string SignatureAlgorithm {
             get { return "http://www.w3.org/2000/09/xmldsig#rsa-sha1"; }
         }
@@ -203,7 +204,7 @@ namespace System.Security.Cryptography {
             get { return (s_UseMachineKeyStore == CspProviderFlags.UseMachineKeyStore); }
             set { s_UseMachineKeyStore = (value ? CspProviderFlags.UseMachineKeyStore : 0); }
         }
-
+#if !MONO
         public bool PersistKeyInCsp {
             [System.Security.SecuritySafeCritical]  // auto-generated
             get {
@@ -502,7 +503,7 @@ namespace System.Security.Cryptography {
         private static bool IsPublic(RSAParameters rsaParams) {
             return (rsaParams.P == null);
         }
-        
+#endif
         //
         // Adapt new RSA abstraction to legacy RSACryptoServiceProvider surface area.
         //
@@ -524,10 +525,14 @@ namespace System.Security.Cryptography {
             Contract.Assert(count >= 0 && count <= data.Length);
             Contract.Assert(!String.IsNullOrEmpty(hashAlgorithm.Name));
 
+#if MONO
+            throw new NotImplementedException ();
+#else
             using (SafeHashHandle hashHandle = Utils.CreateHash(Utils.StaticProvHandle, GetAlgorithmId(hashAlgorithm))) {
                 Utils.HashData(hashHandle, data, offset, count);
                 return Utils.EndHash(hashHandle);
             }
+#endif
         }
 
         [SecuritySafeCritical]
@@ -536,6 +541,9 @@ namespace System.Security.Cryptography {
             Contract.Assert(data != null);
             Contract.Assert(!String.IsNullOrEmpty(hashAlgorithm.Name));
 
+#if MONO
+            throw new NotImplementedException ();
+#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
                 byte[] buffer = new byte[4096];
@@ -549,6 +557,7 @@ namespace System.Security.Cryptography {
 
                 return Utils.EndHash(hashHandle);
             }
+#endif
         }
         
         private static int GetAlgorithmId(HashAlgorithmName hashAlgorithm) {
index 416b29f5079d35aaf8cb039aaf473c5a8eb09a66..674cdf23f61af1a894bd382375cb36d6a8a6ec59 100644 (file)
@@ -11,6 +11,7 @@ namespace System.Security.Cryptography {
     [System.Runtime.InteropServices.ComVisible(true)]
     public class RSAOAEPKeyExchangeDeformatter : AsymmetricKeyExchangeDeformatter {
         private RSA _rsaKey; // RSA Key value to do decrypt operation
+        private bool?  _rsaOverridesDecrypt;
 
         //
         // public constructors
@@ -42,8 +43,8 @@ namespace System.Security.Cryptography {
             if (_rsaKey == null)
                 throw new CryptographicUnexpectedOperationException(Environment.GetResourceString("Cryptography_MissingKey"));
 
-            if (_rsaKey is RSACryptoServiceProvider) {
-                return ((RSACryptoServiceProvider) _rsaKey).Decrypt(rgbData, true);
+            if (OverridesDecrypt) {
+                return _rsaKey.Decrypt(rgbData, RSAEncryptionPadding.OaepSHA1);
             } else {
                 return Utils.RsaOaepDecrypt(_rsaKey, SHA1.Create(), new PKCS1MaskGenerationMethod(), rgbData);
             }
@@ -54,6 +55,16 @@ namespace System.Security.Cryptography {
                 throw new ArgumentNullException("key");
             Contract.EndContractBlock();
             _rsaKey = (RSA) key;
+            _rsaOverridesDecrypt = default(bool?);
+        }
+
+        private bool OverridesDecrypt {
+            get {
+                if (!_rsaOverridesDecrypt.HasValue) {
+                    _rsaOverridesDecrypt = Utils.DoesRsaKeyOverride(_rsaKey, "Decrypt", new Type[] { typeof(byte[]), typeof(RSAEncryptionPadding) });
+                }
+                return _rsaOverridesDecrypt.Value;
+            }
         }
     }
 }
index 68746fe1773aaabb5821daa458ea2c23cf158de6..a931c154cdee84a27f5e5eaa3acad7af3f70423f 100644 (file)
@@ -12,6 +12,7 @@ namespace System.Security.Cryptography {
     public class RSAOAEPKeyExchangeFormatter : AsymmetricKeyExchangeFormatter {
         private byte[] ParameterValue;
         private RSA _rsaKey;
+        private bool?  _rsaOverridesEncrypt;
         private RandomNumberGenerator RngValue;
 
         //
@@ -64,6 +65,7 @@ namespace System.Security.Cryptography {
                 throw new ArgumentNullException("key");
             Contract.EndContractBlock();
             _rsaKey = (RSA) key;
+            _rsaOverridesEncrypt = default(bool?);
         }
 
         [System.Security.SecuritySafeCritical]  // auto-generated
@@ -71,8 +73,8 @@ namespace System.Security.Cryptography {
             if (_rsaKey == null)
                 throw new CryptographicUnexpectedOperationException(Environment.GetResourceString("Cryptography_MissingKey"));
 
-            if (_rsaKey is RSACryptoServiceProvider) {
-                return ((RSACryptoServiceProvider) _rsaKey).Encrypt(rgbData, true);
+            if (OverridesEncrypt) {
+                return _rsaKey.Encrypt(rgbData, RSAEncryptionPadding.OaepSHA1);
             } else {
                 return Utils.RsaOaepEncrypt(_rsaKey, SHA1.Create(), new PKCS1MaskGenerationMethod(), RandomNumberGenerator.Create(), rgbData);
             }
@@ -81,5 +83,14 @@ namespace System.Security.Cryptography {
         public override byte[] CreateKeyExchange(byte[] rgbData, Type symAlgType) {
             return CreateKeyExchange(rgbData);
         }
+
+        private bool OverridesEncrypt {
+            get {
+                if (!_rsaOverridesEncrypt.HasValue) {
+                    _rsaOverridesEncrypt = Utils.DoesRsaKeyOverride(_rsaKey, "Encrypt", new Type[] { typeof(byte[]), typeof(RSAEncryptionPadding) });
+                }
+                return _rsaOverridesEncrypt.Value;
+            }
+        }
     }
 }
index ed412c64dba41b8d6125c3c7f3bfe05271f21f58..ccd8570ada52f15cb5dd118d73663b304f212c0f 100644 (file)
@@ -11,6 +11,7 @@ namespace System.Security.Cryptography {
     [System.Runtime.InteropServices.ComVisible(true)]
     public class RSAPKCS1KeyExchangeDeformatter : AsymmetricKeyExchangeDeformatter {
         RSA _rsaKey;
+        bool?  _rsaOverridesDecrypt;
         RandomNumberGenerator RngValue;
 
         // Constructors
@@ -47,8 +48,8 @@ namespace System.Security.Cryptography {
                 throw new CryptographicUnexpectedOperationException(Environment.GetResourceString("Cryptography_MissingKey"));
 
             byte[] rgbOut;
-            if (_rsaKey is RSACryptoServiceProvider) {
-                rgbOut = ((RSACryptoServiceProvider) _rsaKey).Decrypt(rgbIn, false);
+            if (OverridesDecrypt) {
+                rgbOut = _rsaKey.Decrypt(rgbIn, RSAEncryptionPadding.Pkcs1);
             }
             else {
                 int i;
@@ -83,6 +84,16 @@ namespace System.Security.Cryptography {
                 throw new ArgumentNullException("key");
             Contract.EndContractBlock();
             _rsaKey = (RSA) key;
+            _rsaOverridesDecrypt = default(bool?);
+        }
+
+        private bool OverridesDecrypt {
+            get {
+                if (!_rsaOverridesDecrypt.HasValue) {
+                    _rsaOverridesDecrypt = Utils.DoesRsaKeyOverride(_rsaKey, "Decrypt", new Type[] { typeof(byte[]), typeof(RSAEncryptionPadding) });
+                }
+                return _rsaOverridesDecrypt.Value;
+            }
         }
     }
 }
index 19f34b6d6fbaa914ff76b25ef6af67aee46b4644..188e55ce1c4acfc977eb85b8f38cac056af7cc32 100644 (file)
@@ -14,6 +14,7 @@ namespace System.Security.Cryptography {
     public class RSAPKCS1KeyExchangeFormatter : AsymmetricKeyExchangeFormatter {
         RandomNumberGenerator RngValue;
         RSA _rsaKey;
+        bool?  _rsaOverridesEncrypt;
 
         //
         // public constructors
@@ -50,6 +51,7 @@ namespace System.Security.Cryptography {
                 throw new ArgumentNullException("key");
             Contract.EndContractBlock();
             _rsaKey = (RSA) key;
+            _rsaOverridesEncrypt = default(bool?);
         }
 
         public override byte[] CreateKeyExchange(byte[] rgbData) {
@@ -62,8 +64,8 @@ namespace System.Security.Cryptography {
                 throw new CryptographicUnexpectedOperationException(Environment.GetResourceString("Cryptography_MissingKey"));
 
             byte[] rgbKeyEx;
-            if (_rsaKey is RSACryptoServiceProvider) {
-                rgbKeyEx = ((RSACryptoServiceProvider) _rsaKey).Encrypt(rgbData, false);
+            if (OverridesEncrypt) {
+                rgbKeyEx = _rsaKey.Encrypt(rgbData, RSAEncryptionPadding.Pkcs1);
             }
             else {
                 int cb = _rsaKey.KeySize/8;
@@ -101,5 +103,14 @@ namespace System.Security.Cryptography {
         public override byte[] CreateKeyExchange(byte[] rgbData, Type symAlgType) {
             return CreateKeyExchange(rgbData);
         }
+
+        private bool OverridesEncrypt {
+            get {
+                if (!_rsaOverridesEncrypt.HasValue) {
+                    _rsaOverridesEncrypt = Utils.DoesRsaKeyOverride(_rsaKey, "Encrypt", new Type[] { typeof(byte[]), typeof(RSAEncryptionPadding) });
+                }
+                return _rsaOverridesEncrypt.Value;
+            }
+        }
     }
 }
index 01363fefbdd9af7e2ba30ee609abc430edc9f955..28ee8738639ca84fdb8294c804fe3aeaa7e41dab 100644 (file)
@@ -27,6 +27,7 @@ namespace System.Security.Cryptography {
 
         private RSA    _rsaKey; // RSA Key value to do decrypt operation
         private String _strOID; // OID value for the HASH algorithm
+        private bool?  _rsaOverridesVerifyHash;
 
         //
         // public constructors
@@ -49,6 +50,7 @@ namespace System.Security.Cryptography {
                 throw new ArgumentNullException("key");
             Contract.EndContractBlock();
             _rsaKey = (RSA) key;
+            _rsaOverridesVerifyHash = default(bool?);
         }
 
         public override void SetHashAlgorithm(String strName) {
@@ -70,15 +72,32 @@ namespace System.Security.Cryptography {
 
             // Two cases here -- if we are talking to the CSP version or if we are talking to some other RSA provider.
             if (_rsaKey is RSACryptoServiceProvider) {
+                // This path is kept around for desktop compat: in case someone is using this with a hash algorithm that's known to GetAlgIdFromOid but
+                // not from OidToHashAlgorithmName.
                 int calgHash = X509Utils.GetAlgIdFromOid(_strOID, OidGroup.HashAlgorithm);
                 return ((RSACryptoServiceProvider)_rsaKey).VerifyHash(rgbHash, calgHash, rgbSignature);
             }
+            else if (OverridesVerifyHash) {
+                HashAlgorithmName hashAlgorithmName = Utils.OidToHashAlgorithmName(_strOID);
+                return _rsaKey.VerifyHash(rgbHash, rgbSignature, hashAlgorithmName, RSASignaturePadding.Pkcs1);
+            }
             else {
+                // Fallback compat path for 3rd-party RSA classes that don't override VerifyHash()
+
                 byte[] pad = Utils.RsaPkcs1Padding(_rsaKey, CryptoConfig.EncodeOID(_strOID), rgbHash);
                 // Apply the public key to the signature data to get back the padded buffer actually signed.
                 // Compare the two buffers to see if they match; ignoring any leading zeros
                 return Utils.CompareBigIntArrays(_rsaKey.EncryptValue(rgbSignature), pad);
             }
         }
+
+        private bool OverridesVerifyHash {
+            get {
+                if (!_rsaOverridesVerifyHash.HasValue) {
+                    _rsaOverridesVerifyHash = Utils.DoesRsaKeyOverride(_rsaKey, "VerifyHash", new Type[] { typeof(byte[]), typeof(byte[]), typeof(HashAlgorithmName), typeof(RSASignaturePadding) });
+                }
+                return _rsaOverridesVerifyHash.Value;
+            }
+        }
     }
 }
index 249ea4b072c468c01031abf48083696419c1bbc6..9791242561098c983cdaf92203fbad5431a462ec 100644 (file)
@@ -19,6 +19,7 @@ namespace System.Security.Cryptography {
     public class RSAPKCS1SignatureFormatter : AsymmetricSignatureFormatter {
         private RSA    _rsaKey;
         private String _strOID;
+        private bool?  _rsaOverridesSignHash;
 
         //
         // public constructors
@@ -42,6 +43,7 @@ namespace System.Security.Cryptography {
                 throw new ArgumentNullException("key");
             Contract.EndContractBlock();
             _rsaKey = (RSA) key;
+            _rsaOverridesSignHash = default(bool?);
         }
 
         public override void SetHashAlgorithm(String strName) {
@@ -61,14 +63,31 @@ namespace System.Security.Cryptography {
 
             // Two cases here -- if we are talking to the CSP version or if we are talking to some other RSA provider.
             if (_rsaKey is RSACryptoServiceProvider) {
+                // This path is kept around for desktop compat: in case someone is using this with a hash algorithm that's known to GetAlgIdFromOid but
+                // not from OidToHashAlgorithmName.
                 int calgHash = X509Utils.GetAlgIdFromOid(_strOID, OidGroup.HashAlgorithm);
                 return ((RSACryptoServiceProvider)_rsaKey).SignHash(rgbHash, calgHash);
             }
+            else if (OverridesSignHash) {
+                HashAlgorithmName hashAlgorithmName = Utils.OidToHashAlgorithmName(_strOID);
+                return _rsaKey.SignHash(rgbHash, hashAlgorithmName, RSASignaturePadding.Pkcs1);
+            }
             else {
+                // Fallback compat path for 3rd-party RSA classes that don't override SignHash()
+
                 byte[] pad = Utils.RsaPkcs1Padding(_rsaKey, CryptoConfig.EncodeOID(_strOID), rgbHash);
                 // Create the signature by applying the private key to the padded buffer we just created.
                 return _rsaKey.DecryptValue(pad);
             }
         }
+
+        private bool OverridesSignHash {
+            get {
+                if (!_rsaOverridesSignHash.HasValue) {
+                    _rsaOverridesSignHash = Utils.DoesRsaKeyOverride(_rsaKey, "SignHash", new Type[] { typeof(byte[]), typeof(HashAlgorithmName), typeof(RSASignaturePadding) });
+                }
+                return _rsaOverridesSignHash.Value;
+            }
+        }
     }
 }
index f115e8afc39f82e5a9938938a9c2c11e7c72a0e3..330a0222f098b01ce6b7ad92b38318747007f418 100644 (file)
@@ -83,20 +83,52 @@ namespace System.Security.Cryptography {
         }
     }
 
-    internal class RSAPKCS1SHA1SignatureDescription : SignatureDescription {
-        public RSAPKCS1SHA1SignatureDescription() {
-            KeyAlgorithm = "System.Security.Cryptography.RSACryptoServiceProvider";
-            DigestAlgorithm = "System.Security.Cryptography.SHA1CryptoServiceProvider";
+    internal abstract class RSAPKCS1SignatureDescription : SignatureDescription {
+        protected RSAPKCS1SignatureDescription(string hashAlgorithm, string digestAlgorithm) {
+            KeyAlgorithm = "System.Security.Cryptography.RSA";
+            DigestAlgorithm = digestAlgorithm;
             FormatterAlgorithm = "System.Security.Cryptography.RSAPKCS1SignatureFormatter";
             DeformatterAlgorithm = "System.Security.Cryptography.RSAPKCS1SignatureDeformatter";
+            _hashAlgorithm = hashAlgorithm;
+        }
+        public sealed override AsymmetricSignatureDeformatter CreateDeformatter(AsymmetricAlgorithm key) {
+            AsymmetricSignatureDeformatter item = base.CreateDeformatter(key);
+            item.SetHashAlgorithm(_hashAlgorithm);
+            return item;
         }
 
-        public override AsymmetricSignatureDeformatter CreateDeformatter(AsymmetricAlgorithm key) {
-            AsymmetricSignatureDeformatter item = (AsymmetricSignatureDeformatter) CryptoConfig.CreateFromName(DeformatterAlgorithm);
-            item.SetKey(key);
-            item.SetHashAlgorithm("SHA1");
+        public sealed override AsymmetricSignatureFormatter CreateFormatter(AsymmetricAlgorithm key) {
+            AsymmetricSignatureFormatter item = base.CreateFormatter(key);
+            item.SetHashAlgorithm(_hashAlgorithm);
             return item;
         }
+
+        private string _hashAlgorithm;
+    }
+
+    internal class RSAPKCS1SHA1SignatureDescription : RSAPKCS1SignatureDescription {
+        public RSAPKCS1SHA1SignatureDescription()
+            : base("SHA1", "System.Security.Cryptography.SHA1Cng") {
+        }
+    }
+
+    internal class RSAPKCS1SHA256SignatureDescription : RSAPKCS1SignatureDescription {
+        public RSAPKCS1SHA256SignatureDescription()
+            : base("SHA256", "System.Security.Cryptography.SHA256Cng") {
+        }
+    }
+
+    internal class RSAPKCS1SHA384SignatureDescription : RSAPKCS1SignatureDescription {
+        public RSAPKCS1SHA384SignatureDescription()
+            : base("SHA384", "System.Security.Cryptography.SHA384Cng") {
+        }
+    }
+
+    internal class RSAPKCS1SHA512SignatureDescription : RSAPKCS1SignatureDescription {
+        public RSAPKCS1SHA512SignatureDescription()
+            : base("SHA512", "System.Security.Cryptography.SHA512Cng") {
+        }
     }
 
     internal class DSASignatureDescription : SignatureDescription {
index e8a95fc3be9bc98430dde2f658a65709cca7a3da..cc08a62a05957c141ee98fd95ad107e1053f1d95 100644 (file)
@@ -16,6 +16,7 @@ namespace System.Security.Cryptography
 {
     using Microsoft.Win32;
     using System.IO;
+    using System.Reflection;
     using System.Globalization;
     using System.Runtime.CompilerServices;
     using System.Runtime.InteropServices;
@@ -1017,7 +1018,74 @@ namespace System.Security.Cryptography
         [ResourceExposure(ResourceScope.None)]  // Creates a process resource, but it can't be scoped.
         [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode), SuppressUnmanagedCodeSecurity]
         internal static extern SafeHashHandle CreateHash(SafeProvHandle hProv, int algid);
+#endif
+        internal static HashAlgorithmName OidToHashAlgorithmName(string oid)
+        {
+            switch (oid)
+            {
+                case Constants.OID_OIWSEC_SHA1:
+                    return HashAlgorithmName.SHA1;
+
+                case Constants.OID_OIWSEC_SHA256:
+                    return HashAlgorithmName.SHA256;
 
+                case Constants.OID_OIWSEC_SHA384:
+                    return HashAlgorithmName.SHA384;
+
+                case Constants.OID_OIWSEC_SHA512:
+                    return HashAlgorithmName.SHA512;
+
+                default:
+                    throw new NotSupportedException();
+            }
+        }
+
+        //
+        // Backward-compat hack for third-party RSA-derived classes:
+        // 
+        // Because the SignHash()/VerifyHash()/Encrypt()/Decrypt() methods are new on RSA, we may 
+        // encounter older third-party RSA-derived classes that don't override them
+        // (and if they don't override them, these methods will throw since they are effectively abstract methods that had to declared non-abstract
+        // for backward compat reasons.)
+        //
+        internal static bool DoesRsaKeyOverride(RSA rsaKey, string methodName, Type[] parameterTypes)
+        {
+            // A fast-path check for the common cases where we know we implemented the overrides.
+            Type t = rsaKey.GetType();
+            if (rsaKey is RSACryptoServiceProvider)
+            {
+#if DEBUG
+                // On checked builds, do the slow-path check anyway so it gets exercised.
+                bool foundOverride = DoesRsaKeyOverrideSlowPath(t, methodName, parameterTypes);
+                BCLDebug.Assert(foundOverride, "RSACryptoServiceProvider expected to override " + methodName);
+#endif
+                return true;
+            }
+
+            string fullName = t.FullName;
+            if (fullName == "System.Security.Cryptography.RSACng")
+            {
+#if DEBUG
+                // On checked builds, do the slow-path check anyway so it gets exercised.
+                bool foundOverride = DoesRsaKeyOverrideSlowPath(t, methodName, parameterTypes);
+                BCLDebug.Assert(foundOverride, "RSACng expected to override " + methodName);
+#endif
+                return true;
+            }
+            return DoesRsaKeyOverrideSlowPath(t, methodName, parameterTypes);
+        }
+
+        private static bool DoesRsaKeyOverrideSlowPath(Type t, string methodName, Type[] parameterTypes)
+        {
+            MethodInfo method = t.GetMethod(methodName, BindingFlags.Public | BindingFlags.Instance, null, parameterTypes, null);
+            BCLDebug.Assert(method != null, "method != null"); 
+            Type declaringType = method.DeclaringType;
+            if (declaringType == typeof(RSA))
+                return false;
+
+            return true;
+        }
+#if !MONO
         [System.Security.SecurityCritical]  // auto-generated
         [ResourceExposure(ResourceScope.None)]
         [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode), SuppressUnmanagedCodeSecurity]
index 23f747c04231971c50c00f0114fb22d2ee9b326c..e730084e191969aa3e1fc3376d290738e5d782af 100644 (file)
@@ -159,7 +159,7 @@ namespace System.Security.Cryptography.X509Certificates
                 if (group != OidGroup.AllGroups) {
                     IntPtr allGroupOidInfo = CryptFindOIDInfo(keyType, rawKey, OidGroup.AllGroups);
                     if (allGroupOidInfo != IntPtr.Zero) {
-                        return (CRYPT_OID_INFO)Marshal.PtrToStructure(fullOidInfo, typeof(CRYPT_OID_INFO));
+                        return (CRYPT_OID_INFO)Marshal.PtrToStructure(allGroupOidInfo, typeof(CRYPT_OID_INFO));
                     }
                 }
 
index 02ef088b5e67b3c0f83d136fcac8d765b1f64847..db35ac502b007c51c1cd1ccf4ce0bab61f5331ea 100644 (file)
@@ -24,9 +24,9 @@ namespace System.Security.Permissions {
     using System.Runtime.Versioning;
     using System.Diagnostics.Contracts;
 
-[Serializable]
+    [Serializable]
     [Flags]
-[System.Runtime.InteropServices.ComVisible(true)]
+    [System.Runtime.InteropServices.ComVisible(true)]
     public enum FileIOPermissionAccess
     {
         NoAccess = 0x00,
@@ -36,9 +36,8 @@ namespace System.Security.Permissions {
         PathDiscovery = 0x08,
         AllAccess = 0x0F,
     }
-    
-    
-[System.Runtime.InteropServices.ComVisible(true)]
+
+    [System.Runtime.InteropServices.ComVisible(true)]
     [Serializable]
     sealed public class FileIOPermission : CodeAccessPermission, IUnrestrictedPermission, IBuiltInPermission
     {
@@ -51,7 +50,7 @@ namespace System.Security.Permissions {
         [OptionalField(VersionAdded = 2)]
         private FileIOAccess m_changeAcl;
         private bool m_unrestricted;
-        
+
         public FileIOPermission(PermissionState state)
         {
             if (state == PermissionState.Unrestricted)
@@ -67,91 +66,91 @@ namespace System.Security.Permissions {
                 throw new ArgumentException(Environment.GetResourceString("Argument_InvalidPermissionState"));
             }
         }
-        
+
         [System.Security.SecuritySafeCritical]  // auto-generated
-        public FileIOPermission( FileIOPermissionAccess access, String path )
+        public FileIOPermission(FileIOPermissionAccess access, String path)
         {
-            VerifyAccess( access );
-        
+            VerifyAccess(access);
+
             String[] pathList = new String[] { path };
-            AddPathList( access, pathList, false, true, false );
+            AddPathList(access, pathList, false, true, false);
         }
-        
+
         [System.Security.SecuritySafeCritical]  // auto-generated
-        public FileIOPermission( FileIOPermissionAccess access, String[] pathList )
+        public FileIOPermission(FileIOPermissionAccess access, String[] pathList)
         {
-            VerifyAccess( access );
-        
-            AddPathList( access, pathList, false, true, false );
+            VerifyAccess(access);
+
+            AddPathList(access, pathList, false, true, false);
         }
 
 #if FEATURE_MACL
         [System.Security.SecuritySafeCritical]  // auto-generated
-        public FileIOPermission( FileIOPermissionAccess access, AccessControlActions control, String path )
+        public FileIOPermission(FileIOPermissionAccess access, AccessControlActions control, String path)
         {
-            VerifyAccess( access );
-        
+            VerifyAccess(access);
+
             String[] pathList = new String[] { path };
-            AddPathList( access, control, pathList, false, true, false );
+            AddPathList(access, control, pathList, false, true, false);
         }
-        
+
         [System.Security.SecuritySafeCritical]  // auto-generated
-        public FileIOPermission( FileIOPermissionAccess access, AccessControlActions control, String[] pathList )
-            : this( access, control, pathList, true, true )
+        public FileIOPermission(FileIOPermissionAccess access, AccessControlActions control, String[] pathList)
+            : this(access, control, pathList, true, true)
         {
         }
 #endif
 
         [System.Security.SecurityCritical]  // auto-generated
-        internal FileIOPermission( FileIOPermissionAccess access, String[] pathList, bool checkForDuplicates, bool needFullPath )
+        internal FileIOPermission(FileIOPermissionAccess access, String[] pathList, bool checkForDuplicates, bool needFullPath)
         {
-            VerifyAccess( access );
-        
-            AddPathList( access, pathList, checkForDuplicates, needFullPath, true );
+            VerifyAccess(access);
+
+            AddPathList(access, pathList, checkForDuplicates, needFullPath, true);
         }
 
 #if FEATURE_MACL
         [System.Security.SecurityCritical]  // auto-generated
-        internal FileIOPermission( FileIOPermissionAccess access, AccessControlActions control, String[] pathList, bool checkForDuplicates, bool needFullPath )
+        internal FileIOPermission(FileIOPermissionAccess access, AccessControlActions control, String[] pathList, bool checkForDuplicates, bool needFullPath)
         {
-            VerifyAccess( access );
-        
-            AddPathList( access, control, pathList, checkForDuplicates, needFullPath, true );
+            VerifyAccess(access);
+
+            AddPathList(access, control, pathList, checkForDuplicates, needFullPath, true);
         }
 #endif
 
-        public void SetPathList( FileIOPermissionAccess access, String path )
+        public void SetPathList(FileIOPermissionAccess access, String path)
         {
             String[] pathList;
-            if(path == null)
-                pathList = new String[] {};
+            if (path == null)
+                pathList = new String[] { };
             else
                 pathList = new String[] { path };
-            SetPathList( access, pathList, false );
+            SetPathList(access, pathList, false);
         }
-            
-        public void SetPathList( FileIOPermissionAccess access, String[] pathList )
+
+        public void SetPathList(FileIOPermissionAccess access, String[] pathList)
         {
-            SetPathList( access, pathList, true );
+            SetPathList(access, pathList, true);
         }
 
-        internal void SetPathList( FileIOPermissionAccess access, 
-            String[] pathList, bool checkForDuplicates )
+        internal void SetPathList(FileIOPermissionAccess access,
+            String[] pathList, bool checkForDuplicates)
         {
-            SetPathList( access, AccessControlActions.None, pathList, checkForDuplicates );
+            SetPathList(access, AccessControlActions.None, pathList, checkForDuplicates);
         }
 
         [System.Security.SecuritySafeCritical]  // auto-generated
-        internal void SetPathList( FileIOPermissionAccess access, AccessControlActions control, String[] pathList, bool checkForDuplicates )
+        internal void SetPathList(FileIOPermissionAccess access, AccessControlActions control, String[] pathList, bool checkForDuplicates)
         {
-            VerifyAccess( access );
-            
+            VerifyAccess(access);
+
             if ((access & FileIOPermissionAccess.Read) != 0)
                 m_read = null;
-            
+
             if ((access & FileIOPermissionAccess.Write) != 0)
                 m_write = null;
-    
+
             if ((access & FileIOPermissionAccess.Append) != 0)
                 m_append = null;
 
@@ -168,36 +167,36 @@ namespace System.Security.Permissions {
             m_viewAcl = null;
             m_changeAcl = null;
 #endif
-            
+
             m_unrestricted = false;
 #if FEATURE_MACL
-            AddPathList( access, control, pathList, checkForDuplicates, true, true );
+            AddPathList(access, control, pathList, checkForDuplicates, true, true);
 #else
             AddPathList( access, pathList, checkForDuplicates, true, true );
 #endif
         }
 
         [System.Security.SecuritySafeCritical]  // auto-generated
-        public void AddPathList( FileIOPermissionAccess access, String path )
+        public void AddPathList(FileIOPermissionAccess access, String path)
         {
             String[] pathList;
-            if(path == null)
-                pathList = new String[] {};
+            if (path == null)
+                pathList = new String[] { };
             else
                 pathList = new String[] { path };
-            AddPathList( access, pathList, false, true, false );
+            AddPathList(access, pathList, false, true, false);
         }
 
         [System.Security.SecuritySafeCritical]  // auto-generated
-        public void AddPathList( FileIOPermissionAccess access, String[] pathList )
+        public void AddPathList(FileIOPermissionAccess access, String[] pathList)
         {
-            AddPathList( access, pathList, true, true, true );
+            AddPathList(access, pathList, true, true, true);
         }
 
         [System.Security.SecurityCritical]  // auto-generated
-        internal void AddPathList( FileIOPermissionAccess access, String[] pathListOrig, bool checkForDuplicates, bool needFullPath, bool copyPathList )
+        internal void AddPathList(FileIOPermissionAccess access, String[] pathListOrig, bool checkForDuplicates, bool needFullPath, bool copyPathList)
         {
-            AddPathList( access, AccessControlActions.None, pathListOrig, checkForDuplicates, needFullPath, copyPathList );
+            AddPathList(access, AccessControlActions.None, pathListOrig, checkForDuplicates, needFullPath, copyPathList);
         }
 
         [System.Security.SecurityCritical]  // auto-generated
@@ -205,65 +204,73 @@ namespace System.Security.Permissions {
         {
             if (pathListOrig == null)
             {
-                throw new ArgumentNullException( "pathList" );    
+                throw new ArgumentNullException("pathList");
             }
             if (pathListOrig.Length == 0)
             {
-                throw new ArgumentException( Environment.GetResourceString("Argument_EmptyPath" ));    
+                throw new ArgumentException(Environment.GetResourceString("Argument_EmptyPath"));
             }
             Contract.EndContractBlock();
             // @
 
             VerifyAccess(access);
-                
+
             if (m_unrestricted)
                 return;
 
             String[] pathList = pathListOrig;
-            if(copyPathList)
+            if (copyPathList)
             {
                 // Make a copy of pathList (in case its value changes after we check for illegal chars)
                 pathList = new String[pathListOrig.Length];
                 Array.Copy(pathListOrig, pathList, pathListOrig.Length);
             }
 
-            CheckIllegalCharacters( pathList );
+            // If we need the full path the standard illegal characters will be checked in StringExpressionSet.
+            CheckIllegalCharacters(pathList, onlyCheckExtras: needFullPath);
+
+            // StringExpressionSet will do minor normalization, trimming spaces and replacing alternate
+            // directory separators. It will make an attemt to expand short file names and will check
+            // for standard colon placement.
+            //
+            // If needFullPath is true it will call NormalizePath- which performs short name expansion
+            // and does the normal validity checks.
             ArrayList pathArrayList = StringExpressionSet.CreateListFromExpressions(pathList, needFullPath);
-            
+
             if ((access & FileIOPermissionAccess.Read) != 0)
             {
                 if (m_read == null)
                 {
                     m_read = new FileIOAccess();
                 }
-                m_read.AddExpressions( pathArrayList, checkForDuplicates);
+                m_read.AddExpressions(pathArrayList, checkForDuplicates);
             }
-            
+
             if ((access & FileIOPermissionAccess.Write) != 0)
             {
                 if (m_write == null)
                 {
                     m_write = new FileIOAccess();
                 }
-                m_write.AddExpressions( pathArrayList, checkForDuplicates);
+                m_write.AddExpressions(pathArrayList, checkForDuplicates);
             }
-    
+
             if ((access & FileIOPermissionAccess.Append) != 0)
             {
                 if (m_append == null)
                 {
                     m_append = new FileIOAccess();
                 }
-                m_append.AddExpressions( pathArrayList, checkForDuplicates);
+                m_append.AddExpressions(pathArrayList, checkForDuplicates);
             }
 
             if ((access & FileIOPermissionAccess.PathDiscovery) != 0)
             {
                 if (m_pathDiscovery == null)
                 {
-                    m_pathDiscovery = new FileIOAccess( true );
+                    m_pathDiscovery = new FileIOAccess(true);
                 }
-                m_pathDiscovery.AddExpressions( pathArrayList, checkForDuplicates);
+                m_pathDiscovery.AddExpressions(pathArrayList, checkForDuplicates);
             }
 
 #if FEATURE_MACL
@@ -273,7 +280,7 @@ namespace System.Security.Permissions {
                 {
                     m_viewAcl = new FileIOAccess();
                 }
-                m_viewAcl.AddExpressions( pathArrayList, checkForDuplicates);
+                m_viewAcl.AddExpressions(pathArrayList, checkForDuplicates);
             }
 
             if ((control & AccessControlActions.Change) != 0)
@@ -282,18 +289,18 @@ namespace System.Security.Permissions {
                 {
                     m_changeAcl = new FileIOAccess();
                 }
-                m_changeAcl.AddExpressions( pathArrayList, checkForDuplicates);
+                m_changeAcl.AddExpressions(pathArrayList, checkForDuplicates);
             }
 #endif
         }
-        
+
         [SecuritySafeCritical]
-        public String[] GetPathList( FileIOPermissionAccess access )
+        public String[] GetPathList(FileIOPermissionAccess access)
         {
-            VerifyAccess( access );
-            ExclusiveAccess( access );
-    
-            if (AccessIsSet( access, FileIOPermissionAccess.Read ))
+            VerifyAccess(access);
+            ExclusiveAccess(access);
+
+            if (AccessIsSet(access, FileIOPermissionAccess.Read))
             {
                 if (m_read == null)
                 {
@@ -301,8 +308,8 @@ namespace System.Security.Permissions {
                 }
                 return m_read.ToStringArray();
             }
-            
-            if (AccessIsSet( access, FileIOPermissionAccess.Write ))
+
+            if (AccessIsSet(access, FileIOPermissionAccess.Write))
             {
                 if (m_write == null)
                 {
@@ -310,8 +317,8 @@ namespace System.Security.Permissions {
                 }
                 return m_write.ToStringArray();
             }
-    
-            if (AccessIsSet( access, FileIOPermissionAccess.Append ))
+
+            if (AccessIsSet(access, FileIOPermissionAccess.Append))
             {
                 if (m_append == null)
                 {
@@ -319,8 +326,8 @@ namespace System.Security.Permissions {
                 }
                 return m_append.ToStringArray();
             }
-            
-            if (AccessIsSet( access, FileIOPermissionAccess.PathDiscovery ))
+
+            if (AccessIsSet(access, FileIOPermissionAccess.PathDiscovery))
             {
                 if (m_pathDiscovery == null)
                 {
@@ -330,10 +337,10 @@ namespace System.Security.Permissions {
             }
 
             // not reached
-            
+
             return null;
         }
-        
+
 
         public FileIOPermissionAccess AllLocalFiles
         {
@@ -341,19 +348,19 @@ namespace System.Security.Permissions {
             {
                 if (m_unrestricted)
                     return FileIOPermissionAccess.AllAccess;
-            
+
                 FileIOPermissionAccess access = FileIOPermissionAccess.NoAccess;
-                
+
                 if (m_read != null && m_read.AllLocalFiles)
                 {
                     access |= FileIOPermissionAccess.Read;
                 }
-                
+
                 if (m_write != null && m_write.AllLocalFiles)
                 {
                     access |= FileIOPermissionAccess.Write;
                 }
-                
+
                 if (m_append != null && m_append.AllLocalFiles)
                 {
                     access |= FileIOPermissionAccess.Append;
@@ -363,17 +370,17 @@ namespace System.Security.Permissions {
                 {
                     access |= FileIOPermissionAccess.PathDiscovery;
                 }
-                
+
                 return access;
             }
-            
+
             set
             {
                 if ((value & FileIOPermissionAccess.Read) != 0)
                 {
                     if (m_read == null)
                         m_read = new FileIOAccess();
-                        
+
                     m_read.AllLocalFiles = true;
                 }
                 else
@@ -381,12 +388,12 @@ namespace System.Security.Permissions {
                     if (m_read != null)
                         m_read.AllLocalFiles = false;
                 }
-                
+
                 if ((value & FileIOPermissionAccess.Write) != 0)
                 {
                     if (m_write == null)
                         m_write = new FileIOAccess();
-                        
+
                     m_write.AllLocalFiles = true;
                 }
                 else
@@ -394,12 +401,12 @@ namespace System.Security.Permissions {
                     if (m_write != null)
                         m_write.AllLocalFiles = false;
                 }
-                
+
                 if ((value & FileIOPermissionAccess.Append) != 0)
                 {
                     if (m_append == null)
                         m_append = new FileIOAccess();
-                        
+
                     m_append.AllLocalFiles = true;
                 }
                 else
@@ -411,8 +418,8 @@ namespace System.Security.Permissions {
                 if ((value & FileIOPermissionAccess.PathDiscovery) != 0)
                 {
                     if (m_pathDiscovery == null)
-                        m_pathDiscovery = new FileIOAccess( true );
-                        
+                        m_pathDiscovery = new FileIOAccess(true);
+
                     m_pathDiscovery.AllLocalFiles = true;
                 }
                 else
@@ -423,31 +430,31 @@ namespace System.Security.Permissions {
 
             }
         }
-        
+
         public FileIOPermissionAccess AllFiles
         {
             get
             {
                 if (m_unrestricted)
                     return FileIOPermissionAccess.AllAccess;
-            
+
                 FileIOPermissionAccess access = FileIOPermissionAccess.NoAccess;
-                
+
                 if (m_read != null && m_read.AllFiles)
                 {
                     access |= FileIOPermissionAccess.Read;
                 }
-                
+
                 if (m_write != null && m_write.AllFiles)
                 {
                     access |= FileIOPermissionAccess.Write;
                 }
-                
+
                 if (m_append != null && m_append.AllFiles)
                 {
                     access |= FileIOPermissionAccess.Append;
                 }
-                
+
                 if (m_pathDiscovery != null && m_pathDiscovery.AllFiles)
                 {
                     access |= FileIOPermissionAccess.PathDiscovery;
@@ -455,7 +462,7 @@ namespace System.Security.Permissions {
 
                 return access;
             }
-            
+
             set
             {
                 if (value == FileIOPermissionAccess.AllAccess)
@@ -463,12 +470,12 @@ namespace System.Security.Permissions {
                     m_unrestricted = true;
                     return;
                 }
-            
+
                 if ((value & FileIOPermissionAccess.Read) != 0)
                 {
                     if (m_read == null)
                         m_read = new FileIOAccess();
-                        
+
                     m_read.AllFiles = true;
                 }
                 else
@@ -476,12 +483,12 @@ namespace System.Security.Permissions {
                     if (m_read != null)
                         m_read.AllFiles = false;
                 }
-                
+
                 if ((value & FileIOPermissionAccess.Write) != 0)
                 {
                     if (m_write == null)
                         m_write = new FileIOAccess();
-                        
+
                     m_write.AllFiles = true;
                 }
                 else
@@ -489,12 +496,12 @@ namespace System.Security.Permissions {
                     if (m_write != null)
                         m_write.AllFiles = false;
                 }
-                
+
                 if ((value & FileIOPermissionAccess.Append) != 0)
                 {
                     if (m_append == null)
                         m_append = new FileIOAccess();
-                        
+
                     m_append.AllFiles = true;
                 }
                 else
@@ -506,8 +513,8 @@ namespace System.Security.Permissions {
                 if ((value & FileIOPermissionAccess.PathDiscovery) != 0)
                 {
                     if (m_pathDiscovery == null)
-                        m_pathDiscovery = new FileIOAccess( true );
-                        
+                        m_pathDiscovery = new FileIOAccess(true);
+
                     m_pathDiscovery.AllFiles = true;
                 }
                 else
@@ -517,42 +524,70 @@ namespace System.Security.Permissions {
                 }
 
             }
-        }        
-        
+        }
+
         [Pure]
-        private static void VerifyAccess( FileIOPermissionAccess access )
+        private static void VerifyAccess(FileIOPermissionAccess access)
         {
             if ((access & ~FileIOPermissionAccess.AllAccess) != 0)
                 throw new ArgumentException(Environment.GetResourceString("Arg_EnumIllegalVal", (int)access));
         }
-        
+
         [Pure]
-        private static void ExclusiveAccess( FileIOPermissionAccess access )
+        private static void ExclusiveAccess(FileIOPermissionAccess access)
         {
             if (access == FileIOPermissionAccess.NoAccess)
             {
-                throw new ArgumentException( Environment.GetResourceString("Arg_EnumNotSingleFlag") ); 
+                throw new ArgumentException(Environment.GetResourceString("Arg_EnumNotSingleFlag"));
             }
-    
-            if (((int) access & ((int)access-1)) != 0)
+
+            if (((int)access & ((int)access - 1)) != 0)
             {
-                throw new ArgumentException( Environment.GetResourceString("Arg_EnumNotSingleFlag") ); 
+                throw new ArgumentException(Environment.GetResourceString("Arg_EnumNotSingleFlag"));
             }
         }
 
-        private static void CheckIllegalCharacters( String[] str )
+        private static void CheckIllegalCharacters(String[] str, bool onlyCheckExtras)
         {
             for (int i = 0; i < str.Length; ++i)
             {
-                Path.CheckInvalidPathChars(str[i], true);
+                // FileIOPermission doesn't allow for normalizing across various volume names. This means "C:\" and
+                // "\\?\C:\" won't be considered correctly. In addition there are many other aliases for the volume
+                // besides "C:" such as (in one concrete example) "\\?\Harddisk0Partition2\", "\\?\HarddiskVolume6\",
+                // "\\?\Volume{d1655348-0000-0000-0000-f01500000000}\", etc.
+                //
+                // We'll continue to explicitly block extended syntax here by disallowing wildcards no matter where
+                // they occur in the string (e.g. \\?\ isn't ok)
+                if (CheckExtraPathCharacters(str[i]))
+                    throw new ArgumentException(Environment.GetResourceString("Argument_InvalidPathChars"));
+
+                if (!onlyCheckExtras)
+                    Path.CheckInvalidPathChars(str[i]);
             }
         }
 
-        private static bool AccessIsSet( FileIOPermissionAccess access, FileIOPermissionAccess question )
+        /// <summary>
+        /// Check for ?,* and null, ignoring extended syntax.
+        /// </summary>
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
+        private unsafe static bool CheckExtraPathCharacters(string path)
+        {
+            char currentChar;
+            for (int i = 0; i < path.Length; i++)
+            {
+                currentChar = path[i];
+
+                // We also check for null here as StringExpressionSet will trim it out. (Ensuring we still throw as we always have.)
+                if (currentChar == '*' || currentChar == '?' || currentChar == '\0') return true;
+            }
+            return false;
+        }
+
+        private static bool AccessIsSet(FileIOPermissionAccess access, FileIOPermissionAccess question)
         {
             return (access & question) != 0;
         }
-        
+
         private bool IsEmpty()
         {
             return (!m_unrestricted &&
@@ -563,24 +598,24 @@ namespace System.Security.Permissions {
                     (this.m_viewAcl == null || this.m_viewAcl.IsEmpty()) &&
                     (this.m_changeAcl == null || this.m_changeAcl.IsEmpty()));
         }
-        
+
         //------------------------------------------------------
         //
         // CODEACCESSPERMISSION IMPLEMENTATION
         //
         //------------------------------------------------------
-        
+
         public bool IsUnrestricted()
         {
             return m_unrestricted;
         }
-        
+
         //------------------------------------------------------
         //
         // IPERMISSION IMPLEMENTATION
         //
         //------------------------------------------------------
-        
+
         public override bool IsSubsetOf(IPermission target)
         {
             if (target == null)
@@ -597,14 +632,14 @@ namespace System.Security.Permissions {
             else if (this.IsUnrestricted())
                 return false;
             else
-                return ((this.m_read == null || this.m_read.IsSubsetOf( operand.m_read )) &&
-                        (this.m_write == null || this.m_write.IsSubsetOf( operand.m_write )) &&
-                        (this.m_append == null || this.m_append.IsSubsetOf( operand.m_append )) &&
-                        (this.m_pathDiscovery == null || this.m_pathDiscovery.IsSubsetOf( operand.m_pathDiscovery )) &&
-                        (this.m_viewAcl == null || this.m_viewAcl.IsSubsetOf( operand.m_viewAcl )) &&
-                        (this.m_changeAcl == null || this.m_changeAcl.IsSubsetOf( operand.m_changeAcl )));
+                return ((this.m_read == null || this.m_read.IsSubsetOf(operand.m_read)) &&
+                        (this.m_write == null || this.m_write.IsSubsetOf(operand.m_write)) &&
+                        (this.m_append == null || this.m_append.IsSubsetOf(operand.m_append)) &&
+                        (this.m_pathDiscovery == null || this.m_pathDiscovery.IsSubsetOf(operand.m_pathDiscovery)) &&
+                        (this.m_viewAcl == null || this.m_viewAcl.IsSubsetOf(operand.m_viewAcl)) &&
+                        (this.m_changeAcl == null || this.m_changeAcl.IsSubsetOf(operand.m_changeAcl)));
         }
-      
+
         public override IPermission Intersect(IPermission target)
         {
             if (target == null)
@@ -622,18 +657,18 @@ namespace System.Security.Permissions {
             {
                 return target.Copy();
             }
-    
+
             if (operand.IsUnrestricted())
             {
                 return this.Copy();
             }
-            
-            FileIOAccess intersectRead = this.m_read == null ? null : this.m_read.Intersect( operand.m_read );
-            FileIOAccess intersectWrite = this.m_write == null ? null : this.m_write.Intersect( operand.m_write );
-            FileIOAccess intersectAppend = this.m_append == null ? null : this.m_append.Intersect( operand.m_append );
-            FileIOAccess intersectPathDiscovery = this.m_pathDiscovery == null ? null : this.m_pathDiscovery.Intersect( operand.m_pathDiscovery );
-            FileIOAccess intersectViewAcl = this.m_viewAcl == null ? null : this.m_viewAcl.Intersect( operand.m_viewAcl );
-            FileIOAccess intersectChangeAcl = this.m_changeAcl == null ? null : this.m_changeAcl.Intersect( operand.m_changeAcl );
+
+            FileIOAccess intersectRead = this.m_read == null ? null : this.m_read.Intersect(operand.m_read);
+            FileIOAccess intersectWrite = this.m_write == null ? null : this.m_write.Intersect(operand.m_write);
+            FileIOAccess intersectAppend = this.m_append == null ? null : this.m_append.Intersect(operand.m_append);
+            FileIOAccess intersectPathDiscovery = this.m_pathDiscovery == null ? null : this.m_pathDiscovery.Intersect(operand.m_pathDiscovery);
+            FileIOAccess intersectViewAcl = this.m_viewAcl == null ? null : this.m_viewAcl.Intersect(operand.m_viewAcl);
+            FileIOAccess intersectChangeAcl = this.m_changeAcl == null ? null : this.m_changeAcl.Intersect(operand.m_changeAcl);
 
             if ((intersectRead == null || intersectRead.IsEmpty()) &&
                 (intersectWrite == null || intersectWrite.IsEmpty()) &&
@@ -644,7 +679,7 @@ namespace System.Security.Permissions {
             {
                 return null;
             }
-            
+
             FileIOPermission intersectPermission = new FileIOPermission(PermissionState.None);
             intersectPermission.m_unrestricted = false;
             intersectPermission.m_read = intersectRead;
@@ -653,10 +688,10 @@ namespace System.Security.Permissions {
             intersectPermission.m_pathDiscovery = intersectPathDiscovery;
             intersectPermission.m_viewAcl = intersectViewAcl;
             intersectPermission.m_changeAcl = intersectChangeAcl;
-            
+
             return intersectPermission;
         }
-        
+
         public override IPermission Union(IPermission other)
         {
             if (other == null)
@@ -670,19 +705,19 @@ namespace System.Security.Permissions {
             {
                 throw new ArgumentException(Environment.GetResourceString("Argument_WrongType", this.GetType().FullName));
             }
-    
+
             if (this.IsUnrestricted() || operand.IsUnrestricted())
             {
-                return new FileIOPermission( PermissionState.Unrestricted );
+                return new FileIOPermission(PermissionState.Unrestricted);
             }
-    
-            FileIOAccess unionRead = this.m_read == null ? operand.m_read : this.m_read.Union( operand.m_read );
-            FileIOAccess unionWrite = this.m_write == null ? operand.m_write : this.m_write.Union( operand.m_write );
-            FileIOAccess unionAppend = this.m_append == null ? operand.m_append : this.m_append.Union( operand.m_append );
-            FileIOAccess unionPathDiscovery = this.m_pathDiscovery == null ? operand.m_pathDiscovery : this.m_pathDiscovery.Union( operand.m_pathDiscovery );
-            FileIOAccess unionViewAcl = this.m_viewAcl == null ? operand.m_viewAcl : this.m_viewAcl.Union( operand.m_viewAcl );
-            FileIOAccess unionChangeAcl = this.m_changeAcl == null ? operand.m_changeAcl : this.m_changeAcl.Union( operand.m_changeAcl );
-            
+
+            FileIOAccess unionRead = this.m_read == null ? operand.m_read : this.m_read.Union(operand.m_read);
+            FileIOAccess unionWrite = this.m_write == null ? operand.m_write : this.m_write.Union(operand.m_write);
+            FileIOAccess unionAppend = this.m_append == null ? operand.m_append : this.m_append.Union(operand.m_append);
+            FileIOAccess unionPathDiscovery = this.m_pathDiscovery == null ? operand.m_pathDiscovery : this.m_pathDiscovery.Union(operand.m_pathDiscovery);
+            FileIOAccess unionViewAcl = this.m_viewAcl == null ? operand.m_viewAcl : this.m_viewAcl.Union(operand.m_viewAcl);
+            FileIOAccess unionChangeAcl = this.m_changeAcl == null ? operand.m_changeAcl : this.m_changeAcl.Union(operand.m_changeAcl);
+
             if ((unionRead == null || unionRead.IsEmpty()) &&
                 (unionWrite == null || unionWrite.IsEmpty()) &&
                 (unionAppend == null || unionAppend.IsEmpty()) &&
@@ -692,7 +727,7 @@ namespace System.Security.Permissions {
             {
                 return null;
             }
-            
+
             FileIOPermission unionPermission = new FileIOPermission(PermissionState.None);
             unionPermission.m_unrestricted = false;
             unionPermission.m_read = unionRead;
@@ -702,9 +737,9 @@ namespace System.Security.Permissions {
             unionPermission.m_viewAcl = unionViewAcl;
             unionPermission.m_changeAcl = unionChangeAcl;
 
-            return unionPermission;    
+            return unionPermission;
         }
-        
+
         public override IPermission Copy()
         {
             FileIOPermission copy = new FileIOPermission(PermissionState.None);
@@ -740,97 +775,97 @@ namespace System.Security.Permissions {
                     copy.m_changeAcl = this.m_changeAcl.Copy();
                 }
             }
-            return copy;   
+            return copy;
         }
-   
+
 #if FEATURE_CAS_POLICY
         public override SecurityElement ToXml()
         {
-            SecurityElement esd = CodeAccessPermission.CreatePermissionElement( this, "System.Security.Permissions.FileIOPermission" );
+            SecurityElement esd = CodeAccessPermission.CreatePermissionElement(this, "System.Security.Permissions.FileIOPermission");
             if (!IsUnrestricted())
             {
                 if (this.m_read != null && !this.m_read.IsEmpty())
                 {
-                    esd.AddAttribute( "Read", SecurityElement.Escape( m_read.ToString() ) );
+                    esd.AddAttribute("Read", SecurityElement.Escape(m_read.ToString()));
                 }
                 if (this.m_write != null && !this.m_write.IsEmpty())
                 {
-                    esd.AddAttribute( "Write", SecurityElement.Escape( m_write.ToString() ) );
+                    esd.AddAttribute("Write", SecurityElement.Escape(m_write.ToString()));
                 }
                 if (this.m_append != null && !this.m_append.IsEmpty())
                 {
-                    esd.AddAttribute( "Append", SecurityElement.Escape( m_append.ToString() ) );
+                    esd.AddAttribute("Append", SecurityElement.Escape(m_append.ToString()));
                 }
                 if (this.m_pathDiscovery != null && !this.m_pathDiscovery.IsEmpty())
                 {
-                    esd.AddAttribute( "PathDiscovery", SecurityElement.Escape( m_pathDiscovery.ToString() ) );
+                    esd.AddAttribute("PathDiscovery", SecurityElement.Escape(m_pathDiscovery.ToString()));
                 }
                 if (this.m_viewAcl != null && !this.m_viewAcl.IsEmpty())
                 {
-                    esd.AddAttribute( "ViewAcl", SecurityElement.Escape( m_viewAcl.ToString() ) );
+                    esd.AddAttribute("ViewAcl", SecurityElement.Escape(m_viewAcl.ToString()));
                 }
                 if (this.m_changeAcl != null && !this.m_changeAcl.IsEmpty())
                 {
-                    esd.AddAttribute( "ChangeAcl", SecurityElement.Escape( m_changeAcl.ToString() ) );
+                    esd.AddAttribute("ChangeAcl", SecurityElement.Escape(m_changeAcl.ToString()));
                 }
 
             }
             else
             {
-                esd.AddAttribute( "Unrestricted", "true" );
+                esd.AddAttribute("Unrestricted", "true");
             }
             return esd;
         }
-        
+
         [System.Security.SecuritySafeCritical]  // auto-generated
         public override void FromXml(SecurityElement esd)
         {
-            CodeAccessPermission.ValidateElement( esd, this );
+            CodeAccessPermission.ValidateElement(esd, this);
             String et;
-            
+
             if (XMLUtil.IsUnrestricted(esd))
             {
                 m_unrestricted = true;
                 return;
             }
-    
-            
+
+
             m_unrestricted = false;
-            
-            et = esd.Attribute( "Read" );
+
+            et = esd.Attribute("Read");
             if (et != null)
             {
-                m_read = new FileIOAccess( et );
+                m_read = new FileIOAccess(et);
             }
             else
             {
                 m_read = null;
             }
-            
-            et = esd.Attribute( "Write" );
+
+            et = esd.Attribute("Write");
             if (et != null)
             {
-                m_write = new FileIOAccess( et );
+                m_write = new FileIOAccess(et);
             }
             else
             {
                 m_write = null;
             }
-    
-            et = esd.Attribute( "Append" );
+
+            et = esd.Attribute("Append");
             if (et != null)
             {
-                m_append = new FileIOAccess( et );
+                m_append = new FileIOAccess(et);
             }
             else
             {
                 m_append = null;
             }
 
-            et = esd.Attribute( "PathDiscovery" );
+            et = esd.Attribute("PathDiscovery");
             if (et != null)
             {
-                m_pathDiscovery = new FileIOAccess( et );
+                m_pathDiscovery = new FileIOAccess(et);
                 m_pathDiscovery.PathDiscovery = true;
             }
             else
@@ -838,20 +873,20 @@ namespace System.Security.Permissions {
                 m_pathDiscovery = null;
             }
 
-            et = esd.Attribute( "ViewAcl" );
+            et = esd.Attribute("ViewAcl");
             if (et != null)
             {
-                m_viewAcl = new FileIOAccess( et );
+                m_viewAcl = new FileIOAccess(et);
             }
             else
             {
                 m_viewAcl = null;
             }
 
-            et = esd.Attribute( "ChangeAcl" );
+            et = esd.Attribute("ChangeAcl");
             if (et != null)
             {
-                m_changeAcl = new FileIOAccess( et );
+                m_changeAcl = new FileIOAccess(et);
             }
             else
             {
@@ -875,60 +910,60 @@ namespace System.Security.Permissions {
         public override bool Equals(Object obj)
         {
             FileIOPermission perm = obj as FileIOPermission;
-            if(perm == null)
+            if (perm == null)
                 return false;
 
-            if(m_unrestricted && perm.m_unrestricted)
+            if (m_unrestricted && perm.m_unrestricted)
                 return true;
-            if(m_unrestricted != perm.m_unrestricted)
+            if (m_unrestricted != perm.m_unrestricted)
                 return false;
 
-            if(m_read == null)
+            if (m_read == null)
             {
-                if(perm.m_read != null && !perm.m_read.IsEmpty())
+                if (perm.m_read != null && !perm.m_read.IsEmpty())
                     return false;
             }
-            else if(!m_read.Equals(perm.m_read))
+            else if (!m_read.Equals(perm.m_read))
                 return false;
 
-            if(m_write == null)
+            if (m_write == null)
             {
-                if(perm.m_write != null && !perm.m_write.IsEmpty())
-                    return false; 
+                if (perm.m_write != null && !perm.m_write.IsEmpty())
+                    return false;
             }
-            else if(!m_write.Equals(perm.m_write))
+            else if (!m_write.Equals(perm.m_write))
                 return false;
 
-            if(m_append == null)
+            if (m_append == null)
             {
-                if(perm.m_append != null && !perm.m_append.IsEmpty())
-                    return false; 
+                if (perm.m_append != null && !perm.m_append.IsEmpty())
+                    return false;
             }
-            else if(!m_append.Equals(perm.m_append))
+            else if (!m_append.Equals(perm.m_append))
                 return false;
 
-            if(m_pathDiscovery == null)
+            if (m_pathDiscovery == null)
             {
-                if(perm.m_pathDiscovery != null && !perm.m_pathDiscovery.IsEmpty())
-                    return false; 
+                if (perm.m_pathDiscovery != null && !perm.m_pathDiscovery.IsEmpty())
+                    return false;
             }
-            else if(!m_pathDiscovery.Equals(perm.m_pathDiscovery))
+            else if (!m_pathDiscovery.Equals(perm.m_pathDiscovery))
                 return false;
 
-            if(m_viewAcl == null)
+            if (m_viewAcl == null)
             {
-                if(perm.m_viewAcl != null && !perm.m_viewAcl.IsEmpty())
-                    return false; 
+                if (perm.m_viewAcl != null && !perm.m_viewAcl.IsEmpty())
+                    return false;
             }
-            else if(!m_viewAcl.Equals(perm.m_viewAcl))
+            else if (!m_viewAcl.Equals(perm.m_viewAcl))
                 return false;
 
-            if(m_changeAcl == null)
+            if (m_changeAcl == null)
             {
-                if(perm.m_changeAcl != null && !perm.m_changeAcl.IsEmpty())
-                    return false; 
+                if (perm.m_changeAcl != null && !perm.m_changeAcl.IsEmpty())
+                    return false;
             }
-            else if(!m_changeAcl.Equals(perm.m_changeAcl))
+            else if (!m_changeAcl.Equals(perm.m_changeAcl))
                 return false;
 
             return true;
@@ -951,12 +986,8 @@ namespace System.Security.Permissions {
         /// IMPORTANT: This method should only be used after calling GetFullPath on the path to verify
         /// 
         /// </summary>
-        /// <param name="access"></param>
-        /// <param name="path"></param>
-        /// <param name="checkForDuplicates"></param>
-        /// <param name="needFullPath"></param>
         [System.Security.SecuritySafeCritical]
-        internal static void QuickDemand(FileIOPermissionAccess access, string fullPath, bool checkForDuplicates, bool needFullPath)
+        internal static void QuickDemand(FileIOPermissionAccess access, string fullPath, bool checkForDuplicates = false, bool needFullPath = true)
         {
             if (!CodeAccessSecurityEngine.QuickCheckForAllDemands())
             {
@@ -964,18 +995,109 @@ namespace System.Security.Permissions {
             }
             else
             {
-                //Emulate FileIOPermission checks
-                Path.CheckInvalidPathChars(fullPath, true);
+                EmulateFileIOPermissionChecks(fullPath);
+            }
+        }
+
+        /// <summary>
+        /// Call this method if you don't need a the FileIOPermission for anything other than calling Demand() once.
+        /// 
+        /// This method tries to verify full access before allocating a FileIOPermission object.
+        /// If full access is there, then we still have to emulate the checks that creating the 
+        /// FileIOPermission object would have performed.
+        /// 
+        /// IMPORTANT: This method should only be used after calling GetFullPath on the path to verify
+        /// 
+        /// </summary>
+        [System.Security.SecuritySafeCritical]
+        internal static void QuickDemand(FileIOPermissionAccess access, string[] fullPathList, bool checkForDuplicates = false, bool needFullPath = true)
+        {
+            if (!CodeAccessSecurityEngine.QuickCheckForAllDemands())
+            {
+                new FileIOPermission(access, fullPathList, checkForDuplicates, needFullPath).Demand();
+            }
+            else
+            {
+                foreach (string fullPath in fullPathList)
+                {
+                    EmulateFileIOPermissionChecks(fullPath);
+                }
+            }
+        }
 
-                if (fullPath.Length > 2 && fullPath.IndexOf(':', 2) != -1)
+        [System.Security.SecuritySafeCritical]
+        internal static void QuickDemand(PermissionState state)
+        {
+            if (!CodeAccessSecurityEngine.QuickCheckForAllDemands())
+            {
+                new FileIOPermission(state).Demand();
+            }
+        }
+
+#if FEATURE_MACL
+        [System.Security.SecuritySafeCritical]
+        internal static void QuickDemand(FileIOPermissionAccess access, AccessControlActions control, string fullPath, bool checkForDuplicates = false, bool needFullPath = true)
+        {
+            if (!CodeAccessSecurityEngine.QuickCheckForAllDemands())
+            {
+                new FileIOPermission(access, control, new string[] { fullPath }, checkForDuplicates, needFullPath).Demand();
+            }
+            else
+            {
+                EmulateFileIOPermissionChecks(fullPath);
+            }
+        }
+
+        [System.Security.SecuritySafeCritical]
+        internal static void QuickDemand(FileIOPermissionAccess access, AccessControlActions control, string[] fullPathList, bool checkForDuplicates = true, bool needFullPath = true)
+        {
+            if (!CodeAccessSecurityEngine.QuickCheckForAllDemands())
+            {
+                new FileIOPermission(access, control, fullPathList, checkForDuplicates, needFullPath).Demand();
+            }
+            else
+            {
+                foreach (string fullPath in fullPathList)
                 {
-                    throw new NotSupportedException(Environment.GetResourceString("Argument_PathFormatNotSupported"));
+                    EmulateFileIOPermissionChecks(fullPath);
                 }
             }
         }
+#endif
+
+        /// <summary>
+        /// Perform the additional path checks that would normally happen when creating a FileIOPermission object.
+        /// </summary>
+        /// <param name="fullPath">A path that has already gone through GetFullPath or Normalize</param>
+        internal static void EmulateFileIOPermissionChecks(string fullPath)
+        {
+            // Callers should have already made checks for invalid path format via normalization. This method will only make the
+            // additional checks needed to throw the same exceptions that would normally throw when using FileIOPermission.
+            // These checks are done via CheckIllegalCharacters() and StringExpressionSet in AddPathList() above.
+            //
+            // We have to check the beginning as some paths may be passed in as path + @"\.", which will be normalized away.
+            BCLDebug.Assert(
+                fullPath.StartsWith(Path.NormalizePath(fullPath, fullCheck: false), StringComparison.OrdinalIgnoreCase),
+                string.Format("path isn't normalized: {0}", fullPath));
+
+            // Checking for colon / invalid characters on device paths blocks legitimate access to objects such as named pipes.
+            if (AppContextSwitches.UseLegacyPathHandling || !PathInternal.IsDevice(fullPath))
+            {
+                // GetFullPath already checks normal invalid path characters. We need to just check additional (wildcard) characters here.
+                // (By calling the standard helper we can allow extended paths \\?\ through when the support is enabled.)
+                if (PathInternal.HasWildCardCharacters(fullPath))
+                {
+                    throw new ArgumentException(Environment.GetResourceString("Argument_InvalidPathChars"));
+                }
 
+                if (PathInternal.HasInvalidVolumeSeparator(fullPath))
+                {
+                    throw new NotSupportedException(Environment.GetResourceString("Argument_PathFormatNotSupported"));
+                }
+            }
+        }
     }
-    
+
     [Serializable]
     internal sealed class FileIOAccess
     {
index 93cb2555874be2cc75fecc7495d40a9ebbab4379..e045de8e2539510de2f344c3ec9e55c863d022fc 100644 (file)
@@ -609,6 +609,8 @@ namespace System.Security.Principal
         // Public methods.
         //
         [SecuritySafeCritical]
+        [DynamicSecurityMethodAttribute()]
+        [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable
         public static void RunImpersonated(SafeAccessTokenHandle safeAccessTokenHandle, Action action)
         {
             if (action == null)
@@ -627,6 +629,8 @@ namespace System.Security.Principal
         }
 
         [SecuritySafeCritical]
+        [DynamicSecurityMethodAttribute()]
+        [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable
         public static T RunImpersonated<T>(SafeAccessTokenHandle safeAccessTokenHandle, Func<T> func)
         {
             if (func == null)
index 49adc58c26a185a2e34918a5fc2083620178c8a8..8161a3be2a0d9a94b8952f9f2becd7dc8c84b4d6 100644 (file)
@@ -38,7 +38,11 @@ namespace Microsoft.Win32.SafeHandles {
         [SecurityCritical]
         protected override bool ReleaseHandle()
         {
+#if MONO
+            return true;
+#else
             return Win32Native.CloseHandle(handle);
+#endif
         }
     }
 
index 101d15ee58df3ef79f3ce1652dac39501d326d54..698f76f02e55e7dc627b20f63dcb9bdd4fc83efa 100644 (file)
@@ -219,33 +219,35 @@ namespace System.Security.Util {
                 throw new ArgumentNullException( "str" );
             }
             Contract.EndContractBlock();
+
             ArrayList retArrayList = new ArrayList();
             for (int index = 0; index < str.Length; ++index)
             {
                 if (str[index] == null)
                     throw new ArgumentNullException( "str" );
 
+                // Replace alternate directory separators
                 String oneString = StaticProcessWholeString( str[index] );
 
                 if (oneString != null && oneString.Length != 0)
                 {
-                    String temp = StaticProcessSingleString( oneString);
+                    // Trim leading and trailing spaces
+                    String temp = StaticProcessSingleString(oneString);
 
-                    int indexOfNull = temp.IndexOf( '\0' );
+                    int indexOfNull = temp.IndexOf('\0');
 
                     if (indexOfNull != -1)
-                        temp = temp.Substring( 0, indexOfNull );
+                        temp = temp.Substring(0, indexOfNull);
 
                     if (temp != null && temp.Length != 0)
                     {
-                        if (Path.IsRelative(temp))
+                        if (PathInternal.IsPartiallyQualified(temp))
                         {
-                            throw new ArgumentException( Environment.GetResourceString( "Argument_AbsolutePathRequired" ) );
+                            throw new ArgumentException(Environment.GetResourceString("Argument_AbsolutePathRequired"));
                         }
 
                         temp = CanonicalizePath( temp, needFullPath );
 
-
                         retArrayList.Add( temp );
                     }
                 }
@@ -746,24 +748,14 @@ namespace System.Security.Util {
         [System.Security.SecurityCritical]  // auto-generated
         [ResourceExposure(ResourceScope.Machine)]
         [ResourceConsumption(ResourceScope.Machine)]
-        internal static String CanonicalizePath( String path, bool needFullPath )
+        internal static string CanonicalizePath(string path, bool needFullPath)
         {
-            if (path.IndexOf( '~' ) != -1)
-            {
-                string longPath = null;
-                GetLongPathName(path, JitHelpers.GetStringHandleOnStack(ref longPath));
-                path = (longPath != null) ? longPath : path;
-            }
-
-            if (path.IndexOf( ':', 2 ) != -1)
-                throw new NotSupportedException( Environment.GetResourceString( "Argument_PathFormatNotSupported" ) );
-
             if (needFullPath)
             {
-                String newPath = System.IO.Path.GetFullPathInternal( path );
-                if (path.EndsWith( m_directorySeparator + ".", StringComparison.Ordinal ))
+                string newPath = Path.GetFullPathInternal(path);
+                if (path.EndsWith(m_directorySeparator + ".", StringComparison.Ordinal))
                 {
-                    if (newPath.EndsWith( m_directorySeparator ))
+                    if (newPath.EndsWith(m_directorySeparator))
                     {
                         newPath += ".";
                     }
@@ -771,11 +763,23 @@ namespace System.Security.Util {
                     {
                         newPath += m_directorySeparator + ".";
                     }
-                }                
-                return newPath;
+                }
+                path = newPath;
             }
-            else
-                return path;
+            else if (path.IndexOf('~') != -1)
+            {
+                // GetFullPathInternal() will expand 8.3 file names
+                string longPath = null;
+                GetLongPathName(path, JitHelpers.GetStringHandleOnStack(ref longPath));
+                path = (longPath != null) ? longPath : path;
+            }
+
+            // This blocks usage of alternate data streams and some extended syntax paths (\\?\C:\). Checking after
+            // normalization allows valid paths such as " C:\" to be considered ok (as it will become "C:\").
+            if (path.IndexOf(':', 2) != -1)
+                throw new NotSupportedException(Environment.GetResourceString("Argument_PathFormatNotSupported"));
+
+            return path;
         }
     }
 }
index b009ff0a8ecf6fc0016ce8cd322fc18eb62e9a39..c629fb4f695051b0c9aa39fba9b469fcdc897481 100644 (file)
@@ -354,13 +354,24 @@ namespace System.Security.Util {
         // 3. Throws a PathTooLongException if the length of the resulting URL is >= MAX_PATH.
         //    This is done to prevent security issues due to canonicalization truncations.
         // Remove this method when the Path class supports "\\?\"
-        internal static String PreProcessForExtendedPathRemoval(String url, bool isFileUrl)
+        internal static string PreProcessForExtendedPathRemoval(string url, bool isFileUrl)
         {
-            bool uncShare = false;
-            return PreProcessForExtendedPathRemoval(url, isFileUrl, ref uncShare);
+            return PreProcessForExtendedPathRemoval(checkPathLength: true, url: url, isFileUrl: isFileUrl);
         }
 
-        private static String PreProcessForExtendedPathRemoval(String url, bool isFileUrl, ref bool isUncShare)
+        internal static string PreProcessForExtendedPathRemoval(bool checkPathLength, string url, bool isFileUrl)
+        {
+            bool isUncShare = false;
+            return PreProcessForExtendedPathRemoval(checkPathLength: checkPathLength, url: url, isFileUrl: isFileUrl, isUncShare: ref isUncShare);
+        }
+
+        // Keeping this signature to avoid reflection breaks
+        private static string PreProcessForExtendedPathRemoval(string url, bool isFileUrl, ref bool isUncShare)
+        {
+            return PreProcessForExtendedPathRemoval(checkPathLength: true, url: url, isFileUrl: isFileUrl, isUncShare: ref isUncShare);
+        }
+
+        private static string PreProcessForExtendedPathRemoval(bool checkPathLength, string url, bool isFileUrl, ref bool isUncShare)
         {
             // This is the modified URL that we will return
             StringBuilder modifiedUrl = new StringBuilder(url);
@@ -434,15 +445,24 @@ namespace System.Security.Util {
             }
 
             // ITEM 3 - If the path is greater than or equal (due to terminating NULL in windows) MAX_PATH, we throw.
-            if (modifiedUrl.Length >= Path.MAX_PATH)
+            if (checkPathLength)
             {
-                throw new PathTooLongException(Environment.GetResourceString("IO.PathTooLong"));
+                // This needs to be a separate method to avoid hitting the static constructor on AppContextSwitches
+                CheckPathTooLong(modifiedUrl);
             }
 
             // Create the result string from the StringBuilder
             return modifiedUrl.ToString();
         }
 
+        [MethodImpl(MethodImplOptions.NoInlining)]
+        private static void CheckPathTooLong(StringBuilder path)
+        {
+            if (path.Length >= (AppContextSwitches.BlockLongPaths ? PathInternal.MaxShortPath : PathInternal.MaxLongPath))
+            {
+                throw new PathTooLongException(Environment.GetResourceString("IO.PathTooLong"));
+            }
+        }
 
         // Do any misc massaging of data in the URL
         private String PreProcessURL(String url, bool isFileURL)
index 357bfe6c6ae7620f6e8d920db4bd92276e648182..46c377bdebae60fc7e70105d0cbd79f6cd76186b 100644 (file)
@@ -1968,7 +1968,7 @@ namespace System.Text {
 
             VerifyClassInvariant();
 
-            if ((minBlockCharCount + Length) > m_MaxCapacity)
+            if (minBlockCharCount + Length < minBlockCharCount || (minBlockCharCount + Length) > m_MaxCapacity)
                 throw new ArgumentOutOfRangeException("requiredLength", Environment.GetResourceString("ArgumentOutOfRange_SmallCapacity"));
 
             // Compute the length of the new block we need 
@@ -2028,7 +2028,8 @@ namespace System.Text {
             VerifyClassInvariant();
             Contract.Assert(count > 0, "Count must be strictly positive");
             Contract.Assert(index >= 0, "Index can't be negative");
-            if (count + Length > m_MaxCapacity)
+
+            if (count + Length < count || count + Length > m_MaxCapacity)
                 throw new ArgumentOutOfRangeException("requiredLength", Environment.GetResourceString("ArgumentOutOfRange_SmallCapacity"));
 
             chunk = this;
index 1e3f9293f7c31efdabd588b569ba8cd587752795..6ee970a08efe8a6db1ba7d82b85a2d685c96bd2b 100644 (file)
@@ -3630,7 +3630,14 @@ namespace System.Threading.Tasks
                 ITaskCompletionAction singleTaskCompletionAction = continuationObject as ITaskCompletionAction;
                 if (singleTaskCompletionAction != null)
                 {
-                    singleTaskCompletionAction.Invoke(this);
+                    if (bCanInlineContinuations)
+                    {
+                        singleTaskCompletionAction.Invoke(this);
+                    }
+                    else
+                    {
+                        ThreadPool.UnsafeQueueCustomWorkItem(new CompletionActionInvoker(singleTaskCompletionAction, this), forceGlobal: false);
+                    }
                     LogFinishCompletionNotification();
                     return;
                 }
@@ -3711,7 +3718,15 @@ namespace System.Threading.Tasks
                         {
                             Contract.Assert(currentContinuation is ITaskCompletionAction, "Expected continuation element to be Action, TaskContinuation, or ITaskContinuationAction");
                             var action = (ITaskCompletionAction)currentContinuation;
-                            action.Invoke(this);
+
+                            if (bCanInlineContinuations)
+                            {
+                                action.Invoke(this);
+                            }
+                            else
+                            {
+                                ThreadPool.UnsafeQueueCustomWorkItem(new CompletionActionInvoker(action, this), forceGlobal: false);
+                            }
                         }
                     }
                 }
@@ -6673,6 +6688,30 @@ namespace System.Threading.Tasks
         }
     }
 
+    internal sealed class CompletionActionInvoker : IThreadPoolWorkItem
+    {
+        private readonly ITaskCompletionAction m_action;
+        private readonly Task m_completingTask;
+
+        internal CompletionActionInvoker(ITaskCompletionAction action, Task completingTask)
+        {
+            m_action = action;
+            m_completingTask = completingTask;
+        }
+        
+        [SecurityCritical]
+        public void ExecuteWorkItem()
+        {
+            m_action.Invoke(m_completingTask);
+        }
+        
+        [SecurityCritical]
+        public void MarkAborted(ThreadAbortException tae)
+        {
+            /* NOP */
+        }
+    } 
+
     // Proxy class for better debugging experience
     internal class SystemThreadingTasks_TaskDebugView
     {
diff --git a/mcs/class/test-helpers/TestHelpers.cs b/mcs/class/test-helpers/TestHelpers.cs
new file mode 120000 (symlink)
index 0000000..5cf769a
--- /dev/null
@@ -0,0 +1 @@
+../../../mono/mini/TestHelpers.cs
\ No newline at end of file
diff --git a/mcs/errors/cs0163-2.cs b/mcs/errors/cs0163-2.cs
new file mode 100644 (file)
index 0000000..945ae8a
--- /dev/null
@@ -0,0 +1,13 @@
+// CS0163: Control cannot fall through from one case label `case 1:' to another
+// Line: 9
+
+public class Program
+{
+       public static void Main ()
+       {
+               switch (1) {
+                       case 1: {}
+                       default: {}
+               }
+       }
+}
\ No newline at end of file
diff --git a/mcs/errors/cs1644-50.cs b/mcs/errors/cs1644-50.cs
new file mode 100644 (file)
index 0000000..10817d7
--- /dev/null
@@ -0,0 +1,11 @@
+// CS1644: Feature `interpolated strings' cannot be used because it is not part of the C# 5.0 language specification
+// Line: 9
+// Compiler options: -langversion:5
+
+public class Program
+{
+       public static void Main()
+       {
+               var x = $"I should not compile";
+       }
+}
index 793e47c8a2aeb8ea25919ae770aafa6bf61a66f9..74200cddf49e06d741e1bfdce3d04f019c0bb672 100644 (file)
@@ -348,8 +348,10 @@ namespace Mono.ILASM {
 
                                 if (IsValueType (parent.PeapiClass.nameSpace, parent.PeapiClass.name))
                                         is_value_class = true;
-                                else if (IsEnumType (parent.PeapiClass.nameSpace, parent.PeapiClass.name))
+                                else if (IsEnumType (parent.PeapiClass.nameSpace, parent.PeapiClass.name)) {
                                         is_enum_class = true;
+                                        is_value_class = false;
+                                }
 
                                 if (!IsValueType (name_space, name) && !IsEnumType (name_space, name) &&
                                         is_value_class && (attr & PEAPI.TypeAttr.Sealed) == 0) {
index edd6db37398d6b56afa7d9a3d181142b0605c9c8..bc78f97fd18fdcc0b5dac527f8f4c7aed782533e 100644 (file)
@@ -1,6 +1,8 @@
 // InstrToken.cs\r
 // Author: Sergey Chaban (serge@wildwestsoftware.com)\r
 \r
+#if !MOBILE\r
+\r
 using System;\r
 using System.Reflection.Emit;\r
 \r
@@ -103,3 +105,5 @@ namespace Mono.ILASM {
        }\r
 \r
 }\r
+\r
+#endif\r
index d1eb34c0f726f10b076c472c03b518128e99aa76..85dff2b3c84fcb71651275ea08fb316c379f9d64 100644 (file)
@@ -20,6 +20,7 @@ using System.Security.Cryptography;
 using System.Security.Permissions;
 using Mono.Security.Cryptography;
 using Mono.CompilerServices.SymbolWriter;
+using System.Linq;
 
 #if STATIC
 using IKVM.Reflection;
@@ -43,6 +44,20 @@ namespace Mono.CSharp
                byte[] GetPublicKeyToken ();
                bool IsFriendAssemblyTo (IAssemblyDefinition assembly);
        }
+
+       public class AssemblyReferenceErrorInfo
+       {
+               public AssemblyReferenceErrorInfo (AssemblyName dependencyName, string location, string message)
+               {
+                       this.DependencyName = dependencyName;
+                       this.RequestingAssemblyLocation = location;
+                       this.Message = message;
+               }
+
+               public AssemblyName DependencyName { get; private set; }
+               public string RequestingAssemblyLocation { get; private set; }
+               public string Message { get; private set; }
+       }
                 
        public abstract class AssemblyDefinition : IAssemblyDefinition
        {
@@ -416,7 +431,8 @@ namespace Mono.CSharp
                //
                void CheckReferencesPublicToken ()
                {
-                       foreach (var an in builder_extra.GetReferencedAssemblies ()) {
+                       var references = builder_extra.GetReferencedAssemblies ();
+                       foreach (var an in references) {
                                if (public_key != null && an.GetPublicKey ().Length == 0) {
                                        Report.Error (1577, "Referenced assembly `{0}' does not have a strong name",
                                                an.FullName);
@@ -432,11 +448,17 @@ namespace Mono.CSharp
                                if (ia == null)
                                        continue;
 
-                               var references = GetNotUnifiedReferences (an);
-                               if (references != null) {
-                                       foreach (var r in references) {
-                                               Report.SymbolRelatedToPreviousError ( r[0]);
-                                               Report.Error (1705, r [1]);
+                               var an_references = GetNotUnifiedReferences (an);
+                               if (an_references != null) {
+                                       foreach (var r in an_references) {
+                                               //
+                                               // Secondary check when assembly references is resolved but not used. For example
+                                               // due to type-forwarding
+                                               //
+                                               if (references.Any (l => l.Name == r.DependencyName.Name)) {
+                                                       Report.SymbolRelatedToPreviousError (r.RequestingAssemblyLocation);
+                                                       Report.Error (1705, r.Message);
+                                               }
                                        }
                                }
 
@@ -570,7 +592,7 @@ namespace Mono.CSharp
                        return public_key_token;
                }
 
-               protected virtual List<string[]> GetNotUnifiedReferences (AssemblyName assemblyName)
+               protected virtual List<AssemblyReferenceErrorInfo> GetNotUnifiedReferences (AssemblyName assemblyName)
                {
                        return null;
                }
@@ -909,7 +931,7 @@ namespace Mono.CSharp
                                        Builder.Save (module.Builder.ScopeName, pekind, machine);
                                }
                        } catch (ArgumentOutOfRangeException) {
-                               Report.Error (16, "Output file `{0}' exceeds the 4GB limit");
+                               Report.Error (16, "Output file `{0}' exceeds the 4GB limit", name);
                        } catch (Exception e) {
                                Report.Error (16, "Could not write to file `{0}'. {1}", name, e.Message);
                        }
index 04cfe49f1f867158e76a486138ba87982f9a1762..7200501984e2230825ba7f8dfdaf06f3cec5fba6 100644 (file)
@@ -719,9 +719,11 @@ namespace Mono.CSharp {
                                this.loc = child.Location;
                        }
 
+                       public bool RequiresEmitWithAwait { get; set; }
+
                        public override bool ContainsEmitWithAwait ()
                        {
-                               return child.ContainsEmitWithAwait ();
+                               return RequiresEmitWithAwait || child.ContainsEmitWithAwait ();
                        }
 
                        public override Expression CreateExpressionTree (ResolveContext ec)
index ceeff52fcfe7475c13f120cce8e6ec060224912c..96ac0c8db4c24aacc9f18f573adfff3d885d54da 100644 (file)
@@ -1853,7 +1853,7 @@ namespace Mono.CSharp
                                        return base_type;
                        }
 
-                       if (iface_exprs != null) {
+                       if (iface_exprs != null && this is Interface) {
                                foreach (var iface in iface_exprs) {
                                        // the interface might not have been resolved, prevents a crash, see #442144
                                        if (iface == null)
index 6783a7edbb672ef70e00d3684e3f35427ea12eab..bb2bd6e19718cad38c3cf37e8eb131b1b6581685 100644 (file)
@@ -3351,10 +3351,16 @@ boolean_literal
 interpolated_string
        : INTERPOLATED_STRING interpolations INTERPOLATED_STRING_END
          {
+               if (lang_version < LanguageVersion.V_6)
+                       FeatureIsNotAvailable (GetLocation ($1), "interpolated strings");
+
                $$ = new InterpolatedString ((StringLiteral) $1, (List<Expression>) $2, (StringLiteral) $3);
          }
        | INTERPOLATED_STRING_END
          {
+               if (lang_version < LanguageVersion.V_6)
+                       FeatureIsNotAvailable (GetLocation ($1), "interpolated strings");
+
                $$ = new InterpolatedString ((StringLiteral) $1, null, null);
          }
        ;
index efc5927303ac94674dbba013c3f969c5ef8653d5..fd5732f7598dd20feea9bb715a99f508dce247ab 100644 (file)
@@ -126,11 +126,12 @@ namespace Mono.CSharp {
        /// <remarks>
        ///   Base class for expressions
        /// </remarks>
-       public abstract class Expression {
+       public abstract class Expression
+       {
                public ExprClass eclass;
                protected TypeSpec type;
                protected Location loc;
-               
+
                public TypeSpec Type {
                        get { return type; }
                        set { type = value; }
@@ -258,7 +259,7 @@ namespace Mono.CSharp {
                {
                        report.Error (201, loc, "Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement");
                }
-               
+
                public void Error_InvalidExpressionStatement (BlockContext bc)
                {
                        Error_InvalidExpressionStatement (bc.Report, loc);
@@ -288,6 +289,10 @@ namespace Mono.CSharp {
                        if (type == InternalType.ErrorType || target == InternalType.ErrorType)
                                return;
 
+                       if (type.MemberDefinition.DeclaringAssembly.IsMissing ||
+                               target.MemberDefinition.DeclaringAssembly.IsMissing)
+                               return;
+
                        string from_type = type.GetSignatureForError ();
                        string to_type = target.GetSignatureForError ();
                        if (from_type == to_type) {
@@ -4467,6 +4472,10 @@ namespace Mono.CSharp {
                {
                        TypeSpec argument_type = a.Type;
 
+                       //
+                       // Exactly matching Expression phase
+                       //
+
                        //
                        // If argument is an anonymous function
                        //
@@ -4528,17 +4537,20 @@ namespace Mono.CSharp {
 
                                if (q != p) {
                                        //
-                                       // An inferred return type X exists for E in the context of that parameter list, and 
-                                       // the conversion from X to Y1 is better than the conversion from X to Y2
+                                       // An inferred return type X exists for E in the context of the parameter list, and
+                                       // an identity conversion exists from X to the return type of D
                                        //
-                                       argument_type = am.InferReturnType (ec, null, orig_q);
-                                       if (argument_type == null) {
-                                               // TODO: Can this be hit?
-                                               return 1;
-                                       }
+                                       var inferred_type = am.InferReturnType (ec, null, orig_q);
+                                       if (inferred_type != null) {
+                                               if (inferred_type.BuiltinType == BuiltinTypeSpec.Type.Dynamic)
+                                                       inferred_type = ec.BuiltinTypes.Object;
+
+                                               if (inferred_type == p)
+                                                       return 1;
 
-                                       if (argument_type.BuiltinType == BuiltinTypeSpec.Type.Dynamic)
-                                               argument_type = ec.BuiltinTypes.Object;
+                                               if (inferred_type == q)
+                                                       return 2;
+                                       }
                                }
                        }
 
@@ -4592,25 +4604,28 @@ namespace Mono.CSharp {
                                return IsBetterConversionTarget (rc, p, q);
                        }
 
+                       var p_orig = p;
                        if (p.IsNullableType) {
                                p = Nullable.NullableInfo.GetUnderlyingType (p);
-                               if (!BuiltinTypeSpec.IsPrimitiveType (p))
-                                       return 0;
+                               if (!BuiltinTypeSpec.IsPrimitiveTypeOrDecimal (p))
+                                       return BetterTypeConversionImplicitConversion (rc, p_orig, q);
 
                                //
                                // Spec expects implicit conversion check between p and q, q and p
-                               // to be done before nullable unwrapping but that's expensive operation
-                               // Hence manual tweak is needed because BetterTypeConversion works on
+                               // to be done before nullable unwrapping but that's expensive operation.
+                               // 
+                               // Extra manual tweak is needed because BetterTypeConversion works on
                                // unwrapped types
                                //
                                if (p == q)
                                        return 2;
                        }
 
+                       var q_orig = q;
                        if (q.IsNullableType) {
                                q = Nullable.NullableInfo.GetUnderlyingType (q);
-                               if (!BuiltinTypeSpec.IsPrimitiveType (q))
-                                       return 0;
+                               if (!BuiltinTypeSpec.IsPrimitiveTypeOrDecimal (q))
+                                       return BetterTypeConversionImplicitConversion (rc, p_orig, q_orig);
 
                                if (q == p)
                                        return 1;
@@ -4691,12 +4706,17 @@ namespace Mono.CSharp {
                                break;
                        }
 
+                       return BetterTypeConversionImplicitConversion (ec, p, q);
+               }
+
+               static int BetterTypeConversionImplicitConversion (ResolveContext rc, TypeSpec p, TypeSpec q)
+               {
                        // TODO: this is expensive
                        Expression p_tmp = new EmptyExpression (p);
                        Expression q_tmp = new EmptyExpression (q);
 
-                       bool p_to_q = Convert.ImplicitConversionExists (ec, p_tmp, q);
-                       bool q_to_p = Convert.ImplicitConversionExists (ec, q_tmp, p);
+                       bool p_to_q = Convert.ImplicitConversionExists (rc, p_tmp, q);
+                       bool q_to_p = Convert.ImplicitConversionExists (rc, q_tmp, p);
 
                        if (p_to_q && !q_to_p)
                                return 1;
index aadf818066d2ad89b3d82a2b8488256753e09d9c..f805523b76e0a16f41bd3320409ad98aba4cab8e 100644 (file)
@@ -8084,11 +8084,21 @@ namespace Mono.CSharp
                        if (element == null)
                                return null;
 
-                       if (element is CompoundAssign.TargetExpression) {
-                               if (first_emit != null)
-                                       throw new InternalErrorException ("Can only handle one mutator at a time");
-                               first_emit = element;
-                               element = first_emit_temp = new LocalTemporary (element.Type);
+                       var te = element as CompoundAssign.TargetExpression;
+                       if (te != null) {
+                               for (int i = 1; i < initializers.Count; ++i) {
+                                       if (initializers [i].ContainsEmitWithAwait ()) {
+                                               te.RequiresEmitWithAwait = true;
+                                               break;
+                                       }
+                               }
+
+                               if (!te.RequiresEmitWithAwait) {
+                                       if (first_emit != null)
+                                               throw new InternalErrorException ("Can only handle one mutator at a time");
+                                       first_emit = element;
+                                       element = first_emit_temp = new LocalTemporary (element.Type);
+                               }
                        }
 
                        return Convert.ImplicitConversionRequired (
index 75a02034f9cf9cda8bef266f139325a055c15546..f4b9930f3999e8c3395d53a4319744d1130492c0 100644 (file)
@@ -220,7 +220,7 @@ namespace Mono.CSharp
                        return Builder.__AddModule (moduleFile);
                }
 
-               protected override List<string[]> GetNotUnifiedReferences (AssemblyName assemblyName)
+               protected override List<AssemblyReferenceErrorInfo> 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<string[]>> resolved_version_mismatches;
+               Dictionary<AssemblyName, List<AssemblyReferenceErrorInfo>> resolved_version_mismatches;
                static readonly TypeName objectTypeName = new TypeName ("System", "Object");
 
                static StaticLoader ()
@@ -359,25 +359,24 @@ namespace Mono.CSharp
                                if (version_mismatch is AssemblyBuilder)
                                        return version_mismatch;
 
-                               var v1 = new AssemblyName (refname).Version;
+                               var ref_an = new AssemblyName (refname);
+                               var v1 = ref_an.Version;
                                var v2 = version_mismatch.GetName ().Version;
 
                                if (v1 > v2) {
                                        if (resolved_version_mismatches == null)
-                                               resolved_version_mismatches = new Dictionary<AssemblyName, List<string[]>> ();
+                                               resolved_version_mismatches = new Dictionary<AssemblyName, List<AssemblyReferenceErrorInfo>> ();
 
                                        var an = args.RequestingAssembly.GetName ();
-                                       List<string[]> names;
+                                       List<AssemblyReferenceErrorInfo> names;
                                        if (!resolved_version_mismatches.TryGetValue (an, out names)) {
-                                               names = new List<string[]> ();
+                                               names = new List<AssemblyReferenceErrorInfo> ();
                                                resolved_version_mismatches.Add (an, names);
                                        }
 
-                                       names.Add (new[] {
-                                               args.RequestingAssembly.Location,
+                                       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)
-                                       });
+                                                          args.RequestingAssembly.FullName, refname, version_mismatch.GetName ().FullName)));
 
                                        return version_mismatch;
                                }
@@ -434,9 +433,9 @@ namespace Mono.CSharp
                        return default_references.ToArray ();
                }
 
-               public List<string[]> GetNotUnifiedReferences (AssemblyName assemblyName)
+               public List<AssemblyReferenceErrorInfo> GetNotUnifiedReferences (AssemblyName assemblyName)
                {
-                       List<string[]> list = null;
+                       List<AssemblyReferenceErrorInfo> list = null;
                        if (resolved_version_mismatches != null)
                                resolved_version_mismatches.TryGetValue (assemblyName, out list);
 
index d0341cb3b633045c48889bfa3a3f31789df36ff0..703e7ba497fef805446a5df389a8fa4f81258816 100644 (file)
@@ -5378,18 +5378,30 @@ namespace Mono.CSharp {
                                                continue;
                                        }
 
-                                       if (constant_label != null && constant_label != sl)
+                                       if (section_rc.IsUnreachable) {
+                                               //
+                                               // Common case. Previous label section end is unreachable as
+                                               // it ends with break, return, etc. For next section revert
+                                               // to reachable again unless we have constant switch block
+                                               //
+                                               section_rc = constant_label != null && constant_label != sl ?
+                                                       Reachability.CreateUnreachable () :
+                                                       new Reachability ();
+                                       } else if (prev_label != null) {
+                                               //
+                                               // Error case as control cannot fall through from one case label
+                                               //
+                                               sl.SectionStart = false;
+                                               s = new MissingBreak (prev_label);
+                                               s.MarkReachable (rc);
+                                               block.Statements.Insert (i - 1, s);
+                                               ++i;
+                                       } else if (constant_label != null && constant_label != sl) {
+                                               //
+                                               // Special case for the first unreachable label in constant
+                                               // switch block
+                                               //
                                                section_rc = Reachability.CreateUnreachable ();
-                                       else if (section_rc.IsUnreachable) {
-                                               section_rc = new Reachability ();
-                                       } else {
-                                               if (prev_label != null) {
-                                                       sl.SectionStart = false;
-                                                       s = new MissingBreak (prev_label);
-                                                       s.MarkReachable (rc);
-                                                       block.Statements.Insert (i - 1, s);
-                                                       ++i;
-                                               }
                                        }
 
                                        prev_label = sl;
index 10674f5cd9ec50902bc0db9d25355599b17fa65d..a149e2eb536cb3f61714de3073ead029a3aa9405 100644 (file)
@@ -98,4 +98,8 @@ csproj-local:
 setup:
        $(CSCOMPILE) -t:library dlls/test-679-2/test-679-lib-2.cs
        $(CSCOMPILE) -t:library dlls/test-679-1/test-679-lib.cs -r:dlls/test-679-2/test-679-lib-2.dll
+       $(CSCOMPILE) -t:library dlls/test-939-common.cs -keyfile:key.snk -publicsign
+       $(CSCOMPILE) -t:library dlls/test-939-1/test-939-lib.cs -keyfile:key.snk -publicsign
+       $(CSCOMPILE) -t:library dlls/test-939-1/test-939-ref.cs -r:dlls/test-939-1/test-939-lib.dll -keyfile:key.snk -publicsign
+       $(CSCOMPILE) -t:library dlls/test-939-2/test-939-lib.cs -r:dlls/test-939-common.dll -keyfile:key.snk -publicsign
        $(ILASM) -dll dlls/test-883.il
diff --git a/mcs/tests/dlls/test-939-1/test-939-lib.cs b/mcs/tests/dlls/test-939-1/test-939-lib.cs
new file mode 100644 (file)
index 0000000..1351652
--- /dev/null
@@ -0,0 +1,9 @@
+[assembly:System.Reflection.AssemblyVersionAttribute ("2.1.0.0")]
+
+public class Common
+{
+       public static void Foo ()
+       {
+
+       }
+}
diff --git a/mcs/tests/dlls/test-939-1/test-939-ref.cs b/mcs/tests/dlls/test-939-1/test-939-ref.cs
new file mode 100644 (file)
index 0000000..580d407
--- /dev/null
@@ -0,0 +1,10 @@
+[assembly:System.Reflection.AssemblyVersionAttribute ("4.0.0.0")]
+
+public class A : Common
+{
+}
+
+public class B
+{
+       
+}
diff --git a/mcs/tests/dlls/test-939-2/test-939-lib.cs b/mcs/tests/dlls/test-939-2/test-939-lib.cs
new file mode 100644 (file)
index 0000000..b660068
--- /dev/null
@@ -0,0 +1,5 @@
+using System.Runtime.CompilerServices;
+
+[assembly:System.Reflection.AssemblyVersionAttribute ("2.0.0.0")]
+
+[assembly:TypeForwardedTo (typeof (Common))]
diff --git a/mcs/tests/dlls/test-939-common.cs b/mcs/tests/dlls/test-939-common.cs
new file mode 100644 (file)
index 0000000..a6420bb
--- /dev/null
@@ -0,0 +1,9 @@
+[assembly:System.Reflection.AssemblyVersionAttribute ("1.0.0.0")]
+
+public class Common
+{
+       public static void Foo ()
+       {
+
+       }
+}
diff --git a/mcs/tests/gtest-637.cs b/mcs/tests/gtest-637.cs
new file mode 100644 (file)
index 0000000..f08c850
--- /dev/null
@@ -0,0 +1,26 @@
+using System;
+
+public struct nint
+{
+       public static implicit operator nint (int v)
+       {
+               return 0;
+       }
+}
+
+public class MainClass 
+{
+       static void Test (string key, int? value)
+       {
+       }
+
+       static void Test (string key, nint? value)
+       {
+               throw new ApplicationException ();
+       }
+
+       public static void Main ()
+       {
+               Test (null, int.MinValue);
+       }
+}
diff --git a/mcs/tests/gtest-lambda-37.cs b/mcs/tests/gtest-lambda-37.cs
new file mode 100644 (file)
index 0000000..ffc669e
--- /dev/null
@@ -0,0 +1,38 @@
+using System;
+
+public class MainClass 
+{
+       static long? X<T> (T a1, Func<T, T?> a2) where T : struct
+       {
+               return 0;
+       }
+
+       static int? X<T> (T a1, Func<T, int?> a2)
+       {
+               return 0;
+       }
+
+       static double? X<T> (T a1, Func<T, double?> a2)
+       {
+               return null;
+       }
+
+       public static void Main ()
+       {
+               int? sum = X<int> (1, i => {
+                       if (i > 0)
+                               return i;
+
+                       return null;
+               });
+
+
+               int? sum2 = X (1, i => {
+                       if (i > 0)
+                               return i;
+
+                       return null;
+               });
+
+       }
+}
index 405b7225a52ec1854c6d78901ce589ab1a308682..6afe80eb0d024cfe07e01528e7d4c586509e5699 100644 (file)
@@ -17,6 +17,7 @@ public static class Program
                Complex (null);
                MM (1);
                MM ((byte) 1);
+               DecimalRule (() => (byte) 1);
                return 0;
        }
 
@@ -82,4 +83,13 @@ public static class Program
        {
                throw new ApplicationException ("wrong overload");
        }
+
+    static void DecimalRule (Func<int> i)
+    {
+    }
+
+    static void DecimalRule (Func<decimal?> i)
+    {
+        throw new ApplicationException ("wrong overload");
+    }
 }
\ No newline at end of file
diff --git a/mcs/tests/test-938.cs b/mcs/tests/test-938.cs
new file mode 100644 (file)
index 0000000..17bf81e
--- /dev/null
@@ -0,0 +1,13 @@
+namespace Example
+{
+       public class A : A.InnerInterface
+       {
+               public interface InnerInterface
+               {
+               }
+
+               public static void Main ()
+               {
+               } 
+       }
+}
\ No newline at end of file
diff --git a/mcs/tests/test-939.cs b/mcs/tests/test-939.cs
new file mode 100644 (file)
index 0000000..7d83ddf
--- /dev/null
@@ -0,0 +1,14 @@
+// Compiler options: -r:dlls/test-939-1/test-939-ref.dll -r:dlls/test-939-2/test-939-lib.dll -r:dlls/test-939-common.dll
+
+class X
+{
+       public static void Main ()
+       {
+       }
+
+       static void RealTest ()
+       {
+               A.Foo ();
+               new B ();
+       }
+}
\ No newline at end of file
diff --git a/mcs/tests/test-async-86.cs b/mcs/tests/test-async-86.cs
new file mode 100644 (file)
index 0000000..0f8f71a
--- /dev/null
@@ -0,0 +1,71 @@
+using System;
+using System.Threading.Tasks;
+
+public class Program
+{
+       string Data { 
+               get {
+                       return data;
+               }
+               set {
+                       ++setter_called;
+                       data = value;
+               }
+       }
+
+       int setter_called;
+       string data = "init-";
+
+       string this [string arg] {
+               get {
+                       return i_data;
+               }
+               set {
+                       ++i_setter_called;
+                       i_data = value;
+               }
+       }
+
+       int i_setter_called;
+       string i_data = "init2-";
+
+       public static int Main()
+       {
+               var p = new Program ();
+               p.TestProperty ().Wait ();
+               if (p.data != "init-nxa123z") {
+                       return 1;
+               }
+
+               if (p.setter_called != 1)
+                       return 2;
+
+               p.TestIndexer ().Wait ();
+
+               if (p.i_data != "init2-nxa123z") {
+                       return 3;
+               }
+
+               if (p.i_setter_called != 1)
+                       return 4;
+
+               return 0;
+       }
+
+       async Task TestProperty ()
+       {
+               Data += "n" + await StringValue () + "a" + 123.ToString () + "z";
+       }
+
+       async Task TestIndexer ()
+       {
+               string arg = "foo";
+               this[arg] += "n" + await StringValue () + "a" + 123.ToString () + "z";
+       }
+
+       async Task<string> StringValue ()
+       {
+               await Task.Yield ();
+               return "x";
+       }
+}
\ No newline at end of file
index 55f9c7b2fa6fc0ebce88f03463ee0c9390fa82ae..91d6a9d8ebc90c7e539b470ceaa398ba61822b84 100644 (file)
       </method>
     </type>
   </test>
+  <test name="gtest-637.cs">
+    <type name="nint">
+      <method name="nint op_Implicit(Int32)" attrs="2198">
+        <size>15</size>
+      </method>
+    </type>
+    <type name="MainClass">
+      <method name="Void Test(System.String, System.Nullable`1[System.Int32])" attrs="145">
+        <size>2</size>
+      </method>
+      <method name="Void Test(System.String, System.Nullable`1[nint])" attrs="145">
+        <size>7</size>
+      </method>
+      <method name="Void Main()" attrs="150">
+        <size>18</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-lambda-37.cs">
+    <type name="MainClass">
+      <method name="System.Nullable`1[System.Int64] X[T](T, System.Func`2[T,System.Nullable`1[T]])" attrs="145">
+        <size>16</size>
+      </method>
+      <method name="System.Nullable`1[System.Int32] X[T](T, System.Func`2[T,System.Nullable`1[System.Int32]])" attrs="145">
+        <size>15</size>
+      </method>
+      <method name="System.Nullable`1[System.Double] X[T](T, System.Func`2[T,System.Nullable`1[System.Double]])" attrs="145">
+        <size>18</size>
+      </method>
+      <method name="Void Main()" attrs="150">
+        <size>74</size>
+      </method>
+      <method name="System.Nullable`1[System.Int32] &lt;Main&gt;m__0(Int32)" attrs="145">
+        <size>37</size>
+      </method>
+      <method name="System.Nullable`1[System.Int32] &lt;Main&gt;m__1(Int32)" attrs="145">
+        <size>37</size>
+      </method>
+      <method name="Void .ctor()" attrs="6278">
+        <size>7</size>
+      </method>
+    </type>
+  </test>
   <test name="gtest-linq-01.cs">
     <type name="from.C">
       <method name="Void Main()" attrs="150">
   <test name="test-935.cs">
     <type name="Program">
       <method name="Int32 Main()" attrs="150">
-        <size>101</size>
+        <size>135</size>
       </method>
       <method name="Void TT(System.Threading.Tasks.Task`1[System.String])" attrs="145">
         <size>2</size>
       <method name="Void MM(System.Nullable`1[System.Double])" attrs="145">
         <size>12</size>
       </method>
+      <method name="Void DecimalRule(System.Func`1[System.Int32])" attrs="145">
+        <size>2</size>
+      </method>
+      <method name="Void DecimalRule(System.Func`1[System.Nullable`1[System.Decimal]])" attrs="145">
+        <size>12</size>
+      </method>
+      <method name="Int32 &lt;Main&gt;m__0()" attrs="145">
+        <size>9</size>
+      </method>
     </type>
   </test>
   <test name="test-936.cs">
       </method>
     </type>
   </test>
+  <test name="test-938.cs">
+    <type name="Example.A">
+      <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-939.cs">
+    <type name="X">
+      <method name="Void Main()" attrs="150">
+        <size>2</size>
+      </method>
+      <method name="Void RealTest()" attrs="145">
+        <size>13</size>
+      </method>
+      <method name="Void .ctor()" attrs="6278">
+        <size>7</size>
+      </method>
+    </type>
+  </test>
   <test name="test-94.cs">
     <type name="Base">
       <method name="Int32 IVehicle.Start()" attrs="481">
       </method>
     </type>
   </test>
+  <test name="test-async-86.cs">
+    <type name="Program">
+      <method name="System.String get_Data()" attrs="2177">
+        <size>15</size>
+      </method>
+      <method name="Void set_Data(System.String)" attrs="2177">
+        <size>23</size>
+      </method>
+      <method name="System.String get_Item(System.String)" attrs="2177">
+        <size>15</size>
+      </method>
+      <method name="Void set_Item(System.String, System.String)" attrs="2177">
+        <size>23</size>
+      </method>
+      <method name="Int32 Main()" attrs="150">
+        <size>134</size>
+      </method>
+      <method name="System.Threading.Tasks.Task TestProperty()" attrs="129">
+        <size>41</size>
+      </method>
+      <method name="System.Threading.Tasks.Task TestIndexer()" attrs="129">
+        <size>41</size>
+      </method>
+      <method name="System.Threading.Tasks.Task`1[System.String] StringValue()" attrs="129">
+        <size>33</size>
+      </method>
+      <method name="Void .ctor()" attrs="6278">
+        <size>29</size>
+      </method>
+    </type>
+    <type name="Program+&lt;TestProperty&gt;c__async0">
+      <method name="Void MoveNext()" attrs="486">
+        <size>314</size>
+      </method>
+      <method name="Void SetStateMachine(System.Runtime.CompilerServices.IAsyncStateMachine)" attrs="486">
+        <size>13</size>
+      </method>
+    </type>
+    <type name="Program+&lt;TestIndexer&gt;c__async1">
+      <method name="Void MoveNext()" attrs="486">
+        <size>337</size>
+      </method>
+      <method name="Void SetStateMachine(System.Runtime.CompilerServices.IAsyncStateMachine)" attrs="486">
+        <size>13</size>
+      </method>
+    </type>
+    <type name="Program+&lt;StringValue&gt;c__async2">
+      <method name="Void MoveNext()" attrs="486">
+        <size>171</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">
index 2414206c692ef2023b30b34d7ca16ebceebc8306..a7803c0ea133898e278daf84efc83216b61dd253 100644 (file)
@@ -100,33 +100,34 @@ public class Program
 
        static void RewriteAssembly (string assemblyLocation, Dictionary<string, string> resourcesStrings, CmdOptions options)
        {
-               var readerParameters = new ReaderParameters { ReadSymbols = true };
-               var assembly = AssemblyDefinition.ReadAssembly (assemblyLocation, readerParameters);
-               foreach (var module in assembly.Modules) {
-                       foreach (var type in module.GetTypes ()) {
-                               foreach (var method in type.Methods) {
-                                       if (!method.HasBody)
-                                               continue;
-                                       
-                                       foreach (var instr in method.Body.Instructions) {
-                                               if (instr.OpCode != OpCodes.Ldstr)
+               var readerParameters = new ReaderParameters { ReadSymbols = true, ReadWrite = true };
+               using (var assembly = AssemblyDefinition.ReadAssembly (assemblyLocation, readerParameters)) {
+                       foreach (var module in assembly.Modules) {
+                               foreach (var type in module.GetTypes ()) {
+                                       foreach (var method in type.Methods) {
+                                               if (!method.HasBody)
                                                        continue;
-
-                                               string value;
-                                               if (resourcesStrings.TryGetValue ((string)instr.Operand, out value)) {
-                                                       if (options.Verbose) {
-                                                               Console.WriteLine ($"Replacing '{instr.Operand}' with '{value}'");
+                                               
+                                               foreach (var instr in method.Body.Instructions) {
+                                                       if (instr.OpCode != OpCodes.Ldstr)
+                                                               continue;
+
+                                                       string value;
+                                                       if (resourcesStrings.TryGetValue ((string)instr.Operand, out value)) {
+                                                               if (options.Verbose) {
+                                                                       Console.WriteLine ($"Replacing '{instr.Operand}' with '{value}'");
+                                                               }
+
+                                                               instr.Operand = value;
                                                        }
-
-                                                       instr.Operand = value;
                                                }
                                        }
                                }
                        }
-               }
 
-               var writerParameters = new WriterParameters { WriteSymbols = true };
-               assembly.Write (assemblyLocation, writerParameters);
+                       var writerParameters = new WriterParameters { WriteSymbols = true };
+                       assembly.Write (writerParameters);
+               }
        }
 
        static bool LoadGetResourceStrings (Dictionary<string, string> resourcesStrings, CmdOptions options)
index fa643ed20f825ae59d74f69e96dc55358e52c089..660e859ca2932d76afb1f778a4065e794a75b97f 100644 (file)
@@ -55,8 +55,8 @@ namespace CorCompare {
                        var ifaces = new Dictionary<string, TypeReference> ();
 
                        foreach (var def in WalkHierarchy (type))
-                               foreach (TypeReference iface in def.Interfaces)
-                                       ifaces [iface.FullName] = iface;
+                               foreach (var iface in def.Interfaces)
+                                       ifaces [iface.InterfaceType.FullName] = iface.InterfaceType;
 
                        return ifaces.Values;
                }
index 55c2aeb4283b7e621624cbb808044cac3accf1ab..dd48a6f05b183ab8ea2f547135d76393ebaf9a95 100644 (file)
@@ -59,6 +59,9 @@ namespace CorCompare
                                { "h|?|help",
                                        "Show this message and exit.",
                                        v => showHelp = v != null },
+                               { "contract-api",
+                                       "Produces contract API with all members at each level of inheritance hierarchy",
+                                       v => FullAPISet = v != null },
                        };
 
                        var asms = options.Parse (args);
@@ -116,6 +119,7 @@ namespace CorCompare
 
                internal static bool AbiMode { get; private set; }
                internal static bool FollowForwarders { get; private set; }
+               internal static bool FullAPISet { get; set; }
        }
 
        public class Utils {
@@ -538,7 +542,7 @@ namespace CorCompare
                                        members.Add (new ConstructorData (writer, ctors));
                                }
 
-                               PropertyDefinition[] properties = GetProperties (type);
+                               PropertyDefinition[] properties = GetProperties (type, Driver.FullAPISet);
                                if (properties.Length > 0) {
                                        Array.Sort (properties, PropertyDefinitionComparer.Default);
                                        members.Add (new PropertyData (writer, properties));
@@ -550,7 +554,7 @@ namespace CorCompare
                                        members.Add (new EventData (writer, events));
                                }
 
-                               MethodDefinition [] methods = GetMethods (type);
+                               MethodDefinition [] methods = GetMethods (type, Driver.FullAPISet);
                                if (methods.Length > 0) {
                                        Array.Sort (methods, MethodDefinitionComparer.Default);
                                        members.Add (new MethodData (writer, methods));
@@ -693,53 +697,91 @@ namespace CorCompare
                }
 
 
-               internal static PropertyDefinition [] GetProperties (TypeDefinition type) {
-                       ArrayList list = new ArrayList ();
+               internal static PropertyDefinition [] GetProperties (TypeDefinition type, bool fullAPI) {
+                       var list = new List<PropertyDefinition> ();
+
+                       var t = type;
+                       do {
+                               var properties = t.Properties;//type.GetProperties (flags);
+                               foreach (PropertyDefinition property in properties) {
+                                       MethodDefinition getMethod = property.GetMethod;
+                                       MethodDefinition setMethod = property.SetMethod;
 
-                       var properties = type.Properties;//type.GetProperties (flags);
-                       foreach (PropertyDefinition property in properties) {
-                               MethodDefinition getMethod = property.GetMethod;
-                               MethodDefinition setMethod = property.SetMethod;
+                                       bool hasGetter = (getMethod != null) && MustDocumentMethod (getMethod);
+                                       bool hasSetter = (setMethod != null) && MustDocumentMethod (setMethod);
 
-                               bool hasGetter = (getMethod != null) && MustDocumentMethod (getMethod);
-                               bool hasSetter = (setMethod != null) && MustDocumentMethod (setMethod);
+                                       // if neither the getter or setter should be documented, then
+                                       // skip the property
+                                       if (hasGetter || hasSetter) {
+
+                                               if (t != type && list.Any (l => l.Name == property.Name))
+                                                       continue;
 
-                               // if neither the getter or setter should be documented, then
-                               // skip the property
-                               if (hasGetter || hasSetter) {
-                                       list.Add (property);
+                                               list.Add (property);
+                                       }
                                }
-                       }
 
-                       return (PropertyDefinition []) list.ToArray (typeof (PropertyDefinition));
+                               if (!fullAPI)
+                                       break;
+
+                               if (t.IsInterface || t.IsEnum)
+                                       break;
+
+                               if (t.BaseType == null || t.BaseType.FullName == "System.Object")
+                                       t = null;
+                               else
+                                       t = t.BaseType.Resolve ();
+
+                       } while (t != null);
+
+                       return list.ToArray ();
                }
 
-               private MethodDefinition[] GetMethods (TypeDefinition type)
+               private MethodDefinition[] GetMethods (TypeDefinition type, bool fullAPI)
                {
-                       ArrayList list = new ArrayList ();
+                       var list = new List<MethodDefinition> ();
 
-                       var methods = type.Methods;//type.GetMethods (flags);
-                       foreach (MethodDefinition method in methods) {
-                               if (method.IsSpecialName && !method.Name.StartsWith ("op_", StringComparison.Ordinal))
-                                       continue;
+                       var t = type;
+                       do {
+                               var methods = t.Methods;//type.GetMethods (flags);
+                               foreach (MethodDefinition method in methods) {
+                                       if (method.IsSpecialName && !method.Name.StartsWith ("op_", StringComparison.Ordinal))
+                                               continue;
 
-                               // we're only interested in public or protected members
-                               if (!MustDocumentMethod(method))
-                                       continue;
+                                       // we're only interested in public or protected members
+                                       if (!MustDocumentMethod (method))
+                                               continue;
+
+                                       if (t == type && IsFinalizer (method)) {
+                                               string name = method.DeclaringType.Name;
+                                               int arity = name.IndexOf ('`');
+                                               if (arity > 0)
+                                                       name = name.Substring (0, arity);
 
-                               if (IsFinalizer (method)) {
-                                       string name = method.DeclaringType.Name;
-                                       int arity = name.IndexOf ('`');
-                                       if (arity > 0)
-                                               name = name.Substring (0, arity);
+                                               method.Name = "~" + name;
+                                       }
+
+                                       // TODO: Better check
+                                       if (t != type && list.Any (l => l.DeclaringType != method.DeclaringType && l.Name == method.Name && l.Parameters.Count == method.Parameters.Count))
+                                               continue;
 
-                                       method.Name = "~" + name;
+                                       list.Add (method);
                                }
 
-                               list.Add (method);
-                       }
+                               if (!fullAPI)
+                                       break;
 
-                       return (MethodDefinition []) list.ToArray (typeof (MethodDefinition));
+                               if (!t.IsInterface || t.IsEnum)
+                                       break;
+
+                               if (t.BaseType == null || t.BaseType.FullName == "System.Object")
+                                       t = null;
+                               else
+                                       t = t.BaseType.Resolve ();
+
+                       } while (t != null);
+
+                       return list.ToArray ();
                }
 
                static bool IsFinalizer (MethodDefinition method)
index d8b86335579a2cdbc66a2ce9fd42c99b6d2059ad..28279d9322a8a3e593b40857f7b9758bfcfa72ce 100644 (file)
                        <method name="PrivateInvoke" />
                        <method name="GetAppDomainTarget" />
                </type>
-               <type fullname="System.Runtime.Remoting.Proxies.TransparentProxy" preserve="fields" />
+               <type fullname="System.Runtime.Remoting.Proxies.TransparentProxy" preserve="fields">
+                       <method name="LoadRemoteFieldNew" />
+                       <method name="StoreRemoteField" />
+               </type>
                <type fullname="System.Runtime.Remoting.RemotingServices">
                        <method name="SerializeCallData" />
                        <method name="DeserializeCallData" />
index 74e61e3541c895af113ea346790d598269aa3ff8..0c39910ff5ea06b2d5a538e7ebbda7b09f27f63b 100644 (file)
@@ -520,8 +520,8 @@ namespace Mono.Linker.Steps {
                                MarkFields (type, type.IsEnum);
 
                        if (type.HasInterfaces) {
-                               foreach (TypeReference iface in type.Interfaces)
-                                       MarkType (iface);
+                               foreach (var iface in type.Interfaces)
+                                       MarkType (iface.InterfaceType);
                        }
 
                        if (type.HasMethods) {
index 4f0e2eeaaee1c8a73fc39e71e370ad57d515f442..3fe12ae667c60f4ab5d9772833d6901b2891b452 100644 (file)
@@ -59,8 +59,8 @@ namespace Mono.Linker.Steps {
                        if (!type.HasInterfaces)
                                return;
 
-                       foreach (TypeReference @interface in type.Interfaces) {
-                               var iface = @interface.Resolve ();
+                       foreach (var @interface in type.Interfaces) {
+                               var iface = @interface.InterfaceType.Resolve ();
                                if (iface == null || !iface.HasMethods)
                                        continue;
 
@@ -160,8 +160,8 @@ namespace Mono.Linker.Steps {
                        if (!type.HasInterfaces)
                                yield break;
 
-                       foreach (TypeReference interface_ref in type.Interfaces) {
-                               TypeDefinition @interface = interface_ref.Resolve ();
+                       foreach (var interface_ref in type.Interfaces) {
+                               TypeDefinition @interface = interface_ref.InterfaceType.Resolve ();
                                if (@interface == null)
                                        continue;
 
index c319f54ecfcd67efb50bdd224b2bcdbfbb9df41c..f7074361022d4314aa934b4e5954245d5adacf89 100644 (file)
@@ -16,7 +16,7 @@ MDOC_COMMON_FLAGS = \
 LIB_REFS = monodoc System System.Xml System.Core Mono.Cecil ICSharpCode.SharpZipLib System.Xml.Linq System.Web
        
 LOCAL_MCS_FLAGS = $(MDOC_COMMON_FLAGS)
-PROGRAM = mdoc.exe
+PROGRAM = $(topdir)/class/lib/$(PROFILE)/mdoc.exe
 PROGRAM_DEPS = $(topdir)/class/lib/$(PROFILE)/monodoc.dll
 
 ifdef NET
@@ -66,11 +66,6 @@ PROGRAM_COMPILE = $(CSCOMPILE) -platform:x86
 
 include ../../build/executable.make
 
-$(PROGRAM) : $(build_lib)
-       cp $< $@
-
-$(PROGRAM) : Makefile
-
 MONO = \
        MONO_PATH="$(topdir)/class/lib/$(PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" \
        $(RUNTIME) $(RUNTIME_FLAGS)
@@ -165,7 +160,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 --exclude=.svn -rup Test/en.expected-addNonGeneric Test/en.actual
+       diff -rup 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.
@@ -173,7 +168,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 --exclude=.svn -rup Test/en.expected-dropns-classic-v1 Test/en.actual
+       diff -rup Test/en.expected-dropns-classic-v1 Test/en.actual
 
 check-monodocer-dropns-multi: $(PROGRAM)
        -rm -Rf Test/en.actual
@@ -190,7 +185,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 --exclude=.svn -rup Test/en.expected-dropns-multi Test/en.actual
+       diff -rup Test/en.expected-dropns-multi Test/en.actual
 
 
 check-monodocer-dropns-multi-withexisting: $(PROGRAM)
@@ -208,7 +203,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 --exclude=.svn -rup Test/en.expected-dropns-multi-withexisting Test/en.actual
+       diff -rup Test/en.expected-dropns-multi-withexisting Test/en.actual
 
 check-monodocer-dropns-delete: $(PROGRAM)
        -rm -Rf Test/en.actual
@@ -222,7 +217,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 --exclude=.dvn -rup Test/en.expected-dropns-delete Test/en.actual
+       diff -rup 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
@@ -231,7 +226,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 --exclude=.svn -rup Test/en.expected-dropns-classic-withsecondary Test/en.actual
+       diff -rup Test/en.expected-dropns-classic-withsecondary Test/en.actual
 
 update-monodocer-dropns-unified: $(PROGRAM)
        $(MAKE) Test/DocTest-DropNS-unified.dll
@@ -250,13 +245,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 --exclude=.svn -rup Test/en.expected-internal-interface Test/en.actual
+       diff -rup 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 --exclude=.svn -rup Test/en.expected-enumerations Test/en.actual
+       diff -rup Test/en.expected-enumerations Test/en.actual
 
 check-monodocer-update: $(PROGRAM)
        find Test/en.expected -name \*.xml -exec rm "{}" \;
@@ -267,9 +262,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 --exclude=.svn -rup Test/en.expected Test/en.actual
+       diff -rup Test/en.expected Test/en.actual
        $(MONO) $(PROGRAM) update --debug --exceptions=all -o Test/en.actual Test/DocTest.dll 
-       diff --exclude=.svn -rup Test/en.expected Test/en.actual
+       diff -rup Test/en.expected Test/en.actual
 
 check-monodocer-since-update: $(PROGRAM)
        find Test/en.expected.since -name \*.xml -exec rm "{}" \;
@@ -286,7 +281,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 --exclude=.svn -rup Test/en.expected.since Test/en.actual
+       diff -rup Test/en.expected.since Test/en.actual
 
 check-monodocer-delete-update: $(PROGRAM)
        find Test/en.expected.delete -type f -exec rm "{}" \;
@@ -306,7 +301,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 --exclude=.svn -rup Test/en.expected.delete Test/en.actual
+       diff -rup Test/en.expected.delete Test/en.actual
 
 check-monodocer-importslashdoc-update: $(PROGRAM)
        find Test/en.expected.importslashdoc -name \*.xml -exec rm "{}" \;
@@ -319,7 +314,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 --exclude=.svn -rup Test/en.expected.importslashdoc Test/en.actual
+       diff -rup Test/en.expected.importslashdoc Test/en.actual
 
 check-monodocer-importecmadoc-update: $(PROGRAM)
        find Test/en.expected.importecmadoc -name \*.xml -exec rm "{}" \;
@@ -336,7 +331,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 --exclude=.svn -rup Test/en.expected.importecmadoc Test/en.actual
+       diff -rup Test/en.expected.importecmadoc Test/en.actual
 
 check-mdoc-export-html-update: $(PROGRAM)
        find Test/html.expected -name \*.html -exec rm "{}" \;
@@ -347,7 +342,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 --exclude=.svn -rup Test/html.expected Test/html.actual
+       diff -rup 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
@@ -362,7 +357,7 @@ check-mdoc-export-html-with-version: $(PROGRAM)
 check-md-html-dir: $(PROGRAM)
        rm -Rf Test/html.actual
        $(MONO) $(PROGRAM) export-html -dest:Test/html.actual $(DIR) 
-       diff --exclude=.svn -rup Test/html.expected Test/html.actual
+       diff -rup Test/html.expected Test/html.actual
 
 check-mdoc-export-msxdoc-update:
        $(MONO) $(PROGRAM) export-msxdoc -o - Test/en.expected.importslashdoc \
index 5919870876ca773db4ebbb255220415b927870c5..23b6762a6548c8101f60847be9983f5aa9f15f2b 100644 (file)
@@ -74,7 +74,8 @@ namespace Mono.Documentation {
                        get {
                                if (member == null)
                                        throw new ArgumentNullException ("member");
-                               MemberReference memberDef = member.Resolve ();
+
+                               var memberDef = member.Resolve ();
                                if (memberDef == null) {
                                        ArrayType array = member.DeclaringType as ArrayType;
                                        if (array != null && array.Rank > 1) {
@@ -87,7 +88,7 @@ namespace Mono.Documentation {
                                                                "Unable to resolve member {0}::{1}.",
                                                                member.DeclaringType.FullName, member.Name));
                                }
-                               string memberDecl = xdoc.GetDeclaration (member.Resolve ());
+                               string memberDecl = xdoc.GetDeclaration (member);
                                Dictionary<string, ExceptionSources> e;
                                if (!db.TryGetValue (memberDecl, out e)) {
                                        e = new Dictionary<string, ExceptionSources> ();
index dc94c3a50b827a931eeae57f6e891f0428fef047..8b5b5ab08e4d440f58d3dd88d1b732cbd5ccc449 100644 (file)
@@ -3007,26 +3007,6 @@ static class CecilExtensions {
                return method.GenericParameters.Count > 0;
        }
 
-       public static MemberReference Resolve (this MemberReference member)
-       {
-               FieldReference fr = member as FieldReference;
-               if (fr != null)
-                       return fr.Resolve ();
-               MethodReference mr = member as MethodReference;
-               if (mr != null)
-                       return mr.Resolve ();
-               TypeReference tr = member as TypeReference;
-               if (tr != null)
-                       return tr.Resolve ();
-               PropertyReference pr = member as PropertyReference;
-               if (pr != null)
-                       return pr;
-               EventReference er = member as EventReference;
-               if (er != null)
-                       return er;
-               throw new NotSupportedException ("Cannot find definition for " + member.ToString ());
-       }
-
        public static TypeReference GetUnderlyingType (this TypeDefinition type)
        {
                if (!type.IsEnum)
@@ -3256,7 +3236,8 @@ static class DocUtils {
        {
                HashSet<string> inheritedInterfaces = GetInheritedInterfaces (type);
                List<TypeReference> userInterfaces = new List<TypeReference> ();
-               foreach (TypeReference iface in type.Interfaces) {
+               foreach (var ii in type.Interfaces) {
+                       var iface = ii.InterfaceType;
                        TypeReference lookup = iface.Resolve () ?? iface;
                        if (!inheritedInterfaces.Contains (GetQualifiedTypeName (lookup)))
                                userInterfaces.Add (iface);
@@ -3275,9 +3256,9 @@ static class DocUtils {
                Action<TypeDefinition> a = null;
                a = t => {
                        if (t == null) return;
-                       foreach (TypeReference r in t.Interfaces) {
-                               inheritedInterfaces.Add (GetQualifiedTypeName (r));
-                               a (r.Resolve ());
+                       foreach (var r in t.Interfaces) {
+                               inheritedInterfaces.Add (GetQualifiedTypeName (r.InterfaceType));
+                               a (r.InterfaceType.Resolve ());
                        }
                };
                TypeReference baseRef = type.BaseType;
@@ -3290,8 +3271,8 @@ static class DocUtils {
                        else
                                baseRef = null;
                }
-               foreach (TypeReference r in type.Interfaces)
-                       a (r.Resolve ());
+               foreach (var r in type.Interfaces)
+                       a (r.InterfaceType.Resolve ());
                return inheritedInterfaces;
        }
 }
@@ -4366,8 +4347,13 @@ public abstract class MemberFormatter {
        {
                return e.Name;
        }
+       
+       public string GetDeclaration (MemberReference mreference)
+       {
+               return GetDeclaration (mreference.Resolve ());
+       }
 
-       public virtual string GetDeclaration (MemberReference member)
+       string GetDeclaration (IMemberDefinition member)
        {
                if (member == null)
                        throw new ArgumentNullException ("member");
@@ -4631,8 +4617,8 @@ class ILFullMemberFormatter : MemberFormatter {
                                buf.Append (full.GetName (type.BaseType).Substring ("class ".Length));
                }
                bool first = true;
-               foreach (var name in type.Interfaces.Where (i => MDocUpdater.IsPublic (i.Resolve ()))
-                               .Select (i => full.GetName (i))
+               foreach (var name in type.Interfaces.Where (i => MDocUpdater.IsPublic (i.InterfaceType.Resolve ()))
+                               .Select (i => full.GetName (i.InterfaceType))
                                .OrderBy (n => n)) {
                        if (first) {
                                buf.Append (" implements ");
@@ -5684,15 +5670,6 @@ class SlashDocMemberFormatter : MemberFormatter {
                return buf;
        }
 
-       public override string GetDeclaration (MemberReference member)
-       {
-               TypeReference r = member as TypeReference;
-               if (r != null) {
-                       return "T:" + GetTypeName (r);
-               }
-               return base.GetDeclaration (member);
-       }
-
        protected override string GetConstructorName (MethodReference constructor)
        {
                return GetMethodDefinitionName (constructor, "#ctor");
index 7032bddcfb09e5bebb2606b12286f701baa51dea..ee453b30a3468ae206d2a0487ac8214399804e67 100644 (file)
     <Reference Include="System.Xml.Linq" />
     <Reference Include="ICSharpCode.SharpZipLib" />
     <Reference Include="System.Xml" />
-    <Reference Include="Mono.Cecil, Version=0.9.5.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />
     <Reference Include="monodoc">
-      <HintPath>..\..\class\lib\net_4_5\monodoc.dll</HintPath>
+      <HintPath>..\..\class\lib\net_4_x\monodoc.dll</HintPath>
+    </Reference>
+    <Reference Include="Mono.Cecil">
+      <HintPath>..\..\class\lib\net_4_x\Mono.Cecil.dll</HintPath>
     </Reference>
   </ItemGroup>
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
index 8fe2784485220399c0646210de60a119268d78bc..0f4cd7c2d9586858916282c108fd1890ae2fb3a0 100644 (file)
@@ -78,10 +78,11 @@ namespace Xamarin.ApiDiff {
                public  static  bool    IgnoreVirtualChanges        { get; set; }
                public  static  bool    IgnoreAddedPropertySetters  { get; set; }
 
+               public static bool IgnoreNonbreaking { get; set; }
+
                public static bool Lax;
                public static bool Colorize = true;
        }
-
        class Program {
 
                public static int Main (string[] args)
@@ -120,7 +121,8 @@ namespace Xamarin.ApiDiff {
                                        v => State.IgnoreVirtualChanges = v != null
                                },
                                { "c|colorize:", "Colorize HTML output", v => State.Colorize = string.IsNullOrEmpty (v) ? true : bool.Parse (v) },
-                               { "x|lax", "Ignore duplicate XML entries", v => State.Lax = true }
+                               { "x|lax", "Ignore duplicate XML entries", v => State.Lax = true },
+                               { "ignore-nonbreaking", "Ignore all nonbreaking changes", v => State.IgnoreNonbreaking = true }
                        };
 
                        try {
@@ -130,6 +132,13 @@ namespace Xamarin.ApiDiff {
                                showHelp = true;
                        }
 
+                       if (State.IgnoreNonbreaking) {
+                               State.IgnoreAddedPropertySetters = true;
+                               State.IgnoreVirtualChanges = true;
+                               State.IgnoreNew.Add (new Regex (".*"));
+                               State.IgnoreAdded.Add (new Regex (".*"));
+                       }
+
                        if (showHelp || extra == null || extra.Count < 2 || extra.Count > 3) {
                                Console.WriteLine (@"Usage: mono-api-html [options] <reference.xml> <assembly.xml> [diff.html]");
                                Console.WriteLine ();
@@ -253,9 +262,11 @@ namespace Xamarin.ApiDiff {
                                                        } else {
                                                                file.WriteLine ("<h1>{0}.dll vs {1}.dll</h1>", ac.SourceAssembly, ac.TargetAssembly);
                                                        }
-                                                       file.WriteLine ("<a href='javascript: hideNonBreakingChanges (); ' class='hide-nonbreaking'>Hide non-breaking changes</a>");
-                                                       file.WriteLine ("<a href='javascript: showNonBreakingChanges (); ' class='restore-nonbreaking' style='display: none;'>Show non-breaking changes</a>");
-                                                       file.WriteLine ("<br/>");
+                                                       if (!State.IgnoreNonbreaking) {
+                                                               file.WriteLine ("<a href='javascript: hideNonBreakingChanges (); ' class='hide-nonbreaking'>Hide non-breaking changes</a>");
+                                                               file.WriteLine ("<a href='javascript: showNonBreakingChanges (); ' class='restore-nonbreaking' style='display: none;'>Show non-breaking changes</a>");
+                                                               file.WriteLine ("<br/>");
+                                                       }
                                                        file.WriteLine ("<div data-is-topmost>");
                                                        file.Write (diffHtml);
                                                        file.WriteLine ("</div> <!-- end topmost div -->");
index a3399fbef04e5b731cfeb8277176f2a0705752e5..f6cf940c9e41c63eeb8ad5f6cb9f0fae6a16c52d 100644 (file)
@@ -198,6 +198,20 @@ namespace Xamarin.ApiDiff {
                        Indent ().WriteLine ("}");
                }
 
+               //HACK: we don't have hierarchy information here so just check some basic heuristics for now
+               bool IsBaseChangeCompatible (string source, string target)
+               {
+                       if (source == "System.Object")
+                               return true;
+                       if (source == "System.Exception" && target.EndsWith ("Exception", StringComparison.Ordinal))
+                               return true;
+                       if (source == "System.EventArgs" && target.EndsWith ("EventArgs", StringComparison.Ordinal))
+                               return true;
+                       if (source == "System.Runtime.InteropServices.SafeHandle" && target.StartsWith ("Microsoft.Win32.SafeHandles.SafeHandle", StringComparison.Ordinal))
+                               return true;
+                       return false;
+               }
+
                public override void Modified (XElement source, XElement target, ApiChanges diff)
                {
                        // hack - there could be changes that we're not monitoring (e.g. attributes properties)
@@ -206,7 +220,7 @@ namespace Xamarin.ApiDiff {
 
                        var sb = source.GetAttribute ("base");
                        var tb = target.GetAttribute ("base");
-                       if (sb != tb) {
+                       if (sb != tb && !(State.IgnoreNonbreaking && IsBaseChangeCompatible (sb, tb))) {
                                Output.Write ("Modified base type: ");
                                Output.WriteLine (new ApiChange ().AppendModified (sb, tb, true).Member.ToString ());
                        }
index a2b0225b4480856d2c1497bcb761c67b1abb2a33..f292eee22ddadfdbb051439c9e11c5a205ddd5f2 100644 (file)
@@ -45,14 +45,16 @@ namespace Xamarin.ApiDiff {
 
                void RenderFieldAttributes (FieldAttributes source, FieldAttributes target, ApiChange change)
                {
-                       var srcNotSerialized = (source & FieldAttributes.NotSerialized) == FieldAttributes.NotSerialized;
-                       var tgtNotSerialized = (target & FieldAttributes.NotSerialized) == FieldAttributes.NotSerialized;
-                       if (srcNotSerialized != tgtNotSerialized) {
-                               // this is not a breaking change, so only render it if it changed.
-                               if (srcNotSerialized) {
-                                       change.AppendRemoved ("[NonSerialized]\n");
-                               } else {
-                                       change.AppendAdded ("[NonSerialized]\n");
+                       if (!State.IgnoreNonbreaking) {
+                               var srcNotSerialized = (source & FieldAttributes.NotSerialized) == FieldAttributes.NotSerialized;
+                               var tgtNotSerialized = (target & FieldAttributes.NotSerialized) == FieldAttributes.NotSerialized;
+                               if (srcNotSerialized != tgtNotSerialized) {
+                                       // this is not a breaking change, so only render it if it changed.
+                                       if (srcNotSerialized) {
+                                               change.AppendRemoved ("[NonSerialized]\n");
+                                       } else {
+                                               change.AppendAdded ("[NonSerialized]\n");
+                                       }
                                }
                        }
 
index d12d86625c2ea7a0af1b5d4bbb8067bd32ed04e1..e99f07415765bc21b618798f6d7c132a22d0a1e1 100644 (file)
@@ -138,9 +138,13 @@ namespace Xamarin.ApiDiff {
                void Modify (ApiChanges modified)
                {
                        foreach (var changes in modified) {
+                               if (State.IgnoreNonbreaking && changes.Value.All (c => !c.Breaking))
+                                       continue;
                                Output.WriteLine ("<p>{0}:</p>", changes.Key);
                                Output.WriteLine ("<pre>");
                                foreach (var element in changes.Value) {
+                                       if (State.IgnoreNonbreaking && !element.Breaking)
+                                               continue;
                                        Output.Write ("<div {0}>", element.Breaking ? "data-is-breaking" : "data-is-non-breaking");
                                        foreach (var line in element.Member.ToString ().Split ('\n'))
                                                Output.WriteLine ("\t{0}", line);
@@ -158,6 +162,8 @@ namespace Xamarin.ApiDiff {
                                if (State.IgnoreRemoved.Any (re => re.IsMatch (GetDescription (item))))
                                        continue;
                                SetContext (item);
+                               if (State.IgnoreNonbreaking && !IsBreakingRemoval (item))
+                                       continue;
                                if (!r) {
                                        BeforeRemoving (elements);
                                        r = true;
@@ -418,8 +424,13 @@ namespace Xamarin.ApiDiff {
                                if (tgtAbstract) {
                                        change.AppendAdded ("abstract", true).Append (" ");
                                } else if (srcWord != tgtWord) {
-                                       if (!tgtFinal)
-                                               change.AppendModified (srcWord, tgtWord, breaking).Append (" ");
+                                       if (!tgtFinal) {
+                                               if (State.IgnoreVirtualChanges) {
+                                                       change.HasIgnoredChanges = true;
+                                               } else {
+                                                       change.AppendModified (srcWord, tgtWord, breaking).Append (" ");
+                                               }
+                                       }
                                } else if (tgtWord.Length > 0) {
                                        change.Append (tgtWord).Append (" ");
                                } else if (srcWord.Length > 0) {
@@ -431,7 +442,11 @@ namespace Xamarin.ApiDiff {
                                if (tgtFinal) {
                                        change.Append ("final ");
                                } else {
-                                       change.AppendRemoved ("final", false).Append (" "); // removing 'final' is not a breaking change.
+                                       if (srcVirtual && !tgtVirtual && State.IgnoreVirtualChanges) {
+                                               change.HasIgnoredChanges = true;
+                                       } else {
+                                               change.AppendRemoved ("final", false).Append (" "); // removing 'final' is not a breaking change.
+                                       }
                                }
                        } else {
                                if (tgtFinal && srcVirtual) {
index 01a7ceb97d9d7b328ad92007b57df1ac93bd3b80..68387807a59af2fcaad1ade75e0c9aa110343a84 100644 (file)
@@ -7,218 +7,171 @@ using Mono.Cecil;
 using Mono.Cecil.Cil;
 using Mono.Collections.Generic;
 
-namespace Symbolicate
+namespace Mono
 {
-       class LocationProvider {
-               class AssemblyLocationProvider {
-                       AssemblyDefinition assembly;
-                       string seqPointDataPath;
-
-                       public AssemblyLocationProvider (AssemblyDefinition assembly, string seqPointDataPath)
-                       {
-                               this.assembly = assembly;
-                               this.seqPointDataPath = seqPointDataPath;
-                       }
+       class AssemblyLocationProvider
+       {
+               AssemblyDefinition assembly;
+               Logger logger;
 
-                       public SequencePoint TryGetLocation (string typeFullName, string methodSignature, int offset, bool isOffsetIL, uint methodIndex)
-                       {
-                               if (!assembly.MainModule.HasSymbols)
-                                       return null;
+               public AssemblyLocationProvider (string assemblyPath, Logger logger)
+               {
+                       assemblyPath = Path.GetFullPath (assemblyPath);
+                       this.logger = logger;
 
-                               TypeDefinition type = null;
-                               var nested = typeFullName.Split ('+');
-                               var types = assembly.MainModule.Types;
-                               foreach (var ntype in nested) {
-                                       type = types.FirstOrDefault (t => t.Name == ntype);
-                                       if (type == null)
-                                               return null;
+                       if (!File.Exists (assemblyPath))
+                               throw new ArgumentException ("assemblyPath does not exist: "+ assemblyPath);
+
+                       var readerParameters = new ReaderParameters { ReadSymbols = true };
+                       assembly = AssemblyDefinition.ReadAssembly (assemblyPath, readerParameters);
+               }
 
-                                       types = type.NestedTypes;
+               public bool TryResolveLocation (StackFrameData sfData, SeqPointInfo seqPointInfo)
+               {
+                       if (!assembly.MainModule.HasSymbols)
+                               return false;
+
+                       TypeDefinition type = null;
+                       var nested = sfData.TypeFullName.Split ('+');
+                       var types = assembly.MainModule.Types;
+                       foreach (var ntype in nested) {
+                               if (type == null) {
+                                       // Use namespace first time.
+                                       type = types.FirstOrDefault (t => t.FullName == ntype);
+                               } else {
+                                       type = types.FirstOrDefault (t => t.Name == ntype);
                                }
 
-                               var parensStart = methodSignature.IndexOf ('(');
-                               var methodName = methodSignature.Substring (0, parensStart).TrimEnd ();
-                               var methodParameters = methodSignature.Substring (parensStart);
-                               var method = type.Methods.FirstOrDefault (m => CompareName (m, methodName) && CompareParameters (m.Parameters, methodParameters));
-                               if (method == null)
-                                       return null;
-
-                               int ilOffset = isOffsetIL ? offset : GetILOffsetFromFile (method.MetadataToken.ToInt32 (), methodIndex, offset);
-                               if (ilOffset < 0)
-                                       return null;
-
-                               SequencePoint sp = null;
-                               foreach (var instr in method.Body.Instructions) {
-                                       if (instr.SequencePoint != null)
-                                               sp = instr.SequencePoint;
-                                       
-                                       if (instr.Offset >= ilOffset) {
-                                               return sp;
-                                       }
+                               if (type == null) {
+                                       logger.LogWarning ("Could not find type: {0}", ntype);
+                                       return false;
                                }
 
-                               return null;
+                               types = type.NestedTypes;
                        }
 
-                       SeqPointInfo seqPointInfo;
-                       private int GetILOffsetFromFile (int methodToken, uint methodIndex, int nativeOffset)
-                       {
-                               if (seqPointInfo == null)
-                                       seqPointInfo = SeqPointInfo.Read (seqPointDataPath);
-
-                               return seqPointInfo.GetILOffset (methodToken, methodIndex, nativeOffset);
+                       var parensStart = sfData.MethodSignature.IndexOf ('(');
+                       var methodName = sfData.MethodSignature.Substring (0, parensStart).TrimEnd ();
+                       var methodParameters = sfData.MethodSignature.Substring (parensStart);
+                       var method = type.Methods.FirstOrDefault (m => CompareName (m, methodName) && CompareParameters (m.Parameters, methodParameters));
+                       if (method == null) {
+                               logger.LogWarning ("Could not find method: {0}", methodName);
+                               return false;
                        }
 
-                       static bool CompareName (MethodDefinition candidate, string expected)
-                       {
-                               if (candidate.Name == expected)
-                                       return true;
-
-                               if (!candidate.HasGenericParameters)
-                                       return false;
-                               
-                               var genStart = expected.IndexOf ('[');
-                               if (genStart < 0)
-                                       return false;
-
-                               if (candidate.Name != expected.Substring (0, genStart))
+                       int ilOffset;
+                       if (sfData.IsILOffset) {
+                               ilOffset = sfData.Offset;
+                       } else {
+                               if (seqPointInfo == null)
                                        return false;
 
-                               int arity = 1;
-                               for (int pos = genStart; pos < expected.Length; ++pos) {
-                                       if (expected [pos] == ',')
-                                               ++arity;
-                               }
-
-                               return candidate.GenericParameters.Count == arity;
+                               ilOffset = seqPointInfo.GetILOffset (method.MetadataToken.ToInt32 (), sfData.MethodIndex, sfData.Offset);
                        }
 
-                       static bool CompareParameters (Collection<ParameterDefinition> candidate, string expected)
-                       {
-                               var builder = new StringBuilder ();
-                               builder.Append ("(");
-
-                               for (int i = 0; i < candidate.Count; i++) {
-                                       var parameter = candidate [i];
-                                       if (i > 0)
-                                               builder.Append (", ");
+                       if (ilOffset < 0)
+                               return false;
 
-                                       if (parameter.ParameterType.IsSentinel)
-                                               builder.Append ("...,");
+                       if (!method.DebugInformation.HasSequencePoints)
+                               return false;
 
-                                       var pt = parameter.ParameterType;
-                                       if (!string.IsNullOrEmpty (pt.Namespace)) {
-                                               builder.Append (pt.Namespace);
-                                               builder.Append (".");
-                                       }
+                       SequencePoint prev = null;
+                       foreach (var sp in method.DebugInformation.SequencePoints.OrderBy (l => l.Offset)) {
+                               if (sp.Offset >= ilOffset) {
+                                       sfData.SetLocation (sp.Document.Url, sp.StartLine);
+                                       return true;
+                               }
 
-                                       FormatElementType (pt, builder);
+                               prev = sp;
+                       }
 
-                                       builder.Append (" ");
-                                       builder.Append (parameter.Name);
-                               }
+                       if (prev != null) {
+                               sfData.SetLocation (prev.Document.Url, prev.StartLine);
+                               return true;
+                       }
 
-                               builder.Append (")");
+                       return false;
+               }
 
-                               return builder.ToString () == expected;
+               static bool CompareName (MethodDefinition candidate, string expected)
+               {
+                       if (candidate.Name == expected)
+                               return true;
+
+                       if (!candidate.HasGenericParameters)
+                               return false;
+                       
+                       var genStart = expected.IndexOf ('[');
+                       if (genStart < 0)
+                               return false;
+
+                       if (candidate.Name != expected.Substring (0, genStart))
+                               return false;
+
+                       int arity = 1;
+                       for (int pos = genStart; pos < expected.Length; ++pos) {
+                               if (expected [pos] == ',')
+                                       ++arity;
                        }
 
-                       static void FormatElementType (TypeReference tr, StringBuilder builder)
-                       {
-                               var ts = tr as TypeSpecification;
-                               if (ts != null) {
-                                       if (ts.IsByReference) {
-                                               FormatElementType (ts.ElementType, builder);
-                                               builder.Append ("&");
-                                               return;
-                                       }
+                       return candidate.GenericParameters.Count == arity;
+               }
 
-                                       var array = ts as ArrayType;
-                                       if (array != null) {
-                                               FormatElementType (ts.ElementType, builder);
-                                               builder.Append ("[");
+               static bool CompareParameters (Collection<ParameterDefinition> candidate, string expected)
+               {
+                       var builder = new StringBuilder ();
+                       builder.Append ("(");
 
-                                               for (int ii = 0; ii < array.Rank - 1; ++ii) {
-                                                       builder.Append (",");
-                                               }
+                       for (int i = 0; i < candidate.Count; i++) {
+                               var parameter = candidate [i];
+                               if (i > 0)
+                                       builder.Append (", ");
 
-                                               builder.Append ("]");
-                                               return;
-                                       }
+                               if (parameter.ParameterType.IsSentinel)
+                                       builder.Append ("...,");
+
+                               var pt = parameter.ParameterType;
+                               if (!string.IsNullOrEmpty (pt.Namespace)) {
+                                       builder.Append (pt.Namespace);
+                                       builder.Append (".");
                                }
 
-                               builder.Append (tr.Name);
+                               FormatElementType (pt, builder);
+
+                               builder.Append (" ");
+                               builder.Append (parameter.Name);
                        }
-               }
 
-               Dictionary<string, AssemblyLocationProvider> assemblies;
-               HashSet<string> directories;
+                       builder.Append (")");
 
-               public LocationProvider () {
-                       assemblies = new Dictionary<string, AssemblyLocationProvider> ();
-                       directories = new HashSet<string> ();
+                       return builder.ToString () == expected;
                }
 
-               public void AddAssembly (string assemblyPath)
+               static void FormatElementType (TypeReference tr, StringBuilder builder)
                {
-                       assemblyPath = Path.GetFullPath (assemblyPath);
-                       if (assemblies.ContainsKey (assemblyPath))
-                               return;
-
-                       if (!File.Exists (assemblyPath))
-                               throw new ArgumentException ("assemblyPath does not exist: "+ assemblyPath);
-
-                       var readerParameters = new ReaderParameters { ReadSymbols = true };
-                       var assembly = AssemblyDefinition.ReadAssembly (assemblyPath, readerParameters);
-
-                       var seqPointDataPath = assemblyPath + ".msym";
-                       if (!File.Exists (seqPointDataPath))
-                               seqPointDataPath = null;
-
-                       assemblies.Add (assemblyPath, new AssemblyLocationProvider (assembly, seqPointDataPath));
-
-                       // TODO: Should use AssemblyName with .net unification rules
-                       directories.Add (Path.GetDirectoryName (assemblyPath));
-
-                       foreach (var assemblyRef in assembly.MainModule.AssemblyReferences) {
-                               string refPath = null;
-                               foreach (var dir in directories) {
-                                       refPath = Path.Combine (dir, assemblyRef.Name);
-                                       if (File.Exists (refPath))
-                                               break;
-                                       refPath = Path.Combine (dir, assemblyRef.Name + ".dll");
-                                       if (File.Exists (refPath))
-                                               break;
-                                       refPath = Path.Combine (dir, assemblyRef.Name + ".exe");
-                                       if (File.Exists (refPath))
-                                               break;
-                                       refPath = null;
+                       var ts = tr as TypeSpecification;
+                       if (ts != null) {
+                               if (ts.IsByReference) {
+                                       FormatElementType (ts.ElementType, builder);
+                                       builder.Append ("&");
+                                       return;
                                }
-                               if (refPath != null)
-                                       AddAssembly (refPath);
-                       }
-               }
 
-               public void AddDirectory (string directory)
-               {
-                       directory = Path.GetFullPath (directory);
-                       if (!Directory.Exists (directory)) {
-                               Console.Error.WriteLine ("Directory " + directory + " does not exist.");
-                               return;
-                       }
+                               var array = ts as ArrayType;
+                               if (array != null) {
+                                       FormatElementType (ts.ElementType, builder);
+                                       builder.Append ("[");
 
-                       directories.Add (directory);
-               }
+                                       for (int ii = 0; ii < array.Rank - 1; ++ii) {
+                                               builder.Append (",");
+                                       }
 
-               public SequencePoint TryGetLocation (string typeFullName, string methodSignature, int offset, bool isOffsetIL, uint methodIndex)
-               {
-                       foreach (var assembly in assemblies.Values) {
-                               var loc = assembly.TryGetLocation (typeFullName, methodSignature, offset, isOffsetIL, methodIndex);
-                               if (loc != null)
-                                       return loc;
+                                       builder.Append ("]");
+                                       return;
+                               }
                        }
 
-                       return null;
+                       builder.Append (tr.Name);
                }
        }
 }
diff --git a/mcs/tools/mono-symbolicate/Logger.cs b/mcs/tools/mono-symbolicate/Logger.cs
new file mode 100644 (file)
index 0000000..4dd1174
--- /dev/null
@@ -0,0 +1,48 @@
+using System;
+
+namespace Mono
+{
+       public class Logger
+       {
+               public enum Level
+               {
+                       Debug = 1,
+                       Warning = 2,
+                       Error = 3,
+                       None = 4,
+               }
+
+               Level level;
+               Action<string> logAction;
+
+               public Logger (Level level, Action<string> logAction)
+               {
+                       this.level = level;
+                       this.logAction = logAction;
+               }
+
+               public void LogDebug (string str, params string[] vals)
+               {
+                       Log (Level.Debug, "Debug: " + str, vals);
+               }
+
+               public void LogWarning (string str, params string[] vals)
+               {
+                       Log (Level.Warning, "Warning: " + str, vals);
+               }
+
+               public void LogError (string str, params string[] vals)
+               {
+                       Log (Level.Error, "Error: " + str, vals);
+               }
+
+               private void Log (Level msgLevel, string str, params string[] vals)
+               {
+                       if ((int) level > (int) msgLevel)
+                               return;
+
+                       logAction (string.Format (str, vals));
+               }
+       }
+}
+
index 3c30921a61e18e2b3d239d3356eefda34260099f..884bea5a114ff7b5c0f82e9ff1f912cd0d0bce52 100644 (file)
@@ -15,44 +15,66 @@ LIB_PATH = $(topdir)/class/lib/$(PROFILE)
 
 MONO = MONO_PATH="$(LIB_PATH)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) -O=-inline
 
-OUT_DIR = Test/out
+MSYM_DIR = $(OUT_DIR)/msymdir
 TEST_CS = Test/StackTraceDumper.cs
 TEST_EXE = $(OUT_DIR)/StackTraceDumper.exe
-RELEASE_FILE = $(OUT_DIR)/release.out
-SYMBOLICATE_FILE = $(OUT_DIR)/symbolicate.out
+STACKTRACE_FILE = $(OUT_DIR)/stacktrace.out
+SYMBOLICATE_RAW_FILE = $(OUT_DIR)/symbolicate_raw.out
+SYMBOLICATE_RESULT_FILE = $(OUT_DIR)/symbolicate.result
 SYMBOLICATE_EXPECTED_FILE = Test/symbolicate.expected
 
 CHECK_DIFF = @\
-       MONO_DEBUG=gen-compact-seq-points $(MONO) $(TEST_EXE) > $(RELEASE_FILE); \
-       $(MONO) $(LIB_PATH)/$(PROGRAM) $(TEST_EXE) $(RELEASE_FILE) | sed "s/).*Test\//) in /" > $(SYMBOLICATE_FILE); \
-       DIFF=$$(diff $(SYMBOLICATE_FILE) $(SYMBOLICATE_EXPECTED_FILE)); \
+       $(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); \
+       DIFF=$$(diff -up $(SYMBOLICATE_EXPECTED_FILE) $(SYMBOLICATE_RESULT_FILE)); \
        if [ ! -z "$$DIFF" ]; then \
                echo "Symbolicate tests failed."; \
-               echo "If $(SYMBOLICATE_FILE) is correct copy it to $(SYMBOLICATE_EXPECTED_FILE)."; \
+               echo "If $(SYMBOLICATE_RESULT_FILE) is correct copy it to $(SYMBOLICATE_EXPECTED_FILE)."; \
                echo "Otherwise runtime sequence points need to be fixed."; \
                echo "$$DIFF"; \
                exit 1; \
        fi
 
-BUILD_TEST_EXE = \
+PREPARE_OUTDIR = @\
        rm -rf $(OUT_DIR); \
        mkdir -p $(OUT_DIR); \
-       $(CSCOMPILE) $(TEST_CS) -out:$(TEST_EXE)
+       mkdir -p $(MSYM_DIR);
+
+COMPILE = \
+       $(CSCOMPILE) $(TEST_CS) -out:$(TEST_EXE); \
+       $(MONO) $(LIB_PATH)/$(PROGRAM) store-symbols $(MSYM_DIR) $(OUT_DIR); \
+       $(MONO) $(LIB_PATH)/$(PROGRAM) store-symbols $(MSYM_DIR) $(LIB_PATH);
 
 check: test-local
 
 AOT_SUPPORTED = $(shell $(MONO) --aot 2>&1 | grep -q "AOT compilation is not supported" && echo 0 || echo 1)
 
-test-local: all
-       $(BUILD_TEST_EXE)
-       @echo "Checking $(TEST_EXE) without AOT"
+test-local: test-without-aot test-with-aot test-with-aot-msym
+
+test-without-aot: OUT_DIR = Test/without_aot
+test-without-aot: all
+       @echo "Checking $(TEST_EXE) without AOT in $(OUT_DIR)"
+       $(PREPARE_OUTDIR)
+       $(COMPILE)
        $(CHECK_DIFF)
+
+test-with-aot: OUT_DIR = Test/with_aot
+test-with-aot: all
 ifeq ($(AOT_SUPPORTED), 1)
-       @echo "Checking $(TEST_EXE) with AOT"
-       @MONO_DEBUG=gen-compact-seq-points $(MONO) --aot $(TEST_EXE) > /dev/null
+       @echo "Checking $(TEST_EXE) with AOT in $(OUT_DIR)"
+       $(PREPARE_OUTDIR)
+       $(COMPILE)
+       @$(MONO) --aot $(TEST_EXE) > /dev/null
        $(CHECK_DIFF)
-       @echo "Checking $(TEST_EXE) with AOT (using .msym)"
-       $(BUILD_TEST_EXE)
-       @MONO_DEBUG=gen-compact-seq-points $(MONO) --aot=gen-seq-points-file $(TEST_EXE) > /dev/null
+endif
+
+test-with-aot-msym: OUT_DIR = Test/with_aot_msym
+test-with-aot-msym: all
+ifeq ($(AOT_SUPPORTED), 1)
+       @echo "Checking $(TEST_EXE) with AOT (using .msym) in $(OUT_DIR)"
+       $(PREPARE_OUTDIR)
+       $(COMPILE)
+       @$(MONO) --aot=msym-dir=$(MSYM_DIR) $(TEST_EXE) > /dev/null
        $(CHECK_DIFF)
 endif
diff --git a/mcs/tools/mono-symbolicate/README b/mcs/tools/mono-symbolicate/README
deleted file mode 100644 (file)
index 8dfcc9a..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-Mono Symbolicate Tool - README
-
-Usage
------------------------------
-
-mono-symbolicate exefile stacktracesfile [directories...]
-
-Description
------------------------------
-
-mono-symbolicate is a tool that converts a stack trace with `<filename unknown>:0`
-into one with file names and line numbers.
-
-The output of calling this tool will be the provided stacktracesfile where
-`<filename unknown>:0` parts are replaced by a file name and a line number.
-
-For the tool to work it needs to load referenced assemblies, it will first look
-in the same folder as exefile then from one of the provided directories.
-
-The tool assumes that the folder with a referenced assembly called for example
-name.dll will also include name.dll.mdb, if the referenced assembly is AOT
-compiled then the tool is also expecting to find name.dll.msym.
\ No newline at end of file
diff --git a/mcs/tools/mono-symbolicate/README.md b/mcs/tools/mono-symbolicate/README.md
new file mode 100644 (file)
index 0000000..65988ad
--- /dev/null
@@ -0,0 +1,92 @@
+Mono Symbolicate Tool - README
+
+Usage
+-----------------------------
+
+```
+mono-symbolicate <msym dir> <input file>
+mono-symbolicate store-symbols <msym dir> [<dir>]+
+```
+
+Description
+-----------------------------
+
+`mono-symbolicate` is a tool that converts a stack trace with `<filename unknown>:0`
+into one with file names and line numbers.
+
+The output of calling this tool will be the provided stacktracesfile where
+`<filename unknown>:0` parts are replaced by a file name and a line number.
+
+The tool uses the AOTID and MVID metadata contained at the end of the stacktraces,
+to retrieve the symbols mapping code into line numbers from a provided symbol directory.
+
+When `mono-symbolicate` is called with a symbol directory and a file containing a stacktrace:
+``` mono-symbolicate <msym dir> <input file> ```
+The tool writes into stdout the file contents while adding file location to stack frames when
+it is possible to symbolicate with the symbols available on the symbol directory.
+
+## Symbol directory
+The symbol directory contains subfolder named as a MVID or AOTID.
+ - MVID subfolders contain .dll/.exe and .mdb files.
+ - AOTID subfolder contain .msym files.
+
+Managed assemblies can be added by calling `mono-symbolicate` with the command `store-symbols`:
+```
+mono-symbolicate store-symbols <msym dir> [<dir>]+
+```
+
+.msym are generated and stored automatically in an AOTID subfolder at the same time the assembly
+is compiled ahead of time, by running a command such as:
+```
+mono --aot=msym-dir=<msym dir>
+```
+
+## Practical example
+
+If you do not have `mono-symbolicate` installed on your system you can set it to the built one by doing:
+```
+alias mono="MONO_PATH=../../class/lib/net_4_x ../../../runtime/mono-wrapper"
+alias mono-symbolicate="mono ../../class/lib/net_4_x/mono-symbolicate.exe"
+```
+
+For the example we will use the csharp file `Test/StackTraceDumper.cs` which contains a program that
+outputs a larger number of stacktraces.
+
+The first step is to compile our program with debug data.
+```
+mkdir example
+mcs -debug -out:example/Program.exe Test/StackTraceDumper.cs
+```
+
+Next we need to create the symbol directory and store all the symbols we might need while symbolicating.
+```
+mkdir example/msym-dir
+mono-symbolicate store-symbols example/msym-dir example
+```
+
+After running `mono-symbolicate store-symbols` command the directory `example/msym-dir` should have a subdirectory
+named as a minified GUID containing the Program.exe and Program.mdb.
+
+If we want to symbolicate the stacktraces containing BCL stack frames we need to add those symbols too.
+```
+mono-symbolicate store-symbols example/msym-dir ../../class/lib/net_4_x
+```
+
+We delete the mdb file so on our next step the generated stack trace won't have line numbers.
+```
+rm example/*.mdb
+```
+
+Now we can run our program and dump its output to `example/out`.
+```
+mono example/Program.exe > example/out
+```
+
+Doing `cat example/out` shows us a large number of stacktraces without any line number.
+
+We can finally run `mono-symbolicate` to replace all the `<filename unknown>:0` with actually useful file names and line numbers.
+```
+mono-symbolicate example/msym-dir example/out
+```
+The previous command should display the same as `cat example/out` but this time with file names and line numbers.
+
index 606e4fb3f171c7eb6d4626008f24320ad9131ee1..22a3dae62fb043c49e03530147bd8a8d0846789c 100644 (file)
@@ -2,7 +2,7 @@ using System;
 using System.IO;
 using System.Collections.Generic;
 
-namespace Symbolicate
+namespace Mono
 {
        static class BinaryReaderExtensions
        {
diff --git a/mcs/tools/mono-symbolicate/StackFrameData.cs b/mcs/tools/mono-symbolicate/StackFrameData.cs
new file mode 100644 (file)
index 0000000..0177fcd
--- /dev/null
@@ -0,0 +1,105 @@
+using System;
+using System.Text.RegularExpressions;
+using System.Globalization;
+
+namespace Mono
+{
+       class StackFrameData
+       {
+               static Regex regex = new Regex (@"\w*at (?<Method>.+) *(\[0x(?<IL>.+)\]|<0x.+ \+ 0x(?<NativeOffset>.+)>( (?<MethodIndex>\d+)|)) in <(?<MVID>[^>#]+)(#(?<AOTID>[^>]+)|)>:0");
+
+               public readonly string TypeFullName;
+               public readonly string MethodSignature;
+               public readonly int Offset;
+               public readonly bool IsILOffset;
+               public readonly uint MethodIndex;
+               public readonly string Line;
+               public readonly string Mvid;
+               public readonly string Aotid;
+
+               public string File { get; private set; }
+               public int LineNumber { get; private set; }
+
+               private StackFrameData (string line, string typeFullName, string methodSig, int offset, bool isILOffset, uint methodIndex, string mvid, string aotid)
+               {
+                       LineNumber = -1;
+
+                       Line = line;
+                       TypeFullName = typeFullName;
+                       MethodSignature = methodSig;
+                       Offset = offset;
+                       IsILOffset = isILOffset;
+                       MethodIndex = methodIndex;
+                       Mvid = mvid;
+                       Aotid = aotid;
+               }
+
+               public static bool TryParse (string line, out StackFrameData stackFrame)
+               {
+                       stackFrame = null;
+
+                       var match = regex.Match (line);
+                       if (!match.Success)
+                               return false;
+
+                       string typeFullName, methodSignature;
+                       var methodStr = match.Groups ["Method"].Value.Trim ();
+                       if (!ExtractSignatures (methodStr, out typeFullName, out methodSignature))
+                               return false;
+
+                       var isILOffset = !string.IsNullOrEmpty (match.Groups ["IL"].Value);
+                       var offsetVarName = (isILOffset)? "IL" : "NativeOffset";
+                       var offset = int.Parse (match.Groups [offsetVarName].Value, NumberStyles.HexNumber, CultureInfo.InvariantCulture);
+
+                       uint methodIndex = 0xffffff;
+                       if (!string.IsNullOrEmpty (match.Groups ["MethodIndex"].Value))
+                               methodIndex = uint.Parse (match.Groups ["MethodIndex"].Value, CultureInfo.InvariantCulture);
+
+                       var mvid = match.Groups ["MVID"].Value;
+                       var aotid = match.Groups ["AOTID"].Value;
+
+                       stackFrame = new StackFrameData (line, typeFullName, methodSignature, offset, isILOffset, methodIndex, mvid, aotid);
+
+                       return true;
+               }
+
+               static bool ExtractSignatures (string str, out string typeFullName, out string methodSignature)
+               {
+                       var methodNameEnd = str.IndexOf ('(');
+                       if (methodNameEnd == -1) {
+                               typeFullName = methodSignature = null;
+                               return false;
+                       }
+
+                       var typeNameEnd = str.LastIndexOf ('.', methodNameEnd);
+                       if (typeNameEnd == -1) {
+                               typeFullName = methodSignature = null;
+                               return false;
+                       }
+
+                       // Adjustment for Type..ctor ()
+                       if (typeNameEnd > 0 && str [typeNameEnd - 1] == '.') {
+                               --typeNameEnd;
+                       }
+
+                       typeFullName = str.Substring (0, typeNameEnd);
+                       // Remove generic parameters
+                       typeFullName = Regex.Replace (typeFullName, @"\[[^\[\]]*\]", "");
+
+                       methodSignature = str.Substring (typeNameEnd + 1);
+
+                       return true;
+               }
+
+               internal void SetLocation (string file, int lineNumber)
+               {
+                       File = file;
+                       LineNumber = lineNumber;
+               }
+
+               public override string ToString ()
+               {
+                       return string.Format ("{0} in {1}:{2} ", Line.Substring (0, Line.IndexOf(" in <", StringComparison.Ordinal)), File, LineNumber);
+               }
+       }
+}
diff --git a/mcs/tools/mono-symbolicate/SymbolManager.cs b/mcs/tools/mono-symbolicate/SymbolManager.cs
new file mode 100644 (file)
index 0000000..734aa3a
--- /dev/null
@@ -0,0 +1,131 @@
+using System;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Collections.Generic;
+using Mono.Cecil;
+using Mono.Cecil.Cil;
+using Mono.Collections.Generic;
+
+namespace Mono
+{
+       public class SymbolManager
+       {
+               string msymDir;
+               Logger logger;
+
+               public SymbolManager (string msymDir, Logger logger) {
+                       this.msymDir = msymDir;
+                       this.logger = logger;
+               }
+
+               internal bool TryResolveLocation (StackFrameData sfData)
+               {
+                       if (sfData.Mvid == null)
+                               return false;
+
+                       var assemblyLocProvider = GetOrCreateAssemblyLocationProvider (sfData.Mvid);
+                       if (assemblyLocProvider == null)
+                               return false;
+
+                       SeqPointInfo seqPointInfo = null;
+                       if (!sfData.IsILOffset && sfData.Aotid != null)
+                               seqPointInfo = GetOrCreateSeqPointInfo (sfData.Aotid);
+
+                       return assemblyLocProvider.TryResolveLocation (sfData, seqPointInfo);
+               }
+
+               Dictionary<string, AssemblyLocationProvider> assemblies = new Dictionary<string, AssemblyLocationProvider> ();
+
+               private AssemblyLocationProvider GetOrCreateAssemblyLocationProvider (string mvid)
+               {
+                       if (assemblies.ContainsKey (mvid))
+                               return assemblies[mvid];
+
+                       var mvidDir = Path.Combine (msymDir, mvid);
+                       if (!Directory.Exists (mvidDir)) {
+                               logger.LogWarning ("MVID directory does not exist: {0}", mvidDir);
+                               return  null;
+                       }
+
+                       string assemblyPath = null;
+                       var exeFiles = Directory.GetFiles (mvidDir, "*.exe");
+                       var dllFiles = Directory.GetFiles (mvidDir, "*.dll");
+
+                       if (exeFiles.Length + dllFiles.Length != 1) {
+                               logger.LogError ("MVID directory should include one assembly: {0}", mvidDir);
+                               return null;
+                       }
+
+                       assemblyPath = (exeFiles.Length > 0)? exeFiles[0] : dllFiles[0];
+
+                       var locProvider = new AssemblyLocationProvider (assemblyPath, logger);
+
+                       assemblies.Add (mvid, locProvider);
+
+                       return locProvider;
+               }
+
+               Dictionary<string, SeqPointInfo> seqPointInfos = new Dictionary<string, SeqPointInfo> ();
+
+               private SeqPointInfo GetOrCreateSeqPointInfo (string aotid)
+               {
+                       if (seqPointInfos.ContainsKey (aotid))
+                               return seqPointInfos[aotid];
+
+                       var aotidDir = Path.Combine (msymDir, aotid);
+                       if (!Directory.Exists (aotidDir)) {
+                               logger.LogError ("AOTID directory does not exist: {0}", aotidDir);
+                               return null;
+                       }
+
+                       string msymFile = null;
+                       var msymFiles = Directory.GetFiles(aotidDir, "*.msym");
+                       msymFile = msymFiles[0];
+
+                       var seqPointInfo = SeqPointInfo.Read (msymFile);
+
+                       seqPointInfos.Add (aotid, seqPointInfo);
+
+                       return seqPointInfo;
+               }
+
+               public void StoreSymbols (params string[] lookupDirs)
+               {
+                       foreach (var dir in lookupDirs) {
+                               var exeFiles = Directory.GetFiles (dir, "*.exe");
+                               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
+                                               continue;
+                                       }
+
+                                       var assembly = AssemblyDefinition.ReadAssembly (assemblyPath);
+
+                                       var mvid = assembly.MainModule.Mvid.ToString ("N");
+                                       var mvidDir = Path.Combine (msymDir, mvid);
+
+                                       if (Directory.Exists (mvidDir)) {
+                                               try {
+                                                       Directory.Delete (mvidDir, true);
+                                               } catch (DirectoryNotFoundException e) {}
+                                       }
+
+                                       Directory.CreateDirectory (mvidDir);
+
+                                       var mvidAssemblyPath = Path.Combine (mvidDir, Path.GetFileName (assemblyPath));
+                                       File.Copy (assemblyPath, mvidAssemblyPath);
+
+                                       var mvidMdbPath = Path.Combine (mvidDir, Path.GetFileName (mdbPath));
+                                       File.Copy (mdbPath, mvidMdbPath);
+
+                                       // TODO create MVID dir for non main modules with links to main module MVID
+                               }
+                       }
+               }
+       }
+}
index 78e2db9a8986eea92339c3eb772d778dfcd5a1cf..726997d21345d6c3b16ca9f8caf5353eb77e7429 100644 (file)
@@ -46,6 +46,11 @@ class StackTraceDumper {
                Catch (() => InnerGenericClass<string>.InnerInnerGenericClass<int>.ThrowException ("Stack trace with 2 inner generic class and generic overload"));
 
                Catch (() => InnerGenericClass<int>.InnerInnerGenericClass<string>.ThrowException ("Stack trace with 2 inner generic class and generic overload"));
+
+               Catch (() => {
+                       var d = new Dictionary<string, string> ();
+                       d.ContainsKey (null); // ArgumentNullException
+               });
        }
 
        public static void Catch (Action action)
index a3cd72acd0ef271381ede360b4d50799ca61c8fb..b93d05c7a1392a55cac1e4a1e60a5e18bc364326 100644 (file)
 System.Exception: Stacktrace with 1 frame
-  at StackTraceDumper.Main () in StackTraceDumper.cs:9 
+  at StackTraceDumper.Main () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:9 
 Stacktrace:
-  at StackTraceDumper.Main () in StackTraceDumper.cs:9 
+  at StackTraceDumper.Main () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:9 
 
 System.Exception: Stacktrace with 2 frames
-  at StackTraceDumper.<Main>m__0 () in StackTraceDumper.cs:16 
-  at StackTraceDumper.Catch (System.Action action) in StackTraceDumper.cs:54 
+  at StackTraceDumper.<Main>m__0 () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:16 
+  at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 
 Stacktrace:
-  at StackTraceDumper.<Main>m__0 () in StackTraceDumper.cs:16 
-  at StackTraceDumper.Catch (System.Action action) in StackTraceDumper.cs:54 
+  at StackTraceDumper.<Main>m__0 () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:16 
+  at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 
 
 System.Exception: Stacktrace with 3 frames
-  at StackTraceDumper.ThrowException (System.String message, System.Int32 i) in StackTraceDumper.cs:78 
-  at StackTraceDumper.<Main>m__1 () in StackTraceDumper.cs:18 
-  at StackTraceDumper.Catch (System.Action action) in StackTraceDumper.cs:54 
+  at StackTraceDumper.ThrowException (System.String message, System.Int32 i) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:83 
+  at StackTraceDumper.<Main>m__1 () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:18 
+  at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 
 Stacktrace:
-  at StackTraceDumper.ThrowException (System.String message, System.Int32 i) in StackTraceDumper.cs:78 
-  at StackTraceDumper.<Main>m__1 () in StackTraceDumper.cs:18 
-  at StackTraceDumper.Catch (System.Action action) in StackTraceDumper.cs:54 
+  at StackTraceDumper.ThrowException (System.String message, System.Int32 i) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:83 
+  at StackTraceDumper.<Main>m__1 () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:18 
+  at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 
 
 System.Exception: Stacktrace with 4 frames
-  at StackTraceDumper.ThrowException (System.String message, System.Int32 i) in StackTraceDumper.cs:78 
-  at StackTraceDumper.ThrowException (System.String message, System.Int32 i) in StackTraceDumper.cs:76 
-  at StackTraceDumper.<Main>m__2 () in StackTraceDumper.cs:20 
-  at StackTraceDumper.Catch (System.Action action) in StackTraceDumper.cs:54 
-Stacktrace:
-  at StackTraceDumper.ThrowException (System.String message, System.Int32 i) in StackTraceDumper.cs:78 
-  at StackTraceDumper.ThrowException (System.String message, System.Int32 i) in StackTraceDumper.cs:76 
-  at StackTraceDumper.<Main>m__2 () in StackTraceDumper.cs:20 
-  at StackTraceDumper.Catch (System.Action action) in StackTraceDumper.cs:54 
+  at StackTraceDumper.ThrowException (System.String message, System.Int32 i) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:83 
+  at StackTraceDumper.ThrowException (System.String message, System.Int32 i) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:81 
+  at StackTraceDumper.<Main>m__2 () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:20 
+  at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 
+Stacktrace:
+  at StackTraceDumper.ThrowException (System.String message, System.Int32 i) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:83 
+  at StackTraceDumper.ThrowException (System.String message, System.Int32 i) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:81 
+  at StackTraceDumper.<Main>m__2 () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:20 
+  at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 
 
 System.Exception: Stack frame with method overload using ref parameter
-  at StackTraceDumper.ThrowException (System.String& message) in StackTraceDumper.cs:70 
-  at StackTraceDumper.<Main>m__3 () in StackTraceDumper.cs:24 
-  at StackTraceDumper.Catch (System.Action action) in StackTraceDumper.cs:54 
+  at StackTraceDumper.ThrowException (System.String& message) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:75 
+  at StackTraceDumper.<Main>m__3 () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:24 
+  at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 
 Stacktrace:
-  at StackTraceDumper.ThrowException (System.String& message) in StackTraceDumper.cs:70 
-  at StackTraceDumper.<Main>m__3 () in StackTraceDumper.cs:24 
-  at StackTraceDumper.Catch (System.Action action) in StackTraceDumper.cs:54 
+  at StackTraceDumper.ThrowException (System.String& message) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:75 
+  at StackTraceDumper.<Main>m__3 () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:24 
+  at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 
 
 System.Exception: Stack frame with method overload using out parameter
-  at StackTraceDumper.ThrowException (System.String message, System.Int32& o) in StackTraceDumper.cs:83 
-  at StackTraceDumper.<Main>m__4 () in StackTraceDumper.cs:29 
-  at StackTraceDumper.Catch (System.Action action) in StackTraceDumper.cs:54 
+  at StackTraceDumper.ThrowException (System.String message, System.Int32& o) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:88 
+  at StackTraceDumper.<Main>m__4 () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:29 
+  at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 
 Stacktrace:
-  at StackTraceDumper.ThrowException (System.String message, System.Int32& o) in StackTraceDumper.cs:83 
-  at StackTraceDumper.<Main>m__4 () in StackTraceDumper.cs:29 
-  at StackTraceDumper.Catch (System.Action action) in StackTraceDumper.cs:54 
+  at StackTraceDumper.ThrowException (System.String message, System.Int32& o) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:88 
+  at StackTraceDumper.<Main>m__4 () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:29 
+  at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 
 
 System.Exception: Stack frame with 1 generic parameter
-  at StackTraceDumper.ThrowExceptionGeneric[T] (System.String message) in StackTraceDumper.cs:88 
-  at StackTraceDumper.<Main>m__5 () in StackTraceDumper.cs:32 
-  at StackTraceDumper.Catch (System.Action action) in StackTraceDumper.cs:54 
+  at StackTraceDumper.ThrowExceptionGeneric[T] (System.String message) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:93 
+  at StackTraceDumper.<Main>m__5 () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:32 
+  at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 
 Stacktrace:
-  at StackTraceDumper.ThrowExceptionGeneric[T] (System.String message) in StackTraceDumper.cs:88 
-  at StackTraceDumper.<Main>m__5 () in StackTraceDumper.cs:32 
-  at StackTraceDumper.Catch (System.Action action) in StackTraceDumper.cs:54 
+  at StackTraceDumper.ThrowExceptionGeneric[T] (System.String message) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:93 
+  at StackTraceDumper.<Main>m__5 () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:32 
+  at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 
 
 System.Exception: Stack frame with 2 generic parameters
-  at StackTraceDumper.ThrowExceptionGeneric[T1,T2] (System.String message) in StackTraceDumper.cs:108 
-  at StackTraceDumper.<Main>m__6 () in StackTraceDumper.cs:34 
-  at StackTraceDumper.Catch (System.Action action) in StackTraceDumper.cs:54 
+  at StackTraceDumper.ThrowExceptionGeneric[T1,T2] (System.String message) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:113 
+  at StackTraceDumper.<Main>m__6 () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:34 
+  at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 
 Stacktrace:
-  at StackTraceDumper.ThrowExceptionGeneric[T1,T2] (System.String message) in StackTraceDumper.cs:108 
-  at StackTraceDumper.<Main>m__6 () in StackTraceDumper.cs:34 
-  at StackTraceDumper.Catch (System.Action action) in StackTraceDumper.cs:54 
+  at StackTraceDumper.ThrowExceptionGeneric[T1,T2] (System.String message) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:113 
+  at StackTraceDumper.<Main>m__6 () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:34 
+  at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 
 
 System.Exception: Stack frame with generic method overload
-  at StackTraceDumper.ThrowExceptionGeneric[T] (T a1) in StackTraceDumper.cs:93 
-  at StackTraceDumper.<Main>m__7 () in StackTraceDumper.cs:36 
-  at StackTraceDumper.Catch (System.Action action) in StackTraceDumper.cs:54 
+  at StackTraceDumper.ThrowExceptionGeneric[T] (T a1) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:98 
+  at StackTraceDumper.<Main>m__7 () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:36 
+  at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 
 Stacktrace:
-  at StackTraceDumper.ThrowExceptionGeneric[T] (T a1) in StackTraceDumper.cs:93 
-  at StackTraceDumper.<Main>m__7 () in StackTraceDumper.cs:36 
-  at StackTraceDumper.Catch (System.Action action) in StackTraceDumper.cs:54 
+  at StackTraceDumper.ThrowExceptionGeneric[T] (T a1) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:98 
+  at StackTraceDumper.<Main>m__7 () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:36 
+  at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 
 
 System.Exception: Stack trace with inner class
-  at StackTraceDumper+InnerClass.ThrowException (System.String message) in StackTraceDumper.cs:114 
-  at StackTraceDumper.<Main>m__8 () in StackTraceDumper.cs:38 
-  at StackTraceDumper.Catch (System.Action action) in StackTraceDumper.cs:54 
+  at StackTraceDumper+InnerClass.ThrowException (System.String message) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:119 
+  at StackTraceDumper.<Main>m__8 () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:38 
+  at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 
 Stacktrace:
-  at StackTraceDumper+InnerClass.ThrowException (System.String message) in StackTraceDumper.cs:114 
-  at StackTraceDumper.<Main>m__8 () in StackTraceDumper.cs:38 
-  at StackTraceDumper.Catch (System.Action action) in StackTraceDumper.cs:54 
+  at StackTraceDumper+InnerClass.ThrowException (System.String message) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:119 
+  at StackTraceDumper.<Main>m__8 () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:38 
+  at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 
 
 System.Exception: Stack trace with inner generic class
-  at StackTraceDumper+InnerGenericClass`1[T].ThrowException (System.String message) in StackTraceDumper.cs:121 
-  at StackTraceDumper.<Main>m__9 () in StackTraceDumper.cs:40 
-  at StackTraceDumper.Catch (System.Action action) in StackTraceDumper.cs:54 
+  at StackTraceDumper+InnerGenericClass`1[T].ThrowException (System.String message) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:126 
+  at StackTraceDumper.<Main>m__9 () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:40 
+  at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 
 Stacktrace:
-  at StackTraceDumper+InnerGenericClass`1[T].ThrowException (System.String message) in StackTraceDumper.cs:121 
-  at StackTraceDumper.<Main>m__9 () in StackTraceDumper.cs:40 
-  at StackTraceDumper.Catch (System.Action action) in StackTraceDumper.cs:54 
+  at StackTraceDumper+InnerGenericClass`1[T].ThrowException (System.String message) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:126 
+  at StackTraceDumper.<Main>m__9 () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:40 
+  at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 
 Generic to string:string
 
 System.Exception: Stack trace with inner generic class and method generic parameter
-  at StackTraceDumper+InnerGenericClass`1[T].ThrowException (System.String message, T arg) in StackTraceDumper.cs:127 
-  at StackTraceDumper.<Main>m__A () in StackTraceDumper.cs:42 
-  at StackTraceDumper.Catch (System.Action action) in StackTraceDumper.cs:54 
+  at StackTraceDumper+InnerGenericClass`1[T].ThrowException (System.String message, T arg) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:132 
+  at StackTraceDumper.<Main>m__A () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:42 
+  at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 
 Stacktrace:
-  at StackTraceDumper+InnerGenericClass`1[T].ThrowException (System.String message, T arg) in StackTraceDumper.cs:127 
-  at StackTraceDumper.<Main>m__A () in StackTraceDumper.cs:42 
-  at StackTraceDumper.Catch (System.Action action) in StackTraceDumper.cs:54 
+  at StackTraceDumper+InnerGenericClass`1[T].ThrowException (System.String message, T arg) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:132 
+  at StackTraceDumper.<Main>m__A () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:42 
+  at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 
 
 System.Exception: Stack trace with inner generic class and generic overload
-  at StackTraceDumper+InnerGenericClass`1[T].ThrowException[T1] (System.String message, T1 arg) in StackTraceDumper.cs:132 
-  at StackTraceDumper.<Main>m__B () in StackTraceDumper.cs:44 
-  at StackTraceDumper.Catch (System.Action action) in StackTraceDumper.cs:54 
+  at StackTraceDumper+InnerGenericClass`1[T].ThrowException[T1] (System.String message, T1 arg) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:137 
+  at StackTraceDumper.<Main>m__B () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:44 
+  at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 
 Stacktrace:
-  at StackTraceDumper+InnerGenericClass`1[T].ThrowException[T1] (System.String message, T1 arg) in StackTraceDumper.cs:132 
-  at StackTraceDumper.<Main>m__B () in StackTraceDumper.cs:44 
-  at StackTraceDumper.Catch (System.Action action) in StackTraceDumper.cs:54 
+  at StackTraceDumper+InnerGenericClass`1[T].ThrowException[T1] (System.String message, T1 arg) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:137 
+  at StackTraceDumper.<Main>m__B () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:44 
+  at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 
 
 System.Exception: Stack trace with 2 inner generic class and generic overload
-  at StackTraceDumper+InnerGenericClass`1+InnerInnerGenericClass`1[T,T2].ThrowException (T message) in StackTraceDumper.cs:138 
-  at StackTraceDumper.<Main>m__C () in StackTraceDumper.cs:46 
-  at StackTraceDumper.Catch (System.Action action) in StackTraceDumper.cs:54 
+  at StackTraceDumper+InnerGenericClass`1+InnerInnerGenericClass`1[T,T2].ThrowException (T message) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:143 
+  at StackTraceDumper.<Main>m__C () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:46 
+  at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 
 Stacktrace:
-  at StackTraceDumper+InnerGenericClass`1+InnerInnerGenericClass`1[T,T2].ThrowException (T message) in StackTraceDumper.cs:138 
-  at StackTraceDumper.<Main>m__C () in StackTraceDumper.cs:46 
-  at StackTraceDumper.Catch (System.Action action) in StackTraceDumper.cs:54 
+  at StackTraceDumper+InnerGenericClass`1+InnerInnerGenericClass`1[T,T2].ThrowException (T message) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:143 
+  at StackTraceDumper.<Main>m__C () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:46 
+  at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 
 
 System.Exception: Stack trace with 2 inner generic class and generic overload
-  at StackTraceDumper+InnerGenericClass`1+InnerInnerGenericClass`1[T,T2].ThrowException (T2 message) in StackTraceDumper.cs:143 
-  at StackTraceDumper.<Main>m__D () in StackTraceDumper.cs:48 
-  at StackTraceDumper.Catch (System.Action action) in StackTraceDumper.cs:54 
+  at StackTraceDumper+InnerGenericClass`1+InnerInnerGenericClass`1[T,T2].ThrowException (T2 message) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:148 
+  at StackTraceDumper.<Main>m__D () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:48 
+  at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 
+Stacktrace:
+  at StackTraceDumper+InnerGenericClass`1+InnerInnerGenericClass`1[T,T2].ThrowException (T2 message) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:148 
+  at StackTraceDumper.<Main>m__D () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:48 
+  at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 
+
+System.ArgumentNullException: Value cannot be null.
+Parameter name: key
+  at System.ThrowHelper.ThrowArgumentNullException (System.ExceptionArgument argument) in mcs/class/referencesource/mscorlib/system/throwhelper.cs:80 
+  at System.Collections.Generic.Dictionary`2[TKey,TValue].FindEntry (TKey key) in mcs/class/referencesource/mscorlib/system/collections/generic/dictionary.cs:299 
+  at System.Collections.Generic.Dictionary`2[TKey,TValue].ContainsKey (TKey key) in mcs/class/referencesource/mscorlib/system/collections/generic/dictionary.cs:228 
+  at StackTraceDumper.<Main>m__E () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:52 
+  at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 
 Stacktrace:
-  at StackTraceDumper+InnerGenericClass`1+InnerInnerGenericClass`1[T,T2].ThrowException (T2 message) in StackTraceDumper.cs:143 
-  at StackTraceDumper.<Main>m__D () in StackTraceDumper.cs:48 
-  at StackTraceDumper.Catch (System.Action action) in StackTraceDumper.cs:54 
+  at System.ThrowHelper.ThrowArgumentNullException (System.ExceptionArgument argument) in mcs/class/referencesource/mscorlib/system/throwhelper.cs:80 
+  at System.Collections.Generic.Dictionary`2[TKey,TValue].FindEntry (TKey key) in mcs/class/referencesource/mscorlib/system/collections/generic/dictionary.cs:299 
+  at System.Collections.Generic.Dictionary`2[TKey,TValue].ContainsKey (TKey key) in mcs/class/referencesource/mscorlib/system/collections/generic/dictionary.cs:228 
+  at StackTraceDumper.<Main>m__E () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:52 
+  at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 
index 5c4437ba56945b09750b3dbe362a8b1441ccd1bc..6cb8042e9c528e3bbcb3dd6b6710452a9dce37df 100644 (file)
@@ -1,3 +1,7 @@
 symbolicate.cs
 LocationProvider.cs
 SeqPointInfo.cs
+StackFrameData.cs
+SymbolManager.cs
+Logger.cs
+../../class/Mono.Options/Mono.Options/Options.cs
index 023e1813f91a1cf50fe86c299e4225b743c4d198..dcf29b0f693c1b319df59b4d8b0549003bae1251 100644 (file)
     <Compile Include="LocationProvider.cs" />\r
     <Compile Include="SeqPointInfo.cs" />\r
     <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
+    </Compile>\r
   </ItemGroup>\r
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />\r
 </Project>
\ No newline at end of file
index cb7aa9a46cd38ffc30d16ba877d0c7a10d20f3c7..2c04a27eef04e84b37cd51a2b4b9b78a83be4358 100644 (file)
 using System;
 using System.IO;
+using System.Text;
+using System.Linq;
+using System.Collections.Generic;
 using System.Globalization;
-using System.Text.RegularExpressions;
+using Mono.Options;
 
-namespace Symbolicate
+namespace Mono
 {
-       public class Program
+       public class Symbolicate
        {
-               static Regex regex = new Regex (@"\w*at (?<Method>.+) *(\[0x(?<IL>.+)\]|<0x.+ \+ 0x(?<NativeOffset>.+)>( (?<MethodIndex>\d+)|)) in <filename unknown>:0");
+               class Command {
+                       public readonly int MinArgCount;
+                       public readonly int MaxArgCount;
+                       public readonly Action<List<string>> Action;
+
+                       public Command (Action<List<string>> action, int minArgCount = 0, int maxArgCount = int.MaxValue)
+                       {
+                               Action = action;
+                               MinArgCount = minArgCount;
+                               MaxArgCount = maxArgCount;
+                       }
+               }
+
+               static Logger logger;
 
                public static int Main (String[] args)
                {
-                       if (args.Length < 2) {
-                               Console.Error.WriteLine ("Usage: symbolicate <assembly path> <input file> [lookup directories]");
-                               return 1;
-                       }
-
-                       var assemblyPath = args [0];
-                       var inputFile = args [1];
+                       var showHelp = false;
+                       List<string> extra = null;
 
-                       var locProvider = new LocationProvider ();
+                       Command cmd = null;
 
-                       for (var i = 2; i < args.Length; i++)
-                               locProvider.AddDirectory (args [i]);
+                       var logLevel = Logger.Level.Warning;
 
-                       locProvider.AddAssembly (assemblyPath);
+                       var options = new OptionSet {
+                               { "h|help", "Show this help", v => showHelp = true },
+                               { "q", "Quiet, warnings are not displayed", v => logLevel = Logger.Level.Error },
+                               { "v", "Verbose, log debug messages", v => logLevel = Logger.Level.Debug },
+                       };
 
-                       using (StreamReader r = new StreamReader (inputFile)) {
-                           for (var line = r.ReadLine (); line != null; line = r.ReadLine ()) {
-                                       line = SymbolicateLine (line, locProvider);
-                                       Console.WriteLine (line);
-                           }
+                       try {
+                               extra = options.Parse (args);
+                       } catch (OptionException e) {
+                               Console.WriteLine ("Option error: {0}", e.Message);
+                               showHelp = true;
                        }
 
-                       return 0;
-               }
-
-               static string SymbolicateLine (string line, LocationProvider locProvider)
-               {
-                       var match = regex.Match (line);
-                       if (!match.Success)
-                               return line;
+                       if (extra.Count > 0 && extra[0] == "store-symbols")
+                               cmd = new Command (StoreSymbolsAction, 2);
 
-                       string typeFullName, methodSignature;
-                       var methodStr = match.Groups ["Method"].Value.Trim ();
-                       if (!ExtractSignatures (methodStr, out typeFullName, out methodSignature))
-                               return line;
+                       if (cmd != null) {
+                               extra.RemoveAt (0);
+                       } else {
+                               cmd = new Command (SymbolicateAction, 2, 2);
+                       }
 
-                       var isOffsetIL = !string.IsNullOrEmpty (match.Groups ["IL"].Value);
-                       var offsetVarName = (isOffsetIL)? "IL" : "NativeOffset";
-                       var offset = int.Parse (match.Groups [offsetVarName].Value, NumberStyles.HexNumber, CultureInfo.InvariantCulture);
+                       if (showHelp || extra == null || extra.Count < cmd.MinArgCount || extra.Count > cmd.MaxArgCount) {
+                               Console.Error.WriteLine ("Usage: symbolicate [options] <msym dir> <input file>");
+                               Console.Error.WriteLine ("       symbolicate [options] store-symbols <msym dir> [<dir>]+");
+                               Console.WriteLine ();
+                               Console.WriteLine ("Available options:");
+                               options.WriteOptionDescriptions (Console.Out);
+                               return 1;
+                       }
 
-                       uint methodIndex = 0xffffff;
-                       if (!string.IsNullOrEmpty (match.Groups ["MethodIndex"].Value))
-                               methodIndex = uint.Parse (match.Groups ["MethodIndex"].Value, CultureInfo.InvariantCulture);
+                       logger = new Logger (logLevel, msg => Console.Error.WriteLine (msg));
 
-                       var loc = locProvider.TryGetLocation (typeFullName, methodSignature, offset, isOffsetIL, methodIndex);
-                       if (loc == null)
-                               return line;
+                       cmd.Action (extra);
 
-                       return line.Replace ("<filename unknown>:0", string.Format ("{0}:{1}", loc.Document.Url, loc.StartLine));
+                       return 0;
                }
 
-               static bool ExtractSignatures (string str, out string typeFullName, out string methodSignature)
+               private static void SymbolicateAction (List<string> args)
                {
-                       var methodNameEnd = str.IndexOf ('(');
-                       if (methodNameEnd == -1) {
-                               typeFullName = methodSignature = null;
-                               return false;
-                       }
+                       var msymDir = args [0];
+                       var inputFile = args [1];
 
-                       var typeNameEnd = str.LastIndexOf ('.', methodNameEnd);
-                       if (typeNameEnd == -1) {
-                               typeFullName = methodSignature = null;
-                               return false;
-                       }
+                       var symbolManager = new SymbolManager (msymDir, logger);
 
-                       // Adjustment for Type..ctor ()
-                       if (typeNameEnd > 0 && str [typeNameEnd - 1] == '.') {
-                               --typeNameEnd;
+                       using (StreamReader r = new StreamReader (inputFile)) {
+                               for (var line = r.ReadLine (); line != null; line = r.ReadLine ()) {
+                                       StackFrameData sfData;
+                                       if (StackFrameData.TryParse (line, out sfData) &&
+                                               symbolManager.TryResolveLocation (sfData)) {
+                                               Console.WriteLine (sfData.ToString ());
+                                               continue;
+                                       }
+
+                                       Console.WriteLine (line);
+                               }
                        }
+               }
+
+               private static void StoreSymbolsAction (List<string> args)
+               {
+                       var msymDir = args[0];
+                       var lookupDirs = args.Skip (1).ToArray ();
 
-                       typeFullName = str.Substring (0, typeNameEnd);
-                       // Remove generic parameters
-                       typeFullName = Regex.Replace (typeFullName, @"\[[^\[\]]*\]", "");
+                       var symbolManager = new SymbolManager (msymDir, logger);
 
-                       methodSignature = str.Substring (typeNameEnd + 1);
-                       return true;
+                       symbolManager.StoreSymbols (lookupDirs);
                }
        }
-}
\ No newline at end of file
+}
index ee6d7a650513dbf254d4b81be37cec80dcdeb801..fa61acbf97c5d98ef8ee9596cd204aca9ce597ee 100644 (file)
@@ -73,9 +73,12 @@ namespace NUnitLite
         //             Example usage: -exclude:category1,category2 this command can be used
         //             in combination with the -include option also note that exclude takes priority
         //             over all includes
-        public static void Main(string[] args)
+        public static int Main(string[] args)
         {
-            new TextUI().Execute(args);
+            var runner = new TextUI();
+            runner.Execute(args);
+            
+            return (runner.success ? 0 : 1);
         }
     }
 }
index 144702556aa2fb68ecbffdf649779bad3fdd0b92..df553db5abe7470398c3518866735a875abd8bc3 100644 (file)
@@ -86,8 +86,8 @@ namespace Mono.Tuner {
 
                void CheckInterfaces (TypeDefinition type)
                {
-                       foreach (TypeReference iface in type.Interfaces) {
-                               if (!IsVisibleFrom (type, iface)) {
+                       foreach (var iface in type.Interfaces) {
+                               if (!IsVisibleFrom (type, iface.InterfaceType)) {
                                        ReportError ("Interface `{0}` implemented by `{1}` is not visible",
                                                iface, type);
                                }
index d8d9e54bea80a23dea9de398f5ac0acf2b5663bb..2971b11ad5e1cfe66ee9e7f621e75997c7b4b340 100644 (file)
@@ -149,8 +149,8 @@ namespace Mono.Tuner {
                        TypeDefinition baseType = finalType;
                        while (baseType != null) {
                                if (baseType.HasInterfaces)
-                                       foreach (TypeReference @interface in baseType.Interfaces)
-                                               foreach (MethodDefinition method in @interface.Resolve ().Methods)
+                                       foreach (var @interface in baseType.Interfaces)
+                                               foreach (MethodDefinition method in @interface.InterfaceType.Resolve ().Methods)
                                                        if (method.Name == final.Name && HasSameSignature (method, final))
                                                                return method;
 
index 1266c9d31a207864ecebed3d53ec17fff4b38b00..d38aef196c048226f14b6722fc11bc76d1ba886d 100644 (file)
@@ -68,7 +68,7 @@ namespace Mono.Tuner {
                static void RemoveInterface (TypeDefinition type, string name)
                {
                        for (int i = 0; i < type.Interfaces.Count; i++) {
-                               TypeReference iface = type.Interfaces [i];
+                               TypeReference iface = type.Interfaces [i].InterfaceType;
                                if (iface.FullName == name) {
                                        type.Interfaces.RemoveAt (i);
                                        return;
index 70457756436001b8c749fe9c846bd6e0a218c05c..9d6e914532dad6265dc577dd2bbe6c0e176d5895 100644 (file)
@@ -20,18 +20,35 @@ else
 install-local: install-extras
 endif
 
+PORTABLE_TARGETS_SRC=../../../external/buildtools/src/Portable/Targets
+PCL5_FX_SRC=../../../external/buildtools/src/Portable/Frameworks/v5.0
+
 NETFRAMEWORK_DIR=$(mono_libdir)/mono/xbuild-frameworks/.NETFramework
+PCL5_FX_DIR=$(mono_libdir)/mono/xbuild-frameworks/.NETPortable/v5.0
 VS_TARGETS_DIR = $(mono_libdir)/mono/xbuild/Microsoft/VisualStudio
 PORTABLE_TARGETS_DIR = $(mono_libdir)/mono/xbuild/Microsoft/Portable
+NUGET_BUILDTASKS_TARGETS_DIR = $(mono_libdir)/mono/xbuild/Microsoft/NuGet
+
+ifeq (14.0, $(XBUILD_VERSION))
+install-extras: install-versioned-files install-global-files
+else
+install-extras: install-versioned-files
+endif
 
+#install files into xbuild's versioned locations
+install-versioned-files: install-bin-data install-nuget-imports
 
-install-extras: install-bin-data install-frameworks install-pcl-targets install-web-targets
+#install files that are only installed once across all xbuild versions
+install-global-files: install-frameworks install-web-targets install-pcl-targets install-pcl5-framework install-nuget-targets
 
 install-bin-data:
        $(MKINSTALLDIRS) $(DESTDIR)$(XBUILD_BIN_DIR)/MSBuild
        $(INSTALL_DATA) data/xbuild.rsp $(DESTDIR)$(XBUILD_BIN_DIR)
        $(INSTALL_DATA) data/$(XBUILD_VERSION)/Microsoft.Common.tasks $(DESTDIR)$(XBUILD_BIN_DIR)
        $(INSTALL_DATA) data/$(XBUILD_VERSION)/Microsoft.Common.targets $(DESTDIR)$(XBUILD_BIN_DIR)
+ifeq (14.0, $(XBUILD_VERSION))
+       $(INSTALL_DATA) data/$(XBUILD_VERSION)/Microsoft.Common.props $(DESTDIR)$(XBUILD_BIN_DIR)/../
+endif
        $(INSTALL_DATA) data/$(XBUILD_VERSION)/Microsoft.CSharp.targets $(DESTDIR)$(XBUILD_BIN_DIR)
        $(INSTALL_DATA) data/Microsoft.Build.xsd $(DESTDIR)$(XBUILD_BIN_DIR)
        $(INSTALL_DATA) data/Microsoft.VisualBasic.targets $(DESTDIR)$(XBUILD_BIN_DIR)
@@ -62,20 +79,16 @@ install-frameworks:
        $(INSTALL_DATA) frameworks/net_4.6.1.xml $(DESTDIR)$(NETFRAMEWORK_DIR)/v4.6.1/RedistList/FrameworkList.xml
 
 install-pcl-targets:
-       $(MKINSTALLDIRS) $(DESTDIR)$(PORTABLE_TARGETS_DIR)/v4.0
-       $(INSTALL_DATA) targets/Microsoft.Portable.Common.targets $(DESTDIR)$(PORTABLE_TARGETS_DIR)/v4.0/Microsoft.Portable.Common.targets
-       $(INSTALL_DATA) targets/Microsoft.Portable.CSharp_4.0.targets $(DESTDIR)$(PORTABLE_TARGETS_DIR)/v4.0/Microsoft.Portable.CSharp.targets
-       $(INSTALL_DATA) targets/Microsoft.Portable.VisualBasic_4.0.targets $(DESTDIR)$(PORTABLE_TARGETS_DIR)/v4.0/Microsoft.Portable.VisualBasic.targets
-       $(MKINSTALLDIRS) $(DESTDIR)$(PORTABLE_TARGETS_DIR)/v4.5
-       $(INSTALL_DATA) targets/Microsoft.Portable.Common.targets $(DESTDIR)$(PORTABLE_TARGETS_DIR)/v4.5/Microsoft.Portable.Common.targets
-       $(INSTALL_DATA) targets/Microsoft.Portable.CSharp_4.5.targets $(DESTDIR)$(PORTABLE_TARGETS_DIR)/v4.5/Microsoft.Portable.CSharp.targets
-       $(INSTALL_DATA) targets/Microsoft.Portable.VisualBasic_4.5.targets $(DESTDIR)$(PORTABLE_TARGETS_DIR)/v4.5/Microsoft.Portable.VisualBasic.targets
-       $(INSTALL_DATA) targets/Microsoft.Portable.Core.targets $(DESTDIR)$(PORTABLE_TARGETS_DIR)/Microsoft.Portable.Core.targets
-       $(INSTALL_DATA) targets/Microsoft.Portable.Core.props $(DESTDIR)$(PORTABLE_TARGETS_DIR)/Microsoft.Portable.Core.props
-       $(MKINSTALLDIRS) $(DESTDIR)$(PORTABLE_TARGETS_DIR)/v4.6
-       $(INSTALL_DATA) targets/Microsoft.Portable.Common.targets $(DESTDIR)$(PORTABLE_TARGETS_DIR)/v4.6/Microsoft.Portable.Common.targets
-       $(INSTALL_DATA) targets/Microsoft.Portable.CSharp_4.5.targets $(DESTDIR)$(PORTABLE_TARGETS_DIR)/v4.6/Microsoft.Portable.CSharp.targets
-       $(INSTALL_DATA) targets/Microsoft.Portable.VisualBasic_4.5.targets $(DESTDIR)$(PORTABLE_TARGETS_DIR)/v4.6/Microsoft.Portable.VisualBasic.targets
+       $(MKINSTALLDIRS) $(DESTDIR)$(PORTABLE_TARGETS_DIR)
+       $(INSTALL_DATA) $(PORTABLE_TARGETS_SRC)/Microsoft.Portable.Core.props $(DESTDIR)$(PORTABLE_TARGETS_DIR)/Microsoft.Portable.Core.props
+       $(INSTALL_DATA) $(PORTABLE_TARGETS_SRC)/Microsoft.Portable.Core.targets $(DESTDIR)$(PORTABLE_TARGETS_DIR)/Microsoft.Portable.Core.targets
+
+       for VERSION in v4.0 v4.5 v4.6 v5.0; do \
+               $(MKINSTALLDIRS) $(DESTDIR)$(PORTABLE_TARGETS_DIR)/$$VERSION; \
+               $(INSTALL_DATA) $(PORTABLE_TARGETS_SRC)/$$VERSION/Microsoft.Portable.Common.targets $(DESTDIR)$(PORTABLE_TARGETS_DIR)/$$VERSION/Microsoft.Portable.Common.targets; \
+               $(INSTALL_DATA) $(PORTABLE_TARGETS_SRC)/$$VERSION/Microsoft.Portable.CSharp.targets $(DESTDIR)$(PORTABLE_TARGETS_DIR)/$$VERSION/Microsoft.Portable.CSharp.targets; \
+               $(INSTALL_DATA) $(PORTABLE_TARGETS_SRC)/$$VERSION/Microsoft.Portable.VisualBasic.targets $(DESTDIR)$(PORTABLE_TARGETS_DIR)/$$VERSION/Microsoft.Portable.VisualBasic.targets; \
+       done
 
 install-web-targets:
        $(MKINSTALLDIRS) $(DESTDIR)$(VS_TARGETS_DIR)/v9.0/WebApplications
@@ -89,6 +102,31 @@ install-web-targets:
        $(MKINSTALLDIRS) $(DESTDIR)$(VS_TARGETS_DIR)/v14.0/WebApplications
        $(INSTALL_DATA) targets/Microsoft.WebApplication.targets $(DESTDIR)$(VS_TARGETS_DIR)/v14.0/WebApplications
 
+NUGET_BUILDTASKS_REPO_DIR=$(topdir)/../external/nuget-buildtasks
+
+install-nuget-targets:
+       $(MKINSTALLDIRS) $(DESTDIR)$(NUGET_BUILDTASKS_TARGETS_DIR)
+       $(INSTALL_DATA) $(NUGET_BUILDTASKS_REPO_DIR)/src/Microsoft.NuGet.Build.Tasks/Microsoft.NuGet.targets $(DESTDIR)$(NUGET_BUILDTASKS_TARGETS_DIR)
+       $(INSTALL_DATA) $(NUGET_BUILDTASKS_REPO_DIR)/src/Microsoft.NuGet.Build.Tasks/Microsoft.NuGet.props $(DESTDIR)$(NUGET_BUILDTASKS_TARGETS_DIR)
+
+install-nuget-imports:
+ifeq (14.0, $(XBUILD_VERSION))
+       $(MKINSTALLDIRS) $(DESTDIR)$(XBUILD_BIN_DIR)/../Imports/Microsoft.Common.props/ImportBefore
+       $(MKINSTALLDIRS) $(DESTDIR)$(XBUILD_BIN_DIR)/../Microsoft.Common.targets/ImportAfter
+       $(INSTALL_DATA) $(NUGET_BUILDTASKS_REPO_DIR)/src/Microsoft.NuGet.Build.Tasks/ImportBeforeAfter/Microsoft.NuGet.ImportBefore.props $(DESTDIR)$(XBUILD_BIN_DIR)/../Imports/Microsoft.Common.props/ImportBefore
+       $(INSTALL_DATA) $(NUGET_BUILDTASKS_REPO_DIR)/src/Microsoft.NuGet.Build.Tasks/ImportBeforeAfter/Microsoft.NuGet.ImportAfter.targets $(DESTDIR)$(XBUILD_BIN_DIR)/../Microsoft.Common.targets/ImportAfter
+endif
+
+# The .NETPortable,Version=v5.0 framework contains no assemblies, and essentially just fills the requirement
+# for a framework moniker. When using it, assemblies are provided by NuGet packages such as .NETStandard.Library
+install-pcl5-framework:
+       $(MKINSTALLDIRS) $(DESTDIR)$(PCL5_FX_DIR)/RedistList
+       $(INSTALL_DATA) $(PCL5_FX_SRC)/FrameworkList.xml $(DESTDIR)$(PCL5_FX_DIR)/RedistList/FrameworkList.xml
+
+       $(MKINSTALLDIRS) $(DESTDIR)$(PCL5_FX_DIR)/SupportedFrameworks
+       $(INSTALL_DATA) "$(PCL5_FX_SRC)/.NET Framework 4.6.xml" "$(DESTDIR)$(PCL5_FX_DIR)/SupportedFrameworks/.NET Framework 4.6.xml"
+       $(INSTALL_DATA) "$(PCL5_FX_SRC)/ASP.NET Core 1.0.xml" "$(DESTDIR)$(PCL5_FX_DIR)/SupportedFrameworks/ASP.NET Core 1.0.xml"
+       $(INSTALL_DATA) "$(PCL5_FX_SRC)/Windows Universal 10.0.xml" "$(DESTDIR)$(PCL5_FX_DIR)/SupportedFrameworks/Windows Universal 10.0.xml"
 
 EXTRA_DISTFILES = \
        data/xbuild.rsp \
@@ -104,6 +142,7 @@ EXTRA_DISTFILES = \
        data/4.0/Microsoft.Common.targets \
        data/12.0/Microsoft.Common.targets \
        data/14.0/Microsoft.Common.targets \
+       data/14.0/Microsoft.Common.props \
        data/2.0/Microsoft.CSharp.targets \
        data/3.5/Microsoft.CSharp.targets \
        data/4.0/Microsoft.CSharp.targets \
@@ -122,13 +161,10 @@ EXTRA_DISTFILES = \
        frameworks/net_4.5.2.xml \
        frameworks/net_4.6.xml \
        frameworks/net_4.6.1.xml \
-       targets/Microsoft.Portable.CSharp_4.0.targets \
-       targets/Microsoft.Portable.CSharp_4.5.targets \
-       targets/Microsoft.Portable.VisualBasic_4.0.targets \
-       targets/Microsoft.Portable.VisualBasic_4.5.targets \
-       targets/Microsoft.Portable.Common.targets \
-       targets/Microsoft.Portable.Core.targets \
-       targets/Microsoft.Portable.Core.props \
-       targets/Microsoft.WebApplication.targets \
+       targets/Microsoft.WebApplication.targets        \
+       $(NUGET_BUILDTASKS_REPO_DIR)/src/Microsoft.NuGet.Build.Tasks/ImportBeforeAfter/Microsoft.NuGet.ImportBefore.props       \
+       $(NUGET_BUILDTASKS_REPO_DIR)/src/Microsoft.NuGet.Build.Tasks/ImportBeforeAfter/Microsoft.NuGet.ImportAfter.targets      \
+       $(NUGET_BUILDTASKS_REPO_DIR)/src/Microsoft.NuGet.Build.Tasks/Microsoft.NuGet.targets \
+       $(NUGET_BUILDTASKS_REPO_DIR)/src/Microsoft.NuGet.Build.Tasks/Microsoft.NuGet.props \
        xbuild.make \
        xbuild_test.make
index fb80dbc9454704e74412435730aa359801d8154b..ffe1f63b83831bf76308f05d066a6bcd62b5828e 100644 (file)
@@ -1,4 +1,4 @@
-<Project DefaultTargets="Build" InitialTargets="_ValidateEssentialProperties" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+<Project DefaultTargets="Build" InitialTargets="_CheckForInvalidConfigurationAndPlatform" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
        <PropertyGroup>
                <ImportByWildcardBeforeMicrosoftCommonTargets Condition="'$(ImportByWildcardBeforeMicrosoftCommonTargets)' == ''">true</ImportByWildcardBeforeMicrosoftCommonTargets>
                <ImportByWildcardAfterMicrosoftCommonTargets Condition="'$(ImportByWildcardAfterMicrosoftCommonTargets)' == ''">true</ImportByWildcardAfterMicrosoftCommonTargets>
                <_OriginalPlatform>$(Platform)</_OriginalPlatform>
                <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
                <PlatformName Condition="'$(PlatformName)' == ''">$(Platform)</PlatformName>
+       </PropertyGroup>
 
+       <!-- in MSBuild, these properties are set in a separate file that is only imported for .NETFramework -->
+       <PropertyGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">
                <AddAdditionalExplicitAssemblyReferences Condition="'$(AddAdditionalExplicitAssemblyReferences)' == ''">true</AddAdditionalExplicitAssemblyReferences>
                <AdditionalExplicitAssemblyReferences Condition="'$(AddAdditionalExplicitAssemblyReferences)' == 'true' and '$(TargetFrameworkVersion)' != 'v2.0' and '$(TargetFrameworkVersion)' != 'v3.0'">System.Core;$(AdditionalExplicitAssemblyReferences)</AdditionalExplicitAssemblyReferences>
        </PropertyGroup>
@@ -90,7 +93,7 @@
                <TargetingClr2Framework Condition="('$(TargetFrameworkIdentifier)' == '.NETFramework') and ('$(TargetFrameworkVersion)' == 'v2.0' or '$(TargetFrameworkVersion)' == 'v3.0' or '$(TargetFrameworkVersion)' == 'v3.5')">true</TargetingClr2Framework>
        </PropertyGroup>
 
-       <Target Name="_ValidateEssentialProperties">
+       <Target Name="_CheckForInvalidConfigurationAndPlatform">
                <Error Condition=" '$(OutputPath)' == '' and '$(SkipInvalidConfigurations)' != 'true'"
                        Text="'OutputPath' property is not set for this project. Usually this is caused by invalid Configuration/Platform combination. Original values: Configuration: $(_OriginalConfiguration) Platform: $(_OriginalPlatform)."/>
 
diff --git a/mcs/tools/xbuild/data/14.0/Microsoft.Common.props b/mcs/tools/xbuild/data/14.0/Microsoft.Common.props
new file mode 100644 (file)
index 0000000..6c4d33c
--- /dev/null
@@ -0,0 +1,16 @@
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+       <PropertyGroup>
+               <ImportByWildcardBeforeMicrosoftCommonProps Condition="'$(ImportByWildcardBeforeMicrosoftCommonProps)' == ''">true</ImportByWildcardBeforeMicrosoftCommonProps>
+               <ImportByWildcardAfterMicrosoftCommonProps Condition="'$(ImportByWildcardAfterMicrosoftCommonProps)' == ''">true</ImportByWildcardAfterMicrosoftCommonProps>
+       </PropertyGroup>
+
+       <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Imports\Microsoft.Common.props\ImportBefore\*"
+               Condition="'$(ImportByWildcardBeforeMicrosoftCommonProps)' == 'true' and Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Imports\Microsoft.Common.props\ImportBefore')"/>
+
+       <PropertyGroup>
+               <MicrosoftCommonPropsHasBeenImported>true</MicrosoftCommonPropsHasBeenImported>
+       </PropertyGroup>
+
+       <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Imports\Microsoft.Common.props\ImportAfter\*"
+               Condition="'$(ImportByWildcardAfterMicrosoftCommonProps)' == 'true' and Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Imports\Microsoft.Common.props\ImportAfter')"/>
+</Project>
index bea93366ec988a3bffd8a9cc9d7ed18049147b22..433cffe8e69a8bfb86808755e4bfa26911c7d77a 100644 (file)
@@ -1,4 +1,6 @@
-<Project DefaultTargets="Build" InitialTargets="_ValidateEssentialProperties" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+<Project DefaultTargets="Build" InitialTargets="_CheckForInvalidConfigurationAndPlatform" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+       <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="'$(MicrosoftCommonPropsHasBeenImported)' != 'true' and Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+
        <PropertyGroup>
                <ImportByWildcardBeforeMicrosoftCommonTargets Condition="'$(ImportByWildcardBeforeMicrosoftCommonTargets)' == ''">true</ImportByWildcardBeforeMicrosoftCommonTargets>
                <ImportByWildcardAfterMicrosoftCommonTargets Condition="'$(ImportByWildcardAfterMicrosoftCommonTargets)' == ''">true</ImportByWildcardAfterMicrosoftCommonTargets>
                <_OriginalPlatform>$(Platform)</_OriginalPlatform>
                <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
                <PlatformName Condition="'$(PlatformName)' == ''">$(Platform)</PlatformName>
+       </PropertyGroup>
 
+       <!-- in MSBuild, these properties are set in a separate file that is only imported for .NETFramework -->
+       <PropertyGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">
                <AddAdditionalExplicitAssemblyReferences Condition="'$(AddAdditionalExplicitAssemblyReferences)' == ''">true</AddAdditionalExplicitAssemblyReferences>
                <AdditionalExplicitAssemblyReferences Condition="'$(AddAdditionalExplicitAssemblyReferences)' == 'true' and '$(TargetFrameworkVersion)' != 'v2.0' and '$(TargetFrameworkVersion)' != 'v3.0'">System.Core;$(AdditionalExplicitAssemblyReferences)</AdditionalExplicitAssemblyReferences>
        </PropertyGroup>
@@ -90,7 +95,7 @@
                <TargetingClr2Framework Condition="('$(TargetFrameworkIdentifier)' == '.NETFramework') and ('$(TargetFrameworkVersion)' == 'v2.0' or '$(TargetFrameworkVersion)' == 'v3.0' or '$(TargetFrameworkVersion)' == 'v3.5')">true</TargetingClr2Framework>
        </PropertyGroup>
 
-       <Target Name="_ValidateEssentialProperties">
+       <Target Name="_CheckForInvalidConfigurationAndPlatform">
                <Error Condition=" '$(OutputPath)' == '' and '$(SkipInvalidConfigurations)' != 'true'"
                        Text="'OutputPath' property is not set for this project. Usually this is caused by invalid Configuration/Platform combination. Original values: Configuration: $(_OriginalConfiguration) Platform: $(_OriginalPlatform)."/>
 
index e260aa1ac30524b8efc87db8221f95d80fff60dc..152dd2b985e906f5ed3e6ac13142dd6e90198390 100644 (file)
@@ -1,4 +1,4 @@
-<Project DefaultTargets="Build" InitialTargets="_ValidateEssentialProperties" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+<Project DefaultTargets="Build" InitialTargets="_CheckForInvalidConfigurationAndPlatform" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
        <PropertyGroup>
                <ImportByWildcardBeforeMicrosoftCommonTargets Condition="'$(ImportByWildcardBeforeMicrosoftCommonTargets)' == ''">true</ImportByWildcardBeforeMicrosoftCommonTargets>
                <ImportByWildcardAfterMicrosoftCommonTargets Condition="'$(ImportByWildcardAfterMicrosoftCommonTargets)' == ''">true</ImportByWildcardAfterMicrosoftCommonTargets>
                <_OriginalPlatform>$(Platform)</_OriginalPlatform>
                <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
                <PlatformName Condition="'$(PlatformName)' == ''">$(Platform)</PlatformName>
+       </PropertyGroup>
 
+       <!-- in MSBuild, these properties are set in a separate file that is only imported for .NETFramework -->
+       <PropertyGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">
                <AddAdditionalExplicitAssemblyReferences Condition="'$(AddAdditionalExplicitAssemblyReferences)' == ''">true</AddAdditionalExplicitAssemblyReferences>
                <AdditionalExplicitAssemblyReferences Condition="'$(AddAdditionalExplicitAssemblyReferences)' == 'true' and '$(TargetFrameworkVersion)' != 'v2.0' and '$(TargetFrameworkVersion)' != 'v3.0'">System.Core;$(AdditionalExplicitAssemblyReferences)</AdditionalExplicitAssemblyReferences>
        </PropertyGroup>
@@ -90,7 +93,7 @@
                <TargetingClr2Framework Condition="('$(TargetFrameworkIdentifier)' == '.NETFramework') and ('$(TargetFrameworkVersion)' == 'v2.0' or '$(TargetFrameworkVersion)' == 'v3.0' or '$(TargetFrameworkVersion)' == 'v3.5')">true</TargetingClr2Framework>
        </PropertyGroup>
 
-       <Target Name="_ValidateEssentialProperties">
+       <Target Name="_CheckForInvalidConfigurationAndPlatform">
                <Error Condition=" '$(OutputPath)' == '' and '$(SkipInvalidConfigurations)' != 'true'"
                        Text="'OutputPath' property is not set for this project. Usually this is caused by invalid Configuration/Platform combination. Original values: Configuration: $(_OriginalConfiguration) Platform: $(_OriginalPlatform)."/>
 
diff --git a/mcs/tools/xbuild/targets/Microsoft.Portable.CSharp_4.0.targets b/mcs/tools/xbuild/targets/Microsoft.Portable.CSharp_4.0.targets
deleted file mode 100644 (file)
index 36bc56e..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-       <Import Project="..\Microsoft.Portable.Core.props" />
-       <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
-       <Import Project="..\Microsoft.Portable.Core.targets" />
-</Project>
diff --git a/mcs/tools/xbuild/targets/Microsoft.Portable.CSharp_4.5.targets b/mcs/tools/xbuild/targets/Microsoft.Portable.CSharp_4.5.targets
deleted file mode 100644 (file)
index 36bc56e..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-       <Import Project="..\Microsoft.Portable.Core.props" />
-       <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
-       <Import Project="..\Microsoft.Portable.Core.targets" />
-</Project>
diff --git a/mcs/tools/xbuild/targets/Microsoft.Portable.Common.targets b/mcs/tools/xbuild/targets/Microsoft.Portable.Common.targets
deleted file mode 100644 (file)
index 82bea1e..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-       <Import Project="..\Microsoft.Portable.Core.props" />
-       <Import Project="..\Microsoft.Portable.Core.targets" />
-</Project>
diff --git a/mcs/tools/xbuild/targets/Microsoft.Portable.Core.props b/mcs/tools/xbuild/targets/Microsoft.Portable.Core.props
deleted file mode 100644 (file)
index 4bf2d9c..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-       <PropertyGroup>
-               <AvailablePlatforms>Any CPU</AvailablePlatforms>
-
-               <TargetPlatformIdentifier>Portable</TargetPlatformIdentifier>
-               <TargetFrameworkIdentifier>.NETPortable</TargetFrameworkIdentifier>
-               <TargetFrameworkMonikerDisplayName>.NET Portable Subset</TargetFrameworkMonikerDisplayName>
-
-               <AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>
-               <NoStdLib>true</NoStdLib>
-
-               <ImplicitlyExpandTargetFramework Condition="'$(ImplicitlyExpandTargetFramework)' == '' ">true</ImplicitlyExpandTargetFramework>
-       </PropertyGroup>
-</Project>
diff --git a/mcs/tools/xbuild/targets/Microsoft.Portable.Core.targets b/mcs/tools/xbuild/targets/Microsoft.Portable.Core.targets
deleted file mode 100644 (file)
index 5ca4483..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-       <PropertyGroup>
-               <ResolveReferencesDependsOn>
-                       $(ResolveReferencesDependsOn);
-                       ImplicitlyExpandTargetFramework;
-               </ResolveReferencesDependsOn>
-
-               <ImplicitlyExpandTargetFrameworkDependsOn>
-                       $(ImplicitlyExpandTargetFrameworkDependsOn);
-                       GetReferenceAssemblyPaths
-               </ImplicitlyExpandTargetFrameworkDependsOn>
-       </PropertyGroup>
-
-       <Target Name="ImplicitlyExpandTargetFramework"
-               Condition="'$(ImplicitlyExpandTargetFramework)' == 'true'"
-               DependsOnTargets="$(ImplicitlyExpandTargetFrameworkDependsOn)">
-
-               <ItemGroup>
-                       <ReferenceAssemblyPaths Include="$(_TargetFrameworkDirectories)"/>
-                       <ReferencePath Include="%(ReferenceAssemblyPaths.Identity)\*.dll">
-                               <CopyLocal>false</CopyLocal>
-                               <ResolvedFrom>ImplicitlyExpandTargetFramework</ResolvedFrom>
-                               <IsSystemReference>True</IsSystemReference>
-                       </ReferencePath>
-               </ItemGroup>
-       </Target>
-
-</Project>
diff --git a/mcs/tools/xbuild/targets/Microsoft.Portable.VisualBasic_4.0.targets b/mcs/tools/xbuild/targets/Microsoft.Portable.VisualBasic_4.0.targets
deleted file mode 100644 (file)
index bf58fee..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-       <Import Project="..\Microsoft.Portable.Core.props" />
-       <Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
-       <Import Project="..\Microsoft.Portable.Core.targets" />
-</Project>
diff --git a/mcs/tools/xbuild/targets/Microsoft.Portable.VisualBasic_4.5.targets b/mcs/tools/xbuild/targets/Microsoft.Portable.VisualBasic_4.5.targets
deleted file mode 100644 (file)
index bf58fee..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-       <Import Project="..\Microsoft.Portable.Core.props" />
-       <Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
-       <Import Project="..\Microsoft.Portable.Core.targets" />
-</Project>
index 6ca4da6d88127686f16fe2ac70c759a8839a6f4e..2d8c4c5a91554532a5da89ffa62b92993b4727bf 100644 (file)
@@ -179,9 +179,9 @@ arm_get_disp (void *p, void *target)
 }
 
 // 0b00101 == 0x5
-#define arm_b(p, target) arm_emit (p, (0x0 << 31) | (0x5 << 26) | ((arm_get_disp ((p), (target)) << 0)))
+#define arm_b(p, target) do { if ((target)) g_assert (arm_is_bl_disp ((p), (target))); arm_emit (p, (0x0 << 31) | (0x5 << 26) | ((arm_get_disp ((p), (target)) << 0))); } while (0)
 
-#define arm_bl(p, target) arm_emit (p, (0x1 << 31) | (0x5 << 26) | ((arm_get_disp ((p), (target)) << 0)))
+#define arm_bl(p, target) do { if ((target)) g_assert (arm_is_bl_disp ((p), (target))); arm_emit (p, (0x1 << 31) | (0x5 << 26) | ((arm_get_disp ((p), (target)) << 0))); } while (0)
 
 /* Conditional branch */
 
index 087e3f3008721786750ca531e3487a87aa994907..c8ef14eaeed3dd86d814920839c14dc6ddd56398 100644 (file)
 <opcode name="mono_calli_extra_arg" input="VarPop" output="VarPush" args="InlineSig" o1="0xF0" o2="0x18" flow="call" />
 <opcode name="mono_lddomain" input="Pop0" output="PushI" args="InlineNone" o1="0xF0" o2="0x19" flow="next" />
 <opcode name="mono_atomic_store_i4" input="PopI+PopI" output="Push0" args="InlineI" o1="0xF0" o2="0x1A" flow="next" />
+<opcode name="mono_get_last_error" input="Pop0" output="PushI" args="InlineNone" o1="0xF0" o2="0x1B" flow="next" />
 </opdesc>
index ee69b699ba6797fb7f53a0f2599e650a0983198f..fca2448151a9771b1a91e6fed9d4b130147559b1 100644 (file)
@@ -319,6 +319,7 @@ OPDEF(CEE_MONO_LDPTR_NURSERY_BITS, "mono_ldptr_nursery_bits", Pop0, PushI, Inlin
 OPDEF(CEE_MONO_CALLI_EXTRA_ARG, "mono_calli_extra_arg", VarPop, VarPush, InlineSig, X, 2, 0xF0, 0x18, CALL)
 OPDEF(CEE_MONO_LDDOMAIN, "mono_lddomain", Pop0, PushI, InlineNone, X, 2, 0xF0, 0x19, NEXT)
 OPDEF(CEE_MONO_ATOMIC_STORE_I4, "mono_atomic_store_i4", PopI+PopI, Push0, InlineI, X, 2, 0xF0, 0x1A, NEXT)
+OPDEF(CEE_MONO_GET_LAST_ERROR, "mono_get_last_error", Pop0, PushI, InlineNone, X, 2, 0xF0, 0x1B, NEXT)
 #ifndef OPALIAS
 #define _MONO_CIL_OPALIAS_DEFINED_
 #define OPALIAS(a,s,r)
index fd819424978689f7d5fea4e464f58615f461498c..0eb885e055e4a843868fbcc00a1f0600a99827a1 100644 (file)
@@ -15,7 +15,6 @@ OTHER_H = \
        context.h       \
        error.h         \
        events.h        \
-       handles.h       \
        io.h            \
        io-trace.h      \
        io-layer.h      \
@@ -28,7 +27,6 @@ OTHER_H = \
        semaphores.h    \
        sockets.h       \
        status.h        \
-       threads.h       \
        timefuncs.h     \
        types.h         \
        uglify.h        \
@@ -46,9 +44,6 @@ OTHER_SRC = \
        events.c                \
        events.h                \
        event-private.h         \
-       handles.c               \
-       handles.h               \
-       handles-private.h       \
        io.c                    \
        io.h                    \
        io-portability.c        \
@@ -78,8 +73,6 @@ OTHER_SRC = \
        socket-private.h        \
        socket-wrappers.h       \
        status.h                \
-       threads.h               \
-       thread-private.h        \
        timefuncs.c             \
        timefuncs.h             \
        timefuncs-private.h     \
@@ -93,7 +86,7 @@ OTHER_SRC = \
        wapi_glob.c             \
        wapi.h                  \
        wapi-private.h          \
-       wthreads.c
+       wapi.c
 
 
 WINDOWS_H = \
index 6d40dd3b5cc2a7d37bb0f7ef91a40412fd701f1c..db128be5c72a6c3948f3056f915c02284e5461ca 100644 (file)
 #include <errno.h>
 
 #include "mono/io-layer/wapi.h"
+#include "mono/io-layer/wapi-private.h"
 #include "mono/utils/mono-once.h"
 
 static pthread_key_t error_key;
 static mono_once_t error_key_once=MONO_ONCE_INIT;
-extern gboolean _wapi_has_shut_down;
 
 static void error_init(void)
 {
index 25df9111656ffc62227021b5aa8f01884a41935c..07b35e0c2f9b48451227ff2822a5886d3158675c 100644 (file)
 #include <glib.h>
 #include <pthread.h>
 
-extern struct _WapiHandleOps _wapi_event_ops;
-extern struct _WapiHandleOps _wapi_namedevent_ops;
-
-extern void _wapi_event_details (gpointer handle_info);
+#include "wapi-private.h"
 
 struct _WapiHandle_event
 {
@@ -27,9 +24,11 @@ struct _WapiHandle_event
 
 struct _WapiHandle_namedevent
 {
+       struct _WapiHandle_event e;
        WapiSharedNamespace sharedns;
-       gboolean manual;
-       guint32 set_count;
 };
 
+void
+_wapi_event_init (void);
+
 #endif /* _WAPI_EVENT_PRIVATE_H_ */
index f34ae7139b25f7dacf1d1f18813ce8a638bc4b81..8e3fa4a0394e1a69a31b8bbeb6888217aaf56027 100644 (file)
 
 #include <mono/io-layer/wapi.h>
 #include <mono/io-layer/wapi-private.h>
-#include <mono/io-layer/handles-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);
 
-struct _WapiHandleOps _wapi_event_ops = {
+static MonoW32HandleOps _wapi_event_ops = {
        NULL,                   /* close */
        event_signal,           /* signal */
        event_own,              /* own */
        NULL,                   /* is_owned */
        NULL,                   /* special_wait */
-       NULL                    /* prewait */
+       NULL,                   /* prewait */
+       event_details,  /* details */
+       event_typename, /* typename */
+       event_typesize, /* typesize */
 };
 
-struct _WapiHandleOps _wapi_namedevent_ops = {
+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 */
 };
 
-static gboolean event_pulse (gpointer handle);
-static gboolean event_reset (gpointer handle);
-static gboolean event_set (gpointer handle);
+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);
 
-static gboolean namedevent_pulse (gpointer handle);
-static gboolean namedevent_reset (gpointer handle);
-static gboolean namedevent_set (gpointer handle);
+       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 struct
+static const char* event_handle_type_to_string (MonoW32HandleType type)
 {
-       gboolean (*pulse)(gpointer handle);
-       gboolean (*reset)(gpointer handle);
-       gboolean (*set)(gpointer handle);
-} event_ops[WAPI_HANDLE_COUNT] = {
-               {NULL},
-               {NULL},
-               {NULL},
-               {NULL},
-               {NULL},
-               {NULL},
-               {event_pulse, event_reset, event_set},
-               {NULL},
-               {NULL},
-               {NULL},
-               {NULL},
-               {NULL},
-               {NULL},
-               {namedevent_pulse, namedevent_reset, namedevent_set},
-};
+       switch (type) {
+       case MONO_W32HANDLE_EVENT: return "event";
+       case MONO_W32HANDLE_NAMEDEVENT: return "named event";
+       default:
+               g_assert_not_reached ();
+       }
+}
 
-void _wapi_event_details (gpointer handle_info)
+static gboolean event_handle_own (gpointer handle, MonoW32HandleType type)
 {
-       struct _WapiHandle_event *event = (struct _WapiHandle_event *)handle_info;
-       
-       g_print ("manual: %s", event->manual?"TRUE":"FALSE");
-}
+       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;
+       }
 
-static mono_once_t event_ops_once=MONO_ONCE_INIT;
+       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: owning %s handle %p",
+               __func__, event_handle_type_to_string (type), handle);
 
-static void event_ops_init (void)
-{
-       _wapi_handle_register_capabilities (WAPI_HANDLE_EVENT,
-               (WapiHandleCapability)(WAPI_HANDLE_CAP_WAIT | WAPI_HANDLE_CAP_SIGNAL));
-       _wapi_handle_register_capabilities (WAPI_HANDLE_NAMEDEVENT,
-               (WapiHandleCapability)(WAPI_HANDLE_CAP_WAIT | WAPI_HANDLE_CAP_SIGNAL));
+       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)
@@ -96,28 +111,7 @@ static void event_signal(gpointer handle)
 
 static gboolean event_own (gpointer handle)
 {
-       struct _WapiHandle_event *event_handle;
-       gboolean ok;
-       
-       ok=_wapi_lookup_handle (handle, WAPI_HANDLE_EVENT,
-                               (gpointer *)&event_handle);
-       if(ok==FALSE) {
-               g_warning ("%s: error looking up event handle %p", __func__,
-                          handle);
-               return (FALSE);
-       }
-       
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: owning event handle %p", __func__, handle);
-
-       if(event_handle->manual==FALSE) {
-               g_assert (event_handle->set_count > 0);
-               
-               if (--event_handle->set_count == 0) {
-                       _wapi_handle_set_signal_state (handle, FALSE, FALSE);
-               }
-       }
-
-       return(TRUE);
+       return event_handle_own (handle, MONO_W32HANDLE_EVENT);
 }
 
 static void namedevent_signal (gpointer handle)
@@ -128,162 +122,124 @@ static void namedevent_signal (gpointer handle)
 /* NB, always called with the shared handle lock held */
 static gboolean namedevent_own (gpointer handle)
 {
-       struct _WapiHandle_namedevent *namedevent_handle;
-       gboolean ok;
-       
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: owning named event handle %p", __func__, handle);
+       return event_handle_own (handle, MONO_W32HANDLE_NAMEDEVENT);
+}
 
-       ok = _wapi_lookup_handle (handle, WAPI_HANDLE_NAMEDEVENT,
-                                 (gpointer *)&namedevent_handle);
-       if (ok == FALSE) {
-               g_warning ("%s: error looking up named event handle %p",
-                          __func__, handle);
-               return(FALSE);
-       }
-       
-       if (namedevent_handle->manual == FALSE) {
-               g_assert (namedevent_handle->set_count > 0);
-               
-               if (--namedevent_handle->set_count == 0) {
-                       _wapi_handle_set_signal_state (handle, FALSE, FALSE);
-               }
-       }
-       
-       return (TRUE);
+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 gpointer event_create (WapiSecurityAttributes *security G_GNUC_UNUSED,
-                             gboolean manual, gboolean initial)
+
+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)
 {
-       struct _WapiHandle_event event_handle = {0};
        gpointer handle;
        int thr_ret;
-       
-       /* 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);
 
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Creating unnamed event", __func__);
-       
-       event_handle.manual = manual;
-       event_handle.set_count = 0;
+       event_handle->manual = manual;
+       event_handle->set_count = (initial && !manual) ? 1 : 0;
 
-       if (initial == TRUE) {
-               if (manual == FALSE) {
-                       event_handle.set_count = 1;
-               }
-       }
-       
-       handle = _wapi_handle_new (WAPI_HANDLE_EVENT, &event_handle);
-       if (handle == _WAPI_HANDLE_INVALID) {
-               g_warning ("%s: error creating event handle", __func__);
+       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);
+               return NULL;
        }
 
-       thr_ret = _wapi_handle_lock_handle (handle);
+       thr_ret = mono_w32handle_lock_handle (handle);
        g_assert (thr_ret == 0);
-       
-       if (initial == TRUE) {
-               _wapi_handle_set_signal_state (handle, TRUE, FALSE);
-       }
-       
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: created new event handle %p", __func__, handle);
 
-       thr_ret = _wapi_handle_unlock_handle (handle);
+       if (initial)
+               mono_w32handle_set_signal_state (handle, TRUE, FALSE);
+
+       thr_ret = mono_w32handle_unlock_handle (handle);
        g_assert (thr_ret == 0);
 
-       return(handle);
+       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 (WapiSecurityAttributes *security G_GNUC_UNUSED,
-                                  gboolean manual, gboolean initial,
-                                  const gunichar2 *name G_GNUC_UNUSED)
+static gpointer namedevent_create (gboolean manual, gboolean initial, const gunichar2 *name G_GNUC_UNUSED)
 {
-       struct _WapiHandle_namedevent namedevent_handle = {{{0}}, 0};
        gpointer handle;
        gchar *utf8_name;
        int thr_ret;
-       
-       /* w32 seems to guarantee that opening named objects can't
-        * race each other
-        */
+
+       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);
 
-       /* 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);
-       
        utf8_name = g_utf16_to_utf8 (name, -1, NULL, NULL, NULL);
-       
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Creating named event [%s]", __func__, utf8_name);
-       
-       handle = _wapi_search_handle_namespace (WAPI_HANDLE_NAMEDEVENT,
-                                               utf8_name);
-       if (handle == _WAPI_HANDLE_INVALID) {
-               /* The name has already been used for a different
-                * object.
-                */
+
+       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);
-               goto cleanup;
        } else if (handle) {
-               /* Not an error, but this is how the caller is
-                * informed that the event wasn't freshly created
-                */
+               /* 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, so create both the private and
-                * shared parts
-                */
-       
+               /* 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';
 
-               namedevent_handle.manual = manual;
-               namedevent_handle.set_count = 0;
-               
-               if (initial == TRUE) {
-                       if (manual == FALSE) {
-                               namedevent_handle.set_count = 1;
-                       }
-               }
-               
-               handle = _wapi_handle_new (WAPI_HANDLE_NAMEDEVENT,
-                                          &namedevent_handle);
-
-               if (handle == _WAPI_HANDLE_INVALID) {
-                       g_warning ("%s: error creating event handle", __func__);
-                       SetLastError (ERROR_GEN_FAILURE);
-                       goto cleanup;
-               }
-
-               /* Set the initial state, as this is a completely new
-                * handle
-                */
-               thr_ret = _wapi_handle_lock_handle (handle);
-               g_assert (thr_ret == 0);
-       
-               if (initial == TRUE) {
-                       _wapi_handle_set_signal_state (handle, TRUE, FALSE);
-               }
-
-               thr_ret = _wapi_handle_unlock_handle (handle);
-               g_assert (thr_ret == 0);
+               handle = event_handle_create ((struct _WapiHandle_event*) &namedevent_handle, MONO_W32HANDLE_NAMEDEVENT, manual, initial);
        }
 
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: returning event handle %p", __func__, handle);
-
-cleanup:
        g_free (utf8_name);
 
-       _wapi_namespace_unlock (NULL);
-       
-       return handle;
+       thr_ret = _wapi_namespace_unlock (NULL);
+       g_assert (thr_ret == 0);
 
+       return handle;
 }
 
 
@@ -311,127 +267,13 @@ gpointer CreateEvent(WapiSecurityAttributes *security G_GNUC_UNUSED,
                     gboolean manual, gboolean initial,
                     const gunichar2 *name G_GNUC_UNUSED)
 {
-       mono_once (&event_ops_once, event_ops_init);
-
-       if (name == NULL) {
-               return(event_create (security, manual, initial));
-       } else {
-               return(namedevent_create (security, manual, initial, name));
-       }
-}
-
-static gboolean event_pulse (gpointer handle)
-{
-       struct _WapiHandle_event *event_handle;
-       gboolean ok;
-       int thr_ret;
-       
-       ok = _wapi_lookup_handle (handle, WAPI_HANDLE_EVENT,
-                                 (gpointer *)&event_handle);
-       if (ok == FALSE) {
-               g_warning ("%s: error looking up event handle %p", __func__,
-                          handle);
-               return(FALSE);
-       }
-       
-       thr_ret = _wapi_handle_unlock_handle (handle);
-       g_assert (thr_ret == 0);
-
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Pulsing event handle %p", __func__, handle);
-
-       if (event_handle->manual == TRUE) {
-               _wapi_handle_set_signal_state (handle, TRUE, TRUE);
-       } else {
-               event_handle->set_count = 1;
-               _wapi_handle_set_signal_state (handle, TRUE, FALSE);
-       }
-
-       thr_ret = _wapi_handle_unlock_handle (handle);
-       g_assert (thr_ret == 0);
-       
-       if (event_handle->manual == TRUE) {
-               /* 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.
-                */
-               MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Obtained write lock on event handle %p",
-                          __func__, handle);
-
-               thr_ret = _wapi_handle_lock_handle (handle);
-               g_assert (thr_ret == 0);
-               
-               _wapi_handle_set_signal_state (handle, FALSE, FALSE);
-
-               thr_ret = _wapi_handle_unlock_handle (handle);
-               g_assert (thr_ret == 0);
-       }
-
-       return(TRUE);
-}
-
-static gboolean namedevent_pulse (gpointer handle)
-{
-       struct _WapiHandle_namedevent *namedevent_handle;
-       gboolean ok;
-       int thr_ret;
-       
-       ok = _wapi_lookup_handle (handle, WAPI_HANDLE_NAMEDEVENT,
-                                 (gpointer *)&namedevent_handle);
-       if (ok == FALSE) {
-               g_warning ("%s: error looking up named event handle %p",
-                          __func__, handle);
-               return(FALSE);
-       }
-       
-       thr_ret = _wapi_handle_unlock_handle (handle);
-       g_assert (thr_ret == 0);
-
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Pulsing named event handle %p", __func__, handle);
-
-       if (namedevent_handle->manual == TRUE) {
-               _wapi_handle_set_signal_state (handle, TRUE, TRUE);
-       } else {
-               namedevent_handle->set_count = 1;
-               _wapi_handle_set_signal_state (handle, TRUE, FALSE);
-       }
-
-       thr_ret = _wapi_handle_unlock_handle (handle);
-       g_assert (thr_ret == 0);
-       
-       if (namedevent_handle->manual == TRUE) {
-               /* For a manual-reset event, we're about to try and
-                * get the handle lock again, so give other processes
-                * a chance
-                */
-               _wapi_handle_spin (200);
-
-               /* 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 waiting for
-                * twice the shared handle poll interval.
-                */
-               MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Obtained write lock on event handle %p",
-                          __func__, handle);
-
-               thr_ret = _wapi_handle_lock_handle (handle);
-               g_assert (thr_ret == 0);
-               
-               _wapi_handle_set_signal_state (handle, FALSE, FALSE);
-
-               thr_ret = _wapi_handle_unlock_handle (handle);
-               g_assert (thr_ret == 0);
-       }
+       /* 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(TRUE);
+       return name ? namedevent_create (manual, initial, name) : event_create (manual, initial);
 }
 
 /**
@@ -451,95 +293,65 @@ static gboolean namedevent_pulse (gpointer handle)
  */
 gboolean PulseEvent(gpointer handle)
 {
-       WapiHandleType type;
-       
+       MonoW32HandleType type;
+       struct _WapiHandle_event *event_handle;
+       int thr_ret;
+
        if (handle == NULL) {
                SetLastError (ERROR_INVALID_HANDLE);
                return(FALSE);
        }
-       
-       type = _wapi_handle_type (handle);
-       
-       if (event_ops[type].pulse == NULL) {
+
+       switch (type = mono_w32handle_get_type (handle)) {
+       case MONO_W32HANDLE_EVENT:
+       case MONO_W32HANDLE_NAMEDEVENT:
+               break;
+       default:
                SetLastError (ERROR_INVALID_HANDLE);
-               return(FALSE);
+               return FALSE;
        }
-       
-       return(event_ops[type].pulse (handle));
-}
 
-static gboolean event_reset (gpointer handle)
-{
-       struct _WapiHandle_event *event_handle;
-       gboolean ok;
-       int thr_ret;
-       
-       ok = _wapi_lookup_handle (handle, WAPI_HANDLE_EVENT,
-                                 (gpointer *)&event_handle);
-       if (ok == FALSE) {
-               g_warning ("%s: error looking up event handle %p",
-                          __func__, 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 event handle %p", __func__, handle);
+       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 = _wapi_handle_lock_handle (handle);
+       thr_ret = mono_w32handle_lock_handle (handle);
        g_assert (thr_ret == 0);
-       
-       if (_wapi_handle_issignalled (handle) == FALSE) {
-               MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: No need to reset event handle %p", __func__,
-                          handle);
+
+       if (!event_handle->manual) {
+               event_handle->set_count = 1;
+               mono_w32handle_set_signal_state (handle, TRUE, FALSE);
        } else {
-               MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Obtained write lock on event handle %p",
-                          __func__, handle);
+               mono_w32handle_set_signal_state (handle, TRUE, TRUE);
 
-               _wapi_handle_set_signal_state (handle, FALSE, FALSE);
-       }
-       
-       event_handle->set_count = 0;
-       
-       thr_ret = _wapi_handle_unlock_handle (handle);
-       g_assert (thr_ret == 0);
-       
-       return(TRUE);
-}
+               thr_ret = mono_w32handle_unlock_handle (handle);
+               g_assert (thr_ret == 0);
 
-static gboolean namedevent_reset (gpointer handle)
-{
-       struct _WapiHandle_namedevent *namedevent_handle;
-       gboolean ok;
-       int thr_ret;
-       
-       ok = _wapi_lookup_handle (handle, WAPI_HANDLE_NAMEDEVENT,
-                                 (gpointer *)&namedevent_handle);
-       if (ok == FALSE) {
-               g_warning ("%s: error looking up named event handle %p",
-                          __func__, handle);
-               return(FALSE);
-       }
+               /* For a manual-reset event, we're about to try and get the handle
+                * lock again, so give other threads a chance */
+               sched_yield ();
 
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Resetting named event handle %p", __func__, handle);
+               /* Reset the handle signal state */
 
-       thr_ret = _wapi_handle_lock_handle (handle);
-       g_assert (thr_ret == 0);
-       
-       if (_wapi_handle_issignalled (handle) == FALSE) {
-               MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: No need to reset named event handle %p",
-                          __func__, handle);
-       } else {
-               MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Obtained write lock on named event handle %p",
-                          __func__, handle);
+               /* 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);
 
-               _wapi_handle_set_signal_state (handle, FALSE, FALSE);
+               mono_w32handle_set_signal_state (handle, FALSE, FALSE);
        }
-       
-       namedevent_handle->set_count = 0;
-       
-       thr_ret = _wapi_handle_unlock_handle (handle);
+
+       thr_ret = mono_w32handle_unlock_handle (handle);
        g_assert (thr_ret == 0);
-       
-       return(TRUE);
+
+       return TRUE;
 }
 
 /**
@@ -553,85 +365,54 @@ static gboolean namedevent_reset (gpointer handle)
  */
 gboolean ResetEvent(gpointer handle)
 {
-       WapiHandleType type;
+       MonoW32HandleType type;
+       struct _WapiHandle_event *event_handle;
+       int thr_ret;
+
+       SetLastError (ERROR_SUCCESS);
        
        if (handle == NULL) {
                SetLastError (ERROR_INVALID_HANDLE);
                return(FALSE);
        }
        
-       type = _wapi_handle_type (handle);
-       
-       if (event_ops[type].reset == NULL) {
+       switch (type = mono_w32handle_get_type (handle)) {
+       case MONO_W32HANDLE_EVENT:
+       case MONO_W32HANDLE_NAMEDEVENT:
+               break;
+       default:
                SetLastError (ERROR_INVALID_HANDLE);
-               return(FALSE);
+               return FALSE;
        }
-       
-       return(event_ops[type].reset (handle));
-}
 
-static gboolean event_set (gpointer handle)
-{
-       struct _WapiHandle_event *event_handle;
-       gboolean ok;
-       int thr_ret;
-       
-       ok = _wapi_lookup_handle (handle, WAPI_HANDLE_EVENT,
-                                 (gpointer *)&event_handle);
-       if (ok == FALSE) {
-               g_warning ("%s: error looking up event handle %p", __func__,
-                          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;
        }
-       
-       thr_ret = _wapi_handle_lock_handle (handle);
-       g_assert (thr_ret == 0);
 
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Setting event handle %p", __func__, handle);
-
-       if (event_handle->manual == TRUE) {
-               _wapi_handle_set_signal_state (handle, TRUE, TRUE);
-       } else {
-               event_handle->set_count = 1;
-               _wapi_handle_set_signal_state (handle, TRUE, 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 = _wapi_handle_unlock_handle (handle);
+       thr_ret = mono_w32handle_lock_handle (handle);
        g_assert (thr_ret == 0);
-       
-       return(TRUE);
-}
 
-static gboolean namedevent_set (gpointer handle)
-{
-       struct _WapiHandle_namedevent *namedevent_handle;
-       gboolean ok;
-       int thr_ret;
-       
-       ok = _wapi_lookup_handle (handle, WAPI_HANDLE_NAMEDEVENT,
-                                 (gpointer *)&namedevent_handle);
-       if (ok == FALSE) {
-               g_warning ("%s: error looking up named event handle %p",
-                          __func__, handle);
-               return(FALSE);
-       }
-       
-       thr_ret = _wapi_handle_lock_handle (handle);
-       g_assert (thr_ret == 0);
-
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Setting named event handle %p", __func__, handle);
-
-       if (namedevent_handle->manual == TRUE) {
-               _wapi_handle_set_signal_state (handle, TRUE, TRUE);
+       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 {
-               namedevent_handle->set_count = 1;
-               _wapi_handle_set_signal_state (handle, TRUE, TRUE);
+               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);
        }
 
-       thr_ret = _wapi_handle_unlock_handle (handle);
+       event_handle->set_count = 0;
+
+       thr_ret = mono_w32handle_unlock_handle (handle);
        g_assert (thr_ret == 0);
 
-       return(TRUE);
+       return TRUE;
 }
 
 /**
@@ -650,21 +431,47 @@ static gboolean namedevent_set (gpointer handle)
  */
 gboolean SetEvent(gpointer handle)
 {
-       WapiHandleType type;
+       MonoW32HandleType type;
+       struct _WapiHandle_event *event_handle;
+       int thr_ret;
        
        if (handle == NULL) {
                SetLastError (ERROR_INVALID_HANDLE);
                return(FALSE);
        }
        
-       type = _wapi_handle_type (handle);
-       
-       if (event_ops[type].set == NULL) {
+       switch (type = mono_w32handle_get_type (handle)) {
+       case MONO_W32HANDLE_EVENT:
+       case MONO_W32HANDLE_NAMEDEVENT:
+               break;
+       default:
                SetLastError (ERROR_INVALID_HANDLE);
-               return(FALSE);
+               return FALSE;
        }
-       
-       return(event_ops[type].set (handle));
+
+       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)
@@ -672,8 +479,6 @@ gpointer OpenEvent (guint32 access G_GNUC_UNUSED, gboolean inherit G_GNUC_UNUSED
        gpointer handle;
        gchar *utf8_name;
        int thr_ret;
-       
-       mono_once (&event_ops_once, event_ops_init);
 
        /* w32 seems to guarantee that opening named objects can't
         * race each other
@@ -685,9 +490,9 @@ gpointer OpenEvent (guint32 access G_GNUC_UNUSED, gboolean inherit G_GNUC_UNUSED
        
        MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Opening named event [%s]", __func__, utf8_name);
        
-       handle = _wapi_search_handle_namespace (WAPI_HANDLE_NAMEDEVENT,
+       handle = _wapi_search_handle_namespace (MONO_W32HANDLE_NAMEDEVENT,
                                                utf8_name);
-       if (handle == _WAPI_HANDLE_INVALID) {
+       if (handle == INVALID_HANDLE_VALUE) {
                /* The name has already been used for a different
                 * object.
                 */
diff --git a/mono/io-layer/handles-private.h b/mono/io-layer/handles-private.h
deleted file mode 100644 (file)
index 81b17ea..0000000
+++ /dev/null
@@ -1,294 +0,0 @@
-/*
- * handles-private.h:  Internal operations on handles
- *
- * Author:
- *     Dick Porter (dick@ximian.com)
- *
- * (C) 2002-2006 Novell, Inc.
- */
-
-#ifndef _WAPI_HANDLES_PRIVATE_H_
-#define _WAPI_HANDLES_PRIVATE_H_
-
-#include <config.h>
-#include <glib.h>
-#include <errno.h>
-#include <string.h>
-#include <sys/types.h>
-
-#include <mono/io-layer/wapi-private.h>
-#include <mono/io-layer/shared.h>
-#include <mono/utils/atomic.h>
-
-#define _WAPI_PRIVATE_MAX_SLOTS                (1024 * 16)
-#define _WAPI_PRIVATE_HANDLES(x) (_wapi_private_handles [x / _WAPI_HANDLE_INITIAL_COUNT][x % _WAPI_HANDLE_INITIAL_COUNT])
-#define _WAPI_PRIVATE_HAVE_SLOT(x) ((GPOINTER_TO_UINT (x) / _WAPI_PRIVATE_MAX_SLOTS) < _WAPI_PRIVATE_MAX_SLOTS && \
-                                       _wapi_private_handles [GPOINTER_TO_UINT (x) / _WAPI_HANDLE_INITIAL_COUNT] != NULL)
-#define _WAPI_PRIVATE_VALID_SLOT(x) (((x) / _WAPI_HANDLE_INITIAL_COUNT) < _WAPI_PRIVATE_MAX_SLOTS)
-
-#undef DEBUG
-
-extern struct _WapiHandleUnshared *_wapi_private_handles [];
-
-extern guint32 _wapi_fd_reserve;
-extern gpointer _wapi_global_signal_handle;
-extern mono_mutex_t *_wapi_global_signal_mutex;
-extern mono_cond_t *_wapi_global_signal_cond;
-extern int _wapi_sem_id;
-extern gboolean _wapi_has_shut_down;
-
-extern pid_t _wapi_getpid (void);
-extern gpointer _wapi_handle_new (WapiHandleType type,
-                                 gpointer handle_specific);
-extern gpointer _wapi_handle_new_fd (WapiHandleType type, int fd,
-                                    gpointer handle_specific);
-extern gboolean _wapi_lookup_handle (gpointer handle, WapiHandleType type,
-                                    gpointer *handle_specific);
-extern gpointer _wapi_search_handle (WapiHandleType type,
-                                    gboolean (*check)(gpointer, gpointer),
-                                    gpointer user_data,
-                                    gpointer *handle_specific,
-                                    gboolean search_shared);
-extern gpointer _wapi_search_handle_namespace (WapiHandleType type,
-                                            gchar *utf8_name);
-extern void _wapi_handle_ref (gpointer handle);
-extern void _wapi_handle_unref (gpointer handle);
-extern void _wapi_handle_register_capabilities (WapiHandleType type,
-                                               WapiHandleCapability caps);
-extern gboolean _wapi_handle_test_capabilities (gpointer handle,
-                                               WapiHandleCapability caps);
-extern void _wapi_handle_ops_close (gpointer handle, gpointer data);
-extern void _wapi_handle_ops_signal (gpointer handle);
-extern gboolean _wapi_handle_ops_own (gpointer handle);
-extern gboolean _wapi_handle_ops_isowned (gpointer handle);
-extern guint32 _wapi_handle_ops_special_wait (gpointer handle,
-                                             guint32 timeout,
-                                             gboolean alertable);
-extern void _wapi_handle_ops_prewait (gpointer handle);
-
-extern gboolean _wapi_handle_count_signalled_handles (guint32 numhandles,
-                                                     gpointer *handles,
-                                                     gboolean waitall,
-                                                     guint32 *retcount,
-                                                     guint32 *lowest);
-extern void _wapi_handle_unlock_handles (guint32 numhandles,
-                                        gpointer *handles);
-extern int _wapi_handle_timedwait_signal_handle (gpointer handle, guint32 timeout, gboolean poll, gboolean *alerted);
-extern gboolean _wapi_handle_get_or_set_share (guint64 device, guint64 inode,
-                                              guint32 new_sharemode,
-                                              guint32 new_access,
-                                              guint32 *old_sharemode,
-                                              guint32 *old_access,
-                                              struct _WapiFileShare **info);
-extern void _wapi_handle_dump (void);
-extern void _wapi_handle_foreach (WapiHandleType type,
-                                       gboolean (*on_each)(gpointer test, gpointer user),
-                                       gpointer user_data);
-void _wapi_free_share_info (_WapiFileShare *share_info);
-
-static inline WapiHandleType _wapi_handle_type (gpointer handle)
-{
-       guint32 idx = GPOINTER_TO_UINT(handle);
-       
-       if (!_WAPI_PRIVATE_VALID_SLOT (idx) || !_WAPI_PRIVATE_HAVE_SLOT (idx)) {
-               return(WAPI_HANDLE_UNUSED);     /* An impossible type */
-       }
-       
-       return(_WAPI_PRIVATE_HANDLES(idx).type);
-}
-
-static inline void _wapi_handle_set_signal_state (gpointer handle,
-                                                 gboolean state,
-                                                 gboolean broadcast)
-{
-       guint32 idx = GPOINTER_TO_UINT(handle);
-       struct _WapiHandleUnshared *handle_data;
-       int thr_ret;
-
-       if (!_WAPI_PRIVATE_VALID_SLOT (idx)) {
-               return;
-       }
-
-       handle_data = &_WAPI_PRIVATE_HANDLES(idx);
-       
-#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.
-                */
-               thr_ret = mono_os_mutex_lock (_wapi_global_signal_mutex);
-               if (thr_ret != 0)
-                       g_warning ("Bad call to mono_os_mutex_lock result %d for global signal mutex", thr_ret);
-               g_assert (thr_ret == 0);
-
-               /* This function _must_ be called with
-                * handle->signal_mutex locked
-                */
-               handle_data->signalled=state;
-               
-               if (broadcast == TRUE) {
-                       thr_ret = mono_os_cond_broadcast (&handle_data->signal_cond);
-                       if (thr_ret != 0)
-                               g_warning ("Bad call to mono_os_cond_broadcast result %d for handle %p", thr_ret, handle);
-                       g_assert (thr_ret == 0);
-               } else {
-                       thr_ret = mono_os_cond_signal (&handle_data->signal_cond);
-                       if (thr_ret != 0)
-                               g_warning ("Bad call to mono_os_cond_signal result %d for handle %p", thr_ret, handle);
-                       g_assert (thr_ret == 0);
-               }
-
-               /* Tell everyone blocking on multiple handles that something
-                * was signalled
-                */                     
-               thr_ret = mono_os_cond_broadcast (_wapi_global_signal_cond);
-               if (thr_ret != 0)
-                       g_warning ("Bad call to mono_os_cond_broadcast result %d for handle %p", thr_ret, handle);
-               g_assert (thr_ret == 0);
-                       
-               thr_ret = mono_os_mutex_unlock (_wapi_global_signal_mutex);
-               if (thr_ret != 0)
-                       g_warning ("Bad call to mono_os_mutex_unlock result %d for global signal mutex", thr_ret);
-               g_assert (thr_ret == 0);
-       } else {
-               handle_data->signalled=state;
-       }
-}
-
-static inline gboolean _wapi_handle_issignalled (gpointer handle)
-{
-       guint32 idx = GPOINTER_TO_UINT(handle);
-       
-       if (!_WAPI_PRIVATE_VALID_SLOT (idx)) {
-               return(FALSE);
-       }
-
-       return _WAPI_PRIVATE_HANDLES (idx).signalled;
-}
-
-static inline int _wapi_handle_lock_signal_mutex (void)
-{
-#ifdef DEBUG
-       g_message ("%s: lock global signal mutex", __func__);
-#endif
-
-       return(mono_os_mutex_lock (_wapi_global_signal_mutex));
-}
-
-/* the parameter makes it easier to call from a pthread cleanup handler */
-static inline int _wapi_handle_unlock_signal_mutex (void *unused)
-{
-#ifdef DEBUG
-       g_message ("%s: unlock global signal mutex", __func__);
-#endif
-
-       return(mono_os_mutex_unlock (_wapi_global_signal_mutex));
-}
-
-static inline int _wapi_handle_lock_handle (gpointer handle)
-{
-       guint32 idx = GPOINTER_TO_UINT(handle);
-       
-#ifdef DEBUG
-       g_message ("%s: locking handle %p", __func__, handle);
-#endif
-
-       if (!_WAPI_PRIVATE_VALID_SLOT (idx)) {
-               return(0);
-       }
-       
-       _wapi_handle_ref (handle);
-
-       return(mono_os_mutex_lock (&_WAPI_PRIVATE_HANDLES(idx).signal_mutex));
-}
-
-static inline int _wapi_handle_trylock_handle (gpointer handle)
-{
-       guint32 idx = GPOINTER_TO_UINT(handle);
-       int ret;
-       
-#ifdef DEBUG
-       g_message ("%s: locking handle %p", __func__, handle);
-#endif
-
-       if (!_WAPI_PRIVATE_VALID_SLOT (idx)) {
-               return(0);
-       }
-       
-       _wapi_handle_ref (handle);
-
-       ret = mono_os_mutex_trylock (&_WAPI_PRIVATE_HANDLES(idx).signal_mutex);
-       if (ret != 0) {
-               _wapi_handle_unref (handle);
-       }
-       
-       return(ret);
-}
-
-static inline int _wapi_handle_unlock_handle (gpointer handle)
-{
-       guint32 idx = GPOINTER_TO_UINT(handle);
-       int ret;
-       
-#ifdef DEBUG
-       g_message ("%s: unlocking handle %p", __func__, handle);
-#endif
-       
-       if (!_WAPI_PRIVATE_VALID_SLOT (idx)) {
-               return(0);
-       }
-
-       ret = mono_os_mutex_unlock (&_WAPI_PRIVATE_HANDLES(idx).signal_mutex);
-
-       _wapi_handle_unref (handle);
-       
-       return(ret);
-}
-
-static inline void _wapi_handle_spin (guint32 ms)
-{
-       struct timespec sleepytime;
-       
-       g_assert (ms < 1000);
-       
-       sleepytime.tv_sec = 0;
-       sleepytime.tv_nsec = ms * 1000000;
-       
-       nanosleep (&sleepytime, NULL);
-}
-
-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));
-}
-
-static inline void _wapi_handle_share_release (struct _WapiFileShare *info)
-{
-       int thr_ret;
-
-       g_assert (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);
-
-       if (InterlockedDecrement ((gint32 *)&info->handle_refs) == 0) {
-               _wapi_free_share_info (info);
-       }
-
-       thr_ret = _wapi_shm_sem_unlock (_WAPI_SHARED_SEM_FILESHARE);
-}
-
-#endif /* _WAPI_HANDLES_PRIVATE_H_ */
diff --git a/mono/io-layer/handles.c b/mono/io-layer/handles.c
deleted file mode 100644 (file)
index 0dd3151..0000000
+++ /dev/null
@@ -1,1341 +0,0 @@
-/*
- * handles.c:  Generic and internal operations on 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 <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 <mono/io-layer/wapi.h>
-#include <mono/io-layer/wapi-private.h>
-#include <mono/io-layer/handles-private.h>
-#include <mono/io-layer/shared.h>
-#include <mono/io-layer/process-private.h>
-#include <mono/io-layer/io-trace.h>
-
-#include <mono/utils/mono-os-mutex.h>
-#include <mono/utils/mono-proclib.h>
-#include <mono/utils/mono-threads.h>
-#include <mono/utils/mono-once.h>
-#include <mono/utils/mono-logger-internals.h>
-#undef DEBUG_REFS
-
-static void (*_wapi_handle_ops_get_close_func (WapiHandleType type))(gpointer, gpointer);
-
-static WapiHandleCapability handle_caps[WAPI_HANDLE_COUNT] = { (WapiHandleCapability)0 };
-static struct _WapiHandleOps *handle_ops[WAPI_HANDLE_COUNT]={
-       NULL,
-       &_wapi_file_ops,
-       &_wapi_console_ops,
-       &_wapi_thread_ops,
-       &_wapi_sem_ops,
-       &_wapi_mutex_ops,
-       &_wapi_event_ops,
-#ifndef DISABLE_SOCKETS
-       &_wapi_socket_ops,
-#endif
-       &_wapi_find_ops,
-       &_wapi_process_ops,
-       &_wapi_pipe_ops,
-       &_wapi_namedmutex_ops,
-       &_wapi_namedsem_ops,
-       &_wapi_namedevent_ops,
-};
-
-static void _wapi_shared_details (gpointer handle_info);
-
-static void (*handle_details[WAPI_HANDLE_COUNT])(gpointer) = {
-       NULL,
-       _wapi_file_details,
-       _wapi_console_details,
-       _wapi_shared_details,   /* thread */
-       _wapi_sem_details,
-       _wapi_mutex_details,
-       _wapi_event_details,
-       NULL,                   /* Nothing useful to see in a socket handle */
-       NULL,                   /* Nothing useful to see in a find handle */
-       _wapi_shared_details,   /* process */
-       _wapi_pipe_details,
-       _wapi_shared_details,   /* namedmutex */
-       _wapi_shared_details,   /* namedsem */
-       _wapi_shared_details,   /* namedevent */
-};
-
-const char *_wapi_handle_typename[] = {
-       "Unused",
-       "File",
-       "Console",
-       "Thread",
-       "Sem",
-       "Mutex",
-       "Event",
-       "Socket",
-       "Find",
-       "Process",
-       "Pipe",
-       "N.Mutex",
-       "N.Sem",
-       "N.Event",
-       "Error!!"
-};
-
-/*
- * We can hold _WAPI_PRIVATE_MAX_SLOTS * _WAPI_HANDLE_INITIAL_COUNT handles.
- * If 4M handles are not enough... Oh, well... we will crash.
- */
-#define SLOT_INDEX(x)  (x / _WAPI_HANDLE_INITIAL_COUNT)
-#define SLOT_OFFSET(x) (x % _WAPI_HANDLE_INITIAL_COUNT)
-
-struct _WapiHandleUnshared *_wapi_private_handles [_WAPI_PRIVATE_MAX_SLOTS];
-static guint32 _wapi_private_handle_count = 0;
-static guint32 _wapi_private_handle_slot_count = 0;
-
-/*
- * If SHM is disabled, this will point to a hash of _WapiFileShare structures, otherwise
- * it will be NULL. We use this instead of _wapi_fileshare_layout to avoid allocating a
- * 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)
-
-guint32 _wapi_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.
- */
-gpointer _wapi_global_signal_handle;
-
-/* Point to the mutex/cond inside _wapi_global_signal_handle */
-mono_mutex_t *_wapi_global_signal_mutex;
-mono_cond_t *_wapi_global_signal_cond;
-
-int _wapi_sem_id;
-gboolean _wapi_has_shut_down = FALSE;
-
-/* Use this instead of getpid(), to cope with linuxthreads.  It's a
- * function rather than a variable lookup because we need to get at
- * this before share_init() might have been called.
- */
-static pid_t _wapi_pid;
-static mono_once_t pid_init_once = MONO_ONCE_INIT;
-
-static void _wapi_handle_unref_full (gpointer handle, gboolean ignore_private_busy_handles);
-
-static void pid_init (void)
-{
-       _wapi_pid = getpid ();
-}
-
-pid_t _wapi_getpid (void)
-{
-       mono_once (&pid_init_once, pid_init);
-       
-       return(_wapi_pid);
-}
-
-
-static mono_mutex_t scan_mutex;
-
-static void handle_cleanup (void)
-{
-       int i, j, k;
-       
-       /* 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); _wapi_private_handles[i] != NULL; i++) {
-               for(j = SLOT_OFFSET (0); j < _WAPI_HANDLE_INITIAL_COUNT; j++) {
-                       struct _WapiHandleUnshared *handle_data = &_wapi_private_handles[i][j];
-                       gpointer handle = GINT_TO_POINTER (i*_WAPI_HANDLE_INITIAL_COUNT+j);
-
-                       for(k = handle_data->ref; k > 0; k--) {
-                               _wapi_handle_unref_full (handle, TRUE);
-                       }
-               }
-       }
-       
-       _wapi_shm_semaphores_remove ();
-
-       if (file_share_hash) {
-               g_hash_table_destroy (file_share_hash);
-               mono_os_mutex_destroy (&file_share_hash_mutex);
-       }
-
-       for (i = 0; i < _WAPI_PRIVATE_MAX_SLOTS; ++i)
-               g_free (_wapi_private_handles [i]);
-}
-
-int
-wapi_getdtablesize (void)
-{
-       return eg_getdtablesize ();
-}
-
-/*
- * wapi_init:
- *
- *   Initialize the io-layer.
- */
-void
-wapi_init (void)
-{
-       g_assert ((sizeof (handle_ops) / sizeof (handle_ops[0]))
-                 == WAPI_HANDLE_COUNT);
-
-       _wapi_fd_reserve = wapi_getdtablesize ();
-
-       /* This is needed by the code in _wapi_handle_new_internal */
-       _wapi_fd_reserve = (_wapi_fd_reserve + (_WAPI_HANDLE_INITIAL_COUNT - 1)) & ~(_WAPI_HANDLE_INITIAL_COUNT - 1);
-
-       do {
-               /* 
-                * The entries in _wapi_private_handles reserved for fds are allocated lazily to 
-                * save memory.
-                */
-               /*
-               _wapi_private_handles [idx++] = g_new0 (struct _WapiHandleUnshared,
-                                                       _WAPI_HANDLE_INITIAL_COUNT);
-               */
-
-               _wapi_private_handle_count += _WAPI_HANDLE_INITIAL_COUNT;
-               _wapi_private_handle_slot_count ++;
-       } while(_wapi_fd_reserve > _wapi_private_handle_count);
-
-       _wapi_shm_semaphores_init ();
-
-       _wapi_io_init ();
-       mono_os_mutex_init (&scan_mutex);
-
-       _wapi_global_signal_handle = _wapi_handle_new (WAPI_HANDLE_EVENT, NULL);
-
-       _wapi_global_signal_cond = &_WAPI_PRIVATE_HANDLES (GPOINTER_TO_UINT (_wapi_global_signal_handle)).signal_cond;
-       _wapi_global_signal_mutex = &_WAPI_PRIVATE_HANDLES (GPOINTER_TO_UINT (_wapi_global_signal_handle)).signal_mutex;
-
-       wapi_processes_init ();
-}
-
-void
-wapi_cleanup (void)
-{
-       g_assert (_wapi_has_shut_down == FALSE);
-       
-       _wapi_has_shut_down = TRUE;
-
-       _wapi_error_cleanup ();
-       _wapi_thread_cleanup ();
-       wapi_processes_cleanup ();
-       handle_cleanup ();
-}
-
-static size_t _wapi_handle_struct_size (WapiHandleType type)
-{
-       size_t type_size;
-
-       switch (type) {
-               case WAPI_HANDLE_FILE: case WAPI_HANDLE_CONSOLE: case WAPI_HANDLE_PIPE:
-                       type_size = sizeof (struct _WapiHandle_file);
-                       break;
-               case WAPI_HANDLE_THREAD:
-                       type_size = sizeof (struct _WapiHandle_thread);
-                       break;
-               case WAPI_HANDLE_SEM:
-                       type_size = sizeof (struct _WapiHandle_sem);
-                       break;
-               case WAPI_HANDLE_MUTEX:
-                       type_size = sizeof (struct _WapiHandle_mutex);
-                       break;
-               case WAPI_HANDLE_EVENT:
-                       type_size = sizeof (struct _WapiHandle_event);
-                       break;
-               case WAPI_HANDLE_SOCKET:
-                       type_size = sizeof (struct _WapiHandle_socket);
-                       break;
-               case WAPI_HANDLE_FIND:
-                       type_size = sizeof (struct _WapiHandle_find);
-                       break;
-               case WAPI_HANDLE_PROCESS:
-                       type_size = sizeof (struct _WapiHandle_process);
-                       break;
-               case WAPI_HANDLE_NAMEDMUTEX:
-                       type_size = sizeof (struct _WapiHandle_namedmutex);
-                       break;
-               case WAPI_HANDLE_NAMEDSEM:
-                       type_size = sizeof (struct _WapiHandle_namedsem);
-                       break;
-               case WAPI_HANDLE_NAMEDEVENT:
-                       type_size = sizeof (struct _WapiHandle_namedevent);
-                       break;
-
-               default:
-                       g_error ("Unknown WapiHandleType: %d\n", type);
-       }
-
-       return type_size;
-}
-
-static void _wapi_handle_init (struct _WapiHandleUnshared *handle,
-                              WapiHandleType type, gpointer handle_specific)
-{
-       int thr_ret;
-       int type_size;
-       
-       g_assert (_wapi_has_shut_down == FALSE);
-       
-       handle->type = type;
-       handle->signalled = FALSE;
-       handle->ref = 1;
-       
-       thr_ret = mono_os_cond_init (&handle->signal_cond);
-       g_assert (thr_ret == 0);
-                       
-       thr_ret = mono_os_mutex_init (&handle->signal_mutex);
-       g_assert (thr_ret == 0);
-
-       if (handle_specific != NULL) {
-               type_size = _wapi_handle_struct_size (type);
-               memcpy (&handle->u, handle_specific,
-                       type_size);
-       }
-}
-
-/*
- * _wapi_handle_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
- * _wapi_handle_new, and scan_mutex must be held.
- */
-static guint32 _wapi_handle_new_internal (WapiHandleType type,
-                                         gpointer handle_specific)
-{
-       guint32 i, k, count;
-       static guint32 last = 0;
-       gboolean retry = FALSE;
-       
-       g_assert (_wapi_has_shut_down == 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 < _wapi_fd_reserve) {
-               last = _wapi_fd_reserve;
-       } else {
-               retry = TRUE;
-       }
-
-again:
-       count = last;
-       for(i = SLOT_INDEX (count); i < _wapi_private_handle_slot_count; i++) {
-               if (_wapi_private_handles [i]) {
-                       for (k = SLOT_OFFSET (count); k < _WAPI_HANDLE_INITIAL_COUNT; k++) {
-                               struct _WapiHandleUnshared *handle = &_wapi_private_handles [i][k];
-
-                               if(handle->type == WAPI_HANDLE_UNUSED) {
-                                       last = count + 1;
-                       
-                                       _wapi_handle_init (handle, type, handle_specific);
-                                       return (count);
-                               }
-                               count++;
-                       }
-               }
-       }
-
-       if(retry && last > _wapi_fd_reserve) {
-               /* Try again from the beginning */
-               last = _wapi_fd_reserve;
-               goto again;
-       }
-
-       /* Will need to expand the array.  The caller will sort it out */
-
-       return(0);
-}
-
-gpointer 
-_wapi_handle_new (WapiHandleType type, gpointer handle_specific)
-{
-       guint32 handle_idx = 0;
-       gpointer handle;
-       int thr_ret;
-
-       g_assert (_wapi_has_shut_down == FALSE);
-               
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Creating new handle of type %s", __func__,
-                  _wapi_handle_typename[type]);
-
-       g_assert(!_WAPI_FD_HANDLE(type));
-       
-       thr_ret = mono_os_mutex_lock (&scan_mutex);
-       g_assert (thr_ret == 0);
-               
-       while ((handle_idx = _wapi_handle_new_internal (type, handle_specific)) == 0) {
-               /* Try and expand the array, and have another go */
-               int idx = SLOT_INDEX (_wapi_private_handle_count);
-               if (idx >= _WAPI_PRIVATE_MAX_SLOTS) {
-                       break;
-               }
-
-               _wapi_private_handles [idx] = g_new0 (struct _WapiHandleUnshared,
-                                               _WAPI_HANDLE_INITIAL_COUNT);
-
-               _wapi_private_handle_count += _WAPI_HANDLE_INITIAL_COUNT;
-               _wapi_private_handle_slot_count ++;
-       }
-       
-       thr_ret = mono_os_mutex_unlock (&scan_mutex);
-       g_assert (thr_ret == 0);
-
-       if (handle_idx == 0) {
-               /* We ran out of slots */
-               handle = _WAPI_HANDLE_INVALID;
-               goto done;
-       }
-               
-       /* Make sure we left the space for fd mappings */
-       g_assert (handle_idx >= _wapi_fd_reserve);
-       
-       handle = GUINT_TO_POINTER (handle_idx);
-
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Allocated new handle %p", __func__, handle);
-
-done:
-       return(handle);
-}
-
-static void
-init_handles_slot (int idx)
-{
-       int thr_ret;
-
-       thr_ret = mono_os_mutex_lock (&scan_mutex);
-       g_assert (thr_ret == 0);
-
-       if (_wapi_private_handles [idx] == NULL) {
-               _wapi_private_handles [idx] = g_new0 (struct _WapiHandleUnshared,
-                                                                                         _WAPI_HANDLE_INITIAL_COUNT);
-               g_assert (_wapi_private_handles [idx]);
-       }
-
-       thr_ret = mono_os_mutex_unlock (&scan_mutex);
-       g_assert (thr_ret == 0);
-}
-
-gpointer _wapi_handle_new_fd (WapiHandleType type, int fd,
-                             gpointer handle_specific)
-{
-       struct _WapiHandleUnshared *handle;
-       int thr_ret;
-       
-       g_assert (_wapi_has_shut_down == FALSE);
-       
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Creating new handle of type %s", __func__,
-                  _wapi_handle_typename[type]);
-       
-       g_assert(_WAPI_FD_HANDLE(type));
-
-       if (fd >= _wapi_fd_reserve) {
-               MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: fd %d is too big", __func__, fd);
-
-               return(GUINT_TO_POINTER (_WAPI_HANDLE_INVALID));
-       }
-
-       /* Initialize the array entries on demand */
-       if (_wapi_private_handles [SLOT_INDEX (fd)] == NULL)
-               init_handles_slot (SLOT_INDEX (fd));
-
-       handle = &_WAPI_PRIVATE_HANDLES(fd);
-       
-       if (handle->type != WAPI_HANDLE_UNUSED) {
-               MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%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_IO_LAYER, "%s: Assigning new fd handle %d", __func__, fd);
-
-       /* Prevent file share entries racing with us, when the file
-        * handle is only half initialised
-        */
-       thr_ret = _wapi_shm_sem_lock (_WAPI_SHARED_SEM_FILESHARE);
-       g_assert(thr_ret == 0);
-
-       _wapi_handle_init (handle, type, handle_specific);
-
-       thr_ret = _wapi_shm_sem_unlock (_WAPI_SHARED_SEM_FILESHARE);
-
-       return(GUINT_TO_POINTER(fd));
-}
-
-gboolean 
-_wapi_lookup_handle (gpointer handle, WapiHandleType type,
-                             gpointer *handle_specific)
-{
-       struct _WapiHandleUnshared *handle_data;
-       guint32 handle_idx = GPOINTER_TO_UINT(handle);
-
-       if (!_WAPI_PRIVATE_VALID_SLOT (handle_idx)) {
-               return(FALSE);
-       }
-
-       /* Initialize the array entries on demand */
-       if (_wapi_private_handles [SLOT_INDEX (handle_idx)] == NULL)
-               init_handles_slot (SLOT_INDEX (handle_idx));
-       
-       handle_data = &_WAPI_PRIVATE_HANDLES(handle_idx);
-       
-       if (handle_data->type != type) {
-               return(FALSE);
-       }
-
-       if (handle_specific == NULL) {
-               return(FALSE);
-       }
-       
-       *handle_specific = &handle_data->u;
-       
-       return(TRUE);
-}
-
-void
-_wapi_handle_foreach (WapiHandleType type,
-                       gboolean (*on_each)(gpointer test, gpointer user),
-                       gpointer user_data)
-{
-       struct _WapiHandleUnshared *handle_data = NULL;
-       gpointer ret = NULL;
-       guint32 i, k;
-       int thr_ret;
-
-       thr_ret = mono_os_mutex_lock (&scan_mutex);
-       g_assert (thr_ret == 0);
-
-       for (i = SLOT_INDEX (0); i < _wapi_private_handle_slot_count; i++) {
-               if (_wapi_private_handles [i]) {
-                       for (k = SLOT_OFFSET (0); k < _WAPI_HANDLE_INITIAL_COUNT; k++) {
-                               handle_data = &_wapi_private_handles [i][k];
-                       
-                               if (handle_data->type == type) {
-                                       ret = GUINT_TO_POINTER (i * _WAPI_HANDLE_INITIAL_COUNT + k);
-                                       if (on_each (ret, user_data) == TRUE)
-                                               break;
-                               }
-                       }
-               }
-       }
-
-       thr_ret = mono_os_mutex_unlock (&scan_mutex);
-       g_assert (thr_ret == 0);
-}
-
-/* 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 _wapi_search_handle (WapiHandleType type,
-                             gboolean (*check)(gpointer test, gpointer user),
-                             gpointer user_data,
-                             gpointer *handle_specific,
-                             gboolean search_shared)
-{
-       struct _WapiHandleUnshared *handle_data = NULL;
-       gpointer ret = NULL;
-       guint32 i, k;
-       gboolean found = FALSE;
-       int thr_ret;
-
-       thr_ret = mono_os_mutex_lock (&scan_mutex);
-       g_assert (thr_ret == 0);
-       
-       for (i = SLOT_INDEX (0); !found && i < _wapi_private_handle_slot_count; i++) {
-               if (_wapi_private_handles [i]) {
-                       for (k = SLOT_OFFSET (0); k < _WAPI_HANDLE_INITIAL_COUNT; k++) {
-                               handle_data = &_wapi_private_handles [i][k];
-               
-                               if (handle_data->type == type) {
-                                       ret = GUINT_TO_POINTER (i * _WAPI_HANDLE_INITIAL_COUNT + k);
-                                       if (check (ret, user_data) == TRUE) {
-                                               _wapi_handle_ref (ret);
-                                               found = TRUE;
-                                               break;
-                                       }
-                               }
-                       }
-               }
-       }
-
-       thr_ret = mono_os_mutex_unlock (&scan_mutex);
-       g_assert (thr_ret == 0);
-
-       if (!found) {
-               ret = NULL;
-               goto done;
-       }
-       
-       if(handle_specific != NULL) {
-               *handle_specific = &handle_data->u;
-       }
-
-done:
-       return(ret);
-}
-
-/* Returns the offset of the metadata array, or _WAPI_HANDLE_INVALID on error, or NULL for
- * not found
- */
-gpointer _wapi_search_handle_namespace (WapiHandleType type,
-                                     gchar *utf8_name)
-{
-       struct _WapiHandleUnshared *handle_data;
-       guint32 i, k;
-       gpointer ret = NULL;
-       int thr_ret;
-       
-       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, _wapi_handle_typename[type]);
-
-       thr_ret = mono_os_mutex_lock (&scan_mutex);
-       g_assert (thr_ret == 0);
-       
-       for(i = SLOT_INDEX (0); i < _wapi_private_handle_slot_count; i++) {
-               if (!_wapi_private_handles [i])
-                       continue;
-               for (k = SLOT_OFFSET (0); k < _WAPI_HANDLE_INITIAL_COUNT; k++) {
-                       WapiSharedNamespace *sharedns;
-                       
-                       handle_data = &_wapi_private_handles [i][k];
-
-                       /* Check mutex, event, semaphore, timer, job and
-                        * file-mapping object names.  So far only mutex,
-                        * semaphore and event are implemented.
-                        */
-                       if (!_WAPI_SHARED_NAMESPACE (handle_data->type)) {
-                               continue;
-                       }
-
-                       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: found a shared namespace handle at 0x%x (type %s)", __func__, i, _wapi_handle_typename[handle_data->type]);
-
-                       sharedns=(WapiSharedNamespace *)&handle_data->u;
-                               
-                       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: name is [%s]", __func__, sharedns->name);
-
-                       if (strcmp (sharedns->name, utf8_name) == 0) {
-                               if (handle_data->type != type) {
-                                       /* Its the wrong type, so fail now */
-                                       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle 0x%x matches name but is wrong type: %s", __func__, i, _wapi_handle_typename[handle_data->type]);
-                                       ret = _WAPI_HANDLE_INVALID;
-                                       goto done;
-                               } else {
-                                       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle 0x%x matches name and type", __func__, i);
-                                       ret = handle_data;
-                                       goto done;
-                               }
-                       }
-               }
-       }
-
-done:
-       thr_ret = mono_os_mutex_unlock (&scan_mutex);
-       g_assert (thr_ret == 0);
-       
-       return(ret);
-}
-
-void _wapi_handle_ref (gpointer handle)
-{
-       guint32 idx = GPOINTER_TO_UINT(handle);
-       struct _WapiHandleUnshared *handle_data;
-
-       if (!_WAPI_PRIVATE_VALID_SLOT (idx)) {
-               MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Attempting to ref invalid private handle %p", __func__, handle);
-               return;
-       }
-       
-       if (_wapi_handle_type (handle) == WAPI_HANDLE_UNUSED) {
-               MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Attempting to ref unused handle %p", __func__, handle);
-               return;
-       }
-
-       handle_data = &_WAPI_PRIVATE_HANDLES(idx);
-       
-       InterlockedIncrement ((gint32 *)&handle_data->ref);
-       
-#ifdef DEBUG_REFS
-       g_message ("%s: %s handle %p ref now %d", __func__, 
-                  _wapi_handle_typename[_WAPI_PRIVATE_HANDLES (idx).type],
-                  handle,
-                  _WAPI_PRIVATE_HANDLES(idx).ref);
-#endif
-}
-
-/* The handle must not be locked on entry to this function */
-static void _wapi_handle_unref_full (gpointer handle, gboolean ignore_private_busy_handles)
-{
-       guint32 idx = GPOINTER_TO_UINT(handle);
-       gboolean destroy = FALSE, early_exit = FALSE;
-       int thr_ret;
-
-       if (!_WAPI_PRIVATE_VALID_SLOT (idx)) {
-               return;
-       }
-       
-       if (_wapi_handle_type (handle) == WAPI_HANDLE_UNUSED) {
-               g_warning ("%s: Attempting to unref unused 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 *)&_WAPI_PRIVATE_HANDLES(idx).ref) ==0);
-       
-#ifdef DEBUG_REFS
-       g_message ("%s: %s handle %p ref now %d (destroy %s)", __func__,
-                  _wapi_handle_typename[_WAPI_PRIVATE_HANDLES (idx).type],
-                  handle,
-                  _WAPI_PRIVATE_HANDLES(idx).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())
-                */
-               struct _WapiHandleUnshared handle_data;
-               WapiHandleType type = _WAPI_PRIVATE_HANDLES(idx).type;
-               void (*close_func)(gpointer, gpointer) = _wapi_handle_ops_get_close_func (type);
-
-               thr_ret = mono_os_mutex_lock (&scan_mutex);
-
-               MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Destroying handle %p", __func__, handle);
-               
-               memcpy (&handle_data, &_WAPI_PRIVATE_HANDLES(idx),
-                       sizeof (struct _WapiHandleUnshared));
-
-               memset (&_WAPI_PRIVATE_HANDLES(idx).u, '\0',
-                       sizeof(_WAPI_PRIVATE_HANDLES(idx).u));
-
-               _WAPI_PRIVATE_HANDLES(idx).type = WAPI_HANDLE_UNUSED;
-
-               /* 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 (&_WAPI_PRIVATE_HANDLES(idx).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 (&_WAPI_PRIVATE_HANDLES(idx).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);
-               }
-
-               thr_ret = mono_os_mutex_unlock (&scan_mutex);
-               g_assert (thr_ret == 0);
-
-               if (early_exit)
-                       return;
-               
-               if (close_func != NULL) {
-                       close_func (handle, &handle_data.u);
-               }
-       }
-}
-
-void _wapi_handle_unref (gpointer handle)
-{
-       _wapi_handle_unref_full (handle, FALSE);
-}
-
-void _wapi_handle_register_capabilities (WapiHandleType type,
-                                        WapiHandleCapability caps)
-{
-       handle_caps[type] = caps;
-}
-
-gboolean _wapi_handle_test_capabilities (gpointer handle,
-                                        WapiHandleCapability caps)
-{
-       guint32 idx = GPOINTER_TO_UINT(handle);
-       WapiHandleType type;
-
-       if (!_WAPI_PRIVATE_VALID_SLOT (idx)) {
-               return(FALSE);
-       }
-       
-       type = _WAPI_PRIVATE_HANDLES(idx).type;
-
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%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 (WapiHandleType type))(gpointer, gpointer)
-{
-       if (handle_ops[type] != NULL &&
-           handle_ops[type]->close != NULL) {
-               return (handle_ops[type]->close);
-       }
-
-       return (NULL);
-}
-
-void _wapi_handle_ops_close (gpointer handle, gpointer data)
-{
-       guint32 idx = GPOINTER_TO_UINT(handle);
-       WapiHandleType type;
-
-       if (!_WAPI_PRIVATE_VALID_SLOT (idx)) {
-               return;
-       }
-       
-       type = _WAPI_PRIVATE_HANDLES(idx).type;
-
-       if (handle_ops[type] != NULL &&
-           handle_ops[type]->close != NULL) {
-               handle_ops[type]->close (handle, data);
-       }
-}
-
-void _wapi_handle_ops_signal (gpointer handle)
-{
-       guint32 idx = GPOINTER_TO_UINT(handle);
-       WapiHandleType type;
-
-       if (!_WAPI_PRIVATE_VALID_SLOT (idx)) {
-               return;
-       }
-       
-       type = _WAPI_PRIVATE_HANDLES(idx).type;
-
-       if (handle_ops[type] != NULL && handle_ops[type]->signal != NULL) {
-               handle_ops[type]->signal (handle);
-       }
-}
-
-gboolean _wapi_handle_ops_own (gpointer handle)
-{
-       guint32 idx = GPOINTER_TO_UINT(handle);
-       WapiHandleType type;
-       
-       if (!_WAPI_PRIVATE_VALID_SLOT (idx)) {
-               return(FALSE);
-       }
-       
-       type = _WAPI_PRIVATE_HANDLES(idx).type;
-
-       if (handle_ops[type] != NULL && handle_ops[type]->own_handle != NULL) {
-               return(handle_ops[type]->own_handle (handle));
-       } else {
-               return(FALSE);
-       }
-}
-
-gboolean _wapi_handle_ops_isowned (gpointer handle)
-{
-       guint32 idx = GPOINTER_TO_UINT(handle);
-       WapiHandleType type;
-
-       if (!_WAPI_PRIVATE_VALID_SLOT (idx)) {
-               return(FALSE);
-       }
-       
-       type = _WAPI_PRIVATE_HANDLES(idx).type;
-
-       if (handle_ops[type] != NULL && handle_ops[type]->is_owned != NULL) {
-               return(handle_ops[type]->is_owned (handle));
-       } else {
-               return(FALSE);
-       }
-}
-
-guint32 _wapi_handle_ops_special_wait (gpointer handle, guint32 timeout, gboolean alertable)
-{
-       guint32 idx = GPOINTER_TO_UINT(handle);
-       WapiHandleType type;
-       
-       if (!_WAPI_PRIVATE_VALID_SLOT (idx)) {
-               return(WAIT_FAILED);
-       }
-       
-       type = _WAPI_PRIVATE_HANDLES(idx).type;
-       
-       if (handle_ops[type] != NULL &&
-           handle_ops[type]->special_wait != NULL) {
-               return(handle_ops[type]->special_wait (handle, timeout, alertable));
-       } else {
-               return(WAIT_FAILED);
-       }
-}
-
-void _wapi_handle_ops_prewait (gpointer handle)
-{
-       guint32 idx = GPOINTER_TO_UINT (handle);
-       WapiHandleType type;
-       
-       if (!_WAPI_PRIVATE_VALID_SLOT (idx)) {
-               return;
-       }
-       
-       type = _WAPI_PRIVATE_HANDLES (idx).type;
-       
-       if (handle_ops[type] != NULL &&
-           handle_ops[type]->prewait != NULL) {
-               handle_ops[type]->prewait (handle);
-       }
-}
-
-
-/**
- * CloseHandle:
- * @handle: The handle to release
- *
- * Closes and invalidates @handle, releasing any resources it
- * consumes.  When the last handle to a temporary or non-persistent
- * object is closed, that object can be deleted.  Closing the same
- * handle twice is an error.
- *
- * Return value: %TRUE on success, %FALSE otherwise.
- */
-gboolean CloseHandle(gpointer handle)
-{
-       if (handle == NULL) {
-               /* Problem: because we map file descriptors to the
-                * same-numbered handle we can't tell the difference
-                * between a bogus handle and the handle to stdin.
-                * Assume that it's the console handle if that handle
-                * exists...
-                */
-               if (_WAPI_PRIVATE_HANDLES (0).type != WAPI_HANDLE_CONSOLE) {
-                       SetLastError (ERROR_INVALID_PARAMETER);
-                       return(FALSE);
-               }
-       }
-       if (handle == _WAPI_HANDLE_INVALID){
-               SetLastError (ERROR_INVALID_PARAMETER);
-               return(FALSE);
-       }
-       
-       _wapi_handle_unref (handle);
-       
-       return(TRUE);
-}
-
-/* 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 if (src == _WAPI_THREAD_CURRENT) {
-               g_assert_not_reached ();
-       } else {
-               _wapi_handle_ref (src);
-               *target = src;
-       }
-       
-       return(TRUE);
-}
-
-gboolean _wapi_handle_count_signalled_handles (guint32 numhandles,
-                                              gpointer *handles,
-                                              gboolean waitall,
-                                              guint32 *retcount,
-                                              guint32 *lowest)
-{
-       guint32 count, i, iter=0;
-       gboolean ret;
-       int thr_ret;
-       WapiHandleType type;
-       
-       /* Lock all the handles, with backoff */
-again:
-       for(i=0; i<numhandles; i++) {
-               gpointer handle = handles[i];
-               guint32 idx = GPOINTER_TO_UINT(handle);
-
-               MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: attempting to lock %p", __func__, handle);
-
-               type = _WAPI_PRIVATE_HANDLES(idx).type;
-
-               thr_ret = _wapi_handle_trylock_handle (handle);
-               
-               if (thr_ret != 0) {
-                       /* Bummer */
-                       
-                       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: attempt failed for %p: %s", __func__,
-                                  handle, strerror (thr_ret));
-
-                       while (i--) {
-                               handle = handles[i];
-                               idx = GPOINTER_TO_UINT(handle);
-
-                               thr_ret = _wapi_handle_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_IO_LAYER, "%s: Backing off for %d ms", __func__,
-                                  iter*10);
-                       _wapi_handle_spin (10 * iter);
-                       
-                       goto again;
-               }
-       }
-       
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Locked all handles", __func__);
-
-       count=0;
-       *lowest=numhandles;
-       
-       for(i=0; i<numhandles; i++) {
-               gpointer handle = handles[i];
-               guint32 idx = GPOINTER_TO_UINT(handle);
-               
-               type = _WAPI_PRIVATE_HANDLES(idx).type;
-
-               MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Checking handle %p", __func__, handle);
-
-               if(((_wapi_handle_test_capabilities (handle, WAPI_HANDLE_CAP_OWN)==TRUE) &&
-                   (_wapi_handle_ops_isowned (handle) == TRUE)) ||
-                  (_wapi_handle_issignalled (handle))) {
-                       count++;
-                       
-                       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Handle %p signalled", __func__,
-                                  handle);
-                       if(*lowest>i) {
-                               *lowest=i;
-                       }
-               }
-       }
-       
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%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_IO_LAYER, "%s: Returning %d", __func__, ret);
-
-       *retcount=count;
-       
-       return(ret);
-}
-
-void _wapi_handle_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_IO_LAYER, "%s: unlocking handle %p", __func__, handle);
-
-               thr_ret = _wapi_handle_unlock_handle (handle);
-               g_assert (thr_ret == 0);
-       }
-}
-
-static void
-signal_handle_and_unref (gpointer handle)
-{
-       mono_cond_t *cond;
-       mono_mutex_t *mutex;
-       guint32 idx;
-
-       g_assert (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. */
-       idx = GPOINTER_TO_UINT (handle);
-       cond = &_WAPI_PRIVATE_HANDLES (idx).signal_cond;
-       mutex = &_WAPI_PRIVATE_HANDLES (idx).signal_mutex;
-
-       mono_os_mutex_lock (mutex);
-       mono_os_cond_broadcast (cond);
-       mono_os_mutex_unlock (mutex);
-
-       _wapi_handle_unref (handle);
-}
-
-int
-_wapi_handle_timedwait_signal_handle (gpointer handle, guint32 timeout, gboolean poll, gboolean *alerted)
-{
-       guint32 idx;
-       int res;
-       mono_cond_t *cond;
-       mono_mutex_t *mutex;
-
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: waiting for %p (type %s)", __func__, handle,
-                  _wapi_handle_typename[_wapi_handle_type (handle)]);
-
-       if (alerted)
-               *alerted = FALSE;
-
-       idx = GPOINTER_TO_UINT(handle);
-
-       if (alerted) {
-               mono_thread_info_install_interrupt (signal_handle_and_unref, handle, alerted);
-               if (*alerted)
-                       return 0;
-               _wapi_handle_ref (handle);
-       }
-
-       cond = &_WAPI_PRIVATE_HANDLES (idx).signal_cond;
-       mutex = &_WAPI_PRIVATE_HANDLES (idx).signal_mutex;
-
-       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 == ETIMEDOUT)
-                                       res = 0;
-                       }
-               }
-       }
-
-       if (alerted) {
-               mono_thread_info_uninstall_interrupt (alerted);
-               if (!*alerted) {
-                       /* if it is alerted, then the handle is unref in the interrupt callback */
-                       _wapi_handle_unref (handle);
-               }
-       }
-
-       return res;
-}
-
-void
-_wapi_free_share_info (_WapiFileShare *share_info)
-{
-       file_share_hash_lock ();
-       g_hash_table_remove (file_share_hash, share_info);
-       file_share_hash_unlock ();
-       /* The hashtable dtor frees share_info */
-}
-
-static gint
-wapi_share_info_equal (gconstpointer ka, gconstpointer kb)
-{
-       const _WapiFileShare *s1 = (const _WapiFileShare *)ka;
-       const _WapiFileShare *s2 = (const _WapiFileShare *)kb;
-
-       return (s1->device == s2->device && s1->inode == s2->inode) ? 1 : 0;
-}
-
-static guint
-wapi_share_info_hash (gconstpointer data)
-{
-       const _WapiFileShare *s = (const _WapiFileShare *)data;
-
-       return s->inode;
-}
-
-gboolean _wapi_handle_get_or_set_share (guint64 device, guint64 inode,
-                                       guint32 new_sharemode,
-                                       guint32 new_access,
-                                       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);
-
-       _WapiFileShare tmp;
-
-       /*
-        * Instead of allocating a 4MB array, we use a hash table to keep track of this
-        * info. This is needed even if SHM is disabled, to track sharing inside
-        * the current process.
-        */
-       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);
-               exists = TRUE;
-       } else {
-               file_share = g_new0 (_WapiFileShare, 1);
-
-               file_share->device = device;
-               file_share->inode = inode;
-               file_share->opened_by_pid = _wapi_getpid ();
-               file_share->sharemode = new_sharemode;
-               file_share->access = new_access;
-               file_share->handle_refs = 1;
-               *share_info = file_share;
-
-               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);
-
-       return(exists);
-}
-
-void _wapi_handle_dump (void)
-{
-       struct _WapiHandleUnshared *handle_data;
-       guint32 i, k;
-       int thr_ret;
-       
-       thr_ret = mono_os_mutex_lock (&scan_mutex);
-       g_assert (thr_ret == 0);
-       
-       for(i = SLOT_INDEX (0); i < _wapi_private_handle_slot_count; i++) {
-               if (_wapi_private_handles [i]) {
-                       for (k = SLOT_OFFSET (0); k < _WAPI_HANDLE_INITIAL_COUNT; k++) {
-                               handle_data = &_wapi_private_handles [i][k];
-
-                               if (handle_data->type == WAPI_HANDLE_UNUSED) {
-                                       continue;
-                               }
-               
-                               g_print ("%3x [%7s] %s %d ",
-                                                i * _WAPI_HANDLE_INITIAL_COUNT + k,
-                                                _wapi_handle_typename[handle_data->type],
-                                                handle_data->signalled?"Sg":"Un",
-                                                handle_data->ref);
-                               if (handle_details[handle_data->type])
-                                       handle_details[handle_data->type](&handle_data->u);
-                               g_print ("\n");
-                       }
-               }
-       }
-
-       thr_ret = mono_os_mutex_unlock (&scan_mutex);
-       g_assert (thr_ret == 0);
-}
-
-static void _wapi_shared_details (gpointer handle_info)
-{
-       struct _WapiHandle_shared_ref *shared = (struct _WapiHandle_shared_ref *)handle_info;
-       
-       g_print ("offset: 0x%x", shared->offset);
-}
diff --git a/mono/io-layer/handles.h b/mono/io-layer/handles.h
deleted file mode 100644 (file)
index 31cab7b..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * handles.h:  Generic operations on handles
- *
- * Author:
- *     Dick Porter (dick@ximian.com)
- *
- * (C) 2002 Ximian, Inc.
- */
-
-#ifndef _WAPI_HANDLES_H_
-#define _WAPI_HANDLES_H_
-
-#define INVALID_HANDLE_VALUE (gpointer)-1
-
-G_BEGIN_DECLS
-
-extern gboolean CloseHandle (gpointer handle);
-extern gboolean DuplicateHandle (gpointer srcprocess, gpointer src, gpointer targetprocess, gpointer *target, guint32 access, gboolean inherit, guint32 options);
-
-extern void wapi_init (void);
-extern void wapi_cleanup (void);
-
-int wapi_getdtablesize (void);
-
-G_END_DECLS
-
-#endif /* _WAPI_HANDLES_H_ */
index 9af4b1f0a11f0c4d65152b1b5ab7eccdc75b3168..392b081ca798927e41c67fbd9c824fa17fd6fd97 100644 (file)
 #include <mono/io-layer/io.h>
 #include <mono/io-layer/wapi-private.h>
 
-extern struct _WapiHandleOps _wapi_file_ops;
-extern struct _WapiHandleOps _wapi_console_ops;
-extern struct _WapiHandleOps _wapi_find_ops;
-extern struct _WapiHandleOps _wapi_pipe_ops;
-
 extern gboolean _wapi_lock_file_region (int fd, off_t offset, off_t length);
 extern gboolean _wapi_unlock_file_region (int fd, off_t offset, off_t length);
-extern void _wapi_file_details (gpointer handle_info);
-extern void _wapi_console_details (gpointer handle_info);
-extern void _wapi_pipe_details (gpointer handle_info);
 extern gpointer _wapi_stdhandle_create (int fd, const gchar *name);
 
 /* Currently used for both FILE, CONSOLE and PIPE handle types.  This may
index f67ff65f842d42f6ab847bf40d867d4f49dce97c..e65fdc345a336f6c846e577b47b359a85c393813 100644 (file)
@@ -13,6 +13,7 @@
 #ifdef DISABLE_IO_LAYER_TRACE
 #define MONO_TRACE(...)
 #else
+#include "mono/utils/mono-logger-internals.h"
 #define MONO_TRACE(...) mono_trace (__VA_ARGS__)
 #endif
 
index 145529ed53203992eb78769dea054d0ca7d5b780..3a275dc83513af2c1aedabb890fa8a763fc29d61 100644 (file)
 
 #include <mono/io-layer/wapi.h>
 #include <mono/io-layer/wapi-private.h>
-#include <mono/io-layer/handles-private.h>
 #include <mono/io-layer/io-private.h>
 #include <mono/io-layer/timefuncs-private.h>
-#include <mono/io-layer/thread-private.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>
+
+/*
+ * If SHM is disabled, this will point to a hash of _WapiFileShare structures, otherwise
+ * it will be NULL. We use this instead of _wapi_fileshare_layout to avoid allocating a
+ * 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 void
+_wapi_handle_share_release (_WapiFileShare *share_info)
+{
+       int thr_ret;
+
+       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);
+
+       if (InterlockedDecrement ((gint32 *)&share_info->handle_refs) == 0) {
+               file_share_hash_lock ();
+               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);
+}
+
+static gint
+wapi_share_info_equal (gconstpointer ka, gconstpointer kb)
+{
+       const _WapiFileShare *s1 = (const _WapiFileShare *)ka;
+       const _WapiFileShare *s2 = (const _WapiFileShare *)kb;
+
+       return (s1->device == s2->device && s1->inode == s2->inode) ? 1 : 0;
+}
+
+static guint
+wapi_share_info_hash (gconstpointer data)
+{
+       const _WapiFileShare *s = (const _WapiFileShare *)data;
+
+       return s->inode;
+}
+
+static gboolean
+_wapi_handle_get_or_set_share (guint64 device, guint64 inode, guint32 new_sharemode, guint32 new_access,
+       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);
+
+       _WapiFileShare tmp;
+
+       /*
+        * Instead of allocating a 4MB array, we use a hash table to keep track of this
+        * info. This is needed even if SHM is disabled, to track sharing inside
+        * the current process.
+        */
+       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);
+               exists = TRUE;
+       } else {
+               file_share = g_new0 (_WapiFileShare, 1);
+
+               file_share->device = device;
+               file_share->inode = inode;
+               file_share->opened_by_pid = wapi_getpid ();
+               file_share->sharemode = new_sharemode;
+               file_share->access = new_access;
+               file_share->handle_refs = 1;
+               *share_info = file_share;
+
+               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);
+
+       return(exists);
+}
 
 static void file_close (gpointer handle, gpointer data);
+static void file_details (gpointer data);
+static const gchar* file_typename (void);
+static gsize file_typesize (void);
 static WapiFileType file_getfiletype(void);
 static gboolean file_read(gpointer handle, gpointer buffer,
                          guint32 numbytes, guint32 *bytesread,
@@ -71,31 +181,22 @@ static gboolean file_setfiletime(gpointer handle,
 static guint32 GetDriveTypeFromPath (const gchar *utf8_root_path_name);
 
 /* File handle is only signalled for overlapped IO */
-struct _WapiHandleOps _wapi_file_ops = {
+static MonoW32HandleOps _wapi_file_ops = {
        file_close,             /* close */
        NULL,                   /* signal */
        NULL,                   /* own */
        NULL,                   /* is_owned */
        NULL,                   /* special_wait */
-       NULL                    /* prewait */
+       NULL,                   /* prewait */
+       file_details,   /* details */
+       file_typename,  /* typename */
+       file_typesize,  /* typesize */
 };
 
-void _wapi_file_details (gpointer handle_info)
-{
-       struct _WapiHandle_file *file = (struct _WapiHandle_file *)handle_info;
-       
-       g_print ("[%20s] acc: %c%c%c, shr: %c%c%c, attrs: %5u",
-                file->filename,
-                file->fileaccess&GENERIC_READ?'R':'.',
-                file->fileaccess&GENERIC_WRITE?'W':'.',
-                file->fileaccess&GENERIC_EXECUTE?'X':'.',
-                file->sharemode&FILE_SHARE_READ?'R':'.',
-                file->sharemode&FILE_SHARE_WRITE?'W':'.',
-                file->sharemode&FILE_SHARE_DELETE?'D':'.',
-                file->attrs);
-}
-
 static void console_close (gpointer handle, gpointer data);
+static void console_details (gpointer data);
+static const gchar* console_typename (void);
+static gsize console_typesize (void);
 static WapiFileType console_getfiletype(void);
 static gboolean console_read(gpointer handle, gpointer buffer,
                             guint32 numbytes, guint32 *bytesread,
@@ -107,32 +208,37 @@ static gboolean console_write(gpointer handle, gconstpointer buffer,
 /* Console is mostly the same as file, except it can block waiting for
  * input or output
  */
-struct _WapiHandleOps _wapi_console_ops = {
+static MonoW32HandleOps _wapi_console_ops = {
        console_close,          /* close */
        NULL,                   /* signal */
        NULL,                   /* own */
        NULL,                   /* is_owned */
        NULL,                   /* special_wait */
-       NULL                    /* prewait */
+       NULL,                   /* prewait */
+       console_details,        /* details */
+       console_typename,       /* typename */
+       console_typesize,       /* typesize */
 };
 
-void _wapi_console_details (gpointer handle_info)
-{
-       _wapi_file_details (handle_info);
-}
+static const gchar* find_typename (void);
+static gsize find_typesize (void);
 
-/* Find handle has no ops.
- */
-struct _WapiHandleOps _wapi_find_ops = {
+static MonoW32HandleOps _wapi_find_ops = {
        NULL,                   /* close */
        NULL,                   /* signal */
        NULL,                   /* own */
        NULL,                   /* is_owned */
        NULL,                   /* special_wait */
-       NULL                    /* prewait */
+       NULL,                   /* prewait */
+       NULL,                   /* details */
+       find_typename,  /* typename */
+       find_typesize,  /* typesize */
 };
 
 static void pipe_close (gpointer handle, gpointer data);
+static void pipe_details (gpointer data);
+static const gchar* pipe_typename (void);
+static gsize pipe_typesize (void);
 static WapiFileType pipe_getfiletype (void);
 static gboolean pipe_read (gpointer handle, gpointer buffer, guint32 numbytes,
                           guint32 *bytesread, WapiOverlapped *overlapped);
@@ -142,20 +248,18 @@ static gboolean pipe_write (gpointer handle, gconstpointer buffer,
 
 /* Pipe handles
  */
-struct _WapiHandleOps _wapi_pipe_ops = {
+static MonoW32HandleOps _wapi_pipe_ops = {
        pipe_close,             /* close */
        NULL,                   /* signal */
        NULL,                   /* own */
        NULL,                   /* is_owned */
        NULL,                   /* special_wait */
-       NULL                    /* prewait */
+       NULL,                   /* prewait */
+       pipe_details,   /* details */
+       pipe_typename,  /* typename */
+       pipe_typesize,  /* typesize */
 };
 
-void _wapi_pipe_details (gpointer handle_info)
-{
-       _wapi_file_details (handle_info);
-}
-
 static const struct {
        /* File, console and pipe handles */
        WapiFileType (*getfiletype)(void);
@@ -181,7 +285,7 @@ static const struct {
                                const WapiFileTime *create_time,
                                const WapiFileTime *last_access,
                                const WapiFileTime *last_write);
-} io_ops[WAPI_HANDLE_COUNT]={
+} io_ops[MONO_W32HANDLE_COUNT]={
        {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
        /* file */
        {file_getfiletype,
@@ -217,21 +321,8 @@ static const struct {
         NULL, NULL, NULL, NULL, NULL, NULL},
 };
 
-static mono_once_t io_ops_once=MONO_ONCE_INIT;
 static gboolean lock_while_writing = FALSE;
 
-static void io_ops_init (void)
-{
-/*     _wapi_handle_register_capabilities (WAPI_HANDLE_FILE, */
-/*                                         WAPI_HANDLE_CAP_WAIT); */
-/*     _wapi_handle_register_capabilities (WAPI_HANDLE_CONSOLE, */
-/*                                         WAPI_HANDLE_CAP_WAIT); */
-
-       if (g_getenv ("MONO_STRICT_IO_EMULATION") != NULL) {
-               lock_while_writing = TRUE;
-       }
-}
-
 /* Some utility functions.
  */
 
@@ -384,6 +475,31 @@ static void file_close (gpointer handle, gpointer data)
        close (fd);
 }
 
+static void file_details (gpointer data)
+{
+       struct _WapiHandle_file *file = (struct _WapiHandle_file *)data;
+       
+       g_print ("[%20s] acc: %c%c%c, shr: %c%c%c, attrs: %5u",
+                file->filename,
+                file->fileaccess&GENERIC_READ?'R':'.',
+                file->fileaccess&GENERIC_WRITE?'W':'.',
+                file->fileaccess&GENERIC_EXECUTE?'X':'.',
+                file->sharemode&FILE_SHARE_READ?'R':'.',
+                file->sharemode&FILE_SHARE_WRITE?'W':'.',
+                file->sharemode&FILE_SHARE_DELETE?'D':'.',
+                file->attrs);
+}
+
+static const gchar* file_typename (void)
+{
+       return "File";
+}
+
+static gsize file_typesize (void)
+{
+       return sizeof (struct _WapiHandle_file);
+}
+
 static WapiFileType file_getfiletype(void)
 {
        return(FILE_TYPE_DISK);
@@ -396,8 +512,9 @@ static gboolean file_read(gpointer handle, gpointer buffer,
        struct _WapiHandle_file *file_handle;
        gboolean ok;
        int fd, ret;
+       MonoThreadInfo *info = mono_thread_info_current ();
        
-       ok=_wapi_lookup_handle (handle, WAPI_HANDLE_FILE,
+       ok=mono_w32handle_lookup (handle, MONO_W32HANDLE_FILE,
                                (gpointer *)&file_handle);
        if(ok==FALSE) {
                g_warning ("%s: error looking up file handle %p", __func__,
@@ -423,7 +540,7 @@ static gboolean file_read(gpointer handle, gpointer buffer,
        do {
                ret = read (fd, buffer, numbytes);
        } while (ret == -1 && errno == EINTR &&
-                !_wapi_thread_cur_apc_pending());
+                !mono_thread_info_is_interrupt_state (info));
                        
        if(ret==-1) {
                gint err = errno;
@@ -449,8 +566,9 @@ static gboolean file_write(gpointer handle, gconstpointer buffer,
        gboolean ok;
        int ret, fd;
        off_t current_pos = 0;
+       MonoThreadInfo *info = mono_thread_info_current ();
        
-       ok=_wapi_lookup_handle (handle, WAPI_HANDLE_FILE,
+       ok=mono_w32handle_lookup (handle, MONO_W32HANDLE_FILE,
                                (gpointer *)&file_handle);
        if(ok==FALSE) {
                g_warning ("%s: error looking up file handle %p", __func__,
@@ -496,7 +614,7 @@ static gboolean file_write(gpointer handle, gconstpointer buffer,
        do {
                ret = write (fd, buffer, numbytes);
        } while (ret == -1 && errno == EINTR &&
-                !_wapi_thread_cur_apc_pending());
+                !mono_thread_info_is_interrupt_state (info));
        
        if (lock_while_writing) {
                _wapi_unlock_file_region (fd, current_pos, numbytes);
@@ -526,7 +644,7 @@ static gboolean file_flush(gpointer handle)
        gboolean ok;
        int ret, fd;
        
-       ok=_wapi_lookup_handle (handle, WAPI_HANDLE_FILE,
+       ok=mono_w32handle_lookup (handle, MONO_W32HANDLE_FILE,
                                (gpointer *)&file_handle);
        if(ok==FALSE) {
                g_warning ("%s: error looking up file handle %p", __func__,
@@ -566,7 +684,7 @@ static guint32 file_seek(gpointer handle, gint32 movedistance,
        int whence, fd;
        guint32 ret;
        
-       ok=_wapi_lookup_handle (handle, WAPI_HANDLE_FILE,
+       ok=mono_w32handle_lookup (handle, MONO_W32HANDLE_FILE,
                                (gpointer *)&file_handle);
        if(ok==FALSE) {
                g_warning ("%s: error looking up file handle %p", __func__,
@@ -662,8 +780,9 @@ static gboolean file_setendoffile(gpointer handle)
        struct stat statbuf;
        off_t pos;
        int ret, fd;
+       MonoThreadInfo *info = mono_thread_info_current ();
        
-       ok=_wapi_lookup_handle (handle, WAPI_HANDLE_FILE,
+       ok=mono_w32handle_lookup (handle, MONO_W32HANDLE_FILE,
                                (gpointer *)&file_handle);
        if(ok==FALSE) {
                g_warning ("%s: error looking up file handle %p", __func__,
@@ -722,7 +841,7 @@ static gboolean file_setendoffile(gpointer handle)
                do {
                        ret = write (fd, "", 1);
                } while (ret == -1 && errno == EINTR &&
-                        !_wapi_thread_cur_apc_pending());
+                        !mono_thread_info_is_interrupt_state (info));
 
                if(ret==-1) {
                        MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p extend write failed: %s", __func__, handle, strerror(errno));
@@ -751,7 +870,7 @@ static gboolean file_setendoffile(gpointer handle)
        do {
                ret=ftruncate(fd, pos);
        }
-       while (ret==-1 && errno==EINTR && !_wapi_thread_cur_apc_pending()); 
+       while (ret==-1 && errno==EINTR && !mono_thread_info_is_interrupt_state (info)); 
        if(ret==-1) {
                MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p ftruncate failed: %s", __func__,
                          handle, strerror(errno));
@@ -773,7 +892,7 @@ static guint32 file_getfilesize(gpointer handle, guint32 *highsize)
        int ret;
        int fd;
        
-       ok=_wapi_lookup_handle (handle, WAPI_HANDLE_FILE,
+       ok=mono_w32handle_lookup (handle, MONO_W32HANDLE_FILE,
                                (gpointer *)&file_handle);
        if(ok==FALSE) {
                g_warning ("%s: error looking up file handle %p", __func__,
@@ -859,7 +978,7 @@ static gboolean file_getfiletime(gpointer handle, WapiFileTime *create_time,
        guint64 create_ticks, access_ticks, write_ticks;
        int ret, fd;
        
-       ok=_wapi_lookup_handle (handle, WAPI_HANDLE_FILE,
+       ok=mono_w32handle_lookup (handle, MONO_W32HANDLE_FILE,
                                (gpointer *)&file_handle);
        if(ok==FALSE) {
                g_warning ("%s: error looking up file handle %p", __func__,
@@ -941,7 +1060,7 @@ static gboolean file_setfiletime(gpointer handle,
        guint64 access_ticks, write_ticks;
        int ret, fd;
        
-       ok=_wapi_lookup_handle (handle, WAPI_HANDLE_FILE,
+       ok=mono_w32handle_lookup (handle, MONO_W32HANDLE_FILE,
                                (gpointer *)&file_handle);
        if(ok==FALSE) {
                g_warning ("%s: error looking up file handle %p", __func__,
@@ -1058,6 +1177,21 @@ static void console_close (gpointer handle, gpointer data)
        }
 }
 
+static void console_details (gpointer data)
+{
+       file_details (data);
+}
+
+static const gchar* console_typename (void)
+{
+       return "Console";
+}
+
+static gsize console_typesize (void)
+{
+       return sizeof (struct _WapiHandle_file);
+}
+
 static WapiFileType console_getfiletype(void)
 {
        return(FILE_TYPE_CHAR);
@@ -1070,8 +1204,9 @@ static gboolean console_read(gpointer handle, gpointer buffer,
        struct _WapiHandle_file *console_handle;
        gboolean ok;
        int ret, fd;
+       MonoThreadInfo *info = mono_thread_info_current ();
 
-       ok=_wapi_lookup_handle (handle, WAPI_HANDLE_CONSOLE,
+       ok=mono_w32handle_lookup (handle, MONO_W32HANDLE_CONSOLE,
                                (gpointer *)&console_handle);
        if(ok==FALSE) {
                g_warning ("%s: error looking up console handle %p", __func__,
@@ -1096,7 +1231,7 @@ static gboolean console_read(gpointer handle, gpointer buffer,
        
        do {
                ret=read(fd, buffer, numbytes);
-       } while (ret==-1 && errno==EINTR && !_wapi_thread_cur_apc_pending());
+       } while (ret==-1 && errno==EINTR && !mono_thread_info_is_interrupt_state (info));
 
        if(ret==-1) {
                MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: read of handle %p error: %s", __func__, handle,
@@ -1120,8 +1255,9 @@ static gboolean console_write(gpointer handle, gconstpointer buffer,
        struct _WapiHandle_file *console_handle;
        gboolean ok;
        int ret, fd;
+       MonoThreadInfo *info = mono_thread_info_current ();
        
-       ok=_wapi_lookup_handle (handle, WAPI_HANDLE_CONSOLE,
+       ok=mono_w32handle_lookup (handle, MONO_W32HANDLE_CONSOLE,
                                (gpointer *)&console_handle);
        if(ok==FALSE) {
                g_warning ("%s: error looking up console handle %p", __func__,
@@ -1146,7 +1282,7 @@ static gboolean console_write(gpointer handle, gconstpointer buffer,
        do {
                ret = write(fd, buffer, numbytes);
        } while (ret == -1 && errno == EINTR &&
-                !_wapi_thread_cur_apc_pending());
+                !mono_thread_info_is_interrupt_state (info));
 
        if (ret == -1) {
                if (errno == EINTR) {
@@ -1167,6 +1303,16 @@ static gboolean console_write(gpointer handle, gconstpointer buffer,
        return(TRUE);
 }
 
+static const gchar* find_typename (void)
+{
+       return "Find";
+}
+
+static gsize find_typesize (void)
+{
+       return sizeof (struct _WapiHandle_find);
+}
+
 static void pipe_close (gpointer handle, gpointer data)
 {
        struct _WapiHandle_file *pipe_handle = (struct _WapiHandle_file*)data;
@@ -1182,6 +1328,21 @@ static void pipe_close (gpointer handle, gpointer data)
        close (fd);
 }
 
+static void pipe_details (gpointer data)
+{
+       file_details (data);
+}
+
+static const gchar* pipe_typename (void)
+{
+       return "Pipe";
+}
+
+static gsize pipe_typesize (void)
+{
+       return sizeof (struct _WapiHandle_file);
+}
+
 static WapiFileType pipe_getfiletype(void)
 {
        return(FILE_TYPE_PIPE);
@@ -1194,8 +1355,9 @@ static gboolean pipe_read (gpointer handle, gpointer buffer,
        struct _WapiHandle_file *pipe_handle;
        gboolean ok;
        int ret, fd;
+       MonoThreadInfo *info = mono_thread_info_current ();
 
-       ok=_wapi_lookup_handle (handle, WAPI_HANDLE_PIPE,
+       ok=mono_w32handle_lookup (handle, MONO_W32HANDLE_PIPE,
                                (gpointer *)&pipe_handle);
        if(ok==FALSE) {
                g_warning ("%s: error looking up pipe handle %p", __func__,
@@ -1223,7 +1385,7 @@ static gboolean pipe_read (gpointer handle, gpointer buffer,
 
        do {
                ret=read(fd, buffer, numbytes);
-       } while (ret==-1 && errno==EINTR && !_wapi_thread_cur_apc_pending());
+       } while (ret==-1 && errno==EINTR && !mono_thread_info_is_interrupt_state (info));
                
        if (ret == -1) {
                if (errno == EINTR) {
@@ -1254,8 +1416,9 @@ static gboolean pipe_write(gpointer handle, gconstpointer buffer,
        struct _WapiHandle_file *pipe_handle;
        gboolean ok;
        int ret, fd;
+       MonoThreadInfo *info = mono_thread_info_current ();
        
-       ok=_wapi_lookup_handle (handle, WAPI_HANDLE_PIPE,
+       ok=mono_w32handle_lookup (handle, MONO_W32HANDLE_PIPE,
                                (gpointer *)&pipe_handle);
        if(ok==FALSE) {
                g_warning ("%s: error looking up pipe handle %p", __func__,
@@ -1283,7 +1446,7 @@ static gboolean pipe_write(gpointer handle, gconstpointer buffer,
        do {
                ret = write (fd, buffer, numbytes);
        } while (ret == -1 && errno == EINTR &&
-                !_wapi_thread_cur_apc_pending());
+                !mono_thread_info_is_interrupt_state (info));
 
        if (ret == -1) {
                if (errno == EINTR) {
@@ -1497,10 +1660,8 @@ gpointer CreateFile(const gunichar2 *name, guint32 fileaccess,
        mode_t perms=0666;
        gchar *filename;
        int fd, ret;
-       WapiHandleType handle_type;
+       MonoW32HandleType handle_type;
        struct stat statbuf;
-       
-       mono_once (&io_ops_once, io_ops_init);
 
        if (attrs & FILE_ATTRIBUTE_TEMPORARY)
                perms = 0600;
@@ -1553,7 +1714,7 @@ gpointer CreateFile(const gunichar2 *name, guint32 fileaccess,
                return(INVALID_HANDLE_VALUE);
        }
 
-       if (fd >= _wapi_fd_reserve) {
+       if (fd >= mono_w32handle_fd_reserve) {
                MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: File descriptor is too big", __func__);
 
                SetLastError (ERROR_TOO_MANY_OPEN_FILES);
@@ -1624,19 +1785,19 @@ gpointer CreateFile(const gunichar2 *name, guint32 fileaccess,
 #define S_ISFIFO(m) ((m & S_IFIFO) != 0)
 #endif
        if (S_ISFIFO (statbuf.st_mode)) {
-               handle_type = WAPI_HANDLE_PIPE;
+               handle_type = MONO_W32HANDLE_PIPE;
                /* maintain invariant that pipes have no filename */
                file_handle.filename = NULL;
                g_free (filename);
                filename = NULL;
        } else if (S_ISCHR (statbuf.st_mode)) {
-               handle_type = WAPI_HANDLE_CONSOLE;
+               handle_type = MONO_W32HANDLE_CONSOLE;
        } else {
-               handle_type = WAPI_HANDLE_FILE;
+               handle_type = MONO_W32HANDLE_FILE;
        }
 
-       handle = _wapi_handle_new_fd (handle_type, fd, &file_handle);
-       if (handle == _WAPI_HANDLE_INVALID) {
+       handle = mono_w32handle_new_fd (handle_type, fd, &file_handle);
+       if (handle == INVALID_HANDLE_VALUE) {
                g_warning ("%s: error creating file handle", __func__);
                g_free (filename);
                close (fd);
@@ -1869,6 +2030,7 @@ write_file (int src_fd, int dest_fd, struct stat *st_src, gboolean report_errors
        int remain, n;
        char *buf, *wbuf;
        int buf_size = st_src->st_blksize;
+       MonoThreadInfo *info = mono_thread_info_current ();
 
        buf_size = buf_size < 8192 ? 8192 : (buf_size > 65536 ? 65536 : buf_size);
        buf = (char *) malloc (buf_size);
@@ -1876,7 +2038,7 @@ write_file (int src_fd, int dest_fd, struct stat *st_src, gboolean report_errors
        for (;;) {
                remain = read (src_fd, buf, buf_size);
                if (remain < 0) {
-                       if (errno == EINTR && !_wapi_thread_cur_apc_pending ())
+                       if (errno == EINTR && !mono_thread_info_is_interrupt_state (info))
                                continue;
 
                        if (report_errors)
@@ -1892,7 +2054,7 @@ write_file (int src_fd, int dest_fd, struct stat *st_src, gboolean report_errors
                wbuf = buf;
                while (remain > 0) {
                        if ((n = write (dest_fd, wbuf, remain)) < 0) {
-                               if (errno == EINTR && !_wapi_thread_cur_apc_pending ())
+                               if (errno == EINTR && !mono_thread_info_is_interrupt_state (info))
                                        continue;
 
                                if (report_errors)
@@ -2143,7 +2305,7 @@ gpointer GetStdHandle(WapiStdHandle stdhandle)
 {
        struct _WapiHandle_file *file_handle;
        gpointer handle;
-       int thr_ret, fd;
+       int fd;
        const gchar *name;
        gboolean ok;
        
@@ -2172,10 +2334,9 @@ gpointer GetStdHandle(WapiStdHandle stdhandle)
 
        handle = GINT_TO_POINTER (fd);
 
-       thr_ret = mono_os_mutex_lock (&stdhandle_mutex);
-       g_assert (thr_ret == 0);
+       mono_os_mutex_lock (&stdhandle_mutex);
 
-       ok = _wapi_lookup_handle (handle, WAPI_HANDLE_CONSOLE,
+       ok = mono_w32handle_lookup (handle, MONO_W32HANDLE_CONSOLE,
                                  (gpointer *)&file_handle);
        if (ok == FALSE) {
                /* Need to create this console handle */
@@ -2187,12 +2348,11 @@ gpointer GetStdHandle(WapiStdHandle stdhandle)
                }
        } else {
                /* Add a reference to this handle */
-               _wapi_handle_ref (handle);
+               mono_w32handle_ref (handle);
        }
        
   done:
-       thr_ret = mono_os_mutex_unlock (&stdhandle_mutex);
-       g_assert (thr_ret == 0);
+       mono_os_mutex_unlock (&stdhandle_mutex);
        
        return(handle);
 }
@@ -2227,9 +2387,9 @@ gpointer GetStdHandle(WapiStdHandle stdhandle)
 gboolean ReadFile(gpointer handle, gpointer buffer, guint32 numbytes,
                  guint32 *bytesread, WapiOverlapped *overlapped)
 {
-       WapiHandleType type;
+       MonoW32HandleType type;
 
-       type = _wapi_handle_type (handle);
+       type = mono_w32handle_get_type (handle);
        
        if(io_ops[type].readfile==NULL) {
                SetLastError (ERROR_INVALID_HANDLE);
@@ -2268,9 +2428,9 @@ gboolean ReadFile(gpointer handle, gpointer buffer, guint32 numbytes,
 gboolean WriteFile(gpointer handle, gconstpointer buffer, guint32 numbytes,
                   guint32 *byteswritten, WapiOverlapped *overlapped)
 {
-       WapiHandleType type;
+       MonoW32HandleType type;
 
-       type = _wapi_handle_type (handle);
+       type = mono_w32handle_get_type (handle);
        
        if(io_ops[type].writefile==NULL) {
                SetLastError (ERROR_INVALID_HANDLE);
@@ -2293,9 +2453,9 @@ gboolean WriteFile(gpointer handle, gconstpointer buffer, guint32 numbytes,
  */
 gboolean FlushFileBuffers(gpointer handle)
 {
-       WapiHandleType type;
+       MonoW32HandleType type;
 
-       type = _wapi_handle_type (handle);
+       type = mono_w32handle_get_type (handle);
        
        if(io_ops[type].flushfile==NULL) {
                SetLastError (ERROR_INVALID_HANDLE);
@@ -2317,9 +2477,9 @@ gboolean FlushFileBuffers(gpointer handle)
  */
 gboolean SetEndOfFile(gpointer handle)
 {
-       WapiHandleType type;
+       MonoW32HandleType type;
 
-       type = _wapi_handle_type (handle);
+       type = mono_w32handle_get_type (handle);
        
        if (io_ops[type].setendoffile == NULL) {
                SetLastError (ERROR_INVALID_HANDLE);
@@ -2361,9 +2521,9 @@ gboolean SetEndOfFile(gpointer handle)
 guint32 SetFilePointer(gpointer handle, gint32 movedistance,
                       gint32 *highmovedistance, WapiSeekMethod method)
 {
-       WapiHandleType type;
+       MonoW32HandleType type;
 
-       type = _wapi_handle_type (handle);
+       type = mono_w32handle_get_type (handle);
        
        if (io_ops[type].seek == NULL) {
                SetLastError (ERROR_INVALID_HANDLE);
@@ -2387,14 +2547,9 @@ guint32 SetFilePointer(gpointer handle, gint32 movedistance,
  */
 WapiFileType GetFileType(gpointer handle)
 {
-       WapiHandleType type;
-
-       if (!_WAPI_PRIVATE_HAVE_SLOT (handle)) {
-               SetLastError (ERROR_INVALID_HANDLE);
-               return(FILE_TYPE_UNKNOWN);
-       }
+       MonoW32HandleType type;
 
-       type = _wapi_handle_type (handle);
+       type = mono_w32handle_get_type (handle);
        
        if (io_ops[type].getfiletype == NULL) {
                SetLastError (ERROR_INVALID_HANDLE);
@@ -2422,9 +2577,9 @@ WapiFileType GetFileType(gpointer handle)
  */
 guint32 GetFileSize(gpointer handle, guint32 *highsize)
 {
-       WapiHandleType type;
+       MonoW32HandleType type;
 
-       type = _wapi_handle_type (handle);
+       type = mono_w32handle_get_type (handle);
        
        if (io_ops[type].getfilesize == NULL) {
                SetLastError (ERROR_INVALID_HANDLE);
@@ -2462,9 +2617,9 @@ guint32 GetFileSize(gpointer handle, guint32 *highsize)
 gboolean GetFileTime(gpointer handle, WapiFileTime *create_time,
                     WapiFileTime *last_access, WapiFileTime *last_write)
 {
-       WapiHandleType type;
+       MonoW32HandleType type;
 
-       type = _wapi_handle_type (handle);
+       type = mono_w32handle_get_type (handle);
        
        if (io_ops[type].getfiletime == NULL) {
                SetLastError (ERROR_INVALID_HANDLE);
@@ -2502,9 +2657,9 @@ gboolean SetFileTime(gpointer handle, const WapiFileTime *create_time,
                     const WapiFileTime *last_access,
                     const WapiFileTime *last_write)
 {
-       WapiHandleType type;
+       MonoW32HandleType type;
 
-       type = _wapi_handle_type (handle);
+       type = mono_w32handle_get_type (handle);
        
        if (io_ops[type].setfiletime == NULL) {
                SetLastError (ERROR_INVALID_HANDLE);
@@ -2737,8 +2892,8 @@ gpointer FindFirstFile (const gunichar2 *pattern, WapiFindData *find_data)
        find_handle.num = result;
        find_handle.count = 0;
        
-       handle = _wapi_handle_new (WAPI_HANDLE_FIND, &find_handle);
-       if (handle == _WAPI_HANDLE_INVALID) {
+       handle = mono_w32handle_new (MONO_W32HANDLE_FIND, &find_handle);
+       if (handle == INVALID_HANDLE_VALUE) {
                g_warning ("%s: error creating find handle", __func__);
                g_free (dir_part);
                g_free (entry_part);
@@ -2772,7 +2927,7 @@ gboolean FindNextFile (gpointer handle, WapiFindData *find_data)
        int thr_ret;
        gboolean ret = FALSE;
        
-       ok=_wapi_lookup_handle (handle, WAPI_HANDLE_FIND,
+       ok=mono_w32handle_lookup (handle, MONO_W32HANDLE_FIND,
                                (gpointer *)&find_handle);
        if(ok==FALSE) {
                g_warning ("%s: error looking up find handle %p", __func__,
@@ -2781,7 +2936,7 @@ gboolean FindNextFile (gpointer handle, WapiFindData *find_data)
                return(FALSE);
        }
 
-       thr_ret = _wapi_handle_lock_handle (handle);
+       thr_ret = mono_w32handle_lock_handle (handle);
        g_assert (thr_ret == 0);
        
 retry:
@@ -2888,7 +3043,7 @@ retry:
        g_free (utf16_basename);
 
 cleanup:
-       thr_ret = _wapi_handle_unlock_handle (handle);
+       thr_ret = mono_w32handle_unlock_handle (handle);
        g_assert (thr_ret == 0);
        
        return(ret);
@@ -2913,7 +3068,7 @@ gboolean FindClose (gpointer handle)
                return(FALSE);
        }
        
-       ok=_wapi_lookup_handle (handle, WAPI_HANDLE_FIND,
+       ok=mono_w32handle_lookup (handle, MONO_W32HANDLE_FIND,
                                (gpointer *)&find_handle);
        if(ok==FALSE) {
                g_warning ("%s: error looking up find handle %p", __func__,
@@ -2922,16 +3077,16 @@ gboolean FindClose (gpointer handle)
                return(FALSE);
        }
 
-       thr_ret = _wapi_handle_lock_handle (handle);
+       thr_ret = mono_w32handle_lock_handle (handle);
        g_assert (thr_ret == 0);
        
        g_strfreev (find_handle->namelist);
        g_free (find_handle->dir_part);
 
-       thr_ret = _wapi_handle_unlock_handle (handle);
+       thr_ret = mono_w32handle_unlock_handle (handle);
        g_assert (thr_ret == 0);
        
-       _wapi_handle_unref (handle);
+       mono_w32handle_unref (handle);
        
        return(TRUE);
 }
@@ -3346,8 +3501,6 @@ gboolean CreatePipe (gpointer *readpipe, gpointer *writepipe,
        int filedes[2];
        int ret;
        
-       mono_once (&io_ops_once, io_ops_init);
-       
        MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Creating pipe", __func__);
 
        ret=pipe (filedes);
@@ -3359,8 +3512,8 @@ gboolean CreatePipe (gpointer *readpipe, gpointer *writepipe,
                return(FALSE);
        }
 
-       if (filedes[0] >= _wapi_fd_reserve ||
-           filedes[1] >= _wapi_fd_reserve) {
+       if (filedes[0] >= mono_w32handle_fd_reserve ||
+           filedes[1] >= mono_w32handle_fd_reserve) {
                MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: File descriptor is too big", __func__);
 
                SetLastError (ERROR_TOO_MANY_OPEN_FILES);
@@ -3375,9 +3528,9 @@ gboolean CreatePipe (gpointer *readpipe, gpointer *writepipe,
 
        pipe_read_handle.fd = filedes [0];
        pipe_read_handle.fileaccess = GENERIC_READ;
-       read_handle = _wapi_handle_new_fd (WAPI_HANDLE_PIPE, filedes[0],
+       read_handle = mono_w32handle_new_fd (MONO_W32HANDLE_PIPE, filedes[0],
                                           &pipe_read_handle);
-       if (read_handle == _WAPI_HANDLE_INVALID) {
+       if (read_handle == INVALID_HANDLE_VALUE) {
                g_warning ("%s: error creating pipe read handle", __func__);
                close (filedes[0]);
                close (filedes[1]);
@@ -3388,11 +3541,11 @@ gboolean CreatePipe (gpointer *readpipe, gpointer *writepipe,
        
        pipe_write_handle.fd = filedes [1];
        pipe_write_handle.fileaccess = GENERIC_WRITE;
-       write_handle = _wapi_handle_new_fd (WAPI_HANDLE_PIPE, filedes[1],
+       write_handle = mono_w32handle_new_fd (MONO_W32HANDLE_PIPE, filedes[1],
                                            &pipe_write_handle);
-       if (write_handle == _WAPI_HANDLE_INVALID) {
+       if (write_handle == INVALID_HANDLE_VALUE) {
                g_warning ("%s: error creating pipe write handle", __func__);
-               _wapi_handle_unref (read_handle);
+               mono_w32handle_unref (read_handle);
                
                close (filedes[0]);
                close (filedes[1]);
@@ -4273,9 +4426,30 @@ GetVolumeInformation (const gunichar2 *path, gunichar2 *volumename, int volumesi
 }
 #endif
 
-
 void
 _wapi_io_init (void)
 {
        mono_os_mutex_init (&stdhandle_mutex);
+
+       mono_w32handle_register_ops (MONO_W32HANDLE_FILE,    &_wapi_file_ops);
+       mono_w32handle_register_ops (MONO_W32HANDLE_CONSOLE, &_wapi_console_ops);
+       mono_w32handle_register_ops (MONO_W32HANDLE_FIND,    &_wapi_find_ops);
+       mono_w32handle_register_ops (MONO_W32HANDLE_PIPE,    &_wapi_pipe_ops);
+
+/*     mono_w32handle_register_capabilities (MONO_W32HANDLE_FILE, */
+/*                                         MONO_W32HANDLE_CAP_WAIT); */
+/*     mono_w32handle_register_capabilities (MONO_W32HANDLE_CONSOLE, */
+/*                                         MONO_W32HANDLE_CAP_WAIT); */
+
+       if (g_getenv ("MONO_STRICT_IO_EMULATION"))
+               lock_while_writing = TRUE;
+}
+
+void
+_wapi_io_cleanup (void)
+{
+       if (file_share_hash) {
+               g_hash_table_destroy (file_share_hash);
+               mono_os_mutex_destroy (&file_share_hash_mutex);
+       }
 }
index 4c5a492b95b004db8c46322334e0bea5310ebe01..5321bcd7c4459da7642a1dd34fbe00d936c6e6c6 100644 (file)
@@ -225,6 +225,7 @@ extern gboolean GetVolumeInformation (const gunichar2 *path, gunichar2 *volumena
 
 
 extern void _wapi_io_init (void);
+extern void _wapi_io_cleanup (void);
 
 G_END_DECLS
 
index c014a2d3dc4f983c19f4b70dcb878fa47ef0f751..001df9bef7e9273d726f2999880915377f1cb9ef 100644 (file)
 #include <errno.h>
 #include <mono/io-layer/wapi.h>
 #include <mono/io-layer/wapi-private.h>
-#include <mono/io-layer/handles-private.h>
 #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>
 
 gboolean
 _wapi_lock_file_region (int fd, off_t offset, off_t length)
@@ -125,7 +125,7 @@ LockFile (gpointer handle, guint32 offset_low, guint32 offset_high,
        off_t offset, length;
        int fd = GPOINTER_TO_UINT(handle);
        
-       ok = _wapi_lookup_handle (handle, WAPI_HANDLE_FILE,
+       ok = mono_w32handle_lookup (handle, MONO_W32HANDLE_FILE,
                                  (gpointer *)&file_handle);
        if (ok == FALSE) {
                g_warning ("%s: error looking up file handle %p", __func__,
@@ -172,7 +172,7 @@ UnlockFile (gpointer handle, guint32 offset_low,
        off_t offset, length;
        int fd = GPOINTER_TO_UINT(handle);
        
-       ok = _wapi_lookup_handle (handle, WAPI_HANDLE_FILE,
+       ok = mono_w32handle_lookup (handle, MONO_W32HANDLE_FILE,
                                  (gpointer *)&file_handle);
        if (ok == FALSE) {
                g_warning ("%s: error looking up file handle %p", __func__,
index 21eaaac6705637f51b228decb400c393c92251b0..50e5b14e06368332af615e667e2550e799d258d3 100644 (file)
 #include <pthread.h>
 #include <sys/types.h>
 
-extern struct _WapiHandleOps _wapi_mutex_ops;
-extern struct _WapiHandleOps _wapi_namedmutex_ops;
-
-extern void _wapi_mutex_details (gpointer handle_info);
+#include "wapi-private.h"
 
 struct _WapiHandle_mutex
 {
@@ -28,11 +25,11 @@ struct _WapiHandle_mutex
 
 struct _WapiHandle_namedmutex 
 {
+       struct _WapiHandle_mutex m;
        WapiSharedNamespace sharedns;
-       pthread_t tid;
-       guint32 recursion;
 };
 
-extern void _wapi_mutex_abandon (gpointer data, pid_t pid, pthread_t tid);
+void
+_wapi_mutex_init (void);
 
 #endif /* _WAPI_MUTEX_PRIVATE_H_ */
index 9bcff16fe22fdf4b819366a5f911738e914f7d42..dbfe8b1697abb5fa884942c4b83705474561e7e0 100644 (file)
 
 #include <mono/io-layer/wapi.h>
 #include <mono/io-layer/wapi-private.h>
-#include <mono/io-layer/handles-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);
 
-struct _WapiHandleOps _wapi_mutex_ops = {
+static MonoW32HandleOps _wapi_mutex_ops = {
        NULL,                   /* close */
        mutex_signal,           /* signal */
        mutex_own,              /* own */
        mutex_is_owned,         /* is_owned */
        NULL,                   /* special_wait */
-       NULL                    /* prewait */
+       mutex_prewait,                  /* prewait */
+       mutex_details,  /* details */
+       mutex_typename, /* typename */
+       mutex_typesize, /* typesize */
 };
 
-void _wapi_mutex_details (gpointer handle_info)
-{
-       struct _WapiHandle_mutex *mut = (struct _WapiHandle_mutex *)handle_info;
-       
-#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
-}
-
-struct _WapiHandleOps _wapi_namedmutex_ops = {
+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_prewait,     /* prewait */
+       namedmutex_details,     /* details */
+       namedmutex_typename,    /* typename */
+       namedmutex_typesize,    /* typesize */
 };
 
-static gboolean mutex_release (gpointer handle);
-static gboolean namedmutex_release (gpointer handle);
-
-static struct 
+void
+_wapi_mutex_init (void)
 {
-       gboolean (*release)(gpointer handle);
-} mutex_ops[WAPI_HANDLE_COUNT] = {
-       {NULL},
-       {NULL},
-       {NULL},
-       {NULL},
-       {NULL},
-       {mutex_release},
-       {NULL},
-       {NULL},
-       {NULL},
-       {NULL},
-       {NULL},
-       {namedmutex_release},
-};
-
-static mono_once_t mutex_ops_once=MONO_ONCE_INIT;
+       mono_w32handle_register_ops (MONO_W32HANDLE_MUTEX,      &_wapi_mutex_ops);
+       mono_w32handle_register_ops (MONO_W32HANDLE_NAMEDMUTEX, &_wapi_namedmutex_ops);
 
-static void mutex_ops_init (void)
-{
-       _wapi_handle_register_capabilities (WAPI_HANDLE_MUTEX,
-               (WapiHandleCapability)(WAPI_HANDLE_CAP_WAIT | WAPI_HANDLE_CAP_SIGNAL | WAPI_HANDLE_CAP_OWN));
-       _wapi_handle_register_capabilities (WAPI_HANDLE_NAMEDMUTEX,
-               (WapiHandleCapability)(WAPI_HANDLE_CAP_WAIT | WAPI_HANDLE_CAP_SIGNAL | WAPI_HANDLE_CAP_OWN));
+       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 void mutex_signal(gpointer handle)
+static const char* mutex_handle_type_to_string (MonoW32HandleType type)
 {
-       ReleaseMutex(handle);
+       switch (type) {
+       case MONO_W32HANDLE_MUTEX: return "mutex";
+       case MONO_W32HANDLE_NAMEDMUTEX: return "named mutex";
+       default:
+               g_assert_not_reached ();
+       }
 }
 
-static gboolean mutex_own (gpointer handle)
+static gboolean
+mutex_handle_own (gpointer handle, MonoW32HandleType type)
 {
        struct _WapiHandle_mutex *mutex_handle;
-       gboolean ok;
-       
-       ok = _wapi_lookup_handle (handle, WAPI_HANDLE_MUTEX,
-                                 (gpointer *)&mutex_handle);
-       if (ok == FALSE) {
-               g_warning ("%s: error looking up mutex handle %p", __func__,
-                          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;
        }
 
-       _wapi_thread_own_mutex (handle);
-       
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: owning mutex handle %p", __func__, handle);
+       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);
 
-       _wapi_handle_set_signal_state (handle, FALSE, FALSE);
-       
        mutex_handle->tid = pthread_self ();
        mutex_handle->recursion++;
 
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: mutex handle %p locked %d times by %ld", __func__,
-               handle, mutex_handle->recursion, mutex_handle->tid);
+       mono_w32handle_set_signal_state (handle, FALSE, FALSE);
 
-       return(TRUE);
+       return TRUE;
 }
 
-static gboolean mutex_is_owned (gpointer handle)
+static gboolean
+mutex_handle_is_owned (gpointer handle, MonoW32HandleType type)
 {
        struct _WapiHandle_mutex *mutex_handle;
-       gboolean ok;
-       
-       ok=_wapi_lookup_handle (handle, WAPI_HANDLE_MUTEX,
-                               (gpointer *)&mutex_handle);
-       if(ok==FALSE) {
-               g_warning ("%s: error looking up mutex handle %p", __func__,
-                          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: testing ownership mutex handle %p", __func__, handle);
 
-       if (mutex_handle->recursion > 0 && pthread_equal (mutex_handle->tid, pthread_self ())) {
-               MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: mutex handle %p owned by %ld", __func__,
-                       handle, pthread_self ());
+       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: testing ownership %s handle %p",
+               __func__, mutex_handle_type_to_string (type), handle);
 
-               return(TRUE);
+       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: mutex handle %p not owned by %ld, but locked %d times by %ld", __func__,
-                       handle, pthread_self (), mutex_handle->recursion, mutex_handle->tid);
-
-               return(FALSE);
+               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 namedmutex_signal (gpointer handle)
+static void mutex_signal(gpointer handle)
 {
        ReleaseMutex(handle);
 }
 
-/* NB, always called with the shared handle lock held */
-static gboolean namedmutex_own (gpointer handle)
+static gboolean mutex_own (gpointer handle)
 {
-       struct _WapiHandle_namedmutex *namedmutex_handle;
-       gboolean ok;
-       
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: owning named mutex handle %p", __func__, handle);
-       
-       ok = _wapi_lookup_handle (handle, WAPI_HANDLE_NAMEDMUTEX,
-                                 (gpointer *)&namedmutex_handle);
-       if (ok == FALSE) {
-               g_warning ("%s: error looking up named mutex handle %p",
-                          __func__, handle);
-               return(FALSE);
-       }
-
-       _wapi_thread_own_mutex (handle);
-
-       namedmutex_handle->tid = pthread_self ();
-       namedmutex_handle->recursion++;
-
-       _wapi_handle_set_signal_state (handle, FALSE, FALSE);
-
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: mutex handle %p locked %d times by %ld", __func__,
-               handle, namedmutex_handle->recursion, namedmutex_handle->tid);
-       
-       return(TRUE);
+       return mutex_handle_own (handle, MONO_W32HANDLE_MUTEX);
 }
 
-static gboolean namedmutex_is_owned (gpointer handle)
+static gboolean mutex_is_owned (gpointer handle)
 {
-       struct _WapiHandle_namedmutex *namedmutex_handle;
-       gboolean ok;
-       
-       ok = _wapi_lookup_handle (handle, WAPI_HANDLE_NAMEDMUTEX,
-                                 (gpointer *)&namedmutex_handle);
-       if (ok == FALSE) {
-               g_warning ("%s: error looking up mutex handle %p", __func__,
-                          handle);
-               return(FALSE);
-       }
        
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: testing ownership mutex handle %p", __func__, handle);
+       return mutex_handle_is_owned (handle, MONO_W32HANDLE_MUTEX);
+}
 
-       if (namedmutex_handle->recursion > 0 && pthread_equal (namedmutex_handle->tid, pthread_self ())) {
-               MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: mutex handle %p owned by %ld", __func__,
-                       handle, pthread_self ());
+static void namedmutex_signal (gpointer handle)
+{
+       ReleaseMutex(handle);
+}
 
-               return(TRUE);
-       } else {
-               MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: mutex handle %p not owned by %ld, but locked %d times by %ld", __func__,
-                       handle, pthread_self (), namedmutex_handle->recursion, namedmutex_handle->tid);
+/* NB, always called with the shared handle lock held */
+static gboolean namedmutex_own (gpointer handle)
+{
+       return mutex_handle_own (handle, MONO_W32HANDLE_NAMEDMUTEX);
+}
 
-               return(FALSE);
-       }
+static gboolean namedmutex_is_owned (gpointer handle)
+{
+       return mutex_handle_is_owned (handle, MONO_W32HANDLE_NAMEDMUTEX);
 }
 
-/* The shared state is not locked when prewait methods are called */
-static void namedmutex_prewait (gpointer handle)
+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
@@ -222,224 +170,197 @@ static void namedmutex_prewait (gpointer handle)
         * and assume that process exited abnormally and failed to
         * clean up.
         */
-       struct _WapiHandle_namedmutex *namedmutex_handle;
-       gboolean ok;
-       
-       ok = _wapi_lookup_handle (handle, WAPI_HANDLE_NAMEDMUTEX,
-                                 (gpointer *)&namedmutex_handle);
-       if (ok == FALSE) {
-               g_warning ("%s: error looking up named mutex handle %p",
-                          __func__, handle);
+       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: Checking ownership of named mutex handle %p", __func__,
-                  handle);
 
-       if (namedmutex_handle->recursion == 0) {
-               MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Named mutex handle %p not owned", __func__,
-                          handle);
-       } else {
-               MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Named mutex handle %p owned by this process", __func__,
-                       handle);
-       }
+       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");
 }
 
-static void mutex_abandon (gpointer handle, pid_t pid, pthread_t tid)
+/* The shared state is not locked when prewait methods are called */
+static void mutex_prewait (gpointer handle)
 {
-       struct _WapiHandle_mutex *mutex_handle;
-       gboolean ok;
-       int thr_ret;
+       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;
        
-       ok = _wapi_lookup_handle (handle, WAPI_HANDLE_MUTEX,
-                                 (gpointer *)&mutex_handle);
-       if (ok == FALSE) {
-               g_warning ("%s: error looking up mutex handle %p", __func__,
-                          handle);
-               return;
-       }
+#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
+}
 
-       thr_ret = _wapi_handle_lock_handle (handle);
-       g_assert (thr_ret == 0);
+static void namedmutex_details (gpointer data)
+{
+       struct _WapiHandle_namedmutex *namedmut = (struct _WapiHandle_namedmutex *)data;
        
-       if (pthread_equal (mutex_handle->tid, tid)) {
-               MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Mutex handle %p abandoned!", __func__,
-                       handle);
+#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
+}
 
-               mutex_handle->recursion = 0;
-               mutex_handle->tid = 0;
-               
-               _wapi_handle_set_signal_state (handle, TRUE, FALSE);
-       }
+static const gchar* mutex_typename (void)
+{
+       return "Mutex";
+}
 
-       thr_ret = _wapi_handle_unlock_handle (handle);
-       g_assert (thr_ret == 0);
+static gsize mutex_typesize (void)
+{
+       return sizeof (struct _WapiHandle_mutex);
+}
+
+static const gchar* namedmutex_typename (void)
+{
+       return "N.Mutex";
 }
 
-static void namedmutex_abandon (gpointer handle, pid_t pid, pthread_t tid)
+static gsize namedmutex_typesize (void)
 {
-       struct _WapiHandle_namedmutex *mutex_handle;
-       gboolean ok;
+       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;
-       
-       ok = _wapi_lookup_handle (handle, WAPI_HANDLE_NAMEDMUTEX,
-                                 (gpointer *)&mutex_handle);
-       if (ok == FALSE) {
-               g_warning ("%s: error looking up named mutex handle %p",
-                          __func__, handle);
+
+       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;
        }
 
-       thr_ret = _wapi_handle_lock_handle (handle);
+       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)) {
-               MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Mutex handle %p abandoned!", __func__,
-                       handle);
 
+       if (pthread_equal (mutex_handle->tid, tid)) {
                mutex_handle->recursion = 0;
                mutex_handle->tid = 0;
-               
-               _wapi_handle_set_signal_state (handle, TRUE, FALSE);
-       }
-
-       thr_ret = _wapi_handle_unlock_handle (handle);
-       g_assert (thr_ret == 0);
-}
 
-/* When a thread exits, any mutexes it still holds need to be
- * signalled.  This function must not be called with the shared handle
- * lock held, as namedmutex_abandon () will try to acquire it
- */
-void _wapi_mutex_abandon (gpointer data, pid_t pid, pthread_t tid)
-{
-       WapiHandleType type = _wapi_handle_type (data);
+               mono_w32handle_set_signal_state (handle, TRUE, FALSE);
 
-       if (type == WAPI_HANDLE_MUTEX) {
-               mutex_abandon (data, pid, tid);
-       } else if (type == WAPI_HANDLE_NAMEDMUTEX) {
-               namedmutex_abandon (data, pid, tid);
-       } else {
-               g_assert_not_reached ();
+               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_create (WapiSecurityAttributes *security G_GNUC_UNUSED,
-                             gboolean owned)
+static gpointer mutex_handle_create (struct _WapiHandle_mutex *mutex_handle, MonoW32HandleType type, gboolean owned)
 {
-       struct _WapiHandle_mutex mutex_handle = {0};
        gpointer handle;
        int thr_ret;
-       
-       /* 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);
-       
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Creating unnamed mutex", __func__);
-       
-       handle = _wapi_handle_new (WAPI_HANDLE_MUTEX, &mutex_handle);
-       if (handle == _WAPI_HANDLE_INVALID) {
-               g_warning ("%s: error creating mutex handle", __func__);
+
+       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);
+               return NULL;
        }
 
-       thr_ret = _wapi_handle_lock_handle (handle);
+       thr_ret = mono_w32handle_lock_handle (handle);
        g_assert (thr_ret == 0);
-       
-       if(owned==TRUE) {
-               mutex_own (handle);
-       } else {
-               _wapi_handle_set_signal_state (handle, TRUE, FALSE);
-       }
-       
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: returning mutex handle %p", __func__, handle);
 
-       thr_ret = _wapi_handle_unlock_handle (handle);
+       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);
-       
-       return(handle);
+
+       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 (WapiSecurityAttributes *security G_GNUC_UNUSED, gboolean owned,
-                       const gunichar2 *name)
+static gpointer namedmutex_create (gboolean owned, const gunichar2 *name)
 {
-       struct _WapiHandle_namedmutex namedmutex_handle = {{{0}}, 0};
        gpointer handle;
        gchar *utf8_name;
        int thr_ret;
 
-       /* w32 seems to guarantee that opening named objects can't
-        * race each other
-        */
+       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);
 
-       /* 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);
-       
        utf8_name = g_utf16_to_utf8 (name, -1, NULL, NULL, NULL);
-       
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Creating named mutex [%s]", __func__, utf8_name);
-       
-       handle = _wapi_search_handle_namespace (WAPI_HANDLE_NAMEDMUTEX,
-                                               utf8_name);
-       if (handle == _WAPI_HANDLE_INVALID) {
-               /* The name has already been used for a different
-                * object.
-                */
+
+       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);
-               goto cleanup;
        } else if (handle) {
-               /* Not an error, but this is how the caller is
-                * informed that the mutex wasn't freshly created
-                */
+               /* 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, so create both the private and
-                * shared parts
-                */
-       
+               /* 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 = _wapi_handle_new (WAPI_HANDLE_NAMEDMUTEX,
-                                          &namedmutex_handle);
-       
-               if (handle == _WAPI_HANDLE_INVALID) {
-                       g_warning ("%s: error creating mutex handle", __func__);
-                       SetLastError (ERROR_GEN_FAILURE);
-                       goto cleanup;
-               }
-
-               /* Set the initial state, as this is a completely new
-                * handle
-                */
-               thr_ret = _wapi_handle_lock_handle (handle);
-               g_assert (thr_ret == 0);
-       
-               if (owned == TRUE) {
-                       namedmutex_own (handle);
-               } else {
-                       _wapi_handle_set_signal_state (handle, TRUE, FALSE);
-               }
-
-               thr_ret = _wapi_handle_unlock_handle (handle);
-               g_assert (thr_ret == 0);
+               handle = mutex_handle_create ((struct _WapiHandle_mutex*) &namedmutex_handle, MONO_W32HANDLE_NAMEDMUTEX, owned);
        }
-       
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: returning mutex handle %p", __func__, handle);
 
-cleanup:
        g_free (utf8_name);
 
-       _wapi_namespace_unlock (NULL);
-       
+       thr_ret = _wapi_namespace_unlock (NULL);
+       g_assert (thr_ret == 0);
+
        return handle;
 }
 
@@ -462,140 +383,87 @@ cleanup:
  *
  * Return value: A new handle, or %NULL on error.
  */
-gpointer CreateMutex(WapiSecurityAttributes *security G_GNUC_UNUSED, gboolean owned,
-                       const gunichar2 *name)
+gpointer CreateMutex(WapiSecurityAttributes *security G_GNUC_UNUSED, gboolean owned, const gunichar2 *name)
 {
-       mono_once (&mutex_ops_once, mutex_ops_init);
+       /* 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 == NULL) {
-               return(mutex_create (security, owned));
-       } else {
-               return(namedmutex_create (security, owned, name));
-       }
+       return name ? namedmutex_create (owned, name) : mutex_create (owned);
 }
 
-static gboolean mutex_release (gpointer handle)
+/**
+ * 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;
-       gboolean ok;
-       pthread_t tid = pthread_self ();
+       pthread_t tid;
        int thr_ret;
-       gboolean ret = FALSE;
-       
-       ok = _wapi_lookup_handle (handle, WAPI_HANDLE_MUTEX,
-                                 (gpointer *)&mutex_handle);
-       if (ok == FALSE) {
-               g_warning ("%s: error looking up mutex handle %p", __func__,
-                          handle);
-               return(FALSE);
-       }
+       gboolean ret;
 
-       thr_ret = _wapi_handle_lock_handle (handle);
-       g_assert (thr_ret == 0);
-       
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Releasing mutex handle %p", __func__, handle);
-
-       if (!pthread_equal (mutex_handle->tid, tid)) {
-               MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: We don't own mutex handle %p (owned by %ld, me %ld)", __func__,
-                       handle, mutex_handle->tid, tid);
-
-               goto cleanup;
+       if (handle == NULL) {
+               SetLastError (ERROR_INVALID_HANDLE);
+               return FALSE;
        }
-       ret = TRUE;
-       
-       /* OK, we own this mutex */
-       mutex_handle->recursion--;
-       
-       if(mutex_handle->recursion==0) {
-               _wapi_thread_disown_mutex (handle);
 
-               MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Unlocking mutex handle %p", __func__, handle);
-
-               mutex_handle->tid=0;
-               _wapi_handle_set_signal_state (handle, TRUE, FALSE);
+       switch (type = mono_w32handle_get_type (handle)) {
+       case MONO_W32HANDLE_MUTEX:
+       case MONO_W32HANDLE_NAMEDMUTEX:
+               break;
+       default:
+               SetLastError (ERROR_INVALID_HANDLE);
+               return FALSE;
        }
 
-cleanup:
-       thr_ret = _wapi_handle_unlock_handle (handle);
-       g_assert (thr_ret == 0);
-       
-       return(ret);
-}
-
-static gboolean namedmutex_release (gpointer handle)
-{
-       struct _WapiHandle_namedmutex *mutex_handle;
-       gboolean ok;
-       pthread_t tid = pthread_self ();
-       int thr_ret;
-       gboolean ret = FALSE;
-       
-       ok=_wapi_lookup_handle (handle, WAPI_HANDLE_NAMEDMUTEX,
-                               (gpointer *)&mutex_handle);
-       if(ok==FALSE) {
-               g_warning ("%s: error looking up named mutex handle %p",
-                          __func__, 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;
        }
 
-       thr_ret = _wapi_handle_lock_handle (handle);
+       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);
-       
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Releasing mutex handle %p", __func__, handle);
+
+       tid = pthread_self ();
 
        if (!pthread_equal (mutex_handle->tid, tid)) {
-               MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: We don't own mutex handle %p (owned by %ld, me %ld)", __func__,
-                       handle, mutex_handle->tid, tid);
+               ret = FALSE;
 
-               goto cleanup;
-       }
-       ret = TRUE;
-       
-       /* OK, we own this mutex */
-       mutex_handle->recursion--;
-       
-       if(mutex_handle->recursion==0) {
-               _wapi_thread_disown_mutex (handle);
+               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;
 
-               MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Unlocking mutex handle %p", __func__, handle);
+               /* OK, we own this mutex */
+               mutex_handle->recursion--;
 
-               mutex_handle->tid=0;
-               _wapi_handle_set_signal_state (handle, TRUE, FALSE);
+               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);
+               }
        }
 
-cleanup:
-       thr_ret = _wapi_handle_unlock_handle (handle);
+       thr_ret = mono_w32handle_unlock_handle (handle);
        g_assert (thr_ret == 0);
-       
-       return(ret);
-}
 
-/**
- * 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)
-{
-       WapiHandleType type;
-
-       if (handle == NULL) {
-               SetLastError (ERROR_INVALID_HANDLE);
-               return(FALSE);
-       }
-       
-       type = _wapi_handle_type (handle);
-       
-       if (mutex_ops[type].release == NULL) {
-               SetLastError (ERROR_INVALID_HANDLE);
-               return(FALSE);
-       }
-       
-       return(mutex_ops[type].release (handle));
+       return ret;
 }
 
 gpointer OpenMutex (guint32 access G_GNUC_UNUSED, gboolean inherit G_GNUC_UNUSED, const gunichar2 *name)
@@ -604,8 +472,6 @@ gpointer OpenMutex (guint32 access G_GNUC_UNUSED, gboolean inherit G_GNUC_UNUSED
        gchar *utf8_name;
        int thr_ret;
 
-       mono_once (&mutex_ops_once, mutex_ops_init);
-
        /* w32 seems to guarantee that opening named objects can't
         * race each other
         */
@@ -616,9 +482,9 @@ gpointer OpenMutex (guint32 access G_GNUC_UNUSED, gboolean inherit G_GNUC_UNUSED
        
        MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Opening named mutex [%s]", __func__, utf8_name);
        
-       handle = _wapi_search_handle_namespace (WAPI_HANDLE_NAMEDMUTEX,
+       handle = _wapi_search_handle_namespace (MONO_W32HANDLE_NAMEDMUTEX,
                                                utf8_name);
-       if (handle == _WAPI_HANDLE_INVALID) {
+       if (handle == INVALID_HANDLE_VALUE) {
                /* The name has already been used for a different
                 * object.
                 */
index ef9e46d9e94351b846a42156da1637830c1c2785..d1b7a68d67ca5695d893100748693cdaa6e652ca 100644 (file)
@@ -12,6 +12,8 @@
 
 #include <glib.h>
 
+#include <pthread.h>
+
 G_BEGIN_DECLS
 
 extern gpointer CreateMutex (WapiSecurityAttributes *security, gboolean owned,
@@ -20,6 +22,9 @@ 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 2856d4fcd615cf7dbb973f27830bc391c66255df..fe350c8b8660e59da13d8a2646a62f49db2fb2d9 100644 (file)
 
 #include <mono/io-layer/wapi.h>
 #include <mono/io-layer/wapi-private.h>
-#include <mono/io-layer/handles-private.h>
 #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>
 
 static guint32
 convert_from_flags(int flags)
@@ -101,8 +101,8 @@ gpointer _wapi_stdhandle_create (int fd, const gchar *name)
        file_handle.sharemode=0;
        file_handle.attrs=0;
 
-       handle = _wapi_handle_new_fd (WAPI_HANDLE_CONSOLE, fd, &file_handle);
-       if (handle == _WAPI_HANDLE_INVALID) {
+       handle = mono_w32handle_new_fd (MONO_W32HANDLE_CONSOLE, fd, &file_handle);
+       if (handle == INVALID_HANDLE_VALUE) {
                g_warning ("%s: error creating file handle", __func__);
                SetLastError (ERROR_GEN_FAILURE);
                return(INVALID_HANDLE_VALUE);
index ddd6e863f36623426672ab8244c2fdf9f7ae216b..a17de8a3adb607fd5e6f3ad509033ffcbf6f9271 100644 (file)
 #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);
+void _wapi_processes_init (void);
 extern gpointer _wapi_process_duplicate (void);
 extern void wapi_processes_cleanup (void);
 
-extern struct _WapiHandleOps _wapi_process_ops;
-
 /*
  * MonoProcess describes processes we create.
  * It contains a semaphore that can be waited on in order to wait
index 89bd3f0e8bbb9fac4b07cc768a834ac692396d8c..654c43771ebd5b4ad8e3bb421b227e61cca5dba0 100644 (file)
@@ -95,9 +95,7 @@
 
 #include <mono/io-layer/wapi.h>
 #include <mono/io-layer/wapi-private.h>
-#include <mono/io-layer/handles-private.h>
 #include <mono/io-layer/process-private.h>
-#include <mono/io-layer/threads.h>
 #include <mono/io-layer/io-trace.h>
 #include <mono/utils/strenc.h>
 #include <mono/utils/mono-path.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__)
@@ -127,8 +128,11 @@ static char *mono_environ[1] = { NULL };
 extern char **environ;
 #endif
 
-static guint32 process_wait (gpointer handle, guint32 timeout, gboolean alertable);
+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))
@@ -136,13 +140,16 @@ static FILE *
 open_process_map (int pid, const char *mode);
 #endif
 
-struct _WapiHandleOps _wapi_process_ops = {
+static MonoW32HandleOps _wapi_process_ops = {
        process_close,          /* close_shared */
        NULL,                           /* signal */
        NULL,                           /* own */
        NULL,                           /* is_owned */
        process_wait,                   /* special_wait */
-       NULL                            /* prewait */   
+       NULL,                           /* prewait */
+       process_details,        /* details */
+       process_typename,       /* typename */
+       process_typesize,       /* typesize */
 };
 
 #if HAVE_SIGACTION
@@ -178,7 +185,7 @@ lookup_process_handle (gpointer handle)
        WapiHandle_process *process_data;
        gboolean ret;
 
-       ret = _wapi_lookup_handle (handle, WAPI_HANDLE_PROCESS,
+       ret = mono_w32handle_lookup (handle, MONO_W32HANDLE_PROCESS,
                                                           (gpointer *)&process_data);
        if (!ret)
                return NULL;
@@ -894,8 +901,8 @@ gboolean CreateProcess (const gunichar2 *appname, const gunichar2 *cmdline,
 
        process_set_defaults (&process_handle);
        
-       handle = _wapi_handle_new (WAPI_HANDLE_PROCESS, &process_handle);
-       if (handle == _WAPI_HANDLE_INVALID) {
+       handle = mono_w32handle_new (MONO_W32HANDLE_PROCESS, &process_handle);
+       if (handle == INVALID_HANDLE_VALUE) {
                g_warning ("%s: error creating process handle", __func__);
 
                ret = FALSE;
@@ -998,7 +1005,7 @@ gboolean CreateProcess (const gunichar2 *appname, const gunichar2 *cmdline,
                }
                
                /* Close all file descriptors */
-               for (i = wapi_getdtablesize () - 1; i > 2; i--)
+               for (i = mono_w32handle_fd_reserve - 1; i > 2; i--)
                        close (i);
 
 #ifdef DEBUG_ENABLED
@@ -1029,7 +1036,7 @@ gboolean CreateProcess (const gunichar2 *appname, const gunichar2 *cmdline,
                process_handle_data = lookup_process_handle (handle);
                if (!process_handle_data) {
                        g_warning ("%s: error looking up process handle %p", __func__, handle);
-                       _wapi_handle_unref (handle);
+                       mono_w32handle_unref (handle);
                } else {
                        process_handle_data->id = pid;
 
@@ -1037,25 +1044,19 @@ gboolean CreateProcess (const gunichar2 *appname, const gunichar2 *cmdline,
                        mono_process = (struct MonoProcess *) g_malloc0 (sizeof (struct MonoProcess));
                        mono_process->pid = pid;
                        mono_process->handle_count = 1;
-                       if (mono_os_sem_init (&mono_process->exit_sem, 0) != 0) {
-                               /* If we can't create the exit semaphore, we just don't add anything
-                                * to our list of mono processes. Waiting on the process will return 
-                                * immediately. */
-                               g_warning ("%s: could not create exit semaphore for process.", strerror (errno));
-                               g_free (mono_process);
-                       } else {
-                               /* Keep the process handle artificially alive until the process
-                                * exits so that the information in the handle isn't lost. */
-                               _wapi_handle_ref (handle);
-                               mono_process->handle = handle;
+                       mono_os_sem_init (&mono_process->exit_sem, 0);
 
-                               process_handle_data->mono_process = mono_process;
+                       /* 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 (&mono_processes_mutex);
-                               mono_process->next = mono_processes;
-                               mono_processes = mono_process;
-                               mono_os_mutex_unlock (&mono_processes_mutex);
-                       }
+                       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;
@@ -1072,7 +1073,7 @@ gboolean CreateProcess (const gunichar2 *appname, const gunichar2 *cmdline,
        }
 
        if (fork_failed)
-               _wapi_handle_unref (handle);
+               mono_w32handle_unref (handle);
 
        if (startup_pipe [1] != -1) {
                /* Write 1 byte, doesn't matter what */
@@ -1130,20 +1131,22 @@ process_set_name (WapiHandle_process *process_handle)
 }
 
 void
-wapi_processes_init (void)
+_wapi_processes_init (void)
 {
-       pid_t pid = _wapi_getpid ();
+       pid_t pid = wapi_getpid ();
        WapiHandle_process process_handle = {0};
 
-       _wapi_handle_register_capabilities (WAPI_HANDLE_PROCESS,
-               (WapiHandleCapability)(WAPI_HANDLE_CAP_WAIT | WAPI_HANDLE_CAP_SPECIAL_WAIT));
+       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 = _wapi_handle_new (WAPI_HANDLE_PROCESS,
+       current_process = mono_w32handle_new (MONO_W32HANDLE_PROCESS,
                                            &process_handle);
        g_assert (current_process);
 
@@ -1153,7 +1156,7 @@ wapi_processes_init (void)
 gpointer
 _wapi_process_duplicate (void)
 {
-       _wapi_handle_ref (current_process);
+       mono_w32handle_ref (current_process);
        
        return current_process;
 }
@@ -1209,9 +1212,9 @@ process_open_compare (gpointer handle, gpointer user_data)
         * unsignalled
         */
        if (checking_pid == wanted_pid &&
-           !_wapi_handle_issignalled (handle)) {
+           !mono_w32handle_issignalled (handle)) {
                /* If the handle is blown away in the window between
-                * returning TRUE here and _wapi_search_handle pinging
+                * returning TRUE here and mono_w32handle_search pinging
                 * the timestamp, the search will continue
                 */
                return TRUE;
@@ -1239,7 +1242,7 @@ OpenProcess (guint32 req_access G_GNUC_UNUSED, gboolean inherit G_GNUC_UNUSED, g
        
        MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: looking for process %d", __func__, pid);
 
-       handle = _wapi_search_handle (WAPI_HANDLE_PROCESS,
+       handle = mono_w32handle_search (MONO_W32HANDLE_PROCESS,
                                      process_open_compare,
                                      GUINT_TO_POINTER (pid), NULL, TRUE);
        if (handle == 0) {
@@ -1257,7 +1260,7 @@ OpenProcess (guint32 req_access G_GNUC_UNUSED, gboolean inherit G_GNUC_UNUSED, g
                }
        }
 
-       /* _wapi_search_handle () already added a ref */
+       /* mono_w32handle_search () already added a ref */
        return handle;
 }
 
@@ -1266,6 +1269,7 @@ GetExitCodeProcess (gpointer process, guint32 *code)
 {
        WapiHandle_process *process_handle;
        guint32 pid = -1;
+       gboolean alerted;
        
        if (!code)
                return FALSE;
@@ -1291,7 +1295,7 @@ GetExitCodeProcess (gpointer process, guint32 *code)
                return FALSE;
        }
 
-       if (process_handle->id == _wapi_getpid ()) {
+       if (process_handle->id == wapi_getpid ()) {
                *code = STILL_ACTIVE;
                return TRUE;
        }
@@ -1302,9 +1306,9 @@ GetExitCodeProcess (gpointer process, guint32 *code)
        /* Make sure any process exit has been noticed, before
         * checking if the process is signalled.  Fixes bug 325463.
         */
-       process_wait (process, 0, TRUE);
+       process_wait (process, 0, &alerted);
        
-       if (_wapi_handle_issignalled (process))
+       if (mono_w32handle_issignalled (process))
                *code = process_handle->exitstatus;
        else
                *code = STILL_ACTIVE;
@@ -1350,7 +1354,7 @@ GetProcessTimes (gpointer process, WapiFileTime *create_time,
        /* A process handle is only signalled if the process has
         * exited.  Otherwise exit_time isn't set
         */
-       if (_wapi_handle_issignalled (process))
+       if (mono_w32handle_issignalled (process))
                *exit_time = process_handle->exit_time;
 
 #ifdef HAVE_GETRUSAGE
@@ -2588,7 +2592,7 @@ mono_processes_cleanup (void)
                        mp->handle = NULL;
                        mono_os_mutex_unlock (&mono_processes_mutex);
                        if (unref_handle)
-                               _wapi_handle_unref (unref_handle);
+                               mono_w32handle_unref (unref_handle);
                }
        }
 
@@ -2657,6 +2661,23 @@ process_close (gpointer handle, gpointer data)
        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))
 {
@@ -2714,7 +2735,7 @@ process_add_sigchld_handler (void)
 }
 
 static guint32
-process_wait (gpointer handle, guint32 timeout, gboolean alertable)
+process_wait (gpointer handle, guint32 timeout, gboolean *alerted)
 {
        WapiHandle_process *process_handle;
        pid_t pid G_GNUC_UNUSED, ret;
@@ -2728,6 +2749,9 @@ process_wait (gpointer handle, guint32 timeout, gboolean alertable)
 
        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);
@@ -2783,26 +2807,20 @@ process_wait (gpointer handle, guint32 timeout, gboolean alertable)
                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)), alertable ? MONO_SEM_FLAGS_ALERTABLE : MONO_SEM_FLAGS_NONE);
+                       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, alertable ? MONO_SEM_FLAGS_ALERTABLE : MONO_SEM_FLAGS_NONE);
-               }
-
-               if (ret == -1 && errno != EINTR && errno != ETIMEDOUT) {
-                       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s (%p, %u): sem_timedwait failure: %s", 
-                                  __func__, handle, timeout, g_strerror (errno));
-                       /* Should we return a failure here? */
+                       ret = mono_os_sem_wait (&mp->exit_sem, alerted ? MONO_SEM_FLAGS_ALERTABLE : MONO_SEM_FLAGS_NONE);
                }
 
-               if (ret == 0) {
+               if (ret == MONO_SEM_TIMEDWAIT_RET_SUCCESS) {
                        /* Success, process has exited */
                        mono_os_sem_post (&mp->exit_sem);
                        break;
                }
 
-               if (timeout == 0) {
+               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;
                }
@@ -2813,8 +2831,9 @@ process_wait (gpointer handle, guint32 timeout, gboolean alertable)
                        return WAIT_TIMEOUT;
                }
                
-               if (alertable && _wapi_thread_cur_apc_pending ()) {
+               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;
                }
        }
@@ -2834,7 +2853,7 @@ process_wait (gpointer handle, guint32 timeout, gboolean alertable)
        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);
 
-       _wapi_handle_set_signal_state (handle, TRUE, TRUE);
+       mono_w32handle_set_signal_state (handle, TRUE, TRUE);
 
        return WAIT_OBJECT_0;
 }
index a5ff917f4dfb392ce2941f152b600cce216163f8..3193bc58731a248858f96506a52c25fd1d34b09d 100644 (file)
 #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/handles.h>
 #include <mono/io-layer/access.h>
 #include <mono/io-layer/versioninfo.h>
 
index 8414f4e9205266daca7305346e1f59a15f6ddd93..3c27eef98921a6cfb891503ec68e47dc9ded51da 100644 (file)
 #include <config.h>
 #include <glib.h>
 
-extern struct _WapiHandleOps _wapi_sem_ops;
-extern struct _WapiHandleOps _wapi_namedsem_ops;
-
-extern void _wapi_sem_details (gpointer handle_info);
+#include "wapi-private.h"
 
 /* emulate sem_t, so that we can prod the internal state more easily */
 struct _WapiHandle_sem
@@ -27,9 +24,11 @@ struct _WapiHandle_sem
 
 struct _WapiHandle_namedsem
 {
+       struct _WapiHandle_sem s;
        WapiSharedNamespace sharedns;
-       guint32 val;
-       gint32 max;
 };
 
+void
+_wapi_semaphore_init (void);
+
 #endif /* _WAPI_SEMAPHORE_PRIVATE_H_ */
index 721749cd3d7d94603885e83bdddaefef30e52297..c473f4dc00483b59d7dcce3d84388b53b3457df4 100644 (file)
 
 #include <mono/io-layer/wapi.h>
 #include <mono/io-layer/wapi-private.h>
-#include <mono/io-layer/handles-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);
 
-struct _WapiHandleOps _wapi_sem_ops = {
+static MonoW32HandleOps _wapi_sem_ops = {
        NULL,                   /* close */
        sema_signal,            /* signal */
        sema_own,               /* own */
        NULL,                   /* is_owned */
        NULL,                   /* special_wait */
-       NULL                    /* prewait */
+       NULL,                   /* prewait */
+       sema_details,   /* details */
+       sema_typename,  /* typename */
+       sema_typesize,  /* typesize */
 };
 
-void _wapi_sem_details (gpointer handle_info)
-{
-       struct _WapiHandle_sem *sem = (struct _WapiHandle_sem *)handle_info;
-       
-       g_print ("val: %5u, max: %5d", sem->val, sem->max);
-}
-
-struct _WapiHandleOps _wapi_namedsem_ops = {
+static MonoW32HandleOps _wapi_namedsem_ops = {
        NULL,                   /* close */
        namedsema_signal,       /* signal */
        namedsema_own,          /* own */
        NULL,                   /* is_owned */
        NULL,                   /* special_wait */
-       NULL                    /* prewait */
+       NULL,                   /* prewait */
+       namedsema_details,      /* details */
+       namedsema_typename,     /* typename */
+       namedsema_typesize,     /* typesize */
 };
 
-static gboolean sem_release (gpointer handle, gint32 count, gint32 *prev);
-static gboolean namedsem_release (gpointer handle, gint32 count, gint32 *prev);
-
-static struct 
+void
+_wapi_semaphore_init (void)
 {
-       gboolean (*release)(gpointer handle, gint32 count, gint32 *prev);
-} sem_ops[WAPI_HANDLE_COUNT] = {
-       {NULL},
-       {NULL},
-       {NULL},
-       {NULL},
-       {sem_release},
-       {NULL},
-       {NULL},
-       {NULL},
-       {NULL},
-       {NULL},
-       {NULL},
-       {NULL},
-       {namedsem_release},
-};
-
-static mono_once_t sem_ops_once=MONO_ONCE_INIT;
+       mono_w32handle_register_ops (MONO_W32HANDLE_SEM,      &_wapi_sem_ops);
+       mono_w32handle_register_ops (MONO_W32HANDLE_NAMEDSEM, &_wapi_namedsem_ops);
 
-static void sem_ops_init (void)
-{
-       _wapi_handle_register_capabilities (WAPI_HANDLE_SEM,
-               (WapiHandleCapability)(WAPI_HANDLE_CAP_WAIT | WAPI_HANDLE_CAP_SIGNAL));
-       _wapi_handle_register_capabilities (WAPI_HANDLE_NAMEDSEM,
-               (WapiHandleCapability)(WAPI_HANDLE_CAP_WAIT | WAPI_HANDLE_CAP_SIGNAL));
+       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 void sema_signal(gpointer handle)
+static const char* sem_handle_type_to_string (MonoW32HandleType type)
 {
-       ReleaseSemaphore(handle, 1, NULL);
+       switch (type) {
+       case MONO_W32HANDLE_SEM: return "sem";
+       case MONO_W32HANDLE_NAMEDSEM: return "named sem";
+       default:
+               g_assert_not_reached ();
+       }
 }
 
-static gboolean sema_own (gpointer handle)
+static gboolean sem_handle_own (gpointer handle, MonoW32HandleType type)
 {
        struct _WapiHandle_sem *sem_handle;
-       gboolean ok;
-       
-       ok=_wapi_lookup_handle (handle, WAPI_HANDLE_SEM,
-                               (gpointer *)&sem_handle);
-       if(ok==FALSE) {
-               g_warning ("%s: error looking up sem handle %p", __func__,
-                          handle);
-               return(FALSE);
+
+       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 sem handle %p", __func__, handle);
+
+       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--;
-       
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: sem %p val now %d", __func__, handle, sem_handle->val);
 
-       if(sem_handle->val==0) {
-               _wapi_handle_set_signal_state (handle, FALSE, FALSE);
-       }
+       if (sem_handle->val == 0)
+               mono_w32handle_set_signal_state (handle, FALSE, FALSE);
+
+       return TRUE;
+}
 
-       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)
@@ -127,146 +122,123 @@ static void namedsema_signal (gpointer handle)
 /* NB, always called with the shared handle lock held */
 static gboolean namedsema_own (gpointer handle)
 {
-       struct _WapiHandle_namedsem *namedsem_handle;
-       gboolean ok;
-       
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: owning named sem handle %p", __func__, handle);
-
-       ok = _wapi_lookup_handle (handle, WAPI_HANDLE_NAMEDSEM,
-                                 (gpointer *)&namedsem_handle);
-       if (ok == FALSE) {
-               g_warning ("%s: error looking up named sem handle %p",
-                          __func__, handle);
-               return (FALSE);
-       }
-       
-       namedsem_handle->val--;
-       
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: named sem %p val now %d", __func__, handle,
-                  namedsem_handle->val);
+       return sem_handle_own (handle, MONO_W32HANDLE_NAMEDSEM);
+}
 
-       if (namedsem_handle->val == 0) {
-               _wapi_handle_set_signal_state (handle, FALSE, FALSE);
-       }
-       
-       return (TRUE);
+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_create (WapiSecurityAttributes *security G_GNUC_UNUSED,
-                           gint32 initial, gint32 max)
+
+static gpointer sem_handle_create (struct _WapiHandle_sem *sem_handle, MonoW32HandleType type, gint32 initial, gint32 max)
 {
-       struct _WapiHandle_sem sem_handle = {0};
        gpointer handle;
        int thr_ret;
-       
-       /* 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);
-       
-       sem_handle.val = initial;
-       sem_handle.max = max;
 
-       handle = _wapi_handle_new (WAPI_HANDLE_SEM, &sem_handle);
-       if (handle == _WAPI_HANDLE_INVALID) {
-               g_warning ("%s: error creating semaphore handle", __func__);
+       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);
+               return NULL;
        }
 
-       thr_ret = _wapi_handle_lock_handle (handle);
+       thr_ret = mono_w32handle_lock_handle (handle);
        g_assert (thr_ret == 0);
-       
-       if (initial != 0) {
-               _wapi_handle_set_signal_state (handle, TRUE, FALSE);
-       }
 
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Created semaphore handle %p initial %d max %d",
-                  __func__, handle, initial, max);
+       if (initial != 0)
+               mono_w32handle_set_signal_state (handle, TRUE, FALSE);
 
-       thr_ret = _wapi_handle_unlock_handle (handle);
+       thr_ret = mono_w32handle_unlock_handle (handle);
        g_assert (thr_ret == 0);
 
-       return(handle);
+       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 (WapiSecurityAttributes *security G_GNUC_UNUSED, gint32 initial, gint32 max, const gunichar2 *name G_GNUC_UNUSED)
+static gpointer namedsem_create (gint32 initial, gint32 max, const gunichar2 *name)
 {
-       struct _WapiHandle_namedsem namedsem_handle = {{{0}}, 0};
        gpointer handle;
        gchar *utf8_name;
        int thr_ret;
-       
-       /* w32 seems to guarantee that opening named objects can't
-        * race each other
-        */
+
+       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);
-       
-       /* 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);
 
        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 [%s]", __func__, utf8_name);
 
-       handle = _wapi_search_handle_namespace (WAPI_HANDLE_NAMEDSEM,
-                                               utf8_name);
-       if (handle == _WAPI_HANDLE_INVALID) {
-               /* The name has already been used for a different
-                * object.
-                */
+       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);
-               goto cleanup;
        } else if (handle) {
-               /* Not an error, but this is how the caller is
-                * informed that the semaphore wasn't freshly created
-                */
+               /* 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, so create both the private
-                * and shared parts
-                */
-       
+               /* 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';
-       
-               namedsem_handle.val = initial;
-               namedsem_handle.max = max;
 
-               handle = _wapi_handle_new (WAPI_HANDLE_NAMEDSEM,
-                                          &namedsem_handle);
-       
-               if (handle == _WAPI_HANDLE_INVALID) {
-                       g_warning ("%s: error creating named sem handle", __func__);
-                       SetLastError (ERROR_GEN_FAILURE);
-                       goto cleanup;
-               }
-       
-               /* Set the initial state, as this is a completely new
-                * handle
-                */
-               thr_ret = _wapi_handle_lock_handle (handle);
-               g_assert (thr_ret == 0);
-               
-               if (initial != 0) {
-                       _wapi_handle_set_signal_state (handle, TRUE, FALSE);
-               }
-               
-               thr_ret = _wapi_handle_unlock_handle (handle);
-               g_assert (thr_ret == 0);
+               handle = sem_handle_create ((struct _WapiHandle_sem*) &namedsem_handle, MONO_W32HANDLE_NAMEDSEM, initial, max);
        }
-       
-       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);
-       
+
+       thr_ret = _wapi_namespace_unlock (NULL);
+       g_assert (thr_ret == 0);
+
        return handle;
 }
 
@@ -291,8 +263,6 @@ cleanup:
  */
 gpointer CreateSemaphore(WapiSecurityAttributes *security G_GNUC_UNUSED, gint32 initial, gint32 max, const gunichar2 *name)
 {
-       mono_once (&sem_ops_once, sem_ops_init);
-       
        if (max <= 0) {
                MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: max <= 0", __func__);
 
@@ -307,111 +277,13 @@ gpointer CreateSemaphore(WapiSecurityAttributes *security G_GNUC_UNUSED, gint32
                return(NULL);
        }
 
-       if (name == NULL) {
-               return (sem_create (security, initial, max));
-       } else {
-               return (namedsem_create (security, initial, max, name));
-       }
-}
-
-static gboolean sem_release (gpointer handle, gint32 count, gint32 *prevcount)
-{
-       struct _WapiHandle_sem *sem_handle;
-       gboolean ok;
-       gboolean ret=FALSE;
-       int thr_ret;
-       
-       ok = _wapi_lookup_handle (handle, WAPI_HANDLE_SEM,
-                                 (gpointer *)&sem_handle);
-       if (ok == FALSE) {
-               g_warning ("%s: error looking up sem handle %p", __func__,
-                          handle);
-               return(FALSE);
-       }
-
-       thr_ret = _wapi_handle_lock_handle (handle);
-       g_assert (thr_ret == 0);
-
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: sem %p val %d count %d", __func__, handle,
-                  sem_handle->val, count);
-       
-       /* Do this before checking for count overflow, because overflowing max
-        * is a listed technique for finding the current value
-        */
-       if (prevcount != NULL) {
-               *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: sem %p max value would be exceeded: max %d current %d count %d", __func__, handle, sem_handle->max, sem_handle->val, count);
-
-               goto end;
-       }
-       
-       sem_handle->val += count;
-       _wapi_handle_set_signal_state (handle, TRUE, TRUE);
-       
-       ret = TRUE;
-
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: sem %p val now %d", __func__, handle, sem_handle->val);
-       
-end:
-       thr_ret = _wapi_handle_unlock_handle (handle);
-       g_assert (thr_ret == 0);
-
-       return(ret);
-}
-
-static gboolean namedsem_release (gpointer handle, gint32 count,
-                                 gint32 *prevcount)
-{
-       struct _WapiHandle_namedsem *sem_handle;
-       gboolean ok;
-       gboolean ret=FALSE;
-       int thr_ret;
-       
-       ok = _wapi_lookup_handle (handle, WAPI_HANDLE_NAMEDSEM,
-                                 (gpointer *)&sem_handle);
-       if (ok == FALSE) {
-               g_warning ("%s: error looking up sem handle %p", __func__,
-                          handle);
-               return(FALSE);
-       }
-
-       thr_ret = _wapi_handle_lock_handle (handle);
-       g_assert (thr_ret == 0);
-
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: named sem %p val %d count %d", __func__, handle,
-                 sem_handle->val, count);
-       
-       /* Do this before checking for count overflow, because overflowing max
-        * is a listed technique for finding the current value
+       /* 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
         */
-       if (prevcount != NULL) {
-               *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: named sem %p max value would be exceeded: max %d current %d count %d", __func__, handle, sem_handle->max, sem_handle->val, count);
-
-               goto end;
-       }
-       
-       sem_handle->val += count;
-       _wapi_handle_set_signal_state (handle, TRUE, TRUE);
-       
-       ret = TRUE;
-
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: named sem %p val now %d", __func__, handle,
-                 sem_handle->val);
-       
-end:
-       thr_ret = _wapi_handle_unlock_handle (handle);
-       g_assert (thr_ret == 0);
+       SetLastError (ERROR_SUCCESS);
 
-       return(ret);
+       return name ? namedsem_create (initial, max, name) : sem_create (initial, max);
 }
 
 /**
@@ -428,21 +300,61 @@ end:
  */
 gboolean ReleaseSemaphore(gpointer handle, gint32 count, gint32 *prevcount)
 {
-       WapiHandleType type;
-       
-       if (handle == NULL) {
+       MonoW32HandleType type;
+       struct _WapiHandle_sem *sem_handle;
+       int thr_ret;
+       gboolean ret;
+
+       if (!handle) {
                SetLastError (ERROR_INVALID_HANDLE);
-               return (FALSE);
+               return FALSE;
        }
-       
-       type = _wapi_handle_type (handle);
-       
-       if (sem_ops[type].release == NULL) {
+
+       switch (type = mono_w32handle_get_type (handle)) {
+       case MONO_W32HANDLE_SEM:
+       case MONO_W32HANDLE_NAMEDSEM:
+               break;
+       default:
                SetLastError (ERROR_INVALID_HANDLE);
-               return (FALSE);
+               return FALSE;
        }
-       
-       return (sem_ops[type].release (handle, count, prevcount));
+
+       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,
@@ -452,8 +364,6 @@ gpointer OpenSemaphore (guint32 access G_GNUC_UNUSED, gboolean inherit G_GNUC_UN
        gchar *utf8_name;
        int thr_ret;
 
-       mono_once (&sem_ops_once, sem_ops_init);
-       
        /* w32 seems to guarantee that opening named objects can't
         * race each other
         */
@@ -464,9 +374,9 @@ gpointer OpenSemaphore (guint32 access G_GNUC_UNUSED, gboolean inherit G_GNUC_UN
        
        MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Opening named sem [%s]", __func__, utf8_name);
 
-       handle = _wapi_search_handle_namespace (WAPI_HANDLE_NAMEDSEM,
+       handle = _wapi_search_handle_namespace (MONO_W32HANDLE_NAMEDSEM,
                                                utf8_name);
-       if (handle == _WAPI_HANDLE_INVALID) {
+       if (handle == INVALID_HANDLE_VALUE) {
                /* The name has already been used for a different
                 * object.
                 */
index 64a8b330d4400934a3c8bb5667fa2fc3cc6d5fdb..8fb0e2703bd21386f9991b1ae18333a7c390abed 100644 (file)
@@ -27,17 +27,12 @@ _wapi_shm_semaphores_init (void)
                mono_os_mutex_init (&noshm_sems [i]);
 }
 
-void
-_wapi_shm_semaphores_remove (void)
-{
-       /* Nothing */
-}
-
 int
 _wapi_shm_sem_lock (int sem)
 {
        DEBUGLOG ("%s: locking nosem %d", __func__, sem);
-       return mono_os_mutex_lock (&noshm_sems[sem]);
+       mono_os_mutex_lock (&noshm_sems[sem]);
+       return 0;
 }
 
 int
@@ -51,5 +46,6 @@ int
 _wapi_shm_sem_unlock (int sem)
 {
        DEBUGLOG ("%s: unlocking nosem %d", __func__, sem);
-       return mono_os_mutex_unlock (&noshm_sems[sem]);
+       mono_os_mutex_unlock (&noshm_sems[sem]);
+       return 0;
 }
index 4807adc5a8e8af2567b97cf6e1b514d88eefe1e9..204f50661ff4eff220f0d9ba4f5c427c5e4c5a2b 100644 (file)
@@ -11,7 +11,6 @@
 #define _WAPI_SHARED_H_
 
 extern void _wapi_shm_semaphores_init (void);
-extern void _wapi_shm_semaphores_remove (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);
index db210e2356827dcbe42d4ee0c6213fa0bbdafee2..31bbfe33c89c995c8eaed0b5428b78268b362b1e 100644 (file)
@@ -13,7 +13,7 @@
 #include <config.h>
 #include <glib.h>
 
-extern struct _WapiHandleOps _wapi_socket_ops;
+#include "wapi-private.h"
 
 struct _WapiHandle_socket
 {
@@ -24,4 +24,7 @@ struct _WapiHandle_socket
        int still_readable;
 };
 
+void
+_wapi_socket_init (void);
+
 #endif /* _WAPI_SOCKET_PRIVATE_H_ */
index 4785e1504e3ff98e895c17cb68e6296bf75dd171..05012d26fbbb505967a484272cb4ed1c99f6bad7 100644 (file)
 #include <mono/io-layer/wapi.h>
 #include <mono/io-layer/wapi-private.h>
 #include <mono/io-layer/socket-private.h>
-#include <mono/io-layer/handles-private.h>
 #include <mono/io-layer/socket-wrappers.h>
 #include <mono/io-layer/io-trace.h>
 #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 <netinet/in.h>
 #include <netinet/tcp.h>
 static guint32 in_cleanup = 0;
 
 static void socket_close (gpointer handle, gpointer data);
+static void socket_details (gpointer data);
+static const gchar* socket_typename (void);
+static gsize socket_typesize (void);
 
-struct _WapiHandleOps _wapi_socket_ops = {
+static MonoW32HandleOps _wapi_socket_ops = {
        socket_close,           /* close */
        NULL,                   /* signal */
        NULL,                   /* own */
        NULL,                   /* is_owned */
        NULL,                   /* special_wait */
-       NULL                    /* prewait */
+       NULL,                   /* prewait */
+       socket_details, /* details */
+       socket_typename,        /* typename */
+       socket_typesize,        /* typesize */
 };
 
-static mono_once_t socket_ops_once=MONO_ONCE_INIT;
-
-static void socket_ops_init (void)
+void
+_wapi_socket_init (void)
 {
-       /* No capabilities to register */
+       mono_w32handle_register_ops (MONO_W32HANDLE_SOCKET, &_wapi_socket_ops);
 }
 
 static void socket_close (gpointer handle, gpointer data)
 {
        int ret;
        struct _WapiHandle_socket *socket_handle = (struct _WapiHandle_socket *)data;
+       MonoThreadInfo *info = mono_thread_info_current ();
 
        MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: closing socket handle %p", __func__, handle);
 
@@ -91,7 +97,7 @@ static void socket_close (gpointer handle, gpointer data)
        do {
                ret = close (GPOINTER_TO_UINT(handle));
        } while (ret == -1 && errno == EINTR &&
-                !_wapi_thread_cur_apc_pending ());
+                !mono_thread_info_is_interrupt_state (info));
        
        if (ret == -1) {
                gint errnum = errno;
@@ -105,11 +111,28 @@ static void socket_close (gpointer handle, gpointer data)
                socket_handle->saved_error = 0;
 }
 
+static void socket_details (gpointer data)
+{
+       /* FIXME: do something */
+}
+
+static const gchar* socket_typename (void)
+{
+       return "Socket";
+}
+
+static gsize socket_typesize (void)
+{
+       return sizeof (struct _WapiHandle_socket);
+}
+
 static gboolean
-cleanup_close (gpointer handle, gpointer data)
+cleanup_close (gpointer handle, gpointer data, gpointer user_data)
 {
-       _wapi_handle_ops_close (handle, NULL);
-       return TRUE;
+       if (mono_w32handle_get_type (handle) == MONO_W32HANDLE_SOCKET)
+               mono_w32handle_ops_close (handle, data);
+
+       return FALSE;
 }
 
 void _wapi_cleanup_networking(void)
@@ -117,7 +140,7 @@ void _wapi_cleanup_networking(void)
        MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: cleaning up", __func__);
 
        in_cleanup = 1;
-       _wapi_handle_foreach (WAPI_HANDLE_SOCKET, cleanup_close, NULL);
+       mono_w32handle_foreach (cleanup_close, NULL);
        in_cleanup = 0;
 }
 
@@ -135,12 +158,12 @@ int closesocket(guint32 fd)
 {
        gpointer handle = GUINT_TO_POINTER (fd);
        
-       if (_wapi_handle_type (handle) != WAPI_HANDLE_SOCKET) {
+       if (mono_w32handle_get_type (handle) != MONO_W32HANDLE_SOCKET) {
                WSASetLastError (WSAENOTSOCK);
                return(0);
        }
        
-       _wapi_handle_unref (handle);
+       mono_w32handle_unref (handle);
        return(0);
 }
 
@@ -152,18 +175,19 @@ guint32 _wapi_accept(guint32 fd, struct sockaddr *addr, socklen_t *addrlen)
        struct _WapiHandle_socket new_socket_handle = {0};
        gboolean ok;
        int new_fd;
+       MonoThreadInfo *info = mono_thread_info_current ();
 
        if (addr != NULL && *addrlen < sizeof(struct sockaddr)) {
                WSASetLastError (WSAEFAULT);
                return(INVALID_SOCKET);
        }
        
-       if (_wapi_handle_type (handle) != WAPI_HANDLE_SOCKET) {
+       if (mono_w32handle_get_type (handle) != MONO_W32HANDLE_SOCKET) {
                WSASetLastError (WSAENOTSOCK);
                return(INVALID_SOCKET);
        }
        
-       ok = _wapi_lookup_handle (handle, WAPI_HANDLE_SOCKET,
+       ok = mono_w32handle_lookup (handle, MONO_W32HANDLE_SOCKET,
                                  (gpointer *)&socket_handle);
        if (ok == FALSE) {
                g_warning ("%s: error looking up socket handle %p",
@@ -175,7 +199,7 @@ guint32 _wapi_accept(guint32 fd, struct sockaddr *addr, socklen_t *addrlen)
        do {
                new_fd = accept (fd, addr, addrlen);
        } while (new_fd == -1 && errno == EINTR &&
-                !_wapi_thread_cur_apc_pending());
+                !mono_thread_info_is_interrupt_state (info));
 
        if (new_fd == -1) {
                gint errnum = errno;
@@ -187,7 +211,7 @@ guint32 _wapi_accept(guint32 fd, struct sockaddr *addr, socklen_t *addrlen)
                return(INVALID_SOCKET);
        }
 
-       if (new_fd >= _wapi_fd_reserve) {
+       if (new_fd >= mono_w32handle_fd_reserve) {
                MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: File descriptor is too big", __func__);
 
                WSASetLastError (WSASYSCALLFAILURE);
@@ -202,9 +226,9 @@ guint32 _wapi_accept(guint32 fd, struct sockaddr *addr, socklen_t *addrlen)
        new_socket_handle.protocol = socket_handle->protocol;
        new_socket_handle.still_readable = 1;
 
-       new_handle = _wapi_handle_new_fd (WAPI_HANDLE_SOCKET, new_fd,
+       new_handle = mono_w32handle_new_fd (MONO_W32HANDLE_SOCKET, new_fd,
                                          &new_socket_handle);
-       if(new_handle == _WAPI_HANDLE_INVALID) {
+       if(new_handle == INVALID_HANDLE_VALUE) {
                g_warning ("%s: error creating socket handle", __func__);
                WSASetLastError (ERROR_GEN_FAILURE);
                return(INVALID_SOCKET);
@@ -221,7 +245,7 @@ int _wapi_bind(guint32 fd, struct sockaddr *my_addr, socklen_t addrlen)
        gpointer handle = GUINT_TO_POINTER (fd);
        int ret;
        
-       if (_wapi_handle_type (handle) != WAPI_HANDLE_SOCKET) {
+       if (mono_w32handle_get_type (handle) != MONO_W32HANDLE_SOCKET) {
                WSASetLastError (WSAENOTSOCK);
                return(SOCKET_ERROR);
        }
@@ -245,8 +269,9 @@ int _wapi_connect(guint32 fd, const struct sockaddr *serv_addr,
        struct _WapiHandle_socket *socket_handle;
        gboolean ok;
        gint errnum;
-       
-       if (_wapi_handle_type (handle) != WAPI_HANDLE_SOCKET) {
+       MonoThreadInfo *info = mono_thread_info_current ();
+
+       if (mono_w32handle_get_type (handle) != MONO_W32HANDLE_SOCKET) {
                WSASetLastError (WSAENOTSOCK);
                return(SOCKET_ERROR);
        }
@@ -275,8 +300,8 @@ int _wapi_connect(guint32 fd, const struct sockaddr *serv_addr,
                         * But don't do this for EWOULDBLOCK (bug 317315)
                         */
                        if (errnum != WSAEWOULDBLOCK) {
-                               ok = _wapi_lookup_handle (handle,
-                                                         WAPI_HANDLE_SOCKET,
+                               ok = mono_w32handle_lookup (handle,
+                                                         MONO_W32HANDLE_SOCKET,
                                                          (gpointer *)&socket_handle);
                                if (ok == FALSE) {
                                        /* ECONNRESET means the socket was closed by another thread */
@@ -293,7 +318,7 @@ int _wapi_connect(guint32 fd, const struct sockaddr *serv_addr,
                fds.fd = fd;
                fds.events = MONO_POLLOUT;
                while (mono_poll (&fds, 1, -1) == -1 &&
-                      !_wapi_thread_cur_apc_pending ()) {
+                      !mono_thread_info_is_interrupt_state (info)) {
                        if (errno != EINTR) {
                                errnum = errno_to_WSA (errno, __func__);
 
@@ -321,7 +346,7 @@ int _wapi_connect(guint32 fd, const struct sockaddr *serv_addr,
                        errnum = errno_to_WSA (so_error, __func__);
 
                        /* Need to save this socket error */
-                       ok = _wapi_lookup_handle (handle, WAPI_HANDLE_SOCKET,
+                       ok = mono_w32handle_lookup (handle, MONO_W32HANDLE_SOCKET,
                                                  (gpointer *)&socket_handle);
                        if (ok == FALSE) {
                                g_warning ("%s: error looking up socket handle %p", __func__, handle);
@@ -345,7 +370,7 @@ int _wapi_getpeername(guint32 fd, struct sockaddr *name, socklen_t *namelen)
        gpointer handle = GUINT_TO_POINTER (fd);
        int ret;
        
-       if (_wapi_handle_type (handle) != WAPI_HANDLE_SOCKET) {
+       if (mono_w32handle_get_type (handle) != MONO_W32HANDLE_SOCKET) {
                WSASetLastError (WSAENOTSOCK);
                return(SOCKET_ERROR);
        }
@@ -370,7 +395,7 @@ int _wapi_getsockname(guint32 fd, struct sockaddr *name, socklen_t *namelen)
        gpointer handle = GUINT_TO_POINTER (fd);
        int ret;
        
-       if (_wapi_handle_type (handle) != WAPI_HANDLE_SOCKET) {
+       if (mono_w32handle_get_type (handle) != MONO_W32HANDLE_SOCKET) {
                WSASetLastError (WSAENOTSOCK);
                return(SOCKET_ERROR);
        }
@@ -400,7 +425,7 @@ int _wapi_getsockopt(guint32 fd, int level, int optname, void *optval,
        struct _WapiHandle_socket *socket_handle;
        gboolean ok;
        
-       if (_wapi_handle_type (handle) != WAPI_HANDLE_SOCKET) {
+       if (mono_w32handle_get_type (handle) != MONO_W32HANDLE_SOCKET) {
                WSASetLastError (WSAENOTSOCK);
                return(SOCKET_ERROR);
        }
@@ -431,7 +456,7 @@ int _wapi_getsockopt(guint32 fd, int level, int optname, void *optval,
        }
 
        if (optname == SO_ERROR) {
-               ok = _wapi_lookup_handle (handle, WAPI_HANDLE_SOCKET,
+               ok = mono_w32handle_lookup (handle, MONO_W32HANDLE_SOCKET,
                                          (gpointer *)&socket_handle);
                if (ok == FALSE) {
                        g_warning ("%s: error looking up socket handle %p",
@@ -459,7 +484,7 @@ int _wapi_listen(guint32 fd, int backlog)
        gpointer handle = GUINT_TO_POINTER (fd);
        int ret;
        
-       if (_wapi_handle_type (handle) != WAPI_HANDLE_SOCKET) {
+       if (mono_w32handle_get_type (handle) != MONO_W32HANDLE_SOCKET) {
                WSASetLastError (WSAENOTSOCK);
                return(SOCKET_ERROR);
        }
@@ -490,8 +515,9 @@ int _wapi_recvfrom(guint32 fd, void *buf, size_t len, int recv_flags,
        struct _WapiHandle_socket *socket_handle;
        gboolean ok;
        int ret;
+       MonoThreadInfo *info = mono_thread_info_current ();
        
-       if (_wapi_handle_type (handle) != WAPI_HANDLE_SOCKET) {
+       if (mono_w32handle_get_type (handle) != MONO_W32HANDLE_SOCKET) {
                WSASetLastError (WSAENOTSOCK);
                return(SOCKET_ERROR);
        }
@@ -499,7 +525,7 @@ int _wapi_recvfrom(guint32 fd, void *buf, size_t len, int recv_flags,
        do {
                ret = recvfrom (fd, buf, len, recv_flags, from, fromlen);
        } while (ret == -1 && errno == EINTR &&
-                !_wapi_thread_cur_apc_pending ());
+                !mono_thread_info_is_interrupt_state (info));
 
        if (ret == 0 && len > 0) {
                /* According to the Linux man page, recvfrom only
@@ -520,7 +546,7 @@ int _wapi_recvfrom(guint32 fd, void *buf, size_t len, int recv_flags,
                 * still_readable != 1 then shutdown
                 * (SHUT_RD|SHUT_RDWR) has been called locally.
                 */
-               ok = _wapi_lookup_handle (handle, WAPI_HANDLE_SOCKET,
+               ok = mono_w32handle_lookup (handle, MONO_W32HANDLE_SOCKET,
                                          (gpointer *)&socket_handle);
                if (ok == FALSE || socket_handle->still_readable != 1) {
                        ret = -1;
@@ -547,8 +573,9 @@ _wapi_recvmsg(guint32 fd, struct msghdr *msg, int recv_flags)
        struct _WapiHandle_socket *socket_handle;
        gboolean ok;
        int ret;
+       MonoThreadInfo *info = mono_thread_info_current ();
        
-       if (_wapi_handle_type (handle) != WAPI_HANDLE_SOCKET) {
+       if (mono_w32handle_get_type (handle) != MONO_W32HANDLE_SOCKET) {
                WSASetLastError (WSAENOTSOCK);
                return(SOCKET_ERROR);
        }
@@ -556,11 +583,11 @@ _wapi_recvmsg(guint32 fd, struct msghdr *msg, int recv_flags)
        do {
                ret = recvmsg (fd, msg, recv_flags);
        } while (ret == -1 && errno == EINTR &&
-                !_wapi_thread_cur_apc_pending ());
+                !mono_thread_info_is_interrupt_state (info));
 
        if (ret == 0) {
                /* see _wapi_recvfrom */
-               ok = _wapi_lookup_handle (handle, WAPI_HANDLE_SOCKET,
+               ok = mono_w32handle_lookup (handle, MONO_W32HANDLE_SOCKET,
                                          (gpointer *)&socket_handle);
                if (ok == FALSE || socket_handle->still_readable != 1) {
                        ret = -1;
@@ -584,8 +611,9 @@ int _wapi_send(guint32 fd, const void *msg, size_t len, int send_flags)
 {
        gpointer handle = GUINT_TO_POINTER (fd);
        int ret;
+       MonoThreadInfo *info = mono_thread_info_current ();
        
-       if (_wapi_handle_type (handle) != WAPI_HANDLE_SOCKET) {
+       if (mono_w32handle_get_type (handle) != MONO_W32HANDLE_SOCKET) {
                WSASetLastError (WSAENOTSOCK);
                return(SOCKET_ERROR);
        }
@@ -593,7 +621,7 @@ int _wapi_send(guint32 fd, const void *msg, size_t len, int send_flags)
        do {
                ret = send (fd, msg, len, send_flags);
        } while (ret == -1 && errno == EINTR &&
-                !_wapi_thread_cur_apc_pending ());
+                !mono_thread_info_is_interrupt_state (info));
 
        if (ret == -1) {
                gint errnum = errno;
@@ -621,8 +649,9 @@ int _wapi_sendto(guint32 fd, const void *msg, size_t len, int send_flags,
 {
        gpointer handle = GUINT_TO_POINTER (fd);
        int ret;
+       MonoThreadInfo *info = mono_thread_info_current ();
        
-       if (_wapi_handle_type (handle) != WAPI_HANDLE_SOCKET) {
+       if (mono_w32handle_get_type (handle) != MONO_W32HANDLE_SOCKET) {
                WSASetLastError (WSAENOTSOCK);
                return(SOCKET_ERROR);
        }
@@ -630,7 +659,7 @@ int _wapi_sendto(guint32 fd, const void *msg, size_t len, int send_flags,
        do {
                ret = sendto (fd, msg, len, send_flags, to, tolen);
        } while (ret == -1 && errno == EINTR &&
-                !_wapi_thread_cur_apc_pending ());
+                !mono_thread_info_is_interrupt_state (info));
 
        if (ret == -1) {
                gint errnum = errno;
@@ -649,8 +678,9 @@ _wapi_sendmsg(guint32 fd,  const struct msghdr *msg, int send_flags)
 {
        gpointer handle = GUINT_TO_POINTER (fd);
        int ret;
+       MonoThreadInfo *info = mono_thread_info_current ();
        
-       if (_wapi_handle_type (handle) != WAPI_HANDLE_SOCKET) {
+       if (mono_w32handle_get_type (handle) != MONO_W32HANDLE_SOCKET) {
                WSASetLastError (WSAENOTSOCK);
                return(SOCKET_ERROR);
        }
@@ -658,7 +688,7 @@ _wapi_sendmsg(guint32 fd,  const struct msghdr *msg, int send_flags)
        do {
                ret = sendmsg (fd, msg, send_flags);
        } while (ret == -1 && errno == EINTR &&
-                !_wapi_thread_cur_apc_pending ());
+                !mono_thread_info_is_interrupt_state (info));
 
        if (ret == -1) {
                gint errnum = errno;
@@ -684,7 +714,7 @@ int _wapi_setsockopt(guint32 fd, int level, int optname,
 #endif
        struct timeval tv;
        
-       if (_wapi_handle_type (handle) != WAPI_HANDLE_SOCKET) {
+       if (mono_w32handle_get_type (handle) != MONO_W32HANDLE_SOCKET) {
                WSASetLastError (WSAENOTSOCK);
                return(SOCKET_ERROR);
        }
@@ -747,14 +777,14 @@ int _wapi_shutdown(guint32 fd, int how)
        gpointer handle = GUINT_TO_POINTER (fd);
        int ret;
 
-       if (_wapi_handle_type (handle) != WAPI_HANDLE_SOCKET) {
+       if (mono_w32handle_get_type (handle) != MONO_W32HANDLE_SOCKET) {
                WSASetLastError (WSAENOTSOCK);
                return(SOCKET_ERROR);
        }
 
        if (how == SHUT_RD ||
            how == SHUT_RDWR) {
-               ok = _wapi_lookup_handle (handle, WAPI_HANDLE_SOCKET,
+               ok = mono_w32handle_lookup (handle, MONO_W32HANDLE_SOCKET,
                                          (gpointer *)&socket_handle);
                if (ok == FALSE) {
                        g_warning ("%s: error looking up socket handle %p",
@@ -811,9 +841,9 @@ guint32 _wapi_socket(int domain, int type, int protocol, void *unused,
                return(INVALID_SOCKET);
        }
 
-       if (fd >= _wapi_fd_reserve) {
+       if (fd >= mono_w32handle_fd_reserve) {
                MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: File descriptor is too big (%d >= %d)",
-                          __func__, fd, _wapi_fd_reserve);
+                          __func__, fd, mono_w32handle_fd_reserve);
 
                WSASetLastError (WSASYSCALLFAILURE);
                close (fd);
@@ -856,10 +886,8 @@ guint32 _wapi_socket(int domain, int type, int protocol, void *unused,
        }
        
        
-       mono_once (&socket_ops_once, socket_ops_init);
-       
-       handle = _wapi_handle_new_fd (WAPI_HANDLE_SOCKET, fd, &socket_handle);
-       if (handle == _WAPI_HANDLE_INVALID) {
+       handle = mono_w32handle_new_fd (MONO_W32HANDLE_SOCKET, fd, &socket_handle);
+       if (handle == INVALID_HANDLE_VALUE) {
                g_warning ("%s: error creating socket handle", __func__);
                WSASetLastError (WSASYSCALLFAILURE);
                close (fd);
@@ -878,7 +906,7 @@ static gboolean socket_disconnect (guint32 fd)
        gpointer handle = GUINT_TO_POINTER (fd);
        int newsock, ret;
        
-       ok = _wapi_lookup_handle (handle, WAPI_HANDLE_SOCKET,
+       ok = mono_w32handle_lookup (handle, MONO_W32HANDLE_SOCKET,
                                  (gpointer *)&socket_handle);
        if (ok == FALSE) {
                g_warning ("%s: error looking up socket handle %p", __func__,
@@ -947,6 +975,7 @@ static gboolean wapi_disconnectex (guint32 fd, WapiOverlapped *overlapped,
 static gint
 wapi_sendfile (guint32 socket, gpointer fd, guint32 bytes_to_write, guint32 bytes_per_send, guint32 flags)
 {
+       MonoThreadInfo *info = mono_thread_info_current ();
 #if defined(HAVE_SENDFILE) && (defined(__linux__) || defined(DARWIN))
        gint file = GPOINTER_TO_INT (fd);
        gint n;
@@ -969,7 +998,7 @@ wapi_sendfile (guint32 socket, gpointer fd, guint32 bytes_to_write, guint32 byte
                /* TODO: Might not send the entire file for non-blocking sockets */
                res = sendfile (file, socket, 0, &statbuf.st_size, NULL, 0);
 #endif
-       } while (res != -1 && errno == EINTR && !_wapi_thread_cur_apc_pending ());
+       } while (res != -1 && errno == EINTR && !mono_thread_info_is_interrupt_state (info));
        if (res == -1) {
                errnum = errno;
                errnum = errno_to_WSA (errnum, __func__);
@@ -986,7 +1015,7 @@ wapi_sendfile (guint32 socket, gpointer fd, guint32 bytes_to_write, guint32 byte
        do {
                do {
                        n = read (file, buffer, SF_BUFFER_SIZE);
-               } while (n == -1 && errno == EINTR && !_wapi_thread_cur_apc_pending ());
+               } while (n == -1 && errno == EINTR && !mono_thread_info_is_interrupt_state (info));
                if (n == -1)
                        break;
                if (n == 0) {
@@ -995,8 +1024,8 @@ wapi_sendfile (guint32 socket, gpointer fd, guint32 bytes_to_write, guint32 byte
                }
                do {
                        n = send (socket, buffer, n, 0); /* short sends? enclose this in a loop? */
-               } while (n == -1 && errno == EINTR && !_wapi_thread_cur_apc_pending ());
-       } while (n != -1 && errno == EINTR && !_wapi_thread_cur_apc_pending ());
+               } while (n == -1 && errno == EINTR && !mono_thread_info_is_interrupt_state (info));
+       } while (n != -1 && errno == EINTR && !mono_thread_info_is_interrupt_state (info));
 
        if (n == -1) {
                gint errnum = errno;
@@ -1017,7 +1046,7 @@ TransmitFile (guint32 socket, gpointer file, guint32 bytes_to_write, guint32 byt
        gpointer sock = GUINT_TO_POINTER (socket);
        gint ret;
 
-       if (_wapi_handle_type (sock) != WAPI_HANDLE_SOCKET) {
+       if (mono_w32handle_get_type (sock) != MONO_W32HANDLE_SOCKET) {
                WSASetLastError (WSAENOTSOCK);
                return FALSE;
        }
@@ -1066,7 +1095,7 @@ WSAIoctl (guint32 fd, gint32 command,
        int ret;
        gchar *buffer = NULL;
 
-       if (_wapi_handle_type (handle) != WAPI_HANDLE_SOCKET) {
+       if (mono_w32handle_get_type (handle) != MONO_W32HANDLE_SOCKET) {
                WSASetLastError (WSAENOTSOCK);
                return SOCKET_ERROR;
        }
@@ -1204,7 +1233,7 @@ int ioctlsocket(guint32 fd, unsigned long command, gpointer arg)
        gpointer handle = GUINT_TO_POINTER (fd);
        int ret;
        
-       if (_wapi_handle_type (handle) != WAPI_HANDLE_SOCKET) {
+       if (mono_w32handle_get_type (handle) != MONO_W32HANDLE_SOCKET) {
                WSASetLastError (WSAENOTSOCK);
                return(SOCKET_ERROR);
        }
@@ -1275,6 +1304,7 @@ int _wapi_select(int nfds G_GNUC_UNUSED, fd_set *readfds, fd_set *writefds,
                 fd_set *exceptfds, struct timeval *timeout)
 {
        int ret, maxfd;
+       MonoThreadInfo *info = mono_thread_info_current ();
        
        for (maxfd = FD_SETSIZE-1; maxfd >= 0; maxfd--) {
                if ((readfds && FD_ISSET (maxfd, readfds)) ||
@@ -1293,7 +1323,7 @@ int _wapi_select(int nfds G_GNUC_UNUSED, fd_set *readfds, fd_set *writefds,
                ret = select(maxfd + 1, readfds, writefds, exceptfds,
                             timeout);
        } while (ret == -1 && errno == EINTR &&
-                !_wapi_thread_cur_apc_pending ());
+                !mono_thread_info_is_interrupt_state (info));
 
        if (ret == -1) {
                gint errnum = errno;
@@ -1316,7 +1346,7 @@ void _wapi_FD_CLR(guint32 fd, fd_set *set)
                return;
        }
        
-       if (_wapi_handle_type (handle) != WAPI_HANDLE_SOCKET) {
+       if (mono_w32handle_get_type (handle) != MONO_W32HANDLE_SOCKET) {
                WSASetLastError (WSAENOTSOCK);
                return;
        }
@@ -1333,7 +1363,7 @@ int _wapi_FD_ISSET(guint32 fd, fd_set *set)
                return(0);
        }
        
-       if (_wapi_handle_type (handle) != WAPI_HANDLE_SOCKET) {
+       if (mono_w32handle_get_type (handle) != MONO_W32HANDLE_SOCKET) {
                WSASetLastError (WSAENOTSOCK);
                return(0);
        }
@@ -1350,7 +1380,7 @@ void _wapi_FD_SET(guint32 fd, fd_set *set)
                return;
        }
 
-       if (_wapi_handle_type (handle) != WAPI_HANDLE_SOCKET) {
+       if (mono_w32handle_get_type (handle) != MONO_W32HANDLE_SOCKET) {
                WSASetLastError (WSAENOTSOCK);
                return;
        }
diff --git a/mono/io-layer/thread-private.h b/mono/io-layer/thread-private.h
deleted file mode 100644 (file)
index a950e5e..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * thread-private.h:  Private definitions for thread handles
- *
- * Author:
- *     Dick Porter (dick@ximian.com)
- *
- * (C) 2002 Ximian, Inc.
- */
-
-#ifndef _WAPI_THREAD_PRIVATE_H_
-#define _WAPI_THREAD_PRIVATE_H_
-
-#include <config.h>
-#include <glib.h>
-#include <pthread.h>
-
-/* There doesn't seem to be a defined symbol for this */
-#define _WAPI_THREAD_CURRENT (gpointer)0xFFFFFFFE
-
-extern struct _WapiHandleOps _wapi_thread_ops;
-
-struct _WapiHandle_thread
-{
-       pthread_t id;
-       GPtrArray *owned_mutexes;
-       gint32 priority;
-};
-
-typedef struct _WapiHandle_thread WapiHandle_thread;
-
-extern gboolean _wapi_thread_cur_apc_pending (void);
-extern void _wapi_thread_own_mutex (gpointer mutex);
-extern void _wapi_thread_disown_mutex (gpointer mutex);
-extern void _wapi_thread_cleanup (void);
-
-#endif /* _WAPI_THREAD_PRIVATE_H_ */
diff --git a/mono/io-layer/threads.h b/mono/io-layer/threads.h
deleted file mode 100644 (file)
index f26cefb..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * threads.h:  Thread handles
- *
- * Author:
- *     Dick Porter (dick@ximian.com)
- *
- * (C) 2002 Ximian, Inc.
- */
-
-#ifndef _WAPI_THREADS_H_
-#define _WAPI_THREADS_H_
-
-#include <glib.h>
-
-#include <mono/io-layer/handles.h>
-#include <mono/io-layer/io.h>
-#include <mono/io-layer/status.h>
-#include <mono/io-layer/processes.h>
-#include <mono/io-layer/access.h>
-
-G_BEGIN_DECLS
-
-#define STILL_ACTIVE STATUS_PENDING
-
-#define THREAD_ALL_ACCESS              (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3ff)
-
-typedef guint32 (*WapiThreadStart)(gpointer);
-typedef enum {
-       THREAD_PRIORITY_LOWEST = -2,
-       THREAD_PRIORITY_BELOW_NORMAL = -1,
-       THREAD_PRIORITY_NORMAL = 0,
-       THREAD_PRIORITY_ABOVE_NORMAL = 1,
-       THREAD_PRIORITY_HIGHEST = 2
-} WapiThreadPriority;
-
-gpointer wapi_create_thread_handle (void);
-void wapi_thread_handle_set_exited (gpointer handle, guint32 exitstatus);
-void wapi_ref_thread_handle (gpointer handle);
-gpointer wapi_get_current_thread_handle (void);
-
-char *wapi_current_thread_desc (void);
-
-extern gint32 GetThreadPriority (gpointer handle);
-extern gboolean SetThreadPriority (gpointer handle, gint32 priority);
-
-extern int wapi_thread_priority_to_posix_priority (WapiThreadPriority, int);
-extern void wapi_init_thread_info_priority (gpointer, gint32);
-
-G_END_DECLS
-#endif /* _WAPI_THREADS_H_ */
index aa847569cb898c8e9087a5b285955d7cf53e85ae..5176da07ea7f2aa98f284fbf665d6f7d1cd2d629 100644 (file)
@@ -50,7 +50,6 @@ typedef WapiSecurityAttributes SECURITY_ATTRIBUTES;
 typedef WapiSecurityAttributes *LPSECURITY_ATTRIBUTES;
 typedef WapiOverlapped *LPOVERLAPPED;
 typedef WapiOverlappedCB LPOVERLAPPED_COMPLETION_ROUTINE;
-typedef WapiThreadStart LPTHREAD_START_ROUTINE;
 typedef WapiFileTime FILETIME;
 typedef WapiFileTime *LPFILETIME;
 typedef WapiSystemTime SYSTEMTIME;
index edd875ee188dd3ccc3329e888fdaacde1d8430ec..ddf8e11464ee31340eef33d1c840a7b97c6bb482 100644 (file)
 #include <errno.h>
 
 #include <mono/io-layer/wapi.h>
-#include <mono/io-layer/handles-private.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 (_wapi_handle_issignalled (handle)) {
-               _wapi_handle_ops_own (handle);
+       if (mono_w32handle_issignalled (handle)) {
+               mono_w32handle_ops_own (handle);
                ret = TRUE;
        }
 
@@ -35,8 +36,8 @@ static gboolean own_if_owned(gpointer handle)
 {
        gboolean ret = FALSE;
 
-       if (_wapi_handle_ops_isowned (handle)) {
-               _wapi_handle_ops_own (handle);
+       if (mono_w32handle_ops_isowned (handle)) {
+               mono_w32handle_ops_own (handle);
                ret = TRUE;
        }
 
@@ -68,43 +69,29 @@ guint32 WaitForSingleObjectEx(gpointer handle, guint32 timeout,
        guint32 ret, waited;
        int thr_ret;
        gboolean apc_pending = FALSE;
-       gpointer current_thread = wapi_get_current_thread_handle ();
-       gint64 now, end;
-       
-       if (current_thread == NULL) {
-               SetLastError (ERROR_INVALID_HANDLE);
-               return(WAIT_FAILED);
-       }
-
-       if (handle == _WAPI_THREAD_CURRENT) {
-               handle = wapi_get_current_thread_handle ();
-               if (handle == NULL) {
-                       SetLastError (ERROR_INVALID_HANDLE);
-                       return(WAIT_FAILED);
-               }
-       }
+       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 (_wapi_handle_test_capabilities (handle,
-                                           WAPI_HANDLE_CAP_WAIT) == FALSE) {
+       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);
        }
 
-       _wapi_handle_ops_prewait (handle);
+       mono_w32handle_ops_prewait (handle);
        
-       if (_wapi_handle_test_capabilities (handle, WAPI_HANDLE_CAP_SPECIAL_WAIT) == TRUE) {
+       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 = _wapi_handle_ops_special_wait (handle, timeout, alertable);
+               ret = mono_w32handle_ops_specialwait (handle, timeout, alertable ? &apc_pending : NULL);
        
-               if (alertable && _wapi_thread_cur_apc_pending ())
+               if (apc_pending)
                        ret = WAIT_IO_COMPLETION;
 
                return ret;
@@ -113,11 +100,11 @@ guint32 WaitForSingleObjectEx(gpointer handle, guint32 timeout,
        
        MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: locking handle %p", __func__, handle);
 
-       thr_ret = _wapi_handle_lock_handle (handle);
+       thr_ret = mono_w32handle_lock_handle (handle);
        g_assert (thr_ret == 0);
 
-       if (_wapi_handle_test_capabilities (handle,
-                                           WAPI_HANDLE_CAP_OWN) == TRUE) {
+       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);
@@ -139,13 +126,15 @@ guint32 WaitForSingleObjectEx(gpointer handle, guint32 timeout,
                goto done;
        }
        
-       if (timeout != INFINITE)
-               end = mono_100ns_ticks () + timeout * 1000 * 10;
+       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
                 */
-               _wapi_handle_ops_prewait (handle);
+               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__,
@@ -156,15 +145,15 @@ guint32 WaitForSingleObjectEx(gpointer handle, guint32 timeout,
                }
 
                if (timeout == INFINITE) {
-                       waited = _wapi_handle_timedwait_signal_handle (handle, INFINITE, FALSE, alertable ? &apc_pending : NULL);
+                       waited = mono_w32handle_timedwait_signal_handle (handle, INFINITE, FALSE, alertable ? &apc_pending : NULL);
                } else {
-                       now = mono_100ns_ticks ();
-                       if (end < now) {
+                       gint64 elapsed = mono_100ns_ticks () - wait_start;
+                       if (elapsed >= timeout_in_ticks) {
                                ret = WAIT_TIMEOUT;
                                goto done;
                        }
 
-                       waited = _wapi_handle_timedwait_signal_handle (handle, (end - now) / 10 / 1000, FALSE, alertable ? &apc_pending : NULL);
+                       waited = mono_w32handle_timedwait_signal_handle (handle, (timeout_in_ticks - elapsed) / 10 / 1000, FALSE, alertable ? &apc_pending : NULL);
                }
 
                if(waited==0 && !apc_pending) {
@@ -194,7 +183,7 @@ done:
 
        MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: unlocking handle %p", __func__, handle);
        
-       thr_ret = _wapi_handle_unlock_handle (handle);
+       thr_ret = mono_w32handle_unlock_handle (handle);
        g_assert (thr_ret == 0);
 
        return(ret);
@@ -247,29 +236,7 @@ guint32 SignalObjectAndWait(gpointer signal_handle, gpointer wait,
        guint32 ret = 0, waited;
        int thr_ret;
        gboolean apc_pending = FALSE;
-       gpointer current_thread = wapi_get_current_thread_handle ();
-       gint64 now, end;
-       
-       if (current_thread == NULL) {
-               SetLastError (ERROR_INVALID_HANDLE);
-               return(WAIT_FAILED);
-       }
-
-       if (signal_handle == _WAPI_THREAD_CURRENT) {
-               signal_handle = wapi_get_current_thread_handle ();
-               if (signal_handle == NULL) {
-                       SetLastError (ERROR_INVALID_HANDLE);
-                       return(WAIT_FAILED);
-               }
-       }
-
-       if (wait == _WAPI_THREAD_CURRENT) {
-               wait = wapi_get_current_thread_handle ();
-               if (wait == NULL) {
-                       SetLastError (ERROR_INVALID_HANDLE);
-                       return(WAIT_FAILED);
-               }
-       }
+       gint64 wait_start, timeout_in_ticks;
 
        if ((GPOINTER_TO_UINT (signal_handle) & _WAPI_PROCESS_UNHANDLED) == _WAPI_PROCESS_UNHANDLED) {
                SetLastError (ERROR_INVALID_HANDLE);
@@ -281,19 +248,19 @@ guint32 SignalObjectAndWait(gpointer signal_handle, gpointer wait,
                return(WAIT_FAILED);
        }
        
-       if (_wapi_handle_test_capabilities (signal_handle,
-                                           WAPI_HANDLE_CAP_SIGNAL)==FALSE) {
+       if (mono_w32handle_test_capabilities (signal_handle,
+                                           MONO_W32HANDLE_CAP_SIGNAL)==FALSE) {
                return(WAIT_FAILED);
        }
        
-       if (_wapi_handle_test_capabilities (wait,
-                                           WAPI_HANDLE_CAP_WAIT)==FALSE) {
+       if (mono_w32handle_test_capabilities (wait,
+                                           MONO_W32HANDLE_CAP_WAIT)==FALSE) {
                return(WAIT_FAILED);
        }
 
-       _wapi_handle_ops_prewait (wait);
+       mono_w32handle_ops_prewait (wait);
        
-       if (_wapi_handle_test_capabilities (wait, WAPI_HANDLE_CAP_SPECIAL_WAIT) == TRUE) {
+       if (mono_w32handle_test_capabilities (wait, MONO_W32HANDLE_CAP_SPECIAL_WAIT) == TRUE) {
                g_warning ("%s: handle %p has special wait, implement me!!",
                           __func__, wait);
 
@@ -302,12 +269,12 @@ guint32 SignalObjectAndWait(gpointer signal_handle, gpointer wait,
 
        MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: locking handle %p", __func__, wait);
 
-       thr_ret = _wapi_handle_lock_handle (wait);
+       thr_ret = mono_w32handle_lock_handle (wait);
        g_assert (thr_ret == 0);
 
-       _wapi_handle_ops_signal (signal_handle);
+       mono_w32handle_ops_signal (signal_handle);
 
-       if (_wapi_handle_test_capabilities (wait, WAPI_HANDLE_CAP_OWN)==TRUE) {
+       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);
@@ -323,13 +290,14 @@ guint32 SignalObjectAndWait(gpointer signal_handle, gpointer wait,
                goto done;
        }
 
-       if (timeout != INFINITE)
-               end = mono_100ns_ticks () + timeout * 1000 * 10;
-
+       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
                 */
-               _wapi_handle_ops_prewait (wait);
+               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);
@@ -339,15 +307,15 @@ guint32 SignalObjectAndWait(gpointer signal_handle, gpointer wait,
                }
 
                if (timeout == INFINITE) {
-                       waited = _wapi_handle_timedwait_signal_handle (wait, INFINITE, FALSE, alertable ? &apc_pending : NULL);
+                       waited = mono_w32handle_timedwait_signal_handle (wait, INFINITE, FALSE, alertable ? &apc_pending : NULL);
                } else {
-                       now = mono_100ns_ticks ();
-                       if (end < now) {
+                       gint64 elapsed = mono_100ns_ticks () - wait_start;
+                       if (elapsed >= timeout_in_ticks) {
                                ret = WAIT_TIMEOUT;
                                goto done;
                        }
 
-                       waited = _wapi_handle_timedwait_signal_handle (wait, (end - now) / 10 / 1000, FALSE, alertable ? &apc_pending : NULL);
+                       waited = mono_w32handle_timedwait_signal_handle (wait, (timeout_in_ticks - elapsed) / 10 / 1000, FALSE, alertable ? &apc_pending : NULL);
                }
 
                if (waited==0 && !apc_pending) {
@@ -376,7 +344,7 @@ done:
 
        MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: unlocking handle %p", __func__, wait);
 
-       thr_ret = _wapi_handle_unlock_handle (wait);
+       thr_ret = mono_w32handle_unlock_handle (wait);
        g_assert (thr_ret == 0);
 
        return(ret);
@@ -391,7 +359,7 @@ static gboolean test_and_own (guint32 numobjects, gpointer *handles,
        
        MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: locking handles", __func__);
        
-       done = _wapi_handle_count_signalled_handles (numobjects, handles,
+       done = mono_w32handle_count_signalled_handles (numobjects, handles,
                                                     waitall, count, lowest);
        if (done == TRUE) {
                if (waitall == TRUE) {
@@ -405,7 +373,7 @@ static gboolean test_and_own (guint32 numobjects, gpointer *handles,
        
        MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: unlocking handles", __func__);
 
-       _wapi_handle_unlock_handles (numobjects, handles);
+       mono_w32handle_unlock_handles (numobjects, handles);
 
        return(done);
 }
@@ -449,17 +417,11 @@ guint32 WaitForMultipleObjectsEx(guint32 numobjects, gpointer *handles,
        guint i;
        guint32 ret;
        int thr_ret;
-       gpointer current_thread = wapi_get_current_thread_handle ();
        guint32 retval;
        gboolean poll;
        gpointer sorted_handles [MAXIMUM_WAIT_OBJECTS];
        gboolean apc_pending = FALSE;
-       gint64 now, end;
-       
-       if (current_thread == NULL) {
-               SetLastError (ERROR_INVALID_HANDLE);
-               return(WAIT_FAILED);
-       }
+       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);
@@ -473,17 +435,6 @@ guint32 WaitForMultipleObjectsEx(guint32 numobjects, gpointer *handles,
 
        /* Check for duplicates */
        for (i = 0; i < numobjects; i++) {
-               if (handles[i] == _WAPI_THREAD_CURRENT) {
-                       handles[i] = wapi_get_current_thread_handle ();
-                       
-                       if (handles[i] == NULL) {
-                               MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Handle %d bogus", __func__, i);
-
-                               bogustype = TRUE;
-                               break;
-                       }
-               }
-
                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);
@@ -492,7 +443,7 @@ guint32 WaitForMultipleObjectsEx(guint32 numobjects, gpointer *handles,
                        break;
                }
 
-               if (_wapi_handle_test_capabilities (handles[i], WAPI_HANDLE_CAP_WAIT) == FALSE) {
+               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]);
 
@@ -501,7 +452,7 @@ guint32 WaitForMultipleObjectsEx(guint32 numobjects, gpointer *handles,
                }
 
                sorted_handles [i] = handles [i];
-               _wapi_handle_ops_prewait (handles[i]);
+               mono_w32handle_ops_prewait (handles[i]);
        }
 
        qsort (sorted_handles, numobjects, sizeof (gpointer), g_direct_equal);
@@ -526,7 +477,7 @@ guint32 WaitForMultipleObjectsEx(guint32 numobjects, gpointer *handles,
 
        poll = FALSE;
        for (i = 0; i < numobjects; ++i)
-               if (_wapi_handle_type (handles [i]) == WAPI_HANDLE_PROCESS)
+               if (mono_w32handle_get_type (handles [i]) == MONO_W32HANDLE_PROCESS)
                        /* Can't wait for a process handle + another handle without polling */
                        poll = TRUE;
 
@@ -539,8 +490,10 @@ guint32 WaitForMultipleObjectsEx(guint32 numobjects, gpointer *handles,
                return WAIT_TIMEOUT;
        }
 
-       if (timeout != INFINITE)
-               end = mono_100ns_ticks () + timeout * 1000 * 10;
+       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
         */
@@ -550,7 +503,7 @@ guint32 WaitForMultipleObjectsEx(guint32 numobjects, gpointer *handles,
                 * disappear from under us while we're waiting in the loop
                 * (not lock, as we don't want exclusive access here)
                 */
-               _wapi_handle_ref (handles[i]);
+               mono_w32handle_ref (handles[i]);
        }
 
        while(1) {
@@ -558,41 +511,41 @@ guint32 WaitForMultipleObjectsEx(guint32 numobjects, gpointer *handles,
                 * special-wait handles that aren't already signalled
                 */
                for (i = 0; i < numobjects; i++) {
-                       _wapi_handle_ops_prewait (handles[i]);
+                       mono_w32handle_ops_prewait (handles[i]);
                
-                       if (_wapi_handle_test_capabilities (handles[i], WAPI_HANDLE_CAP_SPECIAL_WAIT) == TRUE && _wapi_handle_issignalled (handles[i]) == FALSE) {
-                               _wapi_handle_ops_special_wait (handles[i], 0, alertable);
+                       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 = _wapi_handle_lock_signal_mutex ();
+               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 (!_wapi_handle_issignalled (handles [i]))
+                               if (!mono_w32handle_issignalled (handles [i]))
                                        done = FALSE;
                } else {
                        done = FALSE;
                        for (i = 0; i < numobjects; i++)
-                               if (_wapi_handle_issignalled (handles [i]))
+                               if (mono_w32handle_issignalled (handles [i]))
                                        done = TRUE;
                }
                
                if (!done) {
                        /* Enter the wait */
                        if (timeout == INFINITE) {
-                               ret = _wapi_handle_timedwait_signal_handle (_wapi_global_signal_handle, INFINITE, poll, &apc_pending);
+                               ret = mono_w32handle_timedwait_signal (INFINITE, poll, &apc_pending);
                        } else {
-                               now = mono_100ns_ticks ();
-                               if (end < now) {
+                               gint64 elapsed = mono_100ns_ticks () - wait_start;
+                               if (elapsed >= timeout_in_ticks) {
                                        ret = WAIT_TIMEOUT;
                                } else {
-                                       ret = _wapi_handle_timedwait_signal_handle (_wapi_global_signal_handle, (end - now) / 10 / 1000, poll, &apc_pending);
+                                       ret = mono_w32handle_timedwait_signal ((timeout_in_ticks - elapsed) / 10 / 1000, poll, &apc_pending);
                                }
                        }
                } else {
@@ -602,7 +555,7 @@ guint32 WaitForMultipleObjectsEx(guint32 numobjects, gpointer *handles,
 
                MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: unlocking signal mutex", __func__);
 
-               thr_ret = _wapi_handle_unlock_signal_mutex (NULL);
+               thr_ret = mono_w32handle_unlock_signal_mutex ();
                g_assert (thr_ret == 0);
                
                if (alertable && apc_pending) {
@@ -620,24 +573,18 @@ guint32 WaitForMultipleObjectsEx(guint32 numobjects, gpointer *handles,
                        retval = WAIT_OBJECT_0+lowest;
                        break;
                } else if (ret != 0) {
-                       /* Didn't get all handles, and there was a
-                        * timeout or other error
-                        */
+                       /* 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));
 
-                       if(ret==ETIMEDOUT) {
-                               retval = WAIT_TIMEOUT;
-                       } else {
-                               retval = WAIT_FAILED;
-                       }
+                       retval = WAIT_TIMEOUT;
                        break;
                }
        }
 
        for (i = 0; i < numobjects; i++) {
                /* Unref everything we reffed above */
-               _wapi_handle_unref (handles[i]);
+               mono_w32handle_unref (handles[i]);
        }
 
        return retval;
index e82d8e68f660ffbe21c3add129c20ef801b8eac3..ee961002d9eec7152e3741e77299836cab989d14 100644 (file)
 #include <sys/stat.h>
 
 #include <mono/io-layer/wapi.h>
-#include <mono/io-layer/handles.h>
 #include <mono/io-layer/io.h>
+#include <mono/io-layer/shared.h>
 
 #include <mono/utils/mono-os-mutex.h>
 
-/* Increment this whenever an incompatible change is made to the
- * shared handle structure.
- */
-#define _WAPI_HANDLE_VERSION 12
-
-typedef enum {
-       WAPI_HANDLE_UNUSED=0,
-       WAPI_HANDLE_FILE,
-       WAPI_HANDLE_CONSOLE,
-       WAPI_HANDLE_THREAD,
-       WAPI_HANDLE_SEM,
-       WAPI_HANDLE_MUTEX,
-       WAPI_HANDLE_EVENT,
-       WAPI_HANDLE_SOCKET,
-       WAPI_HANDLE_FIND,
-       WAPI_HANDLE_PROCESS,
-       WAPI_HANDLE_PIPE,
-       WAPI_HANDLE_NAMEDMUTEX,
-       WAPI_HANDLE_NAMEDSEM,
-       WAPI_HANDLE_NAMEDEVENT,
-       WAPI_HANDLE_COUNT
-} WapiHandleType;
-
-extern const char *_wapi_handle_typename[];
-
-#define _WAPI_FD_HANDLE(type) (type == WAPI_HANDLE_FILE || \
-                              type == WAPI_HANDLE_CONSOLE || \
-                              type == WAPI_HANDLE_SOCKET || \
-                              type == WAPI_HANDLE_PIPE)
-
-#define _WAPI_SHARED_NAMESPACE(type) (type == WAPI_HANDLE_NAMEDMUTEX || \
-                                     type == WAPI_HANDLE_NAMEDSEM || \
-                                     type == WAPI_HANDLE_NAMEDEVENT)
+/* There doesn't seem to be a defined symbol for this */
+#define _WAPI_THREAD_CURRENT (gpointer)0xFFFFFFFE
+
+extern gboolean _wapi_has_shut_down;
 
 typedef struct 
 {
        gchar name[MAX_PATH + 1];
 } WapiSharedNamespace;
 
-typedef enum {
-       WAPI_HANDLE_CAP_WAIT=0x01,
-       WAPI_HANDLE_CAP_SIGNAL=0x02,
-       WAPI_HANDLE_CAP_OWN=0x04,
-       WAPI_HANDLE_CAP_SPECIAL_WAIT=0x08
-} WapiHandleCapability;
-
-struct _WapiHandleOps 
-{
-       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 alertable);
-
-       /* Called by WaitForSingleObject and WaitForMultipleObjects,
-        * if the handle in question needs some preprocessing before the
-        * signal wait.
-        */
-       void (*prewait)(gpointer handle);
-};
-
 #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/thread-private.h>
 #include <mono/io-layer/process-private.h>
+#include <mono/utils/w32handle.h>
 
 struct _WapiHandle_shared_ref
 {
@@ -115,33 +46,6 @@ struct _WapiHandle_shared_ref
        guint32 offset;
 };
 
-#define _WAPI_HANDLE_INITIAL_COUNT 256
-
-struct _WapiHandleUnshared
-{
-       WapiHandleType type;
-       guint ref;
-       gboolean signalled;
-       mono_mutex_t signal_mutex;
-       mono_cond_t signal_cond;
-       
-       union 
-       {
-               struct _WapiHandle_event event;
-               struct _WapiHandle_file file;
-               struct _WapiHandle_find find;
-               struct _WapiHandle_mutex mutex;
-               struct _WapiHandle_sem sem;
-               struct _WapiHandle_socket sock;
-               struct _WapiHandle_thread thread;
-               struct _WapiHandle_process process;
-               struct _WapiHandle_shared_ref shared;
-               struct _WapiHandle_namedmutex namedmutex;
-               struct _WapiHandle_namedsem namedsem;
-               struct _WapiHandle_namedevent namedevent;
-       } u;
-};
-
 #define _WAPI_SHARED_SEM_NAMESPACE 0
 /*#define _WAPI_SHARED_SEM_COLLECTION 1*/
 #define _WAPI_SHARED_SEM_FILESHARE 2
@@ -165,6 +69,18 @@ struct _WapiFileShare
 
 typedef struct _WapiFileShare _WapiFileShare;
 
-#define _WAPI_HANDLE_INVALID (gpointer)-1
+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 d8c4aaccb0095e997d483aa17ca2ea36146d476c..b848a483c7030aad42af1650541355d16f260836 100644 (file)
@@ -99,7 +99,5 @@
 #define WaitForMultipleObjects wapi_WaitForMultipleObjects
 #define WaitForMultipleObjectsEx wapi_WaitForMultipleObjectsEx
 #define WaitForInputIdle wapi_WaitForInputIdle
-#define GetThreadPriority wapi_GetThreadPriority
-#define SetThreadPriority wapi_SetThreadPriority
 
 #endif /* __WAPI_REMAP_H__ */
diff --git a/mono/io-layer/wapi.c b/mono/io-layer/wapi.c
new file mode 100644 (file)
index 0000000..a9f9369
--- /dev/null
@@ -0,0 +1,187 @@
+
+#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"
+
+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 ();
+}
+
+void
+wapi_cleanup (void)
+{
+       g_assert (_wapi_has_shut_down == FALSE);
+       _wapi_has_shut_down = TRUE;
+
+       _wapi_error_cleanup ();
+       wapi_processes_cleanup ();
+       _wapi_io_cleanup ();
+}
+
+/* Use this instead of getpid(), to cope with linuxthreads.  It's a
+ * function rather than a variable lookup because we need to get at
+ * this before share_init() might have been called. */
+static mono_lazy_init_t _wapi_pid_init_lazy = MONO_LAZY_INIT_STATUS_NOT_INITIALIZED;
+static pid_t _wapi_pid;
+
+static void
+_wapi_pid_init (void)
+{
+       _wapi_pid = getpid ();
+}
+
+pid_t
+wapi_getpid (void)
+{
+       mono_lazy_initialize (&_wapi_pid_init_lazy, _wapi_pid_init);
+       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;
+       }
+
+       return TRUE;
+}
+
+/**
+ * CloseHandle:
+ * @handle: The handle to release
+ *
+ * Closes and invalidates @handle, releasing any resources it
+ * consumes.  When the last handle to a temporary or non-persistent
+ * object is closed, that object can be deleted.  Closing the same
+ * handle twice is an error.
+ *
+ * Return value: %TRUE on success, %FALSE otherwise.
+ */
+gboolean CloseHandle(gpointer handle)
+{
+       if (handle == INVALID_HANDLE_VALUE){
+               SetLastError (ERROR_INVALID_PARAMETER);
+               return FALSE;
+       }
+       if (handle == (gpointer)0 && mono_w32handle_get_type (handle) != MONO_W32HANDLE_CONSOLE) {
+               /* Problem: because we map file descriptors to the
+                * same-numbered handle we can't tell the difference
+                * between a bogus handle and the handle to stdin.
+                * Assume that it's the console handle if that handle
+                * exists...
+                */
+               SetLastError (ERROR_INVALID_PARAMETER);
+               return FALSE;
+       }
+
+       mono_w32handle_unref (handle);
+       return TRUE;
+}
index c6cbecd49c5758a4501b732c3e840e0b9c80a719..4e0a688063984ad671543a10f51a4bc2d27290c7 100644 (file)
@@ -13,7 +13,6 @@
 #include <mono/io-layer/wapi-remap.h>
 #include <mono/io-layer/types.h>
 #include <mono/io-layer/macros.h>
-#include <mono/io-layer/handles.h>
 #include <mono/io-layer/io.h>
 #include <mono/io-layer/access.h>
 #include <mono/io-layer/context.h>
 #include <mono/io-layer/semaphores.h>
 #include <mono/io-layer/sockets.h>
 #include <mono/io-layer/status.h>
-#include <mono/io-layer/threads.h>
 #include <mono/io-layer/timefuncs.h>
 #include <mono/io-layer/versioninfo.h>
 #include <mono/io-layer/wait.h>
 
+void
+wapi_init (void);
+
+void
+wapi_cleanup (void);
+
+gboolean
+CloseHandle (gpointer handle);
+
+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);
+
+pid_t
+wapi_getpid (void);
+
 #endif /* _WAPI_WAPI_H_ */
diff --git a/mono/io-layer/wthreads.c b/mono/io-layer/wthreads.c
deleted file mode 100644 (file)
index 26246bb..0000000
+++ /dev/null
@@ -1,464 +0,0 @@
-/*
- * threads.c:  Thread handles
- *
- * Author:
- *     Dick Porter (dick@ximian.com)
- *
- * (C) 2002-2006 Ximian, Inc.
- * Copyright 2003-2011 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 <stdio.h>
-#include <glib.h>
-#include <string.h>
-#include <pthread.h>
-#include <sched.h>
-#include <sys/time.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#include <mono/io-layer/wapi.h>
-#include <mono/io-layer/wapi-private.h>
-#include <mono/io-layer/handles-private.h>
-#include <mono/io-layer/thread-private.h>
-#include <mono/io-layer/mutex-private.h>
-#include <mono/io-layer/io-trace.h>
-
-#include <mono/utils/mono-threads.h>
-#include <mono/utils/atomic.h>
-#include <mono/utils/mono-time.h>
-#include <mono/utils/mono-once.h>
-#include <mono/utils/mono-logger-internals.h>
-
-#ifdef HAVE_VALGRIND_MEMCHECK_H
-#include <valgrind/memcheck.h>
-#endif
-
-struct _WapiHandleOps _wapi_thread_ops = {
-       NULL,                           /* close */
-       NULL,                           /* signal */
-       NULL,                           /* own */
-       NULL,                           /* is_owned */
-       NULL,                           /* special_wait */
-       NULL                            /* prewait */
-};
-
-static mono_once_t thread_ops_once = MONO_ONCE_INIT;
-
-static void
-thread_ops_init (void)
-{
-       _wapi_handle_register_capabilities (WAPI_HANDLE_THREAD,
-                                           WAPI_HANDLE_CAP_WAIT);
-}
-
-void
-_wapi_thread_cleanup (void)
-{
-}
-
-static gpointer
-get_current_thread_handle (void)
-{
-       MonoThreadInfo *info;
-
-       info = mono_thread_info_current ();
-       g_assert (info);
-       g_assert (info->handle);
-       return info->handle;
-}
-
-static WapiHandle_thread*
-lookup_thread (HANDLE handle)
-{
-       WapiHandle_thread *thread;
-       gboolean ok;
-
-       ok = _wapi_lookup_handle (handle, WAPI_HANDLE_THREAD,
-                                                         (gpointer *)&thread);
-       g_assert (ok);
-       return thread;
-}
-
-static WapiHandle_thread*
-get_current_thread (void)
-{
-       gpointer handle;
-
-       handle = get_current_thread_handle ();
-       return lookup_thread (handle);
-}
-
-void
-wapi_thread_handle_set_exited (gpointer handle, guint32 exitstatus)
-{
-       WapiHandle_thread *thread_handle;
-       int i, thr_ret;
-       pid_t pid = _wapi_getpid ();
-       pthread_t tid = pthread_self ();
-       
-       if (_wapi_handle_issignalled (handle) ||
-           _wapi_handle_type (handle) == WAPI_HANDLE_UNUSED) {
-               /* We must have already deliberately finished with
-                * this thread, so don't do any more now
-                */
-               return;
-       }
-
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Thread %p terminating", __func__, handle);
-
-       thread_handle = lookup_thread (handle);
-
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Thread %p abandoning held mutexes", __func__, handle);
-
-       for (i = 0; i < thread_handle->owned_mutexes->len; i++) {
-               gpointer mutex = g_ptr_array_index (thread_handle->owned_mutexes, i);
-
-               _wapi_mutex_abandon (mutex, pid, tid);
-               _wapi_thread_disown_mutex (mutex);
-       }
-       g_ptr_array_free (thread_handle->owned_mutexes, TRUE);
-       
-       thr_ret = _wapi_handle_lock_handle (handle);
-       g_assert (thr_ret == 0);
-
-       _wapi_handle_set_signal_state (handle, TRUE, TRUE);
-
-       thr_ret = _wapi_handle_unlock_handle (handle);
-       g_assert (thr_ret == 0);
-       
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Recording thread handle %p id %ld status as %d",
-                 __func__, handle, thread_handle->id, exitstatus);
-       
-       /* The thread is no longer active, so unref it */
-       _wapi_handle_unref (handle);
-}
-
-/*
- * wapi_create_thread_handle:
- *
- *   Create a thread handle for the current thread.
- */
-gpointer
-wapi_create_thread_handle (void)
-{
-       WapiHandle_thread thread_handle = {0}, *thread;
-       gpointer handle;
-
-       mono_once (&thread_ops_once, thread_ops_init);
-
-       thread_handle.owned_mutexes = g_ptr_array_new ();
-
-       handle = _wapi_handle_new (WAPI_HANDLE_THREAD, &thread_handle);
-       if (handle == _WAPI_HANDLE_INVALID) {
-               g_warning ("%s: error creating thread handle", __func__);
-               SetLastError (ERROR_GEN_FAILURE);
-               
-               return NULL;
-       }
-
-       thread = lookup_thread (handle);
-
-       thread->id = pthread_self ();
-
-       /*
-        * Hold a reference while the thread is active, because we use
-        * the handle to store thread exit information
-        */
-       _wapi_handle_ref (handle);
-
-       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: started thread id %ld", __func__, thread->id);
-       
-       return handle;
-}
-
-void
-wapi_ref_thread_handle (gpointer handle)
-{
-       _wapi_handle_ref (handle);
-}
-
-gpointer
-wapi_get_current_thread_handle (void)
-{
-       return get_current_thread_handle ();
-}
-
-gboolean
-_wapi_thread_cur_apc_pending (void)
-{
-       return mono_thread_info_is_interrupt_state (mono_thread_info_current ());
-}
-
-void
-_wapi_thread_own_mutex (gpointer mutex)
-{
-       WapiHandle_thread *thread;
-       
-       thread = get_current_thread ();
-
-       _wapi_handle_ref (mutex);
-       
-       g_ptr_array_add (thread->owned_mutexes, mutex);
-}
-
-void
-_wapi_thread_disown_mutex (gpointer mutex)
-{
-       WapiHandle_thread *thread;
-
-       thread = get_current_thread ();
-
-       _wapi_handle_unref (mutex);
-       
-       g_ptr_array_remove (thread->owned_mutexes, mutex);
-}
-
-/**
- * wapi_init_thread_info_priority:
- * @param handle: The thread handle to set.
- * @param priority: Priority to initialize with
- *
- *   Initialize the priority field of the thread info
- */
-void
-wapi_init_thread_info_priority (gpointer handle, gint32 priority)
-{
-       struct _WapiHandle_thread *thread_handle = NULL;
-       gboolean ok = _wapi_lookup_handle (handle, WAPI_HANDLE_THREAD,
-                                 (gpointer *)&thread_handle);
-                                 
-       if (ok == TRUE)
-               thread_handle->priority = priority;
-}
-
-/**
- * _wapi_thread_posix_priority_to_priority:
- *
- *   Convert a POSIX priority to a WapiThreadPriority.
- * sched_priority is a POSIX priority,
- * policy is the current scheduling policy
- */
-static WapiThreadPriority 
-_wapi_thread_posix_priority_to_priority (int sched_priority, int policy)
-{
-/* Necessary to get valid priority range */
-#ifdef _POSIX_PRIORITY_SCHEDULING
-       int max,
-           min,
-           i,
-           priority,
-           chunk;
-       WapiThreadPriority priorities[] = {
-               THREAD_PRIORITY_LOWEST,
-               THREAD_PRIORITY_LOWEST,
-               THREAD_PRIORITY_BELOW_NORMAL,
-               THREAD_PRIORITY_NORMAL,
-               THREAD_PRIORITY_ABOVE_NORMAL,
-               THREAD_PRIORITY_HIGHEST,
-               THREAD_PRIORITY_HIGHEST
-       };
-           
-       max = sched_get_priority_max (policy);
-       min = sched_get_priority_min (policy);
-       
-       /* Partition priority range linearly, 
-          assign each partition a thread priority */
-       if (max != min && 0 <= max && 0 <= min) {
-               for (i=1, priority=min, chunk=(max-min)/7; 
-                    i<6 && sched_priority > priority;
-                    ++i) {
-                       priority += chunk;
-               }
-               
-               if (max <= priority)
-               {
-                       return (THREAD_PRIORITY_HIGHEST);
-               }
-               else
-               {
-                       return (priorities[i-1]);
-               }
-       }
-#endif
-
-       return (THREAD_PRIORITY_NORMAL);
-}
-
-/**
- * wapi_thread_priority_to_posix_priority:
- *
- *   Convert a WapiThreadPriority to a POSIX priority.
- * priority is a WapiThreadPriority,
- * policy is the current scheduling policy
- */
-int 
-wapi_thread_priority_to_posix_priority (WapiThreadPriority priority, int policy)
-{
-/* Necessary to get valid priority range */
-#ifdef _POSIX_PRIORITY_SCHEDULING
-       int max,
-           min,
-           posix_priority,
-           i;
-       WapiThreadPriority priorities[] = {
-               THREAD_PRIORITY_LOWEST,
-               THREAD_PRIORITY_LOWEST,
-               THREAD_PRIORITY_BELOW_NORMAL,
-               THREAD_PRIORITY_NORMAL,
-               THREAD_PRIORITY_ABOVE_NORMAL,
-               THREAD_PRIORITY_HIGHEST,
-               THREAD_PRIORITY_HIGHEST
-       };
-       
-       max = sched_get_priority_max (policy);
-       min = sched_get_priority_min (policy);
-
-       /* Partition priority range linearly, 
-          numerically approximate matching ThreadPriority */
-       if (max != min && 0 <= max && 0 <= min) {
-               for (i=0; i<7; ++i) {
-                       if (priorities[i] == priority) {
-                               posix_priority = min + ((max-min)/7) * i;
-                               if (max < posix_priority)
-                               {
-                                       return max;
-                               }
-                               else {
-                                       return posix_priority;
-                               }
-                       }
-               }
-       }
-#endif
-
-       switch (policy) {
-               case SCHED_FIFO:
-               case SCHED_RR:
-                       return 50;
-#ifdef SCHED_BATCH
-               case SCHED_BATCH:
-#endif
-               case SCHED_OTHER:
-                       return 0;
-               default:
-                       return -1;
-       }
-}
-
-/**
- * GetThreadPriority:
- * @param handle: The thread handle to query.
- *
- * Gets the priority of the given thread.
- * @return: A MonoThreadPriority approximating the current POSIX 
- * thread priority, or THREAD_PRIORITY_NORMAL on error.
- */
-gint32 
-GetThreadPriority (gpointer handle)
-{
-       struct _WapiHandle_thread *thread_handle = NULL;
-       int policy;
-       struct sched_param param;
-       gboolean ok = _wapi_lookup_handle (handle, WAPI_HANDLE_THREAD,
-                                 (gpointer *)&thread_handle);
-                                 
-       if (ok == FALSE)
-               return (THREAD_PRIORITY_NORMAL);
-       
-       switch (pthread_getschedparam (thread_handle->id, &policy, &param)) {
-               case 0:
-                       if ((policy == SCHED_FIFO) || (policy == SCHED_RR))
-                               return (_wapi_thread_posix_priority_to_priority (param.sched_priority, policy));
-                       else
-                               return (thread_handle->priority);
-               case ESRCH:
-                       g_warning ("pthread_getschedparam: error looking up thread id %x", (gsize)thread_handle->id);
-       }
-       
-       return (THREAD_PRIORITY_NORMAL);
-}
-
-/**
- * SetThreadPriority:
- * @param handle: The thread handle to query.
- * @param priority: The priority to give to the thread.
- *
- * Sets the priority of the given thread.
- * @return: TRUE on success, FALSE on failure or error.
- */
-gboolean 
-SetThreadPriority (gpointer handle, gint32 priority)
-{
-       struct _WapiHandle_thread *thread_handle = NULL;
-       int policy,
-           posix_priority,
-           rv;
-       struct sched_param param;
-       gboolean ok = _wapi_lookup_handle (handle, WAPI_HANDLE_THREAD,
-                                 (gpointer *)&thread_handle);
-                                 
-       if (ok == FALSE) {
-               return ok;
-       }
-       
-       rv = pthread_getschedparam (thread_handle->id, &policy, &param);
-       if (rv) {
-               if (ESRCH == rv)
-                       g_warning ("pthread_getschedparam: error looking up thread id %x", (gsize)thread_handle->id);
-               return FALSE;
-       }
-       
-       posix_priority =  wapi_thread_priority_to_posix_priority (priority, policy);
-       if (0 > posix_priority)
-               return FALSE;
-               
-       param.sched_priority = posix_priority;
-       switch (pthread_setschedparam (thread_handle->id, policy, &param)) {
-               case 0:
-                       thread_handle->priority = priority;
-                       return TRUE;
-               case ESRCH:
-                       g_warning ("pthread_setschedprio: error looking up thread id %x", (gsize)thread_handle->id);
-                       break;
-               case ENOTSUP:
-                       g_warning ("%s: priority %d not supported", __func__, priority);
-                       break;
-               case EPERM:
-                       g_warning ("%s: permission denied", __func__);
-                       break;
-       }
-       
-       return FALSE;
-}
-
-char*
-wapi_current_thread_desc (void)
-{
-       WapiHandle_thread *thread;
-       gpointer thread_handle;
-       int i;
-       GString* text;
-       char *res;
-
-       thread_handle = get_current_thread_handle ();
-       thread = lookup_thread (thread_handle);
-
-       text = g_string_new (0);
-       g_string_append_printf (text, "thread handle %p state : ", thread_handle);
-
-       mono_thread_info_describe_interrupt_token (mono_thread_info_current (), text);
-
-       g_string_append_printf (text, " owns (");
-       for (i = 0; i < thread->owned_mutexes->len; i++)
-               g_string_append_printf (text, i > 0 ? ", %p" : "%p", g_ptr_array_index (thread->owned_mutexes, i));
-       g_string_append_printf (text, ")");
-
-       res = text->str;
-       g_string_free (text, FALSE);
-       return res;
-}
index 3639f3e5eb0e9b4a6364b91ec3822c5eda578c11..32f5628d5f75c2bd602e7255bebff10d6e3c79bb 100644 (file)
@@ -292,4 +292,4 @@ libmonoruntimeinclude_HEADERS = \
        verify.h                
 
 EXTRA_DIST = $(win32_sources) $(unix_sources) $(null_sources) runtime.h \
-               threadpool-ms-io-poll.c threadpool-ms-io-epoll.c threadpool-ms-io-kqueue.c
+               threadpool-ms-io-poll.c threadpool-ms-io-epoll.c threadpool-ms-io-kqueue.c sgen-dynarray.h
index d0d80a5e9de50412ab0b05cbe5a7f612d943fd14..ae391b08948e86b49aa92aac222083d8e0214175 100644 (file)
@@ -67,6 +67,7 @@
 #include <mono/utils/atomic.h>
 #include <mono/utils/mono-memory-model.h>
 #include <mono/utils/mono-threads.h>
+#include <mono/utils/w32handle.h>
 #ifdef HOST_WIN32
 #include <direct.h>
 #endif
@@ -82,7 +83,7 @@
  * Changes which are already detected at runtime, like the addition
  * of icalls, do not require an increment.
  */
-#define MONO_CORLIB_VERSION 151
+#define MONO_CORLIB_VERSION 152
 
 typedef struct
 {
@@ -961,7 +962,9 @@ ves_icall_System_AppDomain_createDomain (MonoString *friendly_name, MonoAppDomai
 {
        MonoError error;
        MonoAppDomain *ad = NULL;
+
 #ifdef DISABLE_APPDOMAINS
+       mono_error_init (&error);
        mono_error_set_not_supported (&error, "AppDomain creation is not supported on this runtime.");
 #else
        char *fname;
@@ -1513,97 +1516,6 @@ get_shadow_assembly_location (const char *filename, MonoError *error)
        return location;
 }
 
-static gboolean
-ensure_directory_exists (const char *filename)
-{
-#ifdef HOST_WIN32
-       gchar *dir_utf8 = g_path_get_dirname (filename);
-       gunichar2 *p;
-       gunichar2 *dir_utf16 = NULL;
-       int retval;
-       
-       if (!dir_utf8 || !dir_utf8 [0])
-               return FALSE;
-
-       dir_utf16 = g_utf8_to_utf16 (dir_utf8, strlen (dir_utf8), NULL, NULL, NULL);
-       g_free (dir_utf8);
-
-       if (!dir_utf16)
-               return FALSE;
-
-       p = dir_utf16;
-
-       /* make life easy and only use one directory seperator */
-       while (*p != '\0')
-       {
-               if (*p == '/')
-                       *p = '\\';
-               p++;
-       }
-
-       p = dir_utf16;
-
-       /* get past C:\ )*/
-       while (*p++ != '\\')    
-       {
-       }
-
-       while (1) {
-               BOOL bRet = FALSE;
-               p = wcschr (p, '\\');
-               if (p)
-                       *p = '\0';
-               retval = _wmkdir (dir_utf16);
-               if (retval != 0 && errno != EEXIST) {
-                       g_free (dir_utf16);
-                       return FALSE;
-               }
-               if (!p)
-                       break;
-               *p++ = '\\';
-       }
-       
-       g_free (dir_utf16);
-       return TRUE;
-#else
-       char *p;
-       gchar *dir = g_path_get_dirname (filename);
-       int retval;
-       struct stat sbuf;
-       
-       if (!dir || !dir [0]) {
-               g_free (dir);
-               return FALSE;
-       }
-       
-       if (stat (dir, &sbuf) == 0 && S_ISDIR (sbuf.st_mode)) {
-               g_free (dir);
-               return TRUE;
-       }
-       
-       p = dir;
-       while (*p == '/')
-               p++;
-
-       while (1) {
-               p = strchr (p, '/');
-               if (p)
-                       *p = '\0';
-               retval = mkdir (dir, 0777);
-               if (retval != 0 && errno != EEXIST) {
-                       g_free (dir);
-                       return FALSE;
-               }
-               if (!p)
-                       break;
-               *p++ = '/';
-       }
-       
-       g_free (dir);
-       return TRUE;
-#endif
-}
-
 static gboolean
 private_file_needs_copying (const char *src, struct stat *sbuf_src, char *dest)
 {
@@ -1802,7 +1714,7 @@ mono_make_shadow_copy (const char *filename, MonoError *oerror)
                return NULL;
        }
 
-       if (ensure_directory_exists (shadow) == FALSE) {
+       if (g_ensure_directory_exists (shadow) == FALSE) {
                g_free (shadow);
                mono_error_set_execution_engine (oerror, "Failed to create shadow copy (ensure directory exists).");
                return NULL;
@@ -1852,13 +1764,13 @@ mono_make_shadow_copy (const char *filename, MonoError *oerror)
        sibling_target_len = strlen (sibling_target);
        
        copy_result = shadow_copy_sibling (sibling_source, sibling_source_len, ".mdb", sibling_target, sibling_target_len, 7);
-       if (copy_result == TRUE)
+       if (copy_result)
                copy_result = shadow_copy_sibling (sibling_source, sibling_source_len, ".config", sibling_target, sibling_target_len, 7);
        
        g_free (sibling_source);
        g_free (sibling_target);
        
-       if (copy_result == FALSE)  {
+       if (!copy_result)  {
                g_free (shadow);
                mono_error_set_execution_engine (oerror, "Failed to create shadow copy of sibling data (CopyFile).");
                return NULL;
@@ -2443,7 +2355,7 @@ deregister_reflection_info_roots (MonoDomain *domain)
        mono_domain_assemblies_unlock (domain);
 }
 
-static guint32 WINAPI
+static gsize WINAPI
 unload_thread_main (void *arg)
 {
        MonoError error;
@@ -2650,10 +2562,10 @@ 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 = 0;
+       tp.priority = MONO_THREAD_PRIORITY_NORMAL;
        tp.stack_size = 0;
        tp.creation_flags = CREATE_SUSPENDED;
-       thread_handle = mono_threads_create_thread ((LPTHREAD_START_ROUTINE)unload_thread_main, thread_data, &tp, &tid);
+       thread_handle = mono_threads_create_thread (unload_thread_main, thread_data, &tp, &tid);
        if (thread_handle == NULL)
                return;
        mono_thread_info_resume (tid);
index 9c435d27b50df9b3775470b1137c1f087b7b74cd..4bad7dc5ed6d85719bd7426b3e906655c833c127 100644 (file)
@@ -921,6 +921,7 @@ mono_assembly_addref (MonoAssembly *assembly)
 #define WINFX_KEY "31bf3856ad364e35"
 #define ECMA_KEY "b77a5c561934e089"
 #define MSFINAL_KEY "b03f5f7f11d50a3a"
+#define COMPACTFRAMEWORK_KEY "969db8053d3322ac"
 
 typedef struct {
        const char *name;
@@ -929,20 +930,34 @@ typedef struct {
 } KeyRemapEntry;
 
 static KeyRemapEntry key_remap_table[] = {
+       { "CustomMarshalers", COMPACTFRAMEWORK_KEY, MSFINAL_KEY },
        { "Microsoft.CSharp", WINFX_KEY, MSFINAL_KEY },
+       { "Microsoft.VisualBasic", COMPACTFRAMEWORK_KEY, MSFINAL_KEY },
        { "System", SILVERLIGHT_KEY, ECMA_KEY },
+       { "System", COMPACTFRAMEWORK_KEY, ECMA_KEY },
        { "System.ComponentModel.Composition", WINFX_KEY, ECMA_KEY },
        { "System.ComponentModel.DataAnnotations", "ddd0da4d3e678217", WINFX_KEY },
        { "System.Core", SILVERLIGHT_KEY, ECMA_KEY },
+       { "System.Core", COMPACTFRAMEWORK_KEY, ECMA_KEY },
+       { "System.Data", COMPACTFRAMEWORK_KEY, ECMA_KEY },
+       { "System.Data.DataSetExtensions", COMPACTFRAMEWORK_KEY, ECMA_KEY },
+       { "System.Drawing", COMPACTFRAMEWORK_KEY, MSFINAL_KEY },
+       { "System.Messaging", COMPACTFRAMEWORK_KEY, MSFINAL_KEY },
        // FIXME: MS uses MSFINAL_KEY for .NET 4.5
        { "System.Net", SILVERLIGHT_KEY, MSFINAL_KEY },
        { "System.Numerics", WINFX_KEY, ECMA_KEY },
        { "System.Runtime.Serialization", SILVERLIGHT_KEY, ECMA_KEY },
+       { "System.Runtime.Serialization", COMPACTFRAMEWORK_KEY, ECMA_KEY },
        { "System.ServiceModel", WINFX_KEY, ECMA_KEY },
+       { "System.ServiceModel", COMPACTFRAMEWORK_KEY, ECMA_KEY },
        { "System.ServiceModel.Web", SILVERLIGHT_KEY, WINFX_KEY },
+       { "System.Web.Services", COMPACTFRAMEWORK_KEY, MSFINAL_KEY },
        { "System.Windows", SILVERLIGHT_KEY, MSFINAL_KEY },
+       { "System.Windows.Forms", COMPACTFRAMEWORK_KEY, ECMA_KEY },
        { "System.Xml", SILVERLIGHT_KEY, ECMA_KEY },
+       { "System.Xml", COMPACTFRAMEWORK_KEY, ECMA_KEY },
        { "System.Xml.Linq", WINFX_KEY, ECMA_KEY },
+       { "System.Xml.Linq", COMPACTFRAMEWORK_KEY, ECMA_KEY },
        { "System.Xml.Serialization", WINFX_KEY, ECMA_KEY }
 };
 
@@ -1984,6 +1999,7 @@ mono_assembly_name_free (MonoAssemblyName *aname)
        g_free ((void *) aname->name);
        g_free ((void *) aname->culture);
        g_free ((void *) aname->hash_value);
+       g_free ((guint8*) aname->public_key);
 }
 
 static gboolean
index f1d52f5607d7dc558a677f2bdc6c46590bcb6888..4372397aa5740f6fae868ffabf4ce2ce6bea96de 100644 (file)
@@ -102,7 +102,7 @@ static gboolean needs_to_start, started;
 
 static void transport_connect (void);
 
-static guint32 WINAPI receiver_thread (void *arg);
+static gsize WINAPI receiver_thread (void *arg);
 
 static void transport_start_receive (void);
 
@@ -482,14 +482,14 @@ transport_start_receive (void)
        if (!listen_fd)
                return;
 
-       tp.priority = 0;
+       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);
        g_assert (receiver_thread_handle);
 }
 
-static guint32 WINAPI
+static gsize WINAPI
 receiver_thread (void *arg)
 {
        MonoError error;
index e76a3a3bfb7b6f581f9bceb8aa2eb711e4b01c38..41510b486e88139695f0f0109332effe0b59557f 100644 (file)
@@ -829,6 +829,11 @@ mono_gc_clear_domain (MonoDomain *domain)
 {
 }
 
+void
+mono_gc_suspend_finalizers (void)
+{
+}
+
 int
 mono_gc_get_suspend_signal (void)
 {
index 26b4782ca5a101ac942172f0dbd61fb5a857493c..8581a042f2c310bafe764a2992b0897816939f08 100644 (file)
@@ -295,8 +295,8 @@ typedef struct {
 #define CLI_FLAGS_ILONLY         0x01
 #define CLI_FLAGS_32BITREQUIRED  0x02
 #define CLI_FLAGS_STRONGNAMESIGNED 0x8
-#define CLI_FLAGS_PREFERRED32BIT  0x10
 #define CLI_FLAGS_TRACKDEBUGDATA 0x00010000
+#define CLI_FLAGS_PREFERRED32BIT 0x00020000
        guint32        ch_flags;
 
        guint32        ch_entry_point;
index b72657fda72f1e55b2195782581692a490447c74..f51c979a50fab8ab5d230010e483867b188a7ed5 100644 (file)
@@ -573,6 +573,7 @@ struct _MonoGenericParam {
 };
 
 /* Additional details about a MonoGenericParam */
+/* Keep in sync with managed Mono.RuntimeStructs.GenericParamInfo */
 typedef struct {
        MonoClass *pklass;              /* The corresponding `MonoClass'. */
        const char *name;
@@ -1402,7 +1403,7 @@ void
 mono_unload_interface_id (MonoClass *klass);
 
 GPtrArray*
-mono_class_get_methods_by_name (MonoClass *klass, const char *name, guint32 bflags, gboolean ignore_case, gboolean allow_ctors, MonoException **ex);
+mono_class_get_methods_by_name (MonoClass *klass, const char *name, guint32 bflags, gboolean ignore_case, gboolean allow_ctors, MonoError *error);
 
 char*
 mono_class_full_name (MonoClass *klass);
index 39fc6e491df965cc8ba8e37d76072cb467533c3e..a419af381492313e250c7887c0217c26ea071269 100644 (file)
@@ -7895,10 +7895,8 @@ mono_class_from_name_checked_aux (MonoImage *image, const char* name_space, cons
                klass = search_modules (image, name_space, name, error);
                if (klass || !is_ok (error))
                        return klass;
-       }
-
-       if (!token)
                return NULL;
+       }
 
        if (mono_metadata_token_table (token) == MONO_TABLE_EXPORTEDTYPE) {
                MonoTableInfo  *t = &image->tables [MONO_TABLE_EXPORTEDTYPE];
@@ -10209,6 +10207,9 @@ can_access_type (MonoClass *access_klass, MonoClass *member_klass)
 {
        int access_level;
 
+       if (access_klass == member_klass)
+               return TRUE;
+
        if (access_klass->image->assembly && access_klass->image->assembly->corlib_internal)
                return TRUE;
 
@@ -10357,26 +10358,9 @@ mono_method_can_access_field (MonoMethod *method, MonoClassField *field)
 gboolean
 mono_method_can_access_method (MonoMethod *method, MonoMethod *called)
 {
-       int can = can_access_member (method->klass, called->klass, NULL, called->flags & METHOD_ATTRIBUTE_MEMBER_ACCESS_MASK);
-       if (!can) {
-               MonoClass *nested = method->klass->nested_in;
-               while (nested) {
-                       can = can_access_member (nested, called->klass, NULL, called->flags & METHOD_ATTRIBUTE_MEMBER_ACCESS_MASK);
-                       if (can)
-                               return TRUE;
-                       nested = nested->nested_in;
-               }
-       }
-       /* 
-        * FIXME:
-        * with generics calls to explicit interface implementations can be expressed
-        * directly: the method is private, but we must allow it. This may be opening
-        * a hole or the generics code should handle this differently.
-        * Maybe just ensure the interface type is public.
-        */
-       if ((called->flags & METHOD_ATTRIBUTE_VIRTUAL) && (called->flags & METHOD_ATTRIBUTE_FINAL))
-               return TRUE;
-       return can;
+       method = mono_method_get_method_definition (method);
+       called = mono_method_get_method_definition (called);
+       return mono_method_can_access_method_full (method, called, NULL);
 }
 
 /*
@@ -10393,6 +10377,10 @@ mono_method_can_access_method (MonoMethod *method, MonoMethod *called)
 gboolean
 mono_method_can_access_method_full (MonoMethod *method, MonoMethod *called, MonoClass *context_klass)
 {
+       /* Wrappers are except from access checks */
+       if (method->wrapper_type != MONO_WRAPPER_NONE || called->wrapper_type != MONO_WRAPPER_NONE)
+               return TRUE;
+
        MonoClass *access_class = method->klass;
        MonoClass *member_class = called->klass;
        int can = can_access_member (access_class, member_class, context_klass, called->flags & METHOD_ATTRIBUTE_MEMBER_ACCESS_MASK);
index a3989ab74aad127f831b879358a0de850accc5dc..e385adadfd5c1b29b241952e86dd661a1e78298b 100644 (file)
@@ -325,7 +325,10 @@ struct _MonoDomain {
        /* hashtables for Reflection handles */
        MonoGHashTable     *type_hash;
        MonoGHashTable     *refobject_hash;
-       /* a GC-tracked array to keep references to the static fields of types */
+       /*
+        * A GC-tracked array to keep references to the static fields of types.
+        * See note [Domain Static Data Array].
+        */
        gpointer           *static_data_array;
        /* maps class -> type initialization exception object */
        MonoGHashTable    *type_init_exception_hash;
@@ -442,8 +445,8 @@ typedef struct  {
 
 typedef MonoDomain* (*MonoLoadFunc) (const char *filename, const char *runtime_version);
 
-void mono_domain_lock (MonoDomain *domain);
-void mono_domain_unlock (MonoDomain *domain);
+void mono_domain_lock (MonoDomain *domain) MONO_LLVM_INTERNAL;
+void mono_domain_unlock (MonoDomain *domain) MONO_LLVM_INTERNAL;
 
 void
 mono_install_runtime_load  (MonoLoadFunc func);
index a3ba4a76e0492b35533b95791df77c3eab1a235c..d564151b7df43e403c7a72cb7f58ca3810e3a468 100644 (file)
@@ -43,6 +43,7 @@
 #include <metadata/threads.h>
 #include <metadata/profiler-private.h>
 #include <mono/metadata/coree.h>
+#include <mono/utils/w32handle.h>
 
 //#define DEBUG_DOMAIN_UNLOAD 1
 
@@ -525,6 +526,7 @@ mono_init_internal (const char *filename, const char *exe_filename, const char *
 #endif
 
 #ifndef HOST_WIN32
+       mono_w32handle_init ();
        wapi_init ();
 #endif
 
@@ -893,6 +895,7 @@ mono_cleanup (void)
 
 #ifndef HOST_WIN32
        wapi_cleanup ();
+       mono_w32handle_cleanup ();
 #endif
 }
 
@@ -1483,8 +1486,10 @@ mono_context_get_domain_id (MonoAppContext *context)
 void
 mono_domain_add_class_static_data (MonoDomain *domain, MonoClass *klass, gpointer data, guint32 *bitmap)
 {
-       /* The first entry in the array is the index of the next free slot
-        * and the total size of the array
+       /* Note [Domain Static Data Array]:
+        *
+        * Entry 0 in the array is the index of the next free slot.
+        * Entry 1 is the total size of the array.
         */
        int next;
        if (domain->static_data_array) {
index 2aff26dfd53788fe5080ef51e97cbaf0b9975045..e9ebcf38d384ca945bae7903c53e1658fee3691e 100644 (file)
@@ -14,6 +14,7 @@
 
 #include <glib.h>
 #include <config.h>
+#include <mono/metadata/environment.h>
 #include <mono/metadata/exception.h>
 #include <mono/metadata/exception-internals.h>
 
 #include <mono/metadata/appdomain.h>
 #include <mono/metadata/mono-debug.h>
 #include <mono/utils/mono-error-internals.h>
+#include <mono/utils/mono-logger-internals.h>
 #include <string.h>
 
 #ifdef HAVE_EXECINFO_H
 #include <execinfo.h>
 #endif
 
+static MonoUnhandledExceptionFunc unhandled_exception_hook = NULL;
+static gpointer unhandled_exception_hook_data = NULL;
+
 /**
  * mono_exception_from_name:
  * @image: the Mono image where to look for the class
@@ -1051,3 +1056,50 @@ mono_error_set_pending_exception (MonoError *error)
        }
 }
 
+void
+mono_install_unhandled_exception_hook (MonoUnhandledExceptionFunc func, gpointer user_data)
+{
+       unhandled_exception_hook = func;
+       unhandled_exception_hook_data = user_data;
+}
+
+void
+mono_invoke_unhandled_exception_hook (MonoObject *exc)
+{
+       if (unhandled_exception_hook) {
+               unhandled_exception_hook (exc, unhandled_exception_hook_data);
+       } else {
+               MonoError inner_error;
+               MonoObject *other = NULL;
+               MonoString *str = mono_object_try_to_string (exc, &other, &inner_error);
+               char *msg = NULL;
+               
+               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);
+               } else if (other) {
+                       char *original_backtrace = mono_exception_get_managed_backtrace ((MonoException*)exc);
+                       char *nested_backtrace = mono_exception_get_managed_backtrace ((MonoException*)other);
+
+                       msg = g_strdup_printf ("Nested exception detected.\nOriginal Exception: %s\nNested exception:%s\n",
+                               original_backtrace, nested_backtrace);
+
+                       g_free (original_backtrace);
+                       g_free (nested_backtrace);
+               } else {
+                       msg = g_strdup ("Nested exception trying to figure out what went wrong");
+               }
+               mono_runtime_printf_err ("[ERROR] FATAL UNHANDLED EXCEPTION: %s", msg);
+               g_free (msg);
+#if defined(HOST_IOS)
+               g_assertion_message ("Terminating runtime due to unhandled exception");
+#else
+               exit (mono_environment_exitcode_get ());
+#endif
+       }
+
+       g_assert_not_reached ();
+}
index 3de5ae7ff57681981cf95a766105308ab2cacc79..895a67795fab27df7a2d7e7e1e98e100dbb6ad3c 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef _MONO_METADATA_EXCEPTION_H_
 #define _MONO_METADATA_EXCEPTION_H_
 
+#include <glib.h>
 #include <mono/metadata/object.h>
 #include <mono/metadata/image.h>
 
@@ -147,6 +148,14 @@ MONO_RT_EXTERNAL_ONLY
 MONO_API MonoException *
 mono_get_exception_runtime_wrapped (MonoObject *wrapped_exception);
 
+/* Installs a function which is called when the runtime encounters an unhandled exception.
+ * This hook isn't expected to return.
+ * If no hook has been installed, the runtime will print a message before aborting.
+ */
+typedef void  (*MonoUnhandledExceptionFunc)         (MonoObject *exc, gpointer user_data);
+MONO_API void mono_install_unhandled_exception_hook (MonoUnhandledExceptionFunc func, gpointer user_data);
+void          mono_invoke_unhandled_exception_hook  (MonoObject *exc);
+
 MONO_END_DECLS
 
 #endif /* _MONO_METADATA_EXCEPTION_H_ */
index a871337ee36d15cd920d5edc8997f67a7d32d350..9315bdf828fed4df658bc31e68eab9fda9c95f93 100644 (file)
@@ -34,6 +34,7 @@
 #include <mono/metadata/marshal.h>
 #include <mono/utils/strenc.h>
 #include <utils/mono-io-portability.h>
+#include <mono/utils/w32handle.h>
 
 #undef DEBUG
 
@@ -1272,11 +1273,11 @@ mono_filesize_from_fd (int fd)
 
 #endif
 
-void _wapi_handle_dump (void);
+void mono_w32handle_dump (void);
 
 void ves_icall_System_IO_MonoIO_DumpHandles (void)
 {
 #ifndef HOST_WIN32
-       _wapi_handle_dump ();
+       mono_w32handle_dump ();
 #endif
 }
index 82e013b09cdfc642e32b7d52985d5a83463c9df5..b5a19af282f4aa6e588dc7f1f28aef511acd9a7e 100644 (file)
@@ -161,9 +161,11 @@ void  mono_gc_register_for_finalization (MonoObject *obj, void *user_data);
 void  mono_gc_add_memory_pressure (gint64 value);
 MONO_API int   mono_gc_register_root (char *start, size_t size, MonoGCDescriptor descr, MonoGCRootSource source, const char *msg);
 void  mono_gc_deregister_root (char* addr);
-int   mono_gc_finalizers_for_domain (MonoDomain *domain, MonoObject **out_array, int out_size);
+void  mono_gc_finalize_domain (MonoDomain *domain);
 void  mono_gc_run_finalize (void *obj, void *data);
 void  mono_gc_clear_domain (MonoDomain * domain);
+/* Signal early termination of finalizer processing inside the gc */
+void  mono_gc_suspend_finalizers (void);
 
 
 /* 
index e44f07f6d8329cb3e3811eb9387baeb4aa6654a0..fab34a56b8bc34ad104d3bfba90792e804c494cb 100644 (file)
 #endif
 
 typedef struct DomainFinalizationReq {
+       gint32 ref;
        MonoDomain *domain;
-       HANDLE done_event;
+       MonoCoopSem done;
 } DomainFinalizationReq;
 
-static gboolean gc_disabled = FALSE;
+static gboolean gc_disabled;
 
-static gboolean finalizing_root_domain = FALSE;
+static gboolean finalizing_root_domain;
 
-gboolean log_finalizers = FALSE;
-gboolean mono_do_not_finalize = FALSE;
-gchar **mono_do_not_finalize_class_names = NULL;
+gboolean log_finalizers;
+gboolean mono_do_not_finalize;
+volatile gboolean suspend_finalizers;
+gchar **mono_do_not_finalize_class_names ;
 
 #define mono_finalizer_lock() mono_coop_mutex_lock (&finalizer_mutex)
 #define mono_finalizer_unlock() mono_coop_mutex_unlock (&finalizer_mutex)
 static MonoCoopMutex finalizer_mutex;
 static MonoCoopMutex reference_queue_mutex;
 
-static GSList *domains_to_finalize= NULL;
-static MonoMList *threads_to_finalize = NULL;
+static GSList *domains_to_finalize;
+static MonoMList *threads_to_finalize;
 
 static gboolean finalizer_thread_exited;
 /* Uses finalizer_mutex */
@@ -74,12 +76,20 @@ static MonoCoopCond exited_cond;
 
 static MonoInternalThread *gc_thread;
 
+#ifdef TARGET_WIN32
+static HANDLE pending_done_event;
+#else
+static gboolean pending_done;
+static MonoCoopCond pending_done_cond;
+static MonoCoopMutex pending_done_mutex;
+#endif
+
 static void object_register_finalizer (MonoObject *obj, void (*callback)(void *, void*));
 
 static void reference_queue_proccess_all (void);
 static void mono_reference_queue_cleanup (void);
 static void reference_queue_clear_for_domain (MonoDomain *domain);
-static HANDLE pending_done_event;
+
 
 static guint32
 guarded_wait (HANDLE handle, guint32 timeout, gboolean alertable)
@@ -93,6 +103,60 @@ guarded_wait (HANDLE handle, guint32 timeout, gboolean alertable)
        return result;
 }
 
+typedef struct {
+       MonoCoopCond *cond;
+       MonoCoopMutex *mutex;
+} BreakCoopAlertableWaitUD;
+
+static inline void
+break_coop_alertable_wait (gpointer user_data)
+{
+       BreakCoopAlertableWaitUD *ud = (BreakCoopAlertableWaitUD*)user_data;
+
+       mono_coop_mutex_lock (ud->mutex);
+       mono_coop_cond_signal (ud->cond);
+       mono_coop_mutex_unlock (ud->mutex);
+
+       g_free (ud);
+}
+
+/*
+ * coop_cond_timedwait_alertable:
+ *
+ *   Wait on COND/MUTEX. If ALERTABLE is non-null, the wait can be interrupted.
+ * In that case, *ALERTABLE will be set to TRUE, and 0 is returned.
+ */
+static inline gint
+coop_cond_timedwait_alertable (MonoCoopCond *cond, MonoCoopMutex *mutex, guint32 timeout_ms, gboolean *alertable)
+{
+       BreakCoopAlertableWaitUD *ud;
+       int res;
+
+       if (alertable) {
+               ud = g_new0 (BreakCoopAlertableWaitUD, 1);
+               ud->cond = cond;
+               ud->mutex = mutex;
+
+               mono_thread_info_install_interrupt (break_coop_alertable_wait, ud, alertable);
+               if (*alertable) {
+                       g_free (ud);
+                       return 0;
+               }
+       }
+       res = mono_coop_cond_timedwait (cond, mutex, timeout_ms);
+       if (alertable) {
+               mono_thread_info_uninstall_interrupt (alertable);
+               if (*alertable)
+                       return 0;
+               else {
+                       /* the interrupt token has not been taken by another
+                        * thread, so it's our responsability to free it up. */
+                       g_free (ud);
+               }
+       }
+       return res;
+}
+
 static gboolean
 add_thread_to_finalize (MonoInternalThread *thread, MonoError *error)
 {
@@ -105,7 +169,6 @@ add_thread_to_finalize (MonoInternalThread *thread, MonoError *error)
        return is_ok (error);
 }
 
-static gboolean suspend_finalizers = FALSE;
 /* 
  * actually, we might want to queue the finalize requests in a separate thread,
  * but we need to be careful about the execution domain of the thread...
@@ -382,9 +445,10 @@ gboolean
 mono_domain_finalize (MonoDomain *domain, guint32 timeout) 
 {
        DomainFinalizationReq *req;
-       guint32 res;
-       HANDLE done_event;
        MonoInternalThread *thread = mono_thread_internal_current ();
+       gint res;
+       gboolean ret;
+       gint64 start;
 
 #if defined(__native_client__)
        return FALSE;
@@ -408,14 +472,10 @@ mono_domain_finalize (MonoDomain *domain, guint32 timeout)
 
        mono_gc_collect (mono_gc_max_generation ());
 
-       done_event = CreateEvent (NULL, TRUE, FALSE, NULL);
-       if (done_event == NULL) {
-               return FALSE;
-       }
-
        req = g_new0 (DomainFinalizationReq, 1);
+       req->ref = 2;
        req->domain = domain;
-       req->done_event = done_event;
+       mono_coop_sem_init (&req->done, 0);
 
        if (domain == mono_get_root_domain ())
                finalizing_root_domain = TRUE;
@@ -431,23 +491,65 @@ mono_domain_finalize (MonoDomain *domain, guint32 timeout)
 
        if (timeout == -1)
                timeout = INFINITE;
+       if (timeout != INFINITE)
+               start = mono_msec_ticks ();
 
-       while (TRUE) {
-               res = guarded_wait (done_event, timeout, TRUE);
-               /* printf ("WAIT RES: %d.\n", res); */
+       ret = TRUE;
 
-               if (res == WAIT_IO_COMPLETION) {
-                       if ((thread->state & (ThreadState_StopRequested | ThreadState_SuspendRequested)) != 0)
-                               return FALSE;
-               } else if (res == WAIT_TIMEOUT) {
-                       /* We leak the handle here */
-                       return FALSE;
+       for (;;) {
+               if (timeout == INFINITE) {
+                       res = mono_coop_sem_wait (&req->done, MONO_SEM_FLAGS_ALERTABLE);
                } else {
+                       gint64 elapsed = mono_msec_ticks () - start;
+                       if (elapsed >= timeout) {
+                               ret = FALSE;
+                               break;
+                       }
+
+                       res = mono_coop_sem_timedwait (&req->done, timeout - elapsed, MONO_SEM_FLAGS_ALERTABLE);
+               }
+
+               if (res == MONO_SEM_TIMEDWAIT_RET_SUCCESS) {
                        break;
+               } else if (res == MONO_SEM_TIMEDWAIT_RET_ALERTED) {
+                       if ((thread->state & (ThreadState_StopRequested | ThreadState_SuspendRequested)) != 0) {
+                               ret = FALSE;
+                               break;
+                       }
+               } else if (res == MONO_SEM_TIMEDWAIT_RET_TIMEDOUT) {
+                       ret = FALSE;
+                       break;
+               } else {
+                       g_error ("%s: unknown result %d", __func__, res);
                }
        }
 
-       CloseHandle (done_event);
+       if (!ret) {
+               /* Try removing the req from domains_to_finalize:
+                *  - if it's not found: the domain is being finalized,
+                *     so we the ref count is already decremented
+                *  - if it's found: the domain is not yet being finalized,
+                *     so we can safely decrement the ref */
+
+               gboolean found;
+
+               mono_finalizer_lock ();
+
+               found = g_slist_index (domains_to_finalize, req) != -1;
+               if (found)
+                       domains_to_finalize = g_slist_remove (domains_to_finalize, req);
+
+               mono_finalizer_unlock ();
+
+               if (found) {
+                       /* We have to decrement it wherever we
+                        * remove it from domains_to_finalize */
+                       if (InterlockedDecrement (&req->ref) != 1)
+                               g_error ("%s: req->ref should be 1, as we are the first one to decrement it", __func__);
+               }
+
+               goto done;
+       }
 
        if (domain == mono_get_root_domain ()) {
                mono_threadpool_ms_cleanup ();
@@ -456,7 +558,13 @@ mono_domain_finalize (MonoDomain *domain, guint32 timeout)
 
        mono_profiler_appdomain_event (domain, MONO_PROFILE_END_UNLOAD);
 
-       return TRUE;
+done:
+       if (InterlockedDecrement (&req->ref) == 0) {
+               mono_coop_sem_destroy (&req->done);
+               g_free (req);
+       }
+
+       return ret;
 }
 
 void
@@ -528,11 +636,24 @@ ves_icall_System_GC_WaitForPendingFinalizers (void)
        if (gc_thread == NULL)
                return;
 
+#ifdef TARGET_WIN32
        ResetEvent (pending_done_event);
        mono_gc_finalize_notify ();
        /* g_print ("Waiting for pending finalizers....\n"); */
        guarded_wait (pending_done_event, INFINITE, TRUE);
        /* g_print ("Done pending....\n"); */
+#else
+       gboolean alerted = FALSE;
+       mono_coop_mutex_lock (&pending_done_mutex);
+       pending_done = FALSE;
+       mono_gc_finalize_notify ();
+       while (!pending_done) {
+               coop_cond_timedwait_alertable (&pending_done_cond, &pending_done_mutex, INFINITE, &alerted);
+               if (alerted)
+                       break;
+       }
+       mono_coop_mutex_unlock (&pending_done_mutex);
+#endif
 }
 
 void
@@ -622,8 +743,14 @@ mono_gc_GCHandle_CheckCurrentDomain (guint32 gchandle)
 }
 
 static MonoCoopSem finalizer_sem;
-static volatile gboolean finished=FALSE;
+static volatile gboolean finished;
 
+/*
+ * mono_gc_finalize_notify:
+ *
+ *   Notify the finalizer thread that finalizers etc.
+ * are available to be processed.
+ */
 void
 mono_gc_finalize_notify (void)
 {
@@ -689,15 +816,24 @@ collect_objects (gpointer key, gpointer value, gpointer user_data)
  *  Run the finalizers of all finalizable objects in req->domain.
  */
 static void
-finalize_domain_objects (DomainFinalizationReq *req)
+finalize_domain_objects (void)
 {
-       MonoDomain *domain = req->domain;
+       DomainFinalizationReq *req = NULL;
+       MonoDomain *domain;
 
-#if HAVE_SGEN_GC
-#define NUM_FOBJECTS 64
-       MonoObject *to_finalize [NUM_FOBJECTS];
-       int count;
-#endif
+       if (domains_to_finalize) {
+               mono_finalizer_lock ();
+               if (domains_to_finalize) {
+                       req = (DomainFinalizationReq *)domains_to_finalize->data;
+                       domains_to_finalize = g_slist_remove (domains_to_finalize, req);
+               }
+               mono_finalizer_unlock ();
+       }
+
+       if (!req)
+               return;
+
+       domain = req->domain;
 
        /* Process finalizers which are already in the queue */
        mono_gc_invoke_finalizers ();
@@ -724,33 +860,33 @@ finalize_domain_objects (DomainFinalizationReq *req)
                g_ptr_array_free (objs, TRUE);
        }
 #elif defined(HAVE_SGEN_GC)
-       while ((count = mono_gc_finalizers_for_domain (domain, to_finalize, NUM_FOBJECTS))) {
-               int i;
-               for (i = 0; i < count; ++i) {
-                       mono_gc_run_finalize (to_finalize [i], 0);
-               }
-       }
+       mono_gc_finalize_domain (domain);
+       mono_gc_invoke_finalizers ();
 #endif
 
        /* cleanup the reference queue */
        reference_queue_clear_for_domain (domain);
        
        /* printf ("DONE.\n"); */
-       SetEvent (req->done_event);
+       mono_coop_sem_post (&req->done);
 
-       /* The event is closed in mono_domain_finalize if we get here */
-       g_free (req);
+       if (InterlockedDecrement (&req->ref) == 0) {
+               /* mono_domain_finalize already returned, and
+                * doesn't hold a reference to req anymore. */
+               mono_coop_sem_destroy (&req->done);
+               g_free (req);
+       }
 }
 
 static guint32
 finalizer_thread (gpointer unused)
 {
        MonoError error;
+       gboolean wait = TRUE;
+
        mono_thread_set_name_internal (mono_thread_internal_current (), mono_string_new (mono_get_root_domain (), "Finalizer"), FALSE, &error);
        mono_error_assert_ok (&error);
 
-       gboolean wait = TRUE;
-
        /* Register a hazard free queue pump callback */
        mono_hazard_pointer_install_free_queue_size_callback (hazard_free_queue_is_too_big);
 
@@ -776,18 +912,7 @@ finalizer_thread (gpointer unused)
 
                mono_attach_maybe_start ();
 
-               if (domains_to_finalize) {
-                       mono_finalizer_lock ();
-                       if (domains_to_finalize) {
-                               DomainFinalizationReq *req = (DomainFinalizationReq *)domains_to_finalize->data;
-                               domains_to_finalize = g_slist_remove (domains_to_finalize, req);
-                               mono_finalizer_unlock ();
-
-                               finalize_domain_objects (req);
-                       } else {
-                               mono_finalizer_unlock ();
-                       }
-               }                               
+               finalize_domain_objects ();
 
                /* If finished == TRUE, mono_gc_cleanup has been called (from mono_runtime_cleanup),
                 * before the domain is unloaded.
@@ -801,11 +926,18 @@ finalizer_thread (gpointer unused)
                hazard_free_queue_pump ();
 
                /* Avoid posting the pending done event until there are pending finalizers */
-               if (mono_coop_sem_timedwait (&finalizer_sem, 0, MONO_SEM_FLAGS_NONE) == 0) {
+               if (mono_coop_sem_timedwait (&finalizer_sem, 0, MONO_SEM_FLAGS_NONE) == MONO_SEM_TIMEDWAIT_RET_SUCCESS) {
                        /* Don't wait again at the start of the loop */
                        wait = FALSE;
                } else {
+#ifdef TARGET_WIN32
                        SetEvent (pending_done_event);
+#else
+                       mono_coop_mutex_lock (&pending_done_mutex);
+                       pending_done = TRUE;
+                       mono_coop_cond_signal (&pending_done_cond);
+                       mono_coop_mutex_unlock (&pending_done_mutex);
+#endif
                }
        }
 
@@ -847,8 +979,14 @@ mono_gc_init (void)
                return;
        }
 
+#ifdef TARGET_WIN32
        pending_done_event = CreateEvent (NULL, TRUE, FALSE, NULL);
        g_assert (pending_done_event);
+#else
+       mono_coop_cond_init (&pending_done_cond);
+       mono_coop_mutex_init (&pending_done_mutex);
+#endif
+
        mono_coop_cond_init (&exited_cond);
        mono_coop_sem_init (&finalizer_sem, 0);
 
@@ -870,7 +1008,6 @@ mono_gc_cleanup (void)
        if (!gc_disabled) {
                finished = TRUE;
                if (mono_thread_internal_current () != gc_thread) {
-                       gboolean timed_out = FALSE;
                        gint64 start_ticks = mono_msec_ticks ();
                        gint64 end_ticks = start_ticks + 2000;
 
@@ -896,33 +1033,33 @@ mono_gc_cleanup (void)
 
                                /* Set a flag which the finalizer thread can check */
                                suspend_finalizers = TRUE;
+                               mono_gc_suspend_finalizers ();
 
                                /* Try to abort the thread, in the hope that it is running managed code */
-                               mono_thread_internal_stop (gc_thread);
+                               mono_thread_internal_abort (gc_thread);
 
                                /* Wait for it to stop */
                                ret = guarded_wait (gc_thread->handle, 100, TRUE);
 
                                if (ret == WAIT_TIMEOUT) {
-                                       /* 
-                                        * The finalizer thread refused to die. There is not much we 
-                                        * can do here, since the runtime is shutting down so the 
-                                        * state the finalizer thread depends on will vanish.
+                                       /*
+                                        * The finalizer thread refused to exit. Make it stop.
                                         */
-                                       g_warning ("Shutting down finalizer thread timed out.");
-                                       timed_out = TRUE;
+                                       mono_thread_internal_stop (gc_thread);
+                                       ret = guarded_wait (gc_thread->handle, 100, TRUE);
+                                       g_assert (ret != WAIT_TIMEOUT);
+                                       /* The thread can't set this flag */
+                                       finalizer_thread_exited = TRUE;
                                }
                        }
 
-                       if (!timed_out) {
-                               int ret;
+                       int ret;
 
-                               /* Wait for the thread to actually exit */
-                               ret = guarded_wait (gc_thread->handle, INFINITE, TRUE);
-                               g_assert (ret == WAIT_OBJECT_0);
+                       /* Wait for the thread to actually exit */
+                       ret = guarded_wait (gc_thread->handle, INFINITE, TRUE);
+                       g_assert (ret == WAIT_OBJECT_0);
 
-                               mono_thread_join (GUINT_TO_POINTER (gc_thread->tid));
-                       }
+                       mono_thread_join (GUINT_TO_POINTER (gc_thread->tid));
                        g_assert (finalizer_thread_exited);
                }
                gc_thread = NULL;
index 4b4239eb66f7cfbd3b08ac9da26439b27bf64993..56b9b9353cd706fc6bab6b125dc0112f9b6a4f92 100644 (file)
@@ -45,8 +45,7 @@ Combine: MonoDefaults, GENERATE_GET_CLASS_WITH_CACHE, TYPED_HANDLE_DECL and frie
        We could then generate neat type safe wrappers.
 */
 
-const MonoObject *null_cell = { NULL };
-const MonoObjectHandle mono_null_value_handle = { (MonoObject**)&null_cell };
+const MonoObjectHandle mono_null_value_handle = NULL;
 
 #define THIS_IS_AN_OK_NUMBER_OF_HANDLES 100
 
@@ -105,6 +104,7 @@ mono_handle_stack_free (HandleStack *stack)
                c = next;
        }
        g_free (c);
+       g_free (stack);
 }
 
 void
index 3d48c0648580442e50dde4272fa6b130f434f60c..aa4c324372e7aa9c9f0a2e52e9f1394c8a7aff65 100644 (file)
@@ -180,22 +180,32 @@ Handle macros/functions
 
 #ifdef ENABLE_CHECKED_BUILD
 void mono_handle_verify (MonoRawHandle handle);
-#define HANDLE_INVARIANTS(H) mono_handle_verify((void*)(H).__obj)
+#define HANDLE_INVARIANTS(H) mono_handle_verify((void*)(H))
 #else
 #define HANDLE_INVARIANTS(H) (0)
 #endif
 
+#define TYPED_HANDLE_PAYLOAD_NAME(TYPE) TYPE ## HandlePayload
 #define TYPED_HANDLE_NAME(TYPE) TYPE ## Handle
-#define TYPED_HANDLE_DECL(TYPE) typedef struct { TYPE **__obj; } TYPED_HANDLE_NAME (TYPE) ;
 
-#define MONO_HANDLE_INIT { (void*)mono_null_value_handle.__obj }
+/*
+ * typedef struct {
+ *   MonoObject *__obj;
+ * } MonoObjectHandlePayload;
+ *
+ * typedef MonoObjectHandlePayload* MonoObjectHandle;
+ */
+#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 MONO_HANDLE_PAYLOAD_OFFSET(TYPE) MONO_STRUCT_OFFSET(TYPED_HANDLE_PAYLOAD_NAME (TYPE), __obj)
+
+#define MONO_HANDLE_INIT ((void*) mono_null_value_handle)
 #define NULL_HANDLE mono_null_value_handle
 
 //XXX add functions to get/set raw, set field, set field to null, set array, set array to null
-#define MONO_HANDLE_RAW(HANDLE) (HANDLE_INVARIANTS (HANDLE), (*(HANDLE).__obj))
-#define MONO_HANDLE_DCL(TYPE, NAME) TYPED_HANDLE_NAME(TYPE) NAME = { mono_handle_new ((MonoObject*)(NAME ## _raw)) }
-#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)){ (TYPE**)((VALUE).__obj) }
+#define MONO_HANDLE_RAW(HANDLE) (HANDLE_INVARIANTS (HANDLE), ((HANDLE)->__obj))
+#define MONO_HANDLE_DCL(TYPE, NAME) TYPED_HANDLE_NAME(TYPE) NAME = (TYPED_HANDLE_NAME(TYPE))(mono_handle_new ((MonoObject*)(NAME ## _raw)))
+#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 )
 
 /*
 WARNING WARNING WARNING
@@ -236,9 +246,11 @@ This is why we evaluate index and value before any call to MONO_HANDLE_RAW or ot
 
 
 /* Baked typed handles we all want */
-TYPED_HANDLE_DECL (MonoString)
-TYPED_HANDLE_DECL (MonoArray)
-TYPED_HANDLE_DECL (MonoObject)
+TYPED_HANDLE_DECL (MonoString);
+TYPED_HANDLE_DECL (MonoArray);
+TYPED_HANDLE_DECL (MonoObject);
+
+#define NULL_HANDLE_STRING MONO_HANDLE_CAST(MonoString, NULL_HANDLE)
 
 /*
 This is the constant for a handle that points nowhere.
index 68903954c10e09e4aea8045bb72c100a6e024370..60cdc39b98e3d09ea368e0cdc4c270d3985c83e1 100644 (file)
  * you need to insert a method in the middle, don't bother renaming all the symbols.
  * Remember to change also the first_icall_id argument in the ICALL_TYPE 
  * declaration if you add a new icall at the beginning of a type's icall list.
+ *
+ *
+ * *** (Experimental) Cooperative GC support via Handles and MonoError ***
+ * An icall can use the coop GC handles infrastructure from handles.h to avoid some
+ * boilerplate when manipulating managed objects from runtime code and to use MonoError for
+ * threading exceptions out to managed callerrs:
+ *
+ * HANDLES(ICALL(icallid, methodname, cfuncptr))
+ *
+ * An icall with a HANDLES() declaration wrapped around it will have a generated wrapper
+ * that:
+ *   (1) Updates the coop handle stack on entry and exit
+ *   (2) Call the cfuncptr with a new signature:
+ *     (a) All managed object reference in arguments will be wrapped in a handle
+ *         (ie, MonoString* becomes MonoStringHandle)
+ *     (b) the same for the return value (MonoObject* return becomes MonoObjectHandle)
+ *     (c) An additional final argument is added of type MonoError*
+ *     example:    class object {
+ *                     [MethodImplOptions(InternalCall)]
+ *                     String some_icall (object[] x);
+ *                 }
+ *     should be implemented as:
+ *        MonoStringHandle some_icall (MonoObjectHandle this_handle, MonoArrayHandle x_handle, MonoError *error);
+ *   (3) The wrapper will automatically call mono_error_set_pending_exception (error) and raise the resulting exception.
+ * Note:  valuetypes use the same calling convention as normal.
+ * Limitations: "out" and "ref" arguments are not supported yet. 
  */
 
 #ifndef DISABLE_PROCESS_HANDLING
@@ -62,6 +88,19 @@ 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)
 
+ICALL_TYPE(RTCLASS, "Mono.RuntimeClassHandle", RTCLASS_1)
+ICALL(RTCLASS_1, "GetTypeFromClass", ves_icall_Mono_RuntimeClassHandle_GetTypeFromClass)
+
+ICALL_TYPE(RTPTRARRAY, "Mono.RuntimeGPtrArrayHandle", RTPTRARRAY_1)
+ICALL(RTPTRARRAY_1, "GPtrArrayFree", ves_icall_Mono_RuntimeGPtrArrayHandle_GPtrArrayFree)
+
+ICALL_TYPE(RTMARSHAL, "Mono.RuntimeMarshal", RTMARSHAL_1)
+ICALL(RTMARSHAL_1, "FreeAssemblyName", ves_icall_Mono_RuntimeMarshal_FreeAssemblyName)
+
+ICALL_TYPE(SAFESTRMARSHAL, "Mono.SafeStringMarshal", SAFESTRMARSHAL_1)
+ICALL(SAFESTRMARSHAL_1, "GFree", ves_icall_Mono_SafeStringMarshal_GFree)
+ICALL(SAFESTRMARSHAL_2, "StringToUtf8", ves_icall_Mono_SafeStringMarshal_StringToUtf8)
+
 #ifndef PLATFORM_RO_FS
 ICALL_TYPE(KPAIR, "Mono.Security.Cryptography.KeyPairPersistence", KPAIR_1)
 ICALL(KPAIR_1, "_CanSecure", ves_icall_Mono_Security_Cryptography_KeyPairPersistence_CanSecure)
@@ -454,8 +493,8 @@ ICALL(OBJ_1, "GetType", ves_icall_System_Object_GetType)
 ICALL(OBJ_2, "InternalGetHashCode", mono_object_hash)
 ICALL(OBJ_3, "MemberwiseClone", ves_icall_System_Object_MemberwiseClone)
 
-ICALL_TYPE(ASSEM, "System.Reflection.Assembly", ASSEM_1)
-ICALL(ASSEM_1, "FillName", ves_icall_System_Reflection_Assembly_FillName)
+ICALL_TYPE(ASSEM, "System.Reflection.Assembly", ASSEM_1a)
+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)
@@ -483,8 +522,9 @@ ICALL(ASSEM_24, "get_global_assembly_cache", ves_icall_System_Reflection_Assembl
 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_1)
-ICALL(ASSEMN_1, "ParseName", ves_icall_System_Reflection_AssemblyName_ParseName)
+ICALL_TYPE(ASSEMN, "System.Reflection.AssemblyName", ASSEMN_0)
+ICALL(ASSEMN_0, "GetNativeName", ves_icall_System_Reflection_AssemblyName_GetNativeName)
+ICALL(ASSEMN_3, "ParseAssemblyName", ves_icall_System_Reflection_AssemblyName_ParseAssemblyName)
 ICALL(ASSEMN_2, "get_public_token", mono_digest_get_public_token)
 
 ICALL_TYPE(CATTR_DATA, "System.Reflection.CustomAttributeData", CATTR_DATA_1)
@@ -541,6 +581,9 @@ ICALL(TYPEB_5, "get_event_info", mono_reflection_event_builder_get_event_info)
 ICALL(TYPEB_6, "setup_generic_class", mono_reflection_setup_generic_class)
 ICALL(TYPEB_7, "setup_internal_class", mono_reflection_setup_internal_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)
+
 ICALL_TYPE(FIELDI, "System.Reflection.FieldInfo", FILEDI_1)
 ICALL(FILEDI_1, "GetTypeModifiers", ves_icall_System_Reflection_FieldInfo_GetTypeModifiers)
 ICALL(FILEDI_2, "get_marshal_info", ves_icall_System_Reflection_FieldInfo_get_marshal_info)
@@ -552,7 +595,7 @@ ICALL(MEMBERI_1, "get_MetadataToken", ves_icall_reflection_get_token)
 ICALL_TYPE(MBASE, "System.Reflection.MethodBase", MBASE_1)
 ICALL(MBASE_1, "GetCurrentMethod", ves_icall_GetCurrentMethod)
 ICALL(MBASE_2, "GetMethodBodyInternal", ves_icall_System_Reflection_MethodBase_GetMethodBodyInternal)
-ICALL(MBASE_4, "GetMethodFromHandleInternalType", ves_icall_System_Reflection_MethodBase_GetMethodFromHandleInternalType)
+ICALL(MBASE_4, "GetMethodFromHandleInternalType_native", ves_icall_System_Reflection_MethodBase_GetMethodFromHandleInternalType_native)
 
 ICALL_TYPE(MODULE, "System.Reflection.Module", MODULE_1)
 ICALL(MODULE_1, "Close", ves_icall_System_Reflection_Module_Close)
@@ -618,6 +661,9 @@ ICALL_TYPE(PARAMI, "System.Reflection.ParameterInfo", PARAMI_1)
 ICALL(PARAMI_1, "GetMetadataToken", ves_icall_reflection_get_token)
 ICALL(PARAMI_2, "GetTypeModifiers", ves_icall_ParameterInfo_GetTypeModifiers)
 
+ICALL_TYPE(PROPI, "System.Reflection.PropertyInfo", PROPI_1)
+ICALL(PROPI_1, "internal_from_handle_type", ves_icall_System_Reflection_PropertyInfo_internal_from_handle_type)
+
 ICALL_TYPE(RTFIELD, "System.Reflection.RtFieldInfo", RTFIELD_1)
 ICALL(RTFIELD_1, "UnsafeGetValue", ves_icall_MonoField_GetValueInternal)
 
@@ -731,27 +777,25 @@ ICALL(MHAN_1, "GetFunctionPointer", ves_icall_RuntimeMethodHandle_GetFunctionPoi
 
 ICALL_TYPE(RT, "System.RuntimeType", RT_1)
 ICALL(RT_1, "CreateInstanceInternal", ves_icall_System_Activator_CreateInstanceInternal)
-ICALL(RT_2, "GetConstructors_internal", ves_icall_RuntimeType_GetConstructors_internal)
+ICALL(RT_2, "GetConstructors_native", ves_icall_RuntimeType_GetConstructors_native)
 ICALL(RT_30, "GetCorrespondingInflatedConstructor", ves_icall_RuntimeType_GetCorrespondingInflatedMethod)
 ICALL(RT_31, "GetCorrespondingInflatedMethod", ves_icall_RuntimeType_GetCorrespondingInflatedMethod)
-ICALL(RT_3, "GetEvents_internal", ves_icall_RuntimeType_GetEvents_internal)
-ICALL(RT_5, "GetFields_internal", ves_icall_RuntimeType_GetFields_internal)
+ICALL(RT_3, "GetEvents_native", ves_icall_RuntimeType_GetEvents_native)
+ICALL(RT_5, "GetFields_native", ves_icall_RuntimeType_GetFields_native)
 ICALL(RT_6, "GetGenericArgumentsInternal", ves_icall_RuntimeType_GetGenericArguments)
-ICALL(RT_7, "GetGenericParameterAttributes", ves_icall_RuntimeType_GetGenericParameterAttributes)
-ICALL(RT_8, "GetGenericParameterConstraints_impl", ves_icall_RuntimeType_GetGenericParameterConstraints)
 ICALL(RT_9, "GetGenericParameterPosition", ves_icall_RuntimeType_GetGenericParameterPosition)
 ICALL(RT_10, "GetInterfaceMapData", ves_icall_RuntimeType_GetInterfaceMapData)
 ICALL(RT_11, "GetInterfaces", ves_icall_RuntimeType_GetInterfaces)
-ICALL(RT_12, "GetMethodsByName", ves_icall_RuntimeType_GetMethodsByName)
-ICALL(RT_13, "GetNestedTypes_internal", ves_icall_RuntimeType_GetNestedTypes)
+ICALL(RT_12, "GetMethodsByName_native", ves_icall_RuntimeType_GetMethodsByName_native)
+ICALL(RT_13, "GetNestedTypes_native", ves_icall_RuntimeType_GetNestedTypes_native)
 ICALL(RT_14, "GetPacking", ves_icall_RuntimeType_GetPacking)
-ICALL(RT_15, "GetPropertiesByName", ves_icall_RuntimeType_GetPropertiesByName)
+ICALL(RT_15, "GetPropertiesByName_native", ves_icall_RuntimeType_GetPropertiesByName_native)
 ICALL(RT_16, "GetTypeCodeImplInternal", ves_icall_type_GetTypeCodeInternal)
 ICALL(RT_28, "IsTypeExportedToWindowsRuntime", ves_icall_System_RuntimeType_IsTypeExportedToWindowsRuntime)
 ICALL(RT_29, "IsWindowsRuntimeObjectType", ves_icall_System_RuntimeType_IsWindowsRuntimeObjectType)
 ICALL(RT_17, "MakeGenericType", ves_icall_RuntimeType_MakeGenericType)
 ICALL(RT_18, "MakePointerType", ves_icall_RuntimeType_MakePointerType)
-ICALL(RT_19, "getFullName", ves_icall_System_MonoType_getFullName)
+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)
@@ -766,6 +810,7 @@ ICALL(RTH_2, "GetAssembly", ves_icall_RuntimeTypeHandle_GetAssembly)
 ICALL(RTH_3, "GetAttributes", ves_icall_RuntimeTypeHandle_GetAttributes)
 ICALL(RTH_4, "GetBaseType", ves_icall_RuntimeTypeHandle_GetBaseType)
 ICALL(RTH_5, "GetElementType", ves_icall_RuntimeTypeHandle_GetElementType)
+ICALL(RTH_19, "GetGenericParameterInfo", ves_icall_RuntimeTypeHandle_GetGenericParameterInfo)
 ICALL(RTH_6, "GetGenericTypeDefinition_impl", ves_icall_RuntimeTypeHandle_GetGenericTypeDefinition_impl)
 ICALL(RTH_7, "GetMetadataToken", ves_icall_reflection_get_token)
 ICALL(RTH_8, "GetModule", ves_icall_RuntimeTypeHandle_GetModule)
index 33576447451ba9264ca789ad1f8eb880e6fc500e..a9d68804dc1c604fd51231fae2e4a3381da873c9 100644 (file)
@@ -82,6 +82,7 @@
 #include <mono/metadata/runtime.h>
 #include <mono/metadata/file-mmap.h>
 #include <mono/metadata/seq-points-data.h>
+#include <mono/metadata/handle.h>
 #include <mono/io-layer/io-layer.h>
 #include <mono/utils/monobitset.h>
 #include <mono/utils/mono-time.h>
@@ -110,6 +111,8 @@ 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)
@@ -1529,6 +1532,33 @@ ves_icall_System_Type_internal_from_handle (MonoType *handle)
        return ret;
 }
 
+ICALL_EXPORT MonoType*
+ves_icall_Mono_RuntimeClassHandle_GetTypeFromClass (MonoClass *klass)
+{
+       return mono_class_get_type (klass);
+}
+
+ICALL_EXPORT void
+ves_icall_Mono_RuntimeGPtrArrayHandle_GPtrArrayFree (GPtrArray *ptr_array)
+{
+       g_ptr_array_free (ptr_array, TRUE);
+}
+
+ICALL_EXPORT void
+ves_icall_Mono_SafeStringMarshal_GFree (void *c_str)
+{
+       g_free (c_str);
+}
+
+ICALL_EXPORT char*
+ves_icall_Mono_SafeStringMarshal_StringToUtf8 (MonoString *s)
+{
+       MonoError error;
+       char *res = mono_string_to_utf8_checked (s, &error);
+       mono_error_set_pending_exception (&error);
+       return res;
+}
+
 /* System.TypeCode */
 typedef enum {
        TYPECODE_EMPTY,
@@ -1753,7 +1783,6 @@ ves_icall_System_Reflection_FieldInfo_internal_from_handle_type (MonoClassField
        MonoError error;
        gboolean found = FALSE;
        MonoClass *klass;
-       MonoClass *k;
 
        g_assert (handle);
 
@@ -1762,13 +1791,7 @@ ves_icall_System_Reflection_FieldInfo_internal_from_handle_type (MonoClassField
        } else {
                klass = mono_class_from_mono_type (type);
 
-               /* Check that the field belongs to the class */
-               for (k = klass; k; k = k->parent) {
-                       if (k == handle->parent) {
-                               found = TRUE;
-                               break;
-                       }
-               }
+               found = klass == handle->parent || mono_class_has_parent (klass, handle->parent);
 
                if (!found)
                        /* The managed code will throw the exception */
@@ -1780,6 +1803,55 @@ ves_icall_System_Reflection_FieldInfo_internal_from_handle_type (MonoClassField
        return result;
 }
 
+ICALL_EXPORT MonoReflectionEvent*
+ves_icall_System_Reflection_EventInfo_internal_from_handle_type (MonoEvent *handle, MonoType *type)
+{
+       MonoError error;
+       MonoClass *klass;
+
+       g_assert (handle);
+
+       if (!type) {
+               klass = handle->parent;
+       } else {
+               klass = mono_class_from_mono_type (type);
+
+               gboolean found = klass == handle->parent || mono_class_has_parent (klass, handle->parent);
+               if (!found)
+                       /* Managed code will throw an exception */
+                       return NULL;
+       }
+
+       MonoReflectionEvent *result = mono_event_get_object_checked (mono_domain_get (), klass, handle, &error);
+       mono_error_set_pending_exception (&error);
+       return result;
+}
+
+
+ICALL_EXPORT MonoReflectionProperty*
+ves_icall_System_Reflection_PropertyInfo_internal_from_handle_type (MonoProperty *handle, MonoType *type)
+{
+       MonoError error;
+       MonoClass *klass;
+
+       g_assert (handle);
+
+       if (!type) {
+               klass = handle->parent;
+       } else {
+               klass = mono_class_from_mono_type (type);
+
+               gboolean found = klass == handle->parent || mono_class_has_parent (klass, handle->parent);
+               if (!found)
+                       /* Managed code will throw an exception */
+                       return NULL;
+       }
+
+       MonoReflectionProperty *result = mono_property_get_object_checked (mono_domain_get (), klass, handle, &error);
+       mono_error_set_pending_exception (&error);
+       return result;
+}
+
 ICALL_EXPORT MonoArray*
 ves_icall_System_Reflection_FieldInfo_GetTypeModifiers (MonoReflectionField *field, MonoBoolean optional)
 {
@@ -2875,45 +2947,10 @@ ves_icall_RuntimeType_GetGenericParameterPosition (MonoReflectionType *type)
        return -1;
 }
 
-ICALL_EXPORT GenericParameterAttributes
-ves_icall_RuntimeType_GetGenericParameterAttributes (MonoReflectionType *type)
+ICALL_EXPORT MonoGenericParamInfo *
+ves_icall_RuntimeTypeHandle_GetGenericParameterInfo (MonoReflectionType *type)
 {
-       g_assert (IS_MONOTYPE (type));
-       g_assert (is_generic_parameter (type->type));
-       return (GenericParameterAttributes)mono_generic_param_info (type->type->data.generic_param)->flags;
-}
-
-ICALL_EXPORT MonoArray *
-ves_icall_RuntimeType_GetGenericParameterConstraints (MonoReflectionType *type)
-{
-       MonoError error;
-       MonoReflectionType *rt;
-       MonoGenericParamInfo *param_info;
-       MonoDomain *domain;
-       MonoClass **ptr;
-       MonoArray *res;
-       int i, count;
-
-       g_assert (IS_MONOTYPE (type));
-
-       domain = mono_object_domain (type);
-       param_info = mono_generic_param_info (type->type->data.generic_param);
-       for (count = 0, ptr = param_info->constraints; ptr && *ptr; ptr++, count++)
-               ;
-
-       res = mono_array_new_checked (domain, mono_defaults.runtimetype_class, count, &error);
-       if (mono_error_set_pending_exception (&error))
-               return NULL;
-       for (i = 0; i < count; i++) {
-               rt = mono_type_get_object_checked (domain, &param_info->constraints [i]->byval_arg, &error);
-               if (mono_error_set_pending_exception (&error))
-                       return NULL;
-
-               mono_array_setref (res, i, rt);
-       }
-
-
-       return res;
+       return mono_generic_param_info (type->type->data.generic_param);
 }
 
 ICALL_EXPORT MonoBoolean
@@ -3770,38 +3807,32 @@ enum {
        BFLAGS_OptionalParamBinding = 0x40000
 };
 
-ICALL_EXPORT MonoArray*
-ves_icall_RuntimeType_GetFields_internal (MonoReflectionType *type, MonoString *name, guint32 bflags, MonoReflectionType *reftype)
+ICALL_EXPORT GPtrArray*
+ves_icall_RuntimeType_GetFields_native (MonoReflectionType *type, char *utf8_name, guint32 bflags)
 {
        MonoError error;
-       MonoDomain *domain; 
-       MonoClass *startklass, *klass, *refklass;
-       MonoArray *res;
-       MonoObject *member;
-       int i, match;
+       MonoClass *startklass, *klass;
+       int match;
        gpointer iter;
-       char *utf8_name = NULL;
        int (*compare_func) (const char *s1, const char *s2) = NULL;    
        MonoClassField *field;
-       MonoPtrArray tmp_array;
 
-       domain = ((MonoObject *)type)->vtable->domain;
        if (type->type->byref) {
-               MonoArray *result = mono_array_new_checked (domain, mono_defaults.field_info_class, 0, &error);
-               mono_error_set_pending_exception (&error);
-               return result;
+               return g_ptr_array_new ();
        }
 
+       mono_error_init (&error);
+
+       compare_func = (bflags & BFLAGS_IgnoreCase) ? mono_utf8_strcasecmp : strcmp;
+
        klass = startklass = mono_class_from_mono_type (type->type);
-       refklass = mono_class_from_mono_type (reftype->type);
 
-       mono_ptr_array_init (tmp_array, 2, MONO_ROOT_SOURCE_REFLECTION, "temporary reflection fields list");
+       GPtrArray *ptr_array = g_ptr_array_sized_new (16);
        
 handle_parent: 
        if (mono_class_has_failure (klass)) {
-               mono_ptr_array_destroy (tmp_array);
-               mono_set_pending_exception (mono_class_get_exception_for_failure (klass));
-               return NULL;
+               mono_error_set_for_class_failure (&error, klass);
+               goto fail;
        }
 
        iter = NULL;
@@ -3833,41 +3864,18 @@ handle_parent:
                if (!match)
                        continue;
 
-               if (name != NULL) {
-                       if (utf8_name == NULL) {
-                               utf8_name = mono_string_to_utf8_checked (name, &error);
-                               if (!is_ok (&error))
-                                       goto fail;
-                               compare_func = (bflags & BFLAGS_IgnoreCase) ? mono_utf8_strcasecmp : strcmp;
-                       }
-
-                       if (compare_func (mono_field_get_name (field), utf8_name))
+               if (utf8_name != NULL && compare_func (mono_field_get_name (field), utf8_name))
                                continue;
-               }
 
-               member = (MonoObject*)mono_field_get_object_checked (domain, refklass, field, &error);
-               if (!mono_error_ok (&error))
-                   goto fail;
-               mono_ptr_array_append (tmp_array, member);
+               g_ptr_array_add (ptr_array, field);
        }
        if (!(bflags & BFLAGS_DeclaredOnly) && (klass = klass->parent))
                goto handle_parent;
 
-       res = mono_array_new_cached (domain, mono_defaults.field_info_class, mono_ptr_array_size (tmp_array), &error);
-       if (!is_ok (&error))
-               goto fail;
-
-       for (i = 0; i < mono_ptr_array_size (tmp_array); ++i)
-               mono_array_setref (res, i, mono_ptr_array_get (tmp_array, i));
-
-       mono_ptr_array_destroy (tmp_array);
-
-       if (utf8_name != NULL)
-               g_free (utf8_name);
+       return ptr_array;
 
-       return res;
 fail:
-       mono_ptr_array_destroy (tmp_array);
+       g_ptr_array_free (ptr_array, TRUE);
        mono_error_set_pending_exception (&error);
        return NULL;
 }
@@ -3888,7 +3896,7 @@ method_nonpublic (MonoMethod* method, gboolean start_klass)
 }
 
 GPtrArray*
-mono_class_get_methods_by_name (MonoClass *klass, const char *name, guint32 bflags, gboolean ignore_case, gboolean allow_ctors, MonoException **ex)
+mono_class_get_methods_by_name (MonoClass *klass, const char *name, guint32 bflags, gboolean ignore_case, gboolean allow_ctors, MonoError *error)
 {
        GPtrArray *array;
        MonoClass *startklass;
@@ -3902,7 +3910,7 @@ mono_class_get_methods_by_name (MonoClass *klass, const char *name, guint32 bfla
 
        array = g_ptr_array_new ();
        startklass = klass;
-       *ex = NULL;
+       mono_error_init (error);
 
        if (name != NULL)
                compare_func = (ignore_case) ? mono_utf8_strcasecmp : strcmp;
@@ -3991,117 +3999,54 @@ loader_error:
                g_free (method_slots);
        g_ptr_array_free (array, TRUE);
 
-       if (mono_class_has_failure (klass)) {
-               *ex = mono_class_get_exception_for_failure (klass);
-       } else {
-               *ex = mono_get_exception_execution_engine ("Unknown error");
-       }
+       g_assert (mono_class_has_failure (klass));
+       mono_error_set_for_class_failure (error, klass);
        return NULL;
 }
 
-ICALL_EXPORT MonoArray*
-ves_icall_RuntimeType_GetMethodsByName (MonoReflectionType *type, MonoString *name, guint32 bflags, MonoBoolean ignore_case, MonoReflectionType *reftype)
+ICALL_EXPORT GPtrArray*
+ves_icall_RuntimeType_GetMethodsByName_native (MonoReflectionType *type, const char *mname, guint32 bflags, MonoBoolean ignore_case)
 {
-       static MonoClass *MethodInfo_array;
        MonoError error;
-       MonoDomain *domain; 
-       MonoArray *res;
-       MonoVTable *array_vtable;
-       MonoException *ex = NULL;
-       const char *mname = NULL;
        GPtrArray *method_array;
-       MonoClass *klass, *refklass;
-       int i;
-
-       mono_error_init (&error);
-
-       if (!MethodInfo_array) {
-               MonoClass *klass = mono_array_class_get (mono_defaults.method_info_class, 1);
-               mono_memory_barrier ();
-               MethodInfo_array = klass;
-       }
+       MonoClass *klass;
 
        klass = mono_class_from_mono_type (type->type);
-       refklass = mono_class_from_mono_type (reftype->type);
-       domain = ((MonoObject *)type)->vtable->domain;
-       array_vtable = mono_class_vtable_full (domain, MethodInfo_array, &error);
-       if (!is_ok (&error)) {
-               mono_error_set_pending_exception (&error);
-               return NULL;
-       }
        if (type->type->byref) {
-               res = mono_array_new_specific_checked (array_vtable, 0, &error);
-               mono_error_set_pending_exception (&error);
-
-               return res;
-       }
-
-       if (name) {
-               mname = mono_string_to_utf8_checked (name, &error);
-               if (mono_error_set_pending_exception (&error))
-                   return NULL;
-       }
-
-       method_array = mono_class_get_methods_by_name (klass, mname, bflags, ignore_case, FALSE, &ex);
-       g_free ((char*)mname);
-       if (ex) {
-               mono_set_pending_exception (ex);
-               return NULL;
-       }
-
-       res = mono_array_new_specific_checked (array_vtable, method_array->len, &error);
-       if (!mono_error_ok (&error)) {
-               mono_error_set_pending_exception (&error);
-               return NULL;
+               return g_ptr_array_new ();
        }
 
-       for (i = 0; i < method_array->len; ++i) {
-               MonoMethod *method = (MonoMethod *)g_ptr_array_index (method_array, i);
-               MonoReflectionMethod *rm = mono_method_get_object_checked (domain, method, refklass, &error);
-               if (!mono_error_ok (&error))
-                       goto failure;
-               mono_array_setref (res, i, rm);
-       }
-
-failure:
-       g_ptr_array_free (method_array, TRUE);
-       if (!mono_error_ok (&error))
-               mono_set_pending_exception (mono_error_convert_to_exception (&error));
-       return res;
+       method_array = mono_class_get_methods_by_name (klass, mname, bflags, ignore_case, FALSE, &error);
+       mono_error_set_pending_exception (&error);
+       return method_array;
 }
 
-ICALL_EXPORT MonoArray*
-ves_icall_RuntimeType_GetConstructors_internal (MonoReflectionType *type, guint32 bflags, MonoReflectionType *reftype)
+ICALL_EXPORT GPtrArray*
+ves_icall_RuntimeType_GetConstructors_native (MonoReflectionType *type, guint32 bflags)
 {
-       MonoDomain *domain; 
-       MonoClass *startklass, *klass, *refklass;
-       MonoArray *res = NULL;
+       MonoClass *startklass, *klass;
        MonoMethod *method;
-       MonoObject *member;
-       int i, match;
+       int match;
        gpointer iter = NULL;
-       MonoPtrArray tmp_array;
+       GPtrArray *res_array;
        MonoError error;
        
-       domain = ((MonoObject *)type)->vtable->domain;
        if (type->type->byref) {
-               res = mono_array_new_cached (domain, mono_defaults.method_info_class, 0, &error);
-               mono_error_set_pending_exception (&error);
-               return res;
+               return g_ptr_array_new ();
        }
 
-       mono_ptr_array_init (tmp_array, 4, MONO_ROOT_SOURCE_REFLECTION, "temporary reflection constructors list"); /*FIXME, guestimating*/
-
-
        klass = startklass = mono_class_from_mono_type (type->type);
-       refklass = mono_class_from_mono_type (reftype->type);
 
        mono_class_setup_methods (klass);
        if (mono_class_has_failure (klass)) {
-               mono_set_pending_exception (mono_class_get_exception_for_failure (klass));
-               goto leave;
+               mono_error_init (&error);
+               mono_error_set_for_class_failure (&error, klass);
+               mono_error_set_pending_exception (&error);
+               return NULL;
        }
 
+       res_array = g_ptr_array_sized_new (4); /* FIXME, guestimating */
+
        iter = NULL;
        while ((method = mono_class_get_methods (klass, &iter))) {
                match = 0;
@@ -4128,24 +4073,10 @@ ves_icall_RuntimeType_GetConstructors_internal (MonoReflectionType *type, guint3
 
                if (!match)
                        continue;
-               member = (MonoObject*)mono_method_get_object_checked (domain, method, refklass, &error);
-               if (mono_error_set_pending_exception (&error))
-                       goto leave;
-
-               mono_ptr_array_append (tmp_array, member);
+               g_ptr_array_add (res_array, method);
        }
 
-       res = mono_array_new_cached (domain, mono_class_get_constructor_info_class (), mono_ptr_array_size (tmp_array), &error);
-       if (mono_error_set_pending_exception (&error))
-               goto leave;
-
-       for (i = 0; i < mono_ptr_array_size (tmp_array); ++i)
-               mono_array_setref (res, i, mono_ptr_array_get (tmp_array, i));
-
-leave:
-       mono_ptr_array_destroy (tmp_array);
-
-       return res;
+       return res_array;
 }
 
 static guint
@@ -4211,49 +4142,40 @@ property_accessor_nonpublic (MonoMethod* accessor, gboolean start_klass)
        return method_nonpublic (accessor, start_klass);
 }
 
-ICALL_EXPORT MonoArray*
-ves_icall_RuntimeType_GetPropertiesByName (MonoReflectionType *type, MonoString *name, guint32 bflags, MonoBoolean ignore_case, MonoReflectionType *reftype)
+ICALL_EXPORT GPtrArray*
+ves_icall_RuntimeType_GetPropertiesByName_native (MonoReflectionType *type, gchar *propname, guint32 bflags, MonoBoolean ignore_case)
 {
        MonoError error;
-       MonoDomain *domain; 
        MonoClass *startklass, *klass;
-       MonoArray *res;
        MonoMethod *method;
        MonoProperty *prop;
-       int i, match;
+       int match;
        guint32 flags;
-       gchar *propname = NULL;
        int (*compare_func) (const char *s1, const char *s2) = NULL;
        gpointer iter;
        GHashTable *properties = NULL;
-       MonoPtrArray tmp_array;
+       GPtrArray *res_array;
 
-       mono_error_init (&error);
-       
-       domain = ((MonoObject *)type)->vtable->domain;
        if (type->type->byref) {
-               res = mono_array_new_cached (domain, mono_class_get_property_info_class (), 0, &error);
-               mono_error_set_pending_exception (&error);
-               return res;
+               return g_ptr_array_new ();
        }
 
-       mono_ptr_array_init (tmp_array, 8, MONO_ROOT_SOURCE_REFLECTION, "temporary reflection properties list"); /*This the average for ASP.NET types*/
-
+       mono_error_init (&error);
+       
        klass = startklass = mono_class_from_mono_type (type->type);
 
-       if (name != NULL) {
-               propname = mono_string_to_utf8_checked (name, &error);
-               if (mono_error_set_pending_exception (&error))
-                       return NULL;
-               compare_func = (ignore_case) ? mono_utf8_strcasecmp : strcmp;
-       }
+       compare_func = (ignore_case) ? mono_utf8_strcasecmp : strcmp;
+
+       res_array = g_ptr_array_sized_new (8); /*This the average for ASP.NET types*/
 
        properties = g_hash_table_new (property_hash, (GEqualFunc)property_equal);
 handle_parent:
        mono_class_setup_methods (klass);
        mono_class_setup_vtable (klass);
-       if (mono_class_has_failure (klass))
+       if (mono_class_has_failure (klass)) {
+               mono_error_set_for_class_failure (&error, klass);
                goto loader_error;
+       }
 
        iter = NULL;
        while ((prop = mono_class_get_properties (klass, &iter))) {
@@ -4291,49 +4213,28 @@ handle_parent:
                        continue;
                match = 0;
 
-               if (name != NULL) {
-                       if (compare_func (propname, prop->name))
-                               continue;
-               }
+               if (propname != NULL && compare_func (propname, prop->name))
+                       continue;
                
                if (g_hash_table_lookup (properties, prop))
                        continue;
 
-               MonoReflectionProperty *pr = mono_property_get_object_checked (domain, startklass, prop, &error);
-               if (!pr)
-                       goto failure;
-               mono_ptr_array_append (tmp_array, pr);
+               g_ptr_array_add (res_array, prop);
                
                g_hash_table_insert (properties, prop, prop);
        }
-       if ((!(bflags & BFLAGS_DeclaredOnly) && (klass = klass->parent)))
+       if (!(bflags & BFLAGS_DeclaredOnly) && (klass = klass->parent))
                goto handle_parent;
 
        g_hash_table_destroy (properties);
-       g_free (propname);
-
-       res = mono_array_new_cached (domain, mono_class_get_property_info_class (), mono_ptr_array_size (tmp_array), &error);
-       if (!is_ok (&error))
-               goto failure;
-       for (i = 0; i < mono_ptr_array_size (tmp_array); ++i)
-               mono_array_setref (res, i, mono_ptr_array_get (tmp_array, i));
-
-       mono_ptr_array_destroy (tmp_array);
-
-       return res;
 
+       return res_array;
 
 
 loader_error:
-       if (mono_class_has_failure (klass))
-               mono_error_set_for_class_failure (&error, klass);
-
-failure:
        if (properties)
                g_hash_table_destroy (properties);
-       if (name)
-               g_free (propname);
-       mono_ptr_array_destroy (tmp_array);
+       g_ptr_array_free (res_array, TRUE);
 
        mono_error_set_pending_exception (&error);
 
@@ -4355,32 +4256,28 @@ event_equal (MonoEvent *event1, MonoEvent *event2)
        return g_str_equal (event1->name, event2->name);
 }
 
-ICALL_EXPORT MonoArray*
-ves_icall_RuntimeType_GetEvents_internal (MonoReflectionType *type, MonoString *name, guint32 bflags, MonoReflectionType *reftype)
+ICALL_EXPORT GPtrArray*
+ves_icall_RuntimeType_GetEvents_native (MonoReflectionType *type, char *utf8_name, guint32 bflags)
 {
        MonoError error;
-       MonoDomain *domain; 
        MonoClass *startklass, *klass;
-       MonoArray *res;
        MonoMethod *method;
        MonoEvent *event;
-       int i, match;
+       int match;
        gpointer iter;
-       char *utf8_name = NULL;
        int (*compare_func) (const char *s1, const char *s2) = NULL;    
        GHashTable *events = NULL;
-       MonoPtrArray tmp_array;
+       GPtrArray *res_array;
 
-       mono_error_init (&error);
-       
-       domain = mono_object_domain (type);
        if (type->type->byref) {
-               res = mono_array_new_cached (domain, mono_class_get_event_info_class (), 0, &error);
-               mono_error_set_pending_exception (&error);
-               return res;
+               return g_ptr_array_new ();
        }
 
-       mono_ptr_array_init (tmp_array, 4, MONO_ROOT_SOURCE_REFLECTION, "temporary reflection events list");
+       mono_error_init (&error);
+
+       compare_func = (bflags & BFLAGS_IgnoreCase) ? mono_utf8_strcasecmp : strcmp;
+
+       res_array = g_ptr_array_sized_new (4);
 
        klass = startklass = mono_class_from_mono_type (type->type);
 
@@ -4388,8 +4285,10 @@ ves_icall_RuntimeType_GetEvents_internal (MonoReflectionType *type, MonoString *
 handle_parent:
        mono_class_setup_methods (klass);
        mono_class_setup_vtable (klass);
-       if (mono_class_has_failure (klass))
-               goto loader_error;
+       if (mono_class_has_failure (klass)) {
+               mono_error_set_for_class_failure (&error, klass);
+               goto failure;
+       }
 
        iter = NULL;
        while ((event = mono_class_get_events (klass, &iter))) {
@@ -4430,26 +4329,13 @@ handle_parent:
                if (!match)
                        continue;
 
-               if (name != NULL) {
-                       if (utf8_name == NULL) {
-                               utf8_name = mono_string_to_utf8_checked (name, &error);
-                               if (!is_ok (&error))
-                                       goto failure;
-                               compare_func = (bflags & BFLAGS_IgnoreCase) ? mono_utf8_strcasecmp : strcmp;
-                       }
-
-                       if (compare_func (event->name, utf8_name))
-                               continue;
-               }               
+               if (utf8_name != NULL && compare_func (event->name, utf8_name))
+                       continue;
 
                if (g_hash_table_lookup (events, event))
                        continue;
 
-               MonoReflectionEvent *ev_obj;
-               ev_obj = mono_event_get_object_checked (domain, startklass, event, &error);
-               if (!ev_obj)
-                       goto failure;
-               mono_ptr_array_append (tmp_array, ev_obj);
+               g_ptr_array_add (res_array, event); 
 
                g_hash_table_insert (events, event, event);
        }
@@ -4458,59 +4344,31 @@ handle_parent:
 
        g_hash_table_destroy (events);
 
-       res = mono_array_new_cached (domain, mono_class_get_event_info_class (), mono_ptr_array_size (tmp_array), &error);
-       if (!is_ok (&error))
-               goto failure;
-
-       for (i = 0; i < mono_ptr_array_size (tmp_array); ++i)
-               mono_array_setref (res, i, mono_ptr_array_get (tmp_array, i));
-
-       mono_ptr_array_destroy (tmp_array);
-
-       if (utf8_name != NULL)
-               g_free (utf8_name);
-
-       return res;
-
-loader_error:
-       if (mono_class_has_failure (klass))
-               mono_error_set_for_class_failure (&error, klass);
+       return res_array;
 
 failure:
-       
        if (events != NULL)
                g_hash_table_destroy (events);
-       if (utf8_name != NULL)
-               g_free (utf8_name);
 
-       mono_ptr_array_destroy (tmp_array);
+       g_ptr_array_free (res_array, TRUE);
 
        mono_error_set_pending_exception (&error);
        return NULL;
 }
 
-ICALL_EXPORT MonoArray*
-ves_icall_RuntimeType_GetNestedTypes (MonoReflectionType *type, MonoString *name, guint32 bflags)
+ICALL_EXPORT GPtrArray *
+ves_icall_RuntimeType_GetNestedTypes_native (MonoReflectionType *type, char *str, guint32 bflags)
 {
-       MonoError error;
-       MonoReflectionType *rt;
-       MonoDomain *domain; 
        MonoClass *klass;
-       MonoArray *res = NULL;
-       int i, match;
+       int match;
        MonoClass *nested;
        gpointer iter;
-       char *str = NULL;
-       MonoPtrArray tmp_array;
+       GPtrArray *res_array;
 
-       mono_error_init (&error);
-
-       domain = ((MonoObject *)type)->vtable->domain;
        if (type->type->byref) {
-               MonoArray *result = mono_array_new_cached (domain, mono_defaults.runtimetype_class, 0, &error);
-               mono_error_set_pending_exception (&error);
-               return result;
+               return g_ptr_array_new ();
        }
+
        klass = mono_class_from_mono_type (type->type);
 
        /*
@@ -4525,7 +4383,8 @@ ves_icall_RuntimeType_GetNestedTypes (MonoReflectionType *type, MonoString *name
        if (klass->generic_class)
                klass = klass->generic_class->container_class;
 
-       mono_ptr_array_init (tmp_array, 1, MONO_ROOT_SOURCE_REFLECTION, "temporary reflection nested types list");
+       res_array = g_ptr_array_new ();
+       
        iter = NULL;
        while ((nested = mono_class_get_nested_types (klass, &iter))) {
                match = 0;
@@ -4539,39 +4398,13 @@ ves_icall_RuntimeType_GetNestedTypes (MonoReflectionType *type, MonoString *name
                if (!match)
                        continue;
 
-               if (name != NULL) {
-                       if (str == NULL) {
-                               str = mono_string_to_utf8_checked (name, &error);
-                               if (!is_ok (&error))
-                                       goto leave;
-                               mono_identifier_unescape_type_name_chars (str);
-                       }
-
-                       if (strcmp (nested->name, str))
+               if (str != NULL && strcmp (nested->name, str))
                                continue;
-               }
-
-               rt = mono_type_get_object_checked (domain, &nested->byval_arg, &error);
-               if (!is_ok (&error))
-                       goto leave;
 
-               mono_ptr_array_append (tmp_array, (MonoObject*) rt);
+               g_ptr_array_add (res_array, &nested->byval_arg);
        }
 
-       res = mono_array_new_cached (domain, mono_defaults.runtimetype_class, mono_ptr_array_size (tmp_array), &error);
-       if (!is_ok (&error))
-               goto leave;
-
-       for (i = 0; i < mono_ptr_array_size (tmp_array); ++i)
-               mono_array_setref (res, i, mono_ptr_array_get (tmp_array, i));
-
-leave:
-       mono_ptr_array_destroy (tmp_array);
-
-       g_free (str);
-
-       mono_error_set_pending_exception (&error);
-       return res;
+       return res_array;
 }
 
 ICALL_EXPORT MonoReflectionType*
@@ -4893,6 +4726,27 @@ ves_icall_System_Reflection_Assembly_GetManifestResourceNames (MonoReflectionAss
        return result;
 }
 
+ICALL_EXPORT MonoString*
+ves_icall_System_Reflection_Assembly_GetAotId ()
+{
+       int i;
+       guint8 aotid_sum = 0;
+       MonoDomain* domain = mono_domain_get ();
+
+       if (!domain->entry_assembly || !domain->entry_assembly->image)
+               return NULL;
+
+       guint8 (*aotid)[16] = &domain->entry_assembly->image->aotid;
+
+       for (i = 0; i < 16; ++i)
+               aotid_sum |= (*aotid)[i];
+
+       if (aotid_sum == 0)
+               return NULL;
+       
+       return mono_string_new (domain, mono_guid_to_string((guint8*) aotid));
+}
+
 static MonoObject*
 create_version (MonoDomain *domain, guint32 major, guint32 minor, guint32 build, guint32 revision, MonoError *error)
 {
@@ -5131,7 +4985,7 @@ ves_icall_System_Reflection_Assembly_GetManifestResourceInfoInternal (MonoReflec
                        mono_metadata_decode_row (table, i - 1, file_cols, MONO_FILE_SIZE);
                        val = mono_metadata_string_heap (assembly->assembly->image, file_cols [MONO_FILE_NAME]);
                        MONO_OBJECT_SETREF (info, filename, mono_string_new (mono_object_domain (assembly), val));
-                       if (file_cols [MONO_FILE_FLAGS] && FILE_CONTAINS_NO_METADATA)
+                       if (file_cols [MONO_FILE_FLAGS] & FILE_CONTAINS_NO_METADATA)
                                info->location = 0;
                        else
                                info->location = RESOURCE_LOCATION_EMBEDDED;
@@ -5274,7 +5128,7 @@ ves_icall_System_Reflection_Assembly_GetModulesInternal (MonoReflectionAssembly
 
        for (i = 0; i < file_count; ++i, ++j) {
                mono_metadata_decode_row (table, i, cols, MONO_FILE_SIZE);
-               if (cols [MONO_FILE_FLAGS] && FILE_CONTAINS_NO_METADATA) {
+               if (cols [MONO_FILE_FLAGS] & FILE_CONTAINS_NO_METADATA) {
                        MonoReflectionModule *rm = mono_module_file_get_object_checked (domain, image, i, &error);
                        if (mono_error_set_pending_exception (&error))
                                return NULL;
@@ -5357,21 +5211,24 @@ mono_method_get_equivalent_method (MonoMethod *method, MonoClass *klass)
 }
 
 ICALL_EXPORT MonoReflectionMethod*
-ves_icall_System_Reflection_MethodBase_GetMethodFromHandleInternalType (MonoMethod *method, MonoType *type)
+ves_icall_System_Reflection_MethodBase_GetMethodFromHandleInternalType_native (MonoMethod *method, MonoType *type, MonoBoolean generic_check)
 {
        MonoReflectionMethod *res = NULL;
        MonoError error;
        MonoClass *klass;
-       if (type) {
+       if (type && generic_check) {
                klass = mono_class_from_mono_type (type);
-               if (mono_class_get_generic_type_definition (method->klass) != mono_class_get_generic_type_definition (klass)) 
+               if (mono_class_get_generic_type_definition (method->klass) != mono_class_get_generic_type_definition (klass))
                        return NULL;
+
                if (method->klass != klass) {
                        method = mono_method_get_equivalent_method (method, klass);
                        if (!method)
                                return NULL;
                }
-       } else
+       } else if (type)
+               klass = mono_class_from_mono_type (type);
+       else
                klass = method->klass;
        res = mono_method_get_object_checked (mono_domain_get (), method, klass, &error);
        mono_error_set_pending_exception (&error);
@@ -5443,13 +5300,14 @@ ves_icall_System_Reflection_Assembly_GetCallingAssembly (void)
        return result;
 }
 
-ICALL_EXPORT MonoString *
-ves_icall_System_MonoType_getFullName (MonoReflectionType *object, gboolean full_name,
-                                      gboolean assembly_qualified)
+ICALL_EXPORT MonoStringHandle
+ves_icall_System_RuntimeType_getFullName (MonoReflectionTypeHandle object, gboolean full_name,
+                                                                                 gboolean assembly_qualified, MonoError *error)
 {
-       MonoDomain *domain = mono_object_domain (object); 
+       MonoDomain *domain = mono_object_domain (MONO_HANDLE_RAW (object));
+       MonoType *type = MONO_HANDLE_RAW (object)->type;
        MonoTypeNameFormat format;
-       MonoString *res;
+       MonoStringHandle res;
        gchar *name;
 
        if (full_name)
@@ -5459,16 +5317,16 @@ ves_icall_System_MonoType_getFullName (MonoReflectionType *object, gboolean full
        else
                format = MONO_TYPE_NAME_FORMAT_REFLECTION;
  
-       name = mono_type_get_name_full (object->type, format);
+       name = mono_type_get_name_full (type, format);
        if (!name)
-               return NULL;
+               return NULL_HANDLE_STRING;
 
-       if (full_name && (object->type->type == MONO_TYPE_VAR || object->type->type == MONO_TYPE_MVAR)) {
+       if (full_name && (type->type == MONO_TYPE_VAR || type->type == MONO_TYPE_MVAR)) {
                g_free (name);
-               return NULL;
+               return NULL_HANDLE_STRING;
        }
 
-       res = mono_string_new (domain, name);
+       res = mono_string_new_handle (domain, name);
        g_free (name);
 
        return res;
@@ -5633,29 +5491,10 @@ ves_icall_System_Reflection_Assembly_get_fullName (MonoReflectionAssembly *assem
        return res;
 }
 
-ICALL_EXPORT void
-ves_icall_System_Reflection_Assembly_FillName (MonoReflectionAssembly *assembly, MonoReflectionAssemblyName *aname)
+ICALL_EXPORT MonoAssemblyName *
+ves_icall_System_Reflection_AssemblyName_GetNativeName (MonoAssembly *mass)
 {
-       MonoError error;
-       gchar *absolute, *dirname;
-       MonoAssembly *mass = assembly->assembly;
-
-       /* XXX this is duplicated code to compute the codebase URI, unify it */
-       if (g_path_is_absolute (mass->image->name)) {
-               absolute = g_strdup (mass->image->name);
-               dirname = g_path_get_dirname (absolute);
-       } else {
-               absolute = g_build_filename (mass->basedir, mass->image->name, NULL);
-               dirname = g_strdup (mass->basedir);
-       }
-
-       replace_shadow_path (mono_object_domain (assembly), dirname, &absolute);
-       g_free (dirname);
-
-       fill_reflection_assembly_name (mono_object_domain (assembly), aname, &mass->aname, absolute, TRUE, TRUE, TRUE, &error);
-       mono_error_set_pending_exception (&error);
-
-       g_free (absolute);
+       return &mass->aname;
 }
 
 ICALL_EXPORT void
@@ -5921,35 +5760,18 @@ ves_icall_System_Reflection_Assembly_GetTypes (MonoReflectionAssembly *assembly,
        return res;
 }
 
-ICALL_EXPORT gboolean
-ves_icall_System_Reflection_AssemblyName_ParseName (MonoReflectionAssemblyName *name, MonoString *assname)
+ICALL_EXPORT void
+ves_icall_Mono_RuntimeMarshal_FreeAssemblyName (MonoAssemblyName *aname)
 {
-       MonoError error;
-       MonoAssemblyName aname;
-       MonoDomain *domain = mono_object_domain (name);
-       char *val;
-       gboolean is_version_defined;
-       gboolean is_token_defined;
-
-       aname.public_key = NULL;
-       val = mono_string_to_utf8_checked (assname, &error);
-       if (mono_error_set_pending_exception (&error))
-               return FALSE;
-
-       if (!mono_assembly_name_parse_full (val, &aname, TRUE, &is_version_defined, &is_token_defined)) {
-               g_free ((guint8*) aname.public_key);
-               g_free (val);
-               return FALSE;
-       }
-       
-       fill_reflection_assembly_name (domain, name, &aname, "", is_version_defined, FALSE, is_token_defined, &error);
-       mono_error_set_pending_exception (&error);
+       mono_assembly_name_free (aname);
+}
 
-       mono_assembly_name_free (&aname);
-       g_free ((guint8*) aname.public_key);
-       g_free (val);
+ICALL_EXPORT gboolean
+ves_icall_System_Reflection_AssemblyName_ParseAssemblyName (const char *name, MonoAssemblyName *aname, gboolean *is_version_definited, gboolean *is_token_defined)
+{
+       *is_version_definited = *is_token_defined = FALSE;
 
-       return TRUE;
+       return mono_assembly_name_parse_full (name, aname, TRUE, is_version_definited, is_token_defined);
 }
 
 ICALL_EXPORT MonoReflectionType*
@@ -8400,6 +8222,7 @@ ves_icall_Microsoft_Win32_NativeMethods_SetPriorityClass (gpointer handle, gint3
 
 #define ICALL_TYPE(id,name,first)
 #define ICALL(id,name,func) Icall_ ## id,
+#define HANDLES(inner) inner
 
 enum {
 #include "metadata/icall-def.h"
@@ -8410,6 +8233,8 @@ enum {
 #undef ICALL
 #define ICALL_TYPE(id,name,first) Icall_type_ ## id,
 #define ICALL(id,name,func)
+#undef HANDLES
+#define HANDLES(inner) inner
 enum {
 #include "metadata/icall-def.h"
        Icall_type_num
@@ -8419,6 +8244,8 @@ enum {
 #undef ICALL
 #define ICALL_TYPE(id,name,firstic) {(Icall_ ## firstic)},
 #define ICALL(id,name,func)
+#undef HANDLES
+#define HANDLES(inner) inner
 typedef struct {
        guint16 first_icall;
 } IcallTypeDesc;
@@ -8431,6 +8258,8 @@ icall_type_descs [] = {
 
 #define icall_desc_num_icalls(desc) ((desc) [1].first_icall - (desc) [0].first_icall)
 
+#undef HANDLES
+#define HANDLES(inner) inner
 #undef ICALL_TYPE
 #define ICALL_TYPE(id,name,first)
 #undef ICALL
@@ -8502,6 +8331,8 @@ icall_names [] = {
 
 #endif /* !HAVE_ARRAY_ELEM_INIT */
 
+#undef HANDLES
+#define HANDLES(inner) inner
 #undef ICALL_TYPE
 #undef ICALL
 #define ICALL_TYPE(id,name,first)
@@ -8513,6 +8344,8 @@ icall_functions [] = {
 };
 
 #ifdef ENABLE_ICALL_SYMBOL_MAP
+#undef HANDLES
+#define HANDLES(inner) inner
 #undef ICALL_TYPE
 #undef ICALL
 #define ICALL_TYPE(id,name,first)
@@ -8524,6 +8357,19 @@ icall_symbols [] = {
 };
 #endif
 
+#undef ICALL_TYPE
+#undef ICALL
+#define ICALL_TYPE(id,name,first)
+#define ICALL(id,name,func) 0,
+#undef HANDLES
+#define HANDLES(inner) 1,
+static const guchar
+icall_uses_handles [] = {
+#include "metadata/icall-def.h"
+#undef ICALL
+#undef HANDLES
+};
+
 #endif /* DISABLE_ICALL_TABLES */
 
 static mono_mutex_t icall_mutex;
@@ -8644,13 +8490,31 @@ compare_method_imap (const void *key, const void *elem)
        return strcmp (key, method_name);
 }
 
-static gpointer
-find_method_icall (const IcallTypeDesc *imap, const char *name)
+static gsize
+find_slot_icall (const IcallTypeDesc *imap, const char *name)
 {
        const guint16 *nameslot = (const guint16 *)mono_binary_search (name, icall_names_idx + imap->first_icall, icall_desc_num_icalls (imap), sizeof (icall_names_idx [0]), compare_method_imap);
        if (!nameslot)
+               return -1;
+       return (nameslot - &icall_names_idx [0]);
+}
+
+static gboolean
+find_uses_handles_icall (const IcallTypeDesc *imap, const char *name)
+{
+       gsize slotnum = find_slot_icall (imap, name);
+       if (slotnum == -1)
+               return FALSE;
+       return (gboolean)icall_uses_handles [slotnum];
+}
+
+static gpointer
+find_method_icall (const IcallTypeDesc *imap, const char *name)
+{
+       gsize slotnum = find_slot_icall (imap, name);
+       if (slotnum == -1)
                return NULL;
-       return (gpointer)icall_functions [(nameslot - &icall_names_idx [0])];
+       return (gpointer)icall_functions [slotnum];
 }
 
 static int
@@ -8678,13 +8542,31 @@ compare_method_imap (const void *key, const void *elem)
        return strcmp (key, *method_name);
 }
 
-static gpointer
-find_method_icall (const IcallTypeDesc *imap, const char *name)
+static gsize
+find_slot_icall (const IcallTypeDesc *imap, const char *name)
 {
        const char **nameslot = mono_binary_search (name, icall_names + imap->first_icall, icall_desc_num_icalls (imap), sizeof (icall_names [0]), compare_method_imap);
        if (!nameslot)
+               return -1;
+       return nameslot - icall_names;
+}
+
+static gpointer
+find_method_icall (const IcallTypeDesc *imap, const char *name)
+{
+       gsize slotnum = find_slot_icall (imap, name);
+       if (slotnum == -1)
                return NULL;
-       return (gpointer)icall_functions [(nameslot - icall_names)];
+       return (gpointer)icall_functions [slotnum];
+}
+
+static gboolean
+find_uses_handles_icall (const IcallTypeDesc *imap, const char *name)
+{
+       gsize slotnum = find_slot_icall (imap, name);
+       if (slotnum == -1)
+               return FALSE;
+       return (gboolean)icall_uses_handles [slotnum];
 }
 
 static int
@@ -8736,8 +8618,19 @@ no_icall_table (void)
 }
 #endif
 
+/**
+ * mono_lookup_internal_call_full:
+ * @method: the method to look up
+ * @uses_handles: out argument if method needs handles around managed objects.
+ *
+ * Returns a pointer to the icall code for the given method.  If
+ * uses_handles is not NULL, it will be set to TRUE if the method
+ * needs managed objects wrapped using the infrastructure in handle.h
+ *
+ * If the method is not found, warns and returns NULL.
+ */
 gpointer
-mono_lookup_internal_call (MonoMethod *method)
+mono_lookup_internal_call_full (MonoMethod *method, mono_bool *uses_handles)
 {
        char *sigstart;
        char *tmpsig;
@@ -8798,6 +8691,8 @@ mono_lookup_internal_call (MonoMethod *method)
 
        res = g_hash_table_lookup (icall_hash, mname);
        if (res) {
+               if (uses_handles)
+                       *uses_handles = FALSE;
                mono_icall_unlock ();;
                return res;
        }
@@ -8805,6 +8700,8 @@ mono_lookup_internal_call (MonoMethod *method)
        *sigstart = 0;
        res = g_hash_table_lookup (icall_hash, mname);
        if (res) {
+               if (uses_handles)
+                       *uses_handles = FALSE;
                mono_icall_unlock ();
                return res;
        }
@@ -8825,6 +8722,8 @@ mono_lookup_internal_call (MonoMethod *method)
        }
        res = find_method_icall (imap, sigstart - mlen);
        if (res) {
+               if (uses_handles)
+                       *uses_handles = find_uses_handles_icall (imap, sigstart - mlen);
                mono_icall_unlock ();
                return res;
        }
@@ -8832,6 +8731,8 @@ mono_lookup_internal_call (MonoMethod *method)
        *sigstart = '(';
        res = find_method_icall (imap, sigstart - mlen);
        if (res) {
+               if (uses_handles)
+                       *uses_handles = find_uses_handles_icall (imap, sigstart - mlen);
                mono_icall_unlock ();
                return res;
        }
@@ -8850,6 +8751,12 @@ mono_lookup_internal_call (MonoMethod *method)
 #endif
 }
 
+gpointer
+mono_lookup_internal_call (MonoMethod *method)
+{
+       return mono_lookup_internal_call_full (method, NULL);
+}
+
 #ifdef ENABLE_ICALL_SYMBOL_MAP
 static int
 func_cmp (gconstpointer key, gconstpointer p)
index 161bd0031a37893599330767c38280d1b288328b..50eaded2e37279442560273998901d1e3cbb82ea 100644 (file)
@@ -1993,13 +1993,13 @@ mono_image_walk_resource_tree (MonoCLIImageInfo *info, guint32 res_id,
                }
 #endif
        } else if (level==2) {
-               if (is_string == TRUE || (is_string == FALSE && lang_id != 0 && name_offset != lang_id))
+               if (is_string || (lang_id != 0 && name_offset != lang_id))
                        return NULL;
        } else {
                g_assert_not_reached ();
        }
 
-       if(is_dir==TRUE) {
+       if (is_dir) {
                MonoPEResourceDir *res_dir=(MonoPEResourceDir *)(((char *)root)+dir_offset);
                MonoPEResourceDirEntry *sub_entries=(MonoPEResourceDirEntry *)(res_dir+1);
                guint32 entries, i;
index 2922234965a5035b83acf0ce6b3f0f7b51d22f18..4f36ba3c82c11fd5f55a5e8e10866928fdf0a9a5 100644 (file)
@@ -994,6 +994,7 @@ mono_dllmap_lookup_list (MonoDllMap *dll_map, const char *dll, const char* func,
                         */
                }
                if (dll_map->func && strcmp (dll_map->func, func) == 0) {
+                       *rdll = dll_map->target;
                        *rfunc = dll_map->target_func;
                        break;
                }
@@ -1021,7 +1022,7 @@ mono_dllmap_lookup (MonoImage *assembly, const char *dll, const char* func, cons
  * @dll: The name of the external library, as it would be found in the DllImport declaration.  If prefixed with 'i:' the matching of the library name is done without case sensitivity
  * @func: if not null, the mapping will only applied to the named function (the value of EntryPoint)
  * @tdll: The name of the library to map the specified @dll if it matches.
- * @tfunc: if func is not NULL, the name of the function that replaces the invocation
+ * @tfunc: The name of the function that replaces the invocation.  If NULL, it is replaced with a copy of @func.
  *
  * LOCKING: Acquires the loader lock.
  *
@@ -1056,7 +1057,7 @@ mono_dllmap_insert (MonoImage *assembly, const char *dll, const char *func, cons
                entry->dll = dll? g_strdup (dll): NULL;
                entry->target = tdll? g_strdup (tdll): NULL;
                entry->func = func? g_strdup (func): NULL;
-               entry->target_func = tfunc? g_strdup (tfunc): NULL;
+               entry->target_func = tfunc? g_strdup (tfunc): (func? g_strdup (func): NULL);
 
                global_loader_data_lock ();
                entry->next = global_dll_map;
@@ -1067,7 +1068,7 @@ mono_dllmap_insert (MonoImage *assembly, const char *dll, const char *func, cons
                entry->dll = dll? mono_image_strdup (assembly, dll): NULL;
                entry->target = tdll? mono_image_strdup (assembly, tdll): NULL;
                entry->func = func? mono_image_strdup (assembly, func): NULL;
-               entry->target_func = tfunc? mono_image_strdup (assembly, tfunc): NULL;
+               entry->target_func = tfunc? mono_image_strdup (assembly, tfunc): (func? mono_image_strdup (assembly, func): NULL);
 
                mono_image_lock (assembly);
                entry->next = assembly->dll_map;
index 774c9b8a47fbe13024a3db9799635992107af351..a2c6d349ddf15fcc186278750843b8289e4a6c96 100644 (file)
@@ -60,6 +60,10 @@ mono_add_internal_call     (const char *name, const void* method);
 MONO_API void*
 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 6dbf07f79414184cba5de202f48ecdc4484bd312..0132f53fbed8ae08a5777249e87796ad5ee92050 100644 (file)
@@ -40,6 +40,7 @@
 #include "mono/metadata/remoting.h"
 #include "mono/metadata/reflection-internals.h"
 #include "mono/metadata/threadpool-ms.h"
+#include "mono/metadata/handle.h"
 #include "mono/utils/mono-counters.h"
 #include "mono/utils/mono-tls.h"
 #include "mono/utils/mono-memory-model.h"
@@ -203,6 +204,12 @@ mono_free_lparray (MonoArray *array, gpointer* nativeArray);
 static void
 mono_marshal_ftnptr_eh_callback (guint32 gchandle);
 
+static MonoThreadInfo*
+mono_icall_start (HandleStackMark *stackmark, MonoError *error);
+
+static void
+mono_icall_end (MonoThreadInfo *info, HandleStackMark *stackmark, MonoError *error);
+
 /* Lazy class loading functions */
 static GENERATE_GET_CLASS_WITH_CACHE (string_builder, System.Text, StringBuilder)
 static GENERATE_GET_CLASS_WITH_CACHE (date_time, System, DateTime)
@@ -338,6 +345,9 @@ mono_marshal_init (void)
                register_icall (mono_threads_exit_gc_safe_region_unbalanced, "mono_threads_exit_gc_safe_region_unbalanced", "void ptr ptr", TRUE);
                register_icall (mono_threads_attach_coop, "mono_threads_attach_coop", "ptr ptr ptr", TRUE);
                register_icall (mono_threads_detach_coop, "mono_threads_detach_coop", "void ptr ptr", TRUE);
+               register_icall (mono_icall_start, "mono_icall_start", "ptr ptr ptr", TRUE);
+               register_icall (mono_icall_end, "mono_icall_end", "void ptr ptr ptr", TRUE);
+               register_icall (mono_handle_new, "mono_handle_new", "ptr ptr", TRUE);
 
                mono_cominterop_init ();
                mono_remoting_init ();
@@ -422,7 +432,8 @@ mono_delegate_to_ftnptr (MonoDelegate *delegate)
        return delegate->delegate_trampoline;
 
 fail:
-       mono_gchandle_free (target_handle);
+       if (target_handle != 0)
+               mono_gchandle_free (target_handle);
        mono_error_set_pending_exception (&error);
        return NULL;
 }
@@ -3404,7 +3415,6 @@ mono_marshal_get_delegate_invoke_internal (MonoMethod *method, gboolean callvirt
        mono_mb_emit_byte (mb, CEE_LDIND_REF);
        mono_mb_emit_stloc (mb, local_delegates);
 
-
        /* if (delegates == null) */
        mono_mb_emit_ldloc (mb, local_delegates);
        pos2 = mono_mb_emit_branch (mb, CEE_BRTRUE);
@@ -3538,6 +3548,7 @@ mono_marshal_get_delegate_invoke_internal (MonoMethod *method, gboolean callvirt
 #endif /* DISABLE_JIT */
 
        info = mono_wrapper_info_create (mb, subtype);
+       info->d.delegate_invoke.method = method;
 
        if (ctx) {
                MonoMethod *def;
@@ -4220,7 +4231,6 @@ mono_marshal_get_runtime_invoke (MonoMethod *method, gboolean virtual_)
  * ARGS should contain the this argument too.
  * This wrapper serves the same purpose as the runtime-invoke wrappers, but there
  * is only one copy of it, which is useful in full-aot.
- * The wrapper info for the wrapper is a WrapperInfo structure.
  */
 MonoMethod*
 mono_marshal_get_runtime_invoke_dynamic (void)
@@ -4447,7 +4457,6 @@ mono_mb_emit_auto_layout_exception (MonoMethodBuilder *mb, MonoClass *klass)
 /*
  * generates IL code for the icall wrapper (the generated method
  * calls the unmanaged code in func)
- * The wrapper info for the wrapper is a WrapperInfo structure.
  */
 MonoMethod *
 mono_marshal_get_icall_wrapper (MonoMethodSignature *sig, const char *name, gconstpointer func, gboolean check_exceptions)
@@ -7457,19 +7466,25 @@ mono_marshal_emit_native_wrapper (MonoImage *image, MonoMethodBuilder *mb, MonoM
        /* Set LastError if needed */
        if (piinfo->piflags & PINVOKE_ATTRIBUTE_SUPPORTS_LAST_ERROR) {
 #ifdef TARGET_WIN32
-               static MonoMethodSignature *get_last_error_sig = NULL;
-               if (!get_last_error_sig) {
-                       get_last_error_sig = mono_metadata_signature_alloc (mono_defaults.corlib, 0);
-                       get_last_error_sig->ret = &mono_defaults.int_class->byval_arg;
-                       get_last_error_sig->pinvoke = 1;
-               }
+               if (!aot) {
+                       static MonoMethodSignature *get_last_error_sig = NULL;
+                       if (!get_last_error_sig) {
+                               get_last_error_sig = mono_metadata_signature_alloc (mono_defaults.corlib, 0);
+                               get_last_error_sig->ret = &mono_defaults.int_class->byval_arg;
+                               get_last_error_sig->pinvoke = 1;
+                       }
 
-               /*
-                * Have to call GetLastError () early and without a wrapper, since various runtime components could
-                * clobber its value.
-                */
-               mono_mb_emit_native_call (mb, get_last_error_sig, GetLastError);
-               mono_mb_emit_icall (mb, mono_marshal_set_last_error_windows);
+                       /*
+                        * Have to call GetLastError () early and without a wrapper, since various runtime components could
+                        * clobber its value.
+                        */
+                       mono_mb_emit_native_call (mb, get_last_error_sig, GetLastError);
+                       mono_mb_emit_icall (mb, mono_marshal_set_last_error_windows);
+               } else {
+                       mono_mb_emit_byte (mb, MONO_CUSTOM_PREFIX);
+                       mono_mb_emit_byte (mb, CEE_MONO_GET_LAST_ERROR);
+                       mono_mb_emit_icall (mb, mono_marshal_set_last_error_windows);
+               }
 #else
                mono_mb_emit_icall (mb, mono_marshal_set_last_error);
 #endif
@@ -7594,7 +7609,6 @@ mono_marshal_emit_native_wrapper (MonoImage *image, MonoMethodBuilder *mb, MonoM
  *
  * generates IL code for the pinvoke wrapper (the generated method
  * calls the unmanaged code in piinfo->addr)
- * The wrapper info for the wrapper is a WrapperInfo structure.
  */
 MonoMethod *
 mono_marshal_get_native_wrapper (MonoMethod *method, gboolean check_exceptions, gboolean aot)
@@ -7741,11 +7755,54 @@ mono_marshal_get_native_wrapper (MonoMethod *method, gboolean check_exceptions,
                else
                        csig = mono_metadata_signature_dup_full (method->klass->image, sig);
 
+               //printf ("%s\n", mono_method_full_name (method, 1));
+
                /* hack - string constructors returns a value */
                if (method->string_ctor)
                        csig->ret = &mono_defaults.string_class->byval_arg;
 
 #ifndef DISABLE_JIT
+               // FIXME:
+               MonoClass *handle_stack_mark_class;
+               MonoClass *error_class;
+               int thread_info_var = -1, stack_mark_var = -1, error_var = -1;
+               MonoMethodSignature *call_sig = csig;
+               gboolean uses_handles;
+               (void) mono_lookup_internal_call_full (method, &uses_handles);
+
+
+               /* If it uses handles and MonoError, it had better check exceptions */
+               g_assert (!uses_handles || check_exceptions);
+
+               if (uses_handles) {
+                       MonoMethodSignature *ret;
+
+                       /* Add a MonoError argument */
+                       // FIXME: The stuff from mono_metadata_signature_dup_internal_with_padding ()
+                       ret = mono_metadata_signature_alloc (method->klass->image, csig->param_count + 1);
+
+                       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];
+                       }
+                       ret->params [csig->param_count] = &mono_get_intptr_class ()->byval_arg;
+                       call_sig = ret;
+               }
+
+               if (uses_handles) {
+                       handle_stack_mark_class = mono_class_load_from_name (mono_get_corlib (), "Mono", "RuntimeStructs/HandleStackMark");
+                       error_class = mono_class_load_from_name (mono_get_corlib (), "Mono", "RuntimeStructs/MonoError");
+
+                       thread_info_var = mono_mb_add_local (mb, &mono_get_intptr_class ()->byval_arg);
+                       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 (sig->hasthis) {
                        int pos;
 
@@ -7757,21 +7814,58 @@ mono_marshal_get_native_wrapper (MonoMethod *method, gboolean check_exceptions,
                        pos = mono_mb_emit_branch (mb, CEE_BRTRUE);
                        mono_mb_emit_exception (mb, "NullReferenceException", NULL);
                        mono_mb_patch_branch (mb, pos);
-
-                       mono_mb_emit_byte (mb, CEE_LDARG_0);
                }
 
-               for (i = 0; i < sig->param_count; i++)
-                       mono_mb_emit_ldarg (mb, i + sig->hasthis);
+               if (uses_handles) {
+                       mono_mb_emit_ldloc_addr (mb, stack_mark_var);
+                       mono_mb_emit_ldloc_addr (mb, error_var);
+                       mono_mb_emit_icall (mb, mono_icall_start);
+                       mono_mb_emit_stloc (mb, thread_info_var);
+
+                       if (sig->hasthis) {
+                               mono_mb_emit_byte (mb, CEE_LDARG_0);
+                               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);
+                               }
+                       }
+                       mono_mb_emit_ldloc_addr (mb, error_var);
+               } else {
+                       if (sig->hasthis)
+                               mono_mb_emit_byte (mb, CEE_LDARG_0);
+                       for (i = 0; i < sig->param_count; i++)
+                               mono_mb_emit_ldarg (mb, i + sig->hasthis);
+               }
 
                if (aot) {
                        mono_mb_emit_byte (mb, MONO_CUSTOM_PREFIX);
                        mono_mb_emit_op (mb, CEE_MONO_ICALL_ADDR, &piinfo->method);
-                       mono_mb_emit_calli (mb, csig);
+                       mono_mb_emit_calli (mb, call_sig);
                } else {
                        g_assert (piinfo->addr);
-                       mono_mb_emit_native_call (mb, csig, piinfo->addr);
+                       mono_mb_emit_native_call (mb, call_sig, piinfo->addr);
+               }
+
+               if (uses_handles) {
+                       if (MONO_TYPE_IS_REFERENCE (sig->ret)) {
+                               // if (ret != NULL_HANDLE) {
+                               //   ret = MONO_HANDLE_RAW(ret)
+                               // }
+                               mono_mb_emit_byte (mb, CEE_DUP);
+                               int pos = mono_mb_emit_branch (mb, CEE_BRFALSE);
+                               mono_mb_emit_ldflda (mb, MONO_HANDLE_PAYLOAD_OFFSET (MonoObject));
+                               mono_mb_emit_byte (mb, CEE_LDIND_REF);
+                               mono_mb_patch_branch (mb, pos);
+                       }
+                       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);
+                       mono_mb_emit_icall (mb, mono_icall_end);
                }
+
                if (check_exceptions)
                        emit_thread_interrupt_checkpoint (mb);
                mono_mb_emit_byte (mb, CEE_RET);
@@ -8653,7 +8747,6 @@ generate_check_cache (int obj_arg_position, int class_arg_position, int cache_ar
 
 /*
  * This does the equivalent of mono_object_castclass_with_cache.
- * The wrapper info for the wrapper is a WrapperInfo structure.
  */
 MonoMethod *
 mono_marshal_get_castclass_with_cache (void)
@@ -8739,7 +8832,6 @@ mono_marshal_isinst_with_cache (MonoObject *obj, MonoClass *klass, uintptr_t *ca
 
 /*
  * This does the equivalent of mono_object_isinst_with_cache.
- * The wrapper info for the wrapper is a WrapperInfo structure.
  */
 MonoMethod *
 mono_marshal_get_isinst_with_cache (void)
@@ -8916,7 +9008,6 @@ mono_marshal_get_isinst (MonoClass *klass)
  * an instance of the given type, icluding the case where the object is a proxy.
  * The generated function has the following signature:
  * MonoObject* __castclass_wrapper_ (MonoObject *obj)
- * The wrapper info for the wrapper is a WrapperInfo structure.
  */
 MonoMethod *
 mono_marshal_get_castclass (MonoClass *klass)
@@ -8999,7 +9090,6 @@ mono_marshal_get_castclass (MonoClass *klass)
  * @klass:
  *
  * generates IL code for StructureToPtr (object structure, IntPtr ptr, bool fDeleteOld)
- * The wrapper info for the wrapper is a WrapperInfo structure.
  */
 MonoMethod *
 mono_marshal_get_struct_to_ptr (MonoClass *klass)
@@ -9073,7 +9163,6 @@ mono_marshal_get_struct_to_ptr (MonoClass *klass)
  * @klass:
  *
  * generates IL code for PtrToStructure (IntPtr src, object structure)
- * The wrapper info for the wrapper is a WrapperInfo structure.
  */
 MonoMethod *
 mono_marshal_get_ptr_to_struct (MonoClass *klass)
@@ -9152,7 +9241,6 @@ mono_marshal_get_ptr_to_struct (MonoClass *klass)
  * This is used to avoid infinite recursion since it is hard to determine where to
  * replace a method with its synchronized wrapper, and where not.
  * The runtime should execute METHOD instead of the wrapper.
- * The wrapper info for the wrapper is a WrapperInfo structure.
  */
 MonoMethod *
 mono_marshal_get_synchronized_inner_wrapper (MonoMethod *method)
@@ -9520,8 +9608,6 @@ record_slot_vstore (MonoObject *array, size_t index, MonoObject *value)
 #endif
 
 /*
- * The wrapper info for the wrapper is a WrapperInfo structure.
- *
  * TODO:
  *     - Separate simple interfaces from variant interfaces or mbr types. This way we can avoid the icall for them.
  *     - Emit a (new) mono bytecode that produces OP_COND_EXC_NE_UN to raise ArrayTypeMismatch
@@ -9537,7 +9623,7 @@ get_virtual_stelemref_wrapper (int kind)
        MonoMethod *res;
        char *name;
        const char *param_names [16];
-       guint32 b1, b2, b3;
+       guint32 b1, b2, b3, b4;
        int aklass, vklass, vtable, uiid;
        int array_slot_addr;
        WrapperInfo *info;
@@ -9750,7 +9836,7 @@ get_virtual_stelemref_wrapper (int kind)
                mono_mb_emit_ldflda (mb, MONO_STRUCT_OFFSET (MonoClass, idepth));
                mono_mb_emit_byte (mb, CEE_LDIND_U2);
 
-               b2 = mono_mb_emit_branch (mb, CEE_BLT_UN);
+               b3 = mono_mb_emit_branch (mb, CEE_BLT_UN);
 
                /* if (vklass->supertypes [aklass->idepth - 1] != aklass) goto failure */
                mono_mb_emit_ldloc (mb, vklass);
@@ -9768,7 +9854,7 @@ get_virtual_stelemref_wrapper (int kind)
                mono_mb_emit_byte (mb, CEE_LDIND_I);
 
                mono_mb_emit_ldloc (mb, aklass);
-               b3 = mono_mb_emit_branch (mb, CEE_BNE_UN);
+               b4 = mono_mb_emit_branch (mb, CEE_BNE_UN);
 
                /* do_store: */
                mono_mb_patch_branch (mb, b1);
@@ -9780,6 +9866,7 @@ get_virtual_stelemref_wrapper (int kind)
                /* do_exception: */
                mono_mb_patch_branch (mb, b2);
                mono_mb_patch_branch (mb, b3);
+               mono_mb_patch_branch (mb, b4);
 
                mono_mb_emit_exception (mb, "ArrayTypeMismatchException", NULL);
                break;
@@ -9930,9 +10017,6 @@ mono_marshal_get_virtual_stelemref_wrappers (int *nwrappers)
        return res;
 }
 
-/*
- * The wrapper info for the wrapper is a WrapperInfo structure.
- */
 MonoMethod*
 mono_marshal_get_stelemref (void)
 {
@@ -10083,8 +10167,6 @@ mono_marshal_get_stelemref (void)
  * mono_marshal_get_gsharedvt_in_wrapper:
  *
  *   This wrapper handles calls from normal code to gsharedvt code.
- *
- * The wrapper info for the wrapper is a WrapperInfo structure.
  */
 MonoMethod*
 mono_marshal_get_gsharedvt_in_wrapper (void)
@@ -10119,8 +10201,6 @@ mono_marshal_get_gsharedvt_in_wrapper (void)
  * mono_marshal_get_gsharedvt_out_wrapper:
  *
  *   This wrapper handles calls from gsharedvt code to normal code.
- *
- * The wrapper info for the wrapper is a WrapperInfo structure.
  */
 MonoMethod*
 mono_marshal_get_gsharedvt_out_wrapper (void)
@@ -11907,8 +11987,6 @@ ftnptr_eh_callback_default (guint32 gchandle)
        MonoException *exc;
        gpointer stackdata;
 
-       g_assert (gchandle >= 0);
-
        mono_threads_enter_gc_unsafe_region_unbalanced (&stackdata);
 
        exc = (MonoException*) mono_gchandle_get_target (gchandle);
@@ -11932,3 +12010,20 @@ mono_install_ftnptr_eh_callback (MonoFtnPtrEHCallback callback)
 {
        ftnptr_eh_callback = callback;
 }
+
+static MonoThreadInfo*
+mono_icall_start (HandleStackMark *stackmark, MonoError *error)
+{
+       MonoThreadInfo *info = mono_thread_info_current ();
+
+       mono_stack_mark_init (info, stackmark);
+       mono_error_init (error);
+       return info;
+}
+
+static void
+mono_icall_end (MonoThreadInfo *info, HandleStackMark *stackmark, MonoError *error)
+{
+       mono_stack_mark_pop (info, stackmark);
+       mono_error_set_pending_exception (error);
+}
index 58caa69d814f5d57e74a6fb176aba6cff0248004..166db1478ce52312ca113fd954646df022247a7e 100644 (file)
@@ -191,6 +191,10 @@ typedef struct {
        MonoMethodSignature *sig;
 } GsharedvtWrapperInfo;
 
+typedef struct {
+       MonoMethod *method;
+} DelegateInvokeWrapperInfo;
+
 /*
  * This structure contains additional information to uniquely identify a given wrapper
  * method. It can be retrieved by mono_marshal_get_wrapper_info () for certain types
@@ -231,6 +235,8 @@ typedef struct {
                RemotingWrapperInfo remoting;
                /* GSHAREDVT_IN_SIG/GSHAREDVT_OUT_SIG */
                GsharedvtWrapperInfo gsharedvt;
+               /* DELEGATE_INVOKE */
+               DelegateInvokeWrapperInfo delegate_invoke;
        } d;
 } WrapperInfo;
 
index 60d36ae2ad1765d76cbf450dbb8feb9b616bf479..6bf3410d818ec7115921f01c4e9c45dd27109e80 100644 (file)
@@ -172,7 +172,7 @@ mono_mempool_stats (MonoMemPool *pool)
 {
        MonoMemPool *p;
        int count = 0;
-       guint32 still_free = pool->end - pool->pos;
+       guint32 still_free;
 
        p = pool;
        while (p) {
@@ -180,6 +180,7 @@ mono_mempool_stats (MonoMemPool *pool)
                count++;
        }
        if (pool) {
+               still_free = pool->end - pool->pos;
                g_print ("Mempool %p stats:\n", pool);
                g_print ("Total mem allocated: %d\n", pool->d.allocated);
                g_print ("Num chunks: %d\n", count);
index 96f6a5da7c90f3c924b02fe338f3a3eb4f728f95..a1b9eb841781775dcf0fdc3cc5d768ddcfde08e8 100644 (file)
@@ -271,6 +271,8 @@ struct _MonoImage {
 
        gpointer aot_module;
 
+       guint8 aotid[16];
+
        /*
         * The Assembly this image was loaded from.
         */
index 287c68fbfb79d3413a3767ca63c0a9a0e3e66b35..c3beaa4553795cf7d9285b3b0f68c5d3c88abf7e 100644 (file)
@@ -730,7 +730,7 @@ verify_cli_header (VerifyContext *ctx)
        if (!read32 (ptr + 8) || !read32 (ptr + 12))
                ADD_ERROR (ctx, g_strdup_printf ("Missing medatata section in the CLI header"));
 
-       if ((read32 (ptr + 16) & ~0x0001000B) != 0)
+       if ((read32 (ptr + 16) & ~0x0003000B) != 0)
                ADD_ERROR (ctx, g_strdup_printf ("Invalid CLI header flags"));
 
        ptr += 24;
@@ -4228,8 +4228,6 @@ mono_verifier_is_sig_compatible (MonoImage *image, MonoMethod *method, MonoMetho
                        return FALSE;
                if (original_sig->explicit_this != signature->explicit_this)
                        return FALSE;
-               if (original_sig->call_convention != signature->call_convention)
-                       return FALSE;
                if (original_sig->pinvoke != signature->pinvoke)
                        return FALSE;
                if (original_sig->sentinelpos != signature->sentinelpos)
index ab0911bc677f89e1459c8f7476aff317c5e4eccf..2df6db21ec67febd81d791c9663007b2d3660c01 100644 (file)
@@ -6069,6 +6069,21 @@ mono_guid_to_string (const guint8 *guid)
                                guid[10], guid[11], guid[12], guid[13], guid[14], guid[15]);
 }
 
+/**
+ * mono_guid_to_string_minimal:
+ *
+ * Converts a 16 byte Microsoft GUID to lower case no '-' representation..
+ */
+char *
+mono_guid_to_string_minimal (const guint8 *guid)
+{
+       return g_strdup_printf ("%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
+                               guid[3], guid[2], guid[1], guid[0],
+                               guid[5], guid[4],
+                               guid[7], guid[6],
+                               guid[8], guid[9],
+                               guid[10], guid[11], guid[12], guid[13], guid[14], guid[15]);
+}
 static gboolean
 get_constraints (MonoImage *image, int owner, MonoClass ***constraints, MonoGenericContainer *container, MonoError *error)
 {
index 542f9e108e4c9d4eea8ff0a5fa5ccb556a48a2ca..6a5172d8810d4b3c4e6d0400952e663f01381184 100644 (file)
@@ -301,7 +301,10 @@ typedef struct {
 
 struct _MonoArrayType {
        MonoClass *eklass;
+       // Number of dimensions of the array
        uint8_t rank;
+
+       // Arrays recording known upper and lower index bounds for each dimension
        uint8_t numsizes;
        uint8_t numlobounds;
        int *sizes;
@@ -480,6 +483,8 @@ MONO_API uint32_t mono_metadata_token_from_dor (uint32_t dor_index);
 
 MONO_API char *mono_guid_to_string (const uint8_t *guid);
 
+MONO_API char *mono_guid_to_string_minimal (const uint8_t *guid);
+
 MONO_API uint32_t mono_metadata_declsec_from_index (MonoImage *meta, uint32_t idx);
 
 MONO_API uint32_t mono_metadata_translate_token_index (MonoImage *image, int table, uint32_t idx);
index 3dfd3c4e08f720871d564e55926e9009fa568e7a..fe09d0c24b881a1c10ee7046c94cb5c5aba395e8 100644 (file)
@@ -357,7 +357,8 @@ mon_finalize (MonoThreadsSync *mon)
        LOCK_DEBUG (g_message ("%s: Finalizing sync %p", __func__, mon));
 
        if (mon->entry_sem != NULL) {
-               CloseHandle (mon->entry_sem);
+               mono_coop_sem_destroy (mon->entry_sem);
+               g_free (mon->entry_sem);
                mon->entry_sem = NULL;
        }
        /* If this isn't empty then something is seriously broken - it
@@ -679,7 +680,7 @@ mono_monitor_exit_inflated (MonoObject *obj)
                        tmp_status = InterlockedCompareExchange ((gint32*)&mon->status, new_status, old_status);
                        if (tmp_status == old_status) {
                                if (have_waiters)
-                                       ReleaseSemaphore (mon->entry_sem, 1, NULL);
+                                       mono_coop_sem_post (mon->entry_sem);
                                break;
                        }
                        old_status = tmp_status;
@@ -745,8 +746,8 @@ mono_monitor_try_enter_inflated (MonoObject *obj, guint32 ms, gboolean allow_int
        HANDLE sem;
        gint64 then = 0, now, delta;
        guint32 waitms;
-       guint32 ret;
        guint32 new_status, old_status, tmp_status;
+       MonoSemTimedwaitRet wait_ret;
        MonoInternalThread *thread;
        gboolean interrupted = FALSE;
 
@@ -838,11 +839,12 @@ retry_contended:
         */
        if (mon->entry_sem == NULL) {
                /* Create the semaphore */
-               sem = CreateSemaphore (NULL, 0, 0x7fffffff, NULL);
-               g_assert (sem != NULL);
+               sem = g_new0 (MonoCoopSem, 1);
+               mono_coop_sem_init (sem, 0);
                if (InterlockedCompareExchangePointer ((gpointer*)&mon->entry_sem, sem, NULL) != NULL) {
                        /* Someone else just put a handle here */
-                       CloseHandle (sem);
+                       mono_coop_sem_destroy (sem);
+                       g_free (sem);
                }
        }
 
@@ -878,12 +880,10 @@ retry_contended:
        mono_thread_set_state (thread, ThreadState_WaitSleepJoin);
 
        /*
-        * We pass TRUE instead of allow_interruption since we have to check for the
+        * We pass ALERTABLE instead of allow_interruption since we have to check for the
         * StopRequested case below.
         */
-       MONO_ENTER_GC_SAFE;
-       ret = WaitForSingleObjectEx (mon->entry_sem, waitms, TRUE);
-       MONO_EXIT_GC_SAFE;
+       wait_ret = mono_coop_sem_timedwait (mon->entry_sem, waitms, MONO_SEM_FLAGS_ALERTABLE);
 
        mono_thread_clr_state (thread, ThreadState_WaitSleepJoin);
        
@@ -891,7 +891,7 @@ retry_contended:
        mono_perfcounters->thread_queue_len--;
 #endif
 
-       if (ret == WAIT_IO_COMPLETION && !allow_interruption) {
+       if (wait_ret == MONO_SEM_TIMEDWAIT_RET_ALERTED && !allow_interruption) {
                interrupted = TRUE;
                /* 
                 * We have to obey a stop/suspend request even if 
@@ -914,11 +914,11 @@ retry_contended:
                        /* retry from the top */
                        goto retry_contended;
                }
-       } else if (ret == WAIT_OBJECT_0) {
+       } else if (wait_ret == MONO_SEM_TIMEDWAIT_RET_SUCCESS) {
                interrupted = FALSE;
                /* retry from the top */
                goto retry_contended;
-       } else if (ret == WAIT_TIMEOUT) {
+       } else if (wait_ret == MONO_SEM_TIMEDWAIT_RET_TIMEDOUT) {
                /* we're done */
        }
 
@@ -927,10 +927,10 @@ retry_contended:
 
        mono_profiler_monitor_event (obj, MONO_PROFILER_MONITOR_FAIL);
 
-       if (ret == WAIT_IO_COMPLETION) {
+       if (wait_ret == MONO_SEM_TIMEDWAIT_RET_ALERTED) {
                LOCK_DEBUG (g_message ("%s: (%d) interrupted waiting, returning -1", __func__, id));
                return -1;
-       } else if (ret == WAIT_TIMEOUT) {
+       } else if (wait_ret == MONO_SEM_TIMEDWAIT_RET_ALERTED) {
                LOCK_DEBUG (g_message ("%s: (%d) timed out waiting, returning FALSE", __func__, id));
                return 0;
        } else {
index f43e08caece432d1aba4a7bedd81d8e063138ff1..39afe1b69abeb67585e596f58b0759f0e7294f07 100644 (file)
@@ -13,7 +13,8 @@
 #include <glib.h>
 #include <mono/metadata/object.h>
 #include <mono/io-layer/io-layer.h>
-#include "mono/utils/mono-compiler.h"
+#include <mono/utils/mono-compiler.h>
+#include <mono/utils/mono-coop-semaphore.h>
 
 G_BEGIN_DECLS
 
@@ -39,9 +40,9 @@ struct _MonoThreadsSync
 #ifdef HAVE_MOVING_COLLECTOR
        gint32 hash_code;
 #endif
-       HANDLE entry_sem;
        GSList *wait_list;
        void *data;
+       MonoCoopSem *entry_sem;
 };
 
 /*
index 80261f2b62e9a3d74741b48af5aff8fb135903b9..42f36d36854a771c3b1a7c1915cbfe1cf81038dd 100644 (file)
@@ -702,7 +702,7 @@ publisher_policy_start (gpointer user_data,
                memset (&info->old_version_bottom, 0, sizeof (info->old_version_bottom));
                memset (&info->old_version_top, 0, sizeof (info->old_version_top));
                memset (&info->new_version, 0, sizeof (info->new_version));
-       } if (!strcmp (element_name, "assemblyIdentity")) {
+       } else if (!strcmp (element_name, "assemblyIdentity")) {
                for (n = 0; attribute_names [n]; n++) {
                        const gchar *attribute_name = attribute_names [n];
                        
index b88b20e03819cb0383c8b5af48622205cd8f7524..b139ce9f3e6ef944249972c2acff47bc8d3bf4c7 100644 (file)
@@ -459,23 +459,25 @@ mono_debug_add_method (MonoMethod *method, MonoDebugMethodJitInfo *jit, MonoDoma
                write_sleb128 (lne->il_offset, ptr, &ptr);
                write_sleb128 (lne->native_offset, ptr, &ptr);
        }
-
-       *ptr++ = jit->this_var ? 1 : 0;
-       if (jit->this_var)
-               write_variable (jit->this_var, ptr, &ptr);
-
-       write_leb128 (jit->num_params, ptr, &ptr);
-       for (i = 0; i < jit->num_params; i++)
-               write_variable (&jit->params [i], ptr, &ptr);
-
-       write_leb128 (jit->num_locals, ptr, &ptr);
-       for (i = 0; i < jit->num_locals; i++)
-               write_variable (&jit->locals [i], ptr, &ptr);
-
-       *ptr++ = jit->gsharedvt_info_var ? 1 : 0;
-       if (jit->gsharedvt_info_var) {
-               write_variable (jit->gsharedvt_info_var, ptr, &ptr);
-               write_variable (jit->gsharedvt_locals_var, ptr, &ptr);
+       write_leb128 (jit->has_var_info, ptr, &ptr);
+       if (jit->has_var_info) {
+               *ptr++ = jit->this_var ? 1 : 0;
+               if (jit->this_var)
+                       write_variable (jit->this_var, ptr, &ptr);
+
+               write_leb128 (jit->num_params, ptr, &ptr);
+               for (i = 0; i < jit->num_params; i++)
+                       write_variable (&jit->params [i], ptr, &ptr);
+
+               write_leb128 (jit->num_locals, ptr, &ptr);
+               for (i = 0; i < jit->num_locals; i++)
+                       write_variable (&jit->locals [i], ptr, &ptr);
+
+               *ptr++ = jit->gsharedvt_info_var ? 1 : 0;
+               if (jit->gsharedvt_info_var) {
+                       write_variable (jit->gsharedvt_info_var, ptr, &ptr);
+                       write_variable (jit->gsharedvt_locals_var, ptr, &ptr);
+               }
        }
 
        size = ptr - oldptr;
@@ -623,27 +625,29 @@ mono_debug_read_method (MonoDebugMethodAddress *address)
                lne->il_offset = read_sleb128 (ptr, &ptr);
                lne->native_offset = read_sleb128 (ptr, &ptr);
        }
+       jit->has_var_info = read_leb128 (ptr, &ptr);
+       if (jit->has_var_info) {
+               if (*ptr++) {
+                       jit->this_var = g_new0 (MonoDebugVarInfo, 1);
+                       read_variable (jit->this_var, ptr, &ptr);
+               }
 
-       if (*ptr++) {
-               jit->this_var = g_new0 (MonoDebugVarInfo, 1);
-               read_variable (jit->this_var, ptr, &ptr);
-       }
-
-       jit->num_params = read_leb128 (ptr, &ptr);
-       jit->params = g_new0 (MonoDebugVarInfo, jit->num_params);
-       for (i = 0; i < jit->num_params; i++)
-               read_variable (&jit->params [i], ptr, &ptr);
-
-       jit->num_locals = read_leb128 (ptr, &ptr);
-       jit->locals = g_new0 (MonoDebugVarInfo, jit->num_locals);
-       for (i = 0; i < jit->num_locals; i++)
-               read_variable (&jit->locals [i], ptr, &ptr);
-
-       if (*ptr++) {
-               jit->gsharedvt_info_var = g_new0 (MonoDebugVarInfo, 1);
-               jit->gsharedvt_locals_var = g_new0 (MonoDebugVarInfo, 1);
-               read_variable (jit->gsharedvt_info_var, ptr, &ptr);
-               read_variable (jit->gsharedvt_locals_var, ptr, &ptr);
+               jit->num_params = read_leb128 (ptr, &ptr);
+               jit->params = g_new0 (MonoDebugVarInfo, jit->num_params);
+               for (i = 0; i < jit->num_params; i++)
+                       read_variable (&jit->params [i], ptr, &ptr);
+
+               jit->num_locals = read_leb128 (ptr, &ptr);
+               jit->locals = g_new0 (MonoDebugVarInfo, jit->num_locals);
+               for (i = 0; i < jit->num_locals; i++)
+                       read_variable (&jit->locals [i], ptr, &ptr);
+
+               if (*ptr++) {
+                       jit->gsharedvt_info_var = g_new0 (MonoDebugVarInfo, 1);
+                       jit->gsharedvt_locals_var = g_new0 (MonoDebugVarInfo, 1);
+                       read_variable (jit->gsharedvt_info_var, ptr, &ptr);
+                       read_variable (jit->gsharedvt_locals_var, ptr, &ptr);
+               }
        }
 
        return jit;
index 8885e521bad3c652038b49d6492af7fa42f8f9f4..c9350a7023aa2beeb12ea22ff32d4a6501c23c98 100644 (file)
@@ -86,6 +86,7 @@ struct _MonoDebugMethodJitInfo {
        const mono_byte *wrapper_addr;
        uint32_t num_line_numbers;
        MonoDebugLineNumberEntry *line_numbers;
+       uint32_t has_var_info;
        uint32_t num_params;
        MonoDebugVarInfo *this_var;
        MonoDebugVarInfo *params;
index f987e6c34837248b7368e0e19dda783615a0a3bd..c1a531c0dc87eac782c46785a481b82df532abc6 100644 (file)
@@ -364,6 +364,11 @@ mono_gc_clear_domain (MonoDomain *domain)
 {
 }
 
+void
+mono_gc_suspend_finalizers (void)
+{
+}
+
 int
 mono_gc_get_suspend_signal (void)
 {
index 62851d633a9dc976d4c91ff97955169af180977f..9ce52a3515ab6bb6e9e700d24a8f6fa70b31642c 100644 (file)
@@ -1456,18 +1456,12 @@ mono_upgrade_remote_class (MonoDomain *domain, MonoObject *tproxy, MonoClass *kl
 void*
 mono_load_remote_field_checked (MonoObject *this_obj, MonoClass *klass, MonoClassField *field, void **res, MonoError *error);
 
-MonoObject *
-mono_load_remote_field_new_icall (MonoObject *this_obj, MonoClass *klass, MonoClassField *field);
-
 MonoObject *
 mono_load_remote_field_new_checked (MonoObject *this_obj, MonoClass *klass, MonoClassField *field, MonoError *error);
 
 gboolean
 mono_store_remote_field_checked (MonoObject *this_obj, MonoClass *klass, MonoClassField *field, void* val, MonoError *error);
 
-void
-mono_store_remote_field_new_icall (MonoObject *this_obj, MonoClass *klass, MonoClassField *field, MonoObject *arg);
-
 gboolean
 mono_store_remote_field_new_checked (MonoObject *this_obj, MonoClass *klass, MonoClassField *field, MonoObject *arg, MonoError *error);
 
index 737986052251c1385acfca6a20c6a908489ebb62..3f61428872f77097b9890ebc75896f26de35786d 100644 (file)
@@ -7532,9 +7532,17 @@ ves_icall_System_Runtime_Remoting_Messaging_AsyncResult_Invoke (MonoAsyncResult
                gpointer wait_event = NULL;
 
                ac->msg->exc = NULL;
-               res = mono_message_invoke (ares->async_delegate, ac->msg, &ac->msg->exc, &ac->out_args, &error);
-               if (mono_error_set_pending_exception (&error))
-                       return NULL;
+
+               MonoError invoke_error;
+               res = mono_message_invoke (ares->async_delegate, ac->msg, &ac->msg->exc, &ac->out_args, &invoke_error);
+
+               if (!ac->msg->exc) {
+                       MonoException *ex = mono_error_convert_to_exception (&invoke_error);
+                       ac->msg->exc = (MonoObject *)ex;
+               } else {
+                       mono_error_cleanup (&invoke_error);
+               }
+
                MONO_OBJECT_SETREF (ac, res, res);
 
                mono_monitor_enter ((MonoObject*) ares);
@@ -8208,28 +8216,6 @@ mono_load_remote_field_new (MonoObject *this_obj, MonoClass *klass, MonoClassFie
        return result;
 }
 
-/**
- * mono_load_remote_field_new_icall:
- * @this: pointer to an object
- * @klass: klass of the object containing @field
- * @field: the field to load
- *
- * This method is called by the runtime on attempts to load fields of
- * transparent proxy objects. @this points to such TP, @klass is the class of
- * the object containing @field.
- * 
- * Returns: a freshly allocated object containing the value of the
- * field.  On failure returns NULL and throws an exception.
- */
-MonoObject *
-mono_load_remote_field_new_icall (MonoObject *this_obj, MonoClass *klass, MonoClassField *field)
-{
-       MonoError error;
-       MonoObject *result = mono_load_remote_field_new_checked (this_obj, klass, field, &error);
-       mono_error_set_pending_exception (&error);
-       return result;
-}
-
 /**
  * mono_load_remote_field_new_checked:
  * @this: pointer to an object
@@ -8250,69 +8236,25 @@ mono_load_remote_field_new_checked (MonoObject *this_obj, MonoClass *klass, Mono
 
        mono_error_init (error);
 
-       static MonoMethod *getter = NULL;
-       MonoDomain *domain = mono_domain_get ();
-       MonoTransparentProxy *tp = (MonoTransparentProxy *) this_obj;
-       MonoClass *field_class;
-       MonoMethodMessage *msg;
-       MonoArray *out_args;
-       MonoObject *exc, *res;
-       char* full_name;
+       static MonoMethod *tp_load = NULL;
 
        g_assert (mono_object_is_transparent_proxy (this_obj));
 
-       field_class = mono_class_from_mono_type (field->type);
-
-       if (mono_class_is_contextbound (tp->remote_class->proxy_class) && tp->rp->context == (MonoObject *) mono_context_get ()) {
-               gpointer val;
-               if (field_class->valuetype) {
-                       res = mono_object_new_checked (domain, field_class, error);
-                       return_val_if_nok (error, NULL);
-                       val = ((gchar *) res) + sizeof (MonoObject);
-               } else {
-                       val = &res;
-               }
-               mono_field_get_value (tp->rp->unwrapped_server, field, val);
-               return res;
-       }
-
-       if (!getter) {
-               getter = mono_class_get_method_from_name (mono_defaults.object_class, "FieldGetter", -1);
-               if (!getter) {
+       if (!tp_load) {
+               tp_load = mono_class_get_method_from_name (mono_defaults.transparent_proxy_class, "LoadRemoteFieldNew", -1);
+               if (!tp_load) {
                        mono_error_set_not_supported (error, "Linked away.");
                        return NULL;
                }
        }
        
-       msg = (MonoMethodMessage *)mono_object_new_checked (domain, mono_defaults.mono_method_message_class, error);
-       return_val_if_nok (error, NULL);
-       out_args = mono_array_new_checked (domain, mono_defaults.object_class, 1, error);
-       return_val_if_nok (error, NULL);
-
-       MonoReflectionMethod *rm = mono_method_get_object_checked (domain, getter, NULL, error);
-       return_val_if_nok (error, NULL);
-       mono_message_init (domain, msg, rm, out_args, error);
-       return_val_if_nok (error, NULL);
-
-       full_name = mono_type_get_full_name (klass);
-       mono_array_setref (msg->args, 0, mono_string_new (domain, full_name));
-       mono_array_setref (msg->args, 1, mono_string_new (domain, mono_field_get_name (field)));
-       g_free (full_name);
-
-       mono_remoting_invoke ((MonoObject *)(tp->rp), msg, &exc, &out_args, error);
-       return_val_if_nok (error, NULL);
-
-       if (exc) {
-               mono_error_set_exception_instance (error, (MonoException *)exc);
-               return NULL;
-       }
+       /* MonoType *type = mono_class_get_type (klass); */
 
-       if (mono_array_length (out_args) == 0)
-               res = NULL;
-       else
-               res = mono_array_get (out_args, MonoObject *, 0);
+       gpointer args[2];
+       args [0] = &klass;
+       args [1] = &field;
 
-       return res;
+       return mono_runtime_invoke_checked (tp_load, this_obj, args, error);
 }
 
 /**
@@ -8354,65 +8296,24 @@ mono_store_remote_field_checked (MonoObject *this_obj, MonoClass *klass, MonoCla
        
        MONO_REQ_GC_UNSAFE_MODE;
 
-       static MonoMethod *setter = NULL;
+       mono_error_init (error);
 
        MonoDomain *domain = mono_domain_get ();
-       MonoTransparentProxy *tp = (MonoTransparentProxy *) this_obj;
        MonoClass *field_class;
-       MonoMethodMessage *msg;
-       MonoArray *out_args;
-       MonoObject *exc;
        MonoObject *arg;
-       char* full_name;
-
-       mono_error_init (error);
 
        g_assert (mono_object_is_transparent_proxy (this_obj));
 
        field_class = mono_class_from_mono_type (field->type);
 
-       if (mono_class_is_contextbound (tp->remote_class->proxy_class) && tp->rp->context == (MonoObject *) mono_context_get ()) {
-               if (field_class->valuetype) mono_field_set_value (tp->rp->unwrapped_server, field, val);
-               else mono_field_set_value (tp->rp->unwrapped_server, field, *((MonoObject **)val));
-               return TRUE;
-       }
-
-       if (!setter) {
-               setter = mono_class_get_method_from_name (mono_defaults.object_class, "FieldSetter", -1);
-               if (!setter) {
-                       mono_error_set_not_supported (error, "Linked away.");
-                       return FALSE;
-               }
-       }
-
        if (field_class->valuetype) {
                arg = mono_value_box_checked (domain, field_class, val, error);
                return_val_if_nok (error, FALSE);
-       } else 
-               arg = *((MonoObject **)val);
-               
-
-       msg = (MonoMethodMessage *)mono_object_new_checked (domain, mono_defaults.mono_method_message_class, error);
-       return_val_if_nok (error, FALSE);
-       MonoReflectionMethod *rm = mono_method_get_object_checked (domain, setter, NULL, error);
-       return_val_if_nok (error, FALSE);
-       mono_message_init (domain, msg, rm, NULL, error);
-       return_val_if_nok (error, FALSE);
-
-       full_name = mono_type_get_full_name (klass);
-       mono_array_setref (msg->args, 0, mono_string_new (domain, full_name));
-       mono_array_setref (msg->args, 1, mono_string_new (domain, mono_field_get_name (field)));
-       mono_array_setref (msg->args, 2, arg);
-       g_free (full_name);
-
-       mono_remoting_invoke ((MonoObject *)(tp->rp), msg, &exc, &out_args, error);
-       return_val_if_nok (error, FALSE);
-
-       if (exc) {
-               mono_error_set_exception_instance (error, (MonoException *)exc);
-               return FALSE;
+       } else {
+               arg = *((MonoObject**)val);
        }
-       return TRUE;
+
+       return mono_store_remote_field_new_checked (this_obj, klass, field, arg, error);
 }
 
 /**
@@ -8432,23 +8333,6 @@ mono_store_remote_field_new (MonoObject *this_obj, MonoClass *klass, MonoClassFi
        mono_error_cleanup (&error);
 }
 
-/**
- * mono_store_remote_field_new_icall:
- * @this_obj:
- * @klass:
- * @field:
- * @arg:
- *
- * Missing documentation
- */
-void
-mono_store_remote_field_new_icall (MonoObject *this_obj, MonoClass *klass, MonoClassField *field, MonoObject *arg)
-{
-       MonoError error;
-       (void) mono_store_remote_field_new_checked (this_obj, klass, field, arg, &error);
-       mono_error_set_pending_exception (&error);
-}
-
 /**
  * mono_store_remote_field_new_checked:
  * @this_obj:
@@ -8464,56 +8348,27 @@ mono_store_remote_field_new_checked (MonoObject *this_obj, MonoClass *klass, Mon
 {
        MONO_REQ_GC_UNSAFE_MODE;
 
-       static MonoMethod *setter = NULL;
-       MonoDomain *domain = mono_domain_get ();
-       MonoTransparentProxy *tp = (MonoTransparentProxy *) this_obj;
-       MonoClass *field_class;
-       MonoMethodMessage *msg;
-       MonoArray *out_args;
-       MonoObject *exc;
-       char* full_name;
+       static MonoMethod *tp_store = NULL;
 
        mono_error_init (error);
 
        g_assert (mono_object_is_transparent_proxy (this_obj));
 
-       field_class = mono_class_from_mono_type (field->type);
-
-       if (mono_class_is_contextbound (tp->remote_class->proxy_class) && tp->rp->context == (MonoObject *) mono_context_get ()) {
-               if (field_class->valuetype) mono_field_set_value (tp->rp->unwrapped_server, field, ((gchar *) arg) + sizeof (MonoObject));
-               else mono_field_set_value (tp->rp->unwrapped_server, field, arg);
-               return TRUE;
-       }
-
-       if (!setter) {
-               setter = mono_class_get_method_from_name (mono_defaults.object_class, "FieldSetter", -1);
-               if (!setter) {
+       if (!tp_store) {
+               tp_store = mono_class_get_method_from_name (mono_defaults.transparent_proxy_class, "StoreRemoteField", -1);
+               if (!tp_store) {
                        mono_error_set_not_supported (error, "Linked away.");
                        return FALSE;
                }
        }
 
-       msg = (MonoMethodMessage *)mono_object_new_checked (domain, mono_defaults.mono_method_message_class, error);
-       return_val_if_nok (error, FALSE);
-       MonoReflectionMethod *rm = mono_method_get_object_checked (domain, setter, NULL, error);
-       return_val_if_nok (error, FALSE);
-       mono_message_init (domain, msg, rm, NULL, error);
-       return_val_if_nok (error, FALSE);
-
-       full_name = mono_type_get_full_name (klass);
-       mono_array_setref (msg->args, 0, mono_string_new (domain, full_name));
-       mono_array_setref (msg->args, 1, mono_string_new (domain, mono_field_get_name (field)));
-       mono_array_setref (msg->args, 2, arg);
-       g_free (full_name);
-
-       mono_remoting_invoke ((MonoObject *)(tp->rp), msg, &exc, &out_args, error);
-       return_val_if_nok (error, FALSE);
+       gpointer args[3];
+       args [0] = &klass;
+       args [1] = &field;
+       args [2] = arg;
 
-       if (exc) {
-               mono_error_set_exception_instance (error, (MonoException *)exc);
-               return FALSE;
-       }
-       return TRUE;
+       mono_runtime_invoke_checked (tp_store, this_obj, args, error);
+       return is_ok (error);
 }
 #endif
 
index 138bd98553b4a5d2434edbf760af5e32602f5fb5..8178d283823e569dedf444dc828df54cdfbc324d 100644 (file)
@@ -27,6 +27,7 @@
 #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__)  */
index 2dd53c18b14fa153f37d63e368fb6cfebefe366e..034d0de610a57a92208a27c84b8bc631af58b148 100644 (file)
@@ -7156,7 +7156,7 @@ mono_module_file_get_object_checked (MonoDomain *domain, MonoImage *image, int t
        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->is_resource = cols [MONO_FILE_FLAGS] & FILE_CONTAINS_NO_METADATA;
        res->token = mono_metadata_make_token (MONO_TABLE_FILE, table_index + 1);
 
        return res;
@@ -7638,6 +7638,7 @@ mono_event_get_object_checked (MonoDomain *domain, MonoClass *klass, MonoEvent *
        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)
index 9bc72faa28bc344fe09de1b5338e2b56bb34ec1f..30595ee5410e1a43cf886966b5e7175899ccf2ff 100644 (file)
@@ -198,8 +198,6 @@ mono_remoting_marshal_init (void)
                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);
                register_icall (mono_compile_method_icall, "mono_compile_method_icall", "ptr ptr", FALSE);
-               /* mono_load_remote_field_new_icall registered  by mini-runtime.c */
-               /* mono_store_remote_field_new_icall registered  by mini-runtime.c */
 
        }
 
@@ -1327,72 +1325,6 @@ mono_marshal_get_remoting_invoke_with_check (MonoMethod *method)
        return res;
 }
 
-/*
- * mono_marshal_get_ldfld_remote_wrapper:
- * @klass: The return type
- *
- * This method generates a wrapper for calling mono_load_remote_field_new.
- * The return type is ignored for now, as mono_load_remote_field_new () always
- * returns an object. In the future, to optimize some codepaths, we might
- * call a different function that takes a pointer to a valuetype, instead.
- */
-MonoMethod *
-mono_marshal_get_ldfld_remote_wrapper (MonoClass *klass)
-{
-       MonoMethodSignature *sig;
-       MonoMethodBuilder *mb;
-       MonoMethod *res;
-       static MonoMethod* cached = NULL;
-
-       mono_marshal_lock_internal ();
-       if (cached) {
-               mono_marshal_unlock_internal ();
-               return cached;
-       }
-       mono_marshal_unlock_internal ();
-
-       mb = mono_mb_new_no_dup_name (mono_defaults.object_class, "__mono_load_remote_field_new_wrapper", MONO_WRAPPER_LDFLD_REMOTE);
-
-       mb->method->save_lmf = 1;
-
-       sig = mono_metadata_signature_alloc (mono_defaults.corlib, 3);
-       sig->params [0] = &mono_defaults.object_class->byval_arg;
-       sig->params [1] = &mono_defaults.int_class->byval_arg;
-       sig->params [2] = &mono_defaults.int_class->byval_arg;
-       sig->ret = &mono_defaults.object_class->byval_arg;
-
-#ifndef DISABLE_JIT
-       mono_mb_emit_ldarg (mb, 0);
-       mono_mb_emit_ldarg (mb, 1);
-       mono_mb_emit_ldarg (mb, 2);
-
-       mono_mb_emit_icall (mb, mono_load_remote_field_new_icall);
-
-       mono_mb_emit_byte (mb, CEE_RET);
-#endif
-
-       mono_marshal_lock_internal ();
-       res = cached;
-       mono_marshal_unlock_internal ();
-       if (!res) {
-               MonoMethod *newm;
-               newm = mono_mb_create (mb, sig, 4, NULL);
-               mono_marshal_lock_internal ();
-               res = cached;
-               if (!res) {
-                       res = newm;
-                       cached = res;
-                       mono_marshal_unlock_internal ();
-               } else {
-                       mono_marshal_unlock_internal ();
-                       mono_free_method (newm);
-               }
-       }
-       mono_mb_free (mb);
-
-       return res;
-}
-
 /*
  * mono_marshal_get_ldfld_wrapper:
  * @type: the type of the field
@@ -1412,6 +1344,7 @@ mono_marshal_get_ldfld_wrapper (MonoType *type)
        WrapperInfo *info;
        char *name;
        int t, pos0, pos1 = 0;
+       static MonoMethod* tp_load = NULL;
 
        type = mono_type_get_underlying_type (type);
 
@@ -1442,6 +1375,13 @@ mono_marshal_get_ldfld_wrapper (MonoType *type)
        if ((res = mono_marshal_find_in_cache (cache, klass)))
                return res;
 
+#ifndef DISABLE_REMOTING
+       if (!tp_load) {
+               tp_load = mono_class_get_method_from_name (mono_defaults.transparent_proxy_class, "LoadRemoteFieldNew", -1);
+               g_assert (tp_load != NULL);
+       }
+#endif
+
        /* we add the %p pointer value of klass because class names are not unique */
        name = g_strdup_printf ("__ldfld_wrapper_%p_%s.%s", klass, klass->name_space, klass->name); 
        mb = mono_mb_new (mono_defaults.object_class, name, MONO_WRAPPER_LDFLD);
@@ -1458,11 +1398,12 @@ mono_marshal_get_ldfld_wrapper (MonoType *type)
        mono_mb_emit_ldarg (mb, 0);
        pos0 = mono_mb_emit_proxy_check (mb, CEE_BNE_UN);
 
+#ifndef DISABLE_REMOTING
        mono_mb_emit_ldarg (mb, 0);
        mono_mb_emit_ldarg (mb, 1);
        mono_mb_emit_ldarg (mb, 2);
 
-       mono_mb_emit_managed_call (mb, mono_marshal_get_ldfld_remote_wrapper (klass), NULL);
+       mono_mb_emit_managed_call (mb, tp_load, NULL);
 
        /*
        csig = mono_metadata_signature_alloc (mono_defaults.corlib, 3);
@@ -1482,6 +1423,7 @@ mono_marshal_get_ldfld_wrapper (MonoType *type)
        } else {
                mono_mb_emit_byte (mb, CEE_RET);
        }
+#endif
 
        mono_mb_patch_branch (mb, pos0);
 
@@ -1578,8 +1520,7 @@ mono_marshal_get_ldflda_wrapper (MonoType *type)
                        klass = mono_defaults.array_class;
                } else if (type->type == MONO_TYPE_VALUETYPE) {
                        klass = type->data.klass;
-               } else if (t == MONO_TYPE_OBJECT || t == MONO_TYPE_CLASS || t == MONO_TYPE_STRING ||
-                          t == MONO_TYPE_CLASS) { 
+               } else if (t == MONO_TYPE_OBJECT || t == MONO_TYPE_CLASS || t == MONO_TYPE_STRING) { 
                        klass = mono_defaults.object_class;
                } else if (t == MONO_TYPE_PTR || t == MONO_TYPE_FNPTR) {
                        klass = mono_defaults.int_class;
@@ -1677,73 +1618,6 @@ mono_marshal_get_ldflda_wrapper (MonoType *type)
        return res;
 }
 
-/*
- * mono_marshal_get_stfld_remote_wrapper:
- * klass: The type of the field
- *
- *  This function generates a wrapper for calling mono_store_remote_field_new
- * with the appropriate signature.
- * Similarly to mono_marshal_get_ldfld_remote_wrapper () this doesn't depend on the
- * klass argument anymore.
- */
-MonoMethod *
-mono_marshal_get_stfld_remote_wrapper (MonoClass *klass)
-{
-       MonoMethodSignature *sig;
-       MonoMethodBuilder *mb;
-       MonoMethod *res;
-       static MonoMethod *cached = NULL;
-
-       mono_marshal_lock_internal ();
-       if (cached) {
-               mono_marshal_unlock_internal ();
-               return cached;
-       }
-       mono_marshal_unlock_internal ();
-
-       mb = mono_mb_new_no_dup_name (mono_defaults.object_class, "__mono_store_remote_field_new_wrapper", MONO_WRAPPER_STFLD_REMOTE);
-
-       mb->method->save_lmf = 1;
-
-       sig = mono_metadata_signature_alloc (mono_defaults.corlib, 4);
-       sig->params [0] = &mono_defaults.object_class->byval_arg;
-       sig->params [1] = &mono_defaults.int_class->byval_arg;
-       sig->params [2] = &mono_defaults.int_class->byval_arg;
-       sig->params [3] = &mono_defaults.object_class->byval_arg;
-       sig->ret = &mono_defaults.void_class->byval_arg;
-
-#ifndef DISABLE_JIT
-       mono_mb_emit_ldarg (mb, 0);
-       mono_mb_emit_ldarg (mb, 1);
-       mono_mb_emit_ldarg (mb, 2);
-       mono_mb_emit_ldarg (mb, 3);
-
-       mono_mb_emit_icall (mb, mono_store_remote_field_new_icall);
-
-       mono_mb_emit_byte (mb, CEE_RET);
-#endif
-
-       mono_marshal_lock_internal ();
-       res = cached;
-       mono_marshal_unlock_internal ();
-       if (!res) {
-               MonoMethod *newm;
-               newm = mono_mb_create (mb, sig, 6, NULL);
-               mono_marshal_lock_internal ();
-               res = cached;
-               if (!res) {
-                       res = newm;
-                       cached = res;
-                       mono_marshal_unlock_internal ();
-               } else {
-                       mono_marshal_unlock_internal ();
-                       mono_free_method (newm);
-               }
-       }
-       mono_mb_free (mb);
-       
-       return res;
-}
 
 /*
  * mono_marshal_get_stfld_wrapper:
@@ -1764,6 +1638,7 @@ mono_marshal_get_stfld_wrapper (MonoType *type)
        WrapperInfo *info;
        char *name;
        int t, pos;
+       static MonoMethod *tp_store = NULL;
 
        type = mono_type_get_underlying_type (type);
        t = type->type;
@@ -1793,6 +1668,13 @@ mono_marshal_get_stfld_wrapper (MonoType *type)
        if ((res = mono_marshal_find_in_cache (cache, klass)))
                return res;
 
+#ifndef DISABLE_REMOTING
+       if (!tp_store) {
+               tp_store = mono_class_get_method_from_name (mono_defaults.transparent_proxy_class, "StoreRemoteField", -1);
+               g_assert (tp_store != NULL);
+       }
+#endif
+
        /* we add the %p pointer value of klass because class names are not unique */
        name = g_strdup_printf ("__stfld_wrapper_%p_%s.%s", klass, klass->name_space, klass->name); 
        mb = mono_mb_new (mono_defaults.object_class, name, MONO_WRAPPER_STFLD);
@@ -1810,6 +1692,7 @@ mono_marshal_get_stfld_wrapper (MonoType *type)
        mono_mb_emit_ldarg (mb, 0);
        pos = mono_mb_emit_proxy_check (mb, CEE_BNE_UN);
 
+#ifndef DISABLE_REMOTING
        mono_mb_emit_ldarg (mb, 0);
        mono_mb_emit_ldarg (mb, 1);
        mono_mb_emit_ldarg (mb, 2);
@@ -1817,9 +1700,10 @@ mono_marshal_get_stfld_wrapper (MonoType *type)
        if (klass->valuetype)
                mono_mb_emit_op (mb, CEE_BOX, klass);
 
-       mono_mb_emit_managed_call (mb, mono_marshal_get_stfld_remote_wrapper (klass), NULL);
+       mono_mb_emit_managed_call (mb, tp_store, NULL);
 
        mono_mb_emit_byte (mb, CEE_RET);
+#endif
 
        mono_mb_patch_branch (mb, pos);
 
index 9b495b2fb59f87be44d473aad0f80691a09af3ad..b0307aed93dfe044247ac64fee04393385b97eca 100644 (file)
@@ -38,12 +38,6 @@ mono_marshal_get_ldfld_wrapper (MonoType *type);
 MonoMethod *
 mono_marshal_get_ldflda_wrapper (MonoType *type);
 
-MonoMethod *
-mono_marshal_get_ldfld_remote_wrapper (MonoClass *klass);
-
-MonoMethod *
-mono_marshal_get_stfld_remote_wrapper (MonoClass *klass);
-
 MonoMethod *
 mono_marshal_get_proxy_cancast (MonoClass *klass);
 
index df6a4bb8cdee7513673b29f6cd08b8ed3e3ae84b..0597bdd7882fdd994391eadbe65c84ca58c0c181 100644 (file)
@@ -45,6 +45,8 @@ typedef struct {
        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);
 
        /*
@@ -62,6 +64,7 @@ void sgen_new_bridge_init (SgenBridgeProcessor *collector);
 void sgen_tarjan_bridge_init (SgenBridgeProcessor *collector);
 void sgen_set_bridge_implementation (const char *name);
 void sgen_bridge_set_dump_prefix (const char *prefix);
+void sgen_init_bridge (void);
 
 #endif
 
index 303f8ea837210f8f843a03b321da1a82bfd469dc..006e68c50121f32e9de1a776a9f164ead82907dd 100644 (file)
 #include "sgen/sgen-qsort.h"
 #include "utils/mono-logger-internals.h"
 
+typedef enum {
+       BRIDGE_PROCESSOR_INVALID,
+       BRIDGE_PROCESSOR_OLD,
+       BRIDGE_PROCESSOR_NEW,
+       BRIDGE_PROCESSOR_TARJAN,
+       BRIDGE_PROCESSOR_DEFAULT = BRIDGE_PROCESSOR_TARJAN
+} BridgeProcessorSelection;
+
+// Bridge processor type pending / in use
+static BridgeProcessorSelection bridge_processor_selection = BRIDGE_PROCESSOR_DEFAULT;
+// Most recently requested callbacks
+static MonoGCBridgeCallbacks pending_bridge_callbacks;
+// Currently-in-use callbacks
 MonoGCBridgeCallbacks bridge_callbacks;
+
+// Bridge processor state
 static SgenBridgeProcessor bridge_processor;
+// This is used for a special debug feature
 static SgenBridgeProcessor compare_to_bridge_processor;
 
 volatile gboolean bridge_processing_in_progress = FALSE;
 
+// FIXME: The current usage pattern for this function is unsafe. Bridge processing could start immediately after unlock
 void
 mono_gc_wait_for_bridge_processing (void)
 {
@@ -39,42 +56,101 @@ mono_gc_wait_for_bridge_processing (void)
        sgen_gc_unlock ();
 }
 
-
 void
 mono_gc_register_bridge_callbacks (MonoGCBridgeCallbacks *callbacks)
 {
        if (callbacks->bridge_version != SGEN_BRIDGE_VERSION)
                g_error ("Invalid bridge callback version. Expected %d but got %d\n", SGEN_BRIDGE_VERSION, callbacks->bridge_version);
 
-       bridge_callbacks = *callbacks;
+       // Defer assigning to bridge_callbacks until we have the gc lock.
+       // Note: This line is unsafe if we are on a separate thread from the one the runtime was initialized on.
+       pending_bridge_callbacks = *callbacks;
 
-       if (!bridge_processor.reset_data)
-               sgen_new_bridge_init (&bridge_processor);
+       // If sgen has started, will assign bridge callbacks and init bridge
+       sgen_init_bridge ();
 }
 
-static gboolean
-init_bridge_processor (SgenBridgeProcessor *processor, const char *name)
+static BridgeProcessorSelection
+bridge_processor_name (const char *name)
 {
        if (!strcmp ("old", name)) {
-               memset (processor, 0, sizeof (SgenBridgeProcessor));
-               sgen_old_bridge_init (processor);
+               return BRIDGE_PROCESSOR_OLD;
        } else if (!strcmp ("new", name)) {
-               memset (processor, 0, sizeof (SgenBridgeProcessor));
-               sgen_new_bridge_init (processor);
+               return BRIDGE_PROCESSOR_NEW;
        } else if (!strcmp ("tarjan", name)) {
-               memset (processor, 0, sizeof (SgenBridgeProcessor));
-               sgen_tarjan_bridge_init (processor);
+               return BRIDGE_PROCESSOR_TARJAN;
        } else {
-               return FALSE;
+               return BRIDGE_PROCESSOR_INVALID;
+       }
+}
+
+// Initialize a single bridge processor
+static void
+init_bridge_processor (SgenBridgeProcessor *processor, BridgeProcessorSelection selection)
+{
+       memset (processor, 0, sizeof (SgenBridgeProcessor));
+
+       switch (selection) {
+               case BRIDGE_PROCESSOR_OLD:
+                       sgen_old_bridge_init (processor);
+                       break;
+               case BRIDGE_PROCESSOR_NEW:
+                       sgen_new_bridge_init (processor);
+                       break;
+               case BRIDGE_PROCESSOR_TARJAN:
+                       sgen_tarjan_bridge_init (processor);
+                       break;
+               default:
+                       g_assert_not_reached ();
+       }
+}
+
+/*
+ * Initializing the sgen bridge consists of setting the bridge callbacks,
+ * and initializing the bridge processor. Init should follow these rules:
+ *
+ *   - Init happens only after sgen is initialized (because we don't
+ *     know which bridge processor to initialize until then, and also
+ *     to allow bridge processor init to interact with sgen if it wants)
+ *
+ *   - Init happens only after mono_gc_register_bridge_callbacks is called
+ *
+ *   - Init should not happen concurrently with a GC (because a GC will
+ *     call sgen_need_bridge_processing at various times)
+ *
+ *   - Initializing the bridge processor should happen only once
+ *
+ * We call sgen_init_bridge when the callbacks are set, and also when sgen
+ * is done initing. Actual initialization then only occurs if it is ready.
+ */
+void
+sgen_init_bridge ()
+{
+       if (sgen_gc_initialized ()) {
+               // This lock is not initialized until the GC is
+               sgen_gc_lock ();
+
+               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)
+                       init_bridge_processor (&bridge_processor, bridge_processor_selection);
+
+               sgen_gc_unlock ();
        }
-       return TRUE;
 }
 
 void
 sgen_set_bridge_implementation (const char *name)
 {
-       if (!init_bridge_processor (&bridge_processor, name))
-               g_warning ("Invalid value for bridge implementation, valid values are: 'new', 'old' and 'tarjan'.");
+       BridgeProcessorSelection selection = bridge_processor_name (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)
+               g_warning ("Cannot set bridge processor implementation once bridge has already started");
+       else
+               bridge_processor_selection = selection;
 }
 
 gboolean
@@ -589,11 +665,10 @@ sgen_bridge_handle_gc_debug (const char *opt)
                set_dump_prefix (prefix);
        } else if (g_str_has_prefix (opt, "bridge-compare-to=")) {
                const char *name = strchr (opt, '=') + 1;
-               if (init_bridge_processor (&compare_to_bridge_processor, name)) {
-                       if (compare_to_bridge_processor.reset_data == bridge_processor.reset_data) {
-                               g_warning ("Cannot compare bridge implementation to itself - ignoring.");
-                               memset (&compare_to_bridge_processor, 0, sizeof (SgenBridgeProcessor));
-                       }
+               BridgeProcessorSelection selection = bridge_processor_name (name);
+
+               if (selection != BRIDGE_PROCESSOR_INVALID) {
+                       init_bridge_processor (&compare_to_bridge_processor, selection);
                } else {
                        g_warning ("Invalid bridge implementation to compare against - ignoring.");
                }
index 38dc44637cc05c1fea162908aec0bb741cfb0d8d..b11df8a17b5e39d83ef82e05e98ca52c5125cf87 100644 (file)
@@ -9,20 +9,23 @@
  * unreachable objects.  We use it in monodroid to do garbage collection across
  * the Mono and Java heaps.
  *
- * The client can designate some objects as "bridged", which means that they
- * participate in the bridge processing step once SGen considers them
+ * The client (Monodroid) can designate some objects as "bridged", which means
+ * that they participate in the bridge processing step once SGen considers them
  * unreachable, i.e., dead.  Bridged objects must be registered for
  * finalization.
  *
  * When SGen is done marking, it puts together a list of all dead bridged
- * objects and then does a strongly connected component analysis over their
- * object graph.  That graph will usually contain non-bridged objects, too.
+ * 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.
  *
- * 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.
+ * 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),
+ * and an array of "xrefs" (edges between SCCs, MonoGCBridgeXRef).  Edges are
+ * encoded as pairs of "API indices", ie indexes in the SCC array.  The client
+ * is expected to set the `is_alive` flag on those strongly connected components
+ * that it wishes to be kept alive.
  *
  * In monodroid each bridged object has a corresponding Java mirror object.  In
  * the bridge callback it reifies the Mono object graph in the Java heap so that
  * point all links to bridged objects that don't have `is_alive` set are nulled.
  * Note that weak links to non-bridged objects reachable from bridged objects
  * are not nulled.  This might be considered a bug.
+ *
+ * There are three different implementations of the bridge processor, each of
+ * which implements 8 callbacks (see SgenBridgeProcessor).  The implementations
+ * differ in the algorithm they use to compute the "simplified" SCC graph.
  */
 
 #ifndef _MONO_SGEN_BRIDGE_H_
@@ -88,6 +95,11 @@ typedef struct {
        void (*cross_references) (int num_sccs, MonoGCBridgeSCC **sccs, int num_xrefs, MonoGCBridgeXRef *xrefs);
 } MonoGCBridgeCallbacks;
 
+/*
+ * Note: This may be called at any time, but cannot be called concurrently
+ * with (during and on a separate thread from) sgen init. Callers are
+ * responsible for enforcing this.
+ */
 MONO_API void mono_gc_register_bridge_callbacks (MonoGCBridgeCallbacks *callbacks);
 
 MONO_API void mono_gc_wait_for_bridge_processing (void);
diff --git a/mono/metadata/sgen-dynarray.h b/mono/metadata/sgen-dynarray.h
new file mode 100644 (file)
index 0000000..f5a6a61
--- /dev/null
@@ -0,0 +1,346 @@
+/*
+ * Copyright 2016 Xamarin, Inc.
+ *
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+ */
+
+ // Growable array implementation used by sgen-new-bridge and sgen-tarjan-bridge.
+
+typedef struct {
+       int size;
+       int capacity;           /* if negative, data points to another DynArray's data */
+       char *data;
+} DynArray;
+
+/*Specializations*/
+
+// IntArray supports an optimization (in sgen-new-bridge.c): If capacity is less than 0 it is a "copy" and does not own its buffer.
+typedef struct {
+       DynArray array;
+} DynIntArray;
+
+// PtrArray supports an optimization: If size is equal to 1 it is a "singleton" and data points to the single held item, not to a buffer.
+typedef struct {
+       DynArray array;
+} DynPtrArray;
+
+typedef struct {
+       DynArray array;
+} DynSCCArray;
+
+static void
+dyn_array_init (DynArray *da)
+{
+       da->size = 0;
+       da->capacity = 0;
+       da->data = NULL;
+}
+
+static void
+dyn_array_uninit (DynArray *da, int elem_size)
+{
+       if (da->capacity < 0) {
+               dyn_array_init (da);
+               return;
+       }
+
+       if (da->capacity == 0)
+               return;
+
+       sgen_free_internal_dynamic (da->data, elem_size * da->capacity, INTERNAL_MEM_BRIDGE_DATA);
+       da->data = NULL;
+}
+
+static void
+dyn_array_empty (DynArray *da)
+{
+       if (da->capacity < 0)
+               dyn_array_init (da);
+       else
+               da->size = 0;
+}
+
+static char *
+dyn_array_ensure_capacity_internal (DynArray *da, int capacity, int elem_size)
+{
+       if (da->capacity <= 0)
+               da->capacity = 2;
+       while (capacity > da->capacity)
+               da->capacity *= 2;
+
+       return (char *)sgen_alloc_internal_dynamic (elem_size * da->capacity, INTERNAL_MEM_BRIDGE_DATA, TRUE);
+}
+
+static void
+dyn_array_ensure_capacity (DynArray *da, int capacity, int elem_size)
+{
+       int old_capacity = da->capacity;
+       char *new_data;
+
+       g_assert (capacity > 0);
+
+       if (capacity <= old_capacity)
+               return;
+
+       new_data = dyn_array_ensure_capacity_internal (da, capacity, elem_size);
+       memcpy (new_data, da->data, elem_size * da->size);
+       if (old_capacity > 0)
+               sgen_free_internal_dynamic (da->data, elem_size * old_capacity, INTERNAL_MEM_BRIDGE_DATA);
+       da->data = new_data;
+}
+
+static gboolean
+dyn_array_is_copy (DynArray *da)
+{
+       return da->capacity < 0;
+}
+
+static void
+dyn_array_ensure_independent (DynArray *da, int elem_size)
+{
+       if (!dyn_array_is_copy (da))
+               return;
+       dyn_array_ensure_capacity (da, da->size, elem_size);
+       g_assert (da->capacity > 0);
+}
+
+static void*
+dyn_array_add (DynArray *da, int elem_size)
+{
+       void *p;
+
+       dyn_array_ensure_capacity (da, da->size + 1, elem_size);
+
+       p = da->data + da->size * elem_size;
+       ++da->size;
+       return p;
+}
+
+static void
+dyn_array_copy (DynArray *dst, DynArray *src, int elem_size)
+{
+       dyn_array_uninit (dst, elem_size);
+
+       if (src->size == 0)
+               return;
+
+       dst->size = src->size;
+       dst->capacity = -1;
+       dst->data = src->data;
+}
+
+/* int */
+static void
+dyn_array_int_init (DynIntArray *da)
+{
+       dyn_array_init (&da->array);
+}
+
+static void
+dyn_array_int_uninit (DynIntArray *da)
+{
+       dyn_array_uninit (&da->array, sizeof (int));
+}
+
+static int
+dyn_array_int_size (DynIntArray *da)
+{
+       return da->array.size;
+}
+
+#ifdef NEW_XREFS
+static void
+dyn_array_int_empty (DynIntArray *da)
+{
+       dyn_array_empty (&da->array);
+}
+#endif
+
+static void
+dyn_array_int_add (DynIntArray *da, int x)
+{
+       int *p = (int *)dyn_array_add (&da->array, sizeof (int));
+       *p = x;
+}
+
+static int
+dyn_array_int_get (DynIntArray *da, int x)
+{
+       return ((int*)da->array.data)[x];
+}
+
+#ifdef NEW_XREFS
+static void
+dyn_array_int_set (DynIntArray *da, int idx, int val)
+{
+       ((int*)da->array.data)[idx] = val;
+}
+#endif
+
+static void
+dyn_array_int_ensure_independent (DynIntArray *da)
+{
+       dyn_array_ensure_independent (&da->array, sizeof (int));
+}
+
+static void
+dyn_array_int_copy (DynIntArray *dst, DynIntArray *src)
+{
+       dyn_array_copy (&dst->array, &src->array, sizeof (int));
+}
+
+static gboolean
+dyn_array_int_is_copy (DynIntArray *da)
+{
+       return dyn_array_is_copy (&da->array);
+}
+
+/* ptr */
+
+static void
+dyn_array_ptr_init (DynPtrArray *da)
+{
+       dyn_array_init (&da->array);
+}
+
+static void
+dyn_array_ptr_uninit (DynPtrArray *da)
+{
+#ifdef OPTIMIZATION_SINGLETON_DYN_ARRAY
+       if (da->array.capacity == 1)
+               dyn_array_ptr_init (da);
+       else
+#endif
+               dyn_array_uninit (&da->array, sizeof (void*));
+}
+
+static int
+dyn_array_ptr_size (DynPtrArray *da)
+{
+       return da->array.size;
+}
+
+static void
+dyn_array_ptr_empty (DynPtrArray *da)
+{
+#ifdef OPTIMIZATION_SINGLETON_DYN_ARRAY
+       if (da->array.capacity == 1)
+               dyn_array_ptr_init (da);
+       else
+#endif
+               dyn_array_empty (&da->array);
+}
+
+static void*
+dyn_array_ptr_get (DynPtrArray *da, int x)
+{
+#ifdef OPTIMIZATION_SINGLETON_DYN_ARRAY
+       if (da->array.capacity == 1) {
+               g_assert (x == 0);
+               return da->array.data;
+       }
+#endif
+       return ((void**)da->array.data)[x];
+}
+
+static void
+dyn_array_ptr_set (DynPtrArray *da, int x, void *ptr)
+{
+#ifdef OPTIMIZATION_SINGLETON_DYN_ARRAY
+       if (da->array.capacity == 1) {
+               g_assert (x == 0);
+               da->array.data = ptr;
+       } else
+#endif
+       {
+               ((void**)da->array.data)[x] = ptr;
+       }
+}
+
+static void
+dyn_array_ptr_add (DynPtrArray *da, void *ptr)
+{
+       void **p;
+
+#ifdef OPTIMIZATION_SINGLETON_DYN_ARRAY
+       if (da->array.capacity == 0) {
+               da->array.capacity = 1;
+               da->array.size = 1;
+               p = (void**)&da->array.data;
+       } else if (da->array.capacity == 1) {
+               void *ptr0 = da->array.data;
+               void **p0;
+               dyn_array_init (&da->array);
+               p0 = (void **)dyn_array_add (&da->array, sizeof (void*));
+               *p0 = ptr0;
+               p = (void **)dyn_array_add (&da->array, sizeof (void*));
+       } else
+#endif
+       {
+               p = (void **)dyn_array_add (&da->array, sizeof (void*));
+       }
+       *p = ptr;
+}
+
+#define dyn_array_ptr_push dyn_array_ptr_add
+
+static void*
+dyn_array_ptr_pop (DynPtrArray *da)
+{
+       int size = da->array.size;
+       void *p;
+       g_assert (size > 0);
+#ifdef OPTIMIZATION_SINGLETON_DYN_ARRAY
+       if (da->array.capacity == 1) {
+               p = dyn_array_ptr_get (da, 0);
+               dyn_array_init (&da->array);
+       } else
+#endif
+       {
+               g_assert (da->array.capacity > 1);
+               dyn_array_ensure_independent (&da->array, sizeof (void*));
+               p = dyn_array_ptr_get (da, size - 1);
+               --da->array.size;
+       }
+       return p;
+}
+
+static void
+dyn_array_ptr_ensure_capacity (DynPtrArray *da, int capacity)
+{
+#ifdef OPTIMIZATION_SINGLETON_DYN_ARRAY
+       if (capacity == 1 && da->array.capacity < 1) {
+               da->array.capacity = 1;
+       } else if (da->array.capacity == 1) // TODO size==1
+       {
+               if (capacity > 1)
+               {
+                       void *ptr = dyn_array_ptr_get (da, 0);
+                       da->array.data = dyn_array_ensure_capacity_internal(&da->array, capacity, sizeof (void*));
+                       dyn_array_ptr_set (da, 0, ptr);
+               }
+       }
+#endif
+       {
+               dyn_array_ensure_capacity (&da->array, capacity, sizeof (void*));
+       }
+}
+
+static void
+dyn_array_ptr_set_all (DynPtrArray *dst, DynPtrArray *src)
+{
+       const int copysize = src->array.size;
+       if (copysize > 0) {
+               dyn_array_ptr_ensure_capacity (dst, copysize);
+
+#ifdef OPTIMIZATION_SINGLETON_DYN_ARRAY
+               if (copysize == 1) {
+                       dyn_array_ptr_set (dst, 0, dyn_array_ptr_get (src, 0));
+               } else
+#endif
+               {
+                       memcpy (dst->array.data, src->array.data, copysize * sizeof (void*));
+               }
+       }
+       dst->array.size = src->array.size;
+}
index bccc7d8aad53fa1b91dfb139a10df911b6132c13..5c3d772c9facfac1cf717ac952192f0324739f8d 100644 (file)
@@ -140,7 +140,8 @@ mono_gc_wbarrier_object_copy (MonoObject* obj, MonoObject *src)
 
        HEAVY_STAT (++stat_wbarrier_object_copy);
 
-       if (sgen_ptr_in_nursery (obj) || ptr_on_stack (obj) || !SGEN_OBJECT_HAS_REFERENCES (src)) {
+       SGEN_ASSERT (6, !ptr_on_stack (obj), "Why is this called for a non-reference type?");
+       if (sgen_ptr_in_nursery (obj) || !SGEN_OBJECT_HAS_REFERENCES (src)) {
                size = mono_object_class (obj)->instance_size;
                mono_gc_memmove_aligned ((char*)obj + sizeof (MonoObject), (char*)src + sizeof (MonoObject),
                                size - sizeof (MonoObject));
@@ -525,17 +526,19 @@ object_in_domain_predicate (MonoObject *obj, void *user_data)
  * @out_array: output array
  * @out_size: size of output array
  *
- * Store inside @out_array up to @out_size objects that belong to the unloading
- * appdomain @domain. Returns the number of stored items. Can be called repeteadly
- * until it returns 0.
- * The items are removed from the finalizer data structure, so the caller is supposed
- * to finalize them.
- * @out_array should be on the stack to allow the GC to know the objects are still alive.
+ * Enqueue for finalization all objects that belong to the unloading appdomain @domain
+ * @suspend is used for early termination of the enqueuing process.
  */
-int
-mono_gc_finalizers_for_domain (MonoDomain *domain, MonoObject **out_array, int out_size)
+void
+mono_gc_finalize_domain (MonoDomain *domain)
 {
-       return sgen_gather_finalizers_if (object_in_domain_predicate, domain, out_array, out_size);
+       sgen_finalize_if (object_in_domain_predicate, domain);
+}
+
+void
+mono_gc_suspend_finalizers (void)
+{
+       sgen_set_suspend_finalizers ();
 }
 
 /*
@@ -1145,14 +1148,6 @@ create_allocator (int atype, ManagedAllocatorVariant variant)
 
        EMIT_TLS_ACCESS_VAR (mb, thread_var);
 
-#ifdef MANAGED_ALLOCATOR_CAN_USE_CRITICAL_REGION
-       EMIT_TLS_ACCESS_IN_CRITICAL_REGION_ADDR (mb, thread_var);
-       mono_mb_emit_byte (mb, CEE_LDC_I4_1);
-       mono_mb_emit_byte (mb, MONO_CUSTOM_PREFIX);
-       mono_mb_emit_byte (mb, CEE_MONO_ATOMIC_STORE_I4);
-       mono_mb_emit_i4 (mb, MONO_MEMORY_BARRIER_NONE);
-#endif
-
        size_var = mono_mb_add_local (mb, &mono_defaults.int_class->byval_arg);
        if (atype == ATYPE_SMALL) {
                /* size_var = size_arg */
@@ -1279,6 +1274,14 @@ create_allocator (int atype, ManagedAllocatorVariant variant)
                g_assert_not_reached ();
        }
 
+#ifdef MANAGED_ALLOCATOR_CAN_USE_CRITICAL_REGION
+       EMIT_TLS_ACCESS_IN_CRITICAL_REGION_ADDR (mb, thread_var);
+       mono_mb_emit_byte (mb, CEE_LDC_I4_1);
+       mono_mb_emit_byte (mb, MONO_CUSTOM_PREFIX);
+       mono_mb_emit_byte (mb, CEE_MONO_ATOMIC_STORE_I4);
+       mono_mb_emit_i4 (mb, MONO_MEMORY_BARRIER_NONE);
+#endif
+
        /* size += ALLOC_ALIGN - 1; */
        mono_mb_emit_ldloc (mb, size_var);
        mono_mb_emit_icon (mb, SGEN_ALLOC_ALIGN - 1);
@@ -2401,6 +2404,21 @@ sgen_client_scan_thread_data (void *start_nursery, void *end_nursery, gboolean p
                g_assert (info->client_info.stack_end);
 
                aligned_stack_start = (void*)(mword) ALIGN_TO ((mword)info->client_info.stack_start, SIZEOF_VOID_P);
+#ifdef HOST_WIN32
+               /* Windows uses a guard page before the committed stack memory pages to detect when the
+                  stack needs to be grown. If we suspend a thread just after a function prolog has
+                  decremented the stack pointer to point into the guard page but before the thread has
+                  been able to read or write to that page, starting the stack scan at aligned_stack_start
+                  will raise a STATUS_GUARD_PAGE_VIOLATION and the process will crash. This code uses
+                  VirtualQuery() to determine whether stack_start points into the guard page and then
+                  updates aligned_stack_start to point at the next non-guard page. */
+               MEMORY_BASIC_INFORMATION mem_info;
+               SIZE_T result = VirtualQuery(info->client_info.stack_start, &mem_info, sizeof(mem_info));
+               g_assert (result != 0);
+               if (mem_info.Protect & PAGE_GUARD) {
+                       aligned_stack_start = ((char*) mem_info.BaseAddress) + mem_info.RegionSize;
+               }
+#endif
 
                g_assert (info->client_info.suspend_done);
                SGEN_LOG (3, "Scanning thread %p, range: %p-%p, size: %zd, pinned=%zd", info, info->client_info.stack_start, info->client_info.stack_end, (char*)info->client_info.stack_end - (char*)info->client_info.stack_start, sgen_get_pinned_count ());
index a1eb82a714fcdbfa72a89003e1eb988869f8a0b9..4631c0c5430f2ec946931fee01fee5ae079a6ad7 100644 (file)
 #include "tabledefs.h"
 #include "utils/mono-logger-internals.h"
 
+#define OPTIMIZATION_COPY
+#define OPTIMIZATION_FORWARD
+#define OPTIMIZATION_SINGLETON_DYN_ARRAY
+#include "sgen-dynarray.h"
+
 //#define NEW_XREFS
 #ifdef NEW_XREFS
 //#define TEST_NEW_XREFS
 #define XREFS old_xrefs
 #endif
 
-#define OPTIMIZATION_COPY
-#define OPTIMIZATION_FORWARD
-#define OPTIMIZATION_SINGLETON_DYN_ARRAY
-
-typedef struct {
-       int size;
-       int capacity;           /* if negative, data points to another DynArray's data */
-       char *data;
-} DynArray;
-
-/*Specializations*/
-
-typedef struct {
-       DynArray array;
-} DynIntArray;
-
-typedef struct {
-       DynArray array;
-} DynPtrArray;
-
-typedef struct {
-       DynArray array;
-} DynSCCArray;
-
-
 /*
  * Bridge data for a single managed object
  *
@@ -131,266 +111,6 @@ static gboolean bridge_accounting_enabled = FALSE;
 static SgenBridgeProcessor *bridge_processor;
 
 /* Core functions */
-/* public */
-
-/* private */
-
-static void
-dyn_array_init (DynArray *da)
-{
-       da->size = 0;
-       da->capacity = 0;
-       da->data = NULL;
-}
-
-static void
-dyn_array_uninit (DynArray *da, int elem_size)
-{
-       if (da->capacity < 0) {
-               dyn_array_init (da);
-               return;
-       }
-
-       if (da->capacity == 0)
-               return;
-
-       sgen_free_internal_dynamic (da->data, elem_size * da->capacity, INTERNAL_MEM_BRIDGE_DATA);
-       da->data = NULL;
-}
-
-static void
-dyn_array_empty (DynArray *da)
-{
-       if (da->capacity < 0)
-               dyn_array_init (da);
-       else
-               da->size = 0;
-}
-
-static void
-dyn_array_ensure_capacity (DynArray *da, int capacity, int elem_size)
-{
-       int old_capacity = da->capacity;
-       char *new_data;
-
-       g_assert (capacity > 0);
-
-       if (capacity <= old_capacity)
-               return;
-
-       if (old_capacity <= 0)
-               da->capacity = 2;
-       while (capacity > da->capacity)
-               da->capacity *= 2;
-
-       new_data = (char *)sgen_alloc_internal_dynamic (elem_size * da->capacity, INTERNAL_MEM_BRIDGE_DATA, TRUE);
-       memcpy (new_data, da->data, elem_size * da->size);
-       if (old_capacity > 0)
-               sgen_free_internal_dynamic (da->data, elem_size * old_capacity, INTERNAL_MEM_BRIDGE_DATA);
-       da->data = new_data;
-}
-
-static gboolean
-dyn_array_is_copy (DynArray *da)
-{
-       return da->capacity < 0;
-}
-
-static void
-dyn_array_ensure_independent (DynArray *da, int elem_size)
-{
-       if (!dyn_array_is_copy (da))
-               return;
-       dyn_array_ensure_capacity (da, da->size, elem_size);
-       g_assert (da->capacity > 0);
-}
-
-static void*
-dyn_array_add (DynArray *da, int elem_size)
-{
-       void *p;
-
-       dyn_array_ensure_capacity (da, da->size + 1, elem_size);
-
-       p = da->data + da->size * elem_size;
-       ++da->size;
-       return p;
-}
-
-static void
-dyn_array_copy (DynArray *dst, DynArray *src, int elem_size)
-{
-       dyn_array_uninit (dst, elem_size);
-
-       if (src->size == 0)
-               return;
-
-       dst->size = src->size;
-       dst->capacity = -1;
-       dst->data = src->data;
-}
-
-/* int */
-static void
-dyn_array_int_init (DynIntArray *da)
-{
-       dyn_array_init (&da->array);
-}
-
-static void
-dyn_array_int_uninit (DynIntArray *da)
-{
-       dyn_array_uninit (&da->array, sizeof (int));
-}
-
-static int
-dyn_array_int_size (DynIntArray *da)
-{
-       return da->array.size;
-}
-
-#ifdef NEW_XREFS
-static void
-dyn_array_int_empty (DynIntArray *da)
-{
-       dyn_array_empty (&da->array);
-}
-#endif
-
-static void
-dyn_array_int_add (DynIntArray *da, int x)
-{
-       int *p = (int *)dyn_array_add (&da->array, sizeof (int));
-       *p = x;
-}
-
-static int
-dyn_array_int_get (DynIntArray *da, int x)
-{
-       return ((int*)da->array.data)[x];
-}
-
-#ifdef NEW_XREFS
-static void
-dyn_array_int_set (DynIntArray *da, int idx, int val)
-{
-       ((int*)da->array.data)[idx] = val;
-}
-#endif
-
-static void
-dyn_array_int_ensure_independent (DynIntArray *da)
-{
-       dyn_array_ensure_independent (&da->array, sizeof (int));
-}
-
-static void
-dyn_array_int_copy (DynIntArray *dst, DynIntArray *src)
-{
-       dyn_array_copy (&dst->array, &src->array, sizeof (int));
-}
-
-static gboolean
-dyn_array_int_is_copy (DynIntArray *da)
-{
-       return dyn_array_is_copy (&da->array);
-}
-
-/* ptr */
-
-static void
-dyn_array_ptr_init (DynPtrArray *da)
-{
-       dyn_array_init (&da->array);
-}
-
-static void
-dyn_array_ptr_uninit (DynPtrArray *da)
-{
-#ifdef OPTIMIZATION_SINGLETON_DYN_ARRAY
-       if (da->array.capacity == 1)
-               dyn_array_ptr_init (da);
-       else
-#endif
-               dyn_array_uninit (&da->array, sizeof (void*));
-}
-
-static int
-dyn_array_ptr_size (DynPtrArray *da)
-{
-       return da->array.size;
-}
-
-static void
-dyn_array_ptr_empty (DynPtrArray *da)
-{
-#ifdef OPTIMIZATION_SINGLETON_DYN_ARRAY
-       if (da->array.capacity == 1)
-               dyn_array_ptr_init (da);
-       else
-#endif
-               dyn_array_empty (&da->array);
-}
-
-static void*
-dyn_array_ptr_get (DynPtrArray *da, int x)
-{
-#ifdef OPTIMIZATION_SINGLETON_DYN_ARRAY
-       if (da->array.capacity == 1) {
-               g_assert (x == 0);
-               return da->array.data;
-       }
-#endif
-       return ((void**)da->array.data)[x];
-}
-
-static void
-dyn_array_ptr_add (DynPtrArray *da, void *ptr)
-{
-       void **p;
-
-#ifdef OPTIMIZATION_SINGLETON_DYN_ARRAY
-       if (da->array.capacity == 0) {
-               da->array.capacity = 1;
-               da->array.size = 1;
-               p = (void**)&da->array.data;
-       } else if (da->array.capacity == 1) {
-               void *ptr0 = da->array.data;
-               void **p0;
-               dyn_array_init (&da->array);
-               p0 = (void **)dyn_array_add (&da->array, sizeof (void*));
-               *p0 = ptr0;
-               p = (void **)dyn_array_add (&da->array, sizeof (void*));
-       } else
-#endif
-       {
-               p = (void **)dyn_array_add (&da->array, sizeof (void*));
-       }
-       *p = ptr;
-}
-
-#define dyn_array_ptr_push dyn_array_ptr_add
-
-static void*
-dyn_array_ptr_pop (DynPtrArray *da)
-{
-       int size = da->array.size;
-       void *p;
-       g_assert (size > 0);
-#ifdef OPTIMIZATION_SINGLETON_DYN_ARRAY
-       if (da->array.capacity == 1) {
-               p = dyn_array_ptr_get (da, 0);
-               dyn_array_init (&da->array);
-       } else
-#endif
-       {
-               g_assert (da->array.capacity > 1);
-               dyn_array_ensure_independent (&da->array, sizeof (void*));
-               p = dyn_array_ptr_get (da, size - 1);
-               --da->array.size;
-       }
-       return p;
-}
 
 /*SCC */
 
index 5a9bae85b6db35d7c95d81b19ad82a6c2e921a65..1016841f535149e796fa8ea8f8afe89e868d633c 100644 (file)
@@ -46,6 +46,7 @@ suspend_thread (SgenThreadInfo *info, void *context)
        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 */
index 66dff8d1d1c35bd582640155ea57346b4fabe46e..76c5ac64a90d1380e68f88e5e0f1b44f83a7481c 100644 (file)
 #include "tabledefs.h"
 #include "utils/mono-logger-internals.h"
 
-typedef struct {
-       int size;
-       int capacity;
-       char *data;
-} DynArray;
-
-/*Specializations*/
-
-typedef struct {
-       DynArray array;
-} DynPtrArray;
-
-/* private */
-
-static void
-dyn_array_uninit (DynArray *da, int elem_size)
-{
-       if (da->capacity <= 0)
-               return;
+#include "sgen-dynarray.h"
 
-       sgen_free_internal_dynamic (da->data, elem_size * da->capacity, INTERNAL_MEM_BRIDGE_DATA);
-       da->data = NULL;
-}
-
-static void
-dyn_array_ensure_capacity (DynArray *da, int capacity, int elem_size)
-{
-       int old_capacity = da->capacity;
-       char *new_data;
-
-       if (capacity <= old_capacity)
-               return;
-
-       if (da->capacity == 0)
-               da->capacity = 2;
-       while (capacity > da->capacity)
-               da->capacity *= 2;
-
-       new_data = (char *)sgen_alloc_internal_dynamic (elem_size * da->capacity, INTERNAL_MEM_BRIDGE_DATA, TRUE);
-       if (da->data) {
-               memcpy (new_data, da->data, elem_size * da->size);
-               sgen_free_internal_dynamic (da->data, elem_size * old_capacity, INTERNAL_MEM_BRIDGE_DATA);
-       }
-       da->data = new_data;
-}
-
-static void*
-dyn_array_add (DynArray *da, int elem_size)
-{
-       void *p;
-
-       dyn_array_ensure_capacity (da, da->size + 1, elem_size);
-
-       p = da->data + da->size * elem_size;
-       ++da->size;
-       return p;
-}
-
-/* ptr */
-
-static void
-dyn_array_ptr_uninit (DynPtrArray *da)
-{
-       dyn_array_uninit (&da->array, sizeof (void*));
-}
-
-static int
-dyn_array_ptr_size (DynPtrArray *da)
-{
-       return da->array.size;
-}
-
-static void
-dyn_array_ptr_set_size (DynPtrArray *da, int size)
-{
-       da->array.size = size;
-}
-
-static void*
-dyn_array_ptr_get (DynPtrArray *da, int x)
-{
-       return ((void**)da->array.data)[x];
-}
-
-static void
-dyn_array_ptr_add (DynPtrArray *da, void *ptr)
-{
-       void **p = (void **)dyn_array_add (&da->array, sizeof (void*));
-       *p = ptr;
-}
-
-#define dyn_array_ptr_push dyn_array_ptr_add
-
-static void*
-dyn_array_ptr_pop (DynPtrArray *da)
-{
-       void *p;
-       int size = da->array.size;
-       g_assert (size > 0);
-       p = dyn_array_ptr_get (da, size - 1);
-       --da->array.size;
-       return p;
-}
-
-static void
-dyn_array_ptr_ensure_capacity (DynPtrArray *da, int capacity)
-{
-       dyn_array_ensure_capacity (&da->array, capacity, sizeof (void*));
-}
-
-
-static void
-dyn_array_ptr_set_all (DynPtrArray *dst, DynPtrArray *src)
-{
-       if (src->array.size > 0) {
-               dyn_array_ptr_ensure_capacity (dst, src->array.size);
-               memcpy (dst->array.data, src->array.data, src->array.size * sizeof (void*));
-       }
-       dst->array.size = src->array.size;
-}
+/*
+ * See comments in sgen-bridge.h
+ *
+ * This bridge implementation is based on the tarjan algorithm for strongly
+ * connected components. It has two elements:
+ *
+ *   - Standard tarjan SCC algorithm to convert graph to SCC forest
+ *
+ *   - "Colors": We reduce the SCC forest to bridged-SCCs-only by using a
+ *     "color" algorithm devised by Kumpera. Consider the set of bridged SCCs
+ *     which is reachable from a given object. We call each such unique set a
+ *     "color". We compute the set of colors and which colors contain links to
+ *     which colors. The color graph then becomes the reduced SCC graph.
+ */
 
 static void
 enable_accounting (void)
@@ -152,6 +48,8 @@ enable_accounting (void)
        // 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
 class_kind (MonoClass *klass)
 {
@@ -182,9 +80,10 @@ class_kind (MonoClass *klass)
        return GC_BRIDGE_TRANSPARENT_CLASS;
 }
 
-//enable unsage logging
+//enable usage logging
 // #define DUMP_GRAPH 1
 
+// ScanData state
 enum {
        INITIAL,
        SCANNED,
@@ -197,30 +96,45 @@ Optimizations:
        We can split this data structure in two, those with bridges and those without
 */
 typedef struct {
+    // Colors (ColorDatas) linked to by objects with this color
        DynPtrArray other_colors;
+    // Bridge objects (GCObjects) held by objects with this color
        DynPtrArray bridges;
        int api_index    : 31;
        unsigned visited : 1;
 } ColorData;
 
-
-typedef struct {
-       GCObject *obj; //XXX this can be eliminated.
+// Represents one managed object. Equivalent of new/old bridge "HashEntry"
+typedef struct _ScanData {
+       // FIXME this can be eliminated; if we have a ScanData we generally looked it up from its GCObject
+       GCObject *obj;
+       // We use the sgen lock_word in GCObject to store a pointer to the ScanData. Cache the original here to restore later:
        mword lock_word;
 
        ColorData *color;
+       // Tarjan algorithm index (order visited)
        int index;
+       // Tarjan index of lowest-index object known reachable from here
        int low_index : 27;
 
+       // See "ScanData state" enum above
        unsigned state : 2;
        unsigned is_bridge : 1;
+       // Similar to lock_word, we use these bits in the GCObject as scratch space then restore them when done
        unsigned obj_state : 2;
 } ScanData;
 
 
 
+// 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,
+// and loop_stack is the stack structure used by the algorithm itself.
+static DynPtrArray scan_stack, loop_stack;
 
-static DynPtrArray scan_stack, loop_stack, registered_bridges;
+// GCObjects on which register_finalized_object has been called
+static DynPtrArray registered_bridges;
+
+// ColorData objects
 static DynPtrArray color_merge_array;
 
 static int ignored_objects;
@@ -299,6 +213,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
 typedef struct _ColorBucket ColorBucket;
 struct _ColorBucket {
        ColorBucket *next;
@@ -372,6 +287,8 @@ create_data (GCObject *obj)
        res->obj = obj;
        res->color = NULL;
        res->index = res->low_index = -1;
+       res->state = INITIAL;
+       res->is_bridge = FALSE;
        res->obj_state = o [0] & SGEN_VTABLE_BITS_MASK;
        res->lock_word = o [1];
 
@@ -574,6 +491,7 @@ is_opaque_object (GCObject *obj)
        return FALSE;
 }
 
+// Called during DFS; visits one child. If it is a candidate to be scanned, pushes it to the stacks.
 static void
 push_object (GCObject *obj)
 {
@@ -627,6 +545,7 @@ push_object (GCObject *obj)
                if (dst) push_object (dst);                     \
        } while (0)
 
+// dfs () function's queue-children-of-object operation.
 static void
 push_all (ScanData *data)
 {
@@ -635,7 +554,7 @@ push_all (ScanData *data)
        mword desc = sgen_obj_get_descriptor_safe (obj);
 
 #if DUMP_GRAPH
-       printf ("**scanning %p %s\n", obj, safe_name_bridge (obj));
+       printf ("+scanning %s (%p) index %d color %p\n", safe_name_bridge (data->obj), data->obj, data->index, data->color);
 #endif
 
        #include "sgen/sgen-scan-object.h"
@@ -647,8 +566,8 @@ compute_low_index (ScanData *data, GCObject *obj)
 {
        ScanData *other;
        ColorData *cd;
-       obj = bridge_object_forward (obj);
 
+       obj = bridge_object_forward (obj);
        other = find_data (obj);
 
 #if DUMP_GRAPH
@@ -723,12 +642,12 @@ create_scc (ScanData *data)
 #if DUMP_GRAPH
        printf ("|SCC rooted in %s (%p) has bridge %d\n", safe_name_bridge (data->obj), data->obj, found_bridge);
        printf ("\tpoints-to-colors: ");
-       for (i = 0; i < dyn_array_ptr_size (&color_merge_array); ++i)
+       for (int i = 0; i < dyn_array_ptr_size (&color_merge_array); ++i)
                printf ("%p ", dyn_array_ptr_get (&color_merge_array, i));
        printf ("\n");
 
        printf ("loop stack: ");
-       for (i = 0; i < dyn_array_ptr_size (&loop_stack); ++i) {
+       for (int i = 0; i < dyn_array_ptr_size (&loop_stack); ++i) {
                ScanData *other = dyn_array_ptr_get (&loop_stack, i);
                printf ("(%d/%d)", other->index, other->low_index);
        }
@@ -775,7 +694,7 @@ create_scc (ScanData *data)
                g_assert (cd->visited);
                cd->visited = FALSE;
        }
-       dyn_array_ptr_set_size (&color_merge_array, 0);
+       dyn_array_ptr_empty (&color_merge_array);
        found_bridge = FALSE;
 }
 
@@ -785,7 +704,7 @@ dfs (void)
        g_assert (dyn_array_ptr_size (&scan_stack) == 1);
        g_assert (dyn_array_ptr_size (&loop_stack) == 0);
 
-       dyn_array_ptr_set_size (&color_merge_array, 0);
+       dyn_array_ptr_empty (&color_merge_array);
 
        while (dyn_array_ptr_size (&scan_stack) > 0) {
                ScanData *data = (ScanData *)dyn_array_ptr_pop (&scan_stack);
@@ -852,15 +771,15 @@ register_finalized_object (GCObject *obj)
 static void
 reset_data (void)
 {
-       dyn_array_ptr_set_size (&registered_bridges, 0);
+       dyn_array_ptr_empty (&registered_bridges);
 }
 
 static void
 cleanup (void)
 {
-       dyn_array_ptr_set_size (&scan_stack, 0);
-       dyn_array_ptr_set_size (&loop_stack, 0);
-       dyn_array_ptr_set_size (&registered_bridges, 0);
+       dyn_array_ptr_empty (&scan_stack);
+       dyn_array_ptr_empty (&loop_stack);
+       dyn_array_ptr_empty (&registered_bridges);
        free_object_buckets ();
        free_color_buckets ();
        reset_cache ();
@@ -951,7 +870,7 @@ processing_stw_step (void)
 #if defined (DUMP_GRAPH)
        printf ("----summary----\n");
        printf ("bridges:\n");
-       for (i = 0; i < bridge_count; ++i) {
+       for (int i = 0; i < bridge_count; ++i) {
                ScanData *sd = find_data (dyn_array_ptr_get (&registered_bridges, i));
                printf ("\t%s (%p) index %d color %p\n", safe_name_bridge (sd->obj), sd->obj, sd->index, sd->color);
        }
@@ -1049,7 +968,7 @@ processing_build_callback_data (int generation)
                        if (!bridges)
                                continue;
 
-                       dyn_array_ptr_set_size (&color_merge_array, 0);
+                       dyn_array_ptr_empty (&color_merge_array);
                        gather_xrefs (cd);
                        reset_xrefs (cd);
                        dyn_array_ptr_set_all (&cd->other_colors, &color_merge_array);
@@ -1089,7 +1008,7 @@ processing_build_callback_data (int generation)
 
 #if defined (DUMP_GRAPH)
        printf ("---xrefs:\n");
-       for (i = 0; i < xref_count; ++i)
+       for (int i = 0; i < xref_count; ++i)
                printf ("\t%d -> %d\n", api_xrefs [i].src_scc_index, api_xrefs [i].dst_scc_index);
 #endif
 
index 95bac2301bd8b5f9d0dc20e5adb70b777ebf1faf..aaef8f6422a9e5fce06a7565c9912321cc17dd51 100644 (file)
@@ -62,6 +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 <time.h>
 #ifdef HAVE_SYS_TIME_H
index 462fa98df8143115552eeb48bc32c6e21813a529..2bc99e105b9cca5e57845d28d8ff21e3a68a305d 100644 (file)
@@ -84,7 +84,9 @@ epoll_event_wait (void (*callback) (gint fd, gint events, gpointer user_data), g
 
        mono_gc_set_skip_thread (TRUE);
 
+       MONO_ENTER_GC_SAFE;
        ready = epoll_wait (epoll_fd, epoll_events, EPOLL_NEVENTS, -1);
+       MONO_EXIT_GC_SAFE;
 
        mono_gc_set_skip_thread (FALSE);
 
index e162c3cc9be24eec2bc8dfe1558449bedb9ac314..4422b668e8f61c7c2d2a630e1b1cb702dfb5fd56 100644 (file)
@@ -81,7 +81,9 @@ kqueue_event_wait (void (*callback) (gint fd, gint events, gpointer user_data),
 
        mono_gc_set_skip_thread (TRUE);
 
+       MONO_ENTER_GC_SAFE;
        ready = kevent (kqueue_fd, NULL, 0, kqueue_events, KQUEUE_NEVENTS, NULL);
+       MONO_EXIT_GC_SAFE;
 
        mono_gc_set_skip_thread (FALSE);
 
index 4d4cceb090269f97b4f53ecad27601c128da93a6..68e6611fba2619ee83cb65ea78cf16c249549c37 100644 (file)
@@ -143,7 +143,9 @@ poll_event_wait (void (*callback) (gint fd, gint events, gpointer user_data), gp
 
        mono_gc_set_skip_thread (TRUE);
 
+       MONO_ENTER_GC_SAFE;
        ready = mono_poll (poll_fds, poll_fds_size, -1);
+       MONO_EXIT_GC_SAFE;
 
        mono_gc_set_skip_thread (FALSE);
 
index b78ca83b28551282d59395dba3d132807871f8c8..7cdaf5be6842228814efe36fa9922ba81fbe4ea5 100644 (file)
@@ -565,7 +565,7 @@ ves_icall_System_IOSelector_Add (gpointer handle, MonoIOSelectorJob *job)
 {
        ThreadPoolIOUpdate *update;
 
-       g_assert (handle >= 0);
+       g_assert (handle);
 
        g_assert ((job->operation == EVENT_IN) ^ (job->operation == EVENT_OUT));
        g_assert (job->callback);
index 1f4a6cc605237a36e6f13c3a28acc3c229086dff..c15d5be8ad134fdac250e1280362368eb263f58e 100644 (file)
@@ -476,7 +476,7 @@ domain_get_next (ThreadPoolDomain *current)
                                        break;
                                }
                        }
-                       g_assert (current_idx >= 0);
+                       g_assert (current_idx != (guint)-1);
                }
                for (i = current_idx + 1; i < len + current_idx + 1; ++i) {
                        ThreadPoolDomain *tmp = (ThreadPoolDomain *)g_ptr_array_index (threadpool->domains, i % len);
@@ -635,6 +635,9 @@ worker_thread (gpointer data)
                        if (retire)
                                retire = FALSE;
 
+                       /* The tpdomain->domain might have unloaded, while this thread was parked */
+                       previous_tpdomain = NULL;
+
                        continue;
                }
 
index 8ecabdb0e0becc4aa7c2748ce5ea3ab85240d6d2..5b910191f6c4ff0adba5cc680d20d653d034cfb4 100644 (file)
@@ -42,21 +42,12 @@ typedef enum {
        ThreadApartmentState_Unknown = 0x00000002
 } MonoThreadApartmentState;
 
-typedef enum {
-       ThreadPriority_Lowest = 0,
-       ThreadPriority_BelowNormal = 1,
-       ThreadPriority_Normal = 2,
-       ThreadPriority_AboveNormal = 3,
-       ThreadPriority_Highest = 4
-} MonoThreadPriority;
-
 #define SPECIAL_STATIC_NONE 0
 #define SPECIAL_STATIC_THREAD 1
 #define SPECIAL_STATIC_CONTEXT 2
 
 #ifdef HOST_WIN32
 typedef SECURITY_ATTRIBUTES WapiSecurityAttributes;
-typedef LPTHREAD_START_ROUTINE WapiThreadStart;
 #endif
 
 typedef struct _MonoInternalThread MonoInternalThread;
index b4f3f09159770eda404b8011b8fb8c3f1d7ebdb4..8ae79d05d99dfdc68bbe473398d18d8c9e377775 100644 (file)
@@ -386,6 +386,18 @@ unlock_thread (MonoInternalThread *thread)
        mono_coop_mutex_unlock (thread->synch_cs);
 }
 
+static inline gboolean
+is_appdomainunloaded_exception (MonoClass *klass)
+{
+       return klass == mono_class_get_appdomain_unloaded_exception_class ();
+}
+
+static inline gboolean
+is_threadabort_exception (MonoClass *klass)
+{
+       return klass == mono_defaults.threadabortexception_class;
+}
+
 /*
  * NOTE: this function can be called also for threads different from the current one:
  * make sure no code called from it will ever assume it is run on the thread that is
@@ -591,7 +603,7 @@ new_thread_with_internal (MonoDomain *domain, MonoInternalThread *internal)
        MonoThread *thread;
 
        thread = create_thread_object (domain);
-       thread->priority = THREAD_PRIORITY_NORMAL;
+       thread->priority = MONO_THREAD_PRIORITY_NORMAL;
 
        MONO_OBJECT_SETREF (thread, internal_thread, internal);
 
@@ -745,7 +757,21 @@ static guint32 WINAPI start_wrapper_internal(void *data)
                args [0] = start_arg;
                /* we may want to handle the exception here. See comment below on unhandled exceptions */
                mono_runtime_delegate_invoke_checked (start_delegate, args, &error);
-               mono_error_raise_exception (&error); /* OK, triggers unhandled exn handler */
+
+               if (!mono_error_ok (&error)) {
+                       MonoException *ex = mono_error_convert_to_exception (&error);
+
+                       g_assert (ex != NULL);
+                       MonoClass *klass = mono_object_get_class (&ex->object);
+                       if ((mono_runtime_unhandled_exception_policy_get () != MONO_UNHANDLED_POLICY_LEGACY) &&
+                           !is_threadabort_exception (klass)) {
+                               mono_unhandled_exception (&ex->object);
+                               mono_invoke_unhandled_exception_hook (&ex->object);
+                               g_assert_not_reached ();
+                       }
+               } else {
+                       mono_error_cleanup (&error);
+               }
        }
 
        /* If the thread calls ExitThread at all, this remaining code
@@ -779,7 +805,7 @@ static guint32 WINAPI start_wrapper_internal(void *data)
        return(0);
 }
 
-static guint32 WINAPI start_wrapper(void *data)
+static gsize WINAPI start_wrapper(void *data)
 {
        volatile int dummy;
 
@@ -844,7 +870,7 @@ create_thread (MonoThread *thread, MonoInternalThread *internal, StartInfo *star
        tp.stack_size = stack_size;
        tp.creation_flags = CREATE_SUSPENDED;
 
-       thread_handle = mono_threads_create_thread ((LPTHREAD_START_ROUTINE)start_wrapper, start_info, &tp, &tid);
+       thread_handle = mono_threads_create_thread (start_wrapper, start_info, &tp, &tid);
 
        if (thread_handle == NULL) {
                /* The thread couldn't be created, so set an exception */
@@ -930,6 +956,7 @@ mono_thread_create_internal (MonoDomain *domain, gpointer func, gpointer arg, gb
        mono_error_init (error);
 
        thread = create_thread_object (domain);
+       thread->priority = MONO_THREAD_PRIORITY_NORMAL;
 
        internal = create_internal_thread ();
 
@@ -1102,7 +1129,7 @@ mono_thread_detach_if_exiting (void)
 }
 
 void
-mono_thread_exit ()
+mono_thread_exit (void)
 {
        MonoInternalThread *thread = mono_thread_internal_current ();
 
@@ -1422,9 +1449,9 @@ ves_icall_System_Threading_Thread_GetPriority (MonoThread *this_obj)
 
        LOCK_THREAD (internal);
        if (internal->handle != NULL)
-               priority = GetThreadPriority (internal->handle) + 2;
+               priority = mono_thread_info_get_priority ((MonoThreadInfo*) internal->thread_info);
        else
-               priority = this_obj->priority + 2;
+               priority = this_obj->priority;
        UNLOCK_THREAD (internal);
        return priority;
 }
@@ -1442,9 +1469,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 - 2;
+       this_obj->priority = priority;
        if (internal->handle != NULL)
-               SetThreadPriority (internal->handle, this_obj->priority);
+               mono_thread_info_set_priority ((MonoThreadInfo*) internal->thread_info, this_obj->priority);
        UNLOCK_THREAD (internal);
 }
 
@@ -2915,17 +2942,14 @@ void mono_thread_init (MonoThreadStartCB start_cb,
 
 void mono_thread_cleanup (void)
 {
-#if !defined(HOST_WIN32) && !defined(RUN_IN_SUBTHREAD)
-       MonoThreadInfo *info;
-
+#if !defined(RUN_IN_SUBTHREAD)
        /* 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.
         */
-       info = mono_thread_info_current ();
-       wapi_thread_handle_set_exited (info->handle, mono_environment_exitcode_get ());
+       mono_thread_info_set_exited (mono_thread_info_current ());
 #endif
 
 #if 0
@@ -3157,7 +3181,7 @@ remove_and_abort_threads (gpointer key, gpointer value, gpointer user)
                wait->num++;
 
                THREAD_DEBUG (g_print ("%s: Aborting id: %"G_GSIZE_FORMAT"\n", __func__, (gsize)thread->tid));
-               mono_thread_internal_stop (thread);
+               mono_thread_internal_abort (thread);
                return TRUE;
        }
 
@@ -3456,11 +3480,9 @@ get_thread_dump (MonoThreadInfo *info, gpointer ud)
 
 #if 0
 /* This no longer works with remote unwinding */
-#ifndef HOST_WIN32
-       wapi_desc = wapi_current_thread_desc ();
-       g_string_append_printf (text, " tid=0x%p this=0x%p %s\n", (gpointer)(gsize)thread->tid, thread,  wapi_desc);
-       free (wapi_desc);
-#endif
+       g_string_append_printf (text, " tid=0x%p this=0x%p ", (gpointer)(gsize)thread->tid, thread);
+       mono_thread_info_describe (info, text);
+       g_string_append (text, "\n");
 #endif
 
        if (thread == mono_thread_internal_current ())
@@ -4540,7 +4562,7 @@ mono_thread_resume_interruption (void)
                return NULL;
 
        LOCK_THREAD (thread);
-       still_aborting = (thread->state & ThreadState_AbortRequested) != 0;
+       still_aborting = (thread->state & (ThreadState_AbortRequested|ThreadState_StopRequested)) != 0;
        UNLOCK_THREAD (thread);
 
        /*This can happen if the protected block called Thread::ResetAbort*/
@@ -5040,18 +5062,6 @@ mono_thread_internal_check_for_interruption_critical (MonoInternalThread *thread
                mono_thread_interruption_checkpoint ();
 }
 
-static inline gboolean
-is_appdomainunloaded_exception (MonoClass *klass)
-{
-       return klass == mono_class_get_appdomain_unloaded_exception_class ();
-}
-
-static inline gboolean
-is_threadabort_exception (MonoClass *klass)
-{
-       return klass == mono_defaults.threadabortexception_class;
-}
-
 void
 mono_thread_internal_unhandled_exception (MonoObject* exc)
 {
@@ -5061,8 +5071,11 @@ mono_thread_internal_unhandled_exception (MonoObject* exc)
                        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)
-                               exit (255);
+                       if (mono_environment_exitcode_get () == 1) {
+                               mono_environment_exitcode_set (255);
+                               mono_invoke_unhandled_exception_hook (exc);
+                               g_assert_not_reached ();
+                       }
                }
        }
 }
index c3da0227e3c78f729968ffa1e9c4391a47a84e51..09b76d4a128204dd9f34f314c3d4514c5ded671b 100644 (file)
@@ -2768,7 +2768,7 @@ verify_delegate_compatibility (VerifyContext *ctx, MonoClass *delegate, ILStackD
                        CODE_NOT_VERIFIABLE (ctx, g_strdup_printf ("This object not compatible with function pointer for delegate creation at 0x%04x", ctx->ip_offset));
        } else {
                if (method->flags & METHOD_ATTRIBUTE_STATIC) {
-                       if (!stack_slot_is_null_literal (value) && !is_first_arg_bound)
+                       if (!stack_slot_is_null_literal (value))
                                CODE_NOT_VERIFIABLE (ctx, g_strdup_printf ("Non-null this args used with static function for delegate creation at 0x%04x", ctx->ip_offset));
                } else {
                        if (!verify_stack_type_compatibility_full (ctx, &method->klass->byval_arg, value, FALSE, TRUE) && !stack_slot_is_null_literal (value))
index 72ca453eb88436fc1b4c71764ef571566c8abe66..fc2c8954426a32bdba980bdc7f203c66bb8bc205 100644 (file)
@@ -17,8 +17,6 @@ WRAPPER(XDOMAIN_INVOKE, "xdomain-invoke")
 WRAPPER(XDOMAIN_DISPATCH, "xdomain-dispatch")
 WRAPPER(LDFLD, "ldfld")
 WRAPPER(STFLD, "stfld")
-WRAPPER(LDFLD_REMOTE, "ldfld-remote")
-WRAPPER(STFLD_REMOTE, "stfld-remote")
 WRAPPER(SYNCHRONIZED, "synchronized")
 WRAPPER(DYNAMIC_METHOD, "dynamic-method")
 WRAPPER(ISINST, "isinst")
index 59422581b173255cb7f8eb001581972d47b9294b..e3983f69e2b4f769154a6b7cac805abfe91e71bb 100755 (executable)
@@ -486,12 +486,24 @@ test_sources =                    \
        gc-test.cs \
        gshared.cs
 
-regtests=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
+
+if INSTALL_MOBILE_STATIC
+regtests= \
+       $(regtests_UNIVERSAL)
+
 if NACL_CODEGEN
 test_sources += nacl.cs
 regtests += nacl.exe
 endif
 
+else
+regtests= \
+       $(regtests_UNIVERSAL) \
+       $(regtests_MOBILE_STATIC_BLACKLIST)
+endif
+
 if X86
 arch_sources = $(x86_sources)
 arch_built=cpu-x86.h
@@ -583,12 +595,12 @@ libmini_la_CFLAGS = $(mono_CFLAGS)
 libmonoboehm_2_0_la_SOURCES =
 libmonoboehm_2_0_la_CFLAGS = $(mono_boehm_CFLAGS)
 libmonoboehm_2_0_la_LIBADD = libmini.la $(boehm_libs) $(LIBMONO_DTRACE_OBJECT) $(LLVMMONOF)
-libmonoboehm_2_0_la_LDFLAGS = $(libmonoldflags)
+libmonoboehm_2_0_la_LDFLAGS = $(libmonoldflags) $(monobin_platform_ldflags)
 
 libmonosgen_2_0_la_SOURCES =
 libmonosgen_2_0_la_CFLAGS = $(mono_sgen_CFLAGS)
 libmonosgen_2_0_la_LIBADD = libmini.la $(sgen_libs) $(LIBMONO_DTRACE_OBJECT) $(LLVMMONOF)
-libmonosgen_2_0_la_LDFLAGS = $(libmonoldflags)
+libmonosgen_2_0_la_LDFLAGS = $(libmonoldflags) $(monobin_platform_ldflags)
 
 #
 # This library is shared between mono and mono-sgen, since the code in mini/ doesn't contain
@@ -620,8 +632,8 @@ generics.exe: generics.cs TestDriver.dll generics-variant-types.dll
 %.exe: %.il
        $(ILASM) -output=$@ $<
 
-TestDriver.dll: $(srcdir)/TestDriver.cs
-       $(MCS) -out:$@ -target:library $<
+TestDriver.dll: $(srcdir)/TestDriver.cs $(srcdir)/TestHelpers.cs
+       $(MCS) -out:$@ -target:library $^
 
 generics-variant-types.dll: generics-variant-types.il
        $(ILASM) -dll -output=$@ $<
@@ -683,15 +695,11 @@ testi: mono test.exe
 checktests: $(regtests)
        for i in $(regtests); do $(MINI_RUNTIME) $$i; done
 
-rcheck: mono $(regtests)
-if NACL_CODEGEN
-       for i in $(regtests); do echo "running test $$i"; $(MINI_RUNTIME) $$i --exclude 'NaClDisable' || exit 1; done
-else
+rcheck-nunit: mono $(regtests)
        -($(MINI_RUNTIME) --regression $(regtests); echo $$? > regressionexitcode.out) | $(srcdir)/emitnunit.pl
        exit $$(cat regressionexitcode.out)
-endif
 
-rcheck2: mono $(regtests)
+rcheck: mono $(regtests)
        $(MINI_RUNTIME) --regression $(regtests)
 
 if ARM
@@ -724,26 +732,43 @@ gsharedvtcheck:
 
 fullaot_regtests = $(regtests) aot-tests.exe $(if $(GSHAREDVT),gshared.exe)
 
-FULLAOT_LIBS = \
+# Skip aoting the tests that aren't compiled 
+# on the mobile_static profile because they're skipped
+# on mobile profiles
+FULLAOT_LIBS_MOBILE_STATIC_BLACKLIST = \
+       Mono.Posix.dll \
+       System.Configuration.dll
+
+FULLAOT_LIBS_UNIVERSAL = \
        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
+       System.Security.dll \
+       Mono.Simd.dll \
+       Mono.Security.dll
+
+if INSTALL_MOBILE_STATIC
+FULLAOT_LIBS= \
+       Mono.Dynamic.Interpreter.dll \
+       $(FULLAOT_LIBS_UNIVERSAL)
+else
+FULLAOT_LIBS= \
+       $(FULLAOT_LIBS_UNIVERSAL) \
+       $(FULLAOT_LIBS_MOBILE_STATIC_BLACKLIST)
+endif
+
+FULLAOT_TMP_DIR=$(top_builddir)/mono/mini/fullaot-tmp
 
 # This currently only works on amd64/arm
 fullaotcheck: $(mono) $(fullaot_regtests)
-       rm -rf fullaot-tmp
-       mkdir fullaot-tmp
-       $(MAKE) fullaot-libs AOT_FLAGS="full,$(MONO_FULLAOT_ADDITIONAL_ARGS)" GSHAREDVT=$(GSHAREDVT)
-       cp $(regtests) $(fullaot_regtests) generics-variant-types.dll TestDriver.dll fullaot-tmp/
-       MONO_PATH=fullaot-tmp $(top_builddir)/runtime/mono-wrapper $(LLVM_AOT_RUNTIME_OPTS) $(GSHAREDVT_RUNTIME_OPTS) --aot="full,$(MONO_FULLAOT_ADDITIONAL_ARGS)" fullaot-tmp/{generics-variant-types.dll,TestDriver.dll,*.exe} || exit 1
-       ln -s $(if $(MONO_EXECUTABLE),$(MONO_EXECUTABLE),$$PWD/mono) fullaot-tmp/
-       for i in $(fullaot_regtests); do echo $$i; MONO_PATH=fullaot-tmp $(top_builddir)/runtime/mono-wrapper --full-aot fullaot-tmp/$$i --exclude '!FULLAOT' $(ARCH_FULLAOT_EXCLUDE) || exit 1; done
+       rm -rf $(FULLAOT_TMP_DIR)
+       mkdir $(FULLAOT_TMP_DIR)
+       $(MAKE) fullaot-libs AOT_FLAGS="full,$(MONO_FULLAOT_ADDITIONAL_ARGS)$(INVARIANT_AOT_OPTIONS)" GSHAREDVT=$(GSHAREDVT)
+       cp $(regtests) $(fullaot_regtests) generics-variant-types.dll TestDriver.dll $(FULLAOT_TMP_DIR)/
+       MONO_PATH=$(FULLAOT_TMP_DIR) $(top_builddir)/runtime/mono-wrapper $(LLVM_AOT_RUNTIME_OPTS) $(GSHAREDVT_RUNTIME_OPTS) --aot="full,$(MONO_FULLAOT_ADDITIONAL_ARGS)$(INVARIANT_AOT_OPTIONS)" $(FULLAOT_TMP_DIR)/{generics-variant-types.dll,TestDriver.dll,*.exe} || exit 1
+       ln -s $(if $(MONO_EXECUTABLE),$(MONO_EXECUTABLE),$$PWD/mono) $(FULLAOT_TMP_DIR)/
+       for i in $(fullaot_regtests); do echo $$i; MONO_PATH=$(FULLAOT_TMP_DIR) $(top_builddir)/runtime/mono-wrapper --full-aot $(FULLAOT_TMP_DIR)/$$i --exclude '!FULLAOT' $(ARCH_FULLAOT_EXCLUDE) || exit 1; done
 
 # This can run in parallel
 fullaot-libs: $(patsubst %,fullaot-tmp/%.dylib,$(FULLAOT_LIBS))
@@ -762,7 +787,7 @@ llvmonly_regtests = $(fullaot_regtests) gshared.exe
 llvmonlycheck: mono $(llvmonly_regtests)
        rm -rf fullaot-tmp
        mkdir fullaot-tmp
-       $(MAKE) fullaot-libs AOT_FLAGS="llvmonly,$(MONO_FULLAOT_ADDITIONAL_ARGS)"
+       $(MAKE) fullaot-libs AOT_FLAGS="llvmonly,$(MONO_FULLAOT_ADDITIONAL_ARGS)$(INVARIANT_AOT_OPTIONS)"
        cp $(llvmonly_regtests) generics-variant-types.dll TestDriver.dll fullaot-tmp/
        MONO_PATH=fullaot-tmp $(top_builddir)/runtime/mono-wrapper  --aot=llvmonly fullaot-tmp/{generics-variant-types.dll,TestDriver.dll,*.exe} || exit 1
        ln -s $$PWD/mono fullaot-tmp/
@@ -792,7 +817,10 @@ stat3: mono bench.exe
 docu: mini.sgm
        docbook2txt mini.sgm
 
-check-local: rcheck check-seq-points
+# We need these because automake can't process normal make conditionals
+check_local_targets = $(if $(EMIT_NUNIT), rcheck-nunit, rcheck)
+
+check-local: $(check_local_targets)
 
 clean-local:
        rm -f mono a.out gmon.out *.o buildver-boehm.h buildver-sgen.h test.exe regressionexitcode.out TestResult-op_il_seq_point.xml*
@@ -803,6 +831,7 @@ BUILT_SOURCES = version.h $(arch_built)
 
 CLEANFILES= $(BUILT_SOURCES) *.exe *.dll
 EXTRA_DIST = TestDriver.cs \
+       TestHelpers.cs \
        genmdesc.pl                             \
        emitnunit.pl                    \
        $(test_sources)                         \
diff --git a/mono/mini/TestHelpers.cs b/mono/mini/TestHelpers.cs
new file mode 100644 (file)
index 0000000..01ed135
--- /dev/null
@@ -0,0 +1,29 @@
+using System;
+using System.Threading;
+
+namespace MonoTests.Helpers {
+
+       public static class FinalizerHelpers {
+               private static IntPtr aptr;
+
+               private static unsafe void NoPinActionHelper (int depth, Action act)
+               {
+                       // Avoid tail calls
+                       int* values = stackalloc int [20];
+                       aptr = new IntPtr (values);
+
+                       if (depth <= 0)
+                               act ();
+                       else
+                               NoPinActionHelper (depth - 1, act);
+               }
+
+               public static void PerformNoPinAction (Action act)
+               {
+                       Thread thr = new Thread (() => NoPinActionHelper (1024, act));
+                       thr.Start ();
+                       thr.Join ();
+               }
+       }
+}
+
index f40070aeb38b9f2212c5f674aa1f346923938158..ebab8ae4b25519a818acf6fc04a10b53de9004c8 100644 (file)
@@ -226,7 +226,7 @@ handle_instruction:
                                        }
                                }
                                break;
-
+                       //FIXME missing storei1_membase_imm and storei2_membase_imm
                        case OP_STORE_MEMBASE_IMM:
                        case OP_STOREI4_MEMBASE_IMM:
                        case OP_STOREI8_MEMBASE_IMM:
index b08afe7504316ae74cd361e399026d319dea174c..dba952c9ff1763d8926082130c5f10e4827e0a0e 100644 (file)
@@ -51,6 +51,7 @@
 #include <mono/utils/mono-compiler.h>
 #include <mono/utils/mono-time.h>
 #include <mono/utils/mono-mmap.h>
+#include <mono/utils/mono-rand.h>
 #include <mono/utils/json.h>
 #include <mono/utils/mono-threads-coop.h>
 
@@ -113,8 +114,8 @@ typedef struct MonoAotOptions {
        gboolean soft_debug;
        gboolean log_generics;
        gboolean log_instances;
-       gboolean gen_seq_points_file;
-       char *gen_seq_points_file_path;
+       gboolean gen_msym_dir;
+       char *gen_msym_dir_path;
        gboolean direct_pinvoke;
        gboolean direct_icalls;
        gboolean no_direct_calls;
@@ -902,7 +903,10 @@ arch_init (MonoAotCompile *acfg)
        if (acfg->aot_opts.mtriple && strstr (acfg->aot_opts.mtriple, "darwin")) {
                g_string_append (acfg->llc_args, "-mattr=+v6");
        } else {
-#ifdef ARM_FPU_VFP
+#if defined(ARM_FPU_VFP_HARD)
+               g_string_append (acfg->llc_args, " -mattr=+vfp2,-neon,+d16 -float-abi=hard");
+               g_string_append (acfg->as_args, " -mfpu=vfp3");
+#elif defined(ARM_FPU_VFP)
                g_string_append (acfg->llc_args, " -mattr=+vfp2,-neon,+d16");
                g_string_append (acfg->as_args, " -mfpu=vfp3");
 #else
@@ -3100,9 +3104,6 @@ encode_method_ref (MonoAotCompile *acfg, MonoMethod *method, guint8 *buf, guint8
                        encode_klass_ref (acfg, info->d.proxy.klass, p, &p);
                        break;
                }
-               case MONO_WRAPPER_LDFLD_REMOTE:
-               case MONO_WRAPPER_STFLD_REMOTE:
-                       break;
                case MONO_WRAPPER_ALLOC: {
                        /* The GC name is saved once in MonoAotFileInfo */
                        g_assert (info->d.alloc.alloc_type != -1);
@@ -3586,7 +3587,9 @@ get_runtime_invoke_sig (MonoMethodSignature *sig)
 
        mb = mono_mb_new (mono_defaults.object_class, "FOO", MONO_WRAPPER_NONE);
        m = mono_mb_create_method (mb, sig, 16);
-       return mono_marshal_get_runtime_invoke (m, FALSE);
+       MonoMethod *invoke = mono_marshal_get_runtime_invoke (m, FALSE);
+       mono_mb_free (mb);
+       return invoke;
 }
 
 static MonoMethod*
@@ -4058,7 +4061,7 @@ add_wrappers (MonoAotCompile *acfg)
                        continue;
                }
 
-               if (!acfg->aot_opts.llvm_only && klass->rank && MONO_TYPE_IS_PRIMITIVE (&klass->element_class->byval_arg)) {
+               if (klass->rank && MONO_TYPE_IS_PRIMITIVE (&klass->element_class->byval_arg)) {
                        MonoMethod *m, *wrapper;
 
                        /* Add runtime-invoke wrappers too */
@@ -4067,13 +4070,15 @@ add_wrappers (MonoAotCompile *acfg)
                        g_assert (m);
                        wrapper = mono_marshal_get_array_accessor_wrapper (m);
                        add_extra_method (acfg, wrapper);
-                       add_extra_method (acfg, get_runtime_invoke (acfg, wrapper, FALSE));
+                       if (!acfg->aot_opts.llvm_only)
+                               add_extra_method (acfg, get_runtime_invoke (acfg, wrapper, FALSE));
 
                        m = mono_class_get_method_from_name (klass, "Set", -1);
                        g_assert (m);
                        wrapper = mono_marshal_get_array_accessor_wrapper (m);
                        add_extra_method (acfg, wrapper);
-                       add_extra_method (acfg, get_runtime_invoke (acfg, wrapper, FALSE));
+                       if (!acfg->aot_opts.llvm_only)
+                               add_extra_method (acfg, get_runtime_invoke (acfg, wrapper, FALSE));
                }
        }
 
@@ -4232,6 +4237,7 @@ add_wrappers (MonoAotCompile *acfg)
                                if (export_name)
                                        g_hash_table_insert (acfg->export_names, wrapper, export_name);
                        }
+                       g_free (cattr);
                }
 
                if ((method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL) ||
@@ -4656,9 +4662,11 @@ add_types_from_method_header (MonoAotCompile *acfg, MonoMethod *method)
                for (j = 0; j < header->num_locals; ++j)
                        if (header->locals [j]->type == MONO_TYPE_GENERICINST)
                                add_generic_class_with_depth (acfg, mono_class_from_mono_type (header->locals [j]), depth + 1, "local");
+               mono_metadata_free_mh (header);
        } else {
                mono_error_cleanup (&error); /* FIXME report the error */
        }
+
 }
 
 /*
@@ -4943,7 +4951,7 @@ add_generic_instances (MonoAotCompile *acfg)
                }
 
                /* object[] accessor wrappers. */
-               for (i = 1; i < 3; ++i) {
+               for (i = 1; i < 4; ++i) {
                        MonoClass *obj_array_class = mono_array_class_get (mono_defaults.object_class, i);
                        MonoMethod *m;
 
@@ -5394,6 +5402,7 @@ emit_and_reloc_code (MonoAotCompile *acfg, MonoMethod *method, guint8 *code, gui
                }
        }
 
+       g_ptr_array_free (patches, TRUE);
        g_free (locs);
 }
 
@@ -5889,6 +5898,8 @@ emit_method_info (MonoAotCompile *acfg, MonoCompile *cfg)
 
        encode_patch_list (acfg, patches, n_patches, cfg->compile_llvm, first_got_offset, p, &p);
 
+       g_ptr_array_free (patches, TRUE);
+
        acfg->stats.info_size += p - buf;
 
        g_assert (p - buf < buf_size);
@@ -5975,6 +5986,8 @@ emit_exception_debug_info (MonoAotCompile *acfg, MonoCompile *cfg, gboolean stor
 
                unwind_desc = get_unwind_info_offset (acfg, encoded, encoded_len);
                encode_value (unwind_desc, p, &p);
+
+               g_free (encoded);
        } else {
                encode_value (jinfo->unwind_info, p, &p);
        }
@@ -6513,6 +6526,7 @@ emit_trampoline_full (MonoAotCompile *acfg, int got_offset, MonoTrampInfo *info,
 
        encode_patch_list (acfg, patches, patches->len, FALSE, got_offset, p, &p);
        g_assert (p - buf < buf_size);
+       g_ptr_array_free (patches, TRUE);
 
        sprintf (symbol, "%s%s_p", acfg->user_symbol_prefix, name);
 
@@ -6550,6 +6564,8 @@ emit_trampoline_full (MonoAotCompile *acfg, int got_offset, MonoTrampInfo *info,
                if (acfg->dwarf)
                        mono_dwarf_writer_emit_trampoline (acfg->dwarf, symbol, symbol2, NULL, NULL, code_size, unwind_ops);
        }
+
+       g_free (buf);
 }
 
 static G_GNUC_UNUSED void
@@ -6649,10 +6665,12 @@ emit_trampolines (MonoAotCompile *acfg)
                        offset = MONO_RGCTX_SLOT_MAKE_RGCTX (i);
                        mono_arch_create_rgctx_lazy_fetch_trampoline (offset, &info, TRUE);
                        emit_trampoline (acfg, acfg->got_offset, info);
+                       g_free (info);
 
                        offset = MONO_RGCTX_SLOT_MAKE_MRGCTX (i);
                        mono_arch_create_rgctx_lazy_fetch_trampoline (offset, &info, TRUE);
                        emit_trampoline (acfg, acfg->got_offset, info);
+                       g_free (info);
                }
 
 #ifdef MONO_ARCH_HAVE_GENERAL_RGCTX_LAZY_FETCH_TRAMPOLINE
@@ -6673,6 +6691,11 @@ emit_trampolines (MonoAotCompile *acfg)
                        }
                }
 
+#ifdef MONO_ARCH_HAVE_HANDLER_BLOCK_GUARD_AOT
+               mono_arch_create_handler_block_trampoline (&info, TRUE);
+               emit_trampoline (acfg, acfg->got_offset, info);
+#endif
+
 #endif /* #ifdef MONO_ARCH_HAVE_FULL_AOT_TRAMPOLINES */
 
                /* Emit trampolines which are numerous */
@@ -7046,12 +7069,13 @@ mono_aot_parse_options (const char *aot_options, MonoAotOptions *opts)
                } else if (str_begins_with (arg, "soft-debug")) {
                        opts->soft_debug = TRUE;
                } else if (str_begins_with (arg, "gen-seq-points-file=")) {
-                       debug_options.gen_seq_points_compact_data = TRUE;
-                       opts->gen_seq_points_file = TRUE;
-                       opts->gen_seq_points_file_path = g_strdup (arg + strlen ("gen-seq-points-file="));;
+                       fprintf (stderr, "Mono Warning: aot option gen-seq-points-file= is deprecated.\n");
                } else if (str_begins_with (arg, "gen-seq-points-file")) {
-                       debug_options.gen_seq_points_compact_data = TRUE;
-                       opts->gen_seq_points_file = TRUE;
+                       fprintf (stderr, "Mono Warning: aot option gen-seq-points-file is deprecated.\n");
+               } else if (str_begins_with (arg, "msym-dir=")) {
+                       debug_options.no_seq_points_compact_data = FALSE;
+                       opts->gen_msym_dir = TRUE;
+                       opts->gen_msym_dir_path = g_strdup (arg + strlen ("msym_dir="));;
                } else if (str_begins_with (arg, "direct-pinvoke")) {
                        opts->direct_pinvoke = TRUE;
                } else if (str_begins_with (arg, "direct-icalls")) {
@@ -7119,7 +7143,7 @@ mono_aot_parse_options (const char *aot_options, MonoAotOptions *opts)
                        printf ("    tool-prefix=\n");
                        printf ("    readonly-value=\n");
                        printf ("    soft-debug\n");
-                       printf ("    gen-seq-points-file\n");
+                       printf ("    msym-dir=\n");
                        printf ("    gc-maps\n");
                        printf ("    print-skipped\n");
                        printf ("    no-instances\n");
@@ -7183,8 +7207,6 @@ can_encode_method (MonoAotCompile *acfg, MonoMethod *method)
                        case MONO_WRAPPER_STFLD:
                        case MONO_WRAPPER_LDFLD:
                        case MONO_WRAPPER_LDFLDA:
-                       case MONO_WRAPPER_LDFLD_REMOTE:
-                       case MONO_WRAPPER_STFLD_REMOTE:
                        case MONO_WRAPPER_STELEMREF:
                        case MONO_WRAPPER_ISINST:
                        case MONO_WRAPPER_PROXY_ISINST:
@@ -7466,7 +7488,6 @@ compile_method (MonoAotCompile *acfg, MonoMethod *method)
                if (acfg->aot_opts.print_skipped_methods)
                        printf ("Skip (disabled): %s\n", mono_method_get_full_name (method));
                InterlockedIncrement (&acfg->stats.ocount);
-               mono_destroy_compile (cfg);
                return;
        }
        cfg->method_index = index;
@@ -7509,7 +7530,6 @@ compile_method (MonoAotCompile *acfg, MonoMethod *method)
                if (acfg->aot_opts.print_skipped_methods)
                        printf ("Skip (abs call): %s\n", mono_method_get_full_name (method));
                InterlockedIncrement (&acfg->stats.abscount);
-               mono_destroy_compile (cfg);
                return;
        }
 
@@ -7538,7 +7558,6 @@ compile_method (MonoAotCompile *acfg, MonoMethod *method)
                if (acfg->aot_opts.print_skipped_methods)
                        printf ("Skip (patches): %s\n", mono_method_get_full_name (method));
                acfg->stats.ocount++;
-               mono_destroy_compile (cfg);
                mono_acfg_unlock (acfg);
                return;
        }
@@ -7715,20 +7734,12 @@ compile_method (MonoAotCompile *acfg, MonoMethod *method)
                        locals [i] = (MonoInst *)mono_mempool_alloc (acfg->mempool, sizeof (MonoInst));
                        memcpy (locals [i], cfg->locals [i], sizeof (MonoInst));
                }
+               mono_metadata_free_mh (header);
                cfg->locals = locals;
        }
 
        /* Free some fields used by cfg to conserve memory */
-       mono_mempool_destroy (cfg->mempool);
-       cfg->mempool = NULL;
-       g_free (cfg->varinfo);
-       cfg->varinfo = NULL;
-       g_free (cfg->vars);
-       cfg->vars = NULL;
-       if (cfg->rs) {
-               mono_regstate_free (cfg->rs);
-               cfg->rs = NULL;
-       }
+       mono_empty_compile (cfg);
 
        //printf ("Compile:           %s\n", mono_method_full_name (method, TRUE));
 
@@ -7759,12 +7770,12 @@ compile_method (MonoAotCompile *acfg, MonoMethod *method)
        InterlockedIncrement (&acfg->stats.ccount);
 }
  
-static void
-compile_thread_main (gpointer *user_data)
+static gsize WINAPI
+compile_thread_main (gpointer user_data)
 {
-       MonoDomain *domain = (MonoDomain *)user_data [0];
-       MonoAotCompile *acfg = (MonoAotCompile *)user_data [1];
-       GPtrArray *methods = (GPtrArray *)user_data [2];
+       MonoDomain *domain = ((MonoDomain **)user_data) [0];
+       MonoAotCompile *acfg = ((MonoAotCompile **)user_data) [1];
+       GPtrArray *methods = ((GPtrArray **)user_data) [2];
        int i;
 
        MonoError error;
@@ -7774,6 +7785,8 @@ compile_thread_main (gpointer *user_data)
 
        for (i = 0; i < methods->len; ++i)
                compile_method (acfg, (MonoMethod *)g_ptr_array_index (methods, i));
+
+       return 0;
 }
 
 static void
@@ -8233,7 +8246,7 @@ emit_llvm_file (MonoAotCompile *acfg)
                opts = g_strdup ("");
        else
 #if LLVM_API_VERSION > 100
-               opts = g_strdup ("-O2");
+               opts = g_strdup ("-O2 -disable-tail-calls");
 #else
                opts = g_strdup ("-targetlibinfo -no-aa -basicaa -notti -instcombine -simplifycfg -inline-cost -inline -sroa -domtree -early-cse -lazy-value-info -correlated-propagation -simplifycfg -instcombine -simplifycfg -reassociate -domtree -loops -loop-simplify -lcssa -loop-rotate -licm -lcssa -loop-unswitch -instcombine -scalar-evolution -loop-simplify -lcssa -indvars -loop-idiom -loop-deletion -loop-unroll -memdep -gvn -memdep -memcpyopt -sccp -instcombine -lazy-value-info -correlated-propagation -domtree -memdep -adce -simplifycfg -instcombine -strip-dead-prototypes -domtree -verify");
 #endif
@@ -8250,7 +8263,7 @@ emit_llvm_file (MonoAotCompile *acfg)
        if (acfg->aot_opts.llvm_only) {
                /* Use the stock clang from xcode */
                // FIXME: arch
-               command = g_strdup_printf ("clang -march=x86-64 -fpic -msse -msse2 -msse3 -msse4 -O2 -fno-optimize-sibling-calls -Wno-override-module -c -o \"%s\" \"%s.opt.bc\"", acfg->llvm_ofile, acfg->tmpbasename);
+               command = g_strdup_printf ("clang++ -fexceptions -march=x86-64 -fpic -msse -msse2 -msse3 -msse4 -O2 -fno-optimize-sibling-calls -Wno-override-module -c -o \"%s\" \"%s.opt.bc\"", acfg->llvm_ofile, acfg->tmpbasename);
 
                aot_printf (acfg, "Executing clang: %s\n", command);
                if (execute_system (command) != 0)
@@ -8819,6 +8832,7 @@ emit_extra_methods (MonoAotCompile *acfg)
                        g_ptr_array_add (table, new_entry);
                }
        }
+       g_free (chain_lengths);
 
        //printf ("MAX: %d\n", max_chain_length);
 
@@ -8848,6 +8862,8 @@ emit_extra_methods (MonoAotCompile *acfg)
        /* Emit the table */
        emit_aot_data (acfg, MONO_AOT_TABLE_EXTRA_METHOD_TABLE, "extra_method_table", buf, p - buf);
 
+       g_free (buf);
+
        /* 
         * Emit a table reverse mapping method indexes to their index in extra_method_info.
         * This is used by mono_aot_find_jit_info ().
@@ -8862,8 +8878,27 @@ emit_extra_methods (MonoAotCompile *acfg)
                encode_int (info_offsets [i], p, &p);
        }
        emit_aot_data (acfg, MONO_AOT_TABLE_EXTRA_METHOD_INFO_OFFSETS, "extra_method_info_offsets", buf, p - buf);
+
+       g_free (buf);
+       g_free (info_offsets);
+       g_ptr_array_free (table, TRUE);
 }      
 
+static void
+generate_aotid (guint8* aotid)
+{
+       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_error_assert_ok (&error);
+
+       mono_rand_close (rand_handle);
+}
+
 static void
 emit_exception_info (MonoAotCompile *acfg)
 {
@@ -8879,7 +8914,7 @@ emit_exception_info (MonoAotCompile *acfg)
 
                        // By design aot-runtime decode_exception_debug_info is not able to load sequence point debug data from a file.
                        // As it is not possible to load debug data from a file its is also not possible to store it in a file.
-                       gboolean method_seq_points_to_file = acfg->aot_opts.gen_seq_points_file &&
+                       gboolean method_seq_points_to_file = acfg->aot_opts.gen_msym_dir &&
                                cfg->gen_seq_points && !cfg->gen_sdb_seq_points;
                        gboolean method_seq_points_to_binary = cfg->gen_seq_points && !method_seq_points_to_file;
                        
@@ -8899,11 +8934,25 @@ emit_exception_info (MonoAotCompile *acfg)
        }
 
        if (seq_points_to_file) {
-               char *seq_points_aot_file = acfg->aot_opts.gen_seq_points_file_path ? acfg->aot_opts.gen_seq_points_file_path
-                       : g_strdup_printf("%s%s", acfg->image->name, SEQ_POINT_AOT_EXT);
-               mono_seq_point_data_write (&sp_data, seq_points_aot_file);
+               char *aotid = mono_guid_to_string_minimal (acfg->image->aotid);
+               char *dir = g_build_filename (acfg->aot_opts.gen_msym_dir_path, aotid, NULL);
+               char *image_basename = g_path_get_basename (acfg->image->name);
+               char *aot_file = g_strdup_printf("%s%s", image_basename, SEQ_POINT_AOT_EXT);
+               char *aot_file_path = g_build_filename (dir, aot_file, NULL);
+
+               if (g_ensure_directory_exists (aot_file_path) == FALSE) {
+                       fprintf (stderr, "AOT : failed to create msym directory: %s\n", aot_file_path);
+                       exit (1);
+               }
+
+               mono_seq_point_data_write (&sp_data, aot_file_path);
                mono_seq_point_data_free (&sp_data);
-               g_free (seq_points_aot_file);
+
+               g_free (aotid);
+               g_free (dir);
+               g_free (image_basename);
+               g_free (aot_file);
+               g_free (aot_file_path);
        }
 
        acfg->stats.offsets_size += emit_offset_table (acfg, "ex_info_offsets", MONO_AOT_TABLE_EX_INFO_OFFSETS, acfg->nmethods, 10, offsets);
@@ -9038,10 +9087,14 @@ emit_class_name_table (MonoAotCompile *acfg)
                        else
                                encode_int16 (0, p, &p);
                }
+               g_free (entry);
        }
        g_assert (p - buf <= buf_size);
+       g_ptr_array_free (table, TRUE);
 
        emit_aot_data (acfg, MONO_AOT_TABLE_CLASS_NAME, "class_name_table", buf, p - buf);
+
+       g_free (buf);
 }
 
 static void
@@ -9357,6 +9410,8 @@ init_aot_file_info (MonoAotCompile *acfg, MonoAotFileInfo *info)
        info->nshared_got_entries = acfg->nshared_got_entries;
        for (i = 0; i < MONO_AOT_TRAMP_NUM; ++i)
                info->tramp_page_code_offsets [i] = acfg->tramp_page_code_offsets [i];
+
+       memcpy(&info->aotid, acfg->image->aotid, 16);
 }
 
 static void
@@ -9489,6 +9544,8 @@ emit_aot_file_info (MonoAotCompile *acfg, MonoAotFileInfo *info)
        for (i = 0; i < MONO_AOT_TRAMP_NUM; ++i)
                emit_int32 (acfg, info->tramp_page_code_offsets [i]);
 
+       emit_bytes (acfg, info->aotid, 16);
+
        if (acfg->aot_opts.static_link) {
                emit_global_inner (acfg, acfg->static_linking_symbol, FALSE);
                emit_alignment (acfg, sizeof (gpointer));
@@ -9749,10 +9806,10 @@ compile_methods (MonoAotCompile *acfg)
                        user_data [1] = acfg;
                        user_data [2] = frag;
                        
-                       tp.priority = 0;
+                       tp.priority = MONO_THREAD_PRIORITY_NORMAL;
                        tp.stack_size = 0;
                        tp.creation_flags = 0;
-                       handle = mono_threads_create_thread ((LPTHREAD_START_ROUTINE)compile_thread_main, user_data, &tp, NULL);
+                       handle = mono_threads_create_thread (compile_thread_main, (gpointer) user_data, &tp, NULL);
                        g_ptr_array_add (threads, handle);
                }
                g_free (methods);
@@ -9907,9 +9964,17 @@ compile_asm (MonoAotCompile *acfg)
                wrap_path (g_strdup_printf ("%s.o", acfg->tmpfname)), ld_flags);
 #else
        // Default (linux)
-       command = g_strdup_printf ("\"%sld\" %s -shared -o %s %s %s %s", tool_prefix, LD_OPTIONS,
+       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);
+       } 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) {
@@ -9933,7 +9998,7 @@ compile_asm (MonoAotCompile *acfg)
         * gas generates 'mapping symbols' each time code and data is mixed, which 
         * happens a lot in emit_and_reloc_code (), so we need to get rid of them.
         */
-       command = g_strdup_printf ("\"%sstrip\" --strip-symbol=\\$a --strip-symbol=\\$d %s", tool_prefix, tmp_outfile_name);
+       command = g_strdup_printf ("\"%sstrip\" --strip-symbol=\\$a --strip-symbol=\\$d %s", wrap_path(tool_prefix), wrap_path(tmp_outfile_name));
        aot_printf (acfg, "Stripping the binary: %s\n", command);
        if (execute_system (command) != 0) {
                g_free (tmp_outfile_name);
@@ -10048,8 +10113,10 @@ acfg_free (MonoAotCompile *acfg)
        mono_img_writer_destroy (acfg->w);
        for (i = 0; i < acfg->nmethods; ++i)
                if (acfg->cfgs [i])
-                       g_free (acfg->cfgs [i]);
+                       mono_destroy_compile (acfg->cfgs [i]);
+
        g_free (acfg->cfgs);
+
        g_free (acfg->static_linking_symbol);
        g_free (acfg->got_symbol);
        g_free (acfg->plt_symbol);
@@ -10380,6 +10447,12 @@ mono_compile_assembly (MonoAssembly *ass, guint32 opts, const char *aot_options)
 
        aot_printf (acfg, "Mono Ahead of Time compiler - compiling assembly %s\n", image->name);
 
+       generate_aotid ((guint8*) &acfg->image->aotid);
+
+       char *aotid = mono_guid_to_string (acfg->image->aotid);
+       aot_printf (acfg, "AOTID %s\n", aotid);
+       g_free (aotid);
+
 #ifndef MONO_ARCH_HAVE_FULL_AOT_TRAMPOLINES
        if (mono_aot_mode_is_full (&acfg->aot_opts)) {
                aot_printerrf (acfg, "--aot=full is not supported on this platform.\n");
index b6412142493df2e7f8953bd9f42c7cd8d23ea246..34fbdda6e078b66252696371c1bd626ff3589f60 100644 (file)
@@ -922,12 +922,6 @@ decode_method_ref_with_target (MonoAotModule *module, MethodRef *ref, MonoMethod
                        }
                        break;
                }
-               case MONO_WRAPPER_LDFLD_REMOTE:
-                       ref->method = mono_marshal_get_ldfld_remote_wrapper (NULL);
-                       break;
-               case MONO_WRAPPER_STFLD_REMOTE:
-                       ref->method = mono_marshal_get_stfld_remote_wrapper (NULL);
-                       break;
 #endif
                case MONO_WRAPPER_ALLOC: {
                        int atype = decode_value (p, &p);
@@ -1785,17 +1779,6 @@ check_usable (MonoAssembly *assembly, MonoAotFileInfo *info, guint8 *blob, char
                msg = g_strdup_printf ("not compiled with --aot=llvmonly");
                usable = FALSE;
        }
-#ifdef TARGET_ARM
-       /* mono_arch_find_imt_method () requires this */
-       if ((info->flags & MONO_AOT_FILE_FLAG_WITH_LLVM) && !mono_use_llvm) {
-               msg = g_strdup_printf ("compiled against LLVM");
-               usable = FALSE;
-       }
-       if (!(info->flags & MONO_AOT_FILE_FLAG_WITH_LLVM) && mono_use_llvm) {
-               msg = g_strdup_printf ("not compiled against LLVM");
-               usable = FALSE;
-       }
-#endif
        if (mini_get_debug_options ()->mdb_optimizations && !(info->flags & MONO_AOT_FILE_FLAG_DEBUG) && !full_aot) {
                msg = g_strdup_printf ("not compiled for debugging");
                usable = FALSE;
@@ -2016,6 +1999,9 @@ load_aot_module (MonoAssembly *assembly, gpointer user_data)
                find_symbol (sofile, globals, "mono_aot_file_info", (gpointer*)&info);
        }
 
+       // Copy aotid to MonoImage
+       memcpy(&assembly->image->aotid, info->aotid, 16);
+
        if (version_symbol) {
                /* Old file format */
                version = atoi (version_symbol);
@@ -4055,7 +4041,7 @@ find_aot_method_in_amodule (MonoAotModule *amodule, MonoMethod *method, guint32
                        WrapperInfo *info1 = mono_marshal_get_wrapper_info (method);
                        WrapperInfo *info2 = mono_marshal_get_wrapper_info (m);
 
-                       if (info1 && info2 && info1->subtype == info2->subtype && method->klass == m->klass) {
+                       if (info1 && info2 && info1->subtype == info2->subtype && info1->d.delegate_invoke.method == info2->d.delegate_invoke.method) {
                                index = value;
                                break;
                        }
@@ -5845,7 +5831,7 @@ mono_aot_get_method (MonoDomain *domain, MonoMethod *method)
 
 gpointer
 mono_aot_get_method_checked (MonoDomain *domain,
-                                                        MonoMethod *method, MonoError *error);
+                                                        MonoMethod *method, MonoError *error)
 {
        mono_error_init (error);
        return NULL;
index 01219b452680de3f456877078820114f54b48f73..3eeae0fc0da1a42d346b733da64fe69f0d1e048b 100755 (executable)
@@ -792,3 +792,4 @@ gc_spill_slot_liveness_def: len:0
 gc_param_slot_liveness_def: len:0
 
 generic_class_init: src1:A len:32 clob:c
+get_last_error: dest:i len:32
index 2ef1c93fd5622f3d085f4457decf9523038b0664..41e241a33a8bf1a14ee1b64f4f07f5773fac4a0e 100644 (file)
@@ -240,29 +240,32 @@ mono_debug_close_method (MonoCompile *cfg)
        jit->code_start = cfg->native_code;
        jit->epilogue_begin = cfg->epilog_begin;
        jit->code_size = cfg->code_len;
+       jit->has_var_info = debug_options.mdb_optimizations != 0;
 
        if (jit->epilogue_begin)
                   record_line_number (info, jit->epilogue_begin, header->code_size);
 
-       jit->num_params = sig->param_count;
-       jit->params = g_new0 (MonoDebugVarInfo, jit->num_params);
+       if (jit->has_var_info) {
+               jit->num_params = sig->param_count;
+               jit->params = g_new0 (MonoDebugVarInfo, jit->num_params);
 
-       for (i = 0; i < jit->num_locals; i++)
-               write_variable (cfg->locals [i], &jit->locals [i]);
+               for (i = 0; i < jit->num_locals; i++)
+                       write_variable (cfg->locals [i], &jit->locals [i]);
 
-       if (sig->hasthis) {
-               jit->this_var = g_new0 (MonoDebugVarInfo, 1);
-               write_variable (cfg->args [0], jit->this_var);
-       }
+               if (sig->hasthis) {
+                       jit->this_var = g_new0 (MonoDebugVarInfo, 1);
+                       write_variable (cfg->args [0], jit->this_var);
+               }
 
-       for (i = 0; i < jit->num_params; i++)
-               write_variable (cfg->args [i + sig->hasthis], &jit->params [i]);
+               for (i = 0; i < jit->num_params; i++)
+                       write_variable (cfg->args [i + sig->hasthis], &jit->params [i]);
 
-       if (cfg->gsharedvt_info_var) {
-               jit->gsharedvt_info_var = g_new0 (MonoDebugVarInfo, 1);
-               jit->gsharedvt_locals_var = g_new0 (MonoDebugVarInfo, 1);
-               write_variable (cfg->gsharedvt_info_var, jit->gsharedvt_info_var);
-               write_variable (cfg->gsharedvt_locals_var, jit->gsharedvt_locals_var);
+               if (cfg->gsharedvt_info_var) {
+                       jit->gsharedvt_info_var = g_new0 (MonoDebugVarInfo, 1);
+                       jit->gsharedvt_locals_var = g_new0 (MonoDebugVarInfo, 1);
+                       write_variable (cfg->gsharedvt_info_var, jit->gsharedvt_info_var);
+                       write_variable (cfg->gsharedvt_locals_var, jit->gsharedvt_locals_var);
+               }
        }
 
        jit->num_line_numbers = info->line_numbers->len;
@@ -457,22 +460,25 @@ mono_debug_serialize_debug_info (MonoCompile *cfg, guint8 **out_buf, guint32 *bu
        encode_value (jit->epilogue_begin, p, &p);
        encode_value (jit->prologue_end, p, &p);
        encode_value (jit->code_size, p, &p);
+       encode_value (jit->has_var_info, p, &p);
 
-       for (i = 0; i < jit->num_params; ++i)
-               serialize_variable (&jit->params [i], p, &p);
+       if (jit->has_var_info) {
+               for (i = 0; i < jit->num_params; ++i)
+                       serialize_variable (&jit->params [i], p, &p);
 
-       if (mono_method_signature (cfg->method)->hasthis)
-               serialize_variable (jit->this_var, p, &p);
+               if (jit->this_var)
+                       serialize_variable (jit->this_var, p, &p);
 
-       for (i = 0; i < jit->num_locals; i++)
-               serialize_variable (&jit->locals [i], p, &p);
+               for (i = 0; i < jit->num_locals; i++)
+                       serialize_variable (&jit->locals [i], p, &p);
 
-       if (jit->gsharedvt_info_var) {
-               encode_value (1, p, &p);
-               serialize_variable (jit->gsharedvt_info_var, p, &p);
-               serialize_variable (jit->gsharedvt_locals_var, p, &p);
-       } else {
-               encode_value (0, p, &p);
+               if (jit->gsharedvt_info_var) {
+                       encode_value (1, p, &p);
+                       serialize_variable (jit->gsharedvt_info_var, p, &p);
+                       serialize_variable (jit->gsharedvt_locals_var, p, &p);
+               } else {
+                       encode_value (0, p, &p);
+               }
        }
 
        encode_value (jit->num_line_numbers, p, &p);
@@ -535,32 +541,36 @@ deserialize_debug_info (MonoMethod *method, guint8 *code_start, guint8 *buf, gui
 
        jit = g_new0 (MonoDebugMethodJitInfo, 1);
        jit->code_start = code_start;
-       jit->num_locals = header->num_locals;
-       jit->locals = g_new0 (MonoDebugVarInfo, jit->num_locals);
-       jit->num_params = mono_method_signature (method)->param_count;
-       jit->params = g_new0 (MonoDebugVarInfo, jit->num_params);
 
        p = buf;
        jit->epilogue_begin = decode_value (p, &p);
        jit->prologue_end = decode_value (p, &p);
        jit->code_size = decode_value (p, &p);
+       jit->has_var_info = decode_value (p, &p);
 
-       for (i = 0; i < jit->num_params; ++i)
-               deserialize_variable (&jit->params [i], p, &p);
+       if (jit->has_var_info) {
+               jit->num_locals = header->num_locals;
+               jit->num_params = mono_method_signature (method)->param_count;
+               jit->params = g_new0 (MonoDebugVarInfo, jit->num_params);
+               jit->locals = g_new0 (MonoDebugVarInfo, jit->num_locals);
 
-       if (mono_method_signature (method)->hasthis) {
-               jit->this_var = g_new0 (MonoDebugVarInfo, 1);
-               deserialize_variable (jit->this_var, p, &p);
-       }
+               for (i = 0; i < jit->num_params; ++i)
+                       deserialize_variable (&jit->params [i], p, &p);
 
-       for (i = 0; i < jit->num_locals; i++)
-               deserialize_variable (&jit->locals [i], p, &p);
+               if (mono_method_signature (method)->hasthis) {
+                       jit->this_var = g_new0 (MonoDebugVarInfo, 1);
+                       deserialize_variable (jit->this_var, p, &p);
+               }
+
+               for (i = 0; i < jit->num_locals; i++)
+                       deserialize_variable (&jit->locals [i], p, &p);
 
-       if (decode_value (p, &p)) {
-               jit->gsharedvt_info_var = g_new0 (MonoDebugVarInfo, 1);
-               jit->gsharedvt_locals_var = g_new0 (MonoDebugVarInfo, 1);
-               deserialize_variable (jit->gsharedvt_info_var, p, &p);
-               deserialize_variable (jit->gsharedvt_locals_var, p, &p);
+               if (decode_value (p, &p)) {
+                       jit->gsharedvt_info_var = g_new0 (MonoDebugVarInfo, 1);
+                       jit->gsharedvt_locals_var = g_new0 (MonoDebugVarInfo, 1);
+                       deserialize_variable (jit->gsharedvt_info_var, p, &p);
+                       deserialize_variable (jit->gsharedvt_locals_var, p, &p);
+               }
        }
 
        jit->num_line_numbers = decode_value (p, &p);
index ece1fddf5e8044e456386d65d6d0ed7c212d1d0e..ed3bee869a155630c8b1f6256d273db39a8487ff 100644 (file)
@@ -727,7 +727,7 @@ static void transport_connect (const char *address);
 static gboolean transport_handshake (void);
 static void register_transport (DebuggerTransport *trans);
 
-static guint32 WINAPI debugger_thread (void *arg);
+static gsize WINAPI debugger_thread (void *arg);
 
 static void runtime_initialized (MonoProfiler *prof);
 
@@ -1629,7 +1629,7 @@ start_debugger_thread (void)
 {
        MonoThreadParm tp;
 
-       tp.priority = 0;
+       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);
@@ -2790,8 +2790,6 @@ suspend_vm (void)
 static void
 resume_vm (void)
 {
-       int err;
-
        g_assert (is_debugger_thread ());
 
        mono_loader_lock ();
@@ -2810,8 +2808,7 @@ resume_vm (void)
        }
 
        /* Signal this even when suspend_count > 0, since some threads might have resume_count > 0 */
-       err = mono_coop_cond_broadcast (&suspend_cond);
-       g_assert (err == 0);
+       mono_coop_cond_broadcast (&suspend_cond);
 
        mono_coop_mutex_unlock (&suspend_mutex);
        //g_assert (err == 0);
@@ -2830,7 +2827,6 @@ resume_vm (void)
 static void
 resume_thread (MonoInternalThread *thread)
 {
-       int err;
        DebuggerTlsData *tls;
 
        g_assert (is_debugger_thread ());
@@ -2852,8 +2848,7 @@ resume_thread (MonoInternalThread *thread)
         * Signal suspend_count without decreasing suspend_count, the threads will wake up
         * but only the one whose resume_count field is > 0 will be resumed.
         */
-       err = mono_coop_cond_broadcast (&suspend_cond);
-       g_assert (err == 0);
+       mono_coop_cond_broadcast (&suspend_cond);
 
        mono_coop_mutex_unlock (&suspend_mutex);
        //g_assert (err == 0);
@@ -2900,7 +2895,6 @@ static void
 suspend_current (void)
 {
        DebuggerTlsData *tls;
-       int err;
 
        g_assert (!is_debugger_thread ());
 
@@ -2928,8 +2922,7 @@ suspend_current (void)
        DEBUG_PRINTF (1, "[%p] Suspended.\n", (gpointer) (gsize) mono_native_thread_id_get ());
 
        while (suspend_count - tls->resume_count > 0) {
-               err = mono_coop_cond_wait (&suspend_cond, &suspend_mutex);
-               g_assert (err == 0);
+               mono_coop_cond_wait (&suspend_cond, &suspend_mutex);
        }
 
        tls->suspended = FALSE;
@@ -4335,6 +4328,7 @@ set_bp_in_method (MonoDomain *domain, MonoMethod *method, MonoSeqPointInfo *seq_
                MonoError oerror;
 
                /* Might be AOTed code */
+               mono_class_init (method->klass);
                code = mono_aot_get_method_checked (domain, method, &oerror);
                g_assert (code);
                mono_error_assert_ok (&oerror);
@@ -5325,7 +5319,8 @@ ss_start (SingleStepReq *ss_req, MonoMethod *method, SeqPoint* sp, MonoSeqPointI
                                                found_sp = mono_find_next_seq_point_for_native_offset (frame->domain, frame->method, (char*)ei->handler_start - (char*)jinfo->code_start, NULL, &local_sp);
                                                sp = (found_sp)? &local_sp : NULL;
 
-                                               ss_bp_add_one (ss_req, &ss_req_bp_count, &ss_req_bp_cache, frame->method, sp->il_offset);
+                                               if (found_sp)
+                                                       ss_bp_add_one (ss_req, &ss_req_bp_count, &ss_req_bp_cache, frame->method, sp->il_offset);
                                        }
                                }
                        }
@@ -8382,11 +8377,15 @@ type_commands_internal (int command, MonoClass *klass, MonoDomain *domain, guint
        case CMD_TYPE_GET_METHODS_BY_NAME_FLAGS: {
                char *name = decode_string (p, &p, end);
                int i, flags = decode_int (p, &p, end);
-               MonoException *ex = NULL;
-               GPtrArray *array = mono_class_get_methods_by_name (klass, name, flags & ~BINDING_FLAGS_IGNORE_CASE, (flags & BINDING_FLAGS_IGNORE_CASE) != 0, TRUE, &ex);
+               MonoError error;
+               GPtrArray *array;
 
-               if (!array)
+               mono_error_init (&error);
+               array = mono_class_get_methods_by_name (klass, name, flags & ~BINDING_FLAGS_IGNORE_CASE, (flags & BINDING_FLAGS_IGNORE_CASE) != 0, TRUE, &error);
+               if (!is_ok (&error)) {
+                       mono_error_cleanup (&error);
                        return ERR_LOADER_ERROR;
+               }
                buffer_add_int (buf, array->len);
                for (i = 0; i < array->len; ++i) {
                        MonoMethod *method = (MonoMethod *)g_ptr_array_index (array, i);
@@ -9144,7 +9143,7 @@ frame_commands (int command, guint8 *p, guint8 *end, Buffer *buf)
 
        sig = mono_method_signature (frame->actual_method);
 
-       if (!mono_get_seq_points (frame->domain, frame->actual_method))
+       if (!jit->has_var_info || !mono_get_seq_points (frame->domain, frame->actual_method))
                /*
                 * The method is probably from an aot image compiled without soft-debug, variables might be dead, etc.
                 */
@@ -9462,10 +9461,10 @@ object_commands (int command, guint8 *p, guint8 *end, Buffer *buf)
                                g_free (val);
                        } else {
                                guint8 *field_value = NULL;
-                               void *field_storage = NULL;
 
                                if (remote_obj) {
 #ifndef DISABLE_REMOTING
+                                       void *field_storage = NULL;
                                        field_value = mono_load_remote_field_checked(obj, obj_type, f, &field_storage, &error);
                                        if (!is_ok (&error)) {
                                                mono_error_cleanup (&error); /* FIXME report the error */
@@ -9810,7 +9809,7 @@ wait_for_attach (void)
  *   This thread handles communication with the debugger client using a JDWP
  * like protocol.
  */
-static guint32 WINAPI
+static gsize WINAPI
 debugger_thread (void *arg)
 {
        MonoError error;
index aba82d5ffcb99b4112210194768ec78050379d33..9181e53b25257183de08774b3a793327ebe33be2 100644 (file)
@@ -1033,15 +1033,18 @@ mono_jit_exec (MonoDomain *domain, MonoAssembly *assembly, int argc, char *argv[
                if (exc) {
                        mono_unhandled_exception (exc);
                        mono_invoke_unhandled_exception_hook (exc);
-                       return 1;
+                       g_assert_not_reached ();
                }
                return res;
        } else {
                int res = mono_runtime_run_main_checked (method, argc, argv, &error);
                if (!is_ok (&error)) {
                        MonoException *ex = mono_error_convert_to_exception (&error);
-                       if (ex)
-                               mono_unhandled_exception ((MonoObject*)ex);
+                       if (ex) {
+                               mono_unhandled_exception (&ex->object);
+                               mono_invoke_unhandled_exception_hook (&ex->object);
+                               g_assert_not_reached ();
+                       }
                }
                return res;
        }
index b036aa7a61f17f107c81766275f3162905d7f2fb..c7f01aab9f5283dfac811bff9672f4135540e7a4 100644 (file)
@@ -14,9 +14,9 @@
 #include <string.h>
 
 #ifndef MONO_CROSS_COMPILE
-#ifdef HAVE_ASM_SIGCONTEXT_H
+#ifdef PLATFORM_ANDROID
 #include <asm/sigcontext.h>
-#endif  /* def HAVE_ASM_SIGCONTEXT_H */
+#endif  /* def PLATFORM_ANDROID */
 #endif
 
 #ifdef HAVE_UCONTEXT_H
index 1284cb292ae733f3f58dc8b78c5a07d72d31e488..80638b5048e6edf80854c7509ee3b7d18292cd5c 100644 (file)
@@ -898,6 +898,7 @@ class Tests
        }
 
        [Category ("!FULLAOT")]
+       [Category ("!BITCODE")]
        public static int test_0_regress_668095_synchronized_gshared () {
                return DoSomething (new DefaultRetriever ());
        }
index 8651aa25ec497c574a6d492e6ae6e9b324be8e14..d7c6d9a232fe63bbbf3731b6bd6567f2caf676eb 100644 (file)
@@ -1630,6 +1630,9 @@ resolve_vcall (MonoVTable *vt, int slot, MonoMethod *imt_method, gpointer *out_a
                        need_unbox_tramp = TRUE;
        }
 
+       if (m->iflags & METHOD_IMPL_ATTRIBUTE_SYNCHRONIZED)
+               m = mono_marshal_get_synchronized_wrapper (m);
+
        // FIXME: This can throw exceptions
        addr = compiled_method = mono_compile_method_checked (m, error);
        mono_error_assert_ok (error);
@@ -1751,9 +1754,11 @@ mono_resolve_generic_virtual_iface_call (MonoVTable *vt, int imt_slot, MonoMetho
        if (vt->klass->valuetype)
                need_unbox_tramp = TRUE;
 
-       // FIXME: This can throw exceptions
+       if (m->iflags & METHOD_IMPL_ATTRIBUTE_SYNCHRONIZED)
+               m = mono_marshal_get_synchronized_wrapper (m);
+
        addr = compiled_method = mono_compile_method_checked (m, &error);
-       mono_error_assert_ok (&error);
+       mono_error_raise_exception (&error);
        g_assert (addr);
 
        addr = mini_add_method_wrappers_llvmonly (m, addr, FALSE, need_unbox_tramp, &arg);
@@ -1816,12 +1821,16 @@ mono_llvmonly_init_delegate (MonoDelegate *del)
         * but we don't have a a structure which could own its memory.
         */
        if (G_UNLIKELY (!ftndesc)) {
-               gpointer addr = mono_compile_method_checked (del->method, &error);
+               MonoMethod *m = del->method;
+               if (m->iflags & METHOD_IMPL_ATTRIBUTE_SYNCHRONIZED)
+                       m = mono_marshal_get_synchronized_wrapper (m);
+
+               gpointer addr = mono_compile_method_checked (m, &error);
                if (mono_error_set_pending_exception (&error))
                        return;
 
-               if (del->method->klass->valuetype && mono_method_signature (del->method)->hasthis)
-                   addr = mono_aot_get_unbox_trampoline (del->method);
+               if (m->klass->valuetype && mono_method_signature (m)->hasthis)
+                   addr = mono_aot_get_unbox_trampoline (m);
 
                gpointer arg = mini_get_delegate_arg (del->method, addr);
 
@@ -1842,6 +1851,9 @@ mono_llvmonly_init_delegate_virtual (MonoDelegate *del, MonoObject *target, Mono
 
        method = mono_object_get_virtual_method (target, method);
 
+       if (method->iflags & METHOD_IMPL_ATTRIBUTE_SYNCHRONIZED)
+               method = mono_marshal_get_synchronized_wrapper (method);
+
        del->method = method;
        del->method_ptr = mono_compile_method_checked (method, &error);
        if (mono_error_set_pending_exception (&error))
index 6ee1e0ff7929ef8118525e4280d15b911eb029c9..287022daad738c08857273cf5d686eb060edc1eb 100644 (file)
@@ -81,9 +81,11 @@ mono_linear_scan (MonoCompile *cfg, GList *vars, GList *regs, regmask_t *used_ma
        gboolean cost_driven;
 
        if (!cfg->disable_reuse_registers && vars && (((MonoMethodVar*)vars->data)->interval != NULL)) {
-               mono_linear_scan2 (cfg, vars, regs, used_mask);
-               return;
-       }
+               mono_linear_scan2 (cfg, vars, regs, used_mask);
+               g_list_free (regs);
+               g_list_free (vars);
+               return;
+       }
 
        cost_driven = TRUE;
 
index 7fef6b85cb9741b955d701ae1082822fea5cca66..2011fddafaf2b67bb34877c797008a9705e0fc4e 100644 (file)
@@ -34,6 +34,8 @@
 #include "llvm/ExecutionEngine/Orc/ObjectLinkingLayer.h"
 #include "llvm/ExecutionEngine/Orc/OrcArchitectureSupport.h"
 
+#include <cstdlib>
+
 extern "C" {
 #include <mono/utils/mono-dl.h>
 }
@@ -64,6 +66,58 @@ void bzero (void *to, size_t count) { memset (to, 0, count); }
 
 #endif
 
+static AllocCodeMemoryCb *alloc_code_mem_cb;
+
+class MonoJitMemoryManager : public RTDyldMemoryManager
+{
+public:
+       ~MonoJitMemoryManager() override;
+
+       uint8_t *allocateDataSection(uintptr_t Size,
+                                                                unsigned Alignment,
+                                                                unsigned SectionID,
+                                                                StringRef SectionName,
+                                                                bool IsReadOnly) override;
+
+       uint8_t *allocateCodeSection(uintptr_t Size,
+                                                                unsigned Alignment,
+                                                                unsigned SectionID,
+                                                                StringRef SectionName) override;
+
+       bool finalizeMemory(std::string *ErrMsg = nullptr) override;
+};
+
+MonoJitMemoryManager::~MonoJitMemoryManager()
+{
+}
+
+uint8_t *
+MonoJitMemoryManager::allocateDataSection(uintptr_t Size,
+                                                                                 unsigned Alignment,
+                                                                                 unsigned SectionID,
+                                                                                 StringRef SectionName,
+                                                                                 bool IsReadOnly) {
+       uint8_t *res = (uint8_t*)malloc (Size);
+       assert (res);
+       memset (res, 0, Size);
+       return res;
+}
+
+uint8_t *
+MonoJitMemoryManager::allocateCodeSection(uintptr_t Size,
+                                                                                 unsigned Alignment,
+                                                                                 unsigned SectionID,
+                                                                                 StringRef SectionName)
+{
+       return alloc_code_mem_cb (NULL, Size);
+}
+
+bool
+MonoJitMemoryManager::finalizeMemory(std::string *ErrMsg)
+{
+       return false;
+}
+
 class MonoLLVMJIT {
 public:
        /* We use our own trampoline infrastructure instead of the Orc one */
@@ -105,7 +159,7 @@ public:
                                          } );
 
                return CompileLayer.addModuleSet(singletonSet(M),
-                                                                                 make_unique<SectionMemoryManager>(),
+                                                                                 make_unique<MonoJitMemoryManager>(),
                                                                                  std::move(Resolver));
        }
 
@@ -166,6 +220,8 @@ static MonoLLVMJIT *jit;
 MonoEERef
 mono_llvm_create_ee (LLVMModuleProviderRef MP, AllocCodeMemoryCb *alloc_cb, FunctionEmittedCb *emitted_cb, ExceptionTableCb *exception_cb, DlSymCb *dlsym_cb, LLVMExecutionEngineRef *ee)
 {
+       alloc_code_mem_cb = alloc_cb;
+
        InitializeNativeTarget ();
        InitializeNativeTargetAsmPrinter();
 
@@ -760,6 +816,13 @@ mono_llvm_optimize_method (MonoEERef eeref, LLVMValueRef method)
        g_assert_not_reached ();
 }
 
+gpointer
+mono_llvm_compile_method (MonoEERef mono_ee, LLVMValueRef method, int nvars, LLVMValueRef *callee_vars, gpointer *callee_addrs, gpointer *eh_frame)
+{
+       g_assert_not_reached ();
+       return NULL;
+}
+
 void
 mono_llvm_dispose_ee (MonoEERef *eeref)
 {
index 241e6f57e59772d39287fe0b22cb5c2326ce0925..1f9ffcf5d467b12f6b2ad89fdeadc57725db4b7d 100644 (file)
@@ -100,7 +100,6 @@ probe_embedded (const char *program, int *ref_argc, char **ref_argv [])
                        if (entry_point == NULL)
                                entry_point = aname;
                } else if (strncmp (kind, "config:", strlen ("config:")) == 0){
-                       printf ("c-Found: %s %llx\n", kind, (long long)offset);
                        char *config = kind + strlen ("config:");
                        char *aname = g_strdup (config);
                        aname [strlen(aname)-strlen(".config")] = 0;
index 3476585c10751c5d1e3f42fda8cb3990e1f7af3c..386a319cc50234118d4e32d940a370c1d0833609 100644 (file)
@@ -661,6 +661,24 @@ mono_find_block_region (MonoCompile *cfg, int offset)
        return -1;
 }
 
+static gboolean
+ip_in_finally_clause (MonoCompile *cfg, int offset)
+{
+       MonoMethodHeader *header = cfg->header;
+       MonoExceptionClause *clause;
+       int i;
+
+       for (i = 0; i < header->num_clauses; ++i) {
+               clause = &header->clauses [i];
+               if (clause->flags != MONO_EXCEPTION_CLAUSE_FINALLY && clause->flags != MONO_EXCEPTION_CLAUSE_FAULT)
+                       continue;
+
+               if (MONO_OFFSET_IN_HANDLER (clause, offset))
+                       return TRUE;
+       }
+       return FALSE;
+}
+
 static GList*
 mono_find_final_block (MonoCompile *cfg, unsigned char *ip, unsigned char *target, int type)
 {
@@ -2197,7 +2215,6 @@ target_type_is_incompatible (MonoCompile *cfg, MonoType *target, MonoInst *arg)
        if (target->byref) {
                /* FIXME: check that the pointed to types match */
                if (arg->type == STACK_MP) {
-                       if (cfg->verbose_level) printf ("ok\n");
                        /* This is needed to handle gshared types + ldaddr. We lower the types so we can handle enums and other typedef-like types. */
                        MonoClass *target_class_lowered = mono_class_from_mono_type (mini_get_underlying_type (&mono_class_from_mono_type (target)->byval_arg));
                        MonoClass *source_class_lowered = mono_class_from_mono_type (mini_get_underlying_type (&arg->klass->byval_arg));
@@ -4034,7 +4051,8 @@ handle_unbox_nullable (MonoCompile* cfg, MonoInst* val, MonoClass* klass, int co
                   RGCTX. */
                addr = emit_get_rgctx_method (cfg, context_used, method,
                                                                          MONO_RGCTX_INFO_GENERIC_METHOD_CODE);
-               if (cfg->llvm_only && cfg->gsharedvt) {
+               if (cfg->llvm_only) {
+                       cfg->signatures = g_slist_prepend_mempool (cfg->mempool, cfg->signatures, mono_method_signature (method));
                        return emit_llvmonly_calli (cfg, mono_method_signature (method), &val, addr);
                } else {
                        rgctx = emit_get_rgctx (cfg, cfg->current_method, context_used);
@@ -7062,7 +7080,8 @@ inline_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig,
        GHashTable *prev_cbb_hash;
        MonoBasicBlock **prev_cil_offset_to_bb;
        MonoBasicBlock *prev_cbb;
-       unsigned char* prev_cil_start;
+       const unsigned char *prev_ip;
+       unsigned char *prev_cil_start;
        guint32 prev_cil_offset_to_bb_len;
        MonoMethod *prev_current_method;
        MonoGenericContext *prev_generic_context;
@@ -7138,6 +7157,7 @@ inline_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig,
        prev_cil_offset_to_bb = cfg->cil_offset_to_bb;
        prev_cil_offset_to_bb_len = cfg->cil_offset_to_bb_len;
        prev_cil_start = cfg->cil_start;
+       prev_ip = cfg->ip;
        prev_cbb = cfg->cbb;
        prev_current_method = cfg->current_method;
        prev_generic_context = cfg->generic_context;
@@ -7157,6 +7177,7 @@ inline_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig,
        cfg->cil_offset_to_bb = prev_cil_offset_to_bb;
        cfg->cil_offset_to_bb_len = prev_cil_offset_to_bb_len;
        cfg->cil_start = prev_cil_start;
+       cfg->ip = prev_ip;
        cfg->locals = prev_locals;
        cfg->args = prev_args;
        cfg->arg_types = prev_arg_types;
@@ -8173,7 +8194,10 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
        if (!header) {
                mono_cfg_set_exception (cfg, MONO_EXCEPTION_MONO_ERROR);
                goto exception_exit;
+       } else {
+               cfg->headers_to_free = g_slist_prepend_mempool (cfg->mempool, cfg->headers_to_free, header);
        }
+
        generic_container = mono_method_get_generic_container (method);
        sig = mono_method_signature (method);
        num_args = sig->hasthis + sig->param_count;
@@ -9032,6 +9056,9 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                                for (i = 0; i < n; ++i)
                                        EMIT_NEW_ARGLOAD (cfg, call->args [i], i);
 
+                               if (mini_type_is_vtype (mini_get_underlying_type (call->signature->ret)))
+                                       call->vret_var = cfg->vret_addr;
+
                                mono_arch_emit_call (cfg, call);
                                cfg->param_area = MAX(cfg->param_area, call->stack_usage);
                                MONO_ADD_INS (cfg->cbb, (MonoInst*)call);
@@ -9724,6 +9751,20 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
 
                        inline_costs += 10 * num_calls++;
 
+                       /*
+                        * Synchronized wrappers.
+                        * Its hard to determine where to replace a method with its synchronized
+                        * wrapper without causing an infinite recursion. The current solution is
+                        * to add the synchronized wrapper in the trampolines, and to
+                        * change the called method to a dummy wrapper, and resolve that wrapper
+                        * to the real method in mono_jit_compile_method ().
+                        */
+                       if (cfg->method->wrapper_type == MONO_WRAPPER_SYNCHRONIZED) {
+                               MonoMethod *orig = mono_marshal_method_from_wrapper (cfg->method);
+                               if (cmethod == orig || (cmethod->is_inflated && mono_method_get_declaring_generic_method (cmethod) == orig))
+                                       cmethod = mono_marshal_get_synchronized_inner_wrapper (cmethod);
+                       }
+
                        /*
                         * Making generic calls out of gsharedvt methods.
                         * This needs to be used for all generic calls, not just ones with a gsharedvt signature, to avoid
@@ -9943,20 +9984,6 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                                }
                        }
 
-                       /* 
-                        * Synchronized wrappers.
-                        * Its hard to determine where to replace a method with its synchronized
-                        * wrapper without causing an infinite recursion. The current solution is
-                        * to add the synchronized wrapper in the trampolines, and to
-                        * change the called method to a dummy wrapper, and resolve that wrapper
-                        * to the real method in mono_jit_compile_method ().
-                        */
-                       if (cfg->method->wrapper_type == MONO_WRAPPER_SYNCHRONIZED) {
-                               MonoMethod *orig = mono_marshal_method_from_wrapper (cfg->method);
-                               if (cmethod == orig || (cmethod->is_inflated && mono_method_get_declaring_generic_method (cmethod) == orig))
-                                       cmethod = mono_marshal_get_synchronized_inner_wrapper (cmethod);
-                       }
-
                        /*
                         * Virtual calls in llvm-only mode.
                         */
@@ -11309,6 +11336,11 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
 
                                        MONO_EMIT_NULL_CHECK (cfg, sp [0]->dreg);
 
+                                       if (ins_flag & MONO_INST_VOLATILE) {
+                                               /* Volatile stores have release semantics, see 12.6.7 in Ecma 335 */
+                                               emit_memory_barrier (cfg, MONO_MEMORY_BARRIER_REL);
+                                       }
+
                                        if (mini_is_gsharedvt_klass (klass)) {
                                                MonoInst *offset_ins;
 
@@ -12251,6 +12283,9 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                }
                case CEE_THROW:
                        CHECK_STACK (1);
+                       if (sp [-1]->type != STACK_OBJ)
+                               UNVERIFIED;
+
                        MONO_INST_NEW (cfg, ins, OP_THROW);
                        --sp;
                        ins->sreg1 = sp [0]->dreg;
@@ -12268,6 +12303,8 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                                INLINE_FAILURE ("throw");
                        break;
                case CEE_ENDFINALLY:
+                       if (!ip_in_finally_clause (cfg, ip - header->code))
+                               UNVERIFIED;
                        /* mono_save_seq_point_info () depends on this */
                        if (sp != stack_start)
                                emit_seq_point (cfg, method, ip, FALSE, FALSE);
@@ -12926,6 +12963,18 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                        case CEE_MONO_LDDOMAIN:
                                CHECK_STACK_OVF (1);
                                EMIT_NEW_PCONST (cfg, ins, cfg->compile_aot ? NULL : cfg->domain);
+                               ip += 2;
+                               *sp++ = ins;
+                               break;
+                       case CEE_MONO_GET_LAST_ERROR:
+                               CHECK_OPSIZE (2);
+                               CHECK_STACK_OVF (1);
+
+                               MONO_INST_NEW (cfg, ins, OP_GET_LAST_ERROR);
+                               ins->dreg = alloc_dreg (cfg, STACK_I4);
+                               ins->type = STACK_I4;
+                               MONO_ADD_INS (cfg->cbb, ins);
+
                                ip += 2;
                                *sp++ = ins;
                                break;
@@ -13228,8 +13277,10 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                                ip += 4;
                                inline_costs += 1;
                                break;
-                       case CEE_LOCALLOC:
+                       case CEE_LOCALLOC: {
                                CHECK_STACK (1);
+                               MonoBasicBlock *non_zero_bb, *end_bb;
+                               int alloc_ptr = alloc_preg (cfg);
                                --sp;
                                if (sp != stack_start) 
                                        UNVERIFIED;
@@ -13241,8 +13292,20 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                                         */
                                        INLINE_FAILURE("localloc");
 
+                               NEW_BBLOCK (cfg, non_zero_bb);
+                               NEW_BBLOCK (cfg, end_bb);
+
+                               /* if size != zero */
+                               MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, -1, sp [0]->dreg, 0);
+                               MONO_EMIT_NEW_BRANCH_BLOCK (cfg, OP_PBNE_UN, non_zero_bb);
+
+                               //size is zero, so result is NULL
+                               MONO_EMIT_NEW_PCONST (cfg, alloc_ptr, NULL);
+                               MONO_EMIT_NEW_BRANCH_BLOCK (cfg, OP_BR, end_bb);
+
+                               MONO_START_BB (cfg, non_zero_bb);
                                MONO_INST_NEW (cfg, ins, OP_LOCALLOC);
-                               ins->dreg = alloc_preg (cfg);
+                               ins->dreg = alloc_ptr;
                                ins->sreg1 = sp [0]->dreg;
                                ins->type = STACK_PTR;
                                MONO_ADD_INS (cfg->cbb, ins);
@@ -13251,9 +13314,14 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                                if (init_locals)
                                        ins->flags |= MONO_INST_INIT;
 
+                               MONO_START_BB (cfg, end_bb);
+                               EMIT_NEW_UNALU (cfg, ins, OP_MOVE, alloc_preg (cfg), alloc_ptr);
+                               ins->type = STACK_PTR;
+
                                *sp++ = ins;
                                ip += 2;
                                break;
+                       }
                        case CEE_ENDFILTER: {
                                MonoExceptionClause *clause, *nearest;
                                int cc;
@@ -13633,7 +13701,6 @@ mono_error_exit:
        g_slist_free (class_inits);
        mono_basic_block_free (original_bb);
        cfg->dont_inline = g_list_remove (cfg->dont_inline, method);
-       cfg->headers_to_free = g_slist_prepend_mempool (cfg->mempool, cfg->headers_to_free, header);
        if (cfg->exception_type)
                return -1;
        else
index ddf699c58caf5878afcec17bdb707222e4820d97..6a4e7af9d4485ea1894c08f45c9421519744cc12 100644 (file)
@@ -49,6 +49,7 @@ storage_name (ArgStorage st)
        case ArgOnStack: return "ArgOnStack";
        case ArgValuetypeInReg: return "ArgValuetypeInReg";
        case ArgValuetypeAddrInIReg: return "ArgValuetypeAddrInIReg";
+       case ArgValuetypeAddrOnStack: return "ArgValuetypeAddrOnStack";
        case ArgGSharedVtInReg: return "ArgGSharedVtInReg";
        case ArgGSharedVtOnStack: return "ArgGSharedVtOnStack";
        case ArgNone: return "ArgNone";
@@ -167,6 +168,18 @@ get_arg_slots (ArgInfo *ainfo, int **out_slots, gboolean is_source_argument)
                src = g_malloc (nsrc * sizeof (int));
                src [0] = map_freg (sreg);
                break;
+       case ArgValuetypeAddrInIReg:
+               nsrc = 1;
+               src = g_malloc (nsrc * sizeof (int));
+               src [0] = map_reg (ainfo->pair_regs [0]);
+               break;
+       case ArgValuetypeAddrOnStack:
+               nsrc = 1;
+               src = g_malloc (nsrc * sizeof (int));
+               // is_source_argument adds 2 because we're skipping over the old BBP and the return address
+               // XXX this is a very fragile setup as changes in alignment for the caller reg array can cause the magic number be 3
+               src [0] = map_stack_slot (sslot + (is_source_argument ? 2 : 0));
+               break;
        default:
                NOT_IMPLEMENTED;
                break;
@@ -196,6 +209,11 @@ handle_marshal_when_src_gsharedvt (ArgInfo *dst_info, int *arg_marshal, int *arg
                        *arg_marshal = GSHAREDVT_ARG_BYREF_TO_BYVAL;
                        *arg_slots = dst_info->nregs;
                        break;
+               case ArgValuetypeAddrInIReg:
+               case ArgValuetypeAddrOnStack:
+                       *arg_marshal = GSHAREDVT_ARG_NONE;
+                       *arg_slots = dst_info->nregs;
+                       break;
                default:
                        NOT_IMPLEMENTED; // Inappropriate value: if dst and src are gsharedvt at once, we shouldn't be here
                        break;
@@ -214,6 +232,10 @@ handle_marshal_when_dst_gsharedvt (ArgInfo *src_info, int *arg_marshal)
                case ArgOnStack:
                        *arg_marshal = GSHAREDVT_ARG_BYVAL_TO_BYREF;
                        break;
+               case ArgValuetypeAddrInIReg:
+               case ArgValuetypeAddrOnStack:
+                       *arg_marshal = GSHAREDVT_ARG_NONE;
+                       break;
                default:
                        NOT_IMPLEMENTED; // See above
                        break;
@@ -325,6 +347,10 @@ mono_arch_get_gsharedvt_call_info (gpointer addr, MonoMethodSignature *normal_si
                        handle_marshal_when_src_gsharedvt (dst_info, &arg_marshal, &arg_slots);
                        handle_map_when_gsharedvt_on_stack (src_info, &nsrc, &src, TRUE);
                        break;
+               case ArgValuetypeAddrInIReg:
+               case ArgValuetypeAddrOnStack:
+                       nsrc = get_arg_slots (src_info, &src, TRUE);
+                       break;
                default:
                        g_error ("Gsharedvt can't handle source arg type %d", (int)src_info->storage); // Inappropriate value: ArgValuetypeAddrInIReg is for returns only
                }
@@ -345,6 +371,10 @@ mono_arch_get_gsharedvt_call_info (gpointer addr, MonoMethodSignature *normal_si
                        handle_marshal_when_dst_gsharedvt (src_info, &arg_marshal);
                        handle_map_when_gsharedvt_on_stack (dst_info, &ndst, &dst, FALSE);
                        break;
+               case ArgValuetypeAddrInIReg:
+               case ArgValuetypeAddrOnStack:
+                       ndst = get_arg_slots (dst_info, &dst, FALSE);
+                       break;
                default:
                        g_error ("Gsharedvt can't handle dest arg type %d", (int)dst_info->storage); // See above
                }
@@ -483,6 +513,9 @@ mono_arch_get_gsharedvt_call_info (gpointer addr, MonoMethodSignature *normal_si
 
        info->stack_usage = ALIGN_TO (info->stack_usage, MONO_ARCH_FRAME_ALIGNMENT);
 
+       g_free (callee_cinfo);
+       g_free (caller_cinfo);
+
        DEBUG_AMD64_GSHAREDVT_PRINT ("allocated an info at %p stack usage %d\n", info, info->stack_usage);
        return info;
 }
index 073a818a514887e4c0504042296b43a31c40d4bc..258b265e063cc4f986c7e5b5a7c9bfa47a1e82af 100644 (file)
@@ -8,6 +8,7 @@
  *   Dietmar Maurer (dietmar@ximian.com)
  *   Patrik Torstensson
  *   Zoltan Varga (vargaz@gmail.com)
+ *   Johan Lorensson (lateralusx.github@gmail.com)
  *
  * (C) 2003 Ximian, Inc.
  * Copyright 2003-2011 Novell, Inc (http://www.novell.com)
@@ -339,250 +340,296 @@ merge_argument_class_from_type (MonoType *type, ArgumentClass class1)
 }
 
 static int
-count_fields_nested (MonoClass *klass)
+count_fields_nested (MonoClass *klass, gboolean pinvoke)
 {
        MonoMarshalType *info;
        int i, count;
 
-       info = mono_marshal_load_type_info (klass);
-       g_assert(info);
        count = 0;
-       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));
-               else
-                       count ++;
+       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;
+} StructFieldInfo;
+
+/*
+ * collect_field_info_nested:
+ *
+ *   Collect field info from KLASS recursively into FIELDS.
+ */
 static int
-collect_field_info_nested (MonoClass *klass, MonoMarshalField *fields, int index, int offset)
+collect_field_info_nested (MonoClass *klass, StructFieldInfo *fields, int index, int offset, gboolean pinvoke, gboolean unicode)
 {
        MonoMarshalType *info;
        int i;
 
-       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)) {
-                       index = collect_field_info_nested (mono_class_from_mono_type (info->fields [i].field->type), fields, index, info->fields [i].offset);
-               } else {
-                       memcpy (&fields [index], &info->fields [i], sizeof (MonoMarshalField));
-                       fields [index].offset += offset;
-                       index ++;
+       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)) {
+                               index = collect_field_info_nested (mono_class_from_mono_type (info->fields [i].field->type), fields, index, info->fields [i].offset, pinvoke, unicode);
+                       } else {
+                               guint32 align;
+
+                               fields [index].type = info->fields [i].field->type;
+                               fields [index].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 ++;
+                       }
+               }
+       } 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)) {
+                               index = collect_field_info_nested (mono_class_from_mono_type (field->type), fields, index, field->offset - sizeof (MonoObject), pinvoke, unicode);
+                       } else {
+                               int align;
+
+                               fields [index].type = field->type;
+                               fields [index].size = mono_type_size (field->type, &align);
+                               fields [index].offset = field->offset - sizeof (MonoObject) + offset;
+                               index ++;
+                       }
                }
        }
        return index;
 }
 
 #ifdef TARGET_WIN32
-static void
-add_valuetype_win64 (MonoMethodSignature *sig, ArgInfo *ainfo, MonoType *type,
-                                        gboolean is_return,
-                                        guint32 *gr, guint32 *fr, guint32 *stack_size)
-{
-       guint32 size, i, nfields;
-       guint32 argsize = 8;
-       ArgumentClass arg_class;
-       MonoMarshalType *info = NULL;
-       MonoMarshalField *fields = NULL;
-       MonoClass *klass;
-       gboolean pass_on_stack = FALSE;
 
-       klass = mono_class_from_mono_type (type);
-       size = mini_type_stack_size_full (&klass->byval_arg, NULL, sig->pinvoke);
+/* Windows x64 ABI can pass/return value types in register of size 1,2,4,8 bytes. */
+#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))
 
-       /*
-       * Standard C and C++ doesn't allow empty structs, empty structs will always have a size of 1 byte.
-       * GCC have an extension to allow empty structs, https://gcc.gnu.org/onlinedocs/gcc/Empty-Structures.html.
-       * This cause a little dilemma since runtime build using none GCC compiler will not be compatible with
-       * GCC build C libraries and the other way around. On platforms where empty structs has size of 1 byte
-       * it must be represented in call and cannot be dropped.
-       */
-       if (0 == size && MONO_TYPE_ISSTRUCT (type) && sig->pinvoke)
-               ainfo->pass_empty_struct = TRUE;
-       
-       if (!sig->pinvoke)
-               pass_on_stack = TRUE;
+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)
+{
+       gboolean result = FALSE;
 
-       /* If this struct can't be split up naturally into 8-byte */
-       /* chunks (registers), pass it on the stack.              */
-       if (sig->pinvoke && !pass_on_stack) {
-               guint32 align;
-               guint32 field_size;
+       assert (arg_info != NULL && int_regs != NULL && float_regs != NULL && current_int_reg != NULL && current_float_reg != NULL);
+       assert (arg_info->storage == ArgValuetypeInReg || arg_info->storage == ArgValuetypeAddrInIReg);
 
-               info = mono_marshal_load_type_info (klass);
-               g_assert (info);
+       arg_info->pair_storage [0] = arg_info->pair_storage [1] = ArgNone;
+       arg_info->pair_regs [0] = arg_info->pair_regs [1] = ArgNone;
+       arg_info->pair_size [0] = 0;
+       arg_info->pair_size [1] = 0;
+       arg_info->nregs = 0;
 
-               /*
-                * Collect field information recursively to be able to
-                * handle nested structures.
-                */
-               nfields = count_fields_nested (klass);
-               fields = g_new0 (MonoMarshalField, nfields);
-               collect_field_info_nested (klass, fields, 0, 0);
-
-               for (i = 0; i < nfields; ++i) {
-                       field_size = mono_marshal_type_size (fields [i].field->type,
-                                                          fields [i].mspec,
-                                                          &align, TRUE, klass->unicode);
-                       if ((fields [i].offset < 8) && (fields [i].offset + field_size) > 8) {
-                               pass_on_stack = TRUE;
-                               break;
-                       }
-               }
+       if (arg_class == ARG_CLASS_INTEGER && *current_int_reg < int_reg_count) {
+               /* Pass parameter in integer register. */
+               arg_info->pair_storage [0] = ArgInIReg;
+               arg_info->pair_regs [0] = int_regs [*current_int_reg];
+               (*current_int_reg) ++;
+               result = TRUE;
+       } else if (arg_class == ARG_CLASS_SSE && *current_float_reg < float_reg_count) {
+               /* Pass parameter in float register. */
+               arg_info->pair_storage [0] = (arg_size <= sizeof (gfloat)) ? ArgInFloatSSEReg : ArgInDoubleSSEReg;
+               arg_info->pair_regs [0] = float_regs [*current_float_reg];
+               (*current_float_reg) ++;
+               result = TRUE;
        }
 
-       if (pass_on_stack) {
-               /* Allways pass in memory */
-               ainfo->offset = *stack_size;
-               *stack_size += ALIGN_TO (size, 8);
-               ainfo->storage = is_return ? ArgValuetypeAddrInIReg : ArgOnStack;
-               if (!is_return)
-                       ainfo->arg_size = ALIGN_TO (size, 8);
-
-               g_free (fields);
-               return;
+       if (result == TRUE) {
+               arg_info->pair_size [0] = arg_size;
+               arg_info->nregs = 1;
        }
 
-       if (!sig->pinvoke) {
-               int n = mono_class_value_size (klass, NULL);
+       return result;
+}
 
-               argsize = n;
+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);
+}
 
-               if (n > 8)
-                       arg_class = ARG_CLASS_MEMORY;
-               else
-                       /* Always pass in 1 integer register */
-                       arg_class = ARG_CLASS_INTEGER;
-       } else {
-               g_assert (info);
+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);
+}
 
-               /*Only drop value type if its not an empty struct as input that must be represented in call*/
-               if ((!fields && !ainfo->pass_empty_struct) || (!fields && ainfo->pass_empty_struct && is_return)) {
-                       ainfo->storage = ArgValuetypeInReg;
-                       ainfo->pair_storage [0] = ainfo->pair_storage [1] = ArgNone;
-                       return;
-               }
+static void
+allocate_storage_for_valuetype_win64 (ArgInfo *arg_info, MonoType *type, gboolean is_return, ArgumentClass arg_class,
+                                                                         guint32 arg_size, guint32 *current_int_reg, guint32 *current_float_reg, guint32 *stack_size)
+{
+       /* Windows x64 value type ABI.
+       *
+       * Parameters: https://msdn.microsoft.com/en-us/library/zthk2dkh.aspx
+       *
+       * Integer/Float types smaller than or equals to 8 bytes or porperly sized struct/union (1,2,4,8)
+       *    Try pass in register using ArgValuetypeInReg/(ArgInIReg|ArgInFloatSSEReg|ArgInDoubleSSEReg) as storage and size of parameter(1,2,4,8), if no more registers, pass on stack using ArgOnStack as storage and size of parameter(1,2,4,8).
+       * Integer/Float types bigger than 8 bytes or struct/unions larger than 8 bytes or (3,5,6,7).
+       *    Try to pass pointer in register using ArgValuetypeAddrInIReg, if no more registers, pass pointer on stack using ArgValuetypeAddrOnStack as storage and parameter size of register (8 bytes).
+       *
+       * Return values:  https://msdn.microsoft.com/en-us/library/7572ztz4.aspx.
+       *
+       * Integers/Float types smaller than or equal to 8 bytes
+       *    Return in corresponding register RAX/XMM0 using ArgValuetypeInReg/(ArgInIReg|ArgInFloatSSEReg|ArgInDoubleSSEReg) as storage and size of parameter(1,2,4,8).
+       * Properly sized struct/unions (1,2,4,8)
+       *    Return in register RAX using ArgValuetypeInReg as storage and size of parameter(1,2,4,8).
+       * Types bigger than 8 bytes or struct/unions larger than 8 bytes or (3,5,6,7).
+       *    Return pointer to allocated stack space (allocated by caller) using ArgValuetypeAddrInIReg as storage and parameter size.
+       */
 
-               switch (info->native_size) {
-               case 0:
-                       g_assert (!fields && MONO_TYPE_ISSTRUCT (type) && !is_return);
-                       break;
-               case 1: case 2: case 4: case 8:
-                       break;
-               default:
-                       if (is_return) {
-                               ainfo->storage = ArgValuetypeAddrInIReg;
-                               ainfo->offset = *stack_size;
-                               *stack_size += ALIGN_TO (info->native_size, 8);
-                       }
-                       else {
-                               ainfo->storage = ArgValuetypeAddrInIReg;
+       assert (arg_info != NULL && type != NULL && current_int_reg != NULL && current_float_reg != NULL && stack_size != NULL);
 
-                               if (*gr < PARAM_REGS) {
-                                       ainfo->pair_storage [0] = ArgInIReg;
-                                       ainfo->pair_regs [0] = param_regs [*gr];
-                                       (*gr) ++;
-                               }
-                               else {
-                                       ainfo->pair_storage [0] = ArgOnStack;
-                                       ainfo->offset = *stack_size;
-                                       ainfo->arg_size = sizeof (mgreg_t);
-                                       *stack_size += 8;
-                               }
-                       }
+       if (!is_return) {
 
-                       g_free (fields);
-                       return;
+               /* Parameter cases. */
+               if (arg_class != ARG_CLASS_MEMORY && MONO_WIN64_VALUE_TYPE_FITS_REG (arg_size)) {
+                       assert (arg_size == 1 || arg_size == 2 || arg_size == 4 || arg_size == 8);
+
+                       /* First, try to use registers for parameter. If type is struct it can only be passed by value in integer register. */
+                       arg_info->storage = ArgValuetypeInReg;
+                       if (!allocate_parameter_register_for_valuetype_win64 (arg_info, !MONO_TYPE_ISSTRUCT (type) ? arg_class : ARG_CLASS_INTEGER, arg_size, current_int_reg, current_float_reg)) {
+                               /* No more registers, fallback passing parameter on stack as value. */
+                               assert (arg_info->pair_storage [0] == ArgNone && arg_info->pair_storage [1] == ArgNone && arg_info->pair_size [0] == 0 && arg_info->pair_size [1] == 0 && arg_info->nregs == 0);
+                               
+                               /* Passing value directly on stack, so use size of value. */
+                               arg_info->storage = ArgOnStack;
+                               arg_size = ALIGN_TO (arg_size, sizeof (mgreg_t));
+                               arg_info->offset = *stack_size;
+                               arg_info->arg_size = arg_size;
+                               *stack_size += arg_size;
+                       }
+               } else {
+                       /* Fallback to stack, try to pass address to parameter in register. Always use integer register to represent stack address. */
+                       arg_info->storage = ArgValuetypeAddrInIReg;
+                       if (!allocate_parameter_register_for_valuetype_win64 (arg_info, ARG_CLASS_INTEGER, arg_size, current_int_reg, current_float_reg)) {
+                               /* No more registers, fallback passing address to parameter on stack. */
+                               assert (arg_info->pair_storage [0] == ArgNone && arg_info->pair_storage [1] == ArgNone && arg_info->pair_size [0] == 0 && arg_info->pair_size [1] == 0 && arg_info->nregs == 0);
+                                                               
+                               /* Passing an address to value on stack, so use size of register as argument size. */
+                               arg_info->storage = ArgValuetypeAddrOnStack;
+                               arg_size = sizeof (mgreg_t);
+                               arg_info->offset = *stack_size;
+                               arg_info->arg_size = arg_size;
+                               *stack_size += arg_size;
+                       }
                }
+       } else {
+               /* Return value cases. */
+               if (arg_class != ARG_CLASS_MEMORY && MONO_WIN64_VALUE_TYPE_FITS_REG (arg_size)) {
+                       assert (arg_size == 1 || arg_size == 2 || arg_size == 4 || arg_size == 8);
 
-               int size;
-               guint32 align;
-               ArgumentClass class1;
+                       /* Return value fits into return registers. If type is struct it can only be returned by value in integer register. */
+                       arg_info->storage = ArgValuetypeInReg;
+                       allocate_return_register_for_valuetype_win64 (arg_info, !MONO_TYPE_ISSTRUCT (type) ? arg_class : ARG_CLASS_INTEGER, arg_size, current_int_reg, current_float_reg);
 
-               if (nfields == 0 && ainfo->pass_empty_struct) {
-                       g_assert (!fields && !is_return);
-                       class1 = ARG_CLASS_INTEGER;
-               }
-               else if (nfields == 0)
-                       class1 = ARG_CLASS_MEMORY;
-               else
-                       class1 = ARG_CLASS_NO_CLASS;
-               for (i = 0; i < nfields; ++i) {
-                       size = mono_marshal_type_size (fields [i].field->type,
-                                                                                  fields [i].mspec,
-                                                                                  &align, TRUE, klass->unicode);
-                       /* How far into this quad this data extends.*/
-                       /* (8 is size of quad) */
-                       argsize = fields [i].offset + size;
+                       /* Only RAX/XMM0 should be used to return valuetype. */
+                       assert ((arg_info->pair_regs[0] == AMD64_RAX && arg_info->pair_regs[1] == ArgNone) || (arg_info->pair_regs[0] == AMD64_XMM0 && arg_info->pair_regs[1] == ArgNone));
+               } else {
+                       /* Return value doesn't fit into return register, return address to allocated stack space (allocated by caller and passed as input). */
+                       arg_info->storage = ArgValuetypeAddrInIReg;
+                       allocate_return_register_for_valuetype_win64 (arg_info, ARG_CLASS_INTEGER, arg_size, current_int_reg, current_float_reg);
+
+                       /* Only RAX should be used to return valuetype address. */
+                       assert (arg_info->pair_regs[0] == AMD64_RAX && arg_info->pair_regs[1] == ArgNone);
 
-                       class1 = merge_argument_class_from_type (fields [i].field->type, class1);
+                       arg_size = ALIGN_TO (arg_size, sizeof (mgreg_t));
+                       arg_info->offset = *stack_size;
+                       *stack_size += arg_size;
                }
-               g_assert (class1 != ARG_CLASS_NO_CLASS);
-               arg_class = class1;
        }
+}
 
-       g_free (fields);
+static void
+get_valuetype_size_win64 (MonoClass *klass, gboolean pinvoke, ArgInfo *arg_info, MonoType *type, ArgumentClass *arg_class, guint32 *arg_size)
+{
+       *arg_size = 0;
+       *arg_class = ARG_CLASS_NO_CLASS;
 
-       /* Allocate registers */
-       {
-               int orig_gr = *gr;
-               int orig_fr = *fr;
+       assert (klass != NULL && arg_info != NULL && type != NULL && arg_class != NULL && arg_size != NULL);
+       
+       if (pinvoke) {
+               /* Calculate argument class type and size of marshalled type. */
+               MonoMarshalType *info = mono_marshal_load_type_info (klass);
+               *arg_size = info->native_size;
+       } else {
+               /* Calculate argument class type and size of managed type. */
+               *arg_size = mono_class_value_size (klass, NULL);
+       }
 
-               while (argsize != 1 && argsize != 2 && argsize != 4 && argsize != 8)
-                       argsize ++;
+       /* Windows ABI only handle value types on stack or passed in integer register (if it fits register size). */
+       *arg_class = MONO_WIN64_VALUE_TYPE_FITS_REG (*arg_size) ? ARG_CLASS_INTEGER : ARG_CLASS_MEMORY;
 
-               ainfo->storage = ArgValuetypeInReg;
-               ainfo->pair_storage [0] = ainfo->pair_storage [1] = ArgNone;
-               ainfo->pair_size [0] = argsize;
-               ainfo->pair_size [1] = 0;
-               ainfo->nregs = 1;
-               switch (arg_class) {
-               case ARG_CLASS_INTEGER:
-                       if (*gr >= PARAM_REGS)
-                               arg_class = ARG_CLASS_MEMORY;
-                       else {
-                               ainfo->pair_storage [0] = ArgInIReg;
-                               if (is_return)
-                                       ainfo->pair_regs [0] = return_regs [*gr];
-                               else
-                                       ainfo->pair_regs [0] = param_regs [*gr];
-                               (*gr) ++;
-                       }
-                       break;
-               case ARG_CLASS_SSE:
-                       if (*fr >= FLOAT_PARAM_REGS)
-                               arg_class = ARG_CLASS_MEMORY;
-                       else {
-                               if (argsize <= 4)
-                                       ainfo->pair_storage [0] = ArgInFloatSSEReg;
-                               else
-                                       ainfo->pair_storage [0] = ArgInDoubleSSEReg;
-                               ainfo->pair_regs [0] = *fr;
-                               (*fr) ++;
-                       }
-                       break;
-               case ARG_CLASS_MEMORY:
-                       break;
-               default:
-                       g_assert_not_reached ();
-               }
+       if (*arg_class == ARG_CLASS_MEMORY) {
+               /* Value type has a size that doesn't seem to fit register according to ABI. Try to used full stack size of type. */
+               *arg_size = mini_type_stack_size_full (&klass->byval_arg, NULL, pinvoke);
+       }
 
-               if (arg_class == ARG_CLASS_MEMORY) {
-                       /* Revert possible register assignments */
-                       *gr = orig_gr;
-                       *fr = orig_fr;
+       /*
+       * Standard C and C++ doesn't allow empty structs, empty structs will always have a size of 1 byte.
+       * GCC have an extension to allow empty structs, https://gcc.gnu.org/onlinedocs/gcc/Empty-Structures.html.
+       * This cause a little dilemma since runtime build using none GCC compiler will not be compatible with
+       * GCC build C libraries and the other way around. On platforms where empty structs has size of 1 byte
+       * it must be represented in call and cannot be dropped.
+       */
+       if (*arg_size == 0 && MONO_TYPE_ISSTRUCT (type)) {
+               arg_info->pass_empty_struct = TRUE;
+               *arg_size = SIZEOF_REGISTER;
+               *arg_class = ARG_CLASS_INTEGER;
+       }
 
-                       ainfo->offset = *stack_size;
-                       *stack_size += sizeof (mgreg_t);
-                       ainfo->storage = is_return ? ArgValuetypeAddrInIReg : ArgOnStack;
-                       if (!is_return)
-                               ainfo->arg_size = sizeof (mgreg_t);
-               }
+       assert (*arg_class != ARG_CLASS_NO_CLASS);
+}
+
+static void
+add_valuetype_win64 (MonoMethodSignature *signature, ArgInfo *arg_info, MonoType *type,
+                                               gboolean is_return, guint32 *current_int_reg, guint32 *current_float_reg, guint32 *stack_size)
+{
+       guint32 arg_size = SIZEOF_REGISTER;
+       MonoClass *klass = NULL;
+       ArgumentClass arg_class;
+       
+       assert (signature != NULL && arg_info != NULL && type != NULL && current_int_reg != NULL && current_float_reg != NULL && stack_size != NULL);
+
+       klass = mono_class_from_mono_type (type);
+       get_valuetype_size_win64 (klass, signature->pinvoke, arg_info, type, &arg_class, &arg_size);
+
+       /* Only drop value type if its not an empty struct as input that must be represented in call */
+       if ((arg_size == 0 && !arg_info->pass_empty_struct) || (arg_size == 0 && arg_info->pass_empty_struct && is_return)) {
+               arg_info->storage = ArgValuetypeInReg;
+               arg_info->pair_storage [0] = arg_info->pair_storage [1] = ArgNone;
+       } else {
+               /* Alocate storage for value type. */
+               allocate_storage_for_valuetype_win64 (arg_info, type, is_return, arg_class, arg_size, current_int_reg, current_float_reg, stack_size);
        }
 }
+
 #endif /* TARGET_WIN32 */
 
 static void
@@ -598,10 +645,10 @@ add_valuetype (MonoMethodSignature *sig, ArgInfo *ainfo, MonoType *type,
        /* use the right size when copying args/return vars.  */
        guint32 quadsize [2] = {8, 8};
        ArgumentClass args [2];
-       MonoMarshalType *info = NULL;
-       MonoMarshalField *fields = NULL;
+       StructFieldInfo *fields = NULL;
        MonoClass *klass;
        gboolean pass_on_stack = FALSE;
+       int struct_size;
 
        klass = mono_class_from_mono_type (type);
        size = mini_type_stack_size_full (&klass->byval_arg, NULL, sig->pinvoke);
@@ -614,29 +661,25 @@ add_valuetype (MonoMethodSignature *sig, ArgInfo *ainfo, MonoType *type,
 
        /* If this struct can't be split up naturally into 8-byte */
        /* chunks (registers), pass it on the stack.              */
-       if (sig->pinvoke && !pass_on_stack) {
-               guint32 align;
-               guint32 field_size;
-
-               info = mono_marshal_load_type_info (klass);
+       if (sig->pinvoke) {
+               MonoMarshalType *info = mono_marshal_load_type_info (klass);
                g_assert (info);
+               struct_size = info->native_size;
+       } else {
+               struct_size = mono_class_value_size (klass, NULL);
+       }
+       /*
+        * 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);
 
-               /*
-                * Collect field information recursively to be able to
-                * handle nested structures.
-                */
-               nfields = count_fields_nested (klass);
-               fields = g_new0 (MonoMarshalField, nfields);
-               collect_field_info_nested (klass, fields, 0, 0);
-
-               for (i = 0; i < nfields; ++i) {
-                       field_size = mono_marshal_type_size (fields [i].field->type,
-                                                          fields [i].mspec,
-                                                          &align, TRUE, klass->unicode);
-                       if ((fields [i].offset < 8) && (fields [i].offset + field_size) > 8) {
-                               pass_on_stack = TRUE;
-                               break;
-                       }
+       for (i = 0; i < nfields; ++i) {
+               if ((fields [i].offset < 8) && (fields [i].offset + fields [i].size) > 8) {
+                       pass_on_stack = TRUE;
+                       break;
                }
        }
 
@@ -683,20 +726,18 @@ add_valuetype (MonoMethodSignature *sig, ArgInfo *ainfo, MonoType *type,
                 * The X87 and SSEUP stuff is left out since there are no such types in
                 * the CLR.
                 */
-               g_assert (info);
-
-               if (!fields) {
+               if (!nfields) {
                        ainfo->storage = ArgValuetypeInReg;
                        ainfo->pair_storage [0] = ainfo->pair_storage [1] = ArgNone;
                        return;
                }
 
-               if (info->native_size > 16) {
+               if (struct_size > 16) {
                        ainfo->offset = *stack_size;
-                       *stack_size += ALIGN_TO (info->native_size, 8);
+                       *stack_size += ALIGN_TO (struct_size, 8);
                        ainfo->storage = is_return ? ArgValuetypeAddrInIReg : ArgOnStack;
                        if (!is_return)
-                               ainfo->arg_size = ALIGN_TO (info->native_size, 8);
+                               ainfo->arg_size = ALIGN_TO (struct_size, 8);
 
                        g_free (fields);
                        return;
@@ -705,8 +746,6 @@ add_valuetype (MonoMethodSignature *sig, ArgInfo *ainfo, MonoType *type,
                args [0] = ARG_CLASS_NO_CLASS;
                args [1] = ARG_CLASS_NO_CLASS;
                for (quad = 0; quad < nquads; ++quad) {
-                       int size;
-                       guint32 align;
                        ArgumentClass class1;
 
                        if (nfields == 0)
@@ -714,10 +753,7 @@ add_valuetype (MonoMethodSignature *sig, ArgInfo *ainfo, MonoType *type,
                        else
                                class1 = ARG_CLASS_NO_CLASS;
                        for (i = 0; i < nfields; ++i) {
-                               size = mono_marshal_type_size (fields [i].field->type,
-                                                                                          fields [i].mspec,
-                                                                                          &align, TRUE, klass->unicode);
-                               if ((fields [i].offset < 8) && (fields [i].offset + size) > 8) {
+                               if ((fields [i].offset < 8) && (fields [i].offset + fields [i].size) > 8) {
                                        /* Unaligned field */
                                        NOT_IMPLEMENTED;
                                }
@@ -730,11 +766,13 @@ add_valuetype (MonoMethodSignature *sig, ArgInfo *ainfo, MonoType *type,
 
                                /* How far into this quad this data extends.*/
                                /* (8 is size of quad) */
-                               quadsize [quad] = fields [i].offset + size - (quad * 8);
+                               quadsize [quad] = fields [i].offset + fields [i].size - (quad * 8);
 
-                               class1 = merge_argument_class_from_type (fields [i].field->type, class1);
+                               class1 = merge_argument_class_from_type (fields [i].type, class1);
                        }
-                       g_assert (class1 != ARG_CLASS_NO_CLASS);
+                       /* Empty structs have a nonzero size, causing this assert to be hit */
+                       if (sig->pinvoke)
+                               g_assert (class1 != ARG_CLASS_NO_CLASS);
                        args [quad] = class1;
                }
        }
@@ -789,6 +827,8 @@ add_valuetype (MonoMethodSignature *sig, ArgInfo *ainfo, MonoType *type,
                                break;
                        case ARG_CLASS_MEMORY:
                                break;
+                       case ARG_CLASS_NO_CLASS:
+                               break;
                        default:
                                g_assert_not_reached ();
                        }
@@ -802,7 +842,7 @@ add_valuetype (MonoMethodSignature *sig, ArgInfo *ainfo, MonoType *type,
 
                        ainfo->offset = *stack_size;
                        if (sig->pinvoke)
-                               arg_size = ALIGN_TO (info->native_size, 8);
+                               arg_size = ALIGN_TO (struct_size, 8);
                        else
                                arg_size = nquads * sizeof(mgreg_t);
                        *stack_size += arg_size;
@@ -1018,7 +1058,7 @@ get_call_info (MonoMemPool *mp, MonoMethodSignature *sig)
                        /* fall through */
                case MONO_TYPE_VALUETYPE:
                case MONO_TYPE_TYPEDBYREF:
-                       add_valuetype (sig, ainfo, sig->params [i], FALSE, &gr, &fr, &stack_size);
+                       add_valuetype (sig, ainfo, ptype, FALSE, &gr, &fr, &stack_size);
                        break;
                case MONO_TYPE_U8:
 
@@ -1149,6 +1189,8 @@ mono_arch_init (void)
        mono_aot_register_jit_icall ("mono_amd64_throw_corlib_exception", mono_amd64_throw_corlib_exception);
        mono_aot_register_jit_icall ("mono_amd64_resume_unwind", mono_amd64_resume_unwind);
        mono_aot_register_jit_icall ("mono_amd64_get_original_ip", mono_amd64_get_original_ip);
+       mono_aot_register_jit_icall ("mono_amd64_handler_block_trampoline_helper", mono_amd64_handler_block_trampoline_helper);
+
 #if defined(MONO_ARCH_GSHAREDVT_SUPPORTED)
        mono_aot_register_jit_icall ("mono_amd64_start_gsharedvt_call", mono_amd64_start_gsharedvt_call);
 #endif
@@ -1187,6 +1229,15 @@ mono_arch_cpu_optimizations (guint32 *exclude_mask)
                *exclude_mask |= MONO_OPT_CMOV;
        }
 
+#ifdef TARGET_WIN32
+       /* The current SIMD doesn't support the argument used by a LD_ADDR to be of type OP_VTARG_ADDR. */
+       /* This will now be used for value types > 8 or of size 3,5,6,7 as dictated by windows x64 value type ABI. */
+       /* Since OP_VTARG_ADDR needs to be resolved in mono_spill_global_vars and the SIMD implementation optimize */
+       /* away the LD_ADDR in load_simd_vreg, that will cause an error in mono_spill_global_vars since incorrect opcode */
+       /* will now have a reference to an argument that won't be fully decomposed. */
+       *exclude_mask |= MONO_OPT_SIMD;
+#endif
+
        return opts;
 }
 
@@ -1310,7 +1361,7 @@ mono_arch_compute_omit_fp (MonoCompile *cfg)
        for (i = 0; i < sig->param_count + sig->hasthis; ++i) {
                ArgInfo *ainfo = &cinfo->args [i];
 
-               if (ainfo->storage == ArgOnStack) {
+               if (ainfo->storage == ArgOnStack || ainfo->storage == ArgValuetypeAddrInIReg || ainfo->storage == ArgValuetypeAddrOnStack) {
                        /* 
                         * The stack offset can only be determined when the frame
                         * size is known.
@@ -1550,9 +1601,11 @@ mono_arch_allocate_vars (MonoCompile *cfg)
        }
 
        cfg->arch.saved_iregs = cfg->used_int_regs;
-       if (cfg->method->save_lmf)
-               /* Save all callee-saved registers normally, and restore them when unwinding through an LMF */
-               cfg->arch.saved_iregs |= (1 << AMD64_RBX) | (1 << AMD64_R12) | (1 << AMD64_R13) | (1 << AMD64_R14) | (1 << AMD64_R15);
+       if (cfg->method->save_lmf) {
+               /* Save all callee-saved registers normally (except RBP, if not already used), and restore them when unwinding through an LMF */
+               guint32 iregs_to_save = AMD64_CALLEE_SAVED_REGS & ~(1<<AMD64_RBP);
+               cfg->arch.saved_iregs |= iregs_to_save;
+       }
 
        if (cfg->arch.omit_fp)
                cfg->arch.reg_save_area_offset = offset;
@@ -1687,11 +1740,13 @@ mono_arch_allocate_vars (MonoCompile *cfg)
                                break;
                        case ArgValuetypeInReg:
                                break;
-                       case ArgValuetypeAddrInIReg: {
+                       case ArgValuetypeAddrInIReg:
+                       case ArgValuetypeAddrOnStack: {
                                MonoInst *indir;
                                g_assert (!cfg->arch.omit_fp);
-                               
+                               g_assert (ainfo->storage == ArgValuetypeAddrInIReg || (ainfo->storage == ArgValuetypeAddrOnStack && ainfo->pair_storage [0] == ArgNone));
                                MONO_INST_NEW (cfg, indir, 0);
+
                                indir->opcode = OP_REGOFFSET;
                                if (ainfo->pair_storage [0] == ArgInIReg) {
                                        indir->inst_basereg = cfg->frame_reg;
@@ -1713,7 +1768,7 @@ mono_arch_allocate_vars (MonoCompile *cfg)
                                NOT_IMPLEMENTED;
                        }
 
-                       if (!inreg && (ainfo->storage != ArgOnStack) && (ainfo->storage != ArgValuetypeAddrInIReg) && (ainfo->storage != ArgGSharedVtOnStack)) {
+                       if (!inreg && (ainfo->storage != ArgOnStack) && (ainfo->storage != ArgValuetypeAddrInIReg) && (ainfo->storage != ArgValuetypeAddrOnStack) && (ainfo->storage != ArgGSharedVtOnStack)) {
                                ins->opcode = OP_REGOFFSET;
                                ins->inst_basereg = cfg->frame_reg;
                                /* These arguments are saved to the stack in the prolog */
@@ -2099,6 +2154,7 @@ mono_arch_emit_call (MonoCompile *cfg, MonoCallInst *call)
                case ArgOnStack:
                case ArgValuetypeInReg:
                case ArgValuetypeAddrInIReg:
+               case ArgValuetypeAddrOnStack:
                case ArgGSharedVtInReg:
                case ArgGSharedVtOnStack: {
                        if (ainfo->storage == ArgOnStack && !MONO_TYPE_ISSTRUCT (t) && !call->tail_call)
@@ -2259,8 +2315,12 @@ mono_arch_emit_outarg_vt (MonoCompile *cfg, MonoInst *ins, MonoInst *src)
                }
                break;
        }
-       case ArgValuetypeAddrInIReg: {
+       case ArgValuetypeAddrInIReg:
+       case ArgValuetypeAddrOnStack: {
                MonoInst *vtaddr, *load;
+
+               g_assert (ainfo->storage == ArgValuetypeAddrInIReg || (ainfo->storage == ArgValuetypeAddrOnStack && ainfo->pair_storage [0] == ArgNone));
+               
                vtaddr = mono_compile_create_var (cfg, &ins->klass->byval_arg, OP_LOCAL);
                
                MONO_INST_NEW (cfg, load, OP_LDADDR);
@@ -2361,16 +2421,8 @@ dyn_call_supported (MonoMethodSignature *sig, CallInfo *cinfo)
        case ArgInFloatSSEReg:
        case ArgInDoubleSSEReg:
        case ArgValuetypeAddrInIReg:
+       case ArgValuetypeInReg:
                break;
-       case ArgValuetypeInReg: {
-               ArgInfo *ainfo = &cinfo->ret;
-
-               if (ainfo->pair_storage [0] != ArgNone && ainfo->pair_storage [0] != ArgInIReg)
-                       return FALSE;
-               if (ainfo->pair_storage [1] != ArgNone && ainfo->pair_storage [1] != ArgInIReg)
-                       return FALSE;
-               break;
-       }
        default:
                return FALSE;
        }
@@ -2381,12 +2433,7 @@ dyn_call_supported (MonoMethodSignature *sig, CallInfo *cinfo)
                case ArgInIReg:
                case ArgInFloatSSEReg:
                case ArgInDoubleSSEReg:
-                       break;
                case ArgValuetypeInReg:
-                       if (ainfo->pair_storage [0] != ArgNone && ainfo->pair_storage [0] != ArgInIReg)
-                               return FALSE;
-                       if (ainfo->pair_storage [1] != ArgNone && ainfo->pair_storage [1] != ArgInIReg)
-                               return FALSE;
                        break;
                case ArgOnStack:
                        if (!(ainfo->offset + (ainfo->arg_size / 8) <= DYN_CALL_STACK_ARGS))
@@ -2592,15 +2639,22 @@ mono_arch_start_dyn_call (MonoDynCallInfo *info, gpointer **args, guint8 *ret, g
                case MONO_TYPE_VALUETYPE: {
                        switch (ainfo->storage) {
                        case ArgValuetypeInReg:
-                               if (ainfo->pair_storage [0] != ArgNone) {
-                                       slot = param_reg_to_index [ainfo->pair_regs [0]];
-                                       g_assert (ainfo->pair_storage [0] == ArgInIReg);
-                                       p->regs [slot] = ((mgreg_t*)(arg))[0];
-                               }
-                               if (ainfo->pair_storage [1] != ArgNone) {
-                                       slot = param_reg_to_index [ainfo->pair_regs [1]];
-                                       g_assert (ainfo->pair_storage [1] == ArgInIReg);
-                                       p->regs [slot] = ((mgreg_t*)(arg))[1];
+                               for (i = 0; i < 2; ++i) {
+                                       switch (ainfo->pair_storage [i]) {
+                                       case ArgNone:
+                                               break;
+                                       case ArgInIReg:
+                                               slot = param_reg_to_index [ainfo->pair_regs [i]];
+                                               p->regs [slot] = ((mgreg_t*)(arg))[i];
+                                               break;
+                                       case ArgInDoubleSSEReg:
+                                               p->has_fp = 1;
+                                               p->fregs [ainfo->pair_regs [i]] = ((double*)(arg))[i];
+                                               break;
+                                       default:
+                                               g_assert_not_reached ();
+                                               break;
+                                       }
                                }
                                break;
                        case ArgOnStack:
@@ -2637,6 +2691,7 @@ mono_arch_finish_dyn_call (MonoDynCallInfo *info, guint8 *buf)
        guint8 *ret = dargs->ret;
        mgreg_t res = dargs->res;
        MonoType *sig_ret = mini_get_underlying_type (sig->ret);
+       int i;
 
        switch (sig_ret->type) {
        case MONO_TYPE_VOID:
@@ -2697,12 +2752,21 @@ mono_arch_finish_dyn_call (MonoDynCallInfo *info, guint8 *buf)
 
                        g_assert (ainfo->storage == ArgValuetypeInReg);
 
-                       if (ainfo->pair_storage [0] != ArgNone) {
-                               g_assert (ainfo->pair_storage [0] == ArgInIReg);
-                               ((mgreg_t*)ret)[0] = res;
+                       for (i = 0; i < 2; ++i) {
+                               switch (ainfo->pair_storage [0]) {
+                               case ArgInIReg:
+                                       ((mgreg_t*)ret)[i] = res;
+                                       break;
+                               case ArgInDoubleSSEReg:
+                                       ((double*)ret)[i] = dargs->fregs [i];
+                                       break;
+                               case ArgNone:
+                                       break;
+                               default:
+                                       g_assert_not_reached ();
+                                       break;
+                               }
                        }
-
-                       g_assert (ainfo->pair_storage [1] == ArgNone);
                }
                break;
        default:
@@ -3675,6 +3739,30 @@ emit_setup_lmf (MonoCompile *cfg, guint8 *code, gint32 lmf_offset, int cfa_offse
        return code;
 }
 
+#ifdef TARGET_WIN32
+
+#define TEB_LAST_ERROR_OFFSET 0x068
+
+static guint8*
+emit_get_last_error (guint8* code, int dreg)
+{
+       /* Threads last error value is located in TEB_LAST_ERROR_OFFSET. */
+       x86_prefix (code, X86_GS_PREFIX);
+       amd64_mov_reg_membase (code, dreg, TEB_LAST_ERROR_OFFSET, 0, sizeof (guint32));
+
+       return code;
+}
+
+#else
+
+static guint8*
+emit_get_last_error (guint8* code, int dreg)
+{
+       g_assert_not_reached ();
+}
+
+#endif
+
 /* benchmark and set based on cpu */
 #define LOOP_ALIGNMENT 8
 #define bb_is_loop_start(bb) ((bb)->loop_body_start && (bb)->nesting)
@@ -4764,6 +4852,7 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
                        amd64_mov_reg_membase (code, AMD64_R11, var->inst_basereg, var->inst_offset, 8);
                        amd64_mov_membase_reg (code, AMD64_R11, MONO_STRUCT_OFFSET (DynCallArgs, res), AMD64_RAX, 8);
                        amd64_sse_movsd_membase_reg (code, AMD64_R11, MONO_STRUCT_OFFSET (DynCallArgs, fregs), AMD64_XMM0);
+                       amd64_sse_movsd_membase_reg (code, AMD64_R11, MONO_STRUCT_OFFSET (DynCallArgs, fregs) + sizeof (double), AMD64_XMM1);
                        break;
                }
                case OP_AMD64_SAVE_SP_TO_LMF: {
@@ -6510,6 +6599,9 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
                        ins->backend.pc_offset = code - cfg->native_code;
                        bb->spill_slot_defs = g_slist_prepend_mempool (cfg->mempool, bb->spill_slot_defs, ins);
                        break;
+               case OP_GET_LAST_ERROR:
+                       emit_get_last_error(code, ins->dreg);
+                       break;
                default:
                        g_warning ("unknown opcode %s in %s()\n", mono_inst_name (ins->opcode), __FUNCTION__);
                        g_assert_not_reached ();
@@ -6708,7 +6800,7 @@ mono_arch_emit_prolog (MonoCompile *cfg)
 #if defined(TARGET_WIN32) || defined(MONO_ARCH_SIGSEGV_ON_ALTSTACK)
                guint32 remaining_size = alloc_size;
                /*FIXME handle unbounded code expansion, we should use a loop in case of more than X interactions*/
-               guint32 required_code_size = ((remaining_size / 0x1000) + 1) * 10; /*10 is the max size of amd64_alu_reg_imm + amd64_test_membase_reg*/
+               guint32 required_code_size = ((remaining_size / 0x1000) + 1) * 11; /*11 is the max size of amd64_alu_reg_imm + amd64_test_membase_reg*/
                guint32 offset = code - cfg->native_code;
                if (G_UNLIKELY (required_code_size >= (cfg->code_size - offset))) {
                        while (required_code_size >= (cfg->code_size - offset))
@@ -6938,6 +7030,8 @@ mono_arch_emit_prolog (MonoCompile *cfg)
                                if (ainfo->pair_storage [0] == ArgInIReg)
                                        amd64_mov_membase_reg (code, ins->inst_left->inst_basereg, ins->inst_left->inst_offset, ainfo->pair_regs [0],  sizeof (gpointer));
                                break;
+                       case ArgValuetypeAddrOnStack:
+                               break;
                        case ArgGSharedVtInReg:
                                amd64_mov_membase_reg (code, ins->inst_basereg, ins->inst_offset, ainfo->reg, 8);
                                break;
@@ -7742,10 +7836,7 @@ get_delegate_virtual_invoke_impl (MonoTrampInfo **info, gboolean load_imt_reg, i
        amd64_jump_membase (code, AMD64_RAX, offset);
        mono_profiler_code_buffer_new (start, code - start, MONO_PROFILER_CODE_BUFFER_DELEGATE_INVOKE, NULL);
 
-       if (load_imt_reg)
-               tramp_name = g_strdup_printf ("delegate_virtual_invoke_imt_%d", - offset / sizeof (gpointer));
-       else
-               tramp_name = g_strdup_printf ("delegate_virtual_invoke_%d", offset / sizeof (gpointer));
+       tramp_name = mono_get_delegate_virtual_invoke_impl_name (load_imt_reg, offset);
        *info = mono_tramp_info_create (tramp_name, start, code - start, NULL, unwind_ops);
        g_free (tramp_name);
 
@@ -7773,12 +7864,16 @@ mono_arch_get_delegate_invoke_impls (void)
                res = g_slist_prepend (res, info);
        }
 
-       for (i = 0; i <= MAX_VIRTUAL_DELEGATE_OFFSET; ++i) {
+       for (i = 1; i <= MONO_IMT_SIZE; ++i) {
                get_delegate_virtual_invoke_impl (&info, TRUE, - i * SIZEOF_VOID_P);
                res = g_slist_prepend (res, info);
+       }
 
+       for (i = 0; i <= MAX_VIRTUAL_DELEGATE_OFFSET; ++i) {
                get_delegate_virtual_invoke_impl (&info, FALSE, i * SIZEOF_VOID_P);
                res = g_slist_prepend (res, info);
+               get_delegate_virtual_invoke_impl (&info, TRUE, i * SIZEOF_VOID_P);
+               res = g_slist_prepend (res, info);
        }
 
        return res;
index 11fc30a435f28b08366bd6cae009fe21602147d4..22e7413a6f531cb207b974d0cefdfff2605a12e9 100644 (file)
@@ -188,12 +188,20 @@ typedef struct MonoCompileArch {
 } MonoCompileArch;
 
 #ifdef TARGET_WIN32
-#define PARAM_REGS 4
-#define FLOAT_PARAM_REGS 4
 
 static AMD64_Reg_No param_regs [] = { AMD64_RCX, AMD64_RDX, AMD64_R8, AMD64_R9 };
 
-static AMD64_Reg_No return_regs [] = { AMD64_RAX, AMD64_RDX };
+static AMD64_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 };
+
+#define PARAM_REGS G_N_ELEMENTS(param_regs)
+#define FLOAT_PARAM_REGS G_N_ELEMENTS(float_param_regs)
+#define RETURN_REGS G_N_ELEMENTS(return_regs)
+#define FLOAT_RETURN_REGS G_N_ELEMENTS(float_return_regs)
+
 #else
 #define PARAM_REGS 6
 #define FLOAT_PARAM_REGS 8
@@ -248,6 +256,7 @@ typedef enum {
        ArgOnStack,
        ArgValuetypeInReg,
        ArgValuetypeAddrInIReg,
+       ArgValuetypeAddrOnStack,
        /* gsharedvt argument passed by addr */
        ArgGSharedVtInReg,
        ArgGSharedVtOnStack,
@@ -269,7 +278,7 @@ typedef struct {
        int nregs;
        /* Only if storage == ArgOnStack */
        int arg_size; // Bytes, will always be rounded up/aligned to 8 byte boundary
-       gboolean pass_empty_struct; // Set in scenarios when empty structs needs to be represented as argument.
+       guint8 pass_empty_struct : 1; // Set in scenarios when empty structs needs to be represented as argument.
 } ArgInfo;
 
 typedef struct {
@@ -393,6 +402,7 @@ typedef struct {
 
 #define MONO_ARCH_LLVM_SUPPORTED 1
 #define MONO_ARCH_HAVE_HANDLER_BLOCK_GUARD 1
+#define MONO_ARCH_HAVE_HANDLER_BLOCK_GUARD_AOT 1
 #define MONO_ARCH_HAVE_CARD_TABLE_WBARRIER 1
 #define MONO_ARCH_HAVE_SETUP_RESUME_FROM_SIGNAL_HANDLER_CTX 1
 #define MONO_ARCH_GC_MAPS_SUPPORTED 1
@@ -472,6 +482,9 @@ mono_amd64_get_exception_trampolines (gboolean aot);
 int
 mono_amd64_get_tls_gs_offset (void) MONO_LLVM_INTERNAL;
 
+gpointer
+mono_amd64_handler_block_trampoline_helper (void);
+
 #ifdef TARGET_WIN32
 
 void mono_arch_unwindinfo_add_push_nonvol (gpointer* monoui, gpointer codebegin, gpointer nextip, guchar reg );
index 4fbe7c06c0886c91d4418f029b016f019d6f2339..108b4abd256a9e381ac6d9cee0da9d329fc14e73 100644 (file)
@@ -827,9 +827,14 @@ mono_arch_init (void)
 {
        const char *cpu_arch;
 
+#ifdef TARGET_WATCHOS
+       mini_get_debug_options ()->soft_breakpoints = TRUE;
+#endif
+
        mono_os_mutex_init_recursive (&mini_arch_mutex);
        if (mini_get_debug_options ()->soft_breakpoints) {
-               breakpoint_tramp = mini_get_breakpoint_trampoline ();
+               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);
@@ -880,6 +885,21 @@ mono_arch_init (void)
        v6_supported = mono_hwcap_arm_is_v6;
        v7_supported = mono_hwcap_arm_is_v7;
 
+       /*
+        * On weird devices, the hwcap code may fail to detect
+        * the ARM version. In that case, we can at least safely
+        * assume the version the runtime was compiled for.
+        */
+#ifdef HAVE_ARMV5
+       v5_supported = TRUE;
+#endif
+#ifdef HAVE_ARMV6
+       v6_supported = TRUE;
+#endif
+#ifdef HAVE_ARMV7
+       v7_supported = TRUE;
+#endif
+
 #if defined(__APPLE__)
        /* iOS is special-cased here because we don't yet
           have a way to properly detect CPU features on it. */
@@ -1883,6 +1903,9 @@ mono_arch_allocate_vars (MonoCompile *cfg)
                ins->inst_basereg = cfg->frame_reg;
                ins->inst_offset = offset;
                offset += size;
+       }
+       if (cfg->arch.ss_trigger_page_var) {
+               MonoInst *ins;
 
                ins = cfg->arch.ss_trigger_page_var;
                size = 4;
@@ -1907,6 +1930,9 @@ mono_arch_allocate_vars (MonoCompile *cfg)
                ins->inst_basereg = cfg->frame_reg;
                ins->inst_offset = offset;
                offset += size;
+       }
+       if (cfg->arch.seq_point_bp_method_var) {
+               MonoInst *ins;
 
                ins = cfg->arch.seq_point_bp_method_var;
                size = 4;
@@ -2087,6 +2113,18 @@ mono_arch_create_vars (MonoCompile *cfg)
        }
 
        if (cfg->gen_sdb_seq_points) {
+               if (cfg->compile_aot) {
+                       MonoInst *ins = mono_compile_create_var (cfg, &mono_defaults.int_class->byval_arg, OP_LOCAL);
+                       ins->flags |= MONO_INST_VOLATILE;
+                       cfg->arch.seq_point_info_var = ins;
+
+                       if (!cfg->soft_breakpoints) {
+                               /* Allocate a separate variable for this to save 1 load per seq point */
+                               ins = mono_compile_create_var (cfg, &mono_defaults.int_class->byval_arg, OP_LOCAL);
+                               ins->flags |= MONO_INST_VOLATILE;
+                               cfg->arch.ss_trigger_page_var = ins;
+                       }
+               }
                if (cfg->soft_breakpoints) {
                        MonoInst *ins;
 
@@ -2097,17 +2135,6 @@ mono_arch_create_vars (MonoCompile *cfg)
                        ins = mono_compile_create_var (cfg, &mono_defaults.int_class->byval_arg, OP_LOCAL);
                        ins->flags |= MONO_INST_VOLATILE;
                        cfg->arch.seq_point_bp_method_var = ins;
-
-                       g_assert (!cfg->compile_aot);
-               } else if (cfg->compile_aot) {
-                       MonoInst *ins = mono_compile_create_var (cfg, &mono_defaults.int_class->byval_arg, OP_LOCAL);
-                       ins->flags |= MONO_INST_VOLATILE;
-                       cfg->arch.seq_point_info_var = ins;
-
-                       /* Allocate a separate variable for this to save 1 load per seq point */
-                       ins = mono_compile_create_var (cfg, &mono_defaults.int_class->byval_arg, OP_LOCAL);
-                       ins->flags |= MONO_INST_VOLATILE;
-                       cfg->arch.ss_trigger_page_var = ins;
                }
        }
 }
@@ -4575,9 +4602,11 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
                        MonoInst *var;
                        int dreg = ARMREG_LR;
 
+#if 0
                        if (cfg->soft_breakpoints) {
                                g_assert (!cfg->compile_aot);
                        }
+#endif
 
                        /*
                         * For AOT, we use one got slot per method, which will point to a
@@ -4600,6 +4629,7 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
                                g_assert (((guint64)(gsize)ss_trigger_page >> 32) == 0);
                        }
 
+                       /* Single step check */
                        if (ins->flags & MONO_INST_SINGLE_STEP_LOC) {
                                if (cfg->soft_breakpoints) {
                                        /* Load the address of the sequence point method variable. */
@@ -4634,20 +4664,8 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
 
                        mono_add_seq_point (cfg, bb, ins, code - cfg->native_code);
 
-                       if (cfg->soft_breakpoints) {
-                               /* Load the address of the breakpoint method into ip. */
-                               var = bp_method_var;
-                               g_assert (var);
-                               g_assert (var->opcode == OP_REGOFFSET);
-                               g_assert (arm_is_imm12 (var->inst_offset));
-                               ARM_LDR_IMM (code, dreg, var->inst_basereg, var->inst_offset);
-
-                               /*
-                                * A placeholder for a possible breakpoint inserted by
-                                * mono_arch_set_breakpoint ().
-                                */
-                               ARM_NOP (code);
-                       } else if (cfg->compile_aot) {
+                       /* Breakpoint check */
+                       if (cfg->compile_aot) {
                                guint32 offset = code - cfg->native_code;
                                guint32 val;
 
@@ -4670,7 +4688,23 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
                                /* What is faster, a branch or a load ? */
                                ARM_CMP_REG_IMM (code, dreg, 0, 0);
                                /* The breakpoint instruction */
-                               ARM_LDR_IMM_COND (code, dreg, dreg, 0, ARMCOND_NE);
+                               if (cfg->soft_breakpoints)
+                                       ARM_BLX_REG_COND (code, ARMCOND_NE, dreg);
+                               else
+                                       ARM_LDR_IMM_COND (code, dreg, dreg, 0, ARMCOND_NE);
+                       } else if (cfg->soft_breakpoints) {
+                               /* Load the address of the breakpoint method into ip. */
+                               var = bp_method_var;
+                               g_assert (var);
+                               g_assert (var->opcode == OP_REGOFFSET);
+                               g_assert (arm_is_imm12 (var->inst_offset));
+                               ARM_LDR_IMM (code, dreg, var->inst_basereg, var->inst_offset);
+
+                               /*
+                                * A placeholder for a possible breakpoint inserted by
+                                * mono_arch_set_breakpoint ().
+                                */
+                               ARM_NOP (code);
                        } else {
                                /* 
                                 * A placeholder for a possible breakpoint inserted by
@@ -6511,22 +6545,36 @@ mono_arch_emit_prolog (MonoCompile *cfg)
        if (cfg->arch.seq_point_ss_method_var) {
                MonoInst *ss_method_ins = cfg->arch.seq_point_ss_method_var;
                MonoInst *bp_method_ins = cfg->arch.seq_point_bp_method_var;
+
                g_assert (ss_method_ins->opcode == OP_REGOFFSET);
                g_assert (arm_is_imm12 (ss_method_ins->inst_offset));
-               g_assert (bp_method_ins->opcode == OP_REGOFFSET);
-               g_assert (arm_is_imm12 (bp_method_ins->inst_offset));
 
-               ARM_MOV_REG_REG (code, ARMREG_LR, ARMREG_PC);
-               ARM_B (code, 1);
-               *(gpointer*)code = &single_step_tramp;
-               code += 4;
-               *(gpointer*)code = breakpoint_tramp;
-               code += 4;
+               if (cfg->compile_aot) {
+                       MonoInst *info_var = cfg->arch.seq_point_info_var;
+                       int dreg = ARMREG_LR;
+
+                       g_assert (info_var->opcode == OP_REGOFFSET);
+                       g_assert (arm_is_imm12 (info_var->inst_offset));
 
-               ARM_LDR_IMM (code, ARMREG_IP, ARMREG_LR, 0);
-               ARM_STR_IMM (code, ARMREG_IP, ss_method_ins->inst_basereg, ss_method_ins->inst_offset);
-               ARM_LDR_IMM (code, ARMREG_IP, ARMREG_LR, 4);
-               ARM_STR_IMM (code, ARMREG_IP, bp_method_ins->inst_basereg, bp_method_ins->inst_offset);
+                       ARM_LDR_IMM (code, dreg, info_var->inst_basereg, info_var->inst_offset);
+                       ARM_LDR_IMM (code, dreg, dreg, MONO_STRUCT_OFFSET (SeqPointInfo, ss_tramp_addr));
+                       ARM_STR_IMM (code, dreg, ss_method_ins->inst_basereg, ss_method_ins->inst_offset);
+               } else {
+                       g_assert (bp_method_ins->opcode == OP_REGOFFSET);
+                       g_assert (arm_is_imm12 (bp_method_ins->inst_offset));
+
+                       ARM_MOV_REG_REG (code, ARMREG_LR, ARMREG_PC);
+                       ARM_B (code, 1);
+                       *(gpointer*)code = &single_step_tramp;
+                       code += 4;
+                       *(gpointer*)code = breakpoint_tramp;
+                       code += 4;
+
+                       ARM_LDR_IMM (code, ARMREG_IP, ARMREG_LR, 0);
+                       ARM_STR_IMM (code, ARMREG_IP, ss_method_ins->inst_basereg, ss_method_ins->inst_offset);
+                       ARM_LDR_IMM (code, ARMREG_IP, ARMREG_LR, 4);
+                       ARM_STR_IMM (code, ARMREG_IP, bp_method_ins->inst_basereg, bp_method_ins->inst_offset);
+               }
        }
 
        cfg->code_len = code - cfg->native_code;
@@ -7169,17 +7217,19 @@ mono_arch_set_breakpoint (MonoJitInfo *ji, guint8 *ip)
        guint32 native_offset = ip - (guint8*)ji->code_start;
        MonoDebugOptions *opt = mini_get_debug_options ();
 
-       if (opt->soft_breakpoints) {
-               g_assert (!ji->from_aot);
-               code += 4;
-               ARM_BLX_REG (code, ARMREG_LR);
-               mono_arch_flush_icache (code - 4, 4);
-       } else if (ji->from_aot) {
+       if (ji->from_aot) {
                SeqPointInfo *info = mono_arch_get_seq_point_info (mono_domain_get (), ji->code_start);
 
+               if (!breakpoint_tramp)
+                       breakpoint_tramp = mini_get_breakpoint_trampoline ();
+
                g_assert (native_offset % 4 == 0);
                g_assert (info->bp_addrs [native_offset / 4] == 0);
-               info->bp_addrs [native_offset / 4] = bp_trigger_page;
+               info->bp_addrs [native_offset / 4] = opt->soft_breakpoints ? breakpoint_tramp : bp_trigger_page;
+       } else if (opt->soft_breakpoints) {
+               code += 4;
+               ARM_BLX_REG (code, ARMREG_LR);
+               mono_arch_flush_icache (code - 4, 4);
        } else {
                int dreg = ARMREG_LR;
 
@@ -7215,18 +7265,20 @@ mono_arch_clear_breakpoint (MonoJitInfo *ji, guint8 *ip)
        guint8 *code = ip;
        int i;
 
-       if (opt->soft_breakpoints) {
-               g_assert (!ji->from_aot);
-               code += 4;
-               ARM_NOP (code);
-               mono_arch_flush_icache (code - 4, 4);
-       } else if (ji->from_aot) {
+       if (ji->from_aot) {
                guint32 native_offset = ip - (guint8*)ji->code_start;
                SeqPointInfo *info = mono_arch_get_seq_point_info (mono_domain_get (), ji->code_start);
 
+               if (!breakpoint_tramp)
+                       breakpoint_tramp = mini_get_breakpoint_trampoline ();
+
                g_assert (native_offset % 4 == 0);
-               g_assert (info->bp_addrs [native_offset / 4] == bp_trigger_page);
+               g_assert (info->bp_addrs [native_offset / 4] == (opt->soft_breakpoints ? breakpoint_tramp : bp_trigger_page));
                info->bp_addrs [native_offset / 4] = 0;
+       } else if (opt->soft_breakpoints) {
+               code += 4;
+               ARM_NOP (code);
+               mono_arch_flush_icache (code - 4, 4);
        } else {
                for (i = 0; i < 4; ++i)
                        ARM_NOP (code);
@@ -7364,6 +7416,7 @@ mono_arch_get_seq_point_info (MonoDomain *domain, guint8 *code)
 
                info->ss_trigger_page = ss_trigger_page;
                info->bp_trigger_page = bp_trigger_page;
+               info->ss_tramp_addr = &single_step_tramp;
 
                mono_domain_lock (domain);
                g_hash_table_insert (domain_jit_info (domain)->arch_seq_points,
index 046b8c543fff784b91b7342b1d1d00eb7ce4d856..bc23a423d29a1f576c26f969c33e26ffd9d7a180 100644 (file)
@@ -226,6 +226,7 @@ typedef struct {
 typedef struct {
        gpointer ss_trigger_page;
        gpointer bp_trigger_page;
+       gpointer ss_tramp_addr;
        guint8* bp_addrs [MONO_ZERO_LEN_ARRAY];
 } SeqPointInfo;
 
index b64f4e24e1711001f7198928b5ac0ea442c78a22..d16cee8cee3daa00962ced9e1ed97a12959fc445 100644 (file)
@@ -89,9 +89,6 @@ static gpointer throw_corlib_exception_func;
 static gpointer try_more_restore_tramp = NULL;
 static gpointer restore_stack_protection_tramp = NULL;
 
-static MonoUnhandledExceptionFunc unhandled_exception_hook = NULL;
-static gpointer unhandled_exception_hook_data = NULL;
-
 static void try_more_restore (void);
 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);
@@ -2487,9 +2484,6 @@ mono_print_thread_dump_internal (void *sigctx, MonoContext *start_ctx)
 #endif
        GString* text;
        char *name;
-#ifndef HOST_WIN32
-       char *wapi_desc;
-#endif
        GError *error = NULL;
 
        if (!thread)
@@ -2507,11 +2501,9 @@ mono_print_thread_dump_internal (void *sigctx, MonoContext *start_ctx)
        else
                g_string_append (text, "\n\"<unnamed thread>\"");
 
-#ifndef HOST_WIN32
-       wapi_desc = wapi_current_thread_desc ();
-       g_string_append_printf (text, " tid=0x%p this=0x%p %s\n", (gpointer)(gsize)thread->tid, thread,  wapi_desc);
-       free (wapi_desc);
-#endif
+       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);
+       g_string_append (text, "\n");
 
 #ifdef MONO_ARCH_HAVE_SIGCTX_TO_MONOCTX
        if (start_ctx) {
@@ -2645,7 +2637,6 @@ install_handler_block_guard (MonoJitInfo *ji, MonoContext *ctx)
 
 /*
  * Finds the bottom handler block running and install a block guard if needed.
- * FIXME add full-aot support.
  */
 gboolean
 mono_install_handler_block_guard (MonoThreadUnwindState *ctx)
@@ -2654,9 +2645,10 @@ mono_install_handler_block_guard (MonoThreadUnwindState *ctx)
        MonoJitTlsData *jit_tls = (MonoJitTlsData *)ctx->unwind_data [MONO_UNWIND_DATA_JIT_TLS];
        gpointer resume_ip;
 
-       /* FIXME */
+#ifndef MONO_ARCH_HAVE_HANDLER_BLOCK_GUARD_AOT
        if (mono_aot_only)
                return FALSE;
+#endif
 
        /* Guard against a null MonoJitTlsData. This can happens if the thread receives the
          * interrupt signal before the JIT has time to initialize its TLS data for the given thread.
@@ -2824,54 +2816,6 @@ mono_setup_async_callback (MonoContext *ctx, void (*async_cb)(void *fun), gpoint
 #endif
 }
 
-void
-mono_install_unhandled_exception_hook (MonoUnhandledExceptionFunc func, gpointer user_data)
-{
-       unhandled_exception_hook = func;
-       unhandled_exception_hook_data = user_data;
-}
-
-void
-mono_invoke_unhandled_exception_hook (MonoObject *exc)
-{
-       if (unhandled_exception_hook) {
-               unhandled_exception_hook (exc, unhandled_exception_hook_data);
-       } else {
-               MonoError inner_error;
-               MonoObject *other = NULL;
-               MonoString *str = mono_object_try_to_string (exc, &other, &inner_error);
-               char *msg = NULL;
-               
-               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);
-               } else if (other) {
-                       char *original_backtrace = mono_exception_get_managed_backtrace ((MonoException*)exc);
-                       char *nested_backtrace = mono_exception_get_managed_backtrace ((MonoException*)other);
-
-                       msg = g_strdup_printf ("Nested exception detected.\nOriginal Exception: %s\nNested exception:%s\n",
-                               original_backtrace, nested_backtrace);
-
-                       g_free (original_backtrace);
-                       g_free (nested_backtrace);
-               } else {
-                       msg = g_strdup ("Nested exception trying to figure out what went wrong");
-               }
-               mono_runtime_printf_err ("[ERROR] FATAL UNHANDLED EXCEPTION: %s", msg);
-               g_free (msg);
-#if defined(HOST_IOS)
-               g_assertion_message ("Terminating runtime due to unhandled exception");
-#else
-               exit (mono_environment_exitcode_get ());
-#endif
-       }
-
-       g_assert_not_reached ();
-}
-
 /*
  * mono_restore_context:
  *
@@ -2930,6 +2874,7 @@ throw_exception (MonoObject *ex, gboolean rethrow)
                mono_error_assert_ok (&error);
                mono_ex = mono_get_exception_runtime_wrapped_checked (ex, &error);
                mono_error_assert_ok (&error);
+               jit_tls->thrown_non_exc = mono_gchandle_new (ex, FALSE);
        }
        else
                mono_ex = (MonoException*)ex;
@@ -3009,7 +2954,7 @@ mono_llvm_resume_exception (void)
 MonoObject *
 mono_llvm_load_exception (void)
 {
-               MonoError error;
+       MonoError error;
        MonoJitTlsData *jit_tls = mono_get_jit_tls ();
 
        MonoException *mono_ex = (MonoException*)mono_gchandle_get_target (jit_tls->thrown_exc);
@@ -3061,6 +3006,9 @@ mono_llvm_clear_exception (void)
        MonoJitTlsData *jit_tls = mono_get_jit_tls ();
        mono_gchandle_free (jit_tls->thrown_exc);
        jit_tls->thrown_exc = 0;
+       if (jit_tls->thrown_non_exc)
+               mono_gchandle_free (jit_tls->thrown_non_exc);
+       jit_tls->thrown_non_exc = 0;
 
        mono_memory_barrier ();
 }
@@ -3074,13 +3022,22 @@ mono_llvm_clear_exception (void)
 gint32
 mono_llvm_match_exception (MonoJitInfo *jinfo, guint32 region_start, guint32 region_end, gpointer rgctx, MonoObject *this_obj)
 {
-                       MonoError error;
+       MonoError error;
        MonoJitTlsData *jit_tls = mono_get_jit_tls ();
        MonoObject *exc;
        gint32 index = -1;
 
        g_assert (jit_tls->thrown_exc);
        exc = mono_gchandle_get_target (jit_tls->thrown_exc);
+       if (jit_tls->thrown_non_exc) {
+               /*
+                * Have to unwrap RuntimeWrappedExceptions if the
+                * method's assembly doesn't have a RuntimeCompatibilityAttribute.
+                */
+               if (!wrap_non_exception_throws (jinfo_get_method (jinfo)))
+                       exc = mono_gchandle_get_target (jit_tls->thrown_non_exc);
+       }
+
        for (int i = 0; i < jinfo->num_clauses; i++) {
                MonoJitExceptionInfo *ei = &jinfo->clauses [i];
                MonoClass *catch_class;
@@ -3089,7 +3046,7 @@ mono_llvm_match_exception (MonoJitInfo *jinfo, guint32 region_start, guint32 reg
                        continue;
 
                catch_class = ei->data.catch_class;
-               if (catch_class->byval_arg.type == MONO_TYPE_VAR || catch_class->byval_arg.type == MONO_TYPE_MVAR || catch_class->byval_arg.type == MONO_TYPE_GENERICINST) {
+               if (mono_class_is_open_constructed_type (&catch_class->byval_arg)) {
                        MonoGenericContext context;
                        MonoType *inflated_type;
 
index e1e2eb19b430c0040972a551caad3acf31f757a0..aca368c9dba9e1ad8ef382fa8e7532a93981ffe5 100644 (file)
@@ -607,6 +607,7 @@ inflate_info (MonoRuntimeGenericContextInfoTemplate *oti, MonoGenericContext *co
                MonoMethod *inflated_method;
                MonoType *inflated_type = mono_class_inflate_generic_type_checked (&method->klass->byval_arg, context, &error);
                mono_error_assert_ok (&error); /* FIXME don't swallow the error */
+               WrapperInfo *winfo = NULL;
 
                MonoClass *inflated_class = mono_class_from_mono_type (inflated_type);
                MonoJumpInfoGSharedVtCall *res;
@@ -620,7 +621,13 @@ inflate_info (MonoRuntimeGenericContextInfoTemplate *oti, MonoGenericContext *co
 
                mono_class_init (inflated_class);
 
-               g_assert (!method->wrapper_type);
+               if (method->wrapper_type) {
+                       winfo = mono_marshal_get_wrapper_info (method);
+
+                       g_assert (winfo);
+                       g_assert (winfo->subtype == WRAPPER_SUBTYPE_SYNCHRONIZED_INNER);
+                       method = winfo->d.synchronized_inner.method;
+               }
 
                if (inflated_class->byval_arg.type == MONO_TYPE_ARRAY ||
                                inflated_class->byval_arg.type == MONO_TYPE_SZARRAY) {
@@ -633,6 +640,12 @@ inflate_info (MonoRuntimeGenericContextInfoTemplate *oti, MonoGenericContext *co
                }
                mono_class_init (inflated_method->klass);
                g_assert (inflated_method->klass == inflated_class);
+
+               if (winfo) {
+                       g_assert (winfo->subtype == WRAPPER_SUBTYPE_SYNCHRONIZED_INNER);
+                       inflated_method = mono_marshal_get_synchronized_inner_wrapper (inflated_method);
+               }
+
                res->method = inflated_method;
 
                return res;
@@ -1758,6 +1771,9 @@ instantiate_info (MonoDomain *domain, MonoRuntimeGenericContextInfoTemplate *oti
 
                g_assert (method->is_inflated);
 
+               if (mono_llvm_only && (method->iflags & METHOD_IMPL_ATTRIBUTE_SYNCHRONIZED))
+                       method = mono_marshal_get_synchronized_wrapper (method);
+
                if (!virtual_) {
                        addr = mono_compile_method_checked (method, error);
                        return_val_if_nok (error, NULL);
index e3219686ae2cf5beb7eb8ea5adb7fc9987e51d86..1bf14393db25142339add6f35a4e311d3ccbc728 100644 (file)
@@ -54,10 +54,20 @@ mono_llvm_build_alloca (LLVMBuilderRef builder, LLVMTypeRef Ty,
 
 LLVMValueRef 
 mono_llvm_build_load (LLVMBuilderRef builder, LLVMValueRef PointerVal,
-                                         const char *Name, gboolean is_volatile, BarrierKind barrier)
+                                         const char *Name, gboolean is_volatile)
 {
        LoadInst *ins = unwrap(builder)->CreateLoad(unwrap(PointerVal), is_volatile, Name);
 
+       return wrap(ins);
+}
+
+LLVMValueRef
+mono_llvm_build_atomic_load (LLVMBuilderRef builder, LLVMValueRef PointerVal,
+                                                        const char *Name, gboolean is_volatile, int alignment, BarrierKind barrier)
+{
+       LoadInst *ins = unwrap(builder)->CreateLoad(unwrap(PointerVal), is_volatile, Name);
+
+       ins->setAlignment (alignment);
        switch (barrier) {
        case LLVM_BARRIER_NONE:
                break;
@@ -219,6 +229,14 @@ mono_llvm_set_call_preserveall_cc (LLVMValueRef func)
        unwrap<CallInst>(func)->setCallingConv (CallingConv::PreserveAll);
 }
 
+void
+mono_llvm_set_call_notail (LLVMValueRef func)
+{
+#if LLVM_API_VERSION > 100
+       //unwrap<CallInst>(func)->setTailCallKind (CallInst::TailCallKind::TCK_NoTail);
+#endif
+}
+
 #if LLVM_API_VERSION > 100
 
 void*
@@ -236,16 +254,21 @@ mono_llvm_di_create_compile_unit (void *di_builder, const char *cu_name, const c
 }
 
 void*
-mono_llvm_di_create_function (void *di_builder, void *cu, const char *name, const char *mangled_name, const char *dir, const char *file, int line)
+mono_llvm_di_create_function (void *di_builder, void *cu, LLVMValueRef func, const char *name, const char *mangled_name, const char *dir, const char *file, int line)
 {
        DIBuilder *builder = (DIBuilder*)di_builder;
        DIFile *di_file;
        DISubroutineType *type;
+       DISubprogram *di_func;
 
        // FIXME: Share DIFile
        di_file = builder->createFile (file, dir);
        type = builder->createSubroutineType (builder->getOrCreateTypeArray (ArrayRef<Metadata*> ()));
-       return builder->createFunction (di_file, name, mangled_name, di_file, line, type, true, true, 0);
+       di_func = builder->createFunction (di_file, name, mangled_name, di_file, line, type, true, true, 0);
+
+       unwrap<Function>(func)->setMetadata ("dbg", di_func);
+
+       return di_func;
 }
 
 void*
index 06858713f4eaa99ab63cacd0d6449007fb203876..f969274e4a7f6bfb211b13063d73dea5f51a61a2 100644 (file)
@@ -44,9 +44,13 @@ mono_llvm_build_alloca (LLVMBuilderRef builder, LLVMTypeRef Ty,
 
 LLVMValueRef 
 mono_llvm_build_load (LLVMBuilderRef builder, LLVMValueRef PointerVal,
-                                         const char *Name, gboolean is_volatile, BarrierKind barrier);
+                                         const char *Name, gboolean is_volatile);
 
 LLVMValueRef 
+mono_llvm_build_atomic_load (LLVMBuilderRef builder, LLVMValueRef PointerVal,
+                                                        const char *Name, gboolean is_volatile, int alignment, BarrierKind barrier);
+
+LLVMValueRef
 mono_llvm_build_aligned_load (LLVMBuilderRef builder, LLVMValueRef PointerVal,
                                                          const char *Name, gboolean is_volatile, int alignment);
 
@@ -85,6 +89,9 @@ mono_llvm_set_preserveall_cc (LLVMValueRef func);
 void
 mono_llvm_set_call_preserveall_cc (LLVMValueRef call);
 
+void
+mono_llvm_set_call_notail (LLVMValueRef call);
+
 _Unwind_Reason_Code 
 mono_debug_personality (int a, _Unwind_Action b,
        uint64_t c, struct _Unwind_Exception *d, struct _Unwind_Context *e);
@@ -96,7 +103,7 @@ void*
 mono_llvm_create_di_builder (LLVMModuleRef module);
 
 void*
-mono_llvm_di_create_function (void *di_builder, void *cu, const char *name, const char *mangled_name, const char *dir, const char *file, int line);
+mono_llvm_di_create_function (void *di_builder, void *cu, LLVMValueRef func, const char *name, const char *mangled_name, const char *dir, const char *file, int line);
 
 void*
 mono_llvm_di_create_compile_unit (void *di_builder, const char *cu_name, const char *dir, const char *producer);
index 79f2dbcad50b7dd51bf49528ccddfad2c99b3aa3..61f3730f520383cefbc8fb9fc89b5d279f097cf4 100644 (file)
@@ -72,6 +72,7 @@ typedef struct {
        gboolean external_symbols;
        gboolean emit_dwarf;
        int max_got_offset;
+       LLVMValueRef personality;
 
        /* For AOT */
        MonoAssembly *assembly;
@@ -812,14 +813,6 @@ simd_op_to_intrins (int opcode)
                return "llvm.x86.sse2.min.pd";
        case OP_MINPS:
                return "llvm.x86.sse.min.ps";
-       case OP_PMIND_UN:
-               return "llvm.x86.sse41.pminud";
-       case OP_PMINW_UN:
-               return "llvm.x86.sse41.pminuw";
-       case OP_PMINB_UN:
-               return "llvm.x86.sse2.pminu.b";
-       case OP_PMINW:
-               return "llvm.x86.sse2.pmins.w";
        case OP_MAXPD:
                return "llvm.x86.sse2.max.pd";
        case OP_MAXPS:
@@ -832,12 +825,6 @@ simd_op_to_intrins (int opcode)
                return "llvm.x86.sse3.hsub.pd";
        case OP_HSUBPS:
                return "llvm.x86.sse3.hsub.ps";
-       case OP_PMAXD_UN:
-               return "llvm.x86.sse41.pmaxud";
-       case OP_PMAXW_UN:
-               return "llvm.x86.sse41.pmaxuw";
-       case OP_PMAXB_UN:
-               return "llvm.x86.sse2.pmaxu.b";
        case OP_ADDSUBPS:
                return "llvm.x86.sse3.addsub.ps";
        case OP_ADDSUBPD:
@@ -912,10 +899,6 @@ simd_op_to_intrins (int opcode)
                return "llvm.x86.sse2.cvttpd2dq";
        case OP_CVTTPS2DQ:
                return "llvm.x86.sse2.cvttps2dq";
-       case OP_COMPPS:
-               return "llvm.x86.sse.cmp.ps";
-       case OP_COMPPD:
-               return "llvm.x86.sse2.cmp.pd";
        case OP_PACKW:
                return "llvm.x86.sse2.packsswb.128";
        case OP_PACKD:
@@ -1155,8 +1138,19 @@ static LLVMValueRef
 emit_volatile_load (EmitContext *ctx, int vreg)
 {
        MonoType *t;
+       LLVMValueRef v;
 
-       LLVMValueRef v = LLVMBuildLoad (ctx->builder, ctx->addresses [vreg], "");
+#ifdef TARGET_ARM64
+       // FIXME: This hack is required because we pass the rgctx in a callee saved
+       // register on arm64 (x15), and llvm might keep the value in that register
+       // even through the register is marked as 'reserved' inside llvm.
+       if (ctx->cfg->rgctx_var && ctx->cfg->rgctx_var->dreg == vreg)
+               v = mono_llvm_build_load (ctx->builder, ctx->addresses [vreg], "", TRUE);
+       else
+               v = LLVMBuildLoad (ctx->builder, ctx->addresses [vreg], "");
+#else
+       v = LLVMBuildLoad (ctx->builder, ctx->addresses [vreg], "");
+#endif
        t = ctx->vreg_cli_types [vreg];
        if (t && !t->byref) {
                /* 
@@ -1589,18 +1583,17 @@ get_aotconst_typed (EmitContext *ctx, MonoJumpInfoType type, gconstpointer data,
        MonoCompile *cfg;
        guint32 got_offset;
        LLVMValueRef indexes [2];
-       MonoJumpInfo *ji;
        LLVMValueRef got_entry_addr, load;
        LLVMBuilderRef builder = ctx->builder;
        char *name = NULL;
 
        cfg = ctx->cfg;
 
-       ji = g_new0 (MonoJumpInfo, 1);
-       ji->type = type;
-       ji->data.target = data;
+       MonoJumpInfo tmp_ji;
+       tmp_ji.type = type;
+       tmp_ji.data.target = data;
 
-       ji = mono_aot_patch_info_dup (ji);
+       MonoJumpInfo *ji = mono_aot_patch_info_dup (&tmp_ji);
 
        ji->next = cfg->patch_info;
        cfg->patch_info = ji;
@@ -1873,7 +1866,7 @@ emit_call (EmitContext *ctx, MonoBasicBlock *bb, LLVMBuilderRef *builder_ref, LL
 }
 
 static LLVMValueRef
-emit_load_general (EmitContext *ctx, MonoBasicBlock *bb, LLVMBuilderRef *builder_ref, int size, LLVMValueRef addr, const char *name, gboolean is_faulting, BarrierKind barrier)
+emit_load_general (EmitContext *ctx, MonoBasicBlock *bb, LLVMBuilderRef *builder_ref, int size, LLVMValueRef addr, LLVMValueRef base, const char *name, gboolean is_faulting, BarrierKind barrier)
 {
        const char *intrins_name;
        LLVMValueRef args [16], res;
@@ -1883,7 +1876,9 @@ emit_load_general (EmitContext *ctx, MonoBasicBlock *bb, LLVMBuilderRef *builder
 #if LLVM_API_VERSION > 100
        if (is_faulting && bb->region != -1 && !ctx->cfg->llvm_only) {
                /* The llvm.mono.load/store intrinsics are not supported by this llvm version, emit an explicit null check instead */
-               LLVMValueRef cmp = LLVMBuildICmp (*builder_ref, LLVMIntEQ, addr, LLVMConstNull (LLVMTypeOf (addr)), "");
+               LLVMValueRef cmp;
+
+               cmp = LLVMBuildICmp (*builder_ref, LLVMIntEQ, base, LLVMConstNull (LLVMTypeOf (base)), "");
                emit_cond_system_exception (ctx, bb, "NullReferenceException", cmp);
                *builder_ref = ctx->builder;
                use_intrinsics = FALSE;
@@ -1955,26 +1950,29 @@ emit_load_general (EmitContext *ctx, MonoBasicBlock *bb, LLVMBuilderRef *builder
                 * LLVM will generate invalid code when encountering a load from a
                 * NULL address.
                 */
-                res = mono_llvm_build_load (*builder_ref, addr, name, is_faulting, barrier);
+               if (barrier != LLVM_BARRIER_NONE)
+                       res = mono_llvm_build_atomic_load (*builder_ref, addr, name, is_faulting, size, barrier);
+               else
+                       res = mono_llvm_build_load (*builder_ref, addr, name, is_faulting);
 
-                /* Mark it with a custom metadata */
-                /*
-                if (is_faulting)
-                        set_metadata_flag (res, "mono.faulting.load");
-                */
+               /* Mark it with a custom metadata */
+               /*
+                 if (is_faulting)
+                 set_metadata_flag (res, "mono.faulting.load");
+               */
 
-                return res;
+               return res;
        }
 }
 
 static LLVMValueRef
 emit_load (EmitContext *ctx, MonoBasicBlock *bb, LLVMBuilderRef *builder_ref, int size, LLVMValueRef addr, const char *name, gboolean is_faulting)
 {
-       return emit_load_general (ctx, bb, builder_ref, size, addr, name, is_faulting, LLVM_BARRIER_NONE);
+       return emit_load_general (ctx, bb, builder_ref, size, addr, addr, name, is_faulting, LLVM_BARRIER_NONE);
 }
 
 static void
-emit_store_general (EmitContext *ctx, MonoBasicBlock *bb, LLVMBuilderRef *builder_ref, int size, LLVMValueRef value, LLVMValueRef addr, gboolean is_faulting, BarrierKind barrier)
+emit_store_general (EmitContext *ctx, MonoBasicBlock *bb, LLVMBuilderRef *builder_ref, int size, LLVMValueRef value, LLVMValueRef addr, LLVMValueRef base, gboolean is_faulting, BarrierKind barrier)
 {
        const char *intrins_name;
        LLVMValueRef args [16];
@@ -1983,7 +1981,7 @@ emit_store_general (EmitContext *ctx, MonoBasicBlock *bb, LLVMBuilderRef *builde
 #if LLVM_API_VERSION > 100
        if (is_faulting && bb->region != -1 && !ctx->cfg->llvm_only) {
                /* The llvm.mono.load/store intrinsics are not supported by this llvm version, emit an explicit null check instead */
-               LLVMValueRef cmp = LLVMBuildICmp (*builder_ref, LLVMIntEQ, addr, LLVMConstNull (LLVMTypeOf (addr)), "");
+               LLVMValueRef cmp = LLVMBuildICmp (*builder_ref, LLVMIntEQ, base, LLVMConstNull (LLVMTypeOf (base)), "");
                emit_cond_system_exception (ctx, bb, "NullReferenceException", cmp);
                *builder_ref = ctx->builder;
                use_intrinsics = FALSE;
@@ -2045,9 +2043,9 @@ emit_store_general (EmitContext *ctx, MonoBasicBlock *bb, LLVMBuilderRef *builde
 }
 
 static void
-emit_store (EmitContext *ctx, MonoBasicBlock *bb, LLVMBuilderRef *builder_ref, int size, LLVMValueRef value, LLVMValueRef addr, gboolean is_faulting)
+emit_store (EmitContext *ctx, MonoBasicBlock *bb, LLVMBuilderRef *builder_ref, int size, LLVMValueRef value, LLVMValueRef addr, LLVMValueRef base, gboolean is_faulting)
 {
-       emit_store_general (ctx, bb, builder_ref, size, value, addr, is_faulting, LLVM_BARRIER_NONE);
+       emit_store_general (ctx, bb, builder_ref, size, value, addr, base, is_faulting, LLVM_BARRIER_NONE);
 }
 
 /*
@@ -2417,7 +2415,7 @@ emit_get_method (MonoLLVMModule *module)
        LLVMBasicBlockRef entry_bb, fail_bb, bb, code_start_bb, code_end_bb;
        LLVMBasicBlockRef *bbs;
        LLVMTypeRef rtype;
-       LLVMBuilderRef builder;
+       LLVMBuilderRef builder = LLVMCreateBuilder ();
        char *name;
        int i;
 
@@ -2443,14 +2441,12 @@ emit_get_method (MonoLLVMModule *module)
        name = g_strdup_printf ("BB_CODE_START");
        code_start_bb = LLVMAppendBasicBlock (func, name);
        g_free (name);
-       builder = LLVMCreateBuilder ();
        LLVMPositionBuilderAtEnd (builder, code_start_bb);
        LLVMBuildRet (builder, LLVMBuildBitCast (builder, module->code_start, rtype, ""));
 
        name = g_strdup_printf ("BB_CODE_END");
        code_end_bb = LLVMAppendBasicBlock (func, name);
        g_free (name);
-       builder = LLVMCreateBuilder ();
        LLVMPositionBuilderAtEnd (builder, code_end_bb);
        LLVMBuildRet (builder, LLVMBuildBitCast (builder, module->code_end, rtype, ""));
 
@@ -2461,7 +2457,6 @@ emit_get_method (MonoLLVMModule *module)
                g_free (name);
                bbs [i] = bb;
 
-               builder = LLVMCreateBuilder ();
                LLVMPositionBuilderAtEnd (builder, bb);
 
                m = (LLVMValueRef)g_hash_table_lookup (module->idx_to_lmethod, GINT_TO_POINTER (i));
@@ -2472,11 +2467,9 @@ emit_get_method (MonoLLVMModule *module)
        }
 
        fail_bb = LLVMAppendBasicBlock (func, "FAIL");
-       builder = LLVMCreateBuilder ();
        LLVMPositionBuilderAtEnd (builder, fail_bb);
        LLVMBuildRet (builder, LLVMConstNull (rtype));
 
-       builder = LLVMCreateBuilder ();
        LLVMPositionBuilderAtEnd (builder, entry_bb);
 
        switch_ins = LLVMBuildSwitch (builder, LLVMGetParam (func, 0), fail_bb, 0);
@@ -2487,6 +2480,8 @@ emit_get_method (MonoLLVMModule *module)
        }
 
        mark_as_used (module, func);
+
+       LLVMDisposeBuilder (builder);
 }
 
 /*
@@ -2502,7 +2497,7 @@ emit_get_unbox_tramp (MonoLLVMModule *module)
        LLVMBasicBlockRef entry_bb, fail_bb, bb;
        LLVMBasicBlockRef *bbs;
        LLVMTypeRef rtype;
-       LLVMBuilderRef builder;
+       LLVMBuilderRef builder = LLVMCreateBuilder ();
        char *name;
        int i;
 
@@ -2528,18 +2523,15 @@ emit_get_unbox_tramp (MonoLLVMModule *module)
                g_free (name);
                bbs [i] = bb;
 
-               builder = LLVMCreateBuilder ();
                LLVMPositionBuilderAtEnd (builder, bb);
 
                LLVMBuildRet (builder, LLVMBuildBitCast (builder, m, rtype, ""));
        }
 
        fail_bb = LLVMAppendBasicBlock (func, "FAIL");
-       builder = LLVMCreateBuilder ();
        LLVMPositionBuilderAtEnd (builder, fail_bb);
        LLVMBuildRet (builder, LLVMConstNull (rtype));
 
-       builder = LLVMCreateBuilder ();
        LLVMPositionBuilderAtEnd (builder, entry_bb);
 
        switch_ins = LLVMBuildSwitch (builder, LLVMGetParam (func, 0), fail_bb, 0);
@@ -2552,6 +2544,7 @@ emit_get_unbox_tramp (MonoLLVMModule *module)
        }
 
        mark_as_used (module, func);
+       LLVMDisposeBuilder (builder);
 }
 
 /* Add a function to mark the beginning of LLVM code */
@@ -2571,6 +2564,7 @@ emit_llvm_code_start (MonoLLVMModule *module)
        builder = LLVMCreateBuilder ();
        LLVMPositionBuilderAtEnd (builder, entry_bb);
        LLVMBuildRetVoid (builder);
+       LLVMDisposeBuilder (builder);
 }
 
 static LLVMValueRef
@@ -2644,6 +2638,7 @@ emit_init_icall_wrapper (MonoLLVMModule *module, const char *name, const char *i
        LLVMBuildRetVoid (builder);
 
        LLVMVerifyFunction(func, LLVMAbortProcessAction);
+       LLVMDisposeBuilder (builder);
        return func;
 }
 
@@ -2677,6 +2672,7 @@ emit_llvm_code_end (MonoLLVMModule *module)
        builder = LLVMCreateBuilder ();
        LLVMPositionBuilderAtEnd (builder, entry_bb);
        LLVMBuildRetVoid (builder);
+       LLVMDisposeBuilder (builder);
 }
 
 static void
@@ -2867,6 +2863,7 @@ emit_unbox_tramp (EmitContext *ctx, const char *method_name, LLVMTypeRef method_
                LLVMBuildRet (builder, call);
 
        g_hash_table_insert (ctx->module->idx_to_unbox_tramp, GINT_TO_POINTER (method_index), tramp);
+       LLVMDisposeBuilder (builder);
 }
 
 /*
@@ -3361,7 +3358,7 @@ process_call (EmitContext *ctx, MonoBasicBlock *bb, LLVMBuilderRef *builder_ref,
                if (!ctx->imt_rgctx_loc)
                        ctx->imt_rgctx_loc = build_alloca_llvm_type (ctx, ctx->module->ptr_type, sizeof (gpointer));
                LLVMBuildStore (builder, convert (ctx, ctx->values [call->rgctx_arg_reg], ctx->module->ptr_type), ctx->imt_rgctx_loc);
-               args [cinfo->rgctx_arg_pindex] = mono_llvm_build_load (builder, ctx->imt_rgctx_loc, "", TRUE, LLVM_BARRIER_NONE);
+               args [cinfo->rgctx_arg_pindex] = mono_llvm_build_load (builder, ctx->imt_rgctx_loc, "", TRUE);
 #else
                args [cinfo->rgctx_arg_pindex] = convert (ctx, values [call->rgctx_arg_reg], ctx->module->ptr_type);
 #endif
@@ -3374,7 +3371,7 @@ process_call (EmitContext *ctx, MonoBasicBlock *bb, LLVMBuilderRef *builder_ref,
                if (!ctx->imt_rgctx_loc)
                        ctx->imt_rgctx_loc = build_alloca_llvm_type (ctx, ctx->module->ptr_type, sizeof (gpointer));
                LLVMBuildStore (builder, convert (ctx, ctx->values [call->imt_arg_reg], ctx->module->ptr_type), ctx->imt_rgctx_loc);
-               args [cinfo->imt_arg_pindex] = mono_llvm_build_load (builder, ctx->imt_rgctx_loc, "", TRUE, LLVM_BARRIER_NONE);
+               args [cinfo->imt_arg_pindex] = mono_llvm_build_load (builder, ctx->imt_rgctx_loc, "", TRUE);
 #else
                args [cinfo->imt_arg_pindex] = convert (ctx, values [call->imt_arg_reg], ctx->module->ptr_type);
 #endif
@@ -3970,13 +3967,18 @@ emit_handler_start (EmitContext *ctx, MonoBasicBlock *bb, LLVMBuilderRef builder
                g_assert (personality);
        } else {
 #if LLVM_API_VERSION > 100
-               LLVMTypeRef personality_type = LLVMFunctionType (LLVMInt32Type (), NULL, 0, TRUE);
-               personality = LLVMAddFunction (ctx->lmodule, "mono_personality", personality_type);
-               LLVMAddFunctionAttr (personality, LLVMNoUnwindAttribute);
-               LLVMBasicBlockRef entry_bb = LLVMAppendBasicBlock (personality, "ENTRY");
-               LLVMBuilderRef builder2 = LLVMCreateBuilder ();
-               LLVMPositionBuilderAtEnd (builder2, entry_bb);
-               LLVMBuildRet (builder2, LLVMConstInt (LLVMInt32Type (), 0, FALSE));
+               personality = ctx->module->personality;
+               if (!personality) {
+                       LLVMTypeRef personality_type = LLVMFunctionType (LLVMInt32Type (), NULL, 0, TRUE);
+                       personality = LLVMAddFunction (ctx->lmodule, "mono_personality", personality_type);
+                       LLVMAddFunctionAttr (personality, LLVMNoUnwindAttribute);
+                       LLVMBasicBlockRef entry_bb = LLVMAppendBasicBlock (personality, "ENTRY");
+                       LLVMBuilderRef builder2 = LLVMCreateBuilder ();
+                       LLVMPositionBuilderAtEnd (builder2, entry_bb);
+                       LLVMBuildRet (builder2, LLVMConstInt (LLVMInt32Type (), 0, FALSE));
+                       ctx->module->personality = personality;
+                       LLVMDisposeBuilder (builder2);
+               }
 #else
                static gint32 mapping_inited;
 
@@ -5098,6 +5100,7 @@ process_bb (EmitContext *ctx, MonoBasicBlock *bb)
 
                        if ((ins->opcode == OP_LOADI8_MEM) || (ins->opcode == OP_LOAD_MEM) || (ins->opcode == OP_LOADI4_MEM) || (ins->opcode == OP_LOADU4_MEM) || (ins->opcode == OP_LOADU1_MEM) || (ins->opcode == OP_LOADU2_MEM)) {
                                addr = LLVMConstInt (IntPtrType (), ins->inst_imm, FALSE);
+                               base = addr;
                        } else {
                                /* _MEMBASE */
                                base = lhs;
@@ -5116,7 +5119,7 @@ process_bb (EmitContext *ctx, MonoBasicBlock *bb)
 
                        addr = convert (ctx, addr, LLVMPointerType (t, 0));
 
-                       values [ins->dreg] = emit_load (ctx, bb, &builder, size, addr, dname, is_volatile);
+                       values [ins->dreg] = emit_load_general (ctx, bb, &builder, size, addr, base, dname, is_volatile, LLVM_BARRIER_NONE);
 
                        if (!is_volatile && (ins->flags & MONO_INST_INVARIANT_LOAD)) {
                                /*
@@ -5146,7 +5149,7 @@ process_bb (EmitContext *ctx, MonoBasicBlock *bb)
                case OP_STORER8_MEMBASE_REG:
                case OP_STORE_MEMBASE_REG: {
                        int size = 8;
-                       LLVMValueRef index, addr;
+                       LLVMValueRef index, addr, base;
                        LLVMTypeRef t;
                        gboolean sext = FALSE, zext = FALSE;
                        gboolean is_volatile = (ins->flags & MONO_INST_FAULT);
@@ -5158,15 +5161,16 @@ process_bb (EmitContext *ctx, MonoBasicBlock *bb)
 
                        t = load_store_to_llvm_type (ins->opcode, &size, &sext, &zext);
 
+                       base = values [ins->inst_destbasereg];
                        if (ins->inst_offset % size != 0) {
                                /* Unaligned store */
                                index = LLVMConstInt (LLVMInt32Type (), ins->inst_offset, FALSE);
-                               addr = LLVMBuildGEP (builder, convert (ctx, values [ins->inst_destbasereg], LLVMPointerType (LLVMInt8Type (), 0)), &index, 1, "");
+                               addr = LLVMBuildGEP (builder, convert (ctx, base, LLVMPointerType (LLVMInt8Type (), 0)), &index, 1, "");
                        } else {
                                index = LLVMConstInt (LLVMInt32Type (), ins->inst_offset / size, FALSE);                                
-                               addr = LLVMBuildGEP (builder, convert (ctx, values [ins->inst_destbasereg], LLVMPointerType (t, 0)), &index, 1, "");
+                               addr = LLVMBuildGEP (builder, convert (ctx, base, LLVMPointerType (t, 0)), &index, 1, "");
                        }
-                       emit_store (ctx, bb, &builder, size, convert (ctx, values [ins->sreg1], t), convert (ctx, addr, LLVMPointerType (t, 0)), is_volatile);
+                       emit_store (ctx, bb, &builder, size, convert (ctx, values [ins->sreg1], t), convert (ctx, addr, LLVMPointerType (t, 0)), base, is_volatile);
                        break;
                }
 
@@ -5176,27 +5180,28 @@ process_bb (EmitContext *ctx, MonoBasicBlock *bb)
                case OP_STOREI8_MEMBASE_IMM:
                case OP_STORE_MEMBASE_IMM: {
                        int size = 8;
-                       LLVMValueRef index, addr;
+                       LLVMValueRef index, addr, base;
                        LLVMTypeRef t;
                        gboolean sext = FALSE, zext = FALSE;
                        gboolean is_volatile = (ins->flags & MONO_INST_FAULT);
 
                        t = load_store_to_llvm_type (ins->opcode, &size, &sext, &zext);
 
+                       base = values [ins->inst_destbasereg];
                        if (ins->inst_offset % size != 0) {
                                /* Unaligned store */
                                index = LLVMConstInt (LLVMInt32Type (), ins->inst_offset, FALSE);
-                               addr = LLVMBuildGEP (builder, convert (ctx, values [ins->inst_destbasereg], LLVMPointerType (LLVMInt8Type (), 0)), &index, 1, "");
+                               addr = LLVMBuildGEP (builder, convert (ctx, base, LLVMPointerType (LLVMInt8Type (), 0)), &index, 1, "");
                        } else {
                                index = LLVMConstInt (LLVMInt32Type (), ins->inst_offset / size, FALSE);                                
-                               addr = LLVMBuildGEP (builder, convert (ctx, values [ins->inst_destbasereg], LLVMPointerType (t, 0)), &index, 1, "");
+                               addr = LLVMBuildGEP (builder, convert (ctx, base, LLVMPointerType (t, 0)), &index, 1, "");
                        }
-                       emit_store (ctx, bb, &builder, size, convert (ctx, LLVMConstInt (IntPtrType (), ins->inst_imm, FALSE), t), convert (ctx, addr, LLVMPointerType (t, 0)), is_volatile);
+                       emit_store (ctx, bb, &builder, size, convert (ctx, LLVMConstInt (IntPtrType (), ins->inst_imm, FALSE), t), convert (ctx, addr, LLVMPointerType (t, 0)), base, is_volatile);
                        break;
                }
 
                case OP_CHECK_THIS:
-                       emit_load (ctx, bb, &builder, sizeof (gpointer), convert (ctx, lhs, LLVMPointerType (IntPtrType (), 0)), "", TRUE);
+                       emit_load_general (ctx, bb, &builder, sizeof (gpointer), convert (ctx, lhs, LLVMPointerType (IntPtrType (), 0)), lhs, "", TRUE, LLVM_BARRIER_NONE);
                        break;
                case OP_OUTARG_VTRETADDR:
                        break;
@@ -5439,9 +5444,7 @@ process_bb (EmitContext *ctx, MonoBasicBlock *bb)
                case OP_ATOMIC_LOAD_U8:
                case OP_ATOMIC_LOAD_R4:
                case OP_ATOMIC_LOAD_R8: {
-                       set_failure (ctx, "atomic mono.load intrinsic");
-                       break;
-#if 0
+#if LLVM_API_VERSION > 100
                        int size;
                        gboolean sext, zext;
                        LLVMTypeRef t;
@@ -5463,13 +5466,16 @@ process_bb (EmitContext *ctx, MonoBasicBlock *bb)
 
                        addr = convert (ctx, addr, LLVMPointerType (t, 0));
 
-                       values [ins->dreg] = emit_load_general (ctx, bb, &builder, size, addr, dname, is_volatile, barrier);
+                       values [ins->dreg] = emit_load_general (ctx, bb, &builder, size, addr, lhs, dname, is_volatile, barrier);
 
                        if (sext)
                                values [ins->dreg] = LLVMBuildSExt (builder, values [ins->dreg], LLVMInt32Type (), dname);
                        else if (zext)
                                values [ins->dreg] = LLVMBuildZExt (builder, values [ins->dreg], LLVMInt32Type (), dname);
                        break;
+#else
+                       set_failure (ctx, "atomic mono.load intrinsic");
+                       break;
 #endif
                }
                case OP_ATOMIC_STORE_I1:
@@ -5487,12 +5493,14 @@ process_bb (EmitContext *ctx, MonoBasicBlock *bb)
                        LLVMTypeRef t;
                        gboolean is_volatile = (ins->flags & MONO_INST_FAULT);
                        BarrierKind barrier = (BarrierKind) ins->backend.memory_barrier_kind;
-                       LLVMValueRef index, addr, value;
+                       LLVMValueRef index, addr, value, base;
 
+#if LLVM_API_VERSION < 100
                        if (!cfg->llvm_only) {
                                set_failure (ctx, "atomic mono.store intrinsic");
                                break;
                        }
+#endif
 
                        if (!values [ins->inst_destbasereg]) {
                            set_failure (ctx, "inst_destbasereg");
@@ -5501,11 +5509,12 @@ process_bb (EmitContext *ctx, MonoBasicBlock *bb)
 
                        t = load_store_to_llvm_type (ins->opcode, &size, &sext, &zext);
 
+                       base = values [ins->inst_destbasereg];
                        index = LLVMConstInt (LLVMInt32Type (), ins->inst_offset / size, FALSE);
-                       addr = LLVMBuildGEP (builder, convert (ctx, values [ins->inst_destbasereg], LLVMPointerType (t, 0)), &index, 1, "");
+                       addr = LLVMBuildGEP (builder, convert (ctx, base, LLVMPointerType (t, 0)), &index, 1, "");
                        value = convert (ctx, values [ins->sreg1], t);
 
-                       emit_store_general (ctx, bb, &builder, size, value, addr, is_volatile, barrier);
+                       emit_store_general (ctx, bb, &builder, size, value, addr, base, is_volatile, barrier);
                        break;
                }
                case OP_RELAXED_NOP: {
@@ -5542,7 +5551,11 @@ process_bb (EmitContext *ctx, MonoBasicBlock *bb)
                        break;
                }
                case OP_TLS_GET_REG: {
-#if defined(TARGET_AMD64) && defined(TARGET_OSX)
+#if defined(TARGET_AMD64) && defined(__linux__)
+                       // 257 == FS segment register
+                       LLVMTypeRef ptrtype = LLVMPointerType (IntPtrType (), 257);
+                       values [ins->dreg] = LLVMBuildLoad (builder, LLVMBuildIntToPtr (builder, convert (ctx, lhs, LLVMInt64Type ()), ptrtype, ""), "");
+#elif defined(TARGET_AMD64) && defined(TARGET_OSX)
                        /* See emit_tls_get_reg () */
                        // 256 == GS segment register
                        LLVMTypeRef ptrtype = LLVMPointerType (IntPtrType (), 256);
@@ -5580,7 +5593,7 @@ process_bb (EmitContext *ctx, MonoBasicBlock *bb)
                         *   mono_threads_state_poll ();
                         * FIXME: Use a preserveall wrapper
                         */
-                       val = mono_llvm_build_load (builder, convert (ctx, lhs, LLVMPointerType (IntPtrType (), 0)), "", TRUE, LLVM_BARRIER_NONE);
+                       val = mono_llvm_build_load (builder, convert (ctx, lhs, LLVMPointerType (IntPtrType (), 0)), "", TRUE);
                        cmp = LLVMBuildICmp (builder, LLVMIntEQ, val, LLVMConstNull (LLVMTypeOf (val)), "");
                        poll_bb = gen_bb (ctx, "POLL_BB");
                        cont_bb = gen_bb (ctx, "CONT_BB");
@@ -5778,12 +5791,13 @@ process_bb (EmitContext *ctx, MonoBasicBlock *bb)
                        if (!var) {
                                LLVMValueRef indexes [16];
 
-                               LLVMValueRef name_var = LLVMAddGlobal (ctx->lmodule, LLVMArrayType (LLVMInt8Type (), strlen (name) + 1), "@OBJC_METH_VAR_NAME");
+                               LLVMValueRef name_var = LLVMAddGlobal (ctx->lmodule, LLVMArrayType (LLVMInt8Type (), strlen (name) + 1), "@OBJC_METH_VAR_NAME_");
                                LLVMSetInitializer (name_var, mono_llvm_create_constant_data_array ((const uint8_t*)name, strlen (name) + 1));
                                LLVMSetLinkage (name_var, LLVMPrivateLinkage);
                                LLVMSetSection (name_var, "__TEXT,__objc_methname,cstring_literals");
+                               mark_as_used (ctx->module, name_var);
 
-                               LLVMValueRef ref_var = LLVMAddGlobal (ctx->lmodule, LLVMPointerType (LLVMInt8Type (), 0), "@OBJC_SELECTOR_REFERENCES");
+                               LLVMValueRef ref_var = LLVMAddGlobal (ctx->lmodule, LLVMPointerType (LLVMInt8Type (), 0), "@OBJC_SELECTOR_REFERENCES_");
 
                                indexes [0] = LLVMConstInt (LLVMInt32Type (), 0, 0);
                                indexes [1] = LLVMConstInt (LLVMInt32Type (), 0, 0);
@@ -5792,6 +5806,7 @@ process_bb (EmitContext *ctx, MonoBasicBlock *bb)
                                LLVMSetExternallyInitialized (ref_var, TRUE);
                                LLVMSetSection (ref_var, "__DATA, __objc_selrefs, literal_pointers, no_dead_strip");
                                LLVMSetAlignment (ref_var, sizeof (mgreg_t));
+                               mark_as_used (ctx->module, ref_var);
 
                                g_hash_table_insert (ctx->module->objc_selector_to_var, g_strdup (name), ref_var);
                                var = ref_var;
@@ -5921,19 +5936,31 @@ process_bb (EmitContext *ctx, MonoBasicBlock *bb)
                        values [ins->dreg] = LLVMBuildBitCast (builder, v, rt, "");
                        break;
                }
+               case OP_PMIND_UN:
+               case OP_PMINW_UN:
+               case OP_PMINB_UN: {
+                       LLVMValueRef cmp = LLVMBuildICmp (builder, LLVMIntULT, lhs, rhs, "");
+                       values [ins->dreg] = LLVMBuildSelect (builder, cmp, lhs, rhs, "");
+                       break;
+               }
+               case OP_PMAXD_UN:
+               case OP_PMAXW_UN:
+               case OP_PMAXB_UN: {
+                       LLVMValueRef cmp = LLVMBuildICmp (builder, LLVMIntUGT, lhs, rhs, "");
+                       values [ins->dreg] = LLVMBuildSelect (builder, cmp, lhs, rhs, "");
+                       break;
+               }
+               case OP_PMINW: {
+                       LLVMValueRef cmp = LLVMBuildICmp (builder, LLVMIntSLT, lhs, rhs, "");
+                       values [ins->dreg] = LLVMBuildSelect (builder, cmp, lhs, rhs, "");
+                       break;
+               }
                case OP_MINPD:
                case OP_MINPS:
                case OP_MAXPD:
                case OP_MAXPS:
                case OP_ADDSUBPD:
                case OP_ADDSUBPS:
-               case OP_PMIND_UN:
-               case OP_PMINW_UN:
-               case OP_PMINB_UN:
-               case OP_PMINW:
-               case OP_PMAXD_UN:
-               case OP_PMAXW_UN:
-               case OP_PMAXB_UN:
                case OP_HADDPD:
                case OP_HADDPS:
                case OP_HSUBPD:
@@ -6049,6 +6076,33 @@ process_bb (EmitContext *ctx, MonoBasicBlock *bb)
                        values [ins->dreg] = LLVMBuildInsertElement (builder, values [ins->sreg1], convert (ctx, values [ins->sreg2], LLVMDoubleType ()), LLVMConstInt (LLVMInt32Type (), ins->inst_c0, FALSE), dname);
                        break;
 
+#if 0
+                       // Requires a later llvm version
+               case OP_CVTDQ2PD: {
+                       LLVMValueRef indexes [16];
+
+                       indexes [0] = LLVMConstInt (LLVMInt32Type (), 0, FALSE);
+                       indexes [1] = LLVMConstInt (LLVMInt32Type (), 1, FALSE);
+                       LLVMValueRef mask = LLVMConstVector (indexes, 2);
+                       LLVMValueRef shuffle = LLVMBuildShuffleVector (builder, lhs, LLVMConstNull (LLVMTypeOf (lhs)), mask, "");
+                       values [ins->dreg] = LLVMBuildSIToFP (builder, shuffle, LLVMVectorType (LLVMDoubleType (), 2), dname);
+                       break;
+               }
+               case OP_CVTPS2PD: {
+                       LLVMValueRef indexes [16];
+
+                       indexes [0] = LLVMConstInt (LLVMInt32Type (), 0, FALSE);
+                       indexes [1] = LLVMConstInt (LLVMInt32Type (), 1, FALSE);
+                       LLVMValueRef mask = LLVMConstVector (indexes, 2);
+                       LLVMValueRef shuffle = LLVMBuildShuffleVector (builder, lhs, LLVMConstNull (LLVMTypeOf (lhs)), mask, "");
+                       values [ins->dreg] = LLVMBuildFPExt (builder, shuffle, LLVMVectorType (LLVMDoubleType (), 2), dname);
+                       break;
+               }
+               case OP_CVTTPS2DQ:
+                       values [ins->dreg] = LLVMBuildFPToSI (builder, lhs, LLVMVectorType (LLVMInt32Type (), 4), dname);
+                       break;
+#endif
+
                case OP_CVTDQ2PD:
                case OP_CVTDQ2PS:
                case OP_CVTPD2DQ:
@@ -6069,19 +6123,46 @@ process_bb (EmitContext *ctx, MonoBasicBlock *bb)
                        values [ins->dreg] = LLVMBuildCall (builder, get_intrinsic (ctx, simd_op_to_intrins (ins->opcode)), &v, 1, dname);
                        break;
                }
-
                case OP_COMPPS:
                case OP_COMPPD: {
-                       LLVMValueRef args [3];
+                       LLVMRealPredicate op;
 
-                       args [0] = lhs;
-                       args [1] = rhs;
-                       args [2] = LLVMConstInt (LLVMInt8Type (), ins->inst_c0, FALSE);
+                       switch (ins->inst_c0) {
+                       case SIMD_COMP_EQ:
+                               op = LLVMRealOEQ;
+                               break;
+                       case SIMD_COMP_LT:
+                               op = LLVMRealOLT;
+                               break;
+                       case SIMD_COMP_LE:
+                               op = LLVMRealOLE;
+                               break;
+                       case SIMD_COMP_UNORD:
+                               op = LLVMRealUNO;
+                               break;
+                       case SIMD_COMP_NEQ:
+                               op = LLVMRealUNE;
+                               break;
+                       case SIMD_COMP_NLT:
+                               op = LLVMRealUGE;
+                               break;
+                       case SIMD_COMP_NLE:
+                               op = LLVMRealUGT;
+                               break;
+                       case SIMD_COMP_ORD:
+                               op = LLVMRealORD;
+                               break;
+                       default:
+                               g_assert_not_reached ();
+                       }
 
-                       values [ins->dreg] = LLVMBuildCall (builder, get_intrinsic (ctx, simd_op_to_intrins (ins->opcode)), args, 3, dname);
+                       LLVMValueRef cmp = LLVMBuildFCmp (builder, op, lhs, rhs, "");
+                       if (ins->opcode == OP_COMPPD)
+                               values [ins->dreg] = LLVMBuildBitCast (builder, LLVMBuildSExt (builder, cmp, LLVMVectorType (LLVMInt64Type (), 2), ""), LLVMTypeOf (lhs), "");
+                       else
+                               values [ins->dreg] = LLVMBuildBitCast (builder, LLVMBuildSExt (builder, cmp, LLVMVectorType (LLVMInt32Type (), 4), ""), LLVMTypeOf (lhs), "");
                        break;
                }
-
                case OP_ICONV_TO_X:
                        /* This is only used for implementing shifts by non-immediate */
                        values [ins->dreg] = lhs;
@@ -6597,6 +6678,14 @@ free_ctx (EmitContext *ctx)
        g_hash_table_destroy (ctx->region_to_handler);
        g_hash_table_destroy (ctx->clause_to_handler);
        g_hash_table_destroy (ctx->jit_callees);
+
+       GHashTableIter iter;
+       g_hash_table_iter_init (&iter, ctx->method_to_callers);
+       while (g_hash_table_iter_next (&iter, NULL, (gpointer)&l))
+               g_slist_free (l);
+
+       g_hash_table_destroy (ctx->method_to_callers);
+
        g_free (ctx->method_name);
        g_ptr_array_free (ctx->bblock_list, TRUE);
 
@@ -6690,7 +6779,10 @@ mono_llvm_emit_method (MonoCompile *cfg)
        ctx->is_linkonce = is_linkonce;
 
 #if LLVM_API_VERSION > 100
-       ctx->lmodule = LLVMModuleCreateWithName ("jit-module");
+       if (cfg->compile_aot)
+               ctx->lmodule = ctx->module->lmodule;
+       else
+               ctx->lmodule = LLVMModuleCreateWithName ("jit-module");
 #else
        ctx->lmodule = ctx->module->lmodule;
 #endif
@@ -6863,6 +6955,7 @@ emit_method_inner (EmitContext *ctx)
        names = g_new (char *, sig->param_count);
        mono_method_get_param_names (cfg->method, (const char **) names);
 
+       /* Set parameter names/attributes */
        for (i = 0; i < sig->param_count; ++i) {
                LLVMArgInfo *ainfo = &linfo->args [i + sig->hasthis];
                char *name;
@@ -6875,6 +6968,9 @@ emit_method_inner (EmitContext *ctx)
                        g_free (name);
                }
 
+               if (ainfo->storage == LLVMArgVtypeInReg && ainfo->pair_storage [0] == LLVMArgNone && ainfo->pair_storage [1] == LLVMArgNone)
+                       continue;
+
                values [cfg->args [i + sig->hasthis]->dreg] = LLVMGetParam (method, pindex);
                if (ainfo->storage == LLVMArgGsharedvtFixed || ainfo->storage == LLVMArgGsharedvtFixedVtype) {
                        if (names [i] && names [i][0] != '\0')
@@ -7185,12 +7281,15 @@ emit_method_inner (EmitContext *ctx)
        if (cfg->compile_aot && !cfg->llvm_only)
                mark_as_used (ctx->module, method);
 
-       if (cfg->compile_aot && !cfg->llvm_only) {
+       if (!cfg->llvm_only) {
                LLVMValueRef md_args [16];
                LLVMValueRef md_node;
                int method_index;
 
-               method_index = mono_aot_get_method_index (cfg->orig_method);
+               if (cfg->compile_aot)
+                       method_index = mono_aot_get_method_index (cfg->orig_method);
+               else
+                       method_index = 1;
                md_args [0] = LLVMMDString (ctx->method_name, strlen (ctx->method_name));
                md_args [1] = LLVMConstInt (LLVMInt32Type (), method_index, FALSE);
                md_node = LLVMMDNode (md_args, 2);
@@ -7537,11 +7636,12 @@ decode_llvm_eh_info (EmitContext *ctx, gpointer eh_frame)
        p += 4;
        table = (gint32*)p;
 
-       g_assert (fde_count == 1);
+       g_assert (fde_count <= 2);
 
-       /* The only table entry */
+       /* The first entry is the real method */
+       g_assert (table [0] == 1);
        fde_offset = table [1];
-       table += 2;
+       table += fde_count * 2;
        /* Extra entry */
        cfg->code_len = table [0];
        fde_len = table [1] - fde_offset;
@@ -7682,11 +7782,6 @@ typedef enum {
        INTRINS_SSE_HADDPD,
        INTRINS_SSE_HSUBPD,
        INTRINS_SSE_ADDSUBPD,
-       INTRINS_SSE_PMINUD,
-       INTRINS_SSE_PMAXUD,
-       INTRINS_SSE_PMINUW,
-       INTRINS_SSE_PMINSW,
-       INTRINS_SSE_PMAXUW,
        INTRINS_SSE_PADDSW,
        INTRINS_SSE_PSUBSW,
        INTRINS_SSE_PADDUSW,
@@ -7694,8 +7789,6 @@ typedef enum {
        INTRINS_SSE_PAVGW,
        INTRINS_SSE_PMULHW,
        INTRINS_SSE_PMULHU,
-       INTRINS_SSE_PMINUB,
-       INTRINS_SSE_PMAXUB,
        INTRINS_SE_PADDSB,
        INTRINS_SSE_PSUBSB,
        INTRINS_SSE_PADDUSB,
@@ -7771,11 +7864,6 @@ static IntrinsicDesc intrinsics[] = {
        {INTRINS_SSE_HADDPD, "llvm.x86.sse3.hadd.pd"},
        {INTRINS_SSE_HSUBPD, "llvm.x86.sse3.hsub.pd"},
        {INTRINS_SSE_ADDSUBPD, "llvm.x86.sse3.addsub.pd"},
-       {INTRINS_SSE_PMINUD, "llvm.x86.sse41.pminud"},
-       {INTRINS_SSE_PMAXUD, "llvm.x86.sse41.pmaxud"},
-       {INTRINS_SSE_PMINUW, "llvm.x86.sse41.pminuw"},
-       {INTRINS_SSE_PMINSW, "llvm.x86.sse2.pmins.w"},
-       {INTRINS_SSE_PMAXUW, "llvm.x86.sse41.pmaxuw"},
        {INTRINS_SSE_PADDSW, "llvm.x86.sse2.padds.w"},
        {INTRINS_SSE_PSUBSW, "llvm.x86.sse2.psubs.w"},
        {INTRINS_SSE_PADDUSW, "llvm.x86.sse2.paddus.w"},
@@ -7783,8 +7871,6 @@ static IntrinsicDesc intrinsics[] = {
        {INTRINS_SSE_PAVGW, "llvm.x86.sse2.pavg.w"},
        {INTRINS_SSE_PMULHW, "llvm.x86.sse2.pmulh.w"},
        {INTRINS_SSE_PMULHU, "llvm.x86.sse2.pmulhu.w"},
-       {INTRINS_SSE_PMINUB, "llvm.x86.sse2.pminu.b"},
-       {INTRINS_SSE_PMAXUB, "llvm.x86.sse2.pmaxu.b"},
        {INTRINS_SE_PADDSB, "llvm.x86.sse2.padds.b"},
        {INTRINS_SSE_PSUBSB, "llvm.x86.sse2.psubs.b"},
        {INTRINS_SSE_PADDUSB, "llvm.x86.sse2.paddus.b"},
@@ -7990,13 +8076,6 @@ add_intrinsic (LLVMModuleRef module, int id)
                AddFunc (module, name, ret_type, arg_types, 2);
                break;
                /* SSE Binary ops */
-       case INTRINS_SSE_PMINUD:
-       case INTRINS_SSE_PMAXUD:
-               add_sse_binary (module, name, MONO_TYPE_I4);
-               break;
-       case INTRINS_SSE_PMINUW:
-       case INTRINS_SSE_PMINSW:
-       case INTRINS_SSE_PMAXUW:
        case INTRINS_SSE_PADDSW:
        case INTRINS_SSE_PSUBSW:
        case INTRINS_SSE_PADDUSW:
@@ -8020,8 +8099,6 @@ add_intrinsic (LLVMModuleRef module, int id)
        case INTRINS_SSE_ADDSUBPD:
                add_sse_binary (module, name, MONO_TYPE_R8);
                break;
-       case INTRINS_SSE_PMINUB:
-       case INTRINS_SSE_PMAXUB:
        case INTRINS_SE_PADDSB:
        case INTRINS_SSE_PSUBSB:
        case INTRINS_SSE_PADDUSB:
@@ -8094,11 +8171,6 @@ add_intrinsics (LLVMModuleRef module)
                AddFunc (module, "llvm_resume_unwind_trampoline", LLVMVoidType (), NULL, 0);
        }
 
-       /* SSE intrinsics */
-#if defined(TARGET_X86) || defined(TARGET_AMD64)
-
-#endif
-
        /* Load/Store intrinsics */
        {
                LLVMTypeRef arg_types [5];
@@ -8266,10 +8338,6 @@ mono_llvm_create_aot_module (MonoAssembly *assembly, const char *global_prefix,
                /* clang ignores our debug info because it has an invalid version */
                module->emit_dwarf = FALSE;
 
-#if LLVM_API_VERSION > 100
-       module->emit_dwarf = FALSE;
-#endif
-
        add_intrinsics (module->lmodule);
        add_types (module);
 
@@ -8357,6 +8425,19 @@ llvm_array_from_uints (LLVMTypeRef el_type, guint32 *values, int nvalues)
        return res;
 }
 
+static LLVMValueRef
+llvm_array_from_bytes (guint8 *values, int nvalues)
+{
+       int i;
+       LLVMValueRef res, *vals;
+
+       vals = g_new0 (LLVMValueRef, nvalues);
+       for (i = 0; i < nvalues; ++i)
+               vals [i] = LLVMConstInt (LLVMInt8Type (), values [i], FALSE);
+       res = LLVMConstArray (LLVMInt8Type (), vals, nvalues);
+       g_free (vals);
+       return res;
+}
 /*
  * mono_llvm_emit_aot_file_info:
  *
@@ -8420,7 +8501,7 @@ emit_aot_file_info (MonoLLVMModule *module)
        info = &module->aot_info;
 
        /* Create an LLVM type to represent MonoAotFileInfo */
-       nfields = 2 + MONO_AOT_FILE_INFO_NUM_SYMBOLS + 15 + 5;
+       nfields = 2 + MONO_AOT_FILE_INFO_NUM_SYMBOLS + 16 + 5;
        eltypes = g_new (LLVMTypeRef, nfields);
        tindex = 0;
        eltypes [tindex ++] = LLVMInt32Type ();
@@ -8435,6 +8516,7 @@ emit_aot_file_info (MonoLLVMModule *module)
        eltypes [tindex ++] = LLVMArrayType (LLVMInt32Type (), MONO_AOT_TABLE_NUM);
        for (i = 0; i < 4; ++i)
                eltypes [tindex ++] = LLVMArrayType (LLVMInt32Type (), MONO_AOT_TRAMP_NUM);
+       eltypes [tindex ++] = LLVMArrayType (LLVMInt8Type (), 16);
        g_assert (tindex == nfields);
        file_info_type = LLVMStructCreateNamed (module->context, "MonoAotFileInfo");
        LLVMStructSetBody (file_info_type, eltypes, nfields, FALSE);
@@ -8557,6 +8639,8 @@ emit_aot_file_info (MonoLLVMModule *module)
        fields [tindex ++] = llvm_array_from_uints (LLVMInt32Type (), info->trampoline_got_offset_base, MONO_AOT_TRAMP_NUM);
        fields [tindex ++] = llvm_array_from_uints (LLVMInt32Type (), info->trampoline_size, MONO_AOT_TRAMP_NUM);
        fields [tindex ++] = llvm_array_from_uints (LLVMInt32Type (), info->tramp_page_code_offsets, MONO_AOT_TRAMP_NUM);
+
+       fields [tindex ++] = llvm_array_from_bytes (info->aotid, 16);
        g_assert (tindex == nfields);
 
        LLVMSetInitializer (info_var, LLVMConstNamedStruct (file_info_type, fields, nfields));
@@ -8648,6 +8732,9 @@ mono_llvm_emit_aot_module (const char *filename, const char *cu_name)
                while (g_hash_table_iter_next (&iter, (void**)&method, (void**)&callers)) {
                        LLVMValueRef lmethod;
 
+                       if (method->iflags & METHOD_IMPL_ATTRIBUTE_SYNCHRONIZED)
+                               continue;
+
                        lmethod = (LLVMValueRef)g_hash_table_lookup (module->method_to_lmethod, method);
                        if (lmethod) {
                                for (l = callers; l; l = l->next) {
@@ -8828,7 +8915,7 @@ emit_dbg_subprogram (EmitContext *ctx, MonoCompile *cfg, LLVMValueRef method, co
        filename = g_path_get_basename (source_file);
 
 #if LLVM_API_VERSION > 100
-       return mono_llvm_di_create_function (module->di_builder, module->cu, cfg->method->name, name, dir, filename, n_seq_points ? sym_seq_points [0].line : 1);
+       return mono_llvm_di_create_function (module->di_builder, module->cu, method, cfg->method->name, name, dir, filename, n_seq_points ? sym_seq_points [0].line : 1);
 #endif
 
        ctx_args [0] = LLVMConstInt (LLVMInt32Type (), 0x29, FALSE);
@@ -8947,7 +9034,8 @@ default_mono_llvm_unhandled_exception (void)
        MonoObject *target = mono_gchandle_get_target (jit_tls->thrown_exc);
 
        mono_unhandled_exception (target);
-       exit (mono_environment_exitcode_get ());
+       mono_invoke_unhandled_exception_hook (target);
+       g_assert_not_reached ();
 }
 
 /*
index 4c29d4a0e4dd0e9f5b3be528f88faa68f1be86ba..07dd0a435376575104bed2e5da8a9ffa6a8bc099 100644 (file)
@@ -1400,3 +1400,4 @@ MINI_OP(OP_OBJC_GET_SELECTOR, "objc_get_selector", IREG, NONE, NONE)
 MINI_OP(OP_GET_SP, "get_sp", IREG, NONE, NONE)
 MINI_OP(OP_SET_SP, "set_sp", NONE, IREG, NONE)
 
+MINI_OP(OP_GET_LAST_ERROR, "get_last_error", IREG, NONE, NONE)
index 4baf5ab51950b4d9a3f3bb9b77156e2c0007b352..e1918076a8a97099a952d461b43b0d7e6f9fdfad 100644 (file)
@@ -1514,7 +1514,7 @@ mono_resolve_patch_target (MonoMethod *method, MonoDomain *domain, guint8 *code,
                handle = mono_ldtoken_checked (patch_info->data.token->image,
                                                           patch_info->data.token->token, &handle_class, patch_info->data.token->has_context ? &patch_info->data.token->context : NULL, error);
                if (!mono_error_ok (error))
-                       g_error ("Could not patch ldtoken due to %s", mono_error_get_message (error));
+                       return NULL;
                mono_class_init (handle_class);
                mono_class_init (mono_class_from_mono_type ((MonoType *)handle));
 
@@ -1810,6 +1810,10 @@ mono_jit_compile_method_with_opt (MonoMethod *method, guint32 opt, MonoError *er
 
        mono_error_init (error);
 
+       if (mono_llvm_only)
+               /* Should be handled by the caller */
+               g_assert (!(method->iflags & METHOD_IMPL_ATTRIBUTE_SYNCHRONIZED));
+
        /*
         * ICALL wrappers are handled specially, since there is only one copy of them
         * shared by all appdomains.
@@ -2158,7 +2162,10 @@ create_runtime_invoke_info (MonoDomain *domain, MonoMethod *method, gpointer com
 
        info = g_new0 (RuntimeInvokeInfo, 1);
        info->compiled_method = compiled_method;
-       info->sig = mono_method_signature (method);
+       if (mono_llvm_only && method->string_ctor)
+               info->sig = mono_marshal_get_string_ctor_signature (method);
+       else
+               info->sig = mono_method_signature (method);
 
        invoke = mono_marshal_get_runtime_invoke (method, FALSE);
        info->vtable = mono_class_vtable_full (domain, method->klass, error);
@@ -2166,7 +2173,7 @@ create_runtime_invoke_info (MonoDomain *domain, MonoMethod *method, gpointer com
                return NULL;
        g_assert (info->vtable);
 
-       MonoMethodSignature *sig = mono_method_signature (method);
+       MonoMethodSignature *sig = info->sig;
        MonoType *ret_type;
 
        /*
@@ -2772,6 +2779,9 @@ MONO_SIG_HANDLER_FUNC (, mono_sigill_signal_handler)
        MonoException *exc;
        MONO_SIG_HANDLER_GET_CONTEXT;
 
+       if (mono_runtime_get_no_exec ())
+               exit (1);
+
        MONO_ENTER_GC_UNSAFE_UNBALANCED;
 
        exc = mono_get_exception_execution_engine ("SIGILL");
@@ -3046,6 +3056,17 @@ mini_init_delegate (MonoDelegate *del)
                del->extra_arg = mini_get_delegate_arg (del->method, del->method_ptr);
 }
 
+char*
+mono_get_delegate_virtual_invoke_impl_name (gboolean load_imt_reg, int offset)
+{
+       int abs_offset;
+
+       abs_offset = offset;
+       if (abs_offset < 0)
+               abs_offset = - abs_offset;
+       return g_strdup_printf ("delegate_virtual_invoke%s_%s%d", load_imt_reg ? "_imt" : "", offset < 0 ? "m_" : "", abs_offset / SIZEOF_VOID_P);
+}
+
 gpointer
 mono_get_delegate_virtual_invoke_impl (MonoMethodSignature *sig, MonoMethod *method)
 {
@@ -3097,12 +3118,7 @@ mono_get_delegate_virtual_invoke_impl (MonoMethodSignature *sig, MonoMethod *met
 
        /* FIXME Support more cases */
        if (mono_aot_only) {
-               char tramp_name [256];
-               const char *imt = load_imt_reg ? "_imt" : "";
-               int ind = (load_imt_reg ? (-offset) : offset) / SIZEOF_VOID_P;
-
-               sprintf (tramp_name, "delegate_virtual_invoke%s_%d", imt, ind);
-               cache [idx] = (guint8 *)mono_aot_get_trampoline (tramp_name);
+               cache [idx] = (guint8 *)mono_aot_get_trampoline (mono_get_delegate_virtual_invoke_impl_name (load_imt_reg, offset));
                g_assert (cache [idx]);
        } else {
                cache [idx] = (guint8 *)mono_arch_get_delegate_virtual_invoke_impl (sig, method, offset, load_imt_reg);
@@ -3150,7 +3166,9 @@ mini_parse_debug_option (const char *option)
        else if (!strcmp (option, "gen-seq-points"))
                debug_options.gen_sdb_seq_points = TRUE;
        else if (!strcmp (option, "gen-compact-seq-points"))
-               debug_options.gen_seq_points_compact_data = TRUE;
+               fprintf (stderr, "Mono Warning: option gen-compact-seq-points is deprecated.\n");
+       else if (!strcmp (option, "no-compact-seq-points"))
+               debug_options.no_seq_points_compact_data = TRUE;
        else if (!strcmp (option, "single-imm-size"))
                debug_options.single_imm_size = TRUE;
        else if (!strcmp (option, "init-stacks"))
@@ -3195,7 +3213,7 @@ mini_parse_debug_options (void)
 
                if (!mini_parse_debug_option (arg)) {
                        fprintf (stderr, "Invalid option for the MONO_DEBUG env variable: %s\n", arg);
-                       fprintf (stderr, "Available options: 'handle-sigint', 'keep-delegates', 'reverse-pinvoke-exceptions', 'collect-pagefault-stats', 'break-on-unverified', 'no-gdb-backtrace', 'suspend-on-sigsegv', 'suspend-on-exception', 'suspend-on-unhandled', 'dont-free-domains', 'dyn-runtime-invoke', 'gdb', 'explicit-null-checks', 'gen-seq-points', 'gen-compact-seq-points', 'single-imm-size', 'init-stacks', 'casts', 'soft-breakpoints', 'check-pinvoke-callconv', 'arm-use-fallback-tls', 'debug-domain-unload', 'partial-sharing', 'align-small-structs', 'native-debugger-break'\n");
+                       fprintf (stderr, "Available options: 'handle-sigint', 'keep-delegates', 'reverse-pinvoke-exceptions', 'collect-pagefault-stats', 'break-on-unverified', 'no-gdb-backtrace', 'suspend-on-sigsegv', 'suspend-on-exception', 'suspend-on-unhandled', 'dont-free-domains', 'dyn-runtime-invoke', 'gdb', 'explicit-null-checks', 'gen-seq-points', 'no-compact-seq-points', 'single-imm-size', 'init-stacks', 'casts', 'soft-breakpoints', 'check-pinvoke-callconv', 'arm-use-fallback-tls', 'debug-domain-unload', 'partial-sharing', 'align-small-structs', 'native-debugger-break'\n");
                        exit (1);
                }
        }
@@ -3677,9 +3695,7 @@ mini_init (const char *filename, const char *runtime_version)
        mono_simd_intrinsics_init ();
 #endif
 
-#if MONO_SUPPORT_TASKLETS
        mono_tasklets_init ();
-#endif
 
        register_trampolines (domain);
 
@@ -3760,10 +3776,6 @@ register_icalls (void)
        register_icall (mono_thread_get_undeniable_exception, "mono_thread_get_undeniable_exception", "object", FALSE);
        register_icall (mono_thread_interruption_checkpoint, "mono_thread_interruption_checkpoint", "object", FALSE);
        register_icall (mono_thread_force_interruption_checkpoint_noraise, "mono_thread_force_interruption_checkpoint_noraise", "object", FALSE);
-#ifndef DISABLE_REMOTING
-       register_icall (mono_load_remote_field_new_icall, "mono_load_remote_field_new_icall", "object object ptr ptr", FALSE);
-       register_icall (mono_store_remote_field_new_icall, "mono_store_remote_field_new_icall", "void object ptr ptr object", FALSE);
-#endif
 
 #if defined(__native_client__) || defined(__native_client_codegen__)
        register_icall (mono_nacl_gc, "mono_nacl_gc", "void", FALSE);
@@ -3941,8 +3953,8 @@ register_icalls (void)
        register_icall (mono_object_castclass_with_cache, "mono_object_castclass_with_cache", "object object ptr ptr", FALSE);
        register_icall (mono_object_isinst_with_cache, "mono_object_isinst_with_cache", "object object ptr ptr", FALSE);
        register_icall (mono_generic_class_init, "mono_generic_class_init", "void ptr", FALSE);
-       register_icall (mono_fill_class_rgctx, "mono_class_fill_rgctx", "ptr ptr int", FALSE);
-       register_icall (mono_fill_method_rgctx, "mono_method_fill_rgctx", "ptr ptr int", FALSE);
+       register_icall (mono_fill_class_rgctx, "mono_fill_class_rgctx", "ptr ptr int", FALSE);
+       register_icall (mono_fill_method_rgctx, "mono_fill_method_rgctx", "ptr ptr int", FALSE);
 
        register_icall (mono_debugger_agent_user_break, "mono_debugger_agent_user_break", "void", FALSE);
 
index 27820c19f9fa6c19c7af17e34955d16675120698..8c1fe23297bffd8ba8b6ce8c9a6f43e62fff2b78 100644 (file)
@@ -799,7 +799,11 @@ common_call_trampoline (mgreg_t *regs, guint8 *code, MonoMethod *m, MonoVTable *
                                 */
                                no_patch = TRUE;
                        }
-
+#if LLVM_API_VERSION > 100
+                       /* LLVM code doesn't make direct calls */
+                       if (ji && ji->from_llvm)
+                               no_patch = TRUE;
+#endif
                        if (!no_patch && mono_method_same_domain (ji, target_ji))
                                mono_arch_patch_callsite ((guint8 *)ji->code_start, code, (guint8 *)addr);
                }
@@ -1300,15 +1304,19 @@ gpointer
 mono_create_handler_block_trampoline (void)
 {
        static gpointer code;
-       if (code) {
+
+       if (code)
+               return code;
+
+       if (mono_aot_only) {
+               gpointer tmp = mono_aot_get_trampoline ("handler_block_trampoline");
+               g_assert (tmp);
                mono_memory_barrier ();
+               code = tmp;
                return code;
        }
 
-       g_assert (!mono_aot_only);
-
        mono_trampolines_lock ();
-
        if (!code) {
                MonoTrampInfo *info;
                gpointer tmp;
@@ -1505,14 +1513,16 @@ mono_create_jit_trampoline (MonoDomain *domain, MonoMethod *method, MonoError *e
        mono_error_init (error);
 
        if (mono_aot_only) {
+               if (mono_llvm_only && method->iflags & METHOD_IMPL_ATTRIBUTE_SYNCHRONIZED)
+                       method = mono_marshal_get_synchronized_wrapper (method);
+
                /* Avoid creating trampolines if possible */
                gpointer code = mono_jit_find_compiled_method (domain, method);
                
                if (code)
                        return code;
                if (mono_llvm_only) {
-                       if (method->wrapper_type == MONO_WRAPPER_PROXY_ISINST || method->wrapper_type == MONO_WRAPPER_LDFLD_REMOTE ||
-                               method->wrapper_type == MONO_WRAPPER_STFLD_REMOTE)
+                       if (method->wrapper_type == MONO_WRAPPER_PROXY_ISINST)
                                /* These wrappers are not generated */
                                return method_not_found;
                        /* Methods are lazily initialized on first call, so this can't lead recursion */
index ab690bf480797779f46c823999285c9b438a520c..3d14e9cde783e8bf6f3ae6e51a068a0f789f9c03 100644 (file)
@@ -182,7 +182,7 @@ typedef struct {
 } MonoLLVMFDEInfo;
 
 void
-mono_unwind_decode_llvm_mono_fde (guint8 *fde, int fde_len, guint8 *cie, guint8 *code, MonoLLVMFDEInfo *res);
+mono_unwind_decode_llvm_mono_fde (guint8 *fde, int fde_len, guint8 *cie, guint8 *code, MonoLLVMFDEInfo *res) MONO_LLVM_INTERNAL;
 
 GSList* mono_unwind_get_cie_program (void);
 
index badf12b33b3bf1d72f1466b48e8c8a0aeb517e88..9e1702be17c8e32286f5233e2423a4740d2b59ec 100644 (file)
@@ -63,9 +63,9 @@ static mono_mutex_t mini_arch_mutex;
 
 #ifdef TARGET_WIN32
 /* Under windows, the default pinvoke calling convention is stdcall */
-#define CALLCONV_IS_STDCALL(sig) ((((sig)->call_convention) == MONO_CALL_STDCALL) || ((sig)->pinvoke && ((sig)->call_convention) == MONO_CALL_DEFAULT) || ((sig)->pinvoke && ((sig)->call_convention) == MONO_CALL_THISCALL))
+#define CALLCONV_IS_STDCALL(sig) ((sig)->pinvoke && ((sig)->call_convention == MONO_CALL_STDCALL || (sig)->call_convention == MONO_CALL_DEFAULT || (sig)->call_convention == MONO_CALL_THISCALL))
 #else
-#define CALLCONV_IS_STDCALL(sig) (((sig)->call_convention) == MONO_CALL_STDCALL || ((sig)->pinvoke && ((sig)->call_convention) == MONO_CALL_THISCALL))
+#define CALLCONV_IS_STDCALL(sig) ((sig)->pinvoke && ((sig)->call_convention == MONO_CALL_STDCALL || (sig)->call_convention == MONO_CALL_THISCALL))
 #endif
 
 #define X86_IS_CALLEE_SAVED_REG(reg) (((reg) == X86_EBX) || ((reg) == X86_EDI) || ((reg) == X86_ESI))
@@ -231,19 +231,49 @@ add_valuetype (MonoMethodSignature *sig, ArgInfo *ainfo, MonoType *type,
        klass = mono_class_from_mono_type (type);
        size = mini_type_stack_size_full (&klass->byval_arg, NULL, sig->pinvoke);
 
+#if defined(TARGET_WIN32)
+       /*
+       * Standard C and C++ doesn't allow empty structs, empty structs will always have a size of 1 byte.
+       * GCC have an extension to allow empty structs, https://gcc.gnu.org/onlinedocs/gcc/Empty-Structures.html.
+       * This cause a little dilemma since runtime build using none GCC compiler will not be compatible with
+       * GCC build C libraries and the other way around. On platforms where empty structs has size of 1 byte
+       * it must be represented in call and cannot be dropped.
+       */
+       if (size == 0 && MONO_TYPE_ISSTRUCT (type) && sig->pinvoke) {
+               /* Empty structs (1 byte size) needs to be represented in a stack slot */
+               ainfo->pass_empty_struct = TRUE;
+               size = 1;
+       }
+#endif
+
 #ifdef SMALL_STRUCTS_IN_REGS
        if (sig->pinvoke && is_return) {
                MonoMarshalType *info;
 
-               /*
-                * the exact rules are not very well documented, the code below seems to work with the 
-                * code generated by gcc 3.3.3 -mno-cygwin.
-                */
                info = mono_marshal_load_type_info (klass);
                g_assert (info);
 
                ainfo->pair_storage [0] = ainfo->pair_storage [1] = ArgNone;
 
+               /* Ignore empty struct return value, if used. */
+               if (info->num_fields == 0 && ainfo->pass_empty_struct) {
+                       ainfo->storage = ArgValuetypeInReg;
+                       return;
+               }
+
+               /*
+               * Windows x86 ABI for returning structs of size 4 or 8 bytes (regardless of type) dictates that
+               * values are passed in EDX:EAX register pairs, https://msdn.microsoft.com/en-us/library/984x0h58.aspx.
+               * This is different compared to for example float or double return types (not in struct) that will be returned
+               * in ST(0), https://msdn.microsoft.com/en-us/library/ha59cbfz.aspx.
+               *
+               * Apples OSX x86 ABI for returning structs of size 4 or 8 bytes uses a slightly different approach.
+               * If a struct includes only one scalar value, it will be handled with the same rules as scalar values.
+               * This means that structs with one float or double will be returned in ST(0). For more details,
+               * https://developer.apple.com/library/mac/documentation/DeveloperTools/Conceptual/LowLevelABI/130-IA-32_Function_Calling_Conventions/IA32.html.
+               */
+#if !defined(TARGET_WIN32)
+
                /* Special case structs with only a float member */
                if (info->num_fields == 1) {
                        int ftype = mini_get_underlying_type (info->fields [0].field->type)->type;
@@ -258,6 +288,8 @@ add_valuetype (MonoMethodSignature *sig, ArgInfo *ainfo, MonoType *type,
                                return;
                        }
                }
+#endif
+
                if ((info->native_size == 1) || (info->native_size == 2) || (info->native_size == 4) || (info->native_size == 8)) {
                        ainfo->storage = ArgValuetypeInReg;
                        ainfo->pair_storage [0] = ArgInIReg;
@@ -292,7 +324,7 @@ add_valuetype (MonoMethodSignature *sig, ArgInfo *ainfo, MonoType *type,
  * For x86 ELF, see the "System V Application Binary Interface Intel386 
  * Architecture Processor Supplment, Fourth Edition" document for more
  * information.
- * For x86 win32, see ???.
+ * For x86 win32, see https://msdn.microsoft.com/en-us/library/984x0h58.aspx.
  */
 static CallInfo*
 get_call_info_internal (CallInfo *cinfo, MonoMethodSignature *sig)
@@ -511,7 +543,7 @@ get_call_info_internal (CallInfo *cinfo, MonoMethodSignature *sig)
        if (cinfo->vtype_retaddr) {
                /* if the function returns a struct on stack, the called method already does a ret $0x4 */
                cinfo->callee_stack_pop = 4;
-       } else if (CALLCONV_IS_STDCALL (sig) && sig->pinvoke) {
+       } else if (CALLCONV_IS_STDCALL (sig)) {
                /* Have to compensate for the stack space popped by the native callee */
                cinfo->callee_stack_pop = stack_size;
        }
@@ -1355,7 +1387,7 @@ mono_arch_emit_call (MonoCompile *cfg, MonoCallInst *call)
                sentinelpos = sig->sentinelpos + (sig->hasthis ? 1 : 0);
 
        if (sig_ret && MONO_TYPE_ISSTRUCT (sig_ret)) {
-               if (cinfo->ret.storage == ArgValuetypeInReg) {
+               if (cinfo->ret.storage == ArgValuetypeInReg && cinfo->ret.pair_storage[0] != ArgNone ) {
                        /*
                         * Tell the JIT to use a more efficient calling convention: call using
                         * OP_CALL, compute the result location after the call, and save the 
@@ -1437,7 +1469,7 @@ mono_arch_emit_call (MonoCompile *cfg, MonoCallInst *call)
                                size = mini_type_stack_size_full (&in->klass->byval_arg, &align, sig->pinvoke);
                        }
 
-                       if (size > 0) {
+                       if (size > 0 || ainfo->pass_empty_struct) {
                                arg->opcode = OP_OUTARG_VT;
                                arg->sreg1 = in->dreg;
                                arg->klass = in->klass;
@@ -1568,7 +1600,12 @@ mono_arch_emit_outarg_vt (MonoCompile *cfg, MonoInst *ins, MonoInst *src)
                        MONO_EMIT_NEW_STORE_MEMBASE (cfg, OP_STORE_MEMBASE_REG, X86_ESP, ainfo->offset, src->dreg);
                } else if (size <= 4) {
                        int dreg = mono_alloc_ireg (cfg);
-                       MONO_EMIT_NEW_LOAD_MEMBASE (cfg, dreg, src->dreg, 0);
+                       if (ainfo->pass_empty_struct) {
+                               //Pass empty struct value as 0 on platforms representing empty structs as 1 byte.
+                               MONO_EMIT_NEW_ICONST (cfg, dreg, 0);
+                       } else {
+                               MONO_EMIT_NEW_LOAD_MEMBASE (cfg, dreg, src->dreg, 0);
+                       }
                        MONO_EMIT_NEW_STORE_MEMBASE (cfg, OP_STORE_MEMBASE_REG, X86_ESP, ainfo->offset, dreg);
                } else if (size <= 20) {
                        mini_emit_memcpy (cfg, X86_ESP, ainfo->offset, src->dreg, 0, size, 4);
@@ -6013,10 +6050,7 @@ get_delegate_virtual_invoke_impl (MonoTrampInfo **info, gboolean load_imt_reg, i
        x86_jump_membase (code, X86_EAX, offset);
        mono_profiler_code_buffer_new (start, code - start, MONO_PROFILER_CODE_BUFFER_DELEGATE_INVOKE, NULL);
 
-       if (load_imt_reg)
-               tramp_name = g_strdup_printf ("delegate_virtual_invoke_imt_%d", - offset / sizeof (gpointer));
-       else
-               tramp_name = g_strdup_printf ("delegate_virtual_invoke_%d", offset / sizeof (gpointer));
+       tramp_name = mono_get_delegate_virtual_invoke_impl_name (load_imt_reg, offset);
        *info = mono_tramp_info_create (tramp_name, start, code - start, NULL, unwind_ops);
        g_free (tramp_name);
 
index 4150cdf60d0aed1d2527748e11d940407bec8b7a..b70d836c2aa07fd9758bf632c62cb5cd404582a1 100644 (file)
@@ -315,6 +315,7 @@ typedef struct {
        /* Only if storage == ArgValuetypeInReg */
        ArgStorage pair_storage [2];
        gint8 pair_regs [2];
+       guint8 pass_empty_struct : 1; // Set in scenarios when empty structs needs to be represented as argument.
 } ArgInfo;
 
 typedef struct {
index da9f3bb6a2061d3efafc67a3cee6a9e797ad10eb..fff5ece8d5512e319ffe7c3a70bbaf25e5ba2b24 100644 (file)
@@ -1169,7 +1169,7 @@ mono_allocate_stack_slots2 (MonoCompile *cfg, gboolean backward, guint32 *stack_
                vars = g_list_prepend (vars, vmv);
        }
 
-       vars = g_list_sort (g_list_copy (vars), compare_by_interval_start_pos_func);
+       vars = g_list_sort (vars, compare_by_interval_start_pos_func);
 
        /* Sanity check */
        /*
@@ -1886,28 +1886,59 @@ mono_verify_cfg (MonoCompile *cfg)
                mono_verify_bblock (bb);
 }
 
+// This will free many fields in cfg to save
+// memory. Note that this must be safe to call
+// multiple times. It must be idempotent. 
+void
+mono_empty_compile (MonoCompile *cfg)
+{
+       mono_free_loop_info (cfg);
+
+       // These live in the mempool, and so must be freed
+       // first
+       for (GSList *l = cfg->headers_to_free; l; l = l->next) {
+               mono_metadata_free_mh ((MonoMethodHeader *)l->data);
+       }
+       cfg->headers_to_free = NULL;
+
+       if (cfg->mempool) {
+       //mono_mempool_stats (cfg->mempool);
+               mono_mempool_destroy (cfg->mempool);
+               cfg->mempool = NULL;
+       }
+
+       g_free (cfg->varinfo);
+       cfg->varinfo = NULL;
+
+       g_free (cfg->vars);
+       cfg->vars = NULL;
+
+       if (cfg->rs) {
+               mono_regstate_free (cfg->rs);
+               cfg->rs = NULL;
+       }
+}
+
 void
 mono_destroy_compile (MonoCompile *cfg)
 {
-       GSList *l;
+       mono_empty_compile (cfg);
 
        if (cfg->header)
                mono_metadata_free_mh (cfg->header);
-       //mono_mempool_stats (cfg->mempool);
-       mono_free_loop_info (cfg);
-       if (cfg->rs)
-               mono_regstate_free (cfg->rs);
+
        if (cfg->spvars)
                g_hash_table_destroy (cfg->spvars);
        if (cfg->exvars)
                g_hash_table_destroy (cfg->exvars);
-       for (l = cfg->headers_to_free; l; l = l->next)
-               mono_metadata_free_mh ((MonoMethodHeader *)l->data);
+
        g_list_free (cfg->ldstr_list);
-       g_hash_table_destroy (cfg->token_info_hash);
+
+       if (cfg->token_info_hash)
+               g_hash_table_destroy (cfg->token_info_hash);
+
        if (cfg->abs_patches)
                g_hash_table_destroy (cfg->abs_patches);
-       mono_mempool_destroy (cfg->mempool);
 
        mono_debug_free_method (cfg);
 
@@ -3241,7 +3272,7 @@ mini_method_compile (MonoMethod *method, guint32 opts, MonoDomain *domain, JitFl
        cfg->disable_omit_fp = debug_options.disable_omit_fp;
        cfg->skip_visibility = method->skip_visibility;
        cfg->orig_method = method;
-       cfg->gen_seq_points = debug_options.gen_seq_points_compact_data || debug_options.gen_sdb_seq_points;
+       cfg->gen_seq_points = !debug_options.no_seq_points_compact_data || debug_options.gen_sdb_seq_points;
        cfg->gen_sdb_seq_points = debug_options.gen_sdb_seq_points;
        cfg->llvm_only = (flags & JIT_FLAG_LLVM_ONLY) != 0;
        cfg->backend = current_backend;
@@ -3253,6 +3284,11 @@ mini_method_compile (MonoMethod *method, guint32 opts, MonoDomain *domain, JitFl
                cfg->gen_sdb_seq_points = FALSE;
        }
 #endif
+       if (cfg->method->wrapper_type == MONO_WRAPPER_ALLOC) {
+               /* We can't have seq points inside gc critical regions */
+               cfg->gen_seq_points = FALSE;
+               cfg->gen_sdb_seq_points = FALSE;
+       }
        /* coop / nacl requires loop detection to happen */
 #if defined(__native_client_codegen__)
        cfg->opt |= MONO_OPT_LOOP;
@@ -3363,6 +3399,7 @@ mini_method_compile (MonoMethod *method, guint32 opts, MonoDomain *domain, JitFl
                                        //g_free (nm);
                                }
                                if (cfg->llvm_only) {
+                                       g_free (cfg->exception_message);
                                        cfg->disable_aot = TRUE;
                                        return cfg;
                                }
index ff064d11e6bfdf72aec5527ad4473bea6c5ece40..bafaa414969ec65fa1aafd1bfbcaaa7da7307102 100644 (file)
 #endif
 
 /* Version number of the AOT file format */
-#define MONO_AOT_FILE_VERSION 133
+#define MONO_AOT_FILE_VERSION 136
 
 //TODO: This is x86/amd64 specific.
 #define mono_simd_shuffle_mask(a,b,c,d) ((a) | ((b) << 2) | ((c) << 4) | ((d) << 6))
@@ -315,6 +315,8 @@ typedef struct MonoAotFileInfo
        guint32 trampoline_size [MONO_AOT_TRAMP_NUM];
        /* The offset where the trampolines begin on a trampoline page */
        guint32 tramp_page_code_offsets [MONO_AOT_TRAMP_NUM];
+       /* GUID of aot compilation */
+       guint8 aotid[16];
 } MonoAotFileInfo;
 
 /* Number of symbols in the MonoAotFileInfo structure */
@@ -1172,6 +1174,11 @@ typedef struct {
         * The current exception in flight
         */
        guint32 thrown_exc;
+       /*
+        * If the current exception is not a subclass of Exception,
+        * the original exception.
+        */
+       guint32 thrown_non_exc;
 
        /*
         * The calling assembly in llvmonly mode.
@@ -2114,7 +2121,7 @@ typedef struct {
         * Next sequence points and flags are required by the debugger agent.
         */
        gboolean gen_sdb_seq_points;
-       gboolean gen_seq_points_compact_data;
+       gboolean no_seq_points_compact_data;
        /*
         * Setting single_imm_size should guarantee that each time managed code is compiled
         * the same instructions and registers are used, regardless of the size of used values.
@@ -2421,6 +2428,7 @@ void      mono_global_regalloc              (MonoCompile *cfg);
 void      mono_create_jump_table            (MonoCompile *cfg, MonoInst *label, MonoBasicBlock **bbs, int num_blocks);
 MonoCompile *mini_method_compile            (MonoMethod *method, guint32 opts, MonoDomain *domain, JitFlags flags, int parts, int aot_method_index);
 void      mono_destroy_compile              (MonoCompile *cfg);
+void      mono_empty_compile              (MonoCompile *cfg);
 MonoJitICallInfo *mono_find_jit_opcode_emulation (int opcode);
 void     mono_print_ins_index (int i, MonoInst *ins);
 void     mono_print_ins (MonoInst *ins);
@@ -2633,6 +2641,7 @@ void              mono_if_conversion (MonoCompile *cfg);
 /* Delegates */
 gpointer          mini_get_delegate_arg (MonoMethod *method, gpointer method_ptr);
 void              mini_init_delegate (MonoDelegate *del);
+char*             mono_get_delegate_virtual_invoke_impl_name (gboolean load_imt_reg, int offset);
 gpointer          mono_get_delegate_virtual_invoke_impl  (MonoMethodSignature *sig, MonoMethod *method);
 
 /* methods that must be provided by the arch-specific port */
@@ -2857,14 +2866,6 @@ MonoBoolean ves_icall_get_frame_info            (gint32 skip, MonoBoolean need_f
                                                 MonoString **file, gint32 *line, gint32 *column);
 void mono_set_cast_details                      (MonoClass *from, MonoClass *to);
 
-/* Installs a function which is called when the runtime encounters an unhandled exception.
- * This hook isn't expected to return.
- * If no hook has been installed, the runtime will print a message before aborting.
- */
-typedef void  (*MonoUnhandledExceptionFunc)         (MonoObject *exc, gpointer user_data);
-MONO_API void mono_install_unhandled_exception_hook (MonoUnhandledExceptionFunc func, gpointer user_data);
-void          mono_invoke_unhandled_exception_hook  (MonoObject *exc);
-
 void mono_decompose_typechecks (MonoCompile *cfg);
 /* Dominator/SSA methods */
 void        mono_compile_dominator_info         (MonoCompile *cfg, int dom_flags);
index 08deb0c00f2913bf8c8fdccf4173ec7d5e8d768f..7d035aa3b2cef9707ee18b92ba25ae687d511de8 100644 (file)
@@ -150,6 +150,57 @@ void
 mono_tasklets_cleanup (void)
 {
 }
+#else
 
+static
+void continuations_not_supported (void)
+{
+       mono_set_pending_exception (mono_get_exception_not_implemented ("Tasklets are not implemented on this platform."));
+}
+
+static void*
+continuation_alloc (void)
+{
+       continuations_not_supported ();
+       return NULL;
+}
+
+static void
+continuation_free (MonoContinuation *cont)
+{
+       continuations_not_supported ();
+}
+
+static MonoException*
+continuation_mark_frame (MonoContinuation *cont)
+{
+       continuations_not_supported ();
+       return NULL;
+}
+
+static int
+continuation_store (MonoContinuation *cont, int state, MonoException **e)
+{
+       continuations_not_supported ();
+       return 0;
+}
+
+static MonoException*
+continuation_restore (MonoContinuation *cont, int state)
+{
+       continuations_not_supported ();
+       return NULL;
+}
+
+void
+mono_tasklets_init(void)
+{
+       mono_add_internal_call ("Mono.Tasklets.Continuation::alloc", continuation_alloc);
+       mono_add_internal_call ("Mono.Tasklets.Continuation::free", continuation_free);
+       mono_add_internal_call ("Mono.Tasklets.Continuation::mark", continuation_mark_frame);
+       mono_add_internal_call ("Mono.Tasklets.Continuation::store", continuation_store);
+       mono_add_internal_call ("Mono.Tasklets.Continuation::restore", continuation_restore);
+
+}
 #endif
 
index 45d32b99c05e54b64969afac9b9c51d6047a07b8..ee235f5c739cb4a91bb87edfe55e0b5bb5a14f3c 100755 (executable)
@@ -1,7 +1,8 @@
 #!/bin/bash
 
-TEST_FILE=$1
-USE_AOT=$2
+DEFAULT_PROFILE=$1
+TEST_FILE=$2
+USE_AOT=$3
 
 TMP_FILE_PREFIX=$(basename $0).tmp
 BASEDIR=$(dirname $0)
@@ -11,13 +12,13 @@ case "$(uname -s)" in
        *) PLATFORM_PATH_SEPARATOR=':';;
 esac
 
-MONO_PATH=$BASEDIR/../../mcs/class/lib/net_4_x$PLATFORM_PATH_SEPARATOR$BASEDIR
+MONO_PATH=$BASEDIR/../../mcs/class/lib/$DEFAULT_PROFILE$PLATFORM_PATH_SEPARATOR$BASEDIR
 RUNTIME=$BASEDIR/../../runtime/mono-wrapper
 
 trap "rm -rf ${TMP_FILE_PREFIX}*" EXIT
 
 tmp_file () {
-       mktemp ./${TMP_FILE_PREFIX}XXXX
+       mktemp ./${TMP_FILE_PREFIX}XXXXXX
 }
 
 clean_aot () {
@@ -49,16 +50,16 @@ get_method () {
 diff_methods () {
        TMP_FILE1=$(tmp_file)
        TMP_FILE2=$(tmp_file)
-       echo "$(MONO_DEBUG=single-imm-size get_methods $1 $2 $3 $4)" >$TMP_FILE1
-       echo "$(MONO_DEBUG=gen-compact-seq-points,single-imm-size get_methods $1 $2 $3 $4)" >$TMP_FILE2
+       echo "$(MONO_DEBUG=no-compact-seq-points,single-imm-size get_methods $1 $2 $3 $4)" >$TMP_FILE1
+       echo "$(MONO_DEBUG=single-imm-size get_methods $1 $2 $3 $4)" >$TMP_FILE2
        diff $TMP_FILE1 $TMP_FILE2
 }
 
 diff_method () {
        TMP_FILE1=$(tmp_file)
        TMP_FILE2=$(tmp_file)
-       echo "$(MONO_DEBUG=single-imm-size get_method $1 $2 $3 $4 $5)" >$TMP_FILE1
-       echo "$(MONO_DEBUG=gen-compact-seq-points,single-imm-size get_method $1 $2 $3 $4 $5 | grep -Ev il_seq_point)" >$TMP_FILE2
+       echo "$(MONO_DEBUG=no-compact-seq-points,single-imm-size get_method $1 $2 $3 $4 $5)" >$TMP_FILE1
+       echo "$(MONO_DEBUG=single-imm-size get_method $1 $2 $3 $4 $5 | grep -Ev il_seq_point)" >$TMP_FILE2
        sdiff -w 150 $TMP_FILE1 $TMP_FILE2
 }
 
index d9737fb8c52e948339da1868b78630a3a2005c34..b70924cced353fae1a7ac6223c76ea0dfb7340c5 100644 (file)
@@ -757,12 +757,11 @@ mono_arch_invalidate_method (MonoJitInfo *ji, void *func, gpointer func_arg)
        amd64_call_reg (code, AMD64_R11);
 }
 
-
-static void
-handler_block_trampoline_helper (gpointer *ptr)
+gpointer
+mono_amd64_handler_block_trampoline_helper (void)
 {
        MonoJitTlsData *jit_tls = (MonoJitTlsData *)mono_native_tls_get_value (mono_jit_tls_id);
-       *ptr = jit_tls->handler_block_return_address;
+       return jit_tls->handler_block_return_address;
 }
 
 gpointer
@@ -774,8 +773,6 @@ mono_arch_create_handler_block_trampoline (MonoTrampInfo **info, gboolean aot)
        MonoJumpInfo *ji = NULL;
        GSList *unwind_ops;
 
-       g_assert (!aot);
-
        code = buf = (guint8 *)mono_global_codeman_reserve (tramp_size);
 
        unwind_ops = mono_arch_get_cie_program ();
@@ -783,7 +780,7 @@ mono_arch_create_handler_block_trampoline (MonoTrampInfo **info, gboolean aot)
        /*
        This trampoline restore the call chain of the handler block then jumps into the code that deals with it.
        */
-       if (mono_get_jit_tls_offset () != -1) {
+       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 */
@@ -791,14 +788,35 @@ mono_arch_create_handler_block_trampoline (MonoTrampInfo **info, gboolean aot)
                mono_add_unwind_op_def_cfa_offset (unwind_ops, code, buf, 16);
                amd64_jump_code (code, tramp);
        } else {
-               /*Slow path uses a c helper*/
-               amd64_mov_reg_reg (code, MONO_AMD64_ARG_REG1, AMD64_RSP, 8);
-               amd64_mov_reg_imm (code, AMD64_RAX, tramp);
-               amd64_push_reg (code, AMD64_RAX);
-               mono_add_unwind_op_def_cfa_offset (unwind_ops, code, buf, 16);
+               /*
+                * 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_call_code (code, mono_amd64_handler_block_trampoline_helper);
+               }
+               /* 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);
-               mono_add_unwind_op_def_cfa_offset (unwind_ops, code, buf, 24);
-               amd64_jump_code (code, handler_block_trampoline_helper);
+               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_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);
        }
 
        mono_arch_flush_icache (buf, code - buf);
index d24ddf4a72c1a259902f130e133db595ff606c9d..02b1f12c08f2b5b74e669ece1bbd6e4ab7c43992 100644 (file)
@@ -778,15 +778,27 @@ mono_arch_create_sdb_trampoline (gboolean single_step, MonoTrampInfo **info, gbo
        ARM_MOV_REG_REG (code, ARMREG_R0, ARMREG_FP);
 
        /* call */
-       // FIXME: AOT
-       ARM_LDR_IMM (code, ARMREG_IP, ARMREG_PC, 0);
-       ARM_B (code, 0);
-       if (single_step)
-               *(gpointer*)code = debugger_agent_single_step_from_context;
-       else
-               *(gpointer*)code = debugger_agent_breakpoint_from_context;
-       code += 4;
-       ARM_BLX_REG (code, ARMREG_IP);
+       if (aot) {
+               if (single_step)
+                       ji = mono_patch_info_list_prepend (ji, code - buf, MONO_PATCH_INFO_JIT_ICALL_ADDR, "debugger_agent_single_step_from_context");
+               else
+                       ji = mono_patch_info_list_prepend (ji, code - buf, MONO_PATCH_INFO_JIT_ICALL_ADDR, "debugger_agent_breakpoint_from_context");
+               ARM_LDR_IMM (code, ARMREG_IP, ARMREG_PC, 0);
+               ARM_B (code, 0);
+               *(gpointer*)code = NULL;
+               code += 4;
+               ARM_LDR_REG_REG (code, ARMREG_IP, ARMREG_PC, ARMREG_IP);
+               ARM_BLX_REG (code, ARMREG_IP);
+       } else {
+               ARM_LDR_IMM (code, ARMREG_IP, ARMREG_PC, 0);
+               ARM_B (code, 0);
+               if (single_step)
+                       *(gpointer*)code = debugger_agent_single_step_from_context;
+               else
+                       *(gpointer*)code = debugger_agent_breakpoint_from_context;
+               code += 4;
+               ARM_BLX_REG (code, ARMREG_IP);
+       }
 
        /* we're back; save ctx.eip and ctx.esp into the corresponding regs slots. */
        ARM_LDR_IMM (code, ARMREG_R0, ARMREG_FP, MONO_STRUCT_OFFSET (MonoContext, pc));
index ef3c65a7f225790813dfa5ab71f9a5e11b8c8ed4..a2824292404979c4f6e76691edaf2ce99a723575 100644 (file)
@@ -375,13 +375,15 @@ mono_unwind_ops_encode_full (GSList *unwind_ops, guint32 *out_len, gboolean enab
                while (op->when > loc) {
                        if (op->when - loc > 65536) {
                                *p ++ = DW_CFA_advance_loc4;
-                               *(guint32*)p = (guint32)(op->when - loc);
+                               guint32 v = (guint32)(op->when - loc);
+                               memcpy (p, &v, 4);
                                g_assert (read32 (p) == (guint32)(op->when - loc));
                                p += 4;
                                loc = op->when;
                        } else if (op->when - loc > 256) {
                                *p ++ = DW_CFA_advance_loc2;
-                               *(guint16*)p = (guint16)(op->when - loc);
+                               guint16 v = (guint16)(op->when - loc);
+                               memcpy (p, &v, 2);
                                g_assert (read16 (p) == (guint32)(op->when - loc));
                                p += 2;
                                loc = op->when;
index b215a3091c3c87d3da5aee213d6421f9fc3ac585..3d7eb62e4004b07a10c4644c3086e9eedf21b66a 100644 (file)
@@ -14,34 +14,29 @@ if !DISABLE_LIBRARIES
 if !DISABLE_PROFILER
 bin_PROGRAMS = mprof-report
 
-if !BITCODE
-prof_shlibs = \
-       libmono-profiler-aot.la \
-       libmono-profiler-iomap.la \
-       libmono-profiler-log.la
-endif
-
 if HAVE_VTUNE
-vtune_stlibs = libmono-profiler-vtune-static.la
-if !BITCODE
-vtune_shlibs = libmono-profiler-vtune.la
-endif
+vtune_libs = libmono-profiler-vtune.la libmono-profiler-vtune-static.la
 endif
 
 lib_LTLIBRARIES = \
-       $(prof_shlibs) \
+       libmono-profiler-aot.la \
        libmono-profiler-aot-static.la \
+       libmono-profiler-iomap.la \
        libmono-profiler-iomap-static.la \
+       libmono-profiler-log.la \
        libmono-profiler-log-static.la \
-       $(vtune_shlibs) \
-       $(vtune_stlibs)
+       $(vtune_libs)
 
 suppressiondir = $(datadir)/mono-$(API_VER)/mono/profiler
 suppression_DATA = mono-profiler-log.suppression
 
 if PLATFORM_DARWIN
+if BITCODE
+prof_ldflags = -no-undefined
+else
 prof_ldflags = -Wl,-undefined -Wl,suppress -Wl,-flat_namespace
 endif
+endif
 
 if PLATFORM_ANDROID
 prof_ldflags = -avoid-version
@@ -58,6 +53,8 @@ endif
 endif
 endif
 
+monodir=$(top_builddir)
+
 # The log profiler uses eglib functions, so it needs to be linked against
 # libeglib in shared mode, but not in static mode, since that would
 # leads to duplicate symbols when it is linked into an app which
@@ -65,19 +62,19 @@ endif
 # functionality, so create a separate static version of the library.
 
 libmono_profiler_aot_la_SOURCES = mono-profiler-aot.c
-libmono_profiler_aot_la_LIBADD = $(GLIB_LIBS) $(LIBICONV)
+libmono_profiler_aot_la_LIBADD =  $(monodir)/mono/mini/$(LIBMONO_LA) $(GLIB_LIBS) $(LIBICONV)
 libmono_profiler_aot_la_LDFLAGS = $(prof_ldflags)
 libmono_profiler_aot_static_la_SOURCES = mono-profiler-aot.c
 libmono_profiler_aot_static_la_LDFLAGS = -static
 
 libmono_profiler_iomap_la_SOURCES = mono-profiler-iomap.c
-libmono_profiler_iomap_la_LIBADD = $(GLIB_LIBS) $(LIBICONV)
+libmono_profiler_iomap_la_LIBADD = $(monodir)/mono/mini/$(LIBMONO_LA) $(GLIB_LIBS) $(LIBICONV)
 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_LIBADD = $(GLIB_LIBS) $(Z_LIBS)
+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_LDFLAGS = -static
@@ -85,7 +82,7 @@ libmono_profiler_log_static_la_LDFLAGS = -static
 if HAVE_VTUNE
 libmono_profiler_vtune_la_SOURCES = mono-profiler-vtune.c
 libmono_profiler_vtune_la_CFLAGS = $(VTUNE_CFLAGS)
-libmono_profiler_vtune_la_LIBADD = $(VTUNE_LIBS) $(GLIB_LIBS) $(LIBICONV)
+libmono_profiler_vtune_la_LIBADD = $(VTUNE_LIBS) $(LIBMONO) $(GLIB_LIBS) $(LIBICONV)
 libmono_profiler_vtune_la_LDFLAGS = $(prof_ldflags)
 libmono_profiler_vtune_static_la_SOURCES = mono-profiler-vtune.c
 libmono_profiler_vtune_static_la_LDFLAGS = -static
index da6aaf01823c56265c44967c7e78504ec1165670..d0314e8ccfd99166524ccec93893e2cdc12d9764 100644 (file)
 
 #elif defined(TARGET_AMD64)
 
+#ifdef HOST_WIN32
+/* The Windows x64 ABI defines no "red zone". The ABI states:
+   "All memory beyond the current address of RSP is considered volatile" */
+#define REDZONE_SIZE   0
+#else
 #define REDZONE_SIZE   128
+#endif
 
 #elif defined(TARGET_POWERPC)
 
index 016fc462e0e762772ccbb9f6701eaf4c583937af..3579d09bae865777c4bb114fbc6370dd161f54df 100644 (file)
@@ -8,6 +8,27 @@
  * Licensed under the MIT license. See LICENSE file in the project root for full license information.
  */
 
+/*
+ * Defines
+ *
+ *     GCObject* copy_object_no_checks (GCObject *obj, SgenGrayQueue *queue)
+ *
+ * which allocates new space for `obj`, copies it there, forwards `obj` to its new location,
+ * and enqueues the copy into `queue`.
+ *
+ * To be defined by the includer:
+ *
+ *     COLLECTOR_SERIAL_ALLOC_FOR_PROMOTION(vt, obj, objsize, has_refs)
+ *
+ * Allocates space for promoting object `obj`, with size `objsize`, and initizializes the
+ * vtable with `vt`.  `has_refs` indicates whether the object contains references.
+ *
+ *     collector_pin_object(obj, queue)
+ *
+ * Called when no space for `obj` could be allocated.  It must pin `obj` and enqueue it into
+ * `queue` for scanning.
+ */
+
 extern guint64 stat_copy_object_called_nursery;
 extern guint64 stat_objects_copied_nursery;
 
@@ -73,3 +94,6 @@ copy_object_no_checks (GCObject *obj, SgenGrayQueue *queue)
 
        return (GCObject *)destination;
 }
+
+#undef COLLECTOR_SERIAL_ALLOC_FOR_PROMOTION
+#undef collector_pin_object
index 6daa9199dfcea5d7067518d98732a153cb5f6abc..f073dc740648154853db6016d8a4564f7f137fe0 100644 (file)
@@ -149,15 +149,16 @@ static gboolean missing_remsets;
  */
 #undef HANDLE_PTR
 #define HANDLE_PTR(ptr,obj)    do {    \
-       if (*(ptr) && sgen_ptr_in_nursery ((char*)*(ptr))) { \
-               if (!sgen_get_remset ()->find_address ((char*)(ptr)) && !sgen_cement_lookup (*(ptr))) { \
-                       GCVTable __vt = SGEN_LOAD_VTABLE (obj); \
-                       SGEN_LOG (0, "Oldspace->newspace 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))); \
-                       if (!object_is_pinned (*(ptr)))                                                         \
-                               missing_remsets = TRUE;                                                                 \
-               }                                                                                                                               \
-       }                                                                                                                                       \
+               if (*(ptr) && sgen_ptr_in_nursery ((char*)*(ptr))) {    \
+                       if (!sgen_get_remset ()->find_address ((char*)(ptr)) && !sgen_cement_lookup (*(ptr))) { \
+                               GCVTable __vt = SGEN_LOAD_VTABLE (obj); \
+                               gboolean is_pinned = object_is_pinned (*(ptr)); \
+                               SGEN_LOG (0, "Oldspace->newspace reference %p at offset %zd in object %p (%s.%s) not found in remsets%s.", *(ptr), (char*)(ptr) - (char*)(obj), (obj), sgen_client_vtable_get_namespace (__vt), sgen_client_vtable_get_name (__vt), is_pinned ? ", but object is pinned" : ""); \
+                               binary_protocol_missing_remset ((obj), __vt, (int) ((char*)(ptr) - (char*)(obj)), *(ptr), (gpointer)LOAD_VTABLE(*(ptr)), is_pinned); \
+                               if (!is_pinned)                         \
+                                       missing_remsets = TRUE;         \
+                       }                                               \
+               }                                                       \
        } while (0)
 
 /*
@@ -181,7 +182,7 @@ check_consistency_callback (GCObject *obj, size_t size, void *dummy)
  * Assumes the world is stopped.
  */
 void
-sgen_check_consistency (void)
+sgen_check_remset_consistency (void)
 {
        // Need to add more checks
 
@@ -196,6 +197,8 @@ sgen_check_consistency (void)
 
        SGEN_LOG (1, "Heap consistency check done.");
 
+       if (missing_remsets)
+               binary_protocol_flush_buffers (TRUE);
        if (!binary_protocol_is_enabled ())
                g_assert (!missing_remsets);
 }
@@ -426,15 +429,15 @@ missing_remset_spew (char *obj, char **slot)
 FIXME Flag missing remsets due to pinning as non fatal
 */
 #undef HANDLE_PTR
-#define HANDLE_PTR(ptr,obj)    do {    \
-               if (*(char**)ptr) {     \
+#define HANDLE_PTR(ptr,obj)    do {                                    \
+               if (*(char**)ptr) {                                     \
                        if (!is_valid_object_pointer (*(char**)ptr)) {  \
-                               bad_pointer_spew ((char*)obj, (char**)ptr);     \
-                       } else if (!sgen_ptr_in_nursery (obj) && sgen_ptr_in_nursery ((char*)*ptr)) {   \
-                               if (!sgen_get_remset ()->find_address ((char*)(ptr)) && !sgen_cement_lookup (*(ptr)) && (!allow_missing_pinned || !SGEN_OBJECT_IS_PINNED (*(ptr)))) \
-                               missing_remset_spew ((char*)obj, (char**)ptr);  \
-                       }       \
-        } \
+                               bad_pointer_spew ((char*)obj, (char**)ptr); \
+                       } else if (!sgen_ptr_in_nursery (obj) && sgen_ptr_in_nursery ((char*)*ptr)) { \
+                               if (!allow_missing_pinned && !SGEN_OBJECT_IS_PINNED (*(ptr)) && !sgen_get_remset ()->find_address ((char*)(ptr)) && !sgen_cement_lookup (*(ptr))) \
+                                       missing_remset_spew ((char*)obj, (char**)ptr); \
+                       }                                               \
+               }                                                       \
        } while (0)
 
 static void
index dd7cca93dbecc2634a3c6dce3ece2278a5d040ca..bef8bcded6fdb1ea3440012debe30e9a21ac7996 100644 (file)
@@ -557,30 +557,27 @@ sgen_object_register_for_finalization (GCObject *obj, void *user_data)
 }
 
 /* LOCKING: requires that the GC lock is held */
-static int
-finalizers_with_predicate (SgenObjectPredicateFunc predicate, void *user_data, GCObject **out_array, int out_size, SgenHashTable *hash_table)
+static void
+finalize_with_predicate (SgenObjectPredicateFunc predicate, void *user_data, SgenHashTable *hash_table)
 {
        GCObject *object;
        gpointer dummy G_GNUC_UNUSED;
-       int count;
 
-       if (no_finalize || !out_size || !out_array)
-               return 0;
-       count = 0;
+       if (no_finalize)
+               return;
        SGEN_HASH_TABLE_FOREACH (hash_table, GCObject *, object, gpointer, dummy) {
                object = tagged_object_get_object (object);
 
                if (predicate (object, user_data)) {
                        /* remove and put in out_array */
                        SGEN_HASH_TABLE_FOREACH_REMOVE (TRUE);
-                       out_array [count ++] = object;
-                       SGEN_LOG (5, "Collecting object for finalization: %p (%s) (%d)", object, sgen_client_vtable_get_name (SGEN_LOAD_VTABLE (object)), sgen_hash_table_num_entries (hash_table));
-                       if (count == out_size)
-                               return count;
-                       continue;
+                       sgen_queue_finalization_entry (object);
+                       SGEN_LOG (5, "Enqueuing object for finalization: %p (%s) (%d)", object, sgen_client_vtable_get_name (SGEN_LOAD_VTABLE (object)), sgen_hash_table_num_entries (hash_table));
                }
+
+               if (sgen_suspend_finalizers)
+                       break;
        } SGEN_HASH_TABLE_FOREACH_END;
-       return count;
 }
 
 /**
@@ -599,21 +596,14 @@ finalizers_with_predicate (SgenObjectPredicateFunc predicate, void *user_data, G
  * @out_array me be on the stack, or registered as a root, to allow the GC to know the
  * objects are still alive.
  */
-int
-sgen_gather_finalizers_if (SgenObjectPredicateFunc predicate, void *user_data, GCObject **out_array, int out_size)
+void
+sgen_finalize_if (SgenObjectPredicateFunc predicate, void *user_data)
 {
-       int result;
-
        LOCK_GC;
        sgen_process_fin_stage_entries ();
-       result = finalizers_with_predicate (predicate, user_data, (GCObject**)out_array, out_size, &minor_finalizable_hash);
-       if (result < out_size) {
-               result += finalizers_with_predicate (predicate, user_data, (GCObject**)out_array + result, out_size - result,
-                       &major_finalizable_hash);
-       }
+       finalize_with_predicate (predicate, user_data, &minor_finalizable_hash);
+       finalize_with_predicate (predicate, user_data, &major_finalizable_hash);
        UNLOCK_GC;
-
-       return result;
 }
 
 void
index e16cd9b957ad1b2beaa769cdf4b0fac426c8e725..7b650e42caed2aca222b783dea5788135e495edf 100644 (file)
@@ -214,8 +214,8 @@ guint32 verify_before_allocs = 0;
 guint32 collect_before_allocs = 0;
 /* If set, do a whole heap check before each collection */
 static gboolean whole_heap_check_before_collection = FALSE;
-/* If set, do a heap consistency check before each minor collection */
-static gboolean consistency_check_at_minor_collection = FALSE;
+/* If set, do a remset consistency check at various opportunities */
+static gboolean remset_consistency_checks = FALSE;
 /* If set, do a mod union consistency check before each finishing collection pause */
 static gboolean mod_union_consistency_check = FALSE;
 /* If set, check whether mark bits are consistent after major collections */
@@ -288,9 +288,6 @@ static guint64 time_max = 0;
 static SGEN_TV_DECLARE (time_major_conc_collection_start);
 static SGEN_TV_DECLARE (time_major_conc_collection_end);
 
-static SGEN_TV_DECLARE (last_minor_collection_start_tv);
-static SGEN_TV_DECLARE (last_minor_collection_end_tv);
-
 int gc_debug_level = 0;
 FILE* gc_debug_file;
 
@@ -399,8 +396,6 @@ static mword objects_pinned;
  * ######################################################################
  */
 
-typedef SgenGrayQueue GrayQueue;
-
 /* forward declarations */
 static void scan_from_registered_roots (char *addr_start, char *addr_end, int root_type, ScanCopyContext ctx);
 
@@ -410,51 +405,29 @@ static void finish_gray_stack (int generation, ScanCopyContext ctx);
 
 SgenMajorCollector major_collector;
 SgenMinorCollector sgen_minor_collector;
-/* FIXME: get rid of this */
-static GrayQueue gray_queue;
 
 static SgenRememberedSet remset;
 
-/* The gray queue to use from the main collection thread. */
-#define WORKERS_DISTRIBUTE_GRAY_QUEUE  (&gray_queue)
-
 /*
  * The gray queue a worker job must use.  If we're not parallel or
  * concurrent, we use the main gray queue.
  */
 static SgenGrayQueue*
-sgen_workers_get_job_gray_queue (WorkerData *worker_data)
+sgen_workers_get_job_gray_queue (WorkerData *worker_data, SgenGrayQueue *default_gray_queue)
 {
-       return worker_data ? &worker_data->private_gray_queue : WORKERS_DISTRIBUTE_GRAY_QUEUE;
-}
-
-static void
-gray_queue_redirect (SgenGrayQueue *queue)
-{
-       gboolean wake = FALSE;
-
-       for (;;) {
-               GrayQueueSection *section = sgen_gray_object_dequeue_section (queue);
-               if (!section)
-                       break;
-               sgen_section_gray_queue_enqueue ((SgenSectionGrayQueue *)queue->alloc_prepare_data, section);
-               wake = TRUE;
-       }
-
-       if (wake) {
-               g_assert (concurrent_collection_in_progress);
-               sgen_workers_ensure_awake ();
-       }
+       if (worker_data)
+               return &worker_data->private_gray_queue;
+       SGEN_ASSERT (0, default_gray_queue, "Why don't we have a default gray queue when we're not running in a worker thread?");
+       return default_gray_queue;
 }
 
 static void
 gray_queue_enable_redirect (SgenGrayQueue *queue)
 {
-       if (!concurrent_collection_in_progress)
-               return;
+       SGEN_ASSERT (0, concurrent_collection_in_progress, "Where are we redirecting the gray queue to, without a concurrent collection?");
 
-       sgen_gray_queue_set_alloc_prepare (queue, gray_queue_redirect, sgen_workers_get_distribute_section_gray_queue ());
-       gray_queue_redirect (queue);
+       sgen_gray_queue_set_alloc_prepare (queue, sgen_workers_take_from_queue_and_awake);
+       sgen_workers_take_from_queue_and_awake (queue);
 }
 
 void
@@ -537,7 +510,7 @@ gboolean
 sgen_drain_gray_stack (ScanCopyContext ctx)
 {
        ScanObjectFunc scan_func = ctx.ops->scan_object;
-       GrayQueue *queue = ctx.queue;
+       SgenGrayQueue *queue = ctx.queue;
 
        if (ctx.ops->drain_gray_stack)
                return ctx.ops->drain_gray_stack (queue);
@@ -734,7 +707,7 @@ pin_objects_in_nursery (gboolean do_scan_objects, ScanCopyContext ctx)
  * when we can't promote an object because we're out of memory.
  */
 void
-sgen_pin_object (GCObject *object, GrayQueue *queue)
+sgen_pin_object (GCObject *object, SgenGrayQueue *queue)
 {
        SGEN_ASSERT (0, sgen_ptr_in_nursery (object), "We're only supposed to use this for pinning nursery objects when out of memory.");
 
@@ -1329,20 +1302,25 @@ sgen_concurrent_collection_in_progress (void)
 typedef struct {
        SgenThreadPoolJob job;
        SgenObjectOperations *ops;
+       SgenGrayQueue *gc_thread_gray_queue;
 } ScanJob;
 
+static ScanCopyContext
+scan_copy_context_for_scan_job (void *worker_data_untyped, ScanJob *job)
+{
+       WorkerData *worker_data = (WorkerData *)worker_data_untyped;
+
+       return CONTEXT_FROM_OBJECT_OPERATIONS (job->ops, sgen_workers_get_job_gray_queue (worker_data, job->gc_thread_gray_queue));
+}
+
 static void
 job_remembered_set_scan (void *worker_data_untyped, SgenThreadPoolJob *job)
 {
-       WorkerData *worker_data = (WorkerData *)worker_data_untyped;
-       ScanJob *job_data = (ScanJob*)job;
-       ScanCopyContext ctx = CONTEXT_FROM_OBJECT_OPERATIONS (job_data->ops, sgen_workers_get_job_gray_queue (worker_data));
-       remset.scan_remsets (ctx);
+       remset.scan_remsets (scan_copy_context_for_scan_job (worker_data_untyped, (ScanJob*)job));
 }
 
 typedef struct {
-       SgenThreadPoolJob job;
-       SgenObjectOperations *ops;
+       ScanJob scan_job;
        char *heap_start;
        char *heap_end;
        int root_type;
@@ -1351,16 +1329,14 @@ typedef struct {
 static void
 job_scan_from_registered_roots (void *worker_data_untyped, SgenThreadPoolJob *job)
 {
-       WorkerData *worker_data = (WorkerData *)worker_data_untyped;
        ScanFromRegisteredRootsJob *job_data = (ScanFromRegisteredRootsJob*)job;
-       ScanCopyContext ctx = CONTEXT_FROM_OBJECT_OPERATIONS (job_data->ops, sgen_workers_get_job_gray_queue (worker_data));
+       ScanCopyContext ctx = scan_copy_context_for_scan_job (worker_data_untyped, &job_data->scan_job);
 
        scan_from_registered_roots (job_data->heap_start, job_data->heap_end, job_data->root_type, ctx);
 }
 
 typedef struct {
-       SgenThreadPoolJob job;
-       SgenObjectOperations *ops;
+       ScanJob scan_job;
        char *heap_start;
        char *heap_end;
 } ScanThreadDataJob;
@@ -1368,25 +1344,22 @@ typedef struct {
 static void
 job_scan_thread_data (void *worker_data_untyped, SgenThreadPoolJob *job)
 {
-       WorkerData *worker_data = (WorkerData *)worker_data_untyped;
        ScanThreadDataJob *job_data = (ScanThreadDataJob*)job;
-       ScanCopyContext ctx = CONTEXT_FROM_OBJECT_OPERATIONS (job_data->ops, sgen_workers_get_job_gray_queue (worker_data));
+       ScanCopyContext ctx = scan_copy_context_for_scan_job (worker_data_untyped, &job_data->scan_job);
 
        sgen_client_scan_thread_data (job_data->heap_start, job_data->heap_end, TRUE, ctx);
 }
 
 typedef struct {
-       SgenThreadPoolJob job;
-       SgenObjectOperations *ops;
+       ScanJob scan_job;
        SgenPointerQueue *queue;
 } ScanFinalizerEntriesJob;
 
 static void
 job_scan_finalizer_entries (void *worker_data_untyped, SgenThreadPoolJob *job)
 {
-       WorkerData *worker_data = (WorkerData *)worker_data_untyped;
        ScanFinalizerEntriesJob *job_data = (ScanFinalizerEntriesJob*)job;
-       ScanCopyContext ctx = CONTEXT_FROM_OBJECT_OPERATIONS (job_data->ops, sgen_workers_get_job_gray_queue (worker_data));
+       ScanCopyContext ctx = scan_copy_context_for_scan_job (worker_data_untyped, &job_data->scan_job);
 
        scan_finalizer_entries (job_data->queue, ctx);
 }
@@ -1394,9 +1367,8 @@ job_scan_finalizer_entries (void *worker_data_untyped, SgenThreadPoolJob *job)
 static void
 job_scan_major_mod_union_card_table (void *worker_data_untyped, SgenThreadPoolJob *job)
 {
-       WorkerData *worker_data = (WorkerData *)worker_data_untyped;
        ScanJob *job_data = (ScanJob*)job;
-       ScanCopyContext ctx = CONTEXT_FROM_OBJECT_OPERATIONS (job_data->ops, sgen_workers_get_job_gray_queue (worker_data));
+       ScanCopyContext ctx = scan_copy_context_for_scan_job (worker_data_untyped, job_data);
 
        g_assert (concurrent_collection_in_progress);
        major_collector.scan_card_table (CARDTABLE_SCAN_MOD_UNION, ctx);
@@ -1405,9 +1377,8 @@ job_scan_major_mod_union_card_table (void *worker_data_untyped, SgenThreadPoolJo
 static void
 job_scan_los_mod_union_card_table (void *worker_data_untyped, SgenThreadPoolJob *job)
 {
-       WorkerData *worker_data = (WorkerData *)worker_data_untyped;
        ScanJob *job_data = (ScanJob*)job;
-       ScanCopyContext ctx = CONTEXT_FROM_OBJECT_OPERATIONS (job_data->ops, sgen_workers_get_job_gray_queue (worker_data));
+       ScanCopyContext ctx = scan_copy_context_for_scan_job (worker_data_untyped, job_data);
 
        g_assert (concurrent_collection_in_progress);
        sgen_los_scan_card_table (CARDTABLE_SCAN_MOD_UNION, ctx);
@@ -1416,9 +1387,8 @@ job_scan_los_mod_union_card_table (void *worker_data_untyped, SgenThreadPoolJob
 static void
 job_mod_union_preclean (void *worker_data_untyped, SgenThreadPoolJob *job)
 {
-       WorkerData *worker_data = (WorkerData *)worker_data_untyped;
        ScanJob *job_data = (ScanJob*)job;
-       ScanCopyContext ctx = CONTEXT_FROM_OBJECT_OPERATIONS (job_data->ops, sgen_workers_get_job_gray_queue (worker_data));
+       ScanCopyContext ctx = scan_copy_context_for_scan_job (worker_data_untyped, job_data);
 
        g_assert (concurrent_collection_in_progress);
 
@@ -1429,15 +1399,15 @@ job_mod_union_preclean (void *worker_data_untyped, SgenThreadPoolJob *job)
 }
 
 static void
-init_gray_queue (gboolean use_workers)
+init_gray_queue (SgenGrayQueue *gc_thread_gray_queue, gboolean use_workers)
 {
        if (use_workers)
                sgen_workers_init_distribute_gray_queue ();
-       sgen_gray_object_queue_init (&gray_queue, NULL);
+       sgen_gray_object_queue_init (gc_thread_gray_queue, NULL, TRUE);
 }
 
 static void
-enqueue_scan_from_roots_jobs (char *heap_start, char *heap_end, SgenObjectOperations *ops, gboolean enqueue)
+enqueue_scan_from_roots_jobs (SgenGrayQueue *gc_thread_gray_queue, char *heap_start, char *heap_end, SgenObjectOperations *ops, gboolean enqueue)
 {
        ScanFromRegisteredRootsJob *scrrj;
        ScanThreadDataJob *stdj;
@@ -1446,38 +1416,43 @@ enqueue_scan_from_roots_jobs (char *heap_start, char *heap_end, SgenObjectOperat
        /* registered roots, this includes static fields */
 
        scrrj = (ScanFromRegisteredRootsJob*)sgen_thread_pool_job_alloc ("scan from registered roots normal", job_scan_from_registered_roots, sizeof (ScanFromRegisteredRootsJob));
-       scrrj->ops = ops;
+       scrrj->scan_job.ops = ops;
+       scrrj->scan_job.gc_thread_gray_queue = gc_thread_gray_queue;
        scrrj->heap_start = heap_start;
        scrrj->heap_end = heap_end;
        scrrj->root_type = ROOT_TYPE_NORMAL;
-       sgen_workers_enqueue_job (&scrrj->job, enqueue);
+       sgen_workers_enqueue_job (&scrrj->scan_job.job, enqueue);
 
        scrrj = (ScanFromRegisteredRootsJob*)sgen_thread_pool_job_alloc ("scan from registered roots wbarrier", job_scan_from_registered_roots, sizeof (ScanFromRegisteredRootsJob));
-       scrrj->ops = ops;
+       scrrj->scan_job.ops = ops;
+       scrrj->scan_job.gc_thread_gray_queue = gc_thread_gray_queue;
        scrrj->heap_start = heap_start;
        scrrj->heap_end = heap_end;
        scrrj->root_type = ROOT_TYPE_WBARRIER;
-       sgen_workers_enqueue_job (&scrrj->job, enqueue);
+       sgen_workers_enqueue_job (&scrrj->scan_job.job, enqueue);
 
        /* Threads */
 
        stdj = (ScanThreadDataJob*)sgen_thread_pool_job_alloc ("scan thread data", job_scan_thread_data, sizeof (ScanThreadDataJob));
-       stdj->ops = ops;
+       stdj->scan_job.ops = ops;
+       stdj->scan_job.gc_thread_gray_queue = gc_thread_gray_queue;
        stdj->heap_start = heap_start;
        stdj->heap_end = heap_end;
-       sgen_workers_enqueue_job (&stdj->job, enqueue);
+       sgen_workers_enqueue_job (&stdj->scan_job.job, enqueue);
 
        /* Scan the list of objects ready for finalization. */
 
        sfej = (ScanFinalizerEntriesJob*)sgen_thread_pool_job_alloc ("scan finalizer entries", job_scan_finalizer_entries, sizeof (ScanFinalizerEntriesJob));
+       sfej->scan_job.ops = ops;
+       sfej->scan_job.gc_thread_gray_queue = gc_thread_gray_queue;
        sfej->queue = &fin_ready_queue;
-       sfej->ops = ops;
-       sgen_workers_enqueue_job (&sfej->job, enqueue);
+       sgen_workers_enqueue_job (&sfej->scan_job.job, enqueue);
 
        sfej = (ScanFinalizerEntriesJob*)sgen_thread_pool_job_alloc ("scan critical finalizer entries", job_scan_finalizer_entries, sizeof (ScanFinalizerEntriesJob));
+       sfej->scan_job.ops = ops;
+       sfej->scan_job.gc_thread_gray_queue = gc_thread_gray_queue;
        sfej->queue = &critical_fin_queue;
-       sfej->ops = ops;
-       sgen_workers_enqueue_job (&sfej->job, enqueue);
+       sgen_workers_enqueue_job (&sfej->scan_job.job, enqueue);
 }
 
 /*
@@ -1493,10 +1468,13 @@ collect_nursery (const char *reason, gboolean is_overflow, SgenGrayQueue *unpin_
        char *nursery_next;
        mword fragment_total;
        ScanJob *sj;
-       SgenObjectOperations *object_ops = &sgen_minor_collector.serial_ops;
-       ScanCopyContext ctx = CONTEXT_FROM_OBJECT_OPERATIONS (object_ops, &gray_queue);
+       SgenGrayQueue gc_thread_gray_queue;
+       SgenObjectOperations *object_ops;
+       ScanCopyContext ctx;
        TV_DECLARE (atv);
        TV_DECLARE (btv);
+       SGEN_TV_DECLARE (last_minor_collection_start_tv);
+       SGEN_TV_DECLARE (last_minor_collection_end_tv);
 
        if (disable_minor_collections)
                return TRUE;
@@ -1506,6 +1484,11 @@ collect_nursery (const char *reason, gboolean is_overflow, SgenGrayQueue *unpin_
 
        binary_protocol_collection_begin (gc_stats.minor_gc_count, GENERATION_NURSERY);
 
+       if (sgen_concurrent_collection_in_progress ())
+               object_ops = &sgen_minor_collector.serial_ops_with_concurrent_major;
+       else
+               object_ops = &sgen_minor_collector.serial_ops;
+
        if (do_verify_nursery || do_dump_nursery_content)
                sgen_debug_verify_nursery (do_dump_nursery_content);
 
@@ -1541,7 +1524,8 @@ collect_nursery (const char *reason, gboolean is_overflow, SgenGrayQueue *unpin_
 
        sgen_memgov_minor_collection_start ();
 
-       init_gray_queue (FALSE);
+       init_gray_queue (&gc_thread_gray_queue, FALSE);
+       ctx = CONTEXT_FROM_OBJECT_OPERATIONS (object_ops, &gc_thread_gray_queue);
 
        gc_stats.minor_gc_count ++;
 
@@ -1549,8 +1533,6 @@ collect_nursery (const char *reason, gboolean is_overflow, SgenGrayQueue *unpin_
                sgen_clear_nursery_fragments ();
                sgen_check_whole_heap (finish_up_concurrent_mark);
        }
-       if (consistency_check_at_minor_collection)
-               sgen_check_consistency ();
 
        sgen_process_fin_stage_entries ();
 
@@ -1567,6 +1549,9 @@ collect_nursery (const char *reason, gboolean is_overflow, SgenGrayQueue *unpin_
        pin_objects_in_nursery (FALSE, ctx);
        sgen_pinning_trim_queue_to_section (nursery_section);
 
+       if (remset_consistency_checks)
+               sgen_check_remset_consistency ();
+
        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));
@@ -1574,6 +1559,7 @@ collect_nursery (const char *reason, gboolean is_overflow, SgenGrayQueue *unpin_
 
        sj = (ScanJob*)sgen_thread_pool_job_alloc ("scan remset", job_remembered_set_scan, sizeof (ScanJob));
        sj->ops = object_ops;
+       sj->gc_thread_gray_queue = &gc_thread_gray_queue;
        sgen_workers_enqueue_job (&sj->job, FALSE);
 
        /* we don't have complete write barrier yet, so we scan all the old generation sections */
@@ -1589,7 +1575,7 @@ collect_nursery (const char *reason, gboolean is_overflow, SgenGrayQueue *unpin_
        TV_GETTIME (atv);
        time_minor_scan_pinned += TV_ELAPSED (btv, atv);
 
-       enqueue_scan_from_roots_jobs (sgen_get_nursery_start (), nursery_next, object_ops, FALSE);
+       enqueue_scan_from_roots_jobs (&gc_thread_gray_queue, sgen_get_nursery_start (), nursery_next, object_ops, FALSE);
 
        TV_GETTIME (btv);
        time_minor_scan_roots += TV_ELAPSED (atv, btv);
@@ -1605,6 +1591,13 @@ collect_nursery (const char *reason, gboolean is_overflow, SgenGrayQueue *unpin_
                sgen_pinning_setup_section (nursery_section);
        }
 
+       /*
+        * This is the latest point at which we can do this check, because
+        * sgen_build_nursery_fragments() unpins nursery objects again.
+        */
+       if (remset_consistency_checks)
+               sgen_check_remset_consistency ();
+
        /* 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.
@@ -1622,7 +1615,7 @@ collect_nursery (const char *reason, gboolean is_overflow, SgenGrayQueue *unpin_
        time_minor_fragment_creation += TV_ELAPSED (atv, btv);
        SGEN_LOG (2, "Fragment creation: %lld usecs, %lu bytes available", (long long)TV_ELAPSED (atv, btv), (unsigned long)fragment_total);
 
-       if (consistency_check_at_minor_collection)
+       if (remset_consistency_checks)
                sgen_check_major_refs ();
 
        major_collector.finish_nursery_collection ();
@@ -1642,7 +1635,7 @@ collect_nursery (const char *reason, gboolean is_overflow, SgenGrayQueue *unpin_
        /* clear cemented hash */
        sgen_cement_clear_below_threshold ();
 
-       g_assert (sgen_gray_object_queue_is_empty (&gray_queue));
+       sgen_gray_object_queue_dispose (&gc_thread_gray_queue);
 
        remset.finish_minor_collection ();
 
@@ -1672,7 +1665,7 @@ typedef enum {
 } CopyOrMarkFromRootsMode;
 
 static void
-major_copy_or_mark_from_roots (size_t *old_next_pin_slot, CopyOrMarkFromRootsMode mode, SgenObjectOperations *object_ops)
+major_copy_or_mark_from_roots (SgenGrayQueue *gc_thread_gray_queue, size_t *old_next_pin_slot, CopyOrMarkFromRootsMode mode, SgenObjectOperations *object_ops)
 {
        LOSObject *bigobj;
        TV_DECLARE (atv);
@@ -1682,7 +1675,7 @@ major_copy_or_mark_from_roots (size_t *old_next_pin_slot, CopyOrMarkFromRootsMod
         */
        char *heap_start = NULL;
        char *heap_end = (char*)-1;
-       ScanCopyContext ctx = CONTEXT_FROM_OBJECT_OPERATIONS (object_ops, WORKERS_DISTRIBUTE_GRAY_QUEUE);
+       ScanCopyContext ctx = CONTEXT_FROM_OBJECT_OPERATIONS (object_ops, gc_thread_gray_queue);
        gboolean concurrent = mode != COPY_OR_MARK_FROM_ROOTS_SERIAL;
 
        SGEN_ASSERT (0, !!concurrent == !!concurrent_collection_in_progress, "We've been called with the wrong mode.");
@@ -1698,8 +1691,6 @@ major_copy_or_mark_from_roots (size_t *old_next_pin_slot, CopyOrMarkFromRootsMod
                sgen_nursery_alloc_prepare_for_major ();
        }
 
-       init_gray_queue (mode == COPY_OR_MARK_FROM_ROOTS_START_CONCURRENT);
-
        TV_GETTIME (atv);
 
        /* Pinning depends on this */
@@ -1777,7 +1768,7 @@ major_copy_or_mark_from_roots (size_t *old_next_pin_slot, CopyOrMarkFromRootsMod
                        }
                        sgen_los_pin_object (bigobj->data);
                        if (SGEN_OBJECT_HAS_REFERENCES (bigobj->data))
-                               GRAY_OBJECT_ENQUEUE (WORKERS_DISTRIBUTE_GRAY_QUEUE, bigobj->data, sgen_obj_get_descriptor ((GCObject*)bigobj->data));
+                               GRAY_OBJECT_ENQUEUE (gc_thread_gray_queue, bigobj->data, sgen_obj_get_descriptor ((GCObject*)bigobj->data));
                        sgen_pin_stats_register_object (bigobj->data, GENERATION_OLD);
                        SGEN_LOG (6, "Marked large object %p (%s) size: %lu from roots", bigobj->data,
                                        sgen_client_vtable_get_name (SGEN_LOAD_VTABLE (bigobj->data)),
@@ -1791,10 +1782,17 @@ major_copy_or_mark_from_roots (size_t *old_next_pin_slot, CopyOrMarkFromRootsMod
        if (check_nursery_objects_pinned && !sgen_minor_collector.is_split)
                sgen_check_nursery_objects_pinned (mode != COPY_OR_MARK_FROM_ROOTS_START_CONCURRENT);
 
-       major_collector.pin_objects (WORKERS_DISTRIBUTE_GRAY_QUEUE);
+       major_collector.pin_objects (gc_thread_gray_queue);
        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));
@@ -1825,7 +1823,7 @@ major_copy_or_mark_from_roots (size_t *old_next_pin_slot, CopyOrMarkFromRootsMod
 
        sgen_client_collecting_major_3 (&fin_ready_queue, &critical_fin_queue);
 
-       enqueue_scan_from_roots_jobs (heap_start, heap_end, object_ops, FALSE);
+       enqueue_scan_from_roots_jobs (gc_thread_gray_queue, heap_start, heap_end, object_ops, FALSE);
 
        TV_GETTIME (btv);
        time_major_scan_roots += TV_ELAPSED (atv, btv);
@@ -1841,11 +1839,12 @@ major_copy_or_mark_from_roots (size_t *old_next_pin_slot, CopyOrMarkFromRootsMod
                        /* Mod union preclean job */
                        sj = (ScanJob*)sgen_thread_pool_job_alloc ("preclean mod union cardtable", job_mod_union_preclean, sizeof (ScanJob));
                        sj->ops = object_ops;
+                       sj->gc_thread_gray_queue = NULL;
                        sgen_workers_start_all_workers (object_ops, &sj->job);
                } else {
                        sgen_workers_start_all_workers (object_ops, NULL);
                }
-               gray_queue_enable_redirect (WORKERS_DISTRIBUTE_GRAY_QUEUE);
+               gray_queue_enable_redirect (gc_thread_gray_queue);
        }
 
        if (mode == COPY_OR_MARK_FROM_ROOTS_FINISH_CONCURRENT) {
@@ -1854,10 +1853,12 @@ major_copy_or_mark_from_roots (size_t *old_next_pin_slot, CopyOrMarkFromRootsMod
                /* Mod union card table */
                sj = (ScanJob*)sgen_thread_pool_job_alloc ("scan mod union cardtable", job_scan_major_mod_union_card_table, sizeof (ScanJob));
                sj->ops = object_ops;
+               sj->gc_thread_gray_queue = gc_thread_gray_queue;
                sgen_workers_enqueue_job (&sj->job, FALSE);
 
                sj = (ScanJob*)sgen_thread_pool_job_alloc ("scan LOS mod union cardtable", job_scan_los_mod_union_card_table, sizeof (ScanJob));
                sj->ops = object_ops;
+               sj->gc_thread_gray_queue = gc_thread_gray_queue;
                sgen_workers_enqueue_job (&sj->job, FALSE);
 
                TV_GETTIME (atv);
@@ -1865,11 +1866,7 @@ major_copy_or_mark_from_roots (size_t *old_next_pin_slot, CopyOrMarkFromRootsMod
        }
 
        sgen_pin_stats_report ();
-}
 
-static void
-major_finish_copy_or_mark (CopyOrMarkFromRootsMode mode)
-{
        if (mode == COPY_OR_MARK_FROM_ROOTS_START_CONCURRENT) {
                sgen_finish_pinning ();
 
@@ -1881,7 +1878,7 @@ major_finish_copy_or_mark (CopyOrMarkFromRootsMode mode)
 }
 
 static void
-major_start_collection (const char *reason, gboolean concurrent, size_t *old_next_pin_slot)
+major_start_collection (SgenGrayQueue *gc_thread_gray_queue, const char *reason, gboolean concurrent, size_t *old_next_pin_slot)
 {
        SgenObjectOperations *object_ops;
 
@@ -1889,7 +1886,7 @@ major_start_collection (const char *reason, gboolean concurrent, size_t *old_nex
 
        current_collection_generation = GENERATION_OLD;
 
-       g_assert (sgen_section_gray_queue_is_empty (sgen_workers_get_distribute_section_gray_queue ()));
+       sgen_workers_assert_gray_queue_is_empty ();
 
        if (!concurrent)
                sgen_cement_reset ();
@@ -1919,12 +1916,11 @@ major_start_collection (const char *reason, gboolean concurrent, size_t *old_nex
        if (major_collector.start_major_collection)
                major_collector.start_major_collection ();
 
-       major_copy_or_mark_from_roots (old_next_pin_slot, concurrent ? COPY_OR_MARK_FROM_ROOTS_START_CONCURRENT : COPY_OR_MARK_FROM_ROOTS_SERIAL, object_ops);
-       major_finish_copy_or_mark (concurrent ? COPY_OR_MARK_FROM_ROOTS_START_CONCURRENT : COPY_OR_MARK_FROM_ROOTS_SERIAL);
+       major_copy_or_mark_from_roots (gc_thread_gray_queue, old_next_pin_slot, concurrent ? COPY_OR_MARK_FROM_ROOTS_START_CONCURRENT : COPY_OR_MARK_FROM_ROOTS_SERIAL, object_ops);
 }
 
 static void
-major_finish_collection (const char *reason, gboolean is_overflow, size_t old_next_pin_slot, gboolean forced)
+major_finish_collection (SgenGrayQueue *gc_thread_gray_queue, const char *reason, gboolean is_overflow, size_t old_next_pin_slot, gboolean forced)
 {
        ScannedObjectCounts counts;
        SgenObjectOperations *object_ops;
@@ -1937,9 +1933,7 @@ major_finish_collection (const char *reason, gboolean is_overflow, size_t old_ne
        if (concurrent_collection_in_progress) {
                object_ops = &major_collector.major_ops_concurrent_finish;
 
-               major_copy_or_mark_from_roots (NULL, COPY_OR_MARK_FROM_ROOTS_FINISH_CONCURRENT, object_ops);
-
-               major_finish_copy_or_mark (COPY_OR_MARK_FROM_ROOTS_FINISH_CONCURRENT);
+               major_copy_or_mark_from_roots (gc_thread_gray_queue, NULL, COPY_OR_MARK_FROM_ROOTS_FINISH_CONCURRENT, object_ops);
 
 #ifdef SGEN_DEBUG_INTERNAL_ALLOC
                main_gc_thread = NULL;
@@ -1948,10 +1942,9 @@ major_finish_collection (const char *reason, gboolean is_overflow, size_t old_ne
                object_ops = &major_collector.major_ops_serial;
        }
 
-       g_assert (sgen_section_gray_queue_is_empty (sgen_workers_get_distribute_section_gray_queue ()));
+       sgen_workers_assert_gray_queue_is_empty ();
 
-       /* all the objects in the heap */
-       finish_gray_stack (GENERATION_OLD, CONTEXT_FROM_OBJECT_OPERATIONS (object_ops, &gray_queue));
+       finish_gray_stack (GENERATION_OLD, CONTEXT_FROM_OBJECT_OPERATIONS (object_ops, gc_thread_gray_queue));
        TV_GETTIME (atv);
        time_major_finish_gray_stack += TV_ELAPSED (btv, atv);
 
@@ -1982,6 +1975,9 @@ major_finish_collection (const char *reason, gboolean is_overflow, size_t old_ne
        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.
@@ -2035,15 +2031,13 @@ major_finish_collection (const char *reason, gboolean is_overflow, size_t old_ne
                sgen_client_finalize_notify ();
        }
 
-       g_assert (sgen_gray_object_queue_is_empty (&gray_queue));
-
        sgen_memgov_major_collection_end (forced, concurrent_collection_in_progress, reason, is_overflow);
        current_collection_generation = -1;
 
        memset (&counts, 0, sizeof (ScannedObjectCounts));
        major_collector.finish_major_collection (&counts);
 
-       g_assert (sgen_section_gray_queue_is_empty (sgen_workers_get_distribute_section_gray_queue ()));
+       sgen_workers_assert_gray_queue_is_empty ();
 
        SGEN_ASSERT (0, sgen_workers_all_done (), "Can't have workers working after major collection has finished");
        if (concurrent_collection_in_progress)
@@ -2064,6 +2058,7 @@ major_do_collection (const char *reason, gboolean is_overflow, gboolean forced)
        TV_DECLARE (time_start);
        TV_DECLARE (time_end);
        size_t old_next_pin_slot;
+       SgenGrayQueue gc_thread_gray_queue;
 
        if (disable_major_collections)
                return FALSE;
@@ -2076,8 +2071,10 @@ major_do_collection (const char *reason, gboolean is_overflow, gboolean forced)
        /* world must be stopped already */
        TV_GETTIME (time_start);
 
-       major_start_collection (reason, FALSE, &old_next_pin_slot);
-       major_finish_collection (reason, is_overflow, old_next_pin_slot, forced);
+       init_gray_queue (&gc_thread_gray_queue, FALSE);
+       major_start_collection (&gc_thread_gray_queue, reason, FALSE, &old_next_pin_slot);
+       major_finish_collection (&gc_thread_gray_queue, reason, is_overflow, old_next_pin_slot, forced);
+       sgen_gray_object_queue_dispose (&gc_thread_gray_queue);
 
        TV_GETTIME (time_end);
        gc_stats.major_gc_time += TV_ELAPSED (time_start, time_end);
@@ -2095,6 +2092,7 @@ major_start_concurrent_collection (const char *reason)
        TV_DECLARE (time_start);
        TV_DECLARE (time_end);
        long long num_objects_marked;
+       SgenGrayQueue gc_thread_gray_queue;
 
        if (disable_major_collections)
                return;
@@ -2107,10 +2105,10 @@ major_start_concurrent_collection (const char *reason)
 
        binary_protocol_concurrent_start ();
 
+       init_gray_queue (&gc_thread_gray_queue, TRUE);
        // FIXME: store reason and pass it when finishing
-       major_start_collection (reason, TRUE, NULL);
-
-       gray_queue_redirect (&gray_queue);
+       major_start_collection (&gc_thread_gray_queue, reason, TRUE, NULL);
+       sgen_gray_object_queue_dispose (&gc_thread_gray_queue);
 
        num_objects_marked = major_collector.get_and_reset_num_major_objects_marked ();
 
@@ -2126,7 +2124,6 @@ major_start_concurrent_collection (const char *reason)
 static gboolean
 major_should_finish_concurrent_collection (void)
 {
-       SGEN_ASSERT (0, sgen_gray_object_queue_is_empty (&gray_queue), "Why is the gray queue not empty before we have started doing anything?");
        return sgen_workers_all_done ();
 }
 
@@ -2150,6 +2147,7 @@ major_update_concurrent_collection (void)
 static void
 major_finish_concurrent_collection (gboolean forced)
 {
+       SgenGrayQueue gc_thread_gray_queue;
        TV_DECLARE (total_start);
        TV_DECLARE (total_end);
 
@@ -2175,13 +2173,12 @@ major_finish_concurrent_collection (gboolean forced)
 
        current_collection_generation = GENERATION_OLD;
        sgen_cement_reset ();
-       major_finish_collection ("finishing", FALSE, -1, forced);
-
-       if (whole_heap_check_before_collection)
-               sgen_check_whole_heap (FALSE);
+       init_gray_queue (&gc_thread_gray_queue, FALSE);
+       major_finish_collection (&gc_thread_gray_queue, "finishing", FALSE, -1, forced);
+       sgen_gray_object_queue_dispose (&gc_thread_gray_queue);
 
        TV_GETTIME (total_end);
-       gc_stats.major_gc_time += TV_ELAPSED (total_start, total_end) - TV_ELAPSED (last_minor_collection_start_tv, last_minor_collection_end_tv);
+       gc_stats.major_gc_time += TV_ELAPSED (total_start, total_end);
 
        current_collection_generation = -1;
 }
@@ -2305,8 +2302,6 @@ sgen_perform_collection (size_t requested_size, int generation_to_collect, const
                degraded_mode = 1;
        }
 
-       g_assert (sgen_gray_object_queue_is_empty (&gray_queue));
-
        TV_GETTIME (gc_total_end);
        time_max = MAX (time_max, TV_ELAPSED (gc_total_start, gc_total_end));
 
@@ -2408,6 +2403,13 @@ sgen_object_is_live (GCObject *obj)
  */
 
 static volatile gboolean pending_unqueued_finalizer = FALSE;
+volatile gboolean sgen_suspend_finalizers = FALSE;
+
+void
+sgen_set_suspend_finalizers (void)
+{
+       sgen_suspend_finalizers = TRUE;
+}
 
 int
 sgen_gc_invoke_finalizers (void)
@@ -2463,6 +2465,8 @@ sgen_gc_invoke_finalizers (void)
 gboolean
 sgen_have_pending_finalizers (void)
 {
+       if (sgen_suspend_finalizers)
+               return FALSE;
        return pending_unqueued_finalizer || !sgen_pointer_queue_is_empty (&fin_ready_queue) || !sgen_pointer_queue_is_empty (&critical_fin_queue);
 }
 
@@ -3031,8 +3035,8 @@ sgen_gc_init (void)
                                collect_before_allocs = atoi (arg);
                        } else if (!strcmp (opt, "verify-before-collections")) {
                                whole_heap_check_before_collection = TRUE;
-                       } else if (!strcmp (opt, "check-at-minor-collections")) {
-                               consistency_check_at_minor_collection = TRUE;
+                       } else if (!strcmp (opt, "check-remset-consistency")) {
+                               remset_consistency_checks = TRUE;
                                nursery_clear_policy = CLEAR_AT_GC;
                        } else if (!strcmp (opt, "mod-union-consistency-check")) {
                                if (!major_collector.is_concurrent) {
@@ -3098,7 +3102,7 @@ sgen_gc_init (void)
                                fprintf (stderr, "Valid <option>s are:\n");
                                fprintf (stderr, "  collect-before-allocs[=<n>]\n");
                                fprintf (stderr, "  verify-before-allocs[=<n>]\n");
-                               fprintf (stderr, "  check-at-minor-collections\n");
+                               fprintf (stderr, "  check-remset-consistency\n");
                                fprintf (stderr, "  check-mark-bits\n");
                                fprintf (stderr, "  check-nursery-pinned\n");
                                fprintf (stderr, "  verify-before-collections\n");
@@ -3143,6 +3147,14 @@ sgen_gc_init (void)
        sgen_register_root (NULL, 0, sgen_make_user_root_descriptor (sgen_mark_normal_gc_handles), ROOT_TYPE_NORMAL, MONO_ROOT_SOURCE_GC_HANDLE, "normal gc handles");
 
        gc_initialized = 1;
+
+       sgen_init_bridge ();
+}
+
+gboolean
+sgen_gc_initialized ()
+{
+       return gc_initialized > 0;
 }
 
 NurseryClearPolicy
index b0ac3dbcb10d5592e54750ad1662db5370396ac9..a517035499306398ce354ef0bff9957ecf6a181d 100644 (file)
@@ -287,6 +287,7 @@ sgen_get_nursery_end (void)
 List of what each bit on of the vtable gc bits means. 
 */
 enum {
+       // When the Java bridge has determined an object is "bridged", it uses these two bits to cache that information.
        SGEN_GC_BIT_BRIDGE_OBJECT = 1,
        SGEN_GC_BIT_BRIDGE_OPAQUE_OBJECT = 2,
        SGEN_GC_BIT_FINALIZER_AWARE = 4,
@@ -302,6 +303,8 @@ void sgen_check_section_scan_starts (GCMemSection *section);
 
 void sgen_conservatively_pin_objects_from (void **start, void **end, void *start_nursery, void *end_nursery, int pin_type);
 
+gboolean sgen_gc_initialized (void);
+
 /* Keep in sync with description_for_type() in sgen-internal.c! */
 enum {
        INTERNAL_MEM_PIN_QUEUE,
@@ -554,6 +557,7 @@ typedef struct {
        GCObject* (*alloc_for_promotion) (GCVTable vtable, GCObject *obj, size_t objsize, gboolean has_references);
 
        SgenObjectOperations serial_ops;
+       SgenObjectOperations serial_ops_with_concurrent_major;
 
        void (*prepare_to_space) (char *to_space_bitmap, size_t space_bitmap_size);
        void (*clear_fragments) (void);
@@ -810,8 +814,9 @@ void sgen_process_fin_stage_entries (void);
 gboolean sgen_have_pending_finalizers (void);
 void sgen_object_register_for_finalization (GCObject *obj, void *user_data);
 
-int sgen_gather_finalizers_if (SgenObjectPredicateFunc predicate, void *user_data, GCObject **out_array, int out_size);
+void sgen_finalize_if (SgenObjectPredicateFunc predicate, void *user_data);
 void sgen_remove_finalizers_if (SgenObjectPredicateFunc predicate, void *user_data, int generation);
+void sgen_set_suspend_finalizers (void);
 
 void sgen_register_disappearing_link (GCObject *obj, void **link, gboolean track, gboolean in_gc);
 
@@ -974,7 +979,7 @@ extern NurseryClearPolicy nursery_clear_policy;
 extern gboolean sgen_try_free_some_memory;
 extern mword total_promoted_size;
 extern mword total_allocated_major;
-
+extern volatile gboolean sgen_suspend_finalizers;
 extern MonoCoopMutex gc_mutex;
 
 /* Nursery helpers. */
@@ -1008,7 +1013,7 @@ GCObject* sgen_alloc_obj_mature (GCVTable vtable, size_t size);
 
 /* Debug support */
 
-void sgen_check_consistency (void);
+void sgen_check_remset_consistency (void);
 void sgen_check_mod_union_consistency (void);
 void sgen_check_major_refs (void);
 void sgen_check_whole_heap (gboolean allow_missing_pinning);
index 809215136f9799d817b0b157d6c1ac972f085f93..9b5f92a19547916049f9129c7ed8a1fd360497c8 100644 (file)
@@ -38,6 +38,12 @@ guint64 stat_gray_queue_dequeue_slow_path;
 #define STATE_ASSERT(s,v)
 #endif
 
+/*
+ * Whenever we dispose a gray queue, we save its free list.  Then, in the next collection,
+ * we reuse that free list for the new gray queue.
+ */
+static GrayQueueSection *last_gray_queue_free_list;
+
 void
 sgen_gray_object_alloc_queue_section (SgenGrayQueue *queue)
 {
@@ -212,48 +218,40 @@ sgen_gray_object_queue_trim_free_list (SgenGrayQueue *queue)
 }
 
 void
-sgen_gray_object_queue_init (SgenGrayQueue *queue, GrayQueueEnqueueCheckFunc enqueue_check_func)
+sgen_gray_object_queue_init (SgenGrayQueue *queue, GrayQueueEnqueueCheckFunc enqueue_check_func, gboolean reuse_free_list)
 {
-       g_assert (sgen_gray_object_queue_is_empty (queue));
+       memset (queue, 0, sizeof (SgenGrayQueue));
 
-       queue->alloc_prepare_func = NULL;
-       queue->alloc_prepare_data = NULL;
 #ifdef SGEN_CHECK_GRAY_OBJECT_ENQUEUE
        queue->enqueue_check_func = enqueue_check_func;
 #endif
 
-       /* Free the extra sections allocated during the last collection */
-       sgen_gray_object_queue_trim_free_list (queue);
-}
-
-static void
-invalid_prepare_func (SgenGrayQueue *queue)
-{
-       g_assert_not_reached ();
+       if (reuse_free_list) {
+               queue->free_list = last_gray_queue_free_list;
+               last_gray_queue_free_list = NULL;
+       }
 }
 
 void
-sgen_gray_object_queue_init_invalid (SgenGrayQueue *queue)
+sgen_gray_object_queue_dispose (SgenGrayQueue *queue)
 {
-       sgen_gray_object_queue_init (queue, NULL);
-       queue->alloc_prepare_func = invalid_prepare_func;
-       queue->alloc_prepare_data = NULL;
-}
+       SGEN_ASSERT (0, sgen_gray_object_queue_is_empty (queue), "Why are we disposing a gray queue that's not empty?");
 
-void
-sgen_gray_queue_set_alloc_prepare (SgenGrayQueue *queue, GrayQueueAllocPrepareFunc alloc_prepare_func, void *data)
-{
-       SGEN_ASSERT (0, !queue->alloc_prepare_func && !queue->alloc_prepare_data, "Can't set gray queue alloc-prepare twice");
-       queue->alloc_prepare_func = alloc_prepare_func;
-       queue->alloc_prepare_data = data;
+       /* Free the extra sections allocated during the last collection */
+       sgen_gray_object_queue_trim_free_list (queue);
+
+       SGEN_ASSERT (0, !last_gray_queue_free_list, "Are we disposing two gray queues after another?");
+       last_gray_queue_free_list = queue->free_list;
+
+       /* just to make sure */
+       memset (queue, 0, sizeof (SgenGrayQueue));
 }
 
 void
-sgen_gray_object_queue_init_with_alloc_prepare (SgenGrayQueue *queue, GrayQueueEnqueueCheckFunc enqueue_check_func,
-               GrayQueueAllocPrepareFunc alloc_prepare_func, void *data)
+sgen_gray_queue_set_alloc_prepare (SgenGrayQueue *queue, GrayQueueAllocPrepareFunc alloc_prepare_func)
 {
-       sgen_gray_object_queue_init (queue, enqueue_check_func);
-       sgen_gray_queue_set_alloc_prepare (queue, alloc_prepare_func, data);
+       SGEN_ASSERT (0, !queue->alloc_prepare_func, "Can't set gray queue alloc-prepare twice");
+       queue->alloc_prepare_func = alloc_prepare_func;
 }
 
 void
@@ -268,13 +266,6 @@ sgen_gray_object_queue_deinit (SgenGrayQueue *queue)
        }
 }
 
-void
-sgen_gray_object_queue_disable_alloc_prepare (SgenGrayQueue *queue)
-{
-       queue->alloc_prepare_func = NULL;
-       queue->alloc_prepare_data = NULL;
-}
-
 static void
 lock_section_queue (SgenSectionGrayQueue *queue)
 {
index 019f44c927c8e5fbee00e0d291c0234cb54b73cb..2a872d7d2bf1816193f06f8dfebec7a035cfb4d1 100644 (file)
@@ -97,7 +97,6 @@ struct _SgenGrayQueue {
 #ifdef SGEN_CHECK_GRAY_OBJECT_ENQUEUE
        GrayQueueEnqueueCheckFunc enqueue_check_func;
 #endif
-       void *alloc_prepare_data;
 };
 
 typedef struct _SgenSectionGrayQueue SgenSectionGrayQueue;
@@ -130,13 +129,10 @@ GrayQueueEntry sgen_gray_object_dequeue (SgenGrayQueue *queue);
 GrayQueueSection* sgen_gray_object_dequeue_section (SgenGrayQueue *queue);
 void sgen_gray_object_enqueue_section (SgenGrayQueue *queue, GrayQueueSection *section);
 void sgen_gray_object_queue_trim_free_list (SgenGrayQueue *queue);
-void sgen_gray_object_queue_init (SgenGrayQueue *queue, GrayQueueEnqueueCheckFunc enqueue_check_func);
-void sgen_gray_object_queue_init_invalid (SgenGrayQueue *queue);
-void sgen_gray_queue_set_alloc_prepare (SgenGrayQueue *queue, GrayQueueAllocPrepareFunc alloc_prepare_func, void *data);
-void sgen_gray_object_queue_init_with_alloc_prepare (SgenGrayQueue *queue, GrayQueueEnqueueCheckFunc enqueue_check_func,
-               GrayQueueAllocPrepareFunc func, void *data);
+void sgen_gray_object_queue_init (SgenGrayQueue *queue, GrayQueueEnqueueCheckFunc enqueue_check_func, gboolean reuse_free_list);
+void sgen_gray_object_queue_dispose (SgenGrayQueue *queue);
+void sgen_gray_queue_set_alloc_prepare (SgenGrayQueue *queue, GrayQueueAllocPrepareFunc alloc_prepare_func);
 void sgen_gray_object_queue_deinit (SgenGrayQueue *queue);
-void sgen_gray_object_queue_disable_alloc_prepare (SgenGrayQueue *queue);
 void sgen_gray_object_alloc_queue_section (SgenGrayQueue *queue);
 void sgen_gray_object_free_queue_section (GrayQueueSection *section);
 
index ccff562737ab4deac9515b83c266f95147ebf36d..12ace19a3e904e4782f5bdc8febd21709cb3e78d 100644 (file)
@@ -96,8 +96,10 @@ sgen_register_fixed_internal_mem_type (int type, size_t size)
 
        if (fixed_type_allocator_indexes [type] == -1)
                fixed_type_allocator_indexes [type] = slot;
-       else
-               g_assert (fixed_type_allocator_indexes [type] == slot);
+       else {
+               if (fixed_type_allocator_indexes [type] != slot)
+                       g_error ("Invalid double registration of type %d old slot %d new slot %d", type, fixed_type_allocator_indexes [type], slot);
+       }
 }
 
 static const char*
index 4b52eefb3f00cdf295504d29a21780667e99f144..c032d1946f41c18b3dcf1df001b2f1b976025253 100644 (file)
@@ -526,12 +526,14 @@ sgen_ptr_is_in_los (char *ptr, char **start)
 {
        LOSObject *obj;
 
-       *start = NULL;
+       if (start)
+               *start = NULL;
        for (obj = los_object_list; obj; obj = obj->next) {
                char *end = (char*)obj->data + sgen_los_object_size (obj);
 
                if (ptr >= (char*)obj->data && ptr < end) {
-                       *start = (char*)obj->data;
+                       if (start)
+                               *start = (char*)obj->data;
                        return TRUE;
                }
        }
index 4d0c09d40a8514809c32b3ddc4f34cf838751f94..aa5ef1a44a93ace9fe040a3089e3bcffbf19f93e 100644 (file)
@@ -563,17 +563,41 @@ ms_alloc_block (int size_index, gboolean pinned, gboolean has_references)
 }
 
 static gboolean
-ptr_is_from_pinned_alloc (char *ptr)
+ptr_is_in_major_block (char *ptr, char **start, gboolean *pinned)
 {
        MSBlockInfo *block;
 
        FOREACH_BLOCK_NO_LOCK (block) {
-               if (ptr >= MS_BLOCK_FOR_BLOCK_INFO (block) && ptr <= MS_BLOCK_FOR_BLOCK_INFO (block) + MS_BLOCK_SIZE)
-                       return block->pinned;
+               if (ptr >= MS_BLOCK_FOR_BLOCK_INFO (block) && ptr <= MS_BLOCK_FOR_BLOCK_INFO (block) + MS_BLOCK_SIZE) {
+                       int count = MS_BLOCK_FREE / block->obj_size;
+                       int i;
+
+                       if (start)
+                               *start = NULL;
+                       for (i = 0; i <= count; ++i) {
+                               if (ptr >= (char*)MS_BLOCK_OBJ (block, i) && ptr < (char*)MS_BLOCK_OBJ (block, i + 1)) {
+                                       if (start)
+                                               *start = (char *)MS_BLOCK_OBJ (block, i);
+                                       break;
+                               }
+                       }
+                       if (pinned)
+                               *pinned = block->pinned;
+                       return TRUE;
+               }
        } END_FOREACH_BLOCK_NO_LOCK;
        return FALSE;
 }
 
+static gboolean
+ptr_is_from_pinned_alloc (char *ptr)
+{
+       gboolean pinned;
+       if (ptr_is_in_major_block (ptr, NULL, &pinned))
+               return pinned;
+       return FALSE;
+}
+
 static void
 ensure_can_access_block_free_list (MSBlockInfo *block)
 {
@@ -772,23 +796,9 @@ major_is_object_live (GCObject *obj)
 static gboolean
 major_ptr_is_in_non_pinned_space (char *ptr, char **start)
 {
-       MSBlockInfo *block;
-
-       FOREACH_BLOCK_NO_LOCK (block) {
-               if (ptr >= MS_BLOCK_FOR_BLOCK_INFO (block) && ptr <= MS_BLOCK_FOR_BLOCK_INFO (block) + MS_BLOCK_SIZE) {
-                       int count = MS_BLOCK_FREE / block->obj_size;
-                       int i;
-
-                       *start = NULL;
-                       for (i = 0; i <= count; ++i) {
-                               if (ptr >= (char*)MS_BLOCK_OBJ (block, i) && ptr < (char*)MS_BLOCK_OBJ (block, i + 1)) {
-                                       *start = (char *)MS_BLOCK_OBJ (block, i);
-                                       break;
-                               }
-                       }
-                       return !block->pinned;
-               }
-       } END_FOREACH_BLOCK_NO_LOCK;
+       gboolean pinned;
+       if (ptr_is_in_major_block (ptr, start, &pinned))
+               return !pinned;
        return FALSE;
 }
 
@@ -1572,6 +1582,12 @@ ensure_block_is_checked_for_sweeping (guint32 block_index, gboolean wait, gboole
        }
 
  done:
+       /*
+        * Once the block is written back without the checking bit other threads are
+        * free to access it. Make sure the block state is visible before we write it
+        * back.
+        */
+       mono_memory_write_barrier ();
        *block_slot = tagged_block;
        return !!tagged_block;
 }
@@ -1850,7 +1866,7 @@ sgen_evacuation_freelist_blocks (MSBlockInfo * volatile *block_list, int size_in
 
        SGEN_ASSERT (0, num_blocks == index, "Why did the freelist change ?");
 
-       qsort (evacuated_blocks, num_blocks, sizeof (gpointer), block_usage_comparer);
+       sgen_qsort (evacuated_blocks, num_blocks, sizeof (gpointer), block_usage_comparer);
 
        /*
         * Form a new freelist with the fullest blocks. These blocks will also be
index a77d53b4744bed22af7beefdba02232bbb373c22..da392c4292847badfe7fcc5a9b01e9c2cb082851 100644 (file)
@@ -8,12 +8,35 @@
  * Licensed under the MIT license. See LICENSE file in the project root for full license information.
  */
 
-#define collector_pin_object(obj, queue) sgen_pin_object (obj, queue);
-#define COLLECTOR_SERIAL_ALLOC_FOR_PROMOTION alloc_for_promotion
+#undef SERIAL_COPY_OBJECT
+#undef SERIAL_COPY_OBJECT_FROM_OBJ
 
-extern guint64 stat_nursery_copy_object_failed_to_space; /* from sgen-gc.c */
+#if defined(SGEN_SIMPLE_NURSERY)
+
+#ifdef SGEN_CONCURRENT_MAJOR
+#define SERIAL_COPY_OBJECT simple_nursery_serial_with_concurrent_major_copy_object
+#define SERIAL_COPY_OBJECT_FROM_OBJ simple_nursery_serial_with_concurrent_major_copy_object_from_obj
+#else
+#define SERIAL_COPY_OBJECT simple_nursery_serial_copy_object
+#define SERIAL_COPY_OBJECT_FROM_OBJ simple_nursery_serial_copy_object_from_obj
+#endif
+
+#elif defined (SGEN_SPLIT_NURSERY)
+
+#ifdef SGEN_CONCURRENT_MAJOR
+#define SERIAL_COPY_OBJECT split_nursery_serial_with_concurrent_major_copy_object
+#define SERIAL_COPY_OBJECT_FROM_OBJ split_nursery_serial_with_concurrent_major_copy_object_from_obj
+#else
+#define SERIAL_COPY_OBJECT split_nursery_serial_copy_object
+#define SERIAL_COPY_OBJECT_FROM_OBJ split_nursery_serial_copy_object_from_obj
+#endif
+
+#else
+#error "No nursery configuration specified"
+#endif
 
-#include "sgen-copy-object.h"
+
+extern guint64 stat_nursery_copy_object_failed_to_space; /* from sgen-gc.c */
 
 /*
  * This is how the copying happens from the nursery to the old generation.
@@ -121,6 +144,10 @@ SERIAL_COPY_OBJECT_FROM_OBJ (GCObject **obj_slot, SgenGrayQueue *queue)
                SGEN_ASSERT (9, sgen_obj_get_descriptor (forwarded),  "forwarded object %p has no gc descriptor", forwarded);
                SGEN_LOG (9, " (already forwarded to %p)", forwarded);
                HEAVY_STAT (++stat_nursery_copy_object_failed_forwarded);
+#ifdef SGEN_CONCURRENT_MAJOR
+               /* See comment on STORE_STORE_FENCE below. */
+               STORE_STORE_FENCE;
+#endif
                SGEN_UPDATE_REFERENCE (obj_slot, forwarded);
 #ifndef SGEN_SIMPLE_NURSERY
                if (G_UNLIKELY (sgen_ptr_in_nursery (forwarded) && !sgen_ptr_in_nursery (obj_slot) && !SGEN_OBJECT_IS_CEMENTED (forwarded)))
@@ -187,6 +214,16 @@ SERIAL_COPY_OBJECT_FROM_OBJ (GCObject **obj_slot, SgenGrayQueue *queue)
        HEAVY_STAT (++stat_objects_copied_nursery);
 
        copy = copy_object_no_checks (obj, queue);
+#ifdef SGEN_CONCURRENT_MAJOR
+       /*
+        * If an object is evacuated to the major heap and a reference to it, from the major
+        * heap, updated, the concurrent major collector might follow that reference and
+        * scan the new major object.  To make sure the object contents are seen by the
+        * major collector we need this write barrier, so that the reference is seen after
+        * the object.
+        */
+       STORE_STORE_FENCE;
+#endif
        SGEN_UPDATE_REFERENCE (obj_slot, copy);
 #ifndef SGEN_SIMPLE_NURSERY
        if (G_UNLIKELY (sgen_ptr_in_nursery (copy) && !sgen_ptr_in_nursery (obj_slot) && !SGEN_OBJECT_IS_CEMENTED (copy)))
@@ -199,7 +236,3 @@ SERIAL_COPY_OBJECT_FROM_OBJ (GCObject **obj_slot, SgenGrayQueue *queue)
        }
 #endif
 }
-
-#define FILL_MINOR_COLLECTOR_COPY_OBJECT(collector)    do {                    \
-               (collector)->serial_ops.copy_or_mark_object = SERIAL_COPY_OBJECT;                       \
-       } while (0)
index 4b62a739f27183622a0dbc4441e1ea2b17536b9c..cc3e7a4539e794037d54c6055196b2d9df815fef 100644 (file)
 
 extern guint64 stat_scan_object_called_nursery;
 
+#undef SERIAL_SCAN_OBJECT
+#undef SERIAL_SCAN_VTYPE
+#undef SERIAL_SCAN_PTR_FIELD
+
 #if defined(SGEN_SIMPLE_NURSERY)
+
+#ifdef SGEN_CONCURRENT_MAJOR
+#define SERIAL_SCAN_OBJECT simple_nursery_serial_with_concurrent_major_scan_object
+#define SERIAL_SCAN_VTYPE simple_nursery_serial_with_concurrent_major_scan_vtype
+#define SERIAL_SCAN_PTR_FIELD simple_nursery_serial_with_concurrent_major_scan_ptr_field
+#else
 #define SERIAL_SCAN_OBJECT simple_nursery_serial_scan_object
 #define SERIAL_SCAN_VTYPE simple_nursery_serial_scan_vtype
+#define SERIAL_SCAN_PTR_FIELD simple_nursery_serial_scan_ptr_field
+#endif
 
 #elif defined (SGEN_SPLIT_NURSERY)
+
+#ifdef SGEN_CONCURRENT_MAJOR
+#define SERIAL_SCAN_OBJECT split_nursery_serial_with_concurrent_major_scan_object
+#define SERIAL_SCAN_VTYPE split_nursery_serial_with_concurrent_major_scan_vtype
+#define SERIAL_SCAN_PTR_FIELD split_nursery_serial_with_concurrent_major_scan_ptr_field
+#else
 #define SERIAL_SCAN_OBJECT split_nursery_serial_scan_object
 #define SERIAL_SCAN_VTYPE split_nursery_serial_scan_vtype
+#define SERIAL_SCAN_PTR_FIELD split_nursery_serial_scan_ptr_field
+#endif
 
 #else
-#error "Please define GC_CONF_NAME"
+#error "No nursery configuration specified"
 #endif
 
 #undef HANDLE_PTR
@@ -75,8 +95,8 @@ SERIAL_SCAN_PTR_FIELD (GCObject *full_object, GCObject **ptr, SgenGrayQueue *que
        HANDLE_PTR (ptr, NULL);
 }
 
-#define FILL_MINOR_COLLECTOR_SCAN_OBJECT(collector)    do {                    \
-               (collector)->serial_ops.scan_object = SERIAL_SCAN_OBJECT;       \
-               (collector)->serial_ops.scan_vtype = SERIAL_SCAN_VTYPE; \
-               (collector)->serial_ops.scan_ptr_field = SERIAL_SCAN_PTR_FIELD; \
+#define FILL_MINOR_COLLECTOR_SCAN_OBJECT(ops)  do {                    \
+               (ops)->scan_object = SERIAL_SCAN_OBJECT;                        \
+               (ops)->scan_vtype = SERIAL_SCAN_VTYPE;                  \
+               (ops)->scan_ptr_field = SERIAL_SCAN_PTR_FIELD;          \
        } while (0)
index 2e59b6359a4b1aea6f4e650998ae1590e4318d50..ce504201f62d7ce42f8c0f5d64df086f7ed9d786 100644 (file)
@@ -262,27 +262,33 @@ binary_protocol_check_file_overflow (void)
  *
  * The protocol entries that do flush have `FLUSH()` in their definition.
  */
-void
+gboolean
 binary_protocol_flush_buffers (gboolean force)
 {
 #ifdef HAVE_UNISTD_H
        int num_buffers = 0, i;
+       BinaryProtocolBuffer *header;
        BinaryProtocolBuffer *buf;
        BinaryProtocolBuffer **bufs;
 
        if (binary_protocol_file == -1)
-               return;
+               return FALSE;
 
        if (!force && !try_lock_exclusive ())
-               return;
+               return FALSE;
 
-       for (buf = binary_protocol_buffers; buf != NULL; buf = buf->next)
+       header = binary_protocol_buffers;
+       for (buf = header; buf != NULL; buf = buf->next)
                ++num_buffers;
        bufs = (BinaryProtocolBuffer **)sgen_alloc_internal_dynamic (num_buffers * sizeof (BinaryProtocolBuffer*), INTERNAL_MEM_BINARY_PROTOCOL, TRUE);
-       for (buf = binary_protocol_buffers, i = 0; buf != NULL; buf = buf->next, i++)
+       for (buf = header, i = 0; buf != NULL; buf = buf->next, i++)
                bufs [i] = buf;
        SGEN_ASSERT (0, i == num_buffers, "Binary protocol buffer count error");
 
+       /*
+        * This might be incorrect when forcing, but all bets are off in that case, anyway,
+        * because we're trying to figure out a bug in the debugger.
+        */
        binary_protocol_buffers = NULL;
 
        for (i = num_buffers - 1; i >= 0; --i) {
@@ -294,6 +300,8 @@ binary_protocol_flush_buffers (gboolean force)
 
        if (!force)
                unlock_exclusive ();
+
+       return TRUE;
 #endif
 }
 
index 1c10d29d5c0e367f07e8d26a0163177da59c1b41..adefb98070bd5538b5d4a50442c311ef68dac853 100644 (file)
@@ -154,7 +154,7 @@ enum {
 void binary_protocol_init (const char *filename, long long limit);
 gboolean binary_protocol_is_enabled (void);
 
-void binary_protocol_flush_buffers (gboolean force);
+gboolean binary_protocol_flush_buffers (gboolean force);
 
 #define BEGIN_PROTOCOL_ENTRY0(method) \
        void method (void);
index 62c14a5392bc394ffef8420e9741629b458d1b2b..bc8aee7044c8a12baaa684e9411893dedf9f567a 100644 (file)
@@ -18,6 +18,7 @@
 #include "mono/sgen/sgen-protocol.h"
 #include "mono/sgen/sgen-layout-stats.h"
 #include "mono/sgen/sgen-client.h"
+#include "mono/utils/mono-memory-model.h"
 
 static inline GCObject*
 alloc_for_promotion (GCVTable vtable, GCObject *obj, size_t objsize, gboolean has_references)
@@ -61,14 +62,35 @@ init_nursery (SgenFragmentAllocator *allocator, char *start, char *end)
 
 /******************************************Copy/Scan functins ************************************************/
 
+#define collector_pin_object(obj, queue) sgen_pin_object (obj, queue);
+#define COLLECTOR_SERIAL_ALLOC_FOR_PROMOTION alloc_for_promotion
+
+#include "sgen-copy-object.h"
+
 #define SGEN_SIMPLE_NURSERY
 
-#define SERIAL_COPY_OBJECT simple_nursery_serial_copy_object
-#define SERIAL_COPY_OBJECT_FROM_OBJ simple_nursery_serial_copy_object_from_obj
+#include "sgen-minor-copy-object.h"
+#include "sgen-minor-scan-object.h"
+
+static void
+fill_serial_ops (SgenObjectOperations *ops)
+{
+       ops->copy_or_mark_object = SERIAL_COPY_OBJECT;
+       FILL_MINOR_COLLECTOR_SCAN_OBJECT (ops);
+}
+
+#define SGEN_CONCURRENT_MAJOR
 
 #include "sgen-minor-copy-object.h"
 #include "sgen-minor-scan-object.h"
 
+static void
+fill_serial_with_concurrent_major_ops (SgenObjectOperations *ops)
+{
+       ops->copy_or_mark_object = SERIAL_COPY_OBJECT;
+       FILL_MINOR_COLLECTOR_SCAN_OBJECT (ops);
+}
+
 void
 sgen_simple_nursery_init (SgenMinorCollector *collector)
 {
@@ -83,8 +105,8 @@ sgen_simple_nursery_init (SgenMinorCollector *collector)
        collector->build_fragments_finish = build_fragments_finish;
        collector->init_nursery = init_nursery;
 
-       FILL_MINOR_COLLECTOR_COPY_OBJECT (collector);
-       FILL_MINOR_COLLECTOR_SCAN_OBJECT (collector);
+       fill_serial_ops (&collector->serial_ops);
+       fill_serial_with_concurrent_major_ops (&collector->serial_ops_with_concurrent_major);
 }
 
 
index 3b7ae668a203d537bd2372d15d62e7630c5db7e6..a4deb5a3c6a702d2e65b37c1530102f8767776dc 100644 (file)
@@ -418,14 +418,35 @@ print_gc_param_usage (void)
 
 /******************************************Copy/Scan functins ************************************************/
 
+#define collector_pin_object(obj, queue) sgen_pin_object (obj, queue);
+#define COLLECTOR_SERIAL_ALLOC_FOR_PROMOTION alloc_for_promotion
+
+#include "sgen-copy-object.h"
+
 #define SGEN_SPLIT_NURSERY
 
-#define SERIAL_COPY_OBJECT split_nursery_serial_copy_object
-#define SERIAL_COPY_OBJECT_FROM_OBJ split_nursery_serial_copy_object_from_obj
+#include "sgen-minor-copy-object.h"
+#include "sgen-minor-scan-object.h"
+
+static void
+fill_serial_ops (SgenObjectOperations *ops)
+{
+       ops->copy_or_mark_object = SERIAL_COPY_OBJECT;
+       FILL_MINOR_COLLECTOR_SCAN_OBJECT (ops);
+}
+
+#define SGEN_CONCURRENT_MAJOR
 
 #include "sgen-minor-copy-object.h"
 #include "sgen-minor-scan-object.h"
 
+static void
+fill_serial_with_concurrent_major_ops (SgenObjectOperations *ops)
+{
+       ops->copy_or_mark_object = SERIAL_COPY_OBJECT;
+       FILL_MINOR_COLLECTOR_SCAN_OBJECT (ops);
+}
+
 void
 sgen_split_nursery_init (SgenMinorCollector *collector)
 {
@@ -442,8 +463,8 @@ sgen_split_nursery_init (SgenMinorCollector *collector)
        collector->handle_gc_param = handle_gc_param;
        collector->print_gc_param_usage = print_gc_param_usage;
 
-       FILL_MINOR_COLLECTOR_COPY_OBJECT (collector);
-       FILL_MINOR_COLLECTOR_SCAN_OBJECT (collector);
+       fill_serial_ops (&collector->serial_ops);
+       fill_serial_with_concurrent_major_ops (&collector->serial_ops_with_concurrent_major);
 }
 
 
index adc600a090f3dc801f8d1b16b4796acb28a69988..dfdff8c9062f2a7e25f8b5d5591ebc1b1b598187 100644 (file)
@@ -77,7 +77,7 @@ state_is_working_or_enqueued (State state)
        return state == STATE_WORKING || state == STATE_WORK_ENQUEUED;
 }
 
-void
+static void
 sgen_workers_ensure_awake (void)
 {
        State old_state;
@@ -177,7 +177,8 @@ static void
 init_private_gray_queue (WorkerData *data)
 {
        sgen_gray_object_queue_init (&data->private_gray_queue,
-                       sgen_get_major_collector ()->is_concurrent ? concurrent_enqueue_check : NULL);
+                       sgen_get_major_collector ()->is_concurrent ? concurrent_enqueue_check : NULL,
+                       FALSE);
 }
 
 static void
@@ -354,10 +355,29 @@ sgen_workers_are_working (void)
        return state_is_working_or_enqueued (workers_state);
 }
 
-SgenSectionGrayQueue*
-sgen_workers_get_distribute_section_gray_queue (void)
+void
+sgen_workers_assert_gray_queue_is_empty (void)
 {
-       return &workers_distribute_gray_queue;
+       SGEN_ASSERT (0, sgen_section_gray_queue_is_empty (&workers_distribute_gray_queue), "Why is the workers gray queue not empty?");
+}
+
+void
+sgen_workers_take_from_queue_and_awake (SgenGrayQueue *queue)
+{
+       gboolean wake = FALSE;
+
+       for (;;) {
+               GrayQueueSection *section = sgen_gray_object_dequeue_section (queue);
+               if (!section)
+                       break;
+               sgen_section_gray_queue_enqueue (&workers_distribute_gray_queue, section);
+               wake = TRUE;
+       }
+
+       if (wake) {
+               SGEN_ASSERT (0, sgen_concurrent_collection_in_progress (), "Why is there work to take when there's no concurrent collection in progress?");
+               sgen_workers_ensure_awake ();
+       }
 }
 
 #endif
index 780d2eb6df921ed6a096879c4876eef75f8adbaf..1a66c79a48c238fd5ae4e3b589bc4e6e8f5ca4bf 100644 (file)
@@ -20,7 +20,6 @@ struct _WorkerData {
 void sgen_workers_init (int num_workers);
 void sgen_workers_stop_all_workers (void);
 void sgen_workers_start_all_workers (SgenObjectOperations *object_ops, SgenThreadPoolJob *finish_job);
-void sgen_workers_ensure_awake (void);
 void sgen_workers_init_distribute_gray_queue (void);
 void sgen_workers_enqueue_job (SgenThreadPoolJob *job, gboolean enqueue);
 void sgen_workers_wait_for_jobs_finished (void);
@@ -30,6 +29,7 @@ void sgen_workers_join (void);
 gboolean sgen_workers_have_idle_work (void);
 gboolean sgen_workers_all_done (void);
 gboolean sgen_workers_are_working (void);
-SgenSectionGrayQueue* sgen_workers_get_distribute_section_gray_queue (void);
+void sgen_workers_assert_gray_queue_is_empty (void);
+void sgen_workers_take_from_queue_and_awake (SgenGrayQueue *queue);
 
 #endif
index 2bd8f5dff12e5266fa7c39893d1b5e7fdb1fec29..1cfd4fdb897ecec92dd246cf7b6bc7452b68d09f 100644 (file)
@@ -1,7 +1,13 @@
 SUBDIRS = assemblyresolve gc-descriptors
 
+if INSTALL_MOBILE_STATIC
+FEATUREFUL_RUNTIME_TEST =  
+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     \
-                test-console-output test-messages test-env-options test-unhandled-exception-2 test-appdomain-unload test-process-stress rm-empty-logs
+                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
 
@@ -28,6 +34,8 @@ else
 TEST_RUNNER_ARGS=--config tests-config --runtime $(if $(MONO_EXECUTABLE),$(MONO_EXECUTABLE),mono)
 endif
 
+TEST_RUNNER_ARGS += $(if $(V), --verbose,)
+
 CLASS=$(mcs_topdir)/class/lib/$(DEFAULT_PROFILE)
 
 with_mono_path = MONO_PATH=$(CLASS)
@@ -38,16 +46,27 @@ MKBUNDLE = \
        PKG_CONFIG_PATH=$(top_builddir):$(PKG_CONFIG_PATH) \
        $(RUNTIME) $(CLASS)/mkbundle.exe
 
+if INSTALL_MOBILE_STATIC
+PROFILE_MCS_FLAGS = -d:MOBILE,MOBILE_STATIC,MOBILE_LEGACY 
+endif
+
 MCS_NO_LIB = $(RUNTIME) $(mcs_topdir)/class/lib/build/mcs.exe -unsafe -debug \
        -noconfig -nologo \
        -nowarn:0162 -nowarn:0168 -nowarn:0219 -nowarn:0414 -nowarn:0618 \
        -nowarn:0169 -nowarn:1690 -nowarn:0649 -nowarn:0612 -nowarn:3021 \
-       -nowarn:0197
+       -nowarn:0197 $(PROFILE_MCS_FLAGS)
 
 MCS = $(MCS_NO_LIB) -lib:$(CLASS)
 
 ILASM = $(RUNTIME) $(CLASS)/ilasm.exe
 
+if INSTALL_MOBILE_STATIC
+TEST_RUNNER = ./test-runner.exe --runtime $(top_builddir)/runtime/mono-wrapper --mono-path "$(CLASS)" --aot-run-flags "$(AOT_RUN_FLAGS)" --aot-build-flags "$(AOT_BUILD_FLAGS)"
+else
+TEST_RUNNER = ./test-runner.exe --runtime $(top_builddir)/runtime/mono-wrapper --mono-path "$(CLASS)"
+endif
+
+
 BENCHSRC=fib.cs random.cs nested-loops.cs ackermann.cs tight-loop.cs sieve.cs
 
 STRESS_TESTS_SRC=      \
@@ -65,9 +84,68 @@ STRESS_TESTS_SRC=    \
        process-stress.cs       \
        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
+
 # Disabled until ?mcs is fixed
 #      bug-331958.cs
-BASE_TEST_CS_SRC=              \
+BASE_TEST_CS_SRC_UNIVERSAL=            \
+       generic-unloading-sub.2.cs      \
+       create-instance.cs      \
        bug-2907.cs             \
        array-init.cs           \
        arraylist.cs            \
@@ -77,7 +155,6 @@ BASE_TEST_CS_SRC=            \
        assemblyresolve_event4.cs       \
        checked.cs              \
        char-isnumber.cs        \
-       create-instance.cs      \
        field-layout.cs         \
        pack-layout.cs          \
        pack-bug.cs             \
@@ -114,7 +191,6 @@ BASE_TEST_CS_SRC=           \
        typeof-ptr.cs           \
        static-constructor.cs   \
        pinvoke.cs              \
-       pinvoke2.cs             \
        pinvoke3.cs             \
        pinvoke11.cs            \
        pinvoke13.cs            \
@@ -180,13 +256,6 @@ BASE_TEST_CS_SRC=          \
        jit-float.cs            \
        pop.cs                  \
        time.cs                 \
-       appdomain.cs        \
-       appdomain1.cs           \
-       appdomain2.cs           \
-       appdomain-client.cs     \
-       appdomain-unload.cs \
-       appdomain-async-invoke.cs       \
-       loader.cs       \
        pointer.cs              \
        hashcode.cs             \
        delegate1.cs            \
@@ -196,16 +265,10 @@ BASE_TEST_CS_SRC=         \
        delegate6.cs            \
        delegate7.cs            \
        delegate8.cs            \
-       delegate9.cs            \
        delegate10.cs           \
        delegate11.cs           \
        delegate12.cs           \
        delegate13.cs           \
-       remoting1.cs            \
-       remoting2.cs            \
-       remoting3.cs            \
-       remoting4.cs            \
-       remoting5.cs            \
        largeexp.cs             \
        largeexp2.cs            \
        marshalbyref1.cs        \
@@ -226,11 +289,9 @@ BASE_TEST_CS_SRC=          \
        marshal8.cs             \
        marshal9.cs             \
        marshalbool.cs          \
-       marshal-valuetypes.cs   \
        test-byval-in-struct.cs \
        thread.cs               \
        thread5.cs              \
-       thread6.cs              \
        thread-static.cs        \
        thread-static-init.cs   \
        context-static.cs       \
@@ -250,12 +311,9 @@ BASE_TEST_CS_SRC=          \
        threadpool-exceptions4.cs \
        threadpool-exceptions5.cs \
        threadpool-exceptions6.cs \
-       threadpool-exceptions7.cs \
        base-definition.cs      \
        bug-27420.cs            \
-       bug-47295.cs            \
        bug-46781.cs            \
-       bug-48015.cs            \
        bug-42136.cs            \
        bug-59286.cs            \
        bug-70561.cs            \
@@ -266,8 +324,6 @@ BASE_TEST_CS_SRC=           \
        bug-323114.cs           \
        bug-Xamarin-5278.cs     \
        interlocked.cs          \
-       cross-domain.cs         \
-       appdomain-exit.cs       \
        delegate-async-exit.cs  \
        delegate-delegate-exit.cs       \
        delegate-exit.cs        \
@@ -284,16 +340,13 @@ BASE_TEST_CS_SRC=         \
        main-returns.cs         \
        subthread-exit.cs       \
        desweak.cs              \
-       cominterop.cs           \
        exists.cs               \
        handleref.cs    \
-       transparentproxy.cs \
        dbnull-missing.cs       \
        test-type-ctor.cs       \
        soft-float-tests.cs     \
        thread-exit.cs          \
        finalize-parent.cs      \
-       assemblyresolve_event2.2.cs     \
        interlocked-2.2.cs      \
        pinvoke-2.2.cs          \
        bug-78431.2.cs          \
@@ -301,7 +354,6 @@ BASE_TEST_CS_SRC=           \
        catch-generics.2.cs     \
        event-get.2.cs          \
        safehandle.2.cs         \
-       stackframes-async.2.cs          \
        module-cctor-loader.2.cs        \
        generics-invoke-byref.2.cs      \
        generic-signature-compare.2.cs  \
@@ -323,14 +375,10 @@ BASE_TEST_CS_SRC=         \
        generic-virtual2.2.cs   \
        generic-valuetype-interface.2.cs        \
        generic-getgenericarguments.2.cs        \
-       generic-type-builder.2.cs       \
        generic-synchronized.2.cs       \
        generic-delegate-ctor.2.cs      \
        generic-array-iface-set.2.cs    \
        generic-typedef.2.cs    \
-       generic-marshalbyref.2.cs       \
-       generic-xdomain.2.cs    \
-       dynamic-generic-size.cs \
        bug-431413.2.cs \
        bug-459285.2.cs \
        generic-virtual-invoke.2.cs     \
@@ -346,27 +394,17 @@ BASE_TEST_CS_SRC=         \
        bug-479763.2.cs \
        bug-616463.cs   \
        bug-80392.2.cs          \
-       dynamic-method-access.2.cs      \
-       dynamic-method-finalize.2.cs    \
-       dynamic-method-stack-traces.cs  \
        bug-82194.2.cs  \
        anonarray.2.cs  \
        ienumerator-interfaces.2.cs     \
        array-enumerator-ifaces.2.cs    \
        generic_type_definition_encoding.2.cs \
-       generic_type_definition.2.cs    \
        bug-333798.2.cs         \
-       bug-333798-tb.2.cs              \
-       bug-335131.2.cs         \
-       bug-322722_patch_bx.2.cs                \
        bug-348522.2.cs         \
        bug-340662_bug.cs       \
-       bug-322722_dyn_method_throw.2.cs        \
-       bug-389886-2.cs \
        bug-325283.2.cs \
        thunks.cs \
        winx64structs.cs \
-       bug-349190.2.cs \
        nullable_boxing.2.cs    \
        valuetype-equals.cs     \
        custom-modifiers.2.cs   \
@@ -375,44 +413,30 @@ BASE_TEST_CS_SRC=         \
        bug-324535.cs   \
        modules.cs      \
        bug-81673.cs    \
-       bug-36848.cs    \
        bug-81691.cs    \
-       bug-80307.cs    \
        bug-415577.cs   \
        filter-stack.cs \
        vararg2.cs      \
-       bug-389886-sre-generic-interface-instances.cs   \
        bug-461867.cs   \
        bug-461941.cs   \
        bug-461261.cs   \
        bug-400716.cs   \
-       bug-462592.cs   \
        bug-459094.cs   \
-       generic-unloading.2.cs  \
-       generic-unloading-sub.2.cs      \
        bug-467456.cs   \
-       appdomain-unload-callback.cs    \
        bug-508538.cs   \
        bug-472692.2.cs         \
        gchandles.cs    \
        interlocked-3.cs        \
        interlocked-4.2.cs      \
-       appdomain-thread-abort.cs \
-       xdomain-threads.cs      \
        w32message.cs   \
-       bug-544446.cs   \
        gc-altstack.cs  \
        large-gc-bitmap.cs      \
        bug-561239.cs   \
        bug-562150.cs   \
-       bug-575941.cs   \
        bug-599469.cs   \
-       bug-389886-3.cs \
-       monitor.cs      \
        monitor-resurrection.cs \
        monitor-wait-abort.cs   \
        monitor-abort.cs        \
-       dynamic-method-resurrection.cs  \
        bug-666008.cs   \
        bug-685908.cs   \
        sgen-long-vtype.cs      \
@@ -424,13 +448,10 @@ BASE_TEST_CS_SRC=         \
        bug-bxc-795.cs  \
        bug-3903.cs     \
        async-with-cb-throws.cs \
-       appdomain-unload-doesnot-raise-pending-events.cs        \
        bug-6148.cs     \
-       assembly_append_ordering.cs     \
        bug-10127.cs    \
        bug-18026.cs    \
        allow-synchronous-major.cs      \
-       unload-appdomain-on-shutdown.cs \
        block_guard_restore_aligment_on_exit.cs \
        thread_static_gc_layout.cs \
        sleep.cs \
@@ -445,6 +466,15 @@ BASE_TEST_CS_SRC=          \
        bug-29585.cs    \
        priority.cs
 
+if INSTALL_MOBILE_STATIC
+BASE_TEST_CS_SRC= \
+       $(BASE_TEST_CS_SRC_UNIVERSAL)
+else
+BASE_TEST_CS_SRC= \
+       $(BASE_TEST_MOBILE_STATIC_NOT_SUPPORTED) \
+       $(BASE_TEST_CS_SRC_UNIVERSAL)
+endif
+
 TEST_CS_SRC_DIST=      \
        $(BASE_TEST_CS_SRC)     \
        async-exc-compilation.cs \
@@ -598,6 +628,52 @@ else
 COOP_DISABLED_TESTS= 
 endif
 
+if INSTALL_MOBILE_STATIC
+# Tests which rely on TypeLoadExceptions
+# In full-aot mode, these cause the relevant methods to be not AOTed.
+PROFILE_DISABLED_TESTS = \
+       typeload-unaligned.exe \
+       field-access.exe \
+       invalid_generic_instantiation.exe \
+       bug-481403.exe \
+       array_ldelema.exe \
+       array_load_exception.exe \
+       bug445361.exe \
+       generic-type-load-exception.2.exe \
+       invalid-token.exe \
+       call_missing_method.exe \
+       call_missing_class.exe \
+       ldfld_missing_field.exe \
+       ldfld_missing_class.exe \
+       vt-sync-method.exe
+
+# Tests which rely on remoting
+PROFILE_DISABLED_TESTS += \
+       context-static.exe \
+       bug-415577.exe \
+       generic-marshalbyref.2.exe \
+       unhandled-exception-7.exe
+
+# Tests which use unsupported pinvoke+full aot
+# functionality
+PROFILE_DISABLED_TESTS += \
+       marshal.exe \
+       marshal2.exe \
+       marshal6.exe \
+       marshal7.exe \
+       marshal8.exe \
+       pinvoke-2.2.exe \
+       pinvoke3.exe \
+       thunks.exe
+
+# Tests which load assemblies which are not
+# in the mobile_static profile
+PROFILE_DISABLED_TESTS += \
+       assembly-load-remap.exe
+else
+PROFILE_DISABLED_TESTS=
+endif
+
 # The two finalizer tests only work under sgen
 # gc-altstack.exe fails under boehm because it has no support for altstack
 # bug-459094.exe creates an extremely deep directory tree
@@ -612,7 +688,8 @@ DISABLED_TESTS=                     \
        bug-Xamarin-5278.exe \
        $(PLATFORM_DISABLED_TESTS) \
        $(EXTRA_DISABLED_TESTS) \
-       $(COOP_DISABLED_TESTS)
+       $(COOP_DISABLED_TESTS) \
+       $(PROFILE_DISABLED_TESTS)
 
 DISABLED_TESTS_WRENCH= \
        $(DISABLED_TESTS)       \
@@ -632,7 +709,14 @@ AOT_DISABLED_TESTS=constraints-load.exe
 TEST_CSC_SRC=                  \
        vararg.cs
 
-TEST_IL_SRC=                   \
+# constraints-load.il: 
+# Failed to load method 0x6000007 from '..../mono/tests/constraints-load.exe' due to 
+# Could not resolve type with token 01000002 assembly:mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 type:System.BrokenIComparable`1 member:<none>.
+IL_SRC_MOBILE_STATIC_NOT_SUPPORTED=    \
+       constraints-load.il \
+       bug-515884.il
+
+TEST_IL_SRC_UNIVERSAL=                 \
        field-access.il         \
        method-access.il        \
        ldftn-access.il         \
@@ -691,17 +775,23 @@ TEST_IL_SRC=                      \
        bug-463303.il   \
        bug469742.2.il  \
        bug-528055.il   \
-       constraints-load.il     \
        array_load_exception.il \
        bug-481403.il   \
        interface-with-static-method.il \
-       bug-515884.il   \
        bug-633291.il   \
        delegate-with-null-target.il    \
        bug-318677.il   \
        gsharing-valuetype-layout.il    \
        invalid_generic_instantiation.il
 
+if INSTALL_MOBILE_STATIC
+TEST_IL_SRC= \
+       $(TEST_IL_SRC_UNIVERSAL)
+else
+TEST_IL_SRC= \
+       $(TEST_IL_SRC_MOBILE_STATIC_NOT_SUPPORTED) \
+       $(TEST_IL_SRC_UNIVERSAL)
+endif
 
 # pre-requisite test sources: files that are not test themselves
 # but that need to be compiled
@@ -717,14 +807,33 @@ 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))
+
 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)
 
 %.exe: %.il
        $(ILASM) -out:$@ $<
 
-%.exe: %.cs TestDriver.dll
-       $(MCS) -r:System.dll -r:System.Xml.dll -r:System.Core.dll -r:TestDriver.dll -r:Mono.Posix.dll -out:$@ $<
+if !INSTALL_MOBILE_STATIC
+TEST_DRIVER_HARD_KILL_FEATURE=-r:Mono.Posix.dll
+endif
+
+if INSTALL_MOBILE_STATIC
+TEST_DRIVER_DEPEND=TestDriver.dll$(PLATFORM_AOT_SUFFIX)
+else
+TEST_DRIVER_DEPEND=TestDriver.dll
+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:$@ $<
+
+%.exe$(PLATFORM_AOT_SUFFIX): %.exe 
+       $(RUNTIME) $(AOT_BUILD_FLAGS) $<
+
+%.dll$(PLATFORM_AOT_SUFFIX): %.dll 
+       $(RUNTIME) $(AOT_BUILD_FLAGS) $<
 
 # mkbundle works on ppc, but the pkg-config POC doesn't when run with make test
 if POWERPC
@@ -748,8 +857,22 @@ test_platform: test-eglib-remap
 endif
 endif
 
+AOT_EXTRA_LIBS =       \
+bug-382986-lib.dll$(PLATFORM_AOT_SUFFIX)       \
+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)
+
+if INSTALL_MOBILE_STATIC
+prereqs: $(PREREQSI_IL_AOT) $(PREREQSI_CS_AOT) $(AOT_EXTRA_LIBS)
+else
+prereqs: $(PREREQSI_IL) $(PREREQSI_CS)
+endif
+
 # Target to precompile the test executables
-tests: $(TESTSI_CS) $(TESTSI_IL) $(TESTBS) libtest.la $(PREREQSI_IL) $(PREREQSI_CS) $(GSHARED_TESTS)
+tests: $(TESTSI_CS) $(TESTSI_IL) $(TESTBS) libtest.la prereqs $(GSHARED_TESTS)
 
 #
 # Test that no symbols are missed in eglib-remap.h
@@ -787,17 +910,20 @@ test-sgen : sgen-tests
 # Precompile the test assemblies in parallel
 compile-tests:
        $(MAKE) -j4 $(TESTSI_CS) $(TESTSI_IL) $(TESTBS) libtest.la $(PREREQSI_IL) $(PREREQSI_CS)
+if INSTALL_MOBILE_STATIC
+       $(MAKE) $(PREREQSI_IL_AOT) $(PREREQSI_CS_AOT) $(AOT_EXTRA_LIBS)
+endif
 
 # Remove empty .stdout and .stderr files for wrench
 rm-empty-logs:
        @echo "Removing empty logs..."
-       @find . '(' -name "*.stdout" -o -name "*.stderr" ')' -empty -exec rm {} \;
+       find . '(' -name "*.stdout" -o -name "*.stderr" ')' -size 0 -exec rm {} \;
 
 assemblyresolve/test/asm.dll:
        $(MAKE) -C assemblyresolve prereq
 
 TestDriver.dll:
-       $(MCS) -target:library -out:$@ $(srcdir)/../mini/TestDriver.cs
+       $(MCS) -target:library -out:$@ $(srcdir)/../mini/TestDriver.cs $(srcdir)/../mini/TestHelpers.cs
 
 test_cs: $(TEST_PROG) $(TESTSI_CS) libtest.la
        @failed=0; \
@@ -874,11 +1000,11 @@ runtest: $(TESTSI_CS) $(TESTSI_IL) $(TESTBS) libtest.la $(PREREQSI_IL) $(PREREQS
 
 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; \
-       $(RUNTIME) --debug ./test-runner.exe $(TEST_RUNNER_ARGS) -j a --testsuite-name "runtime" --timeout 300 --disabled "$${disabled_tests}" $(TESTSI_CS) $(TESTBS) $(TESTSI_IL)
+       $(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; \
-       $(RUNTIME) --debug ./test-runner.exe $(TEST_RUNNER_ARGS) -j 1 --testsuite-name "runtime" --disabled "$${disabled_tests}" $(TESTSI_CS) $(TESTBS) $(TESTSI_IL)
+       $(RUNTIME) --debug $(TEST_RUNNER) $(TEST_RUNNER_ARGS) -j 1 --testsuite-name "runtime" --disabled "$${disabled_tests}" $(TESTSI_CS) $(TESTBS) $(TESTSI_IL)
 
 testjit:
        @if test x$(M) != x0; then $(MAKE) runtest-managed; else $(MAKE) runtest; fi
@@ -928,7 +1054,7 @@ testbundle: console.exe
        @- rm -rf a.out
 
 EXTRA_DIST += load-missing.il t-missing.cs load-exceptions.cs
-test-type-load: TestDriver.dll
+test-type-load: $(TEST_DRIVER_DEPEND)
        @$(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
@@ -937,7 +1063,7 @@ test-type-load: TestDriver.dll
        @$(RUNTIME) load-exceptions.exe > load-exceptions.exe.stdout 2> load-exceptions.exe.stderr
 
 EXTRA_DIST += custom-attr-errors.cs custom-attr-errors-lib.cs
-test-cattr-type-load: TestDriver.dll 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
        $(MCS) -D:WITH_MEMBERS /t:library $(srcdir)/custom-attr-errors-lib.cs
        $(MCS) -r:TestDriver.dll -r:custom-attr-errors-lib.dll  $(srcdir)/custom-attr-errors.cs
        $(MCS) /t:library $(srcdir)/custom-attr-errors-lib.cs
@@ -971,13 +1097,15 @@ if !S390X
        $(MAKE) sgen-bridge2-tests
 endif
 
-SGEN_REGULAR_TESTS =   \
+SGEN_REGULAR_TESTS_MOBILE_STATIC_NOT_SUPPORTED =       \
+       sgen-domain-unload.exe  \
+       sgen-domain-unload-2.exe
+
+SGEN_REGULAR_TESTS_UNIVERSAL = \
        finalizer-wait.exe      \
        critical-finalizers.exe \
        sgen-descriptors.exe    \
        sgen-gshared-vtype.exe  \
-       sgen-domain-unload.exe  \
-       sgen-domain-unload-2.exe        \
        sgen-weakref-stress.exe \
        sgen-cementing-stress.exe       \
        sgen-case-23400.exe     \
@@ -986,6 +1114,15 @@ SGEN_REGULAR_TESTS =      \
        gc-graystack-stress.exe \
        bug-17590.exe
 
+if INSTALL_MOBILE_STATIC
+SGEN_REGULAR_TESTS= \
+       $(SGEN_REGULAR_TESTS_UNIVERSAL)
+else
+SGEN_REGULAR_TESTS= \
+       $(SGEN_REGULAR_TESTS_MOBILE_STATIC_NOT_SUPPORTED) \
+       $(SGEN_REGULAR_TESTS_UNIVERSAL)
+endif
+
 sgen-regular-tests: $(SGEN_REGULAR_TESTS)
        $(MAKE) sgen-regular-tests-plain
        $(MAKE) sgen-regular-tests-ms-conc
@@ -997,21 +1134,21 @@ sgen-regular-tests: $(SGEN_REGULAR_TESTS)
        $(MAKE) sgen-regular-tests-ms-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.exe $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_REGULAR_TESTS)
+       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-conc: $(SGEN_REGULAR_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="major=marksweep-conc" $(RUNTIME) ./test-runner.exe $(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 $@ --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.exe $(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 $@ --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.exe $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_REGULAR_TESTS)
+       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.exe $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_REGULAR_TESTS)
+       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.exe $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_REGULAR_TESTS)
+       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)
 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.exe $(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 $@ --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.exe $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_REGULAR_TESTS)
+       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)
 
 SGEN_TOGGLEREF_TESTS=  \
        sgen-toggleref.exe
@@ -1027,21 +1164,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.exe $(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 $@ --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.exe $(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 $@ --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.exe $(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 $@ --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.exe $(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 $@ --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.exe $(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 $@ --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.exe $(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 $@ --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.exe $(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 $@ --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.exe $(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 $@ --timeout 900 $(SGEN_TOGGLEREF_TESTS)
 
 SGEN_BRIDGE_TESTS=     \
        sgen-bridge.exe \
@@ -1058,21 +1195,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.exe $(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 $@ --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.exe $(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 $@ --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.exe $(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 $@ --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.exe $(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 $@ --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.exe $(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 $@ --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.exe $(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 $@ --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.exe $(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 $@ --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.exe $(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 $@ --timeout 900 $(SGEN_BRIDGE_TESTS)
 
 SGEN_BRIDGE2_TESTS=    \
        sgen-bridge-xref.exe
@@ -1088,22 +1225,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.exe $(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 $@ --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.exe $(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 $@ --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.exe $(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 $@ --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.exe $(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 $@ --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.exe $(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 $@ --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.exe $(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 $@ --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.exe $(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 $@ --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.exe $(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 $@ --timeout 900 $(SGEN_BRIDGE2_TESTS)
 
 SGEN_BRIDGE3_TESTS=    \
        sgen-bridge-gchandle.exe
@@ -1119,21 +1255,21 @@ sgen-bridge3-tests: $(SGEN_BRIDGE3_TESTS)
        $(MAKE) sgen-bridge3-tests-ms-split-tarjan-bridge
 
 sgen-bridge3-tests-plain: $(SGEN_bridge3_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=3Bridge" MONO_GC_PARAMS="" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE3_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=3Bridge" MONO_GC_PARAMS="" $(RUNTIME) $(TEST_RUNNER) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE3_TESTS)
 sgen-bridge3-tests-ms-conc: $(SGEN_BRIDGE3_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=3Bridge" MONO_GC_PARAMS="major=marksweep-conc" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE3_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=3Bridge" MONO_GC_PARAMS="major=marksweep-conc" $(RUNTIME) $(TEST_RUNNER) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE3_TESTS)
 sgen-bridge3-tests-ms-split: $(SGEN_BRIDGE3_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=3Bridge" MONO_GC_PARAMS="minor=split" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE3_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=3Bridge" MONO_GC_PARAMS="minor=split" $(RUNTIME) $(TEST_RUNNER) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE3_TESTS)
 sgen-bridge3-tests-plain-new-bridge: $(SGEN_BRIDGE3_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=3Bridge" MONO_GC_PARAMS="bridge-implementation=new" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE3_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=3Bridge" MONO_GC_PARAMS="bridge-implementation=new" $(RUNTIME) $(TEST_RUNNER) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE3_TESTS)
 sgen-bridge3-tests-ms-conc-new-bridge: $(SGEN_BRIDGE3_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=3Bridge" MONO_GC_PARAMS="bridge-implementation=new,major=marksweep-conc" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE3_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=3Bridge" MONO_GC_PARAMS="bridge-implementation=new,major=marksweep-conc" $(RUNTIME) $(TEST_RUNNER) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE3_TESTS)
 sgen-bridge3-tests-ms-split-new-bridge: $(SGEN_BRIDGE3_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=3Bridge" MONO_GC_PARAMS="bridge-implementation=new,minor=split" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE3_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=3Bridge" MONO_GC_PARAMS="bridge-implementation=new,minor=split" $(RUNTIME) $(TEST_RUNNER) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE3_TESTS)
 sgen-bridge3-tests-plain-tarjan-bridge: $(SGEN_BRIDGE3_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=3Bridge" MONO_GC_PARAMS="bridge-implementation=tarjan" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE3_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=3Bridge" MONO_GC_PARAMS="bridge-implementation=tarjan" $(RUNTIME) $(TEST_RUNNER) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE3_TESTS)
 sgen-bridge3-tests-ms-split-tarjan-bridge: $(SGEN_BRIDGE3_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=3Bridge" MONO_GC_PARAMS="bridge-implementation=tarjan,minor=split" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE3_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=3Bridge" MONO_GC_PARAMS="bridge-implementation=tarjan,minor=split" $(RUNTIME) $(TEST_RUNNER) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE3_TESTS)
 
 
 AOT_CONFIGURATIONS=    \
@@ -1177,19 +1313,23 @@ test-aot:
 
 # Generated tests for runtime invoke
 EXTRA_DIST += gen-runtime-invoke.cs
-runtime-invoke.gen.exe: TestDriver.dll gen-runtime-invoke.exe
+runtime-invoke.gen.exe: $(TEST_DRIVER_DEPEND) gen-runtime-invoke.exe
        $(RUNTIME) gen-runtime-invoke.exe > runtime-invoke.gen.cs
        $(MCS) -out:runtime-invoke.gen.exe -r:TestDriver.dll runtime-invoke.gen.cs
 
 EXTRA_DIST += make-imt-test.cs
-imt_big_iface_test.exe: TestDriver.dll make-imt-test.exe
+imt_big_iface_test.exe: $(TEST_DRIVER_DEPEND) make-imt-test.exe
        $(RUNTIME) make-imt-test.exe > imt_big_iface_test.cs
        $(MCS) -out:imt_big_iface_test.exe -r:TestDriver.dll imt_big_iface_test.cs
 
 EXTRA_DIST += test-inline-call-stack-library.cs test-inline-call-stack.cs
-test-inline-call-stack-library.dll: TestDriver.dll $(srcdir)/test-inline-call-stack-library.cs
+test-inline-call-stack-library.dll: $(TEST_DRIVER_DEPEND) $(srcdir)/test-inline-call-stack-library.cs
        $(MCS) -t:library -out:test-inline-call-stack-library.dll $(srcdir)/test-inline-call-stack-library.cs
-test-inline-call-stack.exe: TestDriver.dll test-inline-call-stack-library.dll $(srcdir)/test-inline-call-stack.cs
+if INSTALL_MOBILE_STATIC
+       $(RUNTIME) $(AOT_BUILD_FLAGS) $@
+endif
+
+test-inline-call-stack.exe: $(TEST_DRIVER_DEPEND) test-inline-call-stack-library.dll $(srcdir)/test-inline-call-stack.cs
        $(MCS) -r:TestDriver.dll -r:test-inline-call-stack-library.dll -out:test-inline-call-stack.exe $(srcdir)/test-inline-call-stack.cs
 
 EXTRA_DIST += unhandled-exception-base-configuration.config
@@ -1232,12 +1372,18 @@ bug-81673.exe bug-81673-interface.dll: $(srcdir)/bug-81673.cs $(srcdir)/bug-8167
        $(MCS) -target:library -out:bug-81673-interface.dll $(srcdir)/bug-81673-interface.cs
        $(MCS) -out:bug-81673.exe -r:bug-81673-interface.dll $(srcdir)/bug-81673.cs
        $(MCS) -define:WITH_STOP -target:library -out:bug-81673-interface.dll $(srcdir)/bug-81673-interface.cs
+if INSTALL_MOBILE_STATIC
+       $(RUNTIME) $(AOT_BUILD_FLAGS) $@
+endif
 
 EXTRA_DIST += bug-36848-a.cs
 bug-36848.exe bug-36848-a.dll: $(srcdir)/bug-36848.cs $(srcdir)/bug-36848-a.cs
        $(MCS) -target:library -out:bug-36848-a.dll $(srcdir)/bug-36848-a.cs
        $(MCS) -r:bug-36848-a.dll -out:bug-36848.exe $(srcdir)/bug-36848.cs
        $(MCS) -target:library -out:bug-36848-a.dll $(srcdir)/bug-36848-a.cs /define:WITH_STOP
+if INSTALL_MOBILE_STATIC
+       $(RUNTIME) $(AOT_BUILD_FLAGS) $@
+endif
 
 EXTRA_DIST += bug-81691-a.cs bug-81691-b.cs
 bug-81691.exe bug-81691-b.dll: $(srcdir)/bug-81691.cs $(srcdir)/bug-81691-a.cs $(srcdir)/bug-81691-b.cs
@@ -1250,24 +1396,37 @@ bug-81691.exe: bug-81691-b.dll
 EXTRA_DIST += bug-81466-lib.il
 bug-81466-lib.dll: bug-81466-lib.il
        $(ILASM) /dll /output:bug-81466-lib.dll $(srcdir)/bug-81466-lib.il
+if INSTALL_MOBILE_STATIC
+       $(RUNTIME) $(AOT_BUILD_FLAGS) $@
+endif
 bug-81466.exe: bug-81466.il bug-81466-lib.dll
        $(ILASM) /exe /output:bug-81466.exe $(srcdir)/bug-81466.il
 
 EXTRA_DIST += bug-324535-il.il
 bug-324535-il.dll : bug-324535-il.il
        $(ILASM) /dll /output:bug-324535-il.dll $(srcdir)/bug-324535-il.il
+if INSTALL_MOBILE_STATIC
+       $(RUNTIME) $(AOT_BUILD_FLAGS) $@
+endif
 bug-324535.exe : bug-324535.cs bug-324535-il.dll
        $(MCS) -r:bug-324535-il.dll -out:bug-324535.exe $(srcdir)/bug-324535.cs
 
 EXTRA_DIST += custom-modifiers.2.cs custom-modifiers-lib.il
 custom-modifiers-lib.dll: custom-modifiers-lib.il
        $(ILASM) /dll /output:custom-modifiers-lib.dll $(srcdir)/custom-modifiers-lib.il
+if INSTALL_MOBILE_STATIC
+       $(RUNTIME) $(AOT_BUILD_FLAGS) $@
+endif
 custom-modifiers.2.exe: custom-modifiers.2.cs custom-modifiers-lib.dll
        $(MCS) -r:custom-modifiers-lib.dll -out:custom-modifiers.2.exe $(srcdir)/custom-modifiers.2.cs
 
 EXTRA_DIST += bug-382986-lib.cs
 bug-382986-lib.dll: bug-382986-lib.cs
        $(MCS) -target:library -out:$@ $(srcdir)/bug-382986-lib.cs
+if INSTALL_MOBILE_STATIC
+       $(RUNTIME) $(AOT_BUILD_FLAGS) $@
+endif
+
 bug-382986.exe: bug-382986.cs bug-382986-lib.dll
        $(MCS) -out:$@ -r:bug-382986-lib.dll $(srcdir)/bug-382986.cs
 
@@ -1291,10 +1450,16 @@ test-coreclr-security : coreclr-security.exe
 EXTRA_DIST += generic-unboxing.2.il
 generic-unboxing.2.dll : generic-unboxing.2.il
        $(ILASM) /dll /output:generic-unboxing.2.dll $(srcdir)/generic-unboxing.2.il
+if INSTALL_MOBILE_STATIC
+       $(RUNTIME) $(AOT_BUILD_FLAGS) $@
+endif
 
 EXTRA_DIST += generic-boxing.2.il
 generic-boxing.2.dll : generic-boxing.2.il generic-unboxing.2.dll
        $(ILASM) /dll /output:generic-boxing.2.dll $(srcdir)/generic-boxing.2.il
+if INSTALL_MOBILE_STATIC
+       $(RUNTIME) $(AOT_BUILD_FLAGS) $@
+endif
 
 EXTRA_DIST += generic-unbox.2.cs
 generic-unbox.2.exe : generic-unbox.2.cs generic-unboxing.2.dll
@@ -1307,6 +1472,9 @@ generic-box.2.exe : generic-box.2.cs generic-unboxing.2.dll generic-boxing.2.dll
 EXTRA_DIST += generic-delegate2.2.cs generic-delegate2-lib.2.il
 generic-delegate2-lib.2.dll : generic-delegate2-lib.2.il
        $(ILASM) /dll /output:$@ $(srcdir)/generic-delegate2-lib.2.il
+if INSTALL_MOBILE_STATIC
+       $(RUNTIME) $(AOT_BUILD_FLAGS) $@
+endif
 generic-delegate2.2.exe : generic-delegate2.2.cs generic-delegate2-lib.2.dll
        $(MCS) -r:generic-delegate2-lib.2.dll -out:$@ $(srcdir)/generic-delegate2.2.cs
 
@@ -1318,7 +1486,10 @@ gshared: test-generic-sharing
 gshared-aot:
        @$(MAKE) AOT=1 gshared
 
-GSHARED_TESTS = \
+GSHARED_TESTS_MOBILE_STATIC_NOT_SUPPORTED = \
+               generic-type-builder.2.exe
+
+GSHARED_TESTS_UNIVERSAL = \
                generics-sharing.2.exe shared-generic-methods.2.exe     \
                shared-generic-synchronized.2.exe generic-initobj.2.exe         \
                generics-sharing-other-exc.2.exe generic-box.2.exe              \
@@ -1334,7 +1505,7 @@ GSHARED_TESTS = \
                generic-exceptions.2.exe generic-delegate2.2.exe                \
                generic-virtual2.2.exe generic-valuetype-interface.2.exe        \
                generic-valuetype-newobj.2.exe generic-valuetype-newobj2.2.exe  \
-               generic-getgenericarguments.2.exe generic-type-builder.2.exe    \
+               generic-getgenericarguments.2.exe       \
                generic-synchronized.2.exe generic-delegate-ctor.2.exe          \
                generic-constrained.2.exe bug-431413.2.exe                      \
                generic-virtual-invoke.2.exe generic-typedef.2.exe              \
@@ -1346,6 +1517,15 @@ GSHARED_TESTS = \
                generic-type-load-exception.2.exe bug-616463.exe        \
                bug-1147.exe
 
+if INSTALL_MOBILE_STATIC
+GSHARED_TESTS= \
+       $(GSHARED_TESTS_UNIVERSAL)
+else
+GSHARED_TESTS= \
+       $(GSHARED_TESTS_MOBILE_STATIC_NOT_SUPPORTED) \
+       $(GSHARED_TESTS_UNIVERSAL)
+endif
+
 test-generic-sharing-normal: $(GSHARED_TESTS)
        @for fn in $+ ; do      \
                echo "Testing $$fn ...";        \
@@ -1357,7 +1537,7 @@ test-generic-sharing-normal: $(GSHARED_TESTS)
        done
 
 test-generic-sharing-managed: test-runner.exe $(GSHARED_TESTS)
-       @$(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) -j a --testsuite-name "gshared" --opt-sets "gshared gshared,shared gshared,-inline gshared,-inline,shared" $(GSHARED_TESTS)
+       @$(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) -j a --testsuite-name "gshared" --disabled "$(DISABLED_TESTS)" --opt-sets "gshared gshared,shared gshared,-inline gshared,-inline,shared" $(GSHARED_TESTS)
 
 if NACL_CODEGEN
 test-generic-sharing:
@@ -1376,7 +1556,7 @@ test-async-exceptions : async-exceptions.exe
 EXTRA_DIST += modules.cs modules-m1.cs
 modules-m1.netmodule: modules-m1.cs
        $(MCS) -out:$@ /target:module $(srcdir)/modules-m1.cs
-modules.exe: modules.cs modules-m1.netmodule TestDriver.dll
+modules.exe: modules.cs modules-m1.netmodule $(TEST_DRIVER_DEPEND) 
        $(MCS) -out:$@ /addmodule:modules-m1.netmodule -r:TestDriver.dll $(srcdir)/modules.cs
 
 # Useful if mono is compiled with --enable-shared=no
@@ -1434,13 +1614,13 @@ test-unhandled-exception-2: $(UNHANDLED_EXCEPTION_1_TESTS) $(UNHANDLED_EXCEPTION
        $(MAKE) test-unhandled-exception-2-255-without-managed-handler
 
 test-unhandled-exception-2-1-with-managed-handler: $(UNHANDLED_EXCEPTION_1_TESTS) test-runner.exe
-       $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) -j a --testsuite-name $@ --expected-exit-code 1 $(UNHANDLED_EXCEPTION_1_TESTS)
+       $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) -j a --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --expected-exit-code 1 $(UNHANDLED_EXCEPTION_1_TESTS)
 test-unhandled-exception-2-1-without-managed-handler: $(UNHANDLED_EXCEPTION_1_TESTS) test-runner.exe
-       TEST_UNHANDLED_EXCEPTION_HANDLER=1 $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) -j a --testsuite-name $@ --expected-exit-code 1 $(UNHANDLED_EXCEPTION_1_TESTS)
+       TEST_UNHANDLED_EXCEPTION_HANDLER=1 $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) -j a --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --expected-exit-code 1 $(UNHANDLED_EXCEPTION_1_TESTS)
 test-unhandled-exception-2-255-with-managed-handler: $(UNHANDLED_EXCEPTION_255_TESTS) test-runner.exe
-       $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) -j a --testsuite-name $@ --expected-exit-code 255 $(UNHANDLED_EXCEPTION_255_TESTS)
+       $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) -j a --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --expected-exit-code 255 $(UNHANDLED_EXCEPTION_255_TESTS)
 test-unhandled-exception-2-255-without-managed-handler: $(UNHANDLED_EXCEPTION_255_TESTS) test-runner.exe
-       TEST_UNHANDLED_EXCEPTION_HANDLER=1 $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) -j a --testsuite-name $@ --expected-exit-code 255 $(UNHANDLED_EXCEPTION_255_TESTS)
+       TEST_UNHANDLED_EXCEPTION_HANDLER=1 $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) -j a --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --expected-exit-code 255 $(UNHANDLED_EXCEPTION_255_TESTS)
 
 endif
 
@@ -1465,7 +1645,7 @@ PROCESS_STRESS_TESTS=     \
                process-leak.exe
 
 test-process-stress: $(PROCESS_STRESS_TESTS) test-runner.exe
-       $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 600 $(PROCESS_STRESS_TESTS)
+       $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 600 $(PROCESS_STRESS_TESTS)
 
 coreclr-gcstress:
        $(MAKE) -C $(mono_build_root)/acceptance-tests coreclr-gcstress
index dac89cabea949deb3b7423d5cacd7d0537d774e4..b198b753750d45cbbae3d34791451642e171bc2d 100644 (file)
@@ -2,10 +2,14 @@ CLASS=$(mcs_topdir)/class/lib/$(DEFAULT_PROFILE)
 
 with_mono_path = MONO_PATH=$(CLASS)
 
-RUNTIME = $(with_mono_path) $(top_builddir)/runtime/mono-wrapper --debug
-MCS = $(RUNTIME) $(mcs_topdir)/class/lib/build/mcs.exe -debug:full -target:library
+RUNTIME = $(top_builddir)/runtime/mono-wrapper --debug
+MCS = $(with_mono_path) $(RUNTIME) $(mcs_topdir)/class/lib/build/mcs.exe -debug:full -target:library
 
+if INSTALL_MOBILE_STATIC
+prereq: aot
+else
 prereq: test/asm.dll
+endif
 
 test/.dirstamp deps/.dirstamp:
        -mkdir $(@D)
@@ -27,3 +31,10 @@ EXTRA_DIST = asm.cs Test.cs TestBase.cs
 
 clean:
        rm -f deps/*.dll test/*.dll
+
+.PHONY: aot
+aot: test/asm.dll
+       MONO_PATH="deps:$(CLASS)" $(RUNTIME) $(AOT_BUILD_FLAGS) deps/test.dll
+       MONO_PATH="deps:$(CLASS)" $(RUNTIME) $(AOT_BUILD_FLAGS) deps/TestBase.dll
+       MONO_PATH="deps:$(CLASS)" $(RUNTIME) $(AOT_BUILD_FLAGS) test/asm.dll
+
index 80c985b0a1121e6b89f92d01c68a721b78251826..9fc03ba6ff7e1321b30f782bda7ca2cf02a6fb10 100644 (file)
@@ -18,7 +18,7 @@ class Program
        static void ProbeCorlib ()
        {
                Type good = System.Type.GetType("System.Nullable`1[[System.Int32, mscorlib]]"); 
-               Type bad = System.Type.GetType("System.Nullable`1[[System.IO.Pipes.PipeOptions, System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]");
+               Type bad = System.Type.GetType("System.Nullable`1[[System.IO.MemoryMappedFiles.MemoryMappedFile, System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]");
 
                if (good.Assembly.FullName.Split (',') [0] != "mscorlib")
                        throw new Exception ("Wrong assembly name");
index eb2d89d63b4206474ce007028465218fedfbac73..39290ab1eae4b85a7e0c83f4a8d4f54d2804a5c8 100644 (file)
@@ -1,12 +1,18 @@
 using System;
 using System.Runtime.InteropServices;
 
+[AttributeUsage (AttributeTargets.Method)]
+sealed class MonoPInvokeCallbackAttribute : Attribute {
+       public MonoPInvokeCallbackAttribute (Type t) {}
+}
+
 namespace TestApp
 {
        public delegate char MyDelegate(int x);
 
     class Driver
     {
+               [MonoPInvokeCallbackAttribute (typeof (MyDelegate))]
                static char Test (int x) { return (char)x; }
 
                static int Main()
index 8f1e492c0e97bf83d09db8c33f9a95c5ae83bf8e..7f3de465449669d4485a34230f94ff97877a6a43 100644 (file)
@@ -1,4 +1,5 @@
 using System;
+using System.Linq;
 
 class C
 {
@@ -17,6 +18,10 @@ class C
        {
                        string fullTrace = ex.StackTrace;
                        string[] frames = fullTrace.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);
+
+                       // Ignore metadata
+                       frames = frames.Where (l => !l.StartsWith ("[")).ToArray ();
+
                        return frames.Length;
        }
 
index 7d711d9a259a7dca28f474dd175f0dac85e2f5c3..79743cd249664beb3986a257c37cdf06d5445ba8 100644 (file)
@@ -33,7 +33,11 @@ class Program {
                if (args.Length > 0)
                        width = Math.Max (width, Int32.Parse (args [0]));
 
-               int depth = 10000;
+               // Windows x64 only has 1 MB of stack per thread which is less than other x86 64-bit OSes.
+               // Using 10000 for depth will cause a stack overflow on Windows x64. 5000 will fit.
+               int platform = (int) Environment.OSVersion.Platform;
+               bool isWin64 = !(platform == 4 || platform == 128) && Environment.Is64BitProcess;
+               int depth = isWin64 ? 5000 : 10000;
                if (args.Length > 1)
                        depth = Math.Max (depth, Int32.Parse (args [1]));
 
index 1f2930da9655300e0a32a48da28c4f7ec9d69bd1..8f1cef273f40075165310ad858c344b9fb71324f 100644 (file)
@@ -889,12 +889,12 @@ mono_test_marshal_return_delegate (SimpleDelegate delegate)
        return delegate;
 }
 
-typedef int DelegateByrefDelegate (void *);
+typedef int (STDCALL *DelegateByrefDelegate) (void *);
 
 LIBTEST_API int STDCALL
 mono_test_marshal_delegate_ref_delegate (DelegateByrefDelegate del)
 {
-       int (*ptr) (int i);
+       int (STDCALL *ptr) (int i);
 
        del (&ptr);
 
@@ -1243,7 +1243,7 @@ mono_test_marshal_stringbuilder_ref (char **s)
 * C/C++ standard and the runtime.
 */
 typedef struct {
-#if !defined(__GNUC__) || (defined(TARGET_WIN32) && defined(TARGET_AMD64))
+#if !defined(__GNUC__) || defined(TARGET_WIN32)
     char a;
 #endif
 } EmptyStruct;
index aadf7adf7438f77b1ae5730d66532a7695dffc2f..1213f8c5cbf6ec4746c6d26c5157f403ef680bb1 100644 (file)
@@ -8,12 +8,18 @@ using System.Runtime.InteropServices;
 
 public class Tests {
 
+       [AttributeUsage (AttributeTargets.Method)]
+       sealed class MonoPInvokeCallbackAttribute : Attribute {
+               public MonoPInvokeCallbackAttribute (Type t) {}
+       }
+
        public static int Main (string[] args) {
                return TestDriver.RunTests (typeof (Tests), args);
        }
 
        public delegate int SimpleDelegate (int a);
 
+       [MonoPInvokeCallback (typeof (SimpleDelegate))]
        public static int delegate_test (int a)
        {
                return a + 1;
index 7a22bbf40454bbc4a329358604d2f354b0307dd4..f19059435939a60dfc0eafec50e2c05d152b8594 100644 (file)
@@ -5,6 +5,11 @@
 using System;
 using System.Runtime.InteropServices;
 
+[AttributeUsage (AttributeTargets.Method)]
+sealed class MonoPInvokeCallbackAttribute : Attribute {
+       public MonoPInvokeCallbackAttribute (Type t) {}
+}
+
 public class Marshal1 : ICustomMarshaler
 {
        int param;
@@ -232,10 +237,12 @@ public class Tests
        [DllImport ("libtest")]
        private static extern int mono_test_marshal_pass_return_custom_null_in_delegate (pass_return_int_delegate del);
 
+       [MonoPInvokeCallback (typeof (pass_return_int_delegate))]
        private static object pass_return_int (object i) {
                return (int)i;
        }
 
+       [MonoPInvokeCallback (typeof (pass_return_int_delegate))]
        private static object pass_return_null (object i) {
                return (i == null) ? null : new Object ();
        }
@@ -431,7 +438,8 @@ public class Tests
 
                return 0;
        }
-       
+
+       [MonoPInvokeCallback (typeof (custom_out_param_delegate))]
        private static void custom_out_param (out object i) 
        {
                i = new object();       
index 263dd16a134b06399f58dfa11ffe23c8b5e6d714..67cf19636328e473993d78d75f13ea12f257f72a 100644 (file)
@@ -3,6 +3,11 @@ using System.Runtime.InteropServices;
 
 public class marshalbool
 {
+       [AttributeUsage (AttributeTargets.Method)]
+       sealed class MonoPInvokeCallbackAttribute : Attribute {
+               public MonoPInvokeCallbackAttribute (Type t) {}
+       }
+
        [DllImport ("libtest")]
        static extern int mono_test_marshal_bool_in (int arg, uint expected,
                                                     bool bDefaultMarsh,
@@ -596,7 +601,7 @@ public class marshalbool
 
        public static int test_0_Default_In_Managed ()
        {
-               MarshalBoolInDelegate fcn = new MarshalBoolInDelegate (new marshalbool ().MarshalBoolInHelper);
+               MarshalBoolInDelegate fcn = new MarshalBoolInDelegate (MarshalBoolInHelper);
                int ret;
 
                ret = mono_test_managed_marshal_bool_in (1, 0, 0, fcn);
@@ -613,7 +618,7 @@ public class marshalbool
 
        public static int test_0_Bool_In_Managed ()
        {
-               MarshalBoolInDelegate fcn = new MarshalBoolInDelegate (new marshalbool ().MarshalBoolInHelper);
+               MarshalBoolInDelegate fcn = new MarshalBoolInDelegate (MarshalBoolInHelper);
                int ret;
 
                ret = mono_test_managed_marshal_bool_in (2, 0, 0, fcn);
@@ -630,7 +635,7 @@ public class marshalbool
 
        public static int test_0_I1_In_Managed ()
        {
-               MarshalBoolInDelegate fcn = new MarshalBoolInDelegate (new marshalbool ().MarshalBoolInHelper);
+               MarshalBoolInDelegate fcn = new MarshalBoolInDelegate (MarshalBoolInHelper);
                int ret;
 
                ret = mono_test_managed_marshal_bool_in (3, 0, 0, fcn);
@@ -647,7 +652,7 @@ public class marshalbool
 
        public static int test_0_U1_In_Managed ()
        {
-               MarshalBoolInDelegate fcn = new MarshalBoolInDelegate (new marshalbool ().MarshalBoolInHelper);
+               MarshalBoolInDelegate fcn = new MarshalBoolInDelegate (MarshalBoolInHelper);
                int ret;
 
                ret = mono_test_managed_marshal_bool_in (4, 0, 0, fcn);
@@ -664,7 +669,7 @@ public class marshalbool
 
        public static int test_0_VariantBool_In_Managed ()
        {
-               MarshalBoolInDelegate fcn = new MarshalBoolInDelegate (new marshalbool ().MarshalBoolInHelper);
+               MarshalBoolInDelegate fcn = new MarshalBoolInDelegate (MarshalBoolInHelper);
                int ret;
 
                ret = mono_test_managed_marshal_bool_in (5, 0, 0, fcn);
@@ -681,7 +686,7 @@ public class marshalbool
 
        public static int test_0_Default_Out_Managed ()
        {
-               MarshalBoolOutDelegate fcn = new MarshalBoolOutDelegate (new marshalbool ().MarshalBoolOutHelper);
+               MarshalBoolOutDelegate fcn = new MarshalBoolOutDelegate (MarshalBoolOutHelper);
                int ret;
 
                ret = mono_test_managed_marshal_bool_out (1, 0, 0, fcn);
@@ -698,7 +703,7 @@ public class marshalbool
 
        public static int test_0_Bool_Out_Managed ()
        {
-               MarshalBoolOutDelegate fcn = new MarshalBoolOutDelegate (new marshalbool ().MarshalBoolOutHelper);
+               MarshalBoolOutDelegate fcn = new MarshalBoolOutDelegate (MarshalBoolOutHelper);
                int ret;
                
                ret = mono_test_managed_marshal_bool_out (2, 0, 0, fcn);
@@ -715,7 +720,7 @@ public class marshalbool
 
        public static int test_0_I1_Out_Managed ()
        {
-               MarshalBoolOutDelegate fcn = new MarshalBoolOutDelegate (new marshalbool ().MarshalBoolOutHelper);
+               MarshalBoolOutDelegate fcn = new MarshalBoolOutDelegate (MarshalBoolOutHelper);
                int ret;
                
                ret = mono_test_managed_marshal_bool_out (3, 0, 0, fcn);
@@ -732,7 +737,7 @@ public class marshalbool
 
        public static int test_0_U1_Out_Managed ()
        {
-               MarshalBoolOutDelegate fcn = new MarshalBoolOutDelegate (new marshalbool ().MarshalBoolOutHelper);
+               MarshalBoolOutDelegate fcn = new MarshalBoolOutDelegate (MarshalBoolOutHelper);
                int ret;
                
                ret = mono_test_managed_marshal_bool_out (4, 0, 0, fcn);
@@ -749,7 +754,7 @@ public class marshalbool
 
        public static int test_0_VariantBool_Out_Managed ()
        {
-               MarshalBoolOutDelegate fcn = new MarshalBoolOutDelegate (new marshalbool ().MarshalBoolOutHelper);
+               MarshalBoolOutDelegate fcn = new MarshalBoolOutDelegate (MarshalBoolOutHelper);
                int ret;
                
                ret = mono_test_managed_marshal_bool_out (5, 0, 0, fcn);
@@ -766,7 +771,7 @@ public class marshalbool
 
        public static int test_0_Default_Ref_Managed ()
        {
-               MarshalBoolRefDelegate fcn = new MarshalBoolRefDelegate (new marshalbool ().MarshalBoolRefHelper);
+               MarshalBoolRefDelegate fcn = new MarshalBoolRefDelegate (MarshalBoolRefHelper);
                int ret;
 
                ret = mono_test_managed_marshal_bool_ref (1, 0, 0, 0, 0, fcn);
@@ -795,7 +800,7 @@ public class marshalbool
 
        public static int test_0_Bool_Ref_Managed ()
        {
-               MarshalBoolRefDelegate fcn = new MarshalBoolRefDelegate (new marshalbool ().MarshalBoolRefHelper);
+               MarshalBoolRefDelegate fcn = new MarshalBoolRefDelegate (MarshalBoolRefHelper);
                int ret;
 
                ret = mono_test_managed_marshal_bool_ref (2, 0, 0, 0, 0, fcn);
@@ -824,7 +829,7 @@ public class marshalbool
 
        public static int test_0_I1_Ref_Managed ()
        {
-               MarshalBoolRefDelegate fcn = new MarshalBoolRefDelegate (new marshalbool ().MarshalBoolRefHelper);
+               MarshalBoolRefDelegate fcn = new MarshalBoolRefDelegate (MarshalBoolRefHelper);
                int ret;
 
                ret = mono_test_managed_marshal_bool_ref (3, 0, 0, 0, 0, fcn);
@@ -853,7 +858,7 @@ public class marshalbool
 
        public static int test_0_U1_Ref_Managed ()
        {
-               MarshalBoolRefDelegate fcn = new MarshalBoolRefDelegate (new marshalbool ().MarshalBoolRefHelper);
+               MarshalBoolRefDelegate fcn = new MarshalBoolRefDelegate (MarshalBoolRefHelper);
                int ret;
 
                ret = mono_test_managed_marshal_bool_ref (4, 0, 0, 0, 0, fcn);
@@ -882,7 +887,7 @@ public class marshalbool
 
        public static int test_0_VariantBool_Ref_Managed ()
        {
-               MarshalBoolRefDelegate fcn = new MarshalBoolRefDelegate (new marshalbool ().MarshalBoolRefHelper);
+               MarshalBoolRefDelegate fcn = new MarshalBoolRefDelegate (MarshalBoolRefHelper);
                int ret;
 
                ret = mono_test_managed_marshal_bool_ref (5, 0, 0, 0, 0, fcn);
@@ -911,8 +916,9 @@ public class marshalbool
 
 ///////////////////////////////////////////////////////////////////
 
-       unsafe int MarshalBoolInHelper (int arg, uint expected, bool bDefaultMarsh, bool bBoolCustMarsh, bool bI1CustMarsh,
-                                       bool bU1CustMarsh, bool bVBCustMarsh)
+       [MonoPInvokeCallback (typeof (MarshalBoolInDelegate))]
+       unsafe static int MarshalBoolInHelper (int arg, uint expected, bool bDefaultMarsh, bool bBoolCustMarsh, bool bI1CustMarsh,
+                                                                                  bool bU1CustMarsh, bool bVBCustMarsh)
        {
                bool* ptestVal;
                switch (arg) {
@@ -947,8 +953,9 @@ public class marshalbool
                return 0;
        }
 
-       unsafe int MarshalBoolOutHelper (int arg, uint testVal, out bool bDefaultMarsh, out bool bBoolCustMarsh,
-                                        out bool bI1CustMarsh, out bool bU1CustMarsh, out bool bVBCustMarsh)
+       [MonoPInvokeCallback (typeof (MarshalBoolOutDelegate))]
+       unsafe static int MarshalBoolOutHelper (int arg, uint testVal, out bool bDefaultMarsh, out bool bBoolCustMarsh,
+                                                                                       out bool bI1CustMarsh, out bool bU1CustMarsh, out bool bVBCustMarsh)
        {
                bDefaultMarsh = bBoolCustMarsh = bI1CustMarsh = bU1CustMarsh = bVBCustMarsh = false;
                switch (arg) {
@@ -988,8 +995,9 @@ public class marshalbool
                return 0;
        }
 
-       unsafe int MarshalBoolRefHelper (int arg, uint expected, uint testVal, ref bool bDefaultMarsh, ref bool bBoolCustMarsh,
-                                        ref bool bI1CustMarsh, ref bool bU1CustMarsh, ref bool bVBCustMarsh)
+       [MonoPInvokeCallback (typeof (MarshalBoolRefDelegate))]
+       unsafe static int MarshalBoolRefHelper (int arg, uint expected, uint testVal, ref bool bDefaultMarsh, ref bool bBoolCustMarsh,
+                                                                                       ref bool bI1CustMarsh, ref bool bU1CustMarsh, ref bool bVBCustMarsh)
        {
                switch (arg) {
                case 1:
index 5e0f474ec40ac451ce6034bf5af400896980c0ca..9b80f969d65eeebb526c3f90e46a2a32f90d6f95 100644 (file)
@@ -1433,6 +1433,13 @@ public class Tests {
                return mono_test_stdcall_name_mangling (0, 1, 2) == 3 ? 0 : 1;
        }
 
+       /* Test multiple calls to stdcall wrapper, xamarin bug 30146 */
+       public static int test_0_stdcall_many_calls () {
+               for (int i=0; i<256; i++)
+                       mono_test_stdcall_name_mangling (0, 0, 0);
+               return 0;
+       }
+
        /* Float test */
 
        [DllImport ("libtest", EntryPoint="mono_test_marshal_pass_return_float")]
index 143f4ece3e51bdbe7028275c719c75b002f22880..69a2ecf43341d8da6b5e9f3acfb59093e6157cb1 100644 (file)
@@ -27,7 +27,7 @@ namespace ToManyOpenHandles
 
                private static void RunStuffMode()
                {
-                       for (int i = 0; i < 1000; i++)
+                       for (int i = 0; i < 100; i++)
                        {
                                Execute(Assembly.GetExecutingAssembly().Location, i.ToString());
                        }
index 6cc184c7939d73b4cbd72e61ef0c3887223cd573..68fc0a5d0603301897fe4cbad95de05495156d25 100644 (file)
@@ -198,6 +198,7 @@ class Driver {
                t.Join ();
 
                for (int i = 0; i < 5; ++i) {
+                       Console.WriteLine("-GC {0}/5-", i);
                        GC.Collect ();
                        GC.WaitForPendingFinalizers ();
                }
index f4f2df11555816c07308e4935012b020ea486dd1..9e5738078fe4d4a2b8a6d8d8028fa2e969229660 100644 (file)
@@ -4,6 +4,7 @@ using System.Collections.Generic;
 using System.Threading;
 using System.Runtime.InteropServices;
 using System.Runtime.CompilerServices;
+using MonoTests.Helpers;
 
 public class Toggleref {
        public int __test;
@@ -60,9 +61,7 @@ class Driver {
        static int test_0_root_keeps_child ()
        {
                Console.WriteLine ("test_0_root_keeps_child");
-               var t = new Thread (SetupLinks);
-               t.Start ();
-               t.Join ();
+               FinalizerHelpers.PerformNoPinAction (SetupLinks);
                
                GC.Collect ();
                GC.WaitForPendingFinalizers ();
@@ -113,9 +112,7 @@ class Driver {
        {
                Console.WriteLine ("test_0_child_goes_away");
 
-               var t = new Thread (SetupLinks2);
-               t.Start ();
-               t.Join ();
+               FinalizerHelpers.PerformNoPinAction (SetupLinks2);
 
                GC.Collect ();
                GC.WaitForPendingFinalizers ();
@@ -161,9 +158,7 @@ class Driver {
        {
                Console.WriteLine ("test_0_CWT_keep_child_alive");
 
-               var t = new Thread (SetupLinks3);
-               t.Start ();
-               t.Join ();
+               FinalizerHelpers.PerformNoPinAction (SetupLinks3);
 
                GC.Collect ();
                GC.WaitForPendingFinalizers ();
@@ -207,4 +202,4 @@ class Driver {
                return TestDriver.RunTests (typeof (Driver), args);
        }
 
-}
\ No newline at end of file
+}
index 8a0d2a96a05a3a5671d84819c2ec813ecf23e1ea..53b4e9283575422f08b828cdd4a4cab271a91341 100644 (file)
 using System;
 using System.IO;
 using System.Threading;
-using System.Text;
 using System.Diagnostics;
 using System.Collections.Generic;
 using System.Globalization;
 using System.Xml;
+using System.Text;
 using System.Text.RegularExpressions;
+
+#if !MOBILE_STATIC
 using Mono.Unix.Native;
+#endif
 
 //
 // This is a simple test runner with support for parallel execution
@@ -27,6 +30,7 @@ public class TestRunner
 {
        const string TEST_TIME_FORMAT = "mm\\:ss\\.fff";
        const string ENV_TIMEOUT = "TEST_DRIVER_TIMEOUT_SEC";
+       const string MONO_PATH = "MONO_PATH";
 
        class ProcessData {
                public string test;
@@ -43,16 +47,19 @@ public class TestRunner
                int concurrency = 1;
                int timeout = 2 * 60; // in seconds
                int expectedExitCode = 0;
+               bool verbose = false;
                string testsuiteName = null;
                string inputFile = null;
 
-               // FIXME: Add support for runtime arguments + env variables
-
                string disabled_tests = null;
                string runtime = "mono";
                string config = null;
+               string mono_path = null;
                var opt_sets = new List<string> ();
 
+               string aot_run_flags = null;
+               string aot_build_flags = null;
+
                // Process options
                int i = 0;
                while (i < args.Length) {
@@ -124,6 +131,38 @@ public class TestRunner
                                        }
                                        inputFile = args [i + 1];
                                        i += 2;
+                               } else if (args [i] == "--runtime") {
+                                       if (i + 1 >= args.Length) {
+                                               Console.WriteLine ("Missing argument to --runtime command line option.");
+                                               return 1;
+                                       }
+                                       runtime = args [i + 1];
+                                       i += 2;
+                               } else if (args [i] == "--mono-path") {
+                                       if (i + 1 >= args.Length) {
+                                               Console.WriteLine ("Missing argument to --mono-path command line option.");
+                                               return 1;
+                                       }
+                                       mono_path = args [i + 1].Substring(0, args [i + 1].Length);
+
+                                       i += 2;
+                               } else if (args [i] == "--aot-run-flags") {
+                                       if (i + 1 >= args.Length) {
+                                               Console.WriteLine ("Missing argument to --aot-run-flags command line option.");
+                                               return 1;
+                                       }
+                                       aot_run_flags = args [i + 1].Substring(0, args [i + 1].Length);
+                                       i += 2;
+                               } else if (args [i] == "--aot-build-flags") {
+                                       if (i + 1 >= args.Length) {
+                                               Console.WriteLine ("Missing argument to --aot-build-flags command line option.");
+                                               return 1;
+                                       }
+                                       aot_build_flags = args [i + 1].Substring(0, args [i + 1].Length);
+                                       i += 2;
+                               } else if (args [i] == "--verbose") {
+                                       verbose = true;
+                                       i ++;
                                } else {
                                        Console.WriteLine ("Unknown command line option: '" + args [i] + "'.");
                                        return 1;
@@ -182,6 +221,65 @@ public class TestRunner
                                output_width = Math.Min (120, ti.test.Length);
                }
 
+               if (aot_build_flags != null)  {
+                       Console.WriteLine("AOT compiling tests");
+
+                       object aot_monitor = new object ();
+                       var aot_queue = new Queue<String> (tests); 
+
+                       List<Thread> build_threads = new List<Thread> (concurrency);
+
+                       for (int j = 0; j < concurrency; ++j) {
+                               Thread thread = new Thread (() => {
+                                       while (true) {
+                                               String test_name;
+
+                                               lock (aot_monitor) {
+                                                       if (aot_queue.Count == 0)
+                                                               break;
+                                                       test_name = aot_queue.Dequeue ();
+                                               }
+
+                                               string test_bitcode_output = test_name + "_bitcode_tmp";
+                                               string test_bitcode_arg = ",temp-path=" + test_bitcode_output;
+                                               string aot_args = aot_build_flags + test_bitcode_arg + " " + test_name;
+
+                                               Directory.CreateDirectory(test_bitcode_output);
+
+                                               ProcessStartInfo job = new ProcessStartInfo (runtime, aot_args);
+                                               job.UseShellExecute = false;
+                                               job.EnvironmentVariables[ENV_TIMEOUT] = timeout.ToString();
+                                               job.EnvironmentVariables[MONO_PATH] = mono_path;
+                                               Process compiler = new Process ();
+                                               compiler.StartInfo = job;
+
+                                               compiler.Start ();
+
+                                               if (!compiler.WaitForExit (timeout * 1000)) {
+                                                       try {
+                                                               compiler.Kill ();
+                                                       } catch {
+                                                       }
+                                                       throw new Exception(String.Format("Timeout AOT compiling tests, output in {0}", test_bitcode_output));
+                                               } else if (compiler.ExitCode != 0) {
+                                                       throw new Exception(String.Format("Error AOT compiling tests, output in {0}", test_bitcode_output));
+                                               } else {
+                                                       Directory.Delete (test_bitcode_output, true);
+                                               }
+                                       }
+                               });
+
+                               thread.Start ();
+
+                               build_threads.Add (thread);
+                       }
+
+                       for (int j = 0; j < build_threads.Count; ++j)
+                               build_threads [j].Join ();
+
+                       Console.WriteLine("Done compiling");
+               }
+
                List<Thread> threads = new List<Thread> (concurrency);
 
                DateTime test_start_time = DateTime.UtcNow;
@@ -202,14 +300,26 @@ public class TestRunner
                                        string test = ti.test;
                                        string opt_set = ti.opt_set;
 
-                                       output.Write (String.Format ("{{0,-{0}}} ", output_width), test);
+                                       if (verbose) {
+                                               output.Write (String.Format ("{{0,-{0}}} ", output_width), test);
+                                       } else {
+                                               Console.Write (".");
+                                       }
+
+                                       string test_invoke;
+
+                                       if (aot_run_flags != null)
+                                               test_invoke = aot_run_flags + " " + test;
+                                       else
+                                               test_invoke = test;
 
                                        /* Spawn a new process */
                                        string process_args;
                                        if (opt_set == null)
-                                               process_args = test;
+                                               process_args = test_invoke;
                                        else
-                                               process_args = "-O=" + opt_set + " " + test;
+                                               process_args = "-O=" + opt_set + " " + test_invoke;
+
                                        ProcessStartInfo info = new ProcessStartInfo (runtime, process_args);
                                        info.UseShellExecute = false;
                                        info.RedirectStandardOutput = true;
@@ -217,6 +327,8 @@ public class TestRunner
                                        info.EnvironmentVariables[ENV_TIMEOUT] = timeout.ToString();
                                        if (config != null)
                                                info.EnvironmentVariables["MONO_CONFIG"] = config;
+                                       if (mono_path != null)
+                                               info.EnvironmentVariables[MONO_PATH] = mono_path;
                                        Process p = new Process ();
                                        p.StartInfo = info;
 
@@ -257,14 +369,18 @@ public class TestRunner
                                                        timedout.Add (data);
                                                }
 
+#if !MOBILE_STATIC
                                                // Force the process to print a thread dump
                                                try {
                                                        Syscall.kill (p.Id, Signum.SIGQUIT);
                                                        Thread.Sleep (1000);
                                                } catch {
                                                }
+#endif
 
-                                               output.Write ($"timed out ({timeout}s)");
+                                               if (verbose) {
+                                                       output.Write ($"timed out ({timeout}s)");
+                                               }
 
                                                try {
                                                        p.Kill ();
@@ -277,7 +393,8 @@ public class TestRunner
                                                        failed.Add (data);
                                                }
 
-                                               output.Write ("failed, time: {0}, exit code: {1}", (end - start).ToString (TEST_TIME_FORMAT), p.ExitCode);
+                                               if (verbose)
+                                                       output.Write ("failed, time: {0}, exit code: {1}", (end - start).ToString (TEST_TIME_FORMAT), p.ExitCode);
                                        } else {
                                                var end = DateTime.UtcNow;
 
@@ -285,13 +402,15 @@ public class TestRunner
                                                        passed.Add (data);
                                                }
 
-                                               output.Write ("passed, time: {0}", (end - start).ToString (TEST_TIME_FORMAT));
+                                               if (verbose)
+                                                       output.Write ("passed, time: {0}", (end - start).ToString (TEST_TIME_FORMAT));
                                        }
 
                                        p.Close ();
 
                                        lock (monitor) {
-                                               Console.WriteLine (output.ToString ());
+                                               if (verbose)
+                                                       Console.WriteLine (output.ToString ());
                                        }
                                }
                        });
@@ -313,7 +432,9 @@ public class TestRunner
                XmlWriterSettings xmlWriterSettings = new XmlWriterSettings ();
                xmlWriterSettings.NewLineOnAttributes = true;
                xmlWriterSettings.Indent = true;
-               using (XmlWriter writer = XmlWriter.Create (String.Format ("TestResult-{0}.xml", testsuiteName), xmlWriterSettings)) {
+
+               string xmlPath = String.Format ("TestResult-{0}.xml", testsuiteName);
+               using (XmlWriter writer = XmlWriter.Create (xmlPath, xmlWriterSettings)) {
                        // <?xml version="1.0" encoding="utf-8" standalone="no"?>
                        writer.WriteStartDocument ();
                        // <!--This file represents the results of running a test suite-->
@@ -430,14 +551,29 @@ public class TestRunner
                        // </test-results>
                        writer.WriteEndElement ();
                        writer.WriteEndDocument ();
+
+                       string babysitterXmlList = Environment.GetEnvironmentVariable("MONO_BABYSITTER_NUNIT_XML_LIST_FILE");
+                       if (!String.IsNullOrEmpty(babysitterXmlList)) {
+                               try {
+                                       string fullXmlPath = Path.GetFullPath(xmlPath);
+                                       File.AppendAllText(babysitterXmlList, fullXmlPath + Environment.NewLine);
+                               } catch (Exception e) {
+                                       Console.WriteLine("Attempted to record XML path to file {0} but failed.", babysitterXmlList);
+                               }
+                       }
                }
 
-               Console.WriteLine ();
-               Console.WriteLine ("Time: {0}", test_time.ToString (TEST_TIME_FORMAT));
-               Console.WriteLine ();
-               Console.WriteLine ("{0,4} test(s) passed", npassed);
-               Console.WriteLine ("{0,4} test(s) failed", nfailed);
-               Console.WriteLine ("{0,4} test(s) timed out", ntimedout);
+               if (verbose) {
+                       Console.WriteLine ();
+                       Console.WriteLine ("Time: {0}", test_time.ToString (TEST_TIME_FORMAT));
+                       Console.WriteLine ();
+                       Console.WriteLine ("{0,4} test(s) passed", npassed);
+                       Console.WriteLine ("{0,4} test(s) failed", nfailed);
+                       Console.WriteLine ("{0,4} test(s) timed out", ntimedout);
+               } else {
+                       Console.WriteLine ();
+                       Console.WriteLine (String.Format ("{0} test(s) passed, {1} test(s) did not pass.", npassed, nfailed));
+               }
 
                if (nfailed > 0) {
                        Console.WriteLine ();
index 527c29be754e5e0820e6c70bb76ab465e0eed486..0148fb4a4df0bf5cb1ba89b3b0f06b52f931dd64 100644 (file)
@@ -1,6 +1,11 @@
 using System;
 using System.Runtime.InteropServices;
 
+[AttributeUsage (AttributeTargets.Method)]
+sealed class MonoPInvokeCallbackAttribute : Attribute {
+       public MonoPInvokeCallbackAttribute (Type t) {}
+}
+
 [StructLayout (LayoutKind.Sequential)]
 struct winx64_struct1
 {
@@ -450,6 +455,7 @@ class winx64structs
                return 0;
        }
 
+       [MonoPInvokeCallback (typeof (managed_struct1_delegate))]
        public static int managed_struct1_test (winx64_struct1 var)
        {
                if (var.a != 5)
@@ -458,6 +464,7 @@ class winx64structs
                return 0;
        }
 
+       [MonoPInvokeCallback (typeof (managed_struct5_delegate))]
        public static int managed_struct5_test (winx64_struct5 var)
        {
                if (var.a != 5)
@@ -470,6 +477,7 @@ class winx64structs
                return 0;
        }
 
+       [MonoPInvokeCallback (typeof (managed_struct1_struct5_delegate))]
        public static int managed_struct1_struct5_test (winx64_struct1 var1, winx64_struct5 var2,
                                                        winx64_struct1 var3, winx64_struct5 var4,
                                                        winx64_struct1 var5, winx64_struct5 var6)
@@ -487,11 +495,13 @@ class winx64structs
                return 0;
        }
 
+       [MonoPInvokeCallback (typeof (mono_test_Winx64_struct1_ret_delegate))]
        public static winx64_struct1 mono_test_Winx64_struct1_ret_test ()
        {
                return new winx64_struct1 (0x45);
        }
 
+       [MonoPInvokeCallback (typeof (mono_test_Winx64_struct5_ret_delegate))]
        public static winx64_struct5 mono_test_Winx64_struct5_ret_test ()
        {
                return new winx64_struct5 (0x12, 0x34, 0x56);
index 02d447ad511469067266123670983bb25e694c40..2e873cde79844c8793f096b5913a5cc854e28103 100644 (file)
@@ -112,6 +112,7 @@ monoutils_sources = \
        mono-threads-windows.c  \
        mono-threads-linux.c    \
        mono-threads-freebsd.c  \
+       mono-threads-netbsd.c   \
        mono-threads-openbsd.c  \
        mono-threads-android.c  \
        mono-threads.h  \
@@ -151,7 +152,9 @@ monoutils_sources = \
        parse.c \
        parse.h \
        checked-build.c \
-       checked-build.h
+       checked-build.h \
+       w32handle.c \
+       w32handle.h
 
 arch_sources = 
 
index 2ce2a6ea95e4afb928e2bb91d7bd0df263c936ae..3177f2d17a1194f5ebc59fbea7382990120a4db5 100644 (file)
@@ -342,7 +342,7 @@ HAVE_MMAP                 default: 1 (true)
   able to unmap memory that may have be allocated using multiple calls
   to MMAP, so long as they are adjacent.
 
-HAVE_MREMAP               default: 1 on linux, else 0
+HAVE_MREMAP               default: 1 on linux and NetBSD, else 0
   If true realloc() uses mremap() to re-allocate large blocks and
   extend or shrink allocation spaces.
 
@@ -536,11 +536,11 @@ DEFAULT_MMAP_THRESHOLD       default: 256K
 #define MMAP_CLEARS 1
 #endif  /* MMAP_CLEARS */
 #ifndef HAVE_MREMAP
-#ifdef linux
+#if defined(linux) || defined(__NetBSD__)
 #define HAVE_MREMAP 1
-#else   /* linux */
+#else   /* linux || __NetBSD__ */
 #define HAVE_MREMAP 0
-#endif  /* linux */
+#endif  /* linux || __NetBSD__ */
 #endif  /* HAVE_MREMAP */
 #ifndef MALLOC_FAILURE_ACTION
 #define MALLOC_FAILURE_ACTION  errno = ENOMEM;
@@ -1375,7 +1375,13 @@ static int win32munmap(void* ptr, size_t size) {
 #endif /* HAVE_MMAP */
 
 #if HAVE_MMAP && HAVE_MREMAP
+#if defined(linux)
 #define CALL_MREMAP(addr, osz, nsz, mv) mremap((addr), (osz), (nsz), (mv))
+#elif defined(__NetBSD__)
+#define CALL_MREMAP(addr, osz, nsz, mv) mremap((addr), (osz), (addr), (nsz), (mv))
+#else
+#define CALL_MREMAP(addr, osz, nsz, mv) MFAIL
+#endif
 #else  /* HAVE_MMAP && HAVE_MREMAP */
 #define CALL_MREMAP(addr, osz, nsz, mv) MFAIL
 #endif /* HAVE_MMAP && HAVE_MREMAP */
index 3be8342a49873dbc9e2796d44a76a81d5a9302e3..d103ef6aa333eeb96a920d8e62ef0af79db5ecb2 100644 (file)
@@ -477,8 +477,18 @@ mono_lock_free_free (gpointer ptr, size_t block_size)
                g_assert (old_anchor.data.state != STATE_EMPTY);
 
                if (InterlockedCompareExchangePointer ((gpointer * volatile)&heap->active, NULL, desc) == desc) {
-                       /* We own it, so we free it. */
-                       desc_retire (desc);
+                       /*
+                        * We own desc, check if it's still empty, in which case we retire it.
+                        * If it's partial we need to put it back either on the active slot or
+                        * on the partial list.
+                        */
+                       if (desc->anchor.data.state == STATE_EMPTY) {
+                               desc_retire (desc);
+                       } else if (desc->anchor.data.state == STATE_PARTIAL) {
+                               if (InterlockedCompareExchangePointer ((gpointer * volatile)&heap->active, desc, NULL) != NULL)
+                                       heap_put_partial (desc);
+
+                       }
                } else {
                        /*
                         * Somebody else must free it, so we do some
index 92ae719d7ba653080ecada657c71f3263678dba8..1bd0a646054f2e7e7586ad1e8b46b4ce2c215969 100644 (file)
@@ -23,16 +23,16 @@ struct _MonoCoopCond {
        mono_cond_t c;
 };
 
-static inline gint
+static inline void
 mono_coop_mutex_init (MonoCoopMutex *mutex)
 {
-       return mono_os_mutex_init (&mutex->m);
+       mono_os_mutex_init (&mutex->m);
 }
 
-static inline gint
+static inline void
 mono_coop_mutex_init_recursive (MonoCoopMutex *mutex)
 {
-       return mono_os_mutex_init_recursive (&mutex->m);
+       mono_os_mutex_init_recursive (&mutex->m);
 }
 
 static inline gint
@@ -41,22 +41,18 @@ mono_coop_mutex_destroy (MonoCoopMutex *mutex)
        return mono_os_mutex_destroy (&mutex->m);
 }
 
-static inline gint
+static inline void
 mono_coop_mutex_lock (MonoCoopMutex *mutex)
 {
-       gint res;
-
        /* Avoid thread state switch if lock is not contended */
        if (mono_os_mutex_trylock (&mutex->m) == 0)
-               return 0;
+               return;
 
        MONO_ENTER_GC_SAFE;
 
-       res = mono_os_mutex_lock (&mutex->m);
+       mono_os_mutex_lock (&mutex->m);
 
        MONO_EXIT_GC_SAFE;
-
-       return res;
 }
 
 static inline gint
@@ -65,16 +61,16 @@ mono_coop_mutex_trylock (MonoCoopMutex *mutex)
        return mono_os_mutex_trylock (&mutex->m);
 }
 
-static inline gint
+static inline void
 mono_coop_mutex_unlock (MonoCoopMutex *mutex)
 {
-       return mono_os_mutex_unlock (&mutex->m);
+       mono_os_mutex_unlock (&mutex->m);
 }
 
-static inline gint
+static inline void
 mono_coop_cond_init (MonoCoopCond *cond)
 {
-       return mono_os_cond_init (&cond->c);
+       mono_os_cond_init (&cond->c);
 }
 
 static inline gint
@@ -83,18 +79,14 @@ mono_coop_cond_destroy (MonoCoopCond *cond)
        return mono_os_cond_destroy (&cond->c);
 }
 
-static inline gint
+static inline void
 mono_coop_cond_wait (MonoCoopCond *cond, MonoCoopMutex *mutex)
 {
-       gint res;
-
        MONO_ENTER_GC_SAFE;
 
-       res = mono_os_cond_wait (&cond->c, &mutex->m);
+       mono_os_cond_wait (&cond->c, &mutex->m);
 
        MONO_EXIT_GC_SAFE;
-
-       return res;
 }
 
 static inline gint
@@ -111,16 +103,16 @@ mono_coop_cond_timedwait (MonoCoopCond *cond, MonoCoopMutex *mutex, guint32 time
        return res;
 }
 
-static inline gint
+static inline void
 mono_coop_cond_signal (MonoCoopCond *cond)
 {
-       return mono_os_cond_signal (&cond->c);
+       mono_os_cond_signal (&cond->c);
 }
 
-static inline gint
+static inline void
 mono_coop_cond_broadcast (MonoCoopCond *cond)
 {
-       return mono_os_cond_broadcast (&cond->c);
+       mono_os_cond_broadcast (&cond->c);
 }
 
 G_END_DECLS
index 81c987ed74070107a4400e07f8fabf28b6cf865a..29937c5b73877e18c63ae2b49365bb6bf328de6f 100644 (file)
@@ -18,16 +18,16 @@ struct _MonoCoopSem {
        MonoSemType s;
 };
 
-static inline gint
+static inline void
 mono_coop_sem_init (MonoCoopSem *sem, int value)
 {
-       return mono_os_sem_init (&sem->s, value);
+       mono_os_sem_init (&sem->s, value);
 }
 
-static inline gint
+static inline void
 mono_coop_sem_destroy (MonoCoopSem *sem)
 {
-       return mono_os_sem_destroy (&sem->s);
+       mono_os_sem_destroy (&sem->s);
 }
 
 static inline gint
@@ -44,10 +44,10 @@ mono_coop_sem_wait (MonoCoopSem *sem, MonoSemFlags flags)
        return res;
 }
 
-static inline gint
+static inline MonoSemTimedwaitRet
 mono_coop_sem_timedwait (MonoCoopSem *sem, guint timeout_ms, MonoSemFlags flags)
 {
-       gint res;
+       MonoSemTimedwaitRet res;
 
        MONO_ENTER_GC_SAFE;
 
@@ -58,10 +58,10 @@ mono_coop_sem_timedwait (MonoCoopSem *sem, guint timeout_ms, MonoSemFlags flags)
        return res;
 }
 
-static inline gint
+static inline void
 mono_coop_sem_post (MonoCoopSem *sem)
 {
-       return mono_os_sem_post (&sem->s);
+       mono_os_sem_post (&sem->s);
 }
 
 G_END_DECLS
index d5621323f9f64289ae8e3396cb5f7aaf99f48d23..758c3dc6fc2651487fc8cc87fcd97714f1882d13 100644 (file)
@@ -159,7 +159,8 @@ mono_hwcap_arch_init (void)
 
        if (file) {
                while ((line = fgets (buf, 512, file))) {
-                       if (!strncmp (line, "Processor", 9)) {
+                       if (!strncmp (line, "Processor", 9) ||
+                           !strncmp (line, "model name", 10)) {
                                char *ver = strstr (line, "(v");
 
                                if (ver) {
index 89e9a01023ab32bf0a3738271aa6141b5a397f72..f32a25e306d75f5a64ddd70ef84aaea354a290e2 100644 (file)
@@ -17,6 +17,7 @@ typedef enum {
        MONO_TRACE_THREADPOOL           = (1<<7),
        MONO_TRACE_IO_THREADPOOL        = (1<<8),
        MONO_TRACE_IO_LAYER             = (1<<9),
+       MONO_TRACE_W32HANDLE    = (1<<10),
        MONO_TRACE_ALL                  = MONO_TRACE_ASSEMBLY |
                                          MONO_TRACE_TYPE |
                                          MONO_TRACE_DLLIMPORT |
@@ -26,7 +27,8 @@ typedef enum {
                                          MONO_TRACE_SECURITY |
                                          MONO_TRACE_THREADPOOL |
                                          MONO_TRACE_IO_THREADPOOL |
-                                         MONO_TRACE_IO_LAYER
+                                         MONO_TRACE_IO_LAYER |
+                                         MONO_TRACE_W32HANDLE
 } MonoTraceMask;
 
 extern GLogLevelFlags mono_internal_current_level;
index 8a5840a1c4747fd725dabbfb366ce7bb5e1a39bb..f6cdd40b20d8df63eb141fdebd1b721017e12899 100644 (file)
@@ -148,7 +148,7 @@ mono_trace_set_logdest_string (const char *dest)
        if(level_stack == NULL)
                mono_trace_init();
 
-       if ((dest != NULL) && (strcmp("syslog", dest) != 0)) {
+       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;
@@ -263,10 +263,11 @@ mono_trace_set_mask_string (const char *value)
        const char *tok;
        guint32 flags = 0;
 
-       const char *valid_flags[] = {"asm", "type", "dll", "gc", "cfg", "aot", "security", "threadpool", "io-threadpool", "io-layer", "all", NULL};
+       const char *valid_flags[] = {"asm", "type", "dll", "gc", "cfg", "aot", "security", "threadpool", "io-threadpool", "io-layer", "w32handle", "all", NULL};
        const MonoTraceMask     valid_masks[] = {MONO_TRACE_ASSEMBLY, MONO_TRACE_TYPE, MONO_TRACE_DLLIMPORT,
                                                 MONO_TRACE_GC, MONO_TRACE_CONFIG, MONO_TRACE_AOT, MONO_TRACE_SECURITY,
-                                                MONO_TRACE_THREADPOOL, MONO_TRACE_IO_THREADPOOL, MONO_TRACE_IO_LAYER, MONO_TRACE_ALL };
+                                                MONO_TRACE_THREADPOOL, MONO_TRACE_IO_THREADPOOL, MONO_TRACE_IO_LAYER,
+                                                MONO_TRACE_W32HANDLE, MONO_TRACE_ALL };
 
        if(!value)
                return;
@@ -365,7 +366,7 @@ legacy_opener(const char *path, void *user_data)
  * Cleanup routine for older style loggers
  */
 static void
-legacy_closer()
+legacy_closer(void)
 {
        if (logCallback.user_data != NULL) {
                g_free (logCallback.user_data); /* This is a LegacyLoggerUserData struct */
index 1317b0b462d385037b2347d881a954dfc201785d..ece9bd410f6142aa38b59773fbdd144ed1d60c07 100644 (file)
 
 G_BEGIN_DECLS
 
+#ifndef MONO_INFINITE_WAIT
+#define MONO_INFINITE_WAIT ((guint32) 0xFFFFFFFF)
+#endif
+
+
 #if !defined(HOST_WIN32)
 
 typedef pthread_mutex_t mono_mutex_t;
 typedef pthread_cond_t mono_cond_t;
 
-static inline int
+static inline void
 mono_os_mutex_init (mono_mutex_t *mutex)
 {
-       return pthread_mutex_init (mutex, NULL);
+       int res;
+
+       res = pthread_mutex_init (mutex, NULL);
+       if (G_UNLIKELY (res != 0))
+               g_error ("%s: pthread_mutex_init failed with \"%s\" (%d)", __func__, g_strerror (res), res);
 }
 
-static inline int
+static inline void
 mono_os_mutex_init_recursive (mono_mutex_t *mutex)
 {
        int res;
        pthread_mutexattr_t attr;
 
-       pthread_mutexattr_init (&attr);
-       pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_RECURSIVE);
+       res = pthread_mutexattr_init (&attr);
+       if (G_UNLIKELY (res != 0))
+               g_error ("%s: pthread_mutexattr_init failed with \"%s\" (%d)", __func__, g_strerror (res), res);
+
+       res = pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_RECURSIVE);
+       if (G_UNLIKELY (res != 0))
+               g_error ("%s: pthread_mutexattr_settype failed with \"%s\" (%d)", __func__, g_strerror (res), res);
+
        res = pthread_mutex_init (mutex, &attr);
-       pthread_mutexattr_destroy (&attr);
+       if (G_UNLIKELY (res != 0))
+               g_error ("%s: pthread_mutex_init failed with \"%s\" (%d)", __func__, g_strerror (res), res);
 
-       return res;
+       res = pthread_mutexattr_destroy (&attr);
+       if (G_UNLIKELY (res != 0))
+               g_error ("%s: pthread_mutexattr_destroy failed with \"%s\" (%d)", __func__, g_strerror (res), res);
 }
 
 static inline int
 mono_os_mutex_destroy (mono_mutex_t *mutex)
 {
-       return pthread_mutex_destroy (mutex);
+       int res;
+
+       res = pthread_mutex_destroy (mutex);
+       if (G_UNLIKELY (res != 0 && res != EBUSY))
+               g_error ("%s: pthread_mutex_destroy failed with \"%s\" (%d)", __func__, g_strerror (res), res);
+
+       return res != 0 ? -1 : 0;
 }
 
-static inline int
+static inline void
 mono_os_mutex_lock (mono_mutex_t *mutex)
 {
        int res;
 
        res = pthread_mutex_lock (mutex);
-       g_assert (res != EINVAL);
-
-       return res;
+       if (G_UNLIKELY (res != 0))
+               g_error ("%s: pthread_mutex_lock failed with \"%s\" (%d)", __func__, g_strerror (res), res);
 }
 
 static inline int
 mono_os_mutex_trylock (mono_mutex_t *mutex)
 {
-       return pthread_mutex_trylock (mutex);
+       int res;
+
+       res = pthread_mutex_trylock (mutex);
+       if (G_UNLIKELY (res != 0 && res != EBUSY))
+               g_error ("%s: pthread_mutex_trylock failed with \"%s\" (%d)", __func__, g_strerror (res), res);
+
+       return res != 0 ? -1 : 0;
 }
 
-static inline int
+static inline void
 mono_os_mutex_unlock (mono_mutex_t *mutex)
 {
-       return pthread_mutex_unlock (mutex);
+       int res;
+
+       res = pthread_mutex_unlock (mutex);
+       if (G_UNLIKELY (res != 0))
+               g_error ("%s: pthread_mutex_unlock failed with \"%s\" (%d)", __func__, g_strerror (res), res);
 }
 
-static inline int
+static inline void
 mono_os_cond_init (mono_cond_t *cond)
 {
-       return pthread_cond_init (cond, NULL);
+       int res;
+
+       res = pthread_cond_init (cond, NULL);
+       if (G_UNLIKELY (res != 0))
+               g_error ("%s: pthread_cond_init failed with \"%s\" (%d)", __func__, g_strerror (res), res);
 }
 
 static inline int
 mono_os_cond_destroy (mono_cond_t *cond)
 {
-       return pthread_cond_destroy (cond);
+       int res;
+
+       res = pthread_cond_destroy (cond);
+       if (G_UNLIKELY (res != 0 && res != EBUSY))
+               g_error ("%s: pthread_cond_destroy failed with \"%s\" (%d)", __func__, g_strerror (res), res);
+
+       return res != 0 ? -1 : 0;
 }
 
-static inline int
+static inline void
 mono_os_cond_wait (mono_cond_t *cond, mono_mutex_t *mutex)
 {
        int res;
 
        res = pthread_cond_wait (cond, mutex);
-       g_assert (res != EINVAL);
-
-       return res;
+       if (G_UNLIKELY (res != 0))
+               g_error ("%s: pthread_cond_wait failed with \"%s\" (%d)", __func__, g_strerror (res), res);
 }
 
 static inline int
@@ -118,12 +160,17 @@ mono_os_cond_timedwait (mono_cond_t *cond, mono_mutex_t *mutex, guint32 timeout_
        gint64 usecs;
        int res;
 
-       if (timeout_ms == (guint32) 0xFFFFFFFF)
-               return mono_os_cond_wait (cond, mutex);
+       if (timeout_ms == MONO_INFINITE_WAIT) {
+               mono_os_cond_wait (cond, mutex);
+               return 0;
+       }
 
        /* ms = 10^-3, us = 10^-6, ns = 10^-9 */
 
-       gettimeofday (&tv, NULL);
+       res = gettimeofday (&tv, NULL);
+       if (G_UNLIKELY (res != 0))
+               g_error ("%s: pthread_cond_timedwait failed with \"%s\" (%d)", __func__, g_strerror (errno), errno);
+
        tv.tv_sec += timeout_ms / 1000;
        usecs = tv.tv_usec + ((timeout_ms % 1000) * 1000);
        if (usecs >= 1000000) {
@@ -134,21 +181,30 @@ mono_os_cond_timedwait (mono_cond_t *cond, mono_mutex_t *mutex, guint32 timeout_
        ts.tv_nsec = usecs * 1000;
 
        res = pthread_cond_timedwait (cond, mutex, &ts);
-       g_assert (res != EINVAL);
+       if (G_UNLIKELY (res != 0 && res != ETIMEDOUT))
+               g_error ("%s: pthread_cond_timedwait failed with \"%s\" (%d)", __func__, g_strerror (res), res);
 
-       return res;
+       return res != 0 ? -1 : 0;
 }
 
-static inline int
+static inline void
 mono_os_cond_signal (mono_cond_t *cond)
 {
-       return pthread_cond_signal (cond);
+       int res;
+
+       res = pthread_cond_signal (cond);
+       if (G_UNLIKELY (res != 0))
+               g_error ("%s: pthread_cond_signal failed with \"%s\" (%d)", __func__, g_strerror (res), res);
 }
 
-static inline int
+static inline void
 mono_os_cond_broadcast (mono_cond_t *cond)
 {
-       return pthread_cond_broadcast (cond);
+       int res;
+
+       res = pthread_cond_broadcast (cond);
+       if (G_UNLIKELY (res != 0))
+               g_error ("%s: pthread_cond_broadcast failed with \"%s\" (%d)", __func__, g_strerror (res), res);
 }
 
 #else
@@ -220,18 +276,24 @@ WINBASEAPI BOOL WINAPI InitializeCriticalSectionEx(LPCRITICAL_SECTION lpCritical
 typedef CRITICAL_SECTION mono_mutex_t;
 typedef CONDITION_VARIABLE mono_cond_t;
 
-static inline int
+static inline void
 mono_os_mutex_init (mono_mutex_t *mutex)
 {
-       InitializeCriticalSectionEx (mutex, 0, CRITICAL_SECTION_NO_DEBUG_INFO);
-       return 0;
+       BOOL res;
+
+       res = InitializeCriticalSectionEx (mutex, 0, CRITICAL_SECTION_NO_DEBUG_INFO);
+       if (G_UNLIKELY (res == 0))
+               g_error ("%s: InitializeCriticalSectionEx failed with error %d", __func__, GetLastError ());
 }
 
-static inline int
+static inline void
 mono_os_mutex_init_recursive (mono_mutex_t *mutex)
 {
-       InitializeCriticalSectionEx (mutex, 0, CRITICAL_SECTION_NO_DEBUG_INFO);
-       return 0;
+       BOOL res;
+
+       res = InitializeCriticalSectionEx (mutex, 0, CRITICAL_SECTION_NO_DEBUG_INFO);
+       if (G_UNLIKELY (res == 0))
+               g_error ("%s: InitializeCriticalSectionEx failed with error %d", __func__, GetLastError ());
 }
 
 static inline int
@@ -241,31 +303,28 @@ mono_os_mutex_destroy (mono_mutex_t *mutex)
        return 0;
 }
 
-static inline int
+static inline void
 mono_os_mutex_lock (mono_mutex_t *mutex)
 {
        EnterCriticalSection (mutex);
-       return 0;
 }
 
 static inline int
 mono_os_mutex_trylock (mono_mutex_t *mutex)
 {
-       return TryEnterCriticalSection (mutex) != 0 ? 0 : 1;
+       return TryEnterCriticalSection (mutex) == 0 ? -1 : 0;
 }
 
-static inline int
+static inline void
 mono_os_mutex_unlock (mono_mutex_t *mutex)
 {
        LeaveCriticalSection (mutex);
-       return 0;
 }
 
-static inline int
+static inline void
 mono_os_cond_init (mono_cond_t *cond)
 {
        InitializeConditionVariable (cond);
-       return 0;
 }
 
 static inline int
@@ -275,30 +334,38 @@ mono_os_cond_destroy (mono_cond_t *cond)
        return 0;
 }
 
-static inline int
+static inline void
 mono_os_cond_wait (mono_cond_t *cond, mono_mutex_t *mutex)
 {
-       return SleepConditionVariableCS (cond, mutex, INFINITE) ? 0 : 1;
+       BOOL res;
+
+       res = SleepConditionVariableCS (cond, mutex, INFINITE);
+       if (G_UNLIKELY (res == 0))
+               g_error ("%s: SleepConditionVariableCS failed with error %d", __func__, GetLastError ());
 }
 
 static inline int
 mono_os_cond_timedwait (mono_cond_t *cond, mono_mutex_t *mutex, guint32 timeout_ms)
 {
-       return SleepConditionVariableCS (cond, mutex, timeout_ms) ? 0 : 1;
+       BOOL res;
+
+       res = SleepConditionVariableCS (cond, mutex, timeout_ms);
+       if (G_UNLIKELY (res == 0 && GetLastError () != ERROR_TIMEOUT))
+               g_error ("%s: SleepConditionVariableCS failed with error %d", __func__, GetLastError ());
+
+       return res == 0 ? -1 : 0;
 }
 
-static inline int
+static inline void
 mono_os_cond_signal (mono_cond_t *cond)
 {
        WakeConditionVariable (cond);
-       return 0;
 }
 
-static inline int
+static inline void
 mono_os_cond_broadcast (mono_cond_t *cond)
 {
        WakeAllConditionVariable (cond);
-       return 0;
 }
 
 #endif
index 16e3d463b8b7377ab0dfb6ec22b8adcc15b76f66..9f59ce1ea821df2fa3dd849edd89d8e3a8b8aee7 100644 (file)
 #define NSEC_PER_SEC (1000 * 1000 * 1000)
 #endif
 
+#ifndef MONO_INFINITE_WAIT
+#define MONO_INFINITE_WAIT ((guint32) 0xFFFFFFFF)
+#endif
+
 G_BEGIN_DECLS
 
 typedef enum {
@@ -47,30 +51,45 @@ typedef enum {
        MONO_SEM_FLAGS_ALERTABLE = 1 << 0,
 } MonoSemFlags;
 
+typedef enum {
+       MONO_SEM_TIMEDWAIT_RET_SUCCESS  =  0,
+       MONO_SEM_TIMEDWAIT_RET_ALERTED  = -1,
+       MONO_SEM_TIMEDWAIT_RET_TIMEDOUT = -2,
+} MonoSemTimedwaitRet;
+
 #if defined(USE_MACH_SEMA)
 
 typedef semaphore_t MonoSemType;
 
-static inline int
+static inline void
 mono_os_sem_init (MonoSemType *sem, int value)
 {
-       return semaphore_create (current_task (), sem, SYNC_POLICY_FIFO, value) != KERN_SUCCESS ? -1 : 0;
+       kern_return_t res;
+
+       res = semaphore_create (current_task (), sem, SYNC_POLICY_FIFO, value);
+       if (G_UNLIKELY (res != KERN_SUCCESS))
+               g_error ("%s: semaphore_create failed with error %d", __func__, res);
 }
 
-static inline int
+static inline void
 mono_os_sem_destroy (MonoSemType *sem)
 {
-       return semaphore_destroy (current_task (), *sem) != KERN_SUCCESS ? -1 : 0;
+       kern_return_t res;
+
+       res = semaphore_destroy (current_task (), *sem);
+       if (G_UNLIKELY (res != KERN_SUCCESS))
+               g_error ("%s: semaphore_destroy failed with error %d", __func__, res);
 }
 
 static inline int
 mono_os_sem_wait (MonoSemType *sem, MonoSemFlags flags)
 {
-       int res;
+       kern_return_t res;
 
 retry:
        res = semaphore_wait (*sem);
-       g_assert (res != KERN_INVALID_ARGUMENT);
+       if (G_UNLIKELY (res != KERN_SUCCESS && res != KERN_ABORTED))
+               g_error ("%s: semaphore_wait failed with error %d", __func__, res);
 
        if (res == KERN_ABORTED && !(flags & MONO_SEM_FLAGS_ALERTABLE))
                goto retry;
@@ -78,15 +97,16 @@ retry:
        return res != KERN_SUCCESS ? -1 : 0;
 }
 
-static inline int
+static inline MonoSemTimedwaitRet
 mono_os_sem_timedwait (MonoSemType *sem, guint32 timeout_ms, MonoSemFlags flags)
 {
+       kern_return_t res;
+       int resint;
        mach_timespec_t ts, copy;
        struct timeval start, current;
-       int res = 0;
 
-       if (timeout_ms == (guint32) 0xFFFFFFFF)
-               return mono_os_sem_wait (sem, flags);
+       if (timeout_ms == MONO_INFINITE_WAIT)
+               return (MonoSemTimedwaitRet) mono_os_sem_wait (sem, flags);
 
        ts.tv_sec = timeout_ms / 1000;
        ts.tv_nsec = (timeout_ms % 1000) * 1000000;
@@ -96,16 +116,22 @@ mono_os_sem_timedwait (MonoSemType *sem, guint32 timeout_ms, MonoSemFlags flags)
        }
 
        copy = ts;
-       gettimeofday (&start, NULL);
+       resint = gettimeofday (&start, NULL);
+       if (G_UNLIKELY (resint != 0))
+               g_error ("%s: gettimeofday failed with \"%s\" (%d)", __func__, g_strerror (errno), errno);
 
 retry:
        res = semaphore_timedwait (*sem, ts);
-       g_assert (res != KERN_INVALID_ARGUMENT);
+       if (G_UNLIKELY (res != KERN_SUCCESS && res != KERN_ABORTED && res != KERN_OPERATION_TIMED_OUT))
+               g_error ("%s: semaphore_timedwait failed with error %d", __func__, res);
 
        if (res == KERN_ABORTED && !(flags & MONO_SEM_FLAGS_ALERTABLE)) {
                ts = copy;
 
-               gettimeofday (&current, NULL);
+               resint = gettimeofday (&current, NULL);
+               if (G_UNLIKELY (resint != 0))
+                       g_error ("%s: gettimeofday failed with \"%s\" (%d)", __func__, g_strerror (errno), errno);
+
                ts.tv_sec -= (current.tv_sec - start.tv_sec);
                ts.tv_nsec -= (current.tv_usec - start.tv_usec) * 1000;
                if (ts.tv_nsec < 0) {
@@ -124,37 +150,54 @@ retry:
                goto retry;
        }
 
-       return res != KERN_SUCCESS ? -1 : 0;
+       switch (res) {
+       case KERN_SUCCESS:
+               return MONO_SEM_TIMEDWAIT_RET_SUCCESS;
+       case KERN_ABORTED:
+               return MONO_SEM_TIMEDWAIT_RET_ALERTED;
+       case KERN_OPERATION_TIMED_OUT:
+               return MONO_SEM_TIMEDWAIT_RET_TIMEDOUT;
+       default:
+               g_assert_not_reached ();
+       }
 }
 
-static inline int
+static inline void
 mono_os_sem_post (MonoSemType *sem)
 {
-       int res;
+       kern_return_t res;
+
 retry:
        res = semaphore_signal (*sem);
-       g_assert (res != KERN_INVALID_ARGUMENT);
+       if (G_UNLIKELY (res != KERN_SUCCESS && res != KERN_ABORTED))
+               g_error ("%s: semaphore_signal failed with error %d", __func__, res);
 
        if (res == KERN_ABORTED)
                goto retry;
-
-       return res != KERN_SUCCESS ? -1 : 0;
 }
 
 #elif !defined(HOST_WIN32) && defined(HAVE_SEMAPHORE_H)
 
 typedef sem_t MonoSemType;
 
-static inline int
+static inline void
 mono_os_sem_init (MonoSemType *sem, int value)
 {
-       return sem_init (sem, 0, value);
+       int res;
+
+       res = sem_init (sem, 0, value);
+       if (G_UNLIKELY (res != 0))
+               g_error ("%s: sem_init failed with \"%s\" (%d)", __func__, g_strerror (errno), errno);
 }
 
-static inline int
+static inline void
 mono_os_sem_destroy (MonoSemType *sem)
 {
-       return sem_destroy (sem);
+       int res;
+
+       res = sem_destroy (sem);
+       if (G_UNLIKELY (res != 0))
+               g_error ("%s: sem_destroy failed with \"%s\" (%d)", __func__, g_strerror (errno), errno);
 }
 
 static inline int
@@ -164,34 +207,44 @@ mono_os_sem_wait (MonoSemType *sem, MonoSemFlags flags)
 
 retry:
        res = sem_wait (sem);
-       if (res == -1)
-               g_assert (errno != EINVAL);
+       if (G_UNLIKELY (res != 0 && errno != EINTR))
+               g_error ("%s: sem_wait failed with \"%s\" (%d)", __func__, g_strerror (errno), errno);
 
-       if (res == -1 && errno == EINTR && !(flags & MONO_SEM_FLAGS_ALERTABLE))
+       if (res != 0 && errno == EINTR && !(flags & MONO_SEM_FLAGS_ALERTABLE))
                goto retry;
 
        return res != 0 ? -1 : 0;
 }
 
-static inline int
+static inline MonoSemTimedwaitRet
 mono_os_sem_timedwait (MonoSemType *sem, guint32 timeout_ms, MonoSemFlags flags)
 {
        struct timespec ts, copy;
        struct timeval t;
-       int res = 0;
+       int res;
 
        if (timeout_ms == 0) {
-               res = sem_trywait (sem) != 0 ? -1 : 0;
-               if (res == -1)
-                       g_assert (errno != EINVAL);
-
-               return res != 0 ? -1 : 0;
+               res = sem_trywait (sem);
+               if (G_UNLIKELY (res != 0 && errno != EINTR && errno != EAGAIN))
+                       g_error ("%s: sem_trywait failed with \"%s\" (%d)", __func__, g_strerror (errno), errno);
+
+               if (res == 0)
+                       return MONO_SEM_TIMEDWAIT_RET_SUCCESS;
+               else if (errno == EINTR)
+                       return MONO_SEM_TIMEDWAIT_RET_ALERTED;
+               else if (errno == EAGAIN)
+                       return MONO_SEM_TIMEDWAIT_RET_TIMEDOUT;
+               else
+                       g_assert_not_reached ();
        }
 
-       if (timeout_ms == (guint32) 0xFFFFFFFF)
-               return mono_os_sem_wait (sem, flags);
+       if (timeout_ms == MONO_INFINITE_WAIT)
+               return (MonoSemTimedwaitRet) mono_os_sem_wait (sem, flags);
+
+       res = gettimeofday (&t, NULL);
+       if (G_UNLIKELY (res != 0))
+               g_error ("%s: gettimeofday failed with \"%s\" (%d)", __func__, g_strerror (errno), errno);
 
-       gettimeofday (&t, NULL);
        ts.tv_sec = timeout_ms / 1000 + t.tv_sec;
        ts.tv_nsec = (timeout_ms % 1000) * 1000000 + t.tv_usec * 1000;
        while (ts.tv_nsec >= NSEC_PER_SEC) {
@@ -202,75 +255,96 @@ mono_os_sem_timedwait (MonoSemType *sem, guint32 timeout_ms, MonoSemFlags flags)
        copy = ts;
 
 retry:
-#if defined(__native_client__) && defined(USE_NEWLIB)
-       res = sem_trywait (sem);
-#else
        res = sem_timedwait (sem, &ts);
-#endif
-       if (res == -1)
-               g_assert (errno != EINVAL);
+       if (G_UNLIKELY (res != 0 && errno != EINTR && errno != ETIMEDOUT))
+               g_error ("%s: sem_timedwait failed with \"%s\" (%d)", __func__, g_strerror (errno), errno);
 
-       if (res == -1 && errno == EINTR && !(flags & MONO_SEM_FLAGS_ALERTABLE)) {
+       if (res != 0 && errno == EINTR && !(flags & MONO_SEM_FLAGS_ALERTABLE)) {
                ts = copy;
                goto retry;
        }
 
-       return res != 0 ? -1 : 0;
+       if (res == 0)
+               return MONO_SEM_TIMEDWAIT_RET_SUCCESS;
+       else if (errno == EINTR)
+               return MONO_SEM_TIMEDWAIT_RET_ALERTED;
+       else if (errno == ETIMEDOUT)
+               return MONO_SEM_TIMEDWAIT_RET_TIMEDOUT;
+       else
+               g_assert_not_reached ();
 }
 
-static inline int
+static inline void
 mono_os_sem_post (MonoSemType *sem)
 {
        int res;
 
        res = sem_post (sem);
-       if (res == -1)
-               g_assert (errno != EINVAL);
-
-       return res;
+       if (G_UNLIKELY (res != 0))
+               g_error ("%s: sem_post failed with \"%s\" (%d)", __func__, g_strerror (errno), errno);
 }
 
 #else
 
 typedef HANDLE MonoSemType;
 
-static inline int
+static inline void
 mono_os_sem_init (MonoSemType *sem, int value)
 {
        *sem = CreateSemaphore (NULL, value, 0x7FFFFFFF, NULL);
-       return *sem == NULL ? -1 : 0;
+       if (G_UNLIKELY (*sem == NULL))
+               g_error ("%s: CreateSemaphore failed with error %d", __func__, GetLastError ());
 }
 
-static inline int
+static inline void
 mono_os_sem_destroy (MonoSemType *sem)
 {
-       return !CloseHandle (*sem) ? -1 : 0;
+       BOOL res;
+
+       res = CloseHandle (*sem);
+       if (G_UNLIKELY (res == 0))
+               g_error ("%s: CloseHandle failed with error %d", __func__, GetLastError ());
 }
 
-static inline int
+static inline MonoSemTimedwaitRet
 mono_os_sem_timedwait (MonoSemType *sem, guint32 timeout_ms, MonoSemFlags flags)
 {
-       gboolean res;
+       BOOL res;
 
 retry:
        res = WaitForSingleObjectEx (*sem, timeout_ms, flags & MONO_SEM_FLAGS_ALERTABLE);
+       if (G_UNLIKELY (res != WAIT_OBJECT_0 && res != WAIT_IO_COMPLETION && res != WAIT_TIMEOUT))
+               g_error ("%s: WaitForSingleObjectEx failed with error %d", __func__, GetLastError ());
 
        if (res == WAIT_IO_COMPLETION && !(flags & MONO_SEM_FLAGS_ALERTABLE))
                goto retry;
 
-       return res != WAIT_OBJECT_0 ? -1 : 0;
+       switch (res) {
+       case WAIT_OBJECT_0:
+               return MONO_SEM_TIMEDWAIT_RET_SUCCESS;
+       case WAIT_IO_COMPLETION:
+               return MONO_SEM_TIMEDWAIT_RET_ALERTED;
+       case WAIT_TIMEOUT:
+               return MONO_SEM_TIMEDWAIT_RET_TIMEDOUT;
+       default:
+               g_assert_not_reached ();
+       }
 }
 
 static inline int
 mono_os_sem_wait (MonoSemType *sem, MonoSemFlags flags)
 {
-       return mono_os_sem_timedwait (sem, INFINITE, flags);
+       return mono_os_sem_timedwait (sem, INFINITE, flags) != 0 ? -1 : 0;
 }
 
-static inline int
+static inline void
 mono_os_sem_post (MonoSemType *sem)
 {
-       return !ReleaseSemaphore (*sem, 1, NULL) ? -1 : 0;
+       BOOL res;
+
+       res = ReleaseSemaphore (*sem, 1, NULL);
+       if (G_UNLIKELY (res == 0))
+               g_error ("%s: ReleaseSemaphore failed with error %d", __func__, GetLastError ());
 }
 
 #endif
index 70271a57f8f7d48bb7f1ee69c1fc5c73f094a405..927a933d54bb50dde98dfd235926ea0e741ed918 100644 (file)
@@ -8,3 +8,21 @@ mono_free (void *ptr)
        g_free (ptr);
 }
 
+
+/**
+ * mono_set_allocator_vtable
+ *
+ * Make the runtime use the functions in @vtable for allocating memory.
+ * The provided functions must have the same semantics of their libc's equivalents.
+ *
+ * @return TRUE is the vtable was installed. FALSE if the version is incompatible.
+ */
+mono_bool
+mono_set_allocator_vtable (MonoAllocatorVTable* vtable)
+{
+       if (vtable->version != MONO_ALLOCATOR_VTABLE_VERSION)
+               return FALSE;
+       GMemVTable g_mem_vtable = { vtable->malloc, vtable->realloc, vtable->free, vtable->calloc};
+       g_mem_set_vtable (&g_mem_vtable);
+       return TRUE;
+}
index 53d4aa3ea7f4bed28874b023c70f33b9fd9cd490..89d4fb68b7590a565057dd42d4ca1844ac571340 100644 (file)
@@ -53,6 +53,8 @@ typedef unsigned __int64      uint64_t;
 
 #endif /* end of compiler-specific stuff */
 
+#include <stdlib.h>
+
 #if defined(MONO_DLL_EXPORT)
        #define MONO_API MONO_API_EXPORT
 #elif defined(MONO_DLL_IMPORT)
@@ -71,6 +73,20 @@ typedef void (*MonoHFunc)    (void* key, void* value, void* user_data);
 
 MONO_API void mono_free (void *);
 
+#define MONO_ALLOCATOR_VTABLE_VERSION 1
+
+typedef struct {
+       int version;
+       void *(*malloc)      (size_t size);
+       void *(*realloc)     (void *mem, size_t count);
+       void (*free)        (void *mem);
+       void *(*calloc)      (size_t count, size_t size);
+} MonoAllocatorVTable;
+
+MONO_API mono_bool
+mono_set_allocator_vtable (MonoAllocatorVTable* vtable);
+
+
 #define MONO_CONST_RETURN const
 
 /*
index fa82387f26ff8e01f26dfc12874eeea0a91d56ab..b5c039857665f2c8846b35280ec550bbd5527c46 100644 (file)
@@ -37,7 +37,7 @@ slow_get_thread_bounds (guint8 *current, guint8 **staddr, size_t *stsize)
 }
 
 void
-mono_threads_core_get_stack_bounds (guint8 **staddr, size_t *stsize)
+mono_threads_platform_get_stack_bounds (guint8 **staddr, size_t *stsize)
 {
        pthread_attr_t attr;
        guint8 *current = (guint8*)&attr;
index cd5d703a04a1095ffca4c1edbc2388f43a80b69f..9bfbdc51682b2db4fa1b2f94e30a6028ae7e2764 100644 (file)
@@ -417,7 +417,7 @@ mono_threads_is_coop_enabled (void)
 
 
 void
-mono_threads_init_coop (void)
+mono_threads_coop_init (void)
 {
        if (!mono_threads_is_coop_enabled ())
                return;
index cdee0ab40616b07bb980388ebbaefabbd882a3ac..e2e635552114aafcc5c34ac6e39d33231fa3f6e6 100644 (file)
@@ -7,7 +7,7 @@
 #include <pthread_np.h>
 
 void
-mono_threads_core_get_stack_bounds (guint8 **staddr, size_t *stsize)
+mono_threads_platform_get_stack_bounds (guint8 **staddr, size_t *stsize)
 {
        pthread_attr_t attr;
        guint8 *current = (guint8*)&attr;
index c5d6e8bab38eb01f2f7cda6eab0cc03be1f0b58a..6ffec1ab60478ff1a386f4f19aedc30a04fdb1c3 100644 (file)
@@ -6,7 +6,7 @@
 #include <pthread.h>
 
 void
-mono_threads_core_get_stack_bounds (guint8 **staddr, size_t *stsize)
+mono_threads_platform_get_stack_bounds (guint8 **staddr, size_t *stsize)
 {
        pthread_attr_t attr;
 
index 559d2fa63c94525e4c36384bb02213e3ac3155a4..eb43625f4793549cde6cd3a2f21e12158e3be6aa 100644 (file)
 #if defined(HOST_WATCHOS) || defined(HOST_TVOS)
 
 void
-mono_threads_init_abort_syscall (void)
+mono_threads_abort_syscall_init (void)
 {
 }
 
 void
-mono_threads_core_abort_syscall (MonoThreadInfo *info)
+mono_threads_suspend_abort_syscall (MonoThreadInfo *info)
 {
 
 }
 
 gboolean
-mono_threads_core_needs_abort_syscall (void)
+mono_threads_suspend_needs_abort_syscall (void)
 {
        return FALSE;
 }
@@ -40,12 +40,12 @@ mono_threads_core_needs_abort_syscall (void)
 #else
 
 void
-mono_threads_init_abort_syscall (void)
+mono_threads_abort_syscall_init (void)
 {
 }
 
 void
-mono_threads_core_abort_syscall (MonoThreadInfo *info)
+mono_threads_suspend_abort_syscall (MonoThreadInfo *info)
 {
        kern_return_t ret;
 
@@ -79,7 +79,7 @@ mono_threads_core_abort_syscall (MonoThreadInfo *info)
 }
 
 gboolean
-mono_threads_core_needs_abort_syscall (void)
+mono_threads_suspend_needs_abort_syscall (void)
 {
        return TRUE;
 }
index b23680759a8c6adf76789d30ca51da4eceb22317..948804243ccc61d2f9a43420d7c4e806e300056f 100644 (file)
@@ -25,7 +25,7 @@
 #include <mono/utils/hazard-pointer.h>
 
 void
-mono_threads_init_platform (void)
+mono_threads_suspend_init (void)
 {
        mono_threads_init_dead_letter ();
 }
@@ -33,19 +33,19 @@ mono_threads_init_platform (void)
 #if defined(HOST_WATCHOS) || defined(HOST_TVOS)
 
 gboolean
-mono_threads_core_begin_async_suspend (MonoThreadInfo *info, gboolean interrupt_kernel)
+mono_threads_suspend_begin_async_suspend (MonoThreadInfo *info, gboolean interrupt_kernel)
 {
        g_assert_not_reached ();
 }
 
 gboolean
-mono_threads_core_check_suspend_result (MonoThreadInfo *info)
+mono_threads_suspend_check_suspend_result (MonoThreadInfo *info)
 {
        g_assert_not_reached ();
 }
 
 gboolean
-mono_threads_core_begin_async_resume (MonoThreadInfo *info)
+mono_threads_suspend_begin_async_resume (MonoThreadInfo *info)
 {
        g_assert_not_reached ();
 }
@@ -53,7 +53,7 @@ mono_threads_core_begin_async_resume (MonoThreadInfo *info)
 #else /* defined(HOST_WATCHOS) || defined(HOST_TVOS) */
 
 gboolean
-mono_threads_core_begin_async_suspend (MonoThreadInfo *info, gboolean interrupt_kernel)
+mono_threads_suspend_begin_async_suspend (MonoThreadInfo *info, gboolean interrupt_kernel)
 {
        kern_return_t ret;
 
@@ -92,13 +92,13 @@ mono_threads_core_begin_async_suspend (MonoThreadInfo *info, gboolean interrupt_
 }
 
 gboolean
-mono_threads_core_check_suspend_result (MonoThreadInfo *info)
+mono_threads_suspend_check_suspend_result (MonoThreadInfo *info)
 {
        return info->suspend_can_continue;
 }
 
 gboolean
-mono_threads_core_begin_async_resume (MonoThreadInfo *info)
+mono_threads_suspend_begin_async_resume (MonoThreadInfo *info)
 {
        kern_return_t ret;
 
@@ -148,7 +148,7 @@ mono_threads_core_begin_async_resume (MonoThreadInfo *info)
 #endif /* defined(HOST_WATCHOS) || defined(HOST_TVOS) */
 
 void
-mono_threads_platform_register (MonoThreadInfo *info)
+mono_threads_suspend_register (MonoThreadInfo *info)
 {
        char thread_name [64];
 
@@ -161,7 +161,7 @@ mono_threads_platform_register (MonoThreadInfo *info)
 }
 
 void
-mono_threads_platform_free (MonoThreadInfo *info)
+mono_threads_suspend_free (MonoThreadInfo *info)
 {
        mach_port_deallocate (current_task (), info->native_handle);
 }
@@ -170,7 +170,7 @@ mono_threads_platform_free (MonoThreadInfo *info)
 
 #ifdef __MACH__
 void
-mono_threads_core_get_stack_bounds (guint8 **staddr, size_t *stsize)
+mono_threads_platform_get_stack_bounds (guint8 **staddr, size_t *stsize)
 {
        *staddr = (guint8*)pthread_get_stackaddr_np (pthread_self());
        *stsize = pthread_get_stacksize_np (pthread_self());
diff --git a/mono/utils/mono-threads-netbsd.c b/mono/utils/mono-threads-netbsd.c
new file mode 100644 (file)
index 0000000..c140148
--- /dev/null
@@ -0,0 +1,23 @@
+#include <config.h>
+
+#if defined(__NetBSD__)
+
+#include <mono/utils/mono-threads.h>
+#include <pthread.h>
+
+void
+mono_threads_platform_get_stack_bounds (guint8 **staddr, size_t *stsize)
+{
+       pthread_attr_t attr;
+
+       *staddr = NULL;
+       *stsize = (size_t)-1;
+
+       pthread_attr_init (&attr);
+       pthread_attr_get_np (pthread_self (), &attr);
+
+       pthread_attr_getstack (&attr, (void**)staddr, stsize);
+       pthread_attr_destroy (&attr);
+}
+
+#endif
index 96a962230e198f0b288d9a80d938340de9ab79ee..7e2e0e21e2e3fe36d2b9e19cef50ef11018b2df5 100644 (file)
@@ -6,7 +6,7 @@
 #include <pthread_np.h>
 
 void
-mono_threads_core_get_stack_bounds (guint8 **staddr, size_t *stsize)
+mono_threads_platform_get_stack_bounds (guint8 **staddr, size_t *stsize)
 {
        /* TODO :   Determine if this code is actually still needed. It may already be covered by the case above. */
        pthread_attr_t attr;
index 7e836163d67856cd520d26234228d9cebb627a90..232161c273a23d6e01aaa1490206975c15039d56 100644 (file)
 #if defined(USE_POSIX_BACKEND)
 
 void
-mono_threads_init_abort_syscall (void)
+mono_threads_abort_syscall_init (void)
 {
        mono_threads_posix_init_signals (MONO_THREADS_POSIX_INIT_SIGNALS_ABORT);
 }
 
 void
-mono_threads_core_abort_syscall (MonoThreadInfo *info)
+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. */
@@ -36,7 +36,7 @@ mono_threads_core_abort_syscall (MonoThreadInfo *info)
 }
 
 gboolean
-mono_threads_core_needs_abort_syscall (void)
+mono_threads_suspend_needs_abort_syscall (void)
 {
        return TRUE;
 }
index adf14f22eaf802f541bcabef1e24cba8fb8f1d99..cbf92bb1ce763ee726ca92b17688d746d38089d2 100644 (file)
@@ -18,6 +18,7 @@
 #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 <errno.h>
 
@@ -31,12 +32,74 @@ extern int tkill (pid_t tid, int signal);
 
 #if defined(_POSIX_VERSION) || defined(__native_client__)
 
+#include <pthread.h>
+
 #include <sys/resource.h>
 
 #if defined(__native_client__)
 void nacl_shutdown_gc_thread(void);
 #endif
 
+typedef struct {
+       pthread_t id;
+       GPtrArray *owned_mutexes;
+       gint32 priority;
+} MonoW32HandleThread;
+
+static gpointer
+thread_handle_create (void)
+{
+       MonoW32HandleThread thread_data;
+       gpointer thread_handle;
+
+       thread_data.id = pthread_self ();
+       thread_data.owned_mutexes = g_ptr_array_new ();
+       thread_data.priority = MONO_THREAD_PRIORITY_NORMAL;
+
+       thread_handle = mono_w32handle_new (MONO_W32HANDLE_THREAD, (gpointer) &thread_data);
+       if (thread_handle == INVALID_HANDLE_VALUE)
+               return NULL;
+
+       /* 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);
+
+       return thread_handle;
+}
+
+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);
+
+/* Necessary to get valid priority range */
+#ifdef _POSIX_PRIORITY_SCHEDULING
+       int max, min;
+
+       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));
+#endif
+
+       switch (policy) {
+       case SCHED_FIFO:
+       case SCHED_RR:
+               return 50;
+#ifdef SCHED_BATCH
+       case SCHED_BATCH:
+#endif
+       case SCHED_OTHER:
+               return 0;
+       default:
+               return -1;
+       }
+}
+
 typedef struct {
        void *(*start_routine)(void*);
        void *arg;
@@ -59,10 +122,9 @@ inner_start_thread (void *arg)
        MonoThreadInfo *info;
 
        /* Register the thread with the io-layer */
-       handle = wapi_create_thread_handle ();
+       handle = thread_handle_create ();
        if (!handle) {
-               res = mono_coop_sem_post (&(start_info->registered));
-               g_assert (!res);
+               mono_coop_sem_post (&(start_info->registered));
                return NULL;
        }
        start_info->handle = handle;
@@ -72,7 +134,7 @@ inner_start_thread (void *arg)
        info->runtime_thread = TRUE;
        info->handle = handle;
 
-       wapi_init_thread_info_priority(handle, start_info->priority);
+       mono_threads_platform_set_priority (info, start_info->priority);
 
        if (flags & CREATE_SUSPENDED) {
                info->create_suspended = TRUE;
@@ -80,8 +142,7 @@ inner_start_thread (void *arg)
        }
 
        /* start_info is not valid after this */
-       res = mono_coop_sem_post (&(start_info->registered));
-       g_assert (!res);
+       mono_coop_sem_post (&(start_info->registered));
        start_info = NULL;
 
        if (flags & CREATE_SUSPENDED) {
@@ -94,12 +155,12 @@ inner_start_thread (void *arg)
        /* Run the actual main function of the thread */
        result = start_func (t_arg);
 
-       mono_threads_core_exit (GPOINTER_TO_UINT (result));
+       mono_threads_platform_exit (GPOINTER_TO_UINT (result));
        g_assert_not_reached ();
 }
 
 HANDLE
-mono_threads_core_create_thread (LPTHREAD_START_ROUTINE start_routine, gpointer arg, MonoThreadParm *tp, MonoNativeThreadId *out_tid)
+mono_threads_platform_create_thread (MonoThreadStart start_routine, gpointer arg, MonoThreadParm *tp, MonoNativeThreadId *out_tid)
 {
        pthread_attr_t attr;
        int res;
@@ -139,7 +200,7 @@ mono_threads_core_create_thread (LPTHREAD_START_ROUTINE start_routine, gpointer
         */ 
        pthread_getschedparam(pthread_self(), &policy, &sp);
        if ((policy == SCHED_FIFO) || (policy == SCHED_RR)) {
-               sp.sched_priority = wapi_thread_priority_to_posix_priority (tp->priority, policy);
+               sp.sched_priority = win32_priority_to_posix_priority (tp->priority, policy);
                res = pthread_attr_setschedparam (&attr, &sp);
        }
 
@@ -170,24 +231,24 @@ mono_threads_core_create_thread (LPTHREAD_START_ROUTINE start_routine, gpointer
 }
 
 /*
- * mono_threads_core_resume_created:
+ * mono_threads_platform_resume_created:
  *
  *   Resume a newly created thread created using CREATE_SUSPENDED.
  */
 void
-mono_threads_core_resume_created (MonoThreadInfo *info, MonoNativeThreadId tid)
+mono_threads_platform_resume_created (MonoThreadInfo *info, MonoNativeThreadId tid)
 {
        mono_coop_sem_post (&info->create_suspended_sem);
 }
 
 gboolean
-mono_threads_core_yield (void)
+mono_threads_platform_yield (void)
 {
        return sched_yield () == 0;
 }
 
 void
-mono_threads_core_exit (int exit_code)
+mono_threads_platform_exit (int exit_code)
 {
        MonoThreadInfo *current = mono_thread_info_current ();
 
@@ -195,7 +256,7 @@ mono_threads_core_exit (int exit_code)
        nacl_shutdown_gc_thread();
 #endif
 
-       wapi_thread_handle_set_exited (current->handle, exit_code);
+       mono_threads_platform_set_exited (current);
 
        mono_thread_info_detach ();
 
@@ -203,16 +264,16 @@ mono_threads_core_exit (int exit_code)
 }
 
 void
-mono_threads_core_unregister (MonoThreadInfo *info)
+mono_threads_platform_unregister (MonoThreadInfo *info)
 {
        if (info->handle) {
-               wapi_thread_handle_set_exited (info->handle, 0);
+               mono_threads_platform_set_exited (info);
                info->handle = NULL;
        }
 }
 
 HANDLE
-mono_threads_core_open_handle (void)
+mono_threads_platform_open_handle (void)
 {
        MonoThreadInfo *info;
 
@@ -220,9 +281,9 @@ mono_threads_core_open_handle (void)
        g_assert (info);
 
        if (!info->handle)
-               info->handle = wapi_create_thread_handle ();
+               info->handle = thread_handle_create ();
        else
-               wapi_ref_thread_handle (info->handle);
+               mono_w32handle_ref (info->handle);
        return info->handle;
 }
 
@@ -241,9 +302,9 @@ mono_threads_get_max_stack_size (void)
 }
 
 HANDLE
-mono_threads_core_open_thread_handle (HANDLE handle, MonoNativeThreadId tid)
+mono_threads_platform_open_thread_handle (HANDLE handle, MonoNativeThreadId tid)
 {
-       wapi_ref_thread_handle (handle);
+       mono_w32handle_ref (handle);
 
        return handle;
 }
@@ -336,12 +397,204 @@ 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)
+{
+       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);
+
+       mono_w32handle_register_capabilities (MONO_W32HANDLE_THREAD, MONO_W32HANDLE_CAP_WAIT);
+}
+
 #endif /* defined(_POSIX_VERSION) || defined(__native_client__) */
 
 #if defined(USE_POSIX_BACKEND)
 
 gboolean
-mono_threads_core_begin_async_suspend (MonoThreadInfo *info, gboolean interrupt_kernel)
+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 ();
 
@@ -353,7 +606,7 @@ mono_threads_core_begin_async_suspend (MonoThreadInfo *info, gboolean interrupt_
 }
 
 gboolean
-mono_threads_core_check_suspend_result (MonoThreadInfo *info)
+mono_threads_suspend_check_suspend_result (MonoThreadInfo *info)
 {
        return info->suspend_can_continue;
 }
@@ -365,27 +618,30 @@ This begins async resume. This function must do the following:
 - Notify the target to resume.
 */
 gboolean
-mono_threads_core_begin_async_resume (MonoThreadInfo *info)
+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;
 }
 
 void
-mono_threads_platform_register (MonoThreadInfo *info)
+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
-mono_threads_platform_free (MonoThreadInfo *info)
+mono_threads_suspend_free (MonoThreadInfo *info)
 {
 }
 
 void
-mono_threads_init_platform (void)
+mono_threads_suspend_init (void)
 {
        mono_threads_posix_init_signals (MONO_THREADS_POSIX_INIT_SIGNALS_SUSPEND_RESTART);
 }
index bf3cf242f65e9fdea3656cbbf3ea61ea4815b52c..19afe3e6b8e0d4276d3abb4aa01d328a0f291407 100644 (file)
@@ -17,7 +17,7 @@
 #include <limits.h>
 
 void
-mono_threads_init_abort_syscall (void)
+mono_threads_abort_syscall_init (void)
 {
 }
 
@@ -27,7 +27,7 @@ abort_apc (ULONG_PTR param)
 }
 
 void
-mono_threads_core_abort_syscall (MonoThreadInfo *info)
+mono_threads_suspend_abort_syscall (MonoThreadInfo *info)
 {
        DWORD id = mono_thread_info_get_tid (info);
        HANDLE handle;
@@ -41,7 +41,7 @@ mono_threads_core_abort_syscall (MonoThreadInfo *info)
 }
 
 gboolean
-mono_threads_core_needs_abort_syscall (void)
+mono_threads_suspend_needs_abort_syscall (void)
 {
        return TRUE;
 }
index 1b9dd43daf1f9350fc5aac916c862b8ae42c7451..034200d3173aad0a237c32cacca1de5785d616f7 100644 (file)
@@ -16,7 +16,7 @@
 
 
 void
-mono_threads_init_platform (void)
+mono_threads_suspend_init (void)
 {
 }
 
@@ -26,7 +26,7 @@ interrupt_apc (ULONG_PTR param)
 }
 
 gboolean
-mono_threads_core_begin_async_suspend (MonoThreadInfo *info, gboolean interrupt_kernel)
+mono_threads_suspend_begin_async_suspend (MonoThreadInfo *info, gboolean interrupt_kernel)
 {
        DWORD id = mono_thread_info_get_tid (info);
        HANDLE handle;
@@ -67,13 +67,13 @@ mono_threads_core_begin_async_suspend (MonoThreadInfo *info, gboolean interrupt_
 }
 
 gboolean
-mono_threads_core_check_suspend_result (MonoThreadInfo *info)
+mono_threads_suspend_check_suspend_result (MonoThreadInfo *info)
 {
        return info->suspend_can_continue;
 }
 
 gboolean
-mono_threads_core_begin_async_resume (MonoThreadInfo *info)
+mono_threads_suspend_begin_async_resume (MonoThreadInfo *info)
 {
        DWORD id = mono_thread_info_get_tid (info);
        HANDLE handle;
@@ -119,12 +119,12 @@ mono_threads_core_begin_async_resume (MonoThreadInfo *info)
 
 
 void
-mono_threads_platform_register (MonoThreadInfo *info)
+mono_threads_suspend_register (MonoThreadInfo *info)
 {
 }
 
 void
-mono_threads_platform_free (MonoThreadInfo *info)
+mono_threads_suspend_free (MonoThreadInfo *info)
 {
 }
 
@@ -156,8 +156,7 @@ inner_start_thread (LPVOID arg)
        info->runtime_thread = TRUE;
        info->create_suspended = suspend;
 
-       post_result = mono_coop_sem_post (&(start_info->registered));
-       g_assert (!post_result);
+       mono_coop_sem_post (&(start_info->registered));
 
        if (suspend) {
                WaitForSingleObject (suspend_event, INFINITE); /* caller will suspend the thread before setting the event. */
@@ -172,7 +171,7 @@ inner_start_thread (LPVOID arg)
 }
 
 HANDLE
-mono_threads_core_create_thread (LPTHREAD_START_ROUTINE start_routine, gpointer arg, MonoThreadParm *tp, MonoNativeThreadId *out_tid)
+mono_threads_platform_create_thread (MonoThreadStart start_routine, gpointer arg, MonoThreadParm *tp, MonoNativeThreadId *out_tid)
 {
        ThreadStartInfo *start_info;
        HANDLE result;
@@ -233,7 +232,7 @@ mono_native_thread_create (MonoNativeThreadId *tid, gpointer func, gpointer arg)
 }
 
 void
-mono_threads_core_resume_created (MonoThreadInfo *info, MonoNativeThreadId tid)
+mono_threads_platform_resume_created (MonoThreadInfo *info, MonoNativeThreadId tid)
 {
        HANDLE handle;
 
@@ -256,7 +255,7 @@ __readfsdword (unsigned long offset)
 #endif
 
 void
-mono_threads_core_get_stack_bounds (guint8 **staddr, size_t *stsize)
+mono_threads_platform_get_stack_bounds (guint8 **staddr, size_t *stsize)
 {
        MEMORY_BASIC_INFORMATION meminfo;
 #ifdef _WIN64
@@ -284,24 +283,24 @@ mono_threads_core_get_stack_bounds (guint8 **staddr, size_t *stsize)
 }
 
 gboolean
-mono_threads_core_yield (void)
+mono_threads_platform_yield (void)
 {
        return SwitchToThread ();
 }
 
 void
-mono_threads_core_exit (int exit_code)
+mono_threads_platform_exit (int exit_code)
 {
        ExitThread (exit_code);
 }
 
 void
-mono_threads_core_unregister (MonoThreadInfo *info)
+mono_threads_platform_unregister (MonoThreadInfo *info)
 {
 }
 
 HANDLE
-mono_threads_core_open_handle (void)
+mono_threads_platform_open_handle (void)
 {
        HANDLE thread_handle;
 
@@ -326,7 +325,7 @@ mono_threads_get_max_stack_size (void)
 }
 
 HANDLE
-mono_threads_core_open_thread_handle (HANDLE handle, MonoNativeThreadId tid)
+mono_threads_platform_open_thread_handle (HANDLE handle, MonoNativeThreadId tid)
 {
        return OpenThread (THREAD_ALL_ACCESS, TRUE, tid);
 }
@@ -363,4 +362,44 @@ 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)
+{
+       return GetThreadPriority (info->handle) + 2;
+}
+
+gboolean
+mono_threads_platform_set_priority (MonoThreadInfo *info, MonoThreadPriority priority)
+{
+       return SetThreadPriority (info->handle, priority - 2);
+}
+
+void
+mono_threads_platform_init (void)
+{
+}
+
 #endif
index 6ebe007a3c6d583db8d05fd2a724a81e10b76cc8..23a3e759815e66268a5b2504f2ba32e62f23ea6e 100644 (file)
@@ -76,11 +76,11 @@ static gboolean unified_suspend_enabled;
 #define mono_thread_info_run_state(info) (((MonoThreadInfo*)info)->thread_state & THREAD_STATE_MASK)
 
 /*warn at 50 ms*/
-#define SLEEP_DURATION_BEFORE_WARNING (10)
-/*abort at 1 sec*/
-#define SLEEP_DURATION_BEFORE_ABORT 200
+#define SLEEP_DURATION_BEFORE_WARNING (50)
+/*never aborts */
+#define SLEEP_DURATION_BEFORE_ABORT MONO_INFINITE_WAIT
 
-static long sleepWarnDuration = SLEEP_DURATION_BEFORE_WARNING,
+static guint32 sleepWarnDuration = SLEEP_DURATION_BEFORE_WARNING,
            sleepAbortDuration = SLEEP_DURATION_BEFORE_ABORT;
 
 static int suspend_posts, resume_posts, abort_posts, waits_done, pending_ops;
@@ -118,7 +118,7 @@ begin_async_suspend (MonoThreadInfo *info, gboolean interrupt_kernel)
                return TRUE;
        }
 
-       return mono_threads_core_begin_async_suspend (info, interrupt_kernel);
+       return mono_threads_suspend_begin_async_suspend (info, interrupt_kernel);
 }
 
 static gboolean
@@ -129,7 +129,7 @@ check_async_suspend (MonoThreadInfo *info)
                return TRUE;
        }
 
-       return mono_threads_core_check_suspend_result (info);
+       return mono_threads_suspend_check_suspend_result (info);
 }
 
 static void
@@ -138,7 +138,7 @@ resume_async_suspended (MonoThreadInfo *info)
        if (mono_threads_is_coop_enabled ())
                g_assert_not_reached ();
 
-       g_assert (mono_threads_core_begin_async_resume (info));
+       g_assert (mono_threads_suspend_begin_async_resume (info));
 }
 
 static void
@@ -238,7 +238,7 @@ mono_threads_wait_pending_operations (void)
                for (i = 0; i < pending_suspends; ++i) {
                        THREADS_SUSPEND_DEBUG ("[INITIATOR-WAIT-WAITING]\n");
                        InterlockedIncrement (&waits_done);
-                       if (!mono_os_sem_timedwait (&suspend_semaphore, sleepAbortDuration, MONO_SEM_FLAGS_NONE))
+                       if (mono_os_sem_timedwait (&suspend_semaphore, sleepAbortDuration, MONO_SEM_FLAGS_NONE) == MONO_SEM_TIMEDWAIT_RET_SUCCESS)
                                continue;
                        mono_stopwatch_stop (&suspension_time);
 
@@ -322,7 +322,7 @@ free_thread_info (gpointer mem)
        MonoThreadInfo *info = (MonoThreadInfo *) mem;
 
        mono_os_sem_destroy (&info->resume_semaphore);
-       mono_threads_platform_free (info);
+       mono_threads_suspend_free (info);
 
        g_free (info);
 }
@@ -359,6 +359,7 @@ register_thread (MonoThreadInfo *info, gpointer baseptr)
        if (threads_callbacks.thread_register) {
                if (threads_callbacks.thread_register (info, baseptr) == NULL) {
                        // g_warning ("thread registation failed\n");
+                       mono_native_tls_set_value (thread_info_key, NULL);
                        g_free (info);
                        return NULL;
                }
@@ -372,7 +373,7 @@ register_thread (MonoThreadInfo *info, gpointer baseptr)
 
        info->stackdata = g_byte_array_new ();
 
-       mono_threads_platform_register (info);
+       mono_threads_suspend_register (info);
 
        /*
        Transition it before taking any locks or publishing itself to reduce the chance
@@ -412,7 +413,7 @@ unregister_thread (void *arg)
 
        mono_native_tls_set_value (thread_exited_key, GUINT_TO_POINTER (1));
 
-       mono_threads_core_unregister (info);
+       mono_threads_platform_unregister (info);
 
        /*
         * TLS destruction order is not reliable so small_id might be cleaned up
@@ -642,7 +643,7 @@ mono_threads_init (MonoThreadInfoCallbacks *callbacks, size_t info_size)
        gboolean res;
        threads_callbacks = *callbacks;
        thread_info_size = info_size;
-       char *sleepLimit;
+       const char *sleepLimit;
 #ifdef HOST_WIN32
        res = mono_native_tls_alloc (&thread_info_key, NULL);
        res = mono_native_tls_alloc (&thread_exited_key, NULL);
@@ -661,6 +662,7 @@ mono_threads_init (MonoThreadInfoCallbacks *callbacks, size_t info_size)
        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);
                if ((errno == 0) && (threshold >= 40))  {
                        sleepAbortDuration = threshold;
@@ -674,9 +676,10 @@ mono_threads_init (MonoThreadInfoCallbacks *callbacks, size_t info_size)
 
        mono_lls_init (&thread_list, NULL, HAZARD_FREE_NO_LOCK);
        mono_thread_smr_init ();
-       mono_threads_init_platform ();
-       mono_threads_init_coop ();
-       mono_threads_init_abort_syscall ();
+       mono_threads_platform_init ();
+       mono_threads_suspend_init ();
+       mono_threads_coop_init ();
+       mono_threads_abort_syscall_init ();
 
 #if defined(__MACH__)
        mono_mach_init (thread_info_key);
@@ -750,7 +753,7 @@ mono_thread_info_core_resume (MonoThreadInfo *info)
                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_core_resume_created (info, tid);
+               mono_threads_platform_resume_created (info, tid);
                return TRUE;
        }
 
@@ -904,7 +907,7 @@ suspend_sync (MonoNativeThreadId tid, gboolean interrupt_kernel)
                break;
        case AsyncSuspendBlocking:
                if (interrupt_kernel)
-                       mono_threads_core_abort_syscall (info);
+                       mono_threads_suspend_abort_syscall (info);
 
                break;
        default:
@@ -1060,7 +1063,7 @@ mono_thread_info_abort_socket_syscall_for_close (MonoNativeThreadId tid)
        MonoThreadHazardPointers *hp;
        MonoThreadInfo *info;
 
-       if (tid == mono_native_thread_id_get () || !mono_threads_core_needs_abort_syscall ())
+       if (tid == mono_native_thread_id_get () || !mono_threads_suspend_needs_abort_syscall ())
                return;
 
        hp = mono_hazard_pointer_get ();
@@ -1076,7 +1079,7 @@ mono_thread_info_abort_socket_syscall_for_close (MonoNativeThreadId tid)
        mono_thread_info_suspend_lock ();
        mono_threads_begin_global_suspend ();
 
-       mono_threads_core_abort_syscall (info);
+       mono_threads_suspend_abort_syscall (info);
        mono_threads_wait_pending_operations ();
 
        mono_hazard_pointer_clear (hp, 1);
@@ -1124,9 +1127,9 @@ mono_thread_info_is_async_context (void)
  * Returns: a windows or io-layer handle for the thread.
  */
 HANDLE
-mono_threads_create_thread (LPTHREAD_START_ROUTINE start, gpointer arg, MonoThreadParm *tp, MonoNativeThreadId *out_tid)
+mono_threads_create_thread (MonoThreadStart start, gpointer arg, MonoThreadParm *tp, MonoNativeThreadId *out_tid)
 {
-       return mono_threads_core_create_thread (start, arg, tp, out_tid);
+       return mono_threads_platform_create_thread (start, arg, tp, out_tid);
 }
 
 /*
@@ -1139,7 +1142,7 @@ void
 mono_thread_info_get_stack_bounds (guint8 **staddr, size_t *stsize)
 {
        guint8 *current = (guint8 *)&stsize;
-       mono_threads_core_get_stack_bounds (staddr, stsize);
+       mono_threads_platform_get_stack_bounds (staddr, stsize);
        if (!*staddr)
                return;
 
@@ -1153,7 +1156,7 @@ mono_thread_info_get_stack_bounds (guint8 **staddr, size_t *stsize)
 gboolean
 mono_thread_info_yield (void)
 {
-       return mono_threads_core_yield ();
+       return mono_threads_platform_yield ();
 }
 static mono_lazy_init_t sleep_init = MONO_LAZY_INIT_STATUS_NOT_INITIALIZED;
 static MonoCoopMutex sleep_mutex;
@@ -1327,7 +1330,7 @@ mono_thread_info_tls_set (THREAD_INFO_TYPE *info, MonoTlsKey key, gpointer value
 void
 mono_thread_info_exit (void)
 {
-       mono_threads_core_exit (0);
+       mono_threads_platform_exit (0);
 }
 
 /*
@@ -1340,7 +1343,7 @@ mono_thread_info_exit (void)
 HANDLE
 mono_thread_info_open_handle (void)
 {
-       return mono_threads_core_open_handle ();
+       return mono_threads_platform_open_handle ();
 }
 
 /*
@@ -1353,7 +1356,7 @@ mono_thread_info_open_handle (void)
 HANDLE
 mono_threads_open_thread_handle (HANDLE handle, MonoNativeThreadId tid)
 {
-       return mono_threads_core_open_thread_handle (handle, tid);
+       return mono_threads_platform_open_thread_handle (handle, tid);
 }
 
 #define INTERRUPT_STATE ((MonoThreadInfoInterruptToken*) (size_t) -1)
@@ -1561,3 +1564,47 @@ 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)
+{
+       g_assert (mono_thread_info_is_current (info));
+       mono_threads_platform_set_exited (info);
+}
+
+gpointer
+mono_thread_info_get_handle (THREAD_INFO_TYPE *info)
+{
+       g_assert (info->handle);
+       return info->handle;
+}
+
+void
+mono_thread_info_describe (MonoThreadInfo *info, GString *text)
+{
+       mono_threads_platform_describe (info, text);
+}
+
+void
+mono_thread_info_own_mutex (MonoThreadInfo *info, gpointer mutex_handle)
+{
+       mono_threads_platform_own_mutex (info, mutex_handle);
+}
+
+void
+mono_thread_info_disown_mutex (MonoThreadInfo *info, gpointer mutex_handle)
+{
+       mono_threads_platform_disown_mutex (info, mutex_handle);
+}
+
+MonoThreadPriority
+mono_thread_info_get_priority (MonoThreadInfo *info)
+{
+       return mono_threads_platform_get_priority (info);
+}
+
+gboolean
+mono_thread_info_set_priority (MonoThreadInfo *info, MonoThreadPriority priority)
+{
+       return mono_threads_platform_set_priority (info, priority);
+}
index eaab83591e53a1fbc9fdf8f6341b82976155ade6..6e74ec9fb8aa0ef95f5dbabcb429cc35dd680f24 100644 (file)
@@ -32,6 +32,8 @@ typedef DWORD mono_native_thread_return_t;
 #define MONO_NATIVE_THREAD_ID_TO_UINT(tid) (tid)
 #define MONO_UINT_TO_NATIVE_THREAD_ID(tid) ((MonoNativeThreadId)(tid))
 
+typedef LPTHREAD_START_ROUTINE MonoThreadStart;
+
 #else
 
 #include <pthread.h>
@@ -56,6 +58,8 @@ typedef void* mono_native_thread_return_t;
 #define MONO_NATIVE_THREAD_ID_TO_UINT(tid) (gsize)(tid)
 #define MONO_UINT_TO_NATIVE_THREAD_ID(tid) (MonoNativeThreadId)(gsize)(tid)
 
+typedef gsize (*MonoThreadStart)(gpointer);
+
 #endif /* #ifdef HOST_WIN32 */
 
 /*
@@ -289,6 +293,14 @@ typedef struct {
        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)
 {
@@ -425,6 +437,9 @@ mono_thread_info_exit (void);
 HANDLE
 mono_thread_info_open_handle (void);
 
+void
+mono_thread_info_set_exited (THREAD_INFO_TYPE *info);
+
 void
 mono_thread_info_install_interrupt (void (*callback) (gpointer data), gpointer data, gboolean *interrupted);
 
@@ -453,7 +468,7 @@ gboolean
 mono_thread_info_is_live (THREAD_INFO_TYPE *info);
 
 HANDLE
-mono_threads_create_thread (LPTHREAD_START_ROUTINE start, gpointer arg, MonoThreadParm *tp, MonoNativeThreadId *out_tid);
+mono_threads_create_thread (MonoThreadStart start, gpointer arg, MonoThreadParm *tp, MonoNativeThreadId *out_tid);
 
 int
 mono_threads_get_max_stack_size (void);
@@ -480,11 +495,13 @@ mono_threads_pthread_kill (THREAD_INFO_TYPE *info, int signum);
 This is called very early in the runtime, it cannot access any runtime facilities.
 
 */
-void mono_threads_init_platform (void); //ok
+void mono_threads_suspend_init (void); //ok
+
+void mono_threads_platform_init (void);
 
-void mono_threads_init_coop (void);
+void mono_threads_coop_init (void);
 
-void mono_threads_init_abort_syscall (void);
+void mono_threads_abort_syscall_init (void);
 
 /*
 This begins async suspend. This function must do the following:
@@ -495,7 +512,7 @@ This begins async suspend. This function must do the following:
 
 If begin suspend fails the thread must be left uninterrupted and resumed.
 */
-gboolean mono_threads_core_begin_async_suspend (THREAD_INFO_TYPE *info, gboolean interrupt_kernel);
+gboolean mono_threads_suspend_begin_async_suspend (THREAD_INFO_TYPE *info, gboolean interrupt_kernel);
 
 /*
 This verifies the outcome of an async suspend operation.
@@ -503,7 +520,7 @@ This verifies the outcome of an async suspend operation.
 Some targets, such as posix, verify suspend results assynchronously. Suspend results must be
 available (in a non blocking way) after mono_threads_wait_pending_operations completes.
 */
-gboolean mono_threads_core_check_suspend_result (THREAD_INFO_TYPE *info);
+gboolean mono_threads_suspend_check_suspend_result (THREAD_INFO_TYPE *info);
 
 /*
 This begins async resume. This function must do the following:
@@ -512,20 +529,27 @@ This begins async resume. This function must do the following:
 - Notify the target to resume.
 - Register the thread for pending ack with mono_threads_add_to_pending_operation_set if needed.
 */
-gboolean mono_threads_core_begin_async_resume (THREAD_INFO_TYPE *info);
-
-void mono_threads_platform_register (THREAD_INFO_TYPE *info); //ok
-void mono_threads_platform_free (THREAD_INFO_TYPE *info);
-void mono_threads_core_abort_syscall (THREAD_INFO_TYPE *info);
-gboolean mono_threads_core_needs_abort_syscall (void);
-HANDLE mono_threads_core_create_thread (LPTHREAD_START_ROUTINE start, gpointer arg, MonoThreadParm *, MonoNativeThreadId *out_tid);
-void mono_threads_core_resume_created (THREAD_INFO_TYPE *info, MonoNativeThreadId tid);
-void mono_threads_core_get_stack_bounds (guint8 **staddr, size_t *stsize);
-gboolean mono_threads_core_yield (void);
-void mono_threads_core_exit (int exit_code);
-void mono_threads_core_unregister (THREAD_INFO_TYPE *info);
-HANDLE mono_threads_core_open_handle (void);
-HANDLE mono_threads_core_open_thread_handle (HANDLE handle, MonoNativeThreadId tid);
+gboolean mono_threads_suspend_begin_async_resume (THREAD_INFO_TYPE *info);
+
+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);
+
+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);
+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_coop_begin_global_suspend (void);
 void mono_threads_coop_end_global_suspend (void);
@@ -640,4 +664,22 @@ 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);
+
+MonoThreadPriority
+mono_thread_info_get_priority (THREAD_INFO_TYPE *info);
+
+gboolean
+mono_thread_info_set_priority (THREAD_INFO_TYPE *info, MonoThreadPriority priority);
+
 #endif /* __MONO_THREADS_H__ */
diff --git a/mono/utils/w32handle.c b/mono/utils/w32handle.c
new file mode 100644 (file)
index 0000000..9b51b0f
--- /dev/null
@@ -0,0 +1,1165 @@
+/*
+ * 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
new file mode 100644 (file)
index 0000000..0ba409f
--- /dev/null
@@ -0,0 +1,186 @@
+
+#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 e7ad3d3cf9cf917e1787b8b3a0288d28655bab86..7d588b915df6e8e499648bbd642f9bad0b5a96b0 100755 (executable)
@@ -30,7 +30,7 @@ push @symbols, "MonoFixupCorEE";
 
 open (OUT, ">$outfile") || die "Cannot open '$outfile': $!\n";
 print OUT "; file generated by create-windef.pl\n";
-#print OUT "LIBRARY $dllname\nEXPORTS\n";
+print OUT "EXPORTS\n";
 print OUT join ("\n", @symbols);
 print OUT "\n";
 
index e09803d25e2400abc0d38f41ca1c7d669c41c83f..94a7127d7318cad19bd892a6f7e50eb800455856 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\gtimer-win32.c" />\r
     <ClCompile Include="..\eglib\src\gunicode.c" />\r
     <ClCompile Include="..\eglib\src\gutf8.c" />\r
-    <ClCompile Include="..\eglib\src\vasprintf.c" />\r
   </ItemGroup>\r
   <ItemGroup>\r
     <ClInclude Include="..\eglib\src\glib.h" />\r
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />\r
   <ImportGroup Label="ExtensionTargets">\r
   </ImportGroup>\r
-</Project>
\ No newline at end of file
+</Project>\r
diff --git a/msvc/libmono-static.vcxproj b/msvc/libmono-static.vcxproj
new file mode 100644 (file)
index 0000000..6628317
--- /dev/null
@@ -0,0 +1,340 @@
+<?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="Debug|x64">\r
+      <Configuration>Debug</Configuration>\r
+      <Platform>x64</Platform>\r
+    </ProjectConfiguration>\r
+    <ProjectConfiguration Include="Release|Win32">\r
+      <Configuration>Release</Configuration>\r
+      <Platform>Win32</Platform>\r
+    </ProjectConfiguration>\r
+    <ProjectConfiguration Include="Release|x64">\r
+      <Configuration>Release</Configuration>\r
+      <Platform>x64</Platform>\r
+    </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
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>\r
+    </ClCompile>\r
+    <ClCompile Include="..\mono\mini\exceptions-x86.c">\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>\r
+    </ClCompile>\r
+    <ClCompile Include="..\mono\mini\mini-amd64.c">\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>\r
+    </ClCompile>\r
+    <ClCompile Include="..\mono\mini\mini-amd64-gsharedvt.c">\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>\r
+    </ClCompile>\r
+    <ClCompile Include="..\mono\mini\mini-runtime.c" />\r
+    <ClCompile Include="..\mono\mini\mini-windows.c" />\r
+    <ClCompile Include="..\mono\mini\mini-x86.c">\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>\r
+    </ClCompile>\r
+    <ClCompile Include="..\mono\mini\mini-x86-gsharedvt.c">\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>\r
+    </ClCompile>\r
+    <ClCompile Include="..\mono\mini\mini.c" />\r
+    <ClInclude Include="..\mono\metadata\remoting.h" />\r
+    <ClInclude Include="..\mono\mini\ir-emit.h" />\r
+    <ClCompile Include="..\mono\mini\method-to-ir.c" />\r
+    <ClCompile Include="..\mono\mini\decompose.c" />\r
+    <ClInclude Include="..\mono\mini\mini-amd64.h">\r
+      <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-amd64-gsharedvt.h">\r
+      <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-x86.h">\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>\r
+    </ClInclude>\r
+    <ClInclude Include="..\mono\mini\mini.h" />\r
+    <ClInclude Include="..\mono\mini\seq-points.h" />\r
+    <ClInclude Include="..\mono\mini\version.h" />\r
+    <ClInclude Include="..\mono\mini\optflags-def.h" />\r
+    <ClInclude Include="..\mono\mini\cfgdump.h" />\r
+    <ClCompile Include="..\mono\mini\cfgdump.c" />\r
+    <ClInclude Include="..\mono\mini\jit-icalls.h " />\r
+    <ClCompile Include="..\mono\mini\jit-icalls.c " />\r
+    <ClCompile Include="..\mono\mini\seq-points.c" />\r
+    <ClCompile Include="..\mono\mini\trace.c" />\r
+    <ClInclude Include="..\mono\mini\trace.h" />\r
+    <ClInclude Include="..\mono\mini\patch-info.h" />\r
+    <ClInclude Include="..\mono\mini\mini-ops.h" />\r
+    <ClInclude Include="..\mono\mini\mini-arch.h" />\r
+    <ClCompile Include="..\mono\mini\dominators.c" />\r
+    <ClCompile Include="..\mono\mini\cfold.c" />\r
+    <ClInclude Include="..\mono\mini\regalloc.h" />\r
+    <ClCompile Include="..\mono\mini\helpers.c" />\r
+    <ClCompile Include="..\mono\mini\liveness.c" />\r
+    <ClCompile Include="..\mono\mini\ssa.c" />\r
+    <ClCompile Include="..\mono\mini\abcremoval.c" />\r
+    <ClInclude Include="..\mono\mini\abcremoval.h" />\r
+    <ClCompile Include="..\mono\mini\local-propagation.c" />\r
+    <ClCompile Include="..\mono\mini\driver.c" />\r
+    <ClCompile Include="..\mono\mini\debug-mini.c" />\r
+    <ClCompile Include="..\mono\mini\linear-scan.c" />\r
+    <ClCompile Include="..\mono\mini\aot-compiler.c" />\r
+    <ClCompile Include="..\mono\mini\aot-runtime.c" />\r
+    <ClCompile Include="..\mono\mini\graph.c" />\r
+    <ClCompile Include="..\mono\mini\mini-codegen.c" />\r
+    <ClCompile Include="..\mono\mini\mini-cross-helpers.c" />\r
+    <ClCompile Include="..\mono\mini\mini-exceptions.c" />\r
+    <ClCompile Include="..\mono\mini\mini-exceptions-native-unwinder.c" />\r
+    <ClCompile Include="..\mono\mini\mini-trampolines.c  " />\r
+    <ClCompile Include="..\mono\mini\tramp-amd64.c">\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>\r
+    </ClCompile>\r
+    <ClCompile Include="..\mono\mini\tramp-amd64-gsharedvt.c">\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>\r
+    </ClCompile>\r
+    <ClCompile Include="..\mono\mini\tramp-x86.c">\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>\r
+    </ClCompile>\r
+    <ClCompile Include="..\mono\mini\tramp-x86-gsharedvt.c">\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>\r
+    </ClCompile>\r
+    <ClCompile Include="..\mono\mini\branch-opts.c" />\r
+    <ClCompile Include="..\mono\mini\mini-generic-sharing.c" />\r
+    <ClInclude Include="..\mono\mini\simd-methods.h" />\r
+    <ClCompile Include="..\mono\mini\tasklets.c" />\r
+    <ClInclude Include="..\mono\mini\tasklets.h" />\r
+    <ClCompile Include="..\mono\mini\simd-intrinsics.c" />\r
+    <ClInclude Include="..\mono\mini\mini-unwind.h" />\r
+    <ClCompile Include="..\mono\mini\unwind.c" />\r
+    <ClInclude Include="..\mono\mini\image-writer.h" />\r
+    <ClCompile Include="..\mono\mini\image-writer.c" />\r
+    <ClInclude Include="..\mono\mini\dwarfwriter.h" />\r
+    <ClCompile Include="..\mono\mini\dwarfwriter.c" />\r
+    <ClInclude Include="..\mono\mini\mini-gc.h" />\r
+    <ClCompile Include="..\mono\mini\mini-gc.c" />\r
+    <ClInclude Include="..\mono\mini\debugger-agent.h " />\r
+    <ClCompile Include="..\mono\mini\debugger-agent.c" />\r
+    <ClCompile Include="..\mono\mini\xdebug.c" />\r
+    <ClInclude Include="..\mono\mini\mini-llvm.h" />\r
+    <ClInclude Include="..\mono\mini\mini-llvm-cpp.h" />\r
+    <ClCompile Include="..\mono\mini\mini-native-types.c" />\r
+  </ItemGroup>\r
+  <PropertyGroup Label="Globals">\r
+    <ProjectGuid>{CB0D9E92-293C-439C-9AC7-C5F59B6E0772}</ProjectGuid>\r
+    <RootNamespace>libmono-static</RootNamespace>\r
+    <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>\r
+  </PropertyGroup>\r
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">\r
+    <ConfigurationType>StaticLibrary</ConfigurationType>\r
+    <CharacterSet>Unicode</CharacterSet>\r
+    <PlatformToolset>v140</PlatformToolset>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">\r
+    <ConfigurationType>StaticLibrary</ConfigurationType>\r
+    <CharacterSet>Unicode</CharacterSet>\r
+    <PlatformToolset>v140</PlatformToolset>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">\r
+    <ConfigurationType>StaticLibrary</ConfigurationType>\r
+    <CharacterSet>Unicode</CharacterSet>\r
+    <PlatformToolset>v140</PlatformToolset>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">\r
+    <ConfigurationType>StaticLibrary</ConfigurationType>\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 Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">\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
+  </ImportGroup>\r
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">\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
+  </ImportGroup>\r
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">\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
+  </ImportGroup>\r
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">\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
+  </ImportGroup>\r
+  <PropertyGroup Label="UserMacros" />\r
+  <PropertyGroup>\r
+    <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectName)$(MONO_TARGET_SUFFIX)</TargetName>\r
+    <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(ProjectName)$(MONO_TARGET_SUFFIX)</TargetName>\r
+    <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectName)$(MONO_TARGET_SUFFIX)</TargetName>\r
+    <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(ProjectName)$(MONO_TARGET_SUFFIX)</TargetName>\r
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(MONO_BUILD_DIR_PREFIX)$(Platform)\lib\$(Configuration)\</OutDir>\r
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(MONO_BUILD_DIR_PREFIX)$(Platform)\lib\$(Configuration)\</OutDir>\r
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(MONO_BUILD_DIR_PREFIX)$(Platform)\lib\$(Configuration)\</OutDir>\r
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(MONO_BUILD_DIR_PREFIX)$(Platform)\lib\$(Configuration)\</OutDir>\r
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(MONO_BUILD_DIR_PREFIX)$(Platform)\obj\$(ProjectName)$(MONO_TARGET_SUFFIX)\$(Configuration)\</IntDir>\r
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(MONO_BUILD_DIR_PREFIX)$(Platform)\obj\$(ProjectName)$(MONO_TARGET_SUFFIX)\$(Configuration)\</IntDir>\r
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(MONO_BUILD_DIR_PREFIX)$(Platform)\obj\$(ProjectName)$(MONO_TARGET_SUFFIX)\$(Configuration)\</IntDir>\r
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(MONO_BUILD_DIR_PREFIX)$(Platform)\obj\$(ProjectName)$(MONO_TARGET_SUFFIX)\$(Configuration)\</IntDir>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
+    <LinkIncremental>true</LinkIncremental>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">\r
+    <LinkIncremental>true</LinkIncremental>\r
+  </PropertyGroup>\r
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
+    <PreBuildEvent>\r
+      <Command>\r
+      </Command>\r
+    </PreBuildEvent>\r
+    <ClCompile>\r
+      <AdditionalOptions>/D /NODEFAULTLIB:LIBCD" " %(AdditionalOptions)</AdditionalOptions>\r
+      <Optimization>Disabled</Optimization>\r
+      <AdditionalIncludeDirectories>$(MONO_DIR);$(LIBGC_CPPFLAGS_INCLUDE);$(GLIB_CFLAGS_INCLUDE);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
+      <PreprocessorDefinitions>WIN32;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+      <MinimalRebuild>true</MinimalRebuild>\r
+      <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>\r
+      <PrecompiledHeader>\r
+      </PrecompiledHeader>\r
+      <BrowseInformation>false</BrowseInformation>\r
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>\r
+      <DisableSpecificWarnings>4996;4018;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>\r
+      <ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>\r
+    </ClCompile>\r
+    <Link>\r
+      <SubSystem>Windows</SubSystem>\r
+    </Link>\r
+    <PostBuildEvent>\r
+      <Command>.\libmono.bat "$(MONO_INCLUDE_DIR)" "$(SolutionDir)include\mono" -q</Command>\r
+    </PostBuildEvent>\r
+  </ItemDefinitionGroup>\r
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">\r
+    <PreBuildEvent>\r
+      <Command>\r
+      </Command>\r
+    </PreBuildEvent>\r
+    <ClCompile>\r
+      <AdditionalOptions>/D /NODEFAULTLIB:LIBCD" " %(AdditionalOptions)</AdditionalOptions>\r
+      <Optimization>Disabled</Optimization>\r
+      <AdditionalIncludeDirectories>$(MONO_DIR);$(LIBGC_CPPFLAGS_INCLUDE);$(GLIB_CFLAGS_INCLUDE);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
+      <PreprocessorDefinitions>WIN32;WIN64;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+      <MinimalRebuild>true</MinimalRebuild>\r
+      <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>\r
+      <PrecompiledHeader>\r
+      </PrecompiledHeader>\r
+      <BrowseInformation>false</BrowseInformation>\r
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>\r
+      <DisableSpecificWarnings>4996;4018;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>\r
+      <ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>\r
+    </ClCompile>\r
+    <Link>\r
+      <SubSystem>Windows</SubSystem>\r
+    </Link>\r
+    <PostBuildEvent>\r
+      <Command>.\libmono.bat "$(MONO_INCLUDE_DIR)" "$(SolutionDir)include\mono" -q</Command>\r
+    </PostBuildEvent>\r
+  </ItemDefinitionGroup>\r
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">\r
+    <PreBuildEvent>\r
+      <Command>\r
+      </Command>\r
+    </PreBuildEvent>\r
+    <ClCompile>\r
+      <AdditionalOptions>/D /NODEFAULTLIB:LIBCD" " %(AdditionalOptions)</AdditionalOptions>\r
+      <Optimization>MaxSpeed</Optimization>\r
+      <IntrinsicFunctions>true</IntrinsicFunctions>\r
+      <AdditionalIncludeDirectories>$(MONO_DIR);$(LIBGC_CPPFLAGS_INCLUDE);$(GLIB_CFLAGS_INCLUDE);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
+      <PreprocessorDefinitions>WIN32;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+      <FunctionLevelLinking>true</FunctionLevelLinking>\r
+      <PrecompiledHeader>\r
+      </PrecompiledHeader>\r
+      <ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>\r
+    </ClCompile>\r
+    <Link>\r
+      <SubSystem>Windows</SubSystem>\r
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>\r
+      <OptimizeReferences>true</OptimizeReferences>\r
+    </Link>\r
+    <PostBuildEvent>\r
+      <Command>.\libmono.bat "$(MONO_INCLUDE_DIR)" "$(SolutionDir)include\mono" -q</Command>\r
+    </PostBuildEvent>\r
+  </ItemDefinitionGroup>\r
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">\r
+    <PreBuildEvent>\r
+      <Command>\r
+      </Command>\r
+    </PreBuildEvent>\r
+    <ClCompile>\r
+      <AdditionalOptions>/D /NODEFAULTLIB:LIBCD" " %(AdditionalOptions)</AdditionalOptions>\r
+      <Optimization>MaxSpeed</Optimization>\r
+      <IntrinsicFunctions>true</IntrinsicFunctions>\r
+      <AdditionalIncludeDirectories>$(MONO_DIR);$(LIBGC_CPPFLAGS_INCLUDE);$(GLIB_CFLAGS_INCLUDE);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
+      <PreprocessorDefinitions>WIN32;WIN64;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+      <FunctionLevelLinking>true</FunctionLevelLinking>\r
+      <PrecompiledHeader>\r
+      </PrecompiledHeader>\r
+      <ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>\r
+    </ClCompile>\r
+    <Link>\r
+      <SubSystem>Windows</SubSystem>\r
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>\r
+      <OptimizeReferences>true</OptimizeReferences>\r
+    </Link>\r
+    <PostBuildEvent>\r
+      <Command>.\libmono.bat "$(MONO_INCLUDE_DIR)" "$(SolutionDir)include\mono" -q</Command>\r
+    </PostBuildEvent>\r
+  </ItemDefinitionGroup>\r
+  <ItemGroup>\r
+    <CustomBuildStep 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
+    </CustomBuildStep>\r
+    <CustomBuildStep Include="..\mono\mini\mini-amd64.h">\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>\r
+    </CustomBuildStep>\r
+  </ItemGroup>\r
+  <ItemGroup>\r
+    <ProjectReference Include="eglib.vcxproj">\r
+      <Project>{158073ed-99ae-4196-9edc-ddb2344f8466}</Project>\r
+    </ProjectReference>\r
+    <ProjectReference Include="genmdesc.vcxproj">\r
+      <Project>{b7098dfa-31e6-4006-8a15-1c9a4e925149}</Project>\r
+    </ProjectReference>\r
+    <ProjectReference Include="libgc.vcxproj">\r
+      <Project>{eb56000b-c80b-4e8b-908d-d84d31b517d3}</Project>\r
+    </ProjectReference>\r
+    <ProjectReference Include="libgcmonosgen.vcxproj">\r
+      <Project>{c36612bd-22d3-4b95-85e2-7fdc4fc5d740}</Project>\r
+    </ProjectReference>\r
+    <ProjectReference Include="libmonoruntime.vcxproj">\r
+      <Project>{c36612bd-22d3-4b95-85e2-7fdc4fc5d739}</Project>\r
+    </ProjectReference>\r
+    <ProjectReference Include="libmonoutils.vcxproj">\r
+      <Project>{8fc2b0c8-51ad-49df-851f-5d01a77a75e4}</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/libmono-static.vcxproj.filters b/msvc/libmono-static.vcxproj.filters
new file mode 100644 (file)
index 0000000..75748b8
--- /dev/null
@@ -0,0 +1,249 @@
+<?xml version="1.0" encoding="utf-8"?>\r
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
+  <ItemGroup>\r
+    <ClCompile Include="..\mono\mini\abcremoval.c">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\mono\mini\alias-analysis.c">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\mono\mini\aot-compiler.c">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\mono\mini\aot-runtime.c">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\mono\mini\arch-stubs.c">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\mono\mini\branch-opts.c">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\mono\mini\cfold.c">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\mono\mini\debugger-agent.c">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\mono\mini\debug-mini.c">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\mono\mini\decompose.c">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\mono\mini\dominators.c">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\mono\mini\driver.c">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\mono\mini\dwarfwriter.c">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\mono\mini\exceptions-amd64.c">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\mono\mini\exceptions-x86.c">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\mono\mini\graph.c">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\mono\mini\helpers.c">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\mono\mini\image-writer.c">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\mono\mini\jit-icalls.c ">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\mono\mini\linear-scan.c">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\mono\mini\liveness.c">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\mono\mini\local-propagation.c">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\mono\mini\method-to-ir.c">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\mono\mini\mini.c">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\mono\mini\mini-amd64.c">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\mono\mini\mini-codegen.c">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\mono\mini\mini-exceptions.c">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\mono\mini\mini-gc.c">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\mono\mini\mini-generic-sharing.c">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\mono\mini\mini-native-types.c">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\mono\mini\mini-runtime.c">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\mono\mini\mini-trampolines.c  ">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\mono\mini\mini-windows.c">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <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
+    <ClCompile Include="..\mono\mini\simd-intrinsics.c">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\mono\mini\ssa.c">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\mono\mini\tasklets.c">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\mono\mini\trace.c">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\mono\mini\tramp-amd64.c">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\mono\mini\tramp-x86.c">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\mono\mini\unwind.c">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\mono\mini\xdebug.c">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\mono\mini\cfgdump.c">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\mono\mini\mini-amd64-gsharedvt.c">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\mono\mini\mini-cross-helpers.c">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\mono\mini\mini-exceptions-native-unwinder.c">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\mono\mini\mini-x86-gsharedvt.c">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\mono\mini\tramp-amd64-gsharedvt.c">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\mono\mini\tramp-x86-gsharedvt.c">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+  </ItemGroup>\r
+  <ItemGroup>\r
+    <ClInclude Include="..\mono\mini\abcremoval.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="..\mono\mini\debugger-agent.h ">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="..\mono\mini\dwarfwriter.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="..\mono\mini\ir-emit.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="..\mono\mini\image-writer.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="..\mono\mini\seq-points.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="..\mono\mini\jit-icalls.h ">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="..\mono\mini\mini.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="..\mono\mini\mini-amd64.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="..\mono\mini\mini-arch.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="..\mono\mini\mini-gc.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="..\mono\mini\mini-llvm.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="..\mono\mini\mini-llvm-cpp.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="..\mono\mini\mini-ops.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="..\mono\mini\mini-unwind.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="..\mono\mini\mini-x86.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="..\mono\mini\optflags-def.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="..\mono\mini\patch-info.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="..\mono\mini\regalloc.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="..\mono\metadata\remoting.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="..\mono\mini\simd-methods.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="..\mono\mini\tasklets.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="..\mono\mini\trace.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="..\mono\mini\version.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="..\mono\mini\cfgdump.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="..\mono\mini\mini-amd64-gsharedvt.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
+  </ItemGroup>\r
+  <ItemGroup>\r
+    <Filter Include="Header Files">\r
+      <UniqueIdentifier>{bdc9f80b-3045-49d2-bb7b-510450371395}</UniqueIdentifier>\r
+    </Filter>\r
+    <Filter Include="Resource Files">\r
+      <UniqueIdentifier>{f7700495-afaa-4d16-9aac-79d54d10de23}</UniqueIdentifier>\r
+    </Filter>\r
+    <Filter Include="Source Files">\r
+      <UniqueIdentifier>{5370c3c4-b6ec-4f8a-8b21-ce4e782720a6}</UniqueIdentifier>\r
+    </Filter>\r
+  </ItemGroup>\r
+</Project>
\ No newline at end of file
index 6fca2cc5ae4439aaa535b3c08b833683d3b9cede..3acce45d4bbc5356b29c7993c7e5c5bef8f58108 100644 (file)
       <Platform>x64</Platform>\r
     </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
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>\r
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>\r
-    </ClCompile>\r
-    <ClCompile Include="..\mono\mini\exceptions-x86.c">\r
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>\r
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>\r
-    </ClCompile>\r
-    <ClCompile Include="..\mono\mini\mini-amd64.c">\r
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>\r
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>\r
-    </ClCompile>\r
-    <ClCompile Include="..\mono\mini\mini-amd64-gsharedvt.c">\r
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>\r
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>\r
-    </ClCompile>\r
-    <ClCompile Include="..\mono\mini\mini-runtime.c" />\r
-    <ClCompile Include="..\mono\mini\mini-windows.c" />\r
-    <ClCompile Include="..\mono\mini\mini-x86.c">\r
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>\r
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>\r
-    </ClCompile>\r
-    <ClCompile Include="..\mono\mini\mini-x86-gsharedvt.c">\r
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>\r
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>\r
-    </ClCompile>\r
-    <ClCompile Include="..\mono\mini\mini.c" />\r
-    <ClInclude Include="..\mono\metadata\remoting.h" />\r
-    <ClInclude Include="..\mono\mini\ir-emit.h" />\r
-    <ClCompile Include="..\mono\mini\method-to-ir.c" />\r
-    <ClCompile Include="..\mono\mini\decompose.c" />\r
-    <ClInclude Include="..\mono\mini\mini-amd64.h">\r
-      <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-amd64-gsharedvt.h">\r
-      <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-x86.h">\r
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>\r
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>\r
-    </ClInclude>\r
-    <ClInclude Include="..\mono\mini\mini.h" />\r
-    <ClInclude Include="..\mono\mini\seq-points.h" />\r
-    <ClInclude Include="..\mono\mini\version.h" />\r
-    <ClInclude Include="..\mono\mini\optflags-def.h" />\r
-    <ClInclude Include="..\mono\mini\cfgdump.h" />\r
-    <ClCompile Include="..\mono\mini\cfgdump.c" />\r
-    <ClInclude Include="..\mono\mini\jit-icalls.h " />\r
-    <ClCompile Include="..\mono\mini\jit-icalls.c " />\r
-    <ClCompile Include="..\mono\mini\seq-points.c" />\r
-    <ClCompile Include="..\mono\mini\trace.c" />\r
-    <ClInclude Include="..\mono\mini\trace.h" />\r
-    <ClInclude Include="..\mono\mini\patch-info.h" />\r
-    <ClInclude Include="..\mono\mini\mini-ops.h" />\r
-    <ClInclude Include="..\mono\mini\mini-arch.h" />\r
-    <ClCompile Include="..\mono\mini\dominators.c" />\r
-    <ClCompile Include="..\mono\mini\cfold.c" />\r
-    <ClInclude Include="..\mono\mini\regalloc.h" />\r
-    <ClCompile Include="..\mono\mini\helpers.c" />\r
-    <ClCompile Include="..\mono\mini\liveness.c" />\r
-    <ClCompile Include="..\mono\mini\ssa.c" />\r
-    <ClCompile Include="..\mono\mini\abcremoval.c" />\r
-    <ClInclude Include="..\mono\mini\abcremoval.h" />\r
-    <ClCompile Include="..\mono\mini\local-propagation.c" />\r
-    <ClCompile Include="..\mono\mini\driver.c" />\r
-    <ClCompile Include="..\mono\mini\debug-mini.c" />\r
-    <ClCompile Include="..\mono\mini\linear-scan.c" />\r
-    <ClCompile Include="..\mono\mini\aot-compiler.c" />\r
-    <ClCompile Include="..\mono\mini\aot-runtime.c" />\r
-    <ClCompile Include="..\mono\mini\graph.c" />\r
-    <ClCompile Include="..\mono\mini\mini-codegen.c" />\r
-    <ClCompile Include="..\mono\mini\mini-cross-helpers.c" />\r
-    <ClCompile Include="..\mono\mini\mini-exceptions.c" />\r
-    <ClCompile Include="..\mono\mini\mini-exceptions-native-unwinder.c" />\r
-    <ClCompile Include="..\mono\mini\mini-trampolines.c  " />\r
-    <ClCompile Include="..\mono\mini\tramp-amd64.c">\r
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>\r
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>\r
-    </ClCompile>\r
-    <ClCompile Include="..\mono\mini\tramp-amd64-gsharedvt.c">\r
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>\r
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>\r
-    </ClCompile>\r
-    <ClCompile Include="..\mono\mini\tramp-x86.c">\r
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>\r
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>\r
-    </ClCompile>\r
-    <ClCompile Include="..\mono\mini\tramp-x86-gsharedvt.c">\r
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>\r
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>\r
-    </ClCompile>\r
-    <ClCompile Include="..\mono\mini\branch-opts.c" />\r
-    <ClCompile Include="..\mono\mini\mini-generic-sharing.c" />\r
-    <ClInclude Include="..\mono\mini\simd-methods.h" />\r
-    <ClCompile Include="..\mono\mini\tasklets.c" />\r
-    <ClInclude Include="..\mono\mini\tasklets.h" />\r
-    <ClCompile Include="..\mono\mini\simd-intrinsics.c" />\r
-    <ClInclude Include="..\mono\mini\mini-unwind.h" />\r
-    <ClCompile Include="..\mono\mini\unwind.c" />\r
-    <ClInclude Include="..\mono\mini\image-writer.h" />\r
-    <ClCompile Include="..\mono\mini\image-writer.c" />\r
-    <ClInclude Include="..\mono\mini\dwarfwriter.h" />\r
-    <ClCompile Include="..\mono\mini\dwarfwriter.c" />\r
-    <ClInclude Include="..\mono\mini\mini-gc.h" />\r
-    <ClCompile Include="..\mono\mini\mini-gc.c" />\r
-    <ClInclude Include="..\mono\mini\debugger-agent.h " />\r
-    <ClCompile Include="..\mono\mini\debugger-agent.c" />\r
-    <ClCompile Include="..\mono\mini\xdebug.c" />\r
-    <ClInclude Include="..\mono\mini\mini-llvm.h" />\r
-    <ClInclude Include="..\mono\mini\mini-llvm-cpp.h" />\r
-    <ClCompile Include="..\mono\mini\mini-native-types.c" />\r
-  </ItemGroup>\r
   <PropertyGroup Label="Globals">\r
     <ProjectGuid>{CB0D9E92-293C-439C-9AC7-C5F59B6E0771}</ProjectGuid>\r
     <RootNamespace>libmono</RootNamespace>\r
       <Culture>0x0409</Culture>\r
     </ResourceCompile>\r
     <ProjectReference>\r
-      <LinkLibraryDependencies>false</LinkLibraryDependencies>\r
+      <LinkLibraryDependencies>true</LinkLibraryDependencies>\r
     </ProjectReference>\r
     <Link>\r
-      <AdditionalDependencies>eglib.lib;libmonoutils.lib;libmonoruntime$(MONO_TARGET_SUFFIX).lib;$(GC_LIB);%(AdditionalDependencies)</AdditionalDependencies>\r
+      <AdditionalDependencies>eglib.lib;libmonoutils.lib;libmonoruntime$(MONO_TARGET_SUFFIX).lib;libmono-static$(MONO_TARGET_SUFFIX).lib;$(GC_LIB);%(AdditionalDependencies)</AdditionalDependencies>\r
       <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\r
       <ModuleDefinitionFile>$(MONO_DEF)</ModuleDefinitionFile>\r
       <GenerateDebugInformation>true</GenerateDebugInformation>\r
       <Culture>0x0409</Culture>\r
     </ResourceCompile>\r
     <ProjectReference>\r
-      <LinkLibraryDependencies>false</LinkLibraryDependencies>\r
+      <LinkLibraryDependencies>true</LinkLibraryDependencies>\r
     </ProjectReference>\r
     <Link>\r
-      <AdditionalDependencies>eglib.lib;libmonoutils.lib;libmonoruntime$(MONO_TARGET_SUFFIX).lib;$(GC_LIB);%(AdditionalDependencies)</AdditionalDependencies>\r
+      <AdditionalDependencies>eglib.lib;libmonoutils.lib;libmonoruntime$(MONO_TARGET_SUFFIX).lib;libmono-static$(MONO_TARGET_SUFFIX).lib;$(GC_LIB);%(AdditionalDependencies)</AdditionalDependencies>\r
       <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\r
       <ModuleDefinitionFile>$(MONO_DEF)</ModuleDefinitionFile>\r
       <GenerateDebugInformation>true</GenerateDebugInformation>\r
       <Culture>0x0409</Culture>\r
     </ResourceCompile>\r
     <ProjectReference>\r
-      <LinkLibraryDependencies>false</LinkLibraryDependencies>\r
+      <LinkLibraryDependencies>true</LinkLibraryDependencies>\r
     </ProjectReference>\r
     <Link>\r
-      <AdditionalDependencies>eglib.lib;libmonoutils.lib;libmonoruntime$(MONO_TARGET_SUFFIX).lib;$(GC_LIB);%(AdditionalDependencies)</AdditionalDependencies>\r
+      <AdditionalDependencies>eglib.lib;libmonoutils.lib;libmonoruntime$(MONO_TARGET_SUFFIX).lib;libmono-static$(MONO_TARGET_SUFFIX).lib;$(GC_LIB);%(AdditionalDependencies)</AdditionalDependencies>\r
       <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\r
       <ModuleDefinitionFile>$(MONO_DEF)</ModuleDefinitionFile>\r
       <RandomizedBaseAddress>false</RandomizedBaseAddress>\r
       <Culture>0x0409</Culture>\r
     </ResourceCompile>\r
     <ProjectReference>\r
-      <LinkLibraryDependencies>false</LinkLibraryDependencies>\r
+      <LinkLibraryDependencies>true</LinkLibraryDependencies>\r
     </ProjectReference>\r
     <Link>\r
-      <AdditionalDependencies>eglib.lib;libmonoutils.lib;libmonoruntime$(MONO_TARGET_SUFFIX).lib;$(GC_LIB);%(AdditionalDependencies)</AdditionalDependencies>\r
+      <AdditionalDependencies>eglib.lib;libmonoutils.lib;libmonoruntime$(MONO_TARGET_SUFFIX).lib;libmono-static$(MONO_TARGET_SUFFIX).lib;$(GC_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
     <ProjectReference Include="libgcmonosgen.vcxproj">\r
       <Project>{c36612bd-22d3-4b95-85e2-7fdc4fc5d740}</Project>\r
     </ProjectReference>\r
+    <ProjectReference Include="libmono-static.vcxproj">\r
+      <Project>{cb0d9e92-293c-439c-9ac7-c5f59b6e0772}</Project>\r
+    </ProjectReference>\r
     <ProjectReference Include="libmonoruntime.vcxproj">\r
       <Project>{c36612bd-22d3-4b95-85e2-7fdc4fc5d739}</Project>\r
     </ProjectReference>\r
index 75748b858bebbf78297ef860fe58601862bad323..0d407ea4f940edc25a0d364ff323a36f41c96cb9 100644 (file)
@@ -1,240 +1,5 @@
 ï»¿<?xml version="1.0" encoding="utf-8"?>\r
 <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
-  <ItemGroup>\r
-    <ClCompile Include="..\mono\mini\abcremoval.c">\r
-      <Filter>Source Files</Filter>\r
-    </ClCompile>\r
-    <ClCompile Include="..\mono\mini\alias-analysis.c">\r
-      <Filter>Source Files</Filter>\r
-    </ClCompile>\r
-    <ClCompile Include="..\mono\mini\aot-compiler.c">\r
-      <Filter>Source Files</Filter>\r
-    </ClCompile>\r
-    <ClCompile Include="..\mono\mini\aot-runtime.c">\r
-      <Filter>Source Files</Filter>\r
-    </ClCompile>\r
-    <ClCompile Include="..\mono\mini\arch-stubs.c">\r
-      <Filter>Source Files</Filter>\r
-    </ClCompile>\r
-    <ClCompile Include="..\mono\mini\branch-opts.c">\r
-      <Filter>Source Files</Filter>\r
-    </ClCompile>\r
-    <ClCompile Include="..\mono\mini\cfold.c">\r
-      <Filter>Source Files</Filter>\r
-    </ClCompile>\r
-    <ClCompile Include="..\mono\mini\debugger-agent.c">\r
-      <Filter>Source Files</Filter>\r
-    </ClCompile>\r
-    <ClCompile Include="..\mono\mini\debug-mini.c">\r
-      <Filter>Source Files</Filter>\r
-    </ClCompile>\r
-    <ClCompile Include="..\mono\mini\decompose.c">\r
-      <Filter>Source Files</Filter>\r
-    </ClCompile>\r
-    <ClCompile Include="..\mono\mini\dominators.c">\r
-      <Filter>Source Files</Filter>\r
-    </ClCompile>\r
-    <ClCompile Include="..\mono\mini\driver.c">\r
-      <Filter>Source Files</Filter>\r
-    </ClCompile>\r
-    <ClCompile Include="..\mono\mini\dwarfwriter.c">\r
-      <Filter>Source Files</Filter>\r
-    </ClCompile>\r
-    <ClCompile Include="..\mono\mini\exceptions-amd64.c">\r
-      <Filter>Source Files</Filter>\r
-    </ClCompile>\r
-    <ClCompile Include="..\mono\mini\exceptions-x86.c">\r
-      <Filter>Source Files</Filter>\r
-    </ClCompile>\r
-    <ClCompile Include="..\mono\mini\graph.c">\r
-      <Filter>Source Files</Filter>\r
-    </ClCompile>\r
-    <ClCompile Include="..\mono\mini\helpers.c">\r
-      <Filter>Source Files</Filter>\r
-    </ClCompile>\r
-    <ClCompile Include="..\mono\mini\image-writer.c">\r
-      <Filter>Source Files</Filter>\r
-    </ClCompile>\r
-    <ClCompile Include="..\mono\mini\jit-icalls.c ">\r
-      <Filter>Source Files</Filter>\r
-    </ClCompile>\r
-    <ClCompile Include="..\mono\mini\linear-scan.c">\r
-      <Filter>Source Files</Filter>\r
-    </ClCompile>\r
-    <ClCompile Include="..\mono\mini\liveness.c">\r
-      <Filter>Source Files</Filter>\r
-    </ClCompile>\r
-    <ClCompile Include="..\mono\mini\local-propagation.c">\r
-      <Filter>Source Files</Filter>\r
-    </ClCompile>\r
-    <ClCompile Include="..\mono\mini\method-to-ir.c">\r
-      <Filter>Source Files</Filter>\r
-    </ClCompile>\r
-    <ClCompile Include="..\mono\mini\mini.c">\r
-      <Filter>Source Files</Filter>\r
-    </ClCompile>\r
-    <ClCompile Include="..\mono\mini\mini-amd64.c">\r
-      <Filter>Source Files</Filter>\r
-    </ClCompile>\r
-    <ClCompile Include="..\mono\mini\mini-codegen.c">\r
-      <Filter>Source Files</Filter>\r
-    </ClCompile>\r
-    <ClCompile Include="..\mono\mini\mini-exceptions.c">\r
-      <Filter>Source Files</Filter>\r
-    </ClCompile>\r
-    <ClCompile Include="..\mono\mini\mini-gc.c">\r
-      <Filter>Source Files</Filter>\r
-    </ClCompile>\r
-    <ClCompile Include="..\mono\mini\mini-generic-sharing.c">\r
-      <Filter>Source Files</Filter>\r
-    </ClCompile>\r
-    <ClCompile Include="..\mono\mini\mini-native-types.c">\r
-      <Filter>Source Files</Filter>\r
-    </ClCompile>\r
-    <ClCompile Include="..\mono\mini\mini-runtime.c">\r
-      <Filter>Source Files</Filter>\r
-    </ClCompile>\r
-    <ClCompile Include="..\mono\mini\mini-trampolines.c  ">\r
-      <Filter>Source Files</Filter>\r
-    </ClCompile>\r
-    <ClCompile Include="..\mono\mini\mini-windows.c">\r
-      <Filter>Source Files</Filter>\r
-    </ClCompile>\r
-    <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
-    <ClCompile Include="..\mono\mini\simd-intrinsics.c">\r
-      <Filter>Source Files</Filter>\r
-    </ClCompile>\r
-    <ClCompile Include="..\mono\mini\ssa.c">\r
-      <Filter>Source Files</Filter>\r
-    </ClCompile>\r
-    <ClCompile Include="..\mono\mini\tasklets.c">\r
-      <Filter>Source Files</Filter>\r
-    </ClCompile>\r
-    <ClCompile Include="..\mono\mini\trace.c">\r
-      <Filter>Source Files</Filter>\r
-    </ClCompile>\r
-    <ClCompile Include="..\mono\mini\tramp-amd64.c">\r
-      <Filter>Source Files</Filter>\r
-    </ClCompile>\r
-    <ClCompile Include="..\mono\mini\tramp-x86.c">\r
-      <Filter>Source Files</Filter>\r
-    </ClCompile>\r
-    <ClCompile Include="..\mono\mini\unwind.c">\r
-      <Filter>Source Files</Filter>\r
-    </ClCompile>\r
-    <ClCompile Include="..\mono\mini\xdebug.c">\r
-      <Filter>Source Files</Filter>\r
-    </ClCompile>\r
-    <ClCompile Include="..\mono\mini\cfgdump.c">\r
-      <Filter>Source Files</Filter>\r
-    </ClCompile>\r
-    <ClCompile Include="..\mono\mini\mini-amd64-gsharedvt.c">\r
-      <Filter>Source Files</Filter>\r
-    </ClCompile>\r
-    <ClCompile Include="..\mono\mini\mini-cross-helpers.c">\r
-      <Filter>Source Files</Filter>\r
-    </ClCompile>\r
-    <ClCompile Include="..\mono\mini\mini-exceptions-native-unwinder.c">\r
-      <Filter>Source Files</Filter>\r
-    </ClCompile>\r
-    <ClCompile Include="..\mono\mini\mini-x86-gsharedvt.c">\r
-      <Filter>Source Files</Filter>\r
-    </ClCompile>\r
-    <ClCompile Include="..\mono\mini\tramp-amd64-gsharedvt.c">\r
-      <Filter>Source Files</Filter>\r
-    </ClCompile>\r
-    <ClCompile Include="..\mono\mini\tramp-x86-gsharedvt.c">\r
-      <Filter>Source Files</Filter>\r
-    </ClCompile>\r
-  </ItemGroup>\r
-  <ItemGroup>\r
-    <ClInclude Include="..\mono\mini\abcremoval.h">\r
-      <Filter>Header Files</Filter>\r
-    </ClInclude>\r
-    <ClInclude Include="..\mono\mini\debugger-agent.h ">\r
-      <Filter>Header Files</Filter>\r
-    </ClInclude>\r
-    <ClInclude Include="..\mono\mini\dwarfwriter.h">\r
-      <Filter>Header Files</Filter>\r
-    </ClInclude>\r
-    <ClInclude Include="..\mono\mini\ir-emit.h">\r
-      <Filter>Header Files</Filter>\r
-    </ClInclude>\r
-    <ClInclude Include="..\mono\mini\image-writer.h">\r
-      <Filter>Header Files</Filter>\r
-    </ClInclude>\r
-    <ClInclude Include="..\mono\mini\seq-points.h">\r
-      <Filter>Header Files</Filter>\r
-    </ClInclude>\r
-    <ClInclude Include="..\mono\mini\jit-icalls.h ">\r
-      <Filter>Header Files</Filter>\r
-    </ClInclude>\r
-    <ClInclude Include="..\mono\mini\mini.h">\r
-      <Filter>Header Files</Filter>\r
-    </ClInclude>\r
-    <ClInclude Include="..\mono\mini\mini-amd64.h">\r
-      <Filter>Header Files</Filter>\r
-    </ClInclude>\r
-    <ClInclude Include="..\mono\mini\mini-arch.h">\r
-      <Filter>Header Files</Filter>\r
-    </ClInclude>\r
-    <ClInclude Include="..\mono\mini\mini-gc.h">\r
-      <Filter>Header Files</Filter>\r
-    </ClInclude>\r
-    <ClInclude Include="..\mono\mini\mini-llvm.h">\r
-      <Filter>Header Files</Filter>\r
-    </ClInclude>\r
-    <ClInclude Include="..\mono\mini\mini-llvm-cpp.h">\r
-      <Filter>Header Files</Filter>\r
-    </ClInclude>\r
-    <ClInclude Include="..\mono\mini\mini-ops.h">\r
-      <Filter>Header Files</Filter>\r
-    </ClInclude>\r
-    <ClInclude Include="..\mono\mini\mini-unwind.h">\r
-      <Filter>Header Files</Filter>\r
-    </ClInclude>\r
-    <ClInclude Include="..\mono\mini\mini-x86.h">\r
-      <Filter>Header Files</Filter>\r
-    </ClInclude>\r
-    <ClInclude Include="..\mono\mini\optflags-def.h">\r
-      <Filter>Header Files</Filter>\r
-    </ClInclude>\r
-    <ClInclude Include="..\mono\mini\patch-info.h">\r
-      <Filter>Header Files</Filter>\r
-    </ClInclude>\r
-    <ClInclude Include="..\mono\mini\regalloc.h">\r
-      <Filter>Header Files</Filter>\r
-    </ClInclude>\r
-    <ClInclude Include="..\mono\metadata\remoting.h">\r
-      <Filter>Header Files</Filter>\r
-    </ClInclude>\r
-    <ClInclude Include="..\mono\mini\simd-methods.h">\r
-      <Filter>Header Files</Filter>\r
-    </ClInclude>\r
-    <ClInclude Include="..\mono\mini\tasklets.h">\r
-      <Filter>Header Files</Filter>\r
-    </ClInclude>\r
-    <ClInclude Include="..\mono\mini\trace.h">\r
-      <Filter>Header Files</Filter>\r
-    </ClInclude>\r
-    <ClInclude Include="..\mono\mini\version.h">\r
-      <Filter>Header Files</Filter>\r
-    </ClInclude>\r
-    <ClInclude Include="..\mono\mini\cfgdump.h">\r
-      <Filter>Header Files</Filter>\r
-    </ClInclude>\r
-    <ClInclude Include="..\mono\mini\mini-amd64-gsharedvt.h">\r
-      <Filter>Header Files</Filter>\r
-    </ClInclude>\r
-  </ItemGroup>\r
   <ItemGroup>\r
     <Filter Include="Header Files">\r
       <UniqueIdentifier>{bdc9f80b-3045-49d2-bb7b-510450371395}</UniqueIdentifier>\r
index c02736c1bff8c3197b298dcd6a20f268f6dd34c6..d0c79d0f0a4e2d66cd6335238edaae8736756357 100644 (file)
       <SubSystem>Windows</SubSystem>\r
       <GenerateDebugInformation>true</GenerateDebugInformation>\r
     </Link>\r
-    <Lib>\r
-      <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>\r
-    </Lib>\r
+    <Lib />\r
   </ItemDefinitionGroup>\r
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">\r
     <ClCompile>\r
       <SubSystem>Windows</SubSystem>\r
       <GenerateDebugInformation>true</GenerateDebugInformation>\r
     </Link>\r
-    <Lib>\r
-      <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>\r
-    </Lib>\r
+    <Lib />\r
   </ItemDefinitionGroup>\r
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">\r
     <ClCompile>\r
       <EnableCOMDATFolding>true</EnableCOMDATFolding>\r
       <OptimizeReferences>true</OptimizeReferences>\r
     </Link>\r
-    <Lib>\r
-      <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>\r
-    </Lib>\r
+    <Lib />\r
   </ItemDefinitionGroup>\r
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">\r
     <ClCompile>\r
       <EnableCOMDATFolding>true</EnableCOMDATFolding>\r
       <OptimizeReferences>true</OptimizeReferences>\r
     </Link>\r
-    <Lib>\r
-      <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>\r
-    </Lib>\r
+    <Lib />\r
   </ItemDefinitionGroup>\r
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />\r
   <ImportGroup Label="ExtensionTargets">\r
index bbc7249634d1b0d40dfaa9eff49e5e7f819bb33f..2251543e666491a794934617bde33931d99d5dfd 100644 (file)
@@ -423,6 +423,7 @@ mono_get_uint64_class
 mono_get_uintptr_class
 mono_get_void_class
 mono_guid_to_string
+mono_guid_to_string_minimal
 mono_image_add_to_name_cache
 mono_image_addref
 mono_image_close
@@ -505,6 +506,12 @@ mono_lock_free_queue_init
 mono_lock_free_queue_node_init
 mono_lock_free_queue_node_unpoison
 mono_locks_dump
+mono_log_close_logfile
+mono_log_close_syslog
+mono_log_open_logfile
+mono_log_open_syslog
+mono_log_write_logfile
+mono_log_write_syslog
 mono_lookup_icall_symbol
 mono_lookup_internal_call
 mono_lookup_pinvoke_call
@@ -769,6 +776,7 @@ mono_security_core_clr_require_elevated_permissions
 mono_security_core_clr_set_options
 mono_security_enable_core_clr
 mono_security_set_core_clr_platform_callback
+mono_set_allocator_vtable
 mono_set_assemblies_path
 mono_set_break_policy
 mono_set_config_dir
@@ -852,14 +860,20 @@ mono_threads_attach_coop
 mono_threads_attach_tools_thread
 mono_threads_detach_coop
 mono_threads_enter_gc_safe_region
+mono_threads_enter_gc_safe_region_unbalanced
 mono_threads_enter_gc_unsafe_region
+mono_threads_enter_gc_unsafe_region_unbalanced
 mono_threads_exit_gc_safe_region
+mono_threads_exit_gc_safe_region_unbalanced
 mono_threads_exit_gc_unsafe_region
+mono_threads_exit_gc_unsafe_region_unbalanced
 mono_threads_get_default_stacksize
 mono_threads_request_thread_dump
 mono_threads_set_default_stacksize
 mono_trace_set_level_string
 mono_trace_set_log_handler
+mono_trace_set_logdest_string
+mono_trace_set_logheader_string
 mono_trace_set_mask_string
 mono_trace_set_print_handler
 mono_trace_set_printerr_handler
index 408a8b7953166556d8333ee29425e862957f554c..0861cda54050dc6d3e14cfd52a335da11e7d7542 100644 (file)
@@ -161,6 +161,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mono-mini-regression-aot-te
 EndProject\r
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "regression", "regression", "{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
 Global\r
        GlobalSection(SolutionConfigurationPlatforms) = preSolution\r
                Debug|Win32 = Debug|Win32\r
@@ -351,6 +353,14 @@ Global
                {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
+               {CB0D9E92-293C-439C-9AC7-C5F59B6E0772}.Debug|x64.Build.0 = Debug|x64\r
+               {CB0D9E92-293C-439C-9AC7-C5F59B6E0772}.Release|Win32.ActiveCfg = Release|Win32\r
+               {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
        EndGlobalSection\r
        GlobalSection(SolutionProperties) = preSolution\r
                HideSolutionNode = FALSE\r
@@ -382,6 +392,7 @@ Global
                {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
        EndGlobalSection\r
        GlobalSection(ExtensibilityGlobals) = postSolution\r
                AMDCaProjectFile = C:\Users\Owner\Development\monogit\mono\msvc\CodeAnalyst\mono.caw\r
index 081051fe5e02ad8f0c9dfa335d0dae455b33f289..1f82284e7c29e944108087ebb05d2fa117fdac27 100644 (file)
@@ -425,6 +425,7 @@ mono_get_uint64_class
 mono_get_uintptr_class
 mono_get_void_class
 mono_guid_to_string
+mono_guid_to_string_minimal
 mono_image_add_to_name_cache
 mono_image_addref
 mono_image_close
@@ -507,6 +508,12 @@ mono_lock_free_queue_init
 mono_lock_free_queue_node_init
 mono_lock_free_queue_node_unpoison
 mono_locks_dump
+mono_log_close_logfile
+mono_log_close_syslog
+mono_log_open_logfile
+mono_log_open_syslog
+mono_log_write_logfile
+mono_log_write_syslog
 mono_lookup_icall_symbol
 mono_lookup_internal_call
 mono_lookup_pinvoke_call
@@ -771,6 +778,7 @@ mono_security_core_clr_require_elevated_permissions
 mono_security_core_clr_set_options
 mono_security_enable_core_clr
 mono_security_set_core_clr_platform_callback
+mono_set_allocator_vtable
 mono_set_assemblies_path
 mono_set_break_policy
 mono_set_config_dir
@@ -854,14 +862,20 @@ mono_threads_attach_coop
 mono_threads_attach_tools_thread
 mono_threads_detach_coop
 mono_threads_enter_gc_safe_region
+mono_threads_enter_gc_safe_region_unbalanced
 mono_threads_enter_gc_unsafe_region
+mono_threads_enter_gc_unsafe_region_unbalanced
 mono_threads_exit_gc_safe_region
+mono_threads_exit_gc_safe_region_unbalanced
 mono_threads_exit_gc_unsafe_region
+mono_threads_exit_gc_unsafe_region_unbalanced
 mono_threads_get_default_stacksize
 mono_threads_request_thread_dump
 mono_threads_set_default_stacksize
 mono_trace_set_level_string
 mono_trace_set_log_handler
+mono_trace_set_logdest_string
+mono_trace_set_logheader_string
 mono_trace_set_mask_string
 mono_trace_set_print_handler
 mono_trace_set_printerr_handler
index d0473063375ecd968f0ab6fa27cda916d46b5be3..d2424feca659f855fe33bd575d5348dc83ffd53b 100644 (file)
@@ -2,7 +2,7 @@
 <root>
     <project dir="mcs" library="basic-basic">
       <boot></boot>
-      <flags>/codepage:65001 -r:System.dll -r:System.Core.dll -r:System.Xml.dll -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 -d:BOOTSTRAP_BASIC -nowarn:1699 -d:DISABLE_CAS_USE -lib:./../class/lib/basic -optimize /noconfig</flags>
+      <flags>/codepage:65001 -r:System.dll -r:System.Core.dll -r:System.Xml.dll -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 -d:BOOTSTRAP_BASIC -nowarn:1699 -lib:./../class/lib/basic -optimize /noconfig</flags>
       <output>basic.exe</output>
       <built_sources>cs-parser.cs</built_sources>
       <library_output>./../class/lib/basic/basic.exe</library_output>
@@ -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 -d:DISABLE_CAS_USE -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 -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>
       <output>mscorlib.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/basic/mscorlib.dll</library_output>
@@ -24,7 +24,7 @@
     </project>
     <project dir="class/Mono.Security" library="Mono.Security-basic">
       <boot>true</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:BOOTSTRAP_BASIC -nowarn:1699 -d:DISABLE_CAS_USE -lib:./../../class/lib/basic -optimize /noconfig -unsafe -nowarn:1030,3009 -r:./../../class/lib/basic/bare/System.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 -unsafe -nowarn:1030,3009 -r:./../../class/lib/basic/bare/System.dll</flags>
       <output>Mono.Security.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/basic/Mono.Security.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 -d:DISABLE_CAS_USE -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 -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>
       <output>System.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/basic/System.dll</library_output>
@@ -46,7 +46,7 @@
     </project>
     <project dir="class/System.XML" library="System.Xml-basic">
       <boot>true</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:BOOTSTRAP_BASIC -nowarn:1699 -d:DISABLE_CAS_USE -lib:./../../class/lib/basic -optimize /noconfig -nowarn:219,414,649,1717 -unsafe -d:ASYNC -d:CONFIGURATION_DEP -r:./../../class/lib/basic/secxml/System.dll -r:./../../class/lib/basic/System.Configuration.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 -nowarn:219,414,649,1717 -unsafe -d:ASYNC -d:CONFIGURATION_DEP -r:./../../class/lib/basic/secxml/System.dll -r:./../../class/lib/basic/System.Configuration.dll</flags>
       <output>System.Xml.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/basic/System.Xml.dll</library_output>
@@ -57,7 +57,7 @@
     </project>
     <project dir="class/System.Core" library="System.Core-basic">
       <boot>true</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:BOOTSTRAP_BASIC -nowarn:1699 -d:DISABLE_CAS_USE -lib:./../../class/lib/basic -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/basic/System.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: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/basic/System.dll</flags>
       <output>System.Core.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/basic/System.Core.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 -d:DISABLE_CAS_USE -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 -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>
       <output>mscorlib.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/build/mscorlib.dll</library_output>
@@ -79,7 +79,7 @@
     </project>
     <project dir="class/Mono.Security" library="Mono.Security-build">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/build/mscorlib.dll -optimize /noconfig -unsafe -nowarn:1030,3009 -r:./../../class/lib/build/bare/System.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 -unsafe -nowarn:1030,3009 -r:./../../class/lib/build/bare/System.dll</flags>
       <output>Mono.Security.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/build/Mono.Security.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 -d:DISABLE_CAS_USE -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 -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>
       <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 -d:DISABLE_CAS_USE -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 -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>
       <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 -d:DISABLE_CAS_USE -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 -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>
       <output>System.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/build/secxml/System.dll</library_output>
     </project>
     <project dir="class/System.XML" library="System.Xml-build">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/build/mscorlib.dll -optimize /noconfig -nowarn:219,414,649,1717 -unsafe -d:ASYNC -d:CONFIGURATION_DEP -r:./../../class/lib/build/secxml/System.dll -r:./../../class/lib/build/System.Configuration.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 -nowarn:219,414,649,1717 -unsafe -d:ASYNC -d:CONFIGURATION_DEP -r:./../../class/lib/build/secxml/System.dll -r:./../../class/lib/build/System.Configuration.dll</flags>
       <output>System.Xml.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/build/System.Xml.dll</library_output>
     </project>
     <project dir="class/System.XML" library="System.Xml-bare-build">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/build/mscorlib.dll -optimize /noconfig -nowarn:219,414,649,1717 -unsafe -d:ASYNC -r:./../../class/lib/build/bare/System.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 -nowarn:219,414,649,1717 -unsafe -d:ASYNC -r:./../../class/lib/build/bare/System.dll</flags>
       <output>System.Xml.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/build/bare/System.Xml.dll</library_output>
     </project>
     <project dir="class/Mono.Posix" library="Mono.Posix-build">
       <boot>true</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/build/mscorlib.dll -optimize /noconfig /unsafe /nowarn:0618,612 -r:./../../class/lib/build/System.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 /unsafe /nowarn:0618,612 -r:./../../class/lib/build/System.dll</flags>
       <output>Mono.Posix.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/build/Mono.Posix.dll</library_output>
     </project>
     <project dir="class/System.Core" library="System.Core-build">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/build/mscorlib.dll -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/build/System.dll -r:./../../class/lib/build/Mono.Posix.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: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/build/System.dll -r:./../../class/lib/build/Mono.Posix.dll</flags>
       <output>System.Core.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/build/System.Core.dll</library_output>
     </project>
     <project dir="class/System.Core" library="System.Core-plaincore-build">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/build/mscorlib.dll -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/build/System.dll -r:./../../class/lib/build/Mono.Posix.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: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/build/System.dll -r:./../../class/lib/build/Mono.Posix.dll</flags>
       <output>System.Core.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/build/plaincore/System.Core.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 -d:DISABLE_CAS_USE -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_3_5 /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>
     </project>
     <project dir="class/Mono.Cecil.Mdb" library="Mono.Cecil.Mdb-build">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/build/mscorlib.dll -optimize /noconfig /d:CECIL -keyfile:../mono.snk -publicsign -r:./../../class/lib/build/System.dll -r:./../../class/lib/build/Mono.Cecil.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:CECIL -keyfile:../mono.snk -publicsign -r:./../../class/lib/build/System.dll -r:./../../class/lib/build/Mono.Cecil.dll</flags>
       <output>Mono.Cecil.Mdb.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/build/Mono.Cecil.Mdb.dll</library_output>
     </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 -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../class/lib/build/mscorlib.dll -optimize /noconfig -r:System -r:System.Core -r:System.Xml</flags>
+      <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>
       <output>mcs.exe</output>
       <built_sources>cs-parser.cs</built_sources>
       <library_output>mcs.exe</library_output>
     </project>
     <project dir="tools/gacutil" library="gacutil-build">
       <boot></boot>
-      <flags>/codepage:65001 -unsafe -d:NET_4_0 -d:NET_4_5 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/build/mscorlib.dll -optimize /noconfig -r:Mono.Security</flags>
+      <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>
       <output>gacutil.exe</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/build/gacutil.exe</library_output>
     </project>
     <project dir="tools/culevel" library="culevel-build">
       <boot></boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/build/mscorlib.dll -optimize /noconfig -r:System -r:System.Xml</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 -r:System -r:System.Xml</flags>
       <output>culevel.exe</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/build/culevel.exe</library_output>
     </project>
     <project dir="tools/cil-stringreplacer" library="cil-stringreplacer-build">
       <boot></boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/build/mscorlib.dll -optimize /noconfig -r:System -r:Mono.Cecil</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 -r:System -r:Mono.Cecil</flags>
       <output>cil-stringreplacer.exe</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/build/cil-stringreplacer.exe</library_output>
     </project>
     <project dir="tools/commoncryptogenerator" library="commoncryptogenerator-build">
       <boot></boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/build/mscorlib.dll -optimize /noconfig</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</flags>
       <output>commoncryptogenerator.exe</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/build/commoncryptogenerator.exe</library_output>
     </project>
     <project dir="mcs" library="mcs-net_4_x">
       <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:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:System -r:System.Core -r:System.Xml</flags>
+      <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:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:System -r:System.Core -r:System.Xml</flags>
       <output>mcs.exe</output>
       <built_sources>cs-parser.cs</built_sources>
       <library_output>mcs.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 -d:DISABLE_CAS_USE -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 -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>
       <output>mscorlib.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/mscorlib.dll</library_output>
     </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 -d:DISABLE_CAS_USE -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 -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/Mono.Security" library="Mono.Security-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -unsafe -nowarn:1030,3009 -r:./../../class/lib/net_4_x/bare/System.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 -unsafe -nowarn:1030,3009 -r:./../../class/lib/net_4_x/bare/System.dll</flags>
       <output>Mono.Security.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/Mono.Security.dll</library_output>
     </project>
     <project dir="class/Mono.Security" library="Mono.Security-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/Mono.Security.dll -unsafe -nowarn:1030,3009 -r:./../../class/lib/net_4_x/bare/System.dll -nowarn:169,219,618,672</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/Mono.Security.dll -unsafe -nowarn:1030,3009 -r:./../../class/lib/net_4_x/bare/System.dll -nowarn:169,219,618,672</flags>
       <output>net_4_x_Mono.Security_test.dll</output>
       <built_sources></built_sources>
       <library_output>net_4_x_Mono.Security_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 -d:DISABLE_CAS_USE -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 -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>
       <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-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/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>
+      <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/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>net_4_x_System_test.dll</output>
       <built_sources></built_sources>
       <library_output>net_4_x_System_test.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 -d:DISABLE_CAS_USE -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 -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>
       <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-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/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>
+      <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/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>net_4_x_System_test.dll</output>
       <built_sources></built_sources>
       <library_output>net_4_x_System_test.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 -d:DISABLE_CAS_USE -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 -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>
       <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" library="System-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/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>
+      <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/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>net_4_x_System_test.dll</output>
       <built_sources></built_sources>
       <library_output>net_4_x_System_test.dll</library_output>
     </project>
     <project dir="class/System.XML" library="System.Xml-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -nowarn:219,414,649,1717 -unsafe -d:ASYNC -d:CONFIGURATION_DEP -r:./../../class/lib/net_4_x/secxml/System.dll -r:./../../class/lib/net_4_x/System.Configuration.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,1717 -unsafe -d:ASYNC -d:CONFIGURATION_DEP -r:./../../class/lib/net_4_x/secxml/System.dll -r:./../../class/lib/net_4_x/System.Configuration.dll</flags>
       <output>System.Xml.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.Xml.dll</library_output>
     </project>
     <project dir="class/System.XML" library="System.Xml-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/bare/System.Xml.dll -nowarn:219,414,649,1717 -unsafe -d:ASYNC -r:./../../class/lib/net_4_x/bare/System.dll -nowarn:0618 -nowarn:219 -nowarn:169</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/bare/System.Xml.dll -nowarn:219,414,649,1717 -unsafe -d:ASYNC -r:./../../class/lib/net_4_x/bare/System.dll -nowarn:0618 -nowarn:219 -nowarn:169</flags>
       <output>net_4_x_System.Xml_test.dll</output>
       <built_sources></built_sources>
       <library_output>net_4_x_System.Xml_test.dll</library_output>
     </project>
     <project dir="class/System.XML" library="System.Xml-bare-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -nowarn:219,414,649,1717 -unsafe -d:ASYNC -r:./../../class/lib/net_4_x/bare/System.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,1717 -unsafe -d:ASYNC -r:./../../class/lib/net_4_x/bare/System.dll</flags>
       <output>System.Xml.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/bare/System.Xml.dll</library_output>
     </project>
     <project dir="class/System.XML" library="System.Xml-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/bare/System.Xml.dll -nowarn:219,414,649,1717 -unsafe -d:ASYNC -r:./../../class/lib/net_4_x/bare/System.dll -nowarn:0618 -nowarn:219 -nowarn:169</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/bare/System.Xml.dll -nowarn:219,414,649,1717 -unsafe -d:ASYNC -r:./../../class/lib/net_4_x/bare/System.dll -nowarn:0618 -nowarn:219 -nowarn:169</flags>
       <output>net_4_x_System.Xml_test.dll</output>
       <built_sources></built_sources>
       <library_output>net_4_x_System.Xml_test.dll</library_output>
     </project>
     <project dir="class/Mono.CompilerServices.SymbolWriter" library="Mono.CompilerServices.SymbolWriter-net_4_x">
       <boot>true</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:./../../class/lib/net_4_x/System.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 -r:./../../class/lib/net_4_x/System.dll</flags>
       <output>Mono.CompilerServices.SymbolWriter.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/Mono.CompilerServices.SymbolWriter.dll</library_output>
     </project>
     <project dir="class/Mono.Posix" library="Mono.Posix-net_4_x">
       <boot>true</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig /unsafe /nowarn:0618,612 -r:./../../class/lib/net_4_x/System.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 /unsafe /nowarn:0618,612 -r:./../../class/lib/net_4_x/System.dll</flags>
       <output>Mono.Posix.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/Mono.Posix.dll</library_output>
     </project>
     <project dir="class/Mono.Posix" library="Mono.Posix-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/Mono.Posix.dll /unsafe /nowarn:0219,0618</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/Mono.Posix.dll /unsafe /nowarn:0219,0618</flags>
       <output>net_4_x_Mono.Posix_test.dll</output>
       <built_sources></built_sources>
       <library_output>net_4_x_Mono.Posix_test.dll</library_output>
     </project>
     <project dir="class/System.Core" library="System.Core-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -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/net_4_x/System.dll -r:./../../class/lib/net_4_x/Mono.Posix.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: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/net_4_x/System.dll -r:./../../class/lib/net_4_x/Mono.Posix.dll</flags>
       <output>System.Core.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.Core.dll</library_output>
     </project>
     <project dir="class/System.Core" library="System.Core-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/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/net_4_x/System.dll -r:./../../class/lib/net_4_x/Mono.Posix.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/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/net_4_x/System.dll -r:./../../class/lib/net_4_x/Mono.Posix.dll</flags>
       <output>net_4_x_System.Core_test.dll</output>
       <built_sources></built_sources>
       <library_output>net_4_x_System.Core_test.dll</library_output>
     </project>
     <project dir="class/System.Core" library="System.Core-plaincore-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -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/net_4_x/System.dll -r:./../../class/lib/net_4_x/Mono.Posix.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: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/net_4_x/System.dll -r:./../../class/lib/net_4_x/Mono.Posix.dll</flags>
       <output>System.Core.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/plaincore/System.Core.dll</library_output>
     </project>
     <project dir="class/System.Core" library="System.Core-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/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/net_4_x/System.dll -r:./../../class/lib/net_4_x/Mono.Posix.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/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/net_4_x/System.dll -r:./../../class/lib/net_4_x/Mono.Posix.dll</flags>
       <output>net_4_x_System.Core_test.dll</output>
       <built_sources></built_sources>
       <library_output>net_4_x_System.Core_test.dll</library_output>
     </project>
     <project dir="class/System.Security" library="System.Security-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -nowarn:618 -d:SECURITY_DEP -nowarn:414 -r:./../../class/lib/net_4_x/secxml/System.dll -r:./../../class/lib/net_4_x/bare/System.Xml.dll -r:./../../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 -nowarn:618 -d:SECURITY_DEP -nowarn:414 -r:./../../class/lib/net_4_x/secxml/System.dll -r:./../../class/lib/net_4_x/bare/System.Xml.dll -r:./../../class/lib/net_4_x/Mono.Security.dll</flags>
       <output>System.Security.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.Security.dll</library_output>
     </project>
     <project dir="class/System.Security" library="System.Security-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/System.Security.dll -nowarn:618 -d:SECURITY_DEP -nowarn:414 -r:./../../class/lib/net_4_x/secxml/System.dll -r:./../../class/lib/net_4_x/bare/System.Xml.dll -r:./../../class/lib/net_4_x/Mono.Security.dll -nowarn:168,169,183,219,414</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.Security.dll -nowarn:618 -d:SECURITY_DEP -nowarn:414 -r:./../../class/lib/net_4_x/secxml/System.dll -r:./../../class/lib/net_4_x/bare/System.Xml.dll -r:./../../class/lib/net_4_x/Mono.Security.dll -nowarn:168,169,183,219,414</flags>
       <output>net_4_x_System.Security_test.dll</output>
       <built_sources></built_sources>
       <library_output>net_4_x_System.Security_test.dll</library_output>
     </project>
     <project dir="class/System.Configuration" library="System.Configuration-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -nowarn:618 -r:./../../class/lib/net_4_x/secxml/System.dll -r:./../../class/lib/net_4_x/bare/System.Xml.dll -r:./../../class/lib/net_4_x/System.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 -nowarn:618 -r:./../../class/lib/net_4_x/secxml/System.dll -r:./../../class/lib/net_4_x/bare/System.Xml.dll -r:./../../class/lib/net_4_x/System.Security.dll</flags>
       <output>System.Configuration.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.Configuration.dll</library_output>
     </project>
     <project dir="class/System.Configuration" library="System.Configuration-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/System.Configuration.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.Configuration.dll</flags>
       <output>net_4_x_System.Configuration_test.dll</output>
       <built_sources></built_sources>
       <library_output>net_4_x_System.Configuration_test.dll</library_output>
     </project>
     <project dir="tools/resgen" library="resgen-net_4_x">
       <boot></boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:System -r:System.Xml -r:System.Core</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 -r:System.Xml -r:System.Core</flags>
       <output>resgen.exe</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/resgen.exe</library_output>
     </project>
     <project dir="class/System.IO.Compression" library="System.IO.Compression-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig /unsafe -r:./../../class/lib/net_4_x/System.dll -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 /unsafe -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Core.dll</flags>
       <output>System.IO.Compression.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.IO.Compression.dll</library_output>
     </project>
     <project dir="class/System.IO.Compression" library="System.IO.Compression-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/System.IO.Compression.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.IO.Compression.dll</flags>
       <output>net_4_x_System.IO.Compression_test.dll</output>
       <built_sources></built_sources>
       <library_output>net_4_x_System.IO.Compression_test.dll</library_output>
     </project>
     <project dir="class/System.IO.Compression.FileSystem" library="System.IO.Compression.FileSystem-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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.IO.Compression.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 -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.IO.Compression.dll</flags>
       <output>System.IO.Compression.FileSystem.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.IO.Compression.FileSystem.dll</library_output>
     </project>
     <project dir="class/System.IO.Compression.FileSystem" library="System.IO.Compression.FileSystem-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/System.IO.Compression.FileSystem.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.IO.Compression.FileSystem.dll</flags>
       <output>net_4_x_System.IO.Compression.FileSystem_test.dll</output>
       <built_sources></built_sources>
       <library_output>net_4_x_System.IO.Compression.FileSystem_test.dll</library_output>
     </project>
     <project dir="class/System.Drawing" library="System.Drawing-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig /unsafe -resource:Assembly/Mono.ico,Mono.ico -resource:Assembly/Information.ico,Information.ico -resource:Assembly/Error.ico,Error.ico -resource:Assembly/Warning.ico,Warning.ico -resource:Assembly/Question.ico,Question.ico -resource:Assembly/Shield.ico,Shield.ico -r:./../../class/lib/net_4_x/System.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 /unsafe -d:FEATURE_TYPECONVERTER -resource:Assembly/Mono.ico,Mono.ico -resource:Assembly/Information.ico,Information.ico -resource:Assembly/Error.ico,Error.ico -resource:Assembly/Warning.ico,Warning.ico -resource:Assembly/Question.ico,Question.ico -resource:Assembly/Shield.ico,Shield.ico -r:./../../class/lib/net_4_x/System.dll</flags>
       <output>System.Drawing.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.Drawing.dll</library_output>
     </project>
     <project dir="class/System.Drawing" library="System.Drawing-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/System.Drawing.dll /unsafe -resource:Assembly/Mono.ico,Mono.ico -resource:Assembly/Information.ico,Information.ico -resource:Assembly/Error.ico,Error.ico -resource:Assembly/Warning.ico,Warning.ico -resource:Assembly/Question.ico,Question.ico -resource:Assembly/Shield.ico,Shield.ico -r:./../../class/lib/net_4_x/System.dll -define:TEST -resource:Test/resources/indexed.png,indexed.png -nowarn:0618 -nowarn:219 -nowarn:169</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.Drawing.dll /unsafe -d:FEATURE_TYPECONVERTER -resource:Assembly/Mono.ico,Mono.ico -resource:Assembly/Information.ico,Information.ico -resource:Assembly/Error.ico,Error.ico -resource:Assembly/Warning.ico,Warning.ico -resource:Assembly/Question.ico,Question.ico -resource:Assembly/Shield.ico,Shield.ico -r:./../../class/lib/net_4_x/System.dll -define:TEST -resource:Test/resources/indexed.png,indexed.png -nowarn:0618 -nowarn:219 -nowarn:169</flags>
       <output>net_4_x_System.Drawing_test.dll</output>
       <built_sources></built_sources>
       <library_output>net_4_x_System.Drawing_test.dll</library_output>
     </project>
     <project dir="class/System.Transactions" library="System.Transactions-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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.Configuration.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 -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Configuration.dll</flags>
       <output>System.Transactions.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.Transactions.dll</library_output>
     </project>
     <project dir="class/System.Transactions" library="System.Transactions-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/System.Transactions.dll -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Configuration.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.Transactions.dll -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Configuration.dll</flags>
       <output>net_4_x_System.Transactions_test.dll</output>
       <built_sources></built_sources>
       <library_output>net_4_x_System.Transactions_test.dll</library_output>
     </project>
     <project dir="class/System.EnterpriseServices" library="System.EnterpriseServices-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig /nowarn:0168 /nowarn:0162 -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:0168 /nowarn:0162 -r:./../../class/lib/net_4_x/System.Transactions.dll</flags>
       <output>System.EnterpriseServices.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.EnterpriseServices.dll</library_output>
     </project>
     <project dir="class/Mono.Data.Tds" library="Mono.Data.Tds-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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.Xml.dll -r:./../../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 -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Xml.dll -r:./../../class/lib/net_4_x/Mono.Security.dll</flags>
       <output>Mono.Data.Tds.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/Mono.Data.Tds.dll</library_output>
     </project>
     <project dir="class/Mono.Data.Tds" library="Mono.Data.Tds-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/Mono.Data.Tds.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/Mono.Data.Tds.dll</flags>
       <output>net_4_x_Mono.Data.Tds_test.dll</output>
       <built_sources></built_sources>
       <library_output>net_4_x_Mono.Data.Tds_test.dll</library_output>
     </project>
     <project dir="class/System.Numerics" library="System.Numerics-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig /unsafe -d:MONO -r:./../../class/lib/net_4_x/System.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 /unsafe -nowarn:414 -r:./../../class/lib/net_4_x/System.dll</flags>
       <output>System.Numerics.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.Numerics.dll</library_output>
     </project>
     <project dir="class/System.Numerics" library="System.Numerics-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/System.Numerics.dll /unsafe -d:MONO -r:./../../class/lib/net_4_x/System.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.Numerics.dll /unsafe -nowarn:414 -r:./../../class/lib/net_4_x/System.dll</flags>
       <output>net_4_x_System.Numerics_test.dll</output>
       <built_sources></built_sources>
       <library_output>net_4_x_System.Numerics_test.dll</library_output>
     </project>
     <project dir="class/System.Numerics.Vectors" library="System.Numerics.Vectors-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:./../../class/lib/net_4_x/System.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 -unsafe -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Numerics.dll</flags>
       <output>System.Numerics.Vectors.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.Numerics.Vectors.dll</library_output>
       <fx_version>4.5</fx_version>
       <profile>net_4_x</profile>
       <resources></resources>
-      <response>System.Numerics.Vectors.dll.sources</response>
+      <response>./../../build/deps/net_4_x_System.Numerics.Vectors.dll.sources</response>
     </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 -d:DISABLE_CAS_USE -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: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>
       <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 -d:DISABLE_CAS_USE -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: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>
       <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.ComponentModel.DataAnnotations" library="System.ComponentModel.DataAnnotations-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -nowarn:414 -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Data.dll -r:./../../class/lib/net_4_x/System.Xml.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 -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Data.dll -r:./../../class/lib/net_4_x/System.Xml.dll</flags>
       <output>System.ComponentModel.DataAnnotations.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.ComponentModel.DataAnnotations.dll</library_output>
     </project>
     <project dir="class/System.ComponentModel.DataAnnotations" library="System.ComponentModel.DataAnnotations-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/System.ComponentModel.DataAnnotations.dll -nowarn:414 -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Data.dll -r:./../../class/lib/net_4_x/System.Xml.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.ComponentModel.DataAnnotations.dll -nowarn:414 -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Data.dll -r:./../../class/lib/net_4_x/System.Xml.dll</flags>
       <output>net_4_x_System.ComponentModel.DataAnnotations_test.dll</output>
       <built_sources></built_sources>
       <library_output>net_4_x_System.ComponentModel.DataAnnotations_test.dll</library_output>
     </project>
     <project dir="class/Accessibility" library="Accessibility-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig</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</flags>
       <output>Accessibility.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/Accessibility.dll</library_output>
     </project>
     <project dir="class/Mono.WebBrowser" library="Mono.WebBrowser-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -warn:1 -r:./../../class/lib/net_4_x/System.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 -warn:1 -r:./../../class/lib/net_4_x/System.dll</flags>
       <output>Mono.WebBrowser.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/Mono.WebBrowser.dll</library_output>
     </project>
     <project dir="class/System.Runtime.Serialization.Formatters.Soap" library="System.Runtime.Serialization.Formatters.Soap-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:./../../class/lib/net_4_x/System.Xml.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 -r:./../../class/lib/net_4_x/System.Xml.dll</flags>
       <output>System.Runtime.Serialization.Formatters.Soap.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.Runtime.Serialization.Formatters.Soap.dll</library_output>
     </project>
     <project dir="class/System.Runtime.Serialization.Formatters.Soap" library="System.Runtime.Serialization.Formatters.Soap-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/System.Runtime.Serialization.Formatters.Soap.dll -r:./../../class/lib/net_4_x/System.Xml.dll -nowarn:0618 -nowarn:219 -nowarn:169</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.Runtime.Serialization.Formatters.Soap.dll -r:./../../class/lib/net_4_x/System.Xml.dll -nowarn:0618 -nowarn:219 -nowarn:169</flags>
       <output>net_4_x_System.Runtime.Serialization.Formatters.Soap_test.dll</output>
       <built_sources></built_sources>
       <library_output>net_4_x_System.Runtime.Serialization.Formatters.Soap_test.dll</library_output>
     </project>
     <project dir="class/System.Windows.Forms" library="System.Windows.Forms-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig /unsafe @System.Windows.Forms.dll.resources -nowarn:618,612,809 -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Xml.dll -r:./../../class/lib/net_4_x/System.Drawing.dll -r:./../../class/lib/net_4_x/Accessibility.dll -r:./../../class/lib/net_4_x/System.Data.dll -r:./../../class/lib/net_4_x/Mono.Posix.dll -r:./../../class/lib/net_4_x/Mono.WebBrowser.dll -r:./../../class/lib/net_4_x/System.Configuration.dll -r:./../../class/lib/net_4_x/System.Runtime.Serialization.Formatters.Soap.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 /unsafe @System.Windows.Forms.dll.resources -nowarn:618,612,809 -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Xml.dll -r:./../../class/lib/net_4_x/System.Drawing.dll -r:./../../class/lib/net_4_x/Accessibility.dll -r:./../../class/lib/net_4_x/System.Data.dll -r:./../../class/lib/net_4_x/Mono.Posix.dll -r:./../../class/lib/net_4_x/Mono.WebBrowser.dll -r:./../../class/lib/net_4_x/System.Configuration.dll -r:./../../class/lib/net_4_x/System.Runtime.Serialization.Formatters.Soap.dll</flags>
       <output>System.Windows.Forms.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.Windows.Forms.dll</library_output>
     </project>
     <project dir="class/System.Windows.Forms" library="System.Windows.Forms-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/System.Windows.Forms.dll -resource:Test/resources/a.cur,a.cur -resource:Test/resources/32x32.ico,32x32.ico -nowarn:618,612</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.Windows.Forms.dll -resource:Test/resources/a.cur,a.cur -resource:Test/resources/32x32.ico,32x32.ico -nowarn:618,612</flags>
       <output>net_4_x_System.Windows.Forms_test.dll</output>
       <built_sources></built_sources>
       <library_output>net_4_x_System.Windows.Forms_test.dll</library_output>
     </project>
     <project dir="class/Mono.Data.Sqlite" library="Mono.Data.Sqlite-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/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/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Data.dll -r:./../../class/lib/net_4_x/System.Transactions.dll -r:./../../class/lib/net_4_x/System.Xml.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 /unsafe -resource:resources/SR.resources -resource:resources/SQLiteCommand.bmp -resource:resources/SQLiteConnection.bmp -resource:resources/SQLiteDataAdapter.bmp -d:SQLITE_STANDARD -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Data.dll -r:./../../class/lib/net_4_x/System.Transactions.dll -r:./../../class/lib/net_4_x/System.Xml.dll</flags>
       <output>Mono.Data.Sqlite.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/Mono.Data.Sqlite.dll</library_output>
     </project>
     <project dir="class/Mono.Data.Sqlite" library="Mono.Data.Sqlite-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/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/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Data.dll -r:./../../class/lib/net_4_x/System.Transactions.dll -r:./../../class/lib/net_4_x/System.Xml.dll /nowarn:618</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/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/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Data.dll -r:./../../class/lib/net_4_x/System.Transactions.dll -r:./../../class/lib/net_4_x/System.Xml.dll /nowarn:618</flags>
       <output>net_4_x_Mono.Data.Sqlite_test.dll</output>
       <built_sources></built_sources>
       <library_output>net_4_x_Mono.Data.Sqlite_test.dll</library_output>
     </project>
     <project dir="class/System.Web.ApplicationServices" library="System.Web.ApplicationServices-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -d:SYSTEM_WEB_APPLICATIONSERVICES -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Configuration.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:SYSTEM_WEB_APPLICATIONSERVICES -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Configuration.dll</flags>
       <output>System.Web.ApplicationServices.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.Web.ApplicationServices.dll</library_output>
     </project>
     <project dir="class/Novell.Directory.Ldap" library="Novell.Directory.Ldap-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -warn:1 -nowarn:612 -r:./../../class/lib/net_4_x/System.dll -r:./../../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 -warn:1 -nowarn:612 -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/Mono.Security.dll</flags>
       <output>Novell.Directory.Ldap.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/Novell.Directory.Ldap.dll</library_output>
     </project>
     <project dir="class/Novell.Directory.Ldap" library="Novell.Directory.Ldap-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/Novell.Directory.Ldap.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/Novell.Directory.Ldap.dll</flags>
       <output>net_4_x_Novell.Directory.Ldap_test.dll</output>
       <built_sources></built_sources>
       <library_output>net_4_x_Novell.Directory.Ldap_test.dll</library_output>
     </project>
     <project dir="class/System.DirectoryServices" library="System.DirectoryServices-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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/Novell.Directory.Ldap.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 -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/Novell.Directory.Ldap.dll</flags>
       <output>System.DirectoryServices.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.DirectoryServices.dll</library_output>
     </project>
     <project dir="class/System.DirectoryServices" library="System.DirectoryServices-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/System.DirectoryServices.dll -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/Novell.Directory.Ldap.dll -nowarn:0618 -nowarn:219 -nowarn:169</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.DirectoryServices.dll -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/Novell.Directory.Ldap.dll -nowarn:0618 -nowarn:219 -nowarn:169</flags>
       <output>net_4_x_System.DirectoryServices_test.dll</output>
       <built_sources></built_sources>
       <library_output>net_4_x_System.DirectoryServices_test.dll</library_output>
     </project>
     <project dir="class/System.Web" library="System.Web-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -unsafe -nowarn:612,618 -d:INSIDE_SYSTEM_WEB -nowarn:618 /resource:resources/WebUIValidation.js /resource:resources/folder.gif /resource:resources/file.gif /resource:resources/computer.gif /resource:resources/arrow_minus.gif /resource:resources/arrow_noexpand.gif /resource:resources/arrow_plus.gif /resource:resources/arrow_up.gif /resource:resources/arrow_down.gif /resource:resources/box_full.gif /resource:resources/box_empty.gif /resource:resources/box_minus.gif /resource:resources/box_noexpand.gif /resource:resources/box_plus.gif /resource:resources/contact.gif /resource:resources/dot_empty.gif /resource:resources/dot_full.gif /resource:resources/dots.gif /resource:resources/inbox.gif /resource:resources/star_empty.gif /resource:resources/star_full.gif /resource:resources/warning.gif /resource:resources/TreeView_noexpand.gif /resource:resources/TreeView_dash.gif /resource:resources/TreeView_dashminus.gif /resource:resources/TreeView_dashplus.gif /resource:resources/TreeView_i.gif /resource:resources/TreeView_l.gif /resource:resources/TreeView_lminus.gif /resource:resources/TreeView_lplus.gif /resource:resources/TreeView_minus.gif /resource:resources/TreeView_plus.gif /resource:resources/TreeView_r.gif /resource:resources/TreeView_rminus.gif /resource:resources/TreeView_rplus.gif /resource:resources/TreeView_t.gif /resource:resources/TreeView_tminus.gif /resource:resources/TreeView_tplus.gif /resource:resources/transparent.gif /resource:resources/webform.js /resource:resources/WebUIValidation_2.0.js /resource:resources/ErrorTemplateCommon_Top.html /resource:resources/DefaultErrorTemplate_CustomErrorDefault.html /resource:resources/ErrorTemplateCommon_Bottom.html /resource:resources/DefaultErrorTemplate_StandardPage.html /resource:resources/HtmlizedExceptionPage_Top.html /resource:resources/HtmlizedExceptionPage_FileLongSource.html /resource:resources/HtmlizedExceptionPage_FileShortSource.html /resource:resources/HtmlizedExceptionPage_CompilerOutput.html /resource:System.Web.UI.WebControls/GridView.js /resource:System.Web.UI.WebControls/DetailsView.js /resource:System.Web.UI.WebControls/TreeView.js /resource:System.Web.UI.WebControls/Menu.js /resource:System.Web.UI.WebControls/MenuModern.js -define:WEBSERVICES_DEP -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Drawing.dll -r:./../../class/lib/net_4_x/System.Data.dll -r:./../../class/lib/net_4_x/System.Xml.dll -r:./../../class/lib/net_4_x/System.EnterpriseServices.dll -r:./../../class/lib/net_4_x/System.Runtime.Serialization.Formatters.Soap.dll -r:./../../class/lib/net_4_x/System.ComponentModel.DataAnnotations.dll -r:./../../class/lib/net_4_x/System.Web.ApplicationServices.dll -r:./../../class/lib/net_4_x/System.Configuration.dll -r:./../../class/lib/net_4_x/Mono.Data.Sqlite.dll -r:./../../class/lib/net_4_x/System.Web.Services.dll -r:./../../class/lib/net_4_x/plaindesign/System.Design.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 -unsafe -nowarn:612,618 -d:INSIDE_SYSTEM_WEB -nowarn:618 /resource:resources/WebUIValidation.js /resource:resources/folder.gif /resource:resources/file.gif /resource:resources/computer.gif /resource:resources/arrow_minus.gif /resource:resources/arrow_noexpand.gif /resource:resources/arrow_plus.gif /resource:resources/arrow_up.gif /resource:resources/arrow_down.gif /resource:resources/box_full.gif /resource:resources/box_empty.gif /resource:resources/box_minus.gif /resource:resources/box_noexpand.gif /resource:resources/box_plus.gif /resource:resources/contact.gif /resource:resources/dot_empty.gif /resource:resources/dot_full.gif /resource:resources/dots.gif /resource:resources/inbox.gif /resource:resources/star_empty.gif /resource:resources/star_full.gif /resource:resources/warning.gif /resource:resources/TreeView_noexpand.gif /resource:resources/TreeView_dash.gif /resource:resources/TreeView_dashminus.gif /resource:resources/TreeView_dashplus.gif /resource:resources/TreeView_i.gif /resource:resources/TreeView_l.gif /resource:resources/TreeView_lminus.gif /resource:resources/TreeView_lplus.gif /resource:resources/TreeView_minus.gif /resource:resources/TreeView_plus.gif /resource:resources/TreeView_r.gif /resource:resources/TreeView_rminus.gif /resource:resources/TreeView_rplus.gif /resource:resources/TreeView_t.gif /resource:resources/TreeView_tminus.gif /resource:resources/TreeView_tplus.gif /resource:resources/transparent.gif /resource:resources/webform.js /resource:resources/WebUIValidation_2.0.js /resource:resources/ErrorTemplateCommon_Top.html /resource:resources/DefaultErrorTemplate_CustomErrorDefault.html /resource:resources/ErrorTemplateCommon_Bottom.html /resource:resources/DefaultErrorTemplate_StandardPage.html /resource:resources/HtmlizedExceptionPage_Top.html /resource:resources/HtmlizedExceptionPage_FileLongSource.html /resource:resources/HtmlizedExceptionPage_FileShortSource.html /resource:resources/HtmlizedExceptionPage_CompilerOutput.html /resource:System.Web.UI.WebControls/GridView.js /resource:System.Web.UI.WebControls/DetailsView.js /resource:System.Web.UI.WebControls/TreeView.js /resource:System.Web.UI.WebControls/Menu.js /resource:System.Web.UI.WebControls/MenuModern.js -define:WEBSERVICES_DEP -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Drawing.dll -r:./../../class/lib/net_4_x/System.Data.dll -r:./../../class/lib/net_4_x/System.Xml.dll -r:./../../class/lib/net_4_x/System.EnterpriseServices.dll -r:./../../class/lib/net_4_x/System.Runtime.Serialization.Formatters.Soap.dll -r:./../../class/lib/net_4_x/System.ComponentModel.DataAnnotations.dll -r:./../../class/lib/net_4_x/System.Web.ApplicationServices.dll -r:./../../class/lib/net_4_x/System.Configuration.dll -r:./../../class/lib/net_4_x/Mono.Data.Sqlite.dll -r:./../../class/lib/net_4_x/System.Web.Services.dll -r:./../../class/lib/net_4_x/plaindesign/System.Design.dll</flags>
       <output>System.Web.dll</output>
       <built_sources>System.Web/UplevelHelper.cs</built_sources>
       <library_output>./../../class/lib/net_4_x/System.Web.dll</library_output>
     </project>
     <project dir="class/System.Web" library="System.Web-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/plainweb/System.Web.dll -unsafe -nowarn:612,618 -d:INSIDE_SYSTEM_WEB -nowarn:618 /resource:resources/WebUIValidation.js /resource:resources/folder.gif /resource:resources/file.gif /resource:resources/computer.gif /resource:resources/arrow_minus.gif /resource:resources/arrow_noexpand.gif /resource:resources/arrow_plus.gif /resource:resources/arrow_up.gif /resource:resources/arrow_down.gif /resource:resources/box_full.gif /resource:resources/box_empty.gif /resource:resources/box_minus.gif /resource:resources/box_noexpand.gif /resource:resources/box_plus.gif /resource:resources/contact.gif /resource:resources/dot_empty.gif /resource:resources/dot_full.gif /resource:resources/dots.gif /resource:resources/inbox.gif /resource:resources/star_empty.gif /resource:resources/star_full.gif /resource:resources/warning.gif /resource:resources/TreeView_noexpand.gif /resource:resources/TreeView_dash.gif /resource:resources/TreeView_dashminus.gif /resource:resources/TreeView_dashplus.gif /resource:resources/TreeView_i.gif /resource:resources/TreeView_l.gif /resource:resources/TreeView_lminus.gif /resource:resources/TreeView_lplus.gif /resource:resources/TreeView_minus.gif /resource:resources/TreeView_plus.gif /resource:resources/TreeView_r.gif /resource:resources/TreeView_rminus.gif /resource:resources/TreeView_rplus.gif /resource:resources/TreeView_t.gif /resource:resources/TreeView_tminus.gif /resource:resources/TreeView_tplus.gif /resource:resources/transparent.gif /resource:resources/webform.js /resource:resources/WebUIValidation_2.0.js /resource:resources/ErrorTemplateCommon_Top.html /resource:resources/DefaultErrorTemplate_CustomErrorDefault.html /resource:resources/ErrorTemplateCommon_Bottom.html /resource:resources/DefaultErrorTemplate_StandardPage.html /resource:resources/HtmlizedExceptionPage_Top.html /resource:resources/HtmlizedExceptionPage_FileLongSource.html /resource:resources/HtmlizedExceptionPage_FileShortSource.html /resource:resources/HtmlizedExceptionPage_CompilerOutput.html /resource:System.Web.UI.WebControls/GridView.js /resource:System.Web.UI.WebControls/DetailsView.js /resource:System.Web.UI.WebControls/TreeView.js /resource:System.Web.UI.WebControls/Menu.js /resource:System.Web.UI.WebControls/MenuModern.js -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Drawing.dll -r:./../../class/lib/net_4_x/System.Data.dll -r:./../../class/lib/net_4_x/System.Xml.dll -r:./../../class/lib/net_4_x/System.EnterpriseServices.dll -r:./../../class/lib/net_4_x/System.Runtime.Serialization.Formatters.Soap.dll -r:./../../class/lib/net_4_x/System.ComponentModel.DataAnnotations.dll -r:./../../class/lib/net_4_x/System.Web.ApplicationServices.dll -r:./../../class/lib/net_4_x/System.Configuration.dll -r:./../../class/lib/net_4_x/Mono.Data.Sqlite.dll -doc:net_4_x_System.Web_test.xml -nowarn:219,169,1591 /resource:Test/mainsoft/NunitWeb/NunitWeb/Resources/Global.asax /resource:Test/mainsoft/NunitWeb/NunitWeb/Resources/My.ashx /resource:Test/mainsoft/NunitWeb/NunitWeb/Resources/My.master /resource:Test/mainsoft/NunitWeb/NunitWeb/Resources/MyPage.aspx /resource:Test/mainsoft/NunitWeb/NunitWeb/Resources/MyPage.aspx.cs /resource:Test/mainsoft/NunitWeb/NunitWeb/Resources/MyPageWithMaster.aspx /resource:Test/mainsoft/NunitWeb/NunitWeb/Resources/Web.mono.config /resource:Test/mainsoft/NunitWeb/NunitWeb/Resources/Web.mono.config.4.0 /resource:Test/mainsoft/NunitWeb/NunitWeb/Resources/sub_map_01.sitemap /resource:Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_01.sitemap /resource:Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_02.sitemap /resource:Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_03.sitemap /resource:Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_04.sitemap /resource:Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_05.sitemap /resource:Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_06.sitemap /resource:Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_07.sitemap /resource:Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_08.sitemap /resource:Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_09.sitemap /resource:Test/mainsoft/NunitWebResources/menuclass.aspx /resource:Test/mainsoft/NunitWebResources/FormView.aspx /resource:Test/mainsoft/NunitWebResources/PostBackMenuTest.aspx /resource:Test/mainsoft/NunitWebResources/PageWithStyleSheet.aspx /resource:Test/mainsoft/NunitWebResources/PageWithTheme.aspx /resource:Test/mainsoft/NunitWebResources/ResolveUrl.ascx /resource:Test/mainsoft/NunitWebResources/ResolveUrl.aspx /resource:Test/mainsoft/NunitWebResources/RunTimeSetTheme.aspx /resource:Test/mainsoft/NunitWebResources/ReadOnlyPropertyBind.aspx /resource:Test/mainsoft/NunitWebResources/ReadOnlyPropertyControl.ascx /resource:Test/mainsoft/NunitWebResources/Theme1.skin /resource:Test/mainsoft/NunitWebResources/Theme2.skin /resource:Test/mainsoft/NunitWebResources/UrlProperty.aspx /resource:Test/mainsoft/NunitWebResources/UrlProperty.ascx /resource:Test/mainsoft/NunitWebResources/UrlProperty.ascx.cs /resource:Test/mainsoft/NunitWebResources/Web.sitemap /resource:Test/mainsoft/NunitWebResources/WizardTest.skin /resource:Test/mainsoft/NunitWebResources/FooterTemplateTest.aspx /resource:Test/mainsoft/NunitWebResources/DataGrid.aspx /resource:Test/mainsoft/NunitWebResources/DetailsViewTemplates.aspx /resource:Test/mainsoft/NunitWebResources/DetailsViewTemplates_2.aspx /resource:Test/mainsoft/NunitWebResources/DetailsViewTemplates_3.aspx /resource:Test/mainsoft/NunitWebResources/DetailsViewDataActions.aspx /resource:Test/mainsoft/NunitWebResources/DetailsViewProperties1.aspx /resource:Test/mainsoft/NunitWebResources/Bluehills.jpg /resource:Test/mainsoft/NunitWebResources/FormViewTest1.aspx /resource:Test/mainsoft/NunitWebResources/FormViewTest1_2.aspx /resource:Test/mainsoft/NunitWebResources/FormViewTest1_3.aspx /resource:Test/mainsoft/NunitWebResources/FormViewTest1_4.aspx /resource:Test/mainsoft/NunitWebResources/FormViewInsertEditDelete.aspx /resource:Test/mainsoft/NunitWebResources/GridViewUpdate.aspx /resource:Test/mainsoft/NunitWebResources/XMLDataSourceTest.xml /resource:Test/mainsoft/NunitWebResources/XMLDataSourceTest.xsl /resource:Test/mainsoft/NunitWebResources/XMLDataSourceTest1.aspx /resource:Test/mainsoft/NunitWebResources/XMLDataSourceTest2.aspx /resource:Test/mainsoft/NunitWebResources/XMLDataSourceTest3.aspx /resource:Test/mainsoft/NunitWebResources/XMLDataSourceTest4.aspx /resource:Test/mainsoft/NunitWebResources/LoginViewTest1.aspx /resource:Test/mainsoft/NunitWebResources/WebControl.config /resource:Test/mainsoft/NunitWebResources/WebLogin.config /resource:Test/mainsoft/NunitWebResources/CallbackTest1.aspx /resource:Test/mainsoft/NunitWebResources/CallbackTest2.aspx /resource:Test/mainsoft/NunitWebResources/EventValidationTest2.aspx /resource:Test/mainsoft/NunitWebResources/EventValidationTest1.aspx /resource:Test/mainsoft/NunitWebResources/ClientScript.js /resource:Test/mainsoft/NunitWebResources/EvalTest.aspx /resource:Test/mainsoft/NunitWebResources/TemplateUserControl.ascx /resource:Test/mainsoft/NunitWebResources/WebMapping.config /resource:Test/mainsoft/NunitWebResources/Mapping.aspx /resource:Test/mainsoft/NunitWebResources/Mapping1.aspx /resource:Test/mainsoft/NunitWebResources/CrossPagePosting1.aspx /resource:Test/mainsoft/NunitWebResources/CrossPagePosting2.aspx /resource:Test/mainsoft/NunitWebResources/MyDerived.master /resource:Test/mainsoft/NunitWebResources/MyPageWithDerivedMaster.aspx /resource:Test/mainsoft/NunitWebResources/MasterTypeTest1.aspx /resource:Test/mainsoft/NunitWebResources/MasterTypeTest2.aspx /resource:Test/mainsoft/NunitWebResources/PageLifecycleTest.aspx /resource:Test/mainsoft/NunitWebResources/PageValidationTest.aspx /resource:Test/mainsoft/NunitWebResources/AsyncPage.aspx /resource:Test/mainsoft/NunitWebResources/PageCultureTest.aspx /resource:Test/mainsoft/NunitWebResources/adapters.browser /resource:Test/mainsoft/NunitWebResources/NoEventValidation.aspx /resource:Test/mainsoft/NunitWebResources/ListControlPage.aspx /resource:Test/mainsoft/NunitWebResources/TextBoxTestlPage.aspx /resource:Test/mainsoft/NunitWebResources/ClearErrorOnError.aspx /resource:Test/mainsoft/NunitWebResources/RedirectOnError.aspx /resource:Test/mainsoft/NunitWebResources/TestCapability.browser /resource:Test/mainsoft/NunitWebResources/PageWithAdapter.aspx /resource:Test/mainsoft/NunitWebResources/InvalidPropertyBind1.aspx /resource:Test/mainsoft/NunitWebResources/InvalidPropertyBind2.aspx /resource:Test/mainsoft/NunitWebResources/InvalidPropertyBind3.aspx /resource:Test/mainsoft/NunitWebResources/InvalidPropertyBind4.aspx /resource:Test/mainsoft/NunitWebResources/ValidPropertyBind1.aspx /resource:Test/mainsoft/NunitWebResources/ValidPropertyBind2.aspx /resource:Test/mainsoft/NunitWebResources/ValidPropertyBind3.aspx /resource:Test/mainsoft/NunitWebResources/ValidPropertyBind4.aspx /resource:Test/mainsoft/NunitWebResources/ValidPropertyBind5.aspx /resource:Test/mainsoft/NunitWebResources/ReadWritePropertyControl.ascx /resource:Test/mainsoft/MainsoftWebTest/nunitweb_config.xml /resource:Test/mainsoft/NunitWebResources/TemplateControlParsingTest.aspx /resource:Test/mainsoft/NunitWebResources/ContentPlaceHolderInTemplate.aspx /resource:Test/mainsoft/NunitWebResources/ContentPlaceHolderInTemplate.master /resource:Test/mainsoft/NunitWebResources/MissingMasterFile.aspx /resource:Test/mainsoft/NunitWebResources/CustomSectionEmptyCollection.aspx /resource:Test/mainsoft/NunitWebResources/NoDoubleOnInitOnRemoveAdd.aspx /resource:Test/mainsoft/NunitWebResources/NoDoubleOnInitOnRemoveAdd.aspx.cs /resource:Test/mainsoft/NunitWebResources/LoginDisplayRememberMe.aspx /resource:Test/mainsoft/NunitWebResources/NoBindForMethodsWithBindInName.aspx /resource:Test/mainsoft/NunitWebResources/LinkInHeadWithEmbeddedExpression.aspx /resource:Test/mainsoft/NunitWebResources/ExpressionInListControl.aspx /resource:Test/mainsoft/NunitWebResources/ServerSideControlsInScriptBlock.aspx /resource:Test/mainsoft/NunitWebResources/ServerControlInClientSideComment.aspx /resource:Test/mainsoft/NunitWebResources/PreprocessorDirectivesInMarkup.aspx /resource:Test/mainsoft/NunitWebResources/UnquotedAngleBrackets.aspx /resource:Test/mainsoft/NunitWebResources/FullTagsInText.aspx /resource:Test/mainsoft/NunitWebResources/TagsExpressionsAndCommentsInText.aspx /resource:Test/mainsoft/NunitWebResources/NewlineInCodeExpression.aspx /resource:Test/mainsoft/NunitWebResources/DuplicateControlsInClientComment.aspx /resource:Test/mainsoft/NunitWebResources/TagsNestedInClientTag.aspx /resource:Test/mainsoft/NunitWebResources/ConditionalClientComments.aspx /resource:Test/mainsoft/NunitWebResources/OneLetterIdentifierInCodeRender.aspx /resource:Test/mainsoft/NunitWebResources/GlobalResourcesLocalization.aspx /resource:Test/mainsoft/NunitWebResources/TableSections_Bug551666.aspx /resource:Test/mainsoft/NunitWebResources/TableSections_Bug551666.aspx.cs /resource:Test/mainsoft/NunitWebResources/NestedParserFileText.aspx /resource:Test/mainsoft/NunitWebResources/StateFormatter_CorrectConverter.aspx /resource:Test/mainsoft/NunitWebResources/StateFormatter_CollectionConverter.aspx /resource:Test/mainsoft/NunitWebResources/StateFormatter_CollectionConverter.aspx.cs /resource:Test/mainsoft/NunitWebResources/ChangePasswordContainer_FindControl.aspx /resource:Test/mainsoft/NunitWebResources/TagWithExpressionWithinAttribute.aspx /resource:Test/mainsoft/NunitWebResources/CheckBoxList_Bug377703_1.aspx /resource:Test/mainsoft/NunitWebResources/CheckBoxList_Bug377703_2.aspx /resource:Test/mainsoft/NunitWebResources/CheckBoxList_Bug578770.aspx /resource:Test/mainsoft/NunitWebResources/EnumConverter_Bug578586.aspx /resource:Test/mainsoft/NunitWebResources/ButtonColor_Bug325489.aspx /resource:Test/mainsoft/NunitWebResources/SqlDataSource_OnInit_Bug572781.aspx /resource:Test/mainsoft/NunitWebResources/FormViewPagerVisibility.aspx /resource:Test/mainsoft/NunitWebResources/OverridenControlsPropertyAndPostBack_Bug594238.aspx /resource:Test/mainsoft/NunitWebResources/GlobalizationEncodingName.aspx /resource:Test/mainsoft/NunitWebResources/CheckBoxField_Bug595568_0.aspx /resource:Test/mainsoft/NunitWebResources/CheckBoxField_Bug595568_1.aspx /resource:Test/mainsoft/NunitWebResources/CheckBoxField_Bug595568_2.aspx /resource:Test/mainsoft/NunitWebResources/CheckBoxField_Bug595568_5.aspx /resource:Test/mainsoft/NunitWebResources/CheckBoxField_Bug595568_6.aspx /resource:Test/mainsoft/NunitWebResources/CheckBoxField_Bug595568_7.aspx /resource:Test/mainsoft/NunitWebResources/GridView_Bug595567.aspx /resource:Test/mainsoft/NunitWebResources/CheckBoxList_Bug600415.aspx /resource:Test/mainsoft/NunitWebResources/BoundField_Bug646505.aspx /resource:Test/mainsoft/NunitWebResources/BoundField_Bug646505.aspx.cs /resource:Test/mainsoft/NunitWebResources/HtmlTitleCodeRender_Bug662918.aspx /resource:Test/mainsoft/NunitWebResources/App_Code/EnumConverterControl.cs,App_Code/EnumConverterControl.cs /resource:Test/mainsoft/NunitWebResources/App_Code/MyContainer.cs,App_Code/MyContainer.cs /resource:Test/mainsoft/NunitWebResources/App_Code/CustomCheckBoxColumn.cs,App_Code/CustomCheckBoxColumn.cs /resource:Test/mainsoft/NunitWebResources/App_GlobalResources/Common.resx,App_GlobalResources/Common.resx /resource:Test/mainsoft/NunitWebResources/App_GlobalResources/Common.fr-FR.resx,App_GlobalResources/Common.fr-FR.resx /resource:Test/mainsoft/NunitWebResources/App_GlobalResources/Resource1.resx,App_GlobalResources/Resource1.resx</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/plainweb/System.Web.dll -unsafe -nowarn:612,618 -d:INSIDE_SYSTEM_WEB -nowarn:618 /resource:resources/WebUIValidation.js /resource:resources/folder.gif /resource:resources/file.gif /resource:resources/computer.gif /resource:resources/arrow_minus.gif /resource:resources/arrow_noexpand.gif /resource:resources/arrow_plus.gif /resource:resources/arrow_up.gif /resource:resources/arrow_down.gif /resource:resources/box_full.gif /resource:resources/box_empty.gif /resource:resources/box_minus.gif /resource:resources/box_noexpand.gif /resource:resources/box_plus.gif /resource:resources/contact.gif /resource:resources/dot_empty.gif /resource:resources/dot_full.gif /resource:resources/dots.gif /resource:resources/inbox.gif /resource:resources/star_empty.gif /resource:resources/star_full.gif /resource:resources/warning.gif /resource:resources/TreeView_noexpand.gif /resource:resources/TreeView_dash.gif /resource:resources/TreeView_dashminus.gif /resource:resources/TreeView_dashplus.gif /resource:resources/TreeView_i.gif /resource:resources/TreeView_l.gif /resource:resources/TreeView_lminus.gif /resource:resources/TreeView_lplus.gif /resource:resources/TreeView_minus.gif /resource:resources/TreeView_plus.gif /resource:resources/TreeView_r.gif /resource:resources/TreeView_rminus.gif /resource:resources/TreeView_rplus.gif /resource:resources/TreeView_t.gif /resource:resources/TreeView_tminus.gif /resource:resources/TreeView_tplus.gif /resource:resources/transparent.gif /resource:resources/webform.js /resource:resources/WebUIValidation_2.0.js /resource:resources/ErrorTemplateCommon_Top.html /resource:resources/DefaultErrorTemplate_CustomErrorDefault.html /resource:resources/ErrorTemplateCommon_Bottom.html /resource:resources/DefaultErrorTemplate_StandardPage.html /resource:resources/HtmlizedExceptionPage_Top.html /resource:resources/HtmlizedExceptionPage_FileLongSource.html /resource:resources/HtmlizedExceptionPage_FileShortSource.html /resource:resources/HtmlizedExceptionPage_CompilerOutput.html /resource:System.Web.UI.WebControls/GridView.js /resource:System.Web.UI.WebControls/DetailsView.js /resource:System.Web.UI.WebControls/TreeView.js /resource:System.Web.UI.WebControls/Menu.js /resource:System.Web.UI.WebControls/MenuModern.js -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Drawing.dll -r:./../../class/lib/net_4_x/System.Data.dll -r:./../../class/lib/net_4_x/System.Xml.dll -r:./../../class/lib/net_4_x/System.EnterpriseServices.dll -r:./../../class/lib/net_4_x/System.Runtime.Serialization.Formatters.Soap.dll -r:./../../class/lib/net_4_x/System.ComponentModel.DataAnnotations.dll -r:./../../class/lib/net_4_x/System.Web.ApplicationServices.dll -r:./../../class/lib/net_4_x/System.Configuration.dll -r:./../../class/lib/net_4_x/Mono.Data.Sqlite.dll -doc:net_4_x_System.Web_test.xml -nowarn:219,169,1591 /resource:Test/mainsoft/NunitWeb/NunitWeb/Resources/Global.asax /resource:Test/mainsoft/NunitWeb/NunitWeb/Resources/My.ashx /resource:Test/mainsoft/NunitWeb/NunitWeb/Resources/My.master /resource:Test/mainsoft/NunitWeb/NunitWeb/Resources/MyPage.aspx /resource:Test/mainsoft/NunitWeb/NunitWeb/Resources/MyPage.aspx.cs /resource:Test/mainsoft/NunitWeb/NunitWeb/Resources/MyPageWithMaster.aspx /resource:Test/mainsoft/NunitWeb/NunitWeb/Resources/Web.mono.config /resource:Test/mainsoft/NunitWeb/NunitWeb/Resources/Web.mono.config.4.0 /resource:Test/mainsoft/NunitWeb/NunitWeb/Resources/sub_map_01.sitemap /resource:Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_01.sitemap /resource:Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_02.sitemap /resource:Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_03.sitemap /resource:Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_04.sitemap /resource:Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_05.sitemap /resource:Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_06.sitemap /resource:Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_07.sitemap /resource:Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_08.sitemap /resource:Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_09.sitemap /resource:Test/mainsoft/NunitWebResources/menuclass.aspx /resource:Test/mainsoft/NunitWebResources/FormView.aspx /resource:Test/mainsoft/NunitWebResources/PostBackMenuTest.aspx /resource:Test/mainsoft/NunitWebResources/PageWithStyleSheet.aspx /resource:Test/mainsoft/NunitWebResources/PageWithTheme.aspx /resource:Test/mainsoft/NunitWebResources/ResolveUrl.ascx /resource:Test/mainsoft/NunitWebResources/ResolveUrl.aspx /resource:Test/mainsoft/NunitWebResources/RunTimeSetTheme.aspx /resource:Test/mainsoft/NunitWebResources/ReadOnlyPropertyBind.aspx /resource:Test/mainsoft/NunitWebResources/ReadOnlyPropertyControl.ascx /resource:Test/mainsoft/NunitWebResources/Theme1.skin /resource:Test/mainsoft/NunitWebResources/Theme2.skin /resource:Test/mainsoft/NunitWebResources/UrlProperty.aspx /resource:Test/mainsoft/NunitWebResources/UrlProperty.ascx /resource:Test/mainsoft/NunitWebResources/UrlProperty.ascx.cs /resource:Test/mainsoft/NunitWebResources/Web.sitemap /resource:Test/mainsoft/NunitWebResources/WizardTest.skin /resource:Test/mainsoft/NunitWebResources/FooterTemplateTest.aspx /resource:Test/mainsoft/NunitWebResources/DataGrid.aspx /resource:Test/mainsoft/NunitWebResources/DetailsViewTemplates.aspx /resource:Test/mainsoft/NunitWebResources/DetailsViewTemplates_2.aspx /resource:Test/mainsoft/NunitWebResources/DetailsViewTemplates_3.aspx /resource:Test/mainsoft/NunitWebResources/DetailsViewDataActions.aspx /resource:Test/mainsoft/NunitWebResources/DetailsViewProperties1.aspx /resource:Test/mainsoft/NunitWebResources/Bluehills.jpg /resource:Test/mainsoft/NunitWebResources/FormViewTest1.aspx /resource:Test/mainsoft/NunitWebResources/FormViewTest1_2.aspx /resource:Test/mainsoft/NunitWebResources/FormViewTest1_3.aspx /resource:Test/mainsoft/NunitWebResources/FormViewTest1_4.aspx /resource:Test/mainsoft/NunitWebResources/FormViewInsertEditDelete.aspx /resource:Test/mainsoft/NunitWebResources/GridViewUpdate.aspx /resource:Test/mainsoft/NunitWebResources/XMLDataSourceTest.xml /resource:Test/mainsoft/NunitWebResources/XMLDataSourceTest.xsl /resource:Test/mainsoft/NunitWebResources/XMLDataSourceTest1.aspx /resource:Test/mainsoft/NunitWebResources/XMLDataSourceTest2.aspx /resource:Test/mainsoft/NunitWebResources/XMLDataSourceTest3.aspx /resource:Test/mainsoft/NunitWebResources/XMLDataSourceTest4.aspx /resource:Test/mainsoft/NunitWebResources/LoginViewTest1.aspx /resource:Test/mainsoft/NunitWebResources/WebControl.config /resource:Test/mainsoft/NunitWebResources/WebLogin.config /resource:Test/mainsoft/NunitWebResources/CallbackTest1.aspx /resource:Test/mainsoft/NunitWebResources/CallbackTest2.aspx /resource:Test/mainsoft/NunitWebResources/EventValidationTest2.aspx /resource:Test/mainsoft/NunitWebResources/EventValidationTest1.aspx /resource:Test/mainsoft/NunitWebResources/ClientScript.js /resource:Test/mainsoft/NunitWebResources/EvalTest.aspx /resource:Test/mainsoft/NunitWebResources/TemplateUserControl.ascx /resource:Test/mainsoft/NunitWebResources/WebMapping.config /resource:Test/mainsoft/NunitWebResources/Mapping.aspx /resource:Test/mainsoft/NunitWebResources/Mapping1.aspx /resource:Test/mainsoft/NunitWebResources/CrossPagePosting1.aspx /resource:Test/mainsoft/NunitWebResources/CrossPagePosting2.aspx /resource:Test/mainsoft/NunitWebResources/MyDerived.master /resource:Test/mainsoft/NunitWebResources/MyPageWithDerivedMaster.aspx /resource:Test/mainsoft/NunitWebResources/MasterTypeTest1.aspx /resource:Test/mainsoft/NunitWebResources/MasterTypeTest2.aspx /resource:Test/mainsoft/NunitWebResources/PageLifecycleTest.aspx /resource:Test/mainsoft/NunitWebResources/PageValidationTest.aspx /resource:Test/mainsoft/NunitWebResources/AsyncPage.aspx /resource:Test/mainsoft/NunitWebResources/PageCultureTest.aspx /resource:Test/mainsoft/NunitWebResources/adapters.browser /resource:Test/mainsoft/NunitWebResources/NoEventValidation.aspx /resource:Test/mainsoft/NunitWebResources/ListControlPage.aspx /resource:Test/mainsoft/NunitWebResources/TextBoxTestlPage.aspx /resource:Test/mainsoft/NunitWebResources/ClearErrorOnError.aspx /resource:Test/mainsoft/NunitWebResources/RedirectOnError.aspx /resource:Test/mainsoft/NunitWebResources/TestCapability.browser /resource:Test/mainsoft/NunitWebResources/PageWithAdapter.aspx /resource:Test/mainsoft/NunitWebResources/InvalidPropertyBind1.aspx /resource:Test/mainsoft/NunitWebResources/InvalidPropertyBind2.aspx /resource:Test/mainsoft/NunitWebResources/InvalidPropertyBind3.aspx /resource:Test/mainsoft/NunitWebResources/InvalidPropertyBind4.aspx /resource:Test/mainsoft/NunitWebResources/ValidPropertyBind1.aspx /resource:Test/mainsoft/NunitWebResources/ValidPropertyBind2.aspx /resource:Test/mainsoft/NunitWebResources/ValidPropertyBind3.aspx /resource:Test/mainsoft/NunitWebResources/ValidPropertyBind4.aspx /resource:Test/mainsoft/NunitWebResources/ValidPropertyBind5.aspx /resource:Test/mainsoft/NunitWebResources/ReadWritePropertyControl.ascx /resource:Test/mainsoft/MainsoftWebTest/nunitweb_config.xml /resource:Test/mainsoft/NunitWebResources/TemplateControlParsingTest.aspx /resource:Test/mainsoft/NunitWebResources/ContentPlaceHolderInTemplate.aspx /resource:Test/mainsoft/NunitWebResources/ContentPlaceHolderInTemplate.master /resource:Test/mainsoft/NunitWebResources/MissingMasterFile.aspx /resource:Test/mainsoft/NunitWebResources/CustomSectionEmptyCollection.aspx /resource:Test/mainsoft/NunitWebResources/NoDoubleOnInitOnRemoveAdd.aspx /resource:Test/mainsoft/NunitWebResources/NoDoubleOnInitOnRemoveAdd.aspx.cs /resource:Test/mainsoft/NunitWebResources/LoginDisplayRememberMe.aspx /resource:Test/mainsoft/NunitWebResources/NoBindForMethodsWithBindInName.aspx /resource:Test/mainsoft/NunitWebResources/LinkInHeadWithEmbeddedExpression.aspx /resource:Test/mainsoft/NunitWebResources/ExpressionInListControl.aspx /resource:Test/mainsoft/NunitWebResources/ServerSideControlsInScriptBlock.aspx /resource:Test/mainsoft/NunitWebResources/ServerControlInClientSideComment.aspx /resource:Test/mainsoft/NunitWebResources/PreprocessorDirectivesInMarkup.aspx /resource:Test/mainsoft/NunitWebResources/UnquotedAngleBrackets.aspx /resource:Test/mainsoft/NunitWebResources/FullTagsInText.aspx /resource:Test/mainsoft/NunitWebResources/TagsExpressionsAndCommentsInText.aspx /resource:Test/mainsoft/NunitWebResources/NewlineInCodeExpression.aspx /resource:Test/mainsoft/NunitWebResources/DuplicateControlsInClientComment.aspx /resource:Test/mainsoft/NunitWebResources/TagsNestedInClientTag.aspx /resource:Test/mainsoft/NunitWebResources/ConditionalClientComments.aspx /resource:Test/mainsoft/NunitWebResources/OneLetterIdentifierInCodeRender.aspx /resource:Test/mainsoft/NunitWebResources/GlobalResourcesLocalization.aspx /resource:Test/mainsoft/NunitWebResources/TableSections_Bug551666.aspx /resource:Test/mainsoft/NunitWebResources/TableSections_Bug551666.aspx.cs /resource:Test/mainsoft/NunitWebResources/NestedParserFileText.aspx /resource:Test/mainsoft/NunitWebResources/StateFormatter_CorrectConverter.aspx /resource:Test/mainsoft/NunitWebResources/StateFormatter_CollectionConverter.aspx /resource:Test/mainsoft/NunitWebResources/StateFormatter_CollectionConverter.aspx.cs /resource:Test/mainsoft/NunitWebResources/ChangePasswordContainer_FindControl.aspx /resource:Test/mainsoft/NunitWebResources/TagWithExpressionWithinAttribute.aspx /resource:Test/mainsoft/NunitWebResources/CheckBoxList_Bug377703_1.aspx /resource:Test/mainsoft/NunitWebResources/CheckBoxList_Bug377703_2.aspx /resource:Test/mainsoft/NunitWebResources/CheckBoxList_Bug578770.aspx /resource:Test/mainsoft/NunitWebResources/EnumConverter_Bug578586.aspx /resource:Test/mainsoft/NunitWebResources/ButtonColor_Bug325489.aspx /resource:Test/mainsoft/NunitWebResources/SqlDataSource_OnInit_Bug572781.aspx /resource:Test/mainsoft/NunitWebResources/FormViewPagerVisibility.aspx /resource:Test/mainsoft/NunitWebResources/OverridenControlsPropertyAndPostBack_Bug594238.aspx /resource:Test/mainsoft/NunitWebResources/GlobalizationEncodingName.aspx /resource:Test/mainsoft/NunitWebResources/CheckBoxField_Bug595568_0.aspx /resource:Test/mainsoft/NunitWebResources/CheckBoxField_Bug595568_1.aspx /resource:Test/mainsoft/NunitWebResources/CheckBoxField_Bug595568_2.aspx /resource:Test/mainsoft/NunitWebResources/CheckBoxField_Bug595568_5.aspx /resource:Test/mainsoft/NunitWebResources/CheckBoxField_Bug595568_6.aspx /resource:Test/mainsoft/NunitWebResources/CheckBoxField_Bug595568_7.aspx /resource:Test/mainsoft/NunitWebResources/GridView_Bug595567.aspx /resource:Test/mainsoft/NunitWebResources/CheckBoxList_Bug600415.aspx /resource:Test/mainsoft/NunitWebResources/BoundField_Bug646505.aspx /resource:Test/mainsoft/NunitWebResources/BoundField_Bug646505.aspx.cs /resource:Test/mainsoft/NunitWebResources/HtmlTitleCodeRender_Bug662918.aspx /resource:Test/mainsoft/NunitWebResources/App_Code/EnumConverterControl.cs,App_Code/EnumConverterControl.cs /resource:Test/mainsoft/NunitWebResources/App_Code/MyContainer.cs,App_Code/MyContainer.cs /resource:Test/mainsoft/NunitWebResources/App_Code/CustomCheckBoxColumn.cs,App_Code/CustomCheckBoxColumn.cs /resource:Test/mainsoft/NunitWebResources/App_GlobalResources/Common.resx,App_GlobalResources/Common.resx /resource:Test/mainsoft/NunitWebResources/App_GlobalResources/Common.fr-FR.resx,App_GlobalResources/Common.fr-FR.resx /resource:Test/mainsoft/NunitWebResources/App_GlobalResources/Resource1.resx,App_GlobalResources/Resource1.resx</flags>
       <output>net_4_x_System.Web_test.dll</output>
       <built_sources>System.Web/UplevelHelper.cs</built_sources>
       <library_output>net_4_x_System.Web_test.dll</library_output>
     </project>
     <project dir="class/System.Web" library="System.Web-plainweb-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -unsafe -nowarn:612,618 -d:INSIDE_SYSTEM_WEB -nowarn:618 /resource:resources/WebUIValidation.js /resource:resources/folder.gif /resource:resources/file.gif /resource:resources/computer.gif /resource:resources/arrow_minus.gif /resource:resources/arrow_noexpand.gif /resource:resources/arrow_plus.gif /resource:resources/arrow_up.gif /resource:resources/arrow_down.gif /resource:resources/box_full.gif /resource:resources/box_empty.gif /resource:resources/box_minus.gif /resource:resources/box_noexpand.gif /resource:resources/box_plus.gif /resource:resources/contact.gif /resource:resources/dot_empty.gif /resource:resources/dot_full.gif /resource:resources/dots.gif /resource:resources/inbox.gif /resource:resources/star_empty.gif /resource:resources/star_full.gif /resource:resources/warning.gif /resource:resources/TreeView_noexpand.gif /resource:resources/TreeView_dash.gif /resource:resources/TreeView_dashminus.gif /resource:resources/TreeView_dashplus.gif /resource:resources/TreeView_i.gif /resource:resources/TreeView_l.gif /resource:resources/TreeView_lminus.gif /resource:resources/TreeView_lplus.gif /resource:resources/TreeView_minus.gif /resource:resources/TreeView_plus.gif /resource:resources/TreeView_r.gif /resource:resources/TreeView_rminus.gif /resource:resources/TreeView_rplus.gif /resource:resources/TreeView_t.gif /resource:resources/TreeView_tminus.gif /resource:resources/TreeView_tplus.gif /resource:resources/transparent.gif /resource:resources/webform.js /resource:resources/WebUIValidation_2.0.js /resource:resources/ErrorTemplateCommon_Top.html /resource:resources/DefaultErrorTemplate_CustomErrorDefault.html /resource:resources/ErrorTemplateCommon_Bottom.html /resource:resources/DefaultErrorTemplate_StandardPage.html /resource:resources/HtmlizedExceptionPage_Top.html /resource:resources/HtmlizedExceptionPage_FileLongSource.html /resource:resources/HtmlizedExceptionPage_FileShortSource.html /resource:resources/HtmlizedExceptionPage_CompilerOutput.html /resource:System.Web.UI.WebControls/GridView.js /resource:System.Web.UI.WebControls/DetailsView.js /resource:System.Web.UI.WebControls/TreeView.js /resource:System.Web.UI.WebControls/Menu.js /resource:System.Web.UI.WebControls/MenuModern.js -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Drawing.dll -r:./../../class/lib/net_4_x/System.Data.dll -r:./../../class/lib/net_4_x/System.Xml.dll -r:./../../class/lib/net_4_x/System.EnterpriseServices.dll -r:./../../class/lib/net_4_x/System.Runtime.Serialization.Formatters.Soap.dll -r:./../../class/lib/net_4_x/System.ComponentModel.DataAnnotations.dll -r:./../../class/lib/net_4_x/System.Web.ApplicationServices.dll -r:./../../class/lib/net_4_x/System.Configuration.dll -r:./../../class/lib/net_4_x/Mono.Data.Sqlite.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 -unsafe -nowarn:612,618 -d:INSIDE_SYSTEM_WEB -nowarn:618 /resource:resources/WebUIValidation.js /resource:resources/folder.gif /resource:resources/file.gif /resource:resources/computer.gif /resource:resources/arrow_minus.gif /resource:resources/arrow_noexpand.gif /resource:resources/arrow_plus.gif /resource:resources/arrow_up.gif /resource:resources/arrow_down.gif /resource:resources/box_full.gif /resource:resources/box_empty.gif /resource:resources/box_minus.gif /resource:resources/box_noexpand.gif /resource:resources/box_plus.gif /resource:resources/contact.gif /resource:resources/dot_empty.gif /resource:resources/dot_full.gif /resource:resources/dots.gif /resource:resources/inbox.gif /resource:resources/star_empty.gif /resource:resources/star_full.gif /resource:resources/warning.gif /resource:resources/TreeView_noexpand.gif /resource:resources/TreeView_dash.gif /resource:resources/TreeView_dashminus.gif /resource:resources/TreeView_dashplus.gif /resource:resources/TreeView_i.gif /resource:resources/TreeView_l.gif /resource:resources/TreeView_lminus.gif /resource:resources/TreeView_lplus.gif /resource:resources/TreeView_minus.gif /resource:resources/TreeView_plus.gif /resource:resources/TreeView_r.gif /resource:resources/TreeView_rminus.gif /resource:resources/TreeView_rplus.gif /resource:resources/TreeView_t.gif /resource:resources/TreeView_tminus.gif /resource:resources/TreeView_tplus.gif /resource:resources/transparent.gif /resource:resources/webform.js /resource:resources/WebUIValidation_2.0.js /resource:resources/ErrorTemplateCommon_Top.html /resource:resources/DefaultErrorTemplate_CustomErrorDefault.html /resource:resources/ErrorTemplateCommon_Bottom.html /resource:resources/DefaultErrorTemplate_StandardPage.html /resource:resources/HtmlizedExceptionPage_Top.html /resource:resources/HtmlizedExceptionPage_FileLongSource.html /resource:resources/HtmlizedExceptionPage_FileShortSource.html /resource:resources/HtmlizedExceptionPage_CompilerOutput.html /resource:System.Web.UI.WebControls/GridView.js /resource:System.Web.UI.WebControls/DetailsView.js /resource:System.Web.UI.WebControls/TreeView.js /resource:System.Web.UI.WebControls/Menu.js /resource:System.Web.UI.WebControls/MenuModern.js -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Drawing.dll -r:./../../class/lib/net_4_x/System.Data.dll -r:./../../class/lib/net_4_x/System.Xml.dll -r:./../../class/lib/net_4_x/System.EnterpriseServices.dll -r:./../../class/lib/net_4_x/System.Runtime.Serialization.Formatters.Soap.dll -r:./../../class/lib/net_4_x/System.ComponentModel.DataAnnotations.dll -r:./../../class/lib/net_4_x/System.Web.ApplicationServices.dll -r:./../../class/lib/net_4_x/System.Configuration.dll -r:./../../class/lib/net_4_x/Mono.Data.Sqlite.dll</flags>
       <output>System.Web.dll</output>
       <built_sources>System.Web/UplevelHelper.cs</built_sources>
       <library_output>./../../class/lib/net_4_x/plainweb/System.Web.dll</library_output>
     </project>
     <project dir="class/System.Web" library="System.Web-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/plainweb/System.Web.dll -unsafe -nowarn:612,618 -d:INSIDE_SYSTEM_WEB -nowarn:618 /resource:resources/WebUIValidation.js /resource:resources/folder.gif /resource:resources/file.gif /resource:resources/computer.gif /resource:resources/arrow_minus.gif /resource:resources/arrow_noexpand.gif /resource:resources/arrow_plus.gif /resource:resources/arrow_up.gif /resource:resources/arrow_down.gif /resource:resources/box_full.gif /resource:resources/box_empty.gif /resource:resources/box_minus.gif /resource:resources/box_noexpand.gif /resource:resources/box_plus.gif /resource:resources/contact.gif /resource:resources/dot_empty.gif /resource:resources/dot_full.gif /resource:resources/dots.gif /resource:resources/inbox.gif /resource:resources/star_empty.gif /resource:resources/star_full.gif /resource:resources/warning.gif /resource:resources/TreeView_noexpand.gif /resource:resources/TreeView_dash.gif /resource:resources/TreeView_dashminus.gif /resource:resources/TreeView_dashplus.gif /resource:resources/TreeView_i.gif /resource:resources/TreeView_l.gif /resource:resources/TreeView_lminus.gif /resource:resources/TreeView_lplus.gif /resource:resources/TreeView_minus.gif /resource:resources/TreeView_plus.gif /resource:resources/TreeView_r.gif /resource:resources/TreeView_rminus.gif /resource:resources/TreeView_rplus.gif /resource:resources/TreeView_t.gif /resource:resources/TreeView_tminus.gif /resource:resources/TreeView_tplus.gif /resource:resources/transparent.gif /resource:resources/webform.js /resource:resources/WebUIValidation_2.0.js /resource:resources/ErrorTemplateCommon_Top.html /resource:resources/DefaultErrorTemplate_CustomErrorDefault.html /resource:resources/ErrorTemplateCommon_Bottom.html /resource:resources/DefaultErrorTemplate_StandardPage.html /resource:resources/HtmlizedExceptionPage_Top.html /resource:resources/HtmlizedExceptionPage_FileLongSource.html /resource:resources/HtmlizedExceptionPage_FileShortSource.html /resource:resources/HtmlizedExceptionPage_CompilerOutput.html /resource:System.Web.UI.WebControls/GridView.js /resource:System.Web.UI.WebControls/DetailsView.js /resource:System.Web.UI.WebControls/TreeView.js /resource:System.Web.UI.WebControls/Menu.js /resource:System.Web.UI.WebControls/MenuModern.js -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Drawing.dll -r:./../../class/lib/net_4_x/System.Data.dll -r:./../../class/lib/net_4_x/System.Xml.dll -r:./../../class/lib/net_4_x/System.EnterpriseServices.dll -r:./../../class/lib/net_4_x/System.Runtime.Serialization.Formatters.Soap.dll -r:./../../class/lib/net_4_x/System.ComponentModel.DataAnnotations.dll -r:./../../class/lib/net_4_x/System.Web.ApplicationServices.dll -r:./../../class/lib/net_4_x/System.Configuration.dll -r:./../../class/lib/net_4_x/Mono.Data.Sqlite.dll -doc:net_4_x_System.Web_test.xml -nowarn:219,169,1591 /resource:Test/mainsoft/NunitWeb/NunitWeb/Resources/Global.asax /resource:Test/mainsoft/NunitWeb/NunitWeb/Resources/My.ashx /resource:Test/mainsoft/NunitWeb/NunitWeb/Resources/My.master /resource:Test/mainsoft/NunitWeb/NunitWeb/Resources/MyPage.aspx /resource:Test/mainsoft/NunitWeb/NunitWeb/Resources/MyPage.aspx.cs /resource:Test/mainsoft/NunitWeb/NunitWeb/Resources/MyPageWithMaster.aspx /resource:Test/mainsoft/NunitWeb/NunitWeb/Resources/Web.mono.config /resource:Test/mainsoft/NunitWeb/NunitWeb/Resources/Web.mono.config.4.0 /resource:Test/mainsoft/NunitWeb/NunitWeb/Resources/sub_map_01.sitemap /resource:Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_01.sitemap /resource:Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_02.sitemap /resource:Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_03.sitemap /resource:Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_04.sitemap /resource:Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_05.sitemap /resource:Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_06.sitemap /resource:Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_07.sitemap /resource:Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_08.sitemap /resource:Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_09.sitemap /resource:Test/mainsoft/NunitWebResources/menuclass.aspx /resource:Test/mainsoft/NunitWebResources/FormView.aspx /resource:Test/mainsoft/NunitWebResources/PostBackMenuTest.aspx /resource:Test/mainsoft/NunitWebResources/PageWithStyleSheet.aspx /resource:Test/mainsoft/NunitWebResources/PageWithTheme.aspx /resource:Test/mainsoft/NunitWebResources/ResolveUrl.ascx /resource:Test/mainsoft/NunitWebResources/ResolveUrl.aspx /resource:Test/mainsoft/NunitWebResources/RunTimeSetTheme.aspx /resource:Test/mainsoft/NunitWebResources/ReadOnlyPropertyBind.aspx /resource:Test/mainsoft/NunitWebResources/ReadOnlyPropertyControl.ascx /resource:Test/mainsoft/NunitWebResources/Theme1.skin /resource:Test/mainsoft/NunitWebResources/Theme2.skin /resource:Test/mainsoft/NunitWebResources/UrlProperty.aspx /resource:Test/mainsoft/NunitWebResources/UrlProperty.ascx /resource:Test/mainsoft/NunitWebResources/UrlProperty.ascx.cs /resource:Test/mainsoft/NunitWebResources/Web.sitemap /resource:Test/mainsoft/NunitWebResources/WizardTest.skin /resource:Test/mainsoft/NunitWebResources/FooterTemplateTest.aspx /resource:Test/mainsoft/NunitWebResources/DataGrid.aspx /resource:Test/mainsoft/NunitWebResources/DetailsViewTemplates.aspx /resource:Test/mainsoft/NunitWebResources/DetailsViewTemplates_2.aspx /resource:Test/mainsoft/NunitWebResources/DetailsViewTemplates_3.aspx /resource:Test/mainsoft/NunitWebResources/DetailsViewDataActions.aspx /resource:Test/mainsoft/NunitWebResources/DetailsViewProperties1.aspx /resource:Test/mainsoft/NunitWebResources/Bluehills.jpg /resource:Test/mainsoft/NunitWebResources/FormViewTest1.aspx /resource:Test/mainsoft/NunitWebResources/FormViewTest1_2.aspx /resource:Test/mainsoft/NunitWebResources/FormViewTest1_3.aspx /resource:Test/mainsoft/NunitWebResources/FormViewTest1_4.aspx /resource:Test/mainsoft/NunitWebResources/FormViewInsertEditDelete.aspx /resource:Test/mainsoft/NunitWebResources/GridViewUpdate.aspx /resource:Test/mainsoft/NunitWebResources/XMLDataSourceTest.xml /resource:Test/mainsoft/NunitWebResources/XMLDataSourceTest.xsl /resource:Test/mainsoft/NunitWebResources/XMLDataSourceTest1.aspx /resource:Test/mainsoft/NunitWebResources/XMLDataSourceTest2.aspx /resource:Test/mainsoft/NunitWebResources/XMLDataSourceTest3.aspx /resource:Test/mainsoft/NunitWebResources/XMLDataSourceTest4.aspx /resource:Test/mainsoft/NunitWebResources/LoginViewTest1.aspx /resource:Test/mainsoft/NunitWebResources/WebControl.config /resource:Test/mainsoft/NunitWebResources/WebLogin.config /resource:Test/mainsoft/NunitWebResources/CallbackTest1.aspx /resource:Test/mainsoft/NunitWebResources/CallbackTest2.aspx /resource:Test/mainsoft/NunitWebResources/EventValidationTest2.aspx /resource:Test/mainsoft/NunitWebResources/EventValidationTest1.aspx /resource:Test/mainsoft/NunitWebResources/ClientScript.js /resource:Test/mainsoft/NunitWebResources/EvalTest.aspx /resource:Test/mainsoft/NunitWebResources/TemplateUserControl.ascx /resource:Test/mainsoft/NunitWebResources/WebMapping.config /resource:Test/mainsoft/NunitWebResources/Mapping.aspx /resource:Test/mainsoft/NunitWebResources/Mapping1.aspx /resource:Test/mainsoft/NunitWebResources/CrossPagePosting1.aspx /resource:Test/mainsoft/NunitWebResources/CrossPagePosting2.aspx /resource:Test/mainsoft/NunitWebResources/MyDerived.master /resource:Test/mainsoft/NunitWebResources/MyPageWithDerivedMaster.aspx /resource:Test/mainsoft/NunitWebResources/MasterTypeTest1.aspx /resource:Test/mainsoft/NunitWebResources/MasterTypeTest2.aspx /resource:Test/mainsoft/NunitWebResources/PageLifecycleTest.aspx /resource:Test/mainsoft/NunitWebResources/PageValidationTest.aspx /resource:Test/mainsoft/NunitWebResources/AsyncPage.aspx /resource:Test/mainsoft/NunitWebResources/PageCultureTest.aspx /resource:Test/mainsoft/NunitWebResources/adapters.browser /resource:Test/mainsoft/NunitWebResources/NoEventValidation.aspx /resource:Test/mainsoft/NunitWebResources/ListControlPage.aspx /resource:Test/mainsoft/NunitWebResources/TextBoxTestlPage.aspx /resource:Test/mainsoft/NunitWebResources/ClearErrorOnError.aspx /resource:Test/mainsoft/NunitWebResources/RedirectOnError.aspx /resource:Test/mainsoft/NunitWebResources/TestCapability.browser /resource:Test/mainsoft/NunitWebResources/PageWithAdapter.aspx /resource:Test/mainsoft/NunitWebResources/InvalidPropertyBind1.aspx /resource:Test/mainsoft/NunitWebResources/InvalidPropertyBind2.aspx /resource:Test/mainsoft/NunitWebResources/InvalidPropertyBind3.aspx /resource:Test/mainsoft/NunitWebResources/InvalidPropertyBind4.aspx /resource:Test/mainsoft/NunitWebResources/ValidPropertyBind1.aspx /resource:Test/mainsoft/NunitWebResources/ValidPropertyBind2.aspx /resource:Test/mainsoft/NunitWebResources/ValidPropertyBind3.aspx /resource:Test/mainsoft/NunitWebResources/ValidPropertyBind4.aspx /resource:Test/mainsoft/NunitWebResources/ValidPropertyBind5.aspx /resource:Test/mainsoft/NunitWebResources/ReadWritePropertyControl.ascx /resource:Test/mainsoft/MainsoftWebTest/nunitweb_config.xml /resource:Test/mainsoft/NunitWebResources/TemplateControlParsingTest.aspx /resource:Test/mainsoft/NunitWebResources/ContentPlaceHolderInTemplate.aspx /resource:Test/mainsoft/NunitWebResources/ContentPlaceHolderInTemplate.master /resource:Test/mainsoft/NunitWebResources/MissingMasterFile.aspx /resource:Test/mainsoft/NunitWebResources/CustomSectionEmptyCollection.aspx /resource:Test/mainsoft/NunitWebResources/NoDoubleOnInitOnRemoveAdd.aspx /resource:Test/mainsoft/NunitWebResources/NoDoubleOnInitOnRemoveAdd.aspx.cs /resource:Test/mainsoft/NunitWebResources/LoginDisplayRememberMe.aspx /resource:Test/mainsoft/NunitWebResources/NoBindForMethodsWithBindInName.aspx /resource:Test/mainsoft/NunitWebResources/LinkInHeadWithEmbeddedExpression.aspx /resource:Test/mainsoft/NunitWebResources/ExpressionInListControl.aspx /resource:Test/mainsoft/NunitWebResources/ServerSideControlsInScriptBlock.aspx /resource:Test/mainsoft/NunitWebResources/ServerControlInClientSideComment.aspx /resource:Test/mainsoft/NunitWebResources/PreprocessorDirectivesInMarkup.aspx /resource:Test/mainsoft/NunitWebResources/UnquotedAngleBrackets.aspx /resource:Test/mainsoft/NunitWebResources/FullTagsInText.aspx /resource:Test/mainsoft/NunitWebResources/TagsExpressionsAndCommentsInText.aspx /resource:Test/mainsoft/NunitWebResources/NewlineInCodeExpression.aspx /resource:Test/mainsoft/NunitWebResources/DuplicateControlsInClientComment.aspx /resource:Test/mainsoft/NunitWebResources/TagsNestedInClientTag.aspx /resource:Test/mainsoft/NunitWebResources/ConditionalClientComments.aspx /resource:Test/mainsoft/NunitWebResources/OneLetterIdentifierInCodeRender.aspx /resource:Test/mainsoft/NunitWebResources/GlobalResourcesLocalization.aspx /resource:Test/mainsoft/NunitWebResources/TableSections_Bug551666.aspx /resource:Test/mainsoft/NunitWebResources/TableSections_Bug551666.aspx.cs /resource:Test/mainsoft/NunitWebResources/NestedParserFileText.aspx /resource:Test/mainsoft/NunitWebResources/StateFormatter_CorrectConverter.aspx /resource:Test/mainsoft/NunitWebResources/StateFormatter_CollectionConverter.aspx /resource:Test/mainsoft/NunitWebResources/StateFormatter_CollectionConverter.aspx.cs /resource:Test/mainsoft/NunitWebResources/ChangePasswordContainer_FindControl.aspx /resource:Test/mainsoft/NunitWebResources/TagWithExpressionWithinAttribute.aspx /resource:Test/mainsoft/NunitWebResources/CheckBoxList_Bug377703_1.aspx /resource:Test/mainsoft/NunitWebResources/CheckBoxList_Bug377703_2.aspx /resource:Test/mainsoft/NunitWebResources/CheckBoxList_Bug578770.aspx /resource:Test/mainsoft/NunitWebResources/EnumConverter_Bug578586.aspx /resource:Test/mainsoft/NunitWebResources/ButtonColor_Bug325489.aspx /resource:Test/mainsoft/NunitWebResources/SqlDataSource_OnInit_Bug572781.aspx /resource:Test/mainsoft/NunitWebResources/FormViewPagerVisibility.aspx /resource:Test/mainsoft/NunitWebResources/OverridenControlsPropertyAndPostBack_Bug594238.aspx /resource:Test/mainsoft/NunitWebResources/GlobalizationEncodingName.aspx /resource:Test/mainsoft/NunitWebResources/CheckBoxField_Bug595568_0.aspx /resource:Test/mainsoft/NunitWebResources/CheckBoxField_Bug595568_1.aspx /resource:Test/mainsoft/NunitWebResources/CheckBoxField_Bug595568_2.aspx /resource:Test/mainsoft/NunitWebResources/CheckBoxField_Bug595568_5.aspx /resource:Test/mainsoft/NunitWebResources/CheckBoxField_Bug595568_6.aspx /resource:Test/mainsoft/NunitWebResources/CheckBoxField_Bug595568_7.aspx /resource:Test/mainsoft/NunitWebResources/GridView_Bug595567.aspx /resource:Test/mainsoft/NunitWebResources/CheckBoxList_Bug600415.aspx /resource:Test/mainsoft/NunitWebResources/BoundField_Bug646505.aspx /resource:Test/mainsoft/NunitWebResources/BoundField_Bug646505.aspx.cs /resource:Test/mainsoft/NunitWebResources/HtmlTitleCodeRender_Bug662918.aspx /resource:Test/mainsoft/NunitWebResources/App_Code/EnumConverterControl.cs,App_Code/EnumConverterControl.cs /resource:Test/mainsoft/NunitWebResources/App_Code/MyContainer.cs,App_Code/MyContainer.cs /resource:Test/mainsoft/NunitWebResources/App_Code/CustomCheckBoxColumn.cs,App_Code/CustomCheckBoxColumn.cs /resource:Test/mainsoft/NunitWebResources/App_GlobalResources/Common.resx,App_GlobalResources/Common.resx /resource:Test/mainsoft/NunitWebResources/App_GlobalResources/Common.fr-FR.resx,App_GlobalResources/Common.fr-FR.resx /resource:Test/mainsoft/NunitWebResources/App_GlobalResources/Resource1.resx,App_GlobalResources/Resource1.resx</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/plainweb/System.Web.dll -unsafe -nowarn:612,618 -d:INSIDE_SYSTEM_WEB -nowarn:618 /resource:resources/WebUIValidation.js /resource:resources/folder.gif /resource:resources/file.gif /resource:resources/computer.gif /resource:resources/arrow_minus.gif /resource:resources/arrow_noexpand.gif /resource:resources/arrow_plus.gif /resource:resources/arrow_up.gif /resource:resources/arrow_down.gif /resource:resources/box_full.gif /resource:resources/box_empty.gif /resource:resources/box_minus.gif /resource:resources/box_noexpand.gif /resource:resources/box_plus.gif /resource:resources/contact.gif /resource:resources/dot_empty.gif /resource:resources/dot_full.gif /resource:resources/dots.gif /resource:resources/inbox.gif /resource:resources/star_empty.gif /resource:resources/star_full.gif /resource:resources/warning.gif /resource:resources/TreeView_noexpand.gif /resource:resources/TreeView_dash.gif /resource:resources/TreeView_dashminus.gif /resource:resources/TreeView_dashplus.gif /resource:resources/TreeView_i.gif /resource:resources/TreeView_l.gif /resource:resources/TreeView_lminus.gif /resource:resources/TreeView_lplus.gif /resource:resources/TreeView_minus.gif /resource:resources/TreeView_plus.gif /resource:resources/TreeView_r.gif /resource:resources/TreeView_rminus.gif /resource:resources/TreeView_rplus.gif /resource:resources/TreeView_t.gif /resource:resources/TreeView_tminus.gif /resource:resources/TreeView_tplus.gif /resource:resources/transparent.gif /resource:resources/webform.js /resource:resources/WebUIValidation_2.0.js /resource:resources/ErrorTemplateCommon_Top.html /resource:resources/DefaultErrorTemplate_CustomErrorDefault.html /resource:resources/ErrorTemplateCommon_Bottom.html /resource:resources/DefaultErrorTemplate_StandardPage.html /resource:resources/HtmlizedExceptionPage_Top.html /resource:resources/HtmlizedExceptionPage_FileLongSource.html /resource:resources/HtmlizedExceptionPage_FileShortSource.html /resource:resources/HtmlizedExceptionPage_CompilerOutput.html /resource:System.Web.UI.WebControls/GridView.js /resource:System.Web.UI.WebControls/DetailsView.js /resource:System.Web.UI.WebControls/TreeView.js /resource:System.Web.UI.WebControls/Menu.js /resource:System.Web.UI.WebControls/MenuModern.js -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Drawing.dll -r:./../../class/lib/net_4_x/System.Data.dll -r:./../../class/lib/net_4_x/System.Xml.dll -r:./../../class/lib/net_4_x/System.EnterpriseServices.dll -r:./../../class/lib/net_4_x/System.Runtime.Serialization.Formatters.Soap.dll -r:./../../class/lib/net_4_x/System.ComponentModel.DataAnnotations.dll -r:./../../class/lib/net_4_x/System.Web.ApplicationServices.dll -r:./../../class/lib/net_4_x/System.Configuration.dll -r:./../../class/lib/net_4_x/Mono.Data.Sqlite.dll -doc:net_4_x_System.Web_test.xml -nowarn:219,169,1591 /resource:Test/mainsoft/NunitWeb/NunitWeb/Resources/Global.asax /resource:Test/mainsoft/NunitWeb/NunitWeb/Resources/My.ashx /resource:Test/mainsoft/NunitWeb/NunitWeb/Resources/My.master /resource:Test/mainsoft/NunitWeb/NunitWeb/Resources/MyPage.aspx /resource:Test/mainsoft/NunitWeb/NunitWeb/Resources/MyPage.aspx.cs /resource:Test/mainsoft/NunitWeb/NunitWeb/Resources/MyPageWithMaster.aspx /resource:Test/mainsoft/NunitWeb/NunitWeb/Resources/Web.mono.config /resource:Test/mainsoft/NunitWeb/NunitWeb/Resources/Web.mono.config.4.0 /resource:Test/mainsoft/NunitWeb/NunitWeb/Resources/sub_map_01.sitemap /resource:Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_01.sitemap /resource:Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_02.sitemap /resource:Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_03.sitemap /resource:Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_04.sitemap /resource:Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_05.sitemap /resource:Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_06.sitemap /resource:Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_07.sitemap /resource:Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_08.sitemap /resource:Test/mainsoft/NunitWeb/NunitWeb/Resources/test_map_09.sitemap /resource:Test/mainsoft/NunitWebResources/menuclass.aspx /resource:Test/mainsoft/NunitWebResources/FormView.aspx /resource:Test/mainsoft/NunitWebResources/PostBackMenuTest.aspx /resource:Test/mainsoft/NunitWebResources/PageWithStyleSheet.aspx /resource:Test/mainsoft/NunitWebResources/PageWithTheme.aspx /resource:Test/mainsoft/NunitWebResources/ResolveUrl.ascx /resource:Test/mainsoft/NunitWebResources/ResolveUrl.aspx /resource:Test/mainsoft/NunitWebResources/RunTimeSetTheme.aspx /resource:Test/mainsoft/NunitWebResources/ReadOnlyPropertyBind.aspx /resource:Test/mainsoft/NunitWebResources/ReadOnlyPropertyControl.ascx /resource:Test/mainsoft/NunitWebResources/Theme1.skin /resource:Test/mainsoft/NunitWebResources/Theme2.skin /resource:Test/mainsoft/NunitWebResources/UrlProperty.aspx /resource:Test/mainsoft/NunitWebResources/UrlProperty.ascx /resource:Test/mainsoft/NunitWebResources/UrlProperty.ascx.cs /resource:Test/mainsoft/NunitWebResources/Web.sitemap /resource:Test/mainsoft/NunitWebResources/WizardTest.skin /resource:Test/mainsoft/NunitWebResources/FooterTemplateTest.aspx /resource:Test/mainsoft/NunitWebResources/DataGrid.aspx /resource:Test/mainsoft/NunitWebResources/DetailsViewTemplates.aspx /resource:Test/mainsoft/NunitWebResources/DetailsViewTemplates_2.aspx /resource:Test/mainsoft/NunitWebResources/DetailsViewTemplates_3.aspx /resource:Test/mainsoft/NunitWebResources/DetailsViewDataActions.aspx /resource:Test/mainsoft/NunitWebResources/DetailsViewProperties1.aspx /resource:Test/mainsoft/NunitWebResources/Bluehills.jpg /resource:Test/mainsoft/NunitWebResources/FormViewTest1.aspx /resource:Test/mainsoft/NunitWebResources/FormViewTest1_2.aspx /resource:Test/mainsoft/NunitWebResources/FormViewTest1_3.aspx /resource:Test/mainsoft/NunitWebResources/FormViewTest1_4.aspx /resource:Test/mainsoft/NunitWebResources/FormViewInsertEditDelete.aspx /resource:Test/mainsoft/NunitWebResources/GridViewUpdate.aspx /resource:Test/mainsoft/NunitWebResources/XMLDataSourceTest.xml /resource:Test/mainsoft/NunitWebResources/XMLDataSourceTest.xsl /resource:Test/mainsoft/NunitWebResources/XMLDataSourceTest1.aspx /resource:Test/mainsoft/NunitWebResources/XMLDataSourceTest2.aspx /resource:Test/mainsoft/NunitWebResources/XMLDataSourceTest3.aspx /resource:Test/mainsoft/NunitWebResources/XMLDataSourceTest4.aspx /resource:Test/mainsoft/NunitWebResources/LoginViewTest1.aspx /resource:Test/mainsoft/NunitWebResources/WebControl.config /resource:Test/mainsoft/NunitWebResources/WebLogin.config /resource:Test/mainsoft/NunitWebResources/CallbackTest1.aspx /resource:Test/mainsoft/NunitWebResources/CallbackTest2.aspx /resource:Test/mainsoft/NunitWebResources/EventValidationTest2.aspx /resource:Test/mainsoft/NunitWebResources/EventValidationTest1.aspx /resource:Test/mainsoft/NunitWebResources/ClientScript.js /resource:Test/mainsoft/NunitWebResources/EvalTest.aspx /resource:Test/mainsoft/NunitWebResources/TemplateUserControl.ascx /resource:Test/mainsoft/NunitWebResources/WebMapping.config /resource:Test/mainsoft/NunitWebResources/Mapping.aspx /resource:Test/mainsoft/NunitWebResources/Mapping1.aspx /resource:Test/mainsoft/NunitWebResources/CrossPagePosting1.aspx /resource:Test/mainsoft/NunitWebResources/CrossPagePosting2.aspx /resource:Test/mainsoft/NunitWebResources/MyDerived.master /resource:Test/mainsoft/NunitWebResources/MyPageWithDerivedMaster.aspx /resource:Test/mainsoft/NunitWebResources/MasterTypeTest1.aspx /resource:Test/mainsoft/NunitWebResources/MasterTypeTest2.aspx /resource:Test/mainsoft/NunitWebResources/PageLifecycleTest.aspx /resource:Test/mainsoft/NunitWebResources/PageValidationTest.aspx /resource:Test/mainsoft/NunitWebResources/AsyncPage.aspx /resource:Test/mainsoft/NunitWebResources/PageCultureTest.aspx /resource:Test/mainsoft/NunitWebResources/adapters.browser /resource:Test/mainsoft/NunitWebResources/NoEventValidation.aspx /resource:Test/mainsoft/NunitWebResources/ListControlPage.aspx /resource:Test/mainsoft/NunitWebResources/TextBoxTestlPage.aspx /resource:Test/mainsoft/NunitWebResources/ClearErrorOnError.aspx /resource:Test/mainsoft/NunitWebResources/RedirectOnError.aspx /resource:Test/mainsoft/NunitWebResources/TestCapability.browser /resource:Test/mainsoft/NunitWebResources/PageWithAdapter.aspx /resource:Test/mainsoft/NunitWebResources/InvalidPropertyBind1.aspx /resource:Test/mainsoft/NunitWebResources/InvalidPropertyBind2.aspx /resource:Test/mainsoft/NunitWebResources/InvalidPropertyBind3.aspx /resource:Test/mainsoft/NunitWebResources/InvalidPropertyBind4.aspx /resource:Test/mainsoft/NunitWebResources/ValidPropertyBind1.aspx /resource:Test/mainsoft/NunitWebResources/ValidPropertyBind2.aspx /resource:Test/mainsoft/NunitWebResources/ValidPropertyBind3.aspx /resource:Test/mainsoft/NunitWebResources/ValidPropertyBind4.aspx /resource:Test/mainsoft/NunitWebResources/ValidPropertyBind5.aspx /resource:Test/mainsoft/NunitWebResources/ReadWritePropertyControl.ascx /resource:Test/mainsoft/MainsoftWebTest/nunitweb_config.xml /resource:Test/mainsoft/NunitWebResources/TemplateControlParsingTest.aspx /resource:Test/mainsoft/NunitWebResources/ContentPlaceHolderInTemplate.aspx /resource:Test/mainsoft/NunitWebResources/ContentPlaceHolderInTemplate.master /resource:Test/mainsoft/NunitWebResources/MissingMasterFile.aspx /resource:Test/mainsoft/NunitWebResources/CustomSectionEmptyCollection.aspx /resource:Test/mainsoft/NunitWebResources/NoDoubleOnInitOnRemoveAdd.aspx /resource:Test/mainsoft/NunitWebResources/NoDoubleOnInitOnRemoveAdd.aspx.cs /resource:Test/mainsoft/NunitWebResources/LoginDisplayRememberMe.aspx /resource:Test/mainsoft/NunitWebResources/NoBindForMethodsWithBindInName.aspx /resource:Test/mainsoft/NunitWebResources/LinkInHeadWithEmbeddedExpression.aspx /resource:Test/mainsoft/NunitWebResources/ExpressionInListControl.aspx /resource:Test/mainsoft/NunitWebResources/ServerSideControlsInScriptBlock.aspx /resource:Test/mainsoft/NunitWebResources/ServerControlInClientSideComment.aspx /resource:Test/mainsoft/NunitWebResources/PreprocessorDirectivesInMarkup.aspx /resource:Test/mainsoft/NunitWebResources/UnquotedAngleBrackets.aspx /resource:Test/mainsoft/NunitWebResources/FullTagsInText.aspx /resource:Test/mainsoft/NunitWebResources/TagsExpressionsAndCommentsInText.aspx /resource:Test/mainsoft/NunitWebResources/NewlineInCodeExpression.aspx /resource:Test/mainsoft/NunitWebResources/DuplicateControlsInClientComment.aspx /resource:Test/mainsoft/NunitWebResources/TagsNestedInClientTag.aspx /resource:Test/mainsoft/NunitWebResources/ConditionalClientComments.aspx /resource:Test/mainsoft/NunitWebResources/OneLetterIdentifierInCodeRender.aspx /resource:Test/mainsoft/NunitWebResources/GlobalResourcesLocalization.aspx /resource:Test/mainsoft/NunitWebResources/TableSections_Bug551666.aspx /resource:Test/mainsoft/NunitWebResources/TableSections_Bug551666.aspx.cs /resource:Test/mainsoft/NunitWebResources/NestedParserFileText.aspx /resource:Test/mainsoft/NunitWebResources/StateFormatter_CorrectConverter.aspx /resource:Test/mainsoft/NunitWebResources/StateFormatter_CollectionConverter.aspx /resource:Test/mainsoft/NunitWebResources/StateFormatter_CollectionConverter.aspx.cs /resource:Test/mainsoft/NunitWebResources/ChangePasswordContainer_FindControl.aspx /resource:Test/mainsoft/NunitWebResources/TagWithExpressionWithinAttribute.aspx /resource:Test/mainsoft/NunitWebResources/CheckBoxList_Bug377703_1.aspx /resource:Test/mainsoft/NunitWebResources/CheckBoxList_Bug377703_2.aspx /resource:Test/mainsoft/NunitWebResources/CheckBoxList_Bug578770.aspx /resource:Test/mainsoft/NunitWebResources/EnumConverter_Bug578586.aspx /resource:Test/mainsoft/NunitWebResources/ButtonColor_Bug325489.aspx /resource:Test/mainsoft/NunitWebResources/SqlDataSource_OnInit_Bug572781.aspx /resource:Test/mainsoft/NunitWebResources/FormViewPagerVisibility.aspx /resource:Test/mainsoft/NunitWebResources/OverridenControlsPropertyAndPostBack_Bug594238.aspx /resource:Test/mainsoft/NunitWebResources/GlobalizationEncodingName.aspx /resource:Test/mainsoft/NunitWebResources/CheckBoxField_Bug595568_0.aspx /resource:Test/mainsoft/NunitWebResources/CheckBoxField_Bug595568_1.aspx /resource:Test/mainsoft/NunitWebResources/CheckBoxField_Bug595568_2.aspx /resource:Test/mainsoft/NunitWebResources/CheckBoxField_Bug595568_5.aspx /resource:Test/mainsoft/NunitWebResources/CheckBoxField_Bug595568_6.aspx /resource:Test/mainsoft/NunitWebResources/CheckBoxField_Bug595568_7.aspx /resource:Test/mainsoft/NunitWebResources/GridView_Bug595567.aspx /resource:Test/mainsoft/NunitWebResources/CheckBoxList_Bug600415.aspx /resource:Test/mainsoft/NunitWebResources/BoundField_Bug646505.aspx /resource:Test/mainsoft/NunitWebResources/BoundField_Bug646505.aspx.cs /resource:Test/mainsoft/NunitWebResources/HtmlTitleCodeRender_Bug662918.aspx /resource:Test/mainsoft/NunitWebResources/App_Code/EnumConverterControl.cs,App_Code/EnumConverterControl.cs /resource:Test/mainsoft/NunitWebResources/App_Code/MyContainer.cs,App_Code/MyContainer.cs /resource:Test/mainsoft/NunitWebResources/App_Code/CustomCheckBoxColumn.cs,App_Code/CustomCheckBoxColumn.cs /resource:Test/mainsoft/NunitWebResources/App_GlobalResources/Common.resx,App_GlobalResources/Common.resx /resource:Test/mainsoft/NunitWebResources/App_GlobalResources/Common.fr-FR.resx,App_GlobalResources/Common.fr-FR.resx /resource:Test/mainsoft/NunitWebResources/App_GlobalResources/Resource1.resx,App_GlobalResources/Resource1.resx</flags>
       <output>net_4_x_System.Web_test.dll</output>
       <built_sources>System.Web/UplevelHelper.cs</built_sources>
       <library_output>net_4_x_System.Web_test.dll</library_output>
     </project>
     <project dir="class/System.Web.Services" library="System.Web.Services-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -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/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.EnterpriseServices.dll -r:./../../class/lib/net_4_x/System.Xml.dll -r:./../../class/lib/net_4_x/System.Data.dll -r:./../../class/lib/net_4_x/plainweb/System.Web.dll -r:./../../class/lib/net_4_x/plaindesign/System.Design.dll -r:./../../class/lib/net_4_x/System.DirectoryServices.dll -r:./../../class/lib/net_4_x/System.Configuration.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: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/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.EnterpriseServices.dll -r:./../../class/lib/net_4_x/System.Xml.dll -r:./../../class/lib/net_4_x/System.Data.dll -r:./../../class/lib/net_4_x/plainweb/System.Web.dll -r:./../../class/lib/net_4_x/plaindesign/System.Design.dll -r:./../../class/lib/net_4_x/System.DirectoryServices.dll -r:./../../class/lib/net_4_x/System.Configuration.dll</flags>
       <output>System.Web.Services.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.Web.Services.dll</library_output>
     </project>
     <project dir="class/System.Web.Services" library="System.Web.Services-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/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/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.EnterpriseServices.dll -r:./../../class/lib/net_4_x/System.Xml.dll -r:./../../class/lib/net_4_x/System.Data.dll -r:./../../class/lib/net_4_x/plainweb/System.Web.dll -r:./../../class/lib/net_4_x/plaindesign/System.Design.dll -r:./../../class/lib/net_4_x/System.DirectoryServices.dll -r:./../../class/lib/net_4_x/System.Configuration.dll -nowarn:618 -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME</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.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/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.EnterpriseServices.dll -r:./../../class/lib/net_4_x/System.Xml.dll -r:./../../class/lib/net_4_x/System.Data.dll -r:./../../class/lib/net_4_x/plainweb/System.Web.dll -r:./../../class/lib/net_4_x/plaindesign/System.Design.dll -r:./../../class/lib/net_4_x/System.DirectoryServices.dll -r:./../../class/lib/net_4_x/System.Configuration.dll -nowarn:618 -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME</flags>
       <output>net_4_x_System.Web.Services_test.dll</output>
       <built_sources></built_sources>
       <library_output>net_4_x_System.Web.Services_test.dll</library_output>
     </project>
     <project dir="class/System.Design" library="System.Design-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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.Xml.dll -r:./../../class/lib/net_4_x/plainweb/System.Web.dll -r:./../../class/lib/net_4_x/System.Windows.Forms.dll -r:./../../class/lib/net_4_x/System.Drawing.dll -r:./../../class/lib/net_4_x/Accessibility.dll -r:./../../class/lib/net_4_x/System.Data.dll -r:./../../class/lib/net_4_x/System.Configuration.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 -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Xml.dll -r:./../../class/lib/net_4_x/plainweb/System.Web.dll -r:./../../class/lib/net_4_x/System.Windows.Forms.dll -r:./../../class/lib/net_4_x/System.Drawing.dll -r:./../../class/lib/net_4_x/Accessibility.dll -r:./../../class/lib/net_4_x/System.Data.dll -r:./../../class/lib/net_4_x/System.Configuration.dll</flags>
       <output>System.Design.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.Design.dll</library_output>
     </project>
     <project dir="class/System.Design" library="System.Design-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/plaindesign/System.Design.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/plaindesign/System.Design.dll</flags>
       <output>net_4_x_System.Design_test.dll</output>
       <built_sources></built_sources>
       <library_output>net_4_x_System.Design_test.dll</library_output>
     </project>
     <project dir="class/System.Design" library="System.Design-plaindesign-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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.Xml.dll -r:./../../class/lib/net_4_x/plainweb/System.Web.dll -r:./../../class/lib/net_4_x/System.Windows.Forms.dll -r:./../../class/lib/net_4_x/System.Drawing.dll -r:./../../class/lib/net_4_x/Accessibility.dll -r:./../../class/lib/net_4_x/System.Data.dll -r:./../../class/lib/net_4_x/System.Configuration.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 -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Xml.dll -r:./../../class/lib/net_4_x/plainweb/System.Web.dll -r:./../../class/lib/net_4_x/System.Windows.Forms.dll -r:./../../class/lib/net_4_x/System.Drawing.dll -r:./../../class/lib/net_4_x/Accessibility.dll -r:./../../class/lib/net_4_x/System.Data.dll -r:./../../class/lib/net_4_x/System.Configuration.dll</flags>
       <output>System.Design.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/plaindesign/System.Design.dll</library_output>
     </project>
     <project dir="class/System.Design" library="System.Design-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/plaindesign/System.Design.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/plaindesign/System.Design.dll</flags>
       <output>net_4_x_System.Design_test.dll</output>
       <built_sources></built_sources>
       <library_output>net_4_x_System.Design_test.dll</library_output>
     </project>
     <project dir="class/System.Runtime.Remoting" library="System.Runtime.Remoting-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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.Xml.dll -r:./../../class/lib/net_4_x/System.Runtime.Serialization.Formatters.Soap.dll -r:./../../class/lib/net_4_x/System.Web.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 -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Xml.dll -r:./../../class/lib/net_4_x/System.Runtime.Serialization.Formatters.Soap.dll -r:./../../class/lib/net_4_x/System.Web.dll</flags>
       <output>System.Runtime.Remoting.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.Runtime.Remoting.dll</library_output>
     </project>
     <project dir="class/System.Runtime.Remoting" library="System.Runtime.Remoting-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/System.Runtime.Remoting.dll -nowarn:618</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.Runtime.Remoting.dll -nowarn:618</flags>
       <output>net_4_x_System.Runtime.Remoting_test.dll</output>
       <built_sources></built_sources>
       <library_output>net_4_x_System.Runtime.Remoting_test.dll</library_output>
     </project>
     <project dir="class/System.Configuration.Install" library="System.Configuration.Install-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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.Xml.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 -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Xml.dll</flags>
       <output>System.Configuration.Install.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.Configuration.Install.dll</library_output>
     </project>
     <project dir="class/System.Management" library="System.Management-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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.Configuration.Install.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 -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Configuration.Install.dll</flags>
       <output>System.Management.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.Management.dll</library_output>
     </project>
     <project dir="class/System.Data.OracleClient" library="System.Data.OracleClient-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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.Xml.dll -r:./../../class/lib/net_4_x/System.Data.dll -r:./../../class/lib/net_4_x/System.EnterpriseServices.dll -r:./../../class/lib/net_4_x/System.Drawing.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 -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Xml.dll -r:./../../class/lib/net_4_x/System.Data.dll -r:./../../class/lib/net_4_x/System.EnterpriseServices.dll -r:./../../class/lib/net_4_x/System.Drawing.dll</flags>
       <output>System.Data.OracleClient.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.Data.OracleClient.dll</library_output>
     </project>
     <project dir="class/System.Data.OracleClient" library="System.Data.OracleClient-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/System.Data.OracleClient.dll -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Xml.dll -r:./../../class/lib/net_4_x/System.Data.dll -r:./../../class/lib/net_4_x/System.EnterpriseServices.dll -r:./../../class/lib/net_4_x/System.Drawing.dll /nowarn:618</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.OracleClient.dll -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Xml.dll -r:./../../class/lib/net_4_x/System.Data.dll -r:./../../class/lib/net_4_x/System.EnterpriseServices.dll -r:./../../class/lib/net_4_x/System.Drawing.dll /nowarn:618</flags>
       <output>net_4_x_System.Data.OracleClient_test.dll</output>
       <built_sources></built_sources>
       <library_output>net_4_x_System.Data.OracleClient_test.dll</library_output>
     </project>
     <project dir="class/Cscompmgd" library="Cscompmgd-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:./../../class/lib/net_4_x/System.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 -r:./../../class/lib/net_4_x/System.dll</flags>
       <output>cscompmgd.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/cscompmgd.dll</library_output>
     </project>
     <project dir="class/Cscompmgd" library="Cscompmgd-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/cscompmgd.dll -r:./../../class/lib/net_4_x/System.dll -nowarn:0618 -nowarn:219 -nowarn:169</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/cscompmgd.dll -r:./../../class/lib/net_4_x/System.dll -nowarn:0618 -nowarn:219 -nowarn:169</flags>
       <output>net_4_x_Cscompmgd_test.dll</output>
       <built_sources></built_sources>
       <library_output>net_4_x_Cscompmgd_test.dll</library_output>
     </project>
     <project dir="class/Commons.Xml.Relaxng" library="Commons.Xml.Relaxng-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig /resource:resources/relaxng.rng,relaxng.rng -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Xml.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 /resource:resources/relaxng.rng,relaxng.rng -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Xml.dll</flags>
       <output>Commons.Xml.Relaxng.dll</output>
       <built_sources>Commons.Xml.Relaxng.Rnc/RncParser.cs</built_sources>
       <library_output>./../../class/lib/net_4_x/Commons.Xml.Relaxng.dll</library_output>
     </project>
     <project dir="class/Commons.Xml.Relaxng" library="Commons.Xml.Relaxng-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/Commons.Xml.Relaxng.dll /resource:resources/relaxng.rng,relaxng.rng -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Xml.dll -nowarn:0618 -nowarn:219 -nowarn:169</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/Commons.Xml.Relaxng.dll /resource:resources/relaxng.rng,relaxng.rng -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Xml.dll -nowarn:0618 -nowarn:219 -nowarn:169</flags>
       <output>net_4_x_Commons.Xml.Relaxng_test.dll</output>
       <built_sources>Commons.Xml.Relaxng.Rnc/RncParser.cs</built_sources>
       <library_output>net_4_x_Commons.Xml.Relaxng_test.dll</library_output>
     </project>
     <project dir="class/Mono.Messaging" library="Mono.Messaging-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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.Configuration.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 -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Configuration.dll</flags>
       <output>Mono.Messaging.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/Mono.Messaging.dll</library_output>
     </project>
     <project dir="class/Mono.Messaging" library="Mono.Messaging-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/Mono.Messaging.dll -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Configuration.dll -nowarn:0618 -nowarn:219 -nowarn:169</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/Mono.Messaging.dll -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Configuration.dll -nowarn:0618 -nowarn:219 -nowarn:169</flags>
       <output>net_4_x_Mono.Messaging_test.dll</output>
       <built_sources></built_sources>
       <library_output>net_4_x_Mono.Messaging_test.dll</library_output>
     </project>
     <project dir="class/System.Messaging" library="System.Messaging-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig /resource:System.Messaging/MessageQueue.resx -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Xml.dll -r:./../../class/lib/net_4_x/Mono.Messaging.dll -r:./../../class/lib/net_4_x/System.Configuration.Install.dll -r:./../../class/lib/net_4_x/System.Drawing.dll -r:./../../class/lib/net_4_x/System.Windows.Forms.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 /resource:System.Messaging/MessageQueue.resx -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Xml.dll -r:./../../class/lib/net_4_x/Mono.Messaging.dll -r:./../../class/lib/net_4_x/System.Configuration.Install.dll -r:./../../class/lib/net_4_x/System.Drawing.dll -r:./../../class/lib/net_4_x/System.Windows.Forms.dll</flags>
       <output>System.Messaging.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.Messaging.dll</library_output>
     </project>
     <project dir="class/System.Messaging" library="System.Messaging-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/System.Messaging.dll /resource:System.Messaging/MessageQueue.resx -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Xml.dll -r:./../../class/lib/net_4_x/Mono.Messaging.dll -r:./../../class/lib/net_4_x/System.Configuration.Install.dll -r:./../../class/lib/net_4_x/System.Drawing.dll -r:./../../class/lib/net_4_x/System.Windows.Forms.dll -nowarn:0618 -nowarn:219 -nowarn:169</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.Messaging.dll /resource:System.Messaging/MessageQueue.resx -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Xml.dll -r:./../../class/lib/net_4_x/Mono.Messaging.dll -r:./../../class/lib/net_4_x/System.Configuration.Install.dll -r:./../../class/lib/net_4_x/System.Drawing.dll -r:./../../class/lib/net_4_x/System.Windows.Forms.dll -nowarn:0618 -nowarn:219 -nowarn:169</flags>
       <output>net_4_x_System.Messaging_test.dll</output>
       <built_sources></built_sources>
       <library_output>net_4_x_System.Messaging_test.dll</library_output>
     </project>
     <project dir="class/System.ServiceProcess" library="System.ServiceProcess-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig /nowarn:0618 -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Configuration.Install.dll -r:./../../class/lib/net_4_x/System.Windows.Forms.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:0618 -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Configuration.Install.dll -r:./../../class/lib/net_4_x/System.Windows.Forms.dll</flags>
       <output>System.ServiceProcess.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.ServiceProcess.dll</library_output>
     </project>
     <project dir="class/System.ServiceProcess" library="System.ServiceProcess-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/System.ServiceProcess.dll /nowarn:0618 -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Configuration.Install.dll -r:./../../class/lib/net_4_x/System.Windows.Forms.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.ServiceProcess.dll /nowarn:0618 -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Configuration.Install.dll -r:./../../class/lib/net_4_x/System.Windows.Forms.dll</flags>
       <output>net_4_x_System.ServiceProcess_test.dll</output>
       <built_sources></built_sources>
       <library_output>net_4_x_System.ServiceProcess_test.dll</library_output>
     </project>
     <project dir="class/System.Drawing.Design" library="System.Drawing.Design-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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.Drawing.dll -r:./../../class/lib/net_4_x/System.Windows.Forms.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 -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Drawing.dll -r:./../../class/lib/net_4_x/System.Windows.Forms.dll</flags>
       <output>System.Drawing.Design.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.Drawing.Design.dll</library_output>
     </project>
     <project dir="class/ICSharpCode.SharpZipLib" library="ICSharpCode.SharpZipLib-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -warn:1 -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Xml.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 -warn:1 -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Xml.dll</flags>
       <output>ICSharpCode.SharpZipLib.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/ICSharpCode.SharpZipLib.dll</library_output>
     </project>
     <project dir="class/IBM.Data.DB2" library="IBM.Data.DB2-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig /unsafe -warn:1 -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Xml.dll -r:./../../class/lib/net_4_x/System.Data.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 /unsafe -warn:1 -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Xml.dll -r:./../../class/lib/net_4_x/System.Data.dll</flags>
       <output>IBM.Data.DB2.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/IBM.Data.DB2.dll</library_output>
     </project>
     <project dir="class/CustomMarshalers" library="CustomMarshalers-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:./../../class/lib/net_4_x/System.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 -r:./../../class/lib/net_4_x/System.dll</flags>
       <output>CustomMarshalers.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/CustomMarshalers.dll</library_output>
     </project>
     <project dir="class/SystemWebTestShim" library="SystemWebTestShim-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:./../../class/lib/net_4_x/System.Web.dll -r:./../../class/lib/net_4_x/System.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 -r:./../../class/lib/net_4_x/System.Web.dll -r:./../../class/lib/net_4_x/System.dll</flags>
       <output>SystemWebTestShim.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/SystemWebTestShim.dll</library_output>
     </project>
     <project dir="class/System.ServiceModel.Internals" library="System.ServiceModel.Internals-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig /unsafe -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -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/System.Configuration.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 /unsafe -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -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/System.Configuration.dll</flags>
       <output>System.ServiceModel.Internals.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.ServiceModel.Internals.dll</library_output>
     </project>
     <project dir="class/SMDiagnostics" library="SMDiagnostics-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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/System.ServiceModel.Internals.dll -r:./../../class/lib/net_4_x/System.Configuration.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 -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/System.ServiceModel.Internals.dll -r:./../../class/lib/net_4_x/System.Configuration.dll</flags>
       <output>SMDiagnostics.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/SMDiagnostics.dll</library_output>
     </project>
     <project dir="class/System.Runtime.Serialization" library="System.Runtime.Serialization-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -unsafe -d:NO_DYNAMIC_CODEGEN /nowarn:168,169,219,414 /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.ServiceModel.Internals.dll -r:./../../class/lib/net_4_x/SMDiagnostics.dll -r:./../../class/lib/net_4_x/System.Data.dll -r:./../../class/lib/net_4_x/System.Configuration.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 -unsafe -d:NO_DYNAMIC_CODEGEN /nowarn:168,169,219,414 /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.ServiceModel.Internals.dll -r:./../../class/lib/net_4_x/System.Data.dll -r:./../../class/lib/net_4_x/System.Configuration.dll -r:./../../class/lib/net_4_x/SMDiagnostics.dll</flags>
       <output>System.Runtime.Serialization.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.Runtime.Serialization.dll</library_output>
     </project>
     <project dir="class/System.Runtime.Serialization" library="System.Runtime.Serialization-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/System.Runtime.Serialization.dll -unsafe -d:NO_DYNAMIC_CODEGEN /nowarn:168,169,219,414 /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.ServiceModel.Internals.dll -r:./../../class/lib/net_4_x/SMDiagnostics.dll -r:./../../class/lib/net_4_x/System.Data.dll -r:./../../class/lib/net_4_x/System.Configuration.dll /resource:Test/Resources/WSDL/collections.wsdl /resource:Test/Resources/WSDL/custom-collections.wsdl</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.Runtime.Serialization.dll -unsafe -d:NO_DYNAMIC_CODEGEN /nowarn:168,169,219,414 /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.ServiceModel.Internals.dll -r:./../../class/lib/net_4_x/System.Data.dll -r:./../../class/lib/net_4_x/System.Configuration.dll -r:./../../class/lib/net_4_x/SMDiagnostics.dll /resource:Test/Resources/WSDL/collections.wsdl /resource:Test/Resources/WSDL/custom-collections.wsdl</flags>
       <output>net_4_x_System.Runtime.Serialization_test.dll</output>
       <built_sources></built_sources>
       <library_output>net_4_x_System.Runtime.Serialization_test.dll</library_output>
     </project>
     <project dir="class/System.Xml.Linq" library="System.Xml.Linq-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -d:FEATURE_SERIALIZATION -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/System.Runtime.Serialization.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:FEATURE_SERIALIZATION -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/System.Runtime.Serialization.dll</flags>
       <output>System.Xml.Linq.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.Xml.Linq.dll</library_output>
     </project>
     <project dir="class/System.Xml.Linq" library="System.Xml.Linq-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/System.Xml.Linq.dll -d:FEATURE_SERIALIZATION -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/System.Runtime.Serialization.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.Xml.Linq.dll -d:FEATURE_SERIALIZATION -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/System.Runtime.Serialization.dll</flags>
       <output>net_4_x_System.Xml.Linq_test.dll</output>
       <built_sources></built_sources>
       <library_output>net_4_x_System.Xml.Linq_test.dll</library_output>
     </project>
     <project dir="class/System.Data.Linq" library="System.Data.Linq-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -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/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/System.Data.dll -r:./../../class/lib/net_4_x/System.Runtime.Serialization.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 /resource:./src/DbLinq/Schema/Dbml/DbmlSchema.xsd,DbLinq.Schema.Dbml.DbmlSchema.xsd /d:MONO_STRICT /d:MONO_DEPLOY -warn:1 -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/System.Data.dll -r:./../../class/lib/net_4_x/System.Runtime.Serialization.dll</flags>
       <output>System.Data.Linq.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.Data.Linq.dll</library_output>
     </project>
     <project dir="class/System.Data.Linq" library="System.Data.Linq-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/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/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/System.Data.dll -r:./../../class/lib/net_4_x/System.Runtime.Serialization.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.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/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/System.Data.dll -r:./../../class/lib/net_4_x/System.Runtime.Serialization.dll</flags>
       <output>net_4_x_System.Data.Linq_test.dll</output>
       <built_sources></built_sources>
       <library_output>net_4_x_System.Data.Linq_test.dll</library_output>
     </project>
     <project dir="class/System.Web.Abstractions" library="System.Web.Abstractions-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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.Web.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 -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Web.dll</flags>
       <output>System.Web.Abstractions.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.Web.Abstractions.dll</library_output>
     </project>
     <project dir="class/System.Web.Abstractions" library="System.Web.Abstractions-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/System.Web.Abstractions.dll -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Web.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.Web.Abstractions.dll -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Web.dll</flags>
       <output>net_4_x_System.Web.Abstractions_test.dll</output>
       <built_sources></built_sources>
       <library_output>net_4_x_System.Web.Abstractions_test.dll</library_output>
     </project>
     <project dir="class/System.Web.Routing" library="System.Web.Routing-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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.Web.dll -r:./../../class/lib/net_4_x/System.Web.Abstractions.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 -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Web.dll -r:./../../class/lib/net_4_x/System.Web.Abstractions.dll</flags>
       <output>System.Web.Routing.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.Web.Routing.dll</library_output>
     </project>
     <project dir="class/System.Web.Routing" library="System.Web.Routing-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/System.Web.Routing.dll -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Web.dll -r:./../../class/lib/net_4_x/System.Web.Abstractions.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.Web.Routing.dll -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Web.dll -r:./../../class/lib/net_4_x/System.Web.Abstractions.dll</flags>
       <output>net_4_x_System.Web.Routing_test.dll</output>
       <built_sources></built_sources>
       <library_output>net_4_x_System.Web.Routing_test.dll</library_output>
     </project>
     <project dir="class/System.Runtime.DurableInstancing" library="System.Runtime.DurableInstancing-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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.Xml.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Xml.Linq.dll -r:./../../class/lib/net_4_x/System.Transactions.dll -r:./../../class/lib/net_4_x/System.ServiceModel.Internals.dll -r:./../../class/lib/net_4_x/System.Runtime.Serialization.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 -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.Xml.Linq.dll -r:./../../class/lib/net_4_x/System.Transactions.dll -r:./../../class/lib/net_4_x/System.ServiceModel.Internals.dll -r:./../../class/lib/net_4_x/System.Runtime.Serialization.dll</flags>
       <output>System.Runtime.DurableInstancing.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.Runtime.DurableInstancing.dll</library_output>
     </project>
     <project dir="class/System.Runtime.DurableInstancing" library="System.Runtime.DurableInstancing-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/System.Runtime.DurableInstancing.dll -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.Xml.Linq.dll -r:./../../class/lib/net_4_x/System.Transactions.dll -r:./../../class/lib/net_4_x/System.ServiceModel.Internals.dll -r:./../../class/lib/net_4_x/System.Runtime.Serialization.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.Runtime.DurableInstancing.dll -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.Xml.Linq.dll -r:./../../class/lib/net_4_x/System.Transactions.dll -r:./../../class/lib/net_4_x/System.ServiceModel.Internals.dll -r:./../../class/lib/net_4_x/System.Runtime.Serialization.dll</flags>
       <output>net_4_x_System.Runtime.DurableInstancing_test.dll</output>
       <built_sources></built_sources>
       <library_output>net_4_x_System.Runtime.DurableInstancing_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 -d:DISABLE_CAS_USE -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/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>
       <output>System.IdentityModel.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.IdentityModel.dll</library_output>
     </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 -d:DISABLE_CAS_USE -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/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>
       <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.IdentityModel.Selectors" library="System.IdentityModel.Selectors-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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.Runtime.Serialization.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 -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.Runtime.Serialization.dll -r:./../../class/lib/net_4_x/System.IdentityModel.dll</flags>
       <output>System.IdentityModel.Selectors.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.IdentityModel.Selectors.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 -d:DISABLE_CAS_USE -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.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>
       <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 -d:DISABLE_CAS_USE -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.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>
       <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 -d:DISABLE_CAS_USE -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.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>
       <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 -d:DISABLE_CAS_USE -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.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>
       <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.Web.Extensions" library="System.Web.Extensions-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -unsafe -define:NET_3_5 -define:SYSTEM_WEB_EXTENSIONS /resource:../MicrosoftAjaxLibrary/System.Web.Extensions/3.5.0.0/3.5.21022.8/MicrosoftAjax.debug.js /resource:../MicrosoftAjaxLibrary/System.Web.Extensions/3.5.0.0/3.5.21022.8/MicrosoftAjax.js /resource:../MicrosoftAjaxLibrary/System.Web.Extensions/3.5.0.0/3.5.21022.8/MicrosoftAjaxTimer.debug.js /resource:../MicrosoftAjaxLibrary/System.Web.Extensions/3.5.0.0/3.5.21022.8/MicrosoftAjaxTimer.js /resource:../MicrosoftAjaxLibrary/System.Web.Extensions/3.5.0.0/3.5.21022.8/MicrosoftAjaxWebForms.debug.js /resource:../MicrosoftAjaxLibrary/System.Web.Extensions/3.5.0.0/3.5.21022.8/MicrosoftAjaxWebForms.js -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Drawing.dll -r:./../../class/lib/net_4_x/System.Data.dll -r:./../../class/lib/net_4_x/System.Data.Linq.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/System.Web.Services.dll -r:./../../class/lib/net_4_x/System.Configuration.dll -r:./../../class/lib/net_4_x/System.EnterpriseServices.dll -r:./../../class/lib/net_4_x/System.ServiceModel.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 -unsafe -define:NET_3_5 -define:SYSTEM_WEB_EXTENSIONS /resource:../MicrosoftAjaxLibrary/System.Web.Extensions/3.5.0.0/3.5.21022.8/MicrosoftAjax.debug.js /resource:../MicrosoftAjaxLibrary/System.Web.Extensions/3.5.0.0/3.5.21022.8/MicrosoftAjax.js /resource:../MicrosoftAjaxLibrary/System.Web.Extensions/3.5.0.0/3.5.21022.8/MicrosoftAjaxTimer.debug.js /resource:../MicrosoftAjaxLibrary/System.Web.Extensions/3.5.0.0/3.5.21022.8/MicrosoftAjaxTimer.js /resource:../MicrosoftAjaxLibrary/System.Web.Extensions/3.5.0.0/3.5.21022.8/MicrosoftAjaxWebForms.debug.js /resource:../MicrosoftAjaxLibrary/System.Web.Extensions/3.5.0.0/3.5.21022.8/MicrosoftAjaxWebForms.js -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Drawing.dll -r:./../../class/lib/net_4_x/System.Data.dll -r:./../../class/lib/net_4_x/System.Data.Linq.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/System.Web.Services.dll -r:./../../class/lib/net_4_x/System.Configuration.dll -r:./../../class/lib/net_4_x/System.EnterpriseServices.dll -r:./../../class/lib/net_4_x/System.ServiceModel.dll -r:./../../class/lib/net_4_x/System.Web.ApplicationServices.dll</flags>
       <output>System.Web.Extensions.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.Web.Extensions.dll</library_output>
     </project>
     <project dir="class/System.Web.Extensions" library="System.Web.Extensions-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/System.Web.Extensions.dll -unsafe -define:NET_3_5 -define:SYSTEM_WEB_EXTENSIONS /resource:../MicrosoftAjaxLibrary/System.Web.Extensions/3.5.0.0/3.5.21022.8/MicrosoftAjax.debug.js /resource:../MicrosoftAjaxLibrary/System.Web.Extensions/3.5.0.0/3.5.21022.8/MicrosoftAjax.js /resource:../MicrosoftAjaxLibrary/System.Web.Extensions/3.5.0.0/3.5.21022.8/MicrosoftAjaxTimer.debug.js /resource:../MicrosoftAjaxLibrary/System.Web.Extensions/3.5.0.0/3.5.21022.8/MicrosoftAjaxTimer.js /resource:../MicrosoftAjaxLibrary/System.Web.Extensions/3.5.0.0/3.5.21022.8/MicrosoftAjaxWebForms.debug.js /resource:../MicrosoftAjaxLibrary/System.Web.Extensions/3.5.0.0/3.5.21022.8/MicrosoftAjaxWebForms.js -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Drawing.dll -r:./../../class/lib/net_4_x/System.Data.dll -r:./../../class/lib/net_4_x/System.Data.Linq.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/System.Web.Services.dll -r:./../../class/lib/net_4_x/System.Configuration.dll -r:./../../class/lib/net_4_x/System.EnterpriseServices.dll -r:./../../class/lib/net_4_x/System.ServiceModel.dll -r:./../../class/lib/net_4_x/System.Web.ApplicationServices.dll -doc:net_4_x_System.Web.Extensions_test.xml -nowarn:219,169,1591 /resource:Test/resources/Web.mono.config /resource:Test/resources/profile.config.4.x /resource:Test/resources/ListViewSort.aspx /resource:Test/resources/ListViewTest.aspx /resource:Test/resources/ListViewTotalRowCount_Bug535701_1.aspx /resource:Test/resources/ListViewTotalRowCount_Bug535701_2.aspx /resource:Test/resources/ListViewTotalRowCount_Bug604053.aspx /resource:../System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/MyPage.aspx.cs /resource:../System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/Global.asax /resource:../System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/My.ashx /resource:../System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/MyPage.aspx /resource:../System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/MyPageWithDerivedMaster.aspx /resource:../System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/MyPageWithMaster.aspx /resource:../System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/MyPageWithMasterInvalidPlaceHolder.aspx /resource:../System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/My.master /resource:../System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/MyDerived.master -define:SYSTEM_WEB_EXTENSIONS</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.Web.Extensions.dll -unsafe -define:NET_3_5 -define:SYSTEM_WEB_EXTENSIONS /resource:../MicrosoftAjaxLibrary/System.Web.Extensions/3.5.0.0/3.5.21022.8/MicrosoftAjax.debug.js /resource:../MicrosoftAjaxLibrary/System.Web.Extensions/3.5.0.0/3.5.21022.8/MicrosoftAjax.js /resource:../MicrosoftAjaxLibrary/System.Web.Extensions/3.5.0.0/3.5.21022.8/MicrosoftAjaxTimer.debug.js /resource:../MicrosoftAjaxLibrary/System.Web.Extensions/3.5.0.0/3.5.21022.8/MicrosoftAjaxTimer.js /resource:../MicrosoftAjaxLibrary/System.Web.Extensions/3.5.0.0/3.5.21022.8/MicrosoftAjaxWebForms.debug.js /resource:../MicrosoftAjaxLibrary/System.Web.Extensions/3.5.0.0/3.5.21022.8/MicrosoftAjaxWebForms.js -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Drawing.dll -r:./../../class/lib/net_4_x/System.Data.dll -r:./../../class/lib/net_4_x/System.Data.Linq.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/System.Web.Services.dll -r:./../../class/lib/net_4_x/System.Configuration.dll -r:./../../class/lib/net_4_x/System.EnterpriseServices.dll -r:./../../class/lib/net_4_x/System.ServiceModel.dll -r:./../../class/lib/net_4_x/System.Web.ApplicationServices.dll -doc:net_4_x_System.Web.Extensions_test.xml -nowarn:219,169,1591 /resource:Test/resources/Web.mono.config /resource:Test/resources/profile.config.4.x /resource:Test/resources/ListViewSort.aspx /resource:Test/resources/ListViewTest.aspx /resource:Test/resources/ListViewTotalRowCount_Bug535701_1.aspx /resource:Test/resources/ListViewTotalRowCount_Bug535701_2.aspx /resource:Test/resources/ListViewTotalRowCount_Bug604053.aspx /resource:../System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/MyPage.aspx.cs /resource:../System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/Global.asax /resource:../System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/My.ashx /resource:../System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/MyPage.aspx /resource:../System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/MyPageWithDerivedMaster.aspx /resource:../System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/MyPageWithMaster.aspx /resource:../System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/MyPageWithMasterInvalidPlaceHolder.aspx /resource:../System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/My.master /resource:../System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/MyDerived.master -define:SYSTEM_WEB_EXTENSIONS</flags>
       <output>net_4_x_System.Web.Extensions_test.dll</output>
       <built_sources></built_sources>
       <library_output>net_4_x_System.Web.Extensions_test.dll</library_output>
     </project>
     <project dir="class/System.Web.Extensions.Design" library="System.Web.Extensions.Design-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -define:NET_3_5 -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Design.dll -r:./../../class/lib/net_4_x/System.Drawing.dll -r:./../../class/lib/net_4_x/System.Windows.Forms.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 -define:NET_3_5 -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Design.dll -r:./../../class/lib/net_4_x/System.Drawing.dll -r:./../../class/lib/net_4_x/System.Windows.Forms.dll</flags>
       <output>System.Web.Extensions.Design.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.Web.Extensions.Design.dll</library_output>
     </project>
     <project dir="class/System.Web.DynamicData" library="System.Web.DynamicData-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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.ComponentModel.DataAnnotations.dll -r:./../../class/lib/net_4_x/System.Data.dll -r:./../../class/lib/net_4_x/System.Data.Linq.dll -r:./../../class/lib/net_4_x/System.Drawing.dll -r:./../../class/lib/net_4_x/System.Web.dll -r:./../../class/lib/net_4_x/System.Web.Extensions.dll -r:./../../class/lib/net_4_x/System.Web.Abstractions.dll -r:./../../class/lib/net_4_x/System.Web.Routing.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 -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.ComponentModel.DataAnnotations.dll -r:./../../class/lib/net_4_x/System.Data.dll -r:./../../class/lib/net_4_x/System.Data.Linq.dll -r:./../../class/lib/net_4_x/System.Drawing.dll -r:./../../class/lib/net_4_x/System.Web.dll -r:./../../class/lib/net_4_x/System.Web.Extensions.dll -r:./../../class/lib/net_4_x/System.Web.Abstractions.dll -r:./../../class/lib/net_4_x/System.Web.Routing.dll -r:./../../class/lib/net_4_x/System.Web.ApplicationServices.dll</flags>
       <output>System.Web.DynamicData.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.Web.DynamicData.dll</library_output>
     </project>
     <project dir="class/System.Web.DynamicData" library="System.Web.DynamicData-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/System.Web.DynamicData.dll -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.ComponentModel.DataAnnotations.dll -r:./../../class/lib/net_4_x/System.Data.dll -r:./../../class/lib/net_4_x/System.Data.Linq.dll -r:./../../class/lib/net_4_x/System.Drawing.dll -r:./../../class/lib/net_4_x/System.Web.dll -r:./../../class/lib/net_4_x/System.Web.Extensions.dll -r:./../../class/lib/net_4_x/System.Web.Abstractions.dll -r:./../../class/lib/net_4_x/System.Web.Routing.dll -r:./../../class/lib/net_4_x/System.Web.ApplicationServices.dll /resource:Test/WebPages/DynamicData/Content/FilterUserControl.ascx,MonoTests.WebPages.DynamicData.Content.FilterUserControl.ascx /resource:Test/WebPages/DynamicData/Content/FilterUserControl.ascx.cs,MonoTests.WebPages.DynamicData.Content.FilterUserControl.ascx.cs /resource:Test/WebPages/DynamicData/Content/GridViewPager.ascx,MonoTests.WebPages.DynamicData.Content.GridViewPager.ascx /resource:Test/WebPages/DynamicData/Content/GridViewPager.ascx.cs,MonoTests.WebPages.DynamicData.Content.GridViewPager.ascx.cs /resource:Test/WebPages/DynamicData/Content/Images/Back.gif,MonoTests.WebPages.DynamicData.Content.Images.Back.gif /resource:Test/WebPages/DynamicData/Content/Images/header_back.gif,MonoTests.WebPages.DynamicData.Content.Images.header_back.gif /resource:Test/WebPages/DynamicData/Content/Images/PgFirst.gif,MonoTests.WebPages.DynamicData.Content.Images.PgFirst.gif /resource:Test/WebPages/DynamicData/Content/Images/PgLast.gif,MonoTests.WebPages.DynamicData.Content.Images.PgLast.gif /resource:Test/WebPages/DynamicData/Content/Images/PgNext.gif,MonoTests.WebPages.DynamicData.Content.Images.PgNext.gif /resource:Test/WebPages/DynamicData/Content/Images/PgPrev.gif,MonoTests.WebPages.DynamicData.Content.Images.PgPrev.gif /resource:Test/WebPages/DynamicData/Content/Images/plus.gif,MonoTests.WebPages.DynamicData.Content.Images.plus.gif /resource:Test/WebPages/DynamicData/FieldTemplates/Boolean.ascx,MonoTests.WebPages.DynamicData.FieldTemplates.Boolean.ascx /resource:Test/WebPages/DynamicData/FieldTemplates/Boolean.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates.Boolean.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates/Boolean_Edit.ascx,MonoTests.WebPages.DynamicData.FieldTemplates.Boolean_Edit.ascx /resource:Test/WebPages/DynamicData/FieldTemplates/Boolean_Edit.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates.Boolean_Edit.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates/Children.ascx,MonoTests.WebPages.DynamicData.FieldTemplates.Children.ascx /resource:Test/WebPages/DynamicData/FieldTemplates/Children.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates.Children.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates/CustomColor.ascx,MonoTests.WebPages.DynamicData.FieldTemplates.CustomColor.ascx /resource:Test/WebPages/DynamicData/FieldTemplates/CustomColor.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates.CustomColor.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates/CustomFieldTemplate.ascx,MonoTests.WebPages.DynamicData.FieldTemplates.CustomFieldTemplate.ascx /resource:Test/WebPages/DynamicData/FieldTemplates/CustomFieldTemplate.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates.CustomFieldTemplate.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates/DateTime.ascx,MonoTests.WebPages.DynamicData.FieldTemplates.DateTime.ascx /resource:Test/WebPages/DynamicData/FieldTemplates/DateTime.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates.DateTime.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates/DateTime_Edit.ascx,MonoTests.WebPages.DynamicData.FieldTemplates.DateTime_Edit.ascx /resource:Test/WebPages/DynamicData/FieldTemplates/DateTime_Edit.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates.DateTime_Edit.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates/Decimal_Edit.ascx,MonoTests.WebPages.DynamicData.FieldTemplates.Decimal_Edit.ascx /resource:Test/WebPages/DynamicData/FieldTemplates/Decimal_Edit.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates.Decimal_Edit.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates/ForeignKey.ascx,MonoTests.WebPages.DynamicData.FieldTemplates.ForeignKey.ascx /resource:Test/WebPages/DynamicData/FieldTemplates/ForeignKey.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates.ForeignKey.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates/ForeignKey_Edit.ascx,MonoTests.WebPages.DynamicData.FieldTemplates.ForeignKey_Edit.ascx /resource:Test/WebPages/DynamicData/FieldTemplates/ForeignKey_Edit.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates.ForeignKey_Edit.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates/Integer_Edit.ascx,MonoTests.WebPages.DynamicData.FieldTemplates.Integer_Edit.ascx /resource:Test/WebPages/DynamicData/FieldTemplates/Integer_Edit.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates.Integer_Edit.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates/MultilineText_Edit.ascx,MonoTests.WebPages.DynamicData.FieldTemplates.MultilineText_Edit.ascx /resource:Test/WebPages/DynamicData/FieldTemplates/MultilineText_Edit.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates.MultilineText_Edit.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates/MyCustomUIHintTemplate_Text.ascx,MonoTests.WebPages.DynamicData.FieldTemplates.MyCustomUIHintTemplate_Text.ascx /resource:Test/WebPages/DynamicData/FieldTemplates/MyCustomUIHintTemplate_Text.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates.MyCustomUIHintTemplate_Text.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/Boolean.ascx,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.Boolean.ascx /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/Boolean.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.Boolean.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/Byte.ascx,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.Byte.ascx /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/Byte[].ascx,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.Byte[].ascx /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/Byte.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.Byte.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/Byte[].ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.Byte[].ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/Char.ascx,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.Char.ascx /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/Char.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.Char.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/FooEmpty.ascx,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.FooEmpty.ascx /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/FooEmpty.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.FooEmpty.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/ICollection.ascx,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.ICollection.ascx /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/ICollection.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.ICollection.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/Int16.ascx,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.Int16.ascx /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/Int16.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.Int16.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/Int32.ascx,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.Int32.ascx /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/Int32.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.Int32.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/Int64.ascx,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.Int64.ascx /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/Int64.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.Int64.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/MonoTests.Common.FooEmpty.ascx,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.MonoTests.Common.FooEmpty.ascx /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/MonoTests.Common.FooEmpty.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.MonoTests.Common.FooEmpty.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/Object.ascx,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.Object.ascx /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/Object.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.Object.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/SByte.ascx,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.SByte.ascx /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/SByte.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.SByte.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/String.ascx,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.String.ascx /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/String.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.String.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/System.Boolean.ascx,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.System.Boolean.ascx /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/System.Boolean.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.System.Boolean.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/System.Byte.ascx,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.System.Byte.ascx /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/System.Byte[].ascx,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.System.Byte[].ascx /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/System.Byte.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.System.Byte.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/System.Byte[].ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.System.Byte[].ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/System.Char.ascx,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.System.Char.ascx /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/System.Char.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.System.Char.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/System.Collections.Generic.List`1[System.String].ascx,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.System.Collections.Generic.List`1[System.String].ascx /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/System.Collections.Generic.List`1[System.String].ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.System.Collections.Generic.List`1[System.String].ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/System.Collections.ICollection.ascx,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.System.Collections.ICollection.ascx /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/System.Collections.ICollection.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.System.Collections.ICollection.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/System.Int16.ascx,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.System.Int16.ascx /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/System.Int16.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.System.Int16.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/System.Int32.ascx,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.System.Int32.ascx /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/System.Int32.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.System.Int32.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/System.Int64.ascx,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.System.Int64.ascx /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/System.Int64.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.System.Int64.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/System.Object.ascx,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.System.Object.ascx /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/System.Object.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.System.Object.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/System.SByte.ascx,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.System.SByte.ascx /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/System.SByte.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.System.SByte.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/System.String.ascx,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.System.String.ascx /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/System.String.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.System.String.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/System.UInt16.ascx,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.System.UInt16.ascx /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/System.UInt16.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.System.UInt16.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/System.UInt32.ascx,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.System.UInt32.ascx /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/System.UInt32.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.System.UInt32.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/System.UInt64.ascx,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.System.UInt64.ascx /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/System.UInt64.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.System.UInt64.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/UInt16.ascx,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.UInt16.ascx /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/UInt16.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.UInt16.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/UInt32.ascx,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.UInt32.ascx /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/UInt32.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.UInt32.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/UInt64.ascx,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.UInt64.ascx /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/UInt64.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.UInt64.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates/PlainControlTemplate.ascx,MonoTests.WebPages.DynamicData.FieldTemplates.PlainControlTemplate.ascx /resource:Test/WebPages/DynamicData/FieldTemplates/PlainControlTemplate.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates.PlainControlTemplate.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates/Text.ascx,MonoTests.WebPages.DynamicData.FieldTemplates.Text.ascx /resource:Test/WebPages/DynamicData/FieldTemplates/Text.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates.Text.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates/Text_Edit.ascx,MonoTests.WebPages.DynamicData.FieldTemplates.Text_Edit.ascx /resource:Test/WebPages/DynamicData/FieldTemplates/Text_Edit.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates.Text_Edit.ascx.cs /resource:Test/WebPages/DynamicData/PageTemplates/Details.aspx,MonoTests.WebPages.DynamicData.PageTemplates.Details.aspx /resource:Test/WebPages/DynamicData/PageTemplates/Details.aspx.cs,MonoTests.WebPages.DynamicData.PageTemplates.Details.aspx.cs /resource:Test/WebPages/DynamicData/PageTemplates/Edit.aspx,MonoTests.WebPages.DynamicData.PageTemplates.Edit.aspx /resource:Test/WebPages/DynamicData/PageTemplates/Edit.aspx.cs,MonoTests.WebPages.DynamicData.PageTemplates.Edit.aspx.cs /resource:Test/WebPages/DynamicData/PageTemplates/Insert.aspx,MonoTests.WebPages.DynamicData.PageTemplates.Insert.aspx /resource:Test/WebPages/DynamicData/PageTemplates/Insert.aspx.cs,MonoTests.WebPages.DynamicData.PageTemplates.Insert.aspx.cs /resource:Test/WebPages/DynamicData/PageTemplates/List.aspx,MonoTests.WebPages.DynamicData.PageTemplates.List.aspx /resource:Test/WebPages/DynamicData/PageTemplates/List.aspx.cs,MonoTests.WebPages.DynamicData.PageTemplates.List.aspx.cs /resource:Test/WebPages/DynamicData/PageTemplates/ListDetails.aspx,MonoTests.WebPages.DynamicData.PageTemplates.ListDetails.aspx /resource:Test/WebPages/DynamicData/PageTemplates/ListDetails.aspx.cs,MonoTests.WebPages.DynamicData.PageTemplates.ListDetails.aspx.cs /resource:Test/WebPages/DynamicData/web.config,MonoTests.WebPages.DynamicData.web.config /resource:Test/WebPages/Global.asax,MonoTests.WebPages.Global.asax /resource:Test/WebPages/ListView_DynamicControl_01.aspx,MonoTests.WebPages.ListView_DynamicControl_01.aspx /resource:Test/WebPages/ListView_DynamicControl_01.aspx.cs,MonoTests.WebPages.ListView_DynamicControl_01.aspx.cs /resource:Test/WebPages/ListView_DynamicControl_02.aspx,MonoTests.WebPages.ListView_DynamicControl_02.aspx /resource:Test/WebPages/ListView_DynamicControl_02.aspx.cs,MonoTests.WebPages.ListView_DynamicControl_02.aspx.cs /resource:Test/WebPages/ListView_DynamicControl_03.aspx,MonoTests.WebPages.ListView_DynamicControl_03.aspx /resource:Test/WebPages/ListView_DynamicControl_03.aspx.cs,MonoTests.WebPages.ListView_DynamicControl_03.aspx.cs /resource:Test/WebPages/ListView_DynamicControl_04.aspx,MonoTests.WebPages.ListView_DynamicControl_04.aspx /resource:Test/WebPages/ListView_DynamicControl_04.aspx.cs,MonoTests.WebPages.ListView_DynamicControl_04.aspx.cs /resource:Test/WebPages/ListView_DynamicControl_05.aspx,MonoTests.WebPages.ListView_DynamicControl_05.aspx /resource:Test/WebPages/ListView_DynamicControl_05.aspx.cs,MonoTests.WebPages.ListView_DynamicControl_05.aspx.cs /resource:Test/WebPages/ListView_DynamicControl_06.aspx,MonoTests.WebPages.ListView_DynamicControl_06.aspx /resource:Test/WebPages/ListView_DynamicControl_06.aspx.cs,MonoTests.WebPages.ListView_DynamicControl_06.aspx.cs /resource:Test/WebPages/ListView_DynamicControl_07.aspx,MonoTests.WebPages.ListView_DynamicControl_07.aspx /resource:Test/WebPages/ListView_DynamicControl_07.aspx.cs,MonoTests.WebPages.ListView_DynamicControl_07.aspx.cs /resource:Test/WebPages/ListView_DynamicControl_08.aspx,MonoTests.WebPages.ListView_DynamicControl_08.aspx /resource:Test/WebPages/ListView_DynamicControl_08.aspx.cs,MonoTests.WebPages.ListView_DynamicControl_08.aspx.cs /resource:Test/WebPages/ListView_DynamicControl_09.aspx,MonoTests.WebPages.ListView_DynamicControl_09.aspx /resource:Test/WebPages/ListView_DynamicControl_09.aspx.cs,MonoTests.WebPages.ListView_DynamicControl_09.aspx.cs /resource:Test/WebPages/ListView_DynamicControl_10.aspx,MonoTests.WebPages.ListView_DynamicControl_10.aspx /resource:Test/WebPages/ListView_DynamicControl_10.aspx.cs,MonoTests.WebPages.ListView_DynamicControl_10.aspx.cs /resource:Test/WebPages/DynamicValidator_01.aspx,MonoTests.WebPages.DynamicValidator_01.aspx /resource:Test/WebPages/DynamicValidator_01.aspx.cs,MonoTests.WebPages.DynamicValidator_01.aspx.cs /resource:Test/WebPages/DynamicValidator_02.aspx,MonoTests.WebPages.DynamicValidator_02.aspx /resource:Test/WebPages/DynamicValidator_02.aspx.cs,MonoTests.WebPages.DynamicValidator_02.aspx.cs /resource:Test/WebPages/Site.css,MonoTests.WebPages.Site.css /resource:Test/WebPages/Site.master,MonoTests.WebPages.Site.master /resource:Test/WebPages/Site.master.cs,MonoTests.WebPages.Site.master.cs /resource:Test/WebPages/web.config.4.x,MonoTests.WebPages.web.config.4.x</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.Web.DynamicData.dll -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.ComponentModel.DataAnnotations.dll -r:./../../class/lib/net_4_x/System.Data.dll -r:./../../class/lib/net_4_x/System.Data.Linq.dll -r:./../../class/lib/net_4_x/System.Drawing.dll -r:./../../class/lib/net_4_x/System.Web.dll -r:./../../class/lib/net_4_x/System.Web.Extensions.dll -r:./../../class/lib/net_4_x/System.Web.Abstractions.dll -r:./../../class/lib/net_4_x/System.Web.Routing.dll -r:./../../class/lib/net_4_x/System.Web.ApplicationServices.dll /resource:Test/WebPages/DynamicData/Content/FilterUserControl.ascx,MonoTests.WebPages.DynamicData.Content.FilterUserControl.ascx /resource:Test/WebPages/DynamicData/Content/FilterUserControl.ascx.cs,MonoTests.WebPages.DynamicData.Content.FilterUserControl.ascx.cs /resource:Test/WebPages/DynamicData/Content/GridViewPager.ascx,MonoTests.WebPages.DynamicData.Content.GridViewPager.ascx /resource:Test/WebPages/DynamicData/Content/GridViewPager.ascx.cs,MonoTests.WebPages.DynamicData.Content.GridViewPager.ascx.cs /resource:Test/WebPages/DynamicData/Content/Images/Back.gif,MonoTests.WebPages.DynamicData.Content.Images.Back.gif /resource:Test/WebPages/DynamicData/Content/Images/header_back.gif,MonoTests.WebPages.DynamicData.Content.Images.header_back.gif /resource:Test/WebPages/DynamicData/Content/Images/PgFirst.gif,MonoTests.WebPages.DynamicData.Content.Images.PgFirst.gif /resource:Test/WebPages/DynamicData/Content/Images/PgLast.gif,MonoTests.WebPages.DynamicData.Content.Images.PgLast.gif /resource:Test/WebPages/DynamicData/Content/Images/PgNext.gif,MonoTests.WebPages.DynamicData.Content.Images.PgNext.gif /resource:Test/WebPages/DynamicData/Content/Images/PgPrev.gif,MonoTests.WebPages.DynamicData.Content.Images.PgPrev.gif /resource:Test/WebPages/DynamicData/Content/Images/plus.gif,MonoTests.WebPages.DynamicData.Content.Images.plus.gif /resource:Test/WebPages/DynamicData/FieldTemplates/Boolean.ascx,MonoTests.WebPages.DynamicData.FieldTemplates.Boolean.ascx /resource:Test/WebPages/DynamicData/FieldTemplates/Boolean.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates.Boolean.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates/Boolean_Edit.ascx,MonoTests.WebPages.DynamicData.FieldTemplates.Boolean_Edit.ascx /resource:Test/WebPages/DynamicData/FieldTemplates/Boolean_Edit.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates.Boolean_Edit.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates/Children.ascx,MonoTests.WebPages.DynamicData.FieldTemplates.Children.ascx /resource:Test/WebPages/DynamicData/FieldTemplates/Children.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates.Children.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates/CustomColor.ascx,MonoTests.WebPages.DynamicData.FieldTemplates.CustomColor.ascx /resource:Test/WebPages/DynamicData/FieldTemplates/CustomColor.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates.CustomColor.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates/CustomFieldTemplate.ascx,MonoTests.WebPages.DynamicData.FieldTemplates.CustomFieldTemplate.ascx /resource:Test/WebPages/DynamicData/FieldTemplates/CustomFieldTemplate.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates.CustomFieldTemplate.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates/DateTime.ascx,MonoTests.WebPages.DynamicData.FieldTemplates.DateTime.ascx /resource:Test/WebPages/DynamicData/FieldTemplates/DateTime.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates.DateTime.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates/DateTime_Edit.ascx,MonoTests.WebPages.DynamicData.FieldTemplates.DateTime_Edit.ascx /resource:Test/WebPages/DynamicData/FieldTemplates/DateTime_Edit.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates.DateTime_Edit.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates/Decimal_Edit.ascx,MonoTests.WebPages.DynamicData.FieldTemplates.Decimal_Edit.ascx /resource:Test/WebPages/DynamicData/FieldTemplates/Decimal_Edit.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates.Decimal_Edit.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates/ForeignKey.ascx,MonoTests.WebPages.DynamicData.FieldTemplates.ForeignKey.ascx /resource:Test/WebPages/DynamicData/FieldTemplates/ForeignKey.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates.ForeignKey.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates/ForeignKey_Edit.ascx,MonoTests.WebPages.DynamicData.FieldTemplates.ForeignKey_Edit.ascx /resource:Test/WebPages/DynamicData/FieldTemplates/ForeignKey_Edit.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates.ForeignKey_Edit.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates/Integer_Edit.ascx,MonoTests.WebPages.DynamicData.FieldTemplates.Integer_Edit.ascx /resource:Test/WebPages/DynamicData/FieldTemplates/Integer_Edit.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates.Integer_Edit.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates/MultilineText_Edit.ascx,MonoTests.WebPages.DynamicData.FieldTemplates.MultilineText_Edit.ascx /resource:Test/WebPages/DynamicData/FieldTemplates/MultilineText_Edit.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates.MultilineText_Edit.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates/MyCustomUIHintTemplate_Text.ascx,MonoTests.WebPages.DynamicData.FieldTemplates.MyCustomUIHintTemplate_Text.ascx /resource:Test/WebPages/DynamicData/FieldTemplates/MyCustomUIHintTemplate_Text.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates.MyCustomUIHintTemplate_Text.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/Boolean.ascx,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.Boolean.ascx /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/Boolean.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.Boolean.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/Byte.ascx,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.Byte.ascx /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/Byte[].ascx,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.Byte[].ascx /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/Byte.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.Byte.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/Byte[].ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.Byte[].ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/Char.ascx,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.Char.ascx /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/Char.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.Char.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/FooEmpty.ascx,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.FooEmpty.ascx /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/FooEmpty.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.FooEmpty.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/ICollection.ascx,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.ICollection.ascx /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/ICollection.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.ICollection.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/Int16.ascx,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.Int16.ascx /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/Int16.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.Int16.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/Int32.ascx,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.Int32.ascx /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/Int32.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.Int32.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/Int64.ascx,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.Int64.ascx /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/Int64.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.Int64.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/MonoTests.Common.FooEmpty.ascx,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.MonoTests.Common.FooEmpty.ascx /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/MonoTests.Common.FooEmpty.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.MonoTests.Common.FooEmpty.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/Object.ascx,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.Object.ascx /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/Object.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.Object.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/SByte.ascx,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.SByte.ascx /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/SByte.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.SByte.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/String.ascx,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.String.ascx /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/String.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.String.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/System.Boolean.ascx,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.System.Boolean.ascx /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/System.Boolean.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.System.Boolean.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/System.Byte.ascx,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.System.Byte.ascx /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/System.Byte[].ascx,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.System.Byte[].ascx /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/System.Byte.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.System.Byte.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/System.Byte[].ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.System.Byte[].ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/System.Char.ascx,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.System.Char.ascx /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/System.Char.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.System.Char.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/System.Collections.Generic.List`1[System.String].ascx,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.System.Collections.Generic.List`1[System.String].ascx /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/System.Collections.Generic.List`1[System.String].ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.System.Collections.Generic.List`1[System.String].ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/System.Collections.ICollection.ascx,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.System.Collections.ICollection.ascx /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/System.Collections.ICollection.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.System.Collections.ICollection.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/System.Int16.ascx,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.System.Int16.ascx /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/System.Int16.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.System.Int16.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/System.Int32.ascx,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.System.Int32.ascx /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/System.Int32.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.System.Int32.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/System.Int64.ascx,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.System.Int64.ascx /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/System.Int64.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.System.Int64.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/System.Object.ascx,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.System.Object.ascx /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/System.Object.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.System.Object.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/System.SByte.ascx,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.System.SByte.ascx /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/System.SByte.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.System.SByte.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/System.String.ascx,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.System.String.ascx /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/System.String.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.System.String.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/System.UInt16.ascx,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.System.UInt16.ascx /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/System.UInt16.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.System.UInt16.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/System.UInt32.ascx,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.System.UInt32.ascx /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/System.UInt32.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.System.UInt32.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/System.UInt64.ascx,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.System.UInt64.ascx /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/System.UInt64.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.System.UInt64.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/UInt16.ascx,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.UInt16.ascx /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/UInt16.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.UInt16.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/UInt32.ascx,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.UInt32.ascx /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/UInt32.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.UInt32.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/UInt64.ascx,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.UInt64.ascx /resource:Test/WebPages/DynamicData/FieldTemplates_NonDefault/UInt64.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates_NonDefault.UInt64.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates/PlainControlTemplate.ascx,MonoTests.WebPages.DynamicData.FieldTemplates.PlainControlTemplate.ascx /resource:Test/WebPages/DynamicData/FieldTemplates/PlainControlTemplate.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates.PlainControlTemplate.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates/Text.ascx,MonoTests.WebPages.DynamicData.FieldTemplates.Text.ascx /resource:Test/WebPages/DynamicData/FieldTemplates/Text.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates.Text.ascx.cs /resource:Test/WebPages/DynamicData/FieldTemplates/Text_Edit.ascx,MonoTests.WebPages.DynamicData.FieldTemplates.Text_Edit.ascx /resource:Test/WebPages/DynamicData/FieldTemplates/Text_Edit.ascx.cs,MonoTests.WebPages.DynamicData.FieldTemplates.Text_Edit.ascx.cs /resource:Test/WebPages/DynamicData/PageTemplates/Details.aspx,MonoTests.WebPages.DynamicData.PageTemplates.Details.aspx /resource:Test/WebPages/DynamicData/PageTemplates/Details.aspx.cs,MonoTests.WebPages.DynamicData.PageTemplates.Details.aspx.cs /resource:Test/WebPages/DynamicData/PageTemplates/Edit.aspx,MonoTests.WebPages.DynamicData.PageTemplates.Edit.aspx /resource:Test/WebPages/DynamicData/PageTemplates/Edit.aspx.cs,MonoTests.WebPages.DynamicData.PageTemplates.Edit.aspx.cs /resource:Test/WebPages/DynamicData/PageTemplates/Insert.aspx,MonoTests.WebPages.DynamicData.PageTemplates.Insert.aspx /resource:Test/WebPages/DynamicData/PageTemplates/Insert.aspx.cs,MonoTests.WebPages.DynamicData.PageTemplates.Insert.aspx.cs /resource:Test/WebPages/DynamicData/PageTemplates/List.aspx,MonoTests.WebPages.DynamicData.PageTemplates.List.aspx /resource:Test/WebPages/DynamicData/PageTemplates/List.aspx.cs,MonoTests.WebPages.DynamicData.PageTemplates.List.aspx.cs /resource:Test/WebPages/DynamicData/PageTemplates/ListDetails.aspx,MonoTests.WebPages.DynamicData.PageTemplates.ListDetails.aspx /resource:Test/WebPages/DynamicData/PageTemplates/ListDetails.aspx.cs,MonoTests.WebPages.DynamicData.PageTemplates.ListDetails.aspx.cs /resource:Test/WebPages/DynamicData/web.config,MonoTests.WebPages.DynamicData.web.config /resource:Test/WebPages/Global.asax,MonoTests.WebPages.Global.asax /resource:Test/WebPages/ListView_DynamicControl_01.aspx,MonoTests.WebPages.ListView_DynamicControl_01.aspx /resource:Test/WebPages/ListView_DynamicControl_01.aspx.cs,MonoTests.WebPages.ListView_DynamicControl_01.aspx.cs /resource:Test/WebPages/ListView_DynamicControl_02.aspx,MonoTests.WebPages.ListView_DynamicControl_02.aspx /resource:Test/WebPages/ListView_DynamicControl_02.aspx.cs,MonoTests.WebPages.ListView_DynamicControl_02.aspx.cs /resource:Test/WebPages/ListView_DynamicControl_03.aspx,MonoTests.WebPages.ListView_DynamicControl_03.aspx /resource:Test/WebPages/ListView_DynamicControl_03.aspx.cs,MonoTests.WebPages.ListView_DynamicControl_03.aspx.cs /resource:Test/WebPages/ListView_DynamicControl_04.aspx,MonoTests.WebPages.ListView_DynamicControl_04.aspx /resource:Test/WebPages/ListView_DynamicControl_04.aspx.cs,MonoTests.WebPages.ListView_DynamicControl_04.aspx.cs /resource:Test/WebPages/ListView_DynamicControl_05.aspx,MonoTests.WebPages.ListView_DynamicControl_05.aspx /resource:Test/WebPages/ListView_DynamicControl_05.aspx.cs,MonoTests.WebPages.ListView_DynamicControl_05.aspx.cs /resource:Test/WebPages/ListView_DynamicControl_06.aspx,MonoTests.WebPages.ListView_DynamicControl_06.aspx /resource:Test/WebPages/ListView_DynamicControl_06.aspx.cs,MonoTests.WebPages.ListView_DynamicControl_06.aspx.cs /resource:Test/WebPages/ListView_DynamicControl_07.aspx,MonoTests.WebPages.ListView_DynamicControl_07.aspx /resource:Test/WebPages/ListView_DynamicControl_07.aspx.cs,MonoTests.WebPages.ListView_DynamicControl_07.aspx.cs /resource:Test/WebPages/ListView_DynamicControl_08.aspx,MonoTests.WebPages.ListView_DynamicControl_08.aspx /resource:Test/WebPages/ListView_DynamicControl_08.aspx.cs,MonoTests.WebPages.ListView_DynamicControl_08.aspx.cs /resource:Test/WebPages/ListView_DynamicControl_09.aspx,MonoTests.WebPages.ListView_DynamicControl_09.aspx /resource:Test/WebPages/ListView_DynamicControl_09.aspx.cs,MonoTests.WebPages.ListView_DynamicControl_09.aspx.cs /resource:Test/WebPages/ListView_DynamicControl_10.aspx,MonoTests.WebPages.ListView_DynamicControl_10.aspx /resource:Test/WebPages/ListView_DynamicControl_10.aspx.cs,MonoTests.WebPages.ListView_DynamicControl_10.aspx.cs /resource:Test/WebPages/DynamicValidator_01.aspx,MonoTests.WebPages.DynamicValidator_01.aspx /resource:Test/WebPages/DynamicValidator_01.aspx.cs,MonoTests.WebPages.DynamicValidator_01.aspx.cs /resource:Test/WebPages/DynamicValidator_02.aspx,MonoTests.WebPages.DynamicValidator_02.aspx /resource:Test/WebPages/DynamicValidator_02.aspx.cs,MonoTests.WebPages.DynamicValidator_02.aspx.cs /resource:Test/WebPages/Site.css,MonoTests.WebPages.Site.css /resource:Test/WebPages/Site.master,MonoTests.WebPages.Site.master /resource:Test/WebPages/Site.master.cs,MonoTests.WebPages.Site.master.cs /resource:Test/WebPages/web.config.4.x,MonoTests.WebPages.web.config.4.x</flags>
       <output>net_4_x_System.Web.DynamicData_test.dll</output>
       <built_sources></built_sources>
       <library_output>net_4_x_System.Web.DynamicData_test.dll</library_output>
     </project>
     <project dir="class/Mono.CSharp" library="Mono.CSharp-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -d:MONO_FEATURE_THREAD_ABORT -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Xml.dll -r:./../../class/lib/net_4_x/System.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:MONO_FEATURE_THREAD_ABORT -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Xml.dll -r:./../../class/lib/net_4_x/System.dll</flags>
       <output>Mono.CSharp.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/Mono.CSharp.dll</library_output>
     </project>
     <project dir="class/Mono.CSharp" library="Mono.CSharp-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/Mono.CSharp.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/Mono.CSharp.dll</flags>
       <output>net_4_x_Mono.CSharp_test.dll</output>
       <built_sources></built_sources>
       <library_output>net_4_x_Mono.CSharp_test.dll</library_output>
     </project>
     <project dir="class/System.Net" library="System.Net-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -unsafe -d:NET_3_5 -nowarn:1720 -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</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 -unsafe -d:NET_3_5 -nowarn:1720 -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</flags>
       <output>System.Net.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.Net.dll</library_output>
     </project>
     <project dir="class/System.Json" library="System.Json-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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.Xml.dll -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 -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</flags>
       <output>System.Json.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.Json.dll</library_output>
     </project>
     <project dir="class/System.Json" library="System.Json-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/System.Json.dll -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</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.Json.dll -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</flags>
       <output>net_4_x_System.Json_test.dll</output>
       <built_sources></built_sources>
       <library_output>net_4_x_System.Json_test.dll</library_output>
     </project>
     <project dir="class/Microsoft.CSharp" library="Microsoft.CSharp-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/Mono.CSharp.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 -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/Mono.CSharp.dll</flags>
       <output>Microsoft.CSharp.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/Microsoft.CSharp.dll</library_output>
     </project>
     <project dir="class/System.Xaml" library="System.Xaml-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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.Xml.dll -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 -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</flags>
       <output>System.Xaml.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.Xaml.dll</library_output>
     </project>
     <project dir="class/System.Xaml" library="System.Xaml-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/System.Xaml.dll -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</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.Xaml.dll -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</flags>
       <output>net_4_x_System.Xaml_test.dll</output>
       <built_sources></built_sources>
       <library_output>net_4_x_System.Xaml_test.dll</library_output>
     </project>
     <project dir="class/WindowsBase" library="WindowsBase-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -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.Xaml.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 -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.Xaml.dll</flags>
       <output>WindowsBase.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/WindowsBase.dll</library_output>
     </project>
     <project dir="class/WindowsBase" library="WindowsBase-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/WindowsBase.dll -unsafe</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/WindowsBase.dll -unsafe</flags>
       <output>net_4_x_WindowsBase_test.dll</output>
       <built_sources></built_sources>
       <library_output>net_4_x_WindowsBase_test.dll</library_output>
     </project>
     <project dir="class/System.ServiceModel.Activation" library="System.ServiceModel.Activation-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/plainservice/System.ServiceModel.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 -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/plainservice/System.ServiceModel.dll</flags>
       <output>System.ServiceModel.Activation.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.ServiceModel.Activation.dll</library_output>
     </project>
     <project dir="class/System.ServiceModel.Routing" library="System.ServiceModel.Routing-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -d:NET_3_5 -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.Runtime.Serialization.dll -r:./../../class/lib/net_4_x/System.ServiceModel.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Configuration.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_5 -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.Runtime.Serialization.dll -r:./../../class/lib/net_4_x/System.ServiceModel.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Configuration.dll</flags>
       <output>System.ServiceModel.Routing.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.ServiceModel.Routing.dll</library_output>
     </project>
     <project dir="class/System.ServiceModel.Discovery" library="System.ServiceModel.Discovery-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -d:NET_3_5 -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.Runtime.Serialization.dll -r:./../../class/lib/net_4_x/System.ServiceModel.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Xml.Linq.dll -r:./../../class/lib/net_4_x/System.Configuration.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_5 -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.Runtime.Serialization.dll -r:./../../class/lib/net_4_x/System.ServiceModel.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Xml.Linq.dll -r:./../../class/lib/net_4_x/System.Configuration.dll</flags>
       <output>System.ServiceModel.Discovery.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.ServiceModel.Discovery.dll</library_output>
     </project>
     <project dir="class/System.ServiceModel.Discovery" library="System.ServiceModel.Discovery-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/System.ServiceModel.Discovery.dll -d:NET_3_5 -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.Runtime.Serialization.dll -r:./../../class/lib/net_4_x/System.ServiceModel.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Xml.Linq.dll -r:./../../class/lib/net_4_x/System.Configuration.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.ServiceModel.Discovery.dll -d:NET_3_5 -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.Runtime.Serialization.dll -r:./../../class/lib/net_4_x/System.ServiceModel.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Xml.Linq.dll -r:./../../class/lib/net_4_x/System.Configuration.dll</flags>
       <output>net_4_x_System.ServiceModel.Discovery_test.dll</output>
       <built_sources></built_sources>
       <library_output>net_4_x_System.ServiceModel.Discovery_test.dll</library_output>
     </project>
     <project dir="class/System.Runtime.Caching" library="System.Runtime.Caching-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -nowarn:414 -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Data.dll -r:./../../class/lib/net_4_x/System.Configuration.dll -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 -nowarn:414 -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Data.dll -r:./../../class/lib/net_4_x/System.Configuration.dll -r:./../../class/lib/net_4_x/System.Core.dll</flags>
       <output>System.Runtime.Caching.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.Runtime.Caching.dll</library_output>
     </project>
     <project dir="class/System.Runtime.Caching" library="System.Runtime.Caching-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/System.Runtime.Caching.dll -nowarn:414 -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Data.dll -r:./../../class/lib/net_4_x/System.Configuration.dll -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 -r:./../../class/lib/net_4_x/System.Runtime.Caching.dll -nowarn:414 -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Data.dll -r:./../../class/lib/net_4_x/System.Configuration.dll -r:./../../class/lib/net_4_x/System.Core.dll</flags>
       <output>net_4_x_System.Runtime.Caching_test.dll</output>
       <built_sources></built_sources>
       <library_output>net_4_x_System.Runtime.Caching_test.dll</library_output>
     </project>
     <project dir="class/Microsoft.Web.Infrastructure" library="Microsoft.Web.Infrastructure-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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.Configuration.dll -r:./../../class/lib/net_4_x/System.Web.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 -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Configuration.dll -r:./../../class/lib/net_4_x/System.Web.dll</flags>
       <output>Microsoft.Web.Infrastructure.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/Microsoft.Web.Infrastructure.dll</library_output>
     </project>
     <project dir="class/System.ServiceModel.Web" library="System.ServiceModel.Web-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -d:NET_3_5 -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.Runtime.Serialization.dll -r:./../../class/lib/net_4_x/System.ServiceModel.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Configuration.dll -r:./../../class/lib/net_4_x/System.Web.Extensions.dll -r:./../../class/lib/net_4_x/System.ServiceModel.Activation.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_5 -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.Runtime.Serialization.dll -r:./../../class/lib/net_4_x/System.ServiceModel.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Configuration.dll -r:./../../class/lib/net_4_x/System.Web.Extensions.dll -r:./../../class/lib/net_4_x/System.ServiceModel.Activation.dll</flags>
       <output>System.ServiceModel.Web.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.ServiceModel.Web.dll</library_output>
     </project>
     <project dir="class/System.ServiceModel.Web" library="System.ServiceModel.Web-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/System.ServiceModel.Web.dll -d:NET_3_5 -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.Runtime.Serialization.dll -r:./../../class/lib/net_4_x/System.ServiceModel.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Configuration.dll -r:./../../class/lib/net_4_x/System.Web.Extensions.dll -r:./../../class/lib/net_4_x/System.ServiceModel.Activation.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.ServiceModel.Web.dll -d:NET_3_5 -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.Runtime.Serialization.dll -r:./../../class/lib/net_4_x/System.ServiceModel.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Configuration.dll -r:./../../class/lib/net_4_x/System.Web.Extensions.dll -r:./../../class/lib/net_4_x/System.ServiceModel.Activation.dll</flags>
       <output>net_4_x_System.ServiceModel.Web_test.dll</output>
       <built_sources></built_sources>
       <library_output>net_4_x_System.ServiceModel.Web_test.dll</library_output>
     </project>
     <project dir="class/System.Net.Http" library="System.Net.Http-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.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 -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.dll</flags>
       <output>System.Net.Http.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.Net.Http.dll</library_output>
     </project>
     <project dir="class/System.Net.Http" library="System.Net.Http-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/System.Net.Http.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.Net.Http.dll</flags>
       <output>net_4_x_System.Net.Http_test.dll</output>
       <built_sources></built_sources>
       <library_output>net_4_x_System.Net.Http_test.dll</library_output>
     </project>
     <project dir="class/System.Net.Http.WebRequest" library="System.Net.Http.WebRequest-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:./../../class/lib/net_4_x/System.Net.Http.dll -r:./../../class/lib/net_4_x/System.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 -r:./../../class/lib/net_4_x/System.Net.Http.dll -r:./../../class/lib/net_4_x/System.dll</flags>
       <output>System.Net.Http.WebRequest.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.Net.Http.WebRequest.dll</library_output>
     </project>
     <project dir="class/System.Web.Razor" library="System.Web.Razor-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig /warn:1 /keyfile:../winfx.pub -delaysign /d:ASPNETWEBPAGES -r:./../../class/lib/net_4_x/System.dll -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 /warn:1 /keyfile:../winfx.pub -delaysign /d:ASPNETWEBPAGES -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Core.dll</flags>
       <output>System.Web.Razor.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.Web.Razor.dll</library_output>
     </project>
     <project dir="class/System.Web.WebPages.Deployment" library="System.Web.WebPages.Deployment-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig /warn:1 /keyfile:../winfx.pub -delaysign /d:ASPNETWEBPAGES -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Core.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/Microsoft.Web.Infrastructure.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 /warn:1 /keyfile:../winfx.pub -delaysign /d:ASPNETWEBPAGES -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Core.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/Microsoft.Web.Infrastructure.dll</flags>
       <output>System.Web.WebPages.Deployment.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.Web.WebPages.Deployment.dll</library_output>
     </project>
     <project dir="class/System.Web.WebPages" library="System.Web.WebPages-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig /warn:1 /keyfile:../winfx.pub /delaysign /d:ASPNETWEBPAGES -r:./../../class/lib/net_4_x/Microsoft.CSharp.dll -r:./../../class/lib/net_4_x/Microsoft.Web.Infrastructure.dll -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.ComponentModel.DataAnnotations.dll -r:./../../class/lib/net_4_x/System.Configuration.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Data.Linq.dll -r:./../../class/lib/net_4_x/System.Web.dll -r:./../../class/lib/net_4_x/System.Web.WebPages.Deployment.dll -r:./../../class/lib/net_4_x/System.Web.Razor.dll -r:./../../class/lib/net_4_x/System.Xml.dll -r:./../../class/lib/net_4_x/System.Xml.Linq.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 /warn:1 /keyfile:../winfx.pub /delaysign /d:ASPNETWEBPAGES -r:./../../class/lib/net_4_x/Microsoft.CSharp.dll -r:./../../class/lib/net_4_x/Microsoft.Web.Infrastructure.dll -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.ComponentModel.DataAnnotations.dll -r:./../../class/lib/net_4_x/System.Configuration.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Data.Linq.dll -r:./../../class/lib/net_4_x/System.Web.dll -r:./../../class/lib/net_4_x/System.Web.WebPages.Deployment.dll -r:./../../class/lib/net_4_x/System.Web.Razor.dll -r:./../../class/lib/net_4_x/System.Xml.dll -r:./../../class/lib/net_4_x/System.Xml.Linq.dll</flags>
       <output>System.Web.WebPages.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.Web.WebPages.dll</library_output>
     </project>
     <project dir="class/System.Web.WebPages.Razor" library="System.Web.WebPages.Razor-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig /warn:1 /keyfile:../winfx.pub /delaysign /d:ASPNETWEBPAGES -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Core.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.WebPages.dll -r:./../../class/lib/net_4_x/System.Web.Razor.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 /warn:1 /keyfile:../winfx.pub /delaysign /d:ASPNETWEBPAGES -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Core.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.WebPages.dll -r:./../../class/lib/net_4_x/System.Web.Razor.dll</flags>
       <output>System.Web.WebPages.Razor.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.Web.WebPages.Razor.dll</library_output>
     </project>
     <project dir="class/System.Web.Mvc3" library="System.Web.Mvc3-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig /warn:1 /keyfile:../winfx.pub /d:MONO /delaysign -r:./../../class/lib/net_4_x/Microsoft.Web.Infrastructure.dll -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Core.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.Xml.dll -r:./../../class/lib/net_4_x/System.Web.dll -r:./../../class/lib/net_4_x/System.Web.Abstractions.dll -r:./../../class/lib/net_4_x/System.Web.Routing.dll -r:./../../class/lib/net_4_x/System.Web.Extensions.dll -r:./../../class/lib/net_4_x/System.ComponentModel.DataAnnotations.dll -r:./../../class/lib/net_4_x/System.Data.Linq.dll -r:./../../class/lib/net_4_x/System.Runtime.Caching.dll -r:./../../class/lib/net_4_x/System.Web.Razor.dll -r:./../../class/lib/net_4_x/System.Web.WebPages.Razor.dll -r:./../../class/lib/net_4_x/System.Web.WebPages.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 /warn:1 /keyfile:../winfx.pub /d:MONO /delaysign -r:./../../class/lib/net_4_x/Microsoft.Web.Infrastructure.dll -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Core.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.Xml.dll -r:./../../class/lib/net_4_x/System.Web.dll -r:./../../class/lib/net_4_x/System.Web.Abstractions.dll -r:./../../class/lib/net_4_x/System.Web.Routing.dll -r:./../../class/lib/net_4_x/System.Web.Extensions.dll -r:./../../class/lib/net_4_x/System.ComponentModel.DataAnnotations.dll -r:./../../class/lib/net_4_x/System.Data.Linq.dll -r:./../../class/lib/net_4_x/System.Runtime.Caching.dll -r:./../../class/lib/net_4_x/System.Web.Razor.dll -r:./../../class/lib/net_4_x/System.Web.WebPages.Razor.dll -r:./../../class/lib/net_4_x/System.Web.WebPages.dll</flags>
       <output>System.Web.Mvc.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.Web.Mvc.dll</library_output>
     </project>
     <project dir="class/System.Net.Http.Formatting" library="System.Net.Http.Formatting-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -d:ASPNETMVC -keyfile:../winfx.pub -delaysign -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Net.Http.dll -r:./../../class/lib/net_4_x/System.Xml.dll -r:./../../class/lib/net_4_x/System.Runtime.Serialization.dll -r:./../../class/lib/net_4_x/System.Xml.Linq.dll -r:./../../class/lib/net_4_x/System.Data.dll -r:./../../class/lib/net_4_x/System.Configuration.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:ASPNETMVC -keyfile:../winfx.pub -delaysign -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Net.Http.dll -r:./../../class/lib/net_4_x/System.Xml.dll -r:./../../class/lib/net_4_x/System.Runtime.Serialization.dll -r:./../../class/lib/net_4_x/System.Xml.Linq.dll -r:./../../class/lib/net_4_x/System.Data.dll -r:./../../class/lib/net_4_x/System.Configuration.dll</flags>
       <output>System.Net.Http.Formatting.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.Net.Http.Formatting.dll</library_output>
     </project>
     <project dir="class/System.Web.Http" library="System.Web.Http-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -d:ASPNETMVC -keyfile:../winfx.pub -delaysign -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Xml.dll -r:./../../class/lib/net_4_x/System.Net.Http.dll -r:./../../class/lib/net_4_x/System.ComponentModel.DataAnnotations.dll -r:./../../class/lib/net_4_x/System.Net.Http.Formatting.dll -r:./../../class/lib/net_4_x/System.Runtime.Caching.dll -r:./../../class/lib/net_4_x/System.Runtime.Serialization.dll -r:./../../class/lib/net_4_x/System.Data.Linq.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:ASPNETMVC -keyfile:../winfx.pub -delaysign -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Xml.dll -r:./../../class/lib/net_4_x/System.Net.Http.dll -r:./../../class/lib/net_4_x/System.ComponentModel.DataAnnotations.dll -r:./../../class/lib/net_4_x/System.Net.Http.Formatting.dll -r:./../../class/lib/net_4_x/System.Runtime.Caching.dll -r:./../../class/lib/net_4_x/System.Runtime.Serialization.dll -r:./../../class/lib/net_4_x/System.Data.Linq.dll</flags>
       <output>System.Web.Http.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.Web.Http.dll</library_output>
     </project>
     <project dir="class/System.Web.Http.SelfHost" library="System.Web.Http.SelfHost-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -d:ASPNETMVC -keyfile:../winfx.pub -delaysign -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Xml.dll -r:./../../class/lib/net_4_x/System.Configuration.dll -r:./../../class/lib/net_4_x/System.Net.Http.dll -r:./../../class/lib/net_4_x/System.Runtime.Serialization.dll -r:./../../class/lib/net_4_x/System.ServiceModel.dll -r:./../../class/lib/net_4_x/System.IdentityModel.dll -r:./../../class/lib/net_4_x/System.Web.Http.dll -r:./../../class/lib/net_4_x/System.Net.Http.Formatting.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:ASPNETMVC -keyfile:../winfx.pub -delaysign -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Xml.dll -r:./../../class/lib/net_4_x/System.Configuration.dll -r:./../../class/lib/net_4_x/System.Net.Http.dll -r:./../../class/lib/net_4_x/System.Runtime.Serialization.dll -r:./../../class/lib/net_4_x/System.ServiceModel.dll -r:./../../class/lib/net_4_x/System.IdentityModel.dll -r:./../../class/lib/net_4_x/System.Web.Http.dll -r:./../../class/lib/net_4_x/System.Net.Http.Formatting.dll</flags>
       <output>System.Web.Http.SelfHost.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.Web.Http.SelfHost.dll</library_output>
     </project>
     <project dir="class/System.Web.Http.WebHost" library="System.Web.Http.WebHost-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -d:ASPNETMVC -keyfile:../winfx.pub -delaysign -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Xml.dll -r:./../../class/lib/net_4_x/System.Configuration.dll -r:./../../class/lib/net_4_x/System.Net.Http.dll -r:./../../class/lib/net_4_x/System.Runtime.Serialization.dll -r:./../../class/lib/net_4_x/System.ServiceModel.dll -r:./../../class/lib/net_4_x/System.IdentityModel.dll -r:./../../class/lib/net_4_x/System.Web.Http.dll -r:./../../class/lib/net_4_x/System.Net.Http.Formatting.dll -r:./../../class/lib/net_4_x/System.Web.Routing.dll -r:./../../class/lib/net_4_x/System.Web.dll -r:./../../class/lib/net_4_x/Microsoft.Web.Infrastructure.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:ASPNETMVC -keyfile:../winfx.pub -delaysign -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Xml.dll -r:./../../class/lib/net_4_x/System.Configuration.dll -r:./../../class/lib/net_4_x/System.Net.Http.dll -r:./../../class/lib/net_4_x/System.Runtime.Serialization.dll -r:./../../class/lib/net_4_x/System.ServiceModel.dll -r:./../../class/lib/net_4_x/System.IdentityModel.dll -r:./../../class/lib/net_4_x/System.Web.Http.dll -r:./../../class/lib/net_4_x/System.Net.Http.Formatting.dll -r:./../../class/lib/net_4_x/System.Web.Routing.dll -r:./../../class/lib/net_4_x/System.Web.dll -r:./../../class/lib/net_4_x/Microsoft.Web.Infrastructure.dll</flags>
       <output>System.Web.Http.WebHost.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.Web.Http.WebHost.dll</library_output>
     </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 -d:DISABLE_CAS_USE -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>
+      <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>
     </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 -d:DISABLE_CAS_USE -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>
+      <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>
       <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>
+      <output>System.Runtime.InteropServices.RuntimeInformation.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/net_4_x/System.Runtime.InteropServices.RuntimeInformation.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>net_4_x</profile>
+      <resources></resources>
+      <response>System.Runtime.InteropServices.RuntimeInformation.dll.sources</response>
+    </project>
     <project dir="class/Microsoft.Build.Framework" library="Microsoft.Build.Framework-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:./../../class/lib/net_4_x/System.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 -r:./../../class/lib/net_4_x/System.dll</flags>
       <output>Microsoft.Build.Framework.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/Microsoft.Build.Framework.dll</library_output>
     </project>
     <project dir="class/Microsoft.Build.Framework" library="Microsoft.Build.Framework-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/Microsoft.Build.Framework.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/Microsoft.Build.Framework.dll</flags>
       <output>net_4_x_Microsoft.Build.Framework_test.dll</output>
       <built_sources></built_sources>
       <library_output>net_4_x_Microsoft.Build.Framework_test.dll</library_output>
     </project>
     <project dir="class/Microsoft.Build.Utilities" library="Microsoft.Build.Utilities-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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/Microsoft.Build.Framework.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 -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/Microsoft.Build.Framework.dll</flags>
       <output>Microsoft.Build.Utilities.v4.0.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/Microsoft.Build.Utilities.v4.0.dll</library_output>
     </project>
     <project dir="class/Microsoft.Build.Utilities" library="Microsoft.Build.Utilities-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/Microsoft.Build.Utilities.v4.0.dll -resource:Test/Microsoft.Build.Utilities/Strings.resources</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/Microsoft.Build.Utilities.v4.0.dll -resource:Test/Microsoft.Build.Utilities/Strings.resources</flags>
       <output>net_4_x_Microsoft.Build.Utilities_test.dll</output>
       <built_sources></built_sources>
       <library_output>net_4_x_Microsoft.Build.Utilities_test.dll</library_output>
     </project>
     <project dir="class/Microsoft.Build.Engine" library="Microsoft.Build.Engine-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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/Microsoft.Build.Framework.dll -r:./../../class/lib/net_4_x/Microsoft.Build.Utilities.v4.0.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 -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/Microsoft.Build.Framework.dll -r:./../../class/lib/net_4_x/Microsoft.Build.Utilities.v4.0.dll</flags>
       <output>Microsoft.Build.Engine.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/Microsoft.Build.Engine.dll</library_output>
     </project>
     <project dir="class/Microsoft.Build.Engine" library="Microsoft.Build.Engine-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/Microsoft.Build.Engine.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/Microsoft.Build.Engine.dll</flags>
       <output>net_4_x_Microsoft.Build.Engine_test.dll</output>
       <built_sources></built_sources>
       <library_output>net_4_x_Microsoft.Build.Engine_test.dll</library_output>
     </project>
     <project dir="class/Mono.XBuild.Tasks" library="Mono.XBuild.Tasks-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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.Xml.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 -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Xml.dll</flags>
       <output>Mono.XBuild.Tasks.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/Mono.XBuild.Tasks.dll</library_output>
     </project>
     <project dir="class/Mono.XBuild.Tasks" library="Mono.XBuild.Tasks-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/Mono.XBuild.Tasks.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/Mono.XBuild.Tasks.dll</flags>
       <output>net_4_x_Mono.XBuild.Tasks_test.dll</output>
       <built_sources></built_sources>
       <library_output>net_4_x_Mono.XBuild.Tasks_test.dll</library_output>
     </project>
     <project dir="class/Microsoft.Build.Tasks" library="Microsoft.Build.Tasks-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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/System.Windows.Forms.dll -r:./../../class/lib/net_4_x/Microsoft.Build.Utilities.v4.0.dll -r:./../../class/lib/net_4_x/Microsoft.Build.Framework.dll -r:./../../class/lib/net_4_x/Microsoft.Build.Engine.dll -r:./../../class/lib/net_4_x/Mono.XBuild.Tasks.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 -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/System.Windows.Forms.dll -r:./../../class/lib/net_4_x/Microsoft.Build.Utilities.v4.0.dll -r:./../../class/lib/net_4_x/Microsoft.Build.Framework.dll -r:./../../class/lib/net_4_x/Microsoft.Build.Engine.dll -r:./../../class/lib/net_4_x/Mono.XBuild.Tasks.dll</flags>
       <output>Microsoft.Build.Tasks.v4.0.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/Microsoft.Build.Tasks.v4.0.dll</library_output>
     </project>
     <project dir="class/Microsoft.Build.Tasks" library="Microsoft.Build.Tasks-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/Microsoft.Build.Tasks.v4.0.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/Microsoft.Build.Tasks.v4.0.dll</flags>
       <output>net_4_x_Microsoft.Build.Tasks_test.dll</output>
       <built_sources></built_sources>
       <library_output>net_4_x_Microsoft.Build.Tasks_test.dll</library_output>
     </project>
     <project dir="class/Microsoft.Build" library="Microsoft.Build-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig /d:MICROSOFT_BUILD_DLL -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/Microsoft.Build.Engine.dll -r:./../../class/lib/net_4_x/Microsoft.Build.Framework.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:MICROSOFT_BUILD_DLL -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/Microsoft.Build.Engine.dll -r:./../../class/lib/net_4_x/Microsoft.Build.Framework.dll</flags>
       <output>Microsoft.Build.dll</output>
       <built_sources>Microsoft.Build.Internal/ExpressionParser.cs</built_sources>
       <library_output>./../../class/lib/net_4_x/Microsoft.Build.dll</library_output>
     </project>
     <project dir="class/Microsoft.Build" library="Microsoft.Build-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/Microsoft.Build.dll /d:MICROSOFT_BUILD_DLL -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/Microsoft.Build.Engine.dll -r:./../../class/lib/net_4_x/Microsoft.Build.Framework.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/Microsoft.Build.dll /d:MICROSOFT_BUILD_DLL -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/Microsoft.Build.Engine.dll -r:./../../class/lib/net_4_x/Microsoft.Build.Framework.dll</flags>
       <output>net_4_x_Microsoft.Build_test.dll</output>
       <built_sources>Microsoft.Build.Internal/ExpressionParser.cs</built_sources>
       <library_output>net_4_x_Microsoft.Build_test.dll</library_output>
     </project>
     <project dir="class/PEAPI" library="PEAPI-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -nowarn:414,618 -r:./../../class/lib/net_4_x/System.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,618 -r:./../../class/lib/net_4_x/System.dll</flags>
       <output>PEAPI.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/PEAPI.dll</library_output>
     </project>
     <project dir="class/I18N/Common" library="I18N-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 /unsafe /define:DISABLE_UNSAFE -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig</flags>
+      <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/net_4_x/mscorlib.dll -debug -optimize /noconfig</flags>
       <output>I18N.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/I18N.dll</library_output>
     </project>
     <project dir="class/I18N/West" library="I18N.West-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 /unsafe -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:./../../../class/lib/net_4_x/I18N.dll</flags>
+      <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:./../../../class/lib/net_4_x/I18N.dll</flags>
       <output>I18N.West.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/I18N.West.dll</library_output>
     </project>
     <project dir="class/I18N/West" library="I18N.West-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 /unsafe -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../../class/lib/net_4_x/I18N.West.dll</flags>
+      <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 -r:./../../../class/lib/net_4_x/I18N.West.dll</flags>
       <output>net_4_x_I18N.West_test.dll</output>
       <built_sources></built_sources>
       <library_output>net_4_x_I18N.West_test.dll</library_output>
     </project>
     <project dir="class/I18N/MidEast" library="I18N.MidEast-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 /unsafe -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:./../../../class/lib/net_4_x/I18N.dll</flags>
+      <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:./../../../class/lib/net_4_x/I18N.dll</flags>
       <output>I18N.MidEast.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/I18N.MidEast.dll</library_output>
     </project>
     <project dir="class/I18N/MidEast" library="I18N.MidEast-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 /unsafe -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../../class/lib/net_4_x/I18N.MidEast.dll</flags>
+      <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 -r:./../../../class/lib/net_4_x/I18N.MidEast.dll</flags>
       <output>net_4_x_I18N.MidEast_test.dll</output>
       <built_sources></built_sources>
       <library_output>net_4_x_I18N.MidEast_test.dll</library_output>
     </project>
     <project dir="class/I18N/Other" library="I18N.Other-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 /unsafe -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:./../../../class/lib/net_4_x/I18N.dll</flags>
+      <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:./../../../class/lib/net_4_x/I18N.dll</flags>
       <output>I18N.Other.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/I18N.Other.dll</library_output>
     </project>
     <project dir="class/I18N/Rare" library="I18N.Rare-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 /unsafe -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:./../../../class/lib/net_4_x/I18N.dll</flags>
+      <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:./../../../class/lib/net_4_x/I18N.dll</flags>
       <output>I18N.Rare.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/I18N.Rare.dll</library_output>
     </project>
     <project dir="class/I18N/CJK" library="I18N.CJK-net_4_x">
       <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 -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:./../../../class/lib/net_4_x/I18N.dll</flags>
+      <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/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:./../../../class/lib/net_4_x/I18N.dll</flags>
       <output>I18N.CJK.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/I18N.CJK.dll</library_output>
     </project>
     <project dir="class/I18N/CJK" library="I18N.CJK-tests-net_4_x">
       <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 -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../../class/lib/net_4_x/I18N.CJK.dll</flags>
+      <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/net_4_x/mscorlib.dll -debug -optimize -r:./../../../class/lib/net_4_x/I18N.CJK.dll</flags>
       <output>net_4_x_I18N.CJK_test.dll</output>
       <built_sources></built_sources>
       <library_output>net_4_x_I18N.CJK_test.dll</library_output>
     </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 -d:DISABLE_CAS_USE -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>
+      <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>
       <output>Mono.Http.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/Mono.Http.dll</library_output>
     </project>
     <project dir="class/Mono.Cairo" library="Mono.Cairo-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig</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</flags>
       <output>Mono.Cairo.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/Mono.Cairo.dll</library_output>
     </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 -d:DISABLE_CAS_USE -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>
     </project>
     <project dir="class/Mono.Cecil.Mdb" library="Mono.Cecil.Mdb-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig /d:CECIL -keyfile:../mono.snk -publicsign -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/Mono.Cecil.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:CECIL -keyfile:../mono.snk -publicsign -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/Mono.Cecil.dll</flags>
       <output>Mono.Cecil.Mdb.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/Mono.Cecil.Mdb.dll</library_output>
     </project>
     <project dir="class/Mono.Debugger.Soft" library="Mono.Debugger.Soft-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig /unsafe -D:MONO_DATACONVERTER_STATIC_METHODS -keyfile:../mono.snk /publicsign -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/Mono.Cecil.dll -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 /unsafe -D:MONO_DATACONVERTER_STATIC_METHODS -keyfile:../mono.snk /publicsign -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/Mono.Cecil.dll -r:./../../class/lib/net_4_x/System.Core.dll</flags>
       <output>Mono.Debugger.Soft.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/Mono.Debugger.Soft.dll</library_output>
     </project>
     <project dir="class/Mono.Debugger.Soft" library="Mono.Debugger.Soft-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/Mono.Debugger.Soft.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/Mono.Debugger.Soft.dll</flags>
       <output>net_4_x_Mono.Debugger.Soft_test.dll</output>
       <built_sources></built_sources>
       <library_output>net_4_x_Mono.Debugger.Soft_test.dll</library_output>
     </project>
     <project dir="class/Mono.C5" library="Mono.C5-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -nowarn:169,219,414,1030,3001,3005,3006 -r:./../../class/lib/net_4_x/System.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:169,219,414,1030,3001,3005,3006 -r:./../../class/lib/net_4_x/System.dll</flags>
       <output>Mono.C5.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/Mono.C5.dll</library_output>
     </project>
     <project dir="class/Mono.C5" library="Mono.C5-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/Mono.C5.dll -nowarn:169,219,414,1030,3001,3005,3006 -r:./../../class/lib/net_4_x/System.dll -nowarn:0618 -nowarn:219 -nowarn:169</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/Mono.C5.dll -nowarn:169,219,414,1030,3001,3005,3006 -r:./../../class/lib/net_4_x/System.dll -nowarn:0618 -nowarn:219 -nowarn:169</flags>
       <output>net_4_x_Mono.C5_test.dll</output>
       <built_sources></built_sources>
       <library_output>net_4_x_Mono.C5_test.dll</library_output>
     </project>
     <project dir="class/Mono.Management" library="Mono.Management-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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/Mono.Posix.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 -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/Mono.Posix.dll</flags>
       <output>Mono.Management.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/Mono.Management.dll</library_output>
     </project>
     <project dir="class/Mono.Options" library="Mono.Options-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:./../../class/lib/net_4_x/System.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 -r:./../../class/lib/net_4_x/System.dll</flags>
       <output>Mono.Options.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/Mono.Options.dll</library_output>
     </project>
     <project dir="class/Mono.Options" library="Mono.Options-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/Mono.Options.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/Mono.Options.dll</flags>
       <output>net_4_x_Mono.Options_test.dll</output>
       <built_sources></built_sources>
       <library_output>net_4_x_Mono.Options_test.dll</library_output>
     </project>
     <project dir="class/Mono.Simd" library="Mono.Simd-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig /unsafe -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 /unsafe -r:./../../class/lib/net_4_x/System.Core.dll</flags>
       <output>Mono.Simd.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/Mono.Simd.dll</library_output>
     </project>
     <project dir="class/Mono.Tasklets" library="Mono.Tasklets-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig</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</flags>
       <output>Mono.Tasklets.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/Mono.Tasklets.dll</library_output>
       <resources></resources>
       <response>Mono.Tasklets.dll.sources</response>
     </project>
+    <project dir="class/Mono.Tasklets" library="Mono.Tasklets-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/Mono.Tasklets.dll</flags>
+      <output>net_4_x_Mono.Tasklets_test.dll</output>
+      <built_sources></built_sources>
+      <library_output>net_4_x_Mono.Tasklets_test.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>net_4_x</profile>
+      <resources></resources>
+      <response>./../../build/deps/net_4_x_Mono.Tasklets_test.dll.response</response>
+    </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 -d:DISABLE_CAS_USE -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 -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>
     </project>
     <project dir="class/Mono.CodeContracts" library="Mono.CodeContracts-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/Mono.CodeContracts.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/Mono.CodeContracts.dll</flags>
       <output>net_4_x_Mono.CodeContracts_test.dll</output>
       <built_sources></built_sources>
       <library_output>net_4_x_Mono.CodeContracts_test.dll</library_output>
     </project>
     <project dir="class/Mono.Parallel" library="Mono.Parallel-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.dll -d:INSIDE_MONO_PARALLEL</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:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.dll -d:INSIDE_MONO_PARALLEL</flags>
       <output>Mono.Parallel.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/Mono.Parallel.dll</library_output>
     </project>
     <project dir="class/Mono.Parallel" library="Mono.Parallel-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/Mono.Parallel.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/Mono.Parallel.dll</flags>
       <output>net_4_x_Mono.Parallel_test.dll</output>
       <built_sources></built_sources>
       <library_output>net_4_x_Mono.Parallel_test.dll</library_output>
     </project>
     <project dir="class/Mono.Security.Win32" library="Mono.Security.Win32-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig /unsafe</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 /unsafe</flags>
       <output>Mono.Security.Win32.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/Mono.Security.Win32.dll</library_output>
     </project>
     <project dir="class/RabbitMQ.Client/src/apigen" library="RabbitMQ.Client.Apigen-net_4_x">
       <boot></boot>
-      <flags>/codepage:65001 /main:RabbitMQ.Client.Apigen.Apigen -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:System -r:System.Xml</flags>
+      <flags>/codepage:65001 /main:RabbitMQ.Client.Apigen.Apigen -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>
       <output>RabbitMQ.Client.Apigen.exe</output>
       <built_sources></built_sources>
       <library_output>./../../../../class/lib/net_4_x/RabbitMQ.Client.Apigen.exe</library_output>
     </project>
     <project dir="class/RabbitMQ.Client/src/client" library="RabbitMQ.Client-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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</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.Xml.dll</flags>
       <output>RabbitMQ.Client.dll</output>
       <built_sources>../../docs/specs/net_4_x-api-0-9.cs ../../docs/specs/net_4_x-api-0-8.cs ../../docs/specs/net_4_x-api-qpid-0-8.cs</built_sources>
       <library_output>./../../../../class/lib/net_4_x/RabbitMQ.Client.dll</library_output>
     </project>
     <project dir="class/Mono.Messaging.RabbitMQ" library="Mono.Messaging.RabbitMQ-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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.Messaging.dll -r:./../../class/lib/net_4_x/Mono.Messaging.dll -r:./../../class/lib/net_4_x/RabbitMQ.Client.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.Messaging.dll -r:./../../class/lib/net_4_x/Mono.Messaging.dll -r:./../../class/lib/net_4_x/RabbitMQ.Client.dll</flags>
       <output>Mono.Messaging.RabbitMQ.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/Mono.Messaging.RabbitMQ.dll</library_output>
     </project>
     <project dir="class/Mono.Messaging.RabbitMQ" library="Mono.Messaging.RabbitMQ-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/Mono.Messaging.RabbitMQ.dll -nowarn:618 -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Messaging.dll -r:./../../class/lib/net_4_x/Mono.Messaging.dll -r:./../../class/lib/net_4_x/RabbitMQ.Client.dll -nowarn:0618 -nowarn:219 -nowarn:169</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/Mono.Messaging.RabbitMQ.dll -nowarn:618 -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Messaging.dll -r:./../../class/lib/net_4_x/Mono.Messaging.dll -r:./../../class/lib/net_4_x/RabbitMQ.Client.dll -nowarn:0618 -nowarn:219 -nowarn:169</flags>
       <output>net_4_x_Mono.Messaging.RabbitMQ_test.dll</output>
       <built_sources></built_sources>
       <library_output>net_4_x_Mono.Messaging.RabbitMQ_test.dll</library_output>
     </project>
     <project dir="class/System.Dynamic" library="System.Dynamic-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -unsafe -d:CODEPLEX_40 -nowarn:414,169 -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.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 -unsafe -d:CODEPLEX_40 -nowarn:414,169 -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.dll</flags>
       <output>System.Dynamic.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.Dynamic.dll</library_output>
     </project>
     <project dir="class/System.Windows.Forms.DataVisualization" library="System.Windows.Forms.DataVisualization-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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.Drawing.dll -r:./../../class/lib/net_4_x/System.Windows.Forms.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Data.dll -r:./../../class/lib/net_4_x/System.Xml.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 -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Drawing.dll -r:./../../class/lib/net_4_x/System.Windows.Forms.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Data.dll -r:./../../class/lib/net_4_x/System.Xml.dll</flags>
       <output>System.Windows.Forms.DataVisualization.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.Windows.Forms.DataVisualization.dll</library_output>
     </project>
     <project dir="class/System.Windows.Forms.DataVisualization" library="System.Windows.Forms.DataVisualization-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/System.Windows.Forms.DataVisualization.dll -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Drawing.dll -r:./../../class/lib/net_4_x/System.Windows.Forms.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Data.dll -r:./../../class/lib/net_4_x/System.Xml.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.Windows.Forms.DataVisualization.dll -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Drawing.dll -r:./../../class/lib/net_4_x/System.Windows.Forms.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Data.dll -r:./../../class/lib/net_4_x/System.Xml.dll</flags>
       <output>net_4_x_System.Windows.Forms.DataVisualization_test.dll</output>
       <built_sources></built_sources>
       <library_output>net_4_x_System.Windows.Forms.DataVisualization_test.dll</library_output>
     </project>
     <project dir="class/System.Reactive.Interfaces" library="System.Reactive.Interfaces-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig @more_build_args -d:HAS_EDI -d:PREFERASYNC -d:PREFER_ASYNC -d:HAS_AWAIT -r:./../../class/lib/net_4_x/System.dll -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 @more_build_args -d:HAS_EDI -d:PREFERASYNC -d:PREFER_ASYNC -d:HAS_AWAIT -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Core.dll</flags>
       <output>System.Reactive.Interfaces.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.Reactive.Interfaces.dll</library_output>
     </project>
     <project dir="class/System.Reactive.Core" library="System.Reactive.Core-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig @more_build_args -d:HAS_EDI -d:PREFERASYNC -d:PREFER_ASYNC -d:HAS_AWAIT -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Reactive.Interfaces.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 @more_build_args -d:HAS_EDI -d:PREFERASYNC -d:PREFER_ASYNC -d:HAS_AWAIT -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Reactive.Interfaces.dll</flags>
       <output>System.Reactive.Core.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.Reactive.Core.dll</library_output>
     </project>
     <project dir="class/System.Reactive.Linq" library="System.Reactive.Linq-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig @more_build_args -d:HAS_EDI -d:PREFERASYNC -d:PREFER_ASYNC -d:HAS_AWAIT -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Reactive.Interfaces.dll -r:./../../class/lib/net_4_x/System.Reactive.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 @more_build_args -d:HAS_EDI -d:PREFERASYNC -d:PREFER_ASYNC -d:HAS_AWAIT -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Reactive.Interfaces.dll -r:./../../class/lib/net_4_x/System.Reactive.Core.dll</flags>
       <output>System.Reactive.Linq.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.Reactive.Linq.dll</library_output>
     </project>
     <project dir="class/System.Reactive.PlatformServices" library="System.Reactive.PlatformServices-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig @more_build_args -d:HAS_EDI -d:PREFERASYNC -d:PREFER_ASYNC -d:HAS_AWAIT -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Reactive.Interfaces.dll -r:./../../class/lib/net_4_x/System.Reactive.Core.dll -r:./../../class/lib/net_4_x/System.Reactive.Linq.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 @more_build_args -d:HAS_EDI -d:PREFERASYNC -d:PREFER_ASYNC -d:HAS_AWAIT -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Reactive.Interfaces.dll -r:./../../class/lib/net_4_x/System.Reactive.Core.dll -r:./../../class/lib/net_4_x/System.Reactive.Linq.dll</flags>
       <output>System.Reactive.PlatformServices.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.Reactive.PlatformServices.dll</library_output>
     </project>
     <project dir="class/System.Reactive.Providers" library="System.Reactive.Providers-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig @more_build_args -d:HAS_EDI -d:PREFERASYNC -d:PREFER_ASYNC -d:HAS_AWAIT -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Reactive.Interfaces.dll -r:./../../class/lib/net_4_x/System.Reactive.Core.dll -r:./../../class/lib/net_4_x/System.Reactive.Linq.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 @more_build_args -d:HAS_EDI -d:PREFERASYNC -d:PREFER_ASYNC -d:HAS_AWAIT -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Reactive.Interfaces.dll -r:./../../class/lib/net_4_x/System.Reactive.Core.dll -r:./../../class/lib/net_4_x/System.Reactive.Linq.dll</flags>
       <output>System.Reactive.Providers.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.Reactive.Providers.dll</library_output>
     </project>
     <project dir="class/System.Reactive.Runtime.Remoting" library="System.Reactive.Runtime.Remoting-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig @more_build_args -d:HAS_EDI -d:PREFERASYNC -d:PREFER_ASYNC -d:HAS_AWAIT -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Reactive.Interfaces.dll -r:./../../class/lib/net_4_x/System.Reactive.Core.dll -r:./../../class/lib/net_4_x/System.Reactive.Linq.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 @more_build_args -d:HAS_EDI -d:PREFERASYNC -d:PREFER_ASYNC -d:HAS_AWAIT -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Reactive.Interfaces.dll -r:./../../class/lib/net_4_x/System.Reactive.Core.dll -r:./../../class/lib/net_4_x/System.Reactive.Linq.dll</flags>
       <output>System.Reactive.Runtime.Remoting.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.Reactive.Runtime.Remoting.dll</library_output>
     </project>
     <project dir="class/System.Reactive.Windows.Forms" library="System.Reactive.Windows.Forms-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig @more_build_args -d:HAS_EDI -d:PREFERASYNC -d:PREFER_ASYNC -d:HAS_AWAIT -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Reactive.Interfaces.dll -r:./../../class/lib/net_4_x/System.Reactive.Core.dll -r:./../../class/lib/net_4_x/System.Reactive.Linq.dll -r:./../../class/lib/net_4_x/System.Windows.Forms.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 @more_build_args -d:HAS_EDI -d:PREFERASYNC -d:PREFER_ASYNC -d:HAS_AWAIT -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Reactive.Interfaces.dll -r:./../../class/lib/net_4_x/System.Reactive.Core.dll -r:./../../class/lib/net_4_x/System.Reactive.Linq.dll -r:./../../class/lib/net_4_x/System.Windows.Forms.dll</flags>
       <output>System.Reactive.Windows.Forms.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.Reactive.Windows.Forms.dll</library_output>
     </project>
     <project dir="class/System.Reactive.Windows.Threading" library="System.Reactive.Windows.Threading-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig @more_build_args -d:HAS_EDI -d:PREFERASYNC -d:PREFER_ASYNC -d:HAS_AWAIT -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Reactive.Interfaces.dll -r:./../../class/lib/net_4_x/System.Reactive.Core.dll -r:./../../class/lib/net_4_x/System.Reactive.Linq.dll -r:./../../class/lib/net_4_x/WindowsBase.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 @more_build_args -d:HAS_EDI -d:PREFERASYNC -d:PREFER_ASYNC -d:HAS_AWAIT -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Reactive.Interfaces.dll -r:./../../class/lib/net_4_x/System.Reactive.Core.dll -r:./../../class/lib/net_4_x/System.Reactive.Linq.dll -r:./../../class/lib/net_4_x/WindowsBase.dll</flags>
       <output>System.Reactive.Windows.Threading.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.Reactive.Windows.Threading.dll</library_output>
     </project>
     <project dir="class/System.Reactive.Observable.Aliases" library="System.Reactive.Observable.Aliases-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig @more_build_args -d:HAS_EDI -d:PREFERASYNC -d:PREFER_ASYNC -d:HAS_AWAIT -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Reactive.Interfaces.dll -r:./../../class/lib/net_4_x/System.Reactive.Core.dll -r:./../../class/lib/net_4_x/System.Reactive.Linq.dll -r:./../../class/lib/net_4_x/System.Reactive.Providers.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 @more_build_args -d:HAS_EDI -d:PREFERASYNC -d:PREFER_ASYNC -d:HAS_AWAIT -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Reactive.Interfaces.dll -r:./../../class/lib/net_4_x/System.Reactive.Core.dll -r:./../../class/lib/net_4_x/System.Reactive.Linq.dll -r:./../../class/lib/net_4_x/System.Reactive.Providers.dll</flags>
       <output>System.Reactive.Observable.Aliases.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.Reactive.Observable.Aliases.dll</library_output>
     </project>
     <project dir="class/System.Reactive.Experimental" library="System.Reactive.Experimental-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig @more_build_args -d:HAS_EDI -d:PREFERASYNC -d:PREFER_ASYNC -d:HAS_AWAIT -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Reactive.Interfaces.dll -r:./../../class/lib/net_4_x/System.Reactive.Core.dll -r:./../../class/lib/net_4_x/System.Reactive.Linq.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 @more_build_args -d:HAS_EDI -d:PREFERASYNC -d:PREFER_ASYNC -d:HAS_AWAIT -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Reactive.Interfaces.dll -r:./../../class/lib/net_4_x/System.Reactive.Core.dll -r:./../../class/lib/net_4_x/System.Reactive.Linq.dll</flags>
       <output>System.Reactive.Experimental.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.Reactive.Experimental.dll</library_output>
     </project>
     <project dir="class/System.Reactive.Debugger" library="System.Reactive.Debugger-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig @more_build_args -d:HAS_EDI -d:PREFERASYNC -d:PREFER_ASYNC -d:HAS_AWAIT -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Reactive.Interfaces.dll -r:./../../class/lib/net_4_x/System.Reactive.Core.dll -r:./../../class/lib/net_4_x/System.Reactive.Linq.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 @more_build_args -d:HAS_EDI -d:PREFERASYNC -d:PREFER_ASYNC -d:HAS_AWAIT -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Reactive.Interfaces.dll -r:./../../class/lib/net_4_x/System.Reactive.Core.dll -r:./../../class/lib/net_4_x/System.Reactive.Linq.dll</flags>
       <output>System.Reactive.Debugger.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.Reactive.Debugger.dll</library_output>
     </project>
     <project dir="class/System.Data.Services.Client" library="System.Data.Services.Client-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -d:NET_3_5 -warn:2 -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.Linq.dll -r:./../../class/lib/net_4_x/System.Data.dll -r:./../../class/lib/net_4_x/System.Xml.dll -r:./../../class/lib/net_4_x/WindowsBase.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_5 -warn:2 -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.Linq.dll -r:./../../class/lib/net_4_x/System.Data.dll -r:./../../class/lib/net_4_x/System.Xml.dll -r:./../../class/lib/net_4_x/WindowsBase.dll</flags>
       <output>System.Data.Services.Client.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.Data.Services.Client.dll</library_output>
     </project>
     <project dir="class/System.Data.Services" library="System.Data.Services-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -d:NET_3_5 -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.ServiceModel.dll -r:./../../class/lib/net_4_x/System.ServiceModel.Web.dll -r:./../../class/lib/net_4_x/System.Data.Services.Client.dll -r:./../../class/lib/net_4_x/System.ServiceModel.Activation.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_5 -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.ServiceModel.dll -r:./../../class/lib/net_4_x/System.ServiceModel.Web.dll -r:./../../class/lib/net_4_x/System.Data.Services.Client.dll -r:./../../class/lib/net_4_x/System.ServiceModel.Activation.dll</flags>
       <output>System.Data.Services.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.Data.Services.dll</library_output>
     </project>
     <project dir="class/System.Data.Services" library="System.Data.Services-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/System.Data.Services.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.Data.Services.dll</flags>
       <output>net_4_x_System.Data.Services_test.dll</output>
       <built_sources></built_sources>
       <library_output>net_4_x_System.Data.Services_test.dll</library_output>
     </project>
     <project dir="class/System.Data.Entity" library="System.Data.Entity-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -warn:2 -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Data.dll -r:./../../class/lib/net_4_x/System.Xml.dll -r:./../../class/lib/net_4_x/System.Xml.Linq.dll -r:./../../class/lib/net_4_x/System.Transactions.dll -r:./../../class/lib/net_4_x/System.Runtime.Serialization.dll -r:./../../class/lib/net_4_x/System.ComponentModel.DataAnnotations.dll -r:./../../class/lib/net_4_x/System.Configuration.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 -warn:2 -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Data.dll -r:./../../class/lib/net_4_x/System.Xml.dll -r:./../../class/lib/net_4_x/System.Xml.Linq.dll -r:./../../class/lib/net_4_x/System.Transactions.dll -r:./../../class/lib/net_4_x/System.Runtime.Serialization.dll -r:./../../class/lib/net_4_x/System.ComponentModel.DataAnnotations.dll -r:./../../class/lib/net_4_x/System.Configuration.dll</flags>
       <output>System.Data.Entity.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.Data.Entity.dll</library_output>
     </project>
     <project dir="class/System.Data.DataSetExtensions" library="System.Data.DataSetExtensions-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Data.dll -r:./../../class/lib/net_4_x/System.Xml.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 -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Data.dll -r:./../../class/lib/net_4_x/System.Xml.dll</flags>
       <output>System.Data.DataSetExtensions.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.Data.DataSetExtensions.dll</library_output>
     </project>
     <project dir="class/System.Data.DataSetExtensions" library="System.Data.DataSetExtensions-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/System.Data.DataSetExtensions.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Data.dll -r:./../../class/lib/net_4_x/System.Xml.dll -doc:net_4_x_System.Data.DataSetExtensions_test.xml -nowarn:219 -nowarn:169</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.DataSetExtensions.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Data.dll -r:./../../class/lib/net_4_x/System.Xml.dll -doc:net_4_x_System.Data.DataSetExtensions_test.xml -nowarn:219 -nowarn:169</flags>
       <output>net_4_x_System.Data.DataSetExtensions_test.dll</output>
       <built_sources></built_sources>
       <library_output>net_4_x_System.Data.DataSetExtensions_test.dll</library_output>
     </project>
     <project dir="class/System.Json.Microsoft" library="System.Json.Microsoft-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig /d:ASPNETMVC -keyfile:../winfx.pub -delaysign -d:FEATURE_DYNAMIC -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/Microsoft.CSharp.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:ASPNETMVC -keyfile:../winfx.pub -delaysign -d:FEATURE_DYNAMIC -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/Microsoft.CSharp.dll</flags>
       <output>System.Json.Microsoft.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.Json.Microsoft.dll</library_output>
     </project>
     <project dir="class/System.Json.Microsoft" library="System.Json.Microsoft-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/System.Json.Microsoft.dll /d:ASPNETMVC -keyfile:../winfx.pub -delaysign -d:FEATURE_DYNAMIC -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/Microsoft.CSharp.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.Json.Microsoft.dll /d:ASPNETMVC -keyfile:../winfx.pub -delaysign -d:FEATURE_DYNAMIC -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/Microsoft.CSharp.dll</flags>
       <output>net_4_x_System.Json.Microsoft_test.dll</output>
       <built_sources></built_sources>
       <library_output>net_4_x_System.Json.Microsoft_test.dll</library_output>
     </project>
     <project dir="class/System.Threading.Tasks.Dataflow" library="System.Threading.Tasks.Dataflow-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.dll -d:CONCURRENT_COLLECTIONS</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:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.dll -d:CONCURRENT_COLLECTIONS</flags>
       <output>System.Threading.Tasks.Dataflow.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.Threading.Tasks.Dataflow.dll</library_output>
     </project>
     <project dir="class/System.Threading.Tasks.Dataflow" library="System.Threading.Tasks.Dataflow-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/System.Threading.Tasks.Dataflow.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.Threading.Tasks.Dataflow.dll</flags>
       <output>net_4_x_System.Threading.Tasks.Dataflow_test.dll</output>
       <built_sources></built_sources>
       <library_output>net_4_x_System.Threading.Tasks.Dataflow_test.dll</library_output>
     </project>
     <project dir="class/System.ComponentModel.Composition.4.5" library="System.ComponentModel.Composition-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/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/net_4_x/System.dll -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 -d:CLR40 -d:USE_ECMA_KEY,FEATURE_REFLECTIONCONTEXT,FEATURE_REFLECTIONFILEIO,FEATURE_SERIALIZATION,FEATURE_SLIMLOCK -nowarn:219,414 -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Core.dll</flags>
       <output>System.ComponentModel.Composition.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.ComponentModel.Composition.dll</library_output>
     </project>
     <project dir="class/System.Windows" library="System.Windows-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -optimize /noconfig -r:./../../class/lib/net_4_x/System.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 -r:./../../class/lib/net_4_x/System.dll</flags>
       <output>System.Windows.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.Windows.dll</library_output>
     </project>
     <project dir="class/System.Xml.Serialization" library="System.Xml.Serialization-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -optimize /noconfig -r:./../../class/lib/net_4_x/System.Xml.dll -r:./../../class/lib/net_4_x/System.ServiceModel.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 -r:./../../class/lib/net_4_x/System.Xml.dll -r:./../../class/lib/net_4_x/System.ServiceModel.dll</flags>
       <output>System.Xml.Serialization.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.Xml.Serialization.dll</library_output>
     </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 -d:DISABLE_CAS_USE -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>
+      <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>
     </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 -d:DISABLE_CAS_USE -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>
+      <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>
     </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 -d:DISABLE_CAS_USE -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>
+      <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>
       <output>System.DirectoryServices.Protocols.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.DirectoryServices.Protocols.dll</library_output>
     </project>
     <project dir="class/Microsoft.VisualC" library="Microsoft.VisualC-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:./../../class/lib/net_4_x/System.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 -r:./../../class/lib/net_4_x/System.dll</flags>
       <output>Microsoft.VisualC.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/Microsoft.VisualC.dll</library_output>
     </project>
     <project dir="class/WebMatrix.Data" library="WebMatrix.Data-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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.Data.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Configuration.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 -r:./../../class/lib/net_4_x/System.dll -r:./../../class/lib/net_4_x/System.Data.dll -r:./../../class/lib/net_4_x/System.Core.dll -r:./../../class/lib/net_4_x/System.Configuration.dll</flags>
       <output>WebMatrix.Data.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/WebMatrix.Data.dll</library_output>
     </project>
     <project dir="class/WebMatrix.Data" library="WebMatrix.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 -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/WebMatrix.Data.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/WebMatrix.Data.dll</flags>
       <output>net_4_x_WebMatrix.Data_test.dll</output>
       <built_sources></built_sources>
       <library_output>net_4_x_WebMatrix.Data_test.dll</library_output>
     </project>
     <project dir="class/monodoc" library="monodoc-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 /nowarn:618,612,672,809 /define:LEGACY_MODE -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig /unsafe /nowarn:169,164,162,168,219,618,612 /resource:../../docs/monodoc.xml,monodoc.xml /resource:Resources/base.css,base.css /resource:Resources/ecmaspec-html-css.xsl,ecmaspec-html-css.xsl /resource:Resources/ecmaspec-html.xsl,ecmaspec-html.xsl /resource:Resources/ecmaspec.css,ecmaspec.css /resource:Resources/helper.js,helper.js /resource:Resources/home.html,home.html /resource:Resources/Lminus.gif,Lminus.gif /resource:Resources/Lplus.gif,Lplus.gif /resource:Resources/creativecommons.png,creativecommons.png /resource:Resources/mdoc-html-format.xsl,mdoc-html-format.xsl /resource:Resources/mdoc-html-utils.xsl,mdoc-html-utils.xsl /resource:Resources/mdoc-sections-css.xsl,mdoc-sections-css.xsl /resource:Resources/mdoc-sections.xsl,mdoc-sections.xsl /resource:Resources/mono-ecma-css.xsl,mono-ecma-css.xsl /resource:Resources/mono-ecma-impl.xsl,mono-ecma-impl.xsl /resource:Resources/mono-ecma.css,mono-ecma.css /resource:Resources/mono-ecma.xsl,mono-ecma.xsl /resource:Resources/toc-html.xsl,toc-html.xsl /resource:Resources/images/bc_bg.png,bc_bg.png /resource:Resources/images/bc_separator.png,bc_separator.png /resource:Resources/images/error.png,error.png /resource:Resources/images/hatch.png,hatch.png /resource:Resources/images/headerbg.png,headerbg.png /resource:Resources/images/help.png,help.png /resource:Resources/images/house.png,house.png /resource:Resources/images/members.png,members.png /resource:Resources/images/namespace.png,namespace.png /resource:Resources/images/privclass.png,privclass.png /resource:Resources/images/privdelegate.png,privdelegate.png /resource:Resources/images/privenumeration.png,privenumeration.png /resource:Resources/images/privevent.png,privevent.png /resource:Resources/images/privextension.png,privextension.png /resource:Resources/images/privfield.png,privfield.png /resource:Resources/images/privinterface.png,privinterface.png /resource:Resources/images/privmethod.png,privmethod.png /resource:Resources/images/privproperty.png,privproperty.png /resource:Resources/images/privstructure.png,privstructure.png /resource:Resources/images/protclass.png,protclass.png /resource:Resources/images/protdelegate.png,protdelegate.png /resource:Resources/images/protenumeration.png,protenumeration.png /resource:Resources/images/protevent.png,protevent.png /resource:Resources/images/protextension.png,protextension.png /resource:Resources/images/protfield.png,protfield.png /resource:Resources/images/protinterface.png,protinterface.png /resource:Resources/images/protmethod.png,protmethod.png /resource:Resources/images/protproperty.png,protproperty.png /resource:Resources/images/protstructure.png,protstructure.png /resource:Resources/images/pubclass.png,pubclass.png /resource:Resources/images/pubdelegate.png,pubdelegate.png /resource:Resources/images/pubenumeration.png,pubenumeration.png /resource:Resources/images/pubevent.png,pubevent.png /resource:Resources/images/pubextension.png,pubextension.png /resource:Resources/images/pubfield.png,pubfield.png /resource:Resources/images/pubinterface.png,pubinterface.png /resource:Resources/images/pubmethod.png,pubmethod.png /resource:Resources/images/pubproperty.png,pubproperty.png /resource:Resources/images/pubstructure.png,pubstructure.png /resource:Resources/images/reference.png,reference.png /resource:Resources/images/treebg.png,treebg.png /publicsign -r:./../../class/lib/net_4_x/ICSharpCode.SharpZipLib.dll -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/System.Xml.Linq.dll -r:./../../class/lib/net_4_x/System.Configuration.dll</flags>
+      <flags>/codepage:65001 /nowarn:618,612,672,809 /define:LEGACY_MODE -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:169,164,162,168,219,618,612 /resource:../../docs/monodoc.xml,monodoc.xml /resource:Resources/base.css,base.css /resource:Resources/ecmaspec-html-css.xsl,ecmaspec-html-css.xsl /resource:Resources/ecmaspec-html.xsl,ecmaspec-html.xsl /resource:Resources/ecmaspec.css,ecmaspec.css /resource:Resources/helper.js,helper.js /resource:Resources/home.html,home.html /resource:Resources/Lminus.gif,Lminus.gif /resource:Resources/Lplus.gif,Lplus.gif /resource:Resources/creativecommons.png,creativecommons.png /resource:Resources/mdoc-html-format.xsl,mdoc-html-format.xsl /resource:Resources/mdoc-html-utils.xsl,mdoc-html-utils.xsl /resource:Resources/mdoc-sections-css.xsl,mdoc-sections-css.xsl /resource:Resources/mdoc-sections.xsl,mdoc-sections.xsl /resource:Resources/mono-ecma-css.xsl,mono-ecma-css.xsl /resource:Resources/mono-ecma-impl.xsl,mono-ecma-impl.xsl /resource:Resources/mono-ecma.css,mono-ecma.css /resource:Resources/mono-ecma.xsl,mono-ecma.xsl /resource:Resources/toc-html.xsl,toc-html.xsl /resource:Resources/images/bc_bg.png,bc_bg.png /resource:Resources/images/bc_separator.png,bc_separator.png /resource:Resources/images/error.png,error.png /resource:Resources/images/hatch.png,hatch.png /resource:Resources/images/headerbg.png,headerbg.png /resource:Resources/images/help.png,help.png /resource:Resources/images/house.png,house.png /resource:Resources/images/members.png,members.png /resource:Resources/images/namespace.png,namespace.png /resource:Resources/images/privclass.png,privclass.png /resource:Resources/images/privdelegate.png,privdelegate.png /resource:Resources/images/privenumeration.png,privenumeration.png /resource:Resources/images/privevent.png,privevent.png /resource:Resources/images/privextension.png,privextension.png /resource:Resources/images/privfield.png,privfield.png /resource:Resources/images/privinterface.png,privinterface.png /resource:Resources/images/privmethod.png,privmethod.png /resource:Resources/images/privproperty.png,privproperty.png /resource:Resources/images/privstructure.png,privstructure.png /resource:Resources/images/protclass.png,protclass.png /resource:Resources/images/protdelegate.png,protdelegate.png /resource:Resources/images/protenumeration.png,protenumeration.png /resource:Resources/images/protevent.png,protevent.png /resource:Resources/images/protextension.png,protextension.png /resource:Resources/images/protfield.png,protfield.png /resource:Resources/images/protinterface.png,protinterface.png /resource:Resources/images/protmethod.png,protmethod.png /resource:Resources/images/protproperty.png,protproperty.png /resource:Resources/images/protstructure.png,protstructure.png /resource:Resources/images/pubclass.png,pubclass.png /resource:Resources/images/pubdelegate.png,pubdelegate.png /resource:Resources/images/pubenumeration.png,pubenumeration.png /resource:Resources/images/pubevent.png,pubevent.png /resource:Resources/images/pubextension.png,pubextension.png /resource:Resources/images/pubfield.png,pubfield.png /resource:Resources/images/pubinterface.png,pubinterface.png /resource:Resources/images/pubmethod.png,pubmethod.png /resource:Resources/images/pubproperty.png,pubproperty.png /resource:Resources/images/pubstructure.png,pubstructure.png /resource:Resources/images/reference.png,reference.png /resource:Resources/images/treebg.png,treebg.png /publicsign -r:./../../class/lib/net_4_x/ICSharpCode.SharpZipLib.dll -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/System.Xml.Linq.dll -r:./../../class/lib/net_4_x/System.Configuration.dll</flags>
       <output>monodoc.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/monodoc.dll</library_output>
     </project>
     <project dir="class/monodoc" library="monodoc-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 /nowarn:618,612,672,809 /define:LEGACY_MODE -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/monodoc.dll</flags>
+      <flags>/codepage:65001 /nowarn:618,612,672,809 /define:LEGACY_MODE -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/monodoc.dll</flags>
       <output>net_4_x_monodoc_test.dll</output>
       <built_sources></built_sources>
       <library_output>net_4_x_monodoc_test.dll</library_output>
     </project>
     <project dir="class/System.Deployment" library="System.Deployment-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -delaysign -keyfile:../msfinal.pub</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 -delaysign -keyfile:../msfinal.pub</flags>
       <output>System.Deployment.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.Deployment.dll</library_output>
     </project>
     <project dir="class/System.Web.Mobile" library="System.Web.Mobile-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -delaysign -keyfile:../msfinal.pub</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 -delaysign -keyfile:../msfinal.pub</flags>
       <output>System.Web.Mobile.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.Web.Mobile.dll</library_output>
     </project>
     <project dir="class/System.Web.RegularExpressions" library="System.Web.RegularExpressions-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -delaysign -keyfile:../msfinal.pub</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 -delaysign -keyfile:../msfinal.pub</flags>
       <output>System.Web.RegularExpressions.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.Web.RegularExpressions.dll</library_output>
     </project>
     <project dir="class/System.Workflow.Activities" library="System.Workflow.Activities-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -delaysign -keyfile:../winfx.pub</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 -delaysign -keyfile:../winfx.pub</flags>
       <output>System.Workflow.Activities.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.Workflow.Activities.dll</library_output>
     </project>
     <project dir="class/System.Workflow.ComponentModel" library="System.Workflow.ComponentModel-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -delaysign -keyfile:../winfx.pub</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 -delaysign -keyfile:../winfx.pub</flags>
       <output>System.Workflow.ComponentModel.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.Workflow.ComponentModel.dll</library_output>
     </project>
     <project dir="class/System.Workflow.Runtime" library="System.Workflow.Runtime-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -delaysign -keyfile:../winfx.pub</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 -delaysign -keyfile:../winfx.pub</flags>
       <output>System.Workflow.Runtime.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.Workflow.Runtime.dll</library_output>
       <resources></resources>
       <response>System.Workflow.Runtime.dll.sources</response>
     </project>
+    <project dir="class/System.Reflection.Context" library="System.Reflection.Context-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>
+      <output>System.Reflection.Context.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/net_4_x/System.Reflection.Context.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>net_4_x</profile>
+      <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">
+      <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>
+      <output>System.ServiceModel.Primitives.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/net_4_x/Facades/System.ServiceModel.Primitives.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>net_4_x</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-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.Runtime.Serialization.dll</flags>
+      <output>System.Runtime.Serialization.Primitives.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/net_4_x/Facades/System.Runtime.Serialization.Primitives.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>net_4_x</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-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.Runtime.Serialization.dll -r:./../../../class/lib/net_4_x/System.Xml.dll -r:./../../../class/lib/net_4_x/Facades/System.Runtime.Serialization.Primitives.dll</flags>
+      <output>System.Runtime.Serialization.Xml.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/net_4_x/Facades/System.Runtime.Serialization.Xml.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>net_4_x</profile>
+      <resources></resources>
+      <response>System.Runtime.Serialization.Xml.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.Drawing.Primitives" library="Facades_System.Drawing.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 -r:./../../../class/lib/net_4_x/System.Drawing.dll</flags>
+      <output>System.Drawing.Primitives.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/net_4_x/Facades/System.Drawing.Primitives.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>net_4_x</profile>
+      <resources></resources>
+      <response>System.Drawing.Primitives.dll.sources</response>
+    </project>
     <project dir="class/Facades/System.Collections.Concurrent" library="Facades_System.Collections.Concurrent-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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>
+      <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.Collections.Concurrent.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Collections.Concurrent.dll</library_output>
     </project>
     <project dir="class/Facades/System.Collections" library="Facades_System.Collections-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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>
+      <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.Collections.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Collections.dll</library_output>
     </project>
     <project dir="class/Facades/System.ComponentModel.Annotations" library="Facades_System.ComponentModel.Annotations-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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.ComponentModel.DataAnnotations.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.ComponentModel.DataAnnotations.dll</flags>
       <output>System.ComponentModel.Annotations.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.ComponentModel.Annotations.dll</library_output>
     </project>
     <project dir="class/Facades/System.ComponentModel.EventBasedAsync" library="Facades_System.ComponentModel.EventBasedAsync-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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>
+      <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.ComponentModel.EventBasedAsync.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.ComponentModel.EventBasedAsync.dll</library_output>
     </project>
     <project dir="class/Facades/System.ComponentModel" library="Facades_System.ComponentModel-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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>
+      <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.ComponentModel.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.ComponentModel.dll</library_output>
     </project>
     <project dir="class/Facades/System.Diagnostics.Contracts" library="Facades_System.Diagnostics.Contracts-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../../class/lib/net_4_x/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</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</flags>
       <output>System.Diagnostics.Contracts.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Diagnostics.Contracts.dll</library_output>
     </project>
     <project dir="class/Facades/System.Diagnostics.Debug" library="Facades_System.Diagnostics.Debug-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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>
+      <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.Debug.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Diagnostics.Debug.dll</library_output>
     </project>
     <project dir="class/Facades/System.Diagnostics.Tracing" library="Facades_System.Diagnostics.Tracing-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../../class/lib/net_4_x/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</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 /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</flags>
       <output>System.Diagnostics.Tracing.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Diagnostics.Tracing.dll</library_output>
     </project>
     <project dir="class/Facades/System.Diagnostics.Tools" library="Facades_System.Diagnostics.Tools-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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>
+      <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.Tools.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Diagnostics.Tools.dll</library_output>
     </project>
     <project dir="class/Facades/System.Dynamic.Runtime" library="Facades_System.Dynamic.Runtime-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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.Core.dll -r:./../../../class/lib/net_4_x/System.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.Core.dll -r:./../../../class/lib/net_4_x/System.dll</flags>
       <output>System.Dynamic.Runtime.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Dynamic.Runtime.dll</library_output>
     </project>
     <project dir="class/Facades/System.Globalization" library="Facades_System.Globalization-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../../class/lib/net_4_x/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</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</flags>
       <output>System.Globalization.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Globalization.dll</library_output>
     </project>
     <project dir="class/Facades/System.IO" library="Facades_System.IO-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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>
+      <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.IO.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.IO.dll</library_output>
     </project>
     <project dir="class/Facades/System.Linq.Expressions" library="Facades_System.Linq.Expressions-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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.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 -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/net_4_x/System.Core.dll</flags>
       <output>System.Linq.Expressions.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Linq.Expressions.dll</library_output>
     </project>
     <project dir="class/Facades/System.Linq.Parallel" library="Facades_System.Linq.Parallel-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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.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 -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/net_4_x/System.Core.dll</flags>
       <output>System.Linq.Parallel.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Linq.Parallel.dll</library_output>
     </project>
     <project dir="class/Facades/System.Linq.Queryable" library="Facades_System.Linq.Queryable-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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.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 -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/net_4_x/System.Core.dll</flags>
       <output>System.Linq.Queryable.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Linq.Queryable.dll</library_output>
     </project>
     <project dir="class/Facades/System.Linq" library="Facades_System.Linq-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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.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 -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/net_4_x/System.Core.dll</flags>
       <output>System.Linq.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Linq.dll</library_output>
     </project>
     <project dir="class/Facades/System.Net.NetworkInformation" library="Facades_System.Net.NetworkInformation-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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>
+      <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.Net.NetworkInformation.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Net.NetworkInformation.dll</library_output>
     </project>
     <project dir="class/Facades/System.Net.Primitives" library="Facades_System.Net.Primitives-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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>
+      <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.Net.Primitives.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Net.Primitives.dll</library_output>
     </project>
     <project dir="class/Facades/System.Net.Requests" library="Facades_System.Net.Requests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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>
+      <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.Net.Requests.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Net.Requests.dll</library_output>
     </project>
     <project dir="class/Facades/System.ObjectModel" library="Facades_System.ObjectModel-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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>
+      <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.ObjectModel.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.ObjectModel.dll</library_output>
     </project>
     <project dir="class/Facades/System.Reflection.Extensions" library="Facades_System.Reflection.Extensions-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../../class/lib/net_4_x/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</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</flags>
       <output>System.Reflection.Extensions.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Reflection.Extensions.dll</library_output>
     </project>
     <project dir="class/Facades/System.Reflection.Primitives" library="Facades_System.Reflection.Primitives-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../../class/lib/net_4_x/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</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</flags>
       <output>System.Reflection.Primitives.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Reflection.Primitives.dll</library_output>
     </project>
     <project dir="class/Facades/System.Reflection" library="Facades_System.Reflection-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../../class/lib/net_4_x/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</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</flags>
       <output>System.Reflection.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Reflection.dll</library_output>
     </project>
     <project dir="class/Facades/System.Resources.ResourceManager" library="Facades_System.Resources.ResourceManager-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../../class/lib/net_4_x/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</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</flags>
       <output>System.Resources.ResourceManager.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Resources.ResourceManager.dll</library_output>
     </project>
     <project dir="class/Facades/System.Runtime.Extensions" library="Facades_System.Runtime.Extensions-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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>
+      <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.Runtime.Extensions.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Runtime.Extensions.dll</library_output>
     </project>
     <project dir="class/Facades/System.Runtime.InteropServices" library="Facades_System.Runtime.InteropServices-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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>
+      <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.Runtime.InteropServices.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Runtime.InteropServices.dll</library_output>
     </project>
     <project dir="class/Facades/System.Runtime.InteropServices.WindowsRuntime" library="Facades_System.Runtime.InteropServices.WindowsRuntime-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../../class/lib/net_4_x/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</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</flags>
       <output>System.Runtime.InteropServices.WindowsRuntime.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Runtime.InteropServices.WindowsRuntime.dll</library_output>
     </project>
     <project dir="class/Facades/System.Runtime.Numerics" library="Facades_System.Runtime.Numerics-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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.Numerics.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.Numerics.dll</flags>
       <output>System.Runtime.Numerics.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Runtime.Numerics.dll</library_output>
     </project>
     <project dir="class/Facades/System.Runtime.Serialization.Json" library="Facades_System.Runtime.Serialization.Json-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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.Runtime.Serialization.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.Runtime.Serialization.dll</flags>
       <output>System.Runtime.Serialization.Json.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Runtime.Serialization.Json.dll</library_output>
       <resources></resources>
       <response>System.Runtime.Serialization.Json.dll.sources</response>
     </project>
-    <project dir="class/Facades/System.Runtime.Serialization.Primitives" library="Facades_System.Runtime.Serialization.Primitives-net_4_x">
-      <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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.Runtime.Serialization.dll</flags>
-      <output>System.Runtime.Serialization.Primitives.dll</output>
-      <built_sources></built_sources>
-      <library_output>./../../../class/lib/net_4_x/Facades/System.Runtime.Serialization.Primitives.dll</library_output>
-      <fx_version>4.5</fx_version>
-      <profile>net_4_x</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-net_4_x">
-      <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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.Runtime.Serialization.dll -r:./../../../class/lib/net_4_x/System.Xml.dll</flags>
-      <output>System.Runtime.Serialization.Xml.dll</output>
-      <built_sources></built_sources>
-      <library_output>./../../../class/lib/net_4_x/Facades/System.Runtime.Serialization.Xml.dll</library_output>
-      <fx_version>4.5</fx_version>
-      <profile>net_4_x</profile>
-      <resources></resources>
-      <response>System.Runtime.Serialization.Xml.dll.sources</response>
-    </project>
     <project dir="class/Facades/System.Runtime" library="Facades_System.Runtime-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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.ComponentModel.Composition.dll -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 -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/net_4_x/System.dll -r:./../../../class/lib/net_4_x/System.ComponentModel.Composition.dll -r:./../../../class/lib/net_4_x/System.Core.dll</flags>
       <output>System.Runtime.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Runtime.dll</library_output>
     </project>
     <project dir="class/Facades/System.Security.Principal" library="Facades_System.Security.Principal-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../../class/lib/net_4_x/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</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</flags>
       <output>System.Security.Principal.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Security.Principal.dll</library_output>
     </project>
     <project dir="class/Facades/System.ServiceModel.Http" library="Facades_System.ServiceModel.Http-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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.ServiceModel.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.ServiceModel.dll</flags>
       <output>System.ServiceModel.Http.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.ServiceModel.Http.dll</library_output>
       <resources></resources>
       <response>System.ServiceModel.Http.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 -d:DISABLE_CAS_USE -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.ServiceModel.dll -r:./../../../class/lib/net_4_x/System.Xml.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>
-      <fx_version>4.5</fx_version>
-      <profile>net_4_x</profile>
-      <resources></resources>
-      <response>System.ServiceModel.Primitives.dll.sources</response>
-    </project>
     <project dir="class/Facades/System.ServiceModel.Security" library="Facades_System.ServiceModel.Security-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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.ServiceModel.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.ServiceModel.dll</flags>
       <output>System.ServiceModel.Security.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.ServiceModel.Security.dll</library_output>
     </project>
     <project dir="class/Facades/System.Text.Encoding.Extensions" library="Facades_System.Text.Encoding.Extensions-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../../class/lib/net_4_x/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</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</flags>
       <output>System.Text.Encoding.Extensions.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Text.Encoding.Extensions.dll</library_output>
     </project>
     <project dir="class/Facades/System.Text.Encoding" library="Facades_System.Text.Encoding-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../../class/lib/net_4_x/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</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</flags>
       <output>System.Text.Encoding.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Text.Encoding.dll</library_output>
     </project>
     <project dir="class/Facades/System.Text.RegularExpressions" library="Facades_System.Text.RegularExpressions-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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>
+      <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.Text.RegularExpressions.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Text.RegularExpressions.dll</library_output>
     </project>
     <project dir="class/Facades/System.Threading.Tasks.Parallel" library="Facades_System.Threading.Tasks.Parallel-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../../class/lib/net_4_x/mscorlib.dll -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699</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</flags>
       <output>System.Threading.Tasks.Parallel.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Threading.Tasks.Parallel.dll</library_output>
     </project>
     <project dir="class/Facades/System.Threading.Tasks" library="Facades_System.Threading.Tasks-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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.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 -optimize /noconfig /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/net_4_x/System.Core.dll</flags>
       <output>System.Threading.Tasks.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Threading.Tasks.dll</library_output>
     </project>
     <project dir="class/Facades/System.Threading.Timer" library="Facades_System.Threading.Timer-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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>
+      <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.Threading.Timer.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Threading.Timer.dll</library_output>
     </project>
     <project dir="class/Facades/System.Threading" library="Facades_System.Threading-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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>
+      <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.Threading.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Threading.dll</library_output>
     </project>
     <project dir="class/Facades/System.Xml.ReaderWriter" library="Facades_System.Xml.ReaderWriter-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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.Xml.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.Xml.dll</flags>
       <output>System.Xml.ReaderWriter.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Xml.ReaderWriter.dll</library_output>
     </project>
     <project dir="class/Facades/System.Xml.XDocument" library="Facades_System.Xml.XDocument-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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.Xml.Linq.dll -r:./../../../class/lib/net_4_x/System.Xml.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.Xml.Linq.dll -r:./../../../class/lib/net_4_x/System.Xml.dll</flags>
       <output>System.Xml.XDocument.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Xml.XDocument.dll</library_output>
     </project>
     <project dir="class/Facades/System.Xml.XmlSerializer" library="Facades_System.Xml.XmlSerializer-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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.Xml.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.Xml.dll</flags>
       <output>System.Xml.XmlSerializer.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Xml.XmlSerializer.dll</library_output>
     </project>
     <project dir="class/Facades/System.Runtime.Handles" library="Facades_System.Runtime.Handles-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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>
+      <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.Runtime.Handles.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Runtime.Handles.dll</library_output>
     </project>
     <project dir="class/Facades/System.ServiceModel.Duplex" library="Facades_System.ServiceModel.Duplex-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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.ServiceModel.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.ServiceModel.dll</flags>
       <output>System.ServiceModel.Duplex.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.ServiceModel.Duplex.dll</library_output>
     </project>
     <project dir="class/Facades/System.ServiceModel.NetTcp" library="Facades_System.ServiceModel.NetTcp-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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.ServiceModel.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.ServiceModel.dll</flags>
       <output>System.ServiceModel.NetTcp.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.ServiceModel.NetTcp.dll</library_output>
     </project>
     <project dir="class/Facades/Microsoft.Win32.Primitives" library="Facades_Microsoft.Win32.Primitives-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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>
+      <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>Microsoft.Win32.Primitives.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/Microsoft.Win32.Primitives.dll</library_output>
     </project>
     <project dir="class/Facades/Microsoft.Win32.Registry" library="Facades_Microsoft.Win32.Registry-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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>
+      <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>Microsoft.Win32.Registry.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/Microsoft.Win32.Registry.dll</library_output>
     </project>
     <project dir="class/Facades/System.AppContext" library="Facades_System.AppContext-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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>
+      <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.AppContext.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.AppContext.dll</library_output>
     </project>
     <project dir="class/Facades/System.Collections.NonGeneric" library="Facades_System.Collections.NonGeneric-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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>
+      <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.Collections.NonGeneric.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Collections.NonGeneric.dll</library_output>
     </project>
     <project dir="class/Facades/System.Collections.Specialized" library="Facades_System.Collections.Specialized-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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>
+      <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.Collections.Specialized.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Collections.Specialized.dll</library_output>
     </project>
     <project dir="class/Facades/System.ComponentModel.Primitives" library="Facades_System.ComponentModel.Primitives-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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>
+      <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.ComponentModel.Primitives.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.ComponentModel.Primitives.dll</library_output>
     </project>
     <project dir="class/Facades/System.ComponentModel.TypeConverter" library="Facades_System.ComponentModel.TypeConverter-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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>
+      <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.ComponentModel.TypeConverter.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.ComponentModel.TypeConverter.dll</library_output>
     </project>
     <project dir="class/Facades/System.Console" library="Facades_System.Console-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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>
+      <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.Console.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Console.dll</library_output>
     </project>
     <project dir="class/Facades/System.Data.Common" library="Facades_System.Data.Common-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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.Data.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 /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/net_4_x/System.dll -r:./../../../class/lib/net_4_x/System.Data.dll -r:./../../../class/lib/net_4_x/System.Xml.dll</flags>
       <output>System.Data.Common.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Data.Common.dll</library_output>
     </project>
     <project dir="class/Facades/System.Data.SqlClient" library="Facades_System.Data.SqlClient-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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.Data.dll -r:./../../../class/lib/net_4_x/System.Xml.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.Data.dll -r:./../../../class/lib/net_4_x/System.Xml.dll</flags>
       <output>System.Data.SqlClient.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Data.SqlClient.dll</library_output>
     </project>
     <project dir="class/Facades/System.Diagnostics.FileVersionInfo" library="Facades_System.Diagnostics.FileVersionInfo-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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>
+      <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.FileVersionInfo.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Diagnostics.FileVersionInfo.dll</library_output>
     </project>
     <project dir="class/Facades/System.Diagnostics.Process" library="Facades_System.Diagnostics.Process-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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>
+      <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.Process.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Diagnostics.Process.dll</library_output>
     </project>
     <project dir="class/Facades/System.Diagnostics.TextWriterTraceListener" library="Facades_System.Diagnostics.TextWriterTraceListener-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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>
+      <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.TextWriterTraceListener.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Diagnostics.TextWriterTraceListener.dll</library_output>
     </project>
     <project dir="class/Facades/System.Diagnostics.TraceEvent" library="Facades_System.Diagnostics.TraceEvent-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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>
+      <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.TraceEvent.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Diagnostics.TraceEvent.dll</library_output>
     </project>
     <project dir="class/Facades/System.Diagnostics.TraceSource" library="Facades_System.Diagnostics.TraceSource-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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>
+      <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.TraceSource.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Diagnostics.TraceSource.dll</library_output>
     </project>
     <project dir="class/Facades/System.Globalization.Calendars" library="Facades_System.Globalization.Calendars-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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>
+      <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.Globalization.Calendars.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Globalization.Calendars.dll</library_output>
     </project>
     <project dir="class/Facades/System.IO.Compression.ZipFile" library="Facades_System.IO.Compression.ZipFile-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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.IO.Compression.FileSystem.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.IO.Compression.FileSystem.dll</flags>
       <output>System.IO.Compression.ZipFile.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.IO.Compression.ZipFile.dll</library_output>
     </project>
     <project dir="class/Facades/System.IO.FileSystem" library="Facades_System.IO.FileSystem-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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>
+      <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.IO.FileSystem.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.IO.FileSystem.dll</library_output>
     </project>
     <project dir="class/Facades/System.IO.FileSystem.DriveInfo" library="Facades_System.IO.FileSystem.DriveInfo-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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>
+      <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.IO.FileSystem.DriveInfo.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.IO.FileSystem.DriveInfo.dll</library_output>
     </project>
     <project dir="class/Facades/System.IO.FileSystem.Primitives" library="Facades_System.IO.FileSystem.Primitives-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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>
+      <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.IO.FileSystem.Primitives.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.IO.FileSystem.Primitives.dll</library_output>
     </project>
     <project dir="class/Facades/System.IO.IsolatedStorage" library="Facades_System.IO.IsolatedStorage-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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>
+      <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.IO.IsolatedStorage.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.IO.IsolatedStorage.dll</library_output>
     </project>
     <project dir="class/Facades/System.IO.MemoryMappedFiles" library="Facades_System.IO.MemoryMappedFiles-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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>
+      <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.IO.MemoryMappedFiles.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.IO.MemoryMappedFiles.dll</library_output>
     </project>
     <project dir="class/Facades/System.IO.UnmanagedMemoryStream" library="Facades_System.IO.UnmanagedMemoryStream-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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>
+      <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.IO.UnmanagedMemoryStream.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.IO.UnmanagedMemoryStream.dll</library_output>
     </project>
     <project dir="class/Facades/System.Net.AuthenticationManager" library="Facades_System.Net.AuthenticationManager-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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>
+      <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.Net.AuthenticationManager.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Net.AuthenticationManager.dll</library_output>
     </project>
     <project dir="class/Facades/System.Net.Cache" library="Facades_System.Net.Cache-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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>
+      <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.Net.Cache.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Net.Cache.dll</library_output>
     </project>
     <project dir="class/Facades/System.Net.HttpListener" library="Facades_System.Net.HttpListener-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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>
+      <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.Net.HttpListener.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Net.HttpListener.dll</library_output>
     </project>
     <project dir="class/Facades/System.Net.Mail" library="Facades_System.Net.Mail-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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>
+      <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.Net.Mail.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Net.Mail.dll</library_output>
     </project>
     <project dir="class/Facades/System.Net.NameResolution" library="Facades_System.Net.NameResolution-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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>
+      <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.Net.NameResolution.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Net.NameResolution.dll</library_output>
     </project>
     <project dir="class/Facades/System.Net.Security" library="Facades_System.Net.Security-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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>
+      <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.Net.Security.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Net.Security.dll</library_output>
     </project>
     <project dir="class/Facades/System.Net.ServicePoint" library="Facades_System.Net.ServicePoint-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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>
+      <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.Net.ServicePoint.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Net.ServicePoint.dll</library_output>
     </project>
     <project dir="class/Facades/System.Net.Sockets" library="Facades_System.Net.Sockets-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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>
+      <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.Net.Sockets.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Net.Sockets.dll</library_output>
     </project>
     <project dir="class/Facades/System.Net.Utilities" library="Facades_System.Net.Utilities-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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>
+      <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.Net.Utilities.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Net.Utilities.dll</library_output>
     </project>
     <project dir="class/Facades/System.Net.WebHeaderCollection" library="Facades_System.Net.WebHeaderCollection-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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>
+      <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.Net.WebHeaderCollection.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Net.WebHeaderCollection.dll</library_output>
     </project>
     <project dir="class/Facades/System.Net.WebSockets" library="Facades_System.Net.WebSockets-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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>
+      <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.Net.WebSockets.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Net.WebSockets.dll</library_output>
     </project>
     <project dir="class/Facades/System.Net.WebSockets.Client" library="Facades_System.Net.WebSockets.Client-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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>
+      <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.Net.WebSockets.Client.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Net.WebSockets.Client.dll</library_output>
     </project>
     <project dir="class/Facades/System.Resources.ReaderWriter" library="Facades_System.Resources.ReaderWriter-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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>
+      <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.Resources.ReaderWriter.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Resources.ReaderWriter.dll</library_output>
     </project>
     <project dir="class/Facades/System.Runtime.CompilerServices.VisualC" library="Facades_System.Runtime.CompilerServices.VisualC-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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>
+      <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.Runtime.CompilerServices.VisualC.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Runtime.CompilerServices.VisualC.dll</library_output>
     </project>
     <project dir="class/Facades/System.Security.AccessControl" library="Facades_System.Security.AccessControl-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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>
+      <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.Security.AccessControl.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Security.AccessControl.dll</library_output>
     </project>
     <project dir="class/Facades/System.Security.Claims" library="Facades_System.Security.Claims-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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>
+      <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.Security.Claims.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Security.Claims.dll</library_output>
     </project>
     <project dir="class/Facades/System.Security.Cryptography.DeriveBytes" library="Facades_System.Security.Cryptography.DeriveBytes-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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>
+      <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.Security.Cryptography.DeriveBytes.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Security.Cryptography.DeriveBytes.dll</library_output>
     </project>
     <project dir="class/Facades/System.Security.Cryptography.Encoding" library="Facades_System.Security.Cryptography.Encoding-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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>
+      <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.Security.Cryptography.Encoding.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Security.Cryptography.Encoding.dll</library_output>
     </project>
     <project dir="class/Facades/System.Security.Cryptography.Encryption" library="Facades_System.Security.Cryptography.Encryption-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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>
+      <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.Security.Cryptography.Encryption.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Security.Cryptography.Encryption.dll</library_output>
     </project>
     <project dir="class/Facades/System.Security.Cryptography.Encryption.Aes" library="Facades_System.Security.Cryptography.Encryption.Aes-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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>
+      <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.Security.Cryptography.Encryption.Aes.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Security.Cryptography.Encryption.Aes.dll</library_output>
     </project>
     <project dir="class/Facades/System.Security.Cryptography.Encryption.ECDiffieHellman" library="Facades_System.Security.Cryptography.Encryption.ECDiffieHellman-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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>
+      <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.Encryption.ECDiffieHellman.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Security.Cryptography.Encryption.ECDiffieHellman.dll</library_output>
     </project>
     <project dir="class/Facades/System.Security.Cryptography.Encryption.ECDsa" library="Facades_System.Security.Cryptography.Encryption.ECDsa-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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>
+      <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.Encryption.ECDsa.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Security.Cryptography.Encryption.ECDsa.dll</library_output>
     </project>
     <project dir="class/Facades/System.Security.Cryptography.Hashing" library="Facades_System.Security.Cryptography.Hashing-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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>
+      <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.Security.Cryptography.Hashing.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Security.Cryptography.Hashing.dll</library_output>
     </project>
     <project dir="class/Facades/System.Security.Cryptography.Hashing.Algorithms" library="Facades_System.Security.Cryptography.Hashing.Algorithms-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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>
+      <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.Security.Cryptography.Hashing.Algorithms.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Security.Cryptography.Hashing.Algorithms.dll</library_output>
     </project>
     <project dir="class/Facades/System.Security.Cryptography.RSA" library="Facades_System.Security.Cryptography.RSA-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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>
+      <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.Security.Cryptography.RSA.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Security.Cryptography.RSA.dll</library_output>
     </project>
     <project dir="class/Facades/System.Security.Cryptography.RandomNumberGenerator" library="Facades_System.Security.Cryptography.RandomNumberGenerator-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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>
+      <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.Security.Cryptography.RandomNumberGenerator.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Security.Cryptography.RandomNumberGenerator.dll</library_output>
       <resources></resources>
       <response>System.Security.Cryptography.RandomNumberGenerator.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 -d:DISABLE_CAS_USE -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.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.Security.Principal.Windows" library="Facades_System.Security.Principal.Windows-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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>
+      <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.Security.Principal.Windows.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Security.Principal.Windows.dll</library_output>
     </project>
     <project dir="class/Facades/System.Threading.Thread" library="Facades_System.Threading.Thread-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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>
+      <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.Threading.Thread.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Threading.Thread.dll</library_output>
     </project>
     <project dir="class/Facades/System.Threading.ThreadPool" library="Facades_System.Threading.ThreadPool-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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>
+      <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.Threading.ThreadPool.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Threading.ThreadPool.dll</library_output>
     </project>
     <project dir="class/Facades/System.Xml.XPath" library="Facades_System.Xml.XPath-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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.Xml.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.Xml.dll</flags>
       <output>System.Xml.XPath.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Xml.XPath.dll</library_output>
     </project>
     <project dir="class/Facades/System.Xml.XmlDocument" library="Facades_System.Xml.XmlDocument-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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.Xml.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.Xml.dll</flags>
       <output>System.Xml.XmlDocument.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Xml.XmlDocument.dll</library_output>
     </project>
     <project dir="class/Facades/System.Xml.Xsl.Primitives" library="Facades_System.Xml.Xsl.Primitives-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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.Xml.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.Xml.dll</flags>
       <output>System.Xml.Xsl.Primitives.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Xml.Xsl.Primitives.dll</library_output>
     </project>
     <project dir="class/Facades/Microsoft.Win32.Registry.AccessControl" library="Facades_Microsoft.Win32.Registry.AccessControl-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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>
+      <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>Microsoft.Win32.Registry.AccessControl.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/Microsoft.Win32.Registry.AccessControl.dll</library_output>
     </project>
     <project dir="class/Facades/System.Diagnostics.StackTrace" library="Facades_System.Diagnostics.StackTrace-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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>
+      <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.Diagnostics.StackTrace.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Diagnostics.StackTrace.dll</library_output>
     </project>
     <project dir="class/Facades/System.Globalization.Extensions" library="Facades_System.Globalization.Extensions-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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>
+      <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.Globalization.Extensions.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Globalization.Extensions.dll</library_output>
     </project>
     <project dir="class/Facades/System.IO.FileSystem.AccessControl" library="Facades_System.IO.FileSystem.AccessControl-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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>
+      <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.IO.FileSystem.AccessControl.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.IO.FileSystem.AccessControl.dll</library_output>
     </project>
     <project dir="class/Facades/System.Private.CoreLib.InteropServices" library="Facades_System.Private.CoreLib.InteropServices-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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>
+      <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>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Private.CoreLib.InteropServices.dll</library_output>
       <resources></resources>
       <response>System.Private.CoreLib.InteropServices.dll.sources</response>
     </project>
-    <project dir="class/Facades/System.Private.CoreLib.Threading" library="Facades_System.Private.CoreLib.Threading-net_4_x">
-      <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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.Threading.dll</output>
-      <built_sources></built_sources>
-      <library_output>./../../../class/lib/net_4_x/Facades/System.Private.CoreLib.Threading.dll</library_output>
-      <fx_version>4.5</fx_version>
-      <profile>net_4_x</profile>
-      <resources></resources>
-      <response>System.Private.CoreLib.Threading.dll.sources</response>
-    </project>
     <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 -d:DISABLE_CAS_USE -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>
+      <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.Reflection.TypeExtensions.dll</library_output>
     </project>
     <project dir="class/Facades/System.Security.SecureString" library="Facades_System.Security.SecureString-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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>
+      <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.Security.SecureString.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Security.SecureString.dll</library_output>
     </project>
     <project dir="class/Facades/System.Threading.AccessControl" library="Facades_System.Threading.AccessControl-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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>
+      <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.Threading.AccessControl.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Threading.AccessControl.dll</library_output>
     </project>
     <project dir="class/Facades/System.Threading.Overlapped" library="Facades_System.Threading.Overlapped-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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>
+      <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 -unsafe -r:./../../../class/lib/net_4_x/System.dll</flags>
       <output>System.Threading.Overlapped.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Threading.Overlapped.dll</library_output>
     </project>
     <project dir="class/Facades/System.Xml.XPath.XDocument" library="Facades_System.Xml.XPath.XDocument-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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.Xml.Linq.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 /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/net_4_x/System.dll -r:./../../../class/lib/net_4_x/System.Xml.dll -r:./../../../class/lib/net_4_x/System.Xml.Linq.dll</flags>
       <output>System.Xml.XPath.XDocument.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.Xml.XPath.XDocument.dll</library_output>
       <resources></resources>
       <response>System.Xml.XPath.XDocument.dll.sources</response>
     </project>
-    <project dir="class/Facades/System.Reflection.Emit.ILGeneration" library="Facades_System.Reflection.Emit.ILGeneration-net_4_x">
+    <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 -d:DISABLE_CAS_USE -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>
+      <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.Reflection.Emit.ILGeneration.dll</library_output>
+      <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.Reflection.Emit.ILGeneration.dll.sources</response>
+      <response>System.Security.Cryptography.Algorithms.dll.sources</response>
     </project>
-    <project dir="class/Facades/System.Reflection.Emit.Lightweight" library="Facades_System.Reflection.Emit.Lightweight-net_4_x">
+    <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 -d:DISABLE_CAS_USE -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>
+      <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.Security.Cryptography.Primitives.dll</output>
       <built_sources></built_sources>
-      <library_output>./../../../class/lib/net_4_x/Facades/System.Reflection.Emit.Lightweight.dll</library_output>
+      <library_output>./../../../class/lib/net_4_x/Facades/System.Security.Cryptography.Primitives.dll</library_output>
       <fx_version>4.5</fx_version>
       <profile>net_4_x</profile>
       <resources></resources>
-      <response>System.Reflection.Emit.Lightweight.dll.sources</response>
+      <response>System.Security.Cryptography.Primitives.dll.sources</response>
     </project>
-    <project dir="class/Facades/System.Reflection.Emit" library="Facades_System.Reflection.Emit-net_4_x">
+    <project dir="class/Facades/System.Text.Encoding.CodePages" library="Facades_System.Text.Encoding.CodePages-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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>
+      <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.Text.Encoding.CodePages.dll</output>
       <built_sources></built_sources>
-      <library_output>./../../../class/lib/net_4_x/Facades/System.Reflection.Emit.dll</library_output>
+      <library_output>./../../../class/lib/net_4_x/Facades/System.Text.Encoding.CodePages.dll</library_output>
       <fx_version>4.5</fx_version>
       <profile>net_4_x</profile>
       <resources></resources>
-      <response>System.Reflection.Emit.dll.sources</response>
+      <response>System.Text.Encoding.CodePages.dll.sources</response>
     </project>
-    <project dir="class/Facades/System.Diagnostics.PerformanceCounter" library="Facades_System.Diagnostics.PerformanceCounter-net_4_x">
+    <project dir="class/Facades/System.IO.FileSystem.Watcher" library="Facades_System.IO.FileSystem.Watcher-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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>
+      <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.IO.FileSystem.Watcher.dll</output>
       <built_sources></built_sources>
-      <library_output>./../../../class/lib/net_4_x/Facades/System.Diagnostics.PerformanceCounter.dll</library_output>
+      <library_output>./../../../class/lib/net_4_x/Facades/System.IO.FileSystem.Watcher.dll</library_output>
       <fx_version>4.5</fx_version>
       <profile>net_4_x</profile>
       <resources></resources>
-      <response>System.Diagnostics.PerformanceCounter.dll.sources</response>
+      <response>System.IO.FileSystem.Watcher.dll.sources</response>
     </project>
-    <project dir="class/Facades/System.IO.FileSystem.Watcher" library="Facades_System.IO.FileSystem.Watcher-net_4_x">
+    <project dir="class/Facades/System.Security.Cryptography.ProtectedData" library="Facades_System.Security.Cryptography.ProtectedData-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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.IO.FileSystem.Watcher.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 -r:./../../../class/lib/net_4_x/System.dll -r:./../../../class/lib/net_4_x/System.Security.dll</flags>
+      <output>System.Security.Cryptography.ProtectedData.dll</output>
       <built_sources></built_sources>
-      <library_output>./../../../class/lib/net_4_x/Facades/System.IO.FileSystem.Watcher.dll</library_output>
+      <library_output>./../../../class/lib/net_4_x/Facades/System.Security.Cryptography.ProtectedData.dll</library_output>
       <fx_version>4.5</fx_version>
       <profile>net_4_x</profile>
       <resources></resources>
-      <response>System.IO.FileSystem.Watcher.dll.sources</response>
+      <response>System.Security.Cryptography.ProtectedData.dll.sources</response>
+    </project>
+    <project dir="class/Facades/System.ServiceProcess.ServiceController" library="Facades_System.ServiceProcess.ServiceController-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.ServiceProcess.dll</flags>
+      <output>System.ServiceProcess.ServiceController.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../../class/lib/net_4_x/Facades/System.ServiceProcess.ServiceController.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>net_4_x</profile>
+      <resources></resources>
+      <response>System.ServiceProcess.ServiceController.dll.sources</response>
     </project>
     <project dir="class/Facades/System.IO.Pipes" library="Facades_System.IO.Pipes-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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>
+      <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.IO.Pipes.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Facades/System.IO.Pipes.dll</library_output>
       <resources></resources>
       <response>System.IO.Pipes.dll.sources</response>
     </project>
-    <project dir="class/Facades/System.Security.Cryptography.ProtectedData" library="Facades_System.Security.Cryptography.ProtectedData-net_4_x">
+    <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 -d:DISABLE_CAS_USE -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.Security.dll</flags>
-      <output>System.Security.Cryptography.ProtectedData.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.ILGeneration.dll</output>
       <built_sources></built_sources>
-      <library_output>./../../../class/lib/net_4_x/Facades/System.Security.Cryptography.ProtectedData.dll</library_output>
+      <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.Security.Cryptography.ProtectedData.dll.sources</response>
+      <response>System.Reflection.Emit.ILGeneration.dll.sources</response>
     </project>
-    <project dir="class/Facades/System.ServiceProcess.ServiceController" library="Facades_System.ServiceProcess.ServiceController-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 -d:DISABLE_CAS_USE -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.ServiceProcess.dll</flags>
-      <output>System.ServiceProcess.ServiceController.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.ServiceProcess.ServiceController.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.ServiceProcess.ServiceController.dll.sources</response>
+      <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 -d:DISABLE_CAS_USE -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>
+      <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>
     </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 -d:DISABLE_CAS_USE -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>
+      <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>
       <output>nunit.framework.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/nunit.framework.dll</library_output>
     </project>
     <project dir="nunit24/NUnitCore/interfaces" library="nunit.core.interfaces-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 /d:StronglyNamedAssembly /publicsign -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:./../../../class/lib/net_4_x/nunit.framework.dll -r:./../../../class/lib/net_4_x/System.dll</flags>
+      <flags>/codepage:65001 /d:StronglyNamedAssembly /publicsign -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/nunit.framework.dll -r:./../../../class/lib/net_4_x/System.dll</flags>
       <output>nunit.core.interfaces.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/nunit.core.interfaces.dll</library_output>
     </project>
     <project dir="nunit24/NUnitCore/core" library="nunit.core-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 /d:StronglyNamedAssembly -warn:1 /publicsign -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:./../../../class/lib/net_4_x/nunit.framework.dll -r:./../../../class/lib/net_4_x/nunit.core.interfaces.dll -r:./../../../class/lib/net_4_x/System.dll</flags>
+      <flags>/codepage:65001 /d:StronglyNamedAssembly -warn:1 /publicsign -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/nunit.framework.dll -r:./../../../class/lib/net_4_x/nunit.core.interfaces.dll -r:./../../../class/lib/net_4_x/System.dll</flags>
       <output>nunit.core.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/nunit.core.dll</library_output>
     </project>
     <project dir="nunit24/ClientUtilities/util" library="nunit.util-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 /resource:Transform.resources,NUnit.Util.Transform.resources /d:MONO /d:StronglyNamedAssembly /publicsign -warn:1 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:./../../../class/lib/net_4_x/nunit.core.dll -r:./../../../class/lib/net_4_x/nunit.core.interfaces.dll -r:./../../../class/lib/net_4_x/System.dll -r:./../../../class/lib/net_4_x/System.Xml.dll -r:./../../../class/lib/net_4_x/System.Runtime.Remoting.dll</flags>
+      <flags>/codepage:65001 /resource:Transform.resources,NUnit.Util.Transform.resources /d:MONO /d:StronglyNamedAssembly /publicsign -warn:1 -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/nunit.core.dll -r:./../../../class/lib/net_4_x/nunit.core.interfaces.dll -r:./../../../class/lib/net_4_x/System.dll -r:./../../../class/lib/net_4_x/System.Xml.dll -r:./../../../class/lib/net_4_x/System.Runtime.Remoting.dll</flags>
       <output>nunit.util.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/nunit.util.dll</library_output>
     </project>
     <project dir="nunit24/NUnitMocks/mocks" library="nunit.mocks-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 /d:StronglyNamedAssembly /publicsign -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:./../../../class/lib/net_4_x/nunit.framework.dll -r:./../../../class/lib/net_4_x/System.dll</flags>
+      <flags>/codepage:65001 /d:StronglyNamedAssembly /publicsign -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/nunit.framework.dll -r:./../../../class/lib/net_4_x/System.dll</flags>
       <output>nunit.mocks.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/nunit.mocks.dll</library_output>
     </project>
     <project dir="nunit24/NUnitExtensions/framework" library="nunit.framework.extensions-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig /d:StronglyNamedAssembly /publicsign -r:./../../../class/lib/net_4_x/System.Xml.dll -r:./../../../class/lib/net_4_x/System.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:StronglyNamedAssembly /publicsign -r:./../../../class/lib/net_4_x/System.Xml.dll -r:./../../../class/lib/net_4_x/System.dll</flags>
       <output>nunit.framework.extensions.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/nunit.framework.extensions.dll</library_output>
     </project>
     <project dir="nunit24/NUnitExtensions/core" library="nunit.core.extensions-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig /d:StronglyNamedAssembly /publicsign -r:./../../../class/lib/net_4_x/nunit.core.dll -r:./../../../class/lib/net_4_x/nunit.core.interfaces.dll -r:./../../../class/lib/net_4_x/System.Xml.dll -r:./../../../class/lib/net_4_x/System.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:StronglyNamedAssembly /publicsign -r:./../../../class/lib/net_4_x/nunit.core.dll -r:./../../../class/lib/net_4_x/nunit.core.interfaces.dll -r:./../../../class/lib/net_4_x/System.Xml.dll -r:./../../../class/lib/net_4_x/System.dll</flags>
       <output>nunit.core.extensions.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/nunit.core.extensions.dll</library_output>
     </project>
     <project dir="nunit24/ConsoleRunner/nunit-console" library="nunit-console-runner-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 /d:MONO /d:StronglyNamedAssembly /publicsign -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:./../../../class/lib/net_4_x/nunit.core.dll -r:./../../../class/lib/net_4_x/nunit.core.interfaces.dll -r:./../../../class/lib/net_4_x/nunit.util.dll -r:./../../../class/lib/net_4_x/System.dll -r:./../../../class/lib/net_4_x/System.Xml.dll</flags>
+      <flags>/codepage:65001 /d:MONO /d:StronglyNamedAssembly /publicsign -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/nunit.core.dll -r:./../../../class/lib/net_4_x/nunit.core.interfaces.dll -r:./../../../class/lib/net_4_x/nunit.util.dll -r:./../../../class/lib/net_4_x/System.dll -r:./../../../class/lib/net_4_x/System.Xml.dll</flags>
       <output>nunit-console-runner.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/nunit-console-runner.dll</library_output>
     </project>
     <project dir="nunit24/ConsoleRunner/nunit-console-exe" library="nunit-console-net_4_x">
       <boot></boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:nunit.framework -r:nunit.util -r:nunit.core -r:nunit-console-runner</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:nunit.framework -r:nunit.util -r:nunit.core -r:nunit-console-runner</flags>
       <output>nunit-console.exe</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/nunit-console.exe</library_output>
     </project>
     <project dir="ilasm" library="ilasm-net_4_x">
       <boot></boot>
-      <flags>/codepage:65001 /lib:../class/lib/net_4_x /r:../class/lib/net_4_x/PEAPI.dll /r:Mono.CompilerServices.SymbolWriter.dll /r:Mono.Security.dll -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig</flags>
+      <flags>/codepage:65001 /lib:../class/lib/net_4_x /r:../class/lib/net_4_x/PEAPI.dll /r:Mono.CompilerServices.SymbolWriter.dll /r:Mono.Security.dll -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</flags>
       <output>ilasm.exe</output>
       <built_sources>ILParser.cs</built_sources>
       <library_output>./../class/lib/net_4_x/ilasm.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 -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:Mono.Security</flags>
+      <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>
       <output>gacutil.exe</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/gacutil.exe</library_output>
     </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 -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:System -r:System.Xml</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 -r:System.Xml</flags>
       <output>culevel.exe</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/culevel.exe</library_output>
     </project>
     <project dir="tools/cil-stringreplacer" library="cil-stringreplacer-net_4_x">
       <boot></boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:System -r:Mono.Cecil</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 -r:Mono.Cecil</flags>
       <output>cil-stringreplacer.exe</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/cil-stringreplacer.exe</library_output>
     </project>
     <project dir="tools/commoncryptogenerator" library="commoncryptogenerator-net_4_x">
       <boot></boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig</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</flags>
       <output>commoncryptogenerator.exe</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/commoncryptogenerator.exe</library_output>
     </project>
     <project dir="tools/al" library="al-net_4_x">
       <boot></boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:System -r:System.Core -r:Mono.Security -r:System.Security -r:Mono.CompilerServices.SymbolWriter</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 -r:System.Core -r:Mono.Security -r:System.Security -r:Mono.CompilerServices.SymbolWriter</flags>
       <output>al.exe</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/al.exe</library_output>
     </project>
     <project dir="tools/linker" library="monolinker-net_4_x">
       <boot></boot>
-      <flags>/codepage:65001 -resource:Descriptors/mscorlib.xml -resource:Descriptors/System.xml -resource:Descriptors/System.Core.xml -resource:Descriptors/System.Drawing.xml -resource:Descriptors/System.Web.xml -resource:Descriptors/Mono.Posix.xml -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:System -r:System.Core -r:System.Xml -r:Mono.Cecil</flags>
+      <flags>/codepage:65001 -resource:Descriptors/mscorlib.xml -resource:Descriptors/System.xml -resource:Descriptors/System.Core.xml -resource:Descriptors/System.Drawing.xml -resource:Descriptors/System.Web.xml -resource:Descriptors/Mono.Posix.xml -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.Core -r:System.Xml -r:Mono.Cecil</flags>
       <output>monolinker.exe</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/monolinker.exe</library_output>
     </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 -d:DISABLE_CAS_USE -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>
+      <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>
     </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 -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:System -r:System.Xml</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 -r:System.Xml</flags>
       <output>culevel.exe</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/culevel.exe</library_output>
     </project>
     <project dir="tools/genxs" library="genxs-net_4_x">
       <boot></boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:System.Xml</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</flags>
       <output>genxs.exe</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/genxs.exe</library_output>
     </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 -d:DISABLE_CAS_USE -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</flags>
       <output>mkbundle.exe</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/mkbundle.exe</library_output>
     </project>
     <project dir="tools/monop" library="monop-net_4_x">
       <boot></boot>
-      <flags>/codepage:65001 -d:NO_AUTHENTICODE,STATIC,NO_SYMBOL_WRITER -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:System</flags>
+      <flags>/codepage:65001 -d:NO_AUTHENTICODE,STATIC,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</flags>
       <output>monop.exe</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/monop.exe</library_output>
     </project>
     <project dir="tools/mono-service" library="mono-service-net_4_x">
       <boot></boot>
-      <flags>/codepage:65001 -unsafe -publicsign -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:System.ServiceProcess -r:Mono.Posix -r:System</flags>
+      <flags>/codepage:65001 -unsafe -publicsign -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.ServiceProcess -r:Mono.Posix -r:System</flags>
       <output>mono-service.exe</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/mono-service.exe</library_output>
     </project>
     <project dir="tools/mono-xsd" library="xsd-net_4_x">
       <boot></boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:System.Xml -r:System.Data -r:System</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.Data -r:System</flags>
       <output>xsd.exe</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/xsd.exe</library_output>
     </project>
     <project dir="tools/resgen" library="resgen-net_4_x">
       <boot></boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:System -r:System.Xml -r:System.Core</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 -r:System.Xml -r:System.Core</flags>
       <output>resgen.exe</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/resgen.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 -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:Mono.Security</flags>
+      <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>
       <output>gacutil.exe</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/gacutil.exe</library_output>
     </project>
     <project dir="tools/wsdl" library="wsdl-net_4_x">
       <boot></boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:System.Xml -r:System.Web.Services -r:System</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.Web.Services -r:System</flags>
       <output>wsdl.exe</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/wsdl.exe</library_output>
     </project>
     <project dir="tools/xbuild" library="xbuild-net_4_x">
       <boot></boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:Microsoft.Build.Framework -r:Microsoft.Build.Utilities.v4.0 -r:Microsoft.Build.Engine -r:Microsoft.Build.Tasks.v4.0 -r:System -r:System.Core</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:Microsoft.Build.Framework -r:Microsoft.Build.Utilities.v4.0 -r:Microsoft.Build.Engine -r:Microsoft.Build.Tasks.v4.0 -r:System -r:System.Core</flags>
       <output>xbuild.exe</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/xbuild.exe</library_output>
     </project>
     <project dir="tools/csharp" library="csharp-net_4_x">
       <boot></boot>
-      <flags>/codepage:65001 -unsafe -nowarn:3021 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:Mono.CSharp -r:Mono.Posix -r:Mono.Management -r:System</flags>
+      <flags>/codepage:65001 -unsafe -nowarn:3021 -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.CSharp -r:Mono.Posix -r:Mono.Management -r:System</flags>
       <output>csharp.exe</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/csharp.exe</library_output>
     </project>
     <project dir="tools/corcompare" library="mono-api-info-net_4_x">
       <boot></boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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</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:Mono.Cecil -r:System.Xml -r:System.Core -r:System</flags>
       <output>mono-api-info.exe</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/mono-api-info.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 -d:DISABLE_CAS_USE -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:Mono.Cecil -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>
     </project>
     <project dir="tools/compiler-tester" library="compiler-tester-net_4_x">
       <boot></boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:System -r:System.Core -r:System.Xml</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 -r:System.Core -r:System.Xml</flags>
       <output>compiler-tester.exe</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/compiler-tester.exe</library_output>
     </project>
     <project dir="tools/mono-xmltool" library="mono-xmltool-net_4_x">
       <boot></boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:System.Xml -r:Commons.Xml.Relaxng</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:Commons.Xml.Relaxng</flags>
       <output>mono-xmltool.exe</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/mono-xmltool.exe</library_output>
     </project>
     <project dir="tools/mono-shlib-cop" library="mono-shlib-cop-net_4_x">
       <boot></boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:Mono.Posix -r:System -r:System.Xml</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:Mono.Posix -r:System -r:System.Xml</flags>
       <output>mono-shlib-cop.exe</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/mono-shlib-cop.exe</library_output>
     </project>
     <project dir="tools/sgen" library="sgen-net_4_x">
       <boot></boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:System.Xml -r:System</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</flags>
       <output>sgen.exe</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/sgen.exe</library_output>
     </project>
     <project dir="tools/mconfig" library="mconfig-net_4_x">
       <boot></boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:System.Xml -r:System</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</flags>
       <output>mconfig.exe</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/mconfig.exe</library_output>
     </project>
     <project dir="tools/installutil" library="installutil-net_4_x">
       <boot></boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:System.Configuration.Install -r:System</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.Configuration.Install -r:System</flags>
       <output>installutil.exe</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/installutil.exe</library_output>
     </project>
     <project dir="tools/nunitreport" library="nunitreport-net_4_x">
       <boot></boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:System.Xml</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</flags>
       <output>nunitreport.exe</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/nunitreport.exe</library_output>
     </project>
     <project dir="tools/pdb2mdb" library="pdb2mdb-net_4_x">
       <boot></boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:Mono.Cecil -r:Mono.CompilerServices.SymbolWriter -r:System.Core</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:Mono.Cecil -r:Mono.CompilerServices.SymbolWriter -r:System.Core</flags>
       <output>pdb2mdb.exe</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/pdb2mdb.exe</library_output>
     </project>
     <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 -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:System -r:System.Xml -r:System.Data</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 -r:System.Xml -r:System.Data</flags>
       <output>sqlsharp.exe</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/sqlsharp.exe</library_output>
     </project>
     <project dir="tools/sqlmetal" library="sqlmetal-net_4_x">
       <boot></boot>
-      <flags>/codepage:65001 -d:MONO_STRICT -keyfile:../../class/System.Data.Linq/src/DbMetal/../DbLinq.snk -resource:../../class/System.Data.Linq/src/DbMetal/Language/EnglishWords.txt,DbMetal.Language.EnglishWords.txt -resource:../../class/System.Data.Linq/src/DbMetal/Language/FrenchWords.txt,DbMetal.Language.FrenchWords.txt -resource:../../class/System.Data.Linq/src/DbMetal/Language/GermanWords.txt,DbMetal.Language.GermanWords.txt -publicsign -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:System.Configuration -r:System.Core -r:System.Data -r:System.Data.Linq -r:System.Xml -r:System</flags>
+      <flags>/codepage:65001 -d:MONO_STRICT -keyfile:../../class/System.Data.Linq/src/DbMetal/../DbLinq.snk -resource:../../class/System.Data.Linq/src/DbMetal/Language/EnglishWords.txt,DbMetal.Language.EnglishWords.txt -resource:../../class/System.Data.Linq/src/DbMetal/Language/FrenchWords.txt,DbMetal.Language.FrenchWords.txt -resource:../../class/System.Data.Linq/src/DbMetal/Language/GermanWords.txt,DbMetal.Language.GermanWords.txt -publicsign -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.Configuration -r:System.Core -r:System.Data -r:System.Data.Linq -r:System.Xml -r:System</flags>
       <output>sqlmetal.exe</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/sqlmetal.exe</library_output>
     </project>
     <project dir="tools/svcutil" library="svcutil-net_4_x">
       <boot></boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:System.Core -r:System.Runtime.Serialization -r:System.ServiceModel -r:System.Web.Services -r:System.Configuration -r:System -r:System.Xml</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.Core -r:System.Runtime.Serialization -r:System.ServiceModel -r:System.Web.Services -r:System.Configuration -r:System -r:System.Xml</flags>
       <output>svcutil.exe</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/svcutil.exe</library_output>
     </project>
     <project dir="tools/ictool" library="ictool-net_4_x">
       <boot></boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:System.Xml</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</flags>
       <output>ictool.exe</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/ictool.exe</library_output>
     </project>
     <project dir="tools/disco" library="disco-net_4_x">
       <boot></boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:System.Xml -r:System.Web.Services -r:System</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.Web.Services -r:System</flags>
       <output>disco.exe</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/disco.exe</library_output>
     </project>
     <project dir="tools/soapsuds" library="soapsuds-net_4_x">
       <boot></boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:System.Runtime.Remoting -r:System</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.Runtime.Remoting -r:System</flags>
       <output>soapsuds.exe</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/soapsuds.exe</library_output>
     </project>
     <project dir="tools/browsercaps-updater" library="browsercaps-updater-net_4_x">
       <boot></boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:System</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</flags>
       <output>browsercaps-updater.exe</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/browsercaps-updater.exe</library_output>
     </project>
     <project dir="tools/cil-strip" library="mono-cil-strip-net_4_x">
       <boot></boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:System</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</flags>
       <output>mono-cil-strip.exe</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/mono-cil-strip.exe</library_output>
     </project>
     <project dir="tools/macpack" library="macpack-net_4_x">
       <boot></boot>
-      <flags>/codepage:65001 /resource:LOADER /resource:PLIST -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig</flags>
+      <flags>/codepage:65001 /resource:LOADER /resource:PLIST -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</flags>
       <output>macpack.exe</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/macpack.exe</library_output>
     </project>
     <project dir="tools/dtd2rng" library="dtd2rng-net_4_x">
       <boot></boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:System.Xml -r:Commons.Xml.Relaxng</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:Commons.Xml.Relaxng</flags>
       <output>dtd2rng.exe</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/dtd2rng.exe</library_output>
     </project>
     <project dir="tools/dtd2xsd" library="dtd2xsd-net_4_x">
       <boot></boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:System.Xml</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</flags>
       <output>dtd2xsd.exe</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/dtd2xsd.exe</library_output>
     </project>
     <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 -d:DISABLE_CAS_USE -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>
+      <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>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/mdoc.exe</library_output>
     </project>
     <project dir="tools/mod" library="mod-net_4_x">
       <boot></boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:monodoc</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:monodoc</flags>
       <output>mod.exe</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/mod.exe</library_output>
     </project>
     <project dir="tools/installvst" library="installvst-net_4_x">
       <boot></boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:System.Xml</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</flags>
       <output>installvst.exe</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/installvst.exe</library_output>
     </project>
     <project dir="tools/lc" library="lc-net_4_x">
       <boot></boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:System -r:System.Core</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 -r:System.Core</flags>
       <output>lc.exe</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/lc.exe</library_output>
     </project>
     <project dir="tools/mono-configuration-crypto/lib" library="Mono.Configuration.Crypto-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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/Mono.Security.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/System.Xml.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 -r:./../../../class/lib/net_4_x/System.dll -r:./../../../class/lib/net_4_x/Mono.Security.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/System.Xml.dll</flags>
       <output>Mono.Configuration.Crypto.dll</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/Mono.Configuration.Crypto.dll</library_output>
     </project>
     <project dir="tools/mono-configuration-crypto/cli" library="mono-configuration-crypto-net_4_x">
       <boot></boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:Mono.Security -r:System.Security -r:System.Configuration -r:System -r:Mono.Configuration.Crypto</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:Mono.Security -r:System.Security -r:System.Configuration -r:System -r:Mono.Configuration.Crypto</flags>
       <output>mono-configuration-crypto.exe</output>
       <built_sources></built_sources>
       <library_output>./../../../class/lib/net_4_x/mono-configuration-crypto.exe</library_output>
     </project>
     <project dir="tools/ccrewrite" library="ccrewrite-net_4_x">
       <boot></boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:Mono.CodeContracts -r:System -r:System.Core</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:Mono.CodeContracts -r:System -r:System.Core</flags>
       <output>ccrewrite.exe</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/ccrewrite.exe</library_output>
     </project>
     <project dir="tools/cccheck" library="cccheck-net_4_x">
       <boot></boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:Mono.CodeContracts -r:System</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:Mono.CodeContracts -r:System</flags>
       <output>cccheck.exe</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/cccheck.exe</library_output>
     </project>
     <project dir="tools/mdbrebase" library="mdbrebase-net_4_x">
       <boot></boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:System -r:Mono.CompilerServices.SymbolWriter</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 -r:Mono.CompilerServices.SymbolWriter</flags>
       <output>mdbrebase.exe</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/mdbrebase.exe</library_output>
     </project>
     <project dir="tools/ikdasm" library="ikdasm-net_4_x">
       <boot></boot>
-      <flags>/codepage:65001 -d:NO_SYMBOL_WRITER -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:System -r:System.Core -r:System.Security</flags>
+      <flags>/codepage:65001 -d: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:System.Core -r:System.Security</flags>
       <output>ikdasm.exe</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/ikdasm.exe</library_output>
     </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 -d:DISABLE_CAS_USE -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: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>
       <output>mono-symbolicate.exe</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/mono-symbolicate.exe</library_output>
     </project>
     <project dir="tools/linker-analyzer" library="linkeranalyzer-net_4_x">
       <boot></boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -optimize /noconfig -r:System -r:System.Xml</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 -r:System.Xml</flags>
       <output>linkeranalyzer.exe</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/linkeranalyzer.exe</library_output>
     </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 -d:DISABLE_CAS_USE -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>
+      <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>
       <output>Microsoft.Build.Framework.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/xbuild_12/Microsoft.Build.Framework.dll</library_output>
     </project>
     <project dir="class/Microsoft.Build.Framework" library="Microsoft.Build.Framework-tests-xbuild_12">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -d:XBUILD_12 -optimize -r:./../../class/lib/xbuild_12/Microsoft.Build.Framework.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 -d:XBUILD_12 -optimize -r:./../../class/lib/xbuild_12/Microsoft.Build.Framework.dll</flags>
       <output>xbuild_12_Microsoft.Build.Framework_test.dll</output>
       <built_sources></built_sources>
       <library_output>xbuild_12_Microsoft.Build.Framework_test.dll</library_output>
     </project>
     <project dir="class/Microsoft.Build.Utilities" library="Microsoft.Build.Utilities-xbuild_12">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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 -r:./../../class/lib/xbuild_12/../net_4_x/System.Core.dll -r:./../../class/lib/xbuild_12/../net_4_x/System.Xml.dll -r:./../../class/lib/xbuild_12/Microsoft.Build.Framework.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 -d:XBUILD_12 -optimize /noconfig -r:./../../class/lib/xbuild_12/../net_4_x/System.dll -r:./../../class/lib/xbuild_12/../net_4_x/System.Core.dll -r:./../../class/lib/xbuild_12/../net_4_x/System.Xml.dll -r:./../../class/lib/xbuild_12/Microsoft.Build.Framework.dll</flags>
       <output>Microsoft.Build.Utilities.v12.0.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/xbuild_12/Microsoft.Build.Utilities.v12.0.dll</library_output>
     </project>
     <project dir="class/Microsoft.Build.Utilities" library="Microsoft.Build.Utilities-tests-xbuild_12">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -d:XBUILD_12 -optimize -r:./../../class/lib/xbuild_12/Microsoft.Build.Utilities.v12.0.dll -resource:Test/Microsoft.Build.Utilities/Strings.resources</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 -d:XBUILD_12 -optimize -r:./../../class/lib/xbuild_12/Microsoft.Build.Utilities.v12.0.dll -resource:Test/Microsoft.Build.Utilities/Strings.resources</flags>
       <output>xbuild_12_Microsoft.Build.Utilities_test.dll</output>
       <built_sources></built_sources>
       <library_output>xbuild_12_Microsoft.Build.Utilities_test.dll</library_output>
     </project>
     <project dir="class/Microsoft.Build.Engine" library="Microsoft.Build.Engine-xbuild_12">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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 -r:./../../class/lib/xbuild_12/../net_4_x/System.Core.dll -r:./../../class/lib/xbuild_12/../net_4_x/System.Xml.dll -r:./../../class/lib/xbuild_12/Microsoft.Build.Framework.dll -r:./../../class/lib/xbuild_12/Microsoft.Build.Utilities.v12.0.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 -d:XBUILD_12 -optimize /noconfig -r:./../../class/lib/xbuild_12/../net_4_x/System.dll -r:./../../class/lib/xbuild_12/../net_4_x/System.Core.dll -r:./../../class/lib/xbuild_12/../net_4_x/System.Xml.dll -r:./../../class/lib/xbuild_12/Microsoft.Build.Framework.dll -r:./../../class/lib/xbuild_12/Microsoft.Build.Utilities.v12.0.dll</flags>
       <output>Microsoft.Build.Engine.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/xbuild_12/Microsoft.Build.Engine.dll</library_output>
     </project>
     <project dir="class/Microsoft.Build.Engine" library="Microsoft.Build.Engine-tests-xbuild_12">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -d:XBUILD_12 -optimize -r:./../../class/lib/xbuild_12/Microsoft.Build.Engine.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 -d:XBUILD_12 -optimize -r:./../../class/lib/xbuild_12/Microsoft.Build.Engine.dll</flags>
       <output>xbuild_12_Microsoft.Build.Engine_test.dll</output>
       <built_sources></built_sources>
       <library_output>xbuild_12_Microsoft.Build.Engine_test.dll</library_output>
     </project>
     <project dir="class/Mono.XBuild.Tasks" library="Mono.XBuild.Tasks-xbuild_12">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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 -r:./../../class/lib/xbuild_12/../net_4_x/System.Xml.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 -d:XBUILD_12 -optimize /noconfig -r:./../../class/lib/xbuild_12/../net_4_x/System.dll -r:./../../class/lib/xbuild_12/../net_4_x/System.Xml.dll</flags>
       <output>Mono.XBuild.Tasks.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/xbuild_12/Mono.XBuild.Tasks.dll</library_output>
     </project>
     <project dir="class/Mono.XBuild.Tasks" library="Mono.XBuild.Tasks-tests-xbuild_12">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -d:XBUILD_12 -optimize -r:./../../class/lib/xbuild_12/Mono.XBuild.Tasks.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 -d:XBUILD_12 -optimize -r:./../../class/lib/xbuild_12/Mono.XBuild.Tasks.dll</flags>
       <output>xbuild_12_Mono.XBuild.Tasks_test.dll</output>
       <built_sources></built_sources>
       <library_output>xbuild_12_Mono.XBuild.Tasks_test.dll</library_output>
     </project>
     <project dir="class/Microsoft.Build.Tasks" library="Microsoft.Build.Tasks-xbuild_12">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -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 -r:./../../class/lib/xbuild_12/../net_4_x/System.Core.dll -r:./../../class/lib/xbuild_12/../net_4_x/System.Xml.dll -r:./../../class/lib/xbuild_12/../net_4_x/System.Windows.Forms.dll -r:./../../class/lib/xbuild_12/Microsoft.Build.Utilities.v12.0.dll -r:./../../class/lib/xbuild_12/Microsoft.Build.Framework.dll -r:./../../class/lib/xbuild_12/Microsoft.Build.Engine.dll -r:./../../class/lib/xbuild_12/Mono.XBuild.Tasks.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 -d:XBUILD_12 -optimize /noconfig -r:./../../class/lib/xbuild_12/../net_4_x/System.dll -r:./../../class/lib/xbuild_12/../net_4_x/System.Core.dll -r:./../../class/lib/xbuild_12/../net_4_x/System.Xml.dll -r:./../../class/lib/xbuild_12/../net_4_x/System.Windows.Forms.dll -r:./../../class/lib/xbuild_12/Microsoft.Build.Utilities.v12.0.dll -r:./../../class/lib/xbuild_12/Microsoft.Build.Framework.dll -r:./../../class/lib/xbuild_12/Microsoft.Build.Engine.dll -r:./../../class/lib/xbuild_12/Mono.XBuild.Tasks.dll</flags>
       <output>Microsoft.Build.Tasks.v12.0.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/xbuild_12/Microsoft.Build.Tasks.v12.0.dll</library_output>
     </project>
     <project dir="class/Microsoft.Build.Tasks" library="Microsoft.Build.Tasks-tests-xbuild_12">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -d:XBUILD_12 -optimize -r:./../../class/lib/xbuild_12/Microsoft.Build.Tasks.v12.0.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 -d:XBUILD_12 -optimize -r:./../../class/lib/xbuild_12/Microsoft.Build.Tasks.v12.0.dll</flags>
       <output>xbuild_12_Microsoft.Build.Tasks_test.dll</output>
       <built_sources></built_sources>
       <library_output>xbuild_12_Microsoft.Build.Tasks_test.dll</library_output>
     </project>
     <project dir="class/Microsoft.Build" library="Microsoft.Build-xbuild_12">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -d:XBUILD_12 -optimize /noconfig /d:MICROSOFT_BUILD_DLL -r:./../../class/lib/xbuild_12/../net_4_x/System.dll -r:./../../class/lib/xbuild_12/../net_4_x/System.Core.dll -r:./../../class/lib/xbuild_12/../net_4_x/System.Xml.dll -r:./../../class/lib/xbuild_12/Microsoft.Build.Engine.dll -r:./../../class/lib/xbuild_12/Microsoft.Build.Framework.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 -d:XBUILD_12 -optimize /noconfig /d:MICROSOFT_BUILD_DLL -r:./../../class/lib/xbuild_12/../net_4_x/System.dll -r:./../../class/lib/xbuild_12/../net_4_x/System.Core.dll -r:./../../class/lib/xbuild_12/../net_4_x/System.Xml.dll -r:./../../class/lib/xbuild_12/Microsoft.Build.Engine.dll -r:./../../class/lib/xbuild_12/Microsoft.Build.Framework.dll</flags>
       <output>Microsoft.Build.dll</output>
       <built_sources>Microsoft.Build.Internal/ExpressionParser.cs</built_sources>
       <library_output>./../../class/lib/xbuild_12/Microsoft.Build.dll</library_output>
     </project>
     <project dir="class/Microsoft.Build" library="Microsoft.Build-tests-xbuild_12">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -d:XBUILD_12 -optimize -r:./../../class/lib/xbuild_12/Microsoft.Build.dll /d:MICROSOFT_BUILD_DLL -r:./../../class/lib/xbuild_12/../net_4_x/System.dll -r:./../../class/lib/xbuild_12/../net_4_x/System.Core.dll -r:./../../class/lib/xbuild_12/../net_4_x/System.Xml.dll -r:./../../class/lib/xbuild_12/Microsoft.Build.Engine.dll -r:./../../class/lib/xbuild_12/Microsoft.Build.Framework.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 -d:XBUILD_12 -optimize -r:./../../class/lib/xbuild_12/Microsoft.Build.dll /d:MICROSOFT_BUILD_DLL -r:./../../class/lib/xbuild_12/../net_4_x/System.dll -r:./../../class/lib/xbuild_12/../net_4_x/System.Core.dll -r:./../../class/lib/xbuild_12/../net_4_x/System.Xml.dll -r:./../../class/lib/xbuild_12/Microsoft.Build.Engine.dll -r:./../../class/lib/xbuild_12/Microsoft.Build.Framework.dll</flags>
       <output>xbuild_12_Microsoft.Build_test.dll</output>
       <built_sources>Microsoft.Build.Internal/ExpressionParser.cs</built_sources>
       <library_output>xbuild_12_Microsoft.Build_test.dll</library_output>
     </project>
     <project dir="tools/xbuild" library="xbuild-xbuild_12">
       <boot></boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -d:XBUILD_12 -optimize /noconfig -r:Microsoft.Build.Framework -r:Microsoft.Build.Utilities.v12.0 -r:Microsoft.Build.Engine -r:Microsoft.Build.Tasks.v12.0 -r:../net_4_x/System -r:../net_4_x/System.Core</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 -d:XBUILD_12 -optimize /noconfig -r:Microsoft.Build.Framework -r:Microsoft.Build.Utilities.v12.0 -r:Microsoft.Build.Engine -r:Microsoft.Build.Tasks.v12.0 -r:../net_4_x/System -r:../net_4_x/System.Core</flags>
       <output>xbuild.exe</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/xbuild_12/xbuild.exe</library_output>
     </project>
     <project dir="class/Microsoft.Build.Framework" library="Microsoft.Build.Framework-xbuild_14">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -d:XBUILD_12 -d:XBUILD_14 -optimize /noconfig -r:./../../class/lib/xbuild_14/../net_4_x/System.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 -d:XBUILD_12 -d:XBUILD_14 -optimize /noconfig -r:./../../class/lib/xbuild_14/../net_4_x/System.dll</flags>
       <output>Microsoft.Build.Framework.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/xbuild_14/Microsoft.Build.Framework.dll</library_output>
     </project>
     <project dir="class/Microsoft.Build.Framework" library="Microsoft.Build.Framework-tests-xbuild_14">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -d:XBUILD_12 -d:XBUILD_14 -optimize -r:./../../class/lib/xbuild_14/Microsoft.Build.Framework.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 -d:XBUILD_12 -d:XBUILD_14 -optimize -r:./../../class/lib/xbuild_14/Microsoft.Build.Framework.dll</flags>
       <output>xbuild_14_Microsoft.Build.Framework_test.dll</output>
       <built_sources></built_sources>
       <library_output>xbuild_14_Microsoft.Build.Framework_test.dll</library_output>
     </project>
     <project dir="class/Microsoft.Build.Utilities" library="Microsoft.Build.Utilities-xbuild_14">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -d:XBUILD_12 -d:XBUILD_14 -optimize /noconfig -r:./../../class/lib/xbuild_14/../net_4_x/System.dll -r:./../../class/lib/xbuild_14/../net_4_x/System.Core.dll -r:./../../class/lib/xbuild_14/../net_4_x/System.Xml.dll -r:./../../class/lib/xbuild_14/Microsoft.Build.Framework.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 -d:XBUILD_12 -d:XBUILD_14 -optimize /noconfig -r:./../../class/lib/xbuild_14/../net_4_x/System.dll -r:./../../class/lib/xbuild_14/../net_4_x/System.Core.dll -r:./../../class/lib/xbuild_14/../net_4_x/System.Xml.dll -r:./../../class/lib/xbuild_14/Microsoft.Build.Framework.dll</flags>
       <output>Microsoft.Build.Utilities.Core.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/xbuild_14/Microsoft.Build.Utilities.Core.dll</library_output>
     </project>
     <project dir="class/Microsoft.Build.Utilities" library="Microsoft.Build.Utilities-tests-xbuild_14">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -d:XBUILD_12 -d:XBUILD_14 -optimize -r:./../../class/lib/xbuild_14/Microsoft.Build.Utilities.Core.dll -resource:Test/Microsoft.Build.Utilities/Strings.resources</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 -d:XBUILD_12 -d:XBUILD_14 -optimize -r:./../../class/lib/xbuild_14/Microsoft.Build.Utilities.Core.dll -resource:Test/Microsoft.Build.Utilities/Strings.resources</flags>
       <output>xbuild_14_Microsoft.Build.Utilities_test.dll</output>
       <built_sources></built_sources>
       <library_output>xbuild_14_Microsoft.Build.Utilities_test.dll</library_output>
     </project>
     <project dir="class/Microsoft.Build.Engine" library="Microsoft.Build.Engine-xbuild_14">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -d:XBUILD_12 -d:XBUILD_14 -optimize /noconfig -r:./../../class/lib/xbuild_14/../net_4_x/System.dll -r:./../../class/lib/xbuild_14/../net_4_x/System.Core.dll -r:./../../class/lib/xbuild_14/../net_4_x/System.Xml.dll -r:./../../class/lib/xbuild_14/Microsoft.Build.Framework.dll -r:./../../class/lib/xbuild_14/Microsoft.Build.Utilities.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 -d:XBUILD_12 -d:XBUILD_14 -optimize /noconfig -r:./../../class/lib/xbuild_14/../net_4_x/System.dll -r:./../../class/lib/xbuild_14/../net_4_x/System.Core.dll -r:./../../class/lib/xbuild_14/../net_4_x/System.Xml.dll -r:./../../class/lib/xbuild_14/Microsoft.Build.Framework.dll -r:./../../class/lib/xbuild_14/Microsoft.Build.Utilities.Core.dll</flags>
       <output>Microsoft.Build.Engine.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/xbuild_14/Microsoft.Build.Engine.dll</library_output>
     </project>
     <project dir="class/Microsoft.Build.Engine" library="Microsoft.Build.Engine-tests-xbuild_14">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -d:XBUILD_12 -d:XBUILD_14 -optimize -r:./../../class/lib/xbuild_14/Microsoft.Build.Engine.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 -d:XBUILD_12 -d:XBUILD_14 -optimize -r:./../../class/lib/xbuild_14/Microsoft.Build.Engine.dll</flags>
       <output>xbuild_14_Microsoft.Build.Engine_test.dll</output>
       <built_sources></built_sources>
       <library_output>xbuild_14_Microsoft.Build.Engine_test.dll</library_output>
     </project>
     <project dir="class/Mono.XBuild.Tasks" library="Mono.XBuild.Tasks-xbuild_14">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -d:XBUILD_12 -d:XBUILD_14 -optimize /noconfig -r:./../../class/lib/xbuild_14/../net_4_x/System.dll -r:./../../class/lib/xbuild_14/../net_4_x/System.Xml.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 -d:XBUILD_12 -d:XBUILD_14 -optimize /noconfig -r:./../../class/lib/xbuild_14/../net_4_x/System.dll -r:./../../class/lib/xbuild_14/../net_4_x/System.Xml.dll</flags>
       <output>Mono.XBuild.Tasks.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/xbuild_14/Mono.XBuild.Tasks.dll</library_output>
     </project>
     <project dir="class/Mono.XBuild.Tasks" library="Mono.XBuild.Tasks-tests-xbuild_14">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -d:XBUILD_12 -d:XBUILD_14 -optimize -r:./../../class/lib/xbuild_14/Mono.XBuild.Tasks.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 -d:XBUILD_12 -d:XBUILD_14 -optimize -r:./../../class/lib/xbuild_14/Mono.XBuild.Tasks.dll</flags>
       <output>xbuild_14_Mono.XBuild.Tasks_test.dll</output>
       <built_sources></built_sources>
       <library_output>xbuild_14_Mono.XBuild.Tasks_test.dll</library_output>
     </project>
     <project dir="class/Microsoft.Build.Tasks" library="Microsoft.Build.Tasks-xbuild_14">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -d:XBUILD_12 -d:XBUILD_14 -optimize /noconfig -r:./../../class/lib/xbuild_14/../net_4_x/System.dll -r:./../../class/lib/xbuild_14/../net_4_x/System.Core.dll -r:./../../class/lib/xbuild_14/../net_4_x/System.Xml.dll -r:./../../class/lib/xbuild_14/../net_4_x/System.Windows.Forms.dll -r:./../../class/lib/xbuild_14/Microsoft.Build.Utilities.Core.dll -r:./../../class/lib/xbuild_14/Microsoft.Build.Framework.dll -r:./../../class/lib/xbuild_14/Microsoft.Build.Engine.dll -r:./../../class/lib/xbuild_14/Mono.XBuild.Tasks.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 -d:XBUILD_12 -d:XBUILD_14 -optimize /noconfig -r:./../../class/lib/xbuild_14/../net_4_x/System.dll -r:./../../class/lib/xbuild_14/../net_4_x/System.Core.dll -r:./../../class/lib/xbuild_14/../net_4_x/System.Xml.dll -r:./../../class/lib/xbuild_14/../net_4_x/System.Windows.Forms.dll -r:./../../class/lib/xbuild_14/Microsoft.Build.Utilities.Core.dll -r:./../../class/lib/xbuild_14/Microsoft.Build.Framework.dll -r:./../../class/lib/xbuild_14/Microsoft.Build.Engine.dll -r:./../../class/lib/xbuild_14/Mono.XBuild.Tasks.dll</flags>
       <output>Microsoft.Build.Tasks.Core.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/xbuild_14/Microsoft.Build.Tasks.Core.dll</library_output>
     </project>
     <project dir="class/Microsoft.Build.Tasks" library="Microsoft.Build.Tasks-tests-xbuild_14">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -d:XBUILD_12 -d:XBUILD_14 -optimize -r:./../../class/lib/xbuild_14/Microsoft.Build.Tasks.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 -d:XBUILD_12 -d:XBUILD_14 -optimize -r:./../../class/lib/xbuild_14/Microsoft.Build.Tasks.Core.dll</flags>
       <output>xbuild_14_Microsoft.Build.Tasks_test.dll</output>
       <built_sources></built_sources>
       <library_output>xbuild_14_Microsoft.Build.Tasks_test.dll</library_output>
     </project>
     <project dir="class/Microsoft.Build" library="Microsoft.Build-xbuild_14">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -d:XBUILD_12 -d:XBUILD_14 -optimize /noconfig /d:MICROSOFT_BUILD_DLL -r:./../../class/lib/xbuild_14/../net_4_x/System.dll -r:./../../class/lib/xbuild_14/../net_4_x/System.Core.dll -r:./../../class/lib/xbuild_14/../net_4_x/System.Xml.dll -r:./../../class/lib/xbuild_14/Microsoft.Build.Engine.dll -r:./../../class/lib/xbuild_14/Microsoft.Build.Framework.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 -d:XBUILD_12 -d:XBUILD_14 -optimize /noconfig /d:MICROSOFT_BUILD_DLL -r:./../../class/lib/xbuild_14/../net_4_x/System.dll -r:./../../class/lib/xbuild_14/../net_4_x/System.Core.dll -r:./../../class/lib/xbuild_14/../net_4_x/System.Xml.dll -r:./../../class/lib/xbuild_14/Microsoft.Build.Engine.dll -r:./../../class/lib/xbuild_14/Microsoft.Build.Framework.dll</flags>
       <output>Microsoft.Build.dll</output>
       <built_sources>Microsoft.Build.Internal/ExpressionParser.cs</built_sources>
       <library_output>./../../class/lib/xbuild_14/Microsoft.Build.dll</library_output>
     </project>
     <project dir="class/Microsoft.Build" library="Microsoft.Build-tests-xbuild_14">
       <boot>false</boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -d:XBUILD_12 -d:XBUILD_14 -optimize -r:./../../class/lib/xbuild_14/Microsoft.Build.dll /d:MICROSOFT_BUILD_DLL -r:./../../class/lib/xbuild_14/../net_4_x/System.dll -r:./../../class/lib/xbuild_14/../net_4_x/System.Core.dll -r:./../../class/lib/xbuild_14/../net_4_x/System.Xml.dll -r:./../../class/lib/xbuild_14/Microsoft.Build.Engine.dll -r:./../../class/lib/xbuild_14/Microsoft.Build.Framework.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 -d:XBUILD_12 -d:XBUILD_14 -optimize -r:./../../class/lib/xbuild_14/Microsoft.Build.dll /d:MICROSOFT_BUILD_DLL -r:./../../class/lib/xbuild_14/../net_4_x/System.dll -r:./../../class/lib/xbuild_14/../net_4_x/System.Core.dll -r:./../../class/lib/xbuild_14/../net_4_x/System.Xml.dll -r:./../../class/lib/xbuild_14/Microsoft.Build.Engine.dll -r:./../../class/lib/xbuild_14/Microsoft.Build.Framework.dll</flags>
       <output>xbuild_14_Microsoft.Build_test.dll</output>
       <built_sources>Microsoft.Build.Internal/ExpressionParser.cs</built_sources>
       <library_output>xbuild_14_Microsoft.Build_test.dll</library_output>
       <resources></resources>
       <response>./../../build/deps/xbuild_14_Microsoft.Build_test.dll.response</response>
     </project>
+    <project dir="class/Microsoft.NuGet.Build.Tasks" library="Microsoft.NuGet.Build.Tasks-xbuild_14">
+      <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 -d:XBUILD_14 -optimize /noconfig -nowarn:3021 /delaysign /keyfile:./../../../external/nuget-buildtasks/build/PublicKey.snk -r:./../../class/lib/xbuild_14/../net_4_x/System.dll -r:./../../class/lib/xbuild_14/../net_4_x/System.Core.dll -r:./../../class/lib/xbuild_14/../net_4_x/System.Data.dll -r:./../../class/lib/xbuild_14/../net_4_x/System.Xml.dll -r:./../../class/lib/xbuild_14/../net_4_x/System.Xml.Linq.dll -r:./../../class/lib/xbuild_14/../net_4_x/System.Runtime.Serialization.dll -r:./../../class/lib/xbuild_14/Microsoft.Build.Utilities.Core.dll -r:./../../class/lib/xbuild_14/Microsoft.Build.Framework.dll</flags>
+      <output>Microsoft.NuGet.Build.Tasks.dll</output>
+      <built_sources></built_sources>
+      <library_output>./../../class/lib/xbuild_14/Microsoft.NuGet.Build.Tasks.dll</library_output>
+      <fx_version>4.5</fx_version>
+      <profile>xbuild_14</profile>
+      <resources>Microsoft.NuGet.Build.Tasks.Strings,./../../../external/nuget-buildtasks/src/Microsoft.NuGet.Build.Tasks/Strings.resx</resources>
+      <response>./../../build/deps/xbuild_14_Microsoft.NuGet.Build.Tasks.dll.sources</response>
+    </project>
     <project dir="tools/xbuild" library="xbuild-xbuild_14">
       <boot></boot>
-      <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll -debug -d:XBUILD_12 -d:XBUILD_14 -optimize /noconfig -r:Microsoft.Build.Framework -r:Microsoft.Build.Utilities.Core -r:Microsoft.Build.Engine -r:Microsoft.Build.Tasks.Core -r:../net_4_x/System -r:../net_4_x/System.Core</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 -d:XBUILD_12 -d:XBUILD_14 -optimize /noconfig -r:Microsoft.Build.Framework -r:Microsoft.Build.Utilities.Core -r:Microsoft.Build.Engine -r:Microsoft.Build.Tasks.Core -r:../net_4_x/System -r:../net_4_x/System.Core</flags>
       <output>xbuild.exe</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/xbuild_14/xbuild.exe</library_output>
index 223b73852dcbf3762ccd27934beb22ddf5e87687..068bb1d3dc0269bc87633813b76bae786ca0ac63 100644 (file)
@@ -109,10 +109,20 @@ cur_dir_cmd = pwd
 PLATFORM_PATH_SEPARATOR = :
 endif
 
+if INSTALL_MOBILE_STATIC
+#  ILASM.exe has features which a mobile_static runtime will not support.
+#  It is invoked with an external mono when used in the runtime.
+#  We skip it here because otherwise it will fail to verify.
+MOBILE_STATIC_FILTER=grep -v ilasm
+else
+MOBILE_STATIC_FILTER=echo
+endif
+
 # Compile all assemblies with the verifier turned on. Code must be valid but not verifiable.
 # TODO it would be nice to split assemblies without unsafe code to use the verifier with verifiable mode.
 # Skip binary_reference_assemblies because they contain metadata only
 mcs-compileall: mono-wrapper etc/mono/config
+       export verifiable_files=`ls "$(mcs_topdir)/class/lib/$$profile/" | grep -E '\.(dll|exe)$$' | $(MOBILE_STATIC_FILTER)` ; \
        save_MONO_PATH=$$MONO_PATH; mcs_topdir=`cd $(mcs_topdir) && $(cur_dir_cmd)`; ok=:; \
        for profile in $(test_profiles); do \
          if [ "binary_reference_assemblies" = "$$profile" ]; then \
@@ -126,7 +136,9 @@ mcs-compileall: mono-wrapper etc/mono/config
                  MONO_PATH="$$mcs_topdir/class/lib/$$profile$(PLATFORM_PATH_SEPARATOR)$$save_MONO_PATH"; \
          fi; \
          export MONO_PATH; \
-         for i in $(mcs_topdir)/class/lib/$$profile/*.{dll,exe}; do \
+         for stub in $$verifiable_files; do \
+         i=$(mcs_topdir)/class/lib/$$profile/$$stub ; \
+         echo $$i ; \
                if [ ! -f $$i ] ; then \
                        continue ; \
                fi ;  \
index 2183ccbb50bee875511c03a22ae71475208c50fa..6f727a00e1bb0a012ff04ae8ad912981715fbcac 100644 (file)
@@ -1,5 +1,6 @@
 #include <mono/jit/jit.h>
 #include <mono/metadata/environment.h>
+#include <mono/utils/mono-publib.h>
 #include <stdlib.h>
 
 /*
@@ -31,6 +32,13 @@ static void main_function (MonoDomain *domain, const char *file, int argc, char*
        mono_jit_exec (domain, assembly, argc, argv);
 }
 
+static int malloc_count = 0;
+
+static void* custom_malloc(size_t bytes)
+{
+       ++malloc_count;
+       return malloc(bytes);
+}
 
 int 
 main(int argc, char* argv[]) {
@@ -44,6 +52,9 @@ main(int argc, char* argv[]) {
        }
        file = argv [1];
 
+       MonoAllocatorVTable mem_vtable = {custom_malloc};
+       mono_set_allocator_vtable (&mem_vtable);
+
        /*
         * Load the default Mono configuration file, this is needed
         * if you are planning on using the dllmaps defined on the
@@ -66,6 +77,9 @@ main(int argc, char* argv[]) {
        retval = mono_environment_exitcode_get ();
        
        mono_jit_cleanup (domain);
+
+       fprintf (stdout, "custom malloc calls = %d\n", malloc_count);
+
        return retval;
 }
 
index f8b5a6c345ca1545b6e47e06d44172ce7c6a69b9..a1aecd13e3d614957a377ed574144ed3f68bbaee 100755 (executable)
@@ -1,6 +1,42 @@
 #!/usr/bin/env python
 
-# Mimics GNU timeout, but does some fancy tracking based on custom features in mono nunit24.
+# Mimics GNU timeout, but has special modes which gather test result data and retry failed tests.
+
+######################################### How this works ##########################################
+#
+# Because we have several different test harnesses and we don't invoke them directly, communication
+# between this script and the harness is done through the simplest means possible (environment
+# variables to communicate babysitter->harness, files in standard locations harness->babysitter).
+#
+# The script supports three different ways of extracting test data from the invoked test suite:
+#
+# 1. "The babysitter protocol": The babysitter sets five environment variables (see below):
+#        "Ran test file": A path to a file where the harness should write a line-delimited list of
+#            tests which ran to completion.
+#        "Failed test file": A path to a file where the harness should write a line-delimited list
+#            of tests that failed.
+#        "Current test file": A path to a file where the harness should write the currently running
+#            test before a test begins, then delete afterward (used to detect early termination).
+#        "Run test": A list of test names, used by:
+#        "Run mode": This is either RUN or EXCLUDE. If RUN, the test list is a whitelist; run only
+#            those tests. If EXCLUDE, the list is a blacklist; run all except those tests.
+#    This is the most featureful mode: It can report where we failed in the case of timeouts or
+#    crashes that take down the harness, and if the feature is enabled it can retry failed tests.
+#    However, it requires modification to the test harness.
+#
+# 2. NUnit XML: The babysitter also sets a sixth environment variable:
+#        "XML list file": A path to a file where the harness should write a line-delimited list of
+#        paths to NUnit-format XML result files it created.
+#    This also requires modification to the test harness, but less of it.
+#
+# 3. NUnit XML (manually specified): If the test harness can't be modified, but the caller of the
+#    babysitter script happens to know where the harness writes its result XML files, the caller
+#    can specify those paths in the "Extra XML" environment variable (see --help)
+#
+# A single babysitter invocation can currently handle either the babysitter protocol or the XML,
+# but never a mix of the two.
+#
+###################################################################################################
 
 import argparse
 import subprocess
@@ -13,21 +49,16 @@ import copy
 import tempfile
 import calendar
 import json
+from xml.dom.minidom import parse as xmlparse
 
 ### Constants
 
-# Here is how the communication with nunit works. It has to work with two constraints:
-# - We don't invoke nunit directly. We invoke some Makefile which invokes some other Makefile
-#   and at some point down the line someone calls nunit.
-# - nunit has to be able to report back to us even if (especially if) it terminates improperly.
-# To deal with all this, communication babysitter->nunit is done by environment variables,
-# and communication nunit->babysitter is done by leaving behind files in known locations.
-
 # Filenames
 
 CURRENT_TEST_FILE = "babysitter_report_current_test_file.txt"
 RAN_TEST_FILE     = "babysitter_report_ran_test_file.txt"
 FAILED_TEST_FILE  = "babysitter_report_failed_test_file.txt"
+XML_LIST_FILE     = "babysitter_report_xml_list_file.txt"
 LOGGING_FILE      = "babysitter_report.json_lines"
 
 # Environment keys
@@ -36,11 +67,13 @@ LOGGING_FILE      = "babysitter_report.json_lines"
 CURRENT_TEST_KEY  = 'MONO_BABYSITTER_NUNIT_CURRENT_TEST_FILE' # Tell nunit where to leave files
 RAN_TEST_KEY      = 'MONO_BABYSITTER_NUNIT_RAN_TEST_FILE'
 FAILED_TEST_KEY   = 'MONO_BABYSITTER_NUNIT_FAILED_TEST_FILE'
+XML_LIST_KEY      = 'MONO_BABYSITTER_NUNIT_XML_LIST_FILE'
 RUN_KEY           = 'MONO_BABYSITTER_NUNIT_RUN_TEST' # Semicolon-separated list of test names
-RUN_MODE_KEY      = 'MONO_BABYSITTER_NUNIT_RUN_MODE' # Equal to either RUN or AFTER
+RUN_MODE_KEY      = 'MONO_BABYSITTER_NUNIT_RUN_MODE' # Equal to either RUN or EXCLUDE
 
 # Keys used for script configuration (see --help text)
 LOG_FILE_KEY      = 'MONO_BABYSITTER_LOG_FILE'       # Path
+EXTRA_XML_KEY     = 'MONO_BABYSITTER_EXTRA_XML'      # Semicolon-separated list of paths
 RETRY_KEY         = 'MONO_BABYSITTER_RETRY'          # Equal to an integer
 VERBOSE_KEY       = 'MONO_BABYSITTER_VERBOSE'        # "Undocumented"-- used for debugging babysitter
 
@@ -51,6 +84,7 @@ INVOKE_JSON     = 'invocation'
 COUNT_JSON      = 'iteration'        # How many times was command executed?
 LIMIT_JSON      = 'failure_max'
 SUPPORT_JSON    = 'babysitter_protocol' # Was the test suite running with a babysitter-aware nunit?
+LOADED_XML_JSON = 'loaded_xml'          # True if we loaded result XML from the test suite
 FINAL_CODE_JSON = 'final_code'
 TESTS_JSON      = 'tests'         # Holds dictionary of (test case name)->(dict with TEST_ keys below)
 TEST_FAILURES         = 'normal_failures'
@@ -85,8 +119,9 @@ Durations are floating point numbers followed by an optional unit:\n
 'd' for days\n
 supported environment variables:
   %s: File to write logs to (as line-delimited JSON)
-  %s: If set to a number, failed test cases will be rerun this many times (NUnit test suites only)""" %
-               (LOG_FILE_KEY, RETRY_KEY),
+  %s: If set to a number, failed test cases will be rerun this many times (NUnit test suites only)
+  %s: Semicolon-separated list of additional NUnit XMLs to check for errors""" %
+               (LOG_FILE_KEY, RETRY_KEY, EXTRA_XML_KEY),
        formatter_class=argparse.RawTextHelpFormatter)
 argparser.add_argument('-s', '--signal', dest='signal', metavar='signal', default='TERM',
        help="Send this signal to the command on timeout, instead of TERM.")
@@ -131,7 +166,7 @@ def parse_duration(duration): # Accept units
 def parse_signal(sig):        # Accept names
        if sig.isdigit():
                return int(sig)
-       for k,v in signal.__dict__.iteritems():
+       for k,v in signal.__dict__.items():
                if k == ("SIG%s" % sig):
                        return v
        argparser.error("Could not understand signal name %s" % sig)
@@ -148,6 +183,7 @@ global_env = copy.deepcopy( os.environ )
 verbose = VERBOSE_KEY in global_env
 logging = LOG_FILE_KEY in global_env
 logfile = global_env[LOG_FILE_KEY] if logging else None
+xml_list = global_env[EXTRA_XML_KEY].split(";") if EXTRA_XML_KEY in global_env and global_env[EXTRA_XML_KEY] else []
 crash_resuming = True # TODO: Consider exposing this option, or adding a retry_on_crash option.
 failmax = int(global_env[RETRY_KEY]) if RETRY_KEY in global_env else 0
 babysitting = True # If false, babysitter becomes a timeout clone with no env manipulation or anything.
@@ -156,6 +192,7 @@ if babysitting:
        global_env[CURRENT_TEST_KEY] = os.path.join(babysitter_dir, CURRENT_TEST_FILE)
        global_env[RAN_TEST_KEY]     = os.path.join(babysitter_dir, RAN_TEST_FILE)
        global_env[FAILED_TEST_KEY]  = os.path.join(babysitter_dir, FAILED_TEST_FILE)
+       global_env[XML_LIST_KEY]     = os.path.join(babysitter_dir, XML_LIST_FILE)
 
 have_unix_process_groups = 'killpg' in os.__dict__
 have_windows_process_groups = 'CREATE_NEW_PROCESS_GROUP' in subprocess.__dict__
@@ -251,7 +288,7 @@ def run(): # Returns exit code
 
        # Set up logging
        log = {DATE_JSON: posixtime(), COUNT_JSON:0, LIMIT_JSON:failmax, SUPPORT_JSON:False,
-               INVOKE_JSON: " ".join(command)}
+               LOADED_XML_JSON:False, INVOKE_JSON: " ".join(command)}
 
        def log_value(key, set=None, add=None, target=log): # Call to add toplevel value to log
                if add is not None:
@@ -281,7 +318,7 @@ def run(): # Returns exit code
 
                        # Prepare environment/filesystem
                        if babysitting:
-                               for key in [CURRENT_TEST_KEY, RAN_TEST_KEY, FAILED_TEST_KEY]:
+                               for key in [CURRENT_TEST_KEY, RAN_TEST_KEY, FAILED_TEST_KEY, XML_LIST_KEY]:
                                        attemptDelete(env[key])
                                if resume_after:
                                        env[RUN_KEY] = ";".join(resume_after)
@@ -322,6 +359,7 @@ def run(): # Returns exit code
                        crashed_at = attemptFirstLine(env[CURRENT_TEST_KEY])
                        failed_tests = attemptLines(env[FAILED_TEST_KEY])
                        ran_tests = attemptLines(env[RAN_TEST_KEY])
+                       wrote_xml = attemptLines(env[XML_LIST_KEY])
                        bailout = False
 
                        if crashed_at or failed_tests or ran_tests: # Test suite follows the babysitter protocol
@@ -374,12 +412,41 @@ def run(): # Returns exit code
                                        message += " Test suite terminated with code %d, " % (code)
                                        if log[SUPPORT_JSON]:
                                                message += "but failure did not occur during a test case. Halting."
+                                       elif xml_list or wrote_xml:
+                                               message += "will extract test results from XML. Halting."
                                        else:
                                                message += "and suite cannot report test case data. Halting."
                                elif bailout:
                                        message += " Will halt testing."
                                print(message)
 
+                       if not log[SUPPORT_JSON]:
+                               for xml in (xml_list + list(wrote_xml)):
+                                       verbose_print("Will attempt to load XML from %s" % (xml))
+                                       try:
+                                               data = xmlparse(xml).documentElement
+                                               if data.nodeName != 'test-results':
+                                                       raise ValueError("Toplevel element was not <test-results />")
+
+                                               log_value(LOADED_XML_JSON, True)
+
+                                               search = [data]
+                                               while search:
+                                                       nextsearch = []
+                                                       for node in search:
+                                                               for child in node.childNodes:
+                                                                       if child.nodeName == 'test-suite' or child.nodeName == 'results':
+                                                                               nextsearch.append(child) # Descend
+                                                                       elif child.nodeName == 'test-case':
+                                                                               name = child.getAttribute("name")
+                                                                               if child.getAttribute("executed") == "True" and child.getAttribute("success") != "True":
+                                                                                       log_test(name, TEST_FAILURES, add=1)
+
+                                                       search = nextsearch
+                                       except Exception as e:
+                                               print("Could not load XML file %s. Reason: %s" % (xml, e))
+                                       data
+
                        if bailout or not (resume_after or retry_next): # If not retrying
                                return code
 
index ad2fe82914140b24f6daa4d5025b2f5b7bd995c5..b202c2493fb11fac4ff3acf6dce92f6ecb56e979 100755 (executable)
@@ -17,10 +17,13 @@ if [[ ${label} == 'osx-amd64' ]]; then EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --w
 if [[ ${label} == 'w32' ]]; then PLATFORM=Win32; EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --host=i686-w64-mingw32"; export MONO_EXECUTABLE="`cygpath -u ${WORKSPACE}\\\msvc\\\build\\\sgen\\\Win32\\\bin\\\Release\\\mono-sgen.exe`"; fi
 if [[ ${label} == 'w64' ]]; then PLATFORM=x64; EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --host=x86_64-w64-mingw32 --disable-boehm"; export MONO_EXECUTABLE="`cygpath -u ${WORKSPACE}\\\msvc\\\build\\\sgen\\\x64\\\bin\\\Release\\\mono-sgen.exe`"; fi
 
-if [[ ${CI_TAGS} == 'mobile_static' ]];
+if [[ ${CI_TAGS} == *'mobile_static'* ]];
     then
     EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --with-runtime_preset=mobile_static";
-elif [[ ${label} != w* ]] && [[ ${label} != 'debian-ppc64el' ]] && [[ ${label} != 'centos-s390x' ]];
+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'* ]];
     then
     # Override the defaults to skip profiles
     # only enable the mobile profiles and mobile_static on the main architectures
@@ -45,11 +48,17 @@ if [[ ${label} == w* ]];
     then
     ${TESTCMD} --label=make-msvc-sgen --timeout=60m --fatal /cygdrive/c/Program\ Files\ \(x86\)/MSBuild/14.0/Bin/MSBuild.exe /p:PlatformToolset=v140 /p:Platform=${PLATFORM} /p:Configuration=Release /p:MONO_TARGET_GC=sgen msvc/mono.sln
 fi
-${TESTCMD} --label=make --timeout=300m --fatal make -w V=1
+
+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 check-ci
+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
diff --git a/scripts/ci/run-test-acceptance-tests.sh b/scripts/ci/run-test-acceptance-tests.sh
new file mode 100755 (executable)
index 0000000..0e5fe78
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/bash -e
+
+export TESTCMD=`dirname "${BASH_SOURCE[0]}"`/run-step.sh
+
+make install  # Roslyn tests need a Mono installation
+
+LANG=en_US.UTF-8 ${TESTCMD} --label=check-ms-test-suite --timeout=30m make -C acceptance-tests check-ms-test-suite
+
+total_tests=$(find acceptance-tests/ -name TestResult*xml | xargs cat | grep -c "<test-case")
+if [ "$total_tests" -lt "1600" ]
+       then echo "*** NOT ENOUGH TEST RESULTS RECORDED, MARKING FAILURE ***"
+       exit 1
+fi
+
+${TESTCMD} --label=check-roslyn --timeout=30m make -C acceptance-tests check-roslyn PREFIX=${WORKSPACE}/tmp/mono-acceptance-tests
+rm -rf ${WORKSPACE}/tmp/mono-acceptance-tests  # cleanup the Mono installation used for Roslyn tests
+
+${TESTCMD} --label=coreclr-compile-tests --timeout=80m --fatal make -C acceptance-tests coreclr-compile-tests
+${TESTCMD} --label=coreclr-runtest-basic --timeout=10m make -C acceptance-tests coreclr-runtest-basic
+${TESTCMD} --label=coreclr-runtest-coremanglib --timeout=10m make -C acceptance-tests coreclr-runtest-coremanglib
+${TESTCMD} --label=coreclr-gcstress --timeout=1200m make -C acceptance-tests coreclr-gcstress
index 5dc264cffdea2a541075db8c12e202ef47f8ce7a..bffda6b73f7191f1673b4e3123ca9c18b95589ea 100755 (executable)
@@ -2,7 +2,7 @@
 
 export TESTCMD=`dirname "${BASH_SOURCE[0]}"`/run-step.sh
 
-${TESTCMD} --label=mini --timeout=5m make -w -C mono/mini -k check
+${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=verify --timeout=15m make -w -C runtime mcs-compileall
@@ -38,6 +38,7 @@ ${TESTCMD} --label=Microsoft.Build.Framework --timeout=5m make -w -C mcs/class/M
 ${TESTCMD} --label=Microsoft.Build.Tasks --timeout=5m make -w -C mcs/class/Microsoft.Build.Tasks run-test
 ${TESTCMD} --label=Microsoft.Build.Utilities --timeout=5m make -w -C mcs/class/Microsoft.Build.Utilities run-test
 ${TESTCMD} --label=Mono.C5 --timeout=5m make -w -C mcs/class/Mono.C5 run-test
+${TESTCMD} --label=Mono.Tasklets --timeout=5m make -w -C mcs/class/Mono.Tasklets run-test
 ${TESTCMD} --label=System.Configuration --timeout=5m make -w -C mcs/class/System.Configuration run-test
 ${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
@@ -79,4 +80,8 @@ ${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
+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;
+fi
 rm -fr /tmp/jenkins-temp-aspnet*
index 168fd8ca49a51279f92bd78bd31a21d04a014f7b..bfb161032d27c79dc85c9c77bf99ccedd69d478c 100755 (executable)
@@ -4,17 +4,15 @@ TESTCMD=`dirname "${BASH_SOURCE[0]}"`/run-step.sh
 
 if test -n "${MONO_LLVMONLY}";
 then
-${TESTCMD} --label=mini --timeout=5m make -w -C mono/mini -k llvmonlycheck
+${TESTCMD} --label=mini --timeout=25m make -j 4 -w -C mono/mini -k llvmonlycheck
 else
-${TESTCMD} --label=mini --timeout=5m make -w -C mono/mini -k fullaotcheck
+${TESTCMD} --label=mini --timeout=25m make -j 4 -w -C mono/mini -k fullaotcheck
 fi
 
 ${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=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=Mono.Security --timeout=5m make -w -C mcs/class/Mono.Security run-test
index 440476df14051541e61639f3cc2d381c8b04e59d..899e368877ef129e10d447b8d7bbad7bd2b55a7a 100644 (file)
@@ -1,9 +1,8 @@
 #
 # This is a python script and a set of make targets to implement support for conditional submodules
-# There should be a SUBMODULES.json file which contains information about the submodules.
+# Set the SUBMODULES_CONFIG_FILE make variable to the srcdir path of a SUBMODULES.json file which contains information about the submodules.
 #
 
-CONFIG=SUBMODULES.json
 SCRIPT=$(top_srcdir)/scripts/submodules/versions.py
 
 # usage $(call ValidateVersionTemplate (name,MAKEFILE VAR,repo name))
@@ -11,11 +10,11 @@ SCRIPT=$(top_srcdir)/scripts/submodules/versions.py
 
 define ValidateVersionTemplate
 #$(eval REPOSITORY_$(2):=$(shell test -z $(3) && echo $(1) || echo "$(3)"))
-#$(eval DIRECTORY_$(2):=$(shell python $(SCRIPT) get-dir $(1)))
+#$(eval DIRECTORY_$(2):=$(shell python $(SCRIPT) $(SUBMODULES_CONFIG_FILE) get-dir $(1)))
 #$(eval DIRECTORY_$(2):=$(shell test -z $(DIRECTORY_$(2)) && echo $(1) || echo $(DIRECTORY_$(2))))
-#$(eval MODULE_$(2):=$(shell python $(SCRIPT) get-url $(1)))
-#$(eval NEEDED_$(2)_VERSION:=$(shell python $(SCRIPT) get-rev $(1)))
-#$(eval $(2)_BRANCH_AND_REMOTE:=$(shell python $(SCRIPT) get-remote-branch $(1)))
+#$(eval MODULE_$(2):=$(shell python $(SCRIPT) $(SUBMODULES_CONFIG_FILE) get-url $(1)))
+#$(eval NEEDED_$(2)_VERSION:=$(shell python $(SCRIPT) $(SUBMODULES_CONFIG_FILE) get-rev $(1)))
+#$(eval $(2)_BRANCH_AND_REMOTE:=$(shell python $(SCRIPT) $(SUBMODULES_CONFIG_FILE) get-remote-branch $(1)))
 
 #$(eval $(2)_VERSION:=$$$$(shell cd $($(2)_PATH) 2>/dev/null && git rev-parse HEAD ))
 
@@ -68,7 +67,7 @@ test-$(1)::
 
 reset-$(1)::
        @if test -d $($(2)_PATH); then \
-               if ! (cd $($(2)_PATH) && git show $(NEEDED_$(2)_VERSION) >/dev/null 2>&1 && git log -1 $(NEEDED_$(2)_REMOTE) >/dev/null 2>&1) ; then \
+               if ! (cd $($(2)_PATH) && git show $(NEEDED_$(2)_VERSION) >/dev/null 2>&1 && git log -1 $(NEEDED_$(2)_REMOTE/NEEDED_$(2)_BRANCH) >/dev/null 2>&1) ; then \
                        echo "*** git fetch `basename $$($(2)_PATH)`" && (cd $($(2)_PATH) && git fetch); \
                fi;  \
        else \
@@ -107,17 +106,17 @@ reset:
 
 __bump-version-%:
        @if [ "$(REV)" = "" ]; then echo "Usage: make bump-version-$* REV=<ref>"; exit 1; fi
-       python $(SCRIPT) set-rev $* $(REV)
-       @if [ "$(COMMIT)" = "1" ]; then echo "[submodules] Bump $* to pick up $(REV)." | git commit -F - $(CONFIG); fi
+       python $(SCRIPT) $(SUBMODULES_CONFIG_FILE) set-rev $* $(REV)
+       @if [ "$(COMMIT)" = "1" ]; then echo "[submodules] Bump $* to pick up $(REV)." | git commit -F - $(SUBMODULES_CONFIG_FILE); fi
 
 __bump-branch-%:
        @if [ "$(BRANCH)" = "" ]; then echo "Usage: make bump-branch-$* BRANCH=<branch> REMOTE_BRANCH=<remote branch>"; exit 1; fi
        @if [ "$(REMOTE_BRANCH)" == "" ]; then echo "Usage: make bump-branch-$* BRANCH=<branch> REMOTE_BRANCH=<remote branch>"; exit 1; fi
-       python $(SCRIPT) set-branch $* $(BRANCH)
-       python $(SCRIPT) set-remote-branch $* $(REMOTE_BRANCH)
-       @if [ "$(COMMIT)" = "1" ]; then echo "[submodules] Bump $* to switch to $(BRANCH) $(REMOTE BRANCH)." | git commit -F - $(CONFIG); fi
+       python $(SCRIPT) $(SUBMODULES_CONFIG_FILE) set-branch $* $(BRANCH)
+       python $(SCRIPT) $(SUBMODULES_CONFIG_FILE) set-remote-branch $* $(REMOTE_BRANCH)
+       @if [ "$(COMMIT)" = "1" ]; then echo "[submodules] Bump $* to switch to $(BRANCH) $(REMOTE BRANCH)." | git commit -F - $(SUBMODULES_CONFIG_FILE); fi
 
 __bump-current-version-%:
        REV=$(shell cd $(ACCEPTANCE_TESTS_PATH)/$* && git log -1 --pretty=format:%H); \
-       python $(SCRIPT) set-rev $* $$REV; \
-       if [ "$(COMMIT)" = "1" ]; then echo "[submodules] Bump $* to pick up $$REV:" | git commit -F - $(CONFIG); fi
+       python $(SCRIPT) $(SUBMODULES_CONFIG_FILE) set-rev $* $$REV; \
+       if [ "$(COMMIT)" = "1" ]; then echo "[submodules] Bump $* to pick up $$REV:" | git commit -F - $(SUBMODULES_CONFIG_FILE); fi
index 35ded0c0fcd74c3aa017682864890a6e501c885c..5252ee58306a6b9f77b257c92a5f0b391fd430db 100755 (executable)
@@ -12,38 +12,38 @@ def find_module(submodules, name):
     sys.exit(1)
 
 
-if len(sys.argv) < 2:
-    print("Usage: versions.py <command>")
+if len(sys.argv) < 3:
+    print("Usage: versions.py <path to SUBMODULES.json> <command>")
     sys.exit(1)
 
-CONFIG_FILE = "SUBMODULES.json"
-command = sys.argv[1]
+CONFIG_FILE = sys.argv[1]
+command = sys.argv[2]
 
 submodules = json.load(open(CONFIG_FILE))
 
 if command == "get-rev":
-    mod = find_module(submodules, sys.argv[2])
+    mod = find_module(submodules, sys.argv[3])
     print(mod["rev"])
 elif command == "get-url":
-    mod = find_module(submodules, sys.argv[2])
+    mod = find_module(submodules, sys.argv[3])
     print(mod["url"])
 elif command == "get-dir":
-    mod = find_module(submodules, sys.argv[2])
+    mod = find_module(submodules, sys.argv[3])
     print(mod["directory"])
 elif command == "get-remote-branch":
-    mod = find_module(submodules, sys.argv[2])
+    mod = find_module(submodules, sys.argv[3])
     print(mod["remote-branch"])
 elif command == "set-rev":
-    mod = find_module(submodules, sys.argv[2])
-    mod["rev"] = sys.argv[3]
+    mod = find_module(submodules, sys.argv[3])
+    mod["rev"] = sys.argv[4]
     json.dump(submodules, open(CONFIG_FILE, "w"), indent = 2)
 elif command == "set-branch":
-    mod = find_module(submodules, sys.argv[2])
-    mod["branch"] = sys.argv[3]
+    mod = find_module(submodules, sys.argv[3])
+    mod["branch"] = sys.argv[4]
     json.dump(submodules, open(CONFIG_FILE, "w"), indent = 2)
 elif command == "set-remote-branch":
-    mod = find_module(submodules, sys.argv[2])
-    mod["remote-branch"] = sys.argv[3]
+    mod = find_module(submodules, sys.argv[3])
+    mod["remote-branch"] = sys.argv[4]
     json.dump(submodules, open(CONFIG_FILE, "w"), indent = 2)
 elif command == "cat":
     print(json.dumps(submodules, indent = 2))
index 136f2b71878105b87fdcb5ccb5faa0f1cc943646..92fca755371d09ab6336dd25c5c131d014c47d7d 100644 (file)
@@ -3922,12 +3922,17 @@ int Mono_Posix_ToMountFlags (guint64 x, guint64 *r)
 int Mono_Posix_FromMremapFlags (guint64 x, guint64 *r)
 {
        *r = 0;
+#ifndef __NetBSD__
        if ((x & Mono_Posix_MremapFlags_MREMAP_MAYMOVE) == Mono_Posix_MremapFlags_MREMAP_MAYMOVE)
 #ifdef MREMAP_MAYMOVE
                *r |= MREMAP_MAYMOVE;
 #else /* def MREMAP_MAYMOVE */
                {errno = EINVAL; return -1;}
 #endif /* ndef MREMAP_MAYMOVE */
+#else /* def __NetBSD__ */
+       if ((x & Mono_Posix_MremapFlags_MREMAP_MAYMOVE) != Mono_Posix_MremapFlags_MREMAP_MAYMOVE)
+               *r = MAP_FIXED;
+#endif /* def __NetBSD__ */
        if (x == 0)
                return 0;
        return 0;
@@ -3936,12 +3941,17 @@ int Mono_Posix_FromMremapFlags (guint64 x, guint64 *r)
 int Mono_Posix_ToMremapFlags (guint64 x, guint64 *r)
 {
        *r = 0;
+#ifndef __NetBSD__
        if (x == 0)
                return 0;
 #ifdef MREMAP_MAYMOVE
        if ((x & MREMAP_MAYMOVE) == MREMAP_MAYMOVE)
                *r |= Mono_Posix_MremapFlags_MREMAP_MAYMOVE;
 #endif /* ndef MREMAP_MAYMOVE */
+#else /* def __NetBSD__ */
+       if ((x & MAP_FIXED) != MAP_FIXED)
+               *r |= Mono_Posix_MremapFlags_MREMAP_MAYMOVE;
+#endif
        return 0;
 }
 
@@ -9314,4 +9324,3 @@ int Mono_Posix_ToXattrFlags (int x, int *r)
 #endif /* ndef XATTR_REPLACE */
        return 0;
 }
-
index 3973bd6614f7199b3e4585bbf367c89301219a64..1dd61bc372b5343cce83bf8a677c190aca969a05 100644 (file)
 #define __BSD_VISIBLE 1
 #endif
 
+#ifdef __NetBSD__
+/* For mincore () */
+#define _NETBSD_SOURCE
+#endif
+
 #include <sys/types.h>
 #include <sys/mman.h>
 #include <errno.h>
@@ -109,8 +114,15 @@ Mono_Posix_Syscall_mremap (void *old_address, mph_size_t old_size,
        if (Mono_Posix_FromMremapFlags (flags, &_flags) == -1)
                return MAP_FAILED;
 
+#if defined(linux)
        return mremap (old_address, (size_t) old_size, (size_t) new_size,
                        (unsigned long) _flags);
+#elif defined(__NetBSD__)
+       return mremap (old_address, (size_t) old_size, old_address,
+                       (size_t) new_size, (unsigned long) _flags);
+#else
+#error Port me
+#endif
 }
 #endif /* def HAVE_MREMAP */
 
index e83ea3e561c2945c7a7b3e08e3b13a5097870eeb..5d9eb574eb28201bb5aa78ca9bb9bb22be6a29f4 100644 (file)
@@ -24,7 +24,9 @@ namespace CppSharp
         static List<string> Abis = new List<string> ();
         static string OutputDir;
 
+        static bool XamarinAndroid;
         static string MonodroidDir = @"";
+        static string AndroidNdkPath = @"";
         static string MaccoreDir = @"";
 
         public enum TargetPlatform
@@ -87,28 +89,28 @@ namespace CppSharp
             Targets.Add (new Target {
                 Platform = TargetPlatform.Android,
                 Triple = "i686-none-linux-android",
-                Build = "mono-x86",
+                Build = XamarinAndroid ? "x86" : "mono-x86",
                 Defines = { "TARGET_X86" }
             });
 
             Targets.Add (new Target {
                 Platform = TargetPlatform.Android,
                 Triple = "x86_64-none-linux-android",
-                Build = "mono-x86_64",
+                Build = XamarinAndroid ? "x86_64" : "mono-x86_64",
                 Defines = { "TARGET_AMD64" }
             });            
 
             Targets.Add (new Target {
                 Platform = TargetPlatform.Android,
                 Triple = "armv5-none-linux-androideabi",
-                Build = "mono-armv6",
+                Build = XamarinAndroid ? "armeabi" : "mono-armv6",
                 Defines = { "TARGET_ARM", "ARM_FPU_VFP", "HAVE_ARMV5" }
             });
 
             Targets.Add (new Target {
                 Platform = TargetPlatform.Android,
                 Triple = "armv7-none-linux-androideabi",
-                Build = "mono-armv7",                    
+                Build = XamarinAndroid ? "armeabi-v7a" : "mono-armv7",
                 Defines = { "TARGET_ARM", "ARM_FPU_VFP", "HAVE_ARMV5", "HAVE_ARMV6",
                     "HAVE_ARMV7"
                 }
@@ -117,7 +119,7 @@ namespace CppSharp
             Targets.Add (new Target {
                 Platform = TargetPlatform.Android,
                 Triple = "aarch64-v8a-linux-android",
-                Build = "mono-aarch64",                    
+                Build = XamarinAndroid ? "arm64-v8a" : "mono-aarch64",
                 Defines = { "TARGET_ARM64" }
             });            
 
@@ -254,6 +256,9 @@ namespace CppSharp
 
         static string GetAndroidNdkPath()
         {
+            if (!String.IsNullOrEmpty (AndroidNdkPath))
+                return AndroidNdkPath;
+
             // Find the Android NDK's path from Monodroid's config.
             var configFile = Path.Combine(MonodroidDir, "env.config");
             if (!File.Exists(configFile))
@@ -272,7 +277,9 @@ namespace CppSharp
                 { "abi=", "ABI triple to generate", v => Abis.Add(v) },
                 { "o|out=", "output directory", v => OutputDir = v },
                 { "maccore=", "include directory", v => MaccoreDir = v },
-                { "monodroid=", "include directory", v => MonodroidDir = v },
+                { "monodroid=", "top monodroid directory", v => MonodroidDir = v },
+                { "android-ndk=", "Path to Android NDK", v => AndroidNdkPath = v },
+                { "xamarin-android", "Generate for Xamarin.Android instead of monodroid", v => XamarinAndroid = true },
                 { "mono=", "include directory", v => MonoDir = v },
                 { "h|help",  "show this message and exit",  v => showHelp = v != null },
             };
@@ -319,7 +326,7 @@ namespace CppSharp
             string targetPath;
             switch (target.Platform) {
             case TargetPlatform.Android:
-                targetPath = Path.Combine (MonodroidDir, "builds");
+                targetPath = Path.Combine (MonodroidDir, XamarinAndroid ? "build-tools/mono-runtimes/obj/Debug" : "builds");
                 break;
             case TargetPlatform.WatchOS:
             case TargetPlatform.iOS: