Compare commits

...
Author SHA1 Message Date
Zoltan Varga e66d9abbb2 [llvm] Fix the returning of vtypes using a hidden argument in bitcode, in some cases, we forgot to generate the code to return the value, causing random data to be returned. Fixes #59956. (#5786) 2017-10-25 10:35:58 -04:00
Aleksey Kliger (λgeek) 1f4613aa1a [sre] Register a canonical reflected method for a methodspec token. (Fixes #60233) (#5814)
* [sre] mono_dynamic_image_register_token: Change asserts to warnings

This partly relaxes the changes in 792b5367cd
which added the assertions.

In practice the assertions introduced a crash in heavy uses of
System.Reflection.Emit such as unit testing frameworks and dynamic languages.
We still want to know if there are surprising uses of
mono_dynamic_image_register_token, but we don't need a crash.  SRE used to work
before 792b5367cd, so no need to break it.

* [test] ILGenerator test for duplicate methodspec tokens

Regression test for [Bugzilla #60233](https://bugzilla.xamarin.com/show_bug.cgi?id=60233)

* [sre] Register a canonical reflected method for a methodspec token (Fixes #60233)

This is like the fix for [bugzilla
59364](https://bugzilla.xamarin.com/show_bug.cgi?id=59364) but this time it's a
methodspec token, not a memberref token.
2017-10-18 08:09:39 -04:00
Zoltan Varga d092ad186f [llvm] Map byref types to the same type as the this argument so they are called using the same signature if the this argument is passed explicitly. Fixes #59436. (#5572) 2017-10-17 09:21:39 +02:00
Alexis Christoforides c6605763a3 Merge pull request #5783 from marek-safar/2017-06-fixes
[corlib]: Fix race condition in ExceptionDispatchInfo. (#5279)
2017-10-13 14:07:22 -04:00
Martin Baulig 0fb4040ef1 [corlib]: Fix race condition in ExceptionDispatchInfo. (#5279) 2017-10-13 16:03:37 +02:00
Luis Aguilera fea2566b12 Merge pull request #5772 from marek-safar/2017-06-fixes
Brings CoreFX update which contains a fix for #59302
2017-10-12 11:34:26 -04:00
Marek Safar f3c9015ec4 Brings CoreFX update which contains a fix for #59302 2017-10-12 09:44:55 +02:00
Jo Shields 0429840e5b Bump branch to 5.4.1, in anticipation of next release (#5760) 2017-10-12 02:36:03 +02:00
Alexander Köplinger 28d71e9727 [msvc] Fix MONO_CORLIB_VERSION to match configure.ac (#5770)
When I simplified MONO_CORLIB_VERSION to only include major.minor
instead of major.minor.build in https://github.com/mono/mono/pull/5449
I forgot to apply the same change to the msvc copy of that logic.

(cherry picked from commit 43757d67ef)
2017-10-12 02:35:44 +02:00
Alexis Christoforides f1bca3dc5b Fix typo 2017-10-11 16:51:03 -04:00
Aleksey Kliger fbc487ff42 [sre] register a canonical MonoReflectionMethod for a methodref token
In mono_image_create_token we are passed in a managed reflection object and we
need to create a token for it and optionally register it so that we can resolve
that token back to a runtime structure and managed object later.

For a MonoReflectionMethod object that refers to a method from outside the
current dynamic image, we need to generate a memberref token.  It will be the
same token for the same underlying MonoMethod*.  When we go to register the
token with mono_dynamic_image_register_token we need to pass a managed object.
Unfortunately two MonoReflectionMethod objects could refer to the same
MonoMethod* but differ in their ReflectedType, so just registering the
passed-in MonoReflectionMethod means we could assert in
mono_dynamic_image_register_token because previously we may have registered the
same method via a different ReflectedType.

So what we do is we cal mono_method_get_object_handle with NULL for the
reflected type - which corresponds to just using the DeclaringType of the given
MonoMethod*.

Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=59364
2017-10-06 11:12:06 +02:00
Aleksey Kliger 72c4a0ca08 [sre] Expect a new token for MonoArrayMethod and SignatureHelper 2017-10-06 11:12:06 +02:00
Aleksey Kliger 9685274a8a [sre] Remove MonoDynamicImage:handleref_managed field
It's now unused.
2017-10-06 11:12:06 +02:00
Aleksey Kliger 5cb0e59bea [sre] Map fieldref tokens to MonoClassField*
Previously, we mapped fieldref tokens to MonoReflectionField managed objects,
But the object is just used as a key for caching the token so we may as well
use the native field instead of a managed object.
2017-10-06 11:12:06 +02:00
Aleksey Kliger fc364332ff [sre] Wrap mono_image_create_token with HANDLE_FUNCTION_{ENTER,RETURN}
We will allocate a handle for the object that we will register.  For now it's
just an alias of the object passed in, but it could differ.
2017-10-06 11:12:06 +02:00
Aleksey Kliger ff204dae30 [test] SRE ILGenerator test for methodref and fieldref token caching
Regression test for https://bugzilla.xamarin.com/show_bug.cgi?id=59364

We need to cause SRE to generate the same methodref/fieldref token from two
different reflection objects.  That happens if you get the same method or field
via a base and a derived class so that the MemberInfo:DeclaredType is different
but the underlying MonoMethod* or MonoClassField* is the same.
2017-10-06 11:12:06 +02:00
Rolf Bjarne Kvinge 9b466abc49 [appletls] Trust SecTrustResult.Proceed as well. Fixes #58411.
Apple states clearly in their documentation about SecTrustResult.Proceed [1]:

    The user explicitly chose to trust a certificate in the chain (usually by
    clicking a button in a certificate trust panel).

    Your app should trust the chain.

This fixes bug #[58411][2], where SecTrustEvaluate returns
SecTrustResult.Proceed starting with iOS 11.

[1]: https://developer.apple.com/documentation/security/1394363-sectrustevaluate
[2]: https://bugzilla.xamarin.com/show_bug.cgi?id=58411
2017-10-06 11:08:22 +02:00
Zoltan Varga ab058f8e49 [aot] Don't error out if a method fails to JIT in full-aot mode. This was a regression caused by 9302c31f81. Fixes #59832. (#5686) (#5709) 2017-10-06 01:31:56 +02:00
Cody Russell cb4c3ca997 Add glib to the list of packages with debugging symbols. (#5658) 2017-10-04 17:54:12 +02:00
Ludovic Henry 0dd35e9d64 [w32handle] Only own first handle if doing WaitHandle.WaitAny (#5625)
This is the behaviour on .NET, even if it goes against the documentation at https://msdn.microsoft.com/en-us/library/tdykks7z(v=vs.110).aspx#Anchor_2

Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=59281
2017-09-29 11:21:47 +02:00
Ludovic Henry 7ba4e9e7b1 [w32process] Fix inverted kernel and user ticks (#5641) 2017-09-29 11:18:21 +02:00
Alexis Christoforides 71277e78f6 Merge pull request #5619 from mono/2017-06-bump-bockbuild
Bump bockbuild to get gtk Japanese IME fixes
2017-09-21 17:09:21 -04:00
Cody Russell c61b3bd6d9 Bump bockbuild to get gtk Japanese IME fixes 2017-09-21 10:54:29 -05:00
nosami 7d78877800 Install Microsoft.FSharp.NetSdk.props and targets
Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=57771
2017-09-15 15:56:17 +02:00
Ankit Jain 87a052504b [msbuild] Bump to get workaround for bxc #55697 . (#5585)
https://github.com/mono/msbuild/commit/f296e67b6004dd39c3f43b177bcf45dfbe931341
2017-09-15 09:29:37 -04:00
Zoltan Varga 26e759903e [profiler] Clear events for all profilers on profiler shutdown. Previously only the profiler which was added last had its events cleared. Fixes #59274. 2017-09-15 10:45:33 +02:00
Ankit Jain 12ca38606d Bump NuGet.BuildTasks to get new updates and switch to dev branch (#5540) 2017-09-13 08:52:03 -04:00
Marek Safar 0ab383de1e [corlib] Update negative symbol for all cultures. Fixes #57496 2017-09-13 13:45:24 +02:00
Ankit Jain 132135cb22 [msbuild] Bump msbuild to pick up SDK updates 2017-09-12 20:42:28 +02:00
nosami 5066d707ac [F#] Reinstate _DebugFileExt as it's needed for mobile debugging.
Also added a mechanism for users to override DebugType
2017-09-11 12:09:15 +02:00
Ankit Jain 794f7a7612 Update roslyn-binaries to be >= than VS 15.4
Version based on
https://github.com/dotnet/cli/blob/release/2.0-vs/build/DependencyVersions.props#L6

	<CLI_Roslyn_Version>2.3.2-beta1-61921-05</CLI_Roslyn_Version>
2017-09-08 23:20:44 +02:00
Sebastien Pouliot fe516ba0bd [linker] Bump to HEAD (master)
This will allow the SDK (XI/XM) to use the latest version directly from
mono (like cecil) and avoid potential out of sync issues
2017-09-08 18:48:39 +02:00
Bernhard Urban b2acee0ade Merge pull request #5513 from lewurm/2017-06-gethashcode-delegate
[2017-06][bcl] Use RuntimeHelpers.GetHashCode () for getting the hash code of …
2017-09-06 14:03:26 +02:00
Zoltan Varga 8af44d2b16 [bcl] Use RuntimeHelpers.GetHashCode () for getting the hash code of … (#5511)
* [bcl] Use RuntimeHelpers.GetHashCode () for getting the hash code of the delegate target to avoid calling user defined hash code implementations which can throw exceptions. Fixes a regression introduced by a48bc43985.

* add test for #59235

https://bugzilla.xamarin.com/show_bug.cgi?id=59235

* [fixup] RuntimeHelpers.GetHashCode handles null
2017-09-06 13:58:03 +02:00
Jason Imison f4cf17d61d Add portable pdb metadata fix from https://github.com/Microsoft/visualfsharp/pull/3553 (#5510) 2017-09-05 22:51:36 +02:00
nosami 8f3ddb716e Revert "Add portable pdb metadata fix from https://github.com/Microsoft/visualfsharp/pull/3553"
This reverts commit a4cd00b333.
2017-09-05 21:44:30 +01:00
nosami a4cd00b333 Add portable pdb metadata fix from https://github.com/Microsoft/visualfsharp/pull/3553 2017-09-05 21:36:51 +01:00
nosami cb6a2fc7ff Switch F# builds over to portable pdb 2017-09-05 15:52:41 +01:00
Rodrigo Kumpera c81fe5e84d [mini] Handle magic interfaces in common_trampoline as if they were variant.
With the introduction of magic array interfaces, they must be handled as if they
were variant if they are being dispatched against an array.

This was not being done in common_trampoline and resulted in the IMT thunk never
getting rebuilt and getting decent perf.

With this patch, dispatch to simple methods such as Array::Count over a magic interface
in a covariant case (such as IList<object> dispatch onto string[]) will accrue gvi's.

On a trivial benchmark of executing Count 1M times, perf goes from 760ms to 50ms.
2017-09-04 11:04:28 +02:00
Bernhard Urban 1cf175e95c Merge pull request #5493 from lewurm/2017-06-mono-api-html
[2017-06][mono-api-html] Allow `-r` to ignore class removals
2017-09-04 10:42:56 +02:00
Zoltan Varga 01d1582fb7 [llvm] Set the MonoJitInfo.from_llvm flag for methods loaded from llvm, it got broken by 1debf39341. (#5223) 2017-09-02 06:36:01 +02:00
Jonathan Pryor f177485aaf [mono-api-html] Allow -r to ignore class removals
Allow `mono-api-html -r REGEX` to be used to silence messages
regarding class and namespace removals in addition to member removals.
2017-09-01 23:23:56 +02:00
Martin Baulig 1d4fc17faa [System]: Fix minor leaks in AppleTls. (#5369) (#5379)
These should be automatically collected by the GC, but explicitly disposing
will keep memory usage more stable over time and keep pressure off the GC.

(cherry picked from commit 093915cf83)
(cherry picked from commit 9b8bb0edbe)
2017-08-31 12:49:33 -04:00
Martin Baulig dc29ba37a6 [System]: Fix major AppleTls memory leak. Bug #56814. (#5370) (#5376)
(cherry picked from commit c74f44126e)
2017-08-31 12:49:18 -04:00
Marek Safar 8bcbd3cc89 Bump cecil 2017-08-31 15:32:55 +02:00
Ludovic Henry 24901ef720 [w32error] Add ENODEV -> ERROR_DEV_NOT_EXIST error translation (#5385) (#5392)
Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=58738
2017-08-30 17:57:58 -04:00
Ludovic Henry b263d37e15 [marshal] Rethrow in native-to-managed wrapper to keep exception stacktrace (#5384) (#5394)
* [marshal] Rethrow in native-to-managed wrapper to keep exception stacktrace

Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=58782

* [interp] disable tests for 58782 as they rely on appdomains
2017-08-30 17:57:46 -04:00
Zoltan Varga 56267e8476 [amd64] Make code patching smp safe for the case where we emit a mov + call_reg. Hopefully fixes #57959. (#5452) 2017-08-28 16:29:14 -04:00
Alexander Köplinger 1afb931de6 Fix typo from 63b57ba7a1 2017-08-28 12:45:10 +02:00
Alexander Köplinger 63b57ba7a1 [configure.ac] Don't include the .build number in runtime-corlib version (#5449)
It's causing unnecessary complexity because we need to create a new
monolite when bumping the .build number in a major.minor.build
version like from 5.2.0 -> 5.2.1

corlib version bumps are very rare in those cases and even then
you can just increment the MONO_CORLIB_COUNTER variable.
(cherry picked from commit ec9a95dd53)
2017-08-25 22:01:16 +02:00
Marek Safar cbeae56621 [threadpool] Reduce logging verbosity level. Fixes #58829 2017-08-23 09:52:35 +02:00
Jo Shields f527b26e19 [msi] Fix typos in f9bdab7928
(cherry picked from commit da9287e432)
2017-08-22 10:18:53 -04:00
Alexander Köplinger ebee14deca Bump timeout for TaskTests.Delay_Simple (#5410)
Should be reverted once https://bugzilla.xamarin.com/show_bug.cgi?id=58877 is investigated and fixed.
(cherry picked from commit f567c2e5eb)
2017-08-21 17:29:05 +02:00
Jo Shields 929575bb0e [msi] Pull in MSI changes from Mono 5.2 branch 2017-08-21 09:59:36 -04:00
Aleksey Kliger 4fe608c216 [threads] Use designated initializer syntax in MAKE_SPECIAL_STATIC_OFFSET
Originally we used a C90-style struct initializer `{ (index), (offset), (type)
}`.  Unfortunately, SpecialStaticOffset is defined with fields in a different
order on big-endian and little-endian machines.  Using a designated
initializer, we don't have to care about the order.
2017-08-18 18:25:15 -04:00
Alexander Köplinger 6b8abfeb7c Bump bockbuild to remove gtk+ screen patch 2017-08-17 21:17:25 +02:00
Ludovic Henry 000682fe19 [corlib] Increase timeout for MonoTests.System.Runtime.Remoting.TestSynchronizationReleasedOnMultipleAcquire (#5373)
(cherry picked from commit 6e30ded242)
2017-08-17 19:01:59 +02:00
Ankit Jain 282e0fb6d3 Empty commit to trigger a wrench build 2017-08-16 20:16:43 -04:00
Ankit Jain 4cadbfc272 Bump roslyn-binaries 2017-08-16 20:12:06 -04:00
Ankit Jain 2071615b87 [msbuild] Bump to d15.4 branch HEAD 2017-08-16 14:45:40 -04:00
Ankit Jain cbc738c44d [msbuild] Install a deniedAssembliesList.txt to support denied ... (#5358)
... assemblies.

msbuild tries to filter out the denied assemblies, which mono refuses to
load, during a build. It uses the `deniedAssembliesList.txt` installed
to `$mono_prefix/lib/mono/xbuild` to identify them.

This was generated with:

 `$ mono tools/nuget-hash-extractor/nuget-hash-extractor.exe nugets guids_for_msbuild > mcs/tools/xbuild/data/deniedAssembliesList.txt`

This file needs to be kept in sync with any changes in the assemblies
denied by the runtime.

msbuild PR that adds support for this -
https://github.com/mono/msbuild/pull/23 .

cherry-pick 823bca4aed
2017-08-16 14:37:25 -04:00
Ankit Jain 7f9739d414 Install Roslyn binaries, including msbuild tasks to msbuild/Roslyn (#5251)
.. directory, which is `$mono_prefix/lib/mono/msbuild/15.0/bin/Roslyn/`

Mono installs `csc.exe` but the corresponding
`Microsoft.Build.Tasks.CodeAnalysis.dll` required for supporting msbuild C#
projects is installed by msbuild. But these two can get out of sync,
like they did and had to be worked around in
https://github.com/mono/msbuild/pull/19 .

Instead, we now install all the relevant roslyn bits (C# and VB) from the same
source. Only the msbuild specific files are copied to the Roslyn folder.
VBCSCompiler, csi and their dependencies are symlinked from `lib/mono/4.5`.

Also:

- csi.exe is included since the tool is surfaced as an msbuild task,
  and that requires the *Scripting.dll assemblies.
- VBCSCompiler* - shared compiler is installed
- vbc.exe doesn't work on mono currently, so skipping that
- And `Microsoft.DiaSymReader.Native.{amd64,x86}.dll` are dropped.

Cherry-picking 43cec6c0dd
2017-08-16 14:31:38 -04:00
Alexander Köplinger 4432d94f47 Bump bockbuild 2017-08-16 18:38:13 +02:00
Cody Russell 84a67e67e0 Bump bockbuild to get latest gtk patches (#5278) 2017-08-16 18:30:01 +02:00
Aleksey Kliger (λgeek) 3d2159b391 Merge pull request #5366 from lambdageek/bug-17325-2017-06
[2017-06][remoting] transparent proxy GetType of an interface should return the interface Type, not MarshalByRefObject. (Fixes #17325)
2017-08-14 17:41:38 -04:00
Alexander Köplinger 2cc5ff0ef3 Bump nuget to latest 4.3.0 release (#5368)
(cherry picked from commit a9a08890cb)
2017-08-14 19:30:00 +02:00
Alexis Christoforides ab5dc2d67e [MacSDK] Switch to HTTPS for downloading SQLite
(cherry picked from commit aa2ea3b812)
2017-08-14 19:29:23 +02:00
Alexander Köplinger b339b6677c Bump nuget-buildtasks (#5363)
Includes https://github.com/NuGet/NuGet.BuildTasks/pull/35

(cherry picked from commit e88178655b)
2017-08-14 17:54:37 +02:00
Aleksey Kliger a6db6112ca [remoting] transparent proxy GetType of an interface should return the
interface Type, not MarshalByRefObject. (Fixes #17325)

If a RealProxy instance is created (using the protected RealProxy(Type)
constructor) for an interface, mono internally sets up a MonoRemoteClass which
looks like a proxy for a MarshalByRefObject instance that happens to implement
the given interface.  However mono_class_proxy_vtable just does a memcpy() to
setup the MonoVTable:type field of the transparent proxy's vtable.  That type
field is hit by the JIT when System.Object.GetType() is called - and on .NET
Framework GetType for a transparent proxy of an interface returns the interface
not (as Mono used to) typeof(MarshalByRefObject).

Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=17325
2017-08-14 11:37:51 -04:00
Aleksey Kliger fd2303ecb6 [test] Add regression test for GetType() of a transparent proxy.
Check that calling GetType() on a transparent proxy of a RealProxy of an
interface returns that interface type.
2017-08-14 11:37:50 -04:00
Alexander Köplinger 490cc373e4 [System.ServiceProcess] Remove "browser" service from dependencies in test (#5183) (#5351)
LanmanWorkstation and SamSs services don't depend on the Browser
service anymore, at least in the Windows Server build that our
Azure VM agents on Jenkins are using now. This started failing a
few days ago so I assume a new build was rolled out.
(cherry picked from commit 1418f0d58b)
2017-08-10 19:26:39 +02:00
Ankit Jain b65d1a9ffc [msbuild] Bump to the d15.4 branch HEAD (#5342) 2017-08-09 11:46:41 -04:00
Zoltan Varga 8531639386 [runtime] Fix a case where klass->blittable was written without holding the loader locked. (#5331) 2017-08-08 16:36:39 -04:00
Jason Imison 25ef6061fd Merge pull request #5334 from mono/2017-06-fsharp-resources
Bump F# to 4.1.25
2017-08-08 12:54:47 +01:00
nosami 066fde97d3 Bump F# to 4.1.25 and remove already merged patches 2017-08-08 12:32:12 +01:00
Zoltan Varga 28a417c2c0 [btls] Disable BUILD_SHARED_LIBS while building boringssl, so its symbols are not exported from the btls shared lib. (#5307) 2017-08-04 11:39:52 -04:00
Marek Safar c97a3fcfd2 [mcs] Pending implementation of accessors cannot hide base implementation with different member type 2017-08-04 15:18:49 +02:00
Zoltan Varga 3acee7af00 [bcl] Fix Delegate.GetHashCode () so it takes into account the target too. Fixes #58399. (#5296) 2017-08-02 13:02:04 -04:00
Zoltan Varga b6cd01f017 [llvm] Fix the calling of fault clauses in llvm compiled code. Fixes #58446. (#5287) 2017-08-01 14:12:07 -04:00
Aleksey Kliger (λgeek) 67a2f14e73 Merge pull request #5289 from lambdageek/bug-58454-2017-06
[2017-06][sre] Pass declaring type to GetMethodFromHandle in GenericTypeParameterBuilder:InternalResolve (Fixes #58454)
2017-08-01 12:16:29 -04:00
Aleksey Kliger 8043db4c77 [sre] Pass declaring type to GetMethodFromHandle in
GenericTypeParameterBuilder:InternalResolve (Fixes #58454)

When the parameter belongs to a method builder, we need to pass the declaring
type (appropriately resolved) to GetMethodFromHandle to avoid an
ArgumentException.

Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=58454
2017-07-31 18:47:45 -04:00
Aleksey Kliger 252415606d [test] Check that GenericTypeParamBuilder:InternalResolve passes declaring type
to GetMethodFromHandle

Regression test for https://bugzilla.xamarin.com/show_bug.cgi?id=58454
2017-07-31 18:40:41 -04:00
Aleksey Kliger (λgeek) 50f2938561 Merge pull request #5275 from lambdageek/bug-58361-2017-06
[2017-06][sre] Resolve EnumBuilder tokens in managed (Fixes #58361)
2017-07-31 10:42:48 -04:00
Aleksey Kliger (λgeek) 6425f06ff6 Merge pull request #5277 from lambdageek/bug-58421-2017-06
[2017-06][sre] Handle typeref tokens in fixup_method (Fixes #58421)
2017-07-28 12:00:17 -04:00
Aleksey Kliger 485d5205f9 Bump corlib version
Due to changed semantics of ModuleBuilder:RegisterToken icall (it now does not
allow an EnumBuilder argument)
2017-07-28 11:58:51 -04:00
Aleksey Kliger 582c5d77f0 [sre] Resolve EnumBuilder tokens in managed. (Fixes #58361)
In particular, delegate to the TypeBuilder within the EnumBuilder.

Also do not register the EnumBuilder object with the runtime.  (Fixes
https://bugzilla.xamarin.com/show_bug.cgi?id=58361)
2017-07-28 11:58:51 -04:00
Marek Safar bda280c5e8 [mcs] Implements cloning for yield break. Fixes #57796 2017-07-28 11:14:42 +02:00
Aleksey Kliger 287f4303f3 [sre] Handle typeref tokens in fixup_method (Fixes #58421)
This may occur if there are two AssemblyBuilders in progress and one of them
refers to a TypeBuilder from the other.

https://bugzilla.xamarin.com/show_bug.cgi?id=58421
2017-07-27 18:07:27 -04:00
Aleksey Kliger 48d6bff3ae [test] Check that one AssemblyBuilder can refer to a TypeBuilder from another.
Regression test for https://bugzilla.xamarin.com/show_bug.cgi?id=58421
2017-07-27 18:07:26 -04:00
Aleksey Kliger ad6ef5f4bc [test] EnumBuilder regression tests for #58361
Cause the creation of a token for an EnumBuilder object.  Test both typedef
tokens (EnumBuilder from same assembly) and typeref token (EnumBuilder in another assembly)
2017-07-27 18:00:47 -04:00
Aleksey Kliger dd46212fc2 [sre] Add MonoDynamicImageTokCollision arg to mono_dynamic_image_register_token
The new argument controls what should happen when the given token is already
present.

In some situations it's expected that we either see the same object, or we
unconditionally want to replace it (for example if we previously registered a
TypeBuilder or a MethodBuilder, after the type or method is created, we will
re-register the RuntimeType or MonoMethod in its place).  In other cases (for
example when a module references a MonoMethod from a different assembly), we
may still call `mono_image_create_token()` multiple times but we expect to see
the same MonoMethod object.
2017-07-27 18:00:46 -04:00
Miguel de Icaza 41ecc70a69 [Marshal.IsComObject] Make this predicate return false instead of throwing an exception which is what the calling code expects (#5246) 2017-07-25 17:06:41 +02:00
Alexis Christoforides e9d3a69282 Update bockbuild. Fixes #57002 2017-07-25 01:27:58 -04:00
Zoltan Varga e7ce1807d7 [runtime] Fix the size calculation for CustomAttributeType coded indexes, they can only point to the MethodDef/MemberRef tables even through 3 bits are used to encode them, only 2 values are used. Fixes #58210. (#5256) 2017-07-24 23:21:08 -04:00
Zoltan Varga eb7e8d4af8 [jit] Handle OP_VCALL_MEMBASE in get_simd_vreg (). Fixes #58344. 2017-07-24 18:30:04 -04:00
Marek Safar 94651df9ed Bump roslyn to 2.3.1 2017-07-24 20:14:39 +02:00
Zoltan Varga d320c3a40a Bump bockbuild. 2017-07-24 13:53:04 -04:00
Zoltan Varga 97d59f280a Bump bockbuild. 2017-07-24 11:38:31 -04:00
Zoltan Varga 7f68119da8 [bockbuild] Avoid overwriting self.local_configure_flags in some packages, extend them instead. (#5249) 2017-07-22 02:23:36 -04:00
Bernhard Urban 9b3d1a60fc Merge pull request #5238 from lewurm/fix-aot-offset-dumper-2017-06
[2017-06][offset-tool] fix assignment for GeniOS
2017-07-19 15:40:19 +02:00
Bernhard Urban 75aeec5fb9 [offset-tool] fix assignment for GeniOS
fixes this compilation error

MonoAotOffsetsDumper.cs(279,59): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
2017-07-19 15:37:44 +02:00
Martin Baulig a625b98e26 [System.Net.Http]: Close request stream when HttpClientHandler.SendAsync() is done writing data. (#5226) (#5228)
(cherry picked from commit d1555c7c72)
2017-07-18 17:57:45 -04:00
Zoltan Varga 07ef3c251b [offsets-tool] Add a --gen-ios argument which can be used together with --targetdir= to generate ios offsets without having to specify the macos path. (#5218) 2017-07-17 18:55:22 -04:00
Alexander Köplinger fd85ac4fd1 [corlib] Preserve List<T>.ConvertAll in TypeTest (#5215)
TypeTest.GetGenericMethodDefinitionOverInflatedMethodOnGTD accesses
List<T>.ConvertAll() via reflection but doesn't use the method
elsewhere so the linker can remove it. Added some usage to avoid that.

Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=56242
(cherry picked from commit c4d38b54ad)
2017-07-16 01:49:28 +02:00
Zoltan Varga 667dcaa655 [llvm] Add support for fault clauses. Fixes #58114. (#5203) 2017-07-14 15:47:17 -04:00
Zoltan Varga d6ba1ed4fc [llvm] Reserve the proper number of got entries in the llvm got instead of 16 which used to be enough in the past. Hopefully fixes #56111. (#5207) 2017-07-14 15:46:57 -04:00
Aleksey Kliger (λgeek) 5b035af74a Merge pull request #5212 from lambdageek/bug-57691-2017-06
[metadata] Encode public key length correctly for keys longer than 128 bytes (Fixes #57691)
2017-07-14 15:08:02 -04:00
Aleksey Kliger b69e232073 [metadata] Encode public key length correctly for keys longer than 128 bytes
Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=57691

For keys longer than 1024 bits, we encoded the length incorrectly as
   0x80 (length & 0xff)
instead of the correct algorithm:
  if (length < 0x80)
    length
  else if (length < 0x4000)
    0x80|(length>>8) (length & 0xff)
  else
    0xc0|(length>>24) (length>>16)&0xff (length>>8)&0xff length&0xff

which is provided by mono_metadata_encode_value.

See ECMA-335 II.24.2.4 #US and #Blob heaps

N.B.: we now always allocate the memory for the key as (keylen + 4) which
over-allocates by a couple of bytes in the cases where the key is shorter.
2017-07-14 12:23:57 -04:00
Aleksey Kliger edd2d56a32 [tests] Add regression test for InternalsVisibleTo with long PublicKey
Regression test for https://bugzilla.xamarin.com/show_bug.cgi?id=57691

We build a library that has an InternalsVisibleTo attribute that references an
executable that is signed with a long (>128bytes) public key.  Previously we
were using an incorrect method of encoding the key length.
2017-07-14 12:10:47 -04:00
Aleksey Kliger d4d81a3e02 [tests] Use test runner for test-internalsvisibleto
Also add the source files to EXTRA_DIST
2017-07-14 12:10:46 -04:00
Johan Lorensson 1d1ec7d504 Incorrect parameters passed to GetDiskFreeSpaceEx causing random memory corruption. (#5196)
The call to GetDiskFreeSpaceEx passes uninitialized pointers to GetDiskFreeSpaceEx
instead of pointers to stack variables. This will cause random memory corruption and random
crashes on Windows builds.

This is a regression caused by the refactoring work done in this PR:

https://github.com/mono/mono/pull/4255
(cherry picked from commit 46bc4f393e)
2017-07-11 23:24:18 +02:00
Johan Lorensson 5fc8e28ffa Remove partial path for ml.exe and ml64.exe in mono VS runtime builds. (#5195)
Location of ml.exe and ml64.exe is different in VS2017 compared to VS2015.
By removing the partial path from the command, the VS environment will locate
the tool depending on selected build configuration and VS version.

This should work for both VS2015 and VS2017.
(cherry picked from commit 665d8d4141)
2017-07-11 15:21:54 +02:00
Marius Ungureanu de60f3b49e Merge pull request #5185 from mono/2017-06-gtk-bump
Bump bockbuild for gtk# API compat fixes.
2017-07-07 19:50:26 +03:00
Marius Ungureanu 7f560b39c8 Bump bockbuild for gtk# API compat fixes. 2017-07-07 19:49:52 +03:00
Zoltan Varga 73c2e4322e [arm64] Really fix handler block trampolines. 2017-07-07 01:12:24 -04:00
Zoltan Varga 13166f48a8 [arm] Fix the handler block trampoline, it didn't actually call the helper function. 2017-07-07 01:12:15 -04:00
Zoltan Varga e5b06307ca [runtime] Rework process waiting. (#5175)
Instead of using fragile lockless code in the sigchld signal handler, wake up the finalizer thread and make it call back
into the process code to signal finished processes.
2017-07-06 16:23:54 -04:00
Alexander Köplinger be1b671b09 [packaging] Add Windows hostfxr.dll to MSBuild in MSI
Part of https://bugzilla.xamarin.com/show_bug.cgi?id=57930

(cherry picked from commit f7c9be4890 and 727cf39986)
2017-07-06 02:06:22 +02:00
Zoltan Varga 817a7e7bf7 [sre] Fix the signature of the create_dynamic_method () icall, make it static since the C implementation only takes two parameters, this only caused problems if the icall set the error, since it overwrite the DynamicMethod object instead. Fixes #57301. (#5081) 2017-07-05 17:20:28 -04:00
Bernhard Urban 6279df6d70 Merge pull request #5168 from lewurm/interp-cherry-pick-aot-interp-2017-06
[2017-06][interp] add --aot=interp, so we can run `mono --full-aot --interpreter`
2017-07-05 12:01:51 +02:00
Zoltan Varga cbc419bb3e [jit] Optimize ldloc+ldfld operations for valuetypes, so they don't require making a copy of the valuetype. Hopefully fixes #56452. (#5166) 2017-07-04 13:08:25 -04:00
Zoltan Varga 39a8a8f8c0 Revert "[jit] Optimize ldloc+ldfld operations for valuetypes, so they don't require making a copy of the valuetype. Hopefully fixes #56452. (#5166)"
This reverts commit 00ef078380.

Revert this as it seems to break the f# build.
2017-07-04 10:09:09 -04:00
Bernhard Urban 3c9a821c7e [interp] add --aot=interp, so we can run mono --full-aot --interpreter 2017-07-04 11:27:44 +02:00
Ankit Jain bb900edab1 Revert "[packaging/msbuild] Bump to get new changes on xplat-master (#5146)"
This reverts commit 3505d310df.
2017-07-03 21:45:44 -04:00
Zoltan Varga 36e3d93a52 [jit] Use the right type when handling shared versions of RuntimeHelpers.IsReferenceOrContainsReferences (). The previous version only worked by accident. (#5160) 2017-07-03 17:43:04 -04:00
Zoltan Varga 4b49283a9c [jit] Fix mono_debug_count () so it doesn't confuse COUNT=0 with COUNT not being used. 2017-07-03 16:57:58 -04:00
Zoltan Varga 00ef078380 [jit] Optimize ldloc+ldfld operations for valuetypes, so they don't require making a copy of the valuetype. Hopefully fixes #56452. (#5166) 2017-07-03 16:57:44 -04:00
Ludovic Henry 0a3ea22257 Remove unrefing of handles on shutdown
If one of the handle is a file handle for example, then w32file has already be cleaned up, so we cannot guarantee that the handle we are going to close is not going to call into w32file code.
2017-06-30 16:09:04 -04:00
Aleksey Kliger (λgeek) 04419ee95b Merge pull request #5157 from lambdageek/bug-57850+57851-2017-06
[sre] Deal with ResolveEventHandler returning an AssemblyBuilder (Fixes #57850, #57851)

Fix a couple of bugs in the situation where a ResolveEventHandler happens to return an AssemblyBuilder.

#57850 - if the ResolveEventHandler returns a reflection only assembly, throw a FileNotFoundException
#57851 - don't look for a ReferenceAssemblyAttribute on assemblies returned by a ResolveEventHandler if they happen to be an AssemblyBuilder. (the native code path to get there is to try and instantiate a custom attribute in some other assembly, hence the fairly convoluted test in assemblyresolve_event5 and its helper files)
2017-06-30 13:33:23 -04:00
Aleksey Kliger fc339c2777 [loader] Don't try to look for ReferenceAssemblyAttribute on dynamic assemblies (Fixes #57851)
.NETFramework seems to ignore this custom attribute and allows instantiating
types from on assembly builders.
2017-06-30 10:23:22 -04:00
Aleksey Kliger 35b2b68bdf [loader] Throw exn if ResolveEventHandler returns a refonly assembly (Fixes #57850)
(Also depends on previous commit to ensure that MonoAssembly:refonly is set
correctly for dynamic assemblies)
2017-06-30 10:23:21 -04:00
Aleksey Kliger 009d1279a2 [sre] Mark AssemblyBuilderAccess.ReflectionOnly assemblies as refonly
This will ensure they show up in AppDomain.ReflectionOnlyGetAssemblies(), and
won't be allowed to execute
2017-06-30 10:23:20 -04:00
Aleksey Kliger d8eb6c91a2 [sre] use AssemblyBuilderAccess bitmask to set MonoDynamicImage flags
In particular this makes sure that AssemblyBuilderAccess.ReflectionOnly aren't
allowed to run.  And AssemblyBuilderAccess.CollectAndRun aren't allowed to save.
2017-06-30 10:23:19 -04:00
Aleksey Kliger d451def6a5 [sre] Add MonoAssemblyBuilderAccess enum in native code
in sync with System.Reflection.Emit.AssemblyBuilderAccess
2017-06-30 10:23:18 -04:00
Aleksey Kliger f95909190c [mono-error] Add mono_error_set_file_not_found
To throw System.IO.FileNotFoundException
2017-06-30 10:23:17 -04:00
Aleksey Kliger fc65bbe329 [tests] ResolveEventHandler that returns an AssemblyBuilder shouldn't crash mono
Regression test for https://bugzilla.xamarin.com/show_bug.cgi?id=57851
2017-06-30 10:23:16 -04:00
Aleksey Kliger eb6386af15 [tests] Throw an error if ResolveEventHandler returns a reflection only AssemblyBuilder
Regression test for https://bugzilla.xamarin.com/show_bug.cgi?id=57850
2017-06-30 10:23:15 -04:00
Aleksey Kliger 8236cbe950 [tests] Add some missing files to EXTRA_DIST 2017-06-30 10:23:14 -04:00
Ankit Jain 3505d310df [packaging/msbuild] Bump to get new changes on xplat-master (#5146)
cherry-pick 7f5c2b61fcf67cc47aa8b010b34da8039276afb6
2017-06-29 09:38:46 -04:00
Alexander Köplinger c0c8d0bec4 [packaging] Remove git_branch from msbuild and mono-extensions (#5141)
We're checking out a specific commit for both now so the git branch
is no longer required.

Also fixes warnings that a 2017-06 branch doesn't exist in mono-extensions.
(cherry picked from commit 6400a71595)
2017-06-28 19:43:07 +02:00
Jo Shields 3872a400b2 Manually invoke Xvfb, don't depend on the xvfb plugin (#5132)
(cherry picked from commit a12daa47e0)
2017-06-28 19:41:50 +02:00
Aleksey Kliger (λgeek) a6612b4c64 Merge pull request #5121 from lambdageek/bug-57744-2017-06
[reflection] Convert correct MonoError to an exn in Assembly.GetTypes() (Fixes #57744)
2017-06-27 10:45:31 -04:00
Ankit Jain 4db9028cb9 [packaging/msbuild] Bump to get new changes on xplat-master (#5127) (#5128)
cherry-pick 67f753a893
2017-06-27 01:03:22 -04:00
Aleksey Kliger b6e231d521 [reflection] Convert correct MonoError to an exn in Assembly.GetTypes () (Fixes #57744)
Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=57744
2017-06-26 16:24:59 -04:00
Alexander Köplinger 1ec5966c89 Bump API snapshot 2017-06-26 20:53:58 +02:00
Marius Ungureanu 9280bb5e19 [System.Core] Implement MemoryMappedFile.OpenExisting (#5118)
Reuse the existing icall infrastructure to give the same handle back.

This PR implements all OpenExisting methods (with the access rights parameter discarded) and the SafeHandle property.
In the runtime, we don't check the capacity parameter if we try to open a mmap file, and we fallthrough the handle refcount case.
2017-06-26 20:52:35 +02:00
Alexander Köplinger d470d1abbf [cil-strip] Move comment out of .sources file
I forgot that we only run gensources.sh on libraries but not
tools so the comments don't get stripped out...

(cherry picked from commit f892c7c574)
2017-06-26 19:19:41 +02:00
Alexander Köplinger 0e4d13f5b7 Revert "[cil-strip] Remove old private copy of Mono.Cecil"
(reverted from commit 4ea3122758)

(cherry picked from commit a8c53ebf16)
2017-06-26 12:36:47 +02:00
Alexander Köplinger 933ceae45c Revert "[cil-strip] Upgrade to latest Mono.Cecil API"
(reverted from commit 0c9eb70a46)

Using newer Cecil means metadata tokens will be different which
breaks AOT compilation: https://github.com/mono/mono/pull/5102#issuecomment-310801767

(cherry picked from commit f068fb6b66)
2017-06-26 12:36:43 +02:00
Ankit Jain 2f1b9e8aac [packaging/msbuild] Bump to get new changes on xplat-master (#5113) 2017-06-23 23:20:58 -04:00
Ludovic Henry f03dbfcae2 [System] Fix compilation on watchos (#5108) (#5111) 2017-06-23 19:34:34 -04:00
Alexander Köplinger d9211fcb50 [cil-strip] Remove old private copy of Mono.Cecil
No longer needed now that we're using the new Cecil.

(cherry picked from commit 4ea3122758)
2017-06-24 01:25:49 +02:00
Alexander Köplinger 153467c0c6 [cil-strip] Upgrade to latest Mono.Cecil API
This greatly simplifies the code and as a bonus also shaves off
about 300ms when stripping mscorlib.dll.

(cherry picked from commit 0c9eb70a46)
2017-06-24 01:25:46 +02:00
Vlad Brezae a1cac02732 [sgen] Performance improvement for ms_block_size computations
This reduces regressions for switching from MS_BLOCK_SIZE compile time constant
to ms_block_size variable by 85% on the tests where this was showing up. In the
future we should implement a block allocator, which would, amongst other benefits,
enable us to remove the block-size/page-size dependency.
2017-06-23 23:10:51 +03:00
Vlad Brezae 7be144c0b7 [sgen] Fix MS block size calculation.
The block size must be a multiple of the system page size. Page size simply
cannot be determined reliably at compile time, so we must obtain the page size
through a system call on startup and use it as the block size. We still enforce
a minimum block size of 16kb on systems where the page size is smaller than
that.

The old code hardcoded page sizes for certain architectures with large pages.
THe problem is that those architectures don't necessarily have to have large
pages and on systems where this wasn't the case, we'd end up with a block size
much larger than needed.

Rebase of @alexrp's work.
2017-06-23 23:10:38 +03:00
Alex Rønne Petersen 71936252fe [utils/mmap] Prefer sysconf () over getpagesize () in mono_pagesize ().
The former is async-signal-safe, while the latter makes no guarantees and also
isn't actually portable.
2017-06-23 23:10:14 +03:00
Marius Ungureanu ab0791102f Merge pull request #5105 from mono/2017-06-bump-bockbuild
Bump bockbuild
2017-06-23 19:08:19 +03:00
Marius Ungureanu be24ada60a Bump bockbuild 2017-06-23 19:06:45 +03:00
Ankit Jain 9c991786ac [packaging/msbuild] Bump to get new changes on xplat-master
cherry-picking c7b19b52fd
2017-06-23 02:20:14 -04:00
Ankit Jain 019a83f88f [packaging/msbuild] Update commit hash to point to xplat-master HEAD
cherry-pick 4f7b15520d09843c1c0668f9fa4924f3cccb7398 from master
2017-06-22 21:36:41 -04:00
Rodrigo Kumpera 33697c0568 Merge pull request #5096 from kumpera/backport-5095
[aot] Fix the name of the mono_gc_wbarrier_range_copy icall. Backport of #5095
2017-06-22 14:59:28 -07:00
Rodrigo Kumpera fbb82d3923 [aot] Fix the name of the mono_gc_wbarrier_range_copy icall. FullAOT with direct calls requires it. 2017-06-22 14:58:06 -07:00
Rodrigo Kumpera 733b51587e Merge pull request #5085 from kumpera/backport-5082
Back port of #5082 (unlink bug on RO file systems)
2017-06-21 16:34:14 -04:00
Alexander Köplinger f66e71e01b [packaging] Move Windows MSI scripts into repository
They lived in https://github.com/mono/release before, moving them
into the main repo allows us to version them more easily.

Note: I intend to do more cleanup on those scripts in the future,
this is just the first step.

(cherry picked from commit a4d6fccef9)

[packaging] Simplify Windows packaging scripts

We don't need to build in a separate checkout of mono anymore.
Also use .pkg passed in from upstream build.

(cherry picked from commit 69f8abf794)

[packaging] Fix path to wrapper.bat for Windows MSI

(cherry picked from commit 27bf99ebed)

[ci] Get rid of remaining usages of WORKSPACE env var

Most of it was already removed in ea519ada8c

(cherry picked from commit 00f7811683)

[packaging] Exit Windows packaging script on error

Also quote passed in mdk path.

(cherry picked from commit b85f34d763)

[packaging] Remove msiexec prerequisite from Windows script

We're using lessmsi now.

(cherry picked from commit 348ec2cf7a)

[packaging] Fix prerequisite in Windows script

(cherry picked from commit 7f28de8559)

[packaging] Fix wrong argument in Windows script

(cherry picked from commit acf546b1ba)

[packaging] Add missing .pc files to Windows folder

It got accidentally ignored by the root .gitignore.

(cherry picked from commit 581b46d90d)

[packaging] Add back IronLangs to Windows MSI

It was just temporarily removed from the Mac package to work around
a build break. This was fixed so we need to add iron* back.

(cherry picked from commit 6c6ab73705)

[packaging] Add a few missing msbuild files to Windows MSI

(cherry picked from commit 68130ebec9)

[packaging] Add a few more missing files to Windows MSI

Also add a safeguard so we don't accidentally leave files with
OSX paths in the package.

(cherry picked from commit dbaab5d01a)
2017-06-21 20:32:55 +02:00
Rodrigo Kumpera 262128c941 [runtime] Update comment with link to Linux Kernel fix. 2017-06-21 10:47:22 -07:00
Rodrigo Kumpera eeb68ca307 [io-layer] When deleting a file, check for EROFS and verify if the file exists. Fixes #57629.
Linux has this particular behavior of returning ENOFS when unlinking from an read only FS.
Even if the file doesn't exists! Darwin does the sane thing and return ENOENT in this case.

To workaround this, if unlink returns EROFS, we stat the file and deal with that.
2017-06-21 10:47:19 -07:00
Marek Safar 6471bbd6ef [mcs] Add missing vector cloning of definite assignment on-true. Fixes #57505 2017-06-21 15:14:39 +02:00
Marek Safar 96a2b36e82 [mcs] Fixes regression introduced by a0fc3f4dcf to consider user set values. Fixes #57242 2017-06-21 00:15:29 +02:00
Marek Safar 7a704f61c9 Bump roslyn to 2.3 beta 2 2017-06-20 23:22:10 +02:00
Bernhard Urban 39150458f0 Merge pull request #5074 from lewurm/x509-temp-file-fix-2017-06
[2017-06][bcl tests] do not attempt to delete non-existing files
2017-06-20 17:13:56 +02:00
Bernhard Urban 0b522087c2 [bcl tests] do not attempt to delete non-existing files
This fixes an issue we see on the BCL test suite when run in the context
of Xamarin Android:

```
I/mono-stdout( 2534):     Certificate1 [FAIL] : TearDown : System.UnauthorizedAccessException : Access to the path "temp.b64" is denied.
```

It seems like those files aren't generated anymore.  Not sure why this
starts to be a problem now.
2017-06-20 16:37:16 +02:00
Aleksey Kliger (λgeek) 911cc1d438 Merge pull request #5060 from lambdageek/tbt-2017-06
[2017-06][tests] Rework TypeBuilderTest SetUp/TearDown
2017-06-19 15:41:37 -04:00
Zoltan Varga e4b08aa7c9 [arm64] Remove an assert which is hit when mono_arch_get_call_target () is called with a 'b' instead of a 'bl'. 2017-06-19 14:34:53 -04:00
Aleksey Kliger 2db07ca754 [tests] Don't run SRE saved assembly in current process
Windows doesn't like deleting the file, and the original bug was a problem in
SRE, not in the AssemblyBuilder.Save ()
2017-06-19 12:04:21 -04:00
Alexander Köplinger 0d8219ea4a [MacSDK] Bump msbuild 2017-06-19 15:15:08 +02:00
Alexander Köplinger a38a8e4ad4 Bump API snapshot 2017-06-19 13:53:54 +02:00
Zoltan Varga d0b9d91817 [arm64] Fix the patching of MONO_PATCH_INFO_METHOD_JUMP so it handles thunks properly. Allocate thunk space for tail calls. Fixes asserts in the System.Numerics xunit tests. (#5026) 2017-06-18 17:34:55 -04:00
Aleksey Kliger fd6d8198f7 [tests] Rework TypeBuilderTest SetUp/TearDown
- Create a unique temporary directory for each test in TypeBuilderTest and delete
  it on TearDown.

- Change tests to use tempDir instead of Path.GetTempPath ()

- Change IsSerializable () test to how it was 11 years ago and have it write to a
  file with a simple name (but now in a directory where noone else is writing)

- Change FieldsWithSameName (), FieldsWithSameNameAndType () and
  MethodsWithSameNameAndSig () to use the default temp assembly (now in a
  unique tempDir) instead of using the CreateTempAssembly ()

- Remove CreateTempAssembly function. It is dead code.
2017-06-16 20:02:27 -04:00
Ankit Jain 54260048cc [packaging/msbuild] Update commit hash to point to xplat-master HEAD (#5046) 2017-06-15 14:04:15 -04:00
Marek Safar 34ba13146f Bump cecil 2017-06-15 19:02:56 +02:00
Bernhard Urban 00ea5f1e17 Revert "[exceptions] only do SIGSEGV related actions for SIGSEGVs in mono_handle_native_crash" (#5028)
This reverts commit a27bc024f1.

We never want the crash handler to be recursive.
2017-06-14 18:05:41 -04:00
Aleksey Kliger (λgeek) e75b24b807 Merge pull request #5033 from lambdageek/fix-strict-loader-image-cache-hit-2017-06
[2017-06][loader] If using strict strong names, recheck loaded assm before returning it.
2017-06-14 14:18:08 -04:00
Aleksey Kliger ecf65f0093 [loader] If using strict strong names, recheck loaded assm before returning it.
Suppose we have two versions of an assembly: AsmA 1.0.0.0 and AsmA 2.0.0.0 that
we want to load into the same domain at the same time (for example we want to
load AsmB and AsmC that statically reference the two versions, respectively, or
maybe we used reflection).  Suppose version 1 got loaded first (and we found it
on our MONO_PATH in "somepathdir/AsmA.dll").  Now we want to load version 2.
The problem is that if version 1 is on MONO_PATH first, we'll find a filename
that matches ("somepathdir/AsmA.dll") and try to open that image.  Then we'll
end up here in mono_assembly_open_predicate() after the mono_image_open_a_lot()
call hits the image cache.  So we get back an image and image->assembly is
version 1.

The old behavior would just return any non-NULL image->assembly.  The new
behavior is to check the predicate and reject opening the propose file if the
predicate doesn't match.  (If we're not using the strict loader, or if there's
no predicate set, return the existing image->assembly as before).
2017-06-13 19:41:36 -04:00
Aleksey Kliger 35cb8bac8a [tests] Strict assembly loading of two version of the same assm should work.
In particular, we should be able to use classes/methods that are unique to each
version.  We should not get only one version loaded.
2017-06-13 19:41:35 -04:00
Alexander Köplinger 33074493a0 [MacSDK] Remove quotes in nuget wrapper script
None of the other wrapper scripts quote the Mono path and this
broke the Windows packaging script which extracts nuget from the
Mac package.

(cherry picked from commit 258efac3c6)
2017-06-14 00:47:07 +02:00
Marius Ungureanu c5d7419186 Bump bockbuild (#5024) 2017-06-13 20:52:32 +02:00
Alexander Köplinger ccf4d32e12 Bump API snapshot 2017-06-13 02:47:59 +02:00
Alexander Köplinger 89014568b7 Fix System.Numerics xunit tests and add them to CI (#5006)
* Fix System.Numerics xunit tests and add them to CI

Xunit.Extensions.NetCore.dll is available as a net46 version now
so we can just use it instead of building it from our buildtools fork.
This also allows us to remove the fork from our submodules.

We were missing running the System.Numerics xunit tests in CI,
this adds them so we catch breaks like these earlier.

* Skip tests on Windows, they seem to fail there

(cherry picked from commit 1890aa6ec3)
2017-06-13 02:35:13 +02:00
Bernhard Urban 9161e4e5a9 Merge pull request #4999 from lewurm/marshal-string-dummy-2017-06
[2017-06][marshal] allocate dummy string always in root domain
2017-06-12 19:09:17 +02:00
Rodrigo Kumpera 6ac4a68c46 Merge pull request #5007 from kumpera/backport_56684
[corlib] Don't pass RuntimeMethodHandle across domains. Fixes #56684
2017-06-12 10:07:33 -07:00
Martin Baulig 1b5e0f7331 [System]: Correctly implement close and shutdown in SslStream. (#4969) (#5008)
* [System]: Correctly implement close and shutdown in SslStream.

* Cleanup.

* Cosmetic.

* More ReferenceSources/SR2.cs into common.sources to make it build.

(cherry picked from commit 21d5c9c346)
2017-06-12 12:59:01 -04:00
Marek Safar c8863e1d31 [mcs] C#7 type pattern matching 2017-06-12 17:06:26 +02:00
Marek Safar dd951e909a [mcs] Better detection of null operator inside conditional expression. Fixes #57232 2017-06-12 17:04:08 +02:00
Aleksey Kliger (λgeek) 3c21a0f3dd Merge pull request #5004 from lambdageek/bug-57222-2017-06
[sre] FieldBuilder:RuntimeResolve shouldn't lookup by name (Fixes #57222)
2017-06-12 10:52:01 -04:00
Rodrigo Kumpera f031c8fba3 [corlib] Don't pass RuntimeMethodHandle across domains. Fixes #56684
We can't pass RuntimeMethodHandle across AppDomains since that can lead to memory corruption.

The way this happens is that when Domain (A) passes a method handle (M) to Domain (B), (B) will get the reflection object for
which will add that MonoMethod to the per-domain reflection hashtable. This won't cause the assembly of (M) to be registered with (B).

When (A) is unloaded, it might be the only domain referencing the assembly of (M), cause it to unload resulting in (B) having a dangling
pointer to (M) on its reflection hashtable.

The fix is to serialize enough lookup data across the wire so we can do type/method lookup using reflection on the target domain.
It might be slower, but this only happens on some remoting slowpaths anyways.

Finally, we can't simply register the assembly of (M) into domain (B) as that list (MonoDomain::domain_assemblies) is used for type loading,
thus breaking the target domain in some scenarios.
2017-06-09 11:46:41 -07:00
Aleksey Kliger 442d000b6c [test] Test SRE of a class with two methods with the same name.
Regression test for https://bugzilla.xamarin.com/show_bug.cgi?id=57222

Although methods aren't affected by this bug, I added a regression test for
this case anyway in case the implementation changes.

Currently MethodBuilder.RuntimeResolve() goes through a different codepath - it
calls RuntimeType.GetMethod (MethodInfo) which calls into an icall which looks
for a method with a matching token rather than a matching name.
2017-06-09 13:15:27 -04:00
Aleksey Kliger 2cdb7e8648 [sre] FieldBuilder:RuntimeResolve shouldn't lookup by name. (Fixes #57222)
RuntimeType:GetField (FieldInfo) looks up the field by name and attributes,
which doesn't work for SRE because it is legal to create multiple fields with
the same name and type and attributes.  So lookup using the
RuntimeFieldHandle (aka MonoClassField*) instead.
2017-06-09 13:15:26 -04:00
Aleksey Kliger e72203782b [test] Test SRE of a class with two fields with same name
Regression test for https://bugzilla.xamarin.com/show_bug.cgi?id=57222
2017-06-09 13:15:25 -04:00
Bernhard Urban 00e3c897d5 [marshal] allocate dummy string always in root domain
otherwise it can happen that the dummy string is allocated in a
different domain, and when it's onloaded the GC root points to an
invalid object.
2017-06-09 12:51:02 +02:00
Bernhard Urban 52a5acbd88 Merge pull request #4992 from lewurm/interp-aot-mode-2017-06
[2017-06][interp] add MONO_AOT_MODE_INTERP
2017-06-09 12:29:40 +02:00
Bernhard Urban 778e04f2d9 [win] set HAVE_ONLINE_VES 2017-06-08 17:22:55 +02:00
Alexander Köplinger 93ecaeb2c6 [MacSDK] Bump libgdiplus to latest (#4984)
We were using a very old commit of libgdiplus. This brings in
the latest changes.
(cherry picked from commit 1d6a8ed6ea)
2017-06-08 14:22:00 +02:00
Bernhard Urban 49df11fd5f [interp] provide stub for icall_trampoline for x86 and ppc
keep the linker happy
2017-06-08 00:11:05 +02:00
Bernhard Urban c8c8b16bfd [interp] root domain must be used for AOT'd wrappers used by interpreter 2017-06-08 00:11:05 +02:00
Bernhard Urban 6f83951d1c [interp aot] documentation 2017-06-08 00:11:04 +02:00
Bernhard Urban f2ae4658f9 [marshal] some things are required in the interpreter despite DISABLE_JIT 2017-06-08 00:11:03 +02:00
Bernhard Urban faf4fe66af [configure] introduce HAVE_ONLINE_VES 2017-06-08 00:11:03 +02:00
Bernhard Urban 998759345f [interp] fix when DISABLE_JIT is set 2017-06-08 00:11:02 +02:00
Bernhard Urban c88d2cce1f [interp] add InterpMethodArguments struct to offset-tool 2017-06-08 00:11:01 +02:00
Bernhard Urban 3e589e2c39 [interp] add MONO_AOT_MODE_INTERP 2017-06-08 00:11:00 +02:00
Martin Baulig 4c944bc86e [System]: Actually disable the keychain code and SecItemImport() on XI. (#4983) (#4988)
(cherry picked from commit fff41905e9)
2017-06-07 14:32:20 -04:00
Bernhard Urban d3e6c9d17f Merge pull request #4989 from baulig/work-4987-merge
[System]: Fix possible initialization issue in MonoTlsProviderFactory. (#4987)
2017-06-07 19:37:22 +02:00
Martin Baulig 7379ac1bfb Cosmetic; remove [Category ("Martin")] from the test.
(cherry picked from commit dc58d950f2)
2017-06-07 11:55:11 -04:00
Martin Baulig 2a029615aa [System]: Fix possible initialization issue in MonoTlsProviderFactory. (#4987)
* [Mono.Security]: Add test for MonoTlsProviderFactory.GetProvider ().

* [System]: Fix possible initialization issue in MonoTlsProviderFactory.

(cherry picked from commit 83f74c4123)
2017-06-07 11:46:58 -04:00
Marek Safar 9c345b1b02 [mcs] C#7 out variable declaration 2017-06-07 16:55:13 +02:00
Alexander Köplinger 074a1228cf [MacSDK] Update version number in msbuild.py
(cherry picked from commit 9b63661c15)
2017-06-06 23:04:06 +02:00
Bernhard Urban e3596928d8 [mini] set MONO_ARCH_HAVE_INIT_LMF_EXT on architectures that implement mono_arch_init_lmf_ext
it worked before, because we relied on implicit linking
2017-06-06 21:07:18 +02:00
Bernhard Urban ac71acfd52 [mini] guard mono_arch_init_lmf_ext prototype properly 2017-06-06 19:16:05 +02:00
Bernhard Urban 8909c17d9c [arm] don't set MONO_ARCH_SOFT_DEBUG_SUPPORTED on android cross compiling
follow up fix for https://github.com/mono/mono/pull/4956

this breaks the cross compiler on windows for android:

```
  [9:07:36]                       /bin/sh ../../libtool  --tag=CC   --mode=compile /Users/builder/android-toolchain/mxe/bin/i686-w64-mingw32.static-gcc -DHAVE_CONFIG_H -I. -I/U  sers/builder/data/lanes/5000/ff452183/source/xamarin-android/external/mono/mono/mini -I../..   -DWINVER=0x0600 -D_WIN32_WINNT=0x0600 -D_WIN32_IE=0x0501 -D_UNICODE -DUNICODE -  DWIN32_THREADS -DFD_SETSIZE=1024 -g -Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes  -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wno  -cast-qual -Wwrite-strings -Wno-switch -Wno-switch-enum -Wno-unused-value -Wno-attributes -Wno-format-zero-length -D__ARM_EABI__ -DARM_FPU_VFP=1 -DNO_UNALIGNED_ACCESS -I/User  s/builder/data/lanes/5000/ff452183/source/xamarin-android/external/mono -I/Users/builder/data/lanes/5000/ff452183/source/xamarin-android/external/mono/eglib/src -I../../eglib  /src -I/Users/builder/data/lanes/5000/ff452183/source/xamarin-android/build-tools/mono-runtimes/obj/Release//llvm/installed-win32/usr/include -DNDEBUG -D__NO_CTYPE_INLINE -D_  GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DLLVM_API_VERSION=4 -O -I../arch/arm -fvisibility=hidden -DXAMARIN_PRODUCT_VERSION=0 -static   -static-libgcc -std=gnu99 -fno-strict-aliasing -fwrapv -DMONO_DLL_EXPORT -Wno-unused-but-set-variable -g -Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wstrict-  prototypes  -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wno-cast-qual -Wwrite-strings -Wno-switch -Wno-switch-enum -Wno-unused-value -Wno-attributes -Wno-format-ze  ro-length -mno-tls-direct-seg-refs -Werror-implicit-function-declaration -MT libmini_la-mini-arm-gsharedvt.lo -MD -MP -MF .deps/libmini_la-mini-arm-gsharedvt.Tpo -c -o libmin  i_la-mini-arm-gsharedvt.lo `test -f 'mini-arm-gsharedvt.c' || echo '/Users/builder/data/lanes/5000/ff452183/source/xamarin-android/external/mono/mono/mini/'`mini-arm-gsharedv  t.c
  [9:07:36]                       /Users/builder/data/lanes/5000/ff452183/source/xamarin-android/external/mono/mono/mini/mini-arm.c: In function 'mono_arch_is_single_step_event  ':
  [9:07:36]                       /Users/builder/data/lanes/5000/ff452183/source/xamarin-android/external/mono/mono/mini/mini-arm.c:7242:2: error: unknown type name 'siginfo_t'
  [9:07:36]                         siginfo_t *sinfo = info;
  [9:07:36]                         ^
  [9:07:36]                       /Users/builder/data/lanes/5000/ff452183/source/xamarin-android/external/mono/mono/mini/mini-arm.c:7248:11: error: request for member 'si_addr'   in something not a structure or union
  [9:07:36]                         if (sinfo->si_addr >= ss_trigger_page && (guint8*)sinfo->si_addr <= (guint8*)ss_trigger_page + 128)
  [9:07:36]                                  ^
  [9:07:36]                       /Users/builder/data/lanes/5000/ff452183/source/xamarin-android/external/mono/mono/mini/mini-arm.c:7248:57: error: request for member 'si_addr'   in something not a structure or union
  [9:07:36]                         if (sinfo->si_addr >= ss_trigger_page && (guint8*)sinfo->si_addr <= (guint8*)ss_trigger_page + 128)
  [9:07:36]                                                                                ^
  [9:07:36]                       /Users/builder/data/lanes/5000/ff452183/source/xamarin-android/external/mono/mono/mini/mini-arm.c: In function 'mono_arch_is_breakpoint_event'  :
  [9:07:36]                       /Users/builder/data/lanes/5000/ff452183/source/xamarin-android/external/mono/mono/mini/mini-arm.c:7262:2: error: unknown type name 'siginfo_t'
  [9:07:36]                         siginfo_t *sinfo = info;
  [9:07:36]                         ^
  [9:07:36]                       /Users/builder/data/lanes/5000/ff452183/source/xamarin-android/external/mono/mono/mini/mini-arm.c:7267:11: error: request for member 'si_signo  ' in something not a structure or union
  [9:07:36]                         if (sinfo->si_signo == DBG_SIGNAL) {
  [9:07:36]                                  ^
  [9:07:36]                       /Users/builder/data/lanes/5000/ff452183/source/xamarin-android/external/mono/mono/mini/mini-arm.c:7269:12: error: request for member 'si_addr'   in something not a structure or union
  [9:07:36]                          if (sinfo->si_addr >= bp_trigger_page && (guint8*)sinfo->si_addr <= (guint8*)bp_trigger_page + 128)
  [9:07:36]                                   ^
  [9:07:36]                       /Users/builder/data/lanes/5000/ff452183/source/xamarin-android/external/mono/mono/mini/mini-arm.c:7269:58: error: request for member 'si_addr'   in something not a structure or union
  [9:07:36]                          if (sinfo->si_addr >= bp_trigger_page && (guint8*)sinfo->si_addr <= (guint8*)bp_trigger_page + 128)
```
2017-06-06 19:16:05 +02:00
Marek Safar e5d16f01fd Bump corefx 2017-06-06 16:11:32 +02:00
Marek Habersack 9874928b85 Use correct path separator for satellite assemblies in cross builds (#4976)
When creating a bundle on Windows to run on Android, macOS/iOS or Linux we need
to use the target system's path separator when storing satellite assemblies in
the bundle instead of the host system's one. Failing to do so will embed (on
Windows) the satellite assemblies with paths like

   fr_FR\myassembly.resources.dll

while at runtime Mono will try to look up the assembly by

   fr_FR/myassembly.resources.dll

and fail to find it, obviously. The `--style` parameter is now consulted to see
what path separator character should be used.

Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=55603
2017-06-06 16:07:54 +02:00
Marek Safar 9e99e20001 [mcs] Remove unwanted tests 2017-06-05 20:56:38 +02:00
Ludovic Henry b3e79ebc05 Bump to 5.4 for 2017-06 branch (#4971) 2017-06-05 14:05:27 -04:00
Alexander Köplinger d30c17f44e Revert "[marshal] delay dummy string allocation"
Reverts 5e23a773b4

It seems to cause a crash during msbuild tests:

```
  xunit -> Microsoft.Build.Engine.UnitTests...
  Stacktrace:

  Native stacktrace:

  	0   mono                                0x0017cad4 mono_handle_native_crash + 308
  	1   mono                                0x001e2b03 sigabrt_signal_handler + 147
  	2   libsystem_platform.dylib            0x920a8deb _sigtramp + 43
  	3   ???                                 0xffffffff 0x0 + 4294967295
  	4   libsystem_c.dylib                   0x940bb27c abort + 155
  	5   mono                                0x0036886d mono_log_write_logfile + 381
  	6   mono                                0x003630d2 structured_log_adapter + 50
  	7   mono                                0x00380d1b monoeg_assertion_message + 107
  	8   mono                                0x0033863d major_scan_object_with_evacuation + 3373
  	9   mono                                0x0033b3d0 drain_gray_stack + 6608
  	10  mono                                0x0032df57 finish_gray_stack + 151
  	11  mono                                0x0032d3c6 major_finish_collection + 118
  	12  mono                                0x00329909 major_do_collection + 169
  	13  mono                                0x003288bd sgen_perform_collection + 605
  	14  mono                                0x0032a90b sgen_gc_collect + 75
  	15  mono                                0x002d5c4d unload_thread_main + 861
  	16  mono                                0x002abb6b start_wrapper + 795
  	17  libsystem_pthread.dylib             0x9ae6d5fb _pthread_body + 144
  	18  libsystem_pthread.dylib             0x9ae6d485 _pthread_struct_init + 0
  	19  libsystem_pthread.dylib             0x9ae72cf2 thread_start + 34

  Debug info from gdb:

  (lldb) command source -s 0 '/tmp/mono-gdb-commands.2tso9f'
  Executing commands in '/tmp/mono-gdb-commands.2tso9f'.
  (lldb) process attach --pid 2037
  2017-06-02 13:07:23.000 lldb[2093:282f] Metadata.framework [Error]: couldn't get the client port
  Process 2037 stopped
  * thread #1, name = 'tid_507', queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
      frame #0: 0x923cc7ca libsystem_kernel.dylib`__psynch_cvwait + 10
  libsystem_kernel.dylib`__psynch_cvwait:
  ->  0x923cc7ca <+10>: jae    0x923cc7da                ; <+26>
      0x923cc7cc <+12>: calll  0x923cc7d1                ; <+17>
      0x923cc7d1 <+17>: popl   %edx
      0x923cc7d2 <+18>: movl   0xe0b084f(%edx), %edx

  Executable module set to "/Users/builder/data/lanes/2716/mono-mac-sdk/external/bockbuild/stage/bin/mono".
  Architecture set to: i386-apple-macosx.
  (lldb) thread list
  Process 2037 stopped
  * thread #1: tid = 0x530e96a, 0x923cc7ca libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'tid_507', queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
    thread #2: tid = 0x530e96b, 0x923cc7ca libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'SGen worker'
    thread #3: tid = 0x530e96c, 0x923cc7ca libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'SGen worker'
    thread #4: tid = 0x530e96d, 0x923c7fb6 libsystem_kernel.dylib`semaphore_wait_trap + 10, name = 'Finalizer'
    thread #5: tid = 0x530e96e, 0x923cd992 libsystem_kernel.dylib`kevent64 + 10, queue = 'com.apple.libdispatch-manager'
    thread #6: tid = 0x530ea26, 0x923ccace libsystem_kernel.dylib`__select + 10, name = 'tid_5a03'
    thread #7: tid = 0x530edf1, 0x923cc7ca libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'tid_4007'
    thread #8: tid = 0x530edf2, 0x923cc7ca libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'Threadpool worker'
    thread #9: tid = 0x530edf3, 0x923cc7ca libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'Threadpool worker'
    thread #10: tid = 0x530edf4, 0x923ccff2 libsystem_kernel.dylib`__wait4 + 10, name = 'Domain unloader'
  (lldb) thread backtrace all
  * thread #1, name = 'tid_507', queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
    * frame #0: 0x923cc7ca libsystem_kernel.dylib`__psynch_cvwait + 10
      frame #1: 0x9ae6fd1d libsystem_pthread.dylib`_pthread_cond_wait + 728
      frame #2: 0x9ae71bd9 libsystem_pthread.dylib`pthread_cond_wait$UNIX2003 + 71
      frame #3: 0x00361ea9 mono`mono_os_event_wait_multiple + 505
      frame #4: 0x00361ca5 mono`mono_os_event_wait_one + 53
      frame #5: 0x00376b49 mono`mono_thread_info_wait_one_handle + 41
      frame #6: 0x002d51b5 mono`mono_domain_try_unload + 485
      frame #7: 0x002d4f6a mono`ves_icall_System_AppDomain_InternalUnload + 90
      frame #8: 0x05bf9ee0
      frame #9: 0x018ce01d mscorlib.dll.dylib`System_AppDomain_Unload_System_AppDomain + 45
      frame #10: 0x05bf9d60
      frame #11: 0x05bf9ccc
      frame #12: 0x05bf9d04
      frame #13: 0x05bf9c90
      frame #14: 0x05bf996d
      frame #15: 0x02e7d171
      frame #16: 0x005c26d4
      frame #17: 0x005b6878
      frame #18: 0x005b6b7a
      frame #19: 0x000c38a8 mono`mono_jit_runtime_invoke + 1592
      frame #20: 0x002e43fe mono`do_runtime_invoke + 94
      frame #21: 0x002e7de3 mono`do_exec_main_checked + 147
      frame #22: 0x002e69a5 mono`mono_runtime_run_main_checked + 69
      frame #23: 0x0013b687 mono`mono_jit_exec + 311
      frame #24: 0x0013e2b2 mono`mono_main + 10114
      frame #25: 0x000b22db mono`main + 2011
      frame #26: 0x000b1af5 mono`start + 53
    thread #2, name = 'SGen worker'
      frame #0: 0x923cc7ca libsystem_kernel.dylib`__psynch_cvwait + 10
      frame #1: 0x9ae6fd1d libsystem_pthread.dylib`_pthread_cond_wait + 728
      frame #2: 0x9ae71bd9 libsystem_pthread.dylib`pthread_cond_wait$UNIX2003 + 71
      frame #3: 0x0035f0e9 mono`thread_func + 249
      frame #4: 0x9ae6d5fb libsystem_pthread.dylib`_pthread_body + 144
      frame #5: 0x9ae6d485 libsystem_pthread.dylib`_pthread_start + 130
      frame #6: 0x9ae72cf2 libsystem_pthread.dylib`thread_start + 34
    thread #3, name = 'SGen worker'
      frame #0: 0x923cc7ca libsystem_kernel.dylib`__psynch_cvwait + 10
      frame #1: 0x9ae6fd1d libsystem_pthread.dylib`_pthread_cond_wait + 728
      frame #2: 0x9ae71bd9 libsystem_pthread.dylib`pthread_cond_wait$UNIX2003 + 71
      frame #3: 0x0035f0e9 mono`thread_func + 249
      frame #4: 0x9ae6d5fb libsystem_pthread.dylib`_pthread_body + 144
      frame #5: 0x9ae6d485 libsystem_pthread.dylib`_pthread_start + 130
      frame #6: 0x9ae72cf2 libsystem_pthread.dylib`thread_start + 34
    thread #4, name = 'Finalizer'
      frame #0: 0x923c7fb6 libsystem_kernel.dylib`semaphore_wait_trap + 10
      frame #1: 0x002dbeb6 mono`finalizer_thread + 278
      frame #2: 0x002abb6b mono`start_wrapper + 795
      frame #3: 0x9ae6d5fb libsystem_pthread.dylib`_pthread_body + 144
      frame #4: 0x9ae6d485 libsystem_pthread.dylib`_pthread_start + 130
      frame #5: 0x9ae72cf2 libsystem_pthread.dylib`thread_start + 34
    thread #5, queue = 'com.apple.libdispatch-manager'
      frame #0: 0x923cd992 libsystem_kernel.dylib`kevent64 + 10
      frame #1: 0x91b5c899 libdispatch.dylib`_dispatch_mgr_invoke + 238
      frame #2: 0x91b5c532 libdispatch.dylib`_dispatch_mgr_thread + 52
    thread #6, name = 'tid_5a03'
      frame #0: 0x923ccace libsystem_kernel.dylib`__select + 10
      frame #1: 0x0036df29 mono`mono_poll + 409
      frame #2: 0x002b482f mono`poll_event_wait + 111
      frame #3: 0x002b345f mono`selector_thread + 1439
      frame #4: 0x002abb6b mono`start_wrapper + 795
      frame #5: 0x9ae6d5fb libsystem_pthread.dylib`_pthread_body + 144
      frame #6: 0x9ae6d485 libsystem_pthread.dylib`_pthread_start + 130
      frame #7: 0x9ae72cf2 libsystem_pthread.dylib`thread_start + 34
    thread #7, name = 'tid_4007'
      frame #0: 0x923cc7ca libsystem_kernel.dylib`__psynch_cvwait + 10
      frame #1: 0x9ae6fd1d libsystem_pthread.dylib`_pthread_cond_wait + 728
      frame #2: 0x9ae71c25 libsystem_pthread.dylib`pthread_cond_timedwait$UNIX2003 + 71
      frame #3: 0x003760f3 mono`mono_thread_info_sleep + 979
      frame #4: 0x002b1a86 mono`monitor_thread + 262
      frame #5: 0x002abb6b mono`start_wrapper + 795
      frame #6: 0x9ae6d5fb libsystem_pthread.dylib`_pthread_body + 144
      frame #7: 0x9ae6d485 libsystem_pthread.dylib`_pthread_start + 130
      frame #8: 0x9ae72cf2 libsystem_pthread.dylib`thread_start + 34
    thread #8, name = 'Threadpool worker'
      frame #0: 0x923cc7ca libsystem_kernel.dylib`__psynch_cvwait + 10
      frame #1: 0x9ae6fd1d libsystem_pthread.dylib`_pthread_cond_wait + 728
      frame #2: 0x9ae71c25 libsystem_pthread.dylib`pthread_cond_timedwait$UNIX2003 + 71
      frame #3: 0x002b12e0 mono`worker_thread + 1024
      frame #4: 0x002abb6b mono`start_wrapper + 795
      frame #5: 0x9ae6d5fb libsystem_pthread.dylib`_pthread_body + 144
      frame #6: 0x9ae6d485 libsystem_pthread.dylib`_pthread_start + 130
      frame #7: 0x9ae72cf2 libsystem_pthread.dylib`thread_start + 34
    thread #9, name = 'Threadpool worker'
      frame #0: 0x923cc7ca libsystem_kernel.dylib`__psynch_cvwait + 10
      frame #1: 0x9ae6fd1d libsystem_pthread.dylib`_pthread_cond_wait + 728
      frame #2: 0x9ae71c25 libsystem_pthread.dylib`pthread_cond_timedwait$UNIX2003 + 71
      frame #3: 0x002b12e0 mono`worker_thread + 1024
      frame #4: 0x002abb6b mono`start_wrapper + 795
      frame #5: 0x9ae6d5fb libsystem_pthread.dylib`_pthread_body + 144
      frame #6: 0x9ae6d485 libsystem_pthread.dylib`_pthread_start + 130
      frame #7: 0x9ae72cf2 libsystem_pthread.dylib`thread_start + 34
    thread #10, name = 'Domain unloader'
      frame #0: 0x923ccff2 libsystem_kernel.dylib`__wait4 + 10
      frame #1: 0x940d9ea5 libsystem_c.dylib`waitpid$UNIX2003 + 48
      frame #2: 0x0017cba7 mono`mono_handle_native_crash + 519
      frame #3: 0x001e2b03 mono`sigabrt_signal_handler + 147
      frame #4: 0x920a8deb libsystem_platform.dylib`_sigtramp + 43
  (lldb) detach
  Process 2037 detached
  (lldb) quit

  =================================================================
  Got a SIGABRT while executing native code. This usually indicates
  a fatal error in the mono runtime or one of the native libraries
  used by your application.
  =================================================================
```
2017-06-05 16:35:29 +02:00
Marek Safar 2ca4575eeb [mcs] Throw expression cannot be placed after any colon. 2017-06-05 15:27:28 +02:00
Marek Safar 51b93b6c23 [mcs] C#7 throw expression 2017-06-05 12:23:06 +02:00
Alexander Köplinger ed9fb93c62 Bump bockbuild to bring in 64bit fix 2017-06-04 19:27:26 +02:00
Zoltan Varga 7d1644d234 Revert "[sdb] Add an API to make the contents of the 'State Machine Hoisted Local Scopes' table in ppdb files available in sdb. (#4961)" (#4970)
This reverts commit 010fce60af.
2017-06-02 13:52:50 -04:00
Zoltan Varga 010fce60af [sdb] Add an API to make the contents of the 'State Machine Hoisted Local Scopes' table in ppdb files available in sdb. (#4961) 2017-06-02 13:43:56 -04:00
Alexander Köplinger c3667fa861 Update API snapshot 2017-06-02 19:12:31 +02:00
Zoltan Varga cfdbdfc9eb [jit] Avoid running class cctors for remoting wrappers in the source domain. Fixes #56821. (#4950) 2017-06-02 11:54:54 -04:00
Bernhard Urban 077582d3f9 [interp] respect remoting proxies when resolving virtual methods 2017-06-02 17:18:45 +02:00
Bernhard Urban db51810499 [interp] reference domain that owns method in RuntimeMethod and couple other domain related fixes 2017-06-02 17:18:45 +02:00
Bernhard Urban 5e23a773b4 [marshal] delay dummy string allocation 2017-06-02 17:18:45 +02:00
Alexander Köplinger 1ca679877e Update API snapshot 2017-06-02 13:34:28 +02:00
Alexander Köplinger 9cb34c2a76 [Mono.Options] Fix test and add suite to CI (#4963)
* [Mono.Options] Fix test and add suite to CI

We missed running Mono.Options tests on CI so we didn't catch
this error which was introduced with: https://github.com/mono/mono/pull/4719

```
CSC     [net_4_x-darwin] net_4_x_Mono.Options_test.dll
Test/Mono.Options/CommandSetTest.cs(231,16): error CS7036: There is no argument given that corresponds to the required formal parameter 'error' of 'CommandSet.CommandSet(string, TextWriter, TextWriter, Converter<string, string>)'
```

* [Mono.Options] Stop hardcoding \n to fix tests on Windows
2017-06-02 13:07:12 +02:00
Marek Safar 03c7f4f63b [corlib] Updates api 2017-06-02 11:53:54 +02:00
Bernhard Urban 869a2b0121 [arm] remove cross compiling guard for MONO_ARCH_SOFT_DEBUG_SUPPORTED 2017-06-02 10:22:04 +02:00
Bernhard Urban 0e409c5558 [interp] guard remoting functions properly 2017-06-02 10:21:12 +02:00
Zoltan Varga 010fcfb9ec [runtime] Remove all NACL support. It was unmaintained for a long time. (#4955)
https://blog.chromium.org/2017/05/goodbye-pnacl-hello-webassembly.html
2017-06-02 03:51:44 -04:00
Marius Ungureanu 045232ef52 [Posix] Optimize string marshal code by using unsafe code (#4964) 2017-06-02 09:03:47 +02:00
Alexander Köplinger a560146b7c [MacSDKRelease] Pin revision of mono-extensions
With the new bockbuild in place we can finally remove the
implicit dependency on a point-in-time state of mono-extensions
and instead explicitly pin the desired revision.
2017-06-02 03:42:01 +02:00
Zoltan Varga 02db562b69 [aot] Revert a change from d135465fba which broke the aot compiler on windows. 2017-06-01 16:06:30 -04:00
Zoltan Varga 1b35e551d5 [ikdasm] Bump external/ikdasm to master. 2017-06-01 11:38:07 -04:00
Marek Safar 65b5d9b115 [mcs] Constant folding of enum constant and literal was using wrong operands. Fixes #53202 2017-06-01 16:31:57 +02:00
Marek Safar 76f0a58429 [mcs] Moves using static lookup at the end of simple name lookup rules. Fixes #55348 2017-06-01 15:27:30 +02:00
Alexander Köplinger 572e868f97 Bump api-snapshot
I accidentally pushed the wrong branch yesterday.
2017-06-01 11:21:31 +02:00
Marek Safar 313d06b169 Updates api-snapshot 2017-06-01 09:12:42 +02:00
Marek Safar 74524d8b92 Bump corert 2017-06-01 09:06:46 +02:00
Ludovic Henry 5b88ecbe0b [Socket] Fix Socket.BeginConnect to multiple IPAddress (#4960)
We would previously mix 2 SocketAsyncResult, and in case we would succeed asynchronously, we would return one that would not be updated afterwards.

The solution consists in using only 1 SocketAsyncResult that we ensure to update accordingly.
2017-05-31 18:22:27 -04:00
Aleksey Kliger (λgeek) a17afc056b Merge pull request #4935 from lambdageek/dev-handles-may
[coop handles] w32event, w32handle and DNS icalls
2017-05-31 14:34:20 -04:00
Zoltan Varga d5eb1e5aed [runtime] Avoid calling mono_class_from_mono_type () for sre arrays, it could initialize unfinished element types. Create a normal MonoType structure instead. Fixes #56611. (#4952) 2017-05-31 13:21:10 -04:00
Marek Safar 74c86ff4cc [System] Adds watch specific HttpListenerWebSocketContext 2017-05-31 19:16:38 +02:00
Marius Ungureanu 4ad2d48197 Bump bockbuild to include gtk# bump (#4959) 2017-05-31 16:49:10 +02:00
Alexander Köplinger cbf2e5be18 Bump api-snapshot 2017-05-31 12:45:43 +02:00
Bernhard Urban 135e4ddf27 [unaligned] relax test regarding floating point precision 2017-05-31 11:17:29 +02:00
Bernhard Urban 6d298d47f9 [interp] use memmove for some primitve types, because it takes care of unaligned addresses
relevant on architectures which do not support unaligned load/stores.
2017-05-31 11:17:29 +02:00
Marek Safar a75c5db541 Bump corefx 2017-05-31 09:07:32 +02:00
Marek Safar 34a4ffcc45 [build] Fixes profile path for aot compilation 2017-05-31 08:45:16 +02:00
Marek Safar 798a08c1f1 Bump cecil 2017-05-31 08:20:23 +02:00
Alexander Köplinger cbd180afe6 [System] Add missing configuration properties to the list of properties (#4954)
After looking at https://github.com/mono/mono/pull/4949 I did a
quick pass through the other config sections and found two more
cases where we missed adding to the properties list.
2017-05-31 03:52:08 +02:00
Alexander Köplinger c4aa50d2e1 [MacSDK] Bump xamarin-gtk-theme.py to latest revision from private bockbuild 2017-05-31 03:50:09 +02:00
Alexander Köplinger 84fe1a5774 [MacSDK] Port two msbuild fixes from private bockbuild
https://github.com/xamarin/bockbuild/commit/58467b852e13b4bdfc75a2a0f9b9507b417b0694:

    [msbuild] Create symlinks from lib/mono/xbuild/Microsoft/NuGet/*
    msbuild install script cannot do this as the source files are installed
    by mono, which are in a different staging directory.

https://github.com/xamarin/bockbuild/commit/fb9656a7613bab2d77c8ce7e05d673c5abbbdac5:

    Partially Revert "[msbuild] Remove redundant msbuild logic from mono_master.py"

    Use 15.0 instead of mono version! msbuild's install script cannot
    copy these since bockbuild installs msbuild to a separate staging
    directory from mono. So, it needs to be done here.
2017-05-31 03:33:45 +02:00
Alexander Köplinger 819026f391 Bump bockbuild to include gtk+ patch 2017-05-31 03:33:44 +02:00
Cody Russell 45e66c5362 [System] Add useDefaultCredentialsProp to the list of properties. (#4949) 2017-05-31 01:39:26 +02:00
Vlad Brezae cef99c3837 [runtime] Don't make the domain id allocatable before we clear the domain (#4942)
Otherwise, while we are clearing the domain, another domain might be created that has the same id as the current one. This would lead to crashes due to releasing of data from the newly created domain (ex gchandles).
2017-05-31 01:28:50 +03:00
Rodrigo Kumpera f7e0f70b7d Merge pull request #4938 from kumpera/optimize_ref_queries
Add concurrent read version of MonoGHashTable and use it with MonoDomain::refobject
2017-05-30 15:20:44 -07:00
Rodrigo Kumpera feb90c6d43 [win32] Add new files. 2017-05-30 13:03:35 -07:00
Aleksey Kliger b1b5ab0524 [w32socket] Remove dead code 2017-05-30 15:15:06 -04:00
Aleksey Kliger fd201644a0 [w32socket] Use coop handles for System.Net.Dns.GetHostByAddr_internal 2017-05-30 15:14:18 -04:00
Aleksey Kliger 97e9bbae7e [w32socket] Use coop handles for System.Net.Dns.GetHostByName_internal 2017-05-30 14:57:09 -04:00
Marek Safar d466cb5fa5 [mcs] Don't emit param-array attribute on method overrides, it's ignored by C# compiler. Fixes #53244 2017-05-30 19:36:13 +02:00
Alexis Christoforides 828d2adff9 Bump bockbuild 2017-05-30 13:29:33 -04:00
Alexander Köplinger 37fe83f6ea [S.R.I.RuntimeInformation] Fix FrameworkDescription on Android (#4946)
* [S.R.I.RuntimeInformation] Fix FrameworkDescription on Android

It turns out using `DllImport ["__Internal"]` doesn't work on
XA (and other cases where Mono is embedded) because it searches
for the method in the host which embeds Mono and doesn't find it,
resulting in an EntryPointNotFoundException.

We need to switch to an icall instead. However there's already
an existing icall+BCL wrapper: Mono.Runtime.GetDisplayName().

Added IVT from corlib to S.R.I.RuntimeInformation so we can call it.

* Update API snapshot
2017-05-30 18:34:53 +02:00
Marek Safar e06781fb7a [mcs] Reset catch state variable after it has been checked. Fixes #54322 2017-05-30 11:39:46 +02:00
Marek Safar 1782b291f8 [mcs] New property/indexer cannot have accessors implementing an interface in base type. Fixes #56627 2017-05-29 23:57:00 +02:00
Jochen Kühner 7b51e84dc5 Bugfix Ping.cs (#4936) 2017-05-29 23:05:34 +02:00
Bernhard Urban 0f00eb3e59 [interp] implement RELOC_LONG_BRANCH. fixes test/imt_big_iface_test.exe 2017-05-29 22:21:04 +02:00
Rodrigo Kumpera 2769d84822 [runtime] Handle mono_method_body_get_object returning NULL on success. 2017-05-29 10:36:54 -07:00
Alexander Köplinger 966d8f2a57 [Facades] Update to match latest contracts (#4939)
* [Facades] Update to match latest contracts

* Update API snapshot
2017-05-29 19:31:44 +02:00
Bernhard Urban b3901be2f6 [CI] ignore appdomain-unload-asmload.exe on interp and full-aot 2017-05-29 17:50:02 +02:00
Bernhard Urban ee90fc601e [android] add hardware specific workaround for Nexus9 in armv7 mode
we got a couple of bug reports, all with the same failure:

https://bugzilla.xamarin.com/show_bug.cgi?id=44907
https://bugzilla.xamarin.com/show_bug.cgi?id=46482
https://bugzilla.xamarin.com/show_bug.cgi?id=51791

The bugs are private, therefore here what I wrote:

```
Thank you Matthias, this was very helpful.

>>> 09-30 12:24:50.347: A/DEBUG(6211): pid: 6191, tid: 6209, name: Thread-4  >>> com.distech.x50.ui.droid <<<
>>> 09-30 12:24:50.347: A/DEBUG(6211): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x8
>>> 09-30 12:24:50.347: A/DEBUG(6211):     r0 d6b58728  r1 00004001  r2 00000000  r3 d6b58738
>>> 09-30 12:24:50.347: A/DEBUG(6211):     r4 00000008  r5 ea97427c  r6 00001f3c  r7 00000015
>>> 09-30 12:24:50.347: A/DEBUG(6211):     r8 00001f38  r9 00000015  sl d6b58728  fp d67fed90
>>> 09-30 12:24:50.347: A/DEBUG(6211):     ip ea9742c0  sp d67fed60  lr ea7a4504  pc ea716a58  cpsr 800e0010

The crash happens on this assignment:
https://github.com/mono/mono/blob/de1865dad5c0350f391fedcaa08f02f610530d3f/mono/mini/mini-generic-sharing.c#L418
Here the according disassembly:
https://gist.github.com/lewurm/b1094749027c9e5ea19fdc4fac7905a7

The crash happens in the last loop iteration (`r9=i`, `r7=slot`).  Looking
at the machine code it just _cannot_ happen, which is confirmed by the C
code as well: `*oti` successfully happens in the if check, but after
returning from `alloc_oti()`, `oti` doesn't contain a valid address anymore.
I suspect some weird hardware issue that fails to restore all registers
properly from the stack.
```
[...]

```
Thanks again Matthias.  Unfortunately, I'm out of ideas, and I can't
blame anything but the hardware. The situation we see is too weird. We
segfault at offset `0xdda60: str sl, [r4]`, but really we should
already segfault at offset `0xdda2c: ldrge   sl, [r4, #8]!"`.  So I
suspect two things why this could happen:

(1) The instruction at `dda2c` fails to do the post-increment correctly
    for *whatever* reason.

(2) Something along the execution path corrupts the stackslot, where
    `r4` is saved, in such a way that it *exactly* masks it with `0xf`.
    Everything else on the stack looks fine, so this is sort of very
    unlikely to be honest.

This only happens on a very specific device: The Nexus 9 is the only
device that was ever shipped with the Tegra K1 T132.  I suspect an issue
in the binary translation layer of `armv7` instruction set to the internal
micro-ops of the CPU.  I tried to stress test the instruction in
question (see https://github.com/lewurm/ldrinsntest), however I was not
able to trigger a crash.  So either, I'm missing some context in order
to trigger the bug or I'm on a completely wrong track.

That said, even if we could proof that it is indeed a hardware issue,
the workaround is also non-trivial (it would then either need a fix in
gcc or require a microcode update by the chip vendor).
```

And then we saw:
https://github.com/golang/go/issues/19809#issuecomment-290804472

Another hint that this device is buggy.
2017-05-29 15:48:29 +02:00
Alexander Köplinger 621faafcaf Bump bockbuild 2017-05-29 12:33:02 +02:00
Rodrigo Kumpera 4e72eaacaa [runtime] Change MonoDomain::refobject_hash to use MonoConcGHashTable.
This change massively improves reflection query scalability.

Given this benchmark and my 4 cores laptop:

```
const int T_C = 4;
var list = new List<Thread> ();
bool done = false;
int count = 0;
for (int i = 0; i < T_C; ++i) {
	var t = new Thread(() => {
		while (!done) {
			typeof (Driver)
				.GetMethods (
					BindingFlags.Public | BindingFlags.NonPublic |
					BindingFlags.Instance | BindingFlags.Static);
			Interlocked.Increment (ref count);
		}
	});
	t.Start ();
	list.Add (t);
}

Thread.Sleep (5000);
done = true;
foreach (var t in list)
	t.Join ();
Console.WriteLine ("Got {0} lists done", count);
```

This change makes us go from 166.725 queries/s to 5.140.821 queries/s. Or 30x faster.
2017-05-28 20:16:29 -07:00
Rodrigo Kumpera 3a0d3e1169 [runtime] Add concurrent read variant of MonoGHashTable name MonoConcGHashTable.
Use the same design as MonoConcHashTable.

Aaaaand confusing name will confuse.
2017-05-28 17:42:54 -07:00
Marek Safar da76a7b803 [mcs] Improves imported destructor detection. Fixes #54159 2017-05-28 13:48:42 +02:00
Alexander Köplinger a7c31c9805 Bump bockbuild 2017-05-28 02:02:31 +02:00
Alexander Köplinger 73f3ee63cc Bump bockbuild to fix wrench build 2017-05-28 01:18:02 +02:00
Rodrigo Kumpera 5c7f10154f Merge pull request #4904 from kumpera/more_opts
[runtime] Change jit_info_table_num_elements to O(1).
2017-05-27 12:29:01 -07:00
Rodrigo Kumpera 992525a6df Merge pull request #4928 from kumpera/ptr_to_struct_intrinsic
[mini] Intrinsify Marshal.PtrToStructure<T>
2017-05-27 12:27:37 -07:00
Zoltan Varga 76e2c3227f Interp sdb (#4911)
* [interpreter] Add beginnings of debugger support.

Handle debugger support similarly to the JIT:
- Add a MINT_SDB_SEQ_POINT instruction to the debugger IR. Replace it with a MINT_BREAKPOINT instruction when a breakpoint is placed.
- Store the sequence point information in the existing sequence point data structures.

* [interp] Add support for debugger stacktraces.

* [interp] Add support for debugger frame info.

* [interp] Connect seq points inside the same basic block so simple single stepping works.

* [interp] Link sequence points in different basic blocks the same way the JIT does it.

* [interp] Allocate some bitsets from a mempool.

* [interp] Rewrite the patching in the transform pass to make it a bit easier to understand.

* [interp] Add interruption support for sdb.

* [interp] Add support for mkrefany,refanytype and refanyval.

* [interp] Fix debugger failures.

* Add support for setting byref variables.
* Fix thread interruption when the top frame is an interpreter frame.
* Allow stack walks when a thread is suspended while transforming a method.
* Implement method entry/exit events.
* Fix ldstr+dynamic methods.

* [interp] Implement support for Debugger.Break.

* [interp] Change the offsets in MonoJitInfo/seq points into byte based from short based to reduce the amount of special casing needed in other parts of the code.

* [interp] Factor out the push/pop lmf code into a pair of helper functions.

* [mixed] Fix mixed mode EH.

* [interp] Implement support for MONO_VERBOSE_METHOD. Improve sequence point placement.

* [interp] Implement support for SetIP ().

Pass the target thread as an additional argument to mono_interp_set_resume_state (). Check the resume state after single
stepping/breakpoints in the interpreter.

* [interp] Disable the usage of the STLOC_NP opcodes when running under the debugger, it doesn't work if the ip is changed when the execution is stopped.

* [interp] Fix async stack walks in the debugger when the thread is in native code called from interpreter code.

* [interp] Fix the disable interpreter build.

* [interp] Fix the calculation of native offsets in the line number info.

* [interp] Fix the build.

* [interp] Make CMD_STACK_FRAME_GET_THIS behave the same when called on managed-to-native frames, with the interpreter, frame->has_ctx is set.

* [interp] Fix typos, remove some dead code, use g_print instead of printf in a few places, move some interpreter stubs to interp-stubs.c.
2017-05-27 12:29:56 -04:00
Zoltan Varga 5b4ccf033f [runtime] Fix a race in mono_class_get_virtual_methods () which happens when klass->method is NULL initially, but gets initialized later. Use the lowest bit of the iterator pointer to distinguish between the two cases. Fixes #56824. (#4933) 2017-05-27 09:33:59 -04:00
Rodrigo Kumpera 071c3f5697 [runtime] Change jit_info_table_num_elements to O(1).
On very large apps such as XS, this looking can take half a second of CPU time when opening a big solution.
2017-05-27 01:29:03 -07:00
Bill Holmes 9a08e45324 [Mono.Posix] Adding .Net Core 2.0 support. (#4774) 2017-05-27 08:24:10 +02:00
Aleksey Kliger 574f482506 [w32socket] addrinfo_to_IPHostEntry_handles
- change addrinfo_to_IPHostEntry to use the handles version
- next commits will update the callers to use the _handles version directly
2017-05-26 18:43:24 -04:00
Alexis Christoforides 500eec69c7 Re-bump bockbuild for libtiff URL change 2017-05-26 16:11:08 -04:00
Aleksey Kliger 5d50b36c5f [System] Use coop handles for System.Net.Dns.GetHostName_internal 2017-05-26 16:03:25 -04:00
Alexis Christoforides 89ceb247c4 Revert "Bump bockbuild", as it breaks the build.
This reverts commit 30f9a22f08.
2017-05-26 15:39:22 -04:00
Rodrigo Kumpera 2d57bab36b Merge pull request #4931 from kumpera/com-interop-fix
Fix cominterop bug
2017-05-26 12:28:40 -07:00
Rodrigo Kumpera ed0b9b227b [mini]Add test for PtrToStruct<T> 2017-05-26 12:26:44 -07:00
Rodrigo Kumpera 0cac21043d Merge pull request #4840 from kumpera/unaligned-access
Another round of cleanups plus fix how the JIT emit unaligned access.
2017-05-26 12:17:02 -07:00
Aleksey Kliger 44b7efbee0 [runtime] Use coop handles for ves_icall_System_Threading_Mutex_OpenMutex_internal
- add mono_w32mutex_open for w32mutex-unix.c
2017-05-26 14:44:59 -04:00
Aleksey Kliger 0a0da6cbe1 [runtime] Use coop handles for ves_icall_System_Threading_Mutex_CreateMutex_internal 2017-05-26 14:26:21 -04:00
Aleksey Kliger 310b69ce3d [runtime] Use coop handles for ves_icall_System_Threading_Events_OpenEvent_internal 2017-05-26 14:26:19 -04:00
Aleksey Kliger 0a3a12b9aa [w32event] Use coop handles for System.Threading.NativeEventCalls.CreateEvent_internal
- Make a new mono_w32event_create_full on unix
- Convert the MonoString to utf8 (unix) or utf16 (win32) in the icall, then
  call an implementation func.
- transition to GC safe mode around the win32 api call on Windows
2017-05-26 14:26:18 -04:00
Alexis Christoforides 30f9a22f08 Bump bockbuild 2017-05-26 13:41:35 -04:00
Marek Safar 84bac28050 [mcs] Codegen for optimized new with valuetype load and awaited arguments. Fixes #56081 2017-05-26 18:24:35 +02:00
Aleksey Kliger 93e74ce434 [coop handles] Add mono_string_handle_pin_chars 2017-05-26 10:29:20 -04:00
Aleksey Kliger f48e4357c9 [w32handle] Const-ify arg of mono_w32handle_namespace_search_handle 2017-05-26 10:29:18 -04:00
Aleksey Kliger a377fa737c [remoting] Use coop handles for ves_icall_System_Runtime_Activation_ActivationServices_EnableProxyActivation 2017-05-26 10:29:14 -04:00
Aleksey Kliger aa7df40d0c [remoting] Use coop handles for ves_icall_IsTransparentProxy 2017-05-26 10:28:06 -04:00
Bernhard Urban 5467391bbc [arm] use r8 instead of r5 in icall trampoline, because r5 is used as IMT reg 2017-05-26 16:19:38 +02:00
Bernhard Urban 94db1a63f0 [arm] respect iOS specific ABI for frame pointer in icall trampoline 2017-05-26 16:19:38 +02:00
Rodrigo Kumpera 414e98156a [mini] Intrinsify Marshal.PtrToStructure<T> 2017-05-25 22:43:55 -07:00
Rodrigo Kumpera 565d626c05 [runtime] Add support for using COM types from corlib.
This can be reproduced by trying to load a type that implements a COM interface corlib ships.
2017-05-25 17:11:27 -07:00
Rodrigo Kumpera 31ec985a6f [mini] Fix the llvmonlycheck test. 2017-05-25 16:13:27 -07:00
Zoltan Varga 4f1514cc22 [aot] Avoid printing out AOT NOT FOUND messages for icall methods which have no body. 2017-05-25 18:00:01 -04:00
Damien Diederen a661eb8c9d [arm] Do not use the ARM Run-time ABI in cross-compilers (#4914) 2017-05-25 13:16:38 -04:00
Aleksey Kliger b9b72e5947 [remoting] refactor ves_icall_InternalExecute
Pull the FieldGetter and FieldSetter logic into separate functions
2017-05-25 12:05:34 -04:00
Aleksey Kliger b4b33c06e6 [runtime] Use coop handles for System.Runtime.Remoting.RemotingServices.GetVirtualMethod 2017-05-25 11:31:29 -04:00
Vlad Brezae 49a83d0b72 Merge pull request #4926 from BrzVlad/fix-tls-v5
[arm] Don't use fast tls on v5 arm
2017-05-25 14:53:39 +03:00
e-kovalenko c271644e20 Fix mono build with disabled sgen (#4915)
Build of the Mono failed with the Boehm GC only (without SGEN)
if it configured like this: --with-gc=included --withsgen=no
2017-05-25 01:11:40 +02:00
Marcin Cieślak c96819eb25 sysctl takes 3 name components (#4883)
Adapted from:

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=212259

https://github.com/mono/mono/pull/3480

https://svnweb.freebsd.org/ports?view=revision&revision=423356
2017-05-25 01:09:05 +02:00
Marcin Cieślak 3b9f8e8d77 Move <sys/types.h> higher for integer types (#4884)
Fix build on FreeBSD 8 and maybe others
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=198404#c6
2017-05-25 01:06:53 +02:00
Vlad Brezae ef239e765e [arm] Don't use fast tls on v5 arm
The thread coprocessor registers appear only in v7 specification.
2017-05-25 01:14:00 +03:00
Aleksey Kliger (λgeek) 2d403b3a44 Merge pull request #4923 from lambdageek/bug-56694
[appdomain] Don't leak MonoReflectionAssemblyHandles firing events

Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=56694
2017-05-24 17:35:22 -04:00
Rodrigo Kumpera 3b3017dbe4 Merge pull request #4872 from kumpera/add_test_for_eloop
[runtime] Fix runtime behavior when dealing with missing symlinks
2017-05-24 16:25:41 -04:00
Aleksey Kliger (λgeek) 2dabc3e221 Merge pull request #4845 from lambdageek/dev-coop-delegates
[marshal] Use coop handles for delegates icalls
2017-05-24 15:56:38 -04:00
Marcin Cieślak 940944dcde Bug #56499: unreadable /etc/localtime should not cause an exception (#4881)
* Bug #56499: unreadable /etc/localtime should not cause an exception

* Fix build
2017-05-24 20:53:23 +02:00
Aleksey Kliger 182f7c33c1 [sgen] Scan the handle stack for dangling ptrs during domain unload
There should be no handles pointing to objects in the domain that is unloading
in any thread's handle stack once mono_gc_clear_domain () is called.
2017-05-24 14:10:42 -04:00
Aleksey Kliger e3ede19ce7 [coop handles] Fix wrong #ifdef 2017-05-24 14:10:41 -04:00
Aleksey Kliger e6fc657342 [appdomain] Don't leak MonoReflectionAssemblyHandles in callbacks to managed 2017-05-24 14:09:51 -04:00
Aleksey Kliger a957ab18a3 [tests] Regression test for #56694
When an AssemblyLoad event fires in a domain, a System.Reflection.Assembly
object is created in that domain for the assembly being loaded.  The bug left
this object alive after the domain was unloaded, which lead to a GC crash.
2017-05-24 14:09:50 -04:00
Zoltan Varga bde8ce85e0 [runtime] Implement interior handles as a special case to simplify and speed up the more common handle code. (#4921) 2017-05-24 13:58:18 -04:00
Marek Safar 76849c1cfb [corlib] Fixes warning 2017-05-24 19:28:44 +02:00
Marek Safar 1d115c6cd1 [mcs] Parsing of nested unbound types. Fixes #55400 2017-05-24 19:28:44 +02:00
Marek Safar d1add5e846 [corlib] Remove unused field 2017-05-24 19:28:44 +02:00
Miguel de Icaza b11e90f2f7 Improve error messages to help users diagnose problems when using custom mode (#4922)
* Improve error messages to help users diagnose problems when using the custom mode

* Update mkbundle.cs
2017-05-24 13:19:58 -04:00
Zoltan Varga fe1c006f59 [runtime] Convert a g_warning to a type load failure. (#4920) 2017-05-24 09:35:18 -04:00
Zoltan Varga 64cb61349f Fix make dist. 2017-05-23 22:51:09 -04:00
Rodrigo Kumpera 091181ba1d Fix the CpBlk and InitBlk intrinsics. 2017-05-23 16:59:07 -07:00
Rodrigo Kumpera 19631350a2 Update test for correct behavior. 2017-05-23 14:59:02 -07:00
Rodrigo Kumpera c2a7bb4598 [runtime] Fix multiple issues around symlink handling.
After fixing my windows setup, I managed to properly test MS's behavior, which is a lot saner and it's the following:

Opening fails with ERROR_CANT_RESOLVE_FILENAME (1921).
Testing and Deleting works.

Fixing File.Delete required removing the lstat we do before deleting, which no longer serves any purpose.

Fixing File.Exists requires handling ELOOP when stat fails and we retry with lstat.
2017-05-23 14:46:53 -07:00
Martin Baulig d62228e521 [System]: Don't call OnCompleted(this) twice in SocketAsyncEventArgs.FinishWrapperConnectSuccess(). (#4894) 2017-05-23 15:42:05 -04:00
Alexander Köplinger 7075c21582 [bcl] Fix compiling xunit-based tests
We moved System.Runtime.InteropServices.RuntimeInformation to a facade.
2017-05-23 19:54:35 +02:00
Zoltan Varga 581e33fcb6 [runtime] Add specialized versions of mono_icall_handle_new () for internal/non-internal pointers. (#4918) 2017-05-23 11:46:59 -04:00
Zoltan Varga f787cfb2ba Fix full aot (#4919)
* [runtime] Fix the generation of invalid IL in the return marshalling of stringbuilders.

* [runtime] Disable some failing fullaot tests.
2017-05-23 11:36:43 -04:00
Aleksey Kliger 0ec79ec49e [runtime] Use coop handles for System.Delegate.AllocDelegateLike_internal 2017-05-23 11:30:48 -04:00
Aleksey Kliger 52acc12919 [marshal] Use coop handles for System.Delegate.GetVirtualMethod_internal 2017-05-23 11:30:48 -04:00
Aleksey Kliger 631d4e0052 [marshal] Use coop handles in mono_delegate_to_ftnptr
* Create mono_delegate_handle_to_ftnptr for the implementation
* Use coop handles for
  System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegateInternal
2017-05-23 11:30:48 -04:00
Aleksey Kliger e1354fd956 [runtime] Remove temporary fcn mono_delegate_ctor_with_method_fixme 2017-05-23 11:30:48 -04:00
Aleksey Kliger 2d7ce926aa [marshal] Change mono_delegate_ctor to use coop handles 2017-05-23 11:30:48 -04:00
Aleksey Kliger 8b9eaf7a72 [marshal] Use handles in mono_ftnptr_to_delegate
* Move most of the logic to mono_ftnptr_to_delegate_handle
* Use handles for
  System.Runtime.InteropServices.Marshal.GetDelegateForFunctionPointerInternal
2017-05-23 11:30:48 -04:00
Aleksey Kliger a61c283115 [runtime] Use coop handles in mono_delegate_ctor_with_method
Use coop handles in icall System.Delegate.CreateDelegate_internal

TODO: change callsites fo mono_delegate_ctor_with_method_fixme to use handles
2017-05-23 11:30:48 -04:00
Aleksey Kliger 4a78d5cb13 [marshal] Use coop handles for OffsetOf, SizeOf, Prelink, PrelinkAll
System.Runtime.InteropServices.Marshal methods
* OffsetOf
* Prelink
* PrelinkAll
* SizeOf
2017-05-23 11:30:47 -04:00
Alexander Köplinger beb36c6a31 Remove outdated info and unused files from mcs/ (#4916)
Most of the removed files weren't touched in the last decade
and are unused so it's better to remove them to avoid confusion
about what they do.

I also went over and removed the most outdated info from readme
files, we probably want to do a more thorough overhaul in the future.
2017-05-23 14:27:42 +02:00
Marek Safar a0fc3f4dcf [mcs] When setting struct empty layout consider compiler generated fields. Fixes #55604 2017-05-23 08:41:04 +02:00
Alexander Köplinger 872976e6c6 Bump bockbuild to fix build 2017-05-23 02:32:55 +02:00
Zoltan Varga f285740333 [runtime] Add a fastpath to mono_object_isinst_icall (). (#4917) 2017-05-22 20:24:14 -04:00
Alexander Köplinger 3b2da24533 Use nuget 4.3.0-preview1 to fix build
4.5.0 is not yet available.

Also use lowercase nuget.exe to match the URL on https://dist.nuget.org/
2017-05-23 00:16:22 +02:00
Marek Safar ab98a01bac [mcs] Add expression bodied syntax for accessors. Fixes #54991 2017-05-22 23:31:07 +02:00
Bernhard Urban 1516837c58 [interp] fix unaligned. 2017-05-22 22:13:01 +02:00
Alexis Christoforides 99c93cbe85 [MacSDK] Update Nuget to 4.5, switch to binary release instead of building 2017-05-22 16:04:51 -04:00
Alexander Köplinger 29741a40cb [bcl] Make monolite platform specific (#4910)
mscorlib.dll etc will be platform specific in the future. This also
means that we need to adapt monolite since it'll become platform
specific once we start the divergence.

monolite is essentially a repackaging of the "build" profile which
means we need to turn that profile into multi-platform profile
like net_4_x. We'll still have a symlink from build -> build-darwin
and the monolite which is downloaded or packaged in the tarball
is expanded into mcs/lib/monolite-<platform> depending on the platform
you're building on.

I had to move the get-monolite-latest target from the top-level
Makefile.am into mcs/class/Makefile so it has access to HOST_PLATFORM,
but it arguably should've been there anyway before.
2017-05-22 18:09:44 +02:00
Alexander Köplinger a796ce400d [bcl] Exclude Mono.CSharp.dll from api diff
We don't guarantee a stable API there and it changes often
when mcs internals change.
2017-05-22 18:02:12 +02:00
Alex Rønne Petersen 506e60cf63 [profiler] Fall back to CLOCK_MONOTONIC if CLOCK_PROCESS_CPUTIME_ID results in EINVAL. (#4913)
This is the case on WSL.
2017-05-22 11:02:22 -04:00
Marek Safar 3f527c012d [mcs] Inflate referenced current types for imported type definitions. Fixes #56462 2017-05-22 17:01:12 +02:00
Marek Safar 027da05f20 [mcs] Removes TypeManager calls from MoreSpecific 2017-05-22 17:01:12 +02:00
vkargov eb18b8c0de [ci] Add the collect-coverage tag for use on Jenkins. (#4912)
* [ci] Add the collect-coverage tag for use on Jenkins.

* Move collect-coverage up so we don't set different values for -O
2017-05-22 14:43:28 +02:00
Bernhard Urban 88a90e5c20 [mcs] extend API for loading types and consuming source file from a stream (#4905) 2017-05-22 12:40:19 +02:00
Rodrigo Kumpera 48d1ebf570 [jit] Fix x86 failures and handle unaligned load with offset 2017-05-19 19:47:51 -07:00
Rodrigo Kumpera d0b38e1871 [corlib] Address reviewer comments to new test. 2017-05-19 15:06:19 -07:00
Alexander Köplinger 836194d63b Bump api-snapshot 2017-05-19 22:51:54 +02:00
Marek Safar ea0f582d72 Bump Roslyn to 2.3 preview 2017-05-19 21:45:26 +02:00
Alexis Christoforides aaf9fd3dbd Bump bockbuild 2017-05-19 15:24:13 -04:00
Alexander Köplinger ab514a67ee Bump the btls submodule
Bring in the change that makes building the "tool" subdirectory
in BTLS off by default - we don't need it in Mono and it fails
to build on some platforms with older C++ compiler.
2017-05-19 19:55:41 +02:00
Marek Safar 323fcec547 [mcs] Report more unsafe code errors in iterators. Fixes #56616 2017-05-19 18:46:14 +02:00
Marek Safar 3877878670 [build] Remove platforms from xbuild build 2017-05-19 18:16:28 +02:00
Zoltan Varga afffab3b5c [amd64] Fix the allocation of the caller area in filter clauses. Fixes #56567. (#4903) 2017-05-19 11:37:38 -04:00
Rodrigo Kumpera 5e5e381907 [jit] Add unaligned tests. 2017-05-18 20:16:30 -07:00
Rodrigo Kumpera 11917e41a8 [jit] Properly handle unaligned memory access. 2017-05-18 16:38:05 -07:00
Rodrigo Kumpera b79a891772 [jit] Assorted small changes.
Remove 10000 size check in mini_emit_memory_copy_bytes, this is no longer needed now that the memcpy expansion logic in mini_emit_memcpy_internal was fixes.

Use a define for 10000.

Remove useless debug spew.
2017-05-18 16:19:22 -07:00
Rodrigo Kumpera 8884492839 [mini] Remove assert and document reason it can't be used. 2017-05-18 15:56:54 -07:00
Rodrigo Kumpera eec0a66009 [jit] Remove mini_emit_stobj from method-to-ir.c and move mini_emit_wb_aware_memcpy to memory-access.c 2017-05-17 18:51:19 -07:00
Rodrigo Kumpera e05343ddf5 [jit] Replace usage of mini_emit_stobj with mini_emit_memory_copy and simplify usage since the later can handle ref types. 2017-05-17 18:51:19 -07:00
Rodrigo Kumpera 45f1fb7d50 [jit] Fix wording of the function description 2017-05-17 18:51:19 -07:00
Rodrigo Kumpera 414b5fc644 [jit] Fix mono_debug_count breakage introduced by the g_getenv change. 2017-05-17 18:51:19 -07:00
Rodrigo Kumpera 0fd8ecd055 [mini] Add mini_emit_memory_copy to replace mini_emit_stobj 2017-05-17 18:51:19 -07:00
Rodrigo Kumpera 28a16d28a0 [jit] Fix large const memcpy/memset when when the intrins pass is disabled. 2017-05-17 18:51:19 -07:00
Rodrigo Kumpera 32eb3111ee [runtime] Rework how unaligned memcpy/memset are generated.
Problems with the current code:
	It's wrong on 64bits if align == 4
	It's wrong on 64bits if offset is not 0 or 4.
	It generates bad code if align > 1 && align < SIZEOF_VOIDP

This PR implements unaligned based on the following set of assumptions that are true for the current set of platforms we support:

- A load/store of size X works with data aligned on X. IE, a short store can handle addresses aligned to 2
- Unaligned access is either disallowed or plain slower.
- Both source and dest abide to the supplied alignment.

The way we emit unaligned access is by emitting the widest possible access based on alignment and offset.

TBH: use unaligned access on targets like x86 that support it and are profitable.
2017-05-17 18:51:18 -07:00
Rodrigo Kumpera d99cf6b096 [corlib] Reduce the warning spew our testsuite produces. 2017-05-15 16:20:14 -07:00
Rodrigo Kumpera 7283aded35 [corlib] Add tests for the behavior of IO in the face of a symlink loop.
The behavior was empirically found on windows and dotnet.
2017-05-15 16:19:07 -07:00
Rodrigo Kumpera c51f5516ce [corlib] Remove the File.Exists check before opening the file.
It's both racy and not necessary.

Beyond that, it will produce the wrong exception if opening the file fails for a different reason that it's missing.

This is an issue in case of bad permissions or symlink loops.
2017-05-15 16:17:23 -07:00
512 changed files with 13776 additions and 10901 deletions

No files matched your search

-3
View File
@@ -26,9 +26,6 @@
[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
+1 -6
View File
@@ -50,14 +50,9 @@ noinst_DATA = mono-uninstalled.pc
DISTCLEANFILES= mono-uninstalled.pc
# building with monolite
mcslib = $(mcs_topdir)/class/lib
monolite_url = https://download.mono-project.com/monolite/monolite-$(MONO_CORLIB_VERSION)-latest.tar.gz
.PHONY: get-monolite-latest
get-monolite-latest:
-rm -fr $(mcslib)/monolite/$(MONO_CORLIB_VERSION)
-mkdir -p $(mcslib)/monolite
cd $(mcslib) && { (wget -O- $(monolite_url) || curl -L $(monolite_url)) | gzip -d | tar xf - ; }
cd $(mcslib) && mv -f monolite-* monolite/$(MONO_CORLIB_VERSION)
$(MAKE) -C $(mcs_topdir)/class get-monolite-latest
if BITCODE
BITCODE_CHECK=yes
+16 -107
View File
@@ -1,7 +1,7 @@
# Process this file with autoconf to produce a configure script.
#AC_PREREQ([2.62])
AC_INIT(mono, [5.3.0],
AC_INIT(mono, [5.4.1],
[http://bugzilla.xamarin.com/enter_bug.cgi?classification=Mono])
AC_CONFIG_SRCDIR([README.md])
@@ -40,8 +40,8 @@ MONO_VERSION_BUILD=`echo $VERSION | cut -d . -f 3`
# This can be reset to 0 when Mono's version number is bumped
# since it's part of the corlib version (the prefix '1' in the full
# version number is to ensure the number isn't treated as octal in C)
MONO_CORLIB_COUNTER=1
MONO_CORLIB_VERSION=`printf "1%02d%02d%02d%03d" $MONO_VERSION_MAJOR $MONO_VERSION_MINOR $MONO_VERSION_BUILD $MONO_CORLIB_COUNTER`
MONO_CORLIB_COUNTER=3
MONO_CORLIB_VERSION=`printf "1%02d%02d%02d%03d" $MONO_VERSION_MAJOR $MONO_VERSION_MINOR 0 $MONO_CORLIB_COUNTER`
AC_DEFINE_UNQUOTED(MONO_CORLIB_VERSION,$MONO_CORLIB_VERSION,[Version of the corlib-runtime interface])
AC_SUBST(MONO_CORLIB_VERSION)
@@ -264,17 +264,8 @@ case "$host" in
with_sgen_default_concurrent=yes
;;
*-*-nacl*)
CPPFLAGS="$CPPFLAGS -DGC_LINUX_THREADS -D_GNU_SOURCE -D_REENTRANT -DUSE_MMAP"
if test "x$disable_munmap" != "xyes"; then
CPPFLAGS="$CPPFLAGS -DUSE_MUNMAP"
fi
libmono_cflags="-D_REENTRANT"
libdl=
libgc_threads=pthreads
use_sigposix=yes
ikvm_native=no
AC_DEFINE(DISABLE_SOCKETS,1,[Disable sockets support])
AC_DEFINE(DISABLE_ATTACH, 1, [Disable agent attach support])
echo "nacl no longer supported."
exit 1
;;
*-*-hpux*)
CPPFLAGS="$CPPFLAGS -DGC_HPUX_THREADS -D_HPUX_SOURCE -D_XOPEN_SOURCE_EXTENDED -D_REENTRANT"
@@ -743,10 +734,6 @@ fi
AM_CONDITIONAL(DISABLE_LIBRARIES, test x$enable_libraries = xno)
case $host in
*nacl* ) with_shared_mono=yes;;
esac
if test "x$host_win32" = "xyes"; then
# Boehm GC requires the runtime to be in its own dll
with_static_mono=no
@@ -1371,8 +1358,6 @@ AC_TRY_COMPILE([
AC_DEFINE_UNQUOTED(MONO_ZERO_LEN_ARRAY, 1, [Length of zero length arrays])
])
AC_CHECK_HEADERS(nacl/nacl_dyncode.h)
dnl ***********************************
dnl *** Checks for signals
dnl ***********************************
@@ -2220,13 +2205,11 @@ if test x$host_win32 = xno; then
dnl **********************************
dnl *** epoll ***
dnl **********************************
if test "x$ac_cv_header_nacl_nacl_dyncode_h" = "xno"; then
AC_CHECK_HEADERS(sys/epoll.h)
haveepoll=no
AC_CHECK_FUNCS(epoll_ctl, [haveepoll=yes], )
if test "x$haveepoll" = "xyes" -a "x$ac_cv_header_sys_epoll_h" = "xyes"; then
AC_DEFINE(HAVE_EPOLL, 1, [epoll supported])
fi
AC_CHECK_HEADERS(sys/epoll.h)
haveepoll=no
AC_CHECK_FUNCS(epoll_ctl, [haveepoll=yes], )
if test "x$haveepoll" = "xyes" -a "x$ac_cv_header_sys_epoll_h" = "xyes"; then
AC_DEFINE(HAVE_EPOLL, 1, [epoll supported])
fi
havekqueue=no
@@ -2859,40 +2842,6 @@ fi
AM_CONDITIONAL(ENABLE_DTRACE, [test x$enable_dtrace = xyes])
AM_CONDITIONAL(DTRACE_G_REQUIRED, [test x$dtrace_g = xyes])
dnl **************
dnl *** NaCl ***
dnl **************
AC_ARG_ENABLE(nacl_codegen, [ --enable-nacl-codegen Enable Native Client code generation], enable_nacl_codegen=$enableval, enable_nacl_codegen=no)
AC_ARG_ENABLE(nacl_gc, [ --enable-nacl-gc Enable Native Client garbage collection], enable_nacl_gc=$enableval, enable_nacl_gc=no)
AM_CONDITIONAL(NACL_CODEGEN, test x$enable_nacl_codegen != xno)
dnl
dnl Hack to use system mono for operations in build/install not allowed in NaCl.
dnl
nacl_self_host=""
if test "x$ac_cv_header_nacl_nacl_dyncode_h" = "xyes"; then
nacl_self_host="nacl_self_host"
fi
AC_SUBST(nacl_self_host)
if test "x$enable_nacl_codegen" = "xyes"; then
MONO_NACL_ALIGN_MASK_OFF=1
AC_DEFINE(TARGET_NACL, 1, [...])
AC_DEFINE(__native_client_codegen__, 1, [...])
fi
if test "x$enable_nacl_gc" = "xyes"; then
if test "x$TARGET" = "xAMD64" -o "x$TARGET" = "xX86"; then
INSTRUMENT_CFLAG="-finstrument-for-thread-suspension"
else
# Not yet implemented
INSTRUMENT_CFLAG=""
fi
CPPFLAGS="$CPPFLAGS $INSTRUMENT_CFLAG -D__native_client_gc__"
fi
AC_SUBST(MONO_NACL_ALIGN_MASK_OFF)
dnl **************************
dnl *** AOT cross offsets ***
dnl **************************
@@ -3155,12 +3104,6 @@ case "$host" in
mingw*)
;;
esac
case "$host" in
x86_64-*-nacl*)
AC_DEFINE(__mono_ilp32__, 1, [64 bit mode with 4 byte longs and pointers])
sizeof_register=8
;;
esac
;;
sparc*-*-*)
if test "x$ac_cv_sizeof_void_p" = "x8"; then
@@ -3241,13 +3184,6 @@ case "$host" in
ACCESS_UNALIGNED="no"
CPPFLAGS="$CPPFLAGS -D__ARM_EABI__"
;;
# TODO: make proper support for NaCl host.
# arm*-*nacl)
# TARGET=ARM;
# arch_target=arm;
# ACCESS_UNALIGNED="no"
# AOT_SUPPORTED="no"
# ;;
aarch64-*)
# https://lkml.org/lkml/2012/7/15/133
TARGET=ARM64
@@ -3308,38 +3244,6 @@ if test "x$host" != "x$target"; then
sizeof_register=8
target_byte_order=G_BIG_ENDIAN
;;
x86_64-*-nacl)
TARGET=AMD64
arch_target=amd64
AC_DEFINE(TARGET_AMD64, 1, [...])
AC_DEFINE(__mono_ilp32__, 1, [64 bit mode with 4 byte longs and pointers])
sizeof_register=8
;;
# TODO: make proper support for NaCl target.
# arm*-*nacl)
# TARGET=ARM
# arch_target=arm
# AC_DEFINE(TARGET_ARM, 1, [...])
# ACCESS_UNALIGNED="no"
# sizeof_register=4
# CPPFLAGS="$CPPFLAGS \
# -D__ARM_EABI__ \
# -D__arm__ \
# -D__portable_native_client__ \
# -Dtimezone=_timezone \
# -DDISABLE_SOCKETS \
# -DDISABLE_ATTACH \
# -DUSE_NEWLIB"
# Can't use tls, since it depends on the runtime detection of tls offsets
# in mono-compiler.h
# with_tls=pthread
# ;;
i686-*-nacl)
TARGET=X86
arch_target=x86
AC_DEFINE(TARGET_X86, 1, [...])
sizeof_register=4
;;
arm*-linux-*)
TARGET=ARM;
arch_target=arm;
@@ -3630,6 +3534,11 @@ fi
AM_CONDITIONAL(ENABLE_INTERPRETER, [test x$enable_interpreter = xyes])
if test "x$enable_interpreter" = "xyes" || test "x$mono_feature_disable_jit" != "xyes"; then
AC_DEFINE(HAVE_ONLINE_VES, 1, [Some VES is available at runtime])
fi
AM_CONDITIONAL(HAVE_ONLINE_VES, [test x$enable_interpreter = xyes] || [test x$mono_feature_disable_jit != xyes])
dnl
dnl Simple Generational checks (sgen)
@@ -4231,7 +4140,7 @@ AC_SUBST(mono_build_root)
mono_runtime=mono/mini/mono
AC_SUBST(mono_runtime)
CSC_LOCATION=`cd $srcdir && pwd`/external/roslyn-binaries/Microsoft.Net.Compilers/Microsoft.Net.Compilers.2.1.0/tools/csc.exe
CSC_LOCATION=`cd $srcdir && pwd`/external/roslyn-binaries/Microsoft.Net.Compilers/Microsoft.Net.Compilers.2.3.1/tools/csc.exe
if test $csc_compiler = mcs; then
CSC=$mcs_topdir/class/lib/build/mcs.exe
+1 -1
View File
@@ -32,7 +32,7 @@ typedef signed @GSIZE@ gssize;
#define G_HAVE_ISO_VARARGS
#endif
#if defined (__native_client__) || defined (HOST_WATCHOS)
#if defined (HOST_WATCHOS)
#undef G_BREAKPOINT
#define G_BREAKPOINT()
#endif
-10
View File
@@ -154,15 +154,6 @@ g_file_open_tmp (const gchar *tmpl, gchar **name_used, GError **error)
gchar *
g_get_current_dir (void)
{
#ifdef __native_client__
char *buffer;
if ((buffer = g_getenv("NACL_PWD"))) {
buffer = g_strdup(buffer);
} else {
buffer = g_strdup(".");
}
return buffer;
#else
int s = 32;
char *buffer = NULL, *r;
gboolean fail;
@@ -181,5 +172,4 @@ g_get_current_dir (void)
* so we return the buffer here since it has a pointer to the valid string
*/
return buffer;
#endif
}
Submodule external/buildtools deleted from b5cc6e6ab5.
+1 -1
+1 -1
+1 -1
+1 -1
+1 -1
+1 -1
+10
View File
@@ -181,6 +181,16 @@ Gives the path for the temporary LLVM bitcode file created during AOT.
.I info
Print the architecture the AOT in this copy of Mono targets and quit.
.TP
.I interp
Generates all required wrappers, so that it is possible to run --interpreter without
any code generation at runtime. This option only makes sense with \fBmscorlib.dll\fR.
Embedders can set
.nf
mono_jit_set_aot_mode (MONO_AOT_MODE_INTERP);
.fi
.ne
.TP
.I ld-flags
Additional flags to pass to the C linker (if the current AOT mode calls for invoking it).
.TP
+1 -3
View File
@@ -1,7 +1,5 @@
This list of authors is outdated. For a full list of contributors
see:
http://www.go-mono.com/archive/mono-1.0.html
check out the git history.
C# Compiler:
Miguel de Icaza ([email protected])
+1 -340
View File
@@ -1,340 +1 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.
See LICENSE file in the project root for full license information.
+1 -477
View File
@@ -1,477 +1 @@
* Coding Style for the Mono C# source code.
* Class Libraries and Assembly Layout
The class libraries are grouped together in the assemblies
they belong.
Each directory here represents an assembly, and inside each
directory we divide the code based on the namespace they
implement.
In addition, each assembly directory contains a Test directory
that holds the NUnit tests for that assembly.
We use a new build system which is described by various README
files in mcs/build
The build process typically builds an assembly, but in some
cases it also builds special versions of the assemblies
intended to be used for testing.
* Missing implementation bits
If you implement a class and you are missing implementation bits,
please use the attribute [MonoTODO]. This attribute can be used
to programatically generate our status web pages:
[MonoTODO("My Function is not available on Mono")]
int MyFunction ()
{
throw new NotImplementedException ();
}
Ideally, write a human description of the reason why there is
a MonoTODO, this will be useful in the future for our
automated tools that can assist in developers porting their code.
* Tagging buggy code
If there is a bug in your implementation tag the problem by using
the word "FIXME" in the code, together with a description of the
problem.
Do not use XXX or obscure descriptions, because otherwise people
will not be able to understand what you mean.
* Tagging Problematic specs.
If the documentation and the Microsoft implementation do
differ (you wrote a test case to prove this), I suggest that you edit
the file `mcs/class/doc/API-notes' so we can keep track of these problems
and submit our comments to ECMA or Microsoft and seek clarification.
Sometimes the documentation might be buggy, and sometimes the implementation
might be buggy. Lets try to identify and pinpoint which one
is the correct one.
Sometimes the specification will be lame (consider Version.ToString (fieldCount)
where there is no way of knowing how many fields are available, making the API
not only stupid, but leading to unreliable code).
In those cases, use the keyword "LAMESPEC".
* Coding considerations and style.
In order to keep the code consistent, please use the following
conventions. From here on `good' and `bad' are used to attribute
things that would make the coding style match, or not match. It is not
a judgement call on your coding abilities, but more of a style and
look call. Please try to follow these guidelines to ensure prettiness.
Use 8 space tabs for writing your code (hopefully we can keep
this consistent). If you are modifying someone else's code, try
to keep the coding style similar.
Since we are using 8-space tabs, you might want to consider the Linus
Torvals trick to reduce code nesting. Many times in a loop, you will
find yourself doing a test, and if the test is true, you will nest.
Many times this can be changed. Example:
for (i = 0; i < 10; i++) {
if (something (i)) {
do_more ();
}
}
This take precious space, instead write it like this:
for (i = 0; i < 10; i++) {
if (!something (i))
continue;
do_more ();
}
* Performance and readability
It is more important to be correct than to be fast.
It is more important to be maintainable than to be fast.
Fast code that is difficult to maintain is likely going to
be looked down upon.
* Style Guidelines
* Use a space before an opening parenthesis when calling
functions, or indexing, like this:
method (a);
b [10];
* Do not put a space after the opening parenthesis and the
closing one, ie:
good: method (a); array [10];
bad: method ( a ); array[ 10 ];
* Inside a code block, put the opening brace on the same line
as the statement:
good:
if (a) {
code ();
code ();
}
bad:
if (a)
{
code ();
code ();
}
* Avoid using unnecessary open/close braces, vertical space
is usually limited:
good:
if (a)
code ();
bad:
if (a) {
code ();
}
* When defining a method, use the C style for brace placement,
that means, use a new line for the brace, like this:
good:
void Method ()
{
}
bad:
void Method () {
}
* Properties and indexers are an exception, keep the
brace on the same line as the property declaration.
Rationale: this makes it visually
simple to distinguish them.
good:
int Property {
get {
return value;
}
}
bad:
int Property
{
get {
return value;
}
}
Notice how the accessor "get" also keeps its brace on the same
line.
For very small properties, you can compress things:
ok:
int Property {
get { return value; }
set { x = value; }
}
* Use white space in expressions liberally, except in the presence
of parenthesis:
good:
if (a + 5 > method (blah () + 4))
bad:
if (a+5>method(blah()+4))
* For any new files, please use a descriptive introduction, like
this:
//
// System.Comment.cs: Handles comments in System files.
//
// Author:
// Juan Perez ([email protected])
//
// (C) 2002 Address, Inc (http://www.address.com)
//
* If you are modyfing someone else's code, and your contribution
is significant, please add yourself to the Authors list.
* Switch statements have the case at the same indentation as the
switch:
switch (x) {
case 'a':
...
case 'b':
...
}
* Argument names should use the camel casing for
identifiers, like this:
good:
void Method (string myArgument)
bad:
void Method (string lpstrArgument)
void Method (string my_string)
* Empty methods: They should have the body of code using two
lines, in consistency with the rest:
good:
void EmptyMethod ()
{
}
bad:
void EmptyMethod () {}
void EmptyMethod ()
{}
* Line length: The line length for C# source code is 134 columns.
If your function declaration arguments go beyond
this point, please align your arguments to match the
opening brace, like this:
void Function (int arg, string argb,
int argc)
{
}
When invoking functions, the rule is different, the
arguments are not aligned with the previous
argument, instead they begin at the tabbed position,
like this:
void M ()
{
MethodCall ("Very long string that will force",
"Next argument on the 8-tab pos",
"Just like this one")
}
* Variable declaration indentation.
Sometimes it is convenient to indent the variables to make the code
look pretier, but do not add gratuitous space, try to use the minimally
necessary space, for example:
Good:
void Method ()
{
string b;
int a;
byte c;
}
Bad:
void Method ()
{
string b;
int a;
byte c;
}
* Braces and the `else' clause
If there are braces closing or opening next to the else clause,
they go on the same line as the word `else', for example:
Good:
if (..) {
} else {
}
Bad:
if (..) {
}
else {
}
Bad:
if (..) {
} else
{
}
Bad:
if (..) {
}
else
{
}
* RCS and CVS tags
Some users like to use the special RCS/CVS tags in their
source code: $id$, $log$ and so on.
The use of these is not permitted on the Mono source code
repository. This metadata belongs on a ChangeLog or in the
SVN metadata.
* File formats
Historically our repository has used a mix of line-endings,
this is a mistake that we are trying hard to fix.
For existing files, please make sure that you do not convert
the file, as that causes us to loose precious history (the
full file is commited).
For new files that you create, please make sure that you use
Subversion's support for mapping the line endings
automatically, after adding your file:
$ svn add file.cs
Execute this command:
$ svn propset svn:eol-style native file.cs
Which will make the file automatically receive the proper
treatment from that point on.
Please verify before commiting that your changes wont loose
history, you can do this by running:
$ svn diff
And examining the output.
* Warnings
Avoid commiting code with warnings to the repository, the use
of #pragmas to disable warnings is strongly discouraged, but
can be used on unique cases. Please justify the use of the
warning ignore clause on a comment.
Do not commit changes to the Makefiles that removes warnings,
if anything warnings should be eliminated one at a time, and
if not possible, they must be flagged.
* Examples:
class X : Y {
bool Method (int argument_1, int argument_2)
{
if (argument_1 == argument_2)
throw new Exception (Locale.GetText ("They are equal!");
if (argument_1 < argument_2) {
if (argument_1 * 3 > 4)
return true;
else
return false;
}
//
// This sample helps keep your sanity while using 8-spaces for tabs
//
VeryLongIdentifierWhichTakesManyArguments (
Argument1, Argument2, Argument3,
NestedCallHere (
MoreNested));
}
bool MyProperty {
get {
return x;
}
set {
x = value;
}
}
void AnotherMethod ()
{
if ((a + 5) != 4) {
}
while (blah) {
if (a)
continue;
b++;
}
}
}
* Conditional compilation
Ideally we would not need conditional compilation, and the use
of #ifdef is strongly discouraged. But due to our support for
old C# 1.0 compilers we have to use it in a few places.
Try to avoid negative tests that have an else clause, for
example:
#if !NET_2_0
CODE_FOR_1_0
#else
CODE_FOR_2_0
#endif
Instead use:
#if NET_2_0
CODE_FOR_2_0
#else
CODE_FOR_1_0
#endif
When a major feature differs across compilation targets, try
to factor out the code into a separate class, a helper class
or a separate file, and include that in your profile while
surrounding that helper file/class with the ifdefs to reduce
the amount of ifdefs in the code.
For instance, this is used for some parts of Grasshopper where
the code is ifdefed out, when large parts of a file would have
been ifdefed out, we moved the code into a MyOtherFile.jvm.cs
For 2.0 classes, this is even simpler as code can be trivially
factored out into
MyHelperClass.cli.cs
MyHelperClass.jvm.cs
By using partial classes.
Please see http://www.mono-project.com/community/contributing/coding-guidelines/ for latest guidelines.
+4 -108
View File
@@ -23,7 +23,7 @@ compilers and tools.
* *
*********************************************************************
If you only want to build a snapshot or a fresh CVS checkout of the
If you only want to build a snapshot or a fresh checkout of the
sources, you should go into the `mono' sibling directory and issue the
make command, like this:
@@ -35,72 +35,6 @@ make command, like this:
The compilation is bundled with the build due to dependencies on the
class libraries on the runtime.
Build Features for Developers of Mono.
======================================
These instructions apply to both Linux and Windows. To build this
package, you must already have a C# compiler installed. This means
that to build on Linux, you need to get a distribution of the MCS
binaries; these are called monocharges. They can be found at
www.go-mono.com/daily. On Windows, you can just use the
Microsoft compiler. You also need GNU make to build the software (on
Windows, you will need for example the Cygwin environment setup).
You can customize your MCS configuration by using:
./configure [--prefix=PREFIX] [--profile=PROFILE]
If you do not run the above, the defaults are /usr/local for the
prefix, and `default' for the profile.
To build the compiler and class libraries, run:
make
The libraries will be placed in the directory class/lib/ and the mcs
compiler executable in mcs/.
To install them, run the following:
make install
If you get "corlib out of sync" errors, try
make PROFILE="atomic"
A better alternative would be to fire off a 'make' from a sibling or
parent 'mono/' tree.
Troubleshooting
===============
We try to maintain the CVS tree such that it is bootstrapable from the
latest released version of mono and mcs. Occasionally, something in the
compiler or runtime changes enough that an existing installation cannot
complete a bootstrap from cvs. In this case, go to
http://go-mono.com/daily and download a monocharge or monolite tarball.
Unpack and copy the .dlls to $prefix/lib and .exes to $prefix/bin/.
Then you should be able to complete the build normally (i.e. using make
bootstrap).
wget http://go-mono.com/daily/monolite-20040505.tar.gz
tar -zxvf monolite-20040505.tar.gz
cd monolite-20040505
env prefix=/usr/local sh recharge.sh
Monocharges
===========
If you are tracking Mono's development, you may sometimes need to share
the compiled libraries with others, you can do:
make monocharge
Or a light version, which contains only the essential libraries and
results in a much smaller file:
make monocharge-lite
Configuration
=============
@@ -110,48 +44,15 @@ place your configuration options in build/config.make
A list of variables that control the build are listed in the file
build/config-default.make.
Build profiles? What?
======================
Don't worry about them too much. If you're wondering which to use:
use the default if you can (that's why it's the default!) and use
the atomic if you have to.
The default profile uses the C# compiler and class libaries as they
are built. This lets you build MCS without needing to have already
installed it, but can fail if the libraries change significantly.
(This is the source of the dreaded "corlib out of sync" warning, most
of the time.)
The atomic profile tries to use the system compiler and preexisting
MCS libraries. New libaries are built against this constant reference
point, so if a newly built library has a binary incompatibility, the
rest of your build can proceed.
If you want to always use the atomic profile, run this command:
./configure --profile=atomic
More About the Build System
===========================
More information is found in build/README.*. Here's a quick rundown
of the features:
* Unified build system for Windows and Linux. Windows is still
fairly untested, but "should work." Unfortunately I don't
have a Windows machine to test on, but Gonzalo can get
corlib to build I think and that's about as complicated as
it gets.
* Profile support. 'make PROFILE=profilename' or 'export
PROFILE=profilename ; make' will work. Profiles are defined
in build/profiles/profilename.make ; right now there isn't
too much going on. The 'bootstrap' profile will build the
way makefile.gnu did on Linux, by setting MONO_PATH and
using mcs/mcs.exe; the default profile will build against
the existing system libraries and compile with 'mcs', which
should reduce a lot of 'corlib out of sync' warnings.
in build/profiles/profilename.make ;
* Important variables are shared among makefiles now; you can
edit build/config.make (see build/config-default.make for a
@@ -164,16 +65,11 @@ of the features:
* Test libraries now live in class/Library/Library_test.dll,
not class/Library/Test. 'make test' will build the test DLL,
'make run-test' will actually run the nunit tests. Set the
variable TEST_HARNESS to run with a program other than
nunit-console (for example, nunit-gtk).
'make run-test' will actually run the nunit tests.
* Standardized recursive targets: all, clean, install, test,
run-test. Read build/README.makefiles for definitions of
what they should do
* (Relatively) sane 'make dist' target; 'make distcheck'
support; cute 'make monocharge' and 'make monocharge-lite'
targets. They're made possible because 'make install' now
supports DESTDIR a la automake, which I'm sure someone cares
about.
support;
+2 -25
View File
@@ -95,8 +95,7 @@ DISTFILES = \
mkinstalldirs \
MonoIcon.png \
README \
ScalableMonoIcon.svg \
winexe.in
ScalableMonoIcon.svg
dist-local: dist-default
@@ -138,34 +137,12 @@ distcheck: dist-tarball
rm -f before.list after.list distdist.list ; \
rm -rf $(package) InstallTest
monocharge:
chargedir=monocharge-`date -u +%Y%m%d` ; \
mkdir "$$chargedir" ; \
DESTDIR=`cd "$$chargedir" && pwd` ; \
$(MAKE) install DESTDIR="$$DESTDIR" || exit 1 ; \
tar cvjf "$$chargedir".tar.bz2 "$$chargedir" ; \
rm -rf "$$chargedir"
# A bare-bones monocharge.
monocharge-lite:
chargedir=monocharge-lite-`date -u +%Y%m%d` ; \
mkdir "$$chargedir" ; \
DESTDIR=`cd "$$chargedir" && pwd` ; \
$(MAKE) -C mcs install DESTDIR="$$DESTDIR" || exit 1; \
$(MAKE) -C class/corlib install DESTDIR="$$DESTDIR" || exit 1; \
$(MAKE) -C class/System install DESTDIR="$$DESTDIR" || exit 1; \
$(MAKE) -C class/System.XML install DESTDIR="$$DESTDIR" || exit 1; \
$(MAKE) -C class/Mono.CSharp.Debugger install DESTDIR="$$DESTDIR" || exit 1; \
tar cvjf "$$chargedir".tar.bz2 "$$chargedir" ; \
rm -rf "$$chargedir"
# Targets for creating API diffs of the framework
MONO_API_SNAPSHOT_PATH := $(topdir)../external/api-snapshot/
GENAPI := $(MONO_API_SNAPSHOT_PATH)tools/genapi/GenAPI.exe
MONO_API_SNAPSHOT_PROFILE_PATH := $(MONO_API_SNAPSHOT_PATH)profiles/$(PROFILE)/
MONO_API_ASSEMBLIES_IGNORED := $(addprefix $(topdir)class/lib/$(PROFILE)/, SystemWebTestShim.dll standalone-runner-support.dll nunit.core.dll nunit.core.extensions.dll nunit.core.interfaces.dll nunit.framework.dll nunit.framework.extensions.dll nunit.mocks.dll nunit.util.dll nunit-console-runner.dll nunitlite.dll)
MONO_API_ASSEMBLIES_IGNORED := $(addprefix $(topdir)class/lib/$(PROFILE)/, Mono.CSharp.dll SystemWebTestShim.dll standalone-runner-support.dll nunit.core.dll nunit.core.extensions.dll nunit.core.interfaces.dll nunit.framework.dll nunit.framework.extensions.dll nunit.mocks.dll nunit.util.dll nunit-console-runner.dll nunitlite.dll)
MONO_API_ASSEMBLIES := $(filter-out $(MONO_API_ASSEMBLIES_IGNORED), $(wildcard $(topdir)class/lib/$(PROFILE)/*.dll)) $(wildcard $(topdir)class/lib/$(PROFILE)/Facades/*.dll)
MONO_API_ASSEMBLIES_CS := $(MONO_API_ASSEMBLIES:$(topdir)class/lib/$(PROFILE)/%.dll=$(MONO_API_SNAPSHOT_PROFILE_PATH)%.cs)
+20 -19
View File
@@ -19,31 +19,34 @@ package module which drives the compilation of this directory.
class/
The class libraries.
docs/
Some notes on the compiler and the class libraries.
errors/
Sample programs that should generate errors by the C# compiler.
ilasm/
The IL assembler.
jay/
Yacc-based parser generator.
mcs/
The Mono C# compiler
nunit24/
An old copy of the NUnit 2.4 library that we ship for historical reasons.
packages/
Integrates some packages from NuGet (like Roslyn) into the build system.
tests/
Regression test suite for the C# compiler
docs/
Some notes on the compiler and the class libraries.
nant/
A copy of nant source code, used during the build process
on Windows.
tools/
Various small development tools: CorCompare used to compare
two assemblies for differences in the API; TypeReflector is
a tool used to introspect types from assemblies from the
command line; MonoStyle helps you keep your code indendented
with the Mono programming style.
two assemblies for differences in the API; csharp is a C# REPL;
cil-strip trims IL from assemblies.
* Building Individual Directories
=================================
@@ -51,14 +54,14 @@ package module which drives the compilation of this directory.
You can build individual components in the hierarchy by running the command
"make", and to install it use "make install".
By default, the 2.x profile is built, if you want to build the net 1.1 profile,
By default, the 4.x profile is built, if you want to build other profiles,
use the following command:
make PROFILE=net_1_1
make PROFILE=<profilename>
And to install:
make PROFILE=net_1_1 install
make PROFILE=<profilename> install
To turn on verbose mode in the build (for example to diagnose a
problem), you can use the V=1 flag, like this:
@@ -68,16 +71,14 @@ problem), you can use the V=1 flag, like this:
* Running Unit tests
====================
You can run unit tests in individual components by running the command
"make run-test". If you want to run tests for a different profile (say
'net_1_1')
You can run unit tests in individual components by running the command:
make run-test PROFILE=net_1_1
make run-test
If you want to only run the tests in a single fixture (say
'MonoTests.System.TypeTest'), you can use
make run-test TEST_HARNESS_FLAGS=/fixture:MonoTests.System.TypeTest
make run-test TEST_FIXTURE=System.TypeTest
* Acknowledgements
==================
-8
View File
@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="3.5" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\ExtensionPack\MSBuild.ExtensionPack.tasks"/>
<Target Name="Build">
<Copy SourceFiles="common\Consts.cs.in" DestinationFiles="common\Consts.cs"/>
<MSBuild.ExtensionPack.FileSystem.File TaskAction="Replace" RegexPattern="@MONO_VERSION@" Replacement="2.7.0.0" Files="common\Consts.cs"/>
</Target>
</Project>
-2
View File
@@ -1,2 +0,0 @@
/Mono.Common.targets -crlf
/Mono.Default.targets -crlf
-28
View File
@@ -1,28 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="3.5" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\ExtensionPack\MSBuild.ExtensionPack.tasks"/>
<PropertyGroup Condition=" '$(USE_MONO_COMPILER)' == '1' ">
<CscToolExe>gmcs.bat</CscToolExe>
<CscToolPath>C:\MonoExperimental2.5.0\bin</CscToolPath>
</PropertyGroup>
<PropertyGroup Condition=" ('$(Configuration)' == 'basic' Or '$(Configuration)' == 'basic_XML_DEP') ">
<OutputPath Condition=" '$(OutputPath)' == '' ">$(MSBuildProjectDirectory)\..\lib\basic\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'net_2_0_bootstrap' ">
<OutputPath Condition=" '$(OutputPath)' == '' ">$(MSBuildProjectDirectory)\..\lib\net_2_0_bootstrap\</OutputPath>
</PropertyGroup>
<PropertyGroup>
<OutputPath Condition=" '$(OutputPath)' == '' ">$(MSBuildProjectDirectory)\..\lib\$(Configuration)\</OutputPath>
</PropertyGroup>
<Target Name="SetupProject">
<Copy SourceFiles="$(ResponseFile)" DestinationFiles="$(ResponseFile).msbuild"/>
<MSBuild.ExtensionPack.FileSystem.File TaskAction="Replace" RegexPattern="/" Replacement="\" Files="$(ResponseFile).msbuild"/>
<MakeDir Directories="$(OutputDirectory)"/>
</Target>
<PropertyGroup Condition=" '$(ResponseFile)' == '' ">
<ResponseFile>$(MSBuildProjectName).dll.sources</ResponseFile>
</PropertyGroup>
<PropertyGroup>
<CompilerResponseFile>$(ResponseFile).msbuild</CompilerResponseFile>
</PropertyGroup>
</Project>
-7
View File
@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="3.5" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition="'$(Configuration)' == ''">net_2_0</Configuration>
<Platform Condition="'$(Platform)' == ''">AnyCPU</Platform>
</PropertyGroup>
</Project>
+5 -5
View File
@@ -1,6 +1,6 @@
# -*- makefile -*-
monolite_path := $(topdir)/class/lib/monolite/$(MONO_CORLIB_VERSION)
monolite_path := $(topdir)/class/lib/monolite-$(BUILD_PLATFORM)/$(MONO_CORLIB_VERSION)
with_mono_path_monolite = MONO_PATH="$(monolite_path)$(PLATFORM_PATH_SEPARATOR)$(monolite_path)/Facades$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH"
@@ -90,7 +90,7 @@ ifdef use_monolite
do-get-monolite:
do-profile-check-monolite:
@echo "*** The contents of your 'monolite/$(MONO_CORLIB_VERSION)' directory may be out-of-date" 1>&2
@echo "*** The contents of your 'monolite-$(BUILD_PLATFORM)/$(MONO_CORLIB_VERSION)' directory may be out-of-date" 1>&2
@echo "*** You may want to try 'make get-monolite-latest'" 1>&2
rm -f $(monolite_flag)
exit 1
@@ -98,12 +98,12 @@ do-profile-check-monolite:
else
do-get-monolite:
@echo "*** Downloading bootstrap required 'monolite/$(MONO_CORLIB_VERSION)'" 1>&2
$(MAKE) $(MAKE_Q) -C $(mono_build_root) get-monolite-latest
@echo "*** Downloading bootstrap required 'monolite-$(BUILD_PLATFORM)/$(MONO_CORLIB_VERSION)'" 1>&2
$(MAKE) $(MAKE_Q) -C $(topdir)/class get-monolite-latest
do-profile-check-monolite: $(depsdir)/.stamp
@echo "*** The runtime '$(PROFILE_RUNTIME)' doesn't appear to be usable." 1>&2
@echo "*** Trying the 'monolite/$(MONO_CORLIB_VERSION)' directory." 1>&2
@echo "*** Trying the 'monolite-$(BUILD_PLATFORM)/$(MONO_CORLIB_VERSION)' directory." 1>&2
@echo dummy > $(monolite_flag)
$(MAKE) do-profile-check
+3 -1
View File
@@ -6,12 +6,14 @@ BUILD_TOOLS_PROFILE = basic
BOOTSTRAP_MCS = MONO_PATH="$(topdir)/class/lib/$(BOOTSTRAP_PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(INTERNAL_CSC)
MCS = $(BOOTSTRAP_MCS)
PLATFORMS = darwin linux win32
# nuttzing!
profile-check:
@:
DEFAULT_REFERENCES = -r:$(topdir)/class/lib/$(PROFILE)/mscorlib.dll
DEFAULT_REFERENCES = -r:$(topdir)/class/lib/$(PROFILE_DIRECTORY)/mscorlib.dll
PROFILE_MCS_FLAGS = -d:NET_4_0 -d:NET_4_5 -d:MONO -d:WIN_PLATFORM -nowarn:1699 -nostdlib $(DEFAULT_REFERENCES)
NO_SIGN_ASSEMBLY = yes
+2
View File
@@ -2,6 +2,8 @@
include $(topdir)/build/profiles/net_4_x.make
PLATFORMS:=
PARENT_PROFILE = ../net_4_x$(if $(PROFILE_PLATFORM),-$(PROFILE_PLATFORM))/
DEFAULT_REFERENCES = -r:$(topdir)/class/lib/net_4_x$(if $(PROFILE_PLATFORM),-$(PROFILE_PLATFORM))/mscorlib.dll
PROFILE_MCS_FLAGS += -d:XBUILD_12
+5 -7
View File
@@ -20,9 +20,10 @@ TEST_RUNTIME_WRAPPERS_PATH = $(shell dirname $(RUNTIME))/_tmpinst/bin
ifndef NO_TEST
test_nunit_lib = nunitlite.dll
xunit_core := xunit.core xunit.abstractions xunit.assert
xunit_core := xunit.core xunit.abstractions xunit.assert Xunit.NetCore.Extensions
xunit_deps := System.Runtime
xunit_class_deps := Xunit.NetCore.Extensions
xunit_src := $(patsubst %,$(topdir)/../external/xunit-binaries/%,BenchmarkAttribute.cs BenchmarkDiscover.cs)
xunit_class_deps :=
xunit_libs_ref = $(patsubst %,-r:$(topdir)/../external/xunit-binaries/%.dll,$(xunit_core))
xunit_libs_ref += $(patsubst %,-r:$(topdir)/class/lib/$(PROFILE)/Facades/%.dll,$(xunit_deps))
@@ -89,9 +90,6 @@ endif
tests_CLEAN_FILES += $(topdir)/build/deps/nunit-$(PROFILE).stamp
$(topdir)/class/lib/$(PROFILE)/$(PARENT_PROFILE)Xunit.NetCore.Extensions.dll:
$(MAKE) -C $(topdir)/class/Xunit.NetCore.Extensions
endif
test_assemblies :=
@@ -222,8 +220,8 @@ run-xunit-test-lib: xunit-test-local
$$ok
@rm -f xunit.execution.desktop.dll
$(xunit_test_lib): $(the_assembly) $(xtest_response) $(xunit_libs_dep)
$(TEST_COMPILE) $(LIBRARY_FLAGS) $(XTEST_LIB_FLAGS) -target:library -out:$@ $(xtest_flags) @$(xtest_response)
$(xunit_test_lib): $(the_assembly) $(xtest_response) $(xunit_libs_dep) $(xunit_src)
$(TEST_COMPILE) $(LIBRARY_FLAGS) $(XTEST_LIB_FLAGS) -target:library -out:$@ $(xtest_flags) @$(xtest_response) $(xunit_src)
xtest_response_preprocessed = $(xtest_response)_preprocessed
@@ -30,6 +30,6 @@ using System.Runtime.CompilerServices;
[assembly: AssemblyCompany ("Xamarin, Inc.")]
[assembly: AssemblyProduct ("Mono Common Language Infrastructure")]
[assembly: AssemblyCopyright ("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")]
[assembly: AssemblyVersion ("4.1.0.0")]
[assembly: AssemblyVersion ("4.2.1.0")]
[assembly: AssemblyInformationalVersion ("4.0.0.0")]
[assembly: AssemblyFileVersion ("4.0.0.0")]
@@ -21,39 +21,159 @@
//
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.DBNull))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.AcceptRejectRule))]
[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.CatalogLocation))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.Common.DataAdapter))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.Common.DataColumnMapping))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.Common.DataColumnMappingCollection))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.Common.DataTableMapping))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.Common.DataTableMappingCollection))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.Common.DbColumn))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.Common.DbCommand))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.Common.DbCommandBuilder))]
[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.DbDataAdapter))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.Common.DbDataReader))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.Common.DbDataReaderExtensions))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.Common.DbDataRecord))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.Common.DbDataSourceEnumerator))]
[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.DbMetaDataCollectionNames))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.Common.DbMetaDataColumnNames))]
[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.DbProviderSpecificTypePropertyAttribute))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.Common.DbTransaction))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.Common.GroupByBehavior))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.Common.IDbColumnSchemaGenerator))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.Common.IdentifierCase))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.Common.RowUpdatedEventArgs))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.Common.RowUpdatingEventArgs))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.Common.SchemaTableColumn))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.Common.SchemaTableOptionalColumn))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.Common.SupportedJoinOperators))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.ConflictOption))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.ConnectionState))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.Constraint))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.ConstraintCollection))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.ConstraintException))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.DBConcurrencyException))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.DataColumn))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.DataColumnChangeEventArgs))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.DataColumnChangeEventHandler))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.DataColumnCollection))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.DataException))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.DataRelation))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.DataRelationCollection))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.DataRow))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.DataRowAction))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.DataRowBuilder))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.DataRowChangeEventArgs))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.DataRowChangeEventHandler))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.DataRowCollection))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.DataRowState))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.DataRowVersion))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.DataRowView))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.DataSet))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.DataSetDateTime))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.DataSysDescriptionAttribute))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.DataTable))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.DataTableClearEventArgs))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.DataTableClearEventHandler))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.DataTableCollection))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.DataTableNewRowEventArgs))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.DataTableNewRowEventHandler))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.DataTableReader))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.DataView))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.DataViewManager))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.DataViewRowState))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.DataViewSetting))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.DataViewSettingCollection))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.DbType))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.DeletedRowInaccessibleException))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.DuplicateNameException))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.EvaluateException))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.FillErrorEventArgs))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.FillErrorEventHandler))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.ForeignKeyConstraint))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.IColumnMapping))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.IColumnMappingCollection))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.IDataAdapter))]
[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.IDbDataAdapter))]
[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.ITableMapping))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.ITableMappingCollection))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.InRowChangingEventException))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.InternalDataCollectionBase))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.InvalidConstraintException))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.InvalidExpressionException))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.IsolationLevel))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.KeyRestrictionBehavior))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.LoadOption))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.MappingType))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.MergeFailedEventArgs))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.MergeFailedEventHandler))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.MissingMappingAction))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.MissingPrimaryKeyException))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.MissingSchemaAction))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.NoNullAllowedException))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.ParameterDirection))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.PropertyCollection))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.ReadOnlyException))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.RowNotInTableException))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.Rule))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.SchemaSerializationMode))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.SchemaType))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.SerializationFormat))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.SqlDbType))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.SqlTypes.INullable))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.SqlTypes.SqlAlreadyFilledException))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.SqlTypes.SqlBinary))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.SqlTypes.SqlBoolean))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.SqlTypes.SqlByte))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.SqlTypes.SqlBytes))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.SqlTypes.SqlChars))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.SqlTypes.SqlCompareOptions))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.SqlTypes.SqlDateTime))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.SqlTypes.SqlDecimal))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.SqlTypes.SqlDouble))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.SqlTypes.SqlGuid))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.SqlTypes.SqlInt16))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.SqlTypes.SqlInt32))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.SqlTypes.SqlInt64))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.SqlTypes.SqlMoney))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.SqlTypes.SqlNotFilledException))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.SqlTypes.SqlNullValueException))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.SqlTypes.SqlSingle))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.SqlTypes.SqlString))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.SqlTypes.SqlTruncateException))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.SqlTypes.SqlTypeException))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.SqlTypes.SqlXml))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.SqlTypes.StorageState))]
[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.StatementCompletedEventArgs))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.StatementCompletedEventHandler))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.StatementType))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.StrongTypingException))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.SyntaxErrorException))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.UniqueConstraint))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.UpdateRowSource))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.UpdateStatus))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.VersionNotFoundException))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.XmlReadMode))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.XmlWriteMode))]
@@ -30,6 +30,6 @@ using System.Runtime.CompilerServices;
[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.2.0")]
[assembly: AssemblyVersion ("4.1.1.0")]
[assembly: AssemblyInformationalVersion ("4.0.0.0")]
[assembly: AssemblyFileVersion ("4.0.0.0")]
@@ -22,4 +22,19 @@
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.StackFrame))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.StackTrace))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.SymbolStore.ISymbolBinder))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.SymbolStore.ISymbolBinder1))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.SymbolStore.ISymbolDocument))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.SymbolStore.ISymbolDocumentWriter))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.SymbolStore.ISymbolMethod))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.SymbolStore.ISymbolNamespace))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.SymbolStore.ISymbolReader))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.SymbolStore.ISymbolScope))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.SymbolStore.ISymbolVariable))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.SymbolStore.ISymbolWriter))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.SymbolStore.SymAddressKind))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.SymbolStore.SymDocumentType))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.SymbolStore.SymLanguageType))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.SymbolStore.SymLanguageVendor))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.SymbolStore.SymbolToken))]
@@ -30,6 +30,6 @@ using System.Runtime.CompilerServices;
[assembly: AssemblyCompany ("Xamarin, Inc.")]
[assembly: AssemblyProduct ("Mono Common Language Infrastructure")]
[assembly: AssemblyCopyright ("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")]
[assembly: AssemblyVersion ("4.1.0.0")]
[assembly: AssemblyVersion ("4.2.1.0")]
[assembly: AssemblyInformationalVersion ("4.0.0.0")]
[assembly: AssemblyFileVersion ("4.0.0.0")]
@@ -30,6 +30,6 @@ using System.Runtime.CompilerServices;
[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.1.0")]
[assembly: AssemblyVersion ("4.1.1.0")]
[assembly: AssemblyInformationalVersion ("4.0.0.0")]
[assembly: AssemblyFileVersion ("4.0.0.0")]
@@ -30,6 +30,6 @@ using System.Runtime.CompilerServices;
[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: AssemblyVersion ("4.0.1.0")]
[assembly: AssemblyInformationalVersion ("4.0.0.0")]
[assembly: AssemblyFileVersion ("4.0.0.0")]
@@ -30,6 +30,6 @@ using System.Runtime.CompilerServices;
[assembly: AssemblyCompany ("Xamarin, Inc.")]
[assembly: AssemblyProduct ("Mono Common Language Infrastructure")]
[assembly: AssemblyCopyright ("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")]
[assembly: AssemblyVersion ("4.1.0.0")]
[assembly: AssemblyVersion ("4.2.1.0")]
[assembly: AssemblyInformationalVersion ("4.0.0.0")]
[assembly: AssemblyFileVersion ("4.0.0.0")]
@@ -27,6 +27,7 @@
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Sockets.LingerOption))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Sockets.MulticastOption))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Sockets.NetworkStream))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Sockets.ProtocolFamily))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Sockets.ProtocolType))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Sockets.SelectMode))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Sockets.SendPacketsElement))]
@@ -39,7 +39,7 @@ using System.Runtime.CompilerServices;
[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.1.0")]
[assembly: AssemblyVersion ("4.0.3.0")]
[assembly: AssemblyInformationalVersion ("4.0.0.0")]
[assembly: AssemblyFileVersion ("4.0.0.0")]
@@ -12,7 +12,7 @@ LIBRARY = System.Runtime.InteropServices.RuntimeInformation.dll
RESX_RESOURCE_STRING = ../../../../external/corefx/src/System.Runtime.InteropServices.RuntimeInformation/src/Resources/Strings.resx
KEY_FILE = ../../msfinal.pub
SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699,436
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS) /unsafe
@@ -35,12 +35,9 @@ 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 ();
return "Mono " + Mono.Runtime.GetDisplayName ();
}
}
@@ -30,6 +30,6 @@ using System.Runtime.CompilerServices;
[assembly: AssemblyCompany ("Xamarin, Inc.")]
[assembly: AssemblyProduct ("Mono Common Language Infrastructure")]
[assembly: AssemblyCopyright ("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")]
[assembly: AssemblyVersion ("4.1.1.0")]
[assembly: AssemblyVersion ("4.2.1.0")]
[assembly: AssemblyInformationalVersion ("4.0.0.0")]
[assembly: AssemblyFileVersion ("4.0.0.0")]
@@ -25,7 +25,11 @@
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Serialization.DataContractAttribute))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Serialization.DataMemberAttribute))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Serialization.EnumMemberAttribute))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Serialization.ExportOptions))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Serialization.ExtensionDataObject))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Serialization.IExtensibleDataObject))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Serialization.IgnoreDataMemberAttribute))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Serialization.InvalidDataContractException))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Serialization.KnownTypeAttribute))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Serialization.OnDeserializedAttribute))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Serialization.OnDeserializingAttribute))]
@@ -33,4 +37,13 @@
[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))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Serialization.StreamingContextStates))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Serialization.XmlSerializableServices))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Serialization.XPathQueryGenerator))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Serialization.XsdDataContractExporter))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.IFragmentCapableXmlDictionaryWriter))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.IStreamProvider))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.IXmlBinaryReaderInitializer))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.IXmlBinaryWriterInitializer))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.IXmlTextReaderInitializer))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.IXmlTextWriterInitializer))]
@@ -30,6 +30,6 @@ using System.Runtime.CompilerServices;
[assembly: AssemblyCompany ("Xamarin, Inc.")]
[assembly: AssemblyProduct ("Mono Common Language Infrastructure")]
[assembly: AssemblyCopyright ("Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)")]
[assembly: AssemblyVersion ("4.2.0.0")]
[assembly: AssemblyVersion ("4.3.1.0")]
[assembly: AssemblyInformationalVersion ("4.0.0.0")]
[assembly: AssemblyFileVersion ("4.0.0.0")]
@@ -21,27 +21,55 @@
//
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Aes))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.AesManaged))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.AsymmetricKeyExchangeDeformatter))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.AsymmetricKeyExchangeFormatter))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.AsymmetricSignatureDeformatter))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.AsymmetricSignatureFormatter))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.CryptoConfig))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.DeriveBytes))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.DES))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.DSA))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.DSAParameters))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.DSASignatureDeformatter))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.DSASignatureFormatter))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.ECCurve))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.ECDiffieHellmanPublicKey))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.ECDsa))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.ECParameters))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.ECPoint))]
[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.MaskGenerationMethod))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.MD5))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.PKCS1MaskGenerationMethod))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.RandomNumberGenerator))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.RC2))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Rfc2898DeriveBytes))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Rijndael))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.RijndaelManaged))]
[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.RSAOAEPKeyExchangeDeformatter))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.RSAOAEPKeyExchangeFormatter))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.RSAParameters))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.RSAPKCS1KeyExchangeDeformatter))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.RSAPKCS1KeyExchangeFormatter))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.RSAPKCS1SignatureDeformatter))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.RSAPKCS1SignatureFormatter))]
[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.SHA1Managed))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.SHA256))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.SHA256Managed))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.SHA384))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.SHA384Managed))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.SHA512))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.SHA512Managed))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.SignatureDescription))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.TripleDES))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.ECCurve))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.ECParameters))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.ECPoint))]
@@ -30,6 +30,6 @@ using System.Runtime.CompilerServices;
[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: AssemblyVersion ("4.1.1.0")]
[assembly: AssemblyInformationalVersion ("4.0.0.0")]
[assembly: AssemblyFileVersion ("4.0.0.0")]
@@ -30,6 +30,6 @@ using System.Runtime.CompilerServices;
[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.1.0")]
[assembly: AssemblyVersion ("4.1.1.0")]
[assembly: AssemblyInformationalVersion ("4.0.0.0")]
[assembly: AssemblyFileVersion ("4.0.0.0")]
@@ -22,5 +22,6 @@
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.IOCompletionCallback))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.NativeOverlapped))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.Overlapped))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.PreAllocatedOverlapped))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.ThreadPoolBoundHandle))]
@@ -30,6 +30,6 @@ using System.Runtime.CompilerServices;
[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.1.0")]
[assembly: AssemblyVersion ("4.0.3.0")]
[assembly: AssemblyInformationalVersion ("4.0.0.0")]
[assembly: AssemblyFileVersion ("4.0.0.0")]
@@ -30,7 +30,7 @@ using System.Runtime.CompilerServices;
[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.1.0")]
[assembly: AssemblyVersion ("4.1.1.0")]
[assembly: AssemblyInformationalVersion ("4.0.0.0")]
[assembly: AssemblyFileVersion ("4.0.0.0")]
+1 -25
View File
@@ -1,25 +1 @@
The MIT X11 License covers most of the class libraries in the Mono
project. Some third party libraries come from different projects, and
are licensed under their own terms.
Copyright (c) 2001, 2002, 2003 The Mono Project
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
See LICENSE file in the project root for full license information.
+25 -8
View File
@@ -381,8 +381,7 @@ DISTFILES = \
MicrosoftAjaxLibrary/License.htm \
test-helpers/NetworkHelpers.cs \
test-helpers/SocketResponder.cs \
lib/$(monolite_dir)/mcs.exe \
$(monolite_files)
$(foreach HOST_PLATFORM,darwin linux win32,lib/$(monolite_dir)/mcs.exe $(monolite_files))
.PHONY: all-local $(STD_TARGETS:=-local)
all-local $(STD_TARGETS:=-local):
@@ -390,7 +389,7 @@ all-local $(STD_TARGETS:=-local):
all-local-aot:
monolite_dir := monolite/$(MONO_CORLIB_VERSION)
monolite_dir = monolite-$(HOST_PLATFORM)/$(MONO_CORLIB_VERSION)
# Files needed to bootstrap C# compiler
build_files = mscorlib.dll System.dll System.Xml.dll Mono.Security.dll System.Core.dll System.Security.dll System.Configuration.dll \
@@ -413,24 +412,42 @@ lib/$(monolite_dir)/Facades:
$(monolite_files): | lib/$(monolite_dir)
$(monolite_files): | lib/$(monolite_dir)/Facades
$(monolite_files): lib/$(monolite_dir)/%: lib/build/%
$(monolite_files): lib/$(monolite_dir)/%: lib/build-$(HOST_PLATFORM)/%
cp -p $< $@
lib/$(monolite_dir)/mcs.exe:
$(MAKE) -C ../mcs PROFILE=build
cp -p lib/build/mcs.exe lib/$(monolite_dir)
cp -p lib/build-$(HOST_PLATFORM)/mcs.exe lib/$(monolite_dir)
$(build_files:%=lib/build/%):
$(build_files:%=lib/build-$(HOST_PLATFORM)/%):
cd $(topdir) && $(MAKE) profile-do--build--all NO_DIR_CHECK=1 SKIP_AOT=1
dist-monolite: $(monolite_files) lib/$(monolite_dir)/mcs.exe
dist-monolite-all-platforms:
$(MAKE) dist-monolite HOST_PLATFORM=darwin
$(MAKE) dist-monolite HOST_PLATFORM=linux
$(MAKE) dist-monolite HOST_PLATFORM=win32
package-monolite-latest:
MONOLITE=monolite-$(MONO_CORLIB_VERSION)-latest; \
MONOLITE=monolite-$(HOST_PLATFORM)-$(MONO_CORLIB_VERSION)-latest; \
$(MAKE) dist-monolite monolite_dir=$$MONOLITE; \
tar zcvpf $$MONOLITE.tar.gz --directory=lib $$MONOLITE/
dist-default: dist-monolite
package-monolite-latest-all-platforms:
$(MAKE) package-monolite-latest HOST_PLATFORM=darwin
$(MAKE) package-monolite-latest HOST_PLATFORM=linux
$(MAKE) package-monolite-latest HOST_PLATFORM=win32
monolite_url = https://download.mono-project.com/monolite/monolite-$(BUILD_PLATFORM)-$(MONO_CORLIB_VERSION)-latest.tar.gz
get-monolite-latest:
-rm -fr lib/monolite-$(BUILD_PLATFORM)/$(MONO_CORLIB_VERSION)
-mkdir -p lib/monolite-$(BUILD_PLATFORM)
cd lib && { (wget -O- $(monolite_url) || curl -L $(monolite_url)) | gzip -d | tar xf - ; }
cd lib && mv -f monolite-$(BUILD_PLATFORM)-$(MONO_CORLIB_VERSION)-latest monolite-$(BUILD_PLATFORM)/$(MONO_CORLIB_VERSION)
dist-default: dist-monolite-all-platforms
dist-local: dist-default
@@ -58,9 +58,6 @@ corefx/SR.cs
../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Conversions.cs
../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/COperators.cs
../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Declarations/AggregateDeclaration.cs
../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Declarations/Declaration.cs
../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Declarations/GlobalAttributeDeclaration.cs
../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Declarations/NamespaceDeclaration.cs
../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/ExplicitConversion.cs
../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/ExpressionBinder.cs
../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/ExpressionKind.cs
@@ -91,7 +88,6 @@ corefx/SR.cs
../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/EventSymbol.cs
../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/FieldSymbol.cs
../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/IndexerSymbol.cs
../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/LabelSymbol.cs
../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/LocalVariableSymbol.cs
../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/MethodOrPropertySymbol.cs
../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/MethodSymbol.cs
@@ -109,13 +105,11 @@ corefx/SR.cs
../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/SymbolTable.cs
../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/SymFactory.cs
../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/SymFactoryBase.cs
../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/TransparentIdentifierMemberSymbol.cs
../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/TypeParameterSymbol.cs
../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/UnresolvedAggregateSymbol.cs
../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/VariableSymbol.cs
../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/ArrayIndex.cs
../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/ArrayInitialization.cs
../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/ArrayLength.cs
../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Assignment.cs
../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/BinaryOperator.cs
../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Block.cs
@@ -125,7 +119,6 @@ corefx/SR.cs
../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Class.cs
../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/CompoundOperator.cs
../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Concatenate.cs
../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/ConditionalOperator.cs
../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Constant.cs
../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Event.cs
../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/EXPR.cs
@@ -228,7 +228,7 @@ namespace MonoTests.Mono.Options
e.Run = (args) => e.CommandSet.Out.WriteLine (string.Join (" ", args));
var o = new StringWriter ();
var c = new CommandSet ("set", output:o) {
var c = new CommandSet ("set", output:o, error: Console.Error) {
e,
};
Assert.AreEqual (0, c.Run (new [] { "help", "echo" }));
@@ -56,7 +56,7 @@ namespace MonoTests.Mono.Options
c, v => { string ignore = v.OptionValues [0]; });
c.Option = p [0];
Utils.AssertException (typeof(ArgumentOutOfRangeException),
"Specified argument was out of the range of valid values.\nParameter name: index",
$"Specified argument was out of the range of valid values.{Environment.NewLine}Parameter name: index",
c, v => { string ignore = v.OptionValues [2]; });
c.OptionName = "-a";
Utils.AssertException (typeof(OptionException),
@@ -374,10 +374,10 @@ namespace MonoTests.Mono.Options
p, v => { v.Parse (_("-a", "-b")); });
Assert.AreEqual (a, "-b");
Utils.AssertException (typeof(ArgumentNullException),
"Value cannot be null.\nParameter name: option",
$"Value cannot be null.{Environment.NewLine}Parameter name: option",
p, v => { v.Add ((Option) null); });
Utils.AssertException (typeof(ArgumentNullException),
"Value cannot be null.\nParameter name: header",
$"Value cannot be null.{Environment.NewLine}Parameter name: header",
p, v => { v.Add ((string) null); });
// bad type
@@ -394,10 +394,10 @@ namespace MonoTests.Mono.Options
p, v => { v.Parse (_("-cz", "extra")); });
Utils.AssertException (typeof(ArgumentNullException),
"Value cannot be null.\nParameter name: action",
$"Value cannot be null.{Environment.NewLine}Parameter name: action",
p, v => { v.Add ("foo", (Action<string>) null); });
Utils.AssertException (typeof(ArgumentException),
"Cannot provide maxValueCount of 2 for OptionValueType.None.\nParameter name: maxValueCount",
$"Cannot provide maxValueCount of 2 for OptionValueType.None.{Environment.NewLine}Parameter name: maxValueCount",
p, v => { v.Add ("foo", (k, val) => {/* ignore */}); });
}
@@ -772,7 +772,7 @@ namespace MonoTests.Mono.Options
Utils.AssertException (typeof(ArgumentException), "prototypes must be null!",
p, v => { v.Add ("N|NUM=", (int n) => {}); });
Utils.AssertException (typeof(ArgumentNullException),
"Value cannot be null.\nParameter name: option",
$"Value cannot be null.{Environment.NewLine}Parameter name: option",
p, v => { v.GetOptionForName (null); });
}
@@ -66,60 +66,60 @@ namespace MonoTests.Mono.Options
{
object p = null;
Utils.AssertException (typeof(ArgumentNullException),
"Value cannot be null.\nParameter name: prototype",
$"Value cannot be null.{Environment.NewLine}Parameter name: prototype",
p, v => { new DefaultOption (null, null); });
Utils.AssertException (typeof(ArgumentException),
"Cannot be the empty string.\nParameter name: prototype",
$"Cannot be the empty string.{Environment.NewLine}Parameter name: prototype",
p, v => { new DefaultOption ("", null); });
Utils.AssertException (typeof(ArgumentException),
"Empty option names are not supported.\nParameter name: prototype",
$"Empty option names are not supported.{Environment.NewLine}Parameter name: prototype",
p, v => { new DefaultOption ("a|b||c=", null); });
Utils.AssertException (typeof(ArgumentException),
"Conflicting option types: '=' vs. ':'.\nParameter name: prototype",
$"Conflicting option types: '=' vs. ':'.{Environment.NewLine}Parameter name: prototype",
p, v => { new DefaultOption ("a=|b:", null); });
Utils.AssertException (typeof(ArgumentException),
"The default option handler '<>' cannot require values.\nParameter name: prototype",
$"The default option handler '<>' cannot require values.{Environment.NewLine}Parameter name: prototype",
p, v => { new DefaultOption ("<>=", null); });
Utils.AssertException (typeof(ArgumentException),
"The default option handler '<>' cannot require values.\nParameter name: prototype",
$"The default option handler '<>' cannot require values.{Environment.NewLine}Parameter name: prototype",
p, v => { new DefaultOption ("<>:", null); });
Utils.AssertException (null, null,
p, v => { new DefaultOption ("t|<>=", null, 1); });
Utils.AssertException (typeof(ArgumentException),
"The default option handler '<>' cannot require values.\nParameter name: prototype",
$"The default option handler '<>' cannot require values.{Environment.NewLine}Parameter name: prototype",
p, v => { new DefaultOption ("t|<>=", null, 2); });
Utils.AssertException (null, null,
p, v => { new DefaultOption ("a|b=", null, 2); });
Utils.AssertException (typeof(ArgumentOutOfRangeException),
"Specified argument was out of the range of valid values.\nParameter name: maxValueCount",
$"Specified argument was out of the range of valid values.{Environment.NewLine}Parameter name: maxValueCount",
p, v => { new DefaultOption ("a", null, -1); });
Utils.AssertException (typeof(ArgumentException),
"Cannot provide maxValueCount of 0 for OptionValueType.Required or " +
"OptionValueType.Optional.\nParameter name: maxValueCount",
$"OptionValueType.Optional.{Environment.NewLine}Parameter name: maxValueCount",
p, v => { new DefaultOption ("a=", null, 0); });
Utils.AssertException (typeof(ArgumentException),
"Ill-formed name/value separator found in \"a={\".\nParameter name: prototype",
"Ill-formed name/value separator found in \"a={\"." + Environment.NewLine + "Parameter name: prototype",
p, v => { new DefaultOption ("a={", null); });
Utils.AssertException (typeof(ArgumentException),
"Ill-formed name/value separator found in \"a=}\".\nParameter name: prototype",
"Ill-formed name/value separator found in \"a=}\"." + Environment.NewLine + "Parameter name: prototype",
p, v => { new DefaultOption ("a=}", null); });
Utils.AssertException (typeof(ArgumentException),
"Ill-formed name/value separator found in \"a={{}}\".\nParameter name: prototype",
"Ill-formed name/value separator found in \"a={{}}\"." + Environment.NewLine + "Parameter name: prototype",
p, v => { new DefaultOption ("a={{}}", null); });
Utils.AssertException (typeof(ArgumentException),
"Ill-formed name/value separator found in \"a={}}\".\nParameter name: prototype",
"Ill-formed name/value separator found in \"a={}}\"." + Environment.NewLine + "Parameter name: prototype",
p, v => { new DefaultOption ("a={}}", null); });
Utils.AssertException (typeof(ArgumentException),
"Ill-formed name/value separator found in \"a={}{\".\nParameter name: prototype",
"Ill-formed name/value separator found in \"a={}{\"." + Environment.NewLine + "Parameter name: prototype",
p, v => { new DefaultOption ("a={}{", null); });
Utils.AssertException (typeof(ArgumentException),
"Cannot provide key/value separators for Options taking 1 value(s).\nParameter name: prototype",
$"Cannot provide key/value separators for Options taking 1 value(s).{Environment.NewLine}Parameter name: prototype",
p, v => { new DefaultOption ("a==", null); });
Utils.AssertException (typeof(ArgumentException),
"Cannot provide key/value separators for Options taking 1 value(s).\nParameter name: prototype",
$"Cannot provide key/value separators for Options taking 1 value(s).{Environment.NewLine}Parameter name: prototype",
p, v => { new DefaultOption ("a={}", null); });
Utils.AssertException (typeof(ArgumentException),
"Cannot provide key/value separators for Options taking 1 value(s).\nParameter name: prototype",
$"Cannot provide key/value separators for Options taking 1 value(s).{Environment.NewLine}Parameter name: prototype",
p, v => { new DefaultOption ("a=+-*/", null); });
Utils.AssertException (null, null,
p, v => { new DefaultOption ("a", null, 0); });
+11 -2
View File
@@ -34,9 +34,16 @@ using System.Reflection;
using System.Runtime.InteropServices;
using System.Security.Permissions;
[assembly: AssemblyVersion (Consts.FxVersion)]
#if MONO_POSIX_NETSTANDARD_BUILD
[assembly: AssemblyVersion ("1.0.0.0")]
[assembly: AssemblyTitle("Mono.Posix.NETStandard.dll")]
#else
[assembly: AssemblyVersion (Consts.FxVersion)]
[assembly: AssemblyTitle("Mono.Posix.dll")]
#endif
[assembly: AssemblyDescription("Unix Integration Classes")]
[assembly: CLSCompliant (true)]
@@ -48,9 +55,11 @@ using System.Security.Permissions;
*/
#if !MONO_POSIX_NETSTANDARD_BUILD
// We are using ../Open.snk for MONO_POSIX_NETSTANDARD_BUILD
[assembly: AssemblyDelaySign (true)]
[assembly: AssemblyKeyFile ("../mono.pub")]
#endif
/*
* TODO:
*
@@ -0,0 +1,35 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<AssemblyName>Mono.Posix.NETStandard</AssemblyName>
<GenerateAssemblyDescriptionAttribute>false</GenerateAssemblyDescriptionAttribute>
<GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute>
<GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute>
<EnableDefaultItems>false</EnableDefaultItems>
<SignAssembly>true</SignAssembly>
<DelaySign>true</DelaySign>
<AssemblyOriginatorKeyFile>..\Open.snk</AssemblyOriginatorKeyFile>
<!--<BaseIntermediateOutputPath>obj-netstandard2.0</BaseIntermediateOutputPath>
<IntermediateOutputPath>obj-netstandard2.0</IntermediateOutputPath>-->
</PropertyGroup>
<PropertyGroup>
<DefineConstants>$(DefineConstants);MONO_POSIX_NETSTANDARD_BUILD</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(ForceUseLibC)' == 'true'">
<DefineConstants>$(DefineConstants);FORCE_USE_LIBC_NOT_MSVC</DefineConstants>
</PropertyGroup>
<ItemGroup>
<Compile Include=".\Assembly\**\*.cs" />
<Compile Include=".\Mono.Posix\**\*.cs" />
<Compile Include=".\Mono.Unix\**\*.cs" />
<Compile Include=".\Mono.Unix.Native\**\*.cs" />
<Compile Include="..\..\build\common\Locale.cs" />
<Compile Remove=".\Mono.Unix.Native\CdeclFunction.cs" />
</ItemGroup>
</Project>
@@ -309,6 +309,7 @@ namespace Mono.Unix.Native {
public delegate void SignalHandler (int signal);
#if !NETSTANDARD2_0
internal class XPrintfFunctions
{
internal delegate object XPrintf (object[] parameters);
@@ -335,6 +336,7 @@ namespace Mono.Unix.Native {
syslog = new XPrintf (_syslog.Invoke);
}
}
#endif
//
// Convention: Functions that are part of the C standard library go here.
@@ -378,7 +380,11 @@ namespace Mono.Unix.Native {
//
public class Stdlib
{
#if FORCE_USE_LIBC_NOT_MSVC
internal const string LIBC = "c";
#else
internal const string LIBC = "msvcrt";
#endif
internal const string MPH = "MonoPosixHelper";
// It is possible for Mono.Posix and MonoPosixHelper to get out of sync,
@@ -771,6 +777,7 @@ namespace Mono.Unix.Native {
return sys_fprintf (stream, "%s", message);
}
#if !NETSTANDARD2_0
[Obsolete ("Not necessarily portable due to cdecl restrictions.\n" +
"Use fprintf (IntPtr, string) instead.")]
public static int fprintf (IntPtr stream, string format, params object[] parameters)
@@ -781,6 +788,7 @@ namespace Mono.Unix.Native {
Array.Copy (parameters, 0, _parameters, 2, parameters.Length);
return (int) XPrintfFunctions.fprintf (_parameters);
}
#endif
/* SKIP: fscanf(3) */
@@ -793,6 +801,7 @@ namespace Mono.Unix.Native {
return sys_printf ("%s", message);
}
#if !NETSTANDARD2_0
[Obsolete ("Not necessarily portable due to cdecl restrictions.\n" +
"Use printf (string) instead.")]
public static int printf (string format, params object[] parameters)
@@ -802,6 +811,7 @@ namespace Mono.Unix.Native {
Array.Copy (parameters, 0, _parameters, 1, parameters.Length);
return (int) XPrintfFunctions.printf (_parameters);
}
#endif
/* SKIP: scanf(3) */
@@ -823,6 +833,7 @@ namespace Mono.Unix.Native {
return sys_snprintf (s, (ulong) s.Capacity, "%s", message);
}
#if !NETSTANDARD2_0
[CLSCompliant (false)]
[Obsolete ("Not necessarily portable due to cdecl restrictions.\n" +
"Use snprintf (StringBuilder, string) instead.")]
@@ -853,6 +864,7 @@ namespace Mono.Unix.Native {
Array.Copy (parameters, 0, _parameters, 3, parameters.Length);
return (int) XPrintfFunctions.snprintf (_parameters);
}
#endif
/*
* SKIP:
@@ -4387,6 +4387,7 @@ namespace Mono.Unix.Native {
return UnixMarshal.EscapeFormatString (message, new char[]{'m'});
}
#if !NETSTANDARD2_0
[Obsolete ("Not necessarily portable due to cdecl restrictions.\n" +
"Use syslog(SyslogFacility, SyslogLevel, string) instead.")]
public static int syslog (SyslogFacility facility, SyslogLevel level,
@@ -4415,6 +4416,7 @@ namespace Mono.Unix.Native {
Array.Copy (parameters, 0, _parameters, 2, parameters.Length);
return (int) XPrintfFunctions.syslog (_parameters);
}
#endif
[DllImport (MPH, SetLastError=true,
EntryPoint="Mono_Posix_Syscall_closelog")]
+25 -7
View File
@@ -300,17 +300,35 @@ public class UnixEncoding : Encoding
throw new ArgumentOutOfRangeException ("byteIndex", _("ArgRange_Array"));
}
unsafe {
fixed (char* p = s) {
fixed (byte* b = bytes) {
return GetBytes (p + charIndex, charCount, b + byteIndex, bytes.Length - byteIndex);
}
}
}
}
public unsafe override int GetBytes(char* chars, int charCount, byte* bytes, int byteCount)
{
if (bytes == null || chars == null)
throw new ArgumentNullException (bytes == null ? "bytes" : "chars");
if (charCount < 0 || byteCount < 0)
throw new ArgumentOutOfRangeException (charCount < 0 ? "charCount" : "byteCount");
// Convert the characters into bytes.
char ch;
int length = bytes.Length;
int length = byteCount;
uint pair;
int posn = byteIndex;
int posn = 0;
int charIndex = 0;
while (charCount > 0) {
// Fetch the next UTF-16 character pair value.
ch = s[charIndex++];
ch = chars [charIndex++];
if (ch >= '\uD800' && ch <= '\uDBFF' && charCount > 1) {
// This may be the start of a surrogate pair.
pair = (uint)(s[charIndex]);
pair = (uint)(chars[charIndex]);
if (pair >= (uint)0xDC00 && pair <= (uint)0xDFFF) {
pair = (pair - (uint)0xDC00) +
((((uint)ch) - (uint)0xD800) << 10) +
@@ -326,7 +344,7 @@ public class UnixEncoding : Encoding
}
charCount -= 2;
if (charCount >= 0) {
bytes[posn++] = (byte) s [charIndex++];
bytes[posn++] = (byte)chars [charIndex++];
}
continue;
} else {
@@ -365,7 +383,7 @@ public class UnixEncoding : Encoding
}
// Return the final count to the caller.
return posn - byteIndex;
return posn;
}
// Internal version of "GetCharCount" which can handle a rolling
@@ -394,7 +412,7 @@ public class UnixEncoding : Encoding
uint leftSoFar = (leftOverCount & (uint)0x0F);
uint leftSize = ((leftOverCount >> 4) & (uint)0x0F);
while (count > 0) {
ch = (uint)(bytes[index++]);
ch = (uint)(bytes [index++]);
++next_raw;
--count;
if (leftSize == 0) {
+30 -15
View File
@@ -325,27 +325,42 @@ namespace Mono.Unix {
if (encoding == null)
throw new ArgumentNullException ("encoding");
int min_byte_count = encoding.GetMaxByteCount(1);
char[] copy = s.ToCharArray (index, count);
byte[] marshal = new byte [encoding.GetByteCount (copy) + min_byte_count];
if (index < 0 || count < 0)
throw new ArgumentOutOfRangeException ((index < 0 ? "index" : "count"),
"Non - negative number required.");
int bytes_copied = encoding.GetBytes (copy, 0, copy.Length, marshal, 0);
if (s.Length - index < count)
throw new ArgumentOutOfRangeException ("s", "Index and count must refer to a location within the string.");
if (bytes_copied != (marshal.Length-min_byte_count))
throw new NotSupportedException ("encoding.GetBytes() doesn't equal encoding.GetByteCount()!");
int null_terminator_count = encoding.GetMaxByteCount (1);
int length_without_null = encoding.GetByteCount (s);
int marshalLength = checked (length_without_null + null_terminator_count);
IntPtr mem = AllocHeap (marshal.Length);
IntPtr mem = AllocHeap (marshalLength);
if (mem == IntPtr.Zero)
throw new UnixIOException (Native.Errno.ENOMEM);
bool copied = false;
try {
Marshal.Copy (marshal, 0, mem, marshal.Length);
copied = true;
}
finally {
if (!copied)
FreeHeap (mem);
unsafe {
fixed (char* p = s) {
byte* marshal = (byte*)mem;
int bytes_copied;
try {
bytes_copied = encoding.GetBytes (p + index, count, marshal, marshalLength);
} catch {
FreeHeap (mem);
throw;
}
if (bytes_copied != length_without_null) {
FreeHeap (mem);
throw new NotSupportedException ("encoding.GetBytes() doesn't equal encoding.GetByteCount()!");
}
marshal += length_without_null;
for (int i = 0; i < null_terminator_count; ++i)
marshal[i] = 0;
}
}
return mem;
@@ -56,7 +56,7 @@ namespace MonoTests.Mono.Unix.Native {
Assert.IsFalse (NativeConvert.ToSignum (st.signalReceived) == Signum.SIGURG,
"#IH: Signal Handler invoked when it should have been removed!");
}
#if !NETCOREAPP2_0
[Test]
// MSVCRT.DLL doesn't export snprintf(3).
[Category ("NotDotNet")]
@@ -92,6 +92,7 @@ namespace MonoTests.Mono.Unix.Native {
Assert.AreEqual (s.ToString(), expected,
"#SNPF: printf of many builtin types failed");
}
#endif
}
}
@@ -86,6 +86,8 @@ namespace Mono.Security.Interface
void EndWrite (IAsyncResult asyncResult);
Task ShutdownAsync ();
TransportContext TransportContext {
get;
}
@@ -27,6 +27,7 @@ Mono.Security.Cryptography/PKCS8Test.cs
Mono.Security.Cryptography/RSAManagedTest.cs
Mono.Security.Cryptography/SHA224ManagedTest.cs
Mono.Security.Cryptography/SHA224Test.cs
Mono.Security.Interface/TestProvider.cs
Mono.Security.Protocol.Ntlm/ChallengeResponseTest.cs
Mono.Security.Protocol.Ntlm/MessageBaseTest.cs
Mono.Security.Protocol.Ntlm/Type1MessageTest.cs
@@ -0,0 +1,47 @@
//
// TestProvider.cs
//
// Author:
// Martin Baulig <[email protected]>
//
// Copyright (c) 2017 Xamarin, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
using System.IO;
using System.Security.Cryptography;
using System.Text;
using Mono.Security;
using Mono.Security.Interface;
using NUnit.Framework;
namespace MonoTests.Mono.Security
{
[TestFixture]
public class TestProvider
{
[Test]
public void GetProvider ()
{
var provider = MonoTlsProviderFactory.GetProvider ();
Assert.IsNotNull (provider, "TLS Provider");
}
}
}
+1 -257
View File
@@ -35,15 +35,6 @@ testing.
of comments in the source code for that purpose, and if the
problem requires to be followed up on, file a bug.
* Supporting .NET 1.2, .NET 1.1 and .NET 1.0 builds
The defines NET_1_1 and NET_2_0 are used to include
features. When NET_2_0 is defined, it also implies that the
NET_1_1 is defined.
To have code which is only available in an old version, use ONLY_1_0,
ONLY_1_1
* Tagging buggy code
If there is a bug in your implementation tag the problem by using
@@ -69,255 +60,8 @@ testing.
not only stupid, but leading to unreliable code).
In those cases, use the keyword "LAMESPEC".
* Coding considerations and style.
In order to keep the code consistent, please use the following
conventions. From here on `good' and `bad' are used to attribute
things that would make the coding style match, or not match. It is not
a judgement call on your coding abilities, but more of a style and
look call. Please try to follow these guidelines to ensure prettiness.
Use 8 space tabs for writing your code (hopefully we can keep
this consistent). If you are modifying someone else's code, try
to keep the coding style similar.
Since we are using 8-space tabs, you might want to consider the Linus
Torvals trick to reduce code nesting. Many times in a loop, you will
find yourself doing a test, and if the test is true, you will nest.
Many times this can be changed. Example:
for (i = 0; i < 10; i++) {
if (something (i)) {
do_more ();
}
}
This take precious space, instead write it like this:
for (i = 0; i < 10; i++) {
if (!something (i))
continue;
do_more ();
}
A few guidelines:
* Use a space before an opening parenthesis when calling
functions, or indexing, like this:
method (a);
b [10];
* Do not put a space after the opening parenthesis and the
closing one, ie:
good: method (a); array [10];
bad: method ( a ); array[ 10 ];
* Inside a code block, put the opening brace on the same line
as the statement:
good:
if (a) {
code ();
code ();
}
bad:
if (a)
{
code ();
code ();
}
* Avoid using unnecessary open/close braces, vertical space
is usually limited:
good:
if (a)
code ();
bad:
if (a) {
code ();
}
* When defining a method, use the C style for brace placement,
that means, use a new line for the brace, like this:
good:
void Method ()
{
}
bad:
void Method () {
}
* Properties and indexers are an exception, keep the
brace on the same line as the property declaration.
Rationale: this makes it visually
simple to distinguish them.
good:
int Property {
get {
return value;
}
}
bad:
int Property
{
get {
return value;
}
}
Notice how the accessor "get" also keeps its brace on the same
line.
For very small properties, you can compress things:
ok:
int Property {
get { return value; }
set { x = value; }
}
* Use white space in expressions liberally, except in the presence
of parenthesis:
good:
if (a + 5 > method (blah () + 4))
bad:
if (a+5>method(blah()+4))
* For any new files, please use a descriptive introduction, like
this:
//
// System.Comment.cs: Handles comments in System files.
//
// Author:
// Juan Perez ([email protected])
//
// (C) 2002 Address, Inc (http://www.address.com)
//
* If you are modyfing someone else's code, and your contribution
is significant, please add yourself to the Authors list.
* Switch statements have the case at the same indentation as the
switch:
switch (x) {
case 'a':
...
case 'b':
...
}
* Argument names should use the camel casing for
identifiers, like this:
good:
void Method (string myArgument)
bad:
void Method (string lpstrArgument)
void Method (string my_string)
* Empty methods: They should have the body of code using two
lines, in consistency with the rest:
good:
void EmptyMethod ()
{
}
bad:
void EmptyMethod () {}
void EmptyMethod ()
{}
* Line length: The line length for C# source code is 134 columns.
If your function declaration arguments go beyond
this point, please align your arguments to match the
opening brace, like this:
void Function (int arg, string argb,
int argc)
{
}
When invoking functions, the rule is different, the
arguments are not aligned with the previous
argument, instead they begin at the tabbed position,
like this:
void M ()
{
MethodCall ("Very long string that will force",
"Next argument on the 8-tab pos",
"Just like this one")
}
Here are a couple of examples:
class X : Y {
bool Method (int argument_1, int argument_2)
{
if (argument_1 == argument_2)
throw new Exception (Locale.GetText ("They are equal!");
if (argument_1 < argument_2) {
if (argument_1 * 3 > 4)
return true;
else
return false;
}
//
// This sample helps keep your sanity while using 8-spaces for tabs
//
VeryLongIdentifierWhichTakesManyArguments (
Argument1, Argument2, Argument3,
NestedCallHere (
MoreNested));
}
bool MyProperty {
get {
return x;
}
set {
x = value;
}
}
void AnotherMethod ()
{
if ((a + 5) != 4) {
}
while (blah) {
if (a)
continue;
b++;
}
}
}
conventions: http://www.mono-project.com/community/contributing/coding-guidelines/
@@ -310,19 +310,20 @@ namespace System.IO.MemoryMappedFiles
[MonoLimitation ("Named mappings scope is process local")]
public static MemoryMappedFile OpenExisting (string mapName)
{
throw new NotImplementedException ();
return OpenExisting (mapName, MemoryMappedFileRights.ReadWrite);
}
[MonoLimitation ("Named mappings scope is process local")]
public static MemoryMappedFile OpenExisting (string mapName, MemoryMappedFileRights desiredAccessRights)
{
throw new NotImplementedException ();
return OpenExisting (mapName, desiredAccessRights, HandleInheritability.None);
}
[MonoLimitation ("Named mappings scope is process local")]
public static MemoryMappedFile OpenExisting (string mapName, MemoryMappedFileRights desiredAccessRights, HandleInheritability inheritability)
{
throw new NotImplementedException ();
// FIXME: Actually use desiredAccessRights
return CoreShmCreate (mapName, 0, MemoryMappedFileAccess.ReadWrite, MemoryMappedFileOptions.None, null, inheritability, FileMode.Open);
}
public MemoryMappedViewStream CreateViewStream ()
@@ -393,10 +394,9 @@ namespace System.IO.MemoryMappedFiles
throw new NotImplementedException ();
}
[MonoTODO]
public SafeMemoryMappedFileHandle SafeMemoryMappedFileHandle {
get {
throw new NotImplementedException ();
return handle;
}
}
@@ -301,9 +301,12 @@ namespace MonoTests.System.IO.MemoryMappedFiles {
var name = MkNamedMapping ();
using (var m0 = MemoryMappedFile.CreateNew(name, 4096, MemoryMappedFileAccess.ReadWrite)) {
using (var m1 = MemoryMappedFile.CreateOrOpen (name, 4096, MemoryMappedFileAccess.ReadWrite)) {
using (MemoryMappedViewAccessor v0 = m0.CreateViewAccessor (), v1 = m1.CreateViewAccessor ()) {
v0.Write (10, 0x12345);
Assert.AreEqual (0x12345, v1.ReadInt32 (10));
using (var m2 = MemoryMappedFile.OpenExisting (name)) {
using (MemoryMappedViewAccessor v0 = m0.CreateViewAccessor (), v1 = m1.CreateViewAccessor (), v2 = m2.CreateViewAccessor ()) {
v0.Write (10, 0x12345);
Assert.AreEqual (0x12345, v1.ReadInt32 (10));
Assert.AreEqual (0x12345, v2.ReadInt32 (10));
}
}
}
}
@@ -466,5 +469,13 @@ namespace MonoTests.System.IO.MemoryMappedFiles {
}
}
}
[Test]
public void OpenExistingWithNoExistingThrows()
{
Assert.Throws<FileNotFoundException>(() => {
MemoryMappedFile.OpenExisting (MkNamedMapping ());
});
}
}
}
@@ -375,8 +375,9 @@ namespace System.Net.Http
wrequest.ResendContentFactory = content.CopyTo;
var stream = await wrequest.GetRequestStreamAsync ().ConfigureAwait (false);
await request.Content.CopyToAsync (stream).ConfigureAwait (false);
using (var stream = await wrequest.GetRequestStreamAsync ().ConfigureAwait (false)) {
await request.Content.CopyToAsync (stream).ConfigureAwait (false);
}
} else if (HttpMethod.Post.Equals (request.Method) || HttpMethod.Put.Equals (request.Method) || HttpMethod.Delete.Equals (request.Method)) {
// Explicitly set this to make sure we're sending a "Content-Length: 0" header.
// This fixes the issue that's been reported on the forums:
+1 -1
View File
@@ -6,7 +6,7 @@ LIBRARY = System.Numerics.dll
LIB_REFS = System
LIB_MCS_FLAGS = /unsafe
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
XTEST_LIB_REFS = System Facades/System.Threading.Tasks System.Runtime.InteropServices.RuntimeInformation System.Core System.Numerics.Vectors Microsoft.CSharp
XTEST_LIB_REFS = System Facades/System.Threading.Tasks Facades/System.Runtime.InteropServices.RuntimeInformation System.Core System.Numerics.Vectors Microsoft.CSharp
XTEST_LIB_FLAGS = -unsafe
RESX_RESOURCE_STRING = \
@@ -1,3 +1,4 @@
../../../external/corefx/src/Common/tests/System/AssertExtensions.cs
../../../external/corefx/src/Common/tests/System/PlatformDetection.cs
# ../../../external/corefx/src/System.Runtime.Numerics/tests/*.cs
@@ -58,13 +58,13 @@ namespace MonoTests.System.ServiceProcess
static ServiceInfo DISK_DRIVER_SERVICE = new ServiceInfo { ServiceName = "disk", DisplayName = "Disk Driver", ServiceType = ServiceType.KernelDriver };
static ServiceInfo ROUTING_AND_REMOTE_ACCESS_SERVICE = new ServiceInfo { ServiceName = "RemoteAccess", DisplayName = "Routing and Remote Access", DependedOn = new [] { "bfe", "http", "rasman", "rpcss" } };
static ServiceInfo SECONDARY_LOGON_SERVICE = new ServiceInfo { ServiceName = "seclogon", DisplayName = "Secondary Logon", Dependents = new [] { "te.service" } };
static ServiceInfo SECURITY_ACCOUNTS_MANAGER_SERVICE = new ServiceInfo { ServiceName = "SamSs", DisplayName = "Security Accounts Manager", Dependents = new [] { "browser", "ktmrm", "lanmanserver", "msdtc" }, DependedOn = new [] { "rpcss" } };
static ServiceInfo SECURITY_ACCOUNTS_MANAGER_SERVICE = new ServiceInfo { ServiceName = "SamSs", DisplayName = "Security Accounts Manager", Dependents = new [] { "ktmrm", "lanmanserver", "msdtc" }, DependedOn = new [] { "rpcss" } };
static ServiceInfo COMPLUS_EVENTSYSTEM_SERVICE = new ServiceInfo { ServiceName = "EventSystem", DisplayName = "COM+ Event System", ServiceType = ServiceType.Win32ShareProcess, Dependents = new [] { "comsysapp", "sens" }, DependedOn = new [] { "rpcss" } };
static ServiceInfo WINDOWS_IMAGE_ACQUISITION_SERVICE = new ServiceInfo { ServiceName = "stisvc", DisplayName = "Windows Image Acquisition (WIA)", ServiceType = ServiceType.Win32OwnProcess, DependedOn = new [] { "rpcss" } };
static ServiceInfo WINDOWS_SEARCH_SERVICE = new ServiceInfo { ServiceName = "WSearch", DisplayName = "Windows Search", ServiceType = ServiceType.Win32OwnProcess, Dependents = new [] { "wmpnetworksvc", "workfolderssvc" }, DependedOn = new [] { "rpcss" } };
static ServiceInfo WINDOWS_TIME_SERVICE = new ServiceInfo { ServiceName = "W32Time", DisplayName = "Windows Time" };
static ServiceInfo WINDOWS_UPDATE_SERVICE = new ServiceInfo { ServiceName = "wuauserv", DisplayName = "Windows Update", DependedOn = new [] { "rpcss" } };
static ServiceInfo WORKSTATION_SERVICE = new ServiceInfo { ServiceName = "LanmanWorkstation", DisplayName = "Workstation", Dependents = new [] { "browser", "netlogon", "sessionenv" }, DependedOn = new [] { "bowser", "mrxsmb20", "nsi" } };
static ServiceInfo WORKSTATION_SERVICE = new ServiceInfo { ServiceName = "LanmanWorkstation", DisplayName = "Workstation", Dependents = new [] { "netlogon", "sessionenv" }, DependedOn = new [] { "bowser", "mrxsmb20", "nsi" } };
// A service which is expected to be disabled by default on all supported Windows versions.
static ServiceInfo DISABLED_SERVICE = ROUTING_AND_REMOTE_ACCESS_SERVICE;
@@ -36,7 +36,11 @@ namespace Mono.AppleTls
*/
var certificate2 = certificate as X509Certificate2;
if (certificate2 != null)
#if MONOTOUCH
return SecIdentity.Import (certificate2);
#else
return SecImportExport.ItemImport (certificate2);
#endif
/*
* Reading Certificates from the Mac Keychain
@@ -129,28 +133,28 @@ namespace Mono.AppleTls
targetHost = targetHost.Substring (0, pos);
}
var policy = SecPolicy.CreateSslPolicy (!serverMode, targetHost);
var trust = new SecTrust (certificates, policy);
using (var policy = SecPolicy.CreateSslPolicy (!serverMode, targetHost))
using (var trust = new SecTrust (certificates, policy)) {
if (validator.Settings.TrustAnchors != null) {
var status = trust.SetAnchorCertificates (validator.Settings.TrustAnchors);
if (status != SecStatusCode.Success)
throw new InvalidOperationException (status.ToString ());
trust.SetAnchorCertificatesOnly (false);
}
if (validator.Settings.TrustAnchors != null) {
var status = trust.SetAnchorCertificates (validator.Settings.TrustAnchors);
if (status != SecStatusCode.Success)
throw new InvalidOperationException (status.ToString ());
trust.SetAnchorCertificatesOnly (false);
if (validator.Settings.CertificateValidationTime != null) {
var status = trust.SetVerifyDate (validator.Settings.CertificateValidationTime.Value);
if (status != SecStatusCode.Success)
throw new InvalidOperationException (status.ToString ());
}
var result = trust.Evaluate ();
if (result == SecTrustResult.Unspecified || result == SecTrustResult.Proceed)
return true;
errors |= MonoSslPolicyErrors.RemoteCertificateChainErrors;
return false;
}
if (validator.Settings.CertificateValidationTime != null) {
var status = trust.SetVerifyDate (validator.Settings.CertificateValidationTime.Value);
if (status != SecStatusCode.Success)
throw new InvalidOperationException (status.ToString ());
}
var result = trust.Evaluate ();
if (result == SecTrustResult.Unspecified)
return true;
errors |= MonoSslPolicyErrors.RemoteCertificateChainErrors;
return false;
}
}
}
@@ -235,32 +235,41 @@ namespace Mono.AppleTls
*
*/
var trust = GetPeerTrust (!IsServer);
X509CertificateCollection certificates;
if (trust == null || trust.Count == 0) {
remoteCertificate = null;
if (!IsServer)
throw new TlsException (AlertDescription.CertificateUnknown);
certificates = null;
} else {
if (trust.Count > 1)
Debug ("WARNING: Got multiple certificates in SecTrust!");
certificates = new X509CertificateCollection ();
for (int i = 0; i < trust.Count; i++)
certificates.Add (trust [(IntPtr)i].ToX509Certificate ());
remoteCertificate = certificates [0];
Debug ("Got peer trust: {0}", remoteCertificate);
}
bool ok;
SecTrust trust = null;
X509CertificateCollection certificates = null;
try {
trust = GetPeerTrust (!IsServer);
if (trust == null || trust.Count == 0) {
remoteCertificate = null;
if (!IsServer)
throw new TlsException (AlertDescription.CertificateUnknown);
certificates = null;
} else {
if (trust.Count > 1)
Debug ("WARNING: Got multiple certificates in SecTrust!");
certificates = new X509CertificateCollection ();
for (int i = 0; i < trust.Count; i++)
certificates.Add (trust.GetCertificate (i));
remoteCertificate = new X509Certificate (certificates [0]);
Debug ("Got peer trust: {0}", remoteCertificate);
}
ok = ValidateCertificate (certificates);
} catch (Exception ex) {
Debug ("Certificate validation failed: {0}", ex);
throw new TlsException (AlertDescription.CertificateUnknown, "Certificate validation threw exception.");
} finally {
if (trust != null)
trust.Dispose ();
if (certificates != null) {
for (int i = 0; i < certificates.Count; i++)
certificates [i].Dispose ();
}
}
if (!ok)
@@ -665,7 +674,7 @@ namespace Mono.AppleTls
if (value == IntPtr.Zero)
throw new TlsException (AlertDescription.CertificateUnknown);
}
return (value == IntPtr.Zero) ? null : new SecTrust (value);
return (value == IntPtr.Zero) ? null : new SecTrust (value, true);
}
#endregion
@@ -848,12 +857,12 @@ namespace Mono.AppleTls
[DllImport (SecurityLibrary)]
extern static /* OSStatus */ SslStatus SSLClose (/* SSLContextRef */ IntPtr context);
public override void Close ()
public override void Shutdown ()
{
if (Interlocked.Exchange (ref pendingIO, 1) == 1)
throw new InvalidOperationException ();
Debug ("Close");
Debug ("Shutdown");
lastException = null;
@@ -862,7 +871,7 @@ namespace Mono.AppleTls
return;
var status = SSLClose (Handle);
Debug ("Close done: {0}", status);
Debug ("Shutdown done: {0}", status);
CheckStatusAndThrow (status);
} finally {
closed = true;
@@ -38,12 +38,12 @@ namespace Mono.AppleTls
}
protected override MNS.MobileTlsContext CreateContext (
MNS.MobileAuthenticatedStream parent, bool serverMode, string targetHost,
SslProtocols enabledProtocols, X509Certificate serverCertificate,
X509CertificateCollection clientCertificates, bool askForClientCert)
bool serverMode, string targetHost, SslProtocols enabledProtocols,
X509Certificate serverCertificate, X509CertificateCollection clientCertificates,
bool askForClientCert)
{
return new AppleTlsContext (
parent, serverMode, targetHost,
this, serverMode, targetHost,
enabledProtocols, serverCertificate,
clientCertificates, askForClientCert);
}
@@ -67,6 +67,7 @@ namespace Mono.AppleTls {
return code;
}
#if !MONOTOUCH
[DllImport (AppleTlsContext.SecurityLibrary)]
extern static SecStatusCode SecItemImport (
/* CFDataRef */ IntPtr importedData,
@@ -217,6 +218,7 @@ namespace Mono.AppleTls {
IntPtr keyUsage;
IntPtr keyAttributes;
}
#endif
}
}
#endif
+13
View File
@@ -66,6 +66,8 @@ namespace Mono.AppleTls {
foreach (var certificate in certificates)
array [i++] = new SecCertificate (certificate);
Initialize (array, policy);
for (i = 0; i < array.Length; i++)
array [i].Dispose ();
}
void Initialize (SecCertificate[] array, SecPolicy policy)
@@ -122,6 +124,17 @@ namespace Mono.AppleTls {
}
}
internal X509Certificate GetCertificate (int index)
{
if (handle == IntPtr.Zero)
throw new ObjectDisposedException ("SecTrust");
if (index < 0 || index >= Count)
throw new ArgumentOutOfRangeException ("index");
var ptr = SecTrustGetCertificateAtIndex (handle, (IntPtr)index);
return new X509Certificate (ptr);
}
[DllImport (AppleTlsContext.SecurityLibrary)]
extern static SecStatusCode /* OSStatus */ SecTrustSetAnchorCertificates (IntPtr /* SecTrustRef */ trust, IntPtr /* CFArrayRef */ anchorCertificates);
+9 -21
View File
@@ -316,6 +316,9 @@ namespace Mono.Btls
if (status == MonoBtlsSslError.WantRead) {
wantMore = true;
return 0;
} else if (status == MonoBtlsSslError.ZeroReturn) {
wantMore = false;
return size;
} else if (status != MonoBtlsSslError.None) {
throw GetException (status);
}
@@ -358,26 +361,11 @@ namespace Mono.Btls
}
}
public override void Close ()
public override void Shutdown ()
{
Debug ("Close!");
if (ssl != null) {
ssl.Dispose ();
ssl = null;
}
if (ctx != null) {
ctx.Dispose ();
ctx = null;
}
if (bio != null) {
bio.Dispose ();
bio = null;
}
if (errbio != null) {
errbio.Dispose ();
errbio = null;
}
Debug ("Shutdown!");
// ssl.SetQuietShutdown ();
ssl.Shutdown ();
}
void Dispose<T> (ref T disposable)
@@ -397,12 +385,12 @@ namespace Mono.Btls
{
try {
if (disposing) {
Dispose (ref ssl);
Dispose (ref ctx);
Dispose (ref remoteCertificate);
Dispose (ref nativeServerCertificate);
Dispose (ref nativeClientCertificate);
Dispose (ref clientCertificate);
Dispose (ref ctx);
Dispose (ref ssl);
Dispose (ref bio);
Dispose (ref errbio);
}
@@ -102,6 +102,20 @@ namespace Mono.Btls
CheckError (ret == 1, callerName);
}
protected internal void CheckLastError ([CallerMemberName] string callerName = null)
{
var error = Interlocked.Exchange (ref lastError, null);
if (error == null)
return;
string message;
if (callerName != null)
message = string.Format ("Caught unhandled exception in {0}.{1}.", GetType ().Name, callerName);
else
message = string.Format ("Caught unhandled exception.");
throw new MonoBtlsException (message, error);
}
[DllImport (BTLS_DYLIB)]
extern static void mono_btls_free (IntPtr data);
+38 -10
View File
@@ -47,6 +47,7 @@ namespace Mono.Btls
protected override bool ReleaseHandle ()
{
mono_btls_ssl_destroy (handle);
handle = IntPtr.Zero;
return true;
}
}
@@ -78,6 +79,12 @@ namespace Mono.Btls
[DllImport (BTLS_DYLIB)]
extern static void mono_btls_ssl_close (IntPtr handle);
[DllImport (BTLS_DYLIB)]
extern static int mono_btls_ssl_shutdown (IntPtr handle);
[DllImport (BTLS_DYLIB)]
extern static void mono_btls_ssl_set_quiet_shutdown (IntPtr handle, int mode);
[DllImport (BTLS_DYLIB)]
extern static void mono_btls_ssl_set_bio (IntPtr handle, IntPtr bio);
@@ -131,6 +138,7 @@ namespace Mono.Btls
return new BoringSslHandle (handle);
}
MonoBtlsBio bio;
PrintErrorsCallbackFunc printErrorsFunc;
IntPtr printErrorsFuncPtr;
@@ -148,6 +156,7 @@ namespace Mono.Btls
public void SetBio (MonoBtlsBio bio)
{
CheckThrow ();
this.bio = bio;
mono_btls_ssl_set_bio (
Handle.DangerousGetHandle (),
bio.Handle.DangerousGetHandle ());
@@ -164,18 +173,17 @@ namespace Mono.Btls
errors = null;
}
if (errors != null) {
Console.Error.WriteLine ("ERROR: {0} failed: {1}", callerName, errors);
if (errors != null)
throw new MonoBtlsException ("{0} failed: {1}.", callerName, errors);
} else {
Console.Error.WriteLine ("ERROR: {0} failed.", callerName);
else
throw new MonoBtlsException ("{0} failed.", callerName);
}
}
MonoBtlsSslError GetError (int ret_code)
{
CheckThrow ();
bio.CheckLastError ();
var error = mono_btls_ssl_get_error (
Handle.DangerousGetHandle (), ret_code);
return (MonoBtlsSslError)error;
@@ -287,15 +295,20 @@ namespace Mono.Btls
var ret = mono_btls_ssl_read (
Handle.DangerousGetHandle (), data, dataSize);
if (ret >= 0) {
if (ret > 0) {
dataSize = ret;
return MonoBtlsSslError.None;
}
var error = mono_btls_ssl_get_error (
Handle.DangerousGetHandle (), ret);
var error = GetError (ret);
if (ret == 0 && error == MonoBtlsSslError.Syscall) {
// End-of-stream
dataSize = 0;
return MonoBtlsSslError.None;
}
dataSize = 0;
return (MonoBtlsSslError)error;
return error;
}
public MonoBtlsSslError Write (IntPtr data, ref int dataSize)
@@ -416,9 +429,24 @@ namespace Mono.Btls
return Marshal.PtrToStringAnsi (namePtr);
}
public void Shutdown ()
{
CheckThrow ();
var ret = mono_btls_ssl_shutdown (Handle.DangerousGetHandle ());
if (ret < 0)
throw ThrowError ();
}
public void SetQuietShutdown ()
{
CheckThrow ();
mono_btls_ssl_set_quiet_shutdown (Handle.DangerousGetHandle (), 1);
}
protected override void Close ()
{
mono_btls_ssl_close (Handle.DangerousGetHandle ());
if (!Handle.IsInvalid)
mono_btls_ssl_close (Handle.DangerousGetHandle ());
}
}
}
+4 -4
View File
@@ -53,12 +53,12 @@ namespace Mono.Btls
}
protected override MNS.MobileTlsContext CreateContext (
MNS.MobileAuthenticatedStream parent, bool serverMode, string targetHost,
SslProtocols enabledProtocols, X509Certificate serverCertificate,
X509CertificateCollection clientCertificates, bool askForClientCert)
bool serverMode, string targetHost, SslProtocols enabledProtocols,
X509Certificate serverCertificate, X509CertificateCollection clientCertificates,
bool askForClientCert)
{
return new MonoBtlsContext (
parent, serverMode, targetHost,
this, serverMode, targetHost,
enabledProtocols, serverCertificate,
clientCertificates, askForClientCert);
}
@@ -11,14 +11,14 @@ using System;
using System.IO;
using System.Net;
using System.Net.Security;
using System.Security.Authentication;
using SD = System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;
using System.Runtime.ExceptionServices;
namespace Mono.Net.Security
{
delegate AsyncOperationStatus AsyncOperation (AsyncProtocolRequest asyncRequest, AsyncOperationStatus status);
class BufferOffsetSize
{
public byte[] Buffer;
@@ -37,6 +37,13 @@ namespace Mono.Net.Security
public BufferOffsetSize (byte[] buffer, int offset, int size)
{
if (buffer == null)
throw new ArgumentNullException (nameof (buffer));
if (offset < 0)
throw new ArgumentOutOfRangeException (nameof (offset));
if (size < 0 || offset + size > buffer.Length)
throw new ArgumentOutOfRangeException (nameof (size));
Buffer = buffer;
Offset = offset;
Size = size;
@@ -54,7 +61,7 @@ namespace Mono.Net.Security
public readonly int InitialSize;
public BufferOffsetSize2 (int size)
: base (new byte [size], 0, 0)
: base (new byte[size], 0, 0)
{
InitialSize = size;
}
@@ -63,7 +70,7 @@ namespace Mono.Net.Security
{
Offset = Size = 0;
TotalBytes = 0;
Buffer = new byte [InitialSize];
Buffer = new byte[InitialSize];
Complete = false;
}
@@ -74,11 +81,11 @@ namespace Mono.Net.Security
int missing = size - Remaining;
if (Offset == 0 && Size == 0) {
Buffer = new byte [size];
Buffer = new byte[size];
return;
}
var buffer = new byte [Buffer.Length + missing];
var buffer = new byte[Buffer.Length + missing];
Buffer.CopyTo (buffer, 0);
Buffer = buffer;
}
@@ -91,201 +98,296 @@ namespace Mono.Net.Security
}
}
enum AsyncOperationStatus {
NotStarted,
enum AsyncOperationStatus
{
Initialize,
Continue,
Running,
Complete,
WantRead,
WantWrite,
ReadDone,
FinishWrite
Complete
}
class AsyncProtocolRequest
class AsyncProtocolResult
{
public readonly MobileAuthenticatedStream Parent;
public readonly BufferOffsetSize UserBuffer;
int RequestedSize;
public int CurrentSize;
public int UserResult;
AsyncOperation Operation;
int Status;
public readonly int ID = ++next_id;
static int next_id;
public readonly LazyAsyncResult UserAsyncResult;
public AsyncProtocolRequest (MobileAuthenticatedStream parent, LazyAsyncResult lazyResult, BufferOffsetSize userBuffer = null)
{
Parent = parent;
UserAsyncResult = lazyResult;
UserBuffer = userBuffer;
public int UserResult {
get;
}
public ExceptionDispatchInfo Error {
get;
}
public bool CompleteWithError (Exception ex)
public AsyncProtocolResult (int result)
{
Status = (int)AsyncOperationStatus.Complete;
if (UserAsyncResult == null)
return true;
if (!UserAsyncResult.InternalPeekCompleted)
UserAsyncResult.InvokeCallback (ex);
return false;
UserResult = result;
}
public AsyncProtocolResult (ExceptionDispatchInfo error)
{
Error = error;
}
}
abstract class AsyncProtocolRequest
{
public MobileAuthenticatedStream Parent {
get;
}
public bool RunSynchronously {
get;
}
public int ID => ++next_id;
public string Name => GetType ().Name;
public int UserResult {
get;
protected set;
}
int Started;
int RequestedSize;
int WriteRequested;
readonly object locker = new object ();
static int next_id;
public AsyncProtocolRequest (MobileAuthenticatedStream parent, bool sync)
{
Parent = parent;
RunSynchronously = sync;
}
[SD.Conditional ("MARTIN_DEBUG")]
protected void Debug (string message, params object[] args)
{
Parent.Debug ("AsyncProtocolRequest({0}:{1}): {2}", Parent.ID, ID, string.Format (message, args));
Parent.Debug ("{0}({1}:{2}): {3}", Name, Parent.ID, ID, string.Format (message, args));
}
internal void RequestRead (int size)
{
var oldStatus = (AsyncOperationStatus)Interlocked.CompareExchange (ref Status, (int)AsyncOperationStatus.WantRead, (int)AsyncOperationStatus.Running);
Debug ("RequestRead: {0} {1}", oldStatus, size);
if (oldStatus == AsyncOperationStatus.Running)
RequestedSize = size;
else if (oldStatus == AsyncOperationStatus.WantRead)
lock (locker) {
RequestedSize += size;
else if (oldStatus != AsyncOperationStatus.WantWrite)
throw new InvalidOperationException ();
}
internal void ResetRead ()
{
var oldStatus = (AsyncOperationStatus)Interlocked.CompareExchange (ref Status, (int)AsyncOperationStatus.Complete, (int)AsyncOperationStatus.WantRead);
Debug ("ResetRead: {0} {1}", oldStatus, Status);
}
internal void ResetWrite ()
{
var oldStatus = (AsyncOperationStatus)Interlocked.CompareExchange (ref Status, (int)AsyncOperationStatus.Complete, (int)AsyncOperationStatus.WantWrite);
Debug ("ResetWrite: {0} {1}", oldStatus, Status);
Debug ("RequestRead: {0}", size);
}
}
internal void RequestWrite ()
{
var oldStatus = (AsyncOperationStatus)Interlocked.CompareExchange (ref Status, (int)AsyncOperationStatus.WantWrite, (int)AsyncOperationStatus.Running);
Debug ("RequestWrite: {0} {1}", oldStatus, Status);
if (oldStatus == AsyncOperationStatus.Running)
return;
else if (oldStatus != AsyncOperationStatus.WantRead && oldStatus != AsyncOperationStatus.WantWrite)
throw new InvalidOperationException ();
WriteRequested = 1;
}
internal void StartOperation (AsyncOperation operation)
internal async Task<AsyncProtocolResult> StartOperation (CancellationToken cancellationToken)
{
Debug ("Start Operation: {0} {1}", Status, operation);
if (Interlocked.CompareExchange (ref Status, (int)AsyncOperationStatus.Initialize, (int)AsyncOperationStatus.NotStarted) != (int)AsyncOperationStatus.NotStarted)
Debug ("Start Operation: {0}", this);
if (Interlocked.CompareExchange (ref Started, 1, 0) != 0)
throw new InvalidOperationException ();
Operation = operation;
if (UserAsyncResult == null) {
StartOperation ();
return;
}
ThreadPool.QueueUserWorkItem (_ => StartOperation ());
}
void StartOperation ()
{
try {
ProcessOperation ();
if (UserAsyncResult != null && !UserAsyncResult.InternalPeekCompleted)
UserAsyncResult.InvokeCallback (UserResult);
await ProcessOperation (cancellationToken).ConfigureAwait (false);
return new AsyncProtocolResult (UserResult);
} catch (Exception ex) {
if (UserAsyncResult == null)
throw;
if (!UserAsyncResult.InternalPeekCompleted)
UserAsyncResult.InvokeCallback (ex);
var info = Parent.SetException (MobileAuthenticatedStream.GetSSPIException (ex));
return new AsyncProtocolResult (info);
}
}
void ProcessOperation ()
async Task ProcessOperation (CancellationToken cancellationToken)
{
AsyncOperationStatus status;
do {
status = (AsyncOperationStatus)Interlocked.Exchange (ref Status, (int)AsyncOperationStatus.Running);
var status = AsyncOperationStatus.Initialize;
while (status != AsyncOperationStatus.Complete) {
cancellationToken.ThrowIfCancellationRequested ();
Debug ("ProcessOperation: {0}", status);
status = ProcessOperation (status);
Debug ("ProcessOperation done: {0}", status);
AsyncOperationStatus oldStatus;
if (status == AsyncOperationStatus.Complete) {
oldStatus = (AsyncOperationStatus)Interlocked.CompareExchange (ref Status, (int)AsyncOperationStatus.FinishWrite, (int)AsyncOperationStatus.WantWrite);
if (oldStatus == AsyncOperationStatus.WantWrite) {
// We are done, but still need to flush the write queue.
status = AsyncOperationStatus.FinishWrite;
continue;
var ret = await InnerRead (cancellationToken).ConfigureAwait (false);
if (ret != null) {
if (ret == 0) {
// End-of-stream
Debug ("END OF STREAM!");
status = AsyncOperationStatus.ReadDone;
} else if (ret < 0) {
// remote prematurely closed connection.
throw new IOException ("Remote prematurely closed connection.");
}
}
oldStatus = (AsyncOperationStatus)Interlocked.CompareExchange (ref Status, (int)status, (int)AsyncOperationStatus.Running);
Debug ("ProcessOperation done: {0} -> {1}", oldStatus, status);
Debug ("ProcessOperation run: {0}", status);
if (oldStatus != AsyncOperationStatus.Running) {
if (status == oldStatus || status == AsyncOperationStatus.Continue || status == AsyncOperationStatus.Complete)
status = oldStatus;
else
throw new InvalidOperationException ();
AsyncOperationStatus newStatus;
switch (status) {
case AsyncOperationStatus.Initialize:
case AsyncOperationStatus.Continue:
case AsyncOperationStatus.ReadDone:
newStatus = Run (status);
break;
default:
throw new InvalidOperationException ();
}
} while (status != AsyncOperationStatus.Complete);
if (Interlocked.Exchange (ref WriteRequested, 0) != 0) {
// Flush the write queue.
await Parent.InnerWrite (RunSynchronously, cancellationToken);
}
Debug ("ProcessOperation done: {0} -> {1}", status, newStatus);
status = newStatus;
}
}
AsyncOperationStatus ProcessOperation (AsyncOperationStatus status)
async Task<int?> InnerRead (CancellationToken cancellationToken)
{
if (status == AsyncOperationStatus.WantRead) {
if (RequestedSize < 0)
int? totalRead = null;
var requestedSize = Interlocked.Exchange (ref RequestedSize, 0);
while (requestedSize > 0) {
Debug ("ProcessOperation - read inner: {0}", requestedSize);
var ret = await Parent.InnerRead (RunSynchronously, requestedSize, cancellationToken).ConfigureAwait (false);
Debug ("ProcessOperation - read inner done: {0} - {1}", requestedSize, ret);
if (ret <= 0)
return ret;
if (ret > requestedSize)
throw new InvalidOperationException ();
else if (RequestedSize == 0)
return AsyncOperationStatus.Continue;
Debug ("ProcessOperation - read inner: {0}", RequestedSize);
var ret = Parent.InnerRead (RequestedSize);
Debug ("ProcessOperation - read inner done: {0} - {1}", RequestedSize, ret);
totalRead += ret;
requestedSize -= ret;
var newRequestedSize = Interlocked.Exchange (ref RequestedSize, 0);
requestedSize += newRequestedSize;
}
if (ret < 0)
return AsyncOperationStatus.ReadDone;
return totalRead;
}
RequestedSize -= ret;
/*
* This will operate on the internal buffers and never block.
*/
protected abstract AsyncOperationStatus Run (AsyncOperationStatus status);
if (ret == 0 || RequestedSize == 0)
return AsyncOperationStatus.Continue;
else
return AsyncOperationStatus.WantRead;
} else if (status == AsyncOperationStatus.WantWrite) {
Debug ("ProcessOperation - want write");
Parent.InnerWrite ();
Debug ("ProcessOperation - want write done");
return AsyncOperationStatus.Continue;
} else if (status == AsyncOperationStatus.Initialize || status == AsyncOperationStatus.Continue) {
Debug ("ProcessOperation - continue");
status = Operation (this, status);
Debug ("ProcessOperation - continue done: {0}", status);
return status;
} else if (status == AsyncOperationStatus.ReadDone) {
Debug ("ProcessOperation - read done");
status = Operation (this, status);
Debug ("ProcessOperation - read done: {0}", status);
return status;
} else if (status == AsyncOperationStatus.FinishWrite) {
Debug ("ProcessOperation - finish write");
Parent.InnerWrite ();
Debug ("ProcessOperation - finish write done");
public override string ToString ()
{
return string.Format ("[{0}]", Name);
}
}
class AsyncHandshakeRequest : AsyncProtocolRequest
{
public AsyncHandshakeRequest (MobileAuthenticatedStream parent, bool sync)
: base (parent, sync)
{
}
protected override AsyncOperationStatus Run (AsyncOperationStatus status)
{
return Parent.ProcessHandshake (status);
}
}
abstract class AsyncReadOrWriteRequest : AsyncProtocolRequest
{
protected BufferOffsetSize UserBuffer {
get;
}
protected int CurrentSize {
get; set;
}
public AsyncReadOrWriteRequest (MobileAuthenticatedStream parent, bool sync, byte[] buffer, int offset, int size)
: base (parent, sync)
{
UserBuffer = new BufferOffsetSize (buffer, offset, size);
}
public override string ToString ()
{
return string.Format ("[{0}: {1}]", Name, UserBuffer);
}
}
class AsyncReadRequest : AsyncReadOrWriteRequest
{
public AsyncReadRequest (MobileAuthenticatedStream parent, bool sync, byte[] buffer, int offset, int size)
: base (parent, sync, buffer, offset, size)
{
}
protected override AsyncOperationStatus Run (AsyncOperationStatus status)
{
Debug ("ProcessRead - read user: {0} {1}", this, status);
var (ret, wantMore) = Parent.ProcessRead (UserBuffer);
Debug ("ProcessRead - read user done: {0} - {1} {2}", this, ret, wantMore);
if (ret < 0) {
UserResult = -1;
return AsyncOperationStatus.Complete;
}
throw new InvalidOperationException ();
CurrentSize += ret;
UserBuffer.Offset += ret;
UserBuffer.Size -= ret;
Debug ("Process Read - read user done #1: {0} - {1} {2}", this, CurrentSize, wantMore);
if (wantMore && CurrentSize == 0)
return AsyncOperationStatus.Continue;
UserResult = CurrentSize;
return AsyncOperationStatus.Complete;
}
}
class AsyncWriteRequest : AsyncReadOrWriteRequest
{
public AsyncWriteRequest (MobileAuthenticatedStream parent, bool sync, byte[] buffer, int offset, int size)
: base (parent, sync, buffer, offset, size)
{
}
protected override AsyncOperationStatus Run (AsyncOperationStatus status)
{
Debug ("ProcessWrite - write user: {0} {1}", this, status);
if (UserBuffer.Size == 0) {
UserResult = CurrentSize;
return AsyncOperationStatus.Complete;
}
var (ret, wantMore) = Parent.ProcessWrite (UserBuffer);
Debug ("ProcessWrite - write user done: {0} - {1} {2}", this, ret, wantMore);
if (ret < 0) {
UserResult = -1;
return AsyncOperationStatus.Complete;
}
CurrentSize += ret;
UserBuffer.Offset += ret;
UserBuffer.Size -= ret;
if (wantMore)
return AsyncOperationStatus.Continue;
UserResult = CurrentSize;
return AsyncOperationStatus.Complete;
}
}
class AsyncShutdownRequest : AsyncProtocolRequest
{
public AsyncShutdownRequest (MobileAuthenticatedStream parent)
: base (parent, false)
{
}
protected override AsyncOperationStatus Run (AsyncOperationStatus status)
{
return Parent.ProcessShutdown (status);
}
}
}
#endif
@@ -575,6 +575,11 @@ namespace Mono.Net.Security.Private
#region IMonoSslStream
Task IMonoSslStream.ShutdownAsync ()
{
return Task.CompletedTask;
}
AuthenticatedStream IMonoSslStream.AuthenticatedStream {
get { return this; }
}
@@ -23,6 +23,7 @@ using System.IO;
using System.Net;
using System.Net.Security;
using System.Globalization;
using System.Security.Authentication;
using System.Runtime.ExceptionServices;
using System.Threading;
using System.Threading.Tasks;
@@ -36,8 +37,13 @@ namespace Mono.Net.Security
{
abstract class MobileAuthenticatedStream : AuthenticatedStream, MSI.IMonoSslStream
{
/*
* This is intentionally called `xobileTlsContext'. It is a "dangerous" object
* that must not be touched outside the `ioLock' and we need to be very careful
* where we access it.
*/
MobileTlsContext xobileTlsContext;
Exception lastException;
ExceptionDispatchInfo lastException;
AsyncProtocolRequest asyncHandshakeRequest;
AsyncProtocolRequest asyncReadRequest;
@@ -47,11 +53,12 @@ namespace Mono.Net.Security
object ioLock = new object ();
int closeRequested;
bool shutdown;
static int uniqueNameInteger = 123;
public MobileAuthenticatedStream (Stream innerStream, bool leaveInnerStreamOpen, SslStream owner,
MSI.MonoTlsSettings settings, MSI.MonoTlsProvider provider)
MSI.MonoTlsSettings settings, MSI.MonoTlsProvider provider)
: base (innerStream, leaveInnerStreamOpen)
{
SslStream = owner;
@@ -78,42 +85,47 @@ namespace Mono.Net.Security
get { return xobileTlsContext != null; }
}
internal MobileTlsContext Context {
get {
CheckThrow (true);
return xobileTlsContext;
}
}
internal void CheckThrow (bool authSuccessCheck)
internal void CheckThrow (bool authSuccessCheck, bool shutdownCheck = false)
{
if (closeRequested != 0)
throw new InvalidOperationException ("Stream is closed.");
if (lastException != null)
throw lastException;
lastException.Throw ();
if (authSuccessCheck && !IsAuthenticated)
throw new InvalidOperationException ("Must be authenticated.");
throw new InvalidOperationException (SR.net_auth_noauth);
if (shutdownCheck && shutdown)
throw new InvalidOperationException (SR.net_ssl_io_already_shutdown);
}
Exception SetException (Exception e)
internal static Exception GetSSPIException (Exception e)
{
e = SetException_internal (e);
if (e != null && xobileTlsContext != null)
xobileTlsContext.Dispose ();
return e;
if (e is OperationCanceledException || e is IOException || e is ObjectDisposedException || e is AuthenticationException)
return e;
return new AuthenticationException (SR.net_auth_SSPI, e);
}
Exception SetException_internal (Exception e)
internal static Exception GetIOException (Exception e, string message)
{
if (lastException == null)
lastException = e;
return lastException;
if (e is OperationCanceledException || e is IOException || e is ObjectDisposedException || e is AuthenticationException)
return e;
return new IOException (message, e);
}
internal ExceptionDispatchInfo SetException (Exception e)
{
var info = ExceptionDispatchInfo.Capture (e);
var old = Interlocked.CompareExchange (ref lastException, info, null);
return old ?? info;
}
SslProtocols DefaultProtocols {
get { return SslProtocols.Tls12 | SslProtocols.Tls11 | SslProtocols.Tls; }
}
enum OperationType {
Read,
Write,
Shutdown
}
public void AuthenticateAsClient (string targetHost)
{
AuthenticateAsClient (targetHost, new X509CertificateCollection (), DefaultProtocols, false);
@@ -121,8 +133,8 @@ namespace Mono.Net.Security
public void AuthenticateAsClient (string targetHost, X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
{
ValidateCreateContext (false, targetHost, enabledSslProtocols, null, clientCertificates, false);
ProcessAuthentication (null);
var task = ProcessAuthentication (true, false, targetHost, enabledSslProtocols, null, clientCertificates, false);
task.Wait ();
}
public IAsyncResult BeginAuthenticateAsClient (string targetHost, AsyncCallback asyncCallback, object asyncState)
@@ -132,15 +144,13 @@ namespace Mono.Net.Security
public IAsyncResult BeginAuthenticateAsClient (string targetHost, X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, bool checkCertificateRevocation, AsyncCallback asyncCallback, object asyncState)
{
ValidateCreateContext (false, targetHost, enabledSslProtocols, null, clientCertificates, false);
var result = new LazyAsyncResult (this, asyncState, asyncCallback);
ProcessAuthentication (result);
return result;
var task = ProcessAuthentication (false, false, targetHost, enabledSslProtocols, null, clientCertificates, false);
return TaskToApm.Begin (task, asyncCallback, asyncState);
}
public void EndAuthenticateAsClient (IAsyncResult asyncResult)
{
EndProcessAuthentication (asyncResult);
TaskToApm.End (asyncResult);
}
public void AuthenticateAsServer (X509Certificate serverCertificate)
@@ -150,8 +160,8 @@ namespace Mono.Net.Security
public void AuthenticateAsServer (X509Certificate serverCertificate, bool clientCertificateRequired, SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
{
ValidateCreateContext (true, string.Empty, enabledSslProtocols, serverCertificate, null, clientCertificateRequired);
ProcessAuthentication (null);
var task = ProcessAuthentication (true, true, string.Empty, enabledSslProtocols, serverCertificate, null, clientCertificateRequired);
task.Wait ();
}
public IAsyncResult BeginAuthenticateAsServer (X509Certificate serverCertificate, AsyncCallback asyncCallback, object asyncState)
@@ -161,218 +171,214 @@ namespace Mono.Net.Security
public IAsyncResult BeginAuthenticateAsServer (X509Certificate serverCertificate, bool clientCertificateRequired, SslProtocols enabledSslProtocols, bool checkCertificateRevocation, AsyncCallback asyncCallback, object asyncState)
{
ValidateCreateContext (true, string.Empty, enabledSslProtocols, serverCertificate, null, clientCertificateRequired);
var result = new LazyAsyncResult (this, asyncState, asyncCallback);
ProcessAuthentication (result);
return result;
var task = ProcessAuthentication (false, true, string.Empty, enabledSslProtocols, serverCertificate, null, clientCertificateRequired);
return TaskToApm.Begin (task, asyncCallback, asyncState);
}
public void EndAuthenticateAsServer (IAsyncResult asyncResult)
{
EndProcessAuthentication (asyncResult);
TaskToApm.End (asyncResult);
}
public Task AuthenticateAsClientAsync (string targetHost)
{
return Task.Factory.FromAsync (BeginAuthenticateAsClient, EndAuthenticateAsClient, targetHost, null);
return ProcessAuthentication (false, false, targetHost, DefaultProtocols, null, null, false);
}
public Task AuthenticateAsClientAsync (string targetHost, X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
{
return Task.Factory.FromAsync ((callback, state) => BeginAuthenticateAsClient (targetHost, clientCertificates, enabledSslProtocols, checkCertificateRevocation, callback, state), EndAuthenticateAsClient, null);
return ProcessAuthentication (false, false, targetHost, enabledSslProtocols, null, clientCertificates, false);
}
public Task AuthenticateAsServerAsync (X509Certificate serverCertificate)
{
return Task.Factory.FromAsync (BeginAuthenticateAsServer, EndAuthenticateAsServer, serverCertificate, null);
return AuthenticateAsServerAsync (serverCertificate, false, DefaultProtocols, false);
}
public Task AuthenticateAsServerAsync (X509Certificate serverCertificate, bool clientCertificateRequired, SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
{
return Task.Factory.FromAsync ((callback, state) => BeginAuthenticateAsServer (serverCertificate, clientCertificateRequired, enabledSslProtocols, checkCertificateRevocation, callback, state), EndAuthenticateAsServer, null);
return ProcessAuthentication (false, true, string.Empty, enabledSslProtocols, serverCertificate, null, clientCertificateRequired);
}
public Task ShutdownAsync ()
{
Debug ("ShutdownAsync");
/*
* SSLClose() is a little bit tricky as it might attempt to send a close_notify alert
* and thus call our write callback.
*
* It is also not thread-safe with SSLRead() or SSLWrite(), so we need to take the I/O lock here.
*/
var asyncRequest = new AsyncShutdownRequest (this);
var task = StartOperation (OperationType.Shutdown, asyncRequest, CancellationToken.None);
return task;
}
public AuthenticatedStream AuthenticatedStream {
get { return this; }
}
internal void ProcessAuthentication (LazyAsyncResult lazyResult)
async Task ProcessAuthentication (
bool runSynchronously, bool serverMode, string targetHost, SslProtocols enabledProtocols,
X509Certificate serverCertificate, X509CertificateCollection clientCertificates, bool clientCertRequired)
{
var asyncRequest = new AsyncProtocolRequest (this, lazyResult);
if (Interlocked.CompareExchange (ref asyncHandshakeRequest, asyncRequest, null) != null)
throw new InvalidOperationException ("Invalid nested call.");
try {
if (lastException != null)
throw lastException;
if (xobileTlsContext == null)
throw new InvalidOperationException ();
readBuffer.Reset ();
writeBuffer.Reset ();
try {
asyncRequest.StartOperation (ProcessHandshake);
} catch (Exception ex) {
ExceptionDispatchInfo.Capture (SetException (ex)).Throw ();
}
} finally {
if (lazyResult == null || lastException != null) {
readBuffer.Reset ();
writeBuffer.Reset ();
asyncHandshakeRequest = null;
}
}
}
internal void EndProcessAuthentication (IAsyncResult result)
{
if (result == null)
throw new ArgumentNullException ("asyncResult");
var lazyResult = (LazyAsyncResult)result;
if (Interlocked.Exchange (ref asyncHandshakeRequest, null) == null)
throw new InvalidOperationException ("Invalid end call.");
lazyResult.InternalWaitForCompletion ();
readBuffer.Reset ();
writeBuffer.Reset ();
var e = lazyResult.Result as Exception;
if (e != null)
ExceptionDispatchInfo.Capture (SetException (e)).Throw ();
}
internal void ValidateCreateContext (bool serverMode, string targetHost, SslProtocols enabledProtocols, X509Certificate serverCertificate, X509CertificateCollection clientCertificates, bool clientCertRequired)
{
if (xobileTlsContext != null)
throw new InvalidOperationException ();
if (serverMode) {
if (serverCertificate == null)
throw new ArgumentException ("serverCertificate");
} else {
throw new ArgumentException (nameof (serverCertificate));
} else {
if (targetHost == null)
throw new ArgumentException ("targetHost");
throw new ArgumentException (nameof (targetHost));
if (targetHost.Length == 0)
targetHost = "?" + Interlocked.Increment (ref uniqueNameInteger).ToString (NumberFormatInfo.InvariantInfo);
}
xobileTlsContext = CreateContext (this, serverMode, targetHost, enabledProtocols, serverCertificate, clientCertificates, clientCertRequired);
if (lastException != null)
lastException.Throw ();
var asyncRequest = new AsyncHandshakeRequest (this, runSynchronously);
if (Interlocked.CompareExchange (ref asyncHandshakeRequest, asyncRequest, null) != null)
throw new InvalidOperationException ("Invalid nested call.");
// Make sure no other async requests can be started during the handshake.
if (Interlocked.CompareExchange (ref asyncReadRequest, asyncRequest, null) != null)
throw new InvalidOperationException ("Invalid nested call.");
if (Interlocked.CompareExchange (ref asyncWriteRequest, asyncRequest, null) != null)
throw new InvalidOperationException ("Invalid nested call.");
AsyncProtocolResult result;
try {
lock (ioLock) {
if (xobileTlsContext != null)
throw new InvalidOperationException ();
readBuffer.Reset ();
writeBuffer.Reset ();
xobileTlsContext = CreateContext (
serverMode, targetHost, enabledProtocols, serverCertificate,
clientCertificates, clientCertRequired);
}
try {
result = await asyncRequest.StartOperation (CancellationToken.None).ConfigureAwait (false);
} catch (Exception ex) {
result = new AsyncProtocolResult (SetException (GetSSPIException (ex)));
}
} finally {
lock (ioLock) {
readBuffer.Reset ();
writeBuffer.Reset ();
asyncWriteRequest = null;
asyncReadRequest = null;
asyncHandshakeRequest = null;
}
}
if (result.Error != null)
result.Error.Throw ();
}
protected abstract MobileTlsContext CreateContext (
MobileAuthenticatedStream parent, bool serverMode, string targetHost,
SSA.SslProtocols enabledProtocols, X509Certificate serverCertificate,
X509CertificateCollection clientCertificates, bool askForClientCert);
bool serverMode, string targetHost, SSA.SslProtocols enabledProtocols,
X509Certificate serverCertificate, X509CertificateCollection clientCertificates,
bool askForClientCert);
public override IAsyncResult BeginRead (byte[] buffer, int offset, int count, AsyncCallback asyncCallback, object asyncState)
{
return BeginReadOrWrite (ref asyncReadRequest, ref readBuffer, ProcessRead, new BufferOffsetSize (buffer, offset, count), asyncCallback, asyncState);
var asyncRequest = new AsyncReadRequest (this, false, buffer, offset, count);
var task = StartOperation (OperationType.Read, asyncRequest, CancellationToken.None);
return TaskToApm.Begin (task, asyncCallback, asyncState);
}
public override int EndRead (IAsyncResult asyncResult)
{
return (int)EndReadOrWrite (asyncResult, ref asyncReadRequest);
return TaskToApm.End<int> (asyncResult);
}
public override IAsyncResult BeginWrite (byte[] buffer, int offset, int count, AsyncCallback asyncCallback, object asyncState)
{
return BeginReadOrWrite (ref asyncWriteRequest, ref writeBuffer, ProcessWrite, new BufferOffsetSize (buffer, offset, count), asyncCallback, asyncState);
var asyncRequest = new AsyncWriteRequest (this, false, buffer, offset, count);
var task = StartOperation (OperationType.Write, asyncRequest, CancellationToken.None);
return TaskToApm.Begin (task, asyncCallback, asyncState);
}
public override void EndWrite (IAsyncResult asyncResult)
{
EndReadOrWrite (asyncResult, ref asyncWriteRequest);
TaskToApm.End (asyncResult);
}
public override int Read (byte[] buffer, int offset, int count)
{
return ProcessReadOrWrite (ref asyncReadRequest, ref readBuffer, ProcessRead, new BufferOffsetSize (buffer, offset, count), null);
var asyncRequest = new AsyncReadRequest (this, true, buffer, offset, count);
var task = StartOperation (OperationType.Read, asyncRequest, CancellationToken.None);
return task.Result;
}
public void Write (byte[] buffer)
{
Write (buffer, 0, buffer.Length);
}
public override void Write (byte[] buffer, int offset, int count)
{
ProcessReadOrWrite (ref asyncWriteRequest, ref writeBuffer, ProcessWrite, new BufferOffsetSize (buffer, offset, count), null);
var asyncRequest = new AsyncWriteRequest (this, true, buffer, offset, count);
var task = StartOperation (OperationType.Write, asyncRequest, CancellationToken.None);
task.Wait ();
}
IAsyncResult BeginReadOrWrite (ref AsyncProtocolRequest nestedRequest, ref BufferOffsetSize2 internalBuffer, AsyncOperation operation, BufferOffsetSize userBuffer, AsyncCallback asyncCallback, object asyncState)
public override Task<int> ReadAsync (byte[] buffer, int offset, int count, CancellationToken cancellationToken)
{
LazyAsyncResult lazyResult = new LazyAsyncResult (this, asyncState, asyncCallback);
ProcessReadOrWrite (ref nestedRequest, ref internalBuffer, operation, userBuffer, lazyResult);
return lazyResult;
var asyncRequest = new AsyncReadRequest (this, false, buffer, offset, count);
return StartOperation (OperationType.Read, asyncRequest, cancellationToken);
}
object EndReadOrWrite (IAsyncResult asyncResult, ref AsyncProtocolRequest nestedRequest)
public override Task WriteAsync (byte[] buffer, int offset, int count, CancellationToken cancellationToken)
{
if (asyncResult == null)
throw new ArgumentNullException("asyncResult");
var asyncRequest = new AsyncWriteRequest (this, false, buffer, offset, count);
return StartOperation (OperationType.Write, asyncRequest, cancellationToken);
}
var lazyResult = (LazyAsyncResult)asyncResult;
async Task<int> StartOperation (OperationType type, AsyncProtocolRequest asyncRequest, CancellationToken cancellationToken)
{
CheckThrow (true, type != OperationType.Read);
Debug ("StartOperationAsync: {0} {1}", asyncRequest, type);
if (Interlocked.Exchange (ref nestedRequest, null) == null)
throw new InvalidOperationException ("Invalid end call.");
// No "artificial" timeouts implemented so far, InnerStream controls timeout.
lazyResult.InternalWaitForCompletion ();
Debug ("EndReadOrWrite");
var e = lazyResult.Result as Exception;
if (e != null) {
var ioEx = e as IOException;
if (ioEx != null)
throw ioEx;
throw new IOException ("read failed", e);
if (type == OperationType.Read) {
if (Interlocked.CompareExchange (ref asyncReadRequest, asyncRequest, null) != null)
throw new InvalidOperationException ("Invalid nested call.");
} else {
if (Interlocked.CompareExchange (ref asyncWriteRequest, asyncRequest, null) != null)
throw new InvalidOperationException ("Invalid nested call.");
}
return lazyResult.Result;
}
AsyncProtocolResult result;
int ProcessReadOrWrite (ref AsyncProtocolRequest nestedRequest, ref BufferOffsetSize2 internalBuffer, AsyncOperation operation, BufferOffsetSize userBuffer, LazyAsyncResult lazyResult)
{
if (userBuffer == null || userBuffer.Buffer == null)
throw new ArgumentNullException ("buffer");
if (userBuffer.Offset < 0)
throw new ArgumentOutOfRangeException ("offset");
if (userBuffer.Size < 0 || userBuffer.Offset + userBuffer.Size > userBuffer.Buffer.Length)
throw new ArgumentOutOfRangeException ("count");
CheckThrow (true);
var name = internalBuffer == readBuffer ? "read" : "write";
Debug ("ProcessReadOrWrite: {0} {1}", name, userBuffer);
var asyncRequest = new AsyncProtocolRequest (this, lazyResult, userBuffer);
return StartOperation (ref nestedRequest, ref internalBuffer, operation, asyncRequest, name);
}
int StartOperation (ref AsyncProtocolRequest nestedRequest, ref BufferOffsetSize2 internalBuffer, AsyncOperation operation, AsyncProtocolRequest asyncRequest, string name)
{
if (Interlocked.CompareExchange (ref nestedRequest, asyncRequest, null) != null)
throw new InvalidOperationException ("Invalid nested call.");
bool failed = false;
try {
internalBuffer.Reset ();
asyncRequest.StartOperation (operation);
return asyncRequest.UserResult;
lock (ioLock) {
if (type == OperationType.Read)
readBuffer.Reset ();
else
writeBuffer.Reset ();
}
result = await asyncRequest.StartOperation (cancellationToken).ConfigureAwait (false);
} catch (Exception e) {
failed = true;
if (e is IOException)
throw;
throw new IOException (name + " failed", e);
var info = SetException (GetIOException (e, asyncRequest.Name + " failed"));
result = new AsyncProtocolResult (info);
} finally {
if (asyncRequest.UserAsyncResult == null || failed) {
internalBuffer.Reset ();
nestedRequest = null;
lock (ioLock) {
if (type == OperationType.Read) {
readBuffer.Reset ();
asyncReadRequest = null;
} else {
writeBuffer.Reset ();
asyncWriteRequest = null;
}
}
}
if (result.Error != null)
result.Error.Throw ();
return result.UserResult;
}
static int nextId;
@@ -384,26 +390,31 @@ namespace Mono.Net.Security
Console.Error.WriteLine ("MobileAuthenticatedStream({0}): {1}", ID, string.Format (message, args));
}
#region Called back from native code via SslConnection
#region Called back from native code via SslConnection
/*
* Called from within SSLRead() and SSLHandshake(). We only access tha managed byte[] here.
*/
internal int InternalRead (byte[] buffer, int offset, int size, out bool wantMore)
internal int InternalRead (byte[] buffer, int offset, int size, out bool outWantMore)
{
try {
Debug ("InternalRead: {0} {1} {2} {3}", offset, size, asyncReadRequest != null, readBuffer != null);
Debug ("InternalRead: {0} {1} {2} {3} {4}", offset, size,
asyncHandshakeRequest != null ? "handshake" : "",
asyncReadRequest != null ? "async" : "",
readBuffer != null ? readBuffer.ToString () : "");
var asyncRequest = asyncHandshakeRequest ?? asyncReadRequest;
return InternalRead (asyncRequest, readBuffer, buffer, offset, size, out wantMore);
var (ret, wantMore) = InternalRead (asyncRequest, readBuffer, buffer, offset, size);
outWantMore = wantMore;
return ret;
} catch (Exception ex) {
Debug ("InternalRead failed: {0}", ex);
SetException_internal (ex);
wantMore = false;
SetException (GetIOException (ex, "InternalRead() failed"));
outWantMore = false;
return -1;
}
}
int InternalRead (AsyncProtocolRequest asyncRequest, BufferOffsetSize internalBuffer, byte[] buffer, int offset, int size, out bool wantMore)
(int, bool) InternalRead (AsyncProtocolRequest asyncRequest, BufferOffsetSize internalBuffer, byte[] buffer, int offset, int size)
{
if (asyncRequest == null)
throw new InvalidOperationException ();
@@ -422,11 +433,10 @@ namespace Mono.Net.Security
* native function again.
*/
if (internalBuffer.Size == 0 && !internalBuffer.Complete) {
Debug ("InternalRead #1: {0} {1}", internalBuffer.Offset, internalBuffer.TotalBytes);
Debug ("InternalRead #1: {0} {1} {2}", internalBuffer.Offset, internalBuffer.TotalBytes, size);
internalBuffer.Offset = internalBuffer.Size = 0;
asyncRequest.RequestRead (size);
wantMore = true;
return 0;
return (0, true);
}
/*
@@ -441,8 +451,7 @@ namespace Mono.Net.Security
Buffer.BlockCopy (internalBuffer.Buffer, internalBuffer.Offset, buffer, offset, len);
internalBuffer.Offset += len;
internalBuffer.Size -= len;
wantMore = !internalBuffer.Complete && len < size;
return len;
return (len, !internalBuffer.Complete && len < size);
}
/*
@@ -456,7 +465,7 @@ namespace Mono.Net.Security
return InternalWrite (asyncRequest, writeBuffer, buffer, offset, size);
} catch (Exception ex) {
Debug ("InternalWrite failed: {0}", ex);
SetException_internal (ex);
SetException (GetIOException (ex, "InternalWrite() failed"));
return false;
}
}
@@ -511,22 +520,30 @@ namespace Mono.Net.Security
return true;
}
#endregion
#endregion
#region Inner Stream
#region Inner Stream
/*
* Read / write data from the inner stream; we're only called from managed code and only manipulate
* the internal buffers.
*/
internal int InnerRead (int requestedSize)
internal async Task<int> InnerRead (bool sync, int requestedSize, CancellationToken cancellationToken)
{
cancellationToken.ThrowIfCancellationRequested ();
Debug ("InnerRead: {0} {1} {2} {3}", readBuffer.Offset, readBuffer.Size, readBuffer.Remaining, requestedSize);
var len = System.Math.Min (readBuffer.Remaining, requestedSize);
if (len == 0)
throw new InvalidOperationException ();
var ret = InnerStream.Read (readBuffer.Buffer, readBuffer.EndOffset, len);
Task<int> task;
if (sync)
task = Task.Run (() => InnerStream.Read (readBuffer.Buffer, readBuffer.EndOffset, len));
else
task = InnerStream.ReadAsync (readBuffer.Buffer, readBuffer.EndOffset, len, cancellationToken);
var ret = await task.ConfigureAwait (false);
Debug ("InnerRead done: {0} {1} - {2}", readBuffer.Remaining, len, ret);
if (ret >= 0) {
@@ -549,165 +566,126 @@ namespace Mono.Net.Security
return ret;
}
internal void InnerWrite ()
internal async Task InnerWrite (bool sync, CancellationToken cancellationToken)
{
cancellationToken.ThrowIfCancellationRequested ();
Debug ("InnerWrite: {0} {1}", writeBuffer.Offset, writeBuffer.Size);
InnerFlush ();
if (writeBuffer.Size == 0)
return;
Task task;
if (sync)
task = Task.Run (() => InnerStream.Write (writeBuffer.Buffer, writeBuffer.Offset, writeBuffer.Size));
else
task = InnerStream.WriteAsync (writeBuffer.Buffer, writeBuffer.Offset, writeBuffer.Size);
await task.ConfigureAwait (false);
writeBuffer.TotalBytes += writeBuffer.Size;
writeBuffer.Offset = writeBuffer.Size = 0;
}
internal void InnerFlush ()
{
if (writeBuffer.Size > 0) {
InnerStream.Write (writeBuffer.Buffer, writeBuffer.Offset, writeBuffer.Size);
writeBuffer.TotalBytes += writeBuffer.Size;
writeBuffer.Offset = writeBuffer.Size = 0;
}
}
#endregion
#endregion
#region Main async I/O loop
#region Main async I/O loop
AsyncOperationStatus ProcessHandshake (AsyncProtocolRequest asyncRequest, AsyncOperationStatus status)
internal AsyncOperationStatus ProcessHandshake (AsyncOperationStatus status)
{
Debug ("ProcessHandshake: {0}", status);
/*
* The first time we're called (AsyncOperationStatus.Initialize), we need to setup the SslContext and
* start the handshake.
*/
if (status == AsyncOperationStatus.Initialize) {
xobileTlsContext.StartHandshake ();
return AsyncOperationStatus.Continue;
} else if (status == AsyncOperationStatus.ReadDone) {
// remote prematurely closed connection.
throw new IOException ("Remote prematurely closed connection.");
} else if (status != AsyncOperationStatus.Continue) {
throw new InvalidOperationException ();
}
/*
* SSLHandshake() will return repeatedly with 'SslStatus.WouldBlock', we then need
* to take care of I/O and call it again.
*/
if (!xobileTlsContext.ProcessHandshake ()) {
lock (ioLock) {
/*
* Flush the internal write buffer.
*/
InnerFlush ();
return AsyncOperationStatus.Continue;
}
* The first time we're called (AsyncOperationStatus.Initialize), we need to setup the SslContext and
* start the handshake.
*/
if (status == AsyncOperationStatus.Initialize) {
xobileTlsContext.StartHandshake ();
return AsyncOperationStatus.Continue;
} else if (status == AsyncOperationStatus.ReadDone) {
throw new IOException (SR.net_auth_eof);
} else if (status != AsyncOperationStatus.Continue) {
throw new InvalidOperationException ();
}
xobileTlsContext.FinishHandshake ();
return AsyncOperationStatus.Complete;
}
AsyncOperationStatus ProcessRead (AsyncProtocolRequest asyncRequest, AsyncOperationStatus status)
{
Debug ("ProcessRead - read user: {0} {1}", status, asyncRequest.UserBuffer);
int ret;
bool wantMore;
lock (ioLock) {
ret = Context.Read (asyncRequest.UserBuffer.Buffer, asyncRequest.UserBuffer.Offset, asyncRequest.UserBuffer.Size, out wantMore);
}
Debug ("ProcessRead - read user done: {0} - {1} {2}", asyncRequest.UserBuffer, ret, wantMore);
if (ret < 0) {
asyncRequest.UserResult = -1;
return AsyncOperationStatus.Complete;
}
asyncRequest.CurrentSize += ret;
asyncRequest.UserBuffer.Offset += ret;
asyncRequest.UserBuffer.Size -= ret;
Debug ("Process Read - read user done #1: {0} - {1} {2}", asyncRequest.UserBuffer, asyncRequest.CurrentSize, wantMore);
if (wantMore && asyncRequest.CurrentSize == 0)
return AsyncOperationStatus.WantRead;
asyncRequest.ResetRead ();
asyncRequest.UserResult = asyncRequest.CurrentSize;
return AsyncOperationStatus.Complete;
}
AsyncOperationStatus ProcessWrite (AsyncProtocolRequest asyncRequest, AsyncOperationStatus status)
{
Debug ("ProcessWrite - write user: {0} {1}", status, asyncRequest.UserBuffer);
if (asyncRequest.UserBuffer.Size == 0) {
asyncRequest.UserResult = asyncRequest.CurrentSize;
return AsyncOperationStatus.Complete;
}
int ret;
bool wantMore;
lock (ioLock) {
ret = Context.Write (asyncRequest.UserBuffer.Buffer, asyncRequest.UserBuffer.Offset, asyncRequest.UserBuffer.Size, out wantMore);
}
Debug ("ProcessWrite - write user done: {0} - {1} {2}", asyncRequest.UserBuffer, ret, wantMore);
if (ret < 0) {
asyncRequest.UserResult = -1;
return AsyncOperationStatus.Complete;
}
asyncRequest.CurrentSize += ret;
asyncRequest.UserBuffer.Offset += ret;
asyncRequest.UserBuffer.Size -= ret;
if (wantMore || writeBuffer.Size > 0)
return AsyncOperationStatus.WantWrite;
asyncRequest.ResetWrite ();
asyncRequest.UserResult = asyncRequest.CurrentSize;
return AsyncOperationStatus.Complete;
}
AsyncOperationStatus ProcessClose (AsyncProtocolRequest asyncRequest, AsyncOperationStatus status)
{
Debug ("ProcessClose: {0}", status);
lock (ioLock) {
if (xobileTlsContext == null)
/*
* SSLHandshake() will return repeatedly with 'SslStatus.WouldBlock', we then need
* to take care of I/O and call it again.
*/
if (xobileTlsContext.ProcessHandshake ()) {
xobileTlsContext.FinishHandshake ();
return AsyncOperationStatus.Complete;
xobileTlsContext.Close ();
xobileTlsContext = null;
}
return AsyncOperationStatus.Continue;
}
}
AsyncOperationStatus ProcessFlush (AsyncProtocolRequest asyncRequest, AsyncOperationStatus status)
internal (int, bool) ProcessRead (BufferOffsetSize userBuffer)
{
Debug ("ProcessFlush: {0}", status);
return AsyncOperationStatus.Complete;
lock (ioLock) {
// This operates on the internal buffer and will never block.
var ret = xobileTlsContext.Read (userBuffer.Buffer, userBuffer.Offset, userBuffer.Size, out bool wantMore);
return (ret, wantMore);
}
}
#endregion
internal (int, bool) ProcessWrite (BufferOffsetSize userBuffer)
{
lock (ioLock) {
// This operates on the internal buffer and will never block.
var ret = xobileTlsContext.Write (userBuffer.Buffer, userBuffer.Offset, userBuffer.Size, out bool wantMore);
return (ret, wantMore);
}
}
internal AsyncOperationStatus ProcessShutdown (AsyncOperationStatus status)
{
Debug ("ProcessShutdown: {0}", status);
lock (ioLock) {
xobileTlsContext.Shutdown ();
shutdown = true;
return AsyncOperationStatus.Complete;
}
}
#endregion
public override bool IsServer {
get { return xobileTlsContext != null && xobileTlsContext.IsServer; }
get {
CheckThrow (false);
return xobileTlsContext != null && xobileTlsContext.IsServer;
}
}
public override bool IsAuthenticated {
get { return xobileTlsContext != null && lastException == null && xobileTlsContext.IsAuthenticated; }
get {
lock (ioLock) {
// Don't use CheckThrow(), we want to return false if we're not authenticated.
return xobileTlsContext != null && lastException == null && xobileTlsContext.IsAuthenticated;
}
}
}
public override bool IsMutuallyAuthenticated {
get {
return IsAuthenticated &&
(Context.IsServer? Context.LocalServerCertificate: Context.LocalClientCertificate) != null &&
Context.IsRemoteCertificateAvailable;
lock (ioLock) {
// Don't use CheckThrow() here.
if (!IsAuthenticated)
return false;
if ((xobileTlsContext.IsServer ? xobileTlsContext.LocalServerCertificate : xobileTlsContext.LocalClientCertificate) == null)
return false;
return xobileTlsContext.IsRemoteCertificateAvailable;
}
}
}
protected override void Dispose (bool disposing)
{
try {
lastException = new ObjectDisposedException ("MobileAuthenticatedStream");
lock (ioLock) {
Debug ("Dispose: {0}", xobileTlsContext != null);
lastException = ExceptionDispatchInfo.Capture (new ObjectDisposedException ("MobileAuthenticatedStream"));
if (xobileTlsContext != null) {
xobileTlsContext.Dispose ();
xobileTlsContext = null;
@@ -720,26 +698,53 @@ namespace Mono.Net.Security
public override void Flush ()
{
CheckThrow (true);
var asyncRequest = new AsyncProtocolRequest (this, null);
StartOperation (ref asyncWriteRequest, ref writeBuffer, ProcessFlush, asyncRequest, "flush");
// Write() automatically flushes the underlying stream.
}
public override void Close ()
{
/*
* SSLClose() is a little bit tricky as it might attempt to send a close_notify alert
* and thus call our write callback.
*
* It is also not thread-safe with SSLRead() or SSLWrite(), so we need to take the I/O lock here.
*/
if (Interlocked.Exchange (ref closeRequested, 1) == 1)
return;
if (xobileTlsContext == null)
return;
public SslProtocols SslProtocol {
get {
lock (ioLock) {
CheckThrow (true);
return (SslProtocols)xobileTlsContext.NegotiatedProtocol;
}
}
}
var asyncRequest = new AsyncProtocolRequest (this, null);
StartOperation (ref asyncWriteRequest, ref writeBuffer, ProcessClose, asyncRequest, "close");
public X509Certificate RemoteCertificate {
get {
lock (ioLock) {
CheckThrow (true);
return xobileTlsContext.RemoteCertificate;
}
}
}
public X509Certificate LocalCertificate {
get {
lock (ioLock) {
CheckThrow (true);
return InternalLocalCertificate;
}
}
}
public X509Certificate InternalLocalCertificate {
get {
lock (ioLock) {
CheckThrow (false);
if (xobileTlsContext == null)
return null;
return xobileTlsContext.IsServer ? xobileTlsContext.LocalServerCertificate : xobileTlsContext.LocalClientCertificate;
}
}
}
public MSI.MonoTlsConnectionInfo GetConnectionInfo ()
{
lock (ioLock) {
CheckThrow (true);
return xobileTlsContext.ConnectionInfo;
}
}
//
@@ -769,7 +774,7 @@ namespace Mono.Net.Security
}
public override bool CanWrite {
get { return IsAuthenticated & InnerStream.CanWrite; }
get { return IsAuthenticated & InnerStream.CanWrite && !shutdown; }
}
public override bool CanSeek {
@@ -803,46 +808,10 @@ namespace Mono.Net.Security
set { InnerStream.WriteTimeout = value; }
}
public SslProtocols SslProtocol {
get {
CheckThrow (true);
return (SslProtocols)Context.NegotiatedProtocol;
}
}
public X509Certificate RemoteCertificate {
get {
CheckThrow (true);
return Context.RemoteCertificate;
}
}
public X509Certificate LocalCertificate {
get {
CheckThrow (true);
return InternalLocalCertificate;
}
}
public X509Certificate InternalLocalCertificate {
get {
CheckThrow (false);
if (!HasContext)
return null;
return Context.IsServer ? Context.LocalServerCertificate : Context.LocalClientCertificate;
}
}
public MSI.MonoTlsConnectionInfo GetConnectionInfo ()
{
CheckThrow (true);
return Context.ConnectionInfo;
}
public SSA.CipherAlgorithmType CipherAlgorithm {
get {
CheckThrow (true);
var info = Context.ConnectionInfo;
var info = GetConnectionInfo ();
if (info == null)
return SSA.CipherAlgorithmType.None;
switch (info.CipherAlgorithmType) {
@@ -861,7 +830,7 @@ namespace Mono.Net.Security
public SSA.HashAlgorithmType HashAlgorithm {
get {
CheckThrow (true);
var info = Context.ConnectionInfo;
var info = GetConnectionInfo ();
if (info == null)
return SSA.HashAlgorithmType.None;
switch (info.HashAlgorithmType) {
@@ -883,7 +852,7 @@ namespace Mono.Net.Security
public SSA.ExchangeAlgorithmType KeyExchangeAlgorithm {
get {
CheckThrow (true);
var info = Context.ConnectionInfo;
var info = GetConnectionInfo ();
if (info == null)
return SSA.ExchangeAlgorithmType.None;
switch (info.ExchangeAlgorithmType) {
@@ -898,7 +867,7 @@ namespace Mono.Net.Security
}
}
#region Need to Implement
#region Need to Implement
public int CipherStrength {
get {
throw new NotImplementedException ();
@@ -920,7 +889,7 @@ namespace Mono.Net.Security
}
}
#endregion
#endregion
}
}
#endif
@@ -169,7 +169,7 @@ namespace Mono.Net.Security
public abstract int Write (byte[] buffer, int offset, int count, out bool wantMore);
public abstract void Close ();
public abstract void Shutdown ();
protected bool ValidateCertificate (X509Certificate leaf, X509Chain chain)
{
@@ -83,6 +83,8 @@ namespace Mono.Net.Security
if (initialized)
return;
InitializeProviderRegistration ();
MSI.MonoTlsProvider provider;
try {
provider = CreateDefaultProviderImpl ();
+2
View File
@@ -9,6 +9,8 @@ partial class SR
{
public const string mono_net_io_shutdown = "mono_net_io_shutdown";
public const string mono_net_io_renegotiate = "mono_net_io_renegotiate";
public const string net_ssl_io_already_shutdown = "Write operations are not allowed after the channel was shutdown.";
public const string net_log_set_socketoption_reuseport_default_on = "net_log_set_socketoption_reuseport_default_on";
public const string net_log_set_socketoption_reuseport_not_supported = "net_log_set_socketoption_reuseport_not_supported";
@@ -46,6 +46,7 @@ namespace System.ComponentModel
case 32: /* ERROR_SHARING_VIOLATION */ return "Sharing violation";
case 33: /* ERROR_LOCK_VIOLATION */ return "Lock violation";
case 50: /* ERROR_NOT_SUPPORTED */ return "Operation not supported";
case 55: /* ERROR_DEV_NOT_EXIST */ return "Device does not exist";
case 87: /* ERROR_INVALID_PARAMETER */ return "Invalid parameter";
case 120: /* ERROR_CALL_NOT_IMPLEMENTED */ return "Call not implemented";
case 123: /* ERROR_INVALID_NAME */ return "Invalid name";
@@ -142,7 +143,6 @@ namespace System.ComponentModel
case 52: /* ERROR_DUP_NAME */ return "Duplicate name";
case 53: /* ERROR_BAD_NETPATH */ return "Bad netpath";
case 54: /* ERROR_NETWORK_BUSY */ return "Network busy";
case 55: /* ERROR_DEV_NOT_EXIST */ return "Device does not exist";
case 56: /* ERROR_TOO_MANY_CMDS */ return "Too many commands";
case 57: /* ERROR_ADAP_HDW_ERR */ return "ADAP HDW error";
case 58: /* ERROR_BAD_NET_RESP */ return "Bad net response";
@@ -61,8 +61,10 @@ namespace System.Net.Configuration
properties = new ConfigurationPropertyCollection ();
properties.Add (bypassListProp);
properties.Add (enabledProp);
properties.Add (moduleProp);
properties.Add (proxyProp);
properties.Add (useDefaultCredentialsProp);
}
public DefaultProxySection ()
@@ -62,6 +62,7 @@ namespace System.Net.Configuration
properties = new ConfigurationPropertyCollection ();
properties.Add (autoDetectProp);
properties.Add (bypassOnLocalProp);
properties.Add (proxyAddressProp);
properties.Add (scriptLocationProp);
@@ -207,17 +207,6 @@ namespace System.Net.NetworkInformation {
return Send (addresses [0], timeout, buffer, options);
}
static IPAddress GetNonLoopbackIPV4 ()
{
#pragma warning disable 618
foreach (IPAddress addr in Dns.GetHostByName (Dns.GetHostName ()).AddressList)
if (!IPAddress.IsLoopback (addr) && addr.AddressFamily == AddressFamily.InterNetwork)
return addr;
#pragma warning restore 618
throw new InvalidOperationException ("Could not resolve non-loopback IP address for localhost");
}
public PingReply Send (IPAddress address, int timeout, byte [] buffer, PingOptions options)
{
if (address == null)
@@ -243,8 +232,7 @@ namespace System.Net.NetworkInformation {
private PingReply SendPrivileged (IPAddress address, int timeout, byte [] buffer, PingOptions options)
{
IPEndPoint target = new IPEndPoint (address, 0);
IPEndPoint client = new IPEndPoint (GetNonLoopbackIPV4 (), 0);
// FIXME: support IPv6
using (Socket s = new Socket (AddressFamily.InterNetwork, SocketType.Raw, ProtocolType.Icmp)) {
if (options != null) {
@@ -264,7 +252,7 @@ namespace System.Net.NetworkInformation {
// receive
bytes = new byte [100];
do {
EndPoint endpoint = client;
EndPoint endpoint = target;
SocketError error = 0;
int rc = s.ReceiveFrom (bytes, 0, 100, SocketFlags.None,
ref endpoint, out error);
@@ -223,6 +223,11 @@ namespace System.Net.Security
return Impl.AuthenticateAsServerAsync (serverCertificate, clientCertificateRequired, enabledSslProtocols, checkCertificateRevocation);
}
public virtual Task ShutdownAsync ()
{
return Impl.ShutdownAsync ();
}
public override bool IsAuthenticated {
get { return Impl.IsAuthenticated; }
}
@@ -152,6 +152,11 @@ namespace System.Net.Security
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
public virtual Task ShutdownAsync ()
{
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
public override bool IsAuthenticated {
get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
}
+73 -92
View File
@@ -976,60 +976,7 @@ namespace System.Net.Sockets
EndPoint = remoteEP,
};
// Bug #75154: Connect() should not succeed for .Any addresses.
if (remoteEP is IPEndPoint) {
IPEndPoint ep = (IPEndPoint) remoteEP;
if (ep.Address.Equals (IPAddress.Any) || ep.Address.Equals (IPAddress.IPv6Any)) {
sockares.Complete (new SocketException ((int) SocketError.AddressNotAvailable), true);
return sockares;
}
sockares.EndPoint = remoteEP = RemapIPEndPoint (ep);
}
int error = 0;
if (connect_in_progress) {
// This could happen when multiple IPs are used
// Calling connect() again will reset the connection attempt and cause
// an error. Better to just close the socket and move on.
connect_in_progress = false;
m_Handle.Dispose ();
m_Handle = new SafeSocketHandle (Socket_internal (addressFamily, socketType, protocolType, out error), true);
if (error != 0)
throw new SocketException (error);
}
bool blk = is_blocking;
if (blk)
Blocking = false;
Connect_internal (m_Handle, remoteEP.Serialize (), out error, false);
if (blk)
Blocking = true;
if (error == 0) {
// succeeded synch
is_connected = true;
is_bound = true;
sockares.Complete (true);
return sockares;
}
if (error != (int) SocketError.InProgress && error != (int) SocketError.WouldBlock) {
// error synch
is_connected = false;
is_bound = false;
sockares.Complete (new SocketException (error), true);
return sockares;
}
// continue asynch
is_connected = false;
is_bound = false;
connect_in_progress = true;
IOSelector.Add (sockares.Handle, new IOSelectorJob (IOOperation.Write, BeginConnectCallback, sockares));
BeginSConnect (sockares);
return sockares;
}
@@ -1055,39 +1002,85 @@ namespace System.Net.Sockets
is_connected = false;
return BeginMConnect (sockares);
BeginMConnect (sockares);
return sockares;
}
internal IAsyncResult BeginMConnect (SocketAsyncResult sockares)
static void BeginMConnect (SocketAsyncResult sockares)
{
SocketAsyncResult ares = null;
Exception exc = null;
AsyncCallback callback;
for (int i = sockares.CurrentAddress; i < sockares.Addresses.Length; i++) {
try {
sockares.CurrentAddress++;
sockares.EndPoint = new IPEndPoint (sockares.Addresses [i], sockares.Port);
ares = (SocketAsyncResult) BeginConnect (new IPEndPoint (sockares.Addresses [i], sockares.Port), null, sockares);
if (ares.IsCompleted && ares.CompletedSynchronously) {
ares.CheckIfThrowDelayedException ();
callback = ares.AsyncCallback;
if (callback != null)
ThreadPool.UnsafeQueueUserWorkItem (_ => callback (ares), null);
}
break;
BeginSConnect (sockares);
return;
} catch (Exception e) {
exc = e;
ares = null;
}
}
if (ares == null)
throw exc;
throw exc;
}
return sockares;
static void BeginSConnect (SocketAsyncResult sockares)
{
EndPoint remoteEP = sockares.EndPoint;
// Bug #75154: Connect() should not succeed for .Any addresses.
if (remoteEP is IPEndPoint) {
IPEndPoint ep = (IPEndPoint) remoteEP;
if (ep.Address.Equals (IPAddress.Any) || ep.Address.Equals (IPAddress.IPv6Any)) {
sockares.Complete (new SocketException ((int) SocketError.AddressNotAvailable), true);
return;
}
sockares.EndPoint = remoteEP = sockares.socket.RemapIPEndPoint (ep);
}
int error = 0;
if (sockares.socket.connect_in_progress) {
// This could happen when multiple IPs are used
// Calling connect() again will reset the connection attempt and cause
// an error. Better to just close the socket and move on.
sockares.socket.connect_in_progress = false;
sockares.socket.m_Handle.Dispose ();
sockares.socket.m_Handle = new SafeSocketHandle (sockares.socket.Socket_internal (sockares.socket.addressFamily, sockares.socket.socketType, sockares.socket.protocolType, out error), true);
if (error != 0)
throw new SocketException (error);
}
bool blk = sockares.socket.is_blocking;
if (blk)
sockares.socket.Blocking = false;
Connect_internal (sockares.socket.m_Handle, remoteEP.Serialize (), out error, false);
if (blk)
sockares.socket.Blocking = true;
if (error == 0) {
// succeeded synch
sockares.socket.is_connected = true;
sockares.socket.is_bound = true;
sockares.Complete (true);
return;
}
if (error != (int) SocketError.InProgress && error != (int) SocketError.WouldBlock) {
// error synch
sockares.socket.is_connected = false;
sockares.socket.is_bound = false;
sockares.Complete (new SocketException (error), true);
return;
}
// continue asynch
sockares.socket.is_connected = false;
sockares.socket.is_bound = false;
sockares.socket.connect_in_progress = true;
IOSelector.Add (sockares.Handle, new IOSelectorJob (IOOperation.Write, BeginConnectCallback, sockares));
}
static IOAsyncCallback BeginConnectCallback = new IOAsyncCallback (ares => {
@@ -1098,18 +1091,11 @@ namespace System.Net.Sockets
return;
}
SocketAsyncResult mconnect = sockares.AsyncState as SocketAsyncResult;
bool is_mconnect = mconnect != null && mconnect.Addresses != null;
try {
EndPoint ep = sockares.EndPoint;
int error_code = (int) sockares.socket.GetSocketOption (SocketOptionLevel.Socket, SocketOptionName.Error);
int error = (int) sockares.socket.GetSocketOption (SocketOptionLevel.Socket, SocketOptionName.Error);
if (error_code == 0) {
if (is_mconnect)
sockares = mconnect;
sockares.socket.seed_endpoint = ep;
if (error == 0) {
sockares.socket.seed_endpoint = sockares.EndPoint;
sockares.socket.is_connected = true;
sockares.socket.is_bound = true;
sockares.socket.connect_in_progress = false;
@@ -1118,26 +1104,21 @@ namespace System.Net.Sockets
return;
}
if (!is_mconnect) {
if (sockares.Addresses == null) {
sockares.socket.connect_in_progress = false;
sockares.Complete (new SocketException (error_code));
sockares.Complete (new SocketException (error));
return;
}
if (mconnect.CurrentAddress >= mconnect.Addresses.Length) {
mconnect.Complete (new SocketException (error_code));
if (sockares.CurrentAddress >= sockares.Addresses.Length) {
sockares.Complete (new SocketException (error));
return;
}
mconnect.socket.BeginMConnect (mconnect);
BeginMConnect (sockares);
} catch (Exception e) {
sockares.socket.connect_in_progress = false;
if (is_mconnect)
sockares = mconnect;
sockares.Complete (e);
return;
}
});
Loaded 100 of 512 files, more files were not shown because too many files have changed in this diff. Show more