Compare commits

...
107 Commits
Author SHA1 Message Date
Alexander Köplinger 77769615db Fix Cairo issue on macOS Big Sur
Bumps bockbuild to get the changes from mono/bockbuild#162

BigSur's CoreGraphics seems to need a copy of the data to stick around longer than the surface,
so we provide it a copy of the data instead.

Backport of https://github.com/mono/mono/pull/20154 to 2019-12
2020-07-24 13:53:25 +02:00
Alexander Köplinger df7816daf4 Bump bockbuild to get https://github.com/mono/bockbuild/pull/159 2020-05-15 14:33:53 +02:00
Ankit Jain 5d03a6fe11 [2019-12] Bump msbuild to track mono-2019-12 (#19662)
* [2019-12] Bump msbuild to track mono-2019-12

* [2019-12] Bump msbuild to track mono-2019-12

* [2019-12] Bump msbuild to track mono-2019-12
2020-04-29 19:47:23 -04:00
Ankit Jain 4a2a26ce69 [2019-12] Bump msbuild to track mono-2019-12 (#19622)
* [2019-12] Bump msbuild to track mono-2019-12

* Bump nuget.exe to 5.6.0-preview2

* Bump roslyn to 3.6.0-4.20222.3 to match msbuild
2020-04-24 12:42:07 -04:00
monojenkins c8cfa8f284 [System.Runtime.Serialization] Work around specified cast is not valid error (#19641)
Backport of #19620.
2020-04-24 10:56:14 +02:00
Mitchell HwangandMitchell Hwang 6f0bf73005 [mono-2019-12] Bump corefx to get https://github.com/mono/corefx/pull/396 (#19428)
Co-authored-by: Mitchell Hwang <[email protected]>
2020-04-03 14:59:29 -04:00
monojenkins fdbba4a34e [2019-12] [amd64] align application stack pointer in signal handler (#19368)
[2019-12] [amd64] align application stack pointer in signal handler

16byte stack pointer alignment is only required in certain places by the ABI, so the assumption that it holds all the time is wrong (though, it passed CI 😅). We have to setup the frame properly, i.e. we have to ensure the stack pointer is properly aligned. That's what we have done previously too.

Regression of https://github.com/mono/mono/pull/17922
Fixes https://github.com/mono/mono/issues/18006


Backport of #18021.

/cc @lewurm
2020-04-03 06:36:06 -04:00
Alexander Köplinger 1278c2f35e Bump bockbuild to get PATH fix 2020-04-03 11:36:20 +02:00
8199a27e28 [2019-12] Force Python 3.x from env in shebang lines (#19423)
* Force Python 3.x from env in shebang lines

* Fix byte/string incompatiblity in Python 3

* Fix locating Python interpreter when it isn't "python" (#18197)

Fix locating Python interpreter when it isn't "python"

The "python" interpreter is specified by PEP-394. In it, an OS
can decide not to ship a "python" executable, and instead only
ship python2/3, providing some ambiguity for scripts that are
version-neutral, like the one Mono uses.

This uses an automake macro to locate a suitable Python, and
changes the makefile to use the located Python, whatever it may be.

(cherry picked from commit 84221f04b5)

* More disambiguation of Python in makefiles (#18284)

(cherry picked from commit b3ce5bfa88)

* [build] Check for Python 3 in configure.ac (#18625)

I fear this causing packaging problems, but as-is we require Python 3 for most of our Python files but don't actually check for that in configure. We should be consistent about this. Some projects (notably wasm) also use the Python version detected here, so bumping this will also bump the version used in those cases (a good thing, since there are some known bugs when using the scripts with Python 2).

(cherry picked from commit 0f47ea5d80)

Co-authored-by: Calvin Buckley <[email protected]>
Co-authored-by: Ryan Lucia <[email protected]>
2020-04-03 10:38:34 +02:00
Alexander Köplinger 9b3e6f4700 Fix Windows .msi build using newer xar and recent cygwin updates
The old version didn't compile anymore with OpenSSL 1.1

Cygwin now ships libssl 1.1 which removed OpenSSL_add_all_ciphers so the xar configure fails.
Replace the configure check with another existing function to fix it.

(cherry picked from commit 9485a66d20)
(cherry picked from commit e10990125d)
2020-04-03 10:37:58 +02:00
monojenkinsandAlexis Christoforides 8487188883 [2019-12] [merp] Add breadcrumb for StackHash (#19243)
* [merp] Add breadcrumb for StackHash

Contributes to https://github.com/mono/mono/issues/18715

Co-authored-by: Alexis Christoforides <[email protected]>
2020-03-17 11:59:07 -04:00
monojenkinsandAleksey Kliger f2379f2d66 [2019-12] [corlib] Capture the ExceptionDispatchInfo when rethrowing from TaskContinuation (#19208)
* [corlib] Capture the ExceptionDispatchInfo when rethrowing from TaskContinuation

In `task.GetAwaiter().OnCompleted(action)` if `action` throws, the
`TaskContinuation.RunOrScheduleAction method will catch the exception and then
call `RuntimeAugments.ReportUnhandledException`.  We must not simply throw the
exception again - in that case we will lose all the frames leading up to the
`catch` in `RunOrScheduleAction`.  Instead use ExceptionDispatchInfo to
caputure the original throw.

Addresses https://github.com/mono/mono/issues/19166

* [test] Add regression test

For annoying reasons we can't run this as a simple NUnit test because the
exception is unhandled on some arbitrary threadpool worker thread, and those
don't show up within an NUnit setup.

Additionally because the unhandled exception in the root domain would normally
terminate the application, we need to run this in a new appdomain.

Co-authored-by: Aleksey Kliger <[email protected]>
2020-03-13 10:03:05 -04:00
Ankit Jain db04a05e04 [2019-12] Bump msbuild to track mono-2019-12 (#19205) 2020-03-12 23:39:03 +01:00
monojenkinsandAlexis Christoforides d06686c425 [merp] Create a 'reason' breadcrumb for the crash dump process (#19119)
For example, the system name of a signal ('segv') or 'MANAGED_EXCEPTION' are typical arguments.

Co-authored-by: Alexis Christoforides <[email protected]>
2020-03-11 09:35:31 -04:00
Ankit Jain 2ff898859b [2019-12] Bump msbuild to track mono-2019-12 (#19078) 2020-03-02 20:49:30 +01:00
Alexander Köplinger b27b2d7f61 Update mono-extensions 2020-02-28 19:58:45 +01:00
Alexander Köplinger 13fc6948f3 Update mono-extensions 2020-02-28 19:06:21 +01:00
Alexander Köplinger 2517534847 Bump mono-extensions 2020-02-28 15:22:33 +01:00
Alexis Christoforides c6890f410c [2019-12][runtime] Improve handling crashing signals (#19018)
* [runtime] Improve handling crashing signals

The default handlers for SIGTRAP, SIGSYS on macOS and Linux crash the process, so we now have Mono report this.

This patch also changes how the name of the signal is acquired for passing on to the crash reporting functions, allowing code reuse on crashing signals.

* [mono] Remove SIGTRAP handler, as it interferes with debugging

See https://github.com/mono/mono/pull/18243#issuecomment-586013427

* Fix lack of cleanup for SIGSYS
2020-02-28 02:27:41 -05:00
monojenkinsandThays Grazia b33fa1d00e Backport 2020-02 enable embedded ppdb. (#19050)
Co-authored-by: Thays Grazia <[email protected]>
2020-02-26 20:10:15 -05:00
Alexander Köplinger 8a687a4044 Bump bockbuild for Pango nil check fix
Pango nil check fix: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1069059/

Brings in https://github.com/mono/bockbuild/pull/153

Backport of https://github.com/mono/mono/pull/18936
2020-02-24 19:48:37 +01:00
monojenkinsandAlexis Christoforides 44703b3ecc [merp] Produce hashes for unmanaged thread stacks also (#18964)
Before, this was only done for managed stacks.

Addresses https://github.com/mono/mono/issues/18941

Co-authored-by: Alexis Christoforides <[email protected]>
2020-02-24 13:01:47 -05:00
monojenkinsandAlexis Christoforides 0ac7105edd [merp] Increase buffer size for state dump (#18839)
Addresses https://github.com/mono/mono/issues/18796

Co-authored-by: Alexis Christoforides <[email protected]>
2020-02-24 10:21:43 -05:00
Ankit Jain 147ecc0ac3 [2019-12] Bump msbuild to track mono-2019-10 (#18986) 2020-02-24 15:51:06 +01:00
monojenkinsandNathan Ricci e7b4669bc9 Added some parenthesis and a cast to control order of operations. (#18984)
This fixes https://github.com/mono/mono/issues/17140; intermittent incorrect results from GetTotalBytesAllocated for current thread. uint64_t and a pointer difference are not the same type/width on all architectures, so incorrect results can happen with out the parenthesis.

Co-authored-by: Nathan Ricci <[email protected]>
2020-02-24 12:08:03 +01:00
monojenkinsandVlad Brezae fc145be98c [sgen] Disable managed allocator when using nursery-canaries (#18946)
The managed allocator included in a full aot image does not support canaries, leading to inconsistent object layout.

Fixes https://github.com/mono/mono/issues/18925

Co-authored-by: Vlad Brezae <[email protected]>
2020-02-20 14:01:06 +02:00
monojenkinsandEgor Bogatov adebac056a Remove TestEnvVarSwitchForInnerHttpHandler test as it should be in XA/LinkerTests.cs instead (#18956)
Co-authored-by: Egor Bogatov <[email protected]>
2020-02-20 11:11:33 +01:00
monojenkinsandAleksey Kliger f7f561703a [2019-12] [merp] Capture Environment.FailFast message in crash report (#18921)
* [merp] Capture Environment.FailFast message in crash report

* [test] merp-crash-test refactor crasher data; add optional validator

Switch from a Tuple<T1,T2> to a struct for the crash items.  Add a third
optional validator field which is an action to run on the json blob that we get
back.

Not updating existing tests to do any json validation, yet.

* [test] Add new MERP crash test for Environment.FailFast

Check that the resulting json blob includes the failfast message.

Co-authored-by: Aleksey Kliger (λgeek) <[email protected]>
2020-02-19 20:16:29 +01:00
monojenkins b5b50eefe7 [2019-12] [bcl] Default XmlSerializer stream serialize to UTF8 Encoding (#18908)
* [mcs] Default XmlSerializer stream serialize to UTF8 Encoding

* [bcl] Add XmlSerialize Test to preserve UTF chars in stream
2020-02-19 14:06:28 -05:00
Marius Ungureanu cec38fcfc8 Bump bockbuild to bring in Gtk# regression fix (#18911)
Backport of https://github.com/mono/mono/pull/18909
2020-02-18 19:45:45 +01:00
monojenkinsandEgor Bogatov 0761b0ee55 [2019-12] Make MonoWebRequestHandler linker friendly (#18833)
* Make MonoWebRequestHandler linker friendly

* Make MonoWebRequestHandler's ctor public (to be able to use in Activator.CreateInstance without binding flags)

* Remove Console.WriteLine from system.net.http

Co-authored-by: Egor Bogatov <[email protected]>
2020-02-18 15:55:00 +03:00
monojenkinsandEgor Bogatov 0c45a74a96 Move HttpClientHandlerTests.Android.cs to nunit (#18889)
Co-authored-by: Egor Bogatov <[email protected]>
2020-02-18 15:54:41 +03:00
Ankit Jain d5f5f3762f [2019-12] Bump msbuild to track mono-2019-10 (#18862)
- Changes roslyn to 3.5.0-beta2-20074-05
2020-02-17 12:39:58 +01:00
monojenkinsandAlexander Köplinger f1bdf8a93d Move offsets-tool into mono/tools (#18830)
Backporting this since we see errors during `pip install` on the Android Mono SDKs build on Linux and with this we're removing the call to pip (it wasn't needed).

Backport of #18783.

Co-authored-by: Alexander Köplinger <[email protected]>
2020-02-13 14:16:59 +01:00
Ankit Jain 3fdc3c84b2 [2019-12] Bump msbuild to track mono-2019-10 (#18792)
* [2019-12] Bump msbuild to track mono-2019-10

* Bump roslyn to 3.5.0-beta3-20111-03 .

* Update nuget.exe to match xbuild

- the closest version available right now, to `5.5.0-rtm.6422` is
`5.5.0-preview2`, so using that for now.
2020-02-12 17:11:04 +01:00
monojenkins 846a5d41ee [2019-12] Allow users to switch to MonoWebRequestHandler on Android via UI (#18786)
* Bring back old HttpHandler for Android
Co-authored-by: Egor Bogatov <[email protected]>
2020-02-12 16:24:10 +03:00
Alexander Köplinger c8b96661d3 Bump bockbuild to get GTK NSPasteboardType change.
Backport from https://github.com/mono/mono/pull/18080
2020-02-10 16:22:27 +01:00
monojenkinsandAlex Soto db584480ff [iOS] Replace removed dsymutil -t switch with -num-threads (#18744)
Apple removed `-t` switch from dsymutil in favor of `-num-threads`

Co-authored-by: Alex Soto <[email protected]>
2020-02-07 11:14:01 +01:00
Alexander Köplinger 0686e1435b Skip WebAssembly build in sdks archive build on non-master branches
WebAssembly doesn't use our usual release branches yet.

(cherry picked from commit a40e1ae681)
2020-02-06 22:39:13 +01:00
monojenkinsandAlexis Christoforides 5ef6ad0ef7 [merp] Add an exception type for managed exceptions (#18723)
Addresses https://github.com/mono/mono/issues/18681

Co-authored-by: Alexis Christoforides <[email protected]>
2020-02-06 16:31:17 -05:00
monojenkinsandManuel de la Pena 36073a0c74 [NUnitLite] Bump nunitlite submodule. (#18733)
Update the nunitlite submodule to pick up some fixes in the NUnit v3
outputwriter that are needed by xamarin-macios.

Co-authored-by: Manuel de la Pena <[email protected]>
2020-02-06 15:57:58 +01:00
Matt Sylvia e65846bfd3 Update deprecated query parameter to header (#18705)
Use of `access_token` is now deprecated, switching to HTTP header

```
Please use the Authorization HTTP header instead, as using the `access_token` query parameter is deprecated.
```

(cherry picked from commit 2f74ab393f)
2020-02-04 22:58:48 +01:00
monojenkinsandZoltan Varga 0011444f0b [aot] Avoid inflating gparams with byreflike types during generic sharing. (#18682)
Fixes https://github.com/mono/mono/issues/18676.

Co-authored-by: Zoltan Varga <[email protected]>
2020-02-04 16:41:04 +01:00
monojenkinsandAleksey Kliger 4c93e382f5 [2019-12] [merp] MONO_DEBUG=no-gdb-stacktrace shouldn't disable MERP (#18611)
* [merp] MONO_DEBUG=no-gdb-stacktrace shouldn't disable MERP

Only prevent `gdb` or `lldb` from being invoked.

MERP is controlled by separate mechanisms --- configure flags for crash
reporting and an explicit opt-in icall.

The existing code collects crashed process data in-process, but it writes the
data out (using mono_merp_invoke) in the forked child process.  This is a bit
surprising, but in the interest of not disturbing the code too much, this PR
doesn't change that.  We should revisit `dump_native_stacktrace` again in the
future and rationalize these decisions.

Addresses https://github.com/mono/mono/issues/18565

* Fix indentation

Co-authored-by: Aleksey Kliger (λgeek) <[email protected]>
2020-01-31 19:24:43 +01:00
monojenkinsandAlexander Köplinger 8b72dbb708 [corlib] Split corlib xunit tests even more for iOS (#18620)
Follow-up to https://github.com/mono/mono/pull/18228 since two parts wasn't enough to fix the size issue on 32bits devices.
We now use three parts.

Fixes https://github.com/mono/mono/issues/18614

Co-authored-by: Alexander Köplinger <[email protected]>
2020-01-29 21:27:54 +01:00
Alexander Köplinger 1e2d68b92c Bump bockbuild for Pango patch
Fixes bug #1048838, correct SF font not loading in VSMac

Backport of https://github.com/mono/mono/pull/18566
2020-01-28 13:16:07 +01:00
monojenkinsandAlexander Köplinger e55302cb08 configure.ac: remove AC_SEARCH_LIBS for libintl (#18595)
This causes an additional dependency of mono on libintl which we didn't have before.
Reported by a user on gitter, it's problematic on macOS since it makes the mono binary depend on the libintl we ship in the Mono .pkg.

It was introduced in Mono 6.6 by https://github.com/mono/mono/commit/18e0ebfe89be0a175d2f904b9bb1ec6816daa318

Co-authored-by: Alexander Köplinger <[email protected]>
2020-01-27 17:02:44 +01:00
monojenkins ef8188a08d [runtime] Disable lldb backtrace display on osx, it hangs on attaching in lldb. (#18591)
Backport of #18590.
Co-authored-by: Zoltan Varga <[email protected]>
2020-01-27 10:59:17 +01:00
Ankit Jain 01be275ad7 [2019-12] Bump msbuild to track mono-2019-10 (#18577) 2020-01-27 10:55:09 +01:00
monojenkinsandZoltan Varga f9e5a6d2b2 [jit] Compute has_references correctly for gshared types whose constraint is a generic valuetype. Also emit write barriers correctly for these types. (#18562)
Co-authored-by: Zoltan Varga <[email protected]>
2020-01-25 13:02:39 -05:00
monojenkinsandThays Grazia a979811c63 [2019-12] [debugger] Native thread not executing managed code considered as terminated (#18504)
* If a thread was suspended and doesn't have any managed stack, it was considered as terminated, but it wasn't really terminated because it can execute managed code again, and stop in a breakpoint so if the execution arrives in debugger_agent_breakpoint_from_context we reset the flag terminated to FALSE.

* Adding terminated = FALSE in single_step_from_context.

Co-authored-by: Thays Grazia <[email protected]>
2020-01-23 13:15:06 -03:00
monojenkinsandBernhard Urban-Forster 455cf7d3b1 [interp] context can be uninitialized for get_resume_state callback (#18535)
`jit_tls->interp_context` gets initialized lazily, that is, upon the first interpreter execution on a specific thread (e.g. via interp_runtime_invoke). However, with mixed mode the execution can purely happen in AOT code upon the first interaction with the managed debugger.

Stack trace:

```
  thread #1, name = 'tid_407', queue = 'com.apple.main-thread'
    frame #0: 0x0000000190aedc94 libsystem_kernel.dylib`__psynch_cvwait + 8
    frame #1: 0x0000000190a0f094 libsystem_pthread.dylib`_pthread_cond_wait$VARIANT$armv81 + 672
    frame #2: 0x000000010431318c reloadcontext.iOS`mono_os_cond_wait(cond=0x0000000104b9ba78, mutex=0x0000000104b9ba30) at mono-os-mutex.h:219:8
    frame #3: 0x0000000104312a68 reloadcontext.iOS`mono_coop_cond_wait(cond=0x0000000104b9ba78, mutex=0x0000000104b9ba30) at mono-coop-mutex.h:91:2
    frame #4: 0x0000000104312858 reloadcontext.iOS`suspend_current at debugger-agent.c:3021:4
    frame #5: 0x000000010431be18 reloadcontext.iOS`process_event(event=EVENT_KIND_BREAKPOINT, arg=0x0000000145d09ae8, il_offset=0, ctx=0x0000000149015c20, events=0x0000000000000000, suspend_policy=2) at debugger-agent.c:4058:3
    frame #6: 0x0000000104310cf4 reloadcontext.iOS`process_breakpoint_events(_evts=0x000000028351a680, method=0x0000000145d09ae8, ctx=0x0000000149015c20, il_offset=0) at debugger-agent.c:4722:3
    frame #7: 0x000000010432f1c8 reloadcontext.iOS`mono_de_process_breakpoint(void_tls=0x0000000149014e00, from_signal=0) at debugger-engine.c:1141:2
    frame #8: 0x000000010430f238 reloadcontext.iOS`debugger_agent_breakpoint_from_context(ctx=0x000000016f656790) at debugger-agent.c:4938:2
    frame #9: 0x00000001011b73a4 reloadcontext.iOS`sdb_breakpoint_trampoline + 148
    frame #10: 0x00000001008511b4 reloadcontext.iOS`reloadcontext_iOS_Application_Main_string__(args=0x000000010703a030) at Main.cs:14
    frame #11: 0x00000001010f9730 reloadcontext.iOS`wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr + 272
    frame #12: 0x00000001042fd8b8 reloadcontext.iOS`mono_jit_runtime_invoke(method=0x0000000145d09ae8, obj=0x0000000000000000, params=0x000000016f656f20, exc=0x0000000000000000, error=0x000000016f656ff8) at mini-runtime.c:3162:3
    frame #13: 0x0000000104411950 reloadcontext.iOS`do_runtime_invoke(method=0x0000000145d09ae8, obj=0x0000000000000000, params=0x000000016f656f20, exc=0x0000000000000000, error=0x000000016f656ff8) at object.c:3052:11
    frame #14: 0x000000010440c4dc reloadcontext.iOS`mono_runtime_invoke_checked(method=0x0000000145d09ae8, obj=0x0000000000000000, params=0x000000016f656f20, error=0x000000016f656ff8) at object.c:3220:9
    frame #15: 0x0000000104415ae0 reloadcontext.iOS`do_exec_main_checked(method=0x0000000145d09ae8, args=0x000000010703a030, error=0x000000016f656ff8) at object.c:5184:3
    frame #16: 0x00000001044144ac reloadcontext.iOS`mono_runtime_exec_main_checked(method=0x0000000145d09ae8, args=0x000000010703a030, error=0x000000016f656ff8) at object.c:5281:9
    frame #17: 0x0000000104414500 reloadcontext.iOS`mono_runtime_run_main_checked(method=0x0000000145d09ae8, argc=1, argv=0x000000016f6570d0, error=0x000000016f656ff8) at object.c:4734:9
    frame #18: 0x00000001042d3b54 reloadcontext.iOS`mono_jit_exec_internal(domain=0x0000000145f00130, assembly=0x0000000281ba2900, argc=1, argv=0x000000016f6570d0) at driver.c:1320:13
    frame #19: 0x00000001042d39a4 reloadcontext.iOS`mono_jit_exec(domain=0x0000000145f00130, assembly=0x0000000281ba2900, argc=1, argv=0x000000016f6570d0) at driver.c:1265:7
    frame #20: 0x0000000104597994 reloadcontext.iOS`::xamarin_main(argc=5, argv=0x000000016f657a80, launch_mode=XamarinLaunchModeApp) at monotouch-main.m:483:8
    frame #21: 0x00000001008510dc reloadcontext.iOS`main(argc=5, argv=0x000000016f657a80) at main.m:104:11
    frame #22: 0x0000000190af8360 libdyld.dylib`start + 4
[...]
* thread #5, name = 'Debugger agent', stop reason = signal SIGABRT
  * frame #0: 0x0000000190aedec4 libsystem_kernel.dylib`__pthread_kill + 8
    frame #1: 0x0000000190a0d724 libsystem_pthread.dylib`pthread_kill$VARIANT$armv81 + 216
    frame #2: 0x000000019095d844 libsystem_c.dylib`abort + 100
    frame #3: 0x00000001045871b4 reloadcontext.iOS`log_callback(log_domain=0x0000000000000000, log_level="error", message="* Assertion at ../../../../../mono/mini/interp/interp.c:7176, condition `context' not met\n", fatal=4, user_data=0x0000000000000000) at runtime.m:1213:3
    frame #4: 0x0000000104544fc8 reloadcontext.iOS`eglib_log_adapter(log_domain=0x0000000000000000, log_level=G_LOG_LEVEL_ERROR, message="* Assertion at ../../../../../mono/mini/interp/interp.c:7176, condition `context' not met\n", user_data=0x0000000000000000) at mono-logger.c:405:2
    frame #5: 0x000000010456093c reloadcontext.iOS`monoeg_g_logstr(log_domain=0x0000000000000000, log_level=G_LOG_LEVEL_ERROR, msg="* Assertion at ../../../../../mono/mini/interp/interp.c:7176, condition `context' not met\n") at goutput.c:134:2
    frame #6: 0x0000000104560598 reloadcontext.iOS`monoeg_g_logv_nofree(log_domain=0x0000000000000000, log_level=G_LOG_LEVEL_ERROR, format="* Assertion at %s:%d, condition `%s' not met\n", args="e\x12z\x04\x01") at goutput.c:149:2
    frame #7: 0x000000010456061c reloadcontext.iOS`monoeg_assertion_message(format="* Assertion at %s:%d, condition `%s' not met\n") at goutput.c:184:22
    frame #8: 0x0000000104560674 reloadcontext.iOS`mono_assertion_message(file="../../../../../mono/mini/interp/interp.c", line=7176, condition="context") at goutput.c:203:2
    frame #9: 0x000000010459b570 reloadcontext.iOS`interp_get_resume_state(jit_tls=0x000000014900d000, has_resume_state=0x000000016fc7a9f4, interp_frame=0x000000016fc7a9e8, handler_ip=0x000000016fc7a9e0) at interp.c:7176:2
    frame #10: 0x0000000104319420 reloadcontext.iOS`compute_frame_info(thread=0x0000000104fe4130, tls=0x0000000149014e00, force_update=1) at debugger-agent.c:3422:3
    frame #11: 0x0000000104320d40 reloadcontext.iOS`thread_commands(command=1, p="", end="", buf=0x000000016fc7acf8) at debugger-agent.c:9048:3
    frame #12: 0x000000010431cca0 reloadcontext.iOS`debugger_thread(arg=0x0000000000000000) at debugger-agent.c:10132:10
    frame #13: 0x000000010447eb04 reloadcontext.iOS`start_wrapper_internal(start_info=0x0000000000000000, stack_ptr=0x000000016fc7b000) at threads.c:1232:3
    frame #14: 0x000000010447e788 reloadcontext.iOS`start_wrapper(data=0x000000028203ef40) at threads.c:1305:8
    frame #15: 0x0000000190a11d8c libsystem_pthread.dylib`_pthread_start + 15
[...]
```

Thanks to @drasticactions for helping me to reproduce.

Fixes https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1050615

Co-authored-by: Bernhard Urban-Forster <[email protected]>
2020-01-23 13:50:12 +01:00
2edccc52a7 [2019-12] [jit] Compute the instance size/alignment correctly for gshared types whose constraint is a generic valuetype. (#18529)
* [jit] Compute the instance size/alignment correctly for gshared types whose constraint is a generic valuetype.

Fixes https://github.com/mono/mono/issues/18455.

* [jit] Simplify code

Fix some line damage

Co-authored-by: Zoltan Varga <[email protected]>
Co-authored-by: Vlad Brezae <[email protected]>
2020-01-21 15:05:07 -08:00
monojenkinsandAlexander Köplinger 2b0e9bfe7a Bump xsp to fix issues with removed Mono.Security APIs (#18487)
See https://github.com/mono/xsp/pull/88

Co-authored-by: Alexander Köplinger <[email protected]>
2020-01-16 21:51:57 +01:00
monojenkinsandJo Shields d56ea8a520 [2019-12] Don't run make install in boehm submodule (#18476)
* Don't run `make install` in boehm submodule

* Simplify logic

Co-authored-by: Jo Shields <[email protected]>
2020-01-16 10:35:01 -05:00
monojenkins 4e15267c70 [wasm] Improve virtualenv installation script (#18470)
[2019-12] [wasm] Improve virtualenv installation script



Backport of #18190.

/cc @lewurm @marek-safar
2020-01-16 12:36:02 +01:00
monojenkinsandBernhard Urban-Forster fe455fcb34 [2019-12] [arm] account for signed bit when calculating offset to PLT entry (#18460)
* [arm] account for signed bit when calculating offset to PLT entry

* mask only will do the job

Co-authored-by: Bernhard Urban-Forster <[email protected]>
2020-01-16 10:47:32 +01:00
monojenkinsandAleksey Kliger 64bfc6c000 [2019-12] [loader] ReflectionOnlyLoad(byte[]) should not apply binding redirects (#18458)
* [loader] ReflectionOnlyLoad(byte[]) should not apply binding redirects

Match .NET Framework behavior.

Addresses https://github.com/mono/mono/issues/18388

* [tests] ReflectionOnlyLoad(byte[]) should not apply binding redirects

Regression test for https://github.com/mono/mono/issues/18388

Co-authored-by: Aleksey Kliger (λgeek) <[email protected]>
2020-01-15 10:47:39 +01:00
monojenkinsandVlad Brezae 0fd24828b1 [2019-12] [sgen] Fixes for max-heap-size option (#18456)
* [sgen] Don't subtract twice the nursery size from max_heap_size

We were subtracting the nursery size when initializing max_heap_size as well as adding it to the allocated_heap when allocating the nursery (alloc_nursery).

* [sgen] Trigger collection if failing to allocate los section

If the memory governor says we are exceeding the max_heap_size by allocating a los section (1MB) for a new los object, attempt to clear some space by triggering a major collection, before completely bailing out.

Co-authored-by: Vlad Brezae <[email protected]>
2020-01-15 10:45:09 +01:00
Ankit Jain 03e8e8e56f [2019-12] Bump msbuild to track mono-2019-10 (#18433) 2020-01-12 10:55:59 +01:00
Ankit Jain db8ee7ad92 [2019-12] Bump msbuild to track mono-2019-10 (#18413) 2020-01-10 12:43:06 +01:00
monojenkins a83bdec08e [memory barrier] use pagesize determined by helper (#18396)
[2019-12] [memory barrier] use pagesize determined by helper

`limits.h` doesn't always define `PAGESIZE` properly (e.g. iOS), so it would fall back to `0x1000` (4096) but it's really `0x4000` (16384) on iOS. We already have a helper in the runtime to determine the pagesize, so let's use that instead.


Fixes https://github.com/mono/mono/issues/18273

Backport of #18383.

/cc @lewurm
2020-01-10 01:55:45 +01:00
Martin BauligandAlexander Köplinger f323b29968 Bump corefx to latest 2019-12. (#18405)
Co-authored-by: Alexander Köplinger <[email protected]>
2020-01-09 23:48:02 +01:00
Alexis Christoforides 360e64d261 [FileSystemWatcher] Fix wrong behaviour when move multiple files out of watched folder on mac (#41963) (#18225)
Backport of https://github.com/dotnet/corefx/pull/41963

Fixes https://github.com/mono/mono/issues/16778
2020-01-09 16:24:33 -05:00
Ankit Jain a1351981f6 [2019-12] Bump msbuild to track mono-2019-10 (#18392) 2020-01-09 22:18:30 +01:00
monojenkinsandRyan Lucia 2cc08cae73 [reflection] Fix check for Type.FullName to match CoreCLR (#18390)
Updated test to follow in dotnet/runtime

Co-authored-by: Ryan Lucia <[email protected]>
2020-01-09 11:12:27 -05:00
Ankit Jain 0a51d89c42 [2019-12] Bump msbuild to track mono-2019-10 (#18375) 2020-01-08 15:00:40 +01:00
monojenkins f7df632ff0 [2019-12] [jit] Avoid passing a vtable argument to DIM methods when making calls out of gsharedvt methods. (#18365)
* [jit] Avoid passing a vtable argument to DIM methods when making calls out of gsharedvt methods.

Fixes https://github.com/mono/mono/issues/18276.
2020-01-07 17:28:27 -05:00
Ankit Jain 694c3ef470 [2019-12] Bump msbuild to track mono-2019-10 (#18304) 2020-01-07 18:10:27 +01:00
monojenkins 00cb738f63 [2019-12] Add SignedCms to the TypeForwards in the System.Security.Cryptography.Pkcs facade (#18362)
* Add SignedCms to the typeforwards in the System.Security.Cryptography.Pkcs facade

* Added additional missing types from System.Security.Cryptography.Pkcs.

* It would be nice if the files I added had namespaces ;-)

* [csproj] Update project files

* Bump API snapshot submodule
2020-01-07 18:05:54 +01:00
monojenkins 1ff24a77be [2019-12] [metadata] Size 0 Blob heap is ok when resolving assembly refs (#18337)
* [metadata] Size 0 Blob heap is ok when resolving assembly refs

Sometimes ILasm can produce images with a Blob heap of size 0.  In cases where
we're loading assembly references from such an image, the hash (which is
optional) can be at index = 0 and the Blob heap size is also 0.

Also: add the hash value to the output of `monodis --assemblyref`

* [metadata] Add a separate assertion for the index == size == 0 case

And a comment explaining how it is likely to be triggered.  If the assembly is
reasonable the caller of mono_metadata_blob_heap should be updated to use
mono_metadata_blob_heap_null_ok instead

* [bcl] Allow Mono's ILASM to produce a size 0 Blob heap

ECMA 335 II.24.2.4 says that the user string and blob heaps should have an
entry at index 0 consisting of the single byte 0.  However .NET Framework (and
.NET Core) ilasm will entirely omit the Blob heap (that is, create a blob heap
entry of size 0) if it is not needed.  This PR changes Mono's ILASM to emit the
initial byte on demand only if one of the MetaDataStream.Add() methods is
called. Otherwise we will also emit a stream of size 0.

This is needed to compile some test cases.

* [tests] Add regression test for loading assemblies with size 0 Blob heap

Depends on ILASM that can emit a size 0 Blob heap
2020-01-06 16:02:33 -05:00
monojenkins 5f80ec8d77 [2019-12] Set inited flag _after_ TermInfoDriver initialisation completes (#18329)
[2019-12] Set inited flag _after_ TermInfoDriver initialisation completes

This flag was causing issues when accessing console properties on concurrent threads during TermInfoDriver initialisation.

Fixes #18317

Backport of #18318.

/cc @steveisok @nagytech
2020-01-03 20:36:17 +01:00
Steve Pfister 1ae385b59e [2019-12] Pull in DirectoryInfo Invalidate After Create Fix (#18327)
* Bump to mono/corefx@b7e7440

Backport of https://github.com/mono/mono/pull/18310

* Forgot the test tweak
2020-01-03 12:27:42 -05:00
monojenkinsandThays Grazia b61db514ab The behaviour expected of filter exceptions is: -> throw in a async task with a try catch in the caller -> don't stop -> throw in a new thread with a try catch in the caller -> stop -> throw in the main thread without any try catch -> stop (#18333)
Including a new test to test the fix of #17601.

Fixing #16588, create a while 1 to stops the program execution when an exception is thrown and no try catch is found and MONO_DEBUG=suspend-on-unhandled.

Fixes #17601
Fixes #16588

Co-authored-by: Thays Grazia <[email protected]>
2020-01-03 10:21:35 -03:00
monojenkins 68a4b43536 Use byte-aligned LLVM loads and stores for unaligned mini IR loads and stores. (#18301)
[2019-12] Use byte-aligned LLVM loads and stores for unaligned mini IR loads and stores.

Should fix https://github.com/mono/mono/issues/18221.

Backport of #18296.

/cc @lambdageek @imhameed
2020-01-02 22:16:13 +01:00
monojenkinsandMartin Baulig a36cb75039 Socket.BeginMConnect() should not attempt connections on unsupported address families. (#18322)
Fixes #16513.

Co-authored-by: Martin Baulig <[email protected]>
2020-01-01 17:31:23 -05:00
monojenkinsandAleksey Kliger c721d4ce2a [eglib] Don't define _FORTIFY_SOURCE on Cygwin builds (#18311)
See https://github.com/msys2/MINGW-packages/issues/5803

Without -lssp (or -fstack-protector), -D_FORTIFY_SOURCE=2 leads to linker
errors.

Co-authored-by: Aleksey Kliger (λgeek) <[email protected]>
2019-12-30 09:54:18 -05:00
Ankit Jain 2c3a70016b [2019-12] Bump msbuild to track mono-2019-10 (#18258)
* Bump msbuild to track mono-2019-10

- and update nuget.exe to 5.5.0-preview1 to match

* [2019-12] Bump msbuild to track mono-2019-10
2019-12-24 18:36:25 -05:00
monojenkins cafdade424 [domain] Don't add NULL runtime to runtimes list (#18266)
Also when iterating over the runtimes, actually look at the current element,
not the first element.

Also mention the unsupported runtime version in the warning message when it is
passed to mono_init_internal.

Fixes https://github.com/mono/mono/issues/17916
2019-12-23 08:42:29 -05:00
Alexander Köplinger 43cfe8ecfe Bump corefx to get test fix 2019-12-20 00:37:02 +01:00
Alexander Köplinger bcee9454e9 [System] Add additional hardening against race in MonoTlsStream (#18250)
See https://github.com/mono/mono/issues/15805#issuecomment-567131297

(cherry picked from commit c8e19bec68)
2019-12-19 11:57:43 +01:00
Alexander Köplinger e283c45cc0 [bcl] Split corlib and System.Core xunit test assemblies for monotouch profiles (#18228)
They cannot deal with large test assemblies so we need to split them.

We're doing this by introducing a new `#skip <PROFILE>` directive in the .sources format which defines where to split the assembly.
The logic is very simple: files up until the first `#skip` are common files which get included in each part, subsequent files are only in the respective part assembly.

Fixes https://github.com/mono/mono/issues/18213

(cherry picked from commit 3891fe97d2)
(cherry picked from commit a74416d950)
2019-12-18 22:23:03 +01:00
Ankit Jain 828af02bdf Bump msbuild to track mono-2019-10 (#18193)
.. to get changes from https://github.com/mono/msbuild/pull/184 .
2019-12-18 16:48:30 +01:00
monojenkins ff68a657fa [metadata] Check for GTDs in setup_generic_array_ifaces (#18216)
Judging by https://github.com/mono/mono/blob/4cefdcb7ce2d939ee78fb45d1b4913eb3bc064fd/mono/metadata/metadata.c#L3515 the cached_class is sometimes intentionally a GTD, which can get passed all the way down to setup_generic_array_ifaces and cause a crash.
2019-12-17 14:14:03 -05:00
monojenkins eb6a6bae1e [2019-12] [cominterop] Attach to runtime from IUnknown and IDispatch methods (#18185)
* [cominterop][test] Calling QueryInterface from an unattached thread asserts

If we pass a managed COM object to native code and the native code calls one of
the IUnknown methods, we assert because the thread is not attached but we want
to enter GC Unsafe mode.

* [cominterop] Attach to runtime from IUnkown and IDispatch methods

If the COM objects for a managed object is passed to a thread that hasn't
interacted with Mono before, we need to attach before doing GC thread state
transitions.

Addresses https://github.com/mono/mono/issues/18137

* [test] Call managed method through COM wrapper from unattached thread

This works, but I don't think we had a test previously.  Call a managed method
via a COM interface from a thread that is not attached to the runtime, to
ensure that it is attached.
2019-12-16 11:08:09 -05:00
monojenkins e8046e3848 [2019-12] Relax faultcode parsing for Soap11 message errors. (#18187)
* Relax faultcode parsing for Soap11 message errors.

The mono implementation was reading the faultcode content as an XmlQualifiedName, which applied the rule where you could not
start a name with a number. This caused interoperability problems with the .net framework because their parsing just looks
for <namespace>:<name>, where name can be any string.

Example:

<faultcode>s:1</faultcode>

On mono, a soap response that contains a fault code name of 1 will throw an error.  If you run the same code on the .net framework, it will not.

Fixes https://github.com/mono/mono/issues/12995

* [csproj] Update project files
2019-12-14 00:32:18 +01:00
Alexander Köplinger ade2f9239a [sdks] Use Xcode 11.3 stable version for iOS/Mac SDKs
As requested by the xamarin-macios team.

(cherry picked from commit 7e65a73d4d)
2019-12-13 18:15:41 +01:00
Ankit Jain ac8a9a9eab [2019-12] Bump msbuild to track mono-2019-10 (#18131)
* Bump msbuild to track mono-2019-10

- msbuild doesn't have a separate branch for mono-2019-12 right now

* [2019-12] Bump msbuild to track mono-2019-10

* [2019-12] Bump msbuild to track mono-2019-10
2019-12-12 20:57:10 -05:00
monojenkins 12c92be908 [corlib] Rename internal LogLevel enum to avoid conflict with Android LogLevel (#18125)
After https://github.com/mono/mono/pull/18040 we now have InternalsVisibleTo for the Mono.Android assembly.
This exposed the internal LogLevel enum in BCLDebug which causes an issue when consumed in XA:

```
Java.Lang/Object.cs(119,18): error CS0104: 'LogLevel' is an ambiguous reference between 'Android.Runtime.LogLevel' and 'System.LogLevel'
```

To fix this we rename the internal enum in corlib since it's not really used.
2019-12-11 11:34:23 +02:00
monojenkins b951ebb775 [debugger] skip suspend for unattached threads (#18110)
[2019-12] [debugger] skip suspend for unattached threads

When the debugger tries to suspend all the VM threads, it can happen with cooperative-suspend that it tries to suspend a thread that has previously been attached, but then did a "light" detach (that only unsets the domain). With the domain set to `NULL`, looking up a JitInfo for a given `ip` will result into a crash, but it isn't even necessarily needed for the purpose of suspending a thread.

More details: Consider the following:
```
(lldb) c
error: Process is running.  Use 'process interrupt' to pause execution.
Process 12832 stopped
* thread #9, name = 'tid_a31f', queue = 'NSOperationQueue 0x8069b670 (QOS: UTILITY)', stop reason = breakpoint 1.1
    frame #0: 0x00222870 WatchWCSessionAppWatchOSExtension`debugger_interrupt_critical(info=0x81365400, user_data=0xb04dc718) at debugger-agent.c:2716:6
   2713         MonoDomain *domain = (MonoDomain *) mono_thread_info_get_suspend_state (info)->unwind_data [MONO_UNWIND_DATA_DOMAIN];
   2714         if (!domain) {
   2715                 /* not attached */
-> 2716                 ji = NULL;
   2717         } else {
   2718                 ji = mono_jit_info_table_find_internal ( domain, MONO_CONTEXT_GET_IP (&mono_thread_info_get_suspend_state (info)->ctx), TRUE, TRUE);
   2719         }
Target 0: (WatchWCSessionAppWatchOSExtension) stopped.
(lldb) bt
* thread #9, name = 'tid_a31f', queue = 'NSOperationQueue 0x8069b670 (QOS: UTILITY)', stop reason = breakpoint 1.1
  * frame #0: 0x00222870 WatchWCSessionAppWatchOSExtension`debugger_interrupt_critical(info=0x81365400, user_data=0xb04dc718) at debugger-agent.c:2716:6
    frame #1: 0x004e177b WatchWCSessionAppWatchOSExtension`mono_thread_info_safe_suspend_and_run(id=0xb0767000, interrupt_kernel=0, callback=(WatchWCSessionAppWatchOSExtension`debugger_interrupt_critical at debugger-agent.c:2708), user_data=0xb04dc718) at mono-threads.c:1358:19
    frame #2: 0x00222799 WatchWCSessionAppWatchOSExtension`notify_thread(key=0x03994508, value=0x81378c00, user_data=0x00000000) at debugger-agent.c:2747:2
    frame #3: 0x00355bd8 WatchWCSessionAppWatchOSExtension`mono_g_hash_table_foreach(hash=0x8007b4e0, func=(WatchWCSessionAppWatchOSExtension`notify_thread at debugger-agent.c:2733), user_data=0x00000000) at mono-hash.c:310:4
    frame #4: 0x0021e955 WatchWCSessionAppWatchOSExtension`suspend_vm at debugger-agent.c:2844:3
    frame #5: 0x00225ff0 WatchWCSessionAppWatchOSExtension`process_event(event=EVENT_KIND_THREAD_START, arg=0x039945d0, il_offset=0, ctx=0x00000000, events=0x805b28e0, suspend_policy=2) at debugger-agent.c:4012:3
    frame #6: 0x00227c7c WatchWCSessionAppWatchOSExtension`process_profiler_event(event=EVENT_KIND_THREAD_START, arg=0x039945d0) at debugger-agent.c:4072:2
    frame #7: 0x0021b174 WatchWCSessionAppWatchOSExtension`thread_startup(prof=0x00000000, tid=2957889536) at debugger-agent.c:4149:2
    frame #8: 0x0037912d WatchWCSessionAppWatchOSExtension`mono_profiler_raise_thread_started(tid=2957889536) at profiler-events.h:103:1
    frame #9: 0x003d53da WatchWCSessionAppWatchOSExtension`fire_attach_profiler_events(tid=0xb04dd000) at threads.c:1120:2
    frame #10: 0x003d4d83 WatchWCSessionAppWatchOSExtension`mono_thread_attach(domain=0x801750a0) at threads.c:1547:2
    frame #11: 0x003df1a1 WatchWCSessionAppWatchOSExtension`mono_threads_attach_coop_internal(domain=0x801750a0, cookie=0xb04dcc0c, stackdata=0xb04dcba8) at threads.c:6008:3
    frame #12: 0x003df287 WatchWCSessionAppWatchOSExtension`mono_threads_attach_coop(domain=0x00000000, dummy=0xb04dcc0c) at threads.c:6045:9
    frame #13: 0x005034b8 WatchWCSessionAppWatchOSExtension`::xamarin_switch_gchandle(self=0x80762c20, to_weak=false) at runtime.m:1805:2
    frame #14: 0x005065c1 WatchWCSessionAppWatchOSExtension`::xamarin_retain_trampoline(self=0x80762c20, sel="retain") at trampolines.m:693:2
    frame #15: 0x657ea520 libobjc.A.dylib`objc_retain + 64
    frame #16: 0x4b4d9caa WatchConnectivity`__66-[WCSession onqueue_handleDictionaryMessageRequest:withPairingID:]_block_invoke + 279
    frame #17: 0x453c7df7 Foundation`__NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ + 12
    frame #18: 0x453c7cf4 Foundation`-[NSBlockOperation main] + 88
    frame #19: 0x453cacee Foundation`__NSOPERATION_IS_INVOKING_MAIN__ + 27
    frame #20: 0x453c6ebd Foundation`-[NSOperation start] + 835
    frame #21: 0x453cb606 Foundation`__NSOPERATIONQUEUE_IS_STARTING_AN_OPERATION__ + 27
    frame #22: 0x453cb12e Foundation`__NSOQSchedule_f + 194
    frame #23: 0x453cb26e Foundation`____addOperations_block_invoke_4 + 20
    frame #24: 0x65de007b libdispatch.dylib`_dispatch_call_block_and_release + 15
    frame #25: 0x65de126f libdispatch.dylib`_dispatch_client_callout + 14
    frame #26: 0x65de3788 libdispatch.dylib`_dispatch_continuation_pop + 421
    frame #27: 0x65de2ee3 libdispatch.dylib`_dispatch_async_redirect_invoke + 818
    frame #28: 0x65df087d libdispatch.dylib`_dispatch_root_queue_drain + 354
    frame #29: 0x65df0ff3 libdispatch.dylib`_dispatch_worker_thread2 + 109
    frame #30: 0x66024fa0 libsystem_pthread.dylib`_pthread_wqthread + 208
    frame #31: 0x66024e44 libsystem_pthread.dylib`start_wqthread + 36
```

Going further, `info` is about this thread:
```
(lldb) p/x *(int *)(((char *) info->node.key) + 0xa0)
(int) $2 = 0x01243f93
(lldb) thread list
Process 12832 stopped
  thread #1: tid = 0x1243ee1, 0x65f7e396 libsystem_kernel.dylib`mach_msg_trap + 10, name = 'tid_303', queue = 'com.apple.main-thread'
  thread #2: tid = 0x1243ee6, 0x65f816e2 libsystem_kernel.dylib`__recvfrom + 10
  thread #3: tid = 0x1243ee7, 0x65f81aea libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'SGen worker'
  thread #4: tid = 0x1243ee9, 0x65f7e3d2 libsystem_kernel.dylib`semaphore_wait_trap + 10, name = 'Finalizer'
  thread #5: tid = 0x1243eea, 0x65f816e2 libsystem_kernel.dylib`__recvfrom + 10, name = 'Debugger agent'
  thread #6: tid = 0x1243f1d, 0x65f7e396 libsystem_kernel.dylib`mach_msg_trap + 10, name = 'com.apple.uikit.eventfetch-thread'
  thread #8: tid = 0x1243f93, 0x65f7e396 libsystem_kernel.dylib`mach_msg_trap + 10, name = 'tid_6d0f', queue = 'NSOperationQueue 0x8069b300 (QOS: UTILITY)'
* thread #9: tid = 0x12443a9, 0x00222870 WatchWCSessionAppWatchOSExtension`debugger_interrupt_critical(info=0x81365400, user_data=0xb04dc718) at debugger-agent.c:2716:6, name = 'tid_a31f', queue = 'NSOperationQueue 0x8069b670 (QOS: UTILITY)', stop reason = breakpoint 1.1
  thread #10: tid = 0x1244581, 0x65f7fd32 libsystem_kernel.dylib`__workq_kernreturn + 10
(lldb) thread select 8
* thread #8, name = 'tid_6d0f', queue = 'NSOperationQueue 0x8069b300 (QOS: UTILITY)'
    frame #0: 0x65f7e396 libsystem_kernel.dylib`mach_msg_trap + 10
libsystem_kernel.dylib`mach_msg_trap:
->  0x65f7e396 <+10>: retl
    0x65f7e397 <+11>: nop

libsystem_kernel.dylib`mach_msg_overwrite_trap:
    0x65f7e398 <+0>:  movl   $0xffffffe0, %eax         ; imm = 0xFFFFFFE0
    0x65f7e39d <+5>:  calll  0x65f85f44                ; _sysenter_trap
(lldb) bt
* thread #8, name = 'tid_6d0f', queue = 'NSOperationQueue 0x8069b300 (QOS: UTILITY)'
  * frame #0: 0x65f7e396 libsystem_kernel.dylib`mach_msg_trap + 10
    frame #1: 0x65f7e8ff libsystem_kernel.dylib`mach_msg + 47
    frame #2: 0x66079679 libxpc.dylib`_xpc_send_serializer + 104
    frame #3: 0x660794da libxpc.dylib`_xpc_pipe_simpleroutine + 80
    frame #4: 0x66079852 libxpc.dylib`xpc_pipe_simpleroutine + 43
    frame #5: 0x66043a8f libsystem_trace.dylib`___os_activity_stream_reflect_block_invoke_2 + 30
    frame #6: 0x65de126f libdispatch.dylib`_dispatch_client_callout + 14
    frame #7: 0x65de3d71 libdispatch.dylib`_dispatch_block_invoke_direct + 257
    frame #8: 0x65de3c62 libdispatch.dylib`dispatch_block_perform + 112
    frame #9: 0x6604349a libsystem_trace.dylib`_os_activity_stream_reflect + 725
    frame #10: 0x6604ef19 libsystem_trace.dylib`_os_log_impl_stream + 468
    frame #11: 0x6604e44d libsystem_trace.dylib`_os_log_impl_flatten_and_send + 6410
    frame #12: 0x6604cb3b libsystem_trace.dylib`_os_log + 137
    frame #13: 0x6604f4aa libsystem_trace.dylib`_os_log_impl + 31
    frame #14: 0x4b4eb4e9 WatchConnectivity`WCSerializePayloadDictionary + 393
    frame #15: 0x4b4d7c4d WatchConnectivity`-[WCSession onqueue_sendResponseDictionary:identifier:] + 195
    frame #16: 0x4b4da435 WatchConnectivity`__66-[WCSession onqueue_handleDictionaryMessageRequest:withPairingID:]_block_invoke.411 + 35
    frame #17: 0x453c7df7 Foundation`__NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ + 12
    frame #18: 0x453c7cf4 Foundation`-[NSBlockOperation main] + 88
    frame #19: 0x453cacee Foundation`__NSOPERATION_IS_INVOKING_MAIN__ + 27
    frame #20: 0x453c6ebd Foundation`-[NSOperation start] + 835
    frame #21: 0x453cb606 Foundation`__NSOPERATIONQUEUE_IS_STARTING_AN_OPERATION__ + 27
    frame #22: 0x453cb12e Foundation`__NSOQSchedule_f + 194
    frame #23: 0x453cb067 Foundation`____addOperations_block_invoke_2 + 20
    frame #24: 0x65dedf49 libdispatch.dylib`_dispatch_block_async_invoke2 + 77
    frame #25: 0x65de4461 libdispatch.dylib`_dispatch_block_async_invoke_and_release + 17
    frame #26: 0x65de126f libdispatch.dylib`_dispatch_client_callout + 14
    frame #27: 0x65de3788 libdispatch.dylib`_dispatch_continuation_pop + 421
    frame #28: 0x65de2ee3 libdispatch.dylib`_dispatch_async_redirect_invoke + 818
    frame #29: 0x65df087d libdispatch.dylib`_dispatch_root_queue_drain + 354
    frame #30: 0x65df0ff3 libdispatch.dylib`_dispatch_worker_thread2 + 109
    frame #31: 0x66024fa0 libsystem_pthread.dylib`_pthread_wqthread + 208
    frame #32: 0x66024e44 libsystem_pthread.dylib`start_wqthread + 36
```
which is a thread in a "light" detach state (aka. coop detach), where we only unset the domain:
https://github.com/mono/mono/blob/4cefdcb7ce2d939ee78fb45d1b4913eb3bc064fd/mono/metadata/threads.c#L6084-L6111

Fixes https://github.com/mono/mono/issues/17926



<!--
Thank you for your Pull Request!

If you are new to contributing to Mono, please try to do your best at conforming to our coding guidelines http://www.mono-project.com/community/contributing/coding-guidelines/ but don't worry if you get something wrong. One of the project members will help you to get things landed.

Does your pull request fix any of the existing issues? Please use the following format: Fixes #issue-number
-->


Backport of #18105.

/cc @lewurm
2019-12-10 18:15:09 +01:00
monojenkins 47262ff08a [2019-12] [mini] Fix delegate trampoline virtual call via delgate Invoke (#18109)
* [mini] Fix delegate trampoline virtual call via delgate Invoke

If we need to jit the Invoke method of a delegate, we get tramp_info with a
NULL method.

Background: normally when we create a delegate around a virtual method,
handle_delegate_ctor will just create a virtual invoke trampoline with
mono_arch_get_delegate_virtual_invoke_impl which doesn't get here.  But if
we're asked to compile the delegate's Invoke method, then compile_special ()
will create a tramp_info with a null method, and return a delegate trampoline.

That's the case here - we had
  var del = SomeDelegate(obj.VirtualMethod);
  var invoke_method = del.GetType().GetMethod ("Invoke");
  invoke_method.Invoke (del, args);
or
  var del = SomeDelegate(obj.VirtualMethod);
  var another_del = OtherDelegate (del.Invoke);
  another_del (args);

in both cases, we end up in mono_delegate_trampoline with tramp_info->method ==
NULL.

in the second case the IL is like this:
   newobj instance void Derived::'.ctor'
   ldvirtftn instance void class Base::VirtualMethod()
   newobj instance void class SomeDelegate::'.ctor'(object, native int)

So delegate->target is a derived instance but delegate->method is some base
class method.

Addresses https://github.com/mono/mono/issues/17718

* [tests] Add tests for compiling delegate's Invoke method

Where the delegate calls a virtual method
2019-12-10 17:43:04 +01:00
Ankit Jain 17a925ca25 Bump msbuild+roslyn to track mono-2019-10 (#18092)
* Bump msbuild+roslyn to track mono-2019-10

- bumps roslyn to 3.5.0-beta1-19606-04

* roslyn: Delete reference to the now removed Microsoft.Managed.EditorConfig.targets
2019-12-10 12:39:51 +01:00
monojenkins a2bb316900 Bump to mono/corefx@f3815a9 (#18099)
Picks up https://github.com/mono/corefx/pull/376
2019-12-10 12:35:56 +01:00
monojenkins cbc3a80a27 [2019-12] [threads] Add back mono_threads_attach_tools_thread as a public API (#18074)
* [utils] Add back mono_threads_attach_tools_thread

In https://github.com/mono/mono/commit/a5da7b21f4b6dbc5eaa09c2addee91b84dc1dbd5
we got rid of "tools" threads internally to the runtime.

However since the API was previously marked with MONO_API it was an internal
API that some embedders depended on.

This PR adds back an (external-only) limited form of tools thread.

The runtime is aware of the Tools thread in that FOREACH_THREAD_* macros will
iterate over them, and the thread has a coop thread state machine. (That is,
mono_thread_info_current() and GC Safe and GC Unsafe transitions all work.)

However the thread is:
1. Not stopped by the GC
2. Is not interrupted by profiler sampling.
3. Does not have a "current domain"
4. (As a consequence of the above) cannot call managed methods or touch managed
objects.

Such threads are useful for low-level interaction with the runtime such as
querying metadata, the JIT state and other coordination.

mono_threads_attach_tools_thread should be called no more than once.  It should
not be called on a thread that is already attached with mono_thread_atach, and
vice versa.

Addresses https://github.com/mono/mono/issues/18011

* [threads] Make mono_threads_attach_tools_thread into a public API
2019-12-09 10:06:43 +01:00
monojenkins 2538b65b30 Update glib-remap.h to include g_module_address (#18077) 2019-12-09 10:06:17 +01:00
monojenkins 5d83bf4c65 [2019-12] Added Obsolete to AppDomain.CreateDomain for monodroid. (#18026)
* Added Obsolete to AppDomain.CreateDomain for monodroid. The intent is to be helpful for when .NET 5 comes along

* Changed AssemblyLoadContext link to a better doc

* Bump API snapshot submodule
2019-12-06 18:45:36 +01:00
monojenkins 37c475126d [llvm] Avoid decomposing OP_STOREV_MEMBASE early for types which contains no references. (#18065) 2019-12-06 12:24:16 +01:00
Alexander Köplinger 50d4fc360c Remove DNS lookups of the local hostname in tests (#18059)
This allows us to workaround issues we currently have in the macOS bot network where DNS lookup of the hostname fails.

(cherry picked from commit 269d509e42)
2019-12-05 23:21:13 +01:00
monojenkins 159160da7b [System.Net.Http]Add workaround for mono/mono#17897. (#18010)
Use `(UriKind)300` (which is the same as setting `MONO_URI_DOTNETRELATIVEORABSOLUTE=true`)
when parsing Uri headers.
2019-12-05 14:40:49 +01:00
monojenkins 25b7c45431 [2019-12] [corlib] add InternalsVisibleTo for Mono.Android (#18047)
* [corlib] add InternalsVisibleTo for Mono.Android

Context: https://github.com/xamarin/xamarin-android/pull/3991

In Xamarin.Android, we have a bit of System.Reflection usage on
startup:

https://github.com/xamarin/xamarin-android/blob/bbbe2ed36e6eeb7cce0905dcbfdaeaa30754070f/src/Mono.Android/Android.Runtime/UncaughtExceptionHandler.cs#L47-L67

These methods are in `mscorlib.dll` and `internal`. If we had
`[assembly: InternalsVisibleTo ("Mono.Android")]` we could avoid the
System.Reflection.

This is already done for `Xamarin.iOS`, `Xamarin.Mac`, etc. so
hopefully it's OK to add one more?

We could then, just call these methods directly:

* `System.Diagnostics.Debugger.Mono_UnhandledException`
* `AppDomain.CurrentDomain.DoUnhandledException`

The results are possibly a 100-250ms improvement to startup:

    Before:
    12-03 14:27:51.450  1876  1898 I ActivityManager: Displayed Xamarin.Forms_Performance_Integration/xamarin.forms.performance.integration.MainActivity: +3s727ms
    12-03 14:27:57.310  1876  1898 I ActivityManager: Displayed Xamarin.Forms_Performance_Integration/xamarin.forms.performance.integration.MainActivity: +3s723ms
    12-03 14:28:03.216  1876  1898 I ActivityManager: Displayed Xamarin.Forms_Performance_Integration/xamarin.forms.performance.integration.MainActivity: +3s703ms
    12-03 14:28:09.054  1876  1898 I ActivityManager: Displayed Xamarin.Forms_Performance_Integration/xamarin.forms.performance.integration.MainActivity: +3s679ms
    12-03 14:28:14.953  1876  1898 I ActivityManager: Displayed Xamarin.Forms_Performance_Integration/xamarin.forms.performance.integration.MainActivity: +3s711ms
    After:
    12-04 09:13:18.248  1876  1898 I ActivityManager: Displayed Xamarin.Forms_Performance_Integration/xamarin.forms.performance.integration.MainActivity: +3s608ms
    12-04 09:13:24.087  1876  1898 I ActivityManager: Displayed Xamarin.Forms_Performance_Integration/xamarin.forms.performance.integration.MainActivity: +3s570ms
    12-04 09:13:29.997  1876  1898 I ActivityManager: Displayed Xamarin.Forms_Performance_Integration/xamarin.forms.performance.integration.MainActivity: +3s566ms
    12-04 09:13:35.805  1876  1898 I ActivityManager: Displayed Xamarin.Forms_Performance_Integration/xamarin.forms.performance.integration.MainActivity: +3s498ms
    12-04 09:13:41.670  1876  1898 I ActivityManager: Displayed Xamarin.Forms_Performance_Integration/xamarin.forms.performance.integration.MainActivity: +3s475ms

This was the Xamarin.Forms integration project in xamarin-android.
Running a `Debug` build on a HAXM x86 emulator on Windows.

https://github.com/xamarin/xamarin-android/tree/master/tests/Xamarin.Forms-Performance-Integration

* Bump API snapshot submodule
2019-12-05 00:44:10 +01:00
Alexander Köplinger 3e0d18cb7b Bump bockbuild to get https://github.com/mono/bockbuild/pull/136 2019-12-05 00:35:14 +01:00
Ankit Jain 8228edb9a2 [2019-12] Bump msbuild to track mono-2019-10 (#18046)
.. to get changes from https://github.com/mono/msbuild/pull/163 .

And bump roslyn to 3.4.0-beta4-19569-03 to match msbuild.
2019-12-04 18:10:51 -05:00
Thays Grazia c823f329f1 Fix side effect. 2019-12-04 14:57:40 -06:00
Thays Grazia bb4cd21233 Fix DIM in a generic interface. Fixes #17869 2019-12-04 14:57:40 -06:00
monojenkins 7327c13535 [2019-12] [profiler] disable inlining when coverage profiler is used and fix allocation sizes (#17999)
* [profiler] let compiler decide about the size of an entry

* [profiler] disable inlining when coverage profiler is used
2019-12-03 16:47:09 +01:00
monojenkins 7eb7a82f09 [sgen] Don't trigger collections during allocation of thread objects (#17996)
Allocation of thread objects usese the mono_object_new_mature API. These objects are allocated before the thread is finished attaching to the runtime. This means that a collection can happen on an unattached thread as well as all its callbacks, which is a counter-intuitive behavior.

On android this is problematic because at the end of the SGen collection we need to call the java collection, which needs to have the thread attached. This could probably be fixed instead from the Xamarin.Android side, but this approach seems simpler and saner.

Fixes https://github.com/mono/mono/issues/17878
2019-12-03 10:10:25 +02:00
Jo Shields 94ad23218f Bump version to 6.10 (#17989) 2019-12-02 15:58:36 -05:00
176 changed files with 3246 additions and 769 deletions

No files matched your search

+2 -1
View File
@@ -116,6 +116,8 @@
/mono/sgen @BrzVlad @lambdageek
/mono/tools/offsets-tool @lewurm @rolfbjarne
/mono/utils @vargaz @lewurm @lambdageek
/mono/utils/atomic* @lewurm @vargaz
/mono/utils/mono-hwcap* @lewurm @vargaz
@@ -156,6 +158,5 @@
/tools @lambdageek @vargaz
/tools/locale-builder @marek-safar @egorbo
/tools/nuget-hash-extractor @marek-safar @radical @akoeplinger
/tools/offsets-tool @lewurm @rolfbjarne
/tools/pedump @lambdageek @lewurm
/tools/sgen @brzvlad @vargaz @naricc
-2
View File
@@ -139,8 +139,6 @@ llvm/usr/
sdks/builds/llvm-*/
sdks/builds/android-*/
mcs/build/compiler-server.log
tools/offsets-tool-py/offtool/
tools/offsets-tool-py/clang/__pycache__
##############################################################################
# Arcade output directories
+6
View File
@@ -3,6 +3,7 @@ ACLOCAL_AMFLAGS = -I m4
AM_CFLAGS = $(WERROR_CFLAGS)
SUBDIRS = @MONO_SUBDIRS@
noinst_SUBDIRS = @MONO_NOINST_SUBDIRS@
DIST_SUBDIRS = $(SUBDIRS) m4 netcore netcore/corerun
if !ENABLE_NETCORE
@@ -93,6 +94,11 @@ mcs-do-compiler-tests:
bootstrap-world: compiler-tests
$(MAKE) install
install:
for mydir in $(filter-out $(noinst_SUBDIRS),$(SUBDIRS)); do \
(cd $${mydir} && ${MAKE} install) \
done
update-csproj:
-rm msvc/scripts/order
-rm msvc/scripts/order.xml
+23 -10
View File
@@ -4,7 +4,7 @@
# This line is parsed by tools besides autoconf, such as msvc/mono.winconfig.targets.
# It should remain in the format they expect.
#
AC_INIT(mono, [6.9.0],
AC_INIT(mono, [6.10.0],
[https://github.com/mono/mono/issues/new])
AC_CONFIG_SRCDIR([Makefile.am])
@@ -605,6 +605,7 @@ AC_CHECK_TOOL(CC, gcc, gcc)
AC_PROG_CC
AC_CHECK_TOOL(CXX, g++, g++)
AC_PROG_CXX
AM_PATH_PYTHON([3.2])
AM_PROG_AS
AC_PROG_INSTALL
AC_PROG_AWK
@@ -2926,6 +2927,23 @@ if test x$host_win32 = xno; then
])
fi
dnl ********************************
dnl *** Checks for sys_signame ***
dnl ********************************
AC_MSG_CHECKING(for sys_signame)
AC_TRY_LINK([
#include <signal.h>
], [
const char *signame = sys_signame[0];
], [
# Yes, we have it...
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_SYSSIGNAME, 1, [Have sys_signame])
], [
AC_MSG_RESULT(no)
])
dnl ********************************
dnl *** Checks for semaphore lib ***
dnl ********************************
@@ -2937,13 +2955,6 @@ if test x$host_win32 = xno; then
AC_SEARCH_LIBS(shm_open, pthread rt posix4)
AC_CHECK_FUNCS(shm_open)
dnl ********************************
dnl *** Checks for gettext lib ***
dnl ********************************
# This is needed for some hackery for AIX;
# Mono itself doesn't use it, but DllMap includes it
AC_SEARCH_LIBS([gettext], [intl])
dnl ********************************
dnl *** Checks for timezone stuff **
dnl ********************************
@@ -6052,8 +6063,8 @@ fi
AC_SUBST(mono_runtime)
AC_SUBST(mono_runtime_wrapper)
CSC_LOCATION=`cd $srcdir && pwd`/external/roslyn-binaries/Microsoft.Net.Compilers/3.3.0/csc.exe
VBCS_LOCATION=`cd $srcdir && pwd`/external/roslyn-binaries/Microsoft.Net.Compilers/3.3.0/VBCSCompiler.exe
CSC_LOCATION=`cd $srcdir && pwd`/external/roslyn-binaries/Microsoft.Net.Compilers/3.6.0/csc.exe
VBCS_LOCATION=`cd $srcdir && pwd`/external/roslyn-binaries/Microsoft.Net.Compilers/3.6.0/VBCSCompiler.exe
if test $csc_compiler = mcs; then
CSC=$mcs_topdir/class/lib/build/mcs.exe
@@ -6268,9 +6279,11 @@ else
fi
MONO_SUBDIRS="mk po $mono_subdirs_libgc llvm mono $mono_subdirs_ikvm_native $mono_subdirs_support data runtime scripts man samples $mono_subdirs_tools $mono_subdirs_docs msvc acceptance-tests"
MONO_NOINST_SUBDIRS="$mono_subdirs_libgc"
fi
AC_SUBST(MONO_SUBDIRS)
AC_SUBST(MONO_NOINST_SUBDIRS)
AC_CONFIG_COMMANDS([quiet-libtool], [sed -e 's/echo "copying selected/# "copying selected/g' < libtool > libtool.tmp && mv libtool.tmp libtool && chmod a+x libtool; sed -e 's/$ECHO "copying selected/# "copying selected/g' < libtool > libtool.tmp && mv libtool.tmp libtool && chmod a+x libtool])
AC_CONFIG_COMMANDS([nolock-libtool], [sed -e 's/lock_old_archive_extraction=yes/lock_old_archive_extraction=no/g' < libtool > libtool.tmp && mv libtool.tmp libtool && chmod a+x libtool])
+1 -1
+1 -1
+7 -1
View File
@@ -1496,6 +1496,9 @@ scanning is available.
\fBno-managed-allocator\fR
Disables the managed allocator.
.TP
\fBmanaged-allocator\fR
Enables the managed allocator.
.TP
\fBcheck-scan-starts\fR
If set, does a plausibility check on the scan_starts before and after each collection
.TP
@@ -1521,7 +1524,10 @@ sgen-gc.c. You can then use this command to explore the output
\fBnursery-canaries\fR
If set, objects allocated in the nursery are suffixed with a canary (guard)
word, which is checked on each minor collection. Can be used to detect/debug
heap corruption issues.
heap corruption issues. This disables the usage of the managed allocator,
because allocation from full aot code is inconsistent with this option. If
the application is guaranteed not to use aot code, the managed allocator can
be enabled back with managed-allocator option.
.TP
\fBdo-not-finalize(=\fIclasses\fB)\fR
+71 -40
View File
@@ -89,26 +89,32 @@ endif
test_lib = $(PROFILE)_$(ASSEMBLY:$(ASSEMBLY_EXT)=_test.dll)
test_lib_output = $(test_lib_dir)/$(test_lib)
test_sourcefile_base_excludes = $(test_lib).exclude.sources
test_library = $(ASSEMBLY:$(ASSEMBLY_EXT)=)_test$(ASSEMBLY_EXT)
test_response = $(depsdir)/$(PROFILE_PLATFORM)_$(PROFILE)_$(test_library).response
test_makefrag = $(depsdir)/$(PROFILE_PLATFORM)_$(PROFILE)_$(test_library).makefrag
test_pdb = $(test_lib:.dll=.pdb)
test_flags = $(test_nunit_ref) $(TEST_MCS_FLAGS) $(TEST_LIB_MCS_FLAGS)
ifndef NO_BUILD
test_flags += -r:$(the_assembly)
test_assembly_dep = $(the_assembly)
endif
tests_CLEAN_FILES += $(test_lib_output) $(test_lib_output:$(ASSEMBLY_EXT)=.pdb)
tests_CLEAN_FILES += $(test_lib_output) $(test_response) $(test_makefrag)
xtest_sourcefile_base = $(PROFILE_PLATFORM)_$(PROFILE)_$(ASSEMBLY:$(ASSEMBLY_EXT)=_xtest.dll.sources)
xtest_sourcefile_base_excludes_full = $(PROFILE_PLATFORM)_$(PROFILE)_$(ASSEMBLY:$(ASSEMBLY_EXT)=_xtest.dll.exclude.sources)
xtest_sourcefile_base_excludes = $(xtest_sourcefile_base_excludes_full:_%=%)
xunit_test_lib = $(PROFILE)_$(ASSEMBLY:$(ASSEMBLY_EXT)=_xunit-test.dll)
xtest_lib_output = $(test_lib_dir)/$(xunit_test_lib)
xtest_response = $(depsdir)/$(xunit_test_lib).response
xtest_makefrag = $(depsdir)/$(xunit_test_lib).makefrag
xtest_flags = -r:$(the_assembly) $(xunit_libs_ref) $(XTEST_MCS_FLAGS) $(XTEST_LIB_MCS_FLAGS) /unsafe
xtest_library = $(ASSEMBLY:$(ASSEMBLY_EXT)=)_xtest$(ASSEMBLY_EXT)
xtest_response = $(depsdir)/$(PROFILE_PLATFORM)_$(PROFILE)_$(xtest_library).response
xtest_makefrag = $(depsdir)/$(PROFILE_PLATFORM)_$(PROFILE)_$(xtest_library).makefrag
xtest_flags = $(xunit_libs_ref) $(XTEST_MCS_FLAGS) $(XTEST_LIB_MCS_FLAGS) /unsafe
ifndef NO_BUILD
xtest_flags += -r:$(the_assembly)
xtest_assembly_dep = $(the_assembly)
endif
ifeq ($(wildcard $(xtest_sourcefile_base)),)
xtest_sourcefile_base = $(ASSEMBLY:$(ASSEMBLY_EXT)=_xtest.dll.sources)
@@ -140,6 +146,10 @@ test_assemblies :=
ifdef HAVE_CS_TESTS
test_assemblies += $(test_lib_output)
ifdef TEST_SPLIT_ASSEMBLIES
test_assemblies += $(test_lib_output:.dll=.part1.dll) $(test_lib_output:.dll=.part2.dll) $(test_lib_output:.dll=.part3.dll)
endif
check: run-test
test-local: $(test_assemblies) $(test_lib_dir)/nunit-excludes.txt
run-test-local: run-test-lib
@@ -262,44 +272,42 @@ endif
TEST_FILES =
ifdef HAVE_CS_TESTS
TEST_FILES += `sed -e '/^$$/d' -e 's,^../,,' -e '/^\#.*$$/d' -et -e 's,^,Test/,' $(test_sourcefile_base)`
endif
ifdef HAVE_CS_TESTS
TEST_FILES += `sed -e '/^$$/d' -e 's,^../,,' -e '/^\#.*$$/d' -et -e 's,^,Test/,' $(test_sourcefile_base)`
$(test_lib_dir):
mkdir -p $@
test_library = $(ASSEMBLY:$(ASSEMBLY_EXT)=)_test$(ASSEMBLY_EXT)
test_sourcefile = $(depsdir)/$(PROFILE_PLATFORM)_$(PROFILE)_$(test_library).sources
$(test_sourcefile): $(test_sourcefile_base) $(wildcard *_test.dll.sources) $(wildcard *_test.dll.exclude.sources) $(depsdir)/.stamp
$(GENSOURCES) --basedir:./Test --strict --platformsdir:$(topdir)/build "$@" "$(test_library)" "$(PROFILE_PLATFORM)" "$(PROFILE)"
test_response = $(depsdir)/$(PROFILE_PLATFORM)_$(PROFILE)_$(test_library).response
$(test_response): $(test_sourcefile) $(topdir)/build/tests.make $(depsdir)/.stamp
$(PLATFORM_CHANGE_SEPARATOR_CMD) <$(test_sourcefile) >$@
test_makefrag = $(depsdir)/$(PROFILE_PLATFORM)_$(PROFILE)_$(test_library).makefrag
$(test_makefrag): $(test_sourcefile) $(topdir)/build/tests.make $(depsdir)/.stamp
@echo Creating $@ ...
@sed 's,^,$(build_lib): ,' $< >$@
@if test ! -f $(test_sourcefile).makefrag; then :; else \
cat $(test_sourcefile).makefrag >> $@ ; \
echo '$@: $(test_sourcefile).makefrag' >> $@; \
echo '$(test_sourcefile).makefrag:' >> $@; fi
$(test_lib_output): $(test_assembly_dep) $(test_response) $(test_nunit_dep) $(test_lib_output).nunitlite.config | $(test_lib_dir)
$(TEST_COMPILE) $(LIBRARY_FLAGS) -target:library -out:$@ $(test_flags) $(LOCAL_TEST_COMPILER_ONDOTNET_FLAGS) @$(test_response)
tests_CLEAN_FILES += $(test_sourcefile) $(test_response) $(test_makefrag)
ifdef TEST_SPLIT_ASSEMBLIES
$(test_lib_output:.dll=.part1.dll): $(test_lib_output) $(test_response).part1
$(TEST_COMPILE) $(LIBRARY_FLAGS) -target:library -out:$@ $(test_flags) $(LOCAL_TEST_COMPILER_ONDOTNET_FLAGS) @$(test_response).part1
$(test_lib_output:.dll=.part2.dll): $(test_lib_output) $(test_response).part2
$(TEST_COMPILE) $(LIBRARY_FLAGS) -target:library -out:$@ $(test_flags) $(LOCAL_TEST_COMPILER_ONDOTNET_FLAGS) @$(test_response).part2
$(test_lib_output:.dll=.part3.dll): $(test_lib_output) $(test_response).part3
ifneq ($(wildcard $(test_response).part3),)
$(TEST_COMPILE) $(LIBRARY_FLAGS) -target:library -out:$@ $(test_flags) $(LOCAL_TEST_COMPILER_ONDOTNET_FLAGS) @$(test_response).part3
endif
# part3 is optional so we need this empty target to silence make if it doesn't exist
$(test_response).part3: ;
tests_CLEAN_FILES += $(test_response).part1 $(test_response).part2 $(test_response).part3
endif
$(test_response): $(test_sourcefile_base) $(wildcard *_test.dll.sources) $(wildcard *_test.dll.exclude.sources) $(topdir)/build/tests.make $(depsdir)/.stamp
$(GENSOURCES) --basedir:./Test --strict --platformsdir:$(topdir)/build "$@" "$(test_library)" "$(PROFILE_PLATFORM)" "$(PROFILE)"
$(test_makefrag): $(test_response)
@echo Creating $@ ...
@sed 's,^,$(test_lib_output) $(test_lib_output:.dll=.part1.dll) $(test_lib_output:.dll=.part2.dll) $(test_lib_output:.dll=.part3.dll): ,' $< >$@
-include $(test_makefrag)
build-test-lib: $(test_lib_output)
@echo Building testing lib
endif
@@ -336,8 +344,15 @@ ifdef COVERAGE
XTEST_COVERAGE_FLAGS = -O=-aot --profile=coverage:output=$(topdir)/class/lib/$(PROFILE_DIRECTORY)/coverage_xunit_$(ASSEMBLY).xml
endif
xtest_assemblies += $(xtest_lib_output)
ifdef XTEST_SPLIT_ASSEMBLIES
xtest_assemblies += $(xtest_lib_output:.dll=.part1.dll) $(xtest_lib_output:.dll=.part2.dll) $(xtest_lib_output:.dll=.part3.dll)
endif
check: run-xunit-test-local
xunit-test-local: $(xtest_lib_output) $(test_lib_dir)/xunit-excludes.txt $(test_lib_dir)/Xunit.NetCore.Extensions.dll $(test_lib_dir)/xunit.execution.dotnet.dll
xunit-test-local: $(xtest_assemblies) $(test_lib_dir)/xunit-excludes.txt $(test_lib_dir)/Xunit.NetCore.Extensions.dll $(test_lib_dir)/xunit.execution.dotnet.dll
run-xunit-test-local: run-xunit-test-lib
$(test_lib_dir)/xunit-excludes.txt: $(topdir)/build/tests.make | $(test_lib_dir)
@@ -360,19 +375,35 @@ run-xunit-test-lib: xunit-test-local
$(XTEST_REMOTE_EXECUTOR): $(topdir)/../external/corefx/src/Common/tests/System/Diagnostics/RemoteExecutorConsoleApp/RemoteExecutorConsoleApp.cs | $(test_lib_dir)
$(TEST_COMPILE) -r:$(topdir)/class/lib/$(PROFILE)/mscorlib.dll $< -out:$@
$(xtest_lib_output): $(the_assembly) $(xtest_response) $(xunit_libs_dep) $(xunit_src) $(XTEST_REMOTE_EXECUTOR) | $(test_lib_dir)
$(xtest_lib_output): $(xtest_assembly_dep) $(xtest_response) $(xunit_libs_dep) $(xunit_src) $(XTEST_REMOTE_EXECUTOR) | $(test_lib_dir)
$(TEST_COMPILE) $(LIBRARY_FLAGS) $(XTEST_LIB_FLAGS) -target:library -out:$@ $(xtest_flags) @$(xtest_response) $(xunit_src)
xtest_response_preprocessed = $(xtest_response)_preprocessed
ifdef XTEST_SPLIT_ASSEMBLIES
$(xtest_lib_output:.dll=.part1.dll): $(xtest_lib_output) $(xtest_response).part1
$(TEST_COMPILE) $(LIBRARY_FLAGS) $(XTEST_LIB_FLAGS) -target:library -out:$@ $(xtest_flags) @$(xtest_response).part1 $(xunit_src)
$(xtest_lib_output:.dll=.part2.dll): $(xtest_lib_output) $(xtest_response).part2
$(TEST_COMPILE) $(LIBRARY_FLAGS) $(XTEST_LIB_FLAGS) -target:library -out:$@ $(xtest_flags) @$(xtest_response).part2 $(xunit_src)
$(xtest_lib_output:.dll=.part3.dll): $(xtest_lib_output) $(xtest_response).part3
ifneq ($(wildcard $(xtest_response).part3),)
$(TEST_COMPILE) $(LIBRARY_FLAGS) $(XTEST_LIB_FLAGS) -target:library -out:$@ $(xtest_flags) @$(xtest_response).part3 $(xunit_src)
endif
# part3 is optional so we need this empty target to silence make if it doesn't exist
$(xtest_response).part3: ;
xtests_CLEAN_FILES += $(xtest_response).part1 $(xtest_response).part2 $(xtest_response).part3
endif
# This handles .excludes/.sources pairs, as well as resolving the
# includes that occur in .sources files
$(xtest_response): $(xtest_sourcefile_base) $(wildcard *xtest.dll.sources) $(wildcard $(xtest_sourcefile_base_excludes))
$(GENSOURCES) --strict --platformsdir:$(topdir)/build "$@" "$(xtest_sourcefile_base)" "$(xtest_sourcefile_base_excludes)"
# includes that occur in .sources files. It also handles splitting test assemblies into multiple parts.
$(xtest_response): $(xtest_sourcefile_base) $(wildcard *_xtest.dll.sources) $(wildcard *_xtest.dll.exclude.sources) $(topdir)/build/tests.make $(depsdir)/.stamp
$(GENSOURCES) --strict --platformsdir:$(topdir)/build "$@" "$(xtest_library)" "$(PROFILE_PLATFORM)" "$(PROFILE)"
$(xtest_makefrag): $(xtest_response)
@echo Creating $@ ...
@sed 's,^,$(xtest_lib_output): ,' $< >$@
@sed 's,^,$(xtest_lib_output) $(xtest_lib_output:.dll=.part1.dll) $(xtest_lib_output:.dll=.part2.dll) $(xtest_lib_output:.dll=.part3.dll): ,' $< >$@
-include $(xtest_makefrag)
@@ -27,14 +27,28 @@
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.CmsRecipient))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.CmsRecipientCollection))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.CmsRecipientEnumerator))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.CmsSigner))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.ContentInfo))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.EnvelopedCms))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.KeyAgreeRecipientInfo))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.KeyTransRecipientInfo))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.Pkcs12Builder))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.Pkcs12CertBag))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.Pkcs12ConfidentialityMode))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.Pkcs12Info))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.Pkcs12IntegrityMode))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.Pkcs12KeyBag))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.Pkcs12SafeBag))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.Pkcs12SafeContents))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.Pkcs12SafeContentsBag))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.Pkcs12SecretBag))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.Pkcs12ShroudedKeyBag))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.Pkcs8PrivateKeyInfo))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.Pkcs9AttributeObject))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.Pkcs9ContentType))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.Pkcs9DocumentDescription))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.Pkcs9DocumentName))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.Pkcs9LocalKeyId))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.Pkcs9MessageDigest))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.Pkcs9SigningTime))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.PublicKeyInfo))]
@@ -42,10 +56,15 @@
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.RecipientInfoCollection))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.RecipientInfoEnumerator))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.RecipientInfoType))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.Rfc3161TimestampRequest))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.Rfc3161TimestampToken))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.Rfc3161TimestampTokenInfo))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.SignedCms))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.SignerInfo))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.SignerInfoCollection))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.SignerInfoEnumerator))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.SubjectIdentifier))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.SubjectIdentifierOrKey))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.SubjectIdentifierOrKeyType))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.SubjectIdentifierType))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Xml.X509IssuerSerial))]
+24 -5
View File
@@ -558,6 +558,10 @@ public class Tests : TestsBase, ITest2
runtime_invoke_hybrid_exceptions();
return 0;
}
if (args.Length > 0 && args [0] == "new_thread_hybrid_exception") {
new_thread_hybrid_exception();
return 0;
}
assembly_load ();
breakpoints ();
single_stepping ();
@@ -2222,12 +2226,27 @@ public class Tests : TestsBase, ITest2
[MethodImplAttribute (MethodImplOptions.NoInlining)]
public static void runtime_invoke_hybrid_exceptions () {
Type rtType = Type.GetType("RuntimeInvokeWithThrowClass");
ConstructorInfo rtConstructor = rtType.GetConstructor(Type.EmptyTypes);
object rtObject = rtConstructor.Invoke(new object[] { });
MethodInfo rtMethod = rtType.GetMethod("RuntimeInvokeThrowMethod");
rtMethod.Invoke(rtObject, new object[] { });
ConstructorInfo rtConstructor = rtType.GetConstructor(Type.EmptyTypes);
object rtObject = rtConstructor.Invoke(new object[] { });
MethodInfo rtMethod = rtType.GetMethod("RuntimeInvokeThrowMethod");
rtMethod.Invoke(rtObject, new object[] { });
}
[MethodImplAttribute (MethodImplOptions.NoInlining)]
public static void new_thread_hybrid_exception() {
try
{
Thread thread = new Thread(new_thread_hybrid_exception2);
thread.Start();
}
catch (Exception sockEx)
{
}
}
public static void new_thread_hybrid_exception2()
{
throw new Exception("Error");
}
}
public class SentinelClass : MarshalByRefObject {
+13 -1
View File
@@ -470,7 +470,6 @@ public class DebuggerTests
var pdbFromMemory = assemblyMirror.GetPdbBlob ();
if (!File.Exists (pdbPath)) {
Assert.IsFalse (assemblyMirror.HasPdb);
Assert.IsTrue (assemblyMirror.HasFetchedPdb);
continue;
}
@@ -5151,6 +5150,19 @@ public class DebuggerTests
vm.Exit (0);
vm = null;
}
[Test]
public void TestNewThreadHybridSuspendException () {
TearDown ();
Start (dtest_app_path, "new_thread_hybrid_exception", forceExit: true);
var req2 = vm.CreateExceptionRequest (null, false, true, false);
req2.Enable ();
vm.Resume ();
var ev = GetNextEvent ();
Assert.IsInstanceOfType (typeof (ExceptionEvent), ev);
vm.Exit (0);
vm = null;
}
[Test]
public void TestAsyncDebugGenerics () {
@@ -43,33 +43,16 @@ namespace Mono.Messaging.RabbitMQ {
public class RabbitMQMessagingProvider : IMessagingProvider {
private int txCounter = 0;
private readonly uint localIp;
private readonly Guid localId;
private readonly MessagingContextPool contextPool;
public RabbitMQMessagingProvider ()
{
localIp = GetLocalIP ();
localId = Guid.NewGuid ();
contextPool = new MessagingContextPool (new MessageFactory (this),
CreateConnection);
}
private static uint GetLocalIP ()
{
String strHostName = Dns.GetHostName ();
IPHostEntry ipEntry = Dns.GetHostByName (strHostName);
foreach (IPAddress ip in ipEntry.AddressList) {
if (AddressFamily.InterNetwork == ip.AddressFamily) {
byte[] addr = ip.GetAddressBytes ();
uint localIP = 0;
for (int i = 0; i < 4 && i < addr.Length; i++) {
localIP += (uint) (addr[i] << 8 * (3 - i));
}
return localIP;
}
}
return 0;
}
public IMessage CreateMessage ()
{
return new MessageBase ();
@@ -78,7 +61,7 @@ namespace Mono.Messaging.RabbitMQ {
public IMessageQueueTransaction CreateMessageQueueTransaction ()
{
Interlocked.Increment (ref txCounter);
string txId = localIp.ToString () + txCounter.ToString ();
string txId = localId.ToString () + "_" + txCounter.ToString ();
return new RabbitMQMessageQueueTransaction (txId, contextPool);
}
+25 -2
View File
@@ -5658,21 +5658,30 @@ namespace PEAPI {
char[] name;
Hashtable htable = new Hashtable();
Hashtable btable = new Hashtable (new ByteArrayHashCodeProvider (), new ByteArrayComparer ());
bool addInitByte = false;
bool initByteAdded = false;
internal MetaDataStream(char[] name, bool addInitByte) : base(new MemoryStream())
{
if (addInitByte) { Write((byte)0); size = 1; }
this.addInitByte = addInitByte;
this.name = name;
sizeOfHeader = StreamHeaderSize + (uint)name.Length;
}
internal MetaDataStream(char[] name, System.Text.Encoding enc, bool addInitByte) : base(new MemoryStream(),enc)
{
if (addInitByte) { Write((byte)0); size = 1; }
this.addInitByte = addInitByte;
this.name = name;
sizeOfHeader = StreamHeaderSize + (uint)name.Length;
}
void AddInitByte () {
if (addInitByte && !initByteAdded) {
Write((byte)0);
size += 1;
initByteAdded = true;
}
}
public uint Start {
get { return start; }
set { start = value; }
@@ -5706,6 +5715,7 @@ namespace PEAPI {
internal uint Add(string str, bool prependSize)
{
AddInitByte ();
Object val = htable[str];
uint index = 0;
if (val == null) {
@@ -5723,6 +5733,7 @@ namespace PEAPI {
}
internal uint Add (byte[] str, bool prependSize)
{
AddInitByte ();
Object val = btable [str];
uint index = 0;
if (val == null) {
@@ -5740,6 +5751,7 @@ namespace PEAPI {
internal uint Add(Guid guid, bool prependSize)
{
AddInitByte ();
byte [] b = guid.ToByteArray ();
if (prependSize) CompressNum ((uint) b.Length);
Write(guid.ToByteArray());
@@ -5749,6 +5761,7 @@ namespace PEAPI {
internal uint Add(byte[] blob)
{
AddInitByte ();
uint ix = size;
CompressNum((uint)blob.Length);
Write(blob);
@@ -5758,6 +5771,7 @@ namespace PEAPI {
internal uint Add(byte val, bool prependSize)
{
AddInitByte ();
uint ix = size;
if (prependSize) CompressNum (1);
Write(val);
@@ -5767,6 +5781,7 @@ namespace PEAPI {
internal uint Add(sbyte val, bool prependSize)
{
AddInitByte ();
uint ix = size;
if (prependSize) CompressNum (1);
Write(val);
@@ -5776,6 +5791,7 @@ namespace PEAPI {
internal uint Add(ushort val, bool prependSize)
{
AddInitByte ();
uint ix = size;
if (prependSize) CompressNum (2);
Write(val);
@@ -5785,6 +5801,7 @@ namespace PEAPI {
internal uint Add(short val, bool prependSize)
{
AddInitByte ();
uint ix = size;
if (prependSize) CompressNum (2);
Write(val);
@@ -5794,6 +5811,7 @@ namespace PEAPI {
internal uint Add(uint val, bool prependSize)
{
AddInitByte ();
uint ix = size;
if (prependSize) CompressNum (4);
Write(val);
@@ -5803,6 +5821,7 @@ namespace PEAPI {
internal uint Add(int val, bool prependSize)
{
AddInitByte ();
uint ix = size;
if (prependSize) CompressNum (4);
Write (val);
@@ -5812,6 +5831,7 @@ namespace PEAPI {
internal uint Add(ulong val, bool prependSize)
{
AddInitByte ();
uint ix = size;
if (prependSize) CompressNum (8);
Write(val);
@@ -5821,6 +5841,7 @@ namespace PEAPI {
internal uint Add(long val, bool prependSize)
{
AddInitByte ();
uint ix = size;
if (prependSize) CompressNum (8);
Write(val);
@@ -5830,6 +5851,7 @@ namespace PEAPI {
internal uint Add(float val, bool prependSize)
{
AddInitByte ();
uint ix = size;
if (prependSize) CompressNum (4);
Write(val);
@@ -5839,6 +5861,7 @@ namespace PEAPI {
internal uint Add(double val, bool prependSize)
{
AddInitByte ();
uint ix = size;
if (prependSize) CompressNum (8);
Write(val);
+2
View File
@@ -62,4 +62,6 @@ XTEST_LIB_REFS = System Facades/System.Threading.Tasks Microsoft.CSharp Facades/
XTEST_LIB_FLAGS = -unsafe -d:FEATURE_COMPILE
XTEST_RESX_RESOURCE_STRING = ../../../external/corefx/src/System.Collections.Immutable/src/Resources/Strings.resx
XTEST_SPLIT_ASSEMBLIES := $(filter monotouch%, $(PROFILE))
include ../../build/library.make
@@ -3,12 +3,10 @@
../../../external/corefx/src/CoreFx.Private.TestUtilities/src/System/AssertExtensions.cs
../../../external/corefx/src/Common/tests/System/Threading/Tasks/TaskTimeoutExtensions.cs
# System.Linq
# TODO: ../../../external/corefx/src/System.Linq/tests/*.cs
# System.Linq.Queryable
../../../external/corefx/src/System.Linq.Queryable/tests/*.cs
../../../external/corefx/src/Common/tests/System/Linq/SkipTakeData.cs
#split monotouch
#split monotouch_tv
#split monotouch_watch
# System.Linq.Expressions
../../../external/corefx/src/System.Linq.Expressions/tests/Array/*.cs:NewArrayBoundsTests.cs,ArrayAccessTests.cs,ArrayIndexTests.cs
@@ -56,7 +54,19 @@
../../../external/corefx/src/System.Linq.Expressions/tests/Unary/IncDecAssign/*.cs
../../../external/corefx/src/System.Linq.Expressions/tests/*.cs:StackSpillerTests.cs,ReadOnlyCollectionBuilderTests.cs
# System.Linq.Expressions
#split monotouch
#split monotouch_tv
#split monotouch_watch
# System.Linq
# TODO: ../../../external/corefx/src/System.Linq/tests/*.cs
# System.Linq.Queryable
../../../external/corefx/src/System.Linq.Queryable/tests/*.cs
../../../external/corefx/src/Common/tests/System/Linq/SkipTakeData.cs
# System.Linq.Parallel
../../../external/corefx/src/System.Linq.Parallel/tests/Combinatorial/*.cs
../../../external/corefx/src/System.Linq.Parallel/tests/Helpers/*.cs
../../../external/corefx/src/System.Linq.Parallel/tests/QueryOperators/*.cs:DefaultIfEmptyTests.cs,SingleSingleOrDefaultTests.cs
@@ -2,16 +2,15 @@ thisdir = class/System.Net.Http/FunctionalTests
SUBDIRS =
include ../../../build/rules.make
ASSEMBLY = System.Net.Http.FunctionalTests
LIBRARY = System.Net.Http.FunctionalTests.dll
NO_BUILD = yes
NO_INSTALL = yes
XTEST_LIB_REFS = System System.Core Facades/System.Threading.Tasks
XTEST_LIB_REFS = System System.Core Facades/System.Threading.Tasks System.Net.Http
USE_XTEST_REMOTE_EXECUTOR = YES
XTEST_LIB_FLAGS = /resource:../../System/Test/TestData/testservereku.contoso.com.pfx
the_assembly = $(topdir)/class/lib/$(PROFILE_DIRECTORY)/System.Net.Http.dll
include ../../../build/tests.make
include ../../../build/library.make
TEST_RUNTIME := MONO_URI_DOTNETRELATIVEORABSOLUTE=true $(TEST_RUNTIME)
@@ -0,0 +1,27 @@
using System.Reflection;
namespace System.Net.Http
{
partial class HttpClientHandler : HttpMessageHandler
{
static IMonoHttpClientHandler CreateDefaultHandler ()
{
string envvar = Environment.GetEnvironmentVariable ("XA_HTTP_CLIENT_HANDLER_TYPE")?.Trim ();
if (envvar?.StartsWith("System.Net.Http.MonoWebRequestHandler", StringComparison.InvariantCulture) == true)
{
Type monoWrhType = Type.GetType (envvar, false);
if (monoWrhType != null)
return (IMonoHttpClientHandler) Activator.CreateInstance (monoWrhType);
}
// Ignore other types of handlers here (e.g. AndroidHttpHandler) to keep the old behavior
// and always create SocketsHttpHandler for code like this if MonoWebRequestHandler was not specified:
//
// var handler = new HttpClientHandler { Credentials = ... };
// var httpClient = new HttpClient (handler);
//
// AndroidHttpHandler is used only when we use the parameterless ctor of HttpClient
return new SocketsHttpHandler ();
}
}
}
@@ -70,7 +70,7 @@ namespace System.Net.Http
TimeSpan? timeout;
bool disposed;
internal MonoWebRequestHandler ()
public MonoWebRequestHandler ()
{
allowAutoRedirect = true;
maxAutomaticRedirections = 50;
@@ -1328,7 +1328,7 @@
<Compile Include="..\..\..\external\corefx\src\System.Net.Http\src\System\Net\Http\StreamContent.cs" />
<Compile Include="..\..\..\external\corefx\src\System.Net.Http\src\System\Net\Http\StreamToStreamCopy.cs" />
<Compile Include="..\..\..\external\corefx\src\System.Net.Http\src\System\Net\Http\StringContent.cs" />
<Compile Include="HttpClientHandler.SocketsHandler.cs" />
<Compile Include="HttpClientHandler.SocketsHandler.Android.cs" />
<Compile Include="HttpClientHandler.cs" />
<Compile Include="HttpRequestMessage.Mono.cs" />
<Compile Include="IMonoHttpClientHandler.cs" />
@@ -8,27 +8,34 @@ namespace System.Net.Http {
static HttpMessageHandler CreateDefaultHandler ()
{
Type type = Type.GetType("Android.Runtime.AndroidEnvironment, Mono.Android");
if (type == null)
return GetFallback ("Invalid Mono.Android assembly? Cannot find Android.Runtime.AndroidEnvironment");
string envvar = Environment.GetEnvironmentVariable ("XA_HTTP_CLIENT_HANDLER_TYPE")?.Trim ();
MethodInfo method = type.GetMethod ("GetHttpMessageHandler", BindingFlags.Static | BindingFlags.NonPublic);
if (method == null)
return GetFallback ("Your Xamarin.Android version does not support obtaining of the custom HttpClientHandler");
if (string.IsNullOrEmpty (envvar))
return new HttpClientHandler ();
object ret = method.Invoke (null, null);
if (ret == null)
return GetFallback ("Xamarin.Android returned no custom HttpClientHandler");
if (envvar?.StartsWith ("System.Net.Http.MonoWebRequestHandler", StringComparison.InvariantCulture) == true)
{
Type monoWrhType = Type.GetType (envvar, false);
if (monoWrhType != null)
return new HttpClientHandler ((IMonoHttpClientHandler) Activator.CreateInstance (monoWrhType));
var handler = ret as HttpMessageHandler;
if (handler == null)
return GetFallback ($"{ret?.GetType()} is not a valid HttpMessageHandler");
return handler;
}
return new HttpClientHandler ();
}
Type handlerType = Type.GetType (envvar, false);
if (handlerType == null && !envvar.Contains (", "))
{
// if assembly was not specified - look for it in Mono.Android too
// (e.g. AndroidHttpHandler is there)
handlerType = Type.GetType (envvar + ", Mono.Android", false);
}
if (handlerType == null)
return new HttpClientHandler ();
if (Activator.CreateInstance (handlerType) is HttpMessageHandler msgHandler)
return msgHandler;
static HttpMessageHandler GetFallback (string message)
{
Console.WriteLine (message + ". Defaulting to System.Net.Http.HttpClientHandler");
return new HttpClientHandler ();
}
}
+4 -4
View File
@@ -2,15 +2,15 @@ thisdir = class/System.Net.Http/UnitTests
SUBDIRS =
include ../../../build/rules.make
ASSEMBLY = System.Net.Http.UnitTests
LIBRARY = System.Net.Http.UnitTests.dll
NO_BUILD = yes
NO_INSTALL = yes
XTEST_LIB_REFS = System System.Core Facades/System.Threading.Tasks
USE_XTEST_REMOTE_EXECUTOR = YES
XTEST_MCS_FLAGS = -nowarn:436
include ../../../build/tests.make
xtest_flags = $(xunit_libs_ref) $(XTEST_MCS_FLAGS) $(XTEST_LIB_MCS_FLAGS) /unsafe
include ../../../build/library.make
clean-local:
-rm -f $(tests_CLEAN_FILES) $(CLEAN_FILES)
Whitespace-only changes.
@@ -1 +1,2 @@
HttpClient.DefaultHandler.cs
HttpClientHandler.SocketsHandler.cs
@@ -1,2 +1,3 @@
#include socketshandler.sources
System.Net.Http/HttpClient.android.cs
HttpClientHandler.SocketsHandler.Android.cs
@@ -30,7 +30,10 @@ namespace MonoTests.Remoting
{
try
{
tcp = new TcpChannel (0);
Hashtable tcpOptions = new Hashtable ();
tcpOptions ["port"] = 0;
tcpOptions ["bindTo"] = "127.0.0.1";
tcp = new TcpChannel (tcpOptions, null, null);
Hashtable options = new Hashtable ();
options ["timeout"] = 10000; // 10s
@@ -42,8 +45,8 @@ namespace MonoTests.Remoting
AppDomain domain = BaseCallTest.CreateDomain ("testdomain_activation");
server = (ActivationServer) domain.CreateInstanceAndUnwrap(GetType().Assembly.FullName,"MonoTests.Remoting.ActivationServer");
var tcpUrlPrefix = $"tcp://localhost:{server.TcpPort}";
var httpUrlPrefix = $"http://localhost:{server.HttpPort}";
var tcpUrlPrefix = $"tcp://127.0.0.1:{server.TcpPort}";
var httpUrlPrefix = $"http://127.0.0.1:{server.HttpPort}";
RemotingConfiguration.RegisterActivatedClientType (typeof(CaObject1), tcpUrlPrefix);
RemotingConfiguration.RegisterActivatedClientType (typeof(CaObject2), httpUrlPrefix);
RemotingConfiguration.RegisterWellKnownClientType (typeof(WkObjectSinglecall1), tcpUrlPrefix + "/wkoSingleCall1");
@@ -169,8 +172,14 @@ namespace MonoTests.Remoting
{
TcpPort = NetworkHelpers.FindFreePort ();
HttpPort = NetworkHelpers.FindFreePort ();
tcp = new TcpChannel (TcpPort);
http = new HttpChannel (HttpPort);
IDictionary tcpProps = new Hashtable ();
IDictionary httpProps = new Hashtable ();
tcpProps ["port"] = TcpPort;
tcpProps ["bindTo"] = "127.0.0.1";
httpProps ["port"] = HttpPort;
httpProps ["bindTo"] = "127.0.0.1";
tcp = new TcpChannel (tcpProps, null, null);
http = new HttpChannel (httpProps, null, null);
ChannelServices.RegisterChannel (tcp);
ChannelServices.RegisterChannel (http);
@@ -172,6 +172,7 @@ namespace MonoTests.Remoting
IDictionary props = new Hashtable ();
props ["name"] = Guid.NewGuid ().ToString("N");
props ["port"] = port;
props ["bindTo"] = "127.0.0.1";
TcpChannel chan = new TcpChannel (props, null, null);
ChannelServices.RegisterChannel (chan);
@@ -20,11 +20,15 @@ namespace MonoTests.Remoting.Http
[Ignore ("This test somehow keeps http channel registered and then blocks any further http tests working. This also happens under .NET, so this test itself is wrong with nunit 2.4.8.")]
public void Test ()
{
new HttpChannel (8086);
var port = NetworkHelpers.FindFreePort ();
Hashtable props = new Hashtable ();
props["port"] = port;
props["bindTo"] = "127.0.0.1";
new HttpChannel (props, null, null);
RemotingServices.Marshal (new Service (), "test");
Service remObj = (Service) RemotingServices.Connect (
typeof (Service), "http://localhost:8086/test");
typeof (Service), $"http://127.0.0.1:{port}/test");
ArrayList list;
remObj.Test (out list);
@@ -70,13 +74,16 @@ namespace MonoTests.Remoting.Http
public void Main ()
{
var port = NetworkHelpers.FindFreePort ();
channel = new HttpChannel (port);
Hashtable props = new Hashtable ();
props["port"] = port;
props["bindTo"] = "127.0.0.1";
channel = new HttpChannel (props, null, null);
ChannelServices.RegisterChannel (channel);
RemotingConfiguration.RegisterWellKnownServiceType
(typeof (Bug321420),"Server.soap", WellKnownObjectMode.Singleton);
Bug321420 s = (Bug321420) Activator.GetObject (typeof
(Bug321420), $"http://localhost:{port}/Server.soap");
(Bug321420), $"http://127.0.0.1:{port}/Server.soap");
// this works: s.Method ("a", "b");
s.Method ("a", "a");
@@ -101,7 +108,7 @@ namespace MonoTests.Remoting.Http
public void Main ()
{
Foo foo = (Foo) Activator.GetObject (typeof (Foo),
$"http://localhost:{server.HttpPort}/Test");
$"http://127.0.0.1:{server.HttpPort}/Test");
Bar bar = foo.Login ();
if (bar != null)
@@ -146,7 +153,10 @@ namespace MonoTests.Remoting.Http
public void Start ()
{
HttpPort = NetworkHelpers.FindFreePort ();
c = new HttpChannel (HttpPort);
Hashtable props = new Hashtable ();
props["port"] = HttpPort;
props["bindTo"] = "127.0.0.1";
c = new HttpChannel (props, null, null);
ChannelServices.RegisterChannel (c);
Type t = typeof(Foo);
@@ -174,11 +184,14 @@ namespace MonoTests.Remoting.Http
[Test]
public void Main ()
{
channel = new HttpChannel (0);
Hashtable props = new Hashtable ();
props["port"] = 0;
props["bindTo"] = "127.0.0.1";
channel = new HttpChannel (props, null, null);
ChannelServices.RegisterChannel (channel);
MarshalByRefObject obj = (MarshalByRefObject) RemotingServices.Connect (
typeof (IFactorial),
$"http://localhost:{server.HttpPort}/MyEndPoint");
$"http://127.0.0.1:{server.HttpPort}/MyEndPoint");
IFactorial cal = (IFactorial) obj;
Assert.AreEqual (cal.CalculateFactorial (4), 24);
}
@@ -216,7 +229,10 @@ namespace MonoTests.Remoting.Http
public void Start ()
{
HttpPort = NetworkHelpers.FindFreePort ();
c = new HttpChannel (HttpPort);
Hashtable props = new Hashtable ();
props["port"] = HttpPort;
props["bindTo"] = "127.0.0.1";
c = new HttpChannel (props, null, null);
ChannelServices.RegisterChannel (c);
Type t = typeof(Calculator);
@@ -294,6 +294,7 @@ namespace MonoTests.Remoting
IDictionary props = new Hashtable ();
props ["name"] = objMarshal.Uri;
props ["port"] = port;
props ["bindTo"] = "127.0.0.1";
TcpChannel chn = new TcpChannel (props, null, null);
ChannelServices.RegisterChannel (chn);
@@ -317,6 +318,7 @@ namespace MonoTests.Remoting
IDictionary props = new Hashtable ();
props ["name"] = objMarshal.Uri;
props ["port"] = port;
props ["bindTo"] = "127.0.0.1";
TcpChannel chn = new TcpChannel (props, null, null);
ChannelServices.RegisterChannel (chn);
@@ -346,7 +348,10 @@ namespace MonoTests.Remoting
public void ExecuteMessage ()
{
var port = NetworkHelpers.FindFreePort ();
TcpChannel chn = new TcpChannel (port);
IDictionary props = new Hashtable ();
props ["port"] = port;
props ["bindTo"] = "127.0.0.1";
TcpChannel chn = new TcpChannel (props, null, null);
ChannelServices.RegisterChannel (chn);
try {
MarshalObject objMarshal = NewMarshalObject ();
@@ -379,7 +384,10 @@ namespace MonoTests.Remoting
public void IsOneWay ()
{
var port = NetworkHelpers.FindFreePort ();
TcpChannel chn = new TcpChannel (port);
IDictionary props = new Hashtable ();
props ["port"] = port;
props ["bindTo"] = "127.0.0.1";
TcpChannel chn = new TcpChannel (props, null, null);
ChannelServices.RegisterChannel (chn);
try {
RemotingConfiguration.RegisterWellKnownServiceType (typeof (MarshalObject), "MarshalObject.rem", WellKnownObjectMode.Singleton);
@@ -403,7 +411,10 @@ namespace MonoTests.Remoting
public void GetObjRefForProxy ()
{
var port = NetworkHelpers.FindFreePort ();
TcpChannel chn = new TcpChannel (port);
IDictionary props = new Hashtable ();
props ["port"] = port;
props ["bindTo"] = "127.0.0.1";
TcpChannel chn = new TcpChannel (props, null, null);
ChannelServices.RegisterChannel (chn);
try {
// Register le factory as a SAO
@@ -427,7 +438,10 @@ namespace MonoTests.Remoting
public void GetRealProxy ()
{
var port = NetworkHelpers.FindFreePort ();
TcpChannel chn = new TcpChannel (port);
IDictionary props = new Hashtable ();
props ["port"] = port;
props ["bindTo"] = "127.0.0.1";
TcpChannel chn = new TcpChannel (props, null, null);
ChannelServices.RegisterChannel (chn);
try {
RemotingConfiguration.RegisterWellKnownServiceType (typeof (MarshalObject), "MonoTests.System.Runtime.Remoting.RemotingServicesTest.MarshalObject.soap", WellKnownObjectMode.Singleton);
@@ -449,7 +463,10 @@ namespace MonoTests.Remoting
public void SetObjectUriForMarshal ()
{
var port = NetworkHelpers.FindFreePort ();
TcpChannel chn = new TcpChannel (port);
IDictionary props = new Hashtable ();
props ["port"] = port;
props ["bindTo"] = "127.0.0.1";
TcpChannel chn = new TcpChannel (props, null, null);
ChannelServices.RegisterChannel (chn);
try {
MarshalObject objRem = NewMarshalObject ();
@@ -469,7 +486,10 @@ namespace MonoTests.Remoting
public void GetServeurTypeForUri ()
{
var port = NetworkHelpers.FindFreePort ();
TcpChannel chn = new TcpChannel (port);
IDictionary props = new Hashtable ();
props ["port"] = port;
props ["bindTo"] = "127.0.0.1";
TcpChannel chn = new TcpChannel (props, null, null);
Type type = typeof (MarshalObject);
ChannelServices.RegisterChannel (chn);
try {
@@ -491,7 +511,10 @@ namespace MonoTests.Remoting
public void IsObjectOutOf ()
{
var port = NetworkHelpers.FindFreePort ();
TcpChannel chn = new TcpChannel (port);
IDictionary props = new Hashtable ();
props ["port"] = port;
props ["bindTo"] = "127.0.0.1";
TcpChannel chn = new TcpChannel (props, null, null);
ChannelServices.RegisterChannel (chn);
try {
RemotingConfiguration.RegisterWellKnownServiceType (typeof (MarshalObject), "MarshalObject2.rem", WellKnownObjectMode.Singleton);
@@ -514,7 +537,10 @@ namespace MonoTests.Remoting
{
var port = NetworkHelpers.FindFreePort ();
RemotingConfiguration.ApplicationName = "app";
TcpChannel chn = new TcpChannel (port);
IDictionary props = new Hashtable ();
props ["port"] = port;
props ["bindTo"] = "127.0.0.1";
TcpChannel chn = new TcpChannel (props, null, null);
ChannelServices.RegisterChannel (chn);
try {
RemotingConfiguration.RegisterWellKnownServiceType (typeof (MarshalObject), "obj3.rem", WellKnownObjectMode.Singleton);
@@ -541,7 +567,10 @@ namespace MonoTests.Remoting
public void GetObjectWithChannelDataTest ()
{
var port = NetworkHelpers.FindFreePort ();
TcpChannel chn = new TcpChannel (port);
IDictionary props = new Hashtable ();
props ["port"] = port;
props ["bindTo"] = "127.0.0.1";
TcpChannel chn = new TcpChannel (props, null, null);
ChannelServices.RegisterChannel (chn);
try {
RemotingConfiguration.RegisterWellKnownServiceType (typeof (MarshalObject), "getobjectwithchanneldata.rem", WellKnownObjectMode.Singleton);
@@ -7,6 +7,7 @@
//
using System;
using System.Collections;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;
@@ -55,12 +56,18 @@ namespace MonoTests.Remoting
{
public override IChannelSender CreateClientChannel ()
{
return new TcpChannel (0);
Hashtable props = new Hashtable ();
props["port"] = 0;
props["bindTo"] = "127.0.0.1";
return new TcpChannel (props, null, null);
}
public override IChannelReceiver CreateServerChannel ()
{
return new TcpChannel (0);
Hashtable props = new Hashtable ();
props["port"] = 0;
props["bindTo"] = "127.0.0.1";
return new TcpChannel (props, null, null);
}
}
}
@@ -423,8 +423,10 @@ namespace System.Runtime.Serialization.Json
XmlDictionaryString namespaceLocal = null;
if (nameLocal != null && nameLocal is string)
writer.WriteStartElement ((string) name, null);
else
else if (name is XmlDictionaryString)
writer.WriteStartElement ((XmlDictionaryString) name, null);
else
writer.WriteStartElement (name.ToString(), null);
}
void WriteEndElement ()
@@ -0,0 +1,115 @@
using System;
using System.Security.Cryptography;
using System.Security.Cryptography.Pkcs;
namespace System.Security.Cryptography.Pkcs {
/// <summary>Enables the creation of PKCS#12 PFX data values. This class cannot be inherited.</summary>
public sealed class Pkcs12Builder {
/// <summary>Gets a value that indicates whether the PFX data has been sealed.</summary>
/// <returns>A value that indicates whether the PFX data has been sealed.</returns>
public bool IsSealed {
get {
throw new PlatformNotSupportedException ();
}
}
/// <summary>Add contents to the PFX in an bundle encrypted with a byte-based password from a byte array.</summary>
/// <param name="safeContents">The contents to add to the PFX.</param>
/// <param name="passwordBytes">The byte array to use as a password when encrypting the contents.</param>
/// <param name="pbeParameters">The password-based encryption (PBE) parameters to use when encrypting the contents.</param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="safeContents" /> or <paramref name="pbeParameters" /> parameter is <see langword="null" />.</exception>
/// <exception cref="T:System.ArgumentException">The <paramref name="safeContents" /> parameter value is already encrypted.</exception>
/// <exception cref="T:System.InvalidOperationException">The PFX is already sealed (<see cref="P:System.Security.Cryptography.Pkcs.Pkcs12Builder.IsSealed" /> is <see langword="true" />).</exception>
/// <exception cref="T:System.Security.Cryptography.CryptographicException">
/// <paramref name="pbeParameters" /> indicates that <see cref="F:System.Security.Cryptography.PbeEncryptionAlgorithm.TripleDes3KeyPkcs12" /> should be used, which requires <see cref="T:System.Char" />-based passwords.</exception>
public void AddSafeContentsEncrypted (Pkcs12SafeContents safeContents, byte[] passwordBytes, PbeParameters pbeParameters) {
throw new PlatformNotSupportedException ();
}
/// <summary>Add contents to the PFX in an bundle encrypted with a byte-based password from a span.</summary>
/// <param name="safeContents">The contents to add to the PFX.</param>
/// <param name="passwordBytes">The byte span to use as a password when encrypting the contents.</param>
/// <param name="pbeParameters">The password-based encryption (PBE) parameters to use when encrypting the contents.</param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="safeContents" /> or <paramref name="pbeParameters" /> parameter is <see langword="null" />.</exception>
/// <exception cref="T:System.ArgumentException">The <paramref name="safeContents" /> parameter value is already encrypted.</exception>
/// <exception cref="T:System.InvalidOperationException">The PFX is already sealed (<see cref="P:System.Security.Cryptography.Pkcs.Pkcs12Builder.IsSealed" /> is <see langword="true" />).</exception>
/// <exception cref="T:System.Security.Cryptography.CryptographicException">
/// <paramref name="pbeParameters" /> indicates that <see cref="F:System.Security.Cryptography.PbeEncryptionAlgorithm.TripleDes3KeyPkcs12" /> should be used, which requires <see cref="T:System.Char" />-based passwords.</exception>
public void AddSafeContentsEncrypted (Pkcs12SafeContents safeContents, ReadOnlySpan<byte> passwordBytes, PbeParameters pbeParameters) {
throw new PlatformNotSupportedException ();
}
/// <summary>Add contents to the PFX in an bundle encrypted with a char-based password from a span.</summary>
/// <param name="safeContents">The contents to add to the PFX.</param>
/// <param name="password">The span to use as a password when encrypting the contents.</param>
/// <param name="pbeParameters">The password-based encryption (PBE) parameters to use when encrypting the contents.</param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="safeContents" /> or <paramref name="pbeParameters" /> parameter is <see langword="null" />.</exception>
/// <exception cref="T:System.ArgumentException">The <paramref name="safeContents" /> parameter value is already encrypted.</exception>
/// <exception cref="T:System.InvalidOperationException">The PFX is already sealed (<see cref="P:System.Security.Cryptography.Pkcs.Pkcs12Builder.IsSealed" /> is <see langword="true" />).</exception>
public void AddSafeContentsEncrypted (Pkcs12SafeContents safeContents, ReadOnlySpan<char> password, PbeParameters pbeParameters) {
throw new PlatformNotSupportedException ();
}
/// <summary>Add contents to the PFX in an bundle encrypted with a char-based password from a string.</summary>
/// <param name="safeContents">The contents to add to the PFX.</param>
/// <param name="password">The string to use as a password when encrypting the contents.</param>
/// <param name="pbeParameters">The password-based encryption (PBE) parameters to use when encrypting the contents.</param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="safeContents" /> or <paramref name="pbeParameters" /> parameter is <see langword="null" />.</exception>
/// <exception cref="T:System.ArgumentException">The <paramref name="safeContents" /> parameter value is already encrypted.</exception>
/// <exception cref="T:System.InvalidOperationException">The PFX is already sealed (<see cref="P:System.Security.Cryptography.Pkcs.Pkcs12Builder.IsSealed" /> is <see langword="true" />).</exception>
public void AddSafeContentsEncrypted (Pkcs12SafeContents safeContents, string password, PbeParameters pbeParameters) {
throw new PlatformNotSupportedException ();
}
/// <summary>Add contents to the PFX without encrypting them.</summary>
/// <param name="safeContents">The contents to add to the PFX.</param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="safeContents" /> parameter is <see langword="null" />.</exception>
/// <exception cref="T:System.InvalidOperationException">The PFX is already sealed (<see cref="P:System.Security.Cryptography.Pkcs.Pkcs12Builder.IsSealed" /> is <see langword="true" />).</exception>
public void AddSafeContentsUnencrypted (Pkcs12SafeContents safeContents) {
throw new PlatformNotSupportedException ();
}
/// <summary>Encodes the contents of a sealed PFX and returns it as a byte array.</summary>
/// <returns>A byte array representing the encoded form of the PFX.</returns>
/// <exception cref="T:System.InvalidOperationException">The PFX is not sealed (<see cref="P:System.Security.Cryptography.Pkcs.Pkcs12Builder.IsSealed" /> is <see langword="false" />).</exception>
public byte[] Encode () {
throw new PlatformNotSupportedException ();
}
/// <summary>Seals the PFX against further changes by applying a password-based Message Authentication Code (MAC) over the contents with a password from a span.</summary>
/// <param name="password">The password to use as a key for computing the MAC.</param>
/// <param name="hashAlgorithm">The hash algorithm to use when computing the MAC.</param>
/// <param name="iterationCount">The iteration count for the Key Derivation Function (KDF) used in computing the MAC.</param>
/// <exception cref="T:System.ArgumentOutOfRangeException">The <paramref name="iterationCount" /> parameter is less than or equal to 0.</exception>
/// <exception cref="T:System.InvalidOperationException">The PFX is already sealed (<see cref="P:System.Security.Cryptography.Pkcs.Pkcs12Builder.IsSealed" /> is <see langword="true" />).</exception>
public void SealWithMac (ReadOnlySpan<char> password, HashAlgorithmName hashAlgorithm, int iterationCount) {
throw new PlatformNotSupportedException ();
}
/// <summary>Seals the PFX against further changes by applying a password-based Message Authentication Code (MAC) over the contents with a password from a string.</summary>
/// <param name="password">The password to use as a key for computing the MAC.</param>
/// <param name="hashAlgorithm">The hash algorithm to use when computing the MAC.</param>
/// <param name="iterationCount">The iteration count for the Key Derivation Function (KDF) used in computing the MAC.</param>
/// <exception cref="T:System.ArgumentOutOfRangeException">The <paramref name="iterationCount" /> parameter is less than or equal to 0.</exception>
/// <exception cref="T:System.InvalidOperationException">The PFX is already sealed (<see cref="P:System.Security.Cryptography.Pkcs.Pkcs12Builder.IsSealed" /> is <see langword="true" />).</exception>
public void SealWithMac (string password, HashAlgorithmName hashAlgorithm, int iterationCount) {
throw new PlatformNotSupportedException ();
}
/// <summary>Seals the PFX from further changes without applying tamper-protection.</summary>
/// <exception cref="T:System.InvalidOperationException">The PFX is already sealed (<see cref="P:System.Security.Cryptography.Pkcs.Pkcs12Builder.IsSealed" /> is <see langword="true" />).</exception>
public void SealWithoutIntegrity () {
throw new PlatformNotSupportedException ();
}
/// <summary>Attempts to encode the contents of a sealed PFX into a provided buffer.</summary>
/// <param name="destination">The byte span to receive the PKCS#12 PFX data.</param>
/// <param name="bytesWritten">When this method returns, contains a value that indicates the number of bytes written to <paramref name="destination" />. This parameter is treated as uninitialized.</param>
/// <returns>
/// <see langword="true" /> if <paramref name="destination" /> is big enough to receive the output; otherwise, <see langword="false" />.</returns>
/// <exception cref="T:System.InvalidOperationException">The PFX is not sealed (<see cref="P:System.Security.Cryptography.Pkcs.Pkcs12Builder.IsSealed" /> is <see langword="false" />).</exception>
public bool TryEncode (Span<byte> destination, out int bytesWritten) {
throw new PlatformNotSupportedException ();
}
}
}
@@ -0,0 +1,50 @@
using System;
using System.Security.Cryptography;
using System.Security.Cryptography.Pkcs;
using System.Security.Cryptography.X509Certificates;
namespace System.Security.Cryptography.Pkcs {
/// <summary>Represents the PKCS#12 CertBag. This class cannot be inherited.</summary>
public sealed class Pkcs12CertBag : Pkcs12SafeBag {
/// <summary>Gets the uninterpreted certificate contents of the CertSafeBag.</summary>
/// <returns>The uninterpreted certificate contents of the CertSafeBag.</returns>
public ReadOnlyMemory<byte> EncodedCertificate {
get {
throw new PlatformNotSupportedException ();
}
}
/// <summary>Gets a value indicating whether the content type of the encoded certificate value is the X.509 public key certificate content type.</summary>
/// <returns>
/// <see langword="true" /> if the content type is the X.509 public key certificate content type (1.2.840.113549.1.9.22.1); otherwise, <see langword="false" />.</returns>
public bool IsX509Certificate {
get {
throw new PlatformNotSupportedException ();
}
}
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.Pkcs.Pkcs12CertBag" /> class using the specified certificate type and encoding.</summary>
/// <param name="certificateType">The Object Identifier (OID) for the certificate type.</param>
/// <param name="encodedCertificate">The encoded certificate value.</param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="certificateType" /> parameter is <see langword="null" />.</exception>
/// <exception cref="T:System.Security.Cryptography.CryptographicException">The <paramref name="encodedCertificate" /> parameter does not represent a single ASN.1 BER-encoded value.</exception>
public Pkcs12CertBag (Oid certificateType, ReadOnlyMemory<byte> encodedCertificate)
: base (null, default(ReadOnlyMemory<byte>)) {
throw new PlatformNotSupportedException ();
}
/// <summary>Gets the contents of the CertBag interpreted as an X.509 public key certificate.</summary>
/// <returns>A certificate decoded from the contents of the CertBag.</returns>
/// <exception cref="">The content type is not the X.509 public key certificate content type.</exception>
/// <exception cref="T:System.Security.Cryptography.CryptographicException">The contents were not valid for the X.509 certificate content type.</exception>
public X509Certificate2 GetCertificate () {
throw new PlatformNotSupportedException ();
}
/// <summary>Gets the Object Identifier (OID) which identifies the content type of the encoded certificte value.</summary>
/// <returns>The Object Identifier (OID) which identifies the content type of the encoded certificate value.</returns>
public Oid GetCertificateType () {
throw new PlatformNotSupportedException ();
}
}
}
@@ -0,0 +1,13 @@
namespace System.Security.Cryptography.Pkcs {
/// <summary>Represents the kind of encryption associated with a PKCS#12 SafeContents value.</summary>
public enum Pkcs12ConfidentialityMode {
/// <summary>The SafeContents value is not encrypted.</summary>
None = 1,
/// <summary>The SafeContents value is encrypted with a password.</summary>
Password = 2,
/// <summary>The SafeContents value is encrypted using public key cryptography.</summary>
PublicKey = 3,
/// <summary>The kind of encryption applied to the SafeContents is unknown or could not be determined.</summary>
Unknown = 0
}
}
@@ -0,0 +1,59 @@
using System;
using System.Collections.ObjectModel;
using System.Security.Cryptography.Pkcs;
namespace System.Security.Cryptography.Pkcs {
/// <summary>Represents the data from PKCS#12 PFX contents. This class cannot be inherited.</summary>
public sealed class Pkcs12Info {
/// <summary>Gets a read-only collection of the SafeContents values present in the PFX AuthenticatedSafe.</summary>
/// <returns>A read-only collection of the SafeContents values present in the PFX AuthenticatedSafe.</returns>
public ReadOnlyCollection<Pkcs12SafeContents> AuthenticatedSafe {
get {
throw new PlatformNotSupportedException ();
}
}
/// <summary>Gets a value that indicates the type of tamper protection provided for the <see cref="P:System.Security.Cryptography.Pkcs.Pkcs12Info.AuthenticatedSafe" /> contents.</summary>
/// <returns>One of the enumeration members that indicates the type of tamper protection provided for the <see cref="P:System.Security.Cryptography.Pkcs.Pkcs12Info.AuthenticatedSafe" /> contents.</returns>
public Pkcs12IntegrityMode IntegrityMode {
get {
throw new PlatformNotSupportedException ();
}
}
internal Pkcs12Info () {
throw new PlatformNotSupportedException ();
}
/// <summary>Reads the provided data as a PKCS#12 PFX and returns an object view of the contents.</summary>
/// <param name="encodedBytes">The data to interpret as a PKCS#12 PFX.</param>
/// <param name="bytesConsumed">When this method returns, contains a value that indicates the number of bytes from <paramref name="encodedBytes" /> which were read by this method. This parameter is treated as uninitialized.</param>
/// <param name="skipCopy">
/// <see langword="true" /> to store <paramref name="encodedBytes" /> without making a defensive copy; otherwise, <see langword="false" />. The default is <see langword="false" />.</param>
/// <returns>An object view of the PKCS#12 PFX decoded from the input.</returns>
/// <exception cref="T:System.Security.Cryptography.CryptographicException">The contents of the <paramref name="encodedBytes" /> parameter were not successfully decoded as a PKCS#12 PFX.</exception>
public static Pkcs12Info Decode (ReadOnlyMemory<byte> encodedBytes, out int bytesConsumed, bool skipCopy = false) {
throw new PlatformNotSupportedException ();
}
/// <summary>Attempts to verify the integrity of the <see cref="P:System.Security.Cryptography.Pkcs.Pkcs12Info.AuthenticatedSafe" /> contents with a password represented by a <see cref="System.ReadOnlySpan{System.Char}" />.</summary>
/// <param name="password">The password to use to attempt to verify integrity.</param>
/// <returns>
/// <see langword="true" /> if the password successfully verifies the integrity of the <see cref="P:System.Security.Cryptography.Pkcs.Pkcs12Info.AuthenticatedSafe" /> contents; <see langword="false" /> if the password is not correct or the contents have been altered.</returns>
/// <exception cref="T:System.InvalidOperationException">The <see cref="P:System.Security.Cryptography.Pkcs.Pkcs12Info.IntegrityMode" /> value is not <see cref="F:System.Security.Cryptography.Pkcs.Pkcs12IntegrityMode.Password" />.</exception>
/// <exception cref="T:System.Security.Cryptography.CryptographicException">The hash algorithm option specified by the PKCS#12 PFX contents could not be identified or is not supported by this platform.</exception>
public bool VerifyMac (ReadOnlySpan<char> password) {
throw new PlatformNotSupportedException ();
}
/// <summary>Attempts to verify the integrity of the <see cref="P:System.Security.Cryptography.Pkcs.Pkcs12Info.AuthenticatedSafe" /> contents with a password represented by a <see cref="T:System.String" />.</summary>
/// <param name="password">The password to use to attempt to verify integrity.</param>
/// <returns>
/// <see langword="true" /> if the password successfully verifies the integrity of the <see cref="P:System.Security.Cryptography.Pkcs.Pkcs12Info.AuthenticatedSafe" /> contents; <see langword="false" /> if the password is not correct or the contents have been altered.</returns>
/// <exception cref="T:System.InvalidOperationException">The <see cref="P:System.Security.Cryptography.Pkcs.Pkcs12Info.IntegrityMode" /> value is not <see cref="F:System.Security.Cryptography.Pkcs.Pkcs12IntegrityMode.Password" />.</exception>
/// <exception cref="T:System.Security.Cryptography.CryptographicException">The hash algorithm option specified by the PKCS#12 PFX contents could not be identified or is not supported by this platform.</exception>
public bool VerifyMac (string password) {
throw new PlatformNotSupportedException ();
}
}
}
@@ -0,0 +1,13 @@
namespace System.Security.Cryptography.Pkcs {
/// <summary>Represents the type of anti-tampering applied to a PKCS#12 PFX value.</summary>
public enum Pkcs12IntegrityMode {
/// <summary>The PKCS#12 PFX value is not protected from tampering.</summary>
None = 1,
/// <summary>The PKCS#12 PFX value is protected from tampering with a Message Authentication Code (MAC) keyed with a password.</summary>
Password = 2,
/// <summary>The PKCS#12 PFX value is protected from tampering with a digital signature using public key cryptography.</summary>
PublicKey = 3,
/// <summary>The type of anti-tampering applied to the PKCS#12 PFX is unknown or could not be determined.</summary>
Unknown = 0
}
}
@@ -0,0 +1,25 @@
using System;
using System.Security.Cryptography.Pkcs;
namespace System.Security.Cryptography.Pkcs {
/// <summary>Represents the KeyBag from PKCS#12, a container whose contents are a PKCS#8 PrivateKeyInfo. This class cannot be inherited.</summary>
public sealed class Pkcs12KeyBag : Pkcs12SafeBag {
/// <summary>Gets a memory value containing the PKCS#8 PrivateKeyInfo value transported by this bag.</summary>
/// <returns>A memory value containing the PKCS#8 PrivateKeyInfo value transported by this bag.</returns>
public ReadOnlyMemory<byte> Pkcs8PrivateKey {
get {
throw new PlatformNotSupportedException ();
}
}
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.Pkcs.Pkcs12KeyBag" /> from an existing encoded PKCS#8 PrivateKeyInfo value.</summary>
/// <param name="pkcs8PrivateKey">A BER-encoded PKCS#8 PrivateKeyInfo value.</param>
/// <param name="skipCopy">
/// <see langword="true" /> to store <paramref name="pkcs8PrivateKey" /> without making a defensive copy; otherwise, <see langword="false" />. The default is <see langword="false" />.</param>
/// <exception cref="T:System.Security.Cryptography.CryptographicException">The <paramref name="pkcs8privateKey" /> parameter does not represent a single ASN.1 BER-encoded value.</exception>
public Pkcs12KeyBag (ReadOnlyMemory<byte> pkcs8PrivateKey, bool skipCopy = false)
: base (null, default(ReadOnlyMemory<byte>)) {
throw new PlatformNotSupportedException ();
}
}
}
@@ -0,0 +1,57 @@
using System;
using System.Security.Cryptography;
namespace System.Security.Cryptography.Pkcs {
/// <summary>Defines the core behavior of a SafeBag value from the PKCS#12 specification and provides a base for derived classes.</summary>
public abstract class Pkcs12SafeBag {
/// <summary>Gets the modifiable collection of attributes to encode with the SafeBag value.</summary>
/// <returns>The modifiable collection of attributes to encode with the SafeBag value.</returns>
public CryptographicAttributeObjectCollection Attributes {
get {
throw new PlatformNotSupportedException ();
}
}
/// <summary>Gets the ASN.1 BER encoding of the contents of this SafeBag.</summary>
/// <returns>The ASN.1 BER encoding of the contents of this SafeBag.</returns>
public ReadOnlyMemory<byte> EncodedBagValue {
get {
throw new PlatformNotSupportedException ();
}
}
/// <summary>Called from constructors in derived classes to initialize the <see cref="T:System.Security.Cryptography.Pkcs.Pkcs12SafeBag" /> class.</summary>
/// <param name="bagIdValue">The Object Identifier (OID), in dotted decimal form, indicating the data type of this SafeBag.</param>
/// <param name="encodedBagValue">The ASN.1 BER encoded value of the SafeBag contents.</param>
/// <param name="skipCopy">
/// <see langword="true" /> to store <paramref name="encodedBagValue" /> without making a defensive copy; otherwise, <see langword="false" />. The default is <see langword="false" />.</param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="bagIdValue" /> parameter is <see langword="null" /> or the empty string.</exception>
/// <exception cref="T:System.Security.Cryptography.CryptographicException">The <paramref name="encodedBagValue" /> parameter does not represent a single ASN.1 BER-encoded value.</exception>
protected Pkcs12SafeBag (string bagIdValue, ReadOnlyMemory<byte> encodedBagValue, bool skipCopy = false) {
throw new PlatformNotSupportedException ();
}
/// <summary>Encodes the SafeBag value and returns it as a byte array.</summary>
/// <returns>A byte array representing the encoded form of the SafeBag.</returns>
/// <exception cref="T:System.Security.Cryptography.CryptographicException">The object identifier value passed to the constructor was invalid.</exception>
public byte[] Encode () {
throw new PlatformNotSupportedException ();
}
/// <summary>Gets the Object Identifier (OID) identifying the content type of this SafeBag.</summary>
/// <returns>The Object Identifier (OID) identifying the content type of this SafeBag.</returns>
public Oid GetBagId () {
throw new PlatformNotSupportedException ();
}
/// <summary>Attempts to encode the SafeBag value into a provided buffer.</summary>
/// <param name="destination">The byte span to receive the encoded SafeBag value.</param>
/// <param name="bytesWritten">When this method returns, contains a value that indicates the number of bytes written to <paramref name="destination" />. This parameter is treated as uninitialized.</param>
/// <returns>
/// <see langword="true" /> if <paramref name="destination" /> is big enough to receive the output; otherwise, <see langword="false" />.</returns>
/// <exception cref="T:System.Security.Cryptography.CryptographicException">The object identifier value passed to the constructor was invalid.</exception>
public bool TryEncode (Span<byte> destination, out int bytesWritten) {
throw new PlatformNotSupportedException ();
}
}
}
@@ -0,0 +1,171 @@
using System;
using System.Collections.Generic;
using System.Security.Cryptography;
using System.Security.Cryptography.Pkcs;
using System.Security.Cryptography.X509Certificates;
namespace System.Security.Cryptography.Pkcs {
/// <summary>Represents a PKCS#12 SafeContents value. This class cannot be inherited.</summary>
public sealed class Pkcs12SafeContents {
/// <summary>Gets a value that indicates the type of encryption applied to the contents.</summary>
/// <returns>One of the enumeration values that indicates the type of encryption applied to the contents. The default value is <see cref="F:System.Security.Cryptography.Pkcs.Pkcs12ConfidentialityMode.None" />.</returns>
public Pkcs12ConfidentialityMode ConfidentialityMode {
get {
throw new PlatformNotSupportedException ();
}
}
/// <summary>Gets a value that indicates whether this instance in a read-only state.</summary>
/// <returns>
/// <see langword="true" /> if this value is in a read-only state; otherwise, <see langword="false" />. The default value is <see langword="false" />.</returns>
public bool IsReadOnly {
get {
throw new PlatformNotSupportedException ();
}
}
/// <summary>Adds a certificate to the SafeContents via a new <see cref="T:System.Security.Cryptography.Pkcs.Pkcs12CertBag" /> and returns the newly created bag instance.</summary>
/// <param name="certificate">The certificate to add.</param>
/// <returns>The bag instance which was added to the SafeContents.</returns>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="certificate" /> parameter is <see langword="null" />.</exception>
/// <exception cref="T:System.InvalidOperationException">This instance is read-only.</exception>
/// <exception cref="T:System.Security.Cryptography.CryptographicException">The <paramref name="certificate" /> parameter is in an invalid state.</exception>
public Pkcs12CertBag AddCertificate (X509Certificate2 certificate) {
throw new PlatformNotSupportedException ();
}
/// <summary>Adds an asymmetric private key to the SafeContents via a new <see cref="T:System.Security.Cryptography.Pkcs.Pkcs12KeyBag" /> and returns the newly created bag instance.</summary>
/// <param name="key">The asymmetric private key to add.</param>
/// <returns>The bag instance which was added to the SafeContents.</returns>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="key" /> parameter is <see langword="null" />.</exception>
/// <exception cref="T:System.InvalidOperationException">This instance is read-only.</exception>
/// <exception cref="T:System.Security.Cryptography.CryptographicException">The key export failed.</exception>
public Pkcs12KeyBag AddKeyUnencrypted (AsymmetricAlgorithm key) {
throw new PlatformNotSupportedException ();
}
/// <summary>Adds a nested SafeContents to the SafeContents via a new <see cref="T:System.Security.Cryptography.Pkcs.Pkcs12SafeContentsBag" /> and returns the newly created bag instance.</summary>
/// <param name="safeContents">The nested contents to add to the SafeContents.</param>
/// <returns>The bag instance which was added to the SafeContents.</returns>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="safeContents" /> parameter is <see langword="null" />.</exception>
/// <exception cref="T:System.ArgumentException">The <paramref name="safeContents" /> parameter is encrypted.</exception>
/// <exception cref="T:System.InvalidOperationException">This instance is read-only.</exception>
public Pkcs12SafeContentsBag AddNestedContents (Pkcs12SafeContents safeContents) {
throw new PlatformNotSupportedException ();
}
/// <summary>Adds a SafeBag to the SafeContents.</summary>
/// <param name="safeBag">The SafeBag value to add.</param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="safeBag" /> parameter is <see langword="null" />.</exception>
/// <exception cref="T:System.InvalidOperationException">This instance is read-only.</exception>
public void AddSafeBag (Pkcs12SafeBag safeBag) {
throw new PlatformNotSupportedException ();
}
/// <summary>Adds an ASN.1 BER-encoded value with a specified type identifier to the SafeContents via a new <see cref="T:System.Security.Cryptography.Pkcs.Pkcs12SecretBag" /> and returns the newly created bag instance.</summary>
/// <param name="secretType">The Object Identifier (OID) which identifies the data type of the secret value.</param>
/// <param name="secretValue">The BER-encoded value representing the secret to add.</param>
/// <returns>The bag instance which was added to the SafeContents.</returns>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="secretType" /> parameter is <see langword="null" />.</exception>
/// <exception cref="T:System.InvalidOperationException">This instance is read-only.</exception>
/// <exception cref="T:System.Security.Cryptography.CryptographicException">The <paramref name="secretValue" /> parameter does not represent a single ASN.1 BER-encoded value.</exception>
public Pkcs12SecretBag AddSecret (Oid secretType, ReadOnlyMemory<byte> secretValue) {
throw new PlatformNotSupportedException ();
}
/// <summary>Adds an encrypted asymmetric private key to the SafeContents via a new <see cref="T:System.Security.Cryptography.Pkcs.Pkcs12ShroudedKeyBag" /> from a byte-based password in an array and returns the newly created bag instance.</summary>
/// <param name="key">The asymmetric private key to add.</param>
/// <param name="passwordBytes">The bytes to use as a password when encrypting the key material.</param>
/// <param name="pbeParameters">The password-based encryption (PBE) parameters to use when encrypting the key material.</param>
/// <returns>The bag instance which was added to the SafeContents.</returns>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="key" /> parameter is <see langword="null" />.</exception>
/// <exception cref="T:System.InvalidOperationException">This instance is read-only.</exception>
/// <exception cref="T:System.Security.Cryptography.CryptographicException">The key export failed.</exception>
public Pkcs12ShroudedKeyBag AddShroudedKey (AsymmetricAlgorithm key, byte[] passwordBytes, PbeParameters pbeParameters) {
throw new PlatformNotSupportedException ();
}
/// <summary>Adds an encrypted asymmetric private key to the SafeContents via a new <see cref="T:System.Security.Cryptography.Pkcs.Pkcs12ShroudedKeyBag" /> from a byte-based password in a span and returns the newly created bag instance.</summary>
/// <param name="key">The asymmetric private key to add.</param>
/// <param name="passwordBytes">The bytes to use as a password when encrypting the key material.</param>
/// <param name="pbeParameters">The password-based encryption (PBE) parameters to use when encrypting the key material.</param>
/// <returns>The bag instance which was added to the SafeContents.</returns>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="key" /> parameter is <see langword="null" />.</exception>
/// <exception cref="T:System.InvalidOperationException">This instance is read-only.</exception>
/// <exception cref="T:System.Security.Cryptography.CryptographicException">The key export failed.</exception>
public Pkcs12ShroudedKeyBag AddShroudedKey (AsymmetricAlgorithm key, ReadOnlySpan<byte> passwordBytes, PbeParameters pbeParameters) {
throw new PlatformNotSupportedException ();
}
/// <summary>Adds an encrypted asymmetric private key to the SafeContents via a new <see cref="T:System.Security.Cryptography.Pkcs.Pkcs12ShroudedKeyBag" /> from a character-based password in a span and returns the newly created bag instance.</summary>
/// <param name="key">The asymmetric private key to add.</param>
/// <param name="password">The password to use when encrypting the key material.</param>
/// <param name="pbeParameters">The password-based encryption (PBE) parameters to use when encrypting the key material.</param>
/// <returns>The bag instance which was added to the SafeContents.</returns>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="key" /> parameter is <see langword="null" />.</exception>
/// <exception cref="T:System.InvalidOperationException">This instance is read-only.</exception>
/// <exception cref="T:System.Security.Cryptography.CryptographicException">The key export failed.</exception>
public Pkcs12ShroudedKeyBag AddShroudedKey (AsymmetricAlgorithm key, ReadOnlySpan<char> password, PbeParameters pbeParameters) {
throw new PlatformNotSupportedException ();
}
/// <summary>Adds an encrypted asymmetric private key to the SafeContents via a new <see cref="T:System.Security.Cryptography.Pkcs.Pkcs12ShroudedKeyBag" /> from a character-based password in a string and returns the newly created bag instance.</summary>
/// <param name="key">The asymmetric private key to add.</param>
/// <param name="password">The password to use when encrypting the key material.</param>
/// <param name="pbeParameters">The password-based encryption (PBE) parameters to use when encrypting the key material.</param>
/// <returns>The bag instance which was added to the SafeContents.</returns>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="key" /> parameter is <see langword="null" />.</exception>
/// <exception cref="T:System.InvalidOperationException">This instance is read-only.</exception>
/// <exception cref="T:System.Security.Cryptography.CryptographicException">The key export failed.</exception>
public Pkcs12ShroudedKeyBag AddShroudedKey (AsymmetricAlgorithm key, string password, PbeParameters pbeParameters) {
throw new PlatformNotSupportedException ();
}
/// <summary>Decrypts the contents of this SafeContents value using a byte-based password from an array.</summary>
/// <param name="passwordBytes">The bytes to use as a password for decrypting the encrypted contents.</param>
/// <exception cref="T:System.InvalidOperationException">The <see cref="P:System.Security.Cryptography.Pkcs.Pkcs12SafeContents.ConfidentialityMode" /> property is not <see cref="F:System.Security.Cryptography.Pkcs.Pkcs12ConfidentialityMode.Password" />.</exception>
/// <exception cref="T:System.Security.Cryptography.CryptographicException">The password is incorrect.
/// -or-
/// The contents were not successfully decrypted.</exception>
public void Decrypt (byte[] passwordBytes) {
throw new PlatformNotSupportedException ();
}
/// <summary>Decrypts the contents of this SafeContents value using a byte-based password from a span.</summary>
/// <param name="passwordBytes">The bytes to use as a password for decrypting the encrypted contents.</param>
/// <exception cref="T:System.InvalidOperationException">The <see cref="P:System.Security.Cryptography.Pkcs.Pkcs12SafeContents.ConfidentialityMode" /> property is not <see cref="F:System.Security.Cryptography.Pkcs.Pkcs12ConfidentialityMode.Password" />.</exception>
/// <exception cref="T:System.Security.Cryptography.CryptographicException">The password is incorrect.
/// -or-
/// The contents were not successfully decrypted.</exception>
public void Decrypt (ReadOnlySpan<byte> passwordBytes) {
throw new PlatformNotSupportedException ();
}
/// <summary>Decrypts the contents of this SafeContents value using a character-based password from a span.</summary>
/// <param name="password">The password to use for decrypting the encrypted contents.</param>
/// <exception cref="T:System.InvalidOperationException">The <see cref="P:System.Security.Cryptography.Pkcs.Pkcs12SafeContents.ConfidentialityMode" /> property is not <see cref="F:System.Security.Cryptography.Pkcs.Pkcs12ConfidentialityMode.Password" />.</exception>
/// <exception cref="T:System.Security.Cryptography.CryptographicException">The password is incorrect.
/// -or-
/// The contents were not successfully decrypted.</exception>
public void Decrypt (ReadOnlySpan<char> password) {
throw new PlatformNotSupportedException ();
}
/// <summary>Decrypts the contents of this SafeContents value using a character-based password from a string.</summary>
/// <param name="password">The password to use for decrypting the encrypted contents.</param>
/// <exception cref="T:System.InvalidOperationException">The <see cref="P:System.Security.Cryptography.Pkcs.Pkcs12SafeContents.ConfidentialityMode" /> property is not <see cref="F:System.Security.Cryptography.Pkcs.Pkcs12ConfidentialityMode.Password" />.</exception>
/// <exception cref="T:System.Security.Cryptography.CryptographicException">The password is incorrect.
/// -or-
/// The contents were not successfully decrypted.</exception>
public void Decrypt (string password) {
throw new PlatformNotSupportedException ();
}
/// <summary>Gets an enumerable representation of the SafeBag values contained within the SafeContents.</summary>
/// <returns>An enumerable representation of the SafeBag values contained within the SafeContents.</returns>
/// <exception cref="T:System.InvalidOperationException">The contents are encrypted.</exception>
public IEnumerable<Pkcs12SafeBag> GetBags () {
throw new PlatformNotSupportedException ();
}
}
}
@@ -0,0 +1,20 @@
using System;
using System.Security.Cryptography.Pkcs;
namespace System.Security.Cryptography.Pkcs {
/// <summary>Represents the SafeContentsBag from PKCS#12, a container whose contents are a PKCS#12 SafeContents value. This class cannot be inherited.</summary>
public sealed class Pkcs12SafeContentsBag : Pkcs12SafeBag {
/// <summary>Gets the SafeContents value contained within this bag.</summary>
/// <returns>The SafeContents value contained within this bag.</returns>
public Pkcs12SafeContents SafeContents {
get {
throw new PlatformNotSupportedException ();
}
}
internal Pkcs12SafeContentsBag ()
: base (null, default(ReadOnlyMemory<byte>)) {
throw new PlatformNotSupportedException ();
}
}
}
@@ -0,0 +1,27 @@
using System;
using System.Security.Cryptography;
using System.Security.Cryptography.Pkcs;
namespace System.Security.Cryptography.Pkcs {
/// <summary>Represents the SecretBag from PKCS#12, a container whose contents are arbitrary data with a type identifier. This class cannot be inherited.</summary>
public sealed class Pkcs12SecretBag : Pkcs12SafeBag {
/// <summary>Gets a memory value containing the BER-encoded contents of the bag.</summary>
/// <returns>A memory value containing the BER-encoded contents of the bag.</returns>
public ReadOnlyMemory<byte> SecretValue {
get {
throw new PlatformNotSupportedException ();
}
}
internal Pkcs12SecretBag ()
: base (null, default(ReadOnlyMemory<byte>)) {
throw new PlatformNotSupportedException ();
}
/// <summary>Gets the Object Identifier (OID) which identifies the data type of the secret value.</summary>
/// <returns>The Object Identifier (OID) which identifies the data type of the secret value.</returns>
public Oid GetSecretType () {
throw new PlatformNotSupportedException ();
}
}
}
@@ -0,0 +1,25 @@
using System;
using System.Security.Cryptography.Pkcs;
namespace System.Security.Cryptography.Pkcs {
/// <summary>Represents the ShroudedKeyBag from PKCS#12, a container whose contents are a PKCS#8 EncryptedPrivateKeyInfo. This class cannot be inherited.</summary>
public sealed class Pkcs12ShroudedKeyBag : Pkcs12SafeBag {
/// <summary>Gets a memory value containing the PKCS#8 EncryptedPrivateKeyInfo value transported by this bag.</summary>
/// <returns>A memory value containing the PKCS#8 EncryptedPrivateKeyInfo value transported by this bag.</returns>
public ReadOnlyMemory<byte> EncryptedPkcs8PrivateKey {
get {
throw new PlatformNotSupportedException ();
}
}
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.Pkcs.Pkcs12ShroudedKeyBag" /> from an existing encoded PKCS#8 EncryptedPrivateKeyInfo value.</summary>
/// <param name="encryptedPkcs8PrivateKey">A BER-encoded PKCS#8 EncryptedPrivateKeyInfo value.</param>
/// <param name="skipCopy">
/// <see langword="true" /> to store <paramref name="encryptedPkcs8PrivateKey" /> without making a defensive copy; otherwise, <see langword="false" />. The default is <see langword="false" />.</param>
/// <exception cref="T:System.Security.Cryptography.CryptographicException">The <paramref name="encryptedPkcs8privateKey" /> parameter does not represent a single ASN.1 BER-encoded value.</exception>
public Pkcs12ShroudedKeyBag (ReadOnlyMemory<byte> encryptedPkcs8PrivateKey, bool skipCopy = false)
: base (null, default(ReadOnlyMemory<byte>)) {
throw new PlatformNotSupportedException ();
}
}
}
@@ -0,0 +1,149 @@
using System;
using System.Security.Cryptography;
using System.Security.Cryptography.Pkcs;
namespace System.Security.Cryptography.Pkcs {
/// <summary>Enables the inspection of and creation of PKCS#8 PrivateKeyInfo and EncryptedPrivateKeyInfo values. This class cannot be inherited.</summary>
public sealed class Pkcs8PrivateKeyInfo {
/// <summary>Gets the Object Identifier (OID) value identifying the algorithm this key is for.</summary>
/// <returns>The Object Identifier (OID) value identifying the algorithm this key is for.</returns>
public Oid AlgorithmId {
get {
throw new PlatformNotSupportedException ();
}
}
/// <summary>Gets a memory value containing the BER-encoded algorithm parameters associated with this key.</summary>
/// <returns>A memory value containing the BER-encoded algorithm parameters associated with this key, or <see langword="null" /> if no parameters were present.</returns>
public ReadOnlyMemory<byte>? AlgorithmParameters {
get {
throw new PlatformNotSupportedException ();
}
}
/// <summary>Gets the modifiable collection of attributes for this private key.</summary>
/// <returns>The modifiable collection of attributes to encode with the private key.</returns>
public CryptographicAttributeObjectCollection Attributes {
get {
throw new PlatformNotSupportedException ();
}
}
/// <summary>Gets a memory value that represents the algorithm-specific encoded private key.</summary>
/// <returns>A memory value that represents the algorithm-specific encoded private key.</returns>
public ReadOnlyMemory<byte> PrivateKeyBytes {
get {
throw new PlatformNotSupportedException ();
}
}
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.Pkcs.Pkcs8PrivateKeyInfo" /> class.</summary>
/// <param name="algorithmId">The Object Identifier (OID) identifying the asymmetric algorithm this key is for.</param>
/// <param name="algorithmParameters">The BER-encoded algorithm parameters associated with this key, or <see langword="null" /> to omit algorithm parameters when encoding.</param>
/// <param name="privateKey">The algorithm-specific encoded private key.</param>
/// <param name="skipCopies">
/// <see langword="true" /> to store <paramref name="algorithmParameters" /> and <paramref name="privateKey" /> without making a defensive copy; otherwise, <see langword="false" />. The default is <see langword="false" />.</param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="algorithmId" /> parameter is <see langword="null" />.</exception>
/// <exception cref="T:System.Security.Cryptography.CryptographicException">The <paramref name="algorithmParameters" /> parameter is not <see langword="null" />, empty, or a single BER-encoded value.</exception>
public Pkcs8PrivateKeyInfo (Oid algorithmId, ReadOnlyMemory<byte>? algorithmParameters, ReadOnlyMemory<byte> privateKey, bool skipCopies = false) {
throw new PlatformNotSupportedException ();
}
/// <summary>Exports a specified key as a PKCS#8 PrivateKeyInfo and returns its decoded interpretation.</summary>
/// <param name="privateKey">The private key to represent in a PKCS#8 PrivateKeyInfo.</param>
/// <returns>The decoded interpretation of the exported PKCS#8 PrivateKeyInfo.</returns>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="privateKey" /> parameter is <see langword="null" />.</exception>
public static Pkcs8PrivateKeyInfo Create (AsymmetricAlgorithm privateKey) {
throw new PlatformNotSupportedException ();
}
/// <summary>Reads the provided data as a PKCS#8 PrivateKeyInfo and returns an object view of the contents.</summary>
/// <param name="source">The data to interpret as a PKCS#8 PrivateKeyInfo value.</param>
/// <param name="bytesRead">When this method returns, contains a value that indicates the number of bytes read from <paramref name="source" />. This parameter is treated as uninitialized.</param>
/// <param name="skipCopy">
/// <see langword="true" /> to store <paramref name="source" /> without making a defensive copy; otherwise, <see langword="false" />. The default is <see langword="false" />.</param>
/// <returns>An object view of the contents decoded as a PKCS#8 PrivateKeyInfo.</returns>
/// <exception cref="T:System.Security.Cryptography.CryptographicException">The contents of the <paramref name="source" /> parameter were not successfully decoded as a PKCS#8 PrivateKeyInfo.</exception>
public static Pkcs8PrivateKeyInfo Decode (ReadOnlyMemory<byte> source, out int bytesRead, bool skipCopy = false) {
throw new PlatformNotSupportedException ();
}
/// <summary>Decrypts the provided data using the provided byte-based password and decodes the output into an object view of the PKCS#8 PrivateKeyInfo.</summary>
/// <param name="passwordBytes">The bytes to use as a password when decrypting the key material.</param>
/// <param name="source">The data to read as a PKCS#8 EncryptedPrivateKeyInfo structure in the ASN.1-BER encoding.</param>
/// <param name="bytesRead">When this method returns, contains a value that indicates the number of bytes read from <paramref name="source" />. This parameter is treated as uninitialized.</param>
/// <returns>An object view of the contents decrypted decoded as a PKCS#8 PrivateKeyInfo.</returns>
/// <exception cref="T:System.Security.Cryptography.CryptographicException">The password is incorrect.
/// -or-
/// The contents of <paramref name="source" /> indicate the Key Derivation Function (KDF) to apply is the legacy PKCS#12 KDF, which requires <see cref="T:System.Char" />-based passwords.
/// -or-
/// The contents of <paramref name="source" /> do not represent an ASN.1-BER-encoded PKCS#8 EncryptedPrivateKeyInfo structure.</exception>
public static Pkcs8PrivateKeyInfo DecryptAndDecode (ReadOnlySpan<byte> passwordBytes, ReadOnlyMemory<byte> source, out int bytesRead) {
throw new PlatformNotSupportedException ();
}
/// <summary>Decrypts the provided data using the provided character-based password and decodes the output into an object view of the PKCS#8 PrivateKeyInfo.</summary>
/// <param name="password">The password to use when decrypting the key material.</param>
/// <param name="source">The bytes of a PKCS#8 EncryptedPrivateKeyInfo structure in the ASN.1-BER encoding.</param>
/// <param name="bytesRead">When this method returns, contains a value that indicates the number of bytes read from <paramref name="source" />. This parameter is treated as uninitialized.</param>
/// <returns>An object view of the contents decrypted decoded as a PKCS#8 PrivateKeyInfo.</returns>
public static Pkcs8PrivateKeyInfo DecryptAndDecode (ReadOnlySpan<char> password, ReadOnlyMemory<byte> source, out int bytesRead) {
throw new PlatformNotSupportedException ();
}
/// <summary>Encodes the property data of this instance as a PKCS#8 PrivateKeyInfo and returns the encoding as a byte array.</summary>
/// <returns>A byte array representing the encoded form of the PKCS#8 PrivateKeyInfo.</returns>
public byte[] Encode () {
throw new PlatformNotSupportedException();
}
/// <summary>Produces a PKCS#8 EncryptedPrivateKeyInfo from the property contents of this object after encrypting with the specified byte-based password and encryption parameters.</summary>
/// <param name="passwordBytes">The bytes to use as a password when encrypting the key material.</param>
/// <param name="pbeParameters">The password-based encryption (PBE) parameters to use when encrypting the key material.</param>
/// <returns>A byte array containing the encoded form of the PKCS#8 EncryptedPrivateKeyInfo.</returns>
/// <exception cref="T:System.Security.Cryptography.CryptographicException">
/// <paramref name="pbeParameters" /> indicates that <see cref="F:System.Security.Cryptography.PbeEncryptionAlgorithm.TripleDes3KeyPkcs12" /> should be used, which requires <see cref="T:System.Char" />-based passwords.</exception>
public byte[] Encrypt (ReadOnlySpan<byte> passwordBytes, PbeParameters pbeParameters) {
throw new PlatformNotSupportedException ();
}
/// <summary>Produces a PKCS#8 EncryptedPrivateKeyInfo from the property contents of this object after encrypting with the specified character-based password and encryption parameters.</summary>
/// <param name="password">The password to use when encrypting the key material.</param>
/// <param name="pbeParameters">The password-based encryption (PBE) parameters to use when encrypting the key material.</param>
/// <returns>A byte array containing the encoded form of the PKCS#8 EncryptedPrivateKeyInfo.</returns>
public byte[] Encrypt (ReadOnlySpan<char> password, PbeParameters pbeParameters) {
throw new PlatformNotSupportedException ();
}
/// <summary>Attempts to encode the property data of this instance as a PKCS#8 PrivateKeyInfo, writing the results into a provided buffer.</summary>
/// <param name="destination">The byte span to receive the PKCS#8 PrivateKeyInfo data.</param>
/// <param name="bytesWritten">When this method returns, contains a value that indicates the number of bytes written to <paramref name="destination" />. This parameter is treated as uninitialized.</param>
/// <returns>
/// <see langword="true" /> if <paramref name="destination" /> is big enough to receive the output; otherwise, <see langword="false" />.</returns>
public bool TryEncode (Span<byte> destination, out int bytesWritten) {
throw new PlatformNotSupportedException ();
}
/// <summary>Attempts to produce a PKCS#8 EncryptedPrivateKeyInfo from the property contents of this object after encrypting with the specified byte-based password and encryption parameters, writing the results into a provided buffer.</summary>
/// <param name="passwordBytes">The bytes to use as a password when encrypting the key material.</param>
/// <param name="pbeParameters">The password-based encryption (PBE) parameters to use when encrypting the key material.</param>
/// <param name="destination">The byte span to receive the PKCS#8 EncryptedPrivateKeyInfo data.</param>
/// <param name="bytesWritten">When this method returns, contains a value that indicates the number of bytes written to <paramref name="destination" />. This parameter is treated as uninitialized.</param>
/// <returns>
/// <see langword="true" /> if <paramref name="destination" /> is big enough to receive the output; otherwise, <see langword="false" />.</returns>
public bool TryEncrypt (ReadOnlySpan<byte> passwordBytes, PbeParameters pbeParameters, Span<byte> destination, out int bytesWritten) {
throw new PlatformNotSupportedException ();
}
/// <summary>Attempts to produce a PKCS#8 EncryptedPrivateKeyInfo from the property contents of this object after encrypting with the specified character-based password and encryption parameters, writing the result into a provided buffer.</summary>
/// <param name="password">The password to use when encrypting the key material.</param>
/// <param name="pbeParameters">The password-based encryption (PBE) parameters to use when encrypting the key material.</param>
/// <param name="destination">The byte span to receive the PKCS#8 EncryptedPrivateKeyInfo data.</param>
/// <param name="bytesWritten">When this method returns, contains a value that indicates the number of bytes written to <paramref name="destination" />. This parameter is treated as uninitialized.</param>
/// <returns>
/// <see langword="true" /> if <paramref name="destination" /> is big enough to receive the output; otherwise, <see langword="false" />.</returns>
public bool TryEncrypt (ReadOnlySpan<char> password, PbeParameters pbeParameters, Span<byte> destination, out int bytesWritten) {
throw new PlatformNotSupportedException ();
}
}
}
@@ -0,0 +1,32 @@
using System;
using System.Security.Cryptography.Pkcs;
namespace System.Security.Cryptography.Pkcs {
/// <summary>Represents the LocalKeyId attribute from PKCS#9.</summary>
public sealed class Pkcs9LocalKeyId : Pkcs9AttributeObject {
/// <summary>Gets a memory value containing the key identifier from this attribute.</summary>
/// <returns>A memory value containing the key identifier from this attribute.</returns>
public ReadOnlyMemory<byte> KeyId {
get {
throw new PlatformNotSupportedException ();
}
}
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.Pkcs.Pkcs9LocalKeyId" /> class with an empty key identifier value.</summary>
public Pkcs9LocalKeyId () {
throw new PlatformNotSupportedException ();
}
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.Pkcs.Pkcs9LocalKeyId" /> class with a key identifier specified by a byte array.</summary>
/// <param name="keyId">A byte array containing the key identifier.</param>
public Pkcs9LocalKeyId (byte[] keyId) {
throw new PlatformNotSupportedException ();
}
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.Pkcs.Pkcs9LocalKeyId" /> class with a key identifier specified by a byte span.</summary>
/// <param name="keyId">A byte array containing the key identifier.</param>
public Pkcs9LocalKeyId (ReadOnlySpan<byte> keyId) {
throw new PlatformNotSupportedException ();
}
}
}
@@ -0,0 +1,120 @@
using System;
using System.Security.Cryptography;
using System.Security.Cryptography.Pkcs;
using System.Security.Cryptography.X509Certificates;
namespace System.Security.Cryptography.Pkcs {
public sealed class Rfc3161TimestampRequest {
public bool HasExtensions {
get {
throw new PlatformNotSupportedException ();
}
}
public Oid HashAlgorithmId {
get {
throw new PlatformNotSupportedException ();
}
}
public Oid RequestedPolicyId {
get {
throw new PlatformNotSupportedException ();
}
}
public bool RequestSignerCertificate {
get {
throw new PlatformNotSupportedException ();
}
}
public int Version {
get {
throw new PlatformNotSupportedException ();
}
}
internal Rfc3161TimestampRequest () {
throw new PlatformNotSupportedException ();
}
/// <param name="data" />
/// <param name="hashAlgorithm" />
/// <param name="requestedPolicyId" />
/// <param name="nonce" />
/// <param name="requestSignerCertificates" />
/// <param name="extensions" />
public static Rfc3161TimestampRequest CreateFromData (ReadOnlySpan<byte> data, HashAlgorithmName hashAlgorithm, Oid requestedPolicyId = null, ReadOnlyMemory<byte>? nonce = default(ReadOnlyMemory<byte>?), bool requestSignerCertificates = false, X509ExtensionCollection extensions = null) {
throw new PlatformNotSupportedException ();
}
/// <param name="hash" />
/// <param name="hashAlgorithm" />
/// <param name="requestedPolicyId" />
/// <param name="nonce" />
/// <param name="requestSignerCertificates" />
/// <param name="extensions" />
public static Rfc3161TimestampRequest CreateFromHash (ReadOnlyMemory<byte> hash, HashAlgorithmName hashAlgorithm, Oid requestedPolicyId = null, ReadOnlyMemory<byte>? nonce = default(ReadOnlyMemory<byte>?), bool requestSignerCertificates = false, X509ExtensionCollection extensions = null) {
throw new PlatformNotSupportedException ();
}
/// <summary>Create a timestamp request using a pre-computed hash value.</summary>
/// <param name="hash">The pre-computed hash value to be timestamped.</param>
/// <param name="hashAlgorithmId">The Object Identifier (OID) for the hash algorithm that produced <paramref name="hash" />.</param>
/// <param name="requestedPolicyId">The Object Identifier (OID) for a timestamp policy the Timestamp Authority (TSA) should use, or <see langword="null" /> to express no preference.</param>
/// <param name="nonce">An optional nonce (number used once) to uniquely identify this request to pair it with the response. The value is interpreted as an unsigned big-endian integer and may be normalized to the encoding format.</param>
/// <param name="requestSignerCertificates">
/// <see langword="true" /> to indicate the Timestamp Authority (TSA) must include the signing certificate in the issued timestamp token; otherwise, <see langword="false" />.</param>
/// <param name="extensions">RFC3161 extensions to present with the request.</param>
/// <returns>An <see cref="T:System.Security.Cryptography.Pkcs.Rfc3161TimestampRequest" /> representing the chosen values.</returns>
public static Rfc3161TimestampRequest CreateFromHash (ReadOnlyMemory<byte> hash, Oid hashAlgorithmId, Oid requestedPolicyId = null, ReadOnlyMemory<byte>? nonce = default(ReadOnlyMemory<byte>?), bool requestSignerCertificates = false, X509ExtensionCollection extensions = null) {
throw new PlatformNotSupportedException ();
}
/// <param name="signerInfo" />
/// <param name="hashAlgorithm" />
/// <param name="requestedPolicyId" />
/// <param name="nonce" />
/// <param name="requestSignerCertificates" />
/// <param name="extensions" />
public static Rfc3161TimestampRequest CreateFromSignerInfo (SignerInfo signerInfo, HashAlgorithmName hashAlgorithm, Oid requestedPolicyId = null, ReadOnlyMemory<byte>? nonce = default(ReadOnlyMemory<byte>?), bool requestSignerCertificates = false, X509ExtensionCollection extensions = null) {
throw new PlatformNotSupportedException ();
}
public byte[] Encode () {
throw new PlatformNotSupportedException ();
}
public X509ExtensionCollection GetExtensions () {
throw new PlatformNotSupportedException ();
}
public ReadOnlyMemory<byte> GetMessageHash () {
throw new PlatformNotSupportedException ();
}
public ReadOnlyMemory<byte>? GetNonce () {
throw new PlatformNotSupportedException ();
}
/// <param name="responseBytes" />
/// <param name="bytesConsumed" />
public Rfc3161TimestampToken ProcessResponse (ReadOnlyMemory<byte> responseBytes, out int bytesConsumed) {
throw new PlatformNotSupportedException ();
}
/// <param name="encodedBytes" />
/// <param name="request" />
/// <param name="bytesConsumed" />
public static bool TryDecode (ReadOnlyMemory<byte> encodedBytes, out Rfc3161TimestampRequest request, out int bytesConsumed) {
throw new PlatformNotSupportedException ();
}
/// <param name="destination" />
/// <param name="bytesWritten" />
public bool TryEncode (Span<byte> destination, out int bytesWritten) {
throw new PlatformNotSupportedException ();
}
}
}
@@ -0,0 +1,61 @@
using System;
using System.Security.Cryptography;
using System.Security.Cryptography.Pkcs;
using System.Security.Cryptography.X509Certificates;
namespace System.Security.Cryptography.Pkcs {
public sealed class Rfc3161TimestampToken {
public Rfc3161TimestampTokenInfo TokenInfo {
get {
throw new PlatformNotSupportedException ();
}
}
internal Rfc3161TimestampToken () {
throw new PlatformNotSupportedException ();
}
/// <summary>Gets a Signed Cryptographic Message Syntax (CMS) representation of the RFC3161 timestamp token.</summary>
/// <returns>The <see cref="T:System.Security.Cryptography.Pkcs.SignedCms" /> representation of the <see cref="T:System.Security.Cryptography.Pkcs.Rfc3161TimestampToken" />.</returns>
public SignedCms AsSignedCms () {
throw new PlatformNotSupportedException ();
}
/// <param name="encodedBytes" />
/// <param name="token" />
/// <param name="bytesConsumed" />
public static bool TryDecode (ReadOnlyMemory<byte> encodedBytes, out Rfc3161TimestampToken token, out int bytesConsumed) {
throw new PlatformNotSupportedException ();
}
/// <param name="data" />
/// <param name="signerCertificate" />
/// <param name="extraCandidates" />
public bool VerifySignatureForData (ReadOnlySpan<byte> data, out X509Certificate2 signerCertificate, X509Certificate2Collection extraCandidates = null) {
throw new PlatformNotSupportedException ();
}
/// <param name="hash" />
/// <param name="hashAlgorithm" />
/// <param name="signerCertificate" />
/// <param name="extraCandidates" />
public bool VerifySignatureForHash (ReadOnlySpan<byte> hash, HashAlgorithmName hashAlgorithm, out X509Certificate2 signerCertificate, X509Certificate2Collection extraCandidates = null) {
throw new PlatformNotSupportedException ();
}
/// <param name="hash" />
/// <param name="hashAlgorithmId" />
/// <param name="signerCertificate" />
/// <param name="extraCandidates" />
public bool VerifySignatureForHash (ReadOnlySpan<byte> hash, Oid hashAlgorithmId, out X509Certificate2 signerCertificate, X509Certificate2Collection extraCandidates = null) {
throw new PlatformNotSupportedException ();
}
/// <param name="signerInfo" />
/// <param name="signerCertificate" />
/// <param name="extraCandidates" />
public bool VerifySignatureForSignerInfo (SignerInfo signerInfo, out X509Certificate2 signerCertificate, X509Certificate2Collection extraCandidates = null) {
throw new PlatformNotSupportedException ();
}
}
}
@@ -0,0 +1,101 @@
using System;
using System.Security.Cryptography;
using System.Security.Cryptography.Pkcs;
using System.Security.Cryptography.X509Certificates;
namespace System.Security.Cryptography.Pkcs {
public sealed class Rfc3161TimestampTokenInfo {
public long? AccuracyInMicroseconds {
get {
throw new PlatformNotSupportedException ();
}
}
public bool HasExtensions {
get {
throw new PlatformNotSupportedException ();
}
}
public Oid HashAlgorithmId {
get {
throw new PlatformNotSupportedException ();
}
}
public bool IsOrdering {
get {
throw new PlatformNotSupportedException ();
}
}
public Oid PolicyId {
get {
throw new PlatformNotSupportedException ();
}
}
public DateTimeOffset Timestamp {
get {
throw new PlatformNotSupportedException ();
}
}
public int Version {
get {
throw new PlatformNotSupportedException ();
}
}
/// <param name="policyId" />
/// <param name="hashAlgorithmId" />
/// <param name="messageHash" />
/// <param name="serialNumber" />
/// <param name="timestamp" />
/// <param name="accuracyInMicroseconds" />
/// <param name="isOrdering" />
/// <param name="nonce" />
/// <param name="timestampAuthorityName" />
/// <param name="extensions" />
public Rfc3161TimestampTokenInfo (Oid policyId, Oid hashAlgorithmId, ReadOnlyMemory<byte> messageHash, ReadOnlyMemory<byte> serialNumber, DateTimeOffset timestamp, long? accuracyInMicroseconds = default(long?), bool isOrdering = false, ReadOnlyMemory<byte>? nonce = default(ReadOnlyMemory<byte>?), ReadOnlyMemory<byte>? timestampAuthorityName = default(ReadOnlyMemory<byte>?), X509ExtensionCollection extensions = null) {
throw new PlatformNotSupportedException ();
}
public byte[] Encode () {
throw new PlatformNotSupportedException ();
}
public X509ExtensionCollection GetExtensions () {
throw new PlatformNotSupportedException ();
}
public ReadOnlyMemory<byte> GetMessageHash () {
throw new PlatformNotSupportedException ();
}
public ReadOnlyMemory<byte>? GetNonce () {
throw new PlatformNotSupportedException ();
}
public ReadOnlyMemory<byte> GetSerialNumber () {
throw new PlatformNotSupportedException ();
}
public ReadOnlyMemory<byte>? GetTimestampAuthorityName () {
throw new PlatformNotSupportedException ();
}
/// <param name="encodedBytes" />
/// <param name="timestampTokenInfo" />
/// <param name="bytesConsumed" />
public static bool TryDecode (ReadOnlyMemory<byte> encodedBytes, out Rfc3161TimestampTokenInfo timestampTokenInfo, out int bytesConsumed) {
throw new PlatformNotSupportedException ();
}
/// <param name="destination" />
/// <param name="bytesWritten" />
public bool TryEncode (Span<byte> destination, out int bytesWritten) {
throw new PlatformNotSupportedException ();
}
}
}
@@ -211,6 +211,22 @@
<Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.ProtectedData\src\System\Security\Cryptography\DataProtectionScope.cs" />
<Compile Include="Assembly\AssemblyInfo.cs" />
<Compile Include="System.Security.Cryptography.Pkcs\EnvelopedCms.cs" />
<Compile Include="System.Security.Cryptography.Pkcs\Pkcs12Builder.NotSupported.cs" />
<Compile Include="System.Security.Cryptography.Pkcs\Pkcs12CertBag.NotSupported.cs" />
<Compile Include="System.Security.Cryptography.Pkcs\Pkcs12ConfidentialityMode.NotSupported.cs" />
<Compile Include="System.Security.Cryptography.Pkcs\Pkcs12Info.NotSupported.cs" />
<Compile Include="System.Security.Cryptography.Pkcs\Pkcs12IntegrityMode.NotSupported.cs" />
<Compile Include="System.Security.Cryptography.Pkcs\Pkcs12KeyBag.NotSupported.cs" />
<Compile Include="System.Security.Cryptography.Pkcs\Pkcs12SafeBag.NotSupported.cs" />
<Compile Include="System.Security.Cryptography.Pkcs\Pkcs12SafeContents.NotSupported.cs" />
<Compile Include="System.Security.Cryptography.Pkcs\Pkcs12SafeContentsBag.NotSupported.cs" />
<Compile Include="System.Security.Cryptography.Pkcs\Pkcs12SecretBag.NotSupported.cs" />
<Compile Include="System.Security.Cryptography.Pkcs\Pkcs12ShroudedKeyBag.NotSupported.cs" />
<Compile Include="System.Security.Cryptography.Pkcs\Pkcs8PrivateKeyInfo.NotSupported.cs" />
<Compile Include="System.Security.Cryptography.Pkcs\Pkcs9LocalKeyId.NotSupported.cs" />
<Compile Include="System.Security.Cryptography.Pkcs\Rfc3161TimestampRequest.NotSupported.cs" />
<Compile Include="System.Security.Cryptography.Pkcs\Rfc3161TimestampToken.NotSupported.cs" />
<Compile Include="System.Security.Cryptography.Pkcs\Rfc3161TimestampTokenInfo.NotSupported.cs" />
<Compile Include="corefx\SR.cs" />
</ItemGroup>
<!--End of common files-->
@@ -99,5 +99,25 @@ System.Security.Cryptography.Pkcs/EnvelopedCms.cs
../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/SignerInfoCollection.cs
../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/SignerInfoEnumerator.cs
# System.Security.Cryptography.Pkcs NotSupported
System.Security.Cryptography.Pkcs/Pkcs12Builder.NotSupported.cs
System.Security.Cryptography.Pkcs/Pkcs12CertBag.NotSupported.cs
System.Security.Cryptography.Pkcs/Pkcs12ConfidentialityMode.NotSupported.cs
System.Security.Cryptography.Pkcs/Pkcs12Info.NotSupported.cs
System.Security.Cryptography.Pkcs/Pkcs12IntegrityMode.NotSupported.cs
System.Security.Cryptography.Pkcs/Pkcs12KeyBag.NotSupported.cs
System.Security.Cryptography.Pkcs/Pkcs12SafeBag.NotSupported.cs
System.Security.Cryptography.Pkcs/Pkcs12SafeContents.NotSupported.cs
System.Security.Cryptography.Pkcs/Pkcs12SafeContentsBag.NotSupported.cs
System.Security.Cryptography.Pkcs/Pkcs12SecretBag.NotSupported.cs
System.Security.Cryptography.Pkcs/Pkcs12ShroudedKeyBag.NotSupported.cs
System.Security.Cryptography.Pkcs/Pkcs8PrivateKeyInfo.NotSupported.cs
System.Security.Cryptography.Pkcs/Pkcs9LocalKeyId.NotSupported.cs
System.Security.Cryptography.Pkcs/Rfc3161TimestampRequest.NotSupported.cs
System.Security.Cryptography.Pkcs/Rfc3161TimestampToken.NotSupported.cs
System.Security.Cryptography.Pkcs/Rfc3161TimestampTokenInfo.NotSupported.cs
# System.Security.Cryptography.Xml
../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Xml/X509IssuerSerial.cs
@@ -9,4 +9,7 @@ partial class SR
public const string SynchronizedCollectionWrongType1 = "A value of type '{0}' cannot be added to the generic collection, because the collection has been parameterized with a different type.";
public const string SynchronizedCollectionWrongTypeNull = "A null value cannot be added to the generic collection, because the collection has been parameterized with a value type.";
public const string ValueMustBeInRange = "The value of this argument must fall within the range {0} to {1}.";
public const string XmlLangAttributeMissing = "Required xml:lang attribute value is missing.";
public const string InvalidXmlQualifiedName = "Expected XML qualified name, found '{0}'";
public const string UnboundPrefixInQName = "Unbound prefix used in qualified name '{0}'.";
}
@@ -40,8 +40,9 @@ namespace System.ServiceModel.Channels
public static MessageFault CreateFault (Message message, int maxBufferSize)
{
try {
if (message.Version.Envelope == EnvelopeVersion.Soap11)
return CreateFault11 (message, maxBufferSize);
if (message.Version.Envelope == EnvelopeVersion.Soap11) {
return CreateFault11 (message, maxBufferSize);
}
else // common to None and SOAP12
return CreateFault12 (message, maxBufferSize);
} catch (XmlException ex) {
@@ -55,14 +56,14 @@ namespace System.ServiceModel.Channels
FaultReason fr = null;
string actor = null;
XmlDictionaryReader r = message.GetReaderAtBodyContents ();
r.ReadStartElement ("Fault", message.Version.Envelope.Namespace);
fc = ReadFaultCode11 (r, maxBufferSize);
r.MoveToContent ();
while (r.NodeType != XmlNodeType.EndElement) {
switch (r.LocalName) {
case "faultcode":
fc = ReadFaultCode11 (r);
break;
switch (r.LocalName) {
case "faultstring":
fr = new FaultReason (r.ReadElementContentAsString());
break;
@@ -128,26 +129,27 @@ namespace System.ServiceModel.Channels
return new SimpleMessageFault (fc, fr, false, null, null, null, node);
}
static FaultCode ReadFaultCode11 (XmlDictionaryReader r)
// In reference source for soap 1.1, the fault code value is not strictly enforced as per the
// Namespaces in XML spec.
//
// Additionally, the fault sub code is not looked for:
//
// See: https://referencesource.microsoft.com/#System.ServiceModel/System/ServiceModel/Channels/MessageFault.cs,f23a5298fd999b2d
//
static FaultCode ReadFaultCode11 (XmlDictionaryReader reader, int maxBufferSize)
{
FaultCode subcode = null;
XmlQualifiedName value = XmlQualifiedName.Empty;
FaultCode code;
string ns;
string name;
if (r.IsEmptyElement)
throw new ArgumentException ("Fault Code is mandatory in SOAP fault message.");
reader.ReadStartElement ("faultcode", "");
XmlUtil.ReadContentAsQName (reader, out name, out ns);
code = new FaultCode (name, ns);
r.ReadStartElement ("faultcode");
r.MoveToContent ();
while (r.NodeType != XmlNodeType.EndElement) {
if (r.NodeType == XmlNodeType.Element)
subcode = ReadFaultCode11 (r);
else
value = (XmlQualifiedName) r.ReadContentAs (typeof (XmlQualifiedName), r as IXmlNamespaceResolver);
r.MoveToContent ();
}
r.ReadEndElement ();
return new FaultCode (value.Name, value.Namespace, subcode);
reader.ReadEndElement ();
return code;
}
static FaultCode ReadFaultCode12 (XmlDictionaryReader r, string ns)
@@ -117,6 +117,7 @@
<Compile Include="..\referencesource\System.ServiceModel\System\ServiceModel\SynchronizedCollection.cs" />
<Compile Include="..\referencesource\System.ServiceModel\System\ServiceModel\SynchronizedKeyedCollection.cs" />
<Compile Include="..\referencesource\System.ServiceModel\System\ServiceModel\SynchronizedReadOnlyCollection.cs" />
<Compile Include="..\referencesource\System.ServiceModel\System\ServiceModel\XmlUtil.cs" />
<Compile Include="Assembly\AssemblyInfo.cs" />
<Compile Include="Mono.CodeGeneration\CodeAdd.cs" />
<Compile Include="Mono.CodeGeneration\CodeAnd.cs" />
@@ -912,4 +912,5 @@ System.ServiceModel.Configuration/HttpBindingBaseElement.cs
System.ServiceModel.Configuration/BasicHttpsBindingElement.cs
System.ServiceModel.Configuration/BasicHttpsSecurityElement.cs
System.ServiceModel.Configuration/BasicHttpsBindingCollectionElement.cs
../referencesource/System.ServiceModel/System/ServiceModel/XmlUtil.cs
@@ -0,0 +1,8 @@
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<s:Fault>
<faultcode>s:1</faultcode>
<faultstring xml:lang="en-US">String is empty.</faultstring>
</s:Fault>
</s:Body>
</s:Envelope>
@@ -22,6 +22,15 @@ namespace MonoTests.System.ServiceModel.Channels
MessageFault.CreateFault (msg, 0x10000);
}
[Test]
public void CreateFaultWithNumberCode ()
{
var msgVersion = MessageVersion.CreateVersion (EnvelopeVersion.Soap11, AddressingVersion.None);
var msg = Message.CreateMessage (XmlReader.Create (new StreamReader (TestResourceHelper.GetFullPathOfResource ("Test/Resources/soap-fault-number.xml"))), 0x10000, msgVersion);
MessageFault.CreateFault (msg, 0x10000);
}
[Test]
public void CreateFaultMessageVersionNone ()
{
@@ -296,3 +296,4 @@ System.ServiceModel.Security.Tokens/SecurityTokenReferenceStyle.cs
System.ServiceModel.Security.Tokens/SecureConversationSecurityTokenParameters.cs
System.ServiceModel.Security.Tokens/SupportingTokenParameters.cs
System.ServiceModel.Security.Tokens/UserNameSecurityTokenParameters.cs
../referencesource/System.ServiceModel/System/ServiceModel/XmlUtil.cs
@@ -429,13 +429,9 @@ namespace System.Xml.Serialization
}
}
static Encoding DefaultEncoding = Encoding.Default;
public void Serialize (Stream stream, object o)
{
XmlTextWriter xmlWriter = new XmlTextWriter (stream, DefaultEncoding);
xmlWriter.Formatting = Formatting.Indented;
Serialize (xmlWriter, o, null);
Serialize (stream, o, null);
}
public void Serialize (TextWriter textWriter, object o)
@@ -452,7 +448,7 @@ namespace System.Xml.Serialization
public void Serialize (Stream stream, object o, XmlSerializerNamespaces namespaces)
{
XmlTextWriter xmlWriter = new XmlTextWriter (stream, DefaultEncoding);
XmlTextWriter xmlWriter = new XmlTextWriter (stream, Encoding.UTF8);
xmlWriter.Formatting = Formatting.Indented;
Serialize (xmlWriter, o, namespaces);
}
@@ -2676,6 +2676,19 @@ namespace MonoTests.System.XmlSerialization
Assert.AreEqual ("<:GenComplexStructOfInt32String http://www.w3.org/2000/xmlns/:xsd='http://www.w3.org/2001/XMLSchema' http://www.w3.org/2000/xmlns/:xsi='http://www.w3.org/2001/XMLSchema-instance'><:something>123</><:simpleclass><:something>456</></><:simplestruct><:something>789</></><:listclass><:somelist><:int>100</><:int>200</></></><:arrayclass><:arr><:int>11</><:int>22</><:int>33</></></><:twoclass><:something1>10</><:something2>Ten</></><:derivedclass><:something1>two</><:something2>2</><:another1>1</><:another2>one</></><:derived2><:something1>4</><:something2>four</><:another1>3</><:another2>three</></><:nestedouter><:outer>5</></><:nestedinner><:inner>six</><:something>6</></></>", WriterText);
}
[Test]
public void TestSerializeStreamPreserveUTFChars () {
string foo = "BÄR";
XmlSerializer serializer = new XmlSerializer (typeof (string));
MemoryStream stream = new MemoryStream ();
serializer.Serialize (stream, foo);
stream.Position = 0;
foo = (string) serializer.Deserialize (stream);
Assert.AreEqual("BÄR", foo);
}
[Test] // bug #80759
public void HasNullableField ()
{
@@ -64,6 +64,7 @@ namespace Mono.Net.Security
}
SslStream sslStream;
readonly object sslStreamLock = new object ();
internal SslStream SslStream {
get { return sslStream; }
@@ -157,9 +158,11 @@ namespace Mono.Net.Security
}
void CloseSslStream () {
if (sslStream != null) {
sslStream.Dispose ();
sslStream = null;
lock (sslStreamLock) {
if (sslStream != null) {
sslStream.Dispose ();
sslStream = null;
}
}
}
}
@@ -1083,6 +1083,9 @@ namespace System.Net.Sockets
sockares.CurrentAddress++;
sockares.EndPoint = new IPEndPoint (sockares.Addresses [i], sockares.Port);
if (!sockares.socket.CanTryAddressFamily(sockares.EndPoint.AddressFamily))
continue;
return BeginSConnect (sockares);
} catch (Exception e) {
exc = e;
@@ -97,6 +97,10 @@ using System.Runtime.InteropServices;
[assembly: InternalsVisibleTo ("Xamarin.Mac, PublicKey=0024000004800000940000000602000000240000525341310004000011000000438ac2a5acfbf16cbd2b2b47a62762f273df9cb2795ceccdf77d10bf508e69e7a362ea7a45455bbf3ac955e1f2e2814f144e5d817efc4c6502cc012df310783348304e3ae38573c6d658c234025821fda87a0be8a0d504df564e2c93b2b878925f42503e9d54dfef9f9586d9e6f38a305769587b1de01f6c0410328b2c9733db")]
#endif
#if MONODROID
[assembly: InternalsVisibleTo ("Mono.Android, PublicKey=0024000004800000940000000602000000240000525341310004000011000000438ac2a5acfbf16cbd2b2b47a62762f273df9cb2795ceccdf77d10bf508e69e7a362ea7a45455bbf3ac955e1f2e2814f144e5d817efc4c6502cc012df310783348304e3ae38573c6d658c234025821fda87a0be8a0d504df564e2c93b2b878925f42503e9d54dfef9f9586d9e6f38a305769587b1de01f6c0410328b2c9733db")]
#endif
[assembly: InternalsVisibleTo ("System.Net.Http, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")]
[assembly: Guid ("BED7F4EA-1A96-11D2-8F08-00A0C9A6186D")]
+1
View File
@@ -173,6 +173,7 @@ LIB_MCS_FLAGS += -d:FEATURE_CRYPTO_CONFIGURABLE
TEST_MCS_FLAGS += -d:FEATURE_CRYPTO_CONFIGURABLE
endif
XTEST_SPLIT_ASSEMBLIES := $(filter monotouch%, $(PROFILE))
CC_PROFILE := $(filter monotouch% xammac, $(PROFILE))
ifdef CC_PROFILE
@@ -2,7 +2,7 @@ using System.Diagnostics;
namespace System
{
internal enum LogLevel {
internal enum BCLDebugLogLevel {
Trace = 0,
Status = 20,
Warning= 40,
@@ -33,7 +33,7 @@ namespace System
}
[Conditional("_DEBUG")]
public static void Log (string switchName, LogLevel level, params object[] messages)
public static void Log (string switchName, BCLDebugLogLevel level, params object[] messages)
{
}
@@ -820,8 +820,9 @@ namespace System
public override string FullName {
get {
// https://bugzilla.xamarin.com/show_bug.cgi?id=57938
if (IsGenericType && ContainsGenericParameters && !IsGenericTypeDefinition)
// See https://github.com/mono/mono/issues/18180 and
// https://github.com/dotnet/runtime/blob/f23e2796ab5f6fea71c9fdacac024822280253db/src/coreclr/src/System.Private.CoreLib/src/System/RuntimeType.CoreCLR.cs#L1468-L1472
if (ContainsGenericParameters && !GetRootElementType().IsGenericTypeDefinition)
return null;
string fullName;
+10 -1
View File
@@ -1000,11 +1000,17 @@ namespace System {
}
#if MONO_FEATURE_MULTIPLE_APPDOMAINS
#if MONODROID
[Obsolete ("AppDomain.CreateDomain will no longer be supported in .NET 5 and later. Consider AssemblyLoadContext when it becomes available https://docs.microsoft.com/en-us/dotnet/core/dependency-loading/understanding-assemblyloadcontext")]
#endif
public static AppDomain CreateDomain (string friendlyName)
{
return CreateDomain (friendlyName, null, null);
}
#if MONODROID
[Obsolete ("AppDomain.CreateDomain will no longer be supported in .NET 5 and later. Consider AssemblyLoadContext when it becomes available https://docs.microsoft.com/en-us/dotnet/core/dependency-loading/understanding-assemblyloadcontext")]
#endif
public static AppDomain CreateDomain (string friendlyName, Evidence securityInfo)
{
return CreateDomain (friendlyName, securityInfo, null);
@@ -1015,6 +1021,9 @@ namespace System {
[MonoLimitationAttribute ("Currently it does not allow the setup in the other domain")]
[SecurityPermission (SecurityAction.Demand, ControlAppDomain = true)]
#if MONODROID
[Obsolete ("AppDomain.CreateDomain will no longer be supported in .NET 5 and later. Consider AssemblyLoadContext when it becomes available https://docs.microsoft.com/en-us/dotnet/core/dependency-loading/understanding-assemblyloadcontext")]
#endif
public static AppDomain CreateDomain (string friendlyName, Evidence securityInfo, AppDomainSetup info)
{
if (friendlyName == null)
+72 -67
View File
@@ -195,76 +195,81 @@ namespace System {
lock (initLock){
if (inited)
return;
inited = true;
/* This should not happen any more, since it is checked for in Console */
if (!ConsoleDriver.IsConsole)
throw new IOException ("Not a tty.");
ConsoleDriver.SetEcho (false);
string endString = null;
keypadXmit = reader.Get (TermInfoStrings.KeypadXmit);
keypadLocal = reader.Get (TermInfoStrings.KeypadLocal);
if (keypadXmit != null) {
WriteConsole (keypadXmit); // Needed to get the arrows working
if (keypadLocal != null)
endString += keypadLocal;
}
origPair = reader.Get (TermInfoStrings.OrigPair);
origColors = reader.Get (TermInfoStrings.OrigColors);
setfgcolor = reader.Get (TermInfoStrings.SetAForeground);
setbgcolor = reader.Get (TermInfoStrings.SetABackground);
maxColors = reader.Get (TermInfoNumbers.MaxColors);
maxColors = Math.Max (Math.Min (maxColors, 16), 1);
string resetColors = (origColors == null) ? origPair : origColors;
if (resetColors != null)
endString += resetColors;
unsafe {
if (!ConsoleDriver.TtySetup (keypadXmit, endString, out control_characters, out native_terminal_size)){
control_characters = new byte [17];
native_terminal_size = null;
//throw new IOException ("Error initializing terminal.");
try {
/* This should not happen any more, since it is checked for in Console */
if (!ConsoleDriver.IsConsole)
throw new IOException ("Not a tty.");
ConsoleDriver.SetEcho (false);
string endString = null;
keypadXmit = reader.Get (TermInfoStrings.KeypadXmit);
keypadLocal = reader.Get (TermInfoStrings.KeypadLocal);
if (keypadXmit != null) {
WriteConsole (keypadXmit); // Needed to get the arrows working
if (keypadLocal != null)
endString += keypadLocal;
}
origPair = reader.Get (TermInfoStrings.OrigPair);
origColors = reader.Get (TermInfoStrings.OrigColors);
setfgcolor = reader.Get (TermInfoStrings.SetAForeground);
setbgcolor = reader.Get (TermInfoStrings.SetABackground);
maxColors = reader.Get (TermInfoNumbers.MaxColors);
maxColors = Math.Max (Math.Min (maxColors, 16), 1);
string resetColors = (origColors == null) ? origPair : origColors;
if (resetColors != null)
endString += resetColors;
unsafe {
if (!ConsoleDriver.TtySetup (keypadXmit, endString, out control_characters, out native_terminal_size)){
control_characters = new byte [17];
native_terminal_size = null;
//throw new IOException ("Error initializing terminal.");
}
}
stdin = new StreamReader (Console.OpenStandardInput (0), Console.InputEncoding);
clear = reader.Get (TermInfoStrings.ClearScreen);
bell = reader.Get (TermInfoStrings.Bell);
if (clear == null) {
clear = reader.Get (TermInfoStrings.CursorHome);
clear += reader.Get (TermInfoStrings.ClrEos);
}
csrVisible = reader.Get (TermInfoStrings.CursorNormal);
if (csrVisible == null)
csrVisible = reader.Get (TermInfoStrings.CursorVisible);
csrInvisible = reader.Get (TermInfoStrings.CursorInvisible);
if (term == "cygwin" || term == "linux" || (term != null && term.StartsWith ("xterm")) ||
term == "rxvt" || term == "dtterm") {
titleFormat = "\x1b]0;{0}\x7"; // icon + window title
} else if (term == "iris-ansi") {
titleFormat = "\x1bP1.y{0}\x1b\\"; // not tested
} else if (term == "sun-cmd") {
titleFormat = "\x1b]l{0}\x1b\\"; // not tested
}
cursorAddress = reader.Get (TermInfoStrings.CursorAddress);
GetCursorPosition ();
#if DEBUG
logger.WriteLine ("noGetPosition: {0} left: {1} top: {2}", noGetPosition, cursorLeft, cursorTop);
logger.Flush ();
#endif
if (noGetPosition) {
WriteConsole (clear);
cursorLeft = 0;
cursorTop = 0;
}
} finally {
inited = true;
}
stdin = new StreamReader (Console.OpenStandardInput (0), Console.InputEncoding);
clear = reader.Get (TermInfoStrings.ClearScreen);
bell = reader.Get (TermInfoStrings.Bell);
if (clear == null) {
clear = reader.Get (TermInfoStrings.CursorHome);
clear += reader.Get (TermInfoStrings.ClrEos);
}
csrVisible = reader.Get (TermInfoStrings.CursorNormal);
if (csrVisible == null)
csrVisible = reader.Get (TermInfoStrings.CursorVisible);
csrInvisible = reader.Get (TermInfoStrings.CursorInvisible);
if (term == "cygwin" || term == "linux" || (term != null && term.StartsWith ("xterm")) ||
term == "rxvt" || term == "dtterm") {
titleFormat = "\x1b]0;{0}\x7"; // icon + window title
} else if (term == "iris-ansi") {
titleFormat = "\x1bP1.y{0}\x1b\\"; // not tested
} else if (term == "sun-cmd") {
titleFormat = "\x1b]l{0}\x1b\\"; // not tested
}
cursorAddress = reader.Get (TermInfoStrings.CursorAddress);
GetCursorPosition ();
#if DEBUG
logger.WriteLine ("noGetPosition: {0} left: {1} top: {2}", noGetPosition, cursorLeft, cursorTop);
logger.Flush ();
#endif
if (noGetPosition) {
WriteConsole (clear);
cursorLeft = 0;
cursorTop = 0;
}
}
}
@@ -250,7 +250,7 @@ namespace MonoTests.System.IO
DirectoryInfo info = new DirectoryInfo (path);
Assert.IsFalse (info.Exists, "#1");
info.Create ();
Assert.IsFalse (info.Exists, "#2");
Assert.IsTrue (info.Exists, "#2");
info = new DirectoryInfo (path);
Assert.IsTrue (info.Exists, "#3");
} finally {
+10
View File
@@ -5106,6 +5106,16 @@ namespace MonoTests.System
typeof(UserByRefLikeStruct).MakeArrayType ();
}
[Test]
public void GetConstructorsOnArrayOfGenericArgumentsToArraySpecialInterfaceGtd ()
{
// Regression test for https://github.com/mono/mono/issues/7095#issuecomment-470465597
// The assertion here isn't very important; what matters is that the runtime doesn't crash.
Type ilist_arg = typeof(IList<>).GetGenericArguments () [0];
Type ilist_arg_array = ilist_arg.MakeArrayType ();
Assert.NotNull (ilist_arg_array.GetConstructors ());
}
}
class UserType : Type
+4 -2
View File
@@ -1,5 +1,6 @@
using System;
using System.Reflection;
using System.Runtime.ExceptionServices;
namespace Internal.Runtime.Augments {
partial class RuntimeAugments {
@@ -7,7 +8,8 @@ namespace Internal.Runtime.Augments {
public static void ReportUnhandledException (Exception exception)
{
throw exception;
var edi = ExceptionDispatchInfo.Capture (exception);
edi.Throw ();
}
internal static ReflectionExecutionDomainCallbacks Callbacks => s_reflectionExecutionDomainCallbacks;
@@ -19,4 +21,4 @@ namespace Internal.Runtime.Augments {
return new MissingMetadataException ();
}
}
}
}
+126 -106
View File
@@ -15,12 +15,19 @@ corefx/GlobalizationMode.cs
../../../external/corefx/src/Common/tests/System/Security/Cryptography/ByteUtils.cs
../../../external/corefx/src/Common/tests/System/ShouldNotBeInvokedException.cs
../../../external/corefx/src/System.Reflection/tests/Common.cs
../../../external/corefx/src/System.Reflection/tests/TypeInfoTests.cs
#split monotouch
#split monotouch_tv
#split monotouch_watch
#../../../external/corefx/src/System.Globalization/tests/CompareInfo/*.cs:
../../../external/corefx/src/System.Reflection.Emit/tests/Utilities.cs
../../../external/corefx/src/System.Reflection/tests/Common.cs
../../../external/corefx/src/System.Reflection/tests/*.cs:AssemblyTests.cs,AssemblyTests.netcoreapp.cs,AssemblyNameTests.cs,MethodInfoTests.cs
../../../external/corefx/src/System.Reflection.Extensions/tests/Definitions/PropertyDefinitions.cs
../../../external/corefx/src/System.Reflection.Extensions/tests/*.cs
@@ -207,56 +214,74 @@ corefx/GlobalizationMode.cs
# FIXME: this is internal in corlib
../../../external/corefx/src/Common/src/System/MutableDecimal.cs
# System.Collections
../../../external/corefx/src/Common/tests/System/Collections/CollectionAsserts.cs
../../../external/corefx/src/Common/tests/System/Collections/TestBase.NonGeneric.cs
../../../external/corefx/src/Common/tests/System/Collections/TestBase.Generic.cs
../../../external/corefx/src/Common/tests/System/Collections/TestingTypes.cs
../../../external/corefx/src/Common/tests/System/Collections/IList.NonGeneric.Tests.cs
../../../external/corefx/src/Common/tests/System/Collections/IList.Generic.Tests.cs
../../../external/corefx/src/Common/tests/System/Collections/ICollection.NonGeneric.Tests.cs
../../../external/corefx/src/Common/tests/System/Collections/ICollection.Generic.Tests.cs
../../../external/corefx/src/Common/tests/System/Collections/IDictionary.NonGeneric.Tests.cs
../../../external/corefx/src/Common/tests/System/Collections/IDictionary.Generic.Tests.cs
#../../../external/corefx/src/Common/tests/System/Collections/IEnumerable.NonGeneric.Serialization.Tests.cs
../../../external/corefx/src/Common/tests/System/Collections/IEnumerable.NonGeneric.Tests.cs
#../../../external/corefx/src/Common/tests/System/Collections/IEnumerable.Generic.Serialization.Tests.cs
../../../external/corefx/src/Common/tests/System/Collections/IEnumerable.Generic.Tests.cs
../../../external/corefx/src/Common/tests/System/Collections/ISet.Generic.Tests.cs
../../../external/corefx/src/Common/tests/System/Collections/IGenericSharedAPI.Tests.cs
../../../external/corefx/src/Common/tests/System/EnumTypes.cs
../../../external/corefx/src/Common/tests/System/ObjectCloner.cs
../../../external/corefx/src/Common/tests/System/Diagnostics/DebuggerAttributes.cs
../../../external/corefx/src/System.Collections/tests/Generic/SortedSet/*.cs:SortedSet.TreeSubSet.Tests.cs
../../../external/corefx/src/System.Collections/tests/Generic/Stack/*.cs
../../../external/corefx/src/System.Collections/tests/Generic/SortedList/*.cs
../../../external/corefx/src/System.Collections/tests/Generic/SortedDictionary/*.cs
../../../external/corefx/src/System.Collections/tests/Generic/Queue/*.cs
../../../external/corefx/src/System.Collections/tests/Generic/List/*.cs
../../../external/corefx/src/System.Collections/tests/Generic/LinkedList/*.cs
../../../external/corefx/src/System.Collections/tests/Generic/Dictionary/HashCollisionScenarios/*.cs
../../../external/corefx/src/System.Collections/tests/Generic/Dictionary/*.cs
../../../external/corefx/src/System.Collections/tests/Generic/Comparers/*.cs:EqualityComparer.Tests.cs
../../../external/corefx/src/System.Collections/tests/BitArray/*.cs:BitArray_GetSetTests.cs
../../../external/corefx/src/System.Collections/tests/*.cs
# System.Collections.NonGeneric
#../../../external/corefx/src/System.Collections.NonGeneric/tests/ArrayList/*.cs
../../../external/corefx/src/System.Collections.NonGeneric/tests/Hashtable/*.cs
../../../external/corefx/src/System.Collections.NonGeneric/tests/*.cs:SortedListTests.cs,CollectionBaseTests.cs,DictionaryBaseTests.cs,ArrayListTests.cs,ReadOnlyCollectionBaseTests.cs
#split monotouch
#split monotouch_tv
#split monotouch_watch
# System.Collections.Concurrent
../../../external/corefx/src/System.Collections.Concurrent/tests/ConcurrentDictionary/*.cs
../../../external/corefx/src/System.Collections.Concurrent/tests/*.cs:ProducerConsumerCollectionTests.cs,EtwTests.cs,ConcurrentBagTests.cs,ConcurrentQueueTests.cs,ConcurrentStackTests.cs
# System.Runtime.Extensions
../../../external/corefx/src/System.Runtime.Extensions/tests/System/Diagnostics/*.cs
../../../external/corefx/src/System.Runtime.Extensions/tests/System/Runtime/Versioning/*.cs:VersioningHelperTests.cs
../../../external/corefx/src/System.Runtime.Extensions/tests/System/*.cs:AppDomainTests.cs,Environment.Exit.cs,Environment.GetCommandLineArgs.cs,Environment.GetEnvironmentVariable.cs,Environment.SetEnvironmentVariable.cs,EnvironmentTests.cs,Environment.StackTrace.cs,MarshalByRefObjectTest.cs,StringComparer.cs,StringComparer.netcoreapp.cs,UnloadingAndProcessExitTests.netcoreapp.cs,Environment.UserDomainName.cs,Environment.MachineName.cs
# System.Collections.Specialized
../../../external/corefx/src/System.Collections.Specialized/tests/StringDictionary/*.cs
../../../external/corefx/src/System.Collections.Specialized/tests/NameObjectCollectionBase/*.cs:NameObjectCollectionBase.KeysTests.cs,NameObjectCollectionBase.CopyToTests.cs
#../../../external/corefx/src/System.Collections.Specialized/tests/NameValueCollection/*.cs
../../../external/corefx/src/System.Collections.Specialized/tests/ListDictionary/*.cs
../../../external/corefx/src/System.Collections.Specialized/tests/HybridDictionary/*.cs
../../../external/corefx/src/System.Collections.Specialized/tests/OrderedDictionary/*.cs
../../../external/corefx/src/System.Collections.Specialized/tests/*.cs:StringCollectionTests.cs
# System.Runtime.InteropServices
../../../external/corefx/src/System.Runtime.InteropServices/tests/System/Runtime/CompilerServices/*.cs
../../../external/corefx/src/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/*.cs:MarshalTests.cs,GCHandleTests.cs,SafeBufferTests.cs,ComEventsHelperTests.cs,RuntimeEnvironmentTests.cs,DispatchWrapperTests.cs,ArrayWithOffsetTests.cs,SetWin32ContextInIDispatchAttributeTests.cs,ComAwareEventInfoTests.cs,IDispatchImplAttributeTests.cs,ComAwareEventInfoTests.Windows.cs,MarshalTests.Windows.cs
# System.IO.MemoryStream
../../../external/corefx/src/System.IO/tests/MemoryStream/*.cs
../../../external/corefx/src/Common/tests/System/IO/DelegateStream.cs
# System.IO.UnmanagedMemoryStream
../../../external/corefx/src/System.IO.UnmanagedMemoryStream/tests/*.cs
# System.IO.TextReader/StreamReader
../../../external/corefx/src/System.IO/tests/TextReader/*.cs
../../../external/corefx/src/System.IO/tests/StreamReader/*.cs
../../../external/corefx/src/System.IO/tests/TestDataProvider/TestDataProvider.cs
# System.IO.Stream
../../../external/corefx/src/Common/tests/System/IO/CallTrackingStream.cs
../../../external/corefx/src/System.IO/tests/Stream/*.cs
# System.IO.BufferedStream
../../../external/corefx/src/System.IO/tests/StreamWriter/StreamWriter.CloseTests.cs
../../../external/corefx/src/System.IO/tests/StreamWriter/StreamWriter.WriteTests.cs
../../../external/corefx/src/System.IO/tests/StreamWriter/StreamWriter.FlushTests.cs
../../../external/corefx/src/System.IO/tests/BinaryWriter/BinaryWriterTests.cs
../../../external/corefx/src/System.IO/tests/BinaryWriter/BinaryWriter.WriteTests.cs
../../../external/corefx/src/System.IO/tests/BinaryWriter/BinaryWriter.WriteByteCharTests.cs
../../../external/corefx/src/System.IO/tests/StreamReader/StreamReaderTests.cs
../../../external/corefx/src/System.IO/tests/TestDataProvider/TestDataProvider.cs
../../../external/corefx/src/Common/tests/System/IO/WrappedMemoryStream.cs
../../../external/corefx/src/System.IO/tests/BufferedStream/*.cs
# FileSystem Helper (not used on Windows)
../../../external/corefx/src/System.IO.FileSystem/tests/FileSystemTest.Unix.cs
# System.IO.FileInfo
../../../external/corefx/src/Common/tests/System/IO/TempFile.cs
../../../external/corefx/src/Common/tests/System/IO/PathFeatures.cs
../../../external/corefx/src/System.IO.FileSystem/tests/TestData.cs
../../../external/corefx/src/System.IO.FileSystem/tests/FSAssert.cs
../../../external/corefx/src/CoreFx.Private.TestUtilities/src/System/AdminHelpers.cs
../../../external/corefx/src/CoreFx.Private.TestUtilities/src/System/TheoryExtensions.cs
../../../external/corefx/src/System.IO.FileSystem/tests/Base/*.cs:StaticGetSetTimes.cs
../../../external/corefx/src/System.IO.FileSystem/tests/File/*.cs:GetSetTimes.cs
../../../external/corefx/src/System.IO.FileSystem/tests/FileStream/ctor_*.cs
../../../external/corefx/src/System.IO.FileSystem/tests/PortedCommon/*.cs
../../../external/corefx/src/System.IO.FileSystem/tests/FileSystemTest.cs
../../../external/corefx/src/System.IO.FileSystem/tests/FileInfo/*.cs:GetSetTimes.cs
# System.IO.Directory
../../../external/corefx/src/System.IO.FileSystem/tests/Directory/*.cs:GetSetTimes.cs
# System.IO.DirectoryInfo
../../../external/corefx/src/System.IO.FileSystem/tests/DirectoryInfo/*.cs:GetSetTimes.cs
# System.IO.TextWriter/StreamWriter
../../../external/corefx/src/System.IO/tests/TextReader/*.cs
../../../external/corefx/src/System.IO/tests/StreamReader/*.cs
# System.Runtime
../../../external/corefx/src/System.Runtime/tests/System/AccessViolationExceptionTests.cs
@@ -269,8 +294,6 @@ corefx/GlobalizationMode.cs
../../../external/corefx/src/System.Runtime/tests/System/TimeZoneNotFoundExceptionTests.cs
../../../external/corefx/src/System.Runtime/tests/System/TimeSpanTests.cs
../../../external/corefx/src/System.Runtime/tests/System/TimeSpanTests.netcoreapp.cs
../../../external/corefx/src/System.Runtime/tests/System/ArraySegmentTests.cs
../../../external/corefx/src/System.Runtime/tests/System/ArraySegmentTests.netcoreapp.cs
../../../external/corefx/src/System.Runtime/tests/System/BooleanTests.cs
../../../external/corefx/src/System.Runtime/tests/System/BooleanTests.netcoreapp.cs
../../../external/corefx/src/System.Runtime/tests/System/ByteTests.cs
@@ -341,66 +364,63 @@ corefx/GlobalizationMode.cs
../../../external/corefx/src/System.Runtime/tests/System/Text/*.cs
../../../external/corefx/src/System.Runtime/tests/System/Runtime/CompilerServices/*.cs:RuntimeHelpersTests.netcoreapp.cs,ConditionalWeakTableTests.netcoreapp.cs,ConditionalWeakTableTests.cs
# System.Runtime.Extensions
../../../external/corefx/src/System.Runtime.Extensions/tests/System/Diagnostics/*.cs
../../../external/corefx/src/System.Runtime.Extensions/tests/System/Runtime/Versioning/*.cs:VersioningHelperTests.cs
../../../external/corefx/src/System.Runtime.Extensions/tests/System/*.cs:AppDomainTests.cs,Environment.Exit.cs,Environment.GetCommandLineArgs.cs,Environment.GetEnvironmentVariable.cs,Environment.SetEnvironmentVariable.cs,EnvironmentTests.cs,Environment.StackTrace.cs,MarshalByRefObjectTest.cs,StringComparer.cs,StringComparer.netcoreapp.cs,UnloadingAndProcessExitTests.netcoreapp.cs,Environment.UserDomainName.cs,Environment.MachineName.cs
# System.Runtime.InteropServices
../../../external/corefx/src/System.Runtime.InteropServices/tests/System/Runtime/CompilerServices/*.cs
../../../external/corefx/src/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/*.cs:MarshalTests.cs,GCHandleTests.cs,SafeBufferTests.cs,ComEventsHelperTests.cs,RuntimeEnvironmentTests.cs,DispatchWrapperTests.cs,ArrayWithOffsetTests.cs,SetWin32ContextInIDispatchAttributeTests.cs,ComAwareEventInfoTests.cs,IDispatchImplAttributeTests.cs,ComAwareEventInfoTests.Windows.cs,MarshalTests.Windows.cs
#split monotouch
#split monotouch_tv
#split monotouch_watch
# System.IO.MemoryStream
../../../external/corefx/src/System.IO/tests/MemoryStream/*.cs
../../../external/corefx/src/Common/tests/System/IO/DelegateStream.cs
# System.IO.UnmanagedMemoryStream
../../../external/corefx/src/System.IO.UnmanagedMemoryStream/tests/*.cs
../../../external/corefx/src/System.Runtime/tests/System/ArraySegmentTests.cs
../../../external/corefx/src/System.Runtime/tests/System/ArraySegmentTests.netcoreapp.cs
# System.IO.TextReader/StreamReader
../../../external/corefx/src/System.IO/tests/TextReader/*.cs
../../../external/corefx/src/System.IO/tests/StreamReader/*.cs
../../../external/corefx/src/System.IO/tests/TestDataProvider/TestDataProvider.cs
# System.Collections
../../../external/corefx/src/Common/tests/System/Collections/CollectionAsserts.cs
../../../external/corefx/src/Common/tests/System/Collections/TestBase.NonGeneric.cs
../../../external/corefx/src/Common/tests/System/Collections/TestBase.Generic.cs
../../../external/corefx/src/Common/tests/System/Collections/TestingTypes.cs
../../../external/corefx/src/Common/tests/System/EnumTypes.cs
../../../external/corefx/src/Common/tests/System/ObjectCloner.cs
../../../external/corefx/src/Common/tests/System/Diagnostics/DebuggerAttributes.cs
../../../external/corefx/src/Common/tests/System/Collections/IList.NonGeneric.Tests.cs
../../../external/corefx/src/Common/tests/System/Collections/IList.Generic.Tests.cs
../../../external/corefx/src/Common/tests/System/Collections/ICollection.NonGeneric.Tests.cs
../../../external/corefx/src/Common/tests/System/Collections/ICollection.Generic.Tests.cs
../../../external/corefx/src/Common/tests/System/Collections/IDictionary.NonGeneric.Tests.cs
../../../external/corefx/src/Common/tests/System/Collections/IDictionary.Generic.Tests.cs
#../../../external/corefx/src/Common/tests/System/Collections/IEnumerable.NonGeneric.Serialization.Tests.cs
../../../external/corefx/src/Common/tests/System/Collections/IEnumerable.NonGeneric.Tests.cs
#../../../external/corefx/src/Common/tests/System/Collections/IEnumerable.Generic.Serialization.Tests.cs
../../../external/corefx/src/Common/tests/System/Collections/IEnumerable.Generic.Tests.cs
../../../external/corefx/src/Common/tests/System/Collections/ISet.Generic.Tests.cs
../../../external/corefx/src/Common/tests/System/Collections/IGenericSharedAPI.Tests.cs
../../../external/corefx/src/System.Collections/tests/Generic/SortedSet/*.cs:SortedSet.TreeSubSet.Tests.cs
../../../external/corefx/src/System.Collections/tests/Generic/Stack/*.cs
../../../external/corefx/src/System.Collections/tests/Generic/SortedList/*.cs
../../../external/corefx/src/System.Collections/tests/Generic/SortedDictionary/*.cs
../../../external/corefx/src/System.Collections/tests/Generic/Queue/*.cs
../../../external/corefx/src/System.Collections/tests/Generic/List/*.cs
../../../external/corefx/src/System.Collections/tests/Generic/LinkedList/*.cs
../../../external/corefx/src/System.Collections/tests/Generic/Dictionary/HashCollisionScenarios/*.cs
../../../external/corefx/src/System.Collections/tests/Generic/Dictionary/*.cs
../../../external/corefx/src/System.Collections/tests/Generic/Comparers/*.cs:EqualityComparer.Tests.cs
../../../external/corefx/src/System.Collections/tests/BitArray/*.cs:BitArray_GetSetTests.cs
../../../external/corefx/src/System.Collections/tests/*.cs
# System.IO.Stream
../../../external/corefx/src/Common/tests/System/IO/CallTrackingStream.cs
../../../external/corefx/src/System.IO/tests/Stream/*.cs
# System.Collections.NonGeneric
#../../../external/corefx/src/System.Collections.NonGeneric/tests/ArrayList/*.cs
../../../external/corefx/src/System.Collections.NonGeneric/tests/Hashtable/*.cs
../../../external/corefx/src/System.Collections.NonGeneric/tests/*.cs:SortedListTests.cs,CollectionBaseTests.cs,DictionaryBaseTests.cs,ArrayListTests.cs,ReadOnlyCollectionBaseTests.cs
# System.IO.BufferedStream
../../../external/corefx/src/System.IO/tests/StreamWriter/StreamWriter.CloseTests.cs
../../../external/corefx/src/System.IO/tests/StreamWriter/StreamWriter.WriteTests.cs
../../../external/corefx/src/System.IO/tests/StreamWriter/StreamWriter.FlushTests.cs
../../../external/corefx/src/System.IO/tests/BinaryWriter/BinaryWriterTests.cs
../../../external/corefx/src/System.IO/tests/BinaryWriter/BinaryWriter.WriteTests.cs
../../../external/corefx/src/System.IO/tests/BinaryWriter/BinaryWriter.WriteByteCharTests.cs
../../../external/corefx/src/System.IO/tests/StreamReader/StreamReaderTests.cs
../../../external/corefx/src/System.IO/tests/TestDataProvider/TestDataProvider.cs
../../../external/corefx/src/Common/tests/System/IO/WrappedMemoryStream.cs
../../../external/corefx/src/System.IO/tests/BufferedStream/*.cs
# System.Collections.Concurrent
../../../external/corefx/src/System.Collections.Concurrent/tests/ConcurrentDictionary/*.cs
../../../external/corefx/src/System.Collections.Concurrent/tests/*.cs:ProducerConsumerCollectionTests.cs,EtwTests.cs,ConcurrentBagTests.cs,ConcurrentQueueTests.cs,ConcurrentStackTests.cs
# FileSystem Helper (not used on Windows)
../../../external/corefx/src/System.IO.FileSystem/tests/FileSystemTest.Unix.cs
# System.Collections.Specialized
../../../external/corefx/src/System.Collections.Specialized/tests/StringDictionary/*.cs
../../../external/corefx/src/System.Collections.Specialized/tests/NameObjectCollectionBase/*.cs:NameObjectCollectionBase.KeysTests.cs,NameObjectCollectionBase.CopyToTests.cs
#../../../external/corefx/src/System.Collections.Specialized/tests/NameValueCollection/*.cs
../../../external/corefx/src/System.Collections.Specialized/tests/ListDictionary/*.cs
../../../external/corefx/src/System.Collections.Specialized/tests/HybridDictionary/*.cs
../../../external/corefx/src/System.Collections.Specialized/tests/OrderedDictionary/*.cs
../../../external/corefx/src/System.Collections.Specialized/tests/*.cs:StringCollectionTests.cs
# System.IO.FileInfo
../../../external/corefx/src/Common/tests/System/IO/TempFile.cs
../../../external/corefx/src/Common/tests/System/IO/PathFeatures.cs
../../../external/corefx/src/System.IO.FileSystem/tests/TestData.cs
../../../external/corefx/src/System.IO.FileSystem/tests/FSAssert.cs
../../../external/corefx/src/CoreFx.Private.TestUtilities/src/System/AdminHelpers.cs
../../../external/corefx/src/CoreFx.Private.TestUtilities/src/System/TheoryExtensions.cs
../../../external/corefx/src/System.IO.FileSystem/tests/Base/*.cs:StaticGetSetTimes.cs
../../../external/corefx/src/System.IO.FileSystem/tests/File/*.cs:GetSetTimes.cs
../../../external/corefx/src/System.IO.FileSystem/tests/FileStream/ctor_*.cs
../../../external/corefx/src/System.IO.FileSystem/tests/PortedCommon/*.cs
../../../external/corefx/src/System.IO.FileSystem/tests/FileSystemTest.cs
../../../external/corefx/src/System.IO.FileSystem/tests/FileInfo/*.cs:GetSetTimes.cs
# System.IO.Directory
../../../external/corefx/src/System.IO.FileSystem/tests/Directory/*.cs:GetSetTimes.cs
# System.IO.DirectoryInfo
../../../external/corefx/src/System.IO.FileSystem/tests/DirectoryInfo/*.cs:GetSetTimes.cs
# System.IO.TextWriter/StreamWriter
../../../external/corefx/src/System.IO/tests/TextReader/*.cs
../../../external/corefx/src/System.IO/tests/StreamReader/*.cs
@@ -86,7 +86,9 @@ namespace System.ServiceModel
int j;
for (j = s.Length; j > 0 && IsWhitespace(s[j - 1]); j--);
#if !MONO
Fx.Assert(j > i, "Logic error in XmlUtil.Trim().");
#endif
if (i != 0 || j != s.Length)
{
@@ -750,7 +750,7 @@ namespace System.Xml {
// This method tests whether a value is in a given range with just one test; start and end should be constants
private static bool InRange(int value, int start, int end) {
Debug.Assert(start <= end);
return (uint)(value - start) <= (uint)(end - start);
return (uint)(value - start) <= (uint)(end - start);
}
#if XMLCHARTYPE_GEN_RESOURCE
@@ -358,7 +358,7 @@ namespace System.Resources {
_store.BaseStream.Seek(_nameSectionOffset + GetNamePosition(index), SeekOrigin.Begin);
lastReadString = _store.ReadString();
}
BCLDebug.Log("RESMGRFILEFORMAT", LogLevel.Status, "FindPosForResource for ", name, " failed. i: ", index, " lo: ", lo, " hi: ", hi, " last read string: \"", lastReadString, '\'');
BCLDebug.Log("RESMGRFILEFORMAT", BCLDebugLogLevel.Status, "FindPosForResource for ", name, " failed. i: ", index, " lo: ", lo, " hi: ", hi, " last read string: \"", lastReadString, '\'');
#endif
return -1;
}
@@ -909,7 +909,7 @@ namespace System.Resources {
throw new BadImageFormatException(Environment.GetResourceString("BadImageFormat_ResourcesHeaderCorrupted"));
}
if (resMgrHeaderVersion > 1) {
BCLDebug.Log("RESMGRFILEFORMAT", LogLevel.Status, "ReadResources: Unexpected ResMgr header version: {0} Skipping ahead {1} bytes.", resMgrHeaderVersion, numBytesToSkip);
BCLDebug.Log("RESMGRFILEFORMAT", BCLDebugLogLevel.Status, "ReadResources: Unexpected ResMgr header version: {0} Skipping ahead {1} bytes.", resMgrHeaderVersion, numBytesToSkip);
_store.BaseStream.Seek(numBytesToSkip, SeekOrigin.Current);
}
else {
-1
View File
@@ -30,7 +30,6 @@ ROSLYN_FILES_TO_COPY_FOR_MSBUILD = \
$(ROSLYN_CSC_DIR)/Microsoft.Build.Tasks.CodeAnalysis.dll \
$(ROSLYN_CSC_DIR)/Microsoft.CSharp.Core.targets \
$(ROSLYN_CSC_DIR)/Microsoft.Managed.Core.targets \
$(ROSLYN_CSC_DIR)/Microsoft.Managed.EditorConfig.targets \
$(ROSLYN_CSC_DIR)/Microsoft.VisualBasic.Core.targets
DISTFILES = $(ROSLYN_FILES_FOR_MONO) $(ROSLYN_FILES_TO_COPY_FOR_MSBUILD) csi-test.csx
+56 -18
View File
@@ -116,9 +116,6 @@ public static class Program {
if (SourcesParser.TraceLevel > 0)
Console.Error.WriteLine ($"// Writing sources from {sourcesFile} minus {excludesFile}, to {outFile}.");
} else if (args.Count == 4) {
if (baseDir != null)
Console.Error.WriteLine ($"// WARNING: baseDir has no effect in this mode");
var libraryFullName = Path.GetFullPath (args[1]);
var platformName = args[2].Trim ();
var profileName = args[3].Trim ();
@@ -135,13 +132,12 @@ public static class Program {
throw new Exception ();
}
var fileNames = result.GetMatches ()
var files = result.GetMatches ()
.OrderBy (e => e.RelativePath, StringComparer.Ordinal)
.Select (e => e.RelativePath)
.Distinct ()
.Distinct (new MatchEntryEqualityComparer ())
.ToList ();
var unexpectedEmptyResult = (fileNames.Count == 0);
var unexpectedEmptyResult = (files.Count == 0);
// HACK: We have sources files that are literally empty, so as long as *some* sources files were
// parsed during this invocation and they are all empty, producing no matching file names is not
@@ -150,7 +146,7 @@ public static class Program {
unexpectedEmptyResult = false;
if ((result.ErrorCount > 0) || unexpectedEmptyResult) {
Console.Error.WriteLine ($"// gensources produced {result.ErrorCount} error(s) and a set of {fileNames.Count} filename(s)");
Console.Error.WriteLine ($"// gensources produced {result.ErrorCount} error(s) and a set of {files.Count} filename(s)");
Console.Error.WriteLine ($"// Invoked with '{Environment.CommandLine}'");
Console.Error.WriteLine ($"// Working directory was '{Environment.CurrentDirectory}'");
@@ -163,17 +159,29 @@ public static class Program {
}
}
TextWriter output;
if (useStdout)
output = Console.Out;
else
output = new StreamWriter (outFile);
int parts = files.Count == 0 ? 0 : files.Max (f => f.SplitNumber);
if (useStdout && parts > 0)
throw new InvalidOperationException ("useStdout can't be used together with assembly splitting");
using (output) {
foreach (var fileName in fileNames)
output.WriteLine (fileName);
TextWriter[] outputs = new TextWriter[parts + 1];
for (int i = 0; i < parts + 1; i++) { // we create one file with all sources and part assemblies with only common+specific ones
outputs[i] = useStdout ? Console.Out : new StreamWriter (i == 0 ? outFile : $"{outFile}.part{i}");
}
foreach (var fileName in files) {
if (fileName.SplitNumber == 0) { // split number 0 is the special case: common files that should be included in all output parts
foreach (var output in outputs)
output.WriteLine (fileName.RelativePath);
}
else { // all other split numbers should only be included in the full assembly and the specific part assembly
outputs[0].WriteLine (fileName.RelativePath);
outputs[fileName.SplitNumber].WriteLine (fileName.RelativePath);
}
}
foreach (var output in outputs)
output.Dispose();
return 0;
}
}
@@ -195,11 +203,25 @@ public class SourcesFile {
public struct ParseEntry {
public string Directory;
public string Pattern;
public int SplitNumber;
}
public struct MatchEntry {
public SourcesFile SourcesFile;
public string RelativePath;
public int SplitNumber;
}
public class MatchEntryEqualityComparer : IEqualityComparer<MatchEntry> {
public bool Equals (MatchEntry x, MatchEntry y)
{
return (x.RelativePath == y.RelativePath);
}
public int GetHashCode (MatchEntry obj)
{
return obj.RelativePath?.GetHashCode() ?? 0;
}
}
public class TargetParseResult {
@@ -309,6 +331,7 @@ public class ParseResult {
yield return new MatchEntry {
SourcesFile = sourcesFile,
RelativePath = relativePath,
SplitNumber = entry.SplitNumber
};
}
} else {
@@ -329,6 +352,7 @@ public class ParseResult {
yield return new MatchEntry {
SourcesFile = sourcesFile,
RelativePath = relativePath,
SplitNumber = entry.SplitNumber
};
}
}
@@ -403,6 +427,7 @@ public class SourcesParser {
public string HostPlatform;
public string ProfileName;
public string ExclusionsFileName;
public int CurrentSplitNumber;
public int SourcesFilesParsed, ExclusionsFilesParsed;
}
@@ -413,6 +438,7 @@ public class SourcesParser {
public readonly string BaseDirectory;
private int ParseDepth = 0;
private string TargetProfileName = "";
public SourcesParser (
string platformsFolder, string profilesFolder, string baseDir
@@ -442,6 +468,7 @@ public class SourcesParser {
}
public ParseResult Parse (string libraryDirectory, string libraryName, string hostPlatform, string profile) {
TargetProfileName = profile;
var state = new State {
Result = new ParseResult (libraryDirectory),
ProfileName = profile,
@@ -581,6 +608,7 @@ public class SourcesParser {
bool asExclusionsList, string directive
) {
var include = "#include ";
var split = "#split ";
if (directive.StartsWith (include)) {
var includeName = directive.Substring (include.Length).Trim ();
var fileName = Path.Combine (includeDirectory, includeName);
@@ -598,6 +626,14 @@ public class SourcesParser {
}
file.Includes.Add (newFile);
} else if (directive.StartsWith (split)) {
if (asExclusionsList) throw new InvalidOperationException ("split directive is not valid for exclusion lists");
var profileName = directive.Substring (split.Length).Trim ();
if (profileName == TargetProfileName) {
state.CurrentSplitNumber++;
}
}
}
@@ -715,7 +751,8 @@ public class SourcesParser {
foreach (var pattern in explicitExclusions) {
result.Exclusions.Add (new ParseEntry {
Directory = pathDirectory,
Pattern = Path.Combine (mainPatternDirectory, pattern)
Pattern = Path.Combine (mainPatternDirectory, pattern),
SplitNumber = state.CurrentSplitNumber
});
}
}
@@ -723,7 +760,8 @@ public class SourcesParser {
(asExclusionsList ? result.Exclusions : result.Sources)
.Add (new ParseEntry {
Directory = pathDirectory,
Pattern = parts[0]
Pattern = parts[0],
SplitNumber = state.CurrentSplitNumber
});
}
}
+16 -3
View File
@@ -137,15 +137,28 @@ dump_table_assemblyref (MonoImage *m)
cols [MONO_ASSEMBLYREF_REV_NUMBER],
mono_metadata_string_heap (m, cols [MONO_ASSEMBLYREF_NAME]));
fprintf (output, "\tFlags=0x%08x\n", cols [MONO_ASSEMBLYREF_FLAGS]);
ptr = mono_metadata_blob_heap (m, cols [MONO_ASSEMBLYREF_PUBLIC_KEY]);
len = mono_metadata_decode_value (ptr, &ptr);
ptr = mono_metadata_blob_heap_null_ok (m, cols [MONO_ASSEMBLYREF_PUBLIC_KEY]);
if (ptr)
len = mono_metadata_decode_value (ptr, &ptr);
else
len = 0;
if (len > 0){
fprintf (output, "\tPublic Key:");
hex_dump (ptr, 0, len);
fprintf (output, "\n");
} else
fprintf (output, "\tZero sized public key\n");
ptr = mono_metadata_blob_heap_null_ok (m, cols [MONO_ASSEMBLYREF_HASH_VALUE]);
if (ptr)
len = mono_metadata_decode_value (ptr, &ptr);
else
len = 0;
if (len > 0) {
fprintf (output, "\tHash:");
hex_dump (ptr, 0, len);
fprintf (output, "\n");
} else
fprintf (output, "\tZero sized hash value\n");
}
fprintf (output, "\n");
}
+5 -1
View File
@@ -63,7 +63,11 @@ if !ENABLE_MSVC_ONLY
eglibdir=$(datadir)/mono-$(API_VER)/mono/eglib
eglib_DATA = eglib-config.h
libeglib_la_CFLAGS = -g -Wall -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE
libeglib_la_CFLAGS = -g -Wall -D_GNU_SOURCE
if !HOST_WIN32
libeglib_la_CFLAGS += -D_FORTIFY_SOURCE=2
endif
AM_CPPFLAGS = -I$(srcdir)
+1
View File
@@ -124,6 +124,7 @@
#define g_mem_set_vtable monoeg_g_mem_set_vtable
#define g_mem_get_vtable monoeg_g_mem_get_vtable
#define g_mkdtemp monoeg_g_mkdtemp
#define g_module_address monoeg_g_module_address
#define g_module_build_path monoeg_g_module_build_path
#define g_module_close monoeg_g_module_close
#define g_module_error monoeg_g_module_error
+2 -4
View File
@@ -247,13 +247,11 @@ typedef guint32 gunichar;
#define ABS(a) ((a) > 0 ? (a) : -(a))
#endif
#ifndef ALIGN_TO
#define ALIGN_TO(val,align) ((((gssize)val) + ((align) - 1)) & ~((align) - 1))
#endif
#ifndef ALIGN_PTR_TO
#define ALIGN_DOWN_TO(val,align) (((gssize)val) & ~((align) - 1))
#define ALIGN_PTR_TO(ptr,align) (gpointer)((((gssize)(ptr)) + (align - 1)) & (~(align - 1)))
#endif
#define G_STRUCT_OFFSET(p_type,field) offsetof(p_type,field)
+4 -1
View File
@@ -34,7 +34,10 @@ SOURCES = \
test_eglib_SOURCES = $(SOURCES)
GLIB_TEST_FLAGS_COMMON = -Wall -DEGLIB_TESTS=1 -D_FORTIFY_SOURCE=2 -I$(srcdir)/.. -I.. -DDRIVER_NAME=\"EGlib\"
GLIB_TEST_FLAGS_COMMON = -Wall -DEGLIB_TESTS=1 -I$(srcdir)/.. -I.. -DDRIVER_NAME=\"EGlib\"
if !HOST_WIN32
GLIB_TEST_FLAGS_COMMON += -D_FORTIFY_SOURCE=2
endif
CFLAGS += $(GLIB_TEST_FLAGS_COMMON)
CXXFLAGS += $(GLIB_TEST_FLAGS_COMMON) @CXXFLAGS_COMMON@
if HOST_AIX
-2
View File
@@ -130,13 +130,11 @@ libmonoruntime_config_la_CPPFLAGS = $(AM_CPPFLAGS) -DMONO_BINDIR=\"$(bindir)/\"
#
# Support is a separate library because it is not valid C++.
#
if !ENABLE_NETCORE
support_libraries = libmonoruntime-support.la
libmonoruntime_support_la_SOURCES = support.c
libmonoruntime_support_la_LDFLAGS = $(Z_LIBS)
libmonoruntime_support_la_CFLAGS = $(filter-out @CXX_REMOVE_CFLAGS@, @CFLAGS@) @ZLIB_CFLAGS@
endif
#
# This library contains the icall tables if the runtime was configured with --disable-icall-tables
+2 -1
View File
@@ -2725,7 +2725,8 @@ mono_alc_load_raw_bytes (MonoAssemblyLoadContext *alc, guint8 *assembly_data, gu
MonoAssembly* redirected_asm = NULL;
MonoImageOpenStatus new_status = MONO_IMAGE_OK;
if ((redirected_asm = mono_assembly_binding_applies_to_image (alc, image, &new_status))) {
// http://blogs.microsoft.co.il/sasha/2010/06/09/assemblyreflectiononlyload-ignores-assembly-binding-redirects/
if (!refonly && (redirected_asm = mono_assembly_binding_applies_to_image (alc, image, &new_status))) {
mono_image_close (image);
image = redirected_asm->image;
mono_image_addref (image); /* so that mono_image close, below, has something to do */
+38 -8
View File
@@ -28,6 +28,7 @@
#include <mono/metadata/profiler-private.h>
#include <mono/metadata/class-internals.h>
#include <mono/metadata/domain-internals.h>
#include <mono/metadata/exception-internals.h>
#include <mono/metadata/reflection-internals.h>
#include <mono/metadata/mono-endian.h>
#include <mono/metadata/mono-debug.h>
@@ -1269,6 +1270,10 @@ assemblyref_public_tok_checked (MonoImage *image, guint32 key_index, guint32 fla
public_tok = mono_metadata_blob_heap_checked (image, key_index, error);
return_val_if_nok (error, NULL);
if (!public_tok) {
mono_error_set_bad_image (error, image, "expected public key token (index = %d) in assembly reference, but the Blob heap is NULL", key_index);
return NULL;
}
len = mono_metadata_decode_blob_size (public_tok, &public_tok);
if (flags & ASSEMBLYREF_FULL_PUBLIC_KEY_FLAG) {
@@ -1478,10 +1483,18 @@ mono_assembly_get_assemblyref (MonoImage *image, int index, MonoAssemblyName *an
t = &image->tables [MONO_TABLE_ASSEMBLYREF];
mono_metadata_decode_row (t, index, cols, MONO_ASSEMBLYREF_SIZE);
hash = mono_metadata_blob_heap (image, cols [MONO_ASSEMBLYREF_HASH_VALUE]);
aname->hash_len = mono_metadata_decode_blob_size (hash, &hash);
aname->hash_value = hash;
// ECMA-335: II.22.5 - AssemblyRef
// HashValue can be null or non-null. If non-null it's an index into the blob heap
// Sometimes ILasm can create an image without a Blob heap.
hash = mono_metadata_blob_heap_null_ok (image, cols [MONO_ASSEMBLYREF_HASH_VALUE]);
if (hash) {
aname->hash_len = mono_metadata_decode_blob_size (hash, &hash);
aname->hash_value = hash;
} else {
aname->hash_len = 0;
aname->hash_value = NULL;
}
aname->name = mono_metadata_string_heap (image, cols [MONO_ASSEMBLYREF_NAME]);
aname->culture = mono_metadata_string_heap (image, cols [MONO_ASSEMBLYREF_CULTURE]);
aname->flags = cols [MONO_ASSEMBLYREF_FLAGS];
@@ -1697,7 +1710,7 @@ leave:
#endif /* ENABLE_NETCORE */
/**
* mono_assembly_get_assemblyref:
* mono_assembly_get_assemblyref_checked:
* \param image pointer to the \c MonoImage to extract the information from.
* \param index index to the assembly reference in the image.
* \param aname pointer to a \c MonoAssemblyName that will hold the returned value.
@@ -1719,10 +1732,18 @@ mono_assembly_get_assemblyref_checked (MonoImage *image, int index, MonoAssembly
if (!mono_metadata_decode_row_checked (image, t, index, cols, MONO_ASSEMBLYREF_SIZE, error))
return FALSE;
// ECMA-335: II.22.5 - AssemblyRef
// HashValue can be null or non-null. If non-null it's an index into the blob heap
// Sometimes ILasm can create an image without a Blob heap.
hash = mono_metadata_blob_heap_checked (image, cols [MONO_ASSEMBLYREF_HASH_VALUE], error);
return_val_if_nok (error, FALSE);
aname->hash_len = mono_metadata_decode_blob_size (hash, &hash);
aname->hash_value = hash;
if (hash) {
aname->hash_len = mono_metadata_decode_blob_size (hash, &hash);
aname->hash_value = hash;
} else {
aname->hash_len = 0;
aname->hash_value = NULL;
}
aname->name = mono_metadata_string_heap_checked (image, cols [MONO_ASSEMBLYREF_NAME], error);
return_val_if_nok (error, FALSE);
aname->culture = mono_metadata_string_heap_checked (image, cols [MONO_ASSEMBLYREF_CULTURE], error);
@@ -1769,7 +1790,15 @@ mono_assembly_load_reference (MonoImage *image, int index)
if (reference)
return;
mono_assembly_get_assemblyref (image, index, &aname);
mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_ASSEMBLY, "Requesting loading reference %d (of %d) of %s", index, image->nreferences, image->name);
ERROR_DECL (local_error);
mono_assembly_get_assemblyref_checked (image, index, &aname, local_error);
if (!is_ok (local_error)) {
mono_trace (G_LOG_LEVEL_WARNING, MONO_TRACE_ASSEMBLY, "Decoding assembly reference %d (of %d) of %s failed due to: %s", index, image->nreferences, image->name, mono_error_get_message (local_error));
mono_error_cleanup (local_error);
goto commit_reference;
}
if (image->assembly) {
if (mono_trace_is_traced (G_LOG_LEVEL_INFO, MONO_TRACE_ASSEMBLY)) {
@@ -1839,6 +1868,7 @@ mono_assembly_load_reference (MonoImage *image, int index)
}
commit_reference:
mono_assemblies_lock ();
if (reference == NULL) {
/* Flag as not found */
+23 -6
View File
@@ -767,6 +767,7 @@ check_valid_generic_inst_arguments (MonoGenericInst *inst, MonoError *error)
/*
* Create the `MonoClass' for an instantiation of a generic type.
* We only do this if we actually need it.
* This will sometimes return a GTD due to checking the cached_class.
*/
MonoClass*
mono_class_create_generic_inst (MonoGenericClass *gclass)
@@ -1186,7 +1187,7 @@ static MonoClass*
make_generic_param_class (MonoGenericParam *param)
{
MonoClass *klass, **ptr;
int count, pos, i;
int count, pos, i, min_align;
MonoGenericParamInfo *pinfo = mono_generic_param_info (param);
MonoGenericContainer *container = mono_generic_param_owner (param);
g_assert_checked (container);
@@ -1259,13 +1260,17 @@ make_generic_param_class (MonoGenericParam *param)
/* We don't use type_token for VAR since only classes can use it (not arrays, pointer, VARs, etc) */
klass->sizes.generic_param_token = !is_anonymous ? pinfo->token : 0;
/*Init these fields to sane values*/
klass->min_align = 1;
if (param->gshared_constraint) {
MonoClass *constraint_class = mono_class_from_mono_type_internal (param->gshared_constraint);
mono_class_init_sizes (constraint_class);
klass->has_references = m_class_has_references (constraint_class);
}
/*
* This makes sure the the value size of this class is equal to the size of the types the gparam is
* constrained to, the JIT depends on this.
*/
klass->instance_size = MONO_ABI_SIZEOF (MonoObject) + mono_type_stack_size_internal (m_class_get_byval_arg (klass), NULL, TRUE);
klass->instance_size = MONO_ABI_SIZEOF (MonoObject) + mono_type_size (m_class_get_byval_arg (klass), &min_align);
klass->min_align = min_align;
mono_memory_barrier ();
klass->size_inited = 1;
@@ -3030,6 +3035,8 @@ mono_class_setup_vtable_general (MonoClass *klass, MonoMethod **overrides, int o
if (decl->is_inflated) {
override = mono_class_inflate_generic_method_checked (override, mono_method_get_context (decl), error);
mono_error_assert_ok (error);
} else if (mono_class_is_gtd (override->klass)) {
override = mono_class_inflate_generic_method_full_checked (override, ic, mono_class_get_context (ic), error);
}
if (!apply_override (klass, ic, vtable, decl, override, &override_map, &override_class_map, &conflict_map))
goto fail;
@@ -3901,7 +3908,7 @@ mono_class_layout_fields (MonoClass *klass, int base_instance_size, int packing_
MonoType *klass_byval_arg = m_class_get_byval_arg (klass);
if (klass_byval_arg->type == MONO_TYPE_VAR || klass_byval_arg->type == MONO_TYPE_MVAR)
instance_size = MONO_ABI_SIZEOF (MonoObject) + mono_type_stack_size_internal (klass_byval_arg, NULL, TRUE);
instance_size = MONO_ABI_SIZEOF (MonoObject) + mono_type_size (klass_byval_arg, &min_align);
else if (klass_byval_arg->type == MONO_TYPE_PTR)
instance_size = MONO_ABI_SIZEOF (MonoObject) + MONO_ABI_SIZEOF (gpointer);
@@ -4137,10 +4144,20 @@ static void
setup_generic_array_ifaces (MonoClass *klass, MonoClass *iface, MonoMethod **methods, int pos, GHashTable *cache)
{
MonoGenericContext tmp_context;
MonoGenericClass *gclass;
int i;
// The interface can sometimes be a GTD in cases like IList
// See: https://github.com/mono/mono/issues/7095#issuecomment-470465597
if (mono_class_is_gtd (iface)) {
MonoType *ty = mono_class_gtd_get_canonical_inst (iface);
g_assert (ty->type == MONO_TYPE_GENERICINST);
gclass = ty->data.generic_class;
} else
gclass = mono_class_get_generic_class (iface);
tmp_context.class_inst = NULL;
tmp_context.method_inst = mono_class_get_generic_class (iface)->context.class_inst;
tmp_context.method_inst = gclass->context.class_inst;
//g_print ("setting up array interface: %s\n", mono_type_get_name_full (m_class_get_byval_arg (iface), 0));
for (i = 0; i < generic_array_method_num; i++) {
+15 -3
View File
@@ -2543,9 +2543,12 @@ static int STDCALL
cominterop_ccw_addref (MonoCCWInterface* ccwe)
{
int result;
gpointer dummy;
gpointer orig_domain = mono_threads_attach_coop (mono_domain_get (), &dummy);
MONO_ENTER_GC_UNSAFE;
result = cominterop_ccw_addref_impl (ccwe);
MONO_EXIT_GC_UNSAFE;
mono_threads_detach_coop (orig_domain, &dummy);
return result;
}
@@ -2574,9 +2577,12 @@ static int STDCALL
cominterop_ccw_release (MonoCCWInterface* ccwe)
{
int result;
gpointer dummy;
gpointer orig_domain = mono_threads_attach_coop (mono_domain_get (), &dummy);
MONO_ENTER_GC_UNSAFE;
result = cominterop_ccw_release_impl (ccwe);
MONO_EXIT_GC_UNSAFE;
mono_threads_detach_coop (orig_domain, &dummy);
return result;
}
@@ -2623,9 +2629,12 @@ static int STDCALL
cominterop_ccw_queryinterface (MonoCCWInterface* ccwe, const guint8* riid, gpointer* ppv)
{
int result;
gpointer dummy;
gpointer orig_domain = mono_threads_attach_coop (mono_domain_get (), &dummy);
MONO_ENTER_GC_UNSAFE;
result = cominterop_ccw_queryinterface_impl (ccwe, riid, ppv);
MONO_EXIT_GC_UNSAFE;
mono_threads_detach_coop (orig_domain, &dummy);
return result;
}
@@ -2655,7 +2664,7 @@ cominterop_ccw_queryinterface_impl (MonoCCWInterface* ccwe, const guint8* riid,
*ppv = cominterop_get_ccw_checked (object, mono_class_get_iunknown_class (), error);
mono_error_assert_ok (error);
/* remember to addref on QI */
cominterop_ccw_addref ((MonoCCWInterface *)*ppv);
cominterop_ccw_addref_impl ((MonoCCWInterface *)*ppv);
return MONO_S_OK;
}
@@ -2667,7 +2676,7 @@ cominterop_ccw_queryinterface_impl (MonoCCWInterface* ccwe, const guint8* riid,
*ppv = cominterop_get_ccw_checked (object, mono_class_get_idispatch_class (), error);
mono_error_assert_ok (error);
/* remember to addref on QI */
cominterop_ccw_addref ((MonoCCWInterface *)*ppv);
cominterop_ccw_addref_impl ((MonoCCWInterface *)*ppv);
return MONO_S_OK;
}
@@ -2707,7 +2716,7 @@ cominterop_ccw_queryinterface_impl (MonoCCWInterface* ccwe, const guint8* riid,
return MONO_E_NOINTERFACE;
}
/* remember to addref on QI */
cominterop_ccw_addref ((MonoCCWInterface *)*ppv);
cominterop_ccw_addref_impl ((MonoCCWInterface *)*ppv);
return MONO_S_OK;
}
@@ -2743,9 +2752,12 @@ cominterop_ccw_get_ids_of_names (MonoCCWInterface* ccwe, gpointer riid,
guint32 lcid, gint32 *rgDispId)
{
int result;
gpointer dummy;
gpointer orig_domain = mono_threads_attach_coop (mono_domain_get(), &dummy);
MONO_ENTER_GC_UNSAFE;
result = cominterop_ccw_get_ids_of_names_impl (ccwe, riid, rgszNames, cNames, lcid, rgDispId);
MONO_EXIT_GC_UNSAFE;
mono_threads_detach_coop (orig_domain, &dummy);
return result;
}
+3 -3
View File
@@ -172,8 +172,7 @@ mono_ppdb_load_file (MonoImage *image, const guint8 *raw_contents, int size)
return NULL;
}
// Temporarily disabled to unblock Roslyn
#if HOST_WIN32 //|| HAVE_SYS_ZLIB
#if HOST_WIN32 || HAVE_SYS_ZLIB
if (ppdb_data) {
/* Embedded PPDB data */
/* ppdb_size is the uncompressed size */
@@ -436,7 +435,8 @@ mono_ppdb_lookup_location (MonoDebugMethodInfo *minfo, uint32_t offset)
}
location = g_new0 (MonoDebugSourceLocation, 1);
location->source_file = docname;
if (docname && docname [0])
location->source_file = docname;
location->row = start_line;
location->column = start_col;
location->il_offset = iloffset;
+10 -3
View File
@@ -590,20 +590,27 @@ mono_init_internal (const char *filename, const char *exe_filename, const char *
mono_fixup_exe_image (exe_image);
#endif
} else if (runtime_version != NULL) {
runtimes = g_slist_prepend (runtimes, (gpointer)get_runtime_by_version (runtime_version));
const MonoRuntimeInfo* rt = get_runtime_by_version (runtime_version);
if (rt != NULL)
runtimes = g_slist_prepend (runtimes, (gpointer)rt);
}
if (runtimes == NULL) {
const MonoRuntimeInfo *default_runtime = get_runtime_by_version (DEFAULT_RUNTIME_VERSION);
g_assert (default_runtime);
runtimes = g_slist_prepend (runtimes, (gpointer)default_runtime);
g_print ("WARNING: The runtime version supported by this application is unavailable.\n");
if (runtime_version != NULL)
g_print ("WARNING: The requested runtime version \"%s\" is unavailable.\n", runtime_version);
else
g_print ("WARNING: The runtime version supported by this application is unavailable.\n");
g_print ("Using default runtime: %s\n", default_runtime->runtime_version);
}
/* The selected runtime will be the first one for which there is a mscrolib.dll */
GSList *tmp = runtimes;
while (tmp != NULL) {
current_runtime = (MonoRuntimeInfo*)runtimes->data;
current_runtime = (MonoRuntimeInfo*)tmp->data;
g_assert (current_runtime);
ass = mono_assembly_load_corlib (current_runtime, &status);
if (status != MONO_IMAGE_OK && status != MONO_IMAGE_ERROR_ERRNO)
break;
+9 -4
View File
@@ -118,6 +118,7 @@
#include "icall-decl.h"
#include "mono/utils/mono-threads-coop.h"
#include "mono/metadata/icall-signatures.h"
#include "mono/utils/mono-signal-handler.h"
//#define MONO_DEBUG_ICALLARRAY
@@ -6470,7 +6471,7 @@ ves_icall_Mono_Runtime_ExceptionToState (MonoExceptionHandle exc_handle, guint64
// FIXME: Push handles down into mini/mini-exceptions.c
MonoException *exc = MONO_HANDLE_RAW (exc_handle);
MonoThreadSummary out;
mono_summarize_timeline_start ();
mono_summarize_timeline_start ("ExceptionToState");
mono_summarize_timeline_phase_log (MonoSummarySuspendHandshake);
mono_summarize_timeline_phase_log (MonoSummaryUnmanagedStacks);
mono_get_eh_callbacks ()->mono_summarize_exception (exc, &out);
@@ -6515,8 +6516,7 @@ ves_icall_Mono_Runtime_SendMicrosoftTelemetry (const char *payload, guint64 port
hashes.offset_free_hash = portable_hash;
hashes.offset_rich_hash = unportable_hash;
// Tells mono that we want to send the HANG EXC_TYPE.
const char *signal = "SIGTERM";
const char *signal = "MANAGED_EXCEPTION";
gboolean success = mono_merp_invoke (crashed_pid, signal, payload, &hashes);
if (!success) {
@@ -6634,7 +6634,7 @@ ves_icall_Mono_Runtime_DumpStateTotal (guint64 *portable_hash, guint64 *unportab
mono_get_runtime_callbacks ()->install_state_summarizer ();
mono_summarize_timeline_start ();
mono_summarize_timeline_start ("DumpStateTotal");
gboolean success = mono_threads_summarize (ctx, &out, &hashes, TRUE, FALSE, scratch, MONO_MAX_SUMMARY_LEN_ICALL);
mono_summarize_timeline_phase_log (MonoSummaryCleanup);
@@ -7736,7 +7736,12 @@ ves_icall_System_Environment_FailFast (MonoStringHandle message, MonoExceptionHa
} else {
char *msg = mono_string_handle_to_utf8 (message, error);
g_warning ("CLR: Managed code called FailFast, saying \"%s\"", msg);
#ifndef DISABLE_CRASH_REPORTING
char *old_msg = mono_crash_save_failfast_msg (msg);
g_free (old_msg);
#else
g_free (msg);
#endif
}
if (!MONO_HANDLE_IS_NULL (exception)) {
+2
View File
@@ -907,6 +907,8 @@ mono_image_load_metadata (MonoImage *image, MonoCLIImageInfo *iinfo);
const char*
mono_metadata_string_heap_checked (MonoImage *meta, uint32_t table_index, MonoError *error);
const char *
mono_metadata_blob_heap_null_ok (MonoImage *meta, guint32 index);
const char*
mono_metadata_blob_heap_checked (MonoImage *meta, uint32_t table_index, MonoError *error);
gboolean
+24 -1
View File
@@ -1078,22 +1078,45 @@ mono_metadata_user_string (MonoImage *meta, guint32 index)
const char *
mono_metadata_blob_heap (MonoImage *meta, guint32 index)
{
/* Some tools can produce assemblies with a size 0 Blob stream. If a
* blob value is optional, if the index == 0 and heap_blob.size == 0
* assertion is hit, consider updating caller to use
* mono_metadata_blob_heap_null_ok and handling a null return value. */
g_assert (!(index == 0 && meta->heap_blob.size == 0));
g_assert (index < meta->heap_blob.size);
g_return_val_if_fail (index < meta->heap_blob.size, "");/*FIXME shouldn't we return NULL and check for index == 0?*/
return meta->heap_blob.data + index;
}
/**
* mono_metadata_blob_heap_null_ok:
* \param meta metadata context
* \param index index into the blob.
* \return an in-memory pointer to the \p index in the Blob heap.
* If the Blob heap is empty or missing and index is 0 returns NULL, instead of asserting.
*/
const char *
mono_metadata_blob_heap_null_ok (MonoImage *meta, guint32 index)
{
if (G_UNLIKELY (index == 0 && meta->heap_blob.size == 0))
return NULL;
else
return mono_metadata_blob_heap (meta, index);
}
/**
* mono_metadata_blob_heap_checked:
* \param meta metadata context
* \param index index into the blob.
* \param error set on error
* \returns an in-memory pointer to the \p index in the Blob heap. On failure sets \p error and returns NULL;
* If the Blob heap is empty or missing and \p index is 0 returns NULL, without setting error.
*
*/
const char *
mono_metadata_blob_heap_checked (MonoImage *meta, guint32 index, MonoError *error)
{
if (G_UNLIKELY (index == 0 && meta->heap_blob.size == 0))
return NULL;
if (G_UNLIKELY (!(index < meta->heap_blob.size))) {
mono_error_set_bad_image_by_name (error, meta->name ? meta->name : "unknown image", "blob heap index %u out of bounds %u", index, meta->heap_blob.size);
return NULL;
+6 -4
View File
@@ -97,12 +97,14 @@ typedef struct {
extern MonoProfilerState mono_profiler_state;
typedef struct {
guchar *cil_code;
guint32 count;
} MonoProfilerCoverageInfoEntry;
typedef struct {
guint32 entries;
struct {
guchar *cil_code;
guint32 count;
} data [1];
MonoProfilerCoverageInfoEntry data [MONO_ZERO_LEN_ARRAY];
} MonoProfilerCoverageInfo;
void mono_profiler_started (void);
+1 -1
View File
@@ -435,7 +435,7 @@ mono_profiler_coverage_alloc (MonoMethod *method, guint32 entries)
coverage_lock ();
MonoProfilerCoverageInfo *info = g_malloc0 (sizeof (MonoProfilerCoverageInfo) + SIZEOF_VOID_P * 2 * entries);
MonoProfilerCoverageInfo *info = g_malloc0 (sizeof (MonoProfilerCoverageInfo) + sizeof (MonoProfilerCoverageInfoEntry) * entries);
info->entries = entries;
+8 -1
View File
@@ -2634,7 +2634,7 @@ mono_gc_get_allocated_bytes_for_current_thread (void)
info = mono_thread_info_current ();
/*There are some more allocated bytes in the current tlab that have not been recorded yet */
return info->total_bytes_allocated + info->tlab_next - info->tlab_start;
return info->total_bytes_allocated + (ptrdiff_t)(info->tlab_next - info->tlab_start);
}
guint64
@@ -3013,6 +3013,13 @@ sgen_client_handle_gc_debug (const char *opt)
mono_log_finalizers = TRUE;
} else if (!strcmp (opt, "no-managed-allocator")) {
sgen_set_use_managed_allocator (FALSE);
} else if (!strcmp (opt, "managed-allocator")) {
/*
* This option can be used to override the disabling of the managed allocator by
* the nursery canaries option. This can be used when knowing for sure that no
* aot code will be used by the application.
*/
sgen_set_use_managed_allocator (TRUE);
} else if (!sgen_bridge_handle_gc_debug (opt)) {
return FALSE;
}
+33
View File
@@ -1550,6 +1550,34 @@ mono_thread_attach (MonoDomain *domain)
return thread;
}
/**
* mono_threads_attach_tools_thread:
*
* Attach the current thread as a tool thread. DON'T USE THIS FUNCTION WITHOUT READING ALL DISCLAIMERS.
*
* A tools thread is a very special kind of thread that needs access to core
* runtime facilities but should not be counted as a regular thread for high
* order facilities such as executing managed code or accessing the managed
* heap.
*
* This is intended only for low-level utilities than need to be able to use
* some low-level runtime facilities when doing things like resolving
* backtraces in their background processing thread.
*
* Note in particular that the thread is not fully attached - it does not have
* a "current domain" because it cannot run managed code or interact with
* managed objects. However it can act on some metadata, and use our low-level
* locks and the coop thread state machine (ie GC Safe and GC Unsafe
* transitions make sense).
*/
void
mono_threads_attach_tools_thread (void)
{
MonoThreadInfo *info = mono_thread_info_attach ();
g_assert (info);
mono_thread_info_set_flags (MONO_THREAD_INFO_FLAGS_NO_GC | MONO_THREAD_INFO_FLAGS_NO_SAMPLE);
}
/**
* mono_thread_detach:
*/
@@ -1560,6 +1588,8 @@ mono_thread_detach (MonoThread *thread)
mono_thread_detach_internal (thread->internal_thread);
}
/**
* mono_thread_detach_if_exiting:
*
@@ -6483,6 +6513,9 @@ summarizer_state_term (SummarizerGlobalState *state, gchar **out, gchar *mem, si
mono_get_eh_callbacks ()->mono_summarize_managed_stack (threads [i]);
}
/* The value of the breadcrumb should match the "StackHash" value written by `mono_merp_write_fingerprint_payload` */
mono_create_crash_hash_breadcrumb (controlling);
MonoStateWriter writer;
memset (&writer, 0, sizeof (writer));
+3
View File
@@ -44,6 +44,9 @@ MONO_API MonoThread *mono_thread_attach (MonoDomain *domain);
MONO_API void mono_thread_detach (MonoThread *thread);
MONO_API void mono_thread_exit (void);
MONO_API MONO_RT_EXTERNAL_ONLY void
mono_threads_attach_tools_thread (void);
MONO_API char *mono_thread_get_name_utf8 (MonoThread *thread);
MONO_API int32_t mono_thread_get_managed_id (MonoThread *thread);
+2 -2
View File
@@ -74,7 +74,7 @@ TOOLS_RUNTIME = MONO_PATH=$(mcs_topdir)/class/lib/build $(top_builddir)/runtime/
INTERP_RUNTIME = $(MINI_RUNTIME) --interpreter
RUNTIME_AOTCHECK = MONO_PATH="$(CLASS)$(PLATFORM_PATH_SEPARATOR)." $(RUNTIME_EXECUTABLE)
MCS = CSC_SDK_PATH_DISABLED= $(TOOLS_RUNTIME) $(CSC) -langversion:7.2 -nostdlib -unsafe -nowarn:0162 -nologo -noconfig -r:$(CLASS)/mscorlib.dll -r:$(CLASS)/System.dll -r:$(CLASS)/System.Core.dll
MCS = CSC_SDK_PATH_DISABLED= $(TOOLS_RUNTIME) $(CSC) -langversion:8.0 -nostdlib -unsafe -nowarn:0162 -nologo -noconfig -r:$(CLASS)/mscorlib.dll -r:$(CLASS)/System.dll -r:$(CLASS)/System.Core.dll
ILASM = $(TOOLS_RUNTIME) $(mcs_topdir)/class/lib/build/ilasm.exe
if !ENABLE_MSVC_ONLY
@@ -825,7 +825,7 @@ MemoryIntrinsics.dll: MemoryIntrinsics.il
GENMDESC_OPTS=
GENMDESC_PRG=python $(srcdir)/genmdesc.py $(target_define) $(srcdir)
GENMDESC_PRG=$(PYTHON) $(srcdir)/genmdesc.py $(target_define) $(srcdir)
cpu-wasm.h: mini-ops.h cpu-wasm.md $(srcdir)/genmdesc.py
$(GENMDESC_PRG) cpu-wasm.h wasm_desc $(srcdir)/cpu-wasm.md
Loaded 100 of 176 files, more files were not shown because too many files have changed in this diff. Show more