Compare commits

..
227 Commits
Author SHA1 Message Date
Zoltan Varga ef79d2e0eb Fix the mcs-compileall test target. 2014-11-20 12:53:39 -05:00
Zoltan Varga 3d6ebf929e Remove net 2.0 dependencies from mcs tests. 2014-11-20 04:34:07 -05:00
Zoltan Varga ea3575cfaa Remove build system support for the net 2.0/3.5 profiles. 2014-11-20 04:18:02 -05:00
Zoltan Varga 3130eb18ce Fix a warning. 2014-11-20 00:06:03 -05:00
Zoltan Varga 9d3d8a5c53 Fix a warning. 2014-11-20 00:05:36 -05:00
Miguel de Icaza 716b78c578 Add referencesource submodule 2014-11-19 21:01:39 -05:00
Zoltan Varga 5644d157c8 Merge pull request #1411 from jbevain/sdb-frame-domain
[sdb] Expose the domain of the stack frames
2014-11-19 20:51:34 -05:00
Zoltan Varga 2c7265d6b9 [jit] Remove an unused interpeter file. 2014-11-19 19:20:02 -05:00
Zoltan Varga fb033c5301 [jit] Remove some unused defines. 2014-11-19 19:13:01 -05:00
Mark Probst d1b51438d1 [sgen] Remove dead code. 2014-11-19 12:46:39 -08:00
Miguel de Icaza 014f882aea Merge pull request #1415 from ermshiperete/FixTruncatedButton
[MWF] Fix bug that truncates button text
2014-11-19 14:05:03 -05:00
Zoltan Varga b464556d05 Merge pull request #1414 from ExonyLimited/process-vmswap
Process.PagedMemorySize64 now returns value from /proc/PID/status
2014-11-19 13:58:25 -05:00
Eberhard Beilharz da058bf8a4 [MWF] Fix bug that truncates button text
A previous change (885b065e) accidentally calculated the text size
in some places without padding. This resulted in a slightly to small
text rectangle, causing the text to be truncated.
2014-11-19 19:48:27 +01:00
Marek Safar 87f59dce24 Fixes build 2014-11-19 18:07:52 +01:00
Marek Safar 4de9aa838b [corlib] Capture awaited task exception stack. First part of #18629 2014-11-19 17:41:52 +01:00
Craig Minihan 1cc51f63ee Process.PagedMemorySize64 now returns value from /proc/PID/status 2014-11-19 08:07:37 -08:00
Rolf Bjarne Kvinge fbf1077afd Fix typo, there is no profile called 'xammaci'. 2014-11-19 10:29:33 +01:00
Mark Probst 38d9679d82 Merge pull request #1413 from BrzVlad/bin-prot-io
System calls for binary protocol writing
2014-11-18 17:59:16 -08:00
Vlad Brezae 66acb4f3e1 [sgen] Don't use standard C API for binary protocol IO.
This prevents deadlocks from libc locks when interrupting.
2014-11-18 17:56:01 -08:00
Zoltan Varga fccff0d9bb [sdb] Avoid asserts on shutdown when the appdomain unload callbacks are called on the debugger thread during shutdown. Fixes #24342. 2014-11-18 20:54:12 -05:00
Vlad Brezae 3c1147121e [sgen] Fix binary protocol build 2014-11-18 17:36:50 -08:00
Zoltan Varga 672a02e177 [jit] Fix the calculation of the epilog size for EH info. Fixes #24577. 2014-11-18 16:53:26 -05:00
Rodrigo Kumpera 4f2e8dfddd [runtime] Replace mono_method_get_signature(_full) with the _checked variant. 2014-11-18 16:51:07 -05:00
Rodrigo Kumpera f8de60d964 [runtime] Introduce mono_method_get_signature_checked as the MonoError variant of mono_method_get_signature_full. 2014-11-18 16:51:06 -05:00
Rodrigo Kumpera d67dd77506 [runtime] Remove monodiet.c. 2014-11-18 16:51:06 -05:00
Zoltan Varga 9347782b8b [jit] Remove an assert from mono_arch_find_jit_info () on x86 which can be hit when a profiler stack walk is done while in a jump trampoline. 2014-11-18 16:03:51 -05:00
Rodrigo Kumpera 939fa90ceb [jit] Use _checked variant of mono_field_from_token. 2014-11-18 14:04:10 -05:00
Rodrigo Kumpera e94e5e5ac1 [runtime] Use _checked variant of mono_field_from_token. 2014-11-18 14:04:10 -05:00
Rodrigo Kumpera 01f892bdb5 [jit] Use MonoError when possible for error handling. 2014-11-18 14:04:09 -05:00
Rodrigo Kumpera d1c8e68397 [jit] Add a JIT failure mode that uses MonoError. 2014-11-18 14:04:09 -05:00
Rodrigo Kumpera c544d330dd [runtime] more loader error cleanup. 2014-11-18 14:04:09 -05:00
Ludovic Henry c9c80ce2ce [runtime] Fix #24605 "counters not enabled" message in monodis and peverify 2014-11-18 11:51:43 -05:00
Marek Safar 383daff454 [eval] Don't assumen all captured types have storey assigned 2014-11-18 16:51:11 +01:00
Marek Safar 281934e127 [mcs] Remove primary constructors and declaration expressions from C#6 2014-11-18 14:44:16 +01:00
Jb Evain 567834db69 [Mono.Debugger.Soft] Add test for StackFrame.Domain
Assert that the property returns the proper domain for the stack frame.
2014-11-18 14:12:36 +01:00
Marek Safar 2cee8a135e [mcs] Fix error reporting for incomplete attribute target. Fixes #24537 2014-11-18 14:11:59 +01:00
Jb Evain 2729751fcf [Mono.Debugger.Soft] Implement StackFrame.Domain
This property uses the new CMD_STACK_FRAME_GET_DOMAIN command
to retrieve and cache the domain in which the stack frame
is executing.

Bump the protocol version to match the runtime.
2014-11-18 14:10:53 +01:00
Jb Evain f37be5d96b [sdb] Add command CMD_STACK_FRAME_GET_DOMAIN
This command returns the domain in which the stack frame is executing

Bump protocol version.
2014-11-18 14:09:15 +01:00
Marek Safar 20c5941b4c [mcs] Less cascading errors 2014-11-18 13:40:56 +01:00
Marek Safar b9e6127506 [mcs] Makes flow analysis of goto/goto case significantly faster. Fixes #24511 2014-11-18 10:28:55 +01:00
Zoltan Varga df8abf4920 [jit] Fix a class initialization race which happens if a class initializer initializes a got slot before it finishes running. Fixes #23242. 2014-11-17 21:44:35 -05:00
Zoltan Varga 6b7a11a77b [aot] Disable COM support in AOT code, the COM wrapper code doesn't play well with AOT. 2014-11-17 17:42:35 -05:00
Mark Probst 40c30b5288 Merge pull request #1406 from BrzVlad/monitor-resurrect
Keep the monitor link to the object active also in the resurrection case
2014-11-17 14:17:32 -08:00
Rodrigo Kumpera 3ad76e42b2 Merge pull request #1388 from schani/fix-23401
Fix 23401
2014-11-17 17:17:04 -05:00
Zoltan Varga b3e8e1fa20 [runtime] Avoid crashes when a non-runtime thread receives a SIGQUIT. 2014-11-17 17:03:41 -05:00
Sebastien Pouliot 59b80fb93b Merge pull request #1408 from brendanzagaeski/signed-xml-bug-7716
[System.Security] Fix SignedXml bug #7716 with tests
2014-11-17 16:32:54 -05:00
Zoltan Varga e52d20ed7d [arm] Applied patch from Richard Dunkley <[email protected]>. Fix complication problems with newer gcc versions. Fixes #24588. 2014-11-17 15:46:39 -05:00
Brendan Zagaeski c5375566d5 [System.Security] Fix SignedXml bug #7716 with tests
The underlying problem for bug 7716 [1] was that the Mono C14N XML
canonicalizer was not sorting the XML attributes in the same order as
Microsoft .NET's canonicalizer.

The C14N specification [2] states: "the attributes are sorted
lexicographically by attribute name (based on Unicode character code
points)." This wording suggests that the order of attributes should be
strictly ascending based on Unicode byte value. This commit changes the
attribute sort order to match the specification.

The new tests pass on Windows, fail on Mono before this change, and
succeed on Mono after this change.

[1] https://bugzilla.xamarin.com/show_bug.cgi?id=7716
[2] http://www.w3.org/TR/2000/WD-xml-c14n-20000119.html
2014-11-17 15:45:53 -05:00
Vlad Brezae 09edaaf4d4 Keep the monitor link to the object active also in the resurrection case.
The MonoThreadsSync data field contains a weak reference to the object that uses the structure, which should be a tracking one.
2014-11-17 12:23:32 -08:00
Rodrigo Kumpera c12c27a9a9 Merge pull request #1405 from mono/revert-1289-stackframe
Revert "Improved exception stack frame displayed data."
2014-11-17 14:39:43 -05:00
Rodrigo Kumpera 7e7fce7bf1 Revert "Improved exception stack frame displayed data." 2014-11-17 14:37:41 -05:00
Rodrigo Kumpera f256f515de Merge pull request #1289 from esdrubal/stackframe
Improved exception stack frame displayed data.
2014-11-17 12:44:35 -05:00
Marcos Henrich 937c7233d2 Changed METHOD_EXIT_IL_OFFSET back to 0xffffff.
The previous value was -2, that could introduce comparison issues.
Added flag MONO_SEQ_POINT_FLAG_EXIT_IL that is used to encode the exit IL, this avoids a 4 byte IL offset delta.
2014-11-17 20:47:43 +08:00
Marcos Henrich 8bf7d26eaa Added out_buf parameter to encode_var_int and decode_var_int. 2014-11-17 18:20:15 +08:00
Marcos Henrich c6fb27e6e9 Renamed seq_point_info_write_size to seq_point_info_get_write_size. 2014-11-17 17:54:51 +08:00
Marcos Henrich 0f2444e940 MonoSeqPointInfo data is now compressed.
Encode data MonoSeqPointInfo len, has_debug_data and alloc_data into a single variable int.
2014-11-17 17:54:50 +08:00
Marcos Henrich 698e12809f MonoSeqPointInfo no longer uses a GByteArray.
GByteArray requires too much memory, we still use GByteArray to build the buffer but when its done we store in MonoSeqPointInfo a copy.
2014-11-17 17:54:49 +08:00
Marcos Henrich 95b1a5bbf9 Merged SeqPoint.next_array with SeqPoint.array. 2014-11-17 17:54:49 +08:00
Marcos Henrich 63dce7b8e3 SeqPoint next array is no longer allocated by default.
Next array will only be allocated if has_debug_data is true.
2014-11-17 17:54:48 +08:00
Marcos Henrich ba7b9fc562 Added size of sequence points to mono jit stats. 2014-11-17 17:54:48 +08:00
Marcos Henrich 49b7ef4442 Ignore seq points of entry and exit IL offsets.
Those seq points are only required for debugging.
2014-11-17 17:54:47 +08:00
Marcos Henrich 6dea3629f7 Changed mini-exceptions functions to get IL offsets from seq point.
mono_walk_stack_full and ves_icall_get_trace are now using find_prev_seq_point_for_native_offset to retrieve IL offsets.
2014-11-17 17:54:46 +08:00
Marcos Henrich e8412d602f Sequence points debug data is no longer store by default.
Debug data is only stored when cfg->gen_seq_points_debug_data is true.
2014-11-17 17:54:45 +08:00
Marcos Henrich d55bb757b3 Sequence points are now generated by default. 2014-11-17 17:54:23 +08:00
Marcos Henrich 4c8d5ee138 Changed METHOD_EXIT_IL_OFFSET to -2
The new value produces lower deltas and does not overflow when using variable integer encoding.
2014-11-15 03:44:10 +08:00
Marcos Henrich 49c48add7b aot-runtime and aot-compiler now use seq_point_info_read/write. 2014-11-15 03:44:09 +08:00
Marcos Henrich eecf7a8ab5 Added methods to read and write MonoSeqPointInfo. 2014-11-15 03:44:09 +08:00
Marcos Henrich 09bd838116 SeqPoint are now kept in memory with a compact encoding.
MonoSeqPointInfo has now a pointer to a buffer containing encoded sequence points, and to a buffer containing next values.
As there is no longer an array of SeqPoint ready to be read, SeqPointIterator was added.
2014-11-15 03:44:08 +08:00
Marcos Henrich d07e74a3f1 Moved sequence point logic to seq-points.h and seq-points.c 2014-11-15 03:44:07 +08:00
Marcos Henrich afc92f22dc Improved exception stack frame displayed data.
Added stack frame method address display.
2014-11-15 03:43:54 +08:00
Marcos Henrich 20523739f8 Added to StackFrame a field for the method address.
Incremented MONO_CORLIB_VERSION.
2014-11-15 03:34:31 +08:00
Zoltan Varga 4f237e0ce1 [runtime] Fix the errors in edb931dfb9 so it actually works. 2014-11-13 22:26:14 -05:00
Mark Probst 06b8128992 [sgen] Add a FIXME. 2014-11-13 15:46:05 -08:00
Mark Probst 7bd3bd73d5 [sgen] Never mark from two threads at the same time.
We don't update mark bits atomically, so we can't have two threads
marking at the same time, which means we have to stop the concurrent
collector worker thread while we do work in the main GC thread.  That
includes nursery collections, because they also touch mark bits.

Also problematic are mod-union updates.  The worker threads can add
global remsets, which they do in the main cardtable.  This will conflict
with updating the mod-union table, so having the workers stopped also
applies there.
2014-11-13 15:46:01 -08:00
Mark Probst e12085b4c9 [sgen] Reorganize sgen_perform_collection for clarity. 2014-11-13 15:44:28 -08:00
Mark Probst 1624ec14c3 [sgen] Make check-mark-bits work again. 2014-11-13 15:44:28 -08:00
Mark Probst b87d9685bb [sgen] Scan the whole nursery in the finish mark pause.
Before we do all the major heap work in the finish mark pause of a
concurrent collection, we perform a nursery collection, for simplicity's
sake.

The nursery collection left pinned objects in the nursery, without
following their references into the major heap, so the major heap work
had to scan those objects again.  There was no special provisioning
for this—major mark would do the pinning again, and we would
automatically end up scanning the objects again.

The way we determine the stack end for the GC thread, however,
had the effect of making pinning non-deterministic.  We would
conservatively scan part of the GC thread's stack, which was
subject to change, to pinning again might result in less or more
objects pinned.

The proper solution would be to determine the stack end correctly,
but for now we will just the whole nursery.
2014-11-13 15:44:27 -08:00
Mark Probst 537665b54e [sgen] Only count cards for STW protocol if heavy is enabled. 2014-11-13 15:44:26 -08:00
Mark Probst 3639ee61f1 [sgen] Binary protocol entry for pin stage. 2014-11-13 15:44:15 -08:00
Mark Probst fbfe8518ce [sgen] Add missing volatile. 2014-11-13 15:44:14 -08:00
Rolf Bjarne Kvinge 597183658e [System] Ignore two tests which are failing due to external factors changing.
See https://bugzilla.xamarin.com/show_bug.cgi?id=24340
2014-11-14 00:31:16 +01:00
Jonathan Pryor 6299445e81 [mono-api-html] Allow ignoring addition of property setters.
As mentioned in commit 789517f8, I'm trying to compare inter-API level
differences in Mono.Android.dll, and want to reduce as much
"meaningless noise" as possible -- changes which don't meaningfully
break API or ABI.

Among those "meaningless" changes are the addition of property setters
to properties. Adding a setter doesn't break API or ABI.

Add a `mono-api-html --ignore-changes-property-setters` option.

  --ignore-changes-property-setters:
      Ignore the addition of property setters.

      If a source property contains a getter and the target property
      contains both a getter and a setter, do not flag this as a
      change.
2014-11-13 13:36:45 -05:00
Jonathan Pryor 09d16b7265 [mono-api-html] Make --ignore-changes-virtual less lenient.
As mentioned in commit 789517f8, the intentino of
`mono-api-html --ignore-changes-virtual` is so that when a method is
changed from non-virtual to virtual or override, or from virtual to
override, a "Removed member" message isn't triggered.

However, the previous implementation was too lenient. While *adding*
virtual to the method is fine, *removing* is NOT fine, as that would
be an API breaking change (e.g. all classes which attempt to override
a previously virtual method could no longer do so).

Make the virtual check stricter so that virtual/override to
non-virtual changes are not ignored.
2014-11-13 13:36:45 -05:00
Marek Safar 3d293f5a71 [xbuild] Add 14.0 toolchain 2014-11-13 18:37:43 +01:00
Marek Safar 4697ef6e77 [mcs] More updates to auto-properties v6 implementation 2014-11-13 17:19:04 +01:00
Zoltan Varga a32054ece9 [jit] Fix gshared and aot support for --debug=casts. 2014-11-12 20:12:44 -05:00
Zoltan Varga cdfb430b48 [jit] Fix --debug=casts support for casts in gshared methods. 2014-11-12 19:58:27 -05:00
Jonathan Pryor 789517f878 [mono-api-html] Allow ignoring parameter names, virtual.
I've been trying to review API diffs in Xamarin.Android between API
levels, but the diffs are "noisy" because Google will change parameter
names at-will, or will change a non-virtual method into a virtual
method, or a virtual method into an override, all of which are
acceptable changes but individually generate a Removed line in
mono-api-html output, and manually removing the *hundreds* of changes
is error-prone.

Add two new option flags to mono-api-html:

  --ignore-changes-parameter-names:
      Ignore changes in constructor and method parameter names.

      If parameter names change between <reference.xml> and
      <assembly.xml>, don't report a change for the constructor or
      method.

  --ignore-changes-virtual:
      Ignore changes in "virtual-ness".

      If a method or property changes from non-virtual to virtual,
      non-virtual to override, or virtual to override, don't report a
      change for the member.
2014-11-12 17:34:21 -05:00
Rodrigo Kumpera b486e8372e [runtime] Fix a deadlock introduced in the last commit. 2014-11-12 16:49:30 -05:00
Rodrigo Kumpera 363e4bb2a6 [runtime] What MonoImage::ptr_cache with the image lock. Do optimistic locking here too. 2014-11-12 11:29:07 -05:00
Rodrigo Kumpera 2ef2b0d754 [runtime] Replace the loader lock when protecting the global module map. 2014-11-12 11:29:06 -05:00
Rodrigo Kumpera c6b845ea23 Add comment on one usage of the loader lock. 2014-11-12 11:29:06 -05:00
Rodrigo Kumpera 0526aa45e0 [runtime] Protect MonoImage::files with the image lock and make image loading optimistic. 2014-11-12 11:29:06 -05:00
Rodrigo Kumpera 4fe5a46e55 Change mono_class_from_generic_parameter to use the image lock.
We change the function to use the lock/validate pattern. This is both
more scalable and enables us to use the image lock, since the amount of
work done with it held is now trivial.
2014-11-12 11:29:06 -05:00
Rodrigo Kumpera 532420cc64 Reduce usage of the loader lock in method lookup.
The function mono_method_inflated_lookup no longer needs the loader lock to be held
as the hashtable is now protected by the imageset lock.

This means that mono_class_inflate_generic_method_full_checked doesn't need to take the
loader lock.

The function mono_method_set_generic_container uses mono_image_property_insert which takes
the image lock and not the loader lock. Adjust the locking comment.
2014-11-12 11:29:06 -05:00
Zoltan Varga 50e286b2e7 Fix the mobile build. 2014-11-11 20:11:45 -05:00
Zoltan Varga 60d83a46e7 [aot] Avoid an assert when AOTing a non-mobile mscorlib in a runtime with COM disabled. 2014-11-11 20:11:45 -05:00
Ludovic Henry 83fac07316 [perfcounters,proflog,mprof-report] Add support for Performance Counters sampling in the log profiler 2014-11-11 13:46:47 -05:00
Ludovic Henry 7b59f2dcf1 [counters,proflog] Add mono_counters_on_register/delete callbacks + Use them in proflog
This is used for counters that are defined after runtime initialization. It implies that TYPE_SAMPLE_COUNTERS_DESC can now be emitted at any time, and not only once.
2014-11-11 13:40:29 -05:00
Ludovic Henry 734b0e9d32 [counters] Make API thread safe 2014-11-11 13:40:28 -05:00
Ludovic Henry fcfb6c2935 [perf-counters] Fix return of the same counter even with different a counter parameter
The same counter instance would be returned if we use the "instance" parameter instead of the "counter"
parameter. Also it is the name of the counter that is stored in mono_perfcounter_create (mono-perfcounters.c:1488).
2014-11-11 13:40:27 -05:00
Ludovic Henry dc139819ea [perf-counters] Declare shared data header type directly after creation
Fix the following bug : shared_data_find_room return twice the same memory region because it was not marked as "in use" by setting the header.ftype value.
This bug is triggered when we want to create a new shared area (for example a new FTYPE_INSTANCE area) while creating another area (for example a new FTYPE_CATEGORY).
2014-11-11 13:40:27 -05:00
Ludovic Henry 38f2bff71d [perf-counters] Fix bug on SharedCounter decoding
The structure of the encoded SharedCounter is as follow :
 - compressed data type : 1 byte
 - index in the category : 1 byte
 - name of the counter : null terminated string
 - help of the counter : null terminated string
2014-11-11 13:40:26 -05:00
Marek Safar b82016bf29 [xbuild] Change default tools profile 2014-11-11 18:49:30 +01:00
Marek Safar eed64a2729 [corlib] Fix culture info error message. Fixes #24431 2014-11-11 15:53:04 +01:00
Marek Safar 9ddd46b890 [mcs] Extended pragma warning syntax 2014-11-11 15:42:05 +01:00
Marek Safar 31b2d60549 [mcs] Use same result bucket for extension method lookup in all types of using expression 2014-11-11 11:25:28 +01:00
Zoltan Varga c09cd684b4 Add a test for #24419. 2014-11-10 20:54:12 -05:00
Zoltan Varga 5dd3347588 [jit] Remove some special casing from LDTOKEN, it doesn't seem to be needed. Fixes #24419. 2014-11-10 20:49:21 -05:00
Rodrigo Kumpera 5a2ef1b76f [runtime] Remove the second signal used by profiling and now multiplex distribution and sampling with the same signal. 2014-11-10 18:42:05 -05:00
Rodrigo Kumpera e6c3ff7551 [runtime] Introduce new MonoThread API for signal multiplexing. It's a provisional API until we figure out more of how it's suposed to work. 2014-11-10 18:41:25 -05:00
Rodrigo Kumpera 4d12ed3356 [profiler] Guard against null sbuff when serializing statistical data. 2014-11-10 18:41:20 -05:00
Rodrigo Kumpera a18dffad0d [profiler] Fix statistical backtraces to work and collect as many frames as possible.
This is a jumbo commit that addresses multiple issues with statistical backtrace collection:

1) It's not possible to reliably collect MonoMethod* so we check that they exist before
serializing to the .mlpd file and retrieve in sync context.

2) It was reporting the generic instance MonoMethod* under gsharing. Those methods are
not reported to the profiler since they are never compiled. They would turn out as unknowns.

3) Collecting IL offsets from async context is currently impossible to be done safely, so it's
now disabled. The way we'll do it in the future is by serializing the sequence point table when
JIT'ing.

4) The way we used to collect frames in statistical ignored all frames until the first LMF, which
discards a lot of them under statistical mode. We now properly pass sigcontext and have it been consumed.
In the future we should simply use the callchain mode.
2014-11-10 18:41:15 -05:00
Rodrigo Kumpera 3aa7f41bed [runtime] Changes mono_stack_walk_async_safe API to be truly async safe.
This is a very very tricky API, so we restrict the returned data to be what's really
possible under sig context.
2014-11-10 18:41:11 -05:00
Rodrigo Kumpera 412ed8153a [runtime] Harden the profiler signal handlers against not fully attached threads and HP reentrancy. 2014-11-10 18:41:05 -05:00
Zoltan Varga 25e04fa019 Revert "Disable building the NET 2.0 profile by default."
This reverts commit 458c9456f0.

This still breaks the build.
2014-11-10 17:46:34 -05:00
Zoltan Varga 458c9456f0 Disable building the NET 2.0 profile by default. 2014-11-10 15:43:53 -05:00
Zoltan Varga a8c183ac63 [jit] Get rid of the mono_arch_sigctx_to_monoctx()/monoctx_to_sigctx () functions, use mono_sigctx_to_monoctx()/monoctx_to_sigctx() instead. 2014-11-10 14:31:29 -05:00
Zoltan Varga a87062a145 [jit] Use xmm5 as an fp scratch register on winx64. 2014-11-10 14:04:23 -05:00
Jonathan Pryor 7f0da57a65 Merge pull request #1393 from akoeplinger/refresh-mdoc-expected
[mdoc] Refreshed the en.expected.importecmadoc files to fix errors after the recent XML changes

Output was generated on .NET, and thus is canonical.
2014-11-10 13:52:11 -05:00
Marek Safar 7c024c1d5a [mcs] Encode more win32 version info attributes. Fixes #23981 2014-11-10 16:09:38 +01:00
Marek Safar b7a8bfc7ad Merge pull request #1334 from ztone/delegate
Fix PrepareEmit error when evaluating delegates
2014-11-10 12:03:23 +01:00
Zoltan Varga 7e056cd346 [jit] Move the ppc sigctx<->monoctx conversion code to mono-context.c. 2014-11-10 05:22:04 -05:00
Zoltan Varga 1af68a199e Remove some dead code. 2014-11-10 05:06:51 -05:00
Zoltan Varga 0d1555dbd5 Fix the android build. 2014-11-09 21:41:43 -05:00
Miguel de Icaza fb3468e61c Merge pull request #1390 from woodsb02/FreeBSDMacNetworkInterfaces
Freebsd to use Mac NetworkInterface code instead of Linux NetworkInterface code
2014-11-09 20:17:50 -05:00
Zoltan Varga ab1c14290f Merge pull request #1392 from ludovic-henry/pr34-proflog-counters-sample-shutdown
[proflog] Add counters sampling on profiler shutdown and startup
2014-11-09 18:30:15 -05:00
Zoltan Varga 690a646c5e Merge pull request #1395 from ludovic-henry/pr38-proflog-only-counters
[proflog] Add onlycounters parameters which disable event dumping
2014-11-08 13:27:28 -05:00
Ludovic Henry bbfb0e86f3 [proflog] Add countersonly parameters which disable event dumping
This is useful in the case of the benchmarking suite because we are only interested in the counters, and they represent a minimal part of the output file size.
2014-11-08 10:40:34 -05:00
Zoltan Varga a255b522cb Fix a uninitialized variable warning. 2014-11-07 18:50:26 -05:00
Zoltan Varga 7d319221f1 Fix a problem introduced by e19f539121. 2014-11-07 16:53:22 -05:00
Zoltan Varga e19f539121 [amd64] Make xmm6:xmm15 callee saved on winx64 as required by the ABI. 2014-11-07 15:33:57 -05:00
Mark Probst 730d0ccd6f Merge pull request #1385 from BrzVlad/fin-hash
[sgen] Use hash based on current address for finalization hashes.
2014-11-07 12:14:48 -08:00
Alexander Köplinger 0442cdbc19 [System] Fixed formatting of new ClientWebSocket test and disabled it
We need to have an implementation for HttpListenerContext.AcceptWebSocketAsync () first before it works.
2014-11-07 20:16:51 +01:00
Alexander Köplinger 59d2397abc Merge branch 'patch-1' of https://github.com/ReubenBond/mono into ReubenBond-patch-1 2014-11-07 20:14:29 +01:00
Miguel de Icaza c97100c88d Merge pull request #1394 from kjpou1/master
Fix GetUsing to output the using name instead of -> using Mono.CSharp.Na...
2014-11-07 12:20:29 -05:00
Kenneth Pouncey de3ff228dc Add space 2014-11-07 16:59:42 +01:00
Kenneth Pouncey 3664e4c5a7 Add space 2014-11-07 16:57:41 +01:00
Kenneth Pouncey db2381da04 Fix GetUsing to output the using name instead of -> using Mono.CSharp.NamespaceExpression; <- for every using statement that was set
+ Fix NRE when source_file or source_file.Usings is null. This will now return back an empty string or empty List
+ **Note** that we are returning the ToString() value of NamespaceExpression which is the full resolved namespace of "System.Drawing" instead of "Drawing".
+ Add ToString override for NamespaceExpression to return the full resolved name of the namespace.
2014-11-07 16:41:05 +01:00
Atsushi Eno 367d417207 [Mono.Posix] consider nano time info in UnixFileSystemInfo.Last*Time.
Before this change, those Last*Time properties returned only based on
seconds (truncated), which could cause inaccurate time comparison.
Consider code like this:

var fileUpdated = DateTime.Now;
...
File.WriteAllText (path, "foobar");
...
if (fileUpdated > new UnixFileInfo (path).LastWriteTime)
   OnUpdatedFile (path);

This could always result in raising update event, even if there was
no update after writing.

Last*Time With milliseconds makes it very unlikely to happen.
2014-11-07 20:42:25 +08:00
Alexander Köplinger e1900d6dc2 [mdoc] Refreshed the en.expected.importecmadoc files to fix errors after the recent XML changes
The XML work in 661430fd1f and bf39f5aec0 changed the whitespace handling, so the mdoc test suite failed.
Refreshing the files makes them identical to what MS.NET produces and fixes the mdoc tests.
2014-11-07 12:34:26 +01:00
Atsushi Eno bf39f5aec0 [xml] XmlElement.InnserXml seems to preserve whitespaces.
Fix for mdoc test regression (see commit comments on #661430f).
2014-11-07 15:35:40 +08:00
Zoltan Varga edb931dfb9 [runtime] Use a separate signal with the SA_RESTART flag set for suspending/resuming threads during debugging on android, since lots of android native code cannot handle the interruptions caused by the normal abort signal. Fixes #22968/#23987. 2014-11-06 19:44:57 -05:00
Ludovic Henry e41c4efed5 [proflog] Add counters sampling on runtime initialized 2014-11-06 15:25:04 -05:00
Ludovic Henry 8a1db154e1 [proflog] Add counters sampling on profiler shutdown 2014-11-06 15:17:17 -05:00
Ben Woods ba998de3c9 Freebsd to use Mac NetworkInterface code instead of Linux NetworkInterface code 2014-11-06 17:27:36 +08:00
Mark Probst b9061f8807 [sgen] When out of memory, finish concurrent with scanning whole nursery. Fixes #23401.
If we run out of memory during the nursery collection in the finishing collection pause,
there will be late-pinned objects in the nursery: pinned objects that were not pinned
from conservative roots (or cementing).  We need to scan those, too, so in that case
we just walk the nursery and scan all objects.
2014-11-05 16:27:02 -08:00
Mark Probst 9bf45cc5ba [sgen] Make check-mark-bits also scan nursery objects. 2014-11-05 16:27:02 -08:00
Mark Probst d69d4c2472 [sgen] Optional check that the concurrent collector doesn't update references. 2014-11-05 16:27:02 -08:00
Mark Probst 9ed222bd75 [sgen] Add assertions. 2014-11-05 16:27:02 -08:00
Mark Probst 2ba7fb3a36 [sgen] Move heap checks before pinning. 2014-11-05 16:27:01 -08:00
Mark Probst b479e83275 [sgen] Stop concurrent worker during concurrent update and nursery collections.
The two collectors stepped on each other's toes.  Specifically, updating the mod union
card table while the worker thread might mark cards in the card table will not work.

The simplest solution for now is to stop the worker thread during concurrent updates
and nursery collections.  In the future we can have the thread help with the nursery
collection.
2014-11-05 16:27:01 -08:00
Mark Probst 72bd6b96fb [sgen] Remove workers_marking - workers are always marking. 2014-11-05 16:27:01 -08:00
Mark Probst 5479dd7e38 [sgen] Implement a proper state machine for workers.
What we had previously was an impromptu state machine that was
badly implemented, hard to reason about, and not easily extensible.
2014-11-05 16:27:01 -08:00
Mark Probst ef8f07687d [sgen] Fix build with heavy binary protocol. 2014-11-05 16:27:00 -08:00
Mark Probst 47287a6784 [sgen] Fix cementing with concurrent M&S.
Cementing can happen during a concurrent collection when processing
the cardtable.  We use a separate cementing hash during concurrent
collections but we didn't pin objects from there.
2014-11-05 16:27:00 -08:00
Zoltan Varga 363302f71f Install Mono.Cecil in the net 4.5 profile. 2014-11-05 17:31:48 -05:00
Zoltan Varga ed65bc251d Revert "Disable building the NET 2.0 profile by default."
This reverts commit fe265502cc.

Revert this for now as it breaks too much stuff.
2014-11-05 16:57:00 -05:00
Marcos Henrich 570cb1a10a Changed script DateTime.Now_Test.sh to use the compiled csharp.exe. 2014-11-05 16:38:39 +00:00
Marcos Henrich b324cecd4f TZ display name changes no longer reset adjustment rules.
Reset of adjustment rules is mandatory when the base offset is changed because the rules are relative to the base offset.
Adjustment rules are now kept until the base offset changes.
2014-11-05 16:30:13 +00:00
Radek Doulik d8aad87c88 [linker] blacklist System.Net.Sockets.MulticastOption fields
- merge fix for https://bugzilla.xamarin.com/show_bug.cgi?id=21578
   the MulticastOption's 'private IPAddress local' field was
   removed by linker and the app crashed later at runtime.
 - when System.Net.Sockets.MulticastOption object
   is passed to System.Net.Sockets.Socket.SetSocketOption
   and thru it to System.Net.Sockets.Socket.SetSocketOption_internal
   it accesses passed object fields
   (thru few more native calls).
2014-11-05 13:00:37 +01:00
Zoltan Varga 1ea6921beb Merge pull request #1387 from akoeplinger/improve-bug652331_2
[System.ServiceModel] Fixed Bug652331_2 test that failed on Jenkins by increasing timeout
2014-11-04 23:18:11 -05:00
Zoltan Varga 2a11a2f11b [arm] Fix OP_LOCALLOC on arm so it correctly adjusts sp with the param area size even if the size is large. Fixes #24221. 2014-11-04 22:45:23 -05:00
Rodrigo Kumpera d51f34fd21 [profiler] Expose new profiling modes and allow sampling rate to be set when using signal-based sampling. 2014-11-04 19:30:02 -05:00
Rodrigo Kumpera 9522723493 [profiler] Add new profiler API mono_profiler_set_statistical_mode that gives control to statistical mode and sampling rate. 2014-11-04 19:30:02 -05:00
Rodrigo Kumpera 53cd89d23a [profiler] Fix signal based profiling to sample all registered threads.
The current signal profiling code depended on invalid linux behavior of setitimer
allowing multiple threads to register for the same timer. Linux kernel 2.6.12 fixed
this and only the main thread gets the signal. Always.

The correct POSIX behavior happens on OSX/iOS.

On Linux we could use timer_create and SIGEV_THREAD_ID but that would not work on iOS/OSX
since it's specific to it. Given that little detail, I'll leave implementing it as an
exercise to the reader.

The solution, which aims to be as portable as possible, is to use a pair of signals and
have the first one fire the second one against all other threads.

We use a pair of signals since it's not well defined which thread will receive the signal
so detecting this from the signal is non-trivial.
2014-11-04 19:30:02 -05:00
Rodrigo Kumpera f34e6426f9 Make mono_threads_pthread_kill available to mach targets. 2014-11-04 19:30:01 -05:00
Zoltan Varga 82cfc3ea31 Make the build in docs/ uses the net 4.5 profile. 2014-11-04 18:24:27 -05:00
Zoltan Varga fe265502cc Disable building the NET 2.0 profile by default. 2014-11-04 17:49:18 -05:00
Zoltan Varga f6da6fa9ea Fix the loadable llvm build. 2014-11-04 16:44:39 -05:00
Zoltan Varga f812f43d2e [llvm] Add beginnings of support for emitting dwarf debug info for LLVM code. Not enabled yet, since it would clash with the dwarf info emitted by the AOT compiler for JITted code. 2014-11-04 16:20:05 -05:00
Alexander Köplinger d3ee9252da [System.ServiceModel] Fixed Bug652331_2 test that failed on Jenkins by increasing timeout
Looks like the test takes quite a while so 10 seconds was just too short. Increasing the timeout to 20s seems to fix it.
2014-11-04 21:17:26 +01:00
Jonathan Pryor c84d28ca73 [mscorlib] Marshal.GetExceptionForHR() takes an errorInfo parameter.
Parameter names are part of the ABI because of C#4 named parameter.
Consequently, they *must* be consistent with .NET, and .NET a
parameter name of "errorInfo", *not* "errorInfoPtr" [0]:

	public static Exception GetExceptionForHR(
		int errorCode,
		IntPtr errorInfo
	)

Change the parameter name from `errorCodeInfo` to `errorCode` so that
the parameter name is consistent with .NET.

[0]: http://msdn.microsoft.com/en-us/library/3xade62s(v=vs.100).aspx
2014-11-04 14:26:32 -05:00
Alexander Köplinger fc02486d6a Fix NET_2_0 build 2014-11-04 10:49:57 +01:00
Miguel de Icaza 9bb11ade6d Merge pull request #1363 from martinjt/AddMembershipPasswordAttribute
Added the MembershipPasswordAttribute class and associated unit tests
2014-11-04 12:51:53 -05:00
Vlad Brezae b160f1e3b7 [sgen] Use hash based on current address for finalization hashes.
Extend functionality of SgenPointerQueue.

The purpose of this commit is to avoid dependency between GC code and the obtaining of the hash from the object's synchronisation field, which might require additional processing.
2014-11-03 17:30:31 -08:00
Zoltan Varga 92c91d75f0 [jit] Factor out duplicate code from the castclass/unbox.any opcode implementation. 2014-11-03 17:53:21 -05:00
Martin Thwaites 1c6da6b912 Added the MembershipPasswordAttribute class and associated unit tests 2014-11-03 21:40:44 +00:00
Zoltan Varga 7b4bd74b4d [jit] Reenable the more efficient cast code in gshared methods. 2014-11-03 16:06:46 -05:00
Marcos Henrich e5fc5450dd Merge pull request #1185 from esdrubal/http-reuse
Allow stream reuse when InputStream has been disposed.
2014-11-03 11:41:13 +00:00
Miguel de Icaza 09308892bd Merge pull request #1347 from ermshiperete/ImproveEllipsisHandling
[MWF] Improve ellipsis handling
2014-11-02 12:36:49 -05:00
Alexander Köplinger 57feacab95 Add missing newline in .sources file, should fix build 2014-10-31 23:07:28 +01:00
Miguel de Icaza 716c7ad122 [asp.net] Implement the EventHandlerTaskAsyncHelper and HttpTaskAsyncHandler classes; Manually bring Pull Request 1365 from Kornel Pal 2014-11-01 21:23:15 -04:00
Miguel de Icaza 0afdce4e37 Merge pull request #1371 from martinjt/AddClientDisconnectedToken
Add ClientDisconnectedToken property to HttpResponseBase and Wrapper as ...
2014-11-01 20:50:48 -04:00
Miguel de Icaza 5c23f1e15d Set ReadEntityBodyMode default to Classic to force clients to use the old method
for reading the input stream.

According to the MSDN docs, if ReadEntityBodyMode returns "Classic" the code should use
the old method to read the input stream (HttpRequestBase.InputStream) which is fully
implemented in mono.

Manually applied patch from martinjt
2014-11-01 20:49:10 -04:00
Miguel de Icaza b11044a9a6 [asp.net] Implement the EventHandlerTaskAsyncHelper and HttpTaskAsyncHandler classes; Manually bring Pull Request 1365 from Kornel Pal 2014-11-01 20:48:12 -04:00
Miguel de Icaza e4d8f21cf6 Merge pull request #1163 from AerisG222/more_mvc_fixes
Add missing elements to allow MVC5.2 site to run
2014-11-01 20:36:49 -04:00
Atsushi Eno 661430fd1f [xml] XmlDocument.ReadNode() should not special case XmlTextReader.
Added test case that proves this change (by baulig).
2014-11-01 00:06:05 +08:00
Miguel de Icaza 3fd4901a23 Merge pull request #960 from ermshiperete/ShowHelp
[MWF] Partially implement Help.ShowHelp
2014-10-31 11:20:20 -04:00
João Matos 100ecb4f0f Merge pull request #1360 from madewokherd/winuncpath
File URI's without a host are not UNC paths on Windows.
2014-10-31 13:52:33 +00:00
Mark Probst 000c018169 [sgen] Add an explanatory comment about OOM. 2014-10-30 16:28:03 -07:00
Zoltan Varga f85a6bc77c [runtime] Fix the android build with ndk r10c. 2014-10-30 18:44:05 -04:00
Rodrigo Kumpera f05e658a2d Merge pull request #1381 from schani/fix-23401
Fix 23401
2014-10-30 18:43:36 -04:00
Zoltan Varga dbfee6a340 [aot] Remove some obsolete TODOs. 2014-10-30 17:56:19 -04:00
Zoltan Varga bf6fea51af [aot] Use the info->tramp_page_code_offsets array on arm as well. 2014-10-30 17:52:33 -04:00
Zoltan Varga 74d2172cd1 Fix a warning. 2014-10-30 17:28:31 -04:00
Zoltan Varga b40386d4f4 Add the -Qunused-arguments warning to CPPFLAGS too. 2014-10-30 17:28:22 -04:00
Zoltan Varga 7c162f952c [llvm] Remove the unused LLVM_MAJOR_VERSION/LLVM_MINOR_VERSION defines. 2014-10-30 17:23:18 -04:00
Alexander Köplinger 3c533de4a8 Add files that were forgotten in 6af7989628, which is the re-apply of 950d9c8a56 2014-10-30 22:16:35 +01:00
Mark Probst 5eec4d0c84 [sgen] Don't store pin queue addresses, only indexes. Fixes #24084.
The pin queue can get relocated as a side-effect of resizing when late
pinning happens, so we can't count on pointers into it to remain valid.
2014-10-30 13:34:44 -07:00
Mark Probst 45fc2e14fd [sgen] Fix crash in late pinning.
Our code assumed that late-pinned objects don't have a tag, but they
obviously have the pin tag, so use the safe function.
2014-10-30 13:30:26 -07:00
Mark Probst 03494c7387 [sgen] Don't loop endlessly when out of memory. 2014-10-30 13:30:26 -07:00
Ryan J. Melena ef13507552 Revert incorrect changes from commit 950d9c8a56
Correctly handle null value deserialization in non-generic Deserialize(string, Type) method.
2014-10-30 16:19:40 -04:00
Miguel de Icaza 6af7989628 Re-apply the patch, there isa fix for it 2014-10-30 16:19:07 -04:00
Zoltan Varga f269254917 [Mono.Data.Tds] Allow sending of text data longer than 4000 characters by using a different column type. Fixes #21172. 2014-10-30 14:39:44 -04:00
Miguel de Icaza 112079b844 Revert this patch, as it broke the test suite 2014-10-30 13:54:33 -04:00
Jonathan Pryor ac1dcc6ade [System.Core/Android] Update TimeZone database self test.
Add Makefile rules to automagically download the TimeZone database
from the Android target $(ADB_TARGET), and build the tzi.exe app.

	$ make android-dump-tzdata ADB_TARGET=-d
	# downloads timezone data into ./android/tzdb.
	# dumps timezone data into ./android/tzdata
	# builds ./tzi.exe

	# Show adjustment rules for a given timezone dump
	$ mono tzi.exe -i=tzdata/Asia/Amman

Add `tzi.exe -R` option to show the TimeZoneInfo.GetAdjustmentRules()
output for all encountered timezones.

Add `tzi.exe -o=PATH` option to dump the TimeZone data to disk for
interrogation.

Add `tzi.exe -i=PATH` option to read in the specified TimeZone data
file and dump the rules contained therein.

Update usage comments.
2014-10-30 12:42:37 -04:00
Zoltan Varga dacc3f8c5d Merge pull request #944 from ermshiperete/bug-novell-496138
Improve COM error handling
2014-10-29 19:06:05 -04:00
Zoltan Varga 6a738caa5a [corlib] Add some missing memory barriers to the ConcurrentQueue methods to order memory operations. Fixes #22788. 2014-10-29 17:14:10 -04:00
Zoltan Varga bd715a7c5e Merge pull request #1378 from DynamicDevices/ajl/warnings
[libgc] Eliminate warning about redefinition of GC_WIN32_THREADS
2014-10-29 15:03:31 -04:00
Miguel de Icaza c265540e76 Merge pull request #1337 from RyanMelenaNoesis/master
Additional JWT Security Token Support
2014-10-29 15:02:30 -04:00
Alexis Christoforides d585381555 Bump Mono version -> 3.12.1 2014-10-29 13:16:04 -04:00
Alex J Lennon 41981cdca1 [libgc] Eliminate warning about redefinition of GC_WIN32_THREADS
Makefile defines GC_WIN32_THREADS as 1 but gc_config_macros was
redefining as defined but with no value.

Signed-off-by: Alex J Lennon <[email protected]>
2014-10-29 14:27:01 +01:00
Martin Thwaites b7b94a8024 Add ClientDisconnectedToken property to HttpResponseBase and Wrapper as default None 2014-10-26 23:42:54 +00:00
Mike Morano d35449e99b Add/update missing bits in order to support MVC5.2. 2014-10-26 11:14:08 -04:00
Stone Gislason f1108aabba [eval] Fix delegate; add caching for PrepareEmit
The delegate class did not use the internal cache flag as other type definitions which caused the next evaluation to fail.
2014-10-26 01:15:37 +01:00
Eberhard Beilharz 5d869be794 [MWF] Improve ellipsis handling
- Don't subtract room for ellipsis. Ellipsis should be
  handled by the renderer so we shouldn't reserve space for it.
  Otherwise we end up not getting ellipsis (because the renderer
  thinks there is enough space available), or we don't use up the
  available space.
- Don't allow text to go below button if we want to show ellipsis.
2014-10-24 22:38:56 +02:00
Eberhard Beilharz ab361102db [MWF] Display visual feedback on pressed button (#23869)
When a button is pressed the image and the text needs to be rendered one
pixel to the right and to the bottom so that there is some visual
feedback of the button press. Previously this was only the case if
TextImageRelation was set to Overlay.
2014-10-24 22:26:59 +02:00
Vincent Povirk dd68e53636 File URI's without a host are not UNC paths on Windows.
NUnit breaks when these URI's are treated as UNC paths, so I have no way of
running the tests on Windows without this change to see if it broke anything.
Not all URI tests pass, but the ones that fail seem unrelated to my change.

On Unix, the tests all work, but of course on Unix this is a no-op.

This commit licensed as MIT/X11.
2014-10-23 16:12:30 -05:00
Ryan Melena 950d9c8a56 Additional JWT Security Token Support
Fix line endings.  Add test for JavaScriptSerializer.Deserialize(string input, Type targetType).
2014-10-20 16:00:16 -05:00
Marcos Henrich 30ec69fd50 Allow stream reuse when InputStream has been disposed.
If InputStream is disposed FlushInput now sets it to null so a new one can be created.
2014-09-23 18:44:49 +01:00
Marcos Henrich 6a249a5611 Test connection reuse. 2014-09-23 18:44:49 +01:00
Reuben Bond eeac252404 Test ClientWebSocket.SendAsync EndOfMessage 2014-06-21 14:57:56 +10:00
Reuben Bond bbbe1e52d3 ClientWebSocket: SendAsync endOfMessage inverted.
endOfMessage should indicate whether or not additional message parts will follow the current one. Currently, the meaning in ClientWebSocket.cs is inverted: !endOfMessage indicates that no more parts will follow the current one.

See the WebSockets RFC, 'frame-fin' at the top of http://tools.ietf.org/html/rfc6455#page-31.
Also see the MSDN docs for SendAsync: http://msdn.microsoft.com/en-us/library/system.net.websockets.websocket.sendasync(v=vs.110).aspx
2014-06-20 16:48:36 +10:00
MarkS 707051b342 [MWF] Partially implement Help.ShowHelp 2014-03-17 12:30:16 +01:00
Eberhard Beilharz 2d420bfb7a Set ErrorInfo in Marshal.GetHRForException
Marshal.GetHRForException had a MonoTODO because it needs to set
the errorinfo object so that exceptions get properly passed to
unmanaged code. Since not all managed exceptions have a corresponding
HR value but we might need to get to the original thrown exception
we implement a ManagedErrorInfo helper class that implements the
IErrorInfo interface but also stores the exception.

In GetExceptionForHR we check if the errorinfo we get is a
ManagedErrorInfo. If it is we return the exception stored in there
(if it converts to the same error code), otherwise we construct a new
exception.
2014-03-13 18:55:39 +01:00
Eberhard Beilharz 554d6abf4c Properly convert COM error codes to C# exceptions
Also use additional information provided by IErrorInfo to fill in
exception details.

To make use of IErrorInfo on Linux a suitable implementation has to be
provided, e.g. by including libcom plus adding a mapping from
oleauth32.dll to the shared library that provides the implementation.

This completes mono bug 496138
(https://bugzilla.novell.com/show_bug.cgi?id=496138)
2014-03-13 18:53:57 +01:00
313 changed files with 7234 additions and 4023 deletions

No files matched your search

+3
View File
@@ -25,3 +25,6 @@
[submodule "external/ikdasm"]
path = external/ikdasm
url = git://github.com/mono/ikdasm.git
[submodule "external/referencesource"]
path = external/referencesource
url = git://github.com/mono/referencesource
+3 -13
View File
@@ -1,7 +1,7 @@
# Process this file with autoconf to produce a configure script.
#AC_PREREQ([2.62])
AC_INIT(mono, [3.12.0],
AC_INIT(mono, [3.12.1],
[http://bugzilla.xamarin.com/enter_bug.cgi?classification=Mono])
AC_CONFIG_SRCDIR([README.md])
@@ -578,6 +578,7 @@ else
fi
CFLAGS="$CFLAGS -g $WARN"
CFLAGS_FOR_LIBGC="$CFLAGS_FOR_LIBGC -g"
CPPFLAGS="$CPPFLAGS -g $WARN"
# Where's the 'mcs' source tree?
if test -d $srcdir/mcs; then
@@ -2459,8 +2460,6 @@ if test "x$enable_llvm" = "xyes"; then
# Should be something like '2.6' or '2.7svn'
llvm_version=`$LLVM_CONFIG --version`
major_version=`echo $llvm_version | cut -c 1`
minor_version=`echo $llvm_version | cut -c 3`
llvm_api_version=`$LLVM_CONFIG --mono-api-version 2>/dev/null`
AC_MSG_CHECKING(LLVM version)
AC_MSG_RESULT($llvm_version)
@@ -2481,14 +2480,8 @@ if test "x$enable_llvm" = "xyes"; then
AC_MSG_ERROR([Compiling with stock LLVM is not supported, please use the Mono LLVM repo at https://github.com/mono/llvm, with the GIT branch which matches this version of mono, i.e. 'mono-2-10' for Mono 2.10.])
fi
AC_DEFINE_UNQUOTED(LLVM_MAJOR_VERSION, $major_version, [Major version of LLVM libraries])
AC_DEFINE_UNQUOTED(LLVM_MINOR_VERSION, $minor_version, [Minor version of LLVM libraries])
AC_DEFINE_UNQUOTED(LLVM_VERSION, "$llvm_version", [Full version of LLVM libraties])
# Have to pass these on the command line since mini-llvm-cpp.h already includes
# llvm's config.h
LLVM_CXXFLAGS="$LLVM_CXXFLAGS -DLLVM_MAJOR_VERSION=$major_version -DLLVM_MINOR_VERSION=$minor_version"
AC_SUBST(LLVM_CFLAGS)
AC_SUBST(LLVM_CXXFLAGS)
AC_SUBST(LLVM_LIBS)
@@ -3206,7 +3199,7 @@ case "x$libgc" in
;;
esac
AC_ARG_WITH(profile2, [ --with-profile2=yes,no If you want to install the 2.0/3.5 FX (defaults to yes)], [], [with_profile2=yes])
AC_ARG_WITH(profile2, [ --with-profile2=yes,no If you want to install the 2.0/3.5 FX (defaults to yes)], [], [with_profile2=no])
AC_ARG_WITH(profile4, [ --with-profile4=yes,no If you want to install the 4.0 FX (defaults to yes)], [], [with_profile4=yes])
AC_ARG_WITH(profile4_5,[ --with-profile4_5=yes,no If you want to install the 4.5 FX (defaults to yes)], [], [with_profile4_5=yes])
AC_ARG_WITH(monodroid, [ --with-monodroid=yes,no If you want to build the MonoDroid assemblies (defaults to no)], [], [with_monodroid=no])
@@ -3282,7 +3275,6 @@ dnl Consistency settings
dnl
if test x$cross_compiling = xyes -o x$enable_mcs_build = xno; then
DISABLE_MCS_DOCS=yes
with_profile2=no
with_profile4=no
with_profile4_5=no
with_monodroid=no
@@ -3306,7 +3298,6 @@ AC_SUBST(OPROFILE_LIBS)
libmono_ldflags="$libmono_ldflags $LIBS"
AM_CONDITIONAL(INSTALL_2_0, [test "x$with_profile2" = xyes])
AM_CONDITIONAL(INSTALL_4_0, [test "x$with_profile4" = xyes])
AM_CONDITIONAL(INSTALL_4_5, [test "x$with_profile4_5" = xyes])
AM_CONDITIONAL(INSTALL_MONODROID, [test "x$with_monodroid" != "xno"])
@@ -3751,7 +3742,6 @@ echo "
LLVM Back End: $enable_llvm (dynamically loaded: $enable_loadedllvm)
Libraries:
.NET 2.0/3.5: $with_profile2
.NET 4.0: $with_profile4
.NET 4.5: $with_profile4_5
MonoDroid: $with_monodroid
+3 -3
View File
@@ -99,14 +99,14 @@ mono-file-formats.tree: $(srcdir)/docs.make $(srcdir)/Makefile.am $(srcdir)/depl
deploy/.stamp: convert.exe Makefile.am
$(mkdir_p) html
runtimedir=`cd ../runtime && pwd`; export runtimedir; \
MONO_PATH=../mcs/class/lib/net_2_0 perl $(srcdir)/exdoc -h $(srcdir) -t . $(srcdir)/../mono/*/*.c
MONO_PATH=../mcs/class/lib/net_4_5 perl $(srcdir)/exdoc -h $(srcdir) -t . $(srcdir)/../mono/*/*.c
touch $@
extract: deploy/.stamp
convert.exe: convert.cs AgilityPack.dll
$(TOOL_MAKE) PROFILE=net_2_0 convert.exe
$(TOOL_MAKE) PROFILE=net_4_5 convert.exe
AgilityPack.dll:
$(TOOL_MAKE) PROFILE=net_2_0 AgilityPack.dll
$(TOOL_MAKE) PROFILE=net_4_5 AgilityPack.dll
+1 -2
View File
@@ -135,7 +135,6 @@ AC_CHECK_SIZEOF(void *)
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(long long)
AC_CHECK_FUNCS(strlcpy stpcpy strtok_r rewinddir vasprintf)
AC_CHECK_FUNCS(getrlimit)
#
# Mono currently supports 10.6, but strndup is not available prior to 10.7; avoiding
@@ -180,7 +179,7 @@ if test "x$have_iso_varargs" = "xyes"; then
fi
AC_SUBST(G_HAVE_ISO_VARARGS)
AC_CHECK_HEADERS(getopt.h sys/select.h sys/time.h sys/wait.h pwd.h langinfo.h iconv.h localcharset.h sys/types.h sys/resource.h)
AC_CHECK_HEADERS(getopt.h sys/select.h sys/time.h sys/wait.h pwd.h langinfo.h iconv.h localcharset.h sys/types.h)
AC_CHECK_HEADER(alloca.h, [HAVE_ALLOCA_H=1], [HAVE_ALLOCA_H=0])
AC_SUBST(HAVE_ALLOCA_H)
+1
View File
@@ -176,6 +176,7 @@ typedef struct _GMemChunk GMemChunk;
/*
* Misc.
*/
#define g_atexit(func) ((void) atexit (func))
const gchar * g_getenv(const gchar *variable);
gboolean g_setenv(const gchar *variable, const gchar *value, gboolean overwrite);
+2 -23
View File
@@ -53,10 +53,6 @@
#include <sys/wait.h>
#endif
#ifdef HAVE_SYS_RESOURCE_H
# include <sys/resource.h>
#endif
#ifdef G_OS_WIN32
#include <io.h>
#include <winsock2.h>
@@ -217,23 +213,6 @@ write_all (int fd, const void *vbuf, size_t n)
return nwritten;
}
#ifndef G_OS_WIN32
static int
g_getdtablesize (void)
{
#ifdef HAVE_GETRLIMIT
struct rlimit limit;
int res;
res = getrlimit (RLIMIT_NOFILE, &limit);
g_assert (res == 0);
return limit.rlim_cur;
#else
return getdtablesize ();
#endif
}
#endif
gboolean
g_spawn_command_line_sync (const gchar *command_line,
gchar **standard_output,
@@ -277,7 +256,7 @@ g_spawn_command_line_sync (const gchar *command_line,
close (stderr_pipe [0]);
dup2 (stderr_pipe [1], STDERR_FILENO);
}
for (i = g_getdtablesize () - 1; i >= 3; i--)
for (i = getdtablesize () - 1; i >= 3; i--)
close (i);
/* G_SPAWN_SEARCH_PATH is always enabled for g_spawn_command_line_sync */
@@ -438,7 +417,7 @@ g_spawn_async_with_pipes (const gchar *working_directory,
}
if ((flags & G_SPAWN_LEAVE_DESCRIPTORS_OPEN) != 0) {
for (i = g_getdtablesize () - 1; i >= 3; i--)
for (i = getdtablesize () - 1; i >= 3; i--)
close (i);
}
Vendored Submodule
+1
Submodule external/referencesource added at 4e6dea7a9c.
+1 -1
View File
@@ -32,7 +32,7 @@
# define GC_LINUX_THREADS
#endif
#if defined(WIN32_THREADS)
# define GC_WIN32_THREADS
# define GC_WIN32_THREADS 1
#endif
#if defined(USE_LD_WRAP)
# define GC_USE_LD_WRAP
+3 -5
View File
@@ -6,17 +6,16 @@ SUBDIRS := build jay mcs class nunit24 ilasm tools tests errors docs
basic_SUBDIRS := build jay mcs class
build_SUBDIRS := build class mcs class/aot-compiler tools
net_2_0_SUBDIRS := build class nunit24 ilasm tools tests errors docs
monodroid_SUBDIRS := build class
monotouch_SUBDIRS := build class
monotouch_runtime_SUBDIRS := build class
xammac_SUBDIRS := build class
mobile_SUBDIRS := build class
mobile_static_SUBDIRS := build class
net_3_5_SUBDIRS := build class tools/xbuild
net_4_0_SUBDIRS := build class
net_4_5_SUBDIRS := build mcs class nunit24 ilasm tools tests errors docs
xbuild_12_SUBDIRS := build class tools/xbuild
xbuild_14_SUBDIRS := build class tools/xbuild
# List of test subdirs that should pass 100%
centum_tests := \
@@ -87,7 +86,7 @@ dir-check:
# fun specialty targets
PROFILES = net_2_0 net_3_5 net_4_0 net_4_5 xbuild_12
PROFILES = net_3_5 net_4_0 net_4_5 xbuild_12 xbuild_14
.PHONY: all-profiles $(STD_TARGETS:=-profiles)
all-profiles $(STD_TARGETS:=-profiles): %-profiles: profiles-do--%
@@ -106,17 +105,16 @@ profiles-do--run-test:
# Orchestrate the bootstrap here.
_boot_ = all clean install
$(_boot_:%=profile-do--xbuild_14--%): profile-do--xbuild_14--%: profile-do--net_4_5--%
$(_boot_:%=profile-do--xbuild_12--%): profile-do--xbuild_12--%: profile-do--net_4_5--%
$(_boot_:%=profile-do--net_4_5--%): profile-do--net_4_5--%: profile-do--build--%
$(_boot_:%=profile-do--net_4_0--%): profile-do--net_4_0--%: profile-do--build--%
$(_boot_:%=profile-do--net_3_5--%): profile-do--net_3_5--%: profile-do--net_2_0--%
$(_boot_:%=profile-do--monodroid--%): profile-do--monodroid--%: profile-do--build--%
$(_boot_:%=profile-do--monotouch--%): profile-do--monotouch--%: profile-do--build--%
$(_boot_:%=profile-do--monotouch_runtime--%): profile-do--monotouch_runtime--%: profile-do--build--%
$(_boot_:%=profile-do--xammac--%): profile-do--xammac--%: profile-do--build--%
$(_boot_:%=profile-do--mobile--%): profile-do--mobile--%: profile-do--build--%
$(_boot_:%=profile-do--mobile_static--%): profile-do--mobile_static--%: profile-do--build--%
$(_boot_:%=profile-do--net_2_0--%): profile-do--net_2_0--%: profile-do--build--%
$(_boot_:%=profile-do--build--%): profile-do--build--%: profile-do--basic--%
testcorlib:
+2 -1
View File
@@ -22,7 +22,8 @@ PROFILES = \
net_3_5 \
net_4_0 \
net_4_5 \
xbuild_12
xbuild_12 \
xbuild_14
COMMON_SRCS = \
Consts.cs.in \
-16
View File
@@ -1,16 +0,0 @@
# -*- makefile -*-
BOOTSTRAP_PROFILE = build
BOOTSTRAP_MCS = MONO_PATH="$(topdir)/class/lib/$(BOOTSTRAP_PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(INTERNAL_GMCS)
MCS = MONO_PATH="$(topdir)/class/lib/$(BOOTSTRAP_PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(INTERNAL_GMCS)
# nuttzing!
profile-check:
@:
DEFAULT_REFERENCES = -r:mscorlib.dll
PROFILE_MCS_FLAGS = -d:NET_1_1 -d:NET_2_0 -nowarn:1699 -nostdlib -lib:$(topdir)/class/lib/$(PROFILE) $(DEFAULT_REFERENCES) $(PLATFORM_DEBUG_FLAGS)
FRAMEWORK_VERSION = 2.0
XBUILD_VERSION = 2.0
-20
View File
@@ -1,20 +0,0 @@
# -*- makefile -*-
BOOTSTRAP_PROFILE = build
MCS = MONO_PATH="$(topdir)/class/lib/$(BOOTSTRAP_PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(INTERNAL_GMCS)
# nuttzing!
profile-check:
@:
DEFAULT_REFERENCES = -r:mscorlib.dll
PROFILE_MCS_FLAGS = -d:NET_1_1 -d:NET_2_0 -d:NET_3_5 -nowarn:1699 -nostdlib -lib:$(topdir)/class/lib/$(PROFILE) -lib:$(topdir)/class/lib/net_2_0 $(DEFAULT_REFERENCES) $(PLATFORM_DEBUG_FLAGS)
FRAMEWORK_VERSION = 3.5
XBUILD_VERSION = 3.5
TEST_HARNESS = $(topdir)/class/lib/net_2_0/nunit-console.exe
TEST_MONO_PATH = $(topdir)/class/lib/net_2_0
+7
View File
@@ -0,0 +1,7 @@
# -*- makefile -*-
include $(topdir)/build/profiles/net_4_5.make
PROFILE_MCS_FLAGS := $(PROFILE_MCS_FLAGS) -d:XBUILD_12 -d:XBUILD_14 -lib:$(topdir)/class/lib/net_4_5
XBUILD_VERSION = 14.0
+2 -3
View File
@@ -33,6 +33,7 @@ net_2_0_dirs := \
System.EnterpriseServices \
Mono.Data.Tds \
System.Data \
System.ComponentModel.DataAnnotations \
Accessibility \
Mono.WebBrowser \
System.Runtime.Serialization.Formatters.Soap \
@@ -81,7 +82,6 @@ net_2_0_dirs := \
System.ServiceModel \
System.Web.Extensions \
System.Web.Extensions.Design \
System.ComponentModel.DataAnnotations \
System.Web.DynamicData \
System.Web.Mvc2 \
Mono.C5 \
@@ -231,17 +231,16 @@ xbuild_4_0_dirs := \
$(xbuild_2_0_dirs) \
Microsoft.Build
net_2_0_SUBDIRS := $(net_2_0_dirs) $(net_2_0_only_dirs) $(xbuild_2_0_dirs) aot-compiler
monodroid_SUBDIRS := $(monodroid_dirs)
monotouch_SUBDIRS := $(monotouch_dirs)
monotouch_runtime_SUBDIRS := $(monotouch_runtime_dirs)
mobile_static_SUBDIRS := $(mobile_static_dirs)
mobile_SUBDIRS := $(mobile_dynamic_dirs)
xammac_SUBDIRS := $(xammac_dirs)
net_3_5_SUBDIRS := $(xbuild_2_0_dirs)
net_4_0_SUBDIRS := $(net_2_0_dirs) $(net_4_0_dirs) $(net_4_0_only_dirs) $(xbuild_4_0_dirs)
net_4_5_SUBDIRS := $(net_2_0_dirs) $(net_4_0_dirs) $(net_4_5_dirs) $(xbuild_4_0_dirs) aot-compiler
xbuild_12_SUBDIRS := $(xbuild_4_0_dirs)
xbuild_14_SUBDIRS := $(xbuild_4_0_dirs)
include ../build/rules.make
@@ -28,9 +28,14 @@
using System;
using System.Drawing;
using System.Diagnostics;
using System.IO;
namespace System.Windows.Forms
{
/// <summary>
/// http://msdn.microsoft.com/en-us/library/System.Windows.Forms.Help(v=vs.110).aspx
/// </summary>
public class Help
{
#region Constructor
@@ -42,7 +47,7 @@ namespace System.Windows.Forms
#region Public Static Methods
public static void ShowHelp (Control parent, string url)
{
ShowHelp(parent, url, HelpNavigator.TableOfContents, null);
ShowHelp (parent, url, null);
}
public static void ShowHelp (Control parent, string url, HelpNavigator navigator)
@@ -57,9 +62,7 @@ namespace System.Windows.Forms
public static void ShowHelp (Control parent, string url, string keyword)
{
if (keyword == null || keyword == String.Empty)
ShowHelp (parent, url, HelpNavigator.TableOfContents, null);
ShowHelp (parent, url, HelpNavigator.Topic, keyword);
ShowHelpTopic (url, keyword);
}
public static void ShowHelpIndex (Control parent, string url)
@@ -72,5 +75,55 @@ namespace System.Windows.Forms
{
}
#endregion // Public Static Methods
/// <summary>
/// Show a help file and topic using a help viewer
/// </summary>
/// <param name="helpFile">path to a .chm help file</param>
/// <param name="helpTopic">path to a topic in helpFile, or null</param>
private static void ShowHelpTopic (string helpFile, string helpTopic)
{
if (helpFile == null)
throw new ArgumentNullException ();
if (helpFile == String.Empty)
throw new ArgumentException ();
// Use forward slashes in helpFile path if needed
helpFile = helpFile.Replace (@"\", Path.DirectorySeparatorChar.ToString ());
string helpViewer = Environment.GetEnvironmentVariable ("MONO_HELP_VIEWER") ?? "chmsee";
string arguments = String.Format ("\"{0}\"", helpFile);
if (!String.IsNullOrEmpty (helpTopic)) {
if (!helpTopic.StartsWith ("/"))
helpTopic = "/" + helpTopic;
helpTopic = helpTopic.TrimEnd (' ');
arguments = String.Format ("\"{0}::{1}\"", helpFile, helpTopic);
}
try {
RunNonblockingProcess (helpViewer, arguments);
} catch (Exception e) {
// Don't crash if the help viewer couldn't be launched. There
// won't be an exception thrown if the help viewer can't find
// the help file; it's up to the help viewer to display such an error.
string message = String.Format ("The help viewer could not load. Maybe you don't have {0} installed or haven't set MONO_HELP_VIEWER. The specific error message was: {1}", helpViewer, e.Message);
Console.Error.WriteLine (message);
MessageBox.Show (message);
}
}
/// <remarks>
/// throws exception from Process.Start() if there was a problem starting
/// </remarks>
private static void RunNonblockingProcess (string command, string arguments)
{
using (Process process = new Process ()) {
process.StartInfo.FileName = command;
process.StartInfo.Arguments = arguments;
process.StartInfo.UseShellExecute = false;
process.Start ();
}
}
}
}
@@ -492,9 +492,6 @@ namespace System.Windows.Forms
r.X += 2;
r.Width -= 2;
}
if ((flags & TextFormatFlags.WordEllipsis) == TextFormatFlags.WordEllipsis || (flags & TextFormatFlags.EndEllipsis) == TextFormatFlags.EndEllipsis || (flags & TextFormatFlags.WordBreak) == TextFormatFlags.WordBreak) {
r.Width -= 4;
}
if ((flags & TextFormatFlags.VerticalCenter) == TextFormatFlags.VerticalCenter && XplatUI.RunningOnUnix) {
r.Y -= 1;
}
@@ -369,22 +369,24 @@ namespace System.Windows.Forms
Image image = button.Image;
string text = button.Text;
Rectangle content_rect = button.PaddingClientRectangle;
Size text_size = TextRenderer.MeasureTextInternal (g, text, button.Font, content_rect.Size, button.TextFormatFlags | TextFormatFlags.NoPadding, button.UseCompatibleTextRendering);
Size text_size = TextRenderer.MeasureTextInternal (g, text, button.Font, content_rect.Size, button.TextFormatFlags, button.UseCompatibleTextRendering);
Size image_size = image == null ? Size.Empty : image.Size;
textRectangle = Rectangle.Inflate (content_rect, -4, -4);
imageRectangle = Rectangle.Empty;
bool displayEllipsis = (button.TextFormatFlags & (TextFormatFlags.EndEllipsis | TextFormatFlags.PathEllipsis | TextFormatFlags.WordEllipsis)) != 0;
switch (button.TextImageRelation) {
case TextImageRelation.Overlay:
// Overlay is easy, text always goes here
// Image is dependent on ImageAlign
if (image == null) {
if (button.Pressed)
textRectangle.Offset (1, 1);
// Image is dependent on ImageAlign
if (image == null)
return;
}
int image_x = 0;
int image_y = 0;
@@ -437,10 +439,10 @@ namespace System.Windows.Forms
imageRectangle = new Rectangle (image_x, image_y, image_width, image_height);
break;
case TextImageRelation.ImageAboveText:
LayoutTextAboveOrBelowImage (textRectangle, false, text_size, image_size, button.TextAlign, button.ImageAlign, out textRectangle, out imageRectangle);
LayoutTextAboveOrBelowImage (textRectangle, false, text_size, image_size, button.TextAlign, button.ImageAlign, displayEllipsis, out textRectangle, out imageRectangle);
break;
case TextImageRelation.TextAboveImage:
LayoutTextAboveOrBelowImage (textRectangle, true, text_size, image_size, button.TextAlign, button.ImageAlign, out textRectangle, out imageRectangle);
LayoutTextAboveOrBelowImage (textRectangle, true, text_size, image_size, button.TextAlign, button.ImageAlign, displayEllipsis, out textRectangle, out imageRectangle);
break;
case TextImageRelation.ImageBeforeText:
LayoutTextBeforeOrAfterImage (textRectangle, false, text_size, image_size, button.TextAlign, button.ImageAlign, out textRectangle, out imageRectangle);
@@ -449,6 +451,8 @@ namespace System.Windows.Forms
LayoutTextBeforeOrAfterImage (textRectangle, true, text_size, image_size, button.TextAlign, button.ImageAlign, out textRectangle, out imageRectangle);
break;
}
if (button.Pressed)
textRectangle.Offset (1, 1);
}
private void LayoutTextBeforeOrAfterImage (Rectangle totalArea, bool textFirst, Size textSize, Size imageSize, System.Drawing.ContentAlignment textAlign, System.Drawing.ContentAlignment imageAlign, out Rectangle textRect, out Rectangle imageRect)
@@ -496,7 +500,7 @@ namespace System.Windows.Forms
imageRect = final_image_rect;
}
private void LayoutTextAboveOrBelowImage (Rectangle totalArea, bool textFirst, Size textSize, Size imageSize, System.Drawing.ContentAlignment textAlign, System.Drawing.ContentAlignment imageAlign, out Rectangle textRect, out Rectangle imageRect)
private void LayoutTextAboveOrBelowImage (Rectangle totalArea, bool textFirst, Size textSize, Size imageSize, System.Drawing.ContentAlignment textAlign, System.Drawing.ContentAlignment imageAlign, bool displayEllipsis, out Rectangle textRect, out Rectangle imageRect)
{
int element_spacing = 0; // Spacing between the Text and the Image
int total_height = textSize.Height + element_spacing + imageSize.Height;
@@ -545,6 +549,12 @@ namespace System.Windows.Forms
final_text_rect.Y = totalArea.Top;
}
if (displayEllipsis) {
// Don't use more space than is available otherwise ellipsis won't show
if (final_text_rect.Height > totalArea.Bottom)
final_text_rect.Height = totalArea.Bottom - final_text_rect.Top;
}
textRect = final_text_rect;
imageRect = final_image_rect;
}
@@ -1092,11 +1102,11 @@ namespace System.Windows.Forms
break;
case TextImageRelation.ImageAboveText:
content_rect.Inflate (-4, -4);
LayoutTextAboveOrBelowImage (content_rect, false, text_size, image_size, button.TextAlign, button.ImageAlign, out textRectangle, out imageRectangle);
LayoutTextAboveOrBelowImage (content_rect, false, text_size, image_size, button.TextAlign, button.ImageAlign, false, out textRectangle, out imageRectangle);
break;
case TextImageRelation.TextAboveImage:
content_rect.Inflate (-4, -4);
LayoutTextAboveOrBelowImage (content_rect, true, text_size, image_size, button.TextAlign, button.ImageAlign, out textRectangle, out imageRectangle);
LayoutTextAboveOrBelowImage (content_rect, true, text_size, image_size, button.TextAlign, button.ImageAlign, false, out textRectangle, out imageRectangle);
break;
case TextImageRelation.ImageBeforeText:
content_rect.Inflate (-4, -4);
@@ -560,11 +560,8 @@ namespace Microsoft.Build.BuildEngine {
get {
// This is used as the fall back version if the
// project can't find a version to use
// Hard-coded to 2.0, so it allows even vs2005 projects
// to build correctly, as they won't have a ToolsVersion
// set!
return String.IsNullOrEmpty (defaultToolsVersion)
? "2.0"
? "4.0"
: defaultToolsVersion;
}
set {
@@ -39,7 +39,9 @@ public static class Consts {
public static string BinPath {
get {
if (RunningOnMono ()) {
#if XBUILD_12
#if XBUILD_14
string profile = "xbuild_14";
#elif XBUILD_12
string profile = "xbuild_12";
#elif NET_4_5
string profile = "net_4_5";
@@ -54,7 +56,9 @@ public static class Consts {
var lib = Path.GetDirectoryName (Path.GetDirectoryName (corlib));
return Path.Combine (lib, profile);
} else {
#if XBUILD_12
#if XBUILD_14
return ToolLocationHelper.GetPathToBuildTools ("14.0");
#elif XBUILD_12
return ToolLocationHelper.GetPathToBuildTools ("12.0");
#elif NET_4_5
return ToolLocationHelper.GetPathToDotNetFramework (TargetDotNetFrameworkVersion.Version45);
@@ -71,7 +75,9 @@ public static class Consts {
public static string ToolsVersionString {
get {
#if XBUILD_12
#if XBUILD_14
return " ToolsVersion='14.0'";
#elif XBUILD_12
return " ToolsVersion='12.0'";
#elif NET_4_0
return " ToolsVersion='4.0'";
@@ -85,7 +91,9 @@ public static class Consts {
public static string GetTasksAsmPath ()
{
#if XBUILD_12
#if XBUILD_14
return Path.Combine (BinPath, "Microsoft.Build.Tasks.Core.dll");
#elif XBUILD_12
return Path.Combine (BinPath, "Microsoft.Build.Tasks.v12.0.dll");
#elif NET_4_0
return Path.Combine (BinPath, "Microsoft.Build.Tasks.v4.0.dll");
@@ -53,8 +53,13 @@ namespace Microsoft.Build.Utilities
#if XBUILD_12
Version451,
#endif
#if XBUILD_14
Version453,
#endif
#if XBUILD_12
#if XBUILD_14
VersionLatest = Version453
#elif XBUILD_12
VersionLatest = Version451
#elif NET_4_5
VersionLatest = Version45
@@ -233,11 +233,20 @@ namespace Microsoft.Build.Utilities
public static string GetPathToBuildTools (string toolsVersion)
{
if (toolsVersion != "12.0")
string path;
switch (toolsVersion) {
case "12.0":
path = "xbuild_12";
break;
case "14.0":
path = "xbuild_14";
break;
default:
return null;
}
if (Environment.GetEnvironmentVariable ("TESTING_MONO") != null)
return Path.Combine (lib_mono_dir, "xbuild_12");
return Path.Combine (lib_mono_dir, path);
if (runningOnDotNet) {
//see http://msdn.microsoft.com/en-us/library/vstudio/bb397428(v=vs.120).aspx
@@ -263,6 +263,9 @@ namespace Microsoft.Build.Evaluation
#endif
#if XBUILD_12
AddToolset (new Toolset ("12.0", ToolLocationHelper.GetPathToBuildTools ("12.0"), this, null));
#endif
#if XBUILD_14
AddToolset (new Toolset ("14.0", ToolLocationHelper.GetPathToBuildTools ("14.0"), this, null));
#endif
default_tools_version = toolsets.First ().ToolsVersion;
}
@@ -146,6 +146,15 @@ namespace MonoTests.EvaluatorTest
Assert.IsTrue (Evaluator.Run ("x();"), "#2");
}
[Test]
public void CapturedLocalVariable ()
{
Evaluator.Run ("using System;");
var res = Evaluator.Evaluate("var x = 123; Action a = () => x++; a(); x;");
Assert.AreEqual (124, res);
}
#if NET_4_0
[Test]
public void DynamicStatement ()
@@ -104,7 +104,15 @@ namespace MonoTests.EvaluatorTest
{
Evaluator.Run ("class A { class B { } }");
Evaluator.Run ("var x = new A ();");
}
[Test]
public void DelegateType ()
{
Evaluator.Run ("public delegate int D();");
Evaluator.Run ("D d = delegate () { return 7; };");
object res = Evaluator.Evaluate ("d();");
Assert.AreEqual (7, res);
}
}
}
-4
View File
@@ -9,8 +9,4 @@ LIB_MCS_FLAGS = /r:$(corlib) -keyfile:$(LIBRARY_SNK) -r:System.Core.dll -d:NET_3
NO_TEST = yes
ifneq (net_2_0, $(PROFILE))
NO_INSTALL = yes
endif
include ../../build/library.make
@@ -195,6 +195,11 @@ namespace Mono.Unix.Native {
return FromTimeT (time);
}
public static DateTime ToDateTime (long time, long nanoTime)
{
return FromTimeT (time).AddMilliseconds (nanoTime / 1000);
}
public static long FromDateTime (DateTime time)
{
return ToTimeT (time);
@@ -192,7 +192,7 @@ namespace Mono.Unix {
}
public DateTime LastAccessTime {
get {AssertValid (); return Native.NativeConvert.ToDateTime (stat.st_atime);}
get {AssertValid (); return Native.NativeConvert.ToDateTime (stat.st_atime, stat.st_atime_nsec);}
}
public DateTime LastAccessTimeUtc {
@@ -200,7 +200,7 @@ namespace Mono.Unix {
}
public DateTime LastWriteTime {
get {AssertValid (); return Native.NativeConvert.ToDateTime (stat.st_mtime);}
get {AssertValid (); return Native.NativeConvert.ToDateTime (stat.st_mtime, stat.st_mtime_nsec);}
}
public DateTime LastWriteTimeUtc {
@@ -208,7 +208,7 @@ namespace Mono.Unix {
}
public DateTime LastStatusChangeTime {
get {AssertValid (); return Native.NativeConvert.ToDateTime (stat.st_ctime);}
get {AssertValid (); return Native.NativeConvert.ToDateTime (stat.st_ctime, stat.st_ctime_nsec);}
}
public DateTime LastStatusChangeTimeUtc {
@@ -26,7 +26,7 @@ using System;
using System.Collections;
using System.IO;
using System.Threading;
using System.Net;
using Mono.Security.Protocol.Tls.Handshake;
namespace Mono.Security.Protocol.Tls
@@ -683,9 +683,6 @@ namespace Mono.Security.Protocol.Tls
public void SendAlert(Alert alert)
{
if (ServicePointManager.Mono_Suppress_TLS_Alerts)
return;
AlertLevel level;
AlertDescription description;
bool close;
@@ -428,8 +428,7 @@ namespace Mono.Security.Protocol.Tls
private void NegotiateAsyncWorker (IAsyncResult result)
{
NegotiateAsyncResult negotiate = result.AsyncState as NegotiateAsyncResult;
var state = negotiate.State;
try
{
switch (negotiate.State)
@@ -590,23 +589,12 @@ namespace Mono.Security.Protocol.Tls
catch (TlsException ex)
{
// FIXME: should the send alert also be done asynchronously here and below?
Console.WriteLine ("TlsException when handling state {1}: {0}", ex, state);
try {
this.protocol.SendAlert(ex.Alert);
} catch (Exception ex2) {
Console.WriteLine ("TLS: Send Alert raised an exception: {0}", ex2);
}
this.protocol.SendAlert(ex.Alert);
negotiate.SetComplete (new IOException("The authentication or decryption has failed.", ex));
}
catch (Exception ex)
{
Console.WriteLine ("General Exception: {0} when handling state {1}", ex, state);
try {
this.protocol.SendAlert(AlertDescription.InternalError);
} catch (Exception ex2) {
Console.WriteLine ("TLS: Send Alert raised an exception: {0}", ex2);
}
this.protocol.SendAlert(AlertDescription.InternalError);
negotiate.SetComplete (new IOException("The authentication or decryption has failed.", ex));
}
}
+1 -1
View File
@@ -10,7 +10,7 @@ NO_TEST = yes
# This is a .NET 2.0+ only assembly
VALID_PROFILE := $(filter net_2_0 net_4_0 net_4_5, $(PROFILE))
VALID_PROFILE := $(filter net_4_0 net_4_5, $(PROFILE))
ifndef VALID_PROFILE
LIBRARY_NAME = dummy-Mono.Simd.dll
NO_INSTALL = yes
+19
View File
@@ -72,3 +72,22 @@ csproj-local:
$(MAKE) csproj-local intermediate=plaincore/
endif
endif
#
# Android TimeZoneInfo testing....
#
tzi.exe: ../corlib/System/AndroidPlatform.cs $(wildcard System/TimeZone*.cs) ../../build/common/Consts.cs ../Mono.Options/Mono.Options/Options.cs
mcs /debug+ /out:$@ /unsafe "/d:INSIDE_CORLIB;MONODROID;NET_4_0;LIBC;SELF_TEST" $^
android-pull-tzdb:
mkdir -p android/tzdb/usr/share/zoneinfo
mkdir -p android/tzdb/misc/zoneinfo/zoneinfo
android_root=`adb shell echo '$$ANDROID_ROOT' | tr -d "\r"` ; \
android_data=`adb shell echo '$$ANDROID_DATA' | tr -d "\r"` ; \
adb $(ADB_TARGET) pull $$android_root/usr/share/zoneinfo android/tzdb/usr/share/zoneinfo ; \
adb $(ADB_TARGET) pull $$android_data/misc/zoneinfo/tzdata android/tzdb/misc/zoneinfo
mkdir -p android/tzdb/
android-dump-tzdata: tzi.exe android-pull-tzdb
__XA_OVERRIDE_TIMEZONE_ID__=America/New_York ANDROID_ROOT=`pwd` ANDROID_DATA=`pwd` mono --debug tzi.exe -o android/tzdata
@@ -246,6 +246,7 @@ namespace System {
tzdataPath, offset, length, r, buffer.Length));
}
TimeZoneInfo.DumpTimeZoneDataToFile (id, buffer);
return buffer;
}
}
@@ -581,21 +582,37 @@ namespace System {
* Compile:
* mcs /debug+ /out:tzi.exe /unsafe "/d:INSIDE_CORLIB;MONODROID;NET_4_0;LIBC;SELF_TEST" ../corlib/System/AndroidPlatform.cs System/TimeZone*.cs ../../build/common/Consts.cs ../Mono.Options/Mono.Options/Options.cs
* Prep:
* mkdir -p usr/share/zoneinfo
* mkdir -p misc/zoneinfo/zoneinfo
* mkdir -p android/tzdb/usr/share/zoneinfo
* mkdir -p android/tzdb/misc/zoneinfo/zoneinfo
* android_root=`adb shell echo '$ANDROID_ROOT' | tr -d "\r"`
* android_data=`adb shell echo '$ANDROID_DATA' | tr -d "\r"`
* adb pull $android_root/usr/share/zoneinfo usr/share/zoneinfo
* adb pull $android_data/misc/zoneinfo/tzdata misc/zoneinfo
* adb pull $android_root/usr/share/zoneinfo android/tzdb/usr/share/zoneinfo
* adb pull $android_data/misc/zoneinfo/tzdata android/tzdb/misc/zoneinfo
* Run:
* # Dump all timezone names
* __XA_OVERRIDE_TIMEZONE_ID__=America/New_York ANDROID_ROOT=`pwd` ANDROID_DATA=`pwd` mono --debug tzi.exe --offset=1969-01-01
*
* # Dump TimeZone data to files under path `tzdata`
* __XA_OVERRIDE_TIMEZONE_ID__=America/New_York ANDROID_ROOT=`pwd` ANDROID_DATA=`pwd` mono --debug tzi.exe -o android/tzdata
*
* # Dump TimeZone rules for specific timezone data (as dumped above)
* mono tzi.exe --offset=2012-10-24 -i=tzdata/Asia/Amman
*/
static void Main (string[] args)
{
DateTime? offset = null;
Func<IAndroidTimeZoneDB> c = () => GetDefaultTimeZoneDB ();
bool dump_rules = false;
Mono.Options.OptionSet p = null;
p = new Mono.Options.OptionSet () {
{ "i=",
"TimeZone data {FILE} to parse and dump",
v => DumpTimeZoneFile (v, offset)
},
{ "o=",
"Write TimeZone data files to {PATH}",
v => TimeZoneInfo.TimeZoneDataExportPath = v
},
{ "T=", "Create AndroidTzData from {PATH}.", v => {
c = () => new AndroidTzData (v);
} },
@@ -606,6 +623,9 @@ namespace System {
offset = DateTime.Parse (v);
Console.WriteLine ("Using DateTime Offset: {0}", offset);
} },
{ "R|dump-rules",
"Show timezone info offset for DateTime {OFFSET}.",
v => dump_rules = v != null },
{ "help", "Show this message and exit", v => {
p.WriteOptionDescriptions (Console.Out);
Environment.Exit (0);
@@ -623,6 +643,9 @@ namespace System {
if (offset.HasValue) {
Console.Write ("From Offset: {0}", zone.GetUtcOffset (offset.Value));
}
if (dump_rules) {
WriteZoneRules (zone);
}
}
else {
Console.Write (" ERROR:null");
@@ -634,6 +657,53 @@ namespace System {
Console.WriteLine ();
}
}
static void WriteZoneRules (TimeZoneInfo zone)
{
var rules = zone.GetAdjustmentRules ();
for (int i = 0; i < rules.Length; ++i) {
var rule = rules [i];
Console.WriteLine ();
Console.Write ("\tAdjustmentRules[{0,3}]: DaylightDelta={1}; DateStart={2:yyyy-MM}; DateEnd={3:yyyy-MM}; DaylightTransitionStart={4:D2}-{5:D2}T{6}; DaylightTransitionEnd={7:D2}-{8:D2}T{9}",
i,
rule.DaylightDelta,
rule.DateStart, rule.DateEnd,
rule.DaylightTransitionStart.Month, rule.DaylightTransitionStart.Day, rule.DaylightTransitionStart.TimeOfDay.TimeOfDay,
rule.DaylightTransitionEnd.Month, rule.DaylightTransitionEnd.Day, rule.DaylightTransitionEnd.TimeOfDay.TimeOfDay);
}
}
static void DumpTimeZoneFile (string path, DateTime? time)
{
var buffer = File.ReadAllBytes (path);
var zone = ParseTZBuffer (path, buffer, buffer.Length);
Console.Write ("Rules for: {0}", path);
WriteZoneRules (zone);
Console.WriteLine ();
if (time.HasValue) {
var offset = zone.GetUtcOffset (time.Value);
var isDst = zone.IsDaylightSavingTime (time.Value);
Console.WriteLine ("\tDate({0}): Offset({1}) IsDST({2})", time.Value, offset, isDst);
}
}
#endif
}
#if SELF_TEST
static string TimeZoneDataExportPath;
#endif
internal static void DumpTimeZoneDataToFile (string id, byte[] buffer)
{
#if SELF_TEST
int p = id.LastIndexOf ('/');
var o = Path.Combine (TimeZoneDataExportPath,
p >= 0 ? id.Substring (0, p) : id);
if (p >= 0)
o = Path.Combine (o, id.Substring (p+1));
Directory.CreateDirectory (Path.GetDirectoryName (o));
using (var f = File.OpenWrite (o))
f.Write (buffer, 0, buffer.Length);
#endif
}
}
+5 -4
View File
@@ -1179,9 +1179,9 @@ namespace System
DateTime ttime = pair.Key;
TimeType ttype = pair.Value;
if (!ttype.IsDst) {
if (standardDisplayName != ttype.Name || baseUtcOffset.TotalSeconds != ttype.Offset) {
if (standardDisplayName != ttype.Name)
standardDisplayName = ttype.Name;
daylightDisplayName = null;
if (baseUtcOffset.TotalSeconds != ttype.Offset) {
baseUtcOffset = new TimeSpan (0, 0, ttype.Offset);
if (adjustmentRules.Count > 0) // We ignore AdjustmentRules but store transitions.
storeTransition = true;
@@ -1217,10 +1217,11 @@ namespace System
}
dst_observed = false;
} else {
if (daylightDisplayName != ttype.Name || dstDelta.TotalSeconds != ttype.Offset - baseUtcOffset.TotalSeconds) {
if (daylightDisplayName != ttype.Name)
daylightDisplayName = ttype.Name;
if (dstDelta.TotalSeconds != ttype.Offset - baseUtcOffset.TotalSeconds)
dstDelta = new TimeSpan(0, 0, ttype.Offset) - baseUtcOffset;
}
dst_start = ttime;
dst_observed = true;
}
+1 -6
View File
@@ -12,17 +12,12 @@ LIB_MCS_FLAGS = \
/resource:./src/DbLinq/Schema/Dbml/DbmlSchema.xsd,DbLinq.Schema.Dbml.DbmlSchema.xsd \
/d:MONO_STRICT /d:MONO_DEPLOY -warn:1
ifeq (2.0, $(FRAMEWORK_VERSION))
# This is a .NET 3.5 only assembly, but built during the 2.0 build
LIB_MCS_FLAGS += -d:NET_3_5 -nowarn:1720
endif
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
EXTRA_DISTFILES = src/DbLinq/Schema/Dbml/DbmlSchema.xsd
# This is a .NET 3.5+ assembly
VALID_PROFILE := $(filter net_2_0 net_4_0 net_4_5, $(PROFILE))
VALID_PROFILE := $(filter net_4_0 net_4_5, $(PROFILE))
ifndef VALID_PROFILE
LIBRARY_NAME = dummy-System.Data.Linq.dll
NO_INSTALL = yes
@@ -43,6 +43,7 @@ namespace System.Data.Common {
readonly IDataReader reader;
readonly bool closeReader;
readonly SchemaInfo [] schema;
readonly object [] values;
#endregion // Fields
@@ -57,6 +58,7 @@ namespace System.Data.Common {
{
this.reader = reader;
this.closeReader = closeReader;
this.values = new object [reader.FieldCount];
this.schema = LoadSchema (reader);
}
@@ -65,13 +67,8 @@ namespace System.Data.Common {
#region Properties
public object Current {
get {
// DbDataRecordImpl does not do copy of the array
// and MoveNext would overwrite any previously filled data
var values = new object [reader.FieldCount];
get {
reader.GetValues (values);
// TODO: Should not allocate on every property call
return new DbDataRecordImpl (schema, values);
}
}
@@ -15,7 +15,7 @@ TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
EXTRA_DISTFILES =
VALID_PROFILE := $(filter net_2_0 net_4_0 net_4_5, $(PROFILE))
VALID_PROFILE := $(filter net_4_0 net_4_5, $(PROFILE))
ifndef VALID_PROFILE
LIBRARY_NAME = dummy-System.IdentityModel.Selectors.dll
NO_INSTALL = yes
+1 -1
View File
@@ -26,7 +26,7 @@ EXTRA_DISTFILES = \
Test/Resources/test.pfx \
Test/Resources/test2.pfx
VALID_PROFILE := $(filter net_2_0 net_4_0 net_4_5, $(PROFILE))
VALID_PROFILE := $(filter net_4_0 net_4_5, $(PROFILE))
ifndef VALID_PROFILE
LIBRARY_NAME = dummy-System.IdentityModel.dll
NO_INSTALL = yes
@@ -50,6 +50,7 @@
<Compile Include="Assembly\AssemblyInfo.cs" />
<Compile Include="System.IdentityModel\CookieTransform.cs" />
<Compile Include="System.IdentityModel\OpenObject.cs" />
<Compile Include="System.IdentityModel\SignatureVerificationFailedException.cs" />
<Compile Include="System.IdentityModel.Claims\Claim.cs" />
<Compile Include="System.IdentityModel.Claims\ClaimSet.cs" />
<Compile Include="System.IdentityModel.Claims\ClaimTypes.cs" />
@@ -147,9 +148,12 @@
<Compile Include="System.IdentityModel.Tokens\SecurityToken.cs" />
<Compile Include="System.IdentityModel.Tokens\SecurityTokenDescriptor.cs" />
<Compile Include="System.IdentityModel.Tokens\SecurityTokenException.cs" />
<Compile Include="System.IdentityModel.Tokens\SecurityTokenHandler.cs" />
<Compile Include="System.IdentityModel.Tokens\SecurityTokenExpiredException.cs" />
<Compile Include="System.IdentityModel.Tokens\SecurityTokenHandler.cs" />
<Compile Include="System.IdentityModel.Tokens\SecurityTokenHandlerCollection.cs" />
<Compile Include="System.IdentityModel.Tokens\SecurityTokenHandlerConfiguration.cs" />
<Compile Include="System.IdentityModel.Tokens\SecurityTokenNotYetValidException.cs" />
<Compile Include="System.IdentityModel.Tokens\SecurityTokenReplayDetectedException.cs" />
<Compile Include="System.IdentityModel.Tokens\SecurityTokenTypes.cs" />
<Compile Include="System.IdentityModel.Tokens\SecurityTokenValidationException.cs" />
<Compile Include="System.IdentityModel.Tokens\SessionSecurityToken.cs" />
@@ -170,7 +174,8 @@
<Compile Include="System.IdentityModel.Tokens\X509SubjectKeyIdentifierClause.cs" />
<Compile Include="System.IdentityModel.Tokens\X509ThumbprintKeyIdentifierClause.cs" />
<Compile Include="System.IdentityModel.Tokens\X509WindowsSecurityToken.cs" />
<Compile Include="System.Security.Claims\AuthenticationTypes.cs" />␍ <Compile Include="System.ServiceModel.Security\X509CertificateValidationMode.cs" />
<Compile Include="System.Security.Claims\AuthenticationTypes.cs" />
<Compile Include="System.ServiceModel.Security\X509CertificateValidationMode.cs" />
</ItemGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
@@ -180,18 +185,18 @@
</Target>
-->
<PropertyGroup>
<PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
</PreBuildEvent>
<PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">
</PreBuildEvent>
<PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
</PreBuildEvent>
<PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">
</PreBuildEvent>
<PostBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
</PostBuildEvent>
<PostBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">
<PostBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
</PostBuildEvent>
<PostBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">
</PostBuildEvent>
</PropertyGroup>
<ItemGroup>
@@ -236,4 +241,4 @@
<Folder Include="Properties\" />
</ItemGroup>
</Project>
@@ -0,0 +1,54 @@
//
// SecurityTokenExpiredException.cs
//
// Author:
// Noesis Labs ([email protected])
//
// Copyright (C) 2014 Noesis Labs, LLC https://noesislabs.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_4_5
using System;
using System.Runtime.Serialization;
namespace System.IdentityModel.Tokens
{
public class SecurityTokenExpiredException : SecurityTokenValidationException
{
public SecurityTokenExpiredException()
: base("ID4181: The security token has expired.")
{ }
public SecurityTokenExpiredException(string message)
: base(message)
{ }
public SecurityTokenExpiredException(string message, Exception innerException)
: base(message, innerException)
{ }
public SecurityTokenExpiredException(SerializationInfo info, StreamingContext context)
: base(info, context)
{ }
}
}
#endif
@@ -0,0 +1,54 @@
//
// SecurityTokenNotYetValidException.cs
//
// Author:
// Noesis Labs ([email protected])
//
// Copyright (C) 2014 Noesis Labs, LLC https://noesislabs.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_4_5
using System;
using System.Runtime.Serialization;
namespace System.IdentityModel.Tokens
{
public class SecurityTokenNotYetValidException : SecurityTokenValidationException
{
public SecurityTokenNotYetValidException()
: base("ID4182: The security token is not valid yet.")
{ }
public SecurityTokenNotYetValidException(string message)
: base(message)
{ }
public SecurityTokenNotYetValidException(string message, Exception innerException)
: base(message, innerException)
{ }
public SecurityTokenNotYetValidException(SerializationInfo info, StreamingContext context)
: base(info, context)
{ }
}
}
#endif
@@ -0,0 +1,54 @@
//
// SecurityTokenReplayDetectedException.cs
//
// Author:
// Noesis Labs ([email protected])
//
// Copyright (C) 2014 Noesis Labs, LLC https://noesislabs.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_4_5
using System;
using System.Runtime.Serialization;
namespace System.IdentityModel.Tokens
{
public class SecurityTokenReplayDetectedException : SecurityTokenValidationException
{
public SecurityTokenReplayDetectedException()
: base("ID1070: Replay has been detected for a SecurityToken.")
{ }
public SecurityTokenReplayDetectedException(string message)
: base(message)
{ }
public SecurityTokenReplayDetectedException(string message, Exception innerException)
: base(message, innerException)
{ }
public SecurityTokenReplayDetectedException(SerializationInfo info, StreamingContext context)
: base(info, context)
{ }
}
}
#endif
@@ -3,6 +3,7 @@
Assembly/AssemblyInfo.cs
System.IdentityModel/CookieTransform.cs
System.IdentityModel/OpenObject.cs
System.IdentityModel/SignatureVerificationFailedException.cs
System.IdentityModel.Claims/Claim.cs
System.IdentityModel.Claims/ClaimSet.cs
System.IdentityModel.Claims/ClaimTypes.cs
@@ -100,9 +101,12 @@ System.IdentityModel.Tokens/SecurityKeyUsage.cs
System.IdentityModel.Tokens/SecurityToken.cs
System.IdentityModel.Tokens/SecurityTokenDescriptor.cs
System.IdentityModel.Tokens/SecurityTokenException.cs
System.IdentityModel.Tokens/SecurityTokenExpiredException.cs
System.IdentityModel.Tokens/SecurityTokenHandler.cs
System.IdentityModel.Tokens/SecurityTokenHandlerCollection.cs
System.IdentityModel.Tokens/SecurityTokenHandlerConfiguration.cs
System.IdentityModel.Tokens/SecurityTokenNotYetValidException.cs
System.IdentityModel.Tokens/SecurityTokenReplayDetectedException.cs
System.IdentityModel.Tokens/SecurityTokenTypes.cs
System.IdentityModel.Tokens/SecurityTokenValidationException.cs
System.IdentityModel.Tokens/SessionSecurityToken.cs
@@ -124,4 +128,4 @@ System.IdentityModel.Tokens/X509SubjectKeyIdentifierClause.cs
System.IdentityModel.Tokens/X509ThumbprintKeyIdentifierClause.cs
System.IdentityModel.Tokens/X509WindowsSecurityToken.cs
System.Security.Claims/AuthenticationTypes.cs
System.ServiceModel.Security/X509CertificateValidationMode.cs
System.ServiceModel.Security/X509CertificateValidationMode.cs
@@ -0,0 +1,54 @@
//
// SignatureVerificationFailedException.cs
//
// Author:
// Noesis Labs ([email protected])
//
// Copyright (C) 2014 Noesis Labs, LLC https://noesislabs.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_4_5
using System;
using System.Runtime.Serialization;
namespace System.IdentityModel
{
public class SignatureVerificationFailedException : Exception
{
public SignatureVerificationFailedException()
: base("ID4038: Signature verification failed.")
{ }
public SignatureVerificationFailedException(string message)
: base(message)
{ }
public SignatureVerificationFailedException(string message, Exception innerException)
: base(message, innerException)
{ }
public SignatureVerificationFailedException(SerializationInfo info, StreamingContext context)
: base(info, context)
{ }
}
}
#endif
+1 -1
View File
@@ -12,7 +12,7 @@ LOCAL_MCS_FLAGS = -lib:$(secxml_libdir) -lib:$(bare_libdir)
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -nowarn:168,169,183,219,414,1595
VALID_PROFILE := $(filter net_1_1 net_2_0 moonlight_raw net_4_0 net_4_5, $(PROFILE))
VALID_PROFILE := $(filter moonlight_raw net_4_0 net_4_5, $(PROFILE))
EXTRA_DISTFILES = \
Test/System.Security.Cryptography.Xml/sample.pfx \
@@ -637,7 +637,7 @@ namespace Mono.Xml {
else if (n2 == null)
return 1;
else if (n1.Prefix == n2.Prefix)
return string.Compare (n1.LocalName, n2.LocalName);
return string.CompareOrdinal (n1.LocalName, n2.LocalName);
// Attributes in the default namespace are first
// because the default namespace is not applied to
@@ -213,6 +213,87 @@ namespace MonoTests.System.Security.Cryptography.Xml {
Assert.IsTrue (vrfy.CheckSignature (), "RSA-Compute/Verify");
}
// The same as MSDNSample(), but adding a few attributes
public SignedXml MSDNSampleMixedCaseAttributes ()
{
// Create example data to sign.
XmlDocument document = new XmlDocument ();
XmlNode node = document.CreateNode (XmlNodeType.Element, "", "MyElement", "samples");
node.InnerText = "This is some text";
XmlAttribute a1 = document.CreateAttribute ("Aa");
XmlAttribute a2 = document.CreateAttribute ("Bb");
XmlAttribute a3 = document.CreateAttribute ("aa");
XmlAttribute a4 = document.CreateAttribute ("bb");
a1.Value = "one";
a2.Value = "two";
a3.Value = "three";
a4.Value = "four";
node.Attributes.Append (a1);
node.Attributes.Append (a2);
node.Attributes.Append (a3);
node.Attributes.Append (a4);
document.AppendChild (node);
// Create the SignedXml message.
SignedXml signedXml = new SignedXml ();
// Create a data object to hold the data to sign.
DataObject dataObject = new DataObject ();
dataObject.Data = document.ChildNodes;
dataObject.Id = "MyObjectId";
// Add the data object to the signature.
signedXml.AddObject (dataObject);
// Create a reference to be able to package everything into the
// message.
Reference reference = new Reference ();
reference.Uri = "#MyObjectId";
// Add it to the message.
signedXml.AddReference (reference);
return signedXml;
}
public string AsymmetricRSAMixedCaseAttributes ()
{
SignedXml signedXml = MSDNSampleMixedCaseAttributes ();
RSA key = RSA.Create ();
signedXml.SigningKey = key;
// Add a KeyInfo.
KeyInfo keyInfo = new KeyInfo ();
keyInfo.AddClause (new RSAKeyValue (key));
signedXml.KeyInfo = keyInfo;
// Compute the signature.
signedXml.ComputeSignature ();
// Get the XML representation of the signature.
XmlElement xmlSignature = signedXml.GetXml ();
StringWriter sw = new StringWriter ();
XmlWriter w = new XmlTextWriter (sw);
xmlSignature.WriteTo (w);
return sw.ToString ();
}
// Example output from Windows for AsymmetricRSAMixedCaseAttributes()
private const string AsymmetricRSAMixedCaseAttributesResult = "<Signature xmlns=\"http://www.w3.org/2000/09/xmldsig#\"><SignedInfo><CanonicalizationMethod Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315\" /><SignatureMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#rsa-sha1\" /><Reference URI=\"#MyObjectId\"><DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" /><DigestValue>0j1xLsePFtuRHfXEnVdTSLWtAm4=</DigestValue></Reference></SignedInfo><SignatureValue>hmrEBgns5Xx14aDhzqOyIh0qLNMUldtW8+fNPcvtD/2KtEhNZQGctnhs90CRa1NZ08TqzW2pUaEwmqvMAtF4v8KtWzC/zTuc1jH6nxQvQSQo0ABhuXdu7/hknZkXJ4yKBbdgbKjAsKfULwbWrP/PacLPoYfCO+wXSrt+wLMTTWU=</SignatureValue><KeyInfo><KeyValue><RSAKeyValue><Modulus>4h/rHDr54r6SZWk2IPCeHX7N+wR1za0VBLshuS6tq3RSWap4PY2BM8VdbKH2T9RzyZoiHufjng+1seUx430iMsXisOLUkPP+yGtMQOSZ3CQHAa+IYA+fplXipixI0rV1J1wJNXQm3HxXQqKWpIv5fkwBtj8o2k6CWMgPNgFCnxc=</Modulus><Exponent>AQAB</Exponent></RSAKeyValue></KeyValue></KeyInfo><Object Id=\"MyObjectId\"><MyElement Aa=\"one\" Bb=\"two\" aa=\"three\" bb=\"four\" xmlns=\"samples\">This is some text</MyElement></Object></Signature>";
[Test]
public void AsymmetricRSAMixedCaseAttributesVerifyWindows ()
{
XmlDocument doc = new XmlDocument ();
doc.LoadXml (AsymmetricRSAMixedCaseAttributesResult);
SignedXml v1 = new SignedXml ();
v1.LoadXml (doc.DocumentElement);
Assert.IsTrue (v1.CheckSignature ());
}
[Test]
public void AsymmetricDSASignature ()
{
@@ -494,6 +494,19 @@ namespace MonoTests.System.Security.Cryptography.Xml {
Assert.AreEqual (new StreamReader (s, Encoding.UTF8).ReadToEnd (), expected);
}
[Test]
public void OrdinalSortForAttributes ()
{
XmlDocument doc = new XmlDocument ();
string xml = "<foo Aa=\"one\" Bb=\"two\" aa=\"three\" bb=\"four\"><bar></bar></foo>";
doc.LoadXml (xml);
transform.LoadInput (doc);
Stream s = (Stream) transform.GetOutput ();
string output = Stream2String (s);
Assert.AreEqual (xml, output);
}
#if NET_2_0
[Test]
public void PrefixlessNamespaceOutput ()
@@ -70,7 +70,7 @@ namespace MonoTests.System.ServiceModel.Dispatcher
};
client.GetDataAsync ();
if (!wait.WaitOne (TimeSpan.FromSeconds (10)))
if (!wait.WaitOne (TimeSpan.FromSeconds (20)))
Assert.Fail ("timeout");
} finally {
serviceHost.Close ();
+1 -6
View File
@@ -8,17 +8,12 @@ LIB_MCS_FLAGS = \
/r:System.Core.dll \
/r:System.Web.dll
ifeq (2.0, $(FRAMEWORK_VERSION))
# This is a .NET 3.5 only assembly, but built during the 2.0 build
LIB_MCS_FLAGS += -d:NET_3_5
endif
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
EXTRA_DISTFILES =
# This is a .NET 3.5+ assembly
VALID_PROFILE := $(filter net_2_0 net_4_0 net_4_5, $(PROFILE))
VALID_PROFILE := $(filter net_4_0 net_4_5, $(PROFILE))
ifndef VALID_PROFILE
LIBRARY_NAME = dummy-System.Web.Abstractions.dll
NO_INSTALL = yes
@@ -183,10 +183,9 @@ namespace System.Web
return w.GetSection (sectionName);
}
[MonoTODO]
public override object GetService (Type serviceType)
{
throw new NotImplementedException ();
return ((IServiceProvider)w).GetService (serviceType);
}
#if NET_4_0
public override void RemapHandler (IHttpHandler handler)
@@ -138,7 +138,10 @@ namespace System.Web
#if NET_4_5
public virtual ReadEntityBodyMode ReadEntityBodyMode { get { NotImplemented(); return ReadEntityBodyMode.Classic; } }
public virtual UnvalidatedRequestValuesBase Unvalidated { get { NotImplemented (); return null; } }
#endif
public virtual Uri Url { get { NotImplemented (); return null; } }
public virtual Uri UrlReferrer { get { NotImplemented (); return null; } }
@@ -208,6 +208,18 @@ namespace System.Web
get { return w.TotalBytes; }
}
#if NET_4_5
public override UnvalidatedRequestValuesBase Unvalidated {
get { return new UnvalidatedRequestValuesWrapper (w.Unvalidated); }
}
#endif
#if NET_4_5
public override ReadEntityBodyMode ReadEntityBodyMode {
get { return ReadEntityBodyMode.Classic; }
}
#endif
public override Uri Url {
get { return w.Url; }
}
@@ -39,6 +39,7 @@ using System.Security.Permissions;
using System.Security.Principal;
using System.Text;
using System.Web.Caching;
using System.Threading;
#if NET_4_0
using System.Web.Routing;
@@ -69,6 +70,10 @@ namespace System.Web
public virtual string Charset { get { NotImplemented (); return null; } set { NotImplemented (); } }
#if NET_4_5
public virtual CancellationToken ClientDisconnectedToken { get { NotImplemented (); return CancellationToken.None; } }
#endif
public virtual Encoding ContentEncoding { get { NotImplemented (); return null; } set { NotImplemented (); } }
public virtual string ContentType { get { NotImplemented (); return null; } set { NotImplemented (); } }
@@ -39,6 +39,7 @@ using System.Security.Permissions;
using System.Security.Principal;
using System.Text;
using System.Web.Caching;
using System.Threading;
namespace System.Web
{
@@ -82,6 +83,12 @@ namespace System.Web
set { w.Charset = value; }
}
#if NET_4_5
public override CancellationToken ClientDisconnectedToken {
get { return CancellationToken.None; }
}
#endif
public override Encoding ContentEncoding {
get { return w.ContentEncoding; }
set { w.ContentEncoding = value; }
+1 -6
View File
@@ -15,11 +15,6 @@ LIB_MCS_FLAGS = \
/r:System.Web.Abstractions.dll \
/r:System.Web.Routing.dll
ifeq (2.0, $(FRAMEWORK_VERSION))
# This is a .NET 3.5 only assembly, but built during the 2.0 build
LIB_MCS_FLAGS += -d:NET_3_5
endif
ifeq (4, $(FRAMEWORK_VERSION_MAJOR))
LIB_MCS_FLAGS += -r:System.Web.ApplicationServices.dll
endif
@@ -186,7 +181,7 @@ endif
EXTRA_DISTFILES = $(foreach resource,$(TEST_RESOURCE_FILES), $(shell echo $(subst \`,\\\`,$(resource)) | cut -d ',' -f 1))
# This is a .NET 3.5+ assembly
VALID_PROFILE := $(filter net_2_0 net_4_0 net_4_5, $(PROFILE))
VALID_PROFILE := $(filter net_4_0 net_4_5, $(PROFILE))
ifndef VALID_PROFILE
LIBRARY_NAME = dummy-System.Web.DynamicData.dll
NO_INSTALL = yes
@@ -204,7 +204,11 @@ namespace System.Web.Script.Serialization
}
public object Deserialize (string input, Type targetType) {
return DeserializeObjectInternal (input);
object obj = DeserializeObjectInternal (input);
if (obj == null) return null;
return ConvertToType (obj, targetType);
}
static object Evaluate (object value) {
@@ -415,6 +415,22 @@ namespace MonoTests.System.Web.Script.Serialization
//object oo = ser.DeserializeObject ("{value:'Purple\\r \\n monkey\\'s:\\tdishwasher'}");
}
[Test]
public void TestDeserializeNonGenericOverload()
{
JavaScriptSerializer ser = new JavaScriptSerializer();
Assert.IsNull(ser.Deserialize("", typeof(X)));
X s = new X();
s.Init();
string x = ser.Serialize(s);
Assert.AreEqual("{\"z\":8,\"ch\":\"v\",\"ch_null\":null,\"str\":\"vwF59g\",\"b\":253,\"sb\":-48,\"sh\":-32740,\"ush\":65511,\"i\":-234235453,\"ui\":4294733061,\"l\":-9223372036854775780,\"ul\":18446744073709551612,\"f\":NaN,\"f1\":-Infinity,\"f2\":Infinity,\"f3\":-3.40282347E+38,\"f4\":3.40282347E+38,\"d\":NaN,\"d1\":-Infinity,\"d2\":Infinity,\"d3\":-1.7976931348623157E+308,\"d4\":1.7976931348623157E+308,\"de\":-1,\"de1\":0,\"de2\":1,\"de3\":-79228162514264337593543950335,\"de4\":79228162514264337593543950335,\"g\":\"000000ea-0002-0162-0102-030405060708\",\"nb\":null,\"dbn\":null,\"uri\":\"http://kostat@mainsoft/adfasdf/asdfasdf.aspx/asda/ads?a=b&c=d\",\"hash\":{\"mykey\":{\"BB\":10}},\"point\":{\"IsEmpty\":false,\"X\":150,\"Y\":150},\"MyEnum\":[1,10,345],\"MyEnum1\":[1,10,345],\"AA\":5,\"AA1\":[{\"BB\":10},{\"BB\":10}],\"BB\":18446744073709551610,\"YY\":[{\"BB\":10},{\"BB\":10}]}", x, "#A1");
X n = ser.Deserialize(x, typeof(X)) as X;
Assert.AreEqual(s, n, "#A2");
}
[Test]
public void TestDeserializeTypeResolver ()
{
+1 -6
View File
@@ -9,11 +9,6 @@ LIB_MCS_FLAGS = \
/r:System.Web.dll \
/r:System.Web.Abstractions.dll
ifeq (2.0, $(FRAMEWORK_VERSION))
# This is a .NET 3.5 only assembly, but built during the 2.0 build
LIB_MCS_FLAGS += -d:NET_3_5 -d:SYSTEMCORE_DEP
endif
ifdef DEBUG
LIB_MCS_FLAGS += -define:DEBUG
endif
@@ -23,7 +18,7 @@ TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
EXTRA_DISTFILES =
# This is a .NET 3.5+ assembly
VALID_PROFILE := $(filter net_2_0 net_4_0 net_4_5, $(PROFILE))
VALID_PROFILE := $(filter net_4_0 net_4_5, $(PROFILE))
ifndef VALID_PROFILE
LIBRARY_NAME = dummy-System.Web.Routing.dll
NO_INSTALL = yes
+2 -5
View File
@@ -255,6 +255,7 @@ LIB_MCS_FLAGS = \
-r:System.Xml.dll \
-r:System.EnterpriseServices.dll \
-r:System.Runtime.Serialization.Formatters.Soap \
-r:System.ComponentModel.DataAnnotations.dll \
$(OTHER_LIB_MCS_FLAGS) \
$(RESX_RES:%=/resource:%) \
$(OTHER_RES:%=/resource:%)
@@ -271,10 +272,6 @@ TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -doc:$(test_lib:.dll=.xml) -nowarn:219,169,159
$(foreach file,$(NUNIT_APP_CODE_FILES),$(shell echo $(file) | sed -e 's;\(.*\)/\(.*\);/resource:\1/\2,App_Code/\2 ;g')) \
$(foreach file,$(NUNIT_APP_GLOBALRESOURCES_FILES),$(shell echo $(file) | sed -e 's;\(.*\)/\(.*\);/resource:\1/\2,App_GlobalResources/\2 ;g'))
ifeq (net_2_0, $(PROFILE))
TEST_MCS_FLAGS += -r:System.Web.Extensions.dll -d:TEST
endif
EXTRA_DISTFILES = \
$(RESOURCE_FILES_4) \
$(RESOURCE_FILES_2) \
@@ -447,4 +444,4 @@ ifneq ($(PROFILE),basic)
csproj-local:
$(MAKE) csproj-local intermediate=plainweb/
endif
endif
endif
@@ -1249,6 +1249,7 @@
<Compile Include="System.Web\DefaultExceptionPageTemplate.cs" />
<Compile Include="System.Web\DefaultHttpHandler.cs" />
<Compile Include="System.Web\EndEventHandler.cs" />
<Compile Include="System.Web\EventHandlerTaskAsyncHelper.cs" />
<Compile Include="System.Web\ExceptionPageTemplate.cs" />
<Compile Include="System.Web\ExceptionPageTemplateFragment.cs" />
<Compile Include="System.Web\ExceptionPageTemplateFragmentValue.cs" />
@@ -1294,6 +1295,7 @@
<Compile Include="System.Web\HttpRuntime.cs" />
<Compile Include="System.Web\HttpServerUtility.cs" />
<Compile Include="System.Web\HttpStaticObjectsCollection.cs" />
<Compile Include="System.Web\HttpTaskAsyncHandler.cs" />
<Compile Include="System.Web\HttpUnhandledException.cs" />
<Compile Include="System.Web\HttpUtility.cs" />
<Compile Include="System.Web\HttpValidationStatus.cs" />
@@ -1333,6 +1335,8 @@
<Compile Include="System.Web\SiteMapResolveEventArgs.cs" />
<Compile Include="System.Web\StaticFileHandler.cs" />
<Compile Include="System.Web\StaticSiteMapProvider.cs" />
<Compile Include="System.Web\TaskAsyncResult.cs" />
<Compile Include="System.Web\TaskEventHandler.cs" />
<Compile Include="System.Web\TempFileStream.cs" />
<Compile Include="System.Web\TraceContext.cs" />
<Compile Include="System.Web\TraceContextEventArgs.cs" />
@@ -1249,6 +1249,7 @@
<Compile Include="System.Web\DefaultExceptionPageTemplate.cs" />
<Compile Include="System.Web\DefaultHttpHandler.cs" />
<Compile Include="System.Web\EndEventHandler.cs" />
<Compile Include="System.Web\EventHandlerTaskAsyncHelper.cs" />
<Compile Include="System.Web\ExceptionPageTemplate.cs" />
<Compile Include="System.Web\ExceptionPageTemplateFragment.cs" />
<Compile Include="System.Web\ExceptionPageTemplateFragmentValue.cs" />
@@ -1294,6 +1295,7 @@
<Compile Include="System.Web\HttpRuntime.cs" />
<Compile Include="System.Web\HttpServerUtility.cs" />
<Compile Include="System.Web\HttpStaticObjectsCollection.cs" />
<Compile Include="System.Web\HttpTaskAsyncHandler.cs" />
<Compile Include="System.Web\HttpUnhandledException.cs" />
<Compile Include="System.Web\HttpUtility.cs" />
<Compile Include="System.Web\HttpValidationStatus.cs" />
@@ -1321,6 +1323,7 @@
<Compile Include="System.Web\ProcessShutdownReason.cs" />
<Compile Include="System.Web\ProcessStatus.cs" />
<Compile Include="System.Web\QueueManager.cs" />
<Compile Include="System.Web\ReadEntityBodyMode.cs" />
<Compile Include="System.Web\RequestNotification.cs" />
<Compile Include="System.Web\RequestNotificationStatus.cs" />
<Compile Include="System.Web\ServerVariablesCollection.cs" />
@@ -1332,6 +1335,8 @@
<Compile Include="System.Web\SiteMapResolveEventArgs.cs" />
<Compile Include="System.Web\StaticFileHandler.cs" />
<Compile Include="System.Web\StaticSiteMapProvider.cs" />
<Compile Include="System.Web\TaskAsyncResult.cs" />
<Compile Include="System.Web\TaskEventHandler.cs" />
<Compile Include="System.Web\TempFileStream.cs" />
<Compile Include="System.Web\TraceContext.cs" />
<Compile Include="System.Web\TraceContextEventArgs.cs" />
@@ -556,6 +556,7 @@
<Compile Include="Test\System.Web.Util\UrlUtilsTest.cs" />
<Compile Include="Test\System.Web.Util\WorkItemCas.cs" />
<Compile Include="Test\System.Web\AppBrowsersTest.cs" />
<Compile Include="Test\System.Web\EventHandlerTaskAsyncHelperTest.cs" />
<Compile Include="Test\System.Web\HttpApplicationCas.cs" />
<Compile Include="Test\System.Web\HttpApplicationStateCas.cs" />
<Compile Include="Test\System.Web\HttpApplicationTest.cs" />
@@ -591,6 +592,7 @@
<Compile Include="Test\System.Web\HttpServerUtilityCas.cs" />
<Compile Include="Test\System.Web\HttpServerUtilityTest.cs" />
<Compile Include="Test\System.Web\HttpStaticObjectsCollectionCas.cs" />
<Compile Include="Test\System.Web\HttpTaskAsyncHandlerTest.cs" />
<Compile Include="Test\System.Web\HttpUnhandledExceptionCas.cs" />
<Compile Include="Test\System.Web\HttpUtilityCas.cs" />
<Compile Include="Test\System.Web\HttpUtilityTest.cs" />
@@ -602,6 +604,7 @@
<Compile Include="Test\System.Web\SiteMapNodeTest.cs" />
<Compile Include="Test\System.Web\SiteMapProviderTest.cs" />
<Compile Include="Test\System.Web\StaticSiteMapProviderTest.cs" />
<Compile Include="Test\System.Web\TaskAsyncResultTest.cs" />
<Compile Include="Test\System.Web\TraceContextCas.cs" />
<Compile Include="Test\System.Web\TraceContextRecordTest.cs" />
<Compile Include="Test\System.Web\VirtualPathUtilityTest.cs" />
@@ -0,0 +1,110 @@
//
// System.Web.Security.MembershipPasswordAttribute
//
// Authors:
// Martin Thwaites ([email protected])
//
// (C) 2014 Martin Thwaites
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text.RegularExpressions;
namespace System.Web.Security
{
[AttributeUsageAttribute (AttributeTargets.Property|AttributeTargets.Field|AttributeTargets.Parameter, AllowMultiple = false)]
public class MembershipPasswordAttribute : ValidationAttribute
{
public string MinNonAlphanumericCharactersError { get; set; }
public string MinPasswordLengthError { get; set; }
public int MinRequiredNonAlphanumericCharacters { get; set; }
public int MinRequiredPasswordLength { get; set; }
public string PasswordStrengthError { get; set; }
public string PasswordStrengthRegularExpression { get; set; }
public Type ResourceType { get; set; }
public MembershipPasswordAttribute ()
{
if (Membership.Provider != null)
{
MinRequiredNonAlphanumericCharacters = Membership.Provider.MinRequiredNonAlphanumericCharacters;
MinRequiredPasswordLength = Membership.Provider.MinRequiredPasswordLength;
PasswordStrengthRegularExpression = Membership.Provider.PasswordStrengthRegularExpression;
}
else
{
MinRequiredPasswordLength = 7;
MinRequiredNonAlphanumericCharacters = 1;
PasswordStrengthRegularExpression = @"(?=.{6,})(?=(.*\d){1,})(?=(.*\W){1,})";
}
MinNonAlphanumericCharactersError = "The '{0}' field is an invalid password. Password must have {1} or more non-alphanumeric characters.";
MinPasswordLengthError = "The '{0}' field is an invalid password. Password must have {1} or more characters.";
PasswordStrengthError = "The '{0}' field is an invalid password. It does not meet the password strength requirements";
ErrorMessage = "The field {0} is invalid.";
}
protected override ValidationResult IsValid (object value, ValidationContext validationContext)
{
var password = value as string;
var isError = false;
if (string.IsNullOrEmpty(password))
return null;
var errorMessage = string.Empty;
var parameter = 0;
var pattern = new Regex (@"\W|_");
if (MinRequiredPasswordLength > 0 &&
password.Length < MinRequiredPasswordLength) {
errorMessage = MinPasswordLengthError;
parameter = MinRequiredPasswordLength;
isError = true;
}
if (!isError && MinRequiredNonAlphanumericCharacters > 0 &&
pattern.Matches (password).Count < MinRequiredNonAlphanumericCharacters) {
errorMessage = MinNonAlphanumericCharactersError;
parameter = MinRequiredNonAlphanumericCharacters;
isError = true;
}
if (!isError && !string.IsNullOrEmpty (PasswordStrengthRegularExpression) &&
new Regex (PasswordStrengthRegularExpression).IsMatch (password)) {
errorMessage = PasswordStrengthError;
isError = true;
}
if (isError) {
if (validationContext == null)
return new ValidationResult("error");
return new ValidationResult (
string.Format (errorMessage, validationContext.DisplayName, parameter),
new[] {validationContext.MemberName});
}
return ValidationResult.Success;
}
}
}
@@ -0,0 +1,62 @@
//
// System.Web.EventHandlerTaskAsyncHelper.cs
//
// Author:
// Kornel Pal ([email protected])
//
// Copyright (C) 2014 Kornel Pal
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Threading.Tasks;
namespace System.Web
{
public sealed class EventHandlerTaskAsyncHelper
{
readonly TaskEventHandler taskEventHandler;
readonly BeginEventHandler beginEventHandler;
static readonly EndEventHandler endEventHandler = TaskAsyncResult.Wait;
public BeginEventHandler BeginEventHandler {
get { return beginEventHandler; }
}
public EndEventHandler EndEventHandler {
get { return endEventHandler; }
}
public EventHandlerTaskAsyncHelper (TaskEventHandler handler)
{
if (handler == null)
throw new ArgumentNullException ("handler");
taskEventHandler = handler;
beginEventHandler = GetAsyncResult;
}
IAsyncResult GetAsyncResult (object sender, EventArgs e, AsyncCallback callback, object state)
{
Task task = taskEventHandler (sender, e);
return TaskAsyncResult.GetAsyncResult (task, callback, state);
}
}
}
+83 -18
View File
@@ -80,13 +80,17 @@ namespace System.Web
string unescaped_path;
string original_path;
string path_info;
string path_info_unvalidated;
string raw_url;
string raw_url_unvalidated;
WebROCollection all_params;
WebROCollection headers;
NameValueCollection headers;
WebROCollection headers_unvalidated;
Stream input_stream;
InputFilterStream input_filter;
Stream filter;
HttpCookieCollection cookies;
HttpCookieCollection cookies_unvalidated;
string http_method;
WebROCollection form;
@@ -440,15 +444,25 @@ namespace System.Web
}
}
internal HttpCookieCollection CookiesNoValidation {
get {
if (cookies_unvalidated == null) {
if (worker_request == null) {
cookies_unvalidated = new HttpCookieCollection ();
} else {
string cookie_hv = worker_request.GetKnownRequestHeader (HttpWorkerRequest.HeaderCookie);
cookies_unvalidated = new HttpCookieCollection (cookie_hv);
}
}
return cookies_unvalidated;
}
}
public HttpCookieCollection Cookies {
get {
if (cookies == null) {
if (worker_request == null) {
cookies = new HttpCookieCollection ();
} else {
string cookie_hv = worker_request.GetKnownRequestHeader (HttpWorkerRequest.HeaderCookie);
cookies = new HttpCookieCollection (cookie_hv);
}
cookies = CookiesNoValidation;
}
#if TARGET_J2EE
@@ -737,10 +751,20 @@ namespace System.Web
}
}
internal NameValueCollection HeadersNoValidation {
get {
if (headers_unvalidated == null) {
headers_unvalidated = new HeadersCollection (this);
}
return headers_unvalidated;
}
}
public NameValueCollection Headers {
get {
if (headers == null) {
headers = new HeadersCollection (this);
headers = HeadersNoValidation;
#if NET_4_0
if (validateRequestNewMode) {
RequestValidator validator = RequestValidator.Current;
@@ -1226,12 +1250,23 @@ namespace System.Web
}
}
internal string PathInfoNoValidation {
get {
if (path_info_unvalidated == null) {
if (worker_request == null)
return String.Empty;
path_info_unvalidated = worker_request.GetPathInfo () ?? String.Empty;
}
return path_info_unvalidated;
}
}
public string PathInfo {
get {
if (path_info == null) {
if (worker_request == null)
return String.Empty;
path_info = worker_request.GetPathInfo () ?? String.Empty;
path_info = PathInfoNoValidation;
#if NET_4_0
if (validateRequestNewMode) {
RequestValidator validator = RequestValidator.Current;
@@ -1335,16 +1370,26 @@ namespace System.Web
}
}
internal string RawUrlUnvalidated {
get {
if (raw_url_unvalidated == null) {
if (worker_request != null)
raw_url_unvalidated = worker_request.GetRawUrl ();
else
raw_url_unvalidated = UrlComponents.Path + UrlComponents.Query;
if (raw_url_unvalidated == null)
raw_url_unvalidated = String.Empty;
}
return raw_url_unvalidated;
}
}
public string RawUrl {
get {
if (raw_url == null) {
if (worker_request != null)
raw_url = worker_request.GetRawUrl ();
else
raw_url = UrlComponents.Path + UrlComponents.Query;
if (raw_url == null)
raw_url = String.Empty;
raw_url = RawUrlUnvalidated;
#if NET_4_0
if (validateRequestNewMode) {
RequestValidator validator = RequestValidator.Current;
@@ -1398,6 +1443,26 @@ namespace System.Web
}
}
#if NET_4_5
public UnvalidatedRequestValues Unvalidated {
get {
var vals = new UnvalidatedRequestValues ();
vals.Cookies = CookiesNoValidation;
vals.Files = Files;
vals.Form = FormUnvalidated;
vals.Headers = HeadersNoValidation;
vals.Path = PathNoValidation;
vals.PathInfo = PathInfoNoValidation;
vals.QueryString = QueryStringUnvalidated;
vals.RawUrl = RawUrlUnvalidated;
vals.Url = Url;
return vals;
}
}
#endif
public Uri Url {
get {
if (cached_url == null) {
@@ -0,0 +1,59 @@
//
// System.Web.HttpTaskAsyncHandler.cs
//
// Author:
// Kornel Pal ([email protected])
//
// Copyright (C) 2014 Kornel Pal
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.ComponentModel;
using System.Threading.Tasks;
namespace System.Web
{
public abstract class HttpTaskAsyncHandler : IHttpAsyncHandler, IHttpHandler
{
public virtual bool IsReusable {
get { return false; }
}
[EditorBrowsable (EditorBrowsableState.Never)]
public virtual void ProcessRequest (HttpContext context)
{
throw new NotSupportedException ("This handler cannot be executed synchronously.");
}
public abstract Task ProcessRequestAsync (HttpContext context);
IAsyncResult IHttpAsyncHandler.BeginProcessRequest (HttpContext context, AsyncCallback cb, object extraData)
{
Task task = ProcessRequestAsync (context);
return TaskAsyncResult.GetAsyncResult (task, cb, extraData);
}
void IHttpAsyncHandler.EndProcessRequest (IAsyncResult result)
{
TaskAsyncResult.Wait (result);
}
}
}
@@ -0,0 +1,101 @@
//
// System.Web.TaskAsyncResult.cs
//
// Author:
// Kornel Pal ([email protected])
//
// Copyright (C) 2014 Kornel Pal
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Threading;
using System.Threading.Tasks;
namespace System.Web
{
sealed class TaskAsyncResult : IAsyncResult
{
static readonly Action<Task, object> invokeCallback = InvokeCallback;
readonly Task task;
readonly AsyncCallback callback;
public object AsyncState {
get;
private set;
}
public WaitHandle AsyncWaitHandle {
get { return ((IAsyncResult) task).AsyncWaitHandle; }
}
public bool CompletedSynchronously {
get;
private set;
}
public bool IsCompleted {
get { return task.IsCompleted; }
}
TaskAsyncResult (Task task, AsyncCallback callback, object state)
{
this.task = task;
this.callback = callback;
this.AsyncState = state;
this.CompletedSynchronously = task.IsCompleted;
}
public static IAsyncResult GetAsyncResult (Task task, AsyncCallback callback, object state)
{
if (task == null)
return null;
var result = new TaskAsyncResult (task, callback, state);
if (callback != null) {
if (result.CompletedSynchronously)
callback (result);
else
task.ContinueWith (invokeCallback, result);
}
return result;
}
public static void Wait (IAsyncResult result)
{
if (result == null)
throw new ArgumentNullException ("result");
var taskAsyncResult = result as TaskAsyncResult;
if (taskAsyncResult == null)
throw new ArgumentException ("The provided IAsyncResult is invalid.", "result");
taskAsyncResult.task.GetAwaiter ().GetResult ();
}
static void InvokeCallback (Task task, object state)
{
var result = (TaskAsyncResult) state;
result.callback (result);
}
}
}
@@ -0,0 +1,34 @@
//
// System.Web.TaskEventHandler.cs
//
// Author:
// Kornel Pal ([email protected])
//
// Copyright (C) 2014 Kornel Pal
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Threading.Tasks;
namespace System.Web
{
public delegate Task TaskEventHandler (object sender, EventArgs e);
}
@@ -0,0 +1,66 @@
//
// System.Web.UnvalidatedRequestValues.cs
//
// Author:
// Mike Morano <[email protected]>
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections.Specialized;
namespace System.Web {
public sealed class UnvalidatedRequestValues {
public HttpCookieCollection Cookies { get; internal set; }
public HttpFileCollection Files { get; internal set; }
public NameValueCollection Form { get; internal set; }
public NameValueCollection Headers { get; internal set; }
public string Path { get; internal set; }
public string PathInfo { get; internal set; }
public NameValueCollection QueryString { get; internal set; }
public string RawUrl { get; internal set; }
public Uri Url { get; internal set; }
public string this[string field] {
get {
if (Form != null && Form [field] != null) {
return Form [field];
}
if (Cookies != null && Cookies [field] != null) {
return Cookies [field].Value;
}
if (QueryString != null && QueryString [field] != null) {
return QueryString [field];
}
// msdn docs also suggest the ServerVariables are inspected by this indexer,
// but that seems odd given what is available in this class
return null;
}
}
}
}
@@ -0,0 +1,90 @@
//
// System.Web.UnvalidatedRequestValuesBase.cs
//
// Author:
// Mike Morano <[email protected]>
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections.Specialized;
namespace System.Web {
public abstract class UnvalidatedRequestValuesBase {
void NotImplemented ()
{
throw new NotImplementedException ();
}
public virtual HttpCookieCollection Cookies
{
get { NotImplemented (); return null; }
}
public virtual HttpFileCollection Files
{
get { NotImplemented (); return null; }
}
public virtual NameValueCollection Form
{
get { NotImplemented (); return null; }
}
public virtual NameValueCollection Headers
{
get { NotImplemented (); return null; }
}
public virtual string this[string field]
{
get { NotImplemented (); return null; }
}
public virtual string Path
{
get { NotImplemented (); return null; }
}
public virtual string PathInfo
{
get { NotImplemented (); return null; }
}
public virtual NameValueCollection QueryString
{
get { NotImplemented (); return null; }
}
public virtual string RawUrl
{
get { NotImplemented (); return null; }
}
public virtual Uri Url
{
get { NotImplemented (); return null; }
}
}
}
@@ -0,0 +1,92 @@
//
// System.Web.UnvalidatedRequestValuesWrapper.cs
//
// Author:
// Mike Morano <[email protected]>
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections.Specialized;
namespace System.Web {
public class UnvalidatedRequestValuesWrapper : UnvalidatedRequestValuesBase {
UnvalidatedRequestValues rv;
public UnvalidatedRequestValuesWrapper (UnvalidatedRequestValues requestValues)
{
rv = requestValues;
}
public override HttpCookieCollection Cookies
{
get { return rv.Cookies; }
}
public override HttpFileCollection Files
{
get { return rv.Files; }
}
public override NameValueCollection Form
{
get { return rv.Form; }
}
public override NameValueCollection Headers
{
get { return rv.Headers; }
}
public override string this[string field]
{
get { return rv[field]; }
}
public override string Path
{
get { return rv.Path; }
}
public override string PathInfo
{
get { return rv.PathInfo; }
}
public override NameValueCollection QueryString
{
get { return rv.QueryString; }
}
public override string RawUrl
{
get { return rv.RawUrl; }
}
public override Uri Url
{
get { return rv.Url; }
}
}
}
@@ -45,6 +45,7 @@ mainsoft/NunitWeb/NunitWeb/Tests/AuthorConverter.cs
mainsoft/NunitWeb/NunitWeb/Tests/Book.cs
mainsoft/NunitWeb/NunitWeb/Tests/BookType.cs
System.Web/AppBrowsersTest.cs
System.Web/EventHandlerTaskAsyncHelperTest.cs
System.Web/HttpApplicationTest.cs
System.Web/HttpBrowserCapabilitiesTest.cs
System.Web/HttpCacheVaryByContentEncodingsTest.cs
@@ -58,10 +59,12 @@ System.Web/HttpRequestTest.cs
System.Web/HttpResponseTest.cs
System.Web/HttpRuntimeTest.cs
System.Web/HttpServerUtilityTest.cs
System.Web/HttpTaskAsyncHandlerTest.cs
System.Web/HttpUtilityTest.cs
System.Web/SiteMapProviderTest.cs
System.Web/SiteMapNodeTest.cs
System.Web/StaticSiteMapProviderTest.cs
System.Web/TaskAsyncResultTest.cs
System.Web/TraceContextRecordTest.cs
System.Web.Compilation/BuildManagerTest.cs
System.Web.Compilation/ClientBuildManagerParameterTest.cs
@@ -103,6 +106,7 @@ System.Web.Profile/ProfileInfoTest.cs
System.Web.Security/FormsAuthenticationTest.cs
System.Web.Security/FormsIdentityTest.cs
System.Web.Security/MembershipTest.cs
System.Web.Security/MembershipPasswordAttributeTest.cs
System.Web.Security/MembershipProviderCollectionTest.cs
System.Web.Security/MembershipProviderTest.cs
System.Web.Security/MembershipUserCollectionTest.cs
@@ -0,0 +1,140 @@
#if NET_4_5
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web.Security;
using NUnit.Framework;
namespace MonoTests.System.Web.Security {
[TestFixture]
public class MembershipPasswordAttributeTest
{
private ValidationContext _validationContext;
public MembershipPasswordAttributeTest ()
{
_validationContext = new ValidationContext (new object ())
{
DisplayName = "testDisplay",
MemberName = "testMember"
};
}
[Test]
public void IsValid ()
{
var passwordAttribute = new MembershipPasswordAttributeTestClass ();
Assert.IsTrue (passwordAttribute.IsValid (""), "sending an empty password password should should be treated as valid");
}
[Test]
public void IsValid_with_ValidationContext ()
{
var passwordAttribute = new MembershipPasswordAttributeTestClass ();
var result = passwordAttribute.TestValidation ("", _validationContext);
Assert.IsNull (result, "sending an empty password password should return a null response");
result = passwordAttribute.TestValidation ("a!12345", _validationContext);
Assert.AreEqual (ValidationResult.Success, result, "Should suceed with a 7 character length and a single nonalphanumeric");
// test error priority
passwordAttribute.MinRequiredPasswordLength = 4;
passwordAttribute.MinRequiredNonAlphanumericCharacters = 2;
result = passwordAttribute.TestValidation ("aaa", _validationContext);
Assert.AreEqual ("The 'testDisplay' field is an invalid password. Password must have 4 or more characters.", result.ErrorMessage);
}
[Test]
public void MinRequiredPasswordLength ()
{
var passwordAttribute = new MembershipPasswordAttributeTestClass ();
var result = passwordAttribute.TestValidation ("a!1234", _validationContext);
Assert.AreEqual ("The 'testDisplay' field is an invalid password. Password must have 7 or more characters.", result.ErrorMessage, "Error message not correct for lower Min characters");
Assert.AreEqual (_validationContext.MemberName, result.MemberNames.FirstOrDefault (), "Member name not correct");
passwordAttribute.MinRequiredPasswordLength = 6;
result = passwordAttribute.TestValidation ("a!1234", _validationContext);
Assert.AreEqual (ValidationResult.Success, result, "Should suceed with a 6 character length after it's reset");
result = passwordAttribute.TestValidation ("a!123", _validationContext);
Assert.AreEqual("The 'testDisplay' field is an invalid password. Password must have 6 or more characters.", result.ErrorMessage, "Error message not correct for Min characters of 6");
passwordAttribute.MinRequiredPasswordLength = 1;
result = passwordAttribute.TestValidation ("!", _validationContext);
Assert.AreEqual(ValidationResult.Success, result, "Should suceed with a 6 character length after it's reset");
// Note there is no test for empty password here as it returns null and is therefore in the generic test
// Error Message changes
passwordAttribute.MinRequiredPasswordLength = 5;
passwordAttribute.MinPasswordLengthError = "There was an error";
result = passwordAttribute.TestValidation ("a!13", _validationContext);
Assert.AreEqual("There was an error", result.ErrorMessage, "Error Message wasn't correct without parameters.");
passwordAttribute.MinPasswordLengthError = "There was an error parameter1: {0}";
result = passwordAttribute.TestValidation ("a!13", _validationContext);
Assert.AreEqual("There was an error parameter1: testDisplay", result.ErrorMessage, "Error Message wasn't correct with 1 parameter.");
passwordAttribute.MinPasswordLengthError = "There was an error parameter1: {0} parameter2: {1}";
result = passwordAttribute.TestValidation ("a!13", _validationContext);
Assert.AreEqual ("There was an error parameter1: testDisplay parameter2: 5", result.ErrorMessage, "Error Message wasn't correct with 2 parameters.");
}
[Test]
public void MinRequiredNonAlphanumericCharacters ()
{
var passwordAttribute = new MembershipPasswordAttributeTestClass ();
var result = passwordAttribute.TestValidation ("a!12345", _validationContext);
Assert.AreEqual (ValidationResult.Success, result, "Should succeed with the default 1 non alpha numeric");
result = passwordAttribute.TestValidation ("a123456", _validationContext);
Assert.AreEqual ("The 'testDisplay' field is an invalid password. Password must have 1 or more non-alphanumeric characters.", result.ErrorMessage, "Expected validation to fail without non-alphanumerics");
passwordAttribute.MinRequiredNonAlphanumericCharacters = 3;
result = passwordAttribute.TestValidation ("a!&12345", _validationContext);
Assert.AreEqual ("The 'testDisplay' field is an invalid password. Password must have 3 or more non-alphanumeric characters.", result.ErrorMessage, "Expected validation to fail without 3 non-alphanumerics");
result = passwordAttribute.TestValidation ("a!?&132154", _validationContext);
Assert.AreEqual (ValidationResult.Success, result, "Should succeed with 3 non alpha numerics");
passwordAttribute.MinRequiredNonAlphanumericCharacters = 0;
result = passwordAttribute.TestValidation ("a123456", _validationContext);
Assert.AreEqual (ValidationResult.Success, result, "Should succeed with 0 non alpha numerics");
// Error Message changes
passwordAttribute.MinRequiredNonAlphanumericCharacters = 1;
passwordAttribute.MinNonAlphanumericCharactersError = "There was an error";
result = passwordAttribute.TestValidation ("a123456", _validationContext);
Assert.AreEqual ("There was an error", result.ErrorMessage, "Error Message wasn't correct without parameters.");
passwordAttribute.MinNonAlphanumericCharactersError = "There was an error parameter1: {0}";
result = passwordAttribute.TestValidation ("a123456", _validationContext);
Assert.AreEqual("There was an error parameter1: testDisplay", result.ErrorMessage, "Error Message wasn't correct with 1 parameter.");
passwordAttribute.MinNonAlphanumericCharactersError = "There was an error parameter1: {0} parameter2: {1}";
result = passwordAttribute.TestValidation ("a123456", _validationContext);
Assert.AreEqual ("There was an error parameter1: testDisplay parameter2: 1", result.ErrorMessage, "Error Message wasn't correct with 2 parameters.");
}
[Test]
public void FormatErrorMessage ()
{
var passwordAttribute = new MembershipPasswordAttribute ();
Assert.AreEqual ("The field testDisplay2 is invalid.", passwordAttribute.FormatErrorMessage ("testDisplay2"));
}
internal class MembershipPasswordAttributeTestClass : MembershipPasswordAttribute
{
public ValidationResult TestValidation (object val, ValidationContext context)
{
return IsValid (val, context);
}
}
}
}
#endif
@@ -0,0 +1,118 @@
//
// MonoTests.System.Web.EventHandlerTaskAsyncHelperTest.cs
//
// Author:
// Kornel Pal ([email protected])
//
// Copyright (C) 2014 Kornel Pal
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_4_5
using System;
using System.Threading.Tasks;
using System.Web;
using NUnit.Framework;
namespace MonoTests.System.Web
{
[TestFixture]
public sealed class EventHandlerTaskAsyncHelperTest : TaskAsyncResultTest
{
EventHandlerTaskAsyncHelper helper;
object expectedSender;
EventArgs expectedEventArgs;
static Task DummyTaskEventHandler (object sender, EventArgs e)
{
throw new AssertionException ("Should not be called.");
}
protected override void SetNullArguments ()
{
expectedSender = null;
expectedEventArgs = null;
}
protected override IAsyncResult GetAsyncResult (Func<Task> taskFactory, AsyncCallback callback, object state)
{
Assert.IsNull (helper, "GetAsyncResult#A01");
TaskEventHandler handler = (sender, e) => {
Assert.AreSame (expectedSender, sender, "GetAsyncResult#A02");
Assert.AreSame (expectedEventArgs, e, "GetAsyncResult#A03");
return taskFactory ();
};
helper = new EventHandlerTaskAsyncHelper (handler);
return helper.BeginEventHandler (expectedSender, expectedEventArgs, callback, state);
}
protected override void Wait (IAsyncResult result)
{
Assert.IsNotNull (helper, "Wait#A01");
helper.EndEventHandler (result);
}
protected override void TestSetUp ()
{
base.TestSetUp ();
helper = null;
expectedSender = new object ();
expectedEventArgs = new EventArgs ();
}
[Test]
public void Constructor ()
{
var helper = new EventHandlerTaskAsyncHelper (DummyTaskEventHandler);
}
[Test]
[ExpectedException (typeof (ArgumentNullException))]
public void Constructor_NullHandler ()
{
var helper = new EventHandlerTaskAsyncHelper (null);
}
[Test]
public void BeginEventHandler ()
{
var helper = new EventHandlerTaskAsyncHelper (DummyTaskEventHandler);
Assert.IsNotNull (helper.BeginEventHandler, "#A01");
}
[Test]
public void EndEventHandler ()
{
var helper = new EventHandlerTaskAsyncHelper (DummyTaskEventHandler);
Assert.IsNotNull (helper.EndEventHandler, "#A01");
}
}
}
#endif
@@ -0,0 +1,132 @@
//
// MonoTests.System.Web.HttpTaskAsyncHandlerTest.cs
//
// Author:
// Kornel Pal ([email protected])
//
// Copyright (C) 2014 Kornel Pal
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_4_5
using System;
using System.IO;
using System.Threading.Tasks;
using System.Web;
using NUnit.Framework;
namespace MonoTests.System.Web
{
[TestFixture]
public sealed class HttpTaskAsyncHandlerTest : TaskAsyncResultTest
{
sealed class DummyHttpTaskAsyncHandler : HttpTaskAsyncHandler
{
public DummyHttpTaskAsyncHandler ()
{
}
public override Task ProcessRequestAsync (HttpContext context)
{
throw new AssertionException ("Should not be called.");
}
}
sealed class TestHttpTaskAsyncHandler : HttpTaskAsyncHandler
{
readonly Func<Task> taskFactory;
readonly HttpContext expectedContext;
public TestHttpTaskAsyncHandler (Func<Task> taskFactory, HttpContext expectedContext)
{
this.taskFactory = taskFactory;
this.expectedContext = expectedContext;
}
public override Task ProcessRequestAsync (HttpContext context)
{
Assert.AreSame (expectedContext, context, "TestHttpTaskAsyncHandler#A01");
return taskFactory ();
}
}
IHttpAsyncHandler handler;
HttpContext expectedContext;
protected override void SetNullArguments ()
{
expectedContext = null;
}
protected override IAsyncResult GetAsyncResult (Func<Task> taskFactory, AsyncCallback callback, object state)
{
Assert.IsNull (handler, "GetAsyncResult#A01");
handler = new TestHttpTaskAsyncHandler (taskFactory, expectedContext);
return handler.BeginProcessRequest (expectedContext, callback, state);
}
protected override void Wait (IAsyncResult result)
{
Assert.IsNotNull (handler, "Wait#A01");
handler.EndProcessRequest (result);
}
protected override void TestSetUp ()
{
base.TestSetUp ();
handler = null;
var request = new HttpRequest (string.Empty, "http://localhost/", string.Empty);
var response = new HttpResponse (TextWriter.Null);
expectedContext = new HttpContext (request, response);
}
[Test]
public void IsReusable ()
{
var handler = new DummyHttpTaskAsyncHandler ();
Assert.IsFalse (handler.IsReusable, "#A01");
}
[Test]
[ExpectedException (typeof (NotSupportedException))]
public void ProcessRequest ()
{
var handler = new DummyHttpTaskAsyncHandler ();
handler.ProcessRequest (expectedContext);
}
[Test]
[ExpectedException (typeof (NotSupportedException))]
public void ProcessRequest_NullContext ()
{
var handler = new DummyHttpTaskAsyncHandler ();
handler.ProcessRequest (null);
}
}
}
#endif
@@ -0,0 +1,334 @@
//
// MonoTests.System.Web.TaskAsyncResultTest.cs
//
// Author:
// Kornel Pal ([email protected])
//
// Copyright (C) 2014 Kornel Pal
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_4_5
using System;
using System.Threading;
using System.Threading.Tasks;
using NUnit.Framework;
namespace MonoTests.System.Web
{
public abstract class TaskAsyncResultTest
{
sealed class TestException : Exception
{
public TestException ()
: base ("Test exception")
{
}
}
sealed class DummyAsyncResult : IAsyncResult
{
public object AsyncState {
get { throw new AssertionException ("Should not be called."); }
}
public WaitHandle AsyncWaitHandle {
get { throw new AssertionException ("Should not be called."); }
}
public bool CompletedSynchronously {
get { throw new AssertionException ("Should not be called."); }
}
public bool IsCompleted {
get { throw new AssertionException ("Should not be called."); }
}
}
int testThreadId;
int factoryCount;
int callbackCount;
object expectedState;
Exception expectedException;
TaskCompletionSource<object> taskCompletion;
TaskCompletionSource<object> callbackCompletion;
IAsyncResult taskAsyncResult;
static Task NullTaskFatory ()
{
return null;
}
static Task CompletedTaskFatory ()
{
return Task.FromResult<object> (null);
}
static Task FailingTaskFatory ()
{
throw new TestException ();
}
void DummyCallback (IAsyncResult result)
{
Interlocked.Increment (ref callbackCount);
Assert.Fail ("Should not be called.");
}
void FailingCallback (IAsyncResult result)
{
Interlocked.Increment (ref callbackCount);
throw new TestException ();
}
protected abstract void SetNullArguments ();
protected abstract IAsyncResult GetAsyncResult (Func<Task> taskFactory, AsyncCallback callback, object state);
protected abstract void Wait (IAsyncResult result);
[SetUp]
protected virtual void TestSetUp ()
{
testThreadId = Thread.CurrentThread.ManagedThreadId;
factoryCount = 0;
callbackCount = 0;
expectedState = new object ();
expectedException = null;
taskCompletion = new TaskCompletionSource<object> ();
callbackCompletion = new TaskCompletionSource<object> ();
taskAsyncResult = null;
}
[Test]
public void Invoke_NullArguments ()
{
SetNullArguments ();
IAsyncResult result = GetAsyncResult (CompletedTaskFatory, null, null);
Wait (result);
}
[Test]
public void Invoke_NullTask ()
{
IAsyncResult result = GetAsyncResult (NullTaskFatory, DummyCallback, null);
Assert.AreEqual (0, callbackCount, "#A01");
Assert.IsNull (result, "#A02");
}
[Test]
[ExpectedException (typeof (TestException))]
public void Invoke_TaskFatoryException ()
{
try {
GetAsyncResult (FailingTaskFatory, DummyCallback, expectedState);
} finally {
Assert.AreEqual (0, callbackCount, "#A01");
}
}
[Test]
[ExpectedException (typeof (TestException))]
public void Invoke_CallbackException ()
{
try {
GetAsyncResult (CompletedTaskFatory, FailingCallback, expectedState);
} finally {
Assert.AreEqual (1, callbackCount, "#A01");
}
}
[Test]
[ExpectedException (typeof (ArgumentNullException))]
public void Invoke_NullResult ()
{
GetAsyncResult (NullTaskFatory, DummyCallback, null);
Wait (null);
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void Invoke_InvalidResult ()
{
GetAsyncResult (NullTaskFatory, DummyCallback, null);
Wait (new DummyAsyncResult ());
}
void SetTaskResult ()
{
if (expectedException == null)
taskCompletion.SetResult (null);
else
taskCompletion.SetException (expectedException);
}
void WaitTaskResult ()
{
if (expectedException == null) {
Wait (taskAsyncResult);
return;
}
try {
Wait (taskAsyncResult);
Assert.Fail ("Expected exception was not thrown.");
} catch (AssertionException) {
throw;
} catch (Exception ex) {
Assert.AreSame (expectedException, ex, "WaitTaskResult#A01");
}
}
[Test]
public void InvokeSync ()
{
InvokeSyncCore ();
}
[Test]
public void InvokeSync_Failed ()
{
expectedException = new TestException ();
InvokeSyncCore ();
}
void InvokeSyncCore ()
{
IAsyncResult result = GetAsyncResult (SyncTaskFatory, SyncCallback, expectedState);
Assert.IsNotNull (result, "InvokeSyncCore#A01");
Assert.AreSame (taskAsyncResult, result, "InvokeSyncCore#A02");
WaitTaskResult ();
Assert.AreEqual (1, factoryCount, "InvokeSyncCore#A03");
Assert.AreEqual (1, callbackCount, "InvokeSyncCore#A04");
}
Task SyncTaskFatory ()
{
Interlocked.Increment (ref factoryCount);
Assert.AreEqual (testThreadId, Thread.CurrentThread.ManagedThreadId, "SyncTaskFatory#A01");
SetTaskResult ();
return taskCompletion.Task;
}
void SyncCallback (IAsyncResult result)
{
Interlocked.Increment (ref callbackCount);
Assert.AreEqual (testThreadId, Thread.CurrentThread.ManagedThreadId, "SyncCallback#A01");
Assert.IsNotNull (result, "SyncCallback#A02");
Assert.AreSame (expectedState, result.AsyncState, "SyncCallback#A03");
Assert.IsTrue (result.IsCompleted, "SyncCallback#A04");
Assert.IsTrue (result.CompletedSynchronously, "SyncCallback#A05");
Assert.IsNotNull (result.AsyncWaitHandle, "SyncCallback#A06");
Assert.IsTrue (result.AsyncWaitHandle.WaitOne (0), "SyncCallback#A07");
taskAsyncResult = result;
Assert.AreEqual (1, factoryCount, "SyncCallback#A08");
Assert.AreEqual (1, callbackCount, "SyncCallback#A09");
}
[Test]
public void InvokeAsync ()
{
InvokeAsyncCore ();
}
[Test]
public void InvokeAsync_Failed ()
{
expectedException = new TestException ();
InvokeAsyncCore ();
}
void InvokeAsyncCore ()
{
IAsyncResult result = GetAsyncResult (AsyncTaskFatory, AsyncCallback, expectedState);
Assert.IsNotNull (result, "InvokeAsyncCore#A01");
Assert.AreSame (expectedState, result.AsyncState, "InvokeAsyncCore#A02");
Assert.IsFalse (result.IsCompleted, "InvokeAsyncCore#A03");
Assert.IsFalse (result.CompletedSynchronously, "InvokeAsyncCore#A04");
Assert.IsNotNull (result.AsyncWaitHandle, "InvokeAsyncCore#A05");
Assert.IsFalse (result.AsyncWaitHandle.WaitOne (0), "InvokeAsyncCore#A06");
Assert.AreEqual (1, factoryCount, "InvokeAsyncCore#A07");
Assert.AreEqual (0, callbackCount, "InvokeAsyncCore#A08");
taskAsyncResult = result;
SetTaskResult ();
callbackCompletion.Task.GetAwaiter ().GetResult ();
Assert.AreEqual (1, factoryCount, "InvokeAsyncCore#A09");
Assert.AreEqual (1, callbackCount, "InvokeAsyncCore#A10");
}
Task AsyncTaskFatory ()
{
Interlocked.Increment (ref factoryCount);
Assert.AreEqual (testThreadId, Thread.CurrentThread.ManagedThreadId, "AsyncTaskFatory#A01");
return taskCompletion.Task;
}
void AsyncCallback (IAsyncResult result)
{
try {
Interlocked.Increment (ref callbackCount);
Assert.AreNotEqual (testThreadId, Thread.CurrentThread.ManagedThreadId, "AsyncCallback#A01");
Assert.IsNotNull (result, "AsyncCallback#A02");
Assert.AreSame (expectedState, result.AsyncState, "AsyncCallback#A03");
Assert.IsTrue (result.IsCompleted, "AsyncCallback#A04");
Assert.IsFalse (result.CompletedSynchronously, "AsyncCallback#A05");
Assert.IsNotNull (result.AsyncWaitHandle, "AsyncCallback#A06");
Assert.IsTrue (result.AsyncWaitHandle.WaitOne (0), "AsyncCallback#A07");
Assert.AreSame (taskAsyncResult, result, "AsyncCallback#A08");
WaitTaskResult ();
callbackCompletion.TrySetResult (null);
} catch (Exception ex) {
callbackCompletion.TrySetException (ex);
}
}
}
}
#endif
@@ -1,5 +1,12 @@
#include net_4_0_System.Web.dll.sources
System.Web/EventHandlerTaskAsyncHelper.cs
System.Web/HttpTaskAsyncHandler.cs
System.Web/MimeMapping.cs
System.Web/ReadEntityBodyMode.cs
System.Web/UnvalidatedRequestValues.cs
System.Web/UnvalidatedRequestValuesBase.cs
System.Web/UnvalidatedRequestValuesWrapper.cs
System.Web/TaskAsyncResult.cs
System.Web/TaskEventHandler.cs
System.Web.Security/MembershipPasswordAttribute.cs
+1 -14
View File
@@ -858,20 +858,7 @@ namespace System.Xml
[PermissionSet (SecurityAction.InheritanceDemand, Unrestricted = true)]
public virtual XmlNode ReadNode (XmlReader reader)
{
if (PreserveWhitespace)
return ReadNodeCore (reader);
XmlTextReader xtr = reader as XmlTextReader;
if (xtr != null && xtr.WhitespaceHandling ==
WhitespaceHandling.All) {
try {
xtr.WhitespaceHandling = WhitespaceHandling.Significant;
return ReadNodeCore (reader);
} finally {
xtr.WhitespaceHandling = WhitespaceHandling.All;
}
}
else
return ReadNodeCore (reader);
return ReadNodeCore (reader);
}
XmlNode ReadNodeCore (XmlReader reader)
+11 -5
View File
@@ -152,11 +152,17 @@ namespace System.Xml
XmlTextReader xmlReader = new XmlTextReader (value, XmlNodeType.Element, ctx);
xmlReader.XmlResolver = OwnerDocument.Resolver;
do {
XmlNode n = OwnerDocument.ReadNode (xmlReader);
if(n == null) break;
AppendChild (n);
} while (true);
bool pw = OwnerDocument.PreserveWhitespace;
OwnerDocument.PreserveWhitespace = true;
try {
do {
XmlNode n = OwnerDocument.ReadNode (xmlReader);
if(n == null) break;
AppendChild (n);
} while (true);
} finally {
OwnerDocument.PreserveWhitespace = pw;
}
}
}
@@ -1433,5 +1433,43 @@ namespace MonoTests.System.Xml
Assert.IsFalse (reader.ReadAttributeValue(), "#4");
Assert.AreEqual (XmlNodeType.Text, reader.NodeType, "#5");
}
[Test]
public void Whitespaces ()
{
const string xml = "<?xml version=\"1.0\"?><test> <foo name=\"Hello\"> <value>World</value> </foo> <foo name=\"Foo\"><value>Bar</value></foo></test>";
var reader = new XmlTextReader (new StringReader (xml));
//reader.WhitespaceHandling = WhitespaceHandling.All;
reader.Read ();
Assert.AreEqual (XmlNodeType.XmlDeclaration, reader.NodeType, "#1a");
reader.Read ();
Assert.AreEqual (XmlNodeType.Element, reader.NodeType, "#1b");
Assert.AreEqual ("test", reader.Name, "#1c");
reader.Read ();
if (reader.NodeType == XmlNodeType.Whitespace)
reader.Read ();
Assert.AreEqual (XmlNodeType.Element, reader.NodeType, "#2a");
Assert.AreEqual ("foo", reader.Name, "#2b");
var doc = new XmlDocument ();
//doc.PreserveWhitespace = true;
doc.ReadNode (reader);
Assert.AreEqual (XmlNodeType.Whitespace, reader.NodeType, "#3");
reader.Read ();
if (reader.NodeType == XmlNodeType.Whitespace)
reader.Read ();
Assert.AreEqual (XmlNodeType.Element, reader.NodeType, "#4");
Assert.AreEqual ("foo", reader.Name, "#4b");
doc.ReadNode (reader);
Assert.AreEqual (XmlNodeType.EndElement, reader.NodeType, "#5");
}
}
}
@@ -346,23 +346,21 @@ namespace System.Diagnostics {
}
}
[MonoTODO]
[Obsolete ("Use PagedMemorySize64")]
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
[MonitoringDescription ("The number of bytes that are paged.")]
public int PagedMemorySize {
get {
return(0);
return(int)PagedMemorySize64;
}
}
[MonoTODO]
[Obsolete ("Use PagedSystemMemorySize64")]
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
[MonitoringDescription ("The amount of paged system memory in bytes.")]
public int PagedSystemMemorySize {
get {
return(0);
return(int)PagedMemorySize64;
}
}
@@ -406,23 +404,22 @@ namespace System.Diagnostics {
}
}
[MonoTODO]
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
[MonitoringDescription ("The number of bytes that are paged.")]
[ComVisible (false)]
public long PagedMemorySize64 {
get {
return(0);
int error;
return GetProcessData (pid, 12, out error);
}
}
[MonoTODO]
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
[MonitoringDescription ("The amount of paged system memory in bytes.")]
[ComVisible (false)]
public long PagedSystemMemorySize64 {
get {
return(0);
return PagedMemorySize64;
}
}
@@ -58,7 +58,7 @@ namespace System.Net.NetworkInformation {
#else
if (runningOnUnix) {
try {
if (Platform.IsMacOS)
if (Platform.IsMacOS || Platform.IsFreeBSD)
return MacOsNetworkInterface.ImplGetAllNetworkInterfaces ();
else
return LinuxNetworkInterface.ImplGetAllNetworkInterfaces ();
@@ -318,7 +318,7 @@ namespace System.Net.WebSockets
var opCode = MessageTypeToWire (type);
var length = buffer.Count;
headerBuffer[0] = (byte)(opCode | (endOfMessage ? 0 : 0x80));
headerBuffer[0] = (byte)(opCode | (endOfMessage ? 0x80 : 0));
if (length < 126) {
headerBuffer[1] = (byte)length;
} else if (length <= ushort.MaxValue) {
@@ -329,6 +329,9 @@ namespace System.Net {
return false;
if (InputStream.EndRead (ares) <= 0)
return true;
} catch (ObjectDisposedException e) {
input_stream = null;
return true;
} catch {
return false;
}
@@ -186,14 +186,6 @@ namespace System.Net
}
// Properties
/*
* Hack for bug #19334.
*
*/
public static bool Mono_Suppress_TLS_Alerts {
get; set;
}
[Obsolete ("Use ServerCertificateValidationCallback instead", false)]
public static ICertificatePolicy CertificatePolicy {
+41 -21
View File
@@ -28,36 +28,56 @@ using System.Runtime.InteropServices;
namespace System {
internal static class Platform {
static bool checkedOS;
static bool isMacOS;
static bool isFreeBSD;
#if MONOTOUCH || XAMMAC
public static bool IsMacOS {
get { return true; }
private static void CheckOS() {
isMacOS = true;
checkedOS = true;
}
#else
[DllImport ("libc")]
static extern int uname (IntPtr buf);
static bool checkedIsMacOS;
static bool isMacOS;
private static void CheckOS() {
if (Environment.OSVersion.Platform != PlatformID.Unix) {
checkedOS = true;
return;
}
IntPtr buf = Marshal.AllocHGlobal (8192);
if (uname (buf) == 0) {
string os = Marshal.PtrToStringAnsi (buf);
switch (os) {
case "Darwin":
isMacOS = true;
break;
case "FreeBSD":
isFreeBSD = true;
break;
}
}
Marshal.FreeHGlobal (buf);
checkedOS = true;
}
#endif
public static bool IsMacOS {
get {
if (Environment.OSVersion.Platform != PlatformID.Unix)
return false;
if (!checkedIsMacOS) {
IntPtr buf = Marshal.AllocHGlobal (8192);
if (uname (buf) == 0) {
string os = Marshal.PtrToStringAnsi (buf);
if (os == "Darwin")
isMacOS = true;
}
Marshal.FreeHGlobal (buf);
checkedIsMacOS = true;
}
if (!checkedOS)
CheckOS();
return isMacOS;
}
}
#endif
public static bool IsFreeBSD {
get {
if (!checkedOS)
CheckOS();
return isFreeBSD;
}
}
}
}
+11 -10
View File
@@ -269,15 +269,6 @@ namespace System {
return state.remaining.Length > 0;
}
if (state.elements.scheme == Uri.UriSchemeFile) {
// under Windows all file:// URI are considered UNC, which is not the case other MacOS (e.g. Silverlight)
#if BOOTSTRAP_BASIC
state.elements.isUnc = (Path.DirectorySeparatorChar == '\\');
#else
state.elements.isUnc = Environment.IsRunningOnWindows;
#endif
}
return ParseDelimiter (state);
}
@@ -430,7 +421,17 @@ namespace System {
state.elements.host = state.elements.host.ToLowerInvariant ();
state.remaining = part.Substring (state.elements.host.Length);
if (state.elements.scheme == Uri.UriSchemeFile &&
state.elements.host != "") {
// under Windows all file://host URI are considered UNC, which is not the case other MacOS (e.g. Silverlight)
#if BOOTSTRAP_BASIC
state.elements.isUnc = (Path.DirectorySeparatorChar == '\\');
#else
state.elements.isUnc = Environment.IsRunningOnWindows;
#endif
}
return state.remaining.Length > 0;
}
@@ -220,6 +220,45 @@ namespace MonoTests.System.Net.WebSockets
Assert.Fail ("Should have thrown");
}
[Test]
[Category ("NotWorking")] // FIXME: test relies on unimplemented HttpListenerContext.AcceptWebSocketAsync (), reenable it when the method is implemented
public void SendAsyncEndOfMessageTest ()
{
var cancellationToken = new CancellationTokenSource (TimeSpan.FromSeconds (30)).Token;
SendAsyncEndOfMessageTest (false, WebSocketMessageType.Text, cancellationToken).Wait (5000);
SendAsyncEndOfMessageTest (true, WebSocketMessageType.Text, cancellationToken).Wait (5000);
SendAsyncEndOfMessageTest (false, WebSocketMessageType.Binary, cancellationToken).Wait (5000);
SendAsyncEndOfMessageTest (true, WebSocketMessageType.Binary, cancellationToken).Wait (5000);
}
public async Task SendAsyncEndOfMessageTest (bool expectedEndOfMessage, WebSocketMessageType webSocketMessageType, CancellationToken cancellationToken)
{
using (var client = new ClientWebSocket ()) {
// Configure the listener.
var serverReceive = HandleHttpWebSocketRequestAsync<WebSocketReceiveResult> (async socket => await socket.ReceiveAsync (new ArraySegment<byte> (new byte[32]), cancellationToken), cancellationToken);
// Connect to the listener and make the request.
await client.ConnectAsync (new Uri ("ws://localhost:" + Port + "/"), cancellationToken);
await client.SendAsync (new ArraySegment<byte> (Encoding.UTF8.GetBytes ("test")), webSocketMessageType, expectedEndOfMessage, cancellationToken);
// Wait for the listener to handle the request and return its result.
var result = await serverReceive;
// Cleanup and check results.
await client.CloseAsync (WebSocketCloseStatus.NormalClosure, "Finished", cancellationToken);
Assert.AreEqual (expectedEndOfMessage, result.EndOfMessage, "EndOfMessage should be " + expectedEndOfMessage);
}
}
async Task<T> HandleHttpWebSocketRequestAsync<T> (Func<WebSocket, Task<T>> action, CancellationToken cancellationToken)
{
var ctx = await this.listener.GetContextAsync ();
var wsContext = await ctx.AcceptWebSocketAsync (null);
var result = await action (wsContext.WebSocket);
await wsContext.WebSocket.CloseOutputAsync (WebSocketCloseStatus.NormalClosure, "Finished", cancellationToken);
return result;
}
async Task HandleHttpRequestAsync (Action<HttpListenerRequest, HttpListenerResponse> handler)
{
var ctx = await listener.GetContextAsync ();
@@ -1529,7 +1529,7 @@ namespace MonoTests.System.Net {
Cookie cookie = new Cookie ("name", "value")
{
Domain = ".example.com",
Expires = new DateTime (2100, 1, 1, 0, 0, 0, DateTimeKind.Utc),
Expires = new DateTime (2015, 1, 1, 0, 0, 0, DateTimeKind.Utc),
HttpOnly = true,
Secure = true,
};
@@ -1562,14 +1562,14 @@ namespace MonoTests.System.Net {
Cookie cookie = new Cookie ("name", "value")
{
Domain = ".example.com",
Expires = new DateTime (2100, 1, 1, 0, 0, 0, DateTimeKind.Utc),
Expires = new DateTime (2015, 1, 1, 0, 0, 0, DateTimeKind.Utc),
HttpOnly = true,
Secure = true,
};
Uri uri = new Uri ("https://www.example.com/path/file");
CookieContainer container = new CookieContainer ();
container.SetCookies (uri, "name=value; domain=.example.com; expires=Fri, 01-Jan-2100 00:00:00 GMT; HttpOnly; secure");
container.SetCookies (uri, "name=value; domain=.example.com; expires=Thu, 01-Jan-2015 00:00:00 GMT; HttpOnly; secure");
CookieCollection collection = container.GetCookies (uri);
Assert.AreEqual (collection.Count, 1, "#A1");
Cookie cloned = collection [0];
@@ -474,6 +474,57 @@ namespace MonoTests.System.Net {
Event.Close ();
}
}
[Test]
public void ConnectionReuse ()
{
var uri = "http://localhost:1338/";
HttpListener listener = new HttpListener ();
listener.Prefixes.Add (uri);
listener.Start ();
IPEndPoint expectedIpEndPoint = CreateListenerRequest (listener, uri);
Assert.AreEqual (expectedIpEndPoint, CreateListenerRequest (listener, uri), "reuse1");
Assert.AreEqual (expectedIpEndPoint, CreateListenerRequest (listener, uri), "reuse2");
}
public IPEndPoint CreateListenerRequest (HttpListener listener, string uri)
{
IPEndPoint ipEndPoint = null;
listener.BeginGetContext ((result) => ipEndPoint = ListenerCallback (result), listener);
var request = (HttpWebRequest) WebRequest.Create (uri);
request.Method = "POST";
// We need to write something
request.GetRequestStream ().Write (new byte [] {(byte)'a'}, 0, 1);
request.GetRequestStream ().Dispose ();
// Send request, socket is created or reused.
var response = request.GetResponse ();
// Close response so socket can be reused.
response.Close ();
return ipEndPoint;
}
public static IPEndPoint ListenerCallback (IAsyncResult result)
{
var listener = (HttpListener) result.AsyncState;
var context = listener.EndGetContext (result);
var clientEndPoint = context.Request.RemoteEndPoint;
// Disposing InputStream should not avoid socket reuse
context.Request.InputStream.Dispose ();
// Close OutputStream to send response
context.Response.OutputStream.Close ();
return clientEndPoint;
}
}
}
#endif
+96
View File
@@ -919,6 +919,102 @@ TextWriter sw = Console.Out;
Assert.AreEqual ("/%3C%3E%25%22%7B%7D%7C/%5E%60;/:@&=+$,%5B%5D%3F", uri.AbsolutePath, "Special");
}
[Test]
public void LocalFile ()
{
Uri uri = new Uri ("file:///c:/subdir/file");
Assert.AreEqual ("c:/subdir/file", uri.AbsolutePath, "AbsolutePath");
Assert.AreEqual ("file:///c:/subdir/file", uri.AbsoluteUri, "AbsoluteUri");
Assert.AreEqual ("c:\\subdir\\file", uri.LocalPath, "LocalPath");
Assert.AreEqual ("c:/subdir/file", uri.PathAndQuery, "PathAndQuery");
Assert.AreEqual (String.Empty, uri.Query, "Query");
Assert.AreEqual ("file", uri.Segments [3], "Segments [3]");
Assert.AreEqual (String.Empty, uri.Authority, "Authority");
Assert.AreEqual (String.Empty, uri.DnsSafeHost, "DnsSafeHost");
Assert.AreEqual (String.Empty, uri.Fragment, "Fragment");
Assert.AreEqual (String.Empty, uri.Host, "Host");
Assert.AreEqual (UriHostNameType.Basic, uri.HostNameType, "HostNameType");
Assert.IsTrue (uri.IsAbsoluteUri, "IsAbsoluteUri");
Assert.IsTrue (uri.IsDefaultPort, "IsDefaultPort");
Assert.IsTrue (uri.IsFile, "IsFile");
Assert.IsTrue (uri.IsLoopback, "IsLoopback");
Assert.IsFalse (uri.IsUnc, "IsUnc");
Assert.AreEqual ("file:///c:/subdir/file", uri.OriginalString, "OriginalString");
Assert.AreEqual (-1, uri.Port, "Port");
Assert.AreEqual ("file", uri.Scheme, "Scheme");
Assert.AreEqual ("/", uri.Segments [0], "Segments [0]");
Assert.AreEqual ("c:/", uri.Segments [1], "Segments [1]");
Assert.AreEqual ("subdir/", uri.Segments [2], "Segments [2]");
Assert.IsFalse (uri.UserEscaped, "UserEscaped");
Assert.AreEqual (String.Empty, uri.UserInfo, "UserInfo");
}
[Test]
public void LocalhostWinFile ()
{
Uri uri = new Uri ("file://localhost/c:/subdir/file");
Assert.AreEqual ("/c:/subdir/file", uri.AbsolutePath, "AbsolutePath");
Assert.AreEqual ("file://localhost/c:/subdir/file", uri.AbsoluteUri, "AbsoluteUri");
Assert.AreEqual (isWin32 ? "\\\\localhost\\c:\\subdir\\file" : "/c:/subdir/file", uri.LocalPath, "LocalPath");
Assert.AreEqual ("/c:/subdir/file", uri.PathAndQuery, "PathAndQuery");
Assert.AreEqual (String.Empty, uri.Query, "Query");
Assert.AreEqual ("file", uri.Segments [3], "Segments [3]");
Assert.AreEqual ("localhost", uri.Authority, "Authority");
Assert.AreEqual ("localhost", uri.DnsSafeHost, "DnsSafeHost");
Assert.AreEqual (String.Empty, uri.Fragment, "Fragment");
Assert.AreEqual ("localhost", uri.Host, "Host");
Assert.AreEqual (UriHostNameType.Dns, uri.HostNameType, "HostNameType");
Assert.IsTrue (uri.IsAbsoluteUri, "IsAbsoluteUri");
Assert.IsTrue (uri.IsDefaultPort, "IsDefaultPort");
Assert.IsTrue (uri.IsFile, "IsFile");
Assert.IsTrue (uri.IsLoopback, "IsLoopback");
Assert.AreEqual (isWin32, uri.IsUnc, "IsUnc");
Assert.AreEqual ("file://localhost/c:/subdir/file", uri.OriginalString, "OriginalString");
Assert.AreEqual (-1, uri.Port, "Port");
Assert.AreEqual ("file", uri.Scheme, "Scheme");
Assert.AreEqual ("/", uri.Segments [0], "Segments [0]");
Assert.AreEqual ("c:/", uri.Segments [1], "Segments [1]");
Assert.AreEqual ("subdir/", uri.Segments [2], "Segments [2]");
Assert.IsFalse (uri.UserEscaped, "UserEscaped");
Assert.AreEqual (String.Empty, uri.UserInfo, "UserInfo");
}
[Test]
public void LocalhostFile ()
{
Uri uri = new Uri ("file://localhost/dir/subdir/file");
Assert.AreEqual ("/dir/subdir/file", uri.AbsolutePath, "AbsolutePath");
Assert.AreEqual ("file://localhost/dir/subdir/file", uri.AbsoluteUri, "AbsoluteUri");
Assert.AreEqual (isWin32 ? "\\\\localhost\\dir\\subdir\\file" : "/dir/subdir/file", uri.LocalPath, "LocalPath");
Assert.AreEqual ("/dir/subdir/file", uri.PathAndQuery, "PathAndQuery");
Assert.AreEqual (String.Empty, uri.Query, "Query");
Assert.AreEqual ("file", uri.Segments [3], "Segments [3]");
Assert.AreEqual ("localhost", uri.Authority, "Authority");
Assert.AreEqual ("localhost", uri.DnsSafeHost, "DnsSafeHost");
Assert.AreEqual (String.Empty, uri.Fragment, "Fragment");
Assert.AreEqual ("localhost", uri.Host, "Host");
Assert.AreEqual (UriHostNameType.Dns, uri.HostNameType, "HostNameType");
Assert.IsTrue (uri.IsAbsoluteUri, "IsAbsoluteUri");
Assert.IsTrue (uri.IsDefaultPort, "IsDefaultPort");
Assert.IsTrue (uri.IsFile, "IsFile");
Assert.IsTrue (uri.IsLoopback, "IsLoopback");
Assert.AreEqual (isWin32, uri.IsUnc, "IsUnc");
Assert.AreEqual ("file://localhost/dir/subdir/file", uri.OriginalString, "OriginalString");
Assert.AreEqual (-1, uri.Port, "Port");
Assert.AreEqual ("file", uri.Scheme, "Scheme");
Assert.AreEqual ("/", uri.Segments [0], "Segments [0]");
Assert.AreEqual ("dir/", uri.Segments [1], "Segments [1]");
Assert.AreEqual ("subdir/", uri.Segments [2], "Segments [2]");
Assert.IsFalse (uri.UserEscaped, "UserEscaped");
Assert.AreEqual (String.Empty, uri.UserInfo, "UserInfo");
}
[Test]
public void PathReduction_2e ()
{
+5 -2
View File
@@ -1,7 +1,10 @@
#!/bin/sh
SCRIPT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
export MONO_PATH=${MONO_PATH:-$SCRIPT_PATH/../lib/net_4_5/}
CSHARP=$SCRIPT_PATH/../lib/net_4_5/csharp.exe
MONO=$SCRIPT_PATH/../../../mono/mini/mono
export MONO_PATH=${MONO_PATH:-$SCRIPT_PATH/../lib/net_4_5}
TZ_FAILS=0
TZ_COUNT=0
@@ -10,7 +13,7 @@ FORMAT="%a %b %d %T %Y"
for tz in $(cd /usr/share/zoneinfo/; find * -type f -print); do
TZ_COUNT=$(expr $TZ_COUNT + 1)
SYS_DATETIME=$(date -ju -f "$FORMAT" "$(TZ=$tz date "+$FORMAT")" "+%s")
CS_DATETIME=$(TZ=$tz csharp -e '(int)(DateTime.Now - new DateTime(1970, 1, 1)).TotalSeconds;')
CS_DATETIME=$(TZ=$tz $MONO $CSHARP -e '(int)(DateTime.Now - new DateTime(1970, 1, 1)).TotalSeconds;')
DIFF=$(expr $SYS_DATETIME - $CS_DATETIME)
if [ "$DIFF" -gt "5" ] || [ "$DIFF" -lt "-5" ]; then
TZ_FAILS=$(expr $TZ_FAILS + 1)
@@ -63,7 +63,7 @@ namespace System.Collections.Concurrent
{
Node node = new Node ();
node.Value = item;
Node oldTail = null;
Node oldNext = null;
@@ -71,6 +71,8 @@ namespace System.Collections.Concurrent
while (!update) {
oldTail = tail;
oldNext = oldTail.Next;
Thread.MemoryBarrier ();
// Did tail was already updated ?
if (tail == oldTail) {
@@ -104,6 +106,8 @@ namespace System.Collections.Concurrent
Node oldHead = head;
Node oldTail = tail;
oldNext = oldHead.Next;
Thread.MemoryBarrier ();
if (oldHead == head) {
// Empty case ?
@@ -146,6 +150,8 @@ namespace System.Collections.Concurrent
}
result = oldNext.Value;
Thread.MemoryBarrier ();
//check if head has been updated
update = head != oldHead;
@@ -670,7 +670,7 @@ namespace System.Globalization
//
// Be careful not to cause recursive CultureInfo initialization
//
var msg = string.Format (InvariantCulture, "Culture ID {0} (0x{0:X4}) is not a supported culture.", culture.ToString (InvariantCulture));
var msg = string.Format (InvariantCulture, "Culture ID {0} (0x{1}) is not a supported culture.", culture.ToString (InvariantCulture), culture.ToString ("X4", InvariantCulture));
#if NET_4_0
throw new CultureNotFoundException ("culture", msg);
#else
@@ -0,0 +1,38 @@
// IErrorInfo interface
//
// Eberhard Beilharz ([email protected])
//
// Copyright (C) 2011 SIL International
using System;
using System.Runtime.CompilerServices;
using System.Security;
namespace System.Runtime.InteropServices
{
[ComImport]
[SuppressUnmanagedCodeSecurity]
[Guid ("1CF2B120-547D-101B-8E65-08002B2BD119")]
[InterfaceType (ComInterfaceType.InterfaceIsIUnknown)]
internal interface IErrorInfo
{
[MethodImpl (MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
[PreserveSig]
int GetGUID (out Guid pGuid);
[MethodImpl (MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
[PreserveSig]
int GetSource ([MarshalAs (UnmanagedType.BStr)] out string pBstrSource);
[MethodImpl (MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
[PreserveSig]
int GetDescription ([MarshalAs (UnmanagedType.BStr)] out string pbstrDescription);
[MethodImpl (MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
[PreserveSig]
int GetHelpFile ([MarshalAs (UnmanagedType.BStr)] out string pBstrHelpFile);
[MethodImpl (MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
[PreserveSig]
int GetHelpContext (out uint pdwHelpContext);
}
}
@@ -0,0 +1,63 @@
// ManagedErrorInfo class
//
// Eberhard Beilharz ([email protected])
//
// Copyright (C) 2012 SIL International
using System;
using System.Runtime.CompilerServices;
using System.Security;
namespace System.Runtime.InteropServices
{
/// <summary>
/// Helper class that allows to pass an exception as an IErrorInfo object. This is useful
/// when we get an exception in managed code that is called from unmanaged code that is called
/// from managed code and we want to get to the exception in the outer managed code.
/// </summary>
internal class ManagedErrorInfo: IErrorInfo
{
private Exception m_Exception;
public ManagedErrorInfo (Exception e)
{
m_Exception = e;
}
public Exception Exception {
get { return m_Exception; }
}
#region IErrorInfo
public int GetGUID (out Guid guid)
{
// not supported
guid = Guid.Empty;
return 0;
}
public int GetSource (out string source)
{
source = m_Exception.Source;
return 0;
}
public int GetDescription (out string description)
{
description = m_Exception.Message;
return 0;
}
public int GetHelpFile (out string helpFile)
{
helpFile = m_Exception.HelpLink;
return 0;
}
public int GetHelpContext(out uint helpContext)
{
// not supported
helpContext = 0;
return 0;
}
#endregion
}
}
@@ -414,9 +414,11 @@ namespace System.Runtime.InteropServices
#endif // !FULL_AOT_RUNTIME
#if !FULL_AOT_RUNTIME
[MonoTODO ("SetErrorInfo")]
public static int GetHRForException (Exception e)
{
var errorInfo = new ManagedErrorInfo(e);
SetErrorInfo (0, errorInfo);
return e.hresult;
}
@@ -1314,27 +1316,314 @@ namespace System.Runtime.InteropServices
throw new NotImplementedException ();
}
public static Exception GetExceptionForHR (int errorCode) {
return GetExceptionForHR (errorCode, IntPtr.Zero);
}
public static Exception GetExceptionForHR (int errorCode, IntPtr errorInfo) {
private static Exception ConvertHrToException (int errorCode)
{
const int MSEE_E_APPDOMAINUNLOADED = unchecked ((int)0x80131014L);
const int COR_E_APPLICATION = unchecked ((int)0x80131600L);
const int E_INVALIDARG = unchecked ((int)0x80070057);
const int COR_E_ARGUMENTOUTOFRANGE = unchecked ((int)0x80131502L);
const int COR_E_ARITHMETIC = unchecked ((int)0x80070216);
const int COR_E_ARRAYTYPEMISMATCH = unchecked ((int)0x80131503L);
const int COR_E_BADIMAGEFORMAT = unchecked ((int)0x8007000BL);
const int ERROR_BAD_FORMAT = unchecked ((int)0x0B);
//const int COR_E_COMEMULATE_ERROR = unchecked ((int)?);
const int COR_E_CONTEXTMARSHAL = unchecked ((int)0x80131504L);
//const int COR_E_CORE = unchecked ((int)?);
const int NTE_FAIL = unchecked ((int)0x80090020L);
const int COR_E_DIRECTORYNOTFOUND = unchecked ((int)0x80070003L);
const int ERROR_PATH_NOT_FOUND = unchecked ((int)0x03);
const int COR_E_DIVIDEBYZERO = unchecked ((int)0x80020012L);
const int COR_E_DUPLICATEWAITOBJECT = unchecked ((int)0x80131529L);
const int COR_E_ENDOFSTREAM = unchecked ((int)0x80070026L);
const int COR_E_TYPELOAD = unchecked ((int)0x80131522L);
const int COR_E_EXCEPTION = unchecked ((int)0x80131500L);
const int COR_E_EXECUTIONENGINE = unchecked ((int)0x80131506L);
const int COR_E_FIELDACCESS = unchecked ((int)0x80131507L);
const int COR_E_FILENOTFOUND = unchecked ((int)0x80070002L);
const int ERROR_FILE_NOT_FOUND = unchecked ((int)0x02);
const int COR_E_FORMAT = unchecked ((int)0x80131537L);
const int COR_E_INDEXOUTOFRANGE = unchecked ((int)0x80131508L);
const int COR_E_INVALIDCAST = unchecked ((int)0x80004002L);
const int COR_E_INVALIDCOMOBJECT = unchecked ((int)0x80131527L);
const int COR_E_INVALIDFILTERCRITERIA = unchecked ((int)0x80131601L);
const int COR_E_INVALIDOLEVARIANTTYPE = unchecked ((int)0x80131531L);
const int COR_E_INVALIDOPERATION = unchecked ((int)0x80131509L);
const int COR_E_IO = unchecked ((int)0x80131620L);
const int COR_E_MEMBERACCESS = unchecked ((int)0x8013151AL);
const int COR_E_METHODACCESS = unchecked ((int)0x80131510L);
const int COR_E_MISSINGFIELD = unchecked ((int)0x80131511L);
const int COR_E_MISSINGMANIFESTRESOURCE = unchecked ((int)0x80131532L);
const int COR_E_MISSINGMEMBER = unchecked ((int)0x80131512L);
const int COR_E_MISSINGMETHOD = unchecked ((int)0x80131513L);
const int COR_E_MULTICASTNOTSUPPORTED = unchecked ((int)0x80131514L);
const int COR_E_NOTFINITENUMBER = unchecked ((int)0x80131528L);
const int E_NOTIMPL = unchecked ((int)0x80004001L);
const int COR_E_NOTSUPPORTED = unchecked ((int)0x80131515L);
const int COR_E_NULLREFERENCE = unchecked ((int)0x80004003L);
const int E_OUTOFMEMORY = unchecked ((int)0x8007000EL);
const int E_INVALIDARG = unchecked ((int)0X80070057);
switch (errorCode)
{
case E_OUTOFMEMORY:
return new OutOfMemoryException ();
case E_INVALIDARG:
return new ArgumentException ();
const int COR_E_OVERFLOW = unchecked ((int)0x80131516L);
const int COR_E_PATHTOOLONG = unchecked ((int)0x800700CEL);
const int ERROR_FILENAME_EXCED_RANGE = unchecked ((int)0xCE);
const int COR_E_RANK = unchecked ((int)0x80131517L);
const int COR_E_REFLECTIONTYPELOAD = unchecked ((int)0x80131602L);
const int COR_E_REMOTING = unchecked ((int)0x8013150BL);
const int COR_E_SAFEARRAYTYPEMISMATCH = unchecked ((int)0x80131533L);
const int COR_E_SECURITY = unchecked ((int)0x8013150AL);
const int COR_E_SERIALIZATION = unchecked ((int)0x8013150CL);
const int COR_E_STACKOVERFLOW = unchecked ((int)0x800703E9L);
const int ERROR_STACK_OVERFLOW = unchecked ((int)0x03E9);
const int COR_E_SYNCHRONIZATIONLOCK = unchecked ((int)0x80131518L);
const int COR_E_SYSTEM = unchecked ((int)0x80131501L);
const int COR_E_TARGET = unchecked ((int)0x80131603L);
const int COR_E_TARGETINVOCATION = unchecked ((int)0x80131604L);
const int COR_E_TARGETPARAMCOUNT = unchecked ((int)0x8002000EL);
const int COR_E_THREADABORTED = unchecked ((int)0x80131530L);
const int COR_E_THREADINTERRUPTED = unchecked ((int)0x80131519L);
const int COR_E_THREADSTATE = unchecked ((int)0x80131520L);
const int COR_E_THREADSTOP = unchecked ((int)0x80131521L);
const int COR_E_TYPEINITIALIZATION = unchecked ((int)0x80131534L);
const int COR_E_VERIFICATION = unchecked ((int)0x8013150DL);
//const int COR_E_WEAKREFERENCE = unchecked ((int)?);
//const int COR_E_VTABLECALLSNOTSUPPORTED = unchecked ((int));
switch (errorCode) {
case MSEE_E_APPDOMAINUNLOADED:
return new AppDomainUnloadedException ();
case COR_E_APPLICATION:
return new ApplicationException ();
case E_INVALIDARG:
return new ArgumentException ();
case COR_E_ARGUMENTOUTOFRANGE:
return new ArgumentOutOfRangeException ();
case COR_E_ARITHMETIC:
return new ArithmeticException ();
case COR_E_ARRAYTYPEMISMATCH:
return new ArrayTypeMismatchException ();
case COR_E_BADIMAGEFORMAT:
case ERROR_BAD_FORMAT:
return new BadImageFormatException ();
// case COR_E_COMEMULATE_ERROR:
// return new COMEmulateException ();
case COR_E_CONTEXTMARSHAL:
return new ContextMarshalException ();
// case COR_E_CORE:
// return new CoreException ();
case NTE_FAIL:
return new System.Security.Cryptography.CryptographicException ();
case COR_E_DIRECTORYNOTFOUND:
case ERROR_PATH_NOT_FOUND:
return new System.IO.DirectoryNotFoundException ();
case COR_E_DIVIDEBYZERO:
return new DivideByZeroException ();
case COR_E_DUPLICATEWAITOBJECT:
return new DuplicateWaitObjectException ();
case COR_E_ENDOFSTREAM:
return new System.IO.EndOfStreamException ();
case COR_E_EXCEPTION:
return new Exception ();
case COR_E_EXECUTIONENGINE:
return new ExecutionEngineException ();
case COR_E_FIELDACCESS:
return new FieldAccessException ();
case COR_E_FILENOTFOUND:
case ERROR_FILE_NOT_FOUND:
return new System.IO.FileNotFoundException ();
case COR_E_FORMAT:
return new FormatException ();
case COR_E_INDEXOUTOFRANGE:
return new IndexOutOfRangeException ();
case COR_E_INVALIDCAST:
// E_NOINTERFACE has same value as COR_E_INVALIDCAST
return new InvalidCastException ();
case COR_E_INVALIDCOMOBJECT:
return new InvalidComObjectException ();
case COR_E_INVALIDFILTERCRITERIA:
return new InvalidFilterCriteriaException ();
case COR_E_INVALIDOLEVARIANTTYPE:
return new InvalidOleVariantTypeException ();
case COR_E_INVALIDOPERATION:
return new InvalidOperationException ();
case COR_E_IO:
return new System.IO.IOException ();
case COR_E_MEMBERACCESS:
return new MemberAccessException ();
case COR_E_METHODACCESS:
return new MethodAccessException ();
case COR_E_MISSINGFIELD:
return new MissingFieldException ();
case COR_E_MISSINGMANIFESTRESOURCE:
return new System.Resources.MissingManifestResourceException ();
case COR_E_MISSINGMEMBER:
return new MissingMemberException ();
case COR_E_MISSINGMETHOD:
return new MissingMethodException ();
case COR_E_MULTICASTNOTSUPPORTED:
return new MulticastNotSupportedException ();
case COR_E_NOTFINITENUMBER:
return new NotFiniteNumberException ();
case E_NOTIMPL:
return new NotImplementedException ();
case COR_E_NOTSUPPORTED:
return new NotSupportedException ();
case COR_E_NULLREFERENCE:
// E_POINTER has the same value as COR_E_NULLREFERENCE
return new NullReferenceException ();
case E_OUTOFMEMORY:
// COR_E_OUTOFMEMORY has the same value as E_OUTOFMEMORY
return new OutOfMemoryException ();
case COR_E_OVERFLOW:
return new OverflowException ();
case COR_E_PATHTOOLONG:
case ERROR_FILENAME_EXCED_RANGE:
return new System.IO.PathTooLongException ();
case COR_E_RANK:
return new RankException ();
case COR_E_REFLECTIONTYPELOAD:
return new System.Reflection.ReflectionTypeLoadException (new Type[] { }, new Exception[] { });
case COR_E_REMOTING:
return new System.Runtime.Remoting.RemotingException ();
case COR_E_SAFEARRAYTYPEMISMATCH:
return new SafeArrayTypeMismatchException ();
case COR_E_SECURITY:
return new SecurityException ();
case COR_E_SERIALIZATION:
return new System.Runtime.Serialization.SerializationException ();
case COR_E_STACKOVERFLOW:
case ERROR_STACK_OVERFLOW:
return new StackOverflowException ();
case COR_E_SYNCHRONIZATIONLOCK:
return new SynchronizationLockException ();
case COR_E_SYSTEM:
return new SystemException ();
case COR_E_TARGET:
return new TargetException ();
case COR_E_TARGETINVOCATION:
return new System.Reflection.TargetInvocationException (null);
case COR_E_TARGETPARAMCOUNT:
return new TargetParameterCountException ();
// case COR_E_THREADABORTED:
// ThreadAbortException c'tor is inaccessible
// return new System.Threading.ThreadAbortException ();
case COR_E_THREADINTERRUPTED:
return new ThreadInterruptedException ();
case COR_E_THREADSTATE:
return new ThreadStateException ();
// case COR_E_THREADSTOP:
// ThreadStopException does not exist
// return new System.Threading.ThreadStopException ();
case COR_E_TYPELOAD:
return new TypeLoadException ();
// MSDN lists COR_E_TYPELOAD twice with different exceptions.
// return new EntryPointNotFoundException ();
case COR_E_TYPEINITIALIZATION:
return new TypeInitializationException("", null);
case COR_E_VERIFICATION:
return new VerificationException ();
// case COR_E_WEAKREFERENCE:
// return new WeakReferenceException ();
// case COR_E_VTABLECALLSNOTSUPPORTED:
// return new VTableCallsNotSupportedException ();
}
if (errorCode < 0)
return new COMException ("", errorCode);
return null;
}
[DllImport ("oleaut32.dll", CharSet=CharSet.Unicode, EntryPoint = "SetErrorInfo")]
static extern int _SetErrorInfo (int dwReserved,
[MarshalAs(UnmanagedType.Interface)] IErrorInfo pIErrorInfo);
[DllImport ("oleaut32.dll", CharSet=CharSet.Unicode, EntryPoint = "GetErrorInfo")]
static extern int _GetErrorInfo (int dwReserved,
[MarshalAs(UnmanagedType.Interface)] out IErrorInfo ppIErrorInfo);
static bool SetErrorInfoNotAvailable;
static bool GetErrorInfoNotAvailable;
internal static int SetErrorInfo (int dwReserved, IErrorInfo errorInfo)
{
int retVal = 0;
errorInfo = null;
if (SetErrorInfoNotAvailable)
return -1;
try {
retVal = _SetErrorInfo (dwReserved, errorInfo);
}
catch (Exception) {
// ignore any exception - probably there's no suitable SetErrorInfo
// method available.
SetErrorInfoNotAvailable = true;
}
return retVal;
}
internal static int GetErrorInfo (int dwReserved, out IErrorInfo errorInfo)
{
int retVal = 0;
errorInfo = null;
if (GetErrorInfoNotAvailable)
return -1;
try {
retVal = _GetErrorInfo (dwReserved, out errorInfo);
}
catch (Exception) {
// ignore any exception - probably there's no suitable GetErrorInfo
// method available.
GetErrorInfoNotAvailable = true;
}
return retVal;
}
public static Exception GetExceptionForHR (int errorCode)
{
return GetExceptionForHR (errorCode, IntPtr.Zero);
}
public static Exception GetExceptionForHR (int errorCode, IntPtr errorInfo)
{
#if !MOBILE
IErrorInfo info = null;
if (errorInfo != (IntPtr)(-1)) {
if (errorInfo == IntPtr.Zero) {
if (GetErrorInfo (0, out info) != 0) {
info = null;
}
} else {
info = Marshal.GetObjectForIUnknown (errorInfo) as IErrorInfo;
}
}
if (info is ManagedErrorInfo && ((ManagedErrorInfo) info).Exception.hresult == errorCode) {
return ((ManagedErrorInfo) info).Exception;
}
Exception e = ConvertHrToException (errorCode);
if (info != null && e != null) {
uint helpContext;
info.GetHelpContext (out helpContext);
string str;
info.GetSource (out str);
e.Source = str;
info.GetDescription (out str);
e.SetMessage (str);
info.GetHelpFile (out str);
if (helpContext == 0) {
e.HelpLink = str;
} else {
e.HelpLink = string.Format ("{0}#{1}", str, helpContext);
}
}
return e;
#else
return ConvertHrToException (errorCode);
#endif
}
#if !FULL_AOT_RUNTIME
public static int FinalReleaseComObject (object o)
{
@@ -58,6 +58,9 @@ namespace System.Security.Claims {
throw new ArgumentNullException ("type");
if (value == null)
throw new ArgumentNullException ("value");
Properties = new Dictionary <string, string> ();
Type = type;
Value = value;
ValueType = valueType == null ? ClaimValueTypes.String : valueType;
@@ -91,4 +94,4 @@ namespace System.Security.Claims {
}
}
}
#endif
#endif
@@ -486,9 +486,7 @@ namespace System.Threading.Tasks
}
if (cancellation) {
ExceptionSlot.Exception = aggregate;
Thread.MemoryBarrier ();
ExceptionSlot.SetException (aggregate);
CancelReal ();
} else {
HandleGenericException (aggregate);
@@ -619,12 +617,15 @@ namespace System.Threading.Tasks
if (exSlot == null || exSlot.ChildExceptions == null)
return;
if (ExceptionSlot.Exception == null)
exSlot.Exception = new AggregateException ();
var exceptions = new List<Exception> ();
if (exSlot.Exception != null)
exceptions.AddRange (exSlot.Exception.InnerExceptions);
AggregateException childEx;
while (exSlot.ChildExceptions.TryDequeue (out childEx))
exSlot.Exception.AddChildException (childEx);
exceptions.Add (childEx);
exSlot.SetException (new AggregateException (exceptions));
if (isParent) {
Status = TaskStatus.Faulted;
@@ -655,7 +656,7 @@ namespace System.Threading.Tasks
void HandleGenericException (AggregateException e)
{
ExceptionSlot.Exception = e;
ExceptionSlot.SetException (e);
Thread.MemoryBarrier ();
Status = TaskStatus.Faulted;
@@ -32,22 +32,46 @@
using System;
using System.Collections.Concurrent;
using System.Runtime.ExceptionServices;
namespace System.Threading.Tasks
{
internal class TaskExceptionSlot
{
public volatile AggregateException Exception;
public volatile bool Observed;
public ConcurrentQueue<AggregateException> ChildExceptions;
Task parent;
volatile AggregateException exception;
#if NET_4_5
volatile ExceptionDispatchInfo dispatchInfo;
#endif
readonly Task parent;
public TaskExceptionSlot (Task parent)
{
this.parent = parent;
}
public AggregateException Exception {
get {
return exception;
}
}
public void SetException (AggregateException exception)
{
#if NET_4_5
if (dispatchInfo == null) {
//
// Used by task awaiter to rethrow an exception with original call stack, it's
// needed for first exception only
//
dispatchInfo = ExceptionDispatchInfo.Capture (exception.InnerException);
}
#endif
this.exception = exception;
}
~TaskExceptionSlot ()
{
if (Exception != null && !Observed && !TaskScheduler.FireUnobservedEvent (parent, Exception).Observed) {
Loaded 100 of 313 files, more files were not shown because too many files have changed in this diff. Show more