Compare commits

...
335 Commits
Author SHA1 Message Date
Alex Corrado 378032bf64 Fix prepending $(CURDIR) to paths failing under cygwin 2011-09-15 13:07:57 -04:00
Alex Corrado a19eb0760b 2.10.6 2011-09-13 23:37:20 -04:00
Gonzalo Paniagua Javier 5cfc62f415 Stop lying in the comments 2011-09-13 20:24:11 -04:00
Gonzalo Paniagua Javier 1ed1c4bed1 Report compilation errors when the type named in 'class' can't be loaded. 2011-09-13 20:24:01 -04:00
Rodrigo Kumpera 616f648f0d Avoid duplicates in the SSC xrefs.
* sgen-brige.c (scc_add_xref): Make sure that the xref
	array is kept sorted by doing sorted insertion for single elements
	and merging for a pair of lists.

	This avoids degenerated cases where performance of the dfs2 step
	goes unbound and slows us down significantly.

	Fixes bxc #496
2011-09-13 15:35:31 -03:00
Rodrigo Kumpera 4fccd4d599 Add logging to sgen-bridge. Log times and sizes. 2011-09-13 15:35:30 -03:00
Rolf Bjarne Kvinge bd4f80e803 [System.Data] Delay column expression evaluation after all the columns have been cloned when cloning a table. Fixes #666.
When cloning a table we loop over all the columns and clone them, but if a column
contains an expression with a reference to a later column, we'll throw an exception
unless we delay the expression compilation until all the columns have been added
to the new table clone.

So I've split out the expression compilation logic from the Expression property setter,
and now the column Clone method only sets the field. The Clone caller is responsible
for calling CompileExpression on the cloned column after adding all the cloned columns to
the cloned table.
2011-09-13 14:15:11 +02:00
Rolf Bjarne Kvinge 9e9b3f913d [System.Data] Properly clone a column's extended properties when cloning a table. Fixes #668. 2011-09-13 13:01:57 +02:00
Jérémie Laval a2a168e5f3 Add missing files. 2011-09-13 12:20:07 +02:00
Jérémie Laval 5f982b1908 Backport System.Threading.Tasks from master to mono-2-10 2011-09-13 12:18:39 +02:00
Gonzalo Paniagua Javier f00202d3e3 Delay initialization of the stream until first read
This way uri-based resources are not fetched before they are supposed
	to.

	Fixes Xamarin bug #762.
2011-09-13 01:24:14 -04:00
Gonzalo Paniagua Javier b4d4033040 Internal worker is kept while there is an ongoing operation
When there is an ongoing operation we can't dispose the internal
	worker because it might be used by the IO threadpool.

	Fixes Novell bug #691076 and Xamarin bug #766.
2011-09-13 00:06:12 -04:00
Sebastien Pouliot 68deb6335e More fixes for running unit tests under NET_2_1 profile 2011-09-12 12:53:17 -04:00
Miguel de Icaza cb965a9d3a Various fixes to the Expression parser, the fixes include:
* Fixes to the SUBSTRING and TRIM function to allow
	  a wider range of functions to be passed as
	  parameters.   This fixes xamarin #665

	* Fix to the Parser.jay grammar to eliminate the
	  reduce/reduce conflicts.

	* Dropping the string concatenation code and instead
	  use the existing arithmetic addition operator which
	  also fixes the concatenation operation in the presence
	  of null values

	* Adds the null literal

With the associated test cases.
2011-09-09 22:04:18 -04:00
Marek Habersack 86262ef424 Support colors on 256-color terminals 2011-09-09 22:04:02 -04:00
Sebastien Pouliot acfa4856b9 Adjust corlib unit tests to reduce failures when executed on the NET_2_1 profile 2011-09-09 13:48:15 -04:00
Sebastien Pouliot be8711a7e6 fix FileStream test failures under Mac OSX 2011-09-09 13:48:01 -04:00
Sebastien Pouliot 7e6a0ff51e Throwing IsolatedStorageException is a Moonlight-behavior and should not have been exposed to other 2.1 profiles 2011-09-09 13:47:48 -04:00
Sebastien Pouliot c989e10293 Ensure we can roundtrip 'Local' (special case) timezone. Fix bug #326 2011-09-09 13:29:40 -04:00
Sebastien Pouliot b04d809478 Return null instead of catching Activator exception (and return null). What was a corner case before is now very common when the linker is used (e.g. monotouch, m4a). Reported in assistly #1741 2011-09-09 13:29:26 -04:00
Miguel de Icaza 219276c182 Fallback: load profiler from the Mono default path. This in particular allows users to run mono --profiler=log foo.exe without having to set anuy environment variables 2011-09-07 18:44:22 -04:00
Sebastien Pouliot 64ff652330 Add null-check on 'partDesc'. Fix bug #612 (WCF regression) 2011-09-07 11:17:55 -04:00
Rodrigo Kumpera 75e3ca80bc Let the system figure our permissions instead of doing a poor job at it.
io.c (DeleteFile): We can't forbit a file to be deleted just before
	it's mask is not u+w. We should just call unlink and let the kernel
	figure out permissions.

	We are not SAMBA.

	We're not in the job of trying to mingle windows and unix permissions
	models so we just let the kernel figure it out and translate the appropriate
	errno value to UnauthorizedAccessException.
2011-09-06 19:36:00 -03:00
Jérémie Laval aa48b6f714 Use a TaskCompletionSource in non-generic ContinueWhenAny case. Fix #647. 2011-09-06 23:55:01 +02:00
Rodrigo Kumpera 2603a2e4fd Improve exception message. 2011-09-06 14:53:00 -03:00
Rodrigo Kumpera 05550e7c66 Add collection logging to sgen. 2011-09-06 14:52:59 -03:00
Gonzalo Paniagua Javier 99349445b1 Display more debugging info when epoll fails 2011-09-05 21:13:07 -04:00
Gonzalo Paniagua Javier d768dd0125 Fallback to poll() if epoll_create() fails
From a patch by Zoltan in bug #705190.
2011-09-05 20:51:10 -04:00
Zoltan Varga e376d9156b Handle threads which die without detaching. 2011-09-06 04:24:21 +02:00
Zoltan Varga 85349b801f Implement AppDomain.ResourceResolve. Fixes #579. 2011-09-04 03:20:22 +02:00
Mark Probst 41d1be9f34 [sgen] Break tracking weak references as early as possible.
Our tracking references code aimed to transform tracking references
into normal weak references the first time their targets became
unreachable.  It was implemented incorrectly though, and is not the
right thing to do in the first place anyway, because tracking
references have to keep tracking if the target is re-registered for
finalization.  The incorrect implementation inadvertently handled
re-registration correctly, but it kept the reference intact for one
garbage collection cycle too many.
2011-09-02 11:14:27 -03:00
Rodrigo Kumpera ac19d5bfaf Handle finalizable objects pointed by bridge objects. (cont...)
* sgen-fin-weak-hash.c:
	* sgen-gc.c: Bridge objects are used to represent objects
	that have references outside of sgen's control. They are
	kept around until the embedder figures out it's ok to
	collect them.
	Until those bridge objects turn externally unreachable,
	they must be kept around. Up to now, the expected pattern
	was to resurrect them during finalization.
	The problem with this approach is that if they hold references
	to other finalizable, non-bridge objects those will be finalized
	and we will resurrect objects that point to dead ones.

	Think of this:

	class BridgeObject {
 		FileStream stream;
	}

	The bridge object is resurrected on the finalizer and so will
	stream, disposing its native handle and been permanently unusable.

	The solution is to process brige objects before we do ordinary
	finalization. We record all dead bridges and copy/mark them.
	We drain the gray queue on the end, which makes sure all other
	finalizable objects that transitively reachable are too.

	Finally, we introduce a breaking change to the bridge API.
	The bridge must set to NULL the first object of all SCC
	entries that remain alive. Other entries will be considered
	dead and will be subject to regular finalization.

	This way, sgen knows when a given bridge object is completely
	unreachable and provides adequate finalization semantics to
	them and referenced objects.

	This fixes bxc #375
2011-09-01 20:13:06 -03:00
Atsushi Eno ae7d005dfc DiffLoader didn't handle encoded name and caused mismatch between .NET. 2011-08-31 17:53:04 -07:00
Atsushi Eno 04427d962d Fix invalid path check for Windows regarding ':'. 2011-08-31 14:12:51 -07:00
Atsushi Eno 57bc2f6ffb Add test for bug #545. 2011-08-31 14:12:42 -07:00
Atsushi Eno 059a6a685b EncoderReplacementFallbackBuffer.Reset() did not really reset its internals. 2011-08-31 14:03:10 -07:00
Chris Toshok 4ac77ca819 prepend $(CURDIR) to jay input files so that the debugging info references the right .jay 2011-08-30 17:06:50 -07:00
Jonathan Pryor d703e86b4b Don't use vasprintf on PLATFORM_ANDROID.
This allows sanely using g_log() within signal handlers.
2011-08-30 15:44:17 -04:00
Atsushi Eno 6870a59952 Implement IXmlLineInfo on XLinq node reader. 2011-08-30 23:13:36 +09:00
Atsushi Eno 721dadd34b LineInfo on namespace nodes were missing. 2011-08-30 20:22:01 +09:00
Sebastien Pouliot b7061d3e57 Fix build. Adding #if MOBILE is just not enough ;-) 2011-08-29 09:53:23 -04:00
Sebastien Pouliot 2f4099863e Fix bug #380. Patch from bnc#605795 were not committed to master but part of MonoTouch 3.x (ended up missing in MT4) 2011-08-29 08:57:30 -04:00
Hin-Tak Leung 96e0c59371 Fix mingw32 cross-build on a git no-branch checkout. Fixes #698446. 2011-08-29 01:25:19 +02:00
Zoltan Varga 1e910229a8 Allow pointers to structures to be passed in pinvoke, MS seems to allow this at least in some cases. Fixes bxc #158.
This partially reverts c4d9097c57.
2011-08-28 17:52:05 +02:00
Jérémie Laval c74031105a Check that CancellationToken coming from OperationCanceledException isn't None. Fix #472. 2011-08-28 14:50:12 +02:00
Atsushi Eno 279678d726 Revert GET switch for serializing requests. BodyWriter handles it better. 2011-08-24 18:13:04 -07:00
Atsushi Eno 46db32524d for GET request, just skip the member. It does not contain xml for null. 2011-08-24 16:48:46 -07:00
Atsushi Eno 0563034987 Skip serialization when the return type is void.
This batch should fix bug #206.
2011-08-24 12:20:23 -07:00
Atsushi Eno 0baf32151f Do not try to output empty message body to logs. 2011-08-24 12:20:13 -07:00
Atsushi Eno 8bd9eebf1f When there is void return, the common message formatter should ignore it.
This case occurs when MessageContract is used and there is no member for
the return value.
2011-08-24 12:20:02 -07:00
Atsushi Eno b9a5b85c16 ReturnValue in MessageDescription was missing when there was MessageContract. 2011-08-24 12:19:52 -07:00
Atsushi Eno c98be1ad12 Differentiate GET query parameter binding from another request binding.
This is one core of the bugfix for #206.
2011-08-24 12:19:42 -07:00
Atsushi Eno 67b1fcec06 When there was no path parameter, it ignored the whole path part. 2011-08-24 12:19:31 -07:00
Atsushi Eno 4643f66d1a This filter should ignore port, and should not filter out anonymous URIs. 2011-08-24 12:19:21 -07:00
Atsushi Eno e3aa857b74 UriTemplate should not be mandatory, make it optional. Fix unit test. 2011-08-23 11:43:56 -07:00
Alex Corrado 350fcbd003 2.10.5 2011-08-22 19:58:07 -04:00
Jérémie Laval c6799b1f41 Throw when a non-finished task is started 2011-08-20 15:00:24 +02:00
Jérémie Laval f260ff4299 Make TaskCompletionSource methods thread-safe
Conflicts:

	mcs/class/corlib/System.Threading.Tasks/TaskCompletionSource.cs
2011-08-20 14:54:28 +02:00
Rodrigo Kumpera 7122b78d60 Fix sgen-arm-mach. It requires some #define juggling.
.
2011-08-19 20:36:39 -03:00
Rodrigo Kumpera 52971cce4c Fix variance test involving nullable types.
* class.c (mono_class_is_variant_compatible): Reject valuetypes
	if not the same straight away. This fixes testing IEnumerable<int?>
	with IEnumerable<int>.

	Fixes bxc #185
2011-08-19 19:32:48 -03:00
Rodrigo Kumpera 5dc77749e7 Correctly calculate the size of the freed array buffer.
* sgen-bridge.c (dyn_array_ensure_capacity): We must correctly
	calculate the size as our allocator asserts when we do it with
	very large allocs.
2011-08-19 02:06:24 -03:00
Rodrigo Kumpera 472b3e6fca Fix android's broken pthread_kill under sgen. 2011-08-18 14:02:26 -03:00
Alan McGovern 59b4c5bc3d [LinkedList] Optimise Clear slightly. 2011-08-18 16:06:27 +01:00
Alan McGovern f105c6d4e7 Merge pull request #161 from LogosBible/master
Fix bug #311: On LinkedList.Clear, detach each node instead of dropping them en masse.
2011-08-18 16:06:10 +01:00
Zoltan Varga 2e637c4cba Disable some failing LLVM passes. Should fix bxc #280. 2011-08-18 17:00:34 +02:00
Jérémie Laval 8d44e61042 Fix coding style 2011-08-17 20:02:02 +02:00
Sebastien Pouliot eac9866b2c Provide an error message if an instance method is decorated with [MonoPInvokeCallback]. Ease finding issues like bug #296 2011-08-17 10:49:30 -04:00
Alan McGovern 7ada4aec7b [System.IO.Packaging] Fix calling convention related issues
The P/Invokes should be Cdecl as the library is compiled with that
calling convention. The delegates passed to native code must also
be marshalled as Cdecl. Fixes BXC #223.
2011-08-17 12:50:23 +01:00
Miguel de Icaza dacb11a24c updated copyrights 2011-08-17 01:26:05 -04:00
Miguel de Icaza 5c44041365 More updates 2011-08-17 01:21:40 -04:00
Rodrigo Kumpera 56b901df8f Fix g_log redirection under android. 2011-08-16 16:30:06 -03:00
Jérémie Laval 582bd35450 Backport TaskCreationOptions check from master 2011-08-16 19:06:45 +02:00
Jeffrey Stedfast 6057352d91 Merge pull request #158 from nickers/mono-2-10
remove debug CWL's
2011-08-16 04:35:11 -07:00
Tomasz Wsuł 3b450189bb Remove writing statement on standard output 2011-08-16 12:56:08 +02:00
Jeffrey Stedfast 7878c22bbf Fixed a typo in zoltan's last commit 2011-08-15 18:05:13 -04:00
Jeffrey Stedfast 674372dd15 Fix for bug #445855
In this day and age of mobile personal computing devices,
we need to periodically check the underlying system
timezone because the device may have crossed a timezone
boundary.
2011-08-15 15:19:20 -04:00
Zoltan Varga af804a9305 Escape characters in LLVM symbol names 2011-08-15 17:47:56 +01:00
Zoltan Varga 7e2eff0be7 Don't pass MONO_UNWIND_ACTUAL_METHOD to the stack walker in a signal handler, its not signal safe. Fixes bxc #263. 2011-08-14 22:35:55 +02:00
Gonzalo Paniagua Javier 7de999655d [threadpool] Exit on unhandled exceptions only
Unhandled exceptions will only set the exitcode if there is no
	AppDomain unhandled exception handler. When the exitcode is set,
	the TP will exit for unhandled exceptions.

	Fixes bug #227.
2011-08-13 00:34:13 -04:00
Gonzalo Paniagua Javier 1b84abfcab [threadpool] Work around for a race-condition
Under some circumstances new_job was not signaled and the threadpool
	threads didn't realized there was a workitem in the queue.

	Fixes Xamarin bug #12 and Novell bug #690357.
2011-08-12 23:17:05 -04:00
Sebastien Pouliot 8286cbf198 Use 'as' for casting certificate extensions since we already deal with null and malformed extensions will throw, hard to debug, ICE when we just want to ignore them 2011-08-12 14:59:12 -04:00
Gonzalo Paniagua Javier db7d7c47cb Fix the range for rnd.Next() 2011-08-11 14:17:23 -04:00
Rodrigo Kumpera 9445d6e22c Add IObserver/IObservable to MOBILE profile. 2011-08-11 13:19:47 -03:00
Marek Habersack 209c253e3f Compilation fix for e449d41158 2011-08-11 02:29:07 +02:00
Marek Habersack e449d41158 [runtime] Fix for Xamarin bug #99. Don't fail to parse assembly names with spaces surrounding = in key=value pairs 2011-08-11 02:20:11 +02:00
Zoltan Varga 9b4a07a69e Fix the newly added test_0_llvm_regress_171 (). 2011-08-10 18:10:58 +02:00
Jérémie Laval 28766cfe96 Avoid creating a delegate instance in general case when setting up continuations
Conflicts:

	mcs/class/corlib/System.Threading.Tasks/Task.cs
2011-08-10 17:16:23 +02:00
Jonathan Pryor a95adaf53d [System,MOBILE] Add System.Text.RegularExpressions.RegexOptions.Compiled.
Add the RegexOptions.Compiled enumeration value to the MOBILE profile.

Fixes: http://bugzilla.xamarin.com/show_bug.cgi?id=149

MonoTouch and Mono for Android still use `PatternCompiler`, which is
interpreted. Thus RegexOptions.Compiled is ignored, and is present only for
compatibility with Windows Phone 7, which states [0]:

	Present only in Silverlight for Windows Phone, but not supported.

[0] http://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regexoptions(VS.96).aspx
2011-08-09 21:33:56 -04:00
Zoltan Varga 7ae2112edc LLVM requires two PHI entries if a previous bblock branches to the current bblock using a conditional branch whose two targets are the same. Fixes #171. 2011-08-09 21:41:54 +02:00
Zoltan Varga 79b99d358b Add support for reference instances of Interlocked.Exchange<T> to full-aot, similarly to Interlocked.CompareExchange<T>. 2011-08-09 19:16:15 +02:00
Zoltan Varga 12fedc8ee6 Merge pull request #154 from mdsol/fix-mono-tarball-tests
Fix mono tarball tests
2011-08-09 10:03:00 -07:00
Jeffrey Stedfast 27589a4031 If #CONFIGURATION_DEP isn't defined, we still want to get a default proxy 2011-08-09 12:30:32 -04:00
Alex Corrado f12adef20c 2.10.4 2011-08-08 21:00:25 -04:00
Harry Wilkinson 049efb2da8 Include mono/tests/delegate2.exe.config to the source tarball so that the tests pass 2011-08-08 18:16:03 +01:00
Gonzalo Paniagua Javier d41b9d61c2 Merge pull request #150 from bassamtabbara/mono-2-10
Some fixes to mono-2-10
2011-08-08 06:26:42 -07:00
Bassam Tabbara 71b1f58d41 Fixed regression in System.Web.Routing caused by 62b047ae5b. Value and constraint where switched when evaluating regex route constraints. 2011-08-07 23:09:08 -07:00
Bassam Tabbara f983186526 Remove Console.WriteLine from DriveInfo.GetDrives() 2011-08-07 11:51:08 -07:00
Bassam Tabbara c726c88f32 Networkstream now throws IOException('connection closed') if the socket was closed/disposed 2011-08-07 11:17:27 -07:00
Jérémie Laval 3cb9ce92bc Fix for #162 2011-08-05 22:35:13 +02:00
Miguel de Icaza 2504797e50 Merge pull request #129 from grumpydev/CryptoFixo
Fix for out of bounds exception in Rfc2898DeriveBytes
2011-08-05 10:05:56 -04:00
Mark Probst 67ebb6a498 [sgen] Enqueue finalizers after update the pointer.
If the object was forwarded we read a bogus vtable and hence a bogus
klass.
2011-08-04 12:04:50 +02:00
Atsushi Eno d9e839c91b Merge pull request #146 from flutos/207ce0bccceec3ff7860ea986086fedb5a92d822
fix for bug 708178 that would fail if the type wasnt IEnumerable, should check if it implement IEnumerable rather than is IEnumerable
2011-08-04 09:08:12 +09:00
Rodrigo Kumpera fd65ec9388 Fix padding of call instructions. 2011-08-03 19:47:34 -03:00
Chris Toshok 7a0052ae2f don't redefine ABS 2011-08-03 10:42:01 -07:00
Marek Habersack ec0e9d7771 [runtime, globalization] Fix for Xamarin bug #161. Fix culture info data for certain locale short date formats
Modified locales which don't use '/' as the short date separator.
2011-08-03 16:00:46 +02:00
Rolf Bjarne Kvinge 4325b8151a [aot-compiler] Replace assert with descriptive error message. 2011-08-03 15:07:41 +02:00
Atsushi Eno 482e406319 Fix NET_2_1 builds (regression from the previous SecurityBindingElement fixes). 2011-08-03 13:54:08 +09:00
Rodrigo Kumpera e421b10a3d Implement fail tramp support on arm for full-aot imt thunks.
* aot-compiler.c (arch_emit_imt_thunk): Implement fail tramp
	support on arm. This enables variance to work under full-aot.
	The code blowout is not really significant as even on non linked
	apps the imt thunk overhead is 0.5%.
2011-08-03 00:47:20 -03:00
Geoff Norton 55c4b01d95 [gc] Darwin/AMD64 can have 64-bit thread id's, so we need to ensure
we cast properly to make sure the modulus has a valid result.
Additionally add support for x86_THREAD_STATE64.
2011-08-02 23:36:05 -04:00
Atsushi Eno a5610cbed1 Merge pull request #145 from ngraziano/99b87f07af0beed3a887
Fix Service Model Xml Serialization and XMLAttributes
2011-08-02 13:51:35 -07:00
Atsushi Eno fc9e1be0b3 Fix build, merge some missing changes to MessagePartDescription. 2011-08-03 05:46:53 +09:00
Atsushi Eno 9b9fef57d9 Fix bug #707434, check order only when applicable.
Based on the input by Scott Fluto.
2011-08-03 05:36:30 +09:00
Nicolas GRAZIANO 99b87f07af TypedMessageConverter do not take into account the xml attribute which modify the serialization.
Correction and Unit Test.
2011-08-02 22:15:58 +02:00
Atsushi Eno 9a69207087 Merge pull request #143 from mistoll/master
Fixes for WCF BasicHttpBinding with message security
2011-08-02 22:53:01 +09:00
Alex 4cfb3889f8 Define MONO_ARCH_NOMAP32BIT for DragonFly BSD. 2011-08-02 00:07:59 +02:00
Atsushi Eno 0a7f80fb0a Fill/reflect ReturnValue to and from corresponding message part.
This may have fixed bug #41.
2011-08-02 10:00:49 -07:00
Atsushi Eno df66c40aaa part of fix bug #41. MessageParameterAttribute is considered for return value.
Conflicts:

	mcs/class/System.ServiceModel/System.ServiceModel.Description/MessagePartDescription.cs
2011-08-02 07:52:03 -07:00
Jeffrey Stedfast 9b3e4f9034 Oops, fixed a typo 2011-08-01 16:59:52 -04:00
Alex 89dad63b0f Add support for DragonFly and NetBSD to sigcontext. 2011-08-01 10:29:43 +02:00
Jeffrey Stedfast 9636231dda Fix a mkbundle compiler warning by #including mono-config.h 2011-07-29 16:59:27 -04:00
Miguel de Icaza a2d896ec4e Update copyrights 2011-07-29 15:22:11 -04:00
Rodrigo Kumpera 66187b25b6 Use wrappers for accessing socket errors. Cygwin does not have some errors in errno.h. Fixes Windows build. 2011-07-29 13:42:25 -03:00
Rodrigo Kumpera f3deab1057 OSX won't expose IPV6_PKTINFO unless __APPLE_USE_RFC_3542 is defined. 2011-07-28 15:23:36 -03:00
Rodrigo Kumpera 5a9f5defc3 Handle a race on thread cleanup.
* mini.c (mini_thread_cleanup): Under some rare cases it's
	possible to have a NULL lmf.
2011-07-28 15:23:33 -03:00
Alex Corrado e43a74ae3f 2.10.3 2011-07-27 19:07:46 -04:00
Jérémie Laval 06cd95ea65 Same test for TaskCompletionSource 2011-07-27 19:52:01 -04:00
Jérémie Laval 7d088a3f17 Ensure that Task is in a correct initial state before starting it for real 2011-07-27 19:36:40 -04:00
Jérémie Laval 0ddabfc4ab Test that futures throw Exception through Result property when they are Faulted 2011-07-27 19:35:50 -04:00
Jérémie Laval 8078626d49 Add test for various AggregateException ctor exception situations 2011-07-27 18:32:05 -04:00
Jérémie Laval ffad7f7365 Move innerExceptions internal null check at the right place. 2011-07-27 18:21:36 -04:00
Jérémie Laval da2f5156b2 Add testcase to ensure unobserved exception on Task are correctly propagated 2011-07-27 18:12:23 -04:00
Jérémie Laval e3578fe451 Makes AggregateException ToString output closer to .NET one 2011-07-27 18:03:28 -04:00
Jérémie Laval 036c395d3c Fix AggregateException behavior 2011-07-27 18:03:24 -04:00
Jérémie Laval 474417efb7 Allow using a worker number that is greater than Environment.ProcessorCount for parallel loops. 2011-07-27 16:24:08 -04:00
Atsushi Eno 23263e537f Fix wsdl import wrt element qname (!= type name). 2011-07-27 21:05:56 -07:00
Jeffrey Stedfast c98cedfc91 Don't invoke libc uname() on non-Unix systems 2011-07-26 18:41:49 -04:00
Mark Probst 2228af8148 [sgen] Use the proper object size when scanning arrays from a card table.
Using the block object size is incorrect since we might scan beyond
the end of the array.
2011-07-26 18:28:23 +02:00
Mark Probst c6bbff5b5e [sgen] Make the card table on AMD64 correct for 64 bit nursery addresses. 2011-07-26 18:25:46 +02:00
Mark Probst 1b58ec73aa [sgen] Make mono_sgen_safe_object_get_size() handle forwarded objects.
This is sometimes called on forwarded objects from the major collector
during finalization.  Now it doesn't crash anymore.
2011-07-26 18:24:09 +02:00
Miguel de Icaza f49164bf76 Fix invocation to syslog 2011-07-25 19:10:07 -04:00
Atsushi Eno 1ae6c346f6 Fix bug #16: use Owner node instead of Parent. Patch by Martin Potter. 2011-07-26 04:25:00 +09:00
Sebastien Pouliot 45064beb94 Fixed decoding of PKCS/CMS message with detached ContentInfo. Pull request from Pablo Ruiz Garcia <[email protected]> 2011-07-25 10:32:46 -04:00
Duane Wandless 8bd7d107a8 Fix crash on Lion when exiting 2011-07-24 15:59:41 -03:00
Geoff Norton d465c35811 Fix configure check for darwin to support all variants 2011-07-24 15:59:40 -03:00
Zoltan Varga fcff387c6a Fix a crash in the soft-float decompose code when a branch following an fcompare is optimized away. Fixes #705186. 2011-07-24 20:45:24 +02:00
Atsushi Eno 513122c74e Avoid possible duplicate xmlns output. Fixes xsp-based hosting somehow. 2011-07-22 14:04:08 +09:00
Atsushi Eno d68521e673 Fix bug #703910 - implement Order support in XmlSerializer. 2011-07-21 04:58:51 +09:00
Marek Safar c5302ba6b6 Merge pull request #135 from eue/mono-2-10
-checked command-line option
2011-07-20 01:10:43 -07:00
Martinho Fernandes 70352e16a9 Test for bug #706877 2011-07-20 09:02:23 +01:00
Martinho Fernandes 150ea5489d [Fix] Command-line option -checked now works (bug #706877)
The -checked option was not being considered in the BuilderContext.
Now it is set on construction of BuilderContext to the value from RootContext.
2011-07-20 09:01:24 +01:00
Atsushi Eno dd4afcfa02 fix build regarding ContentType. 2011-07-19 10:03:37 +09:00
Atsushi Eno a15e2d0bec support action parameter in SOAP 1.2 content type. Close pull request #133. 2011-07-19 02:30:11 +09:00
Rodrigo Kumpera 1e7567b332 Merge pull request #132 from ngraziano/fb497cbb6503c2a0913fddba700079608bcd8892
"make dist" do not work in branch mono-2-10
2011-07-18 07:19:38 -07:00
Atsushi Eno 1dba37de1c Fix bug 704813: just ignore members of type IEnumerable`1 without Add(). 2011-07-16 06:51:45 -07:00
Rodrigo Kumpera bfdd13a52c If a thread abort is fatal, print the exception before dying. 2011-07-15 18:16:36 -03:00
Rodrigo Kumpera a26b65f6b3 Improve stacktraces when facing a runtime invoke wrapper.
* mini-exceptions.c (mono_handle_exception_internal_first_pass):
	Don't trim the trace list if we find a filter clause from a wrapper.
	This makes stacktraces across MRI's work.
	Extract trace trimming into a macro to reduce code duplication.
2011-07-15 18:10:40 -03:00
Rodrigo Kumpera 36f12fc250 Avoid a .cctor on the initialization path. 2011-07-12 19:50:46 -03:00
Rodrigo Kumpera 8c253ee6c3 Add shared_perfcounters option to enable minimal. 2011-07-12 19:50:44 -03:00
Nicolas Graziano fb497cbb65 Correct the include files Platform is not in test. 2011-07-12 16:01:05 +02:00
Rodrigo Kumpera 11bacf8e1b Do DISABLE_PORTABILITY more agressively. 2011-07-12 01:35:35 -03:00
Zoltan Varga 2599353bc0 Add a test for 7cb704d9a9. 2011-07-12 03:19:10 +02:00
Zoltan Varga 9f92b788d8 Avoid register allocation problems when a try clause is nested inside a handler block. 2011-07-12 02:09:27 +02:00
Zoltan Varga c584c82e0d Fix the length of r4const on arm. 2011-07-11 17:11:00 +02:00
Zoltan Varga aa4803c5a4 Fix caching in mono_marshal_get_array_address (). 2011-07-11 00:25:52 +02:00
Zoltan Varga 816556dbb8 Use TARGET_ANDROID instead of PLATFORM_ANDROID in one place. 2011-07-11 00:25:50 +02:00
Zoltan Varga d9ecc66fb6 Really fix the -Wno-unused-but-set-variable check. 2011-07-11 00:25:49 +02:00
Zoltan Varga f333e91d0a Clean up the cross-compile configure.in code. Add a TARGET_ANDROID define. 2011-07-11 00:25:49 +02:00
Rodrigo Kumpera f87620d145 Fix signal chaining to handle a stupid previous handler. 2011-07-09 13:40:43 -03:00
Rodrigo Kumpera 8bd567de14 Arm has MONO_ARCH_HAVE_SIGCTX_TO_MONOCTX. This gives us nice stacktraces on unhandles exceptions. 2011-07-09 13:40:36 -03:00
Rodrigo Kumpera 28a61a5d55 Disable the exception thread under iOS since it's neither needed nor working. 2011-07-09 13:40:29 -03:00
Atsushi Eno d25c23dc46 Full equivalence comparison is unnecessary for MessageEncoder ContentType.
based on https://github.com/mono/mono/pull/130
2011-07-09 06:52:43 +09:00
Jeffrey Stedfast 481881bdf7 Reverted previous commit, struct sizes vary way too much between platforms 2011-07-06 18:20:20 -04:00
Jeffrey Stedfast 44ab43948a Use a struct utsname when calling uname() instead of an 8K buffer 2011-07-06 18:07:34 -04:00
Jeffrey Stedfast 643c0f0cba Add System/Platform.cs to *System*.dll.sources 2011-07-06 13:30:06 -04:00
Jeffrey Stedfast da0d698fce Make internal Platform class static 2011-07-06 12:43:49 -04:00
Jeffrey Stedfast 6f1458dea4 Load the correct type on MacOSX (as opposed to iOS) 2011-07-06 12:04:34 -04:00
Jeffrey Stedfast 72e554c612 Implemented a shared way to detect MacOSX for System.dll 2011-07-05 17:50:21 -04:00
Jeffrey Stedfast e54a124e71 Doh, do proper OSX detection 2011-07-05 17:00:16 -04:00
Jeffrey Stedfast 62e6bd03f6 Use runtime checks to decide to use CoreFoundation.CFNetwork.GetDefaultProxy() 2011-07-05 16:30:50 -04:00
Jeffrey Stedfast be2e765af8 On MonoTouch, call CoreFoundation.CFNetwork.GetDefaultProxy() to get the default proxy 2011-07-05 13:56:51 -04:00
Marek Habersack c5b95f4bbb [asp.net] Added FormsAuthentication.Timeout 4.0 property 2011-07-01 00:01:19 +02:00
Jb Evain b8e85ce171 Fix handling of null in the non generic implementation of EqualityComparer. Fixes 703027. 2011-06-30 01:25:34 +02:00
Jackson Harper a2b093a9a1 We can accidently swallow out of FD errors here since this function is called from a threadpool thread. 2011-06-28 23:25:15 -04:00
Atsushi Eno 8481eefe9f Implement support for Stream param with WebHttpBinding raw content format. 2011-06-28 20:45:37 +09:00
Atsushi Eno 9f612740f7 Implement support for generic data contract type name with "{x}". 2011-06-28 18:03:49 +09:00
Jb Evain cb4b62c04b Fix queryable enumerable expression transformation 2011-06-23 00:33:09 +02:00
Jb Evain c51e257674 Don't emit null queryable constants when rewriting linq queries, fix #701187 2011-06-23 00:20:13 +02:00
Sebastien Pouliot 40ca71a120 Merge pull request #119 from konrad-kruczynski/SslStreamNoTimeout
Removed hard coded timeout for SslStreamBase.
2011-06-22 06:25:06 -04:00
Michael Hutchinson cc81b58a0e Fix the cairo dllmap on OS X 2011-06-20 14:48:19 +01:00
XTZGZoReX 70640f232b Socket: Fixed a security issue when default-initialized ArraySegment structs are passed in.
This is the same security issue that was recently addressed in MS.NET.
2011-06-19 19:02:34 -04:00
Gonzalo Paniagua Javier 949e910102 Fix crash when there's a \' in the arguments.
Fixes crash when calling Process.Start on a file with a ' in the path
	when UseShellExecute is set to false.

	Patch by Tom Philpot.
2011-06-15 15:36:23 -04:00
Sebastien Pouliot 395aae632d Fix remaining moon-unit failures wrt Sockets changes
* System.Net.Sockets/Socket_2_1.cs: Ensure RemoteEndPoint is always
available after ConnectAsync (connected or not, allowed or not).
Ensure the Connect event is fired even if denied by policy.
2011-06-15 15:36:09 -04:00
Sebastien Pouliot ce9ff91f78 Fix copy-paste error in git 17085447
* System.Net.Sockets/Socket_2_1.cs: Fix some moved code (from
SocketAsyncEventArgs.cs) so should the references to RemoteEndPoint
still point to the SocketAsyncEventArgs instance. Fix some moon-unit
test failures
2011-06-15 15:36:09 -04:00
Zoltan Varga f1861e5cbe Apply a workaround for a gcc 4.6 problem on arm. 2011-06-15 17:31:35 +02:00
Atsushi Eno 79bca55588 Set "Encoder" property when Message was read from MessageEncoder. 2011-06-14 19:19:06 +09:00
Atsushi Eno 3e48da364b finally implement Message.ToString() as in expected form.
Regressions on this method has caused several unpredictable errors,
so I avoided this for somewhat long time...
2011-06-14 18:46:12 +09:00
Atsushi Eno 8b88042311 Flush some ongoing changes for XmlSerializer support in svcutil. 2011-06-14 18:01:07 +09:00
Rodrigo Kumpera 352e7d076d Allow AssemblyRef flags to have at least ECMA's values. Fixes #684613. 2011-06-13 16:38:59 -03:00
Atsushi Eno d4a6887c31 Fix 2.0 build. 2011-06-13 21:36:47 +09:00
Atsushi Eno 6813d3f09b Implement OnWriteBodyContents() and add message buffer support for RawMessage. 2011-06-13 20:07:53 +09:00
Marek Habersack 81d20479d4 [asp.net] Construct properly rooted paths when assigning values from resources 2011-06-13 12:39:23 +02:00
Zoltan Varga 1ff53bb1ba Add an assert to detect TLS mismatches between the aot compilation and runtime environment. 2011-06-12 18:47:17 +02:00
Sebastien Pouliot 927a76eb30 Fix namespace and avoid looping once ctor is found 2011-06-12 12:25:23 -04:00
Sebastien Pouliot 050abd469f Refactor MonoMac's MarkNSObjects substep so it can be reused in other products 2011-06-12 12:25:04 -04:00
Jb Evain 127c3bf6e0 update tuner 2011-06-12 12:24:41 -04:00
Jb Evain cbd9da1acf update tuner 2011-06-12 12:24:14 -04:00
Zoltan Varga 71b1425fd5 Fix the check for the -Wno-unused-but-set-variable gcc option. 2011-06-11 15:35:06 +02:00
Zoltan Varga 89424f5b25 Disable the -Wunused-by-set-variable warning supported by newer gcc versions. 2011-06-11 15:35:06 +02:00
Rodrigo Kumpera 86d31a6e3f Fix darwin-arm build. 2011-06-09 13:55:23 -03:00
Zoltan Varga 84265522ed Fix a corner case where an inlined bblock which had its next_bb set was the last bblock in a method. Fixes #693905. 2011-06-04 15:24:38 +02:00
Jonathan Pryor 662a9ac8f7 Allow Android'd support_boehm=no to work.
The AC_ARG_ENABLE(boehm, ..., ..., support_boehm=yes) resulted in
support_boehm always being 'yes', even for `--host=arm-linux-androidabi`,
which was not the intention. Using `support_boehm=${support_boehm:-yes}`
generates correct behavior.
2011-06-03 17:19:43 -04:00
Jonathan Pryor 33068b3d07 Simplify building with the Android NDK.
Check --host against *-*-linux-android* for Android-specific configure fixes,
and improve **/Makefile.am to simplify Android support:

	./configure \
		--build=`./config.guess` \
		--host=armv5-linux-androideabi \
		--target=armv5-linux-androideabi \
		--enable-nls=no --with-mcs-docs=no --enable-mcs-build=no \
		CC="/path/to/ndk/arm-linux-androideabi-gcc --sysroot=/path/to/sysroot" \
		AR="..." AS="..." CPP="..." CXX="..." LD="..." RANLIB="..." STRIP="..."
		CFLAGS="-DARM_FPU_NONE=1" CXXFLAGS="-DARM_FPU_NONE=1"

See also Android NDK docs/STANDALONE-TOOLCHAIN.html.

The Android NDK/bionic is "interesting", in that it's lacking header files and
macros normally present on Linux which otherwise break the build (e.g. no
<link.h> which breaks Boehm support).  Using --host with an android target
works around the known issues, simplifying the building of libmonosgen-2.0.so
with the Android NDK toolchain.
2011-06-03 16:58:08 -04:00
Atsushi Eno db9f31cbd1 Support RemoteEndpointMessageProperty. 2011-06-03 19:47:40 +09:00
Zoltan Varga 5b3336a997 Fix the previous change. 2011-06-03 12:29:17 +02:00
Zoltan Varga 6920d7ce86 Fix NOMAP32BIT support in specific trampolines. 2011-06-02 23:42:46 +02:00
Rodrigo Kumpera 1da10df16c Handle a vtable layout corner case.
class.c (mono_class_inflate_generic_method_full_checked): Don't
	inflate a method if the provided context won't change it.
	This change, in particular, avoid inflating a generic method
	of a non-generic class if the context has class only vars.

	This fixes #696593 as the above was causing the vtable of
	Class3 ending up with an inflated Class1::Method<> that
	comes from inflated Class2<object> parent.
	Then the parent override pass would collect a non-inflated
	Class1::Method<> overide that would then not match the one
	on the vtable causing Class3 to have an abstract method on
	its vtable and thus failing to load.

	Big explanation means tricky change, might break tons of stuff.
2011-06-01 15:04:34 -03:00
Atsushi Eno 7f2cf89aeb Support WebHttpBinding configuration. 2011-05-31 20:58:05 +09:00
Atsushi Eno 3e629f2ac7 Ref parameter was not covered by ParameterInfo.IsOut. Fixed bug #696784. 2011-05-31 18:55:09 +09:00
Rodrigo Kumpera 3c5a13fa39 Properly handle field RVA under moving collector.
* reflection.c (typebuilder_setup_fields): Alloc RVA data
	on the image mempool so it works with a moving collector.

	Fixes #696817
2011-05-30 18:34:03 -03:00
Rodrigo Kumpera 46c26749eb Fix sgen under xen 2011-05-30 12:23:35 -03:00
Atsushi Eno a2d8112081 Add test for XmlMembersMapping.TypeName and .Namespace (not very useful yet...) 2011-05-27 17:30:12 +09:00
Atsushi Eno bb331ddde1 Fill type info in MessagePartDescription from XmlSerializer-based wsdl importer.
It still needs some fixes to import message elements.
2011-05-27 17:27:01 +09:00
Rodrigo Kumpera 300bc2d4b0 Fix mul_imm under amd64 2011-05-25 15:09:28 -03:00
Marek Habersack f88fba3cbd [asp.net] Don't throw an exception if a session item being released does not have a lock.
It can happen when the item is being released after its associated session has ended.
2011-05-24 11:14:33 +02:00
Atsushi Eno 7b58e280a5 Support named wildcard in UriTemplate matching. Fixed bug #693996. 2011-05-23 20:32:11 +09:00
Atsushi Eno 8dd637646f Look for KnownTypeAttributes on known types (recursively). Fixed bug #695203. 2011-05-23 19:29:28 +09:00
Atsushi Eno 77625cbc89 Allow DocumentType in ImportNode().
http://lists.ximian.com/pipermail/mono-devel-list/2011-May/037575.html
2011-05-19 13:18:20 +09:00
Marek Habersack b122da385a [asp.net] Ignore JavaScript blocks enclosed in HTML comments 2011-05-19 03:37:44 +02:00
Marek Habersack eac15568e2 [runtime] When shadow-copying assemblies, use the io portability function to find the file.
This is necessary in situations when managed code pases case-insenstive file name and the
file on disk uses different case. stat(2) would return an error in such situation and, in effect,
the stat structure would get invalid/random values in its fields.
2011-05-18 22:05:40 +02:00
Atsushi Eno fb67d391a3 Check invalid recursion of xs:group use. Fixed bug #650117. 2011-05-18 01:11:34 +09:00
Marek Habersack 7129d57c22 [asp.net] Fix for bug #650847. Output both tagged and untagged UpdatePanel names in AJAX responses.
Also, update panels which rendered empty string are included in the output.
2011-05-16 16:15:03 +02:00
Atsushi Eno 9e88fe782a Do not import xs:any member as XmlElement[]. Create a wrapper class instead.
Part of bugfix #670945.
2011-05-16 18:47:11 +09:00
Atsushi Eno 91de42214b (manually) Merge pull request #101 from occ/master
Decimal support to XmlBinaryDictionaryReader
2011-05-16 16:41:27 +09:00
Zoltan Varga 02b82fb567 Avoid a crash in Field:GetRawConstantValue () if the field type couldn't be loaded. Fixes #693894. 2011-05-15 13:05:14 +02:00
Atsushi Eno 9fc2d82c3b Implement XmlSerializerMessageContractImporter, round 2.
This time it is XmlSerializer-based, got it somewhat working.
2011-05-14 01:30:21 +09:00
Atsushi Eno 1aebe941ef Do not take host part into consideration on comparing URLs.
It blocks access by different host name (e.g. localhost vs. IP).
This was part of bugfix #687580 (forgot to commit).
2011-05-13 21:55:30 +09:00
Atsushi Eno 9c1b923e99 Implement WsdlContractConversionContext, and ignore message importer for now. 2011-05-13 21:48:41 +09:00
Atsushi Eno 6adda4d4c0 Revert previous XmlSerializerMessageContractImporter implementation.
XsdDataContractImporter is not XmlSerializer-based, while this class is.
2011-05-11 18:42:45 +09:00
Atsushi Eno 5a8f29cbcc Add PipeException. fixed bug #692987 by Eberhard Beilharz. 2011-05-11 16:56:58 +09:00
Atsushi Eno aa2208afee Fixed orders in XmlSchemaObjectTable and got some S.R.Serialization tests working. 2011-05-11 16:37:04 +09:00
Atsushi Eno a1e3732cef CanImport() just returns false, without throwing error. 2011-05-10 22:04:10 +09:00
Atsushi Eno 8bb3b4db45 support import of xs:anyType, as well as make couple of minor fixes. 2011-05-10 21:47:58 +09:00
Atsushi Eno 240c0124a6 Fix common issue in MetadataSet - call MoveToContent() while iterating nodes. 2011-05-10 20:00:38 +09:00
Atsushi Eno 52965a2b9d Add new MetadataSetTest and fix couple of minor issues. 2011-05-10 19:36:26 +09:00
Atsushi Eno bed33dd66b Revive this test by implementing mock web server. 2011-05-10 19:36:16 +09:00
Atsushi Eno c0f3997eaf Add (not-working) callback instance context mode test and FIXME comment. 2011-05-10 19:36:05 +09:00
Atsushi Eno 29adf41cc2 Update XsdDataContractImporter.CanImport and implement ImportXmlType. 2011-05-10 17:42:03 +09:00
Atsushi Eno 0f6b274a8e ongoing XmlSerializerMessageContractImporter work.
It is part of bugfix #670945.
2011-05-09 23:00:39 +09:00
Atsushi Eno 34b7d3a84d Multiple schemas in wsdl could share same SourceUri, so check more identity.
Part of bugfix #670945.
2011-05-09 19:12:09 +09:00
Atsushi Eno 3afbf58c92 Allow xsi:nil for void. Fixed client side of bug #687580. 2011-05-09 13:52:09 +09:00
Atsushi Eno 9193bf8f3f Now our HttpListener can listen to wildcard prefix safely.
Fixed server part of bug #687580.
2011-05-09 13:43:12 +09:00
Rodrigo Kumpera 2b487789c8 Workaround io-layer crashing when the runtime exit without cleaning up everything.
* handles.c (handle_cleanup): When the runtime exit(), not
	everything is shutdown and the main thread might be waiting
	on other threads to finish. On this case, io-layer cleanup
	with assert as a mutex will be in use.
	The work-around is to be lenient to busy resources during
	shutdown.
2011-05-07 00:13:11 +02:00
Lluis Sanchez 6b6ce9bd43 [Web Services] Fix regression caused by previous commit
Fixes a regression caused by the implementation of support
for optional parameters. GlobalIndex was not being set
when using SOAP RPC protocol.
2011-05-06 18:45:30 +02:00
Veerapuram Varadhan fbe4e20182 [ado.net]bugfix:688773 - Assign default value to columns that does not
exist in the row that is being imported.
2011-05-06 00:06:23 +05:30
Veerapuram Varadhan d753eb1861 [ado.net]bugfix:681916 - Based on patch by Scott <[email protected]>
- Handle null values for parameter types varbinary(max) and/or image
2011-05-06 00:05:31 +05:30
Veerapuram Varadhan aac2016aa9 [mono]bugfix:663287 - Validate the type of value against underlyingtype
instead of nullableType.
2011-05-06 00:03:42 +05:30
Veerapuram Varadhan 2ec26f2e77 [ado.net][OracleClient] - Fixes calling size_t native parameters by
passing UIntPtr reference types and hence, solves 32/64 bit and
little/big-endian issues.
2011-05-05 23:51:14 +05:30
Veerapuram Varadhan 9e48c8a2b0 [bugfix][ado.net]Fixes 663914 - Restore original column data for
unchanged columns during deserialization.
2011-05-05 23:41:39 +05:30
Marek Habersack f1ab82a7e8 [corlib] Do not cache disposed resource sets. 2011-05-04 23:33:11 +02:00
Marek Habersack c4a3ecad74 [asp.net] Do not retrieve script's URL in RegisterScriptReference if script.Path is set. 2011-05-04 23:33:04 +02:00
Martin Baulig 844d678cba Add socket timeouts to the soft debugger.
SDB now support setting a send/receive timeout on the client's side
of the communication socket.  To make this work, the server sends
a special 'keepalive' event when using receive timeouts.

There's a new method VirtualMachine.SetSocketTimeouts() to enable
this feature.
2011-05-03 13:53:37 +02:00
Rodrigo Kumpera d3c5cc1fe5 Add regression test for #691057 2011-05-03 02:58:48 -03:00
Rodrigo Kumpera 01cf5ded25 Fix a couple of issues on Mono.Simd.
* local-propagation.c (mono_local_deadce): Don't perform
	reverse copyprop on simd insert ops. The backend requires
	dreg and sreg1 to match.

	* mini-x86.c (mono_arch_output_basic_block): Fix insert_r8_slow
	for the X element.

	Fixes a few bugs due to #691057
2011-05-03 01:23:20 -03:00
Zoltan Varga 399a6c779e Implement BSTR icalls even when COM is disabled. Fixes #690255. 2011-05-03 01:03:43 +02:00
Gonzalo Paniagua Javier 516cbf29c4 Don't set NoDelay twice. 2011-05-02 12:12:09 +02:00
Jb Evain 63fc3530b9 Fix non net_4_0 profiles build 2011-05-02 11:58:52 +02:00
Jb Evain 0ae09ac40d Properly check the maxstacksize asked for the Thread 2011-05-02 11:46:09 +02:00
Zoltan Varga c9cb0a918b Fix support for parameters with generic constraints in Type.IsAssignableFrom (). Fixes #691119. 2011-05-02 09:41:18 +02:00
Geoff Norton c538edd457 Avoid doubly declaring some types in the 2.1 profile for mobile 2011-04-30 11:48:59 -04:00
Gonzalo Paniagua Javier 718f02e0d3 Fix prefix selection
We were picking the wrong prefix when the URL matched the path.
	Fixes bug #688860.
2011-04-30 11:34:54 +02:00
Gonzalo Paniagua Javier f3560b3f22 Support FTP + RETR + proxy
Fixes bug #690887.
2011-04-30 11:08:55 +02:00
Gonzalo Paniagua Javier 8b18364cfb Missed this in the backport 2011-04-30 06:59:20 +02:00
Geoff Norton e7ff9bcf14 Remove debug spew 2011-04-29 17:52:33 -04:00
Geoff Norton 546a888f91 [boehm] Avoid a ENOMEM when allocating across an unallocated page
A very rare allocation pattern could cause the boehm free list to call
the GC_unmap_gap function, which actually calls down into munmap().
Darwins virtual memory manager will return a KERN_INVALID_ADDRESS
which is translated into a ENOMEM, if mprotect attempts to change
the protection of a range which includes an unallocated page.
We address this by just mmap() back to ANON, instead of actually
unallocating the page.
2011-04-29 16:23:15 -04:00
Gonzalo Paniagua Javier b0c3795ac4 [webclient] Process uri.UserInfo when present
If there are no crendetials, the Uri might have them.
	Based on a patch by QuickJack.
	Fixes bug #688007.
2011-04-29 11:55:17 +02:00
Geoff Norton 19f4433ef2 Avoid a needless buffer copy that is susceptible to overflow 2011-04-28 23:05:15 -04:00
Zoltan Varga b09e63d792 Fix loading from volatile base addresses in the LLVM backend. Fixes #690020. 2011-04-28 23:46:42 +02:00
Zoltan Varga 5e04bc52bb Revert "Modify fixup_cattrs () to handle a corner case where a cattr is created using a MonoCMethod instead of a ConstructorBuilder. Fixes #689533."
This reverts commit 046ff98055.

This seems to break smcs.exe.
2011-04-28 22:28:00 +02:00
Lluis Sanchez 2773f9f10a [Web.Services] Add support for optional parameters
Non-nullable web service parameters can be made optional by
adding an additional parameter with the same name and a
'Specified' suffix. This was supported when serializing
classes, but not when serializing web service parameters.
This might fix bug 688496.
2011-04-28 18:34:16 +02:00
Atsushi Eno cf183438ee Looks like xs:any is allowed under certain condition in XsdDataContractImporter.
But I don't understand why :(
2011-04-28 23:41:43 +09:00
Atsushi Eno c18ad33d44 moonlight does not like XmlSchemaType but nasty code in KnownTypeCollection :( 2011-04-28 22:10:06 +09:00
Atsushi Eno 9956130fa2 ...and do return Type for all known xs:* types in XsdDataContractImporter. 2011-04-28 20:33:47 +09:00
Atsushi Eno 50ad936a80 Do not reject xsd:* types that are not listed in KnownTypeCollection.
e.g. xs:token.
2011-04-28 20:09:05 +09:00
Atsushi Eno acb4203da5 support <service>-less wsdls in svcutil. Look for portTypes instead. 2011-04-28 19:54:48 +09:00
Atsushi Eno a6e6fbbeb3 Extend supported XmlDateTimeSerialization formats. Fixed bug #690475. 2011-04-28 17:37:33 +09:00
Atsushi Eno 02e0ab3df8 XmlSerializer code generator was generating wrong char literal.
Fixed bug #673019.
2011-04-28 15:44:18 +09:00
Gonzalo Paniagua Javier a66df5bf91 [socket] More BeginConnect (IPAddress []) work
When trying multiple addresses, the second and sucessive calls to
	BeginConnect(IPAddress) will cause an error which we would have to
	ignore and then retry. Since this behavior is not documented, we just
	close the socket and open a new one for retries is there is already a
	pending connect attempt.
2011-04-28 00:18:35 -04:00
Gonzalo Paniagua Javier ef49022f97 [Socket] Improved ConnectAsync
ConnectAsync() now uses the improved BeginConnect.
2011-04-28 00:18:35 -04:00
Atsushi Eno 4d2ff35b88 Remove non-existent test source (it is only in master). 2011-04-28 12:45:13 +09:00
Atsushi Eno 1e08457302 Handle fault messages in duplex callback channel. 2011-04-27 20:59:18 +09:00
Atsushi Eno 59dd3fcfe8 Use FindCritera/ResolveCriteria Duration properties for DiscoveryEndpoint timeout. 2011-04-27 15:43:46 +09:00
Atsushi Eno 35a659b435 Log UDP messages (using System.ServiceModel internals via IVT). 2011-04-27 15:43:39 +09:00
Gonzalo Paniagua Javier 01fff28591 If there's a delayed exception, clear 'ares' 2011-04-26 23:44:12 -04:00
Gonzalo Paniagua Javier acad9c91d0 Worked on linux, failed on OSX 2011-04-26 22:05:49 -04:00
Marek Habersack ea73a5a1e4 [asp.net] CreateChildControls is internal only when compiling system.web tests 2011-04-26 21:14:35 +02:00
Jérémie Laval 6c5f273c3f Fail gracefully when CancellationToken has been created uninitialized by user.
Also add corresponding unit test.
2011-04-26 17:03:26 +02:00
Jérémie Laval 512ca45eb9 Add CancellationToken unit tests 2011-04-26 17:03:26 +02:00
Jérémie Laval 67c3b641c2 Honors correctly canceled ctor parameter of CancellationToken 2011-04-26 17:03:26 +02:00
Gonzalo Paniagua Javier bb61f41996 Reset the blocking flag as soon as possible. 2011-04-26 11:03:00 -04:00
Gonzalo Paniagua Javier 8dfa7d2c7e [socket] Fixed other BeginConnect overloads
The BeginConnect overload taking an IPAddress[] was not really
	asynchronous.
2011-04-26 11:03:00 -04:00
Zoltan Varga 046ff98055 Modify fixup_cattrs () to handle a corner case where a cattr is created using a MonoCMethod instead of a ConstructorBuilder. Fixes #689533. 2011-04-26 13:26:54 +02:00
Atsushi Eno cde89bb093 Fix monodroid/monotouch build. 2011-04-26 19:39:10 +09:00
Gonzalo Paniagua Javier 9eb77b093b [Socket] Fix BeginConnect
Windows/Linux flagged the socket as writable even when connect() has
	not been called. On *BSD and OSX, this was not the case and we waited
	forever.

	Now, for blocking sockets, we make them blocking and call connect()
	before adding the socket to the wait pool.
2011-04-26 00:05:26 -04:00
Gonzalo Paniagua Javier 5e40958c3b In *AllLines use WriteLine instead of Write.
This fixes bug #689670.
2011-04-25 16:23:17 -04:00
Atsushi Eno 82b1e211f8 Log net.tcp transport messages too. 2011-04-25 18:31:01 +09:00
Atsushi Eno 3fd521bd7d Make our own simple log format actually diagnostics-compatible.
So MS ServiceTraceViewer.exe can open our log now.
2011-04-25 18:30:50 +09:00
Atsushi Eno cdc0fc4d45 Document MONO_WCF_TRACE environment variable. 2011-04-25 16:25:39 +09:00
Atsushi Eno 43c40b6f3d minor diagnostic log format brush up. 2011-04-25 16:15:08 +09:00
Atsushi Eno 2e5417f5bd Actual source directory changes after changing namespaces. 2011-04-25 15:57:59 +09:00
Atsushi Eno 247cef557f More nettcp namespace changes. 2011-04-25 15:57:49 +09:00
Atsushi Eno 0f328b26c0 Move NetTcp namespace to internal one. 2011-04-25 15:57:38 +09:00
Atsushi Eno 415027eedd Enable environment-controled output on non-moon profile too. Add error logging. 2011-04-25 15:38:39 +09:00
Miguel de Icaza 1223efd9ce Do not go beyond our string boundaries 2011-04-23 12:54:57 -04:00
Atsushi Eno 27e1844bb9 Log HTTP reply Message too. Make logging customizible on under the moon.
Logging is done only when requested by MOON_WCF_TRACE=[stdout|stderr]
environment variable.
2011-04-23 02:09:11 +09:00
Marek Habersack 054738b20f Fix compilation 2011-04-22 14:02:39 +02:00
Marek Habersack 58a60f9e5e [asp.net] Do nothing if null SessionStateStoreData is passed to SessionStateServerHandler.SetAndReleaseItemExclusive 2011-04-22 12:36:11 +02:00
Marek Habersack df413084ff [asp.net] Inform user about all exceptions thrown during HttpRuntime static initialization 2011-04-22 11:55:35 +02:00
Marek Habersack b029f4e97e [asp.net] Implemented composite scripts support in System.Web.Extensions 2011-04-22 11:55:15 +02:00
Zoltan Varga 4b98bcb536 Fix AOT support for isinst_with_cache wrappers. Fixes #687865. 2011-04-22 03:40:58 +02:00
Geoff Norton c597bb43ac We support hard breakpoints on arm, not sure why this is here at all 2011-04-21 15:00:42 -04:00
Atsushi Eno f66017dd16 Use XPathNavigator output in WCF diagnostics. Got sorta-valid message trace. 2011-04-21 21:12:48 +09:00
Atsushi Eno 0990c54b02 Fix wrapper elements. It should be <TraceData><DataItem>... 2011-04-21 21:09:48 +09:00
Atsushi Eno 1cf432ed50 XmlWriterTraceListener supports XPathNavigator as non-escaped xml output. 2011-04-21 20:56:09 +09:00
Marek Safar eb9c5951e6 [688891] Keep same TypeParameter ctor syntax 2011-04-21 10:11:11 +01:00
Marek Safar 6a1de942e0 [688891] Copy type parameters for base proxy method 2011-04-21 10:08:42 +01:00
Atsushi Eno b62fb2816f Use xmlns-ignoring XmlDocument derivation for config files. Fixed bug #641935. 2011-04-21 17:47:49 +09:00
Atsushi Eno d3a50832b1 RooArray types were rejected as unknown when it is at root. Fixed bug #688414. 2011-04-21 16:22:09 +09:00
Atsushi Eno d911500226 Get real fix for bug #687902. Revert request processor IDisposable.
and handle session shutdown when creating InstanceContext.
Also add note on DisposeInstance(), which got me stuck.
2011-04-20 19:15:15 +09:00
Atsushi Eno 657c31a31b Ongoing service channel closing fix and session management in ChannelDispatcher.
It is part of bugfix 687902.

To get the bug fixed, the new "using" sections in ChannelDispatcher.cs to
explicitly dispose channels. But this causes regression in PerSession-based
tests. So some new session management code is (likely) required as well.

It will also alter "mixed" MaxConcurrentCalls and MaxConcurrentSessions with
correct management code.
2011-04-20 16:57:58 +09:00
Miguel de Icaza 851c79f6e6 Prevent crash on scripts that do not contain the #! line 2011-04-19 22:52:39 -04:00
Zoltan Varga 3fedcf496b Allow storing managed pointers into 'native int' in the JIT, fsharp generates code without a conv.i. Fixes #688008. 2011-04-19 22:45:29 +02:00
Gonzalo Paniagua Javier 1562106ccd [HttpListener] Fix matching directories
/foo was not properly matched.
	Fixes bug #688353.
2011-04-19 13:56:39 -04:00
Marek Safar 90922a746d [687282] Fixes cross references of nested anonymous methods which don't start at parameters level block 2011-04-19 13:06:12 +01:00
Lluis Sanchez e54906aaf2 Fix ICollection.CopyTo in the Stack class 2011-04-19 13:51:55 +02:00
Gonzalo Paniagua Javier 6f9f05df58 [HttpWebRequest] Fix half-baked commit
Fixes bug #688100.
2011-04-18 10:57:21 -04:00
468 changed files with 14740 additions and 3717 deletions

No files matched your search

+2 -2
View File
@@ -57,11 +57,11 @@ function setup ()
CROSS_DLL_DIR="$CROSS_DIR/bin"
PATH=$CROSS_BIN_DIR:$PATH
MONO_VERSION=`grep AM_INIT_AUTOMAKE configure.in | cut -d ',' -f 2|tr -d '\)'`
MONO_VERSION=`grep AM_INIT_AUTOMAKE configure.in | cut -d ',' -f 2|tr -d '\)'|tr -d '\('`
if [ -d ./.git ]; then
MONO_GIT_COMMIT="`git log -1 --format=format:%t`"
MONO_GIT_BRANCH="`git branch|grep '\*'|cut -d ' ' -f 2`"
MONO_GIT_BRANCH="`git branch|grep '\*'|cut -d ' ' -f 2|tr -d '\)'|tr -d '\('`"
MONO_RELEASE="$MONO_VERSION-$MONO_GIT_BRANCH-$MONO_GIT_COMMIT"
else
MONO_RELEASE="$MONO_VERSION"
+104 -9
View File
@@ -6,7 +6,7 @@ AC_CANONICAL_SYSTEM
m4_ifdef([_A][M_PROG_TAR],[_A][M_SET_OPTION([tar-ustar])])
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE(mono,2.10.2)
AM_INIT_AUTOMAKE(mono,2.10.6)
AM_MAINTAINER_MODE
API_VER=2.0
@@ -78,6 +78,7 @@ esac
host_win32=no
target_win32=no
platform_android=no
case "$host" in
*-mingw*|*-*-cygwin*)
AC_DEFINE(HOST_WIN32,1,[Host Platform is Win32])
@@ -172,6 +173,41 @@ case "$host" in
with_sigaltstack=no
use_sigposix=yes
;;
*-*-linux-android*)
host_win32=no
platform_android=yes
AC_DEFINE(PLATFORM_ANDROID,1,[Targeting the Android platform])
AC_DEFINE(TARGET_ANDROID,1,[Targeting the Android platform])
CPPFLAGS="$CPPFLAGS -DGC_LINUX_THREADS -D_GNU_SOURCE -D_REENTRANT -DUSE_MMAP"
if test "x$disable_munmap" != "xyes"; then
CPPFLAGS="$CPPFLAGS -DUSE_MUNMAP"
fi
libmono_cflags="-D_REENTRANT"
libdl="-ldl"
libgc_threads=pthreads
use_sigposix=yes
with_tls=pthread
with_sigaltstack=no
with_static_mono=no
# Android doesn't support boehm, as it's missing <link.h>
support_boehm=no
with_gc=sgen
# isinf(3) requires -lm; see isinf check below
LDFLAGS="$LDFLAGS -lm"
# Bionic's <pthread.h> sets PTHREAD_STACK_MIN=2*PAGE_SIZE; doesn't define
# PAGE_SIZE; breaks mono/io-layer/collection.c
# Bionic doesn't provide S_IWRITE; breaks io-layer/io.c
CFLAGS="$CFLAGS -DPAGE_SIZE=4096 -DS_IWRITE=S_IWUSR"
CXXFLAGS="$CXXFLAGS -DPAGE_SIZE=4096 -DS_IWRITE=S_IWUSR"
# to bypass the underscore linker check, can't work when cross-compiling
mono_cv_uscore=yes
;;
*-*-linux*)
host_win32=no
CPPFLAGS="$CPPFLAGS -DGC_LINUX_THREADS -D_GNU_SOURCE -D_REENTRANT -DUSE_MMAP"
@@ -248,12 +284,12 @@ case "$host" in
if test "x$cross_compiling" = "xyes"; then
has_broken_apple_cpp=yes
fi
dnl Snow Leopard is horribly broken -- it reports itself as i386-apple-darwin10.0.0, but
dnl Snow Leopard is horribly broken -- it reports itself as i386-apple-darwin*, but
dnl its gcc defaults to 64-bit mode. They have also deprecated the usage of ucontext
dnl we need to set some flags to build our 32-bit binaries on 10.6 properly
case "$host" in
dnl Snow Leopard config.guess reports as this
i*86-*-darwin10*)
dnl Snow Leopard and newer config.guess reports as this
i*86-*-darwin*)
BROKEN_DARWIN_FLAGS="-arch i386 -D_XOPEN_SOURCE -mmacosx-version-min=10.5"
CPPFLAGS="$CPPFLAGS $BROKEN_DARWIN_FLAGS"
CFLAGS="$CFLAGS $BROKEN_DARWIN_FLAGS"
@@ -294,6 +330,7 @@ AM_CONDITIONAL(TARGET_WIN32, test x$target_win32 = xyes)
AM_CONDITIONAL(PLATFORM_LINUX, echo x$target_os | grep -q linux)
AM_CONDITIONAL(PLATFORM_DARWIN, test x$platform_darwin = xyes)
AM_CONDITIONAL(PLATFORM_SIGPOSIX, test x$use_sigposix = xyes)
AM_CONDITIONAL(PLATFORM_ANDROID, test x$platform_android = xyes)
AC_CHECK_TOOL(CC, gcc, gcc)
AC_PROG_CC
@@ -443,6 +480,20 @@ if test x"$GCC" = xyes; then
AC_MSG_RESULT(no)
CFLAGS=$ORIG_CFLAGS
])
ORIG_CFLAGS=$CFLAGS
# Check for the normal version, since gcc ignores unknown -Wno options
CFLAGS="$CFLAGS -Wunused-but-set-variable"
AC_MSG_CHECKING(for -Wno-unused-but-set-variable option to gcc)
AC_TRY_COMPILE([], [
void main () { }
], [
AC_MSG_RESULT(yes)
CFLAGS="$ORIG_CFLAGS -Wno-unused-but-set-variable"
], [
AC_MSG_RESULT(no)
CFLAGS=$ORIG_CFLAGS
])
else
# The Sun Forte compiler complains about inline functions that access static variables
# so disable all inlining.
@@ -657,7 +708,7 @@ DISABLED_FEATURES=none
AC_ARG_ENABLE(minimal, [ --enable-minimal=LIST drop support for LIST subsystems.
LIST is a comma-separated list from: aot, profiler, decimal, pinvoke, debug,
reflection_emit, reflection_emit_save, large_code, logging, com, ssa, generics, attach, jit, simd, soft_debug, normalization, assembly_remapping.],
reflection_emit, reflection_emit_save, large_code, logging, com, ssa, generics, attach, jit, simd, soft_debug, normalization, assembly_remapping, shared_perfcounters.],
[
for feature in `echo "$enable_minimal" | sed -e "s/,/ /g"`; do
eval "mono_feature_disable_$feature='yes'"
@@ -782,6 +833,11 @@ if test "x$mono_feature_disable_assembly_remapping" = "xyes"; then
AC_MSG_NOTICE([Disabled Assembly remapping.])
fi
if test "x$mono_feature_disable_shared_perfcounters" = "xyes"; then
AC_DEFINE(DISABLE_SHARED_PERFCOUNTERS, 1, [Disable shared perfcounters.])
AC_MSG_NOTICE([Disabled Shared perfcounters.])
fi
AC_MSG_CHECKING(for visibility __attribute__)
AC_TRY_COMPILE([], [
void __attribute__ ((visibility ("hidden"))) doit (void) {}
@@ -813,6 +869,9 @@ if test x$enable_parallel_mark = xyes; then
libgc_configure_args="$libgc_configure_args --enable-parallel-mark"
fi
AC_ARG_ENABLE(boehm, [ --disable-boehm Disable the Boehm GC.], support_boehm=$enableval,support_boehm=${support_boehm:-yes})
AM_CONDITIONAL(SUPPORT_BOEHM, test x$support_boehm = xyes)
dnl
dnl Boehm GC configuration
dnl
@@ -2304,12 +2363,12 @@ case "$host" in
esac
if test "x$host" != "x$target"; then
AC_DEFINE(MONO_CROSS_COMPILE,1,[The runtime is compiled for cross-compiling mode])
case "$target" in
powerpc64-ps3-linux-gnu)
TARGET=POWERPC64
arch_target=powerpc64
AC_DEFINE(TARGET_PS3, 1, [...])
AC_DEFINE(MONO_CROSS_COMPILE,1,[The runtime is compiled for cross-compiling mode])
# It would be better to just use TARGET_POWERPC64, but lots of code already
# uses this define
AC_DEFINE(__mono_ppc64__, 1, [...])
@@ -2322,7 +2381,6 @@ if test "x$host" != "x$target"; then
TARGET=POWERPC64
arch_target=powerpc64
AC_DEFINE(TARGET_XBOX360, 1, [...])
AC_DEFINE(MONO_CROSS_COMPILE,1,[The runtime is compiled for cross-compiling mode])
# It would be better to just use TARGET_POWERPC64, but lots of code already
# uses this define
sizeof_register=8
@@ -2332,12 +2390,49 @@ if test "x$host" != "x$target"; then
TARGET=AMD64
arch_target=amd64
AC_DEFINE(TARGET_AMD64, 1, [...])
AC_DEFINE(MONO_CROSS_COMPILE,1,[The runtime is compiled for cross-compiling mode])
AC_DEFINE(__mono_ilp32__, 1, [64 bit mode with 4 byte longs and pointers])
sizeof_register=8
;;
armv7l-unknown-linux-gnueabi*)
# TEGRA
TARGET=ARM;
arch_target=arm;
AC_DEFINE(TARGET_ARM, 1, [...])
ACCESS_UNALIGNED="no"
JIT_SUPPORTED=yes
CPPFLAGS="$CPPFLAGS -DARM_FPU_VFP=1 -D__ARM_EABI__"
jit_wanted=true
# Can't use tls, since it depends on the runtime detection of tls offsets
# in mono-compiler.h
with_tls=pthread
;;
armv5tel-unknown-linux-gnueabi*)
TARGET=ARM;
arch_target=arm;
AC_DEFINE(TARGET_ARM, 1, [...])
ACCESS_UNALIGNED="no"
JIT_SUPPORTED=yes
CPPFLAGS="$CPPFLAGS -D__ARM_EABI__"
jit_wanted=true
# Can't use tls, since it depends on the runtime detection of tls offsets
# in mono-compiler.h
with_tls=pthread
;;
armv5-*-linux-androideabi*)
TARGET=ARM;
arch_target=arm;
AC_DEFINE(TARGET_ARM, 1, [...])
AC_DEFINE(TARGET_ANDROID, 1, [...])
ACCESS_UNALIGNED="no"
JIT_SUPPORTED=yes
CPPFLAGS="$CPPFLAGS -D__ARM_EABI__ -DARM_FPU_NONE=1"
jit_wanted=true
# Can't use tls, since it depends on the runtime detection of tls offset
# in mono-compiler.h
with_tls=pthread
;;
*)
AC_MSG_WARN([Cross compiling is only supported for targets matching 'powerpc64-{ps3,xbox360}-linux-gnu'])
AC_MSG_ERROR([Cross compiling is not supported for target $target])
esac
fi
+1
View File
@@ -17,6 +17,7 @@
<dllmap dll="sqlite3" target="@SQLITE3@" os="!windows"/>
<dllmap dll="libX11" target="@X11@" os="!windows" />
<dllmap dll="libcairo-2.dll" target="libcairo.so.2" os="!windows"/>
<dllmap dll="libcairo-2.dll" target="libcairo.2.dylib" os="osx"/>
<dllmap dll="libcups" target="libcups.so.2" os="!windows"/>
<dllmap dll="libcups" target="libcups.dylib" os="osx"/>
<dllmap dll="i:kernel32.dll">
+10
View File
@@ -40,6 +40,7 @@ AM_CONDITIONAL(CROSS_COMPILING, [test x$cross_compiling = xyes])
AC_C_BIGENDIAN([ORDER=G_BIG_ENDIAN],[ORDER=G_LITTLE_ENDIAN])
platform_darwin=no
platform_android=no
case $host in
*-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*)
@@ -55,6 +56,14 @@ case $host in
OS="UNIX"
PIDTYPE='int'
;;
*-*-linux-android*)
platform_android=yes
AC_DEFINE(PLATFORM_ANDROID,1,[Targeting the Android platform])
PATHSEP='/'
SEARCHSEP=':'
OS="UNIX"
PIDTYPE='int'
;;
*)
PATHSEP='/'
SEARCHSEP=':'
@@ -91,6 +100,7 @@ AC_SUBST(PIDTYPE)
AM_CONDITIONAL(HOST_WIN32, test x$OS = xWIN32)
AM_CONDITIONAL(TARGET_WIN32, test x$OS = xWIN32)
AM_CONDITIONAL(PLATFORM_DARWIN, test x$platform_darwin = xyes)
AM_CONDITIONAL(PLATFORM_ANDROID, test x$platform_android = xyes)
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(void *)
+4
View File
@@ -61,6 +61,10 @@ INCLUDES = -I$(srcdir)
if HOST_WIN32
libeglib_la_LIBADD = -lm $(ICONV_LIBS) -lpsapi
else
if PLATFORM_ANDROID
libeglib_la_LIBADD = -llog
endif
endif
libeglib_static_la_LIBADD = $(libeglib_la_LIBADD)
+2
View File
@@ -114,7 +114,9 @@ typedef int32_t gboolean;
#define G_USEC_PER_SEC 1000000
#ifndef ABS
#define ABS(a) ((a) > 0 ? (a) : -(a))
#endif
#define G_STRUCT_OFFSET(p_type,field) offsetof(p_type,field)
+8 -9
View File
@@ -24,6 +24,7 @@
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <glib.h>
@@ -111,28 +112,26 @@ g_log_set_fatal_mask (const gchar *log_domain, GLogLevelFlags fatal_mask)
void
g_logv (const gchar *log_domain, GLogLevelFlags log_level, const gchar *format, va_list args)
{
#if PLATFORM_ANDROID
__android_log_vprint (to_android_priority (log_level), log_domain, format, args);
#else
char *msg;
vasprintf (&msg, format, args);
#if PLATFORM_ANDROID
__android_log_print (to_android_priority (log_level),
/* TODO: provide a proper app name */
"mono", "%s%s%s",
log_domain != NULL ? log_domain : "",
log_domain != NULL ? ": " : "",
msg);
#else
printf ("%s%s%s\n",
log_domain != NULL ? log_domain : "",
log_domain != NULL ? ": " : "",
msg);
#endif
free (msg);
if (log_level & fatal){
fflush (stdout);
fflush (stderr);
abort ();
}
#endif
if (log_level & fatal){
abort ();
}
}
void
+3 -1
View File
@@ -68,7 +68,9 @@ g_build_path (const gchar *separator, const gchar *first_element, ...)
g_string_append_len (result, s, p - s);
if (next && *next){
if (strncmp (separator, result->str + strlen (result->str) - slen, slen))
int reslen = strlen (result->str);
if (reslen >= slen && strncmp (separator, result->str + reslen - slen, slen))
g_string_append (result, separator);
for (; strncmp (next, separator, slen) == 0; )
+1 -1
View File
@@ -225,7 +225,7 @@ g_shell_unquote (const gchar *quoted_string, GError **error)
}
} else if (*p == '\\'){
char c = *(++p);
if (!(c == '$' || c == '"' || c == '\\' || c == '`' || c == 0))
if (!(c == '$' || c == '"' || c == '\\' || c == '`' || c == '\'' || c == 0 ))
g_string_append_c (result, '\\');
if (c == 0)
break;
+2
View File
@@ -371,6 +371,8 @@ void GC_print_callers GC_PROTO((struct callinfo info[NFRAMES]));
# define GC_MACH_THREAD_STATE_FLAVOR PPC_THREAD_STATE
# elif defined(I386)
# define GC_MACH_THREAD_STATE_FLAVOR i386_THREAD_STATE
# elif defined(X86_64)
# define GC_MACH_THREAD_STATE_FLAVOR x86_THREAD_STATE64
# else
# define GC_MACH_THREAD_STATE_FLAVOR MACHINE_THREAD_STATE
# endif
+8 -1
View File
@@ -2131,7 +2131,14 @@ void GC_unmap_gap(ptr_t start1, word bytes1, ptr_t start2, word bytes2)
len -= free_len;
}
# else
if (len != 0 && munmap(start_addr, len) != 0) ABORT("munmap failed");
if (len != 0) {
/* Immediately remap as above. */
void * result;
result = mmap(start_addr, len, PROT_NONE,
MAP_PRIVATE | MAP_FIXED | OPT_MAP_ANON,
zero_fd, 0/* offset */);
if (result != (void *)start_addr) ABORT("mmap(...PROT_NONE...) failed");
}
GC_unmapped_bytes += len;
# endif
}
+4 -4
View File
@@ -729,7 +729,7 @@ void nacl_shutdown_gc_thread()
/* Caller holds allocation lock. */
GC_thread GC_new_thread(pthread_t id)
{
int hv = ((word)id) % THREAD_TABLE_SZ;
int hv = ((unsigned long)id) % THREAD_TABLE_SZ;
GC_thread result;
static GC_bool first_thread_used = FALSE;
@@ -760,7 +760,7 @@ GC_thread GC_new_thread(pthread_t id)
/* Caller holds allocation lock. */
void GC_delete_thread(pthread_t id)
{
int hv = ((word)id) % THREAD_TABLE_SZ;
int hv = ((unsigned long)id) % THREAD_TABLE_SZ;
register GC_thread p = GC_threads[hv];
register GC_thread prev = 0;
@@ -796,7 +796,7 @@ void GC_delete_thread(pthread_t id)
/* This is OK, but we need a way to delete a specific one. */
void GC_delete_gc_thread(pthread_t id, GC_thread gc_id)
{
int hv = ((word)id) % THREAD_TABLE_SZ;
int hv = ((unsigned long)id) % THREAD_TABLE_SZ;
register GC_thread p = GC_threads[hv];
register GC_thread prev = 0;
@@ -825,7 +825,7 @@ void GC_delete_gc_thread(pthread_t id, GC_thread gc_id)
/* return the most recent one. */
GC_thread GC_lookup_thread(pthread_t id)
{
int hv = ((word)id) % THREAD_TABLE_SZ;
int hv = ((unsigned long)id) % THREAD_TABLE_SZ;
register GC_thread p = GC_threads[hv];
while (p != 0 && !pthread_equal(p -> id, id)) p = p -> next;
+3
View File
@@ -1410,6 +1410,9 @@ be used when writing messages like this: Console.Error:MyProgramName.
See the System.Diagnostics.DefaultTraceListener documentation for more
information.
.TP
\fBMONO_WCF_TRACE\fR
This eases WCF diagnostics functionality by simply outputs all log messages from WCF engine to "stdout", "stderr" or any file passed to this environment variable. The log format is the same as usual diagnostic output.
.TP
\fBMONO_XEXCEPTIONS\fR
This throws an exception when a X11 error is encountered; by default a
message is displayed but execution continues
+2
View File
@@ -26,6 +26,8 @@ PLATFORM_MAKE_CORLIB_CMP = yes
PLATFORM_CHANGE_SEPARATOR_CMD=tr '/' '\\\\'
PLATFORM_PATH_SEPARATOR = ;
override CURDIR:=$(shell cygpath -m $(CURDIR))
## not so simple :-)
#PLATFORM_AOT_SUFFIX = .dll
+1 -1
View File
@@ -22,7 +22,7 @@ EXTRA_DISTFILES = \
$(RESOURCE_FILES)
Commons.Xml.Relaxng.Rnc/RncParser.cs: Commons.Xml.Relaxng.Rnc/RncParser.jay $(topdir)/jay/skeleton.cs
$(topdir)/jay/jay -ctv < $(topdir)/jay/skeleton.cs Commons.Xml.Relaxng.Rnc/RncParser.jay > Commons.Xml.Relaxng.Rnc/RncParser.cs
$(topdir)/jay/jay -ctv < $(topdir)/jay/skeleton.cs $(CURDIR)/Commons.Xml.Relaxng.Rnc/RncParser.jay > Commons.Xml.Relaxng.Rnc/RncParser.cs
BUILT_SOURCES = Commons.Xml.Relaxng.Rnc/RncParser.cs
@@ -1,3 +1,9 @@
2011-05-05 Veerapuram Varadhan <[email protected]>
** Fixes #681916
* Tds70.cs (WriteParameterInfo): Handle null value for Image
or varbinary(max) parameters as well.
2010-09-29 Veerapuram Varadhan <[email protected]>
** Fixes failed test for smallmoney
@@ -615,7 +615,8 @@ namespace Mono.Data.Tds.Protocol
// types if param value is NULL
if ((colType == TdsColumnType.BigVarChar ||
colType == TdsColumnType.BigNVarChar ||
colType == TdsColumnType.BigVarBinary) &&
colType == TdsColumnType.BigVarBinary ||
colType == TdsColumnType.Image) &&
(param.Value == null || param.Value == DBNull.Value))
size = -1;
else
@@ -356,7 +356,8 @@ namespace Mono.Debugger.Soft
BREAKPOINT = 10,
STEP = 11,
TYPE_LOAD = 12,
EXCEPTION = 13
EXCEPTION = 13,
KEEPALIVE = 14
}
enum ModifierKind {
@@ -377,7 +378,8 @@ namespace Mono.Debugger.Soft
DISPOSE = 6,
INVOKE_METHOD = 7,
SET_PROTOCOL_VERSION = 8,
ABORT_INVOKE = 9
ABORT_INVOKE = 9,
SET_KEEPALIVE = 10
}
enum CmdEvent {
@@ -1166,6 +1168,8 @@ namespace Mono.Debugger.Soft
long id = r.ReadId ();
events [i] = new EventInfo (etype, req_id) { ThreadId = thread_id, Id = id };
//EventHandler.AppDomainUnload (req_id, thread_id, id);
} else if (kind == EventKind.KEEPALIVE) {
events [i] = new EventInfo (etype, req_id) { };
} else {
throw new NotImplementedException ("Unknown event kind: " + kind);
}
@@ -1381,6 +1385,13 @@ namespace Mono.Debugger.Soft
SendReceive (CommandSet.VM, (int)CmdVM.ABORT_INVOKE, new PacketWriter ().WriteId (thread).WriteInt (id));
}
public void SetSocketTimeouts (int send_timeout, int receive_timeout, int keepalive_interval)
{
socket.SendTimeout = send_timeout;
socket.ReceiveTimeout = receive_timeout;
SendReceive (CommandSet.VM, (int)CmdVM.SET_KEEPALIVE, new PacketWriter ().WriteId (keepalive_interval));
}
/*
* DOMAIN
*/
@@ -17,7 +17,8 @@ namespace Mono.Debugger.Soft
Step = 11,
TypeLoad = 12,
Exception = 13,
KeepAlive = 14,
// Not part of the wire protocol
VMDisconnect = 99
}
}
}
@@ -160,6 +160,16 @@ namespace Mono.Debugger.Soft
return new EnumMirror (this, type, value);
}
//
// Enable send and receive timeouts on the connection and send a keepalive event
// every 'keepalive_interval' milliseconds.
//
public void SetSocketTimeouts (int send_timeout, int receive_timeout, int keepalive_interval)
{
conn.SetSocketTimeouts (send_timeout, receive_timeout, keepalive_interval);
}
//
// Methods to create event request objects
//
@@ -39,9 +39,7 @@ namespace Mono.Security.Protocol.Tls
#region Fields
static ManualResetEvent record_processing = new ManualResetEvent (true);
private const int WaitTimeOut = 5 * 60 * 1000;
static ManualResetEvent record_processing = new ManualResetEvent (true);
internal Stream innerStream;
internal MemoryStream inputBuffer;
@@ -875,7 +873,7 @@ namespace Mono.Security.Protocol.Tls
// Always wait until the read is complete
if (!asyncResult.IsCompleted)
{
if (!asyncResult.AsyncWaitHandle.WaitOne (WaitTimeOut, false))
if (!asyncResult.AsyncWaitHandle.WaitOne ())
throw new TlsException (AlertDescription.InternalError, "Couldn't complete EndRead");
}
@@ -900,7 +898,7 @@ namespace Mono.Security.Protocol.Tls
if (!asyncResult.IsCompleted)
{
if (!internalResult.AsyncWaitHandle.WaitOne (WaitTimeOut, false))
if (!internalResult.AsyncWaitHandle.WaitOne ())
throw new TlsException (AlertDescription.InternalError, "Couldn't complete EndWrite");
}
+2 -2
View File
@@ -28,13 +28,13 @@ Mono.Xml.XPath2/XQueryParser.jay: Mono.Xml.XPath2/ParserBase.jay $(SKELETON)
Mono.Xml.XPath2/XPath2Parser.cs: Mono.Xml.XPath2/XPath2Parser.jay
echo "#define XPATH2_PARSER" > $@
echo "#if NET_2_0" >> $@
$(topdir)/jay/jay -ct < $(SKELETON) $< >>$@
$(topdir)/jay/jay -ct < $(SKELETON) $(CURDIR)/$< >>$@
echo "#endif" >> $@
Mono.Xml.XPath2/XQueryParser.cs: Mono.Xml.XPath2/XQueryParser.jay $(SKELETON)
echo "#define XQUERY_PARSER" > $@
echo "#if NET_2_0" >> $@
$(topdir)/jay/jay -ct < $(SKELETON) $< >>$@
$(topdir)/jay/jay -ct < $(SKELETON) $(CURDIR)/$< >>$@
echo "#endif" >> $@
Mono.Xml.XPath2/XPath2Tokenizer.cs: Mono.Xml.XPath2/TokenizerBase.cs
@@ -38,6 +38,18 @@ using System.IO;
namespace System.Configuration {
// For configuration document, use this XmlDocument instead of the standard one. This ignores xmlns attribute for MS.
internal class ConfigurationXmlDocument : XmlDocument
{
public override XmlElement CreateElement (string prefix, string localName, string namespaceURI)
{
if (namespaceURI == "http://schemas.microsoft.com/.NetConfiguration/v2.0")
return base.CreateElement (String.Empty, localName, String.Empty);
else
return base.CreateElement (prefix, localName, namespaceURI);
}
}
public sealed class Configuration
{
Configuration parent;
@@ -111,7 +111,7 @@ namespace System.Configuration
// ignore, it can fail - we deserialize only in order to get
// the configSource attribute
}
XmlDocument doc = new XmlDocument ();
XmlDocument doc = new ConfigurationXmlDocument ();
doc.LoadXml (RawXml);
return SectionHandler.Create (parent, ConfigContext, doc.DocumentElement);
}
@@ -159,7 +159,7 @@ namespace System.Configuration
{
if (protection_provider != null) {
ProtectedConfigurationProvider prov = ProtectedConfiguration.GetProvider (protection_provider, true);
XmlDocument doc = new XmlDocument ();
XmlDocument doc = new ConfigurationXmlDocument ();
reader.MoveToElement ();
@@ -69,7 +69,7 @@ namespace System.Configuration
internal string EncryptSection (string clearXml, ProtectedConfigurationProvider protectionProvider)
{
XmlDocument doc = new XmlDocument ();
XmlDocument doc = new ConfigurationXmlDocument ();
doc.LoadXml (clearXml);
XmlNode encryptedNode = protectionProvider.Encrypt (doc.DocumentElement);
@@ -79,7 +79,7 @@ namespace System.Configuration
internal string DecryptSection (string encryptedXml, ProtectedConfigurationProvider protectionProvider)
{
XmlDocument doc = new XmlDocument ();
XmlDocument doc = new ConfigurationXmlDocument ();
doc.InnerXml = encryptedXml;
XmlNode decryptedNode = protectionProvider.Decrypt (doc.DocumentElement);
@@ -66,7 +66,7 @@ namespace System.Configuration
[MonoTODO]
public override XmlNode Decrypt (XmlNode encrypted_node)
{
XmlDocument doc = new XmlDocument ();
XmlDocument doc = new ConfigurationXmlDocument ();
doc.Load (new StringReader (encrypted_node.OuterXml));
@@ -82,7 +82,7 @@ namespace System.Configuration
[MonoTODO]
public override XmlNode Encrypt (XmlNode node)
{
XmlDocument doc = new XmlDocument ();
XmlDocument doc = new ConfigurationXmlDocument ();
doc.Load (new StringReader (node.OuterXml));
@@ -59,7 +59,11 @@ namespace System.Linq {
if (qe == null)
return constant;
return Expression.Constant (qe.GetEnumerable ());
var enumerable = qe.GetEnumerable ();
if (enumerable != null)
return Expression.Constant (enumerable);
return Visit (qe.Expression);
}
static bool IsQueryableExtension (MethodInfo method)
@@ -329,6 +329,9 @@ namespace System
#if MONODROID
return ZoneInfoDB.GetTimeZone (id);
#elif LIBC
// Local requires special logic that already exists in the Local property (bug #326)
if (id == "Local")
return Local;
string filepath = Path.Combine (TimeZoneDirectory, id);
return FindSystemTimeZoneByFileName (id, filepath);
#else
@@ -540,6 +540,20 @@ namespace MonoTests.System
TimeZoneInfo vatican = TimeZoneInfo.FindSystemTimeZoneById ("Europe/Vatican");
Assert.IsTrue (rome.HasSameRules (vatican));
}
[Test]
public void FindSystemTimeZoneById_Local_Roundtrip ()
{
Assert.AreEqual (TimeZoneInfo.Local.Id, TimeZoneInfo.FindSystemTimeZoneById (TimeZoneInfo.Local.Id).Id);
}
[Test]
public void Test326 ()
{
DateTime utc = DateTime.UtcNow;
DateTime local = TimeZoneInfo.ConvertTime (utc, TimeZoneInfo.Utc, TimeZoneInfo.FindSystemTimeZoneById (TimeZoneInfo.Local.Id));
Assert.AreEqual (local, utc + TimeZoneInfo.Local.GetUtcOffset (utc), "ConvertTime/Local");
}
#if SLOW_TESTS
[Test]
@@ -1,4 +1,4 @@
//
//
// OciCalls.cs
//
// Part of the Mono class libraries at
@@ -464,7 +464,7 @@ namespace System.Data.OracleClient.Oci
[MarshalAs (UnmanagedType.U4)] int dstlen,
byte [] src,
[MarshalAs (UnmanagedType.U4)] int srclen,
[MarshalAs (UnmanagedType.U4)] out int rsize);
[MarshalAs (UnmanagedType.SysUInt)] ref UIntPtr rsizep);
[DllImport ("oci")]
internal static extern int OCIUnicodeToCharSet (
@@ -473,7 +473,7 @@ namespace System.Data.OracleClient.Oci
[MarshalAs (UnmanagedType.U4)] int dstlen,
[MarshalAs (UnmanagedType.LPWStr)] string src,
[MarshalAs (UnmanagedType.U4)] int srclen,
[MarshalAs (UnmanagedType.U4)] out int rsize);
[MarshalAs (UnmanagedType.SysUInt)] ref UIntPtr rsizep);
}
#endregion
@@ -1183,26 +1183,26 @@ namespace System.Data.OracleClient.Oci
IntPtr svchp,
StringBuilder dst,
byte [] src,
out int rsize)
[MarshalAs (UnmanagedType.SysUInt)] ref UIntPtr rsizep)
{
#if TRACE
Trace.WriteLineIf(traceOci, "OCICharSetToUnicode", "OCI");
#endif
return OciNativeCalls.OCICharSetToUnicode (svchp, dst, dst!=null ? dst.Capacity : 0, src, src.Length, out rsize);
return OciNativeCalls.OCICharSetToUnicode (svchp, dst, dst!=null ? dst.Capacity : 0, src, src.Length, ref rsizep);
}
internal static int OCIUnicodeToCharSet (
IntPtr svchp,
byte [] dst,
[MarshalAs (UnmanagedType.LPWStr)] string src,
[MarshalAs (UnmanagedType.U4)] out int rsize)
[MarshalAs (UnmanagedType.SysUInt)] ref UIntPtr rsizep)
{
#if TRACE
Trace.WriteLineIf(traceOci, "OCIUnicodeToCharSet", "OCI");
#endif
return OciNativeCalls.OCIUnicodeToCharSet (svchp, dst, dst!=null ? dst.Length : 0, src, src.Length, out rsize);
return OciNativeCalls.OCIUnicodeToCharSet (svchp, dst, dst!=null ? dst.Length : 0, src, src.Length, ref rsizep);
}
[DllImport ("oci")]
@@ -1,4 +1,4 @@
//
//
// OciDateTimeDescriptor.cs - used for an Oracle TIMESTAMP
//
// Part of managed C#/.NET library System.Data.OracleClient.dll
@@ -64,13 +64,15 @@ namespace System.Data.OracleClient.Oci {
byte hour, byte min, byte sec, uint fsec, string timezone)
{
// Get size of buffer
int rsize = 0;
int status = OciCalls.OCIUnicodeToCharSet (handle, null, timezone, out rsize);
ulong rsize = 0;
UIntPtr rsizep = new UIntPtr (rsize);
int status = OciCalls.OCIUnicodeToCharSet (handle, null, timezone, ref rsizep);
// Fill buffer
rsize = rsizep.ToUInt64 ();
byte[] bytes = new byte[rsize];
if (status == 0 && rsize > 0)
OciCalls.OCIUnicodeToCharSet (handle, bytes, timezone, out rsize);
OciCalls.OCIUnicodeToCharSet (handle, bytes, timezone, ref rsizep);
if (fsec > 0)
fsec = fsec * 1000000;
@@ -1,4 +1,4 @@
//
//
// OciDefineHandle.cs
//
// Part of managed C#/.NET library System.Data.OracleClient.dll
@@ -516,15 +516,17 @@ namespace System.Data.OracleClient.Oci
Marshal.Copy (Value, buffer, 0, Size);
// Get length of returned string
int rsize = 0;
ulong rsize = 0;
UIntPtr rsizep = new UIntPtr (rsize);
//IntPtr env = Parent.Parent; // Parent is statement, grandparent is environment
IntPtr env = conn.Environment;
int status = OciCalls.OCICharSetToUnicode (env, null, buffer, out rsize);
int status = OciCalls.OCICharSetToUnicode (env, null, buffer, ref rsizep);
OciErrorHandle.ThrowExceptionIfError (ErrorHandle, status);
// Get string
StringBuilder ret = new StringBuilder(rsize);
status = OciCalls.OCICharSetToUnicode (env, ret, buffer, out rsize);
rsize = rsizep.ToUInt64 ();
StringBuilder ret = new StringBuilder((int)rsize);
status = OciCalls.OCICharSetToUnicode (env, ret, buffer, ref rsizep);
OciErrorHandle.ThrowExceptionIfError (ErrorHandle, status);
return ret.ToString ();
@@ -66,8 +66,9 @@ namespace System.Data.OracleClient.Oci {
if (h == null)
throw new Exception ("Internal driver error: handle is null.");
int errbufSize = 4096;
IntPtr errbuf = OciCalls.AllocateClear (errbufSize);
ulong errbufSize = 4096;
UIntPtr errbufSizep = new UIntPtr (errbufSize);
IntPtr errbuf = OciCalls.AllocateClear ((int)errbufSize);
OciCalls.OCIErrorGet (hwnd,
1,
@@ -78,15 +79,16 @@ namespace System.Data.OracleClient.Oci {
OciHandleType.Error);
byte[] bytea = new byte[errbufSize];
Marshal.Copy (errbuf, bytea, 0, errbufSize);
Marshal.Copy (errbuf, bytea, 0, (int)errbufSize);
errbufSize = 0;
// first call to OCICharSetToUnicode gets the size
OciCalls.OCICharSetToUnicode (h, null, bytea, out errbufSize);
StringBuilder str = new StringBuilder (errbufSize);
OciCalls.OCICharSetToUnicode (h, null, bytea, ref errbufSizep);
errbufSize = errbufSizep.ToUInt64 ();
StringBuilder str = new StringBuilder ((int)errbufSize);
// second call to OCICharSetToUnicode gets the string
OciCalls.OCICharSetToUnicode (h, str, bytea, out errbufSize);
OciCalls.OCICharSetToUnicode (h, str, bytea, ref errbufSizep);
string errmsg = String.Empty;
if (errbufSize > 0) {
@@ -104,8 +106,9 @@ namespace System.Data.OracleClient.Oci {
info.ErrorCode = 0;
info.ErrorMessage = String.Empty;
int errbufSize = 4096;
IntPtr errbuf = OciCalls.AllocateClear (errbufSize);
ulong errbufSize = 4096;
UIntPtr errbufSizep = new UIntPtr (errbufSize);
IntPtr errbuf = OciCalls.AllocateClear ((int)errbufSize);
OciCalls.OCIErrorGet (hand,
1,
@@ -116,7 +119,7 @@ namespace System.Data.OracleClient.Oci {
OciHandleType.Error);
byte[] bytea = new byte[errbufSize];
Marshal.Copy (errbuf, bytea, 0, errbufSize);
Marshal.Copy (errbuf, bytea, 0, (int)errbufSize);
errbufSize = 0;
OciHandle h = hand.Parent;
@@ -126,11 +129,12 @@ namespace System.Data.OracleClient.Oci {
throw new Exception ("Internal driver error: handle is null.");
// first call to OCICharSetToUnicode gets the size
OciCalls.OCICharSetToUnicode (h, null, bytea, out errbufSize);
StringBuilder str = new StringBuilder (errbufSize);
OciCalls.OCICharSetToUnicode (h, null, bytea, ref errbufSizep);
errbufSize = errbufSizep.ToUInt64 ();
StringBuilder str = new StringBuilder ((int)errbufSize);
// second call to OCICharSetToUnicode gets the string
OciCalls.OCICharSetToUnicode (h, str, bytea, out errbufSize);
OciCalls.OCICharSetToUnicode (h, str, bytea, ref errbufSizep);
string errmsg = String.Empty;
if (errbufSize > 0)
@@ -19,6 +19,7 @@
using System;
using System.Collections;
using System.Text;
using System.Runtime.InteropServices;
namespace System.Data.OracleClient.Oci {
@@ -253,15 +254,20 @@ namespace System.Data.OracleClient.Oci {
throw new InvalidOperationException ("StatementHandle is already disposed.");
}
int rsize = 0;
ulong rsize = 0;
byte [] buffer;
UIntPtr rsizep = new UIntPtr (rsize);
// Get size of buffer
OciCalls.OCIUnicodeToCharSet (Parent, null, commandText, out rsize);
OciCalls.OCIUnicodeToCharSet (Parent, null, commandText, ref rsizep);
rsize = rsizep.ToUInt64 ();
//rsize = Encoding.UTF8.GetMaxByteCount (commandText.Length+1);
// Fill buffer
buffer = new byte[rsize];
OciCalls.OCIUnicodeToCharSet (Parent, buffer, commandText, out rsize);
OciCalls.OCIUnicodeToCharSet (Parent, buffer, commandText, ref rsizep);
// Execute statement
status = OciCalls.OCIStmtPrepare (this,
@@ -1,3 +1,10 @@
2011-05-05 Veerapuram Varadhan <[email protected]>
* OracleConnection.cs (GetOracleVersion, GetNlsInfo):
* OracleParameter.cs: Use UIntPtr for referencing size_t
parameters to fix 32/64 bit - big/little-endian issues
while calling native methods.
2010-02-14 Veerapuram Varadhan <[email protected]>
** Fixes 667855
@@ -220,13 +220,15 @@ namespace System.Data.OracleClient
OciCalls.OCIServerVersion (sh, eh, ref buffer, bufflen, OciHandleType.Service);
// Get length of returned string
int rsize = 0;
ulong rsize = 0;
UIntPtr rsizep = new UIntPtr (rsize);
IntPtr env = oci.Environment;
OciCalls.OCICharSetToUnicode (env, null, buffer, out rsize);
OciCalls.OCICharSetToUnicode (env, null, buffer, ref rsizep);
// Get string
StringBuilder ret = new StringBuilder(rsize);
OciCalls.OCICharSetToUnicode (env, ret, buffer, out rsize);
rsize = rsizep.ToUInt64 ();
StringBuilder ret = new StringBuilder((int)rsize);
OciCalls.OCICharSetToUnicode (env, ret, buffer, ref rsizep);
return ret.ToString ();
}
@@ -371,12 +373,14 @@ namespace System.Data.OracleClient
ref buffer, bufflen, (ushort) item);
// Get length of returned string
int rsize = 0;
OciCalls.OCICharSetToUnicode (Environment, null, buffer, out rsize);
ulong rsize = 0;
UIntPtr rsizep = new UIntPtr (rsize);
OciCalls.OCICharSetToUnicode (Environment, null, buffer, ref rsizep);
// Get string
StringBuilder ret = new StringBuilder (rsize);
OciCalls.OCICharSetToUnicode (Environment, ret, buffer, out rsize);
rsize = rsizep.ToUInt64 ();
StringBuilder ret = new StringBuilder ((int)rsize);
OciCalls.OCICharSetToUnicode (Environment, ret, buffer, ref rsizep);
return ret.ToString ();
}
@@ -431,8 +431,9 @@ namespace System.Data.OracleClient
object v = value;
int status = 0;
bindType = ociType;
int rsize = 0;
ulong rsize = 0;
UIntPtr rsizep = new UIntPtr (rsize);
string svalue;
string sDate;
DateTime dt;
@@ -482,10 +483,10 @@ namespace System.Data.OracleClient
// in this case using OCIUnicodeToCharSet
rsize = 0;
// Get size of buffer
status = OciCalls.OCIUnicodeToCharSet (statement.Parent, null, svalue, out rsize);
status = OciCalls.OCIUnicodeToCharSet (statement.Parent, null, svalue, ref rsizep);
rsize = rsizep.ToUInt64 ();
if (direction == ParameterDirection.Input)
bindSize = rsize;
bindSize = (int)rsize;
else {
// this cannot be rsize because you need room for the output after the execute
bindSize = Encoding.UTF8.GetMaxByteCount (Size + 1);
@@ -495,7 +496,7 @@ namespace System.Data.OracleClient
bytes = new byte [bindSize];
// Fill buffer
status = OciCalls.OCIUnicodeToCharSet (statement.Parent, bytes, svalue, out rsize);
status = OciCalls.OCIUnicodeToCharSet (statement.Parent, bytes, svalue, ref rsizep);
} else {
// for Output and ReturnValue parameters, get size in bytes
bindSize = Encoding.UTF8.GetMaxByteCount (size + 1);
@@ -612,17 +613,17 @@ namespace System.Data.OracleClient
rsize = 0;
// Get size of buffer
OciCalls.OCIUnicodeToCharSet (statement.Parent, null, svalue, out rsize);
OciCalls.OCIUnicodeToCharSet (statement.Parent, null, svalue, ref rsizep);
// Fill buffer
rsize = rsizep.ToUInt64 ();
if (direction == ParameterDirection.Input)
bindSize = rsize;
bindSize = (int)rsize;
else
bindSize = 30; // need room for output possibly being bigger than the input
bytes = new byte [bindSize];
OciCalls.OCIUnicodeToCharSet (statement.Parent, bytes, svalue, out rsize);
OciCalls.OCIUnicodeToCharSet (statement.Parent, bytes, svalue, ref rsizep);
} else {
// Output and ReturnValue parameters allocate memory
bindSize = 30;
@@ -672,11 +673,12 @@ namespace System.Data.OracleClient
rsize = 0;
// Get size of buffer
OciCalls.OCIUnicodeToCharSet (statement.Parent, null, svalue, out rsize);
OciCalls.OCIUnicodeToCharSet (statement.Parent, null, svalue, ref rsizep);
// Fill buffer
rsize = rsizep.ToUInt64 ();
bytes = new byte[rsize];
OciCalls.OCIUnicodeToCharSet (statement.Parent, bytes, svalue, out rsize);
OciCalls.OCIUnicodeToCharSet (statement.Parent, bytes, svalue, ref rsizep);
bindType = OciDataType.Long;
bindSize = bytes.Length;
@@ -1245,7 +1247,8 @@ namespace System.Data.OracleClient
if (indicator == -1)
return;
int rsize = 0;
ulong rsize = 0;
UIntPtr rsizep = new UIntPtr (rsize);
IntPtr env = IntPtr.Zero;
StringBuilder ret = null;
@@ -1263,11 +1266,12 @@ namespace System.Data.OracleClient
// Get length of returned string
rsize = 0;
env = cmd.Connection.Environment;
OciCalls.OCICharSetToUnicode (env, null, bytes, out rsize);
OciCalls.OCICharSetToUnicode (env, null, bytes, ref rsizep);
// Get string
ret = new StringBuilder(rsize);
OciCalls.OCICharSetToUnicode (env, ret, bytes, out rsize);
rsize = rsizep.ToUInt64 ();
ret = new StringBuilder((int)rsize);
OciCalls.OCICharSetToUnicode (env, ret, bytes, ref rsizep);
value = ret.ToString ();
break;
@@ -1312,11 +1316,12 @@ namespace System.Data.OracleClient
case OciDataType.Float:
rsize = 0;
env = cmd.Connection.Environment;
OciCalls.OCICharSetToUnicode (env, null, bytes, out rsize);
OciCalls.OCICharSetToUnicode (env, null, bytes, ref rsizep);
// Get string
ret = new StringBuilder(rsize);
OciCalls.OCICharSetToUnicode (env, ret, bytes, out rsize);
rsize = rsizep.ToUInt64 ();
ret = new StringBuilder((int)rsize);
OciCalls.OCICharSetToUnicode (env, ret, bytes, ref rsizep);
// if not empty, parse string as a decimal using session format
if (ret.Length > 0) {
+1 -1
View File
@@ -63,7 +63,7 @@ EXTRA_DISTFILES = \
BUILT_SOURCES = Mono.Data.SqlExpressions/Parser.cs
Mono.Data.SqlExpressions/Parser.cs: Mono.Data.SqlExpressions/Parser.jay $(topdir)/jay/skeleton.cs
$(topdir)/jay/jay -ct < $(topdir)/jay/skeleton.cs $< >$@
$(topdir)/jay/jay -vct < $(topdir)/jay/skeleton.cs $(CURDIR)/$< >$@
include ../../build/library.make
@@ -6,6 +6,7 @@
// Juraj Skripsky ([email protected])
//
// (C) 2004 HotFeet GmbH (http://www.hotfeet.ch)
// Copyright 2011 Xamarin Inc (http://www.xamarin.com)
//
using System;
@@ -190,6 +191,7 @@ LiteralValue
| NumberLiteral { $$ = new Literal ($1); }
| DateLiteral { $$ = new Literal ($1); }
| BoolLiteral
| NULL { $$ = new Literal (null); }
;
BoolLiteral
@@ -271,28 +273,20 @@ AggFunctionName
;
StringExpr
: PAROPEN StringExpr PARCLOSE
{
$$ = (IExpression)$2;
}
| SingleColumnValue
: SingleColumnValue
| StringLiteral { $$ = new Literal ($1); }
| StringFunction
| Function
;
StringFunction
: TRIM PAROPEN StringExpr PARCLOSE
: TRIM PAROPEN ArithExpr PARCLOSE
{
$$ = new TrimFunction ((IExpression)$3);
}
| SUBSTRING PAROPEN StringExpr COMMA ArithExpr COMMA ArithExpr PARCLOSE
| SUBSTRING PAROPEN ArithExpr COMMA ArithExpr COMMA ArithExpr PARCLOSE
{
$$ = new SubstringFunction ((IExpression)$3, (IExpression)$5, (IExpression)$7);
}
| StringExpr PLUS StringExpr
{
$$ = new ConcatFunction ((IExpression)$1, (IExpression)$3);
}
;
CalcFunction
@@ -55,42 +55,6 @@ namespace Mono.Data.SqlExpressions {
}
}
internal class ConcatFunction : StringFunction
{
readonly IExpression _add;
public ConcatFunction (IExpression e, IExpression add)
: base (e)
{
_add = add;
}
public override bool Equals(object obj)
{
if (!base.Equals (obj))
return false;
if (!(obj is ConcatFunction))
return false;
ConcatFunction other = (ConcatFunction) obj;
return _add.Equals (other._add);
}
public override int GetHashCode()
{
int hashCode = base.GetHashCode ();
hashCode ^= _add.GetHashCode ();
return hashCode;
}
override public object Eval (DataRow row) {
string str = (string) base.Eval (row);
string x = (string) _add.Eval (row);
return str + x;
}
}
internal class SubstringFunction : StringFunction {
IExpression start;
IExpression len;
@@ -1,3 +1,9 @@
2011-05-05 Veerapuram Varadhan <[email protected]>
** Fixes 688773
* RecordCache.cs (CopyRecord): When copying records, assign default value
for the columns that does not exist in the row being imported.
2010-07-23 Veerapuram Varadhan <[email protected]>
** Fixes #565616 - Based on Patch by Hubert FONGARNAND
@@ -106,12 +106,13 @@ namespace System.Data.Common
recordIndex = NewRecord ();
try {
foreach (DataColumn fromColumn in fromTable.Columns) {
DataColumn column = _table.Columns [fromColumn.ColumnName];
if (column != null)
column.DataContainer.CopyValue (fromColumn.DataContainer, fromRecordIndex, recordIndex);
foreach (DataColumn toColumn in _table.Columns) {
DataColumn fromColumn = fromTable.Columns [toColumn.ColumnName];
if (fromColumn != null)
toColumn.DataContainer.CopyValue (fromColumn.DataContainer, fromRecordIndex, recordIndex);
else
toColumn.DataContainer.CopyValue (_table.DefaultValuesRowIndex, recordIndex);
}
return recordIndex;
} catch {
if (toRecordIndex == -1)
@@ -1,3 +1,9 @@
2011-03-22 Veerapuram Varadhan <[email protected]>
** Fixes 663914 - Patch by Gábor Remete <[email protected]>
* DataRow.cs (SetOriginalValue): When setting original value for a column,
ensure that original values of other columns are also restored.
2011-03-15 Veerapuram Varadhan <[email protected]>
** Fixes 672113
+48 -41
View File
@@ -17,6 +17,7 @@
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
// Copyright (C) 2011 Xamarin Inc (http://www.xamarin.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
@@ -475,43 +476,53 @@ namespace System.Data {
if (value == null)
value = String.Empty;
if (value != String.Empty) {
if (AutoIncrement || Unique)
throw new ArgumentException ("Cannot create an expression on a column that has AutoIncrement or Unique.");
CompileExpression (value);
_expression = value;
}
}
if (Table != null) {
for (int i = 0; i < Table.Constraints.Count; i++) {
if (Table.Constraints [i].IsColumnContained (this))
throw new ArgumentException (
String.Format (
"Cannot set Expression property on column {0}, because it is a part of a constraint.",
ColumnName));
}
}
internal void CompileExpression ()
{
CompileExpression (_expression);
}
Parser parser = new Parser ();
IExpression compiledExpression = parser.Compile (value);
internal void CompileExpression (string expression)
{
if (expression != String.Empty) {
if (AutoIncrement || Unique)
throw new ArgumentException ("Cannot create an expression on a column that has AutoIncrement or Unique.");
if (Table != null) {
if (compiledExpression.DependsOn (this))
throw new ArgumentException ("Cannot set Expression property due to circular reference in the expression.");
// Check if expression is ok
if (Table.Rows.Count == 0)
compiledExpression.Eval (Table.NewRow ());
else
compiledExpression.Eval (Table.Rows [0]);
}
ReadOnly = true;
_compiledExpression = compiledExpression;
} else {
_compiledExpression = null;
if (Table != null) {
int defaultValuesRowIndex = Table.DefaultValuesRowIndex;
if (defaultValuesRowIndex != -1)
DataContainer.FillValues (defaultValuesRowIndex);
if (Table != null) {
for (int i = 0; i < Table.Constraints.Count; i++) {
if (Table.Constraints [i].IsColumnContained (this))
throw new ArgumentException (
String.Format (
"Cannot set Expression property on column {0}, because it is a part of a constraint.",
ColumnName));
}
}
_expression = value;
Parser parser = new Parser ();
IExpression compiledExpression = parser.Compile (expression);
if (Table != null) {
if (compiledExpression.DependsOn (this))
throw new ArgumentException ("Cannot set Expression property due to circular reference in the expression.");
// Check if expression is ok
if (Table.Rows.Count == 0)
compiledExpression.Eval (Table.NewRow ());
else
compiledExpression.Eval (Table.Rows [0]);
}
ReadOnly = true;
_compiledExpression = compiledExpression;
} else {
_compiledExpression = null;
if (Table != null) {
int defaultValuesRowIndex = Table.DefaultValuesRowIndex;
if (defaultValuesRowIndex != -1)
DataContainer.FillValues (defaultValuesRowIndex);
}
}
}
@@ -701,16 +712,12 @@ namespace System.Data {
//Copy.Container
copy.DataType = DataType;
copy._defaultValue = _defaultValue;
// Use the property to set the expression as it updates compiledExpression, if any.
copy.Expression = _expression;
// Do not use the Expression property to set the expression, the caller of Clone
// must explicitly call CompileExpression on the returned DataColumn to update compiledExpression (if any).
copy._expression = _expression;
//Copy.ExtendedProperties
if (_extendedProperties.Count > 0) {
Array extPropArray = Array.CreateInstance (typeof (object), _extendedProperties.Count);
_extendedProperties.CopyTo (extPropArray, 0);
for (var i = 0; i < _extendedProperties.Count; i++)
copy.ExtendedProperties.Add (extPropArray.GetValue(i),
ExtendedProperties[extPropArray.GetValue(i)]);
}
foreach (object key in _extendedProperties.Keys)
copy.ExtendedProperties.Add (key, ExtendedProperties[key]);
copy._maxLength = _maxLength;
copy._nameSpace = _nameSpace;
copy._prefix = _prefix;
+5 -1
View File
@@ -586,8 +586,12 @@ namespace System.Data {
DataColumn column = _table.Columns [columnName];
_table.ChangingDataColumn (this, column, val);
if (Original < 0 || Original == Current)
if (Original < 0 || Original == Current) {
Original = Table.RecordCache.NewRecord ();
foreach (DataColumn col in _table.Columns)
col.DataContainer.CopyValue (Table.DefaultValuesRowIndex, Original);
}
CheckValue (val, column);
column [Original] = val;
@@ -880,6 +880,8 @@ namespace System.Data {
if (isEmpty || !Copy.Columns.Contains (column.ColumnName))
Copy.Columns.Add (column.Clone ());
}
foreach (DataColumn column in Copy.Columns)
column.CompileExpression ();
CopyConstraints (Copy);
// add primary key to the copy
@@ -54,7 +54,6 @@ namespace System.Data {
private DataTable table;
private Hashtable DiffGrRows = new Hashtable ();
private Hashtable ErrorRows = new Hashtable ();
#endregion // Fields
#region ctors
@@ -222,7 +221,7 @@ namespace System.Data {
private void LoadColumnAttributes (DataTable Table, DataRow Row,
XmlReader reader, DataRowVersion loadType)
{
{
if (!reader.HasAttributes // this check will be faster
|| !reader.MoveToFirstAttribute ())
return;
@@ -273,8 +272,10 @@ namespace System.Data {
{
object data = XmlDataLoader.StringToObject (Table.Columns[colName].DataType, reader.ReadString ());
if (loadType == DataRowVersion.Current) Row [colName] = data;
else Row.SetOriginalValue (colName, data);
if (loadType == DataRowVersion.Current)
Row [colName] = data;
else
Row.SetOriginalValue (colName, data);
reader.Read ();
}
else
@@ -289,7 +290,6 @@ namespace System.Data {
reader.Skip ();
}
}
reader.ReadEndElement ();
}
@@ -351,6 +351,7 @@ namespace System.Data {
DataTable GetTable (string name)
{
name = XmlConvert.DecodeName (name);
if (DSet != null)
return DSet.Tables [name];
else if (name == table.TableName)
@@ -10,9 +10,10 @@
// (C) Copyright 2002 Rodrigo Moya
// (C) Copyright 2003 Daniel Morgan
// (C) Copyright 2003 Martin Willemoes Hansen
//
// (C) Copyright 2011 Xamarin Inc
//
// Copyright 2011 Xamarin Inc (http://www.xamarin.com)
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
@@ -913,5 +914,46 @@ namespace MonoTests.System.Data
Assert.Fail ("SetOrdinalTest failed");
}
}
[Test]
public void Xamarin665 ()
{
var t = new DataTable() ;
var c1 = t.Columns.Add ("c1");
var c2 = t.Columns.Add ("c2");
c2.Expression = "TRIM(ISNULL(c1,' '))";
c2.Expression = "SUBSTRING(ISNULL(c1,' '), 1, 10)";
}
DataColumn MakeColumn (string col, string test)
{
return new DataColumn () {
ColumnName = col,
Expression = test
};
}
#if false
// Check Windows output for the row [0] value
[Test]
public void NullStrings ()
{
var a = MakeColumn ("nullbar", "null+'bar'");
var b = MakeColumn ("barnull", "'bar'+null");
var c = MakeColumn ("foobar", "'foo'+'bar'");
var table = new DataTable();
table.Columns.Add(a);
table.Columns.Add(b);
table.Columns.Add(c);
var row = table.NewRow();
table.Rows.Add(row);
Assert.AreEqual (row [0], DBNull.Value, "#1");
Assert.AreEqual (row [1], DBNull.Value, "#2");
Assert.AreEqual (row [2], "foobar", "#3");
}
#endif
}
}
@@ -2563,6 +2563,30 @@ namespace MonoTests.System.Data
Assert.AreEqual (2, dsLoad.Tables[2].Columns.Count, "T3-Columns");
}
[Test]
public void ReadDiff ()
{
DataSet dsTest = new DataSet ("MonoTouchTest");
var dt = new DataTable ("123");
dt.Columns.Add (new DataColumn ("Value1"));
dt.Columns.Add (new DataColumn ("Value2"));
dsTest.Tables.Add (dt);
dsTest.ReadXml (new StringReader (@"
<diffgr:diffgram
xmlns:msdata='urn:schemas-microsoft-com:xml-msdata'
xmlns:diffgr='urn:schemas-microsoft-com:xml-diffgram-v1'>
<MonoTouchTest>
<_x0031_23 diffgr:id='1231' msdata:rowOrder='0'>
<Value1>Row1Value1</Value1>
<Value2>Row1Value2</Value2>
</_x0031_23>
</MonoTouchTest>
</diffgr:diffgram>
"));
Assert.AreEqual ("123", dsTest.Tables [0].TableName, "#1");
Assert.AreEqual (1, dsTest.Tables [0].Rows.Count, "#2");
}
private void CompareTables (DataSet dsLoad) {
Assert.AreEqual (ds.Tables.Count, dsLoad.Tables.Count, "NumTables");
for (int tc = 0; tc < dsLoad.Tables.Count; tc++) {
@@ -11,6 +11,7 @@
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
// Copyright (C) 2011 Xamarin Inc. (http://www.xamarin.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
@@ -1043,6 +1044,43 @@ namespace MonoTests.System.Data
Assert.AreEqual ("Table#1", copyTable.TableName, "#A30");
}
[Test]
public void CloneExtendedProperties ()
{
// bug 668
DataTable t1 = new DataTable ("t1");
DataColumn c1 = t1.Columns.Add ("c1");
c1.ExtendedProperties.Add ("Company", "Xamarin");
DataTable t2 = t1.Clone ();
Assert.AreEqual ("Xamarin", t1.Columns["c1"].ExtendedProperties["Company"], "CEP1");
Assert.AreEqual ("Xamarin", t2.Columns["c1"].ExtendedProperties["Company"], "CEP2");
}
[Test]
[ExpectedException (typeof (EvaluateException))]
public void CloneExtendedProperties1 ()
{
// Xamarin bug 666
DataTable table1 = new DataTable("Table1") ;
DataColumn c1 = table1.Columns.Add("c1", typeof(string), "'hello ' + c2") ; /* Should cause an exception */
}
[Test]
public void CloneExtendedProperties2 ()
{
// Xamarin bug 666
DataTable table1 = new DataTable("Table1") ;
DataColumn c1 = table1.Columns.Add("c1") ;
DataColumn c2 = table1.Columns.Add("c2") ;
c1.Expression = "'hello ' + c2";
DataTable t2 = table1.Clone(); // this should not cause an exception
}
[Test]
public void LoadDataException ()
{
@@ -54,9 +54,24 @@ namespace System.IdentityModel.Tokens
#if TARGET_DOTNET
throw new NotImplementedException ();
#else
return new BigInteger (FromBinHex (hexString)).ToString ();
// http://tools.ietf.org/html/rfc5280#section-4.1.2.2
// We SHOULD support negative numbers
var bytes = FromBinHex (hexString);
var negative = bytes.Length > 0 && bytes [0] >= 0x80;
if (negative) {
for (int i = 0; i < bytes.Length; i++)
bytes [i] = (byte) ~ bytes [i];
}
var big = new BigInteger (bytes);
if (negative) {
big = big + 1;
return "-" + big.ToString ();
} else
return big.ToString ();
#endif
}
}
public X509IssuerSerialKeyIdentifierClause (X509Certificate2 certificate)
: base (null)
@@ -40,6 +40,7 @@ namespace MonoTests.System.IdentityModel.Selectors
{
static readonly X509Certificate2 cert = new X509Certificate2 ("Test/Resources/test.pfx", "mono");
static readonly X509Certificate2 cert2 = new X509Certificate2 ("Test/Resources/test2.pfx", "mono");
static readonly X509Certificate2 cert3 = new X509Certificate2("Test/Resources/test_neg_serial.cer");
[Test]
public void Properties ()
@@ -50,5 +51,14 @@ namespace MonoTests.System.IdentityModel.Selectors
Assert.AreEqual ("22491767666218099257720700881460366085", ic.IssuerSerialNumber, "#2");
Assert.AreEqual (null, ic.ClauseType, "#3");
}
[Test]
public void NegativeSerialNumber ()
{
var clause = new X509IssuerSerialKeyIdentifierClause (cert3);
Assert.AreEqual ("CN=test, OU=cert, O=test, [email protected]", clause.IssuerName, "#1");
Assert.AreEqual ("-168428216848510272180165529369113665228", clause.IssuerSerialNumber, "#2");
Assert.AreEqual (null, clause.ClauseType, "#3");
}
}
}
@@ -223,16 +223,26 @@ namespace System.Runtime.Serialization
known_types.Add (t);
}
RegisterTypeAsKnown (type);
}
void RegisterTypeAsKnown (Type type)
{
if (known_types.Contains (type))
return;
Type elementType = type;
if (type.HasElementType)
elementType = type.GetElementType ();
known_types.Add (elementType);
/* Get all KnownTypeAttribute-s, including inherited ones */
object [] attrs = elementType.GetCustomAttributes (typeof (KnownTypeAttribute), true);
for (int i = 0; i < attrs.Length; i ++) {
KnownTypeAttribute kt = (KnownTypeAttribute) attrs [i];
foreach (var t in kt.GetTypes (elementType))
known_types.Add (t);
RegisterTypeAsKnown (t);
}
}
@@ -458,8 +468,7 @@ namespace System.Runtime.Serialization
if (rootQName == null &&
graph.GetType () != type &&
!known_types.Contains (graph.GetType ()) &&
KnownTypeCollection.GetPrimitiveTypeName (graph.GetType ()) == QName.Empty)
IsUnknownType (graph.GetType ()))
throw new SerializationException (String.Format ("Type '{0}' is unexpected. The type should either be registered as a known type, or DataContractResolver should be used.", graph.GetType ()));
QName instName = rootQName;
@@ -503,6 +512,16 @@ namespace System.Runtime.Serialization
writer.WriteEndAttribute ();
*/
}
bool IsUnknownType (Type type)
{
if (known_types.Contains (type) ||
KnownTypeCollection.GetPrimitiveTypeName (type) != QName.Empty)
return false;
if (type.IsArray)
return IsUnknownType (type.GetElementType ());
return true;
}
public override void WriteEndObject (XmlDictionaryWriter writer)
{
@@ -115,6 +115,9 @@ namespace System.Runtime.Serialization
// not in ms nsURI schema
dbnull_type, date_time_offset_type;
// XmlSchemaType.GetBuiltInPrimitiveType() does not exist in moonlight, so I had to explicitly add them. And now that we have it, it does not make much sense to use #if MOONLIGHT ... #endif for XmlSchemaType anymore :-(
static Dictionary<string,Type> xs_predefined_types = new Dictionary<string,Type> ();
static KnownTypeCollection ()
{
string s = MSSimpleNamespace;
@@ -142,6 +145,55 @@ namespace System.Runtime.Serialization
dbnull_type = new QName ("DBNull", DefaultClrNamespaceBase + "System");
date_time_offset_type = new QName ("DateTimeOffset", DefaultClrNamespaceBase + "System");
xs_predefined_types.Add ("string", typeof (string));
xs_predefined_types.Add ("boolean", typeof (bool));
xs_predefined_types.Add ("float", typeof (float));
xs_predefined_types.Add ("double", typeof (double));
xs_predefined_types.Add ("decimal", typeof (decimal));
xs_predefined_types.Add ("duration", typeof (TimeSpan));
xs_predefined_types.Add ("dateTime", typeof (DateTime));
xs_predefined_types.Add ("date", typeof (DateTime));
xs_predefined_types.Add ("time", typeof (DateTime));
xs_predefined_types.Add ("gYearMonth", typeof (DateTime));
xs_predefined_types.Add ("gYear", typeof (DateTime));
xs_predefined_types.Add ("gMonthDay", typeof (DateTime));
xs_predefined_types.Add ("gDay", typeof (DateTime));
xs_predefined_types.Add ("gMonth", typeof (DateTime));
xs_predefined_types.Add ("hexBinary", typeof (byte []));
xs_predefined_types.Add ("base64Binary", typeof (byte []));
xs_predefined_types.Add ("anyURI", typeof (Uri));
xs_predefined_types.Add ("QName", typeof (QName));
xs_predefined_types.Add ("NOTATION", typeof (string));
xs_predefined_types.Add ("normalizedString", typeof (string));
xs_predefined_types.Add ("token", typeof (string));
xs_predefined_types.Add ("language", typeof (string));
xs_predefined_types.Add ("IDREFS", typeof (string []));
xs_predefined_types.Add ("ENTITIES", typeof (string []));
xs_predefined_types.Add ("NMTOKEN", typeof (string));
xs_predefined_types.Add ("NMTOKENS", typeof (string []));
xs_predefined_types.Add ("Name", typeof (string));
xs_predefined_types.Add ("NCName", typeof (string));
xs_predefined_types.Add ("ID", typeof (string));
xs_predefined_types.Add ("IDREF", typeof (string));
xs_predefined_types.Add ("ENTITY", typeof (string));
xs_predefined_types.Add ("integer", typeof (decimal));
xs_predefined_types.Add ("nonPositiveInteger", typeof (int));
xs_predefined_types.Add ("negativeInteger", typeof (int));
xs_predefined_types.Add ("long", typeof (long));
xs_predefined_types.Add ("int", typeof (int));
xs_predefined_types.Add ("short", typeof (short));
xs_predefined_types.Add ("byte", typeof (sbyte));
xs_predefined_types.Add ("nonNegativeInteger", typeof (decimal));
xs_predefined_types.Add ("unsignedLong", typeof (ulong));
xs_predefined_types.Add ("unsignedInt", typeof (uint));
xs_predefined_types.Add ("unsignedShort", typeof (ushort));
xs_predefined_types.Add ("unsignedByte", typeof (byte));
xs_predefined_types.Add ("positiveInteger", typeof (decimal));
xs_predefined_types.Add ("anyType", typeof (object));
}
// FIXME: find out how QName and guid are processed
@@ -287,8 +339,8 @@ namespace System.Runtime.Serialization
return typeof (DateTimeOffset);
}
break;
// FIXME: xsd types and ms serialization types should be differentiated. (usage problem)
case XmlSchema.Namespace:
return xs_predefined_types.FirstOrDefault (p => p.Key == name.Name).Value;
case MSSimpleNamespace:
switch (name.Name) {
case "anyURI":
@@ -539,6 +591,12 @@ namespace System.Runtime.Serialization
{
if (name == null)
name = GetDefaultName (type);
else if (type.IsGenericType) {
var args = type.GetGenericArguments ();
for (int i = 0; i < args.Length; i++)
name = name.Replace ("{" + i + "}", GetStaticQName (args [i]).Name);
}
if (ns == null)
ns = GetDefaultNamespace (type);
return new QName (name, ns);
@@ -604,7 +662,7 @@ namespace System.Runtime.Serialization
static QName GetSerializableQName (Type type)
{
#if !NET_2_1
#if !MOONLIGHT
// First, check XmlSchemaProviderAttribute and try GetSchema() to see if it returns a schema in the expected format.
var xpa = type.GetCustomAttribute<XmlSchemaProviderAttribute> (true);
if (xpa != null) {
@@ -440,15 +440,13 @@ namespace System.Runtime.Serialization
internal void Initialize ()
{
Type type = RuntimeType;
List <DataMemberInfo> members = new List <DataMemberInfo> ();
List <DataMemberInfo> members;
object [] atts = type.GetCustomAttributes (
typeof (DataContractAttribute), false);
IsReference = atts.Length > 0 ? (((DataContractAttribute) atts [0]).IsReference) : false;
while (type != null) {
QName qname = KnownTypes.GetQName (type);
members = GetMembers (type, qname, true);
members = GetMembers (type);
members.Sort (DataMemberInfo.DataMemberInfoComparer.Instance);
Members.InsertRange (0, members);
members.Clear ();
@@ -457,12 +455,10 @@ namespace System.Runtime.Serialization
}
}
List<DataMemberInfo> GetMembers (Type type, QName qname, bool declared_only)
List<DataMemberInfo> GetMembers (Type type)
{
List<DataMemberInfo> data_members = new List<DataMemberInfo> ();
BindingFlags flags = AllInstanceFlags;
if (declared_only)
flags |= BindingFlags.DeclaredOnly;
BindingFlags flags = AllInstanceFlags | BindingFlags.DeclaredOnly;
foreach (PropertyInfo pi in type.GetProperties (flags)) {
DataMemberAttribute dma =
@@ -615,6 +611,9 @@ namespace System.Runtime.Serialization
public override void SerializeNonReference (object graph,
XmlFormatterSerializer serializer)
{
// output item xmlns in advance so that it does not result in excessive xmlns overwrites.
if (XmlName.Namespace != element_qname.Namespace && element_qname.Namespace != KnownTypeCollection.MSSimpleNamespace)
serializer.Writer.WriteXmlnsAttribute (null, element_qname.Namespace);
foreach (object o in (IEnumerable) graph) {
serializer.WriteStartElement (element_qname.Name, XmlName.Namespace, CurrentNamespace);
@@ -152,7 +152,7 @@ namespace System.Runtime.Serialization
if (isNil) {
reader.Skip ();
if (!type.IsValueType)
if (!type.IsValueType || type == typeof (void))
return null;
else if (type.IsGenericType && type.GetGenericTypeDefinition () == typeof (Nullable<>))
return null;
@@ -37,9 +37,11 @@ using System.Xml;
using System.Xml.Schema;
using System.Xml.Serialization;
using QName = System.Xml.XmlQualifiedName;
namespace System.Runtime.Serialization
{
[MonoTODO ("Support ImportXmlType option; support arrays; CanImport is not up to date with Import")]
[MonoTODO ("support arrays")]
public class XsdDataContractImporter
{
static readonly XmlQualifiedName qname_anytype = new XmlQualifiedName ("anyType", XmlSchema.Namespace);
@@ -71,6 +73,66 @@ namespace System.Runtime.Serialization
}
}
void GenerateXmlType (XmlQualifiedName qname)
{
var cns = GetCodeNamespace (qname.Namespace);
var td = new CodeTypeDeclaration () {
Name = GetUniqueName (CodeIdentifier.MakeValid (qname.Name), cns),
TypeAttributes = GenerateInternal ? TypeAttributes.NotPublic : TypeAttributes.Public,
IsPartial = true };
cns.Types.Add (td);
td.BaseTypes.Add (new CodeTypeReference (typeof (IXmlSerializable)));
var thisNodes = new CodePropertyReferenceExpression (new CodeThisReferenceExpression (), "Nodes"); // property this.Nodes
var xmlSerializableServices = new CodeTypeReferenceExpression (typeof (XmlSerializableServices)); // static XmlSerializableServices.
var qnameType = new CodeTypeReference (typeof (XmlQualifiedName));
// XmlQualifiedName qname = new XmlQualifiedName ({qname.Name}, {qname.Namespace});
td.Members.Add (new CodeMemberField () { Name = "qname", Type = qnameType, InitExpression = new CodeObjectCreateExpression (qnameType, new CodePrimitiveExpression (qname.Name), new CodePrimitiveExpression (qname.Namespace)) });
// public XmlNode[] Nodes { get; set; }
td.Members.Add (new CodeMemberProperty () { Name = "Nodes", Type = new CodeTypeReference (typeof (XmlNode [])), Attributes = (GenerateInternal ? MemberAttributes.Assembly : MemberAttributes.Public) | MemberAttributes.Final, HasGet = true, HasSet = true });
// public void ReadXml(XmlReader reader) {
var read = new CodeMemberMethod () { Name = "ReadXml", Attributes = (GenerateInternal ? MemberAttributes.Assembly : MemberAttributes.Public) | MemberAttributes.Final };
read.Parameters.Add (new CodeParameterDeclarationExpression (new CodeTypeReference (typeof (XmlReader)), "reader"));
// this.Nodes = XmlSerializableServices.ReadXml(reader);
read.Statements.Add (
new CodeAssignStatement (thisNodes,
new CodeMethodInvokeExpression (
new CodeMethodReferenceExpression (xmlSerializableServices, "ReadXml"),
new CodeArgumentReferenceExpression ("reader"))));
// }
td.Members.Add (read);
// public void WriteXml(XmlWriter writer) {
var write = new CodeMemberMethod () { Name = "WriteXml",Attributes = (GenerateInternal ? MemberAttributes.Assembly : MemberAttributes.Public) | MemberAttributes.Final };
write.Parameters.Add (new CodeParameterDeclarationExpression (new CodeTypeReference (typeof (XmlWriter)), "writer"));
// XmlSerializableServices.WriteXml(writer, this.Nodes);
write.Statements.Add (
new CodeMethodInvokeExpression (
new CodeMethodReferenceExpression (xmlSerializableServices, "WriteXml"),
new CodeArgumentReferenceExpression ("writer"),
thisNodes));
// }
td.Members.Add (write);
// public XmlSchema GetSchema () { return null; }
var getSchema = new CodeMemberMethod () { Name = "GetSchema", Attributes = (GenerateInternal ? MemberAttributes.Assembly : MemberAttributes.Public) | MemberAttributes.Final, ReturnType = new CodeTypeReference (typeof (XmlSchema)) };
getSchema.Statements.Add (new CodeMethodReturnStatement (new CodePrimitiveExpression (null)));
td.Members.Add (getSchema);
// public static XmlQualifiedName ExportSchema (XmlSchemaSet schemas) {
var export = new CodeMemberMethod () { Name = "ExportSchema", Attributes = (GenerateInternal ? MemberAttributes.Assembly : MemberAttributes.Public) | MemberAttributes.Final | MemberAttributes.Static, ReturnType = qnameType };
export.Parameters.Add (new CodeParameterDeclarationExpression (new CodeTypeReference (typeof (XmlSchemaSet)), "schemas"));
// XmlSerializableServices.AddDefaultSchema (schemas);
export.Statements.Add (new CodeMethodInvokeExpression (xmlSerializableServices, "AddDefaultSchema", new CodeArgumentReferenceExpression ("schemas")));
// return qname;
export.Statements.Add (new CodeMethodReturnStatement (new CodeFieldReferenceExpression (new CodeThisReferenceExpression (), "qname")));
// }
td.Members.Add (export);
}
// CanImport
public bool CanImport (XmlSchemaSet schemas)
@@ -113,23 +175,196 @@ namespace System.Runtime.Serialization
if (!schemas.IsCompiled)
schemas.Compile ();
if (!schemas.GlobalTypes.Contains (typeName))
throw new InvalidDataContractException (String.Format ("Type {0} is not found in the schemas", typeName));
if (IsPredefinedType (typeName))
return true; // while it just ignores...
return CanImport (schemas, schemas.GlobalTypes [typeName] as XmlSchemaComplexType);
if (!schemas.GlobalTypes.Contains (typeName))
return false;
return CanImport (schemas, schemas.GlobalTypes [typeName] as XmlSchemaType);
}
public bool CanImport (XmlSchemaSet schemas, XmlSchemaElement element)
{
if (schemas == null)
throw new ArgumentNullException ("schemas");
if (element == null)
throw new ArgumentNullException ("element");
if (!schemas.IsCompiled)
schemas.Compile ();
return CanImport (schemas, element.ElementSchemaType as XmlSchemaComplexType);
if (element.ElementSchemaType != null)
return CanImport (schemas, element.ElementSchemaType as XmlSchemaType);
else if (element.SchemaTypeName != null && !element.SchemaTypeName.Equals (QName.Empty))
return CanImport (schemas, element.SchemaTypeName);
else
// anyType
return true;
}
#if true // new
bool CanImport (XmlSchemaSet schemas, XmlSchemaType type)
{
if (IsPredefinedType (type.QualifiedName))
return true;
var st = type as XmlSchemaSimpleType;
if (st != null) {
return CanImportSimpleType (schemas, st);
} else {
var ct = (XmlSchemaComplexType) type;
var sc = ct.ContentModel as XmlSchemaSimpleContent;
if (sc != null) {
if (sc.Content is XmlSchemaSimpleContentExtension)
return false;
}
if (!CanImportComplexType (schemas, ct))
return false;
return true;
}
}
bool CanImportSimpleType (XmlSchemaSet schemas, XmlSchemaSimpleType type)
{
var scl = type.Content as XmlSchemaSimpleTypeList;
if (scl != null) {
if (scl.ItemType == null)
return false;
var itemType = scl.ItemType as XmlSchemaSimpleType;
var ir = itemType.Content as XmlSchemaSimpleTypeRestriction;
if (ir == null)
return false;
return true; // as enum
}
var scr = type.Content as XmlSchemaSimpleTypeRestriction;
if (scr != null)
return true; // as enum
return false;
}
bool CanImportComplexType (XmlSchemaSet schemas, XmlSchemaComplexType type)
{
foreach (XmlSchemaAttribute att in type.AttributeUses.Values)
if (att.Use != XmlSchemaUse.Optional || att.QualifiedName.Namespace != KnownTypeCollection.MSSimpleNamespace)
return false;
CodeTypeReference baseClrType = null;
var particle = type.Particle;
if (type.ContentModel != null) {
var xsscr = type.ContentModel.Content as XmlSchemaSimpleContentRestriction;
if (xsscr != null) {
if (xsscr.BaseType != null) {
if (!CanImport (schemas, xsscr.BaseType))
return false;
} else {
if (!CanImport (schemas, xsscr.BaseTypeName))
return false;
}
// The above will result in an error, but make sure to show we don't support it.
return false;
}
var xscce = type.ContentModel.Content as XmlSchemaComplexContentExtension;
if (xscce != null) {
if (!CanImport (schemas, xscce.BaseTypeName))
return false;
baseClrType = GetCodeTypeReferenceInternal (xscce.BaseTypeName, false);
var baseInfo = GetTypeInfo (xscce.BaseTypeName, false);
particle = xscce.Particle;
}
var xsccr = type.ContentModel.Content as XmlSchemaComplexContentRestriction;
if (xsccr != null)
return false;
}
var seq = particle as XmlSchemaSequence;
if (seq == null && particle != null)
return false;
if (seq != null) {
if (seq.Items.Count == 1 && seq.Items [0] is XmlSchemaAny && type.Parent is XmlSchemaElement) {
// looks like it is not rejected (which contradicts the error message on .NET). See XsdDataContractImporterTest.ImportTestX32(). Also ImporTestX13() for Parent check.
} else {
foreach (var child in seq.Items)
if (!(child is XmlSchemaElement))
return false;
bool isDictionary = false;
if (type.Annotation != null) {
foreach (var ann in type.Annotation.Items) {
var ai = ann as XmlSchemaAppInfo;
if (ai != null && ai.Markup != null &&
ai.Markup.Length > 0 &&
ai.Markup [0].NodeType == XmlNodeType.Element &&
ai.Markup [0].LocalName == "IsDictionary" &&
ai.Markup [0].NamespaceURI == KnownTypeCollection.MSSimpleNamespace)
isDictionary = true;
}
}
if (seq.Items.Count == 1) {
var pt = (XmlSchemaParticle) seq.Items [0];
var xe = pt as XmlSchemaElement;
if (pt.MaxOccursString == "unbounded") {
// import as a collection contract.
if (pt is XmlSchemaAny) {
} else if (isDictionary) {
var kvt = xe.ElementSchemaType as XmlSchemaComplexType;
var seq2 = kvt != null ? kvt.Particle as XmlSchemaSequence : null;
var k = seq2 != null && seq2.Items.Count == 2 ? seq2.Items [0] as XmlSchemaElement : null;
var v = seq2 != null && seq2.Items.Count == 2 ? seq2.Items [1] as XmlSchemaElement : null;
if (k == null || v == null)
return false;
if (!CanImport (schemas, k.ElementSchemaType))
return false;
if (!CanImport (schemas, v.ElementSchemaType))
return false;
return true;
} else if (type.QualifiedName.Namespace == KnownTypeCollection.MSArraysNamespace &&
IsPredefinedType (xe.ElementSchemaType.QualifiedName)) {
// then this CodeTypeDeclaration is to be removed, and CodeTypeReference to this type should be an array instead.
return true;
}
else
if (!CanImport (schemas, xe.ElementSchemaType))
return false;
return true;
}
}
if (isDictionary)
return false;
// import as a (normal) contract.
var elems = new List<XmlSchemaElement> ();
foreach (XmlSchemaElement xe in seq.Items) {
if (xe.MaxOccurs != 1)
return false;
if (elems.Any (e => e.QualifiedName.Name == xe.QualifiedName.Name))
return false;
elems.Add (xe);
}
foreach (var xe in elems) {
// import property type in prior.
if (!CanImport (schemas, xe.ElementSchemaType.QualifiedName))
return false;
}
} // if (seq contains only an xs:any)
} // if (seq != 0)
return true;
}
#else
bool CanImport (XmlSchemaSet schemas, XmlSchemaComplexType type)
{
if (type == null || type.QualifiedName.Namespace == XmlSchema.Namespace) // xs:anyType -> not supported.
@@ -148,6 +383,7 @@ namespace System.Runtime.Serialization
return true;
}
#endif
// Import
@@ -181,6 +417,9 @@ namespace System.Runtime.Serialization
if (typeName == null)
throw new ArgumentNullException ("typeName");
if (!schemas.IsCompiled)
schemas.Compile ();
if (IsPredefinedType (typeName))
return;
@@ -199,6 +438,9 @@ namespace System.Runtime.Serialization
var elname = element.QualifiedName;
if (IsPredefinedType (element.SchemaTypeName))
return elname;
switch (elname.Namespace) {
case KnownTypeCollection.MSSimpleNamespace:
switch (elname.Name) {
@@ -210,14 +452,35 @@ namespace System.Runtime.Serialization
break;
}
if (!CanImport (schemas, element) && Options != null && Options.ImportXmlType) {
var qn = element.QualifiedName;
GenerateXmlType (qn);
return qn;
}
// FIXME: use element to fill nillable and arrays.
var qname = element.SchemaType != null ? element.QualifiedName : element.ElementSchemaType.QualifiedName;
Import (schemas, element.ElementSchemaType, qname);
var qname =
elname != null && !elname.Equals (QName.Empty) ? elname :
element.ElementSchemaType != null ? element.ElementSchemaType.QualifiedName :
qname_anytype;
if (element.ElementSchemaType != null)
Import (schemas, element.ElementSchemaType, qname);
else if (element.SchemaTypeName != null && !element.SchemaTypeName.Equals (QName.Empty))
Import (schemas, schemas.GlobalTypes [element.SchemaTypeName] as XmlSchemaType, qname);
// otherwise it is typeless == anyType.
else
Import (schemas, XmlSchemaType.GetBuiltInComplexType (qname_anytype), qname);
return qname;
}
void Import (XmlSchemaSet schemas, XmlSchemaType type)
{
if (!CanImport (schemas, type) && Options != null && Options.ImportXmlType) {
GenerateXmlType (type.QualifiedName);
return;
}
Import (schemas, type, type.QualifiedName);
}
@@ -247,12 +510,13 @@ namespace System.Runtime.Serialization
{
CodeNamespace cns = null;
CodeTypeReference clrRef;
cns = GetCodeNamespace (qname);
cns = GetCodeNamespace (qname.Namespace);
clrRef = new CodeTypeReference (cns.Name.Length > 0 ? cns.Name + "." + qname.Name : qname.Name);
var td = new CodeTypeDeclaration () {
Name = GetUniqueName (CodeIdentifier.MakeValid (qname.Name), cns),
TypeAttributes = GenerateInternal ? TypeAttributes.NotPublic : TypeAttributes.Public };
TypeAttributes = GenerateInternal ? TypeAttributes.NotPublic : TypeAttributes.Public,
IsPartial = true };
cns.Types.Add (td);
var info = new TypeImportInfo () { ClrType = clrRef, XsdType = type, XsdTypeName = qname };
@@ -393,7 +657,6 @@ namespace System.Runtime.Serialization
}
// Returns false if it should remove the imported type.
// FIXME: also support ImportXmlType
bool ImportComplexType (CodeTypeDeclaration td, XmlSchemaSet schemas, XmlSchemaComplexType type, XmlQualifiedName qname)
{
foreach (XmlSchemaAttribute att in type.AttributeUses.Values)
@@ -435,6 +698,12 @@ namespace System.Runtime.Serialization
if (seq != null) {
if (seq.Items.Count == 1 && seq.Items [0] is XmlSchemaAny && type.Parent is XmlSchemaElement) {
// looks like it is not rejected (which contradicts the error message on .NET). See XsdDataContractImporterTest.ImportTestX32(). Also ImporTestX13() for Parent check.
} else {
foreach (var child in seq.Items)
if (!(child is XmlSchemaElement))
throw new InvalidDataContractException (String.Format ("Only local element is allowed as the content of the sequence of the top-level content of a complex type '{0}'. Other particles (sequence, choice, all, any, group ref) are not supported.", qname));
@@ -453,10 +722,12 @@ namespace System.Runtime.Serialization
}
if (seq.Items.Count == 1) {
var xe = (XmlSchemaElement) seq.Items [0];
if (xe.MaxOccursString == "unbounded") {
var pt = (XmlSchemaParticle) seq.Items [0];
var xe = pt as XmlSchemaElement;
if (pt.MaxOccursString == "unbounded") {
// import as a collection contract.
if (isDictionary) {
if (pt is XmlSchemaAny) {
} else if (isDictionary) {
var kvt = xe.ElementSchemaType as XmlSchemaComplexType;
var seq2 = kvt != null ? kvt.Particle as XmlSchemaSequence : null;
var k = seq2 != null && seq2.Items.Count == 2 ? seq2.Items [0] as XmlSchemaElement : null;
@@ -503,6 +774,7 @@ namespace System.Runtime.Serialization
AddProperty (td, xe);
}
} // if (seq contains only an xs:any)
} // if (seq != 0)
AddTypeAttributes (td, type);
@@ -542,19 +814,22 @@ namespace System.Runtime.Serialization
bool IsPredefinedType (XmlQualifiedName qname)
{
if (qname == null)
return false;
switch (qname.Namespace) {
case KnownTypeCollection.MSSimpleNamespace:
case XmlSchema.Namespace:
return KnownTypeCollection.GetPrimitiveTypeFromName (qname) != null;
case XmlSchema.Namespace:
return XmlSchemaType.GetBuiltInSimpleType (qname) != null || XmlSchemaType.GetBuiltInComplexType (qname) != null;
}
return false;
}
CodeNamespace GetCodeNamespace (XmlQualifiedName name)
CodeNamespace GetCodeNamespace (string xmlns)
{
string ns = null;
if (Options == null || !Options.Namespaces.TryGetValue (name.Namespace, out ns))
ns = GetCodeNamespaceFromXmlns (name.Namespace);
if (Options == null || !Options.Namespaces.TryGetValue (xmlns, out ns))
ns = GetCodeNamespaceFromXmlns (xmlns);
foreach (CodeNamespace cns in CodeCompileUnit.Namespaces)
if (cns.Name == ns)
@@ -615,7 +890,10 @@ namespace System.Runtime.Serialization
switch (typeName.Namespace) {
case XmlSchema.Namespace:
case KnownTypeCollection.MSSimpleNamespace:
return new CodeTypeReference (KnownTypeCollection.GetPrimitiveTypeFromName (typeName));
var pt = KnownTypeCollection.GetPrimitiveTypeFromName (typeName);
if (pt == null)
throw new ArgumentException (String.Format ("Invalid type name in a predefined namespace: {0}", typeName));
return new CodeTypeReference (pt);
}
var info = GetTypeInfo (typeName, throwError);
@@ -1,5 +1,6 @@
System.Runtime.Serialization/Bug666333Test.cs
System.Runtime.Serialization/Bug675144Test.cs
System.Runtime.Serialization/Bug695203Test.cs
System.Runtime.Serialization/DataContractResolverTest.cs
System.Runtime.Serialization/KnownTypeAttributeTest.cs
System.Runtime.Serialization/XmlObjectSerializerTest.cs
@@ -173,6 +173,8 @@ namespace System.Xml
return XmlConvert.ToString ((float) TypedValue);
case BF.Double:
return XmlConvert.ToString ((double) TypedValue);
case BF.Decimal:
return XmlConvert.ToString ((decimal) TypedValue);
case BF.DateTime:
return XmlConvert.ToString ((DateTime) TypedValue, XmlDateTimeSerializationMode.RoundtripKind);
case BF.TimeSpan:
@@ -17,6 +17,7 @@ ns10.xsd : contains element with substitutionGroup. E2 is resolved to be
ns11.xsd : contains xs:choice as the particle, not supported in WCF(!)
ns12.xsd : contains xs:all as the particle, not supported in WCF(!)
ns13.xsd : contains xs:any as the content of xs:sequence, not supported in WCF.
see also ns33.xsd which contains an xs:element and thus OK.
ns14.xsd : contains simple content restriction by enum. Mapped to CLI enum.
ns15.xsd : contains simple list by string, not supported in WCF.
ns16.xsd : contains simple list by embedded enumeration string type.
@@ -38,3 +39,7 @@ ns28.xsd : dictionary collection type.
ns29.xsd : variation of ns28, removed Value. Error.
ns30.xsd : variation of ns28, customized name. Shown in [DataMember].
ns31.xsd : variation of ns28, removed IsDictionary appInfo. Becomes List<T>.
ns32.xsd : variation of ns13, moved xs:complexType under xs:element and thus
became OK. (despite the error message explicitly prohibits this!)
ns33.xsd : variation of ns13, replaced xs:any with xs:element and became OK
(despite the error message explicitly prohibits this!)
@@ -0,0 +1,10 @@
<xs:schema targetNamespace="urn:bar" xmlns="urn:bar"
xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:element name="E1">
<xs:complexType>
<xs:sequence>
<xs:any />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
@@ -0,0 +1,9 @@
<xs:schema targetNamespace="urn:bar" xmlns="urn:bar"
xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:element name="E1" type="T1" />
<xs:complexType name="T1">
<xs:sequence>
<xs:element name="x" />
</xs:sequence>
</xs:complexType>
</xs:schema>
@@ -0,0 +1,19 @@
<xs:schema
targetNamespace="http://www.onvif.org/ver10/device/wsdl"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:tt="http://www.onvif.org/ver10/schema"
xmlns:tds="http://www.onvif.org/ver10/device/wsdl"
elementFormDefault="qualified" >
<xs:element name="GetSystemDateAndTime">
<xs:complexType>
<xs:sequence/>
</xs:complexType>
</xs:element>
<xs:element name="GetSystemDateAndTimeResponse">
<xs:complexType>
<xs:sequence>
<xs:element name="SystemDateAndTime" type="tt:SystemDateTime" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
@@ -0,0 +1,21 @@
<xs:schema
targetNamespace="http://www.onvif.org/ver10/schema"
elementFormDefault="qualified"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:tt="http://www.onvif.org/ver10/schema">
<xs:complexType name="SystemDateTime">
<xs:sequence>
<xs:element name="foobar" type="xs:string" minOccurs="0" />
<xs:element name="Extension" type="tt:SystemDateTimeExtension" minOccurs="0"/>
</xs:sequence>
<!-- xs:anyAttribute processContents="lax"/ -->
</xs:complexType>
<xs:complexType name="SystemDateTimeExtension">
<xs:sequence>
<xs:any namespace="##any" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
@@ -0,0 +1,287 @@
<?xml version='1.0'?>
<?xml-stylesheet href="../2008/09/xsd.xsl" type="text/xsl"?>
<xs:schema targetNamespace="http://www.w3.org/XML/1998/namespace"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns ="http://www.w3.org/1999/xhtml"
xml:lang="en">
<xs:annotation>
<xs:documentation>
<div>
<h1>About the XML namespace</h1>
<div class="bodytext">
<p>
This schema document describes the XML namespace, in a form
suitable for import by other schema documents.
</p>
<p>
See <a href="http://www.w3.org/XML/1998/namespace.html">
http://www.w3.org/XML/1998/namespace.html</a> and
<a href="http://www.w3.org/TR/REC-xml">
http://www.w3.org/TR/REC-xml</a> for information
about this namespace.
</p>
<p>
Note that local names in this namespace are intended to be
defined only by the World Wide Web Consortium or its subgroups.
The names currently defined in this namespace are listed below.
They should not be used with conflicting semantics by any Working
Group, specification, or document instance.
</p>
<p>
See further below in this document for more information about <a
href="#usage">how to refer to this schema document from your own
XSD schema documents</a> and about <a href="#nsversioning">the
namespace-versioning policy governing this schema document</a>.
</p>
</div>
</div>
</xs:documentation>
</xs:annotation>
<xs:attribute name="lang">
<xs:annotation>
<xs:documentation>
<div>
<h3>lang (as an attribute name)</h3>
<p>
denotes an attribute whose value
is a language code for the natural language of the content of
any element; its value is inherited. This name is reserved
by virtue of its definition in the XML specification.</p>
</div>
<div>
<h4>Notes</h4>
<p>
Attempting to install the relevant ISO 2- and 3-letter
codes as the enumerated possible values is probably never
going to be a realistic possibility.
</p>
<p>
See BCP 47 at <a href="http://www.rfc-editor.org/rfc/bcp/bcp47.txt">
http://www.rfc-editor.org/rfc/bcp/bcp47.txt</a>
and the IANA language subtag registry at
<a href="http://www.iana.org/assignments/language-subtag-registry">
http://www.iana.org/assignments/language-subtag-registry</a>
for further information.
</p>
<p>
The union allows for the 'un-declaration' of xml:lang with
the empty string.
</p>
</div>
</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:union memberTypes="xs:language">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value=""/>
</xs:restriction>
</xs:simpleType>
</xs:union>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="space">
<xs:annotation>
<xs:documentation>
<div>
<h3>space (as an attribute name)</h3>
<p>
denotes an attribute whose
value is a keyword indicating what whitespace processing
discipline is intended for the content of the element; its
value is inherited. This name is reserved by virtue of its
definition in the XML specification.</p>
</div>
</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:NCName">
<xs:enumeration value="default"/>
<xs:enumeration value="preserve"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="base" type="xs:anyURI"> <xs:annotation>
<xs:documentation>
<div>
<h3>base (as an attribute name)</h3>
<p>
denotes an attribute whose value
provides a URI to be used as the base for interpreting any
relative URIs in the scope of the element on which it
appears; its value is inherited. This name is reserved
by virtue of its definition in the XML Base specification.</p>
<p>
See <a
href="http://www.w3.org/TR/xmlbase/">http://www.w3.org/TR/xmlbase/</a>
for information about this attribute.
</p>
</div>
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="id" type="xs:ID">
<xs:annotation>
<xs:documentation>
<div>
<h3>id (as an attribute name)</h3>
<p>
denotes an attribute whose value
should be interpreted as if declared to be of type ID.
This name is reserved by virtue of its definition in the
xml:id specification.</p>
<p>
See <a
href="http://www.w3.org/TR/xml-id/">http://www.w3.org/TR/xml-id/</a>
for information about this attribute.
</p>
</div>
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attributeGroup name="specialAttrs">
<xs:attribute ref="xml:base"/>
<xs:attribute ref="xml:lang"/>
<xs:attribute ref="xml:space"/>
<xs:attribute ref="xml:id"/>
</xs:attributeGroup>
<xs:annotation>
<xs:documentation>
<div>
<h3>Father (in any context at all)</h3>
<div class="bodytext">
<p>
denotes Jon Bosak, the chair of
the original XML Working Group. This name is reserved by
the following decision of the W3C XML Plenary and
XML Coordination groups:
</p>
<blockquote>
<p>
In appreciation for his vision, leadership and
dedication the W3C XML Plenary on this 10th day of
February, 2000, reserves for Jon Bosak in perpetuity
the XML name "xml:Father".
</p>
</blockquote>
</div>
</div>
</xs:documentation>
</xs:annotation>
<xs:annotation>
<xs:documentation>
<div xml:id="usage" id="usage">
<h2><a name="usage">About this schema document</a></h2>
<div class="bodytext">
<p>
This schema defines attributes and an attribute group suitable
for use by schemas wishing to allow <code>xml:base</code>,
<code>xml:lang</code>, <code>xml:space</code> or
<code>xml:id</code> attributes on elements they define.
</p>
<p>
To enable this, such a schema must import this schema for
the XML namespace, e.g. as follows:
</p>
<pre>
&lt;schema . . .>
. . .
&lt;import namespace="http://www.w3.org/XML/1998/namespace"
schemaLocation="http://www.w3.org/2001/xml.xsd"/>
</pre>
<p>
or
</p>
<pre>
&lt;import namespace="http://www.w3.org/XML/1998/namespace"
schemaLocation="http://www.w3.org/2009/01/xml.xsd"/>
</pre>
<p>
Subsequently, qualified reference to any of the attributes or the
group defined below will have the desired effect, e.g.
</p>
<pre>
&lt;type . . .>
. . .
&lt;attributeGroup ref="xml:specialAttrs"/>
</pre>
<p>
will define a type which will schema-validate an instance element
with any of those attributes.
</p>
</div>
</div>
</xs:documentation>
</xs:annotation>
<xs:annotation>
<xs:documentation>
<div id="nsversioning" xml:id="nsversioning">
<h2><a name="nsversioning">Versioning policy for this schema document</a></h2>
<div class="bodytext">
<p>
In keeping with the XML Schema WG's standard versioning
policy, this schema document will persist at
<a href="http://www.w3.org/2009/01/xml.xsd">
http://www.w3.org/2009/01/xml.xsd</a>.
</p>
<p>
At the date of issue it can also be found at
<a href="http://www.w3.org/2001/xml.xsd">
http://www.w3.org/2001/xml.xsd</a>.
</p>
<p>
The schema document at that URI may however change in the future,
in order to remain compatible with the latest version of XML
Schema itself, or with the XML namespace itself. In other words,
if the XML Schema or XML namespaces change, the version of this
document at <a href="http://www.w3.org/2001/xml.xsd">
http://www.w3.org/2001/xml.xsd
</a>
will change accordingly; the version at
<a href="http://www.w3.org/2009/01/xml.xsd">
http://www.w3.org/2009/01/xml.xsd
</a>
will not change.
</p>
<p>
Previous dated (and unchanging) versions of this schema
document are at:
</p>
<ul>
<li><a href="http://www.w3.org/2009/01/xml.xsd">
http://www.w3.org/2009/01/xml.xsd</a></li>
<li><a href="http://www.w3.org/2007/08/xml.xsd">
http://www.w3.org/2007/08/xml.xsd</a></li>
<li><a href="http://www.w3.org/2004/10/xml.xsd">
http://www.w3.org/2004/10/xml.xsd</a></li>
<li><a href="http://www.w3.org/2001/03/xml.xsd">
http://www.w3.org/2001/03/xml.xsd</a></li>
</ul>
</div>
</div>
</xs:documentation>
</xs:annotation>
</xs:schema>
@@ -0,0 +1,90 @@
using System;
using System.Runtime.Serialization;
using System.IO;
using System.Diagnostics;
using System.Xml.Serialization;
using System.Globalization;
using System.ComponentModel;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.ServiceModel.Description;
using System.Xml;
using System.CodeDom.Compiler;
using NUnit.Framework;
namespace MonoTests.System.Runtime.Serialization
{
[TestFixture]
public class Bug695203Test
{
[Test]
public void DoTest ()
{
using (var mem = new MemoryStream ()) {
BaseClass data = new DerivedA1 { Code = "1", CodeA = "A", CodeA1 = "A1" };
Serialize (data, mem);
mem.Position = 0;
var docResult = Deserialize<BaseClass> (mem);
}
using (var mem = new MemoryStream ()) {
BaseClass data = new DerivedA2 { Code = "1", CodeA = "A", CodeA2 = "A1" };
Serialize (data, mem);
mem.Position = 0;
var docResult = Deserialize<BaseClass> (mem);
}
}
void Serialize<T> (T instance, Stream destinationStream)
{
var serializer = new DataContractSerializer (typeof (T), null, int.MaxValue, false, true, null);
using (var writer = XmlDictionaryWriter.CreateBinaryWriter (destinationStream, null, null, false))
serializer.WriteObject (writer, instance);
}
public static T Deserialize<T> (Stream sourceStream)
{
var serializer = new DataContractSerializer (typeof (T), null, int.MaxValue, false, true, null);
using (var reader = XmlDictionaryReader.CreateBinaryReader(sourceStream, XmlDictionaryReaderQuotas.Max))
return (T) serializer.ReadObject (reader);
}
[DataContract]
[KnownType (typeof (DerivedA1))]
[KnownType (typeof (DerivedA))]
public abstract class BaseClass
{
[DataMember]
public string Code { get; set; }
}
[DataContract]
[KnownType (typeof (DerivedA1))]
[KnownType (typeof (DerivedA2))]
public abstract class DerivedA : BaseClass
{
public string CodeA { get; set; }
}
[DataContract]
public class DerivedA1 : DerivedA
{
[DataMember]
public string CodeA1 { get; set; }
}
[DataContract]
public class DerivedA2 : DerivedA
{
[DataMember]
public string CodeA2 { get; set; }
}
}
}
@@ -73,6 +73,27 @@ namespace MonoTests.System.Runtime.Serialization
Serialize (new Data4 () { X = new Bar () });
}
[Test]
public void GenericTypeNameArgument ()
{
string expected = "<Foo_KnownTypeAttributeTest.Foo xmlns:i='http://www.w3.org/2001/XMLSchema-instance' xmlns:d1p1='http://schemas.datacontract.org/2004/07/MonoTests.System.Runtime.Serialization' xmlns='urn:foo'><KnownTypeAttributeTest.Foo><d1p1:S>z</d1p1:S></KnownTypeAttributeTest.Foo></Foo_KnownTypeAttributeTest.Foo>".Replace ('\'', '"');
var ds = new DataContractSerializer (typeof (MyList<Foo>));
var l = new MyList<Foo> ();
l.Add (new Foo () { S = "z" });
var sw = new StringWriter ();
var settings = new XmlWriterSettings () { OmitXmlDeclaration = true };
using (var xw = XmlWriter.Create (sw, settings))
ds.WriteObject (xw, l);
Assert.AreEqual (expected, sw.ToString (), "#1");
}
[Test]
[ExpectedException (typeof (InvalidDataContractException))]
public void DataContractOnCollection ()
{
Serialize (new MyListWrong<Foo> ());
}
public class Foo
{
public string S { get; set; }
@@ -134,6 +155,16 @@ namespace MonoTests.System.Runtime.Serialization
yield return typeof (Bar);
}
}
[CollectionDataContract (Name = "Foo_{0}", Namespace = "urn:foo")]
public class MyList<T> : List<T>
{
}
[DataContract (Name = "Foo_{0}", Namespace = "urn:foo")]
public class MyListWrong<T> : List<T>
{
}
}
}
#endif
@@ -315,7 +315,6 @@ namespace MonoTests.System.Runtime.Serialization
[Test]
[ExpectedException (typeof (SerializationException))]
[Category ("NotWorking")] // behavior changed in 3.5/SP1
public void SerializeSimpleXml ()
{
DataContractSerializer ser =
@@ -980,7 +979,6 @@ namespace MonoTests.System.Runtime.Serialization
}
[Test]
[Category ("NotWorking")]
public void DeserializeDCWithNullableEnum ()
{
DCWithNullableEnum dc = Deserialize<DCWithNullableEnum> (
@@ -1575,6 +1573,17 @@ namespace MonoTests.System.Runtime.Serialization
Assert.AreEqual ("Hello, world!", obj.Content != null ? obj.Content.InnerText : String.Empty, "#2");
Assert.AreEqual (2, obj.Nodes != null ? obj.Nodes.Length : -1, "#3");
}
[Test]
public void ArrayAsEnumerableAsRoot ()
{
var ds = new DataContractSerializer (typeof (IEnumerable<Guid>));
var sw = new StringWriter ();
using (var xw = XmlWriter.Create (sw, settings))
ds.WriteObject (xw, new Guid [] {Guid.Empty});
string xml = "<ArrayOfguid xmlns:i='http://www.w3.org/2001/XMLSchema-instance' xmlns='http://schemas.microsoft.com/2003/10/Serialization/Arrays'><guid>00000000-0000-0000-0000-000000000000</guid></ArrayOfguid>".Replace ('\'', '"');
Assert.AreEqual (xml, sw.ToString (), "#1");
}
}
[DataContract]
@@ -37,6 +37,7 @@ using System.CodeDom;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel.Description;
using System.Xml;
@@ -45,6 +46,8 @@ using System.Xml.Serialization;
using Microsoft.CSharp;
using NUnit.Framework;
using QName = System.Xml.XmlQualifiedName;
namespace MonoTests.System.Runtime.Serialization
{
[TestFixture]
@@ -68,6 +71,7 @@ namespace MonoTests.System.Runtime.Serialization
if (section.Metadata is XmlSchema)
xss.Add (section.Metadata as XmlSchema);
Assert.AreEqual (3, xss.Schemas ().Count, "#1");
return xss;
}
@@ -92,7 +96,6 @@ namespace MonoTests.System.Runtime.Serialization
[Test]
[ExpectedException (typeof (InvalidOperationException))]
[Category ("NotWorking")]
public void GetCodeTypeReferenceTest ()
{
XsdDataContractImporter xsdi = GetImporter ();
@@ -100,7 +103,6 @@ namespace MonoTests.System.Runtime.Serialization
}
[Test]
[Category ("NotWorking")]
public void GetCodeTypeReferenceTest2 ()
{
NewXmlSchemaSet ();
@@ -119,7 +121,6 @@ namespace MonoTests.System.Runtime.Serialization
}
[Test]
[Category ("NotWorking")]
public void CanImportTest ()
{
NewXmlSchemaSet ();
@@ -145,7 +146,6 @@ namespace MonoTests.System.Runtime.Serialization
}
[Test]
[Category ("NotWorking")]
public void CanImportTest2 ()
{
NewXmlSchemaSet ();
@@ -165,7 +165,6 @@ namespace MonoTests.System.Runtime.Serialization
[Test]
[ExpectedException (typeof (ArgumentNullException))]
[Category ("NotWorking")]
public void CanImportNullTest1 ()
{
XsdDataContractImporter xsdi = GetImporter ();
@@ -173,7 +172,6 @@ namespace MonoTests.System.Runtime.Serialization
}
[Test]
[Category ("NotWorking")]
[ExpectedException (typeof (ArgumentNullException))]
public void CanImportNullTest2 ()
{
@@ -182,7 +180,6 @@ namespace MonoTests.System.Runtime.Serialization
}
[Test]
[Category ("NotWorking")]
[ExpectedException (typeof (ArgumentNullException))]
public void CanImportNullTest3 ()
{
@@ -239,12 +236,13 @@ namespace MonoTests.System.Runtime.Serialization
}
[Test]
[Category ("NotWorking")]
[Category ("NotWorking")] // importing almost-invalid element. This test is almost missing the point.
public void ImportTest ()
{
XsdDataContractImporter xsdi = GetImporter ();
XmlSchemaElement element = new XmlSchemaElement();
//Assert.IsTrue (xsdi.CanImport (xss, element));
Assert.IsTrue (xsdi.CanImport (xss, new QName ("dc", "http://schemas.datacontract.org/2004/07/")), "#i01");
Assert.IsTrue (xsdi.CanImport (xss, element), "#i01-2");
Assert.AreEqual (new XmlQualifiedName ("anyType", XmlSchema.Namespace), xsdi.Import (xss, element), "#i02");
CodeCompileUnit ccu = xsdi.CodeCompileUnit;
@@ -259,7 +257,6 @@ namespace MonoTests.System.Runtime.Serialization
}
[Test]
[Category ("NotWorking")]
public void ImportDataContract1 ()
{
NewXmlSchemaSet ();
@@ -287,7 +284,6 @@ namespace MonoTests.System.Runtime.Serialization
}
[Test]
[Category ("NotWorking")]
public void ImportDataContract2 ()
{
NewXmlSchemaSet ();
@@ -316,7 +312,6 @@ namespace MonoTests.System.Runtime.Serialization
[Test]
[ExpectedException (typeof (InvalidDataContractException))]
[Category ("NotWorking")]
public void ImportMessageEcho ()
{
XsdDataContractImporter xsdi = GetImporter ();
@@ -324,7 +319,6 @@ namespace MonoTests.System.Runtime.Serialization
}
[Test]
[Category ("NotWorking")]
public void ImportAll ()
{
NewXmlSchemaSet ();
@@ -410,9 +404,16 @@ namespace MonoTests.System.Runtime.Serialization
}
CodeCompileUnit DoImport (params string [] schemaFiles)
{
return DoImport (false, schemaFiles);
}
CodeCompileUnit DoImport (bool xmlType, params string [] schemaFiles)
{
var ccu = new CodeCompileUnit ();
var xdi = new XsdDataContractImporter (ccu);
if (xmlType)
xdi.Options = new ImportOptions () { ImportXmlType = true };
var xss = new XmlSchemaSet ();
foreach (var schemaFile in schemaFiles)
xss.Add (null, schemaFile);
@@ -421,6 +422,23 @@ namespace MonoTests.System.Runtime.Serialization
return ccu;
}
void DoCanImport (bool result, params string [] schemaFiles)
{
var ccu = new CodeCompileUnit ();
var xdi = new XsdDataContractImporter (ccu);
var xss = new XmlSchemaSet ();
foreach (var schemaFile in schemaFiles)
xss.Add (null, schemaFile);
Assert.AreEqual (result, xdi.CanImport (xss));
}
string GenerateCode (CodeCompileUnit ccu)
{
var sw = new StringWriter ();
new CSharpCodeProvider ().GenerateCodeFromCompileUnit (ccu, sw, null);
return sw.ToString ();
}
// FIXME: this set of tests need further assertion in each test case. Right now it just checks if things import or fail just fine.
[Test]
@@ -429,18 +447,37 @@ namespace MonoTests.System.Runtime.Serialization
DoImport ("Test/Resources/Schemas/ns0.xsd");
}
[Test]
public void ImportTestX0_2 ()
{
var ccu = DoImport (true, "Test/Resources/Schemas/ns0.xsd");
Assert.IsTrue (GenerateCode (ccu).IndexOf ("class") < 0, "#1");
}
[Test]
public void ImportTestX1 ()
{
DoImport ("Test/Resources/Schemas/ns1.xsd");
}
[Test]
public void ImportTestX1_2 ()
{
Assert.AreEqual (GenerateCode (DoImport ("Test/Resources/Schemas/ns1.xsd")), GenerateCode (DoImport (true, "Test/Resources/Schemas/ns1.xsd")), "#1");
}
[Test]
public void ImportTestX2 ()
{
DoImport ("Test/Resources/Schemas/ns2.xsd");
}
[Test]
public void ImportTestX2_2 ()
{
Assert.AreEqual (GenerateCode (DoImport ("Test/Resources/Schemas/ns2.xsd")), GenerateCode (DoImport (true, "Test/Resources/Schemas/ns2.xsd")), "#1");
}
[Test]
[ExpectedException (typeof (InvalidDataContractException))]
public void ImportTestX3 ()
@@ -448,6 +485,19 @@ namespace MonoTests.System.Runtime.Serialization
DoImport ("Test/Resources/Schemas/ns3.xsd");
}
[Test]
[Category ("NotWorking")]
public void ImportTestX3_2 ()
{
var ccu = DoImport (true, "Test/Resources/Schemas/ns3.xsd");
var code = GenerateCode (ccu);
Assert.IsTrue (code.IndexOf ("class T2") > 0, "#1");
Assert.IsTrue (code.IndexOf ("IXmlSerializable") > 0, "#2");
Assert.IsTrue (code.IndexOf ("WriteXml") > 0, "#3");
Assert.IsTrue (code.IndexOf ("XmlRootAttribute(ElementName=\"E2\", Namespace=\"urn:bar\"") > 0, "#4");
Assert.IsTrue (code.IndexOf ("XmlSchemaProviderAttribute(\"ExportSchema\")") > 0, "#5");
}
[Test]
[ExpectedException (typeof (InvalidDataContractException))]
public void ImportTestX4 ()
@@ -632,6 +682,30 @@ namespace MonoTests.System.Runtime.Serialization
DoImport ("Test/Resources/Schemas/ns31.xsd");
}
[Test]
public void ImportTestX32 ()
{
DoImport ("Test/Resources/Schemas/ns32.xsd");
}
[Test]
public void ImportTestX33 ()
{
DoImport ("Test/Resources/Schemas/ns33.xsd");
}
[Test]
public void ImportTestX34 ()
{
DoImport (true, "Test/Resources/Schemas/ns34.xsd", "Test/Resources/Schemas/ns34_2.xsd");
}
[Test]
public void CanImportTestX34 ()
{
DoCanImport (false, "Test/Resources/Schemas/ns34.xsd", "Test/Resources/Schemas/ns34_2.xsd");
}
/* Helper methods */
private void CheckDC (CodeTypeDeclaration type, string name, Dictionary<string, string> members, string msg)
{
@@ -677,16 +751,19 @@ namespace MonoTests.System.Runtime.Serialization
private void CheckDataContractAttribute (CodeTypeDeclaration type, string msg)
{
Assert.AreEqual (3, type.CustomAttributes.Count, msg + "a");
// DebuggerStepThrouAttribute is insignificant. So, no reason to check the attribute count.
// Assert.AreEqual (3, type.CustomAttributes.Count, msg + "a");
// DebuggerStepThroughAttribute - skip it
//GeneratedCodeAttribute
CodeAttributeDeclaration ca = type.CustomAttributes [1];
Assert.AreEqual ("System.CodeDom.Compiler.GeneratedCodeAttribute", ca.Name, msg + "b");
var l = new List<CodeAttributeDeclaration> ();
foreach (CodeAttributeDeclaration a in type.CustomAttributes)
l.Add (a);
Assert.IsTrue (l.Any (a => a.Name == "System.CodeDom.Compiler.GeneratedCodeAttribute"), msg + "b");
ca = type.CustomAttributes [2];
Assert.AreEqual ("System.Runtime.Serialization.DataContractAttribute", ca.Name, msg + "c");
var ca = l.FirstOrDefault (a => a.Name == "System.Runtime.Serialization.DataContractAttribute");
Assert.IsNotNull (ca, msg + "b");
Assert.AreEqual (2, ca.Arguments.Count, msg + "d");
}
@@ -698,6 +775,11 @@ namespace MonoTests.System.Runtime.Serialization
return null;
}
[Test]
public void ImportXsdBuiltInTypes ()
{
DoImport ("Test/Resources/Schemas/xml.xsd");
}
}
}
+3 -1
View File
@@ -24,7 +24,9 @@ EXTRA_DISTFILES = \
Test/System.Security.Cryptography.Xml/sample.pfx \
Test/System.Security.Cryptography.Xml/EncryptedXmlSample1.xml \
Test/System.Security.Cryptography.Xml/EncryptedXmlSample2.xml \
Test/System.Security.Cryptography.Xml/EncryptedXmlSample3.xml
Test/System.Security.Cryptography.Xml/EncryptedXmlSample3.xml \
Test/System.Security.Cryptography.Pkcs/detached.data \
Test/System.Security.Cryptography.Pkcs/detached.p7
include ../../build/library.make
@@ -249,7 +249,13 @@ namespace System.Security.Cryptography.Pkcs {
ASN1 content = sd.ContentInfo.Content;
Oid oid = new Oid (sd.ContentInfo.ContentType);
_content = new ContentInfo (oid, content[0].Value);
if (!_detached || _content == null) {
if (content[0] == null)
throw new ArgumentException ("ContentInfo has no content. Detached signature ?");
_content = new ContentInfo (oid, content[0].Value);
}
foreach (Mono.Security.X509.X509Certificate x in sd.Certificates) {
_certs.Add (new X509Certificate2 (x.RawData));
@@ -437,6 +437,20 @@ namespace MonoTests.System.Security.Cryptography.Pkcs {
sp.CheckSignature (true);
CheckSignatureProperties (sp, 1);
}
[Test]
public void CheckSignatureDetachedSignedCms ()
{
string path = Path.Combine ("Test", "System.Security.Cryptography.Pkcs");
var signedBytes = File.ReadAllBytes (Path.Combine (path, "detached.data"));
var bytes = File.ReadAllBytes (Path.Combine (path, "detached.p7"));
var oid = new Oid ("1.2.840.113549.1.7.2");
var contentInfo = new ContentInfo (oid, signedBytes);
var signedCms = new SignedCms (contentInfo, true);
signedCms.Decode (bytes);
signedCms.CheckSignature (true);
}
}
}
@@ -120,6 +120,8 @@ namespace System.ServiceModel.Discovery.Udp
void SendCore (UdpClient cli, Message message, TimeSpan timeout)
{
Logger.LogMessage (MessageLogSourceKind.TransportSend, ref message, int.MaxValue);
var ms = new MemoryStream ();
message_encoder.WriteMessage (message, ms);
// It seems .NET sends the same Message a couple of times so that the receivers don't miss it. So, do the same hack.
@@ -195,6 +197,9 @@ namespace System.ServiceModel.Discovery.Udp
msg.Properties.Add ("Via", LocalAddress.Uri);
msg.Properties.Add ("Encoder", message_encoder);
msg.Properties.Add (RemoteEndpointMessageProperty.Name, new RemoteEndpointMessageProperty (ip.Address.ToString (), ip.Port));
Logger.LogMessage (MessageLogSourceKind.TransportReceive, ref msg, binding_element.MaxReceivedMessageSize);
return true;
}
@@ -80,7 +80,8 @@ namespace System.ServiceModel.Discovery.Version11
Channel.EndFind (result);
}, null);
if (!reply_find_handle.WaitOne (InnerChannel.OperationTimeout))
var timeout = InnerChannel.OperationTimeout < criteria.Duration ? InnerChannel.OperationTimeout : criteria.Duration;
if (!reply_find_handle.WaitOne (timeout))
throw new EndpointNotFoundException ("The discovery client could not receive Find operation response within the operation timeout.");
try {
var ir = find_completed ();
@@ -118,7 +119,8 @@ namespace System.ServiceModel.Discovery.Version11
Channel.EndResolve (result);
}, null);
if (!reply_resolve_handle.WaitOne (InnerChannel.OperationTimeout))
var timeout = InnerChannel.OperationTimeout < criteria.Duration ? InnerChannel.OperationTimeout : criteria.Duration;
if (!reply_find_handle.WaitOne (timeout))
throw new TimeoutException ();
try {
var ir = resolve_completed ();
@@ -80,7 +80,8 @@ namespace System.ServiceModel.Discovery.VersionApril2005
Channel.EndFind (result);
}, null);
if (!reply_find_handle.WaitOne (InnerChannel.OperationTimeout))
var timeout = InnerChannel.OperationTimeout < criteria.Duration ? InnerChannel.OperationTimeout : criteria.Duration;
if (!reply_find_handle.WaitOne (timeout))
throw new EndpointNotFoundException ("The discovery client could not receive Find operation response within the operation timeout.");
try {
var ir = find_completed ();
@@ -118,7 +119,8 @@ namespace System.ServiceModel.Discovery.VersionApril2005
Channel.EndResolve (result);
}, null);
if (!reply_resolve_handle.WaitOne (InnerChannel.OperationTimeout))
var timeout = InnerChannel.OperationTimeout < criteria.Duration ? InnerChannel.OperationTimeout : criteria.Duration;
if (!reply_find_handle.WaitOne (timeout))
throw new TimeoutException ();
try {
var ir = resolve_completed ();
@@ -80,7 +80,8 @@ namespace System.ServiceModel.Discovery.VersionCD1
Channel.EndFind (result);
}, null);
if (!reply_find_handle.WaitOne (InnerChannel.OperationTimeout))
var timeout = InnerChannel.OperationTimeout < criteria.Duration ? InnerChannel.OperationTimeout : criteria.Duration;
if (!reply_find_handle.WaitOne (timeout))
throw new EndpointNotFoundException ("The discovery client could not receive Find operation response within the operation timeout.");
try {
var ir = find_completed ();
@@ -118,7 +119,8 @@ namespace System.ServiceModel.Discovery.VersionCD1
Channel.EndResolve (result);
}, null);
if (!reply_resolve_handle.WaitOne (InnerChannel.OperationTimeout))
var timeout = InnerChannel.OperationTimeout < criteria.Duration ? InnerChannel.OperationTimeout : criteria.Duration;
if (!reply_find_handle.WaitOne (timeout))
throw new TimeoutException ();
try {
var ir = resolve_completed ();
@@ -145,32 +145,57 @@ namespace MonoTests.System.ServiceModel.Discovery
Assert.AreEqual (DiscoveryClientBindingElement.DiscoveryEndpointAddress, ch.RemoteAddress, "#1");
}
// This test takes a while, so I in fact don't want to enable it ...
class MyDiscoveryEndpointProvider2 : DiscoveryEndpointProvider
{
public MyDiscoveryEndpointProvider2 (DiscoveryEndpoint endpoint)
{
this.endpoint = endpoint;
}
DiscoveryEndpoint endpoint;
public override DiscoveryEndpoint GetDiscoveryEndpoint ()
{
return endpoint;
}
}
[Test]
[ExpectedException (typeof (EndpointNotFoundException))]
public void RequestChannelOpenFails ()
{
var be = new DiscoveryClientBindingElement ();
// Note that this explicitly sets shorter timeout than open timeout for the channel.
// If it is longer, then TimeoutException will occur instgead,
// as the client doesn't expect longer than FindCriteria.Duration.
be.FindCriteria.Duration = TimeSpan.FromSeconds (3);
var bc = new BindingContext (new CustomBinding (be, new HttpTransportBindingElement ()), new BindingParameterCollection ());
var cf = be.BuildChannelFactory<IRequestChannel> (bc);
cf.Open ();
Assert.IsNull (cf.GetProperty<DiscoveryEndpoint> (), "#1");
var ch = cf.CreateChannel (DiscoveryClientBindingElement.DiscoveryEndpointAddress);
Assert.IsNull (ch.GetProperty<DiscoveryEndpoint> (), "#2");
ch.Open (TimeSpan.FromSeconds (80));
DateTime start = DateTime.Now;
ch.Open (TimeSpan.FromSeconds (5));
Assert.IsTrue (DateTime.Now - start < TimeSpan.FromSeconds (15), "It is likely that FindCriteria.Duration is ignored");
}
// This test takes a while, so I in fact don't want to enable it ...
[Test]
[ExpectedException (typeof (EndpointNotFoundException))]
public void RequestChannelOpenFails2 ()
{
var be = new DiscoveryClientBindingElement ();
// (The comment on RequestChannelOpenFails() applies here too.)
be.FindCriteria.Duration = TimeSpan.FromSeconds (3);
var bc = new BindingContext (new CustomBinding (be, new TcpTransportBindingElement ()), new BindingParameterCollection ());
var cf = be.BuildChannelFactory<IDuplexSessionChannel> (bc);
cf.Open ();
var ch = cf.CreateChannel (DiscoveryClientBindingElement.DiscoveryEndpointAddress);
ch.Open (TimeSpan.FromSeconds (80));
DateTime start = DateTime.Now;
ch.Open (TimeSpan.FromSeconds (5));
Assert.IsTrue (DateTime.Now - start < TimeSpan.FromSeconds (15), "It is likely that FindCriteria.Duration is ignored");
}
[Test]
@@ -27,7 +27,6 @@
//
using System;
using System.IO;
using System.Net.Mime;
using System.Runtime.Serialization.Json;
using System.ServiceModel;
using System.ServiceModel.Dispatcher;
@@ -84,7 +83,7 @@ namespace System.ServiceModel.Channels
contentType = contentType ?? "application/octet-stream";
Encoding enc = Encoding.UTF8;
ContentType ct = new ContentType (contentType);
var ct = new System.Net.Mime.ContentType (contentType);
if (ct.CharSet != null)
enc = Encoding.GetEncoding (ct.CharSet);
@@ -131,6 +130,7 @@ namespace System.ServiceModel.Channels
}
if (wp != null)
msg.Properties.Add (WebBodyFormatMessageProperty.Name, wp);
msg.Properties.Encoder = this;
return msg;
}
@@ -3,8 +3,10 @@
//
// Author:
// Atsushi Enomoto <[email protected]>
// Atsushi Enomoto <[email protected]>
//
// Copyright (C) 2008,2009 Novell, Inc (http://www.novell.com)
// Copyright (C) 2011 Xamarin, Inc (http://xamarin.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
@@ -45,6 +47,24 @@ using XmlObjectSerializer = System.Object;
namespace System.ServiceModel.Dispatcher
{
// This set of classes is to work as message formatters for
// WebHttpBehavior. There are couple of aspects to differentiate
// implementations:
// - request/reply and client/server
// by WebMessageFormatter hierarchy
// - WebClientMessageFormatter - for client
// - RequestClientFormatter - for request
// - ReplyClientFormatter - for response
// - WebDispatchMessageFormatter - for server
// - RequestDispatchFormatter - for request
// - ReplyDispatchFormatter - for response
//
// FIXME: below items need more work
// - HTTP method differences
// - GET (WebGet)
// - POST (other way)
// - output format: Stream, JSON, XML ...
internal abstract class WebMessageFormatter
{
OperationDescription operation;
@@ -182,6 +202,9 @@ namespace System.ServiceModel.Dispatcher
protected XmlObjectSerializer GetSerializer (WebContentFormat msgfmt, bool isWrapped, MessagePartDescription part)
{
if (part.Type == typeof (void))
return null; // no serialization should be done.
switch (msgfmt) {
case WebContentFormat.Xml:
if (xml_serializer == null)
@@ -208,6 +231,9 @@ namespace System.ServiceModel.Dispatcher
// FIXME: handle ref/out parameters
var reader = message.GetReaderAtBodyContents ();
reader.MoveToContent ();
bool wasEmptyElement = reader.IsEmptyElement;
if (isWrapped) {
if (fmt == WebContentFormat.Json)
@@ -216,9 +242,9 @@ namespace System.ServiceModel.Dispatcher
reader.ReadStartElement (md.Body.WrapperName, md.Body.WrapperNamespace);
}
var ret = ReadObjectBody (serializer, reader);
var ret = (serializer == null) ? null : ReadObjectBody (serializer, reader);
if (isWrapped)
if (isWrapped && !wasEmptyElement)
reader.ReadEndElement ();
return ret;
@@ -291,6 +317,8 @@ namespace System.ServiceModel.Dispatcher
internal abstract class WebClientMessageFormatter : WebMessageFormatter, IClientMessageFormatter
{
IClientMessageFormatter default_formatter;
protected WebClientMessageFormatter (OperationDescription operation, ServiceEndpoint endpoint, QueryStringConverter converter, WebHttpBehavior behavior)
: base (operation, endpoint, converter, behavior)
{
@@ -306,11 +334,11 @@ namespace System.ServiceModel.Dispatcher
MessageDescription md = GetMessageDescription (MessageDirection.Input);
if (parameters.Length != md.Body.Parts.Count)
throw new ArgumentException ("Parameter array length does not match the number of message body parts");
Message ret;
Uri to;
object msgpart = null;
for (int i = 0; i < parameters.Length; i++) {
var p = md.Body.Parts [i];
string name = p.Name.ToUpper (CultureInfo.InvariantCulture);
@@ -325,10 +353,9 @@ namespace System.ServiceModel.Dispatcher
throw new NotImplementedException (String.Format ("More than one parameters including {0} that are not contained in the URI template {1} was found.", p.Name, UriTemplate));
}
}
ret = Message.CreateMessage (messageVersion, (string) null, msgpart);
Uri to = UriTemplate.BindByName (Endpoint.Address.Uri, c);
Message ret = Message.CreateMessage (messageVersion, (string) null, msgpart);
to = UriTemplate.BindByName (Endpoint.Address.Uri, c);
ret.Headers.To = to;
var hp = new HttpRequestMessageProperty ();
@@ -544,18 +571,10 @@ namespace System.ServiceModel.Dispatcher
var wp = message.Properties [WebBodyFormatMessageProperty.Name] as WebBodyFormatMessageProperty;
var fmt = wp != null ? wp.Format : WebContentFormat.Xml;
if (fmt == WebContentFormat.Raw) {
var rmsg = (RawMessage) message;
parameters [0] = rmsg.Stream;
return;
}
Uri to = message.Headers.To;
UriTemplateMatch match = UriTemplate.Match (Endpoint.Address.Uri, to);
if (match == null)
// not sure if it could happen
throw new SystemException (String.Format ("INTERNAL ERROR: UriTemplate does not match with the request: {0} / {1}", UriTemplate, to));
if (iwc != null)
UriTemplateMatch match = to == null ? null : UriTemplate.Match (Endpoint.Address.Uri, to);
if (match != null && iwc != null)
iwc.UriTemplateMatch = match;
MessageDescription md = GetMessageDescription (MessageDirection.Input);
@@ -563,12 +582,20 @@ namespace System.ServiceModel.Dispatcher
for (int i = 0; i < parameters.Length; i++) {
var p = md.Body.Parts [i];
string name = p.Name.ToUpperInvariant ();
var str = match.BoundVariables [name];
if (str != null)
parameters [i] = Converter.ConvertStringToValue (str, p.Type);
else {
var serializer = GetSerializer (fmt, IsRequestBodyWrapped, p);
parameters [i] = DeserializeObject (serializer, message, md, IsRequestBodyWrapped, fmt);
if (fmt == WebContentFormat.Raw && p.Type == typeof (Stream)) {
var rmsg = (RawMessage) message;
parameters [i] = rmsg.Stream;
} else {
var str = match.BoundVariables [name];
if (str != null)
parameters [i] = Converter.ConvertStringToValue (str, p.Type);
else {
if (info.Method != "GET") {
var serializer = GetSerializer (fmt, IsRequestBodyWrapped, p);
parameters [i] = DeserializeObject (serializer, message, md, IsRequestBodyWrapped, fmt);
}
// for GET Uri template parameters, there is no <anyType xsi:nil='true' />. So just skip the member.
}
}
}
}
@@ -604,7 +631,57 @@ namespace System.ServiceModel.Dispatcher
protected override void OnWriteBodyContents (XmlDictionaryWriter writer)
{
throw new NotSupportedException ();
writer.WriteString ("-- message body is raw binary --");
}
protected override MessageBuffer OnCreateBufferedCopy (int maxBufferSize)
{
var ms = Stream as MemoryStream;
if (ms == null) {
ms = new MemoryStream ();
#if NET_4_0 || NET_2_1
Stream.CopyTo (ms);
#else
byte [] tmp = new byte [0x1000];
int size;
do {
size = Stream.Read (tmp, 0, tmp.Length);
ms.Write (tmp, 0, size);
} while (size > 0);
#endif
this.Stream = ms;
}
return new RawMessageBuffer (ms.ToArray (), headers, properties);
}
}
internal class RawMessageBuffer : MessageBuffer
{
byte [] buffer;
MessageHeaders headers;
MessageProperties properties;
public RawMessageBuffer (byte [] buffer, MessageHeaders headers, MessageProperties properties)
{
this.buffer = buffer;
this.headers = new MessageHeaders (headers);
this.properties = new MessageProperties (properties);
}
public override int BufferSize {
get { return buffer.Length; }
}
public override void Close ()
{
}
public override Message CreateMessage ()
{
var msg = new RawMessage (new MemoryStream (buffer));
msg.Headers.CopyHeadersFrom (headers);
msg.Properties.CopyProperties (properties);
return msg;
}
}
}
@@ -27,9 +27,14 @@
//
using System;
using System.ComponentModel;
using System.Linq;
using System.ServiceModel.Channels;
using System.Text;
using System.Xml;
#if !NET_2_1
using System.Configuration;
using System.ServiceModel.Configuration;
#endif
namespace System.ServiceModel
{
@@ -41,11 +46,34 @@ namespace System.ServiceModel
#endif
{
public WebHttpBinding ()
: this (WebHttpSecurityMode.None)
: this (String.Empty)
{
}
public WebHttpBinding (WebHttpSecurityMode mode)
{
Initialize (mode);
}
public WebHttpBinding (string configurationName)
{
#if !NET_2_1
BindingsSection bindingsSection = ConfigUtil.BindingsSection;
WebHttpBindingElement el = (WebHttpBindingElement) bindingsSection ["webHttpBinding"].ConfiguredBindings.FirstOrDefault (c => c.Name == configurationName);
if (el != null) {
Initialize (el.Security.Mode); // to initialize Transport correctly.
el.ApplyConfiguration (this);
}
else if (!String.IsNullOrEmpty (configurationName))
throw new ConfigurationException (String.Format ("Specified webHttpBinding configuration '{0}' was not found", configurationName));
else
Initialize (WebHttpSecurityMode.None);
#else
Initialize (WebHttpSecurityMode.None);
#endif
}
void Initialize (WebHttpSecurityMode mode)
{
security.Mode = mode;
// MSDN says that this security mode can be set only
@@ -55,12 +83,6 @@ namespace System.ServiceModel
t.ManualAddressing = true;
}
[MonoTODO]
public WebHttpBinding (string configurationName)
{
throw new NotImplementedException ();
}
WebHttpSecurity security = new WebHttpSecurity ();
HttpTransportBindingElement t;
// This can be changed only using <synchronousReceive> configuration element.
@@ -44,6 +44,7 @@ namespace System
string template;
ReadOnlyCollection<string> path, query;
string wild_path_name;
Dictionary<string,string> query_params = new Dictionary<string,string> ();
public UriTemplate (string template)
@@ -162,6 +163,15 @@ namespace System
void BindByName (ref int src, StringBuilder sb, ReadOnlyCollection<string> names, NameValueCollection nvc, IDictionary<string,string> dic, bool omitDefaults, bool query)
{
if (query) {
int idx = template.IndexOf ('?', src);
if (idx > 0) {
sb.Append (template.Substring (src, idx - src));
src = idx;
// note that it doesn't append '?'. It is added only when there is actual parameter binding.
}
}
foreach (string name in names) {
int s = template.IndexOf ('{', src);
int e = template.IndexOf ('}', s + 1);
@@ -172,18 +182,19 @@ namespace System
#endif
if (dic != null)
dic.TryGetValue (name, out value);
if (query) {
if (value != null || (!omitDefaults && Defaults.TryGetValue (name, out value))) {
sb.Append (template.Substring (src, s - src));
sb.Append (value);
}
} else
if (value == null && (omitDefaults || !Defaults.TryGetValue(name, out value)))
throw new ArgumentException(string.Format("The argument name value collection does not contain non-nul vaalue for '{0}'", name), "parameters");
else {
sb.Append (template.Substring (src, s - src));
sb.Append (value);
}
} else {
if (value == null && (omitDefaults || !Defaults.TryGetValue (name, out value)))
throw new ArgumentException (string.Format("The argument name value collection does not contain non-null value for '{0}'", name), "parameters");
sb.Append (template.Substring (src, s - src));
sb.Append (value);
}
src = e + 1;
}
}
@@ -245,9 +256,6 @@ namespace System
candidate = new Uri(candidate.GetComponents (UriComponents.SchemeAndServer | UriComponents.Path, UriFormat.Unescaped) + '/' + candidate.Query, candidate.IsAbsoluteUri ? UriKind.Absolute : UriKind.RelativeOrAbsolute);
}
if (Uri.Compare (baseAddress, candidate, UriComponents.StrongAuthority, UriFormat.SafeUnescaped, StringComparison.Ordinal) != 0)
return null;
int i = 0, c = 0;
UriTemplateMatch m = new UriTemplateMatch ();
m.BaseUri = baseAddress;
@@ -255,7 +263,7 @@ namespace System
m.RequestUri = candidate;
var vc = m.BoundVariables;
string cp = Uri.UnescapeDataString (baseAddress.MakeRelativeUri (candidate).ToString ());
string cp = Uri.UnescapeDataString (baseAddress.MakeRelativeUri (new Uri (baseAddress, candidate.GetComponents (UriComponents.PathAndQuery, UriFormat.Unescaped))).ToString ());
if (IgnoreTrailingSlash && cp [cp.Length - 1] == '/')
cp = cp.Substring (0, cp.Length - 1);
@@ -269,6 +277,10 @@ namespace System
c++;
foreach (string name in path) {
if (name == wild_path_name) {
vc [name] = cp.Substring (c); // all remaining paths.
continue;
}
int n = StringIndexOf (template, '{' + name + '}', i);
if (String.CompareOrdinal (cp, c, template, i, n - i) != 0)
return null; // doesn't match before current template part.
@@ -285,11 +297,12 @@ namespace System
c += value.Length;
}
int tEnd = template.IndexOf ('?');
int wildIdx = template.IndexOf ('*');
bool wild = wildIdx >= 0;
if (tEnd < 0)
tEnd = template.Length;
bool wild = (template [tEnd - 1] == '*');
if (wild)
tEnd--;
tEnd = wildIdx - 1;
if (!wild && (cp.Length - c) != (tEnd - i) ||
String.CompareOrdinal (cp, c, template, i, tEnd - i) != 0)
return null; // suffix doesn't match
@@ -337,8 +350,9 @@ namespace System
ReadOnlyCollection<string> ParsePathTemplate (string template, int index, int end)
{
int widx = template.IndexOf ('*', index, end);
if (widx >= 0 && widx != end - 1)
throw new FormatException (String.Format ("Wildcard in UriTemplate is valid only if it is placed at the last part of the path: '{0}'", template));
if (widx >= 0)
if (widx != end - 1 && template.IndexOf ('}', widx) != end - 1)
throw new FormatException (String.Format ("Wildcard in UriTemplate is valid only if it is placed at the last part of the path: '{0}'", template));
List<string> list = null;
int prevEnd = -2;
for (int i = index; i <= end; ) {
@@ -356,6 +370,8 @@ namespace System
i++;
string name = template.Substring (i, e - i);
string uname = name.ToUpper (CultureInfo.InvariantCulture);
if (uname [0] == '*')
uname = wild_path_name = uname.Substring (1);
if (list.Contains (uname) || (path != null && path.Contains (uname)))
throw new InvalidOperationException (String.Format ("The URI template string contains duplicate template item {{'{0}'}}", name));
list.Add (uname);
@@ -0,0 +1,321 @@
//
// This code was partly auto-generated by slsvcutil, version 4.0.60310.0
//
namespace DHIWebService
{
using System.Runtime.Serialization;
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")]
[System.Runtime.Serialization.DataContractAttribute(Name="ClientLoginData", Namespace="http://schemas.datacontract.org/2004/07/Domain.Models")]
public partial class ClientLoginData : object
{
private int CompanyNumberField;
private string InstitutionIdField;
private string PasswordField;
private string UserNameField;
[System.Runtime.Serialization.DataMemberAttribute()]
public int CompanyNumber
{
get
{
return this.CompanyNumberField;
}
set
{
this.CompanyNumberField = value;
}
}
[System.Runtime.Serialization.DataMemberAttribute()]
public string InstitutionId
{
get
{
return this.InstitutionIdField;
}
set
{
this.InstitutionIdField = value;
}
}
[System.Runtime.Serialization.DataMemberAttribute(IsRequired=true)]
public string Password
{
get
{
return this.PasswordField;
}
set
{
this.PasswordField = value;
}
}
[System.Runtime.Serialization.DataMemberAttribute(IsRequired=true)]
public string UserName
{
get
{
return this.UserNameField;
}
set
{
this.UserNameField = value;
}
}
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")]
[System.Runtime.Serialization.DataContractAttribute(Name="Login", Namespace="http://schemas.datacontract.org/2004/07/Domain.Models")]
public partial class Login : object
{
private int CompanyNumberField;
private string InstitutionIdField;
private string PasswordField;
private string UserNameField;
[System.Runtime.Serialization.DataMemberAttribute()]
public int CompanyNumber
{
get
{
return this.CompanyNumberField;
}
set
{
this.CompanyNumberField = value;
}
}
[System.Runtime.Serialization.DataMemberAttribute()]
public string InstitutionId
{
get
{
return this.InstitutionIdField;
}
set
{
this.InstitutionIdField = value;
}
}
[System.Runtime.Serialization.DataMemberAttribute(IsRequired=true)]
public string Password
{
get
{
return this.PasswordField;
}
set
{
this.PasswordField = value;
}
}
[System.Runtime.Serialization.DataMemberAttribute(IsRequired=true)]
public string UserName
{
get
{
return this.UserNameField;
}
set
{
this.UserNameField = value;
}
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
[System.ServiceModel.ServiceContractAttribute(Namespace="IBEWebSvc", ConfigurationName="DHIWebService.IDHIService")]
public interface IDHIService
{
[System.ServiceModel.OperationContractAttribute(AsyncPattern=true, Action="IBEWebSvc/IDHIService/Login", ReplyAction="IBEWebSvc/IDHIService/LoginResponse")]
// FIXME: uncommenting this results in cryptic error message. We should tell what could be wrong here.
// [System.ServiceModel.Web.WebInvoke(BodyStyle=System.ServiceModel.Web.WebMessageBodyStyle.Wrapped)]
System.IAsyncResult BeginLogin(DHIWebService.LoginRequest request, System.AsyncCallback callback, object asyncState);
DHIWebService.LoginResponse EndLogin(System.IAsyncResult result);
[System.ServiceModel.OperationContractAttribute(Action="IBEWebSvc/IDHIService/Login", ReplyAction="IBEWebSvc/IDHIService/LoginResponse")]
[System.ServiceModel.Web.WebInvoke(BodyStyle=System.ServiceModel.Web.WebMessageBodyStyle.Wrapped)]
DHIWebService.LoginResponse Login(DHIWebService.LoginRequest request);
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
[System.ServiceModel.MessageContractAttribute(WrapperName="Login", WrapperNamespace="IBEWebSvc", IsWrapped=true)]
public partial class LoginRequest
{
[System.ServiceModel.MessageBodyMemberAttribute(Namespace="IBEWebSvc", Order=0)]
public DHIWebService.ClientLoginData clientLoginData;
[System.ServiceModel.MessageBodyMemberAttribute(Namespace="IBEWebSvc", Order=1)]
public DHIWebService.Login credentials;
public LoginRequest()
{
}
public LoginRequest(DHIWebService.ClientLoginData clientLoginData, DHIWebService.Login credentials)
{
this.clientLoginData = clientLoginData;
this.credentials = credentials;
}
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
[System.ServiceModel.MessageContractAttribute(WrapperName="LoginResponse", WrapperNamespace="IBEWebSvc", IsWrapped=true)]
public partial class LoginResponse
{
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
public interface IDHIServiceChannel : DHIWebService.IDHIService, System.ServiceModel.IClientChannel
{
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
public partial class LoginCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs
{
private object[] results;
public LoginCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState)
{
this.results = results;
}
public DHIWebService.LoginResponse Result
{
get
{
base.RaiseExceptionIfNecessary();
return ((DHIWebService.LoginResponse)(this.results[0]));
}
}
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
public partial class DHIServiceClient : System.ServiceModel.ClientBase<DHIWebService.IDHIService>, DHIWebService.IDHIService
{
private BeginOperationDelegate onBeginLoginDelegate;
private EndOperationDelegate onEndLoginDelegate;
private System.Threading.SendOrPostCallback onLoginCompletedDelegate;
public DHIServiceClient()
{
}
public DHIServiceClient(string endpointConfigurationName) :
base(endpointConfigurationName)
{
}
public DHIServiceClient(string endpointConfigurationName, string remoteAddress) :
base(endpointConfigurationName, remoteAddress)
{
}
public DHIServiceClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) :
base(endpointConfigurationName, remoteAddress)
{
}
public DHIServiceClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) :
base(binding, remoteAddress)
{
}
public event System.EventHandler<LoginCompletedEventArgs> LoginCompleted;
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
System.IAsyncResult DHIWebService.IDHIService.BeginLogin(DHIWebService.LoginRequest request, System.AsyncCallback callback, object asyncState)
{
return base.Channel.BeginLogin(request, callback, asyncState);
}
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
DHIWebService.LoginResponse DHIWebService.IDHIService.EndLogin(System.IAsyncResult result)
{
return base.Channel.EndLogin(result);
}
private System.IAsyncResult OnBeginLogin(object[] inValues, System.AsyncCallback callback, object asyncState)
{
DHIWebService.LoginRequest request = ((DHIWebService.LoginRequest)(inValues[0]));
return ((DHIWebService.IDHIService)(this)).BeginLogin(request, callback, asyncState);
}
private object[] OnEndLogin(System.IAsyncResult result)
{
DHIWebService.LoginResponse retVal = ((DHIWebService.IDHIService)(this)).EndLogin(result);
return new object[] {
retVal};
}
private void OnLoginCompleted(object state)
{
if ((this.LoginCompleted != null))
{
InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
this.LoginCompleted(this, new LoginCompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState));
}
}
public void LoginAsync(DHIWebService.LoginRequest request)
{
this.LoginAsync(request, null);
}
public void LoginAsync(DHIWebService.LoginRequest request, object userState)
{
if ((this.onBeginLoginDelegate == null))
{
this.onBeginLoginDelegate = new BeginOperationDelegate(this.OnBeginLogin);
}
if ((this.onEndLoginDelegate == null))
{
this.onEndLoginDelegate = new EndOperationDelegate(this.OnEndLogin);
}
if ((this.onLoginCompletedDelegate == null))
{
this.onLoginCompletedDelegate = new System.Threading.SendOrPostCallback(this.OnLoginCompleted);
}
base.InvokeAsync(this.onBeginLoginDelegate, new object[] {
request}, this.onEndLoginDelegate, this.onLoginCompletedDelegate, userState);
}
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
DHIWebService.LoginResponse DHIWebService.IDHIService.Login (DHIWebService.LoginRequest request)
{
return base.Channel.Login(request);
}
}
}
@@ -241,7 +241,6 @@ namespace MonoTests.System.ServiceModel.Description
var se = new ServiceEndpoint (cd, new WebHttpBinding (), new EndpointAddress ("http://localhost:8080/"));
var wmebe = new WebMessageEncodingBindingElement ();
var wme = wmebe.CreateMessageEncoderFactory ().Encoder;
Console.WriteLine (wme.MediaType);
var msg = wme.ReadMessage (ms, 100, null); // "application/xml" causes error.
var formatter = new WebHttpBehaviorExt ().DoGetRequestDispatchFormatter (od, se);
object [] pars = new object [1];
@@ -256,6 +256,7 @@ namespace MonoTests.System.ServiceModel.Dispatcher
{
var host = new WebServiceHost (typeof (Hello));
host.AddServiceEndpoint (typeof (IHello), new WebHttpBinding (), "http://localhost:37564/");
host.Description.Behaviors.Find<ServiceDebugBehavior> ().IncludeExceptionDetailInFaults = true;
host.Open ();
try {
// run client
@@ -228,6 +228,15 @@ namespace MonoTests.System
Assert.AreEqual ("http://localhost/x/value2/value1", u.ToString ());
}
[Test]
public void BindByName3 ()
{
var t = new UriTemplate ("Login?clientLoginData={clientLoginData}&credentials={credentials}");
var n = new NameValueCollection ();
var u = t.BindByName (new Uri ("http://localhost"), n);
Assert.AreEqual ("http://localhost/Login", u.ToString (), "#1");
}
[Test]
public void BindByNameManySlashes ()
{
@@ -458,5 +467,13 @@ namespace MonoTests.System
Assert.AreEqual ("http://localhost:8080/id-aaa/bbb", uri.ToString ());
}
[Test]
public void NamedWildcard ()
{
UriTemplate template = new UriTemplate ("{*path}");
UriTemplateMatch match = template.Match (new Uri ("http://localhost"), new Uri ("http://localhost/something"));
Assert.IsNotNull (match, "#1");
Assert.AreEqual ("something", match.BoundVariables ["path"], "#2");
}
}
}
+4 -1
View File
@@ -1,6 +1,7 @@
using System.Reflection;
using System.Runtime.Serialization;
#if !MOBILE
namespace System.Runtime.CompilerServices
{
// introduced for silverlight sdk compatibility
@@ -11,6 +12,7 @@ namespace System.Runtime.CompilerServices
}
}
}
#endif
namespace System.ServiceModel
{
@@ -102,6 +104,7 @@ namespace System.ServiceModel.Security
{
class Dummy {}
}
#if !MOBILE
namespace System.Net.Security
{
public enum ProtectionLevel {None}
@@ -118,4 +121,4 @@ namespace Mono.Xml.XPath
{
class Dummy {}
}
#endif
+2
View File
@@ -10,6 +10,7 @@ LIBRARY = System.ServiceModel.dll
LIB_MCS_FLAGS = \
/nowarn:414,169,67,3005,436,219,618 \
/unsafe \
/d:TRACE \
/r:System.dll \
/r:System.Xml.dll \
/r:System.Core.dll \
@@ -44,6 +45,7 @@ TEST_EXTRA_FILES = \
System.ServiceModel_test_net_3_0.dll.config \
Test/config/* \
Test/Resources/* \
Test/XmlFiles/* \
Test/System.ServiceModel.Description/dump.xml
EXTRA_DISTFILES = $(RESOURCE_FILES) $(TEST_EXTRA_FILES)
@@ -0,0 +1,41 @@
using System;
using System.IO;
using System.Runtime.Serialization;
using System.ServiceModel.Channels;
namespace System.IO
{
public class PipeException : IOException
{
public PipeException ()
{
}
public PipeException (string message): base (message)
{
}
protected PipeException (SerializationInfo info, StreamingContext context)
: base (info, context)
{
}
public PipeException (string message, Exception inner)
: base (message, inner)
{
}
public PipeException (string message, int errorCode)
: base (message, errorCode)
{
}
public virtual int ErrorCode {
get {
// we re-use the HResult for the error code here.
return HResult;
}
}
}
}
@@ -164,6 +164,8 @@ namespace System.ServiceModel.Channels.Http
public abstract string ContentType { get; }
public abstract string HttpMethod { get; }
public abstract Stream InputStream { get; }
public abstract string ClientIPAddress { get; }
public abstract int ClientPort { get; }
}
class HttpStandaloneRequestInfo : HttpRequestInfo
@@ -196,6 +198,12 @@ namespace System.ServiceModel.Channels.Http
public override Stream InputStream {
get { return req.InputStream; }
}
public override string ClientIPAddress {
get { return req.RemoteEndPoint.Address.ToString (); }
}
public override int ClientPort {
get { return req.RemoteEndPoint.Port; }
}
}
class AspNetHttpRequestInfo : HttpRequestInfo
@@ -228,6 +236,12 @@ namespace System.ServiceModel.Channels.Http
public override Stream InputStream {
get { return req.InputStream; }
}
public override string ClientIPAddress {
get { return req.UserHostAddress; }
}
public override int ClientPort {
get { return -1; } // cannot retrieve
}
}
// Response
@@ -111,11 +111,7 @@ namespace System.ServiceModel.Channels.Http
{
var l = new HttpListener ();
#if false // FIXME: enable this once we found out why this causes problem
string uriString = element.HostNameComparisonMode == HostNameComparisonMode.Exact ? uri.ToString () : uri.Scheme + "://*" + uri.GetComponents (UriComponents.Port | UriComponents.Path, UriFormat.SafeUnescaped);
#else
string uriString = uri.ToString ();
#endif
if (!uriString.EndsWith ("/", StringComparison.Ordinal))
uriString += "/"; // HttpListener requires this mess.
@@ -57,6 +57,10 @@ namespace System.ServiceModel.Channels.Http
}
}
internal HttpChannelListener<IReplyChannel> Source {
get { return source; }
}
public MessageEncoder Encoder {
get { return source.MessageEncoder; }
}
@@ -176,7 +180,7 @@ namespace System.ServiceModel.Channels.Http
msg.Properties.Add ("Via", LocalAddress.Uri);
msg.Properties.Add (HttpRequestMessageProperty.Name, CreateRequestProperty (ctxi));
Logger.LogMessage (MessageLogSourceKind.TransportReceive, ref msg, 0x10000); // FIXME: pass maxMessageSize.
Logger.LogMessage (MessageLogSourceKind.TransportReceive, ref msg, source.Source.MaxReceivedMessageSize);
context = new HttpRequestContext (this, ctxi, msg);
reqctx = context;
@@ -235,6 +239,7 @@ namespace System.ServiceModel.Channels.Http
msg.Headers.Action = action;
}
}
msg.Properties.Add (RemoteEndpointMessageProperty.Name, new RemoteEndpointMessageProperty (ctxi.Request.ClientIPAddress, ctxi.Request.ClientPort));
return msg;
}
@@ -133,6 +133,8 @@ namespace System.ServiceModel.Channels.Http
if (msg == null)
throw new ArgumentNullException ("msg");
Logger.LogMessage (MessageLogSourceKind.TransportSend, ref msg, Channel.Source.Source.MaxReceivedMessageSize);
MemoryStream ms = new MemoryStream ();
Channel.Encoder.WriteMessage (msg, ms);
Context.Response.ContentType = Channel.Encoder.ContentType;
@@ -34,6 +34,7 @@ using System.Net;
using System.Net.Security;
using System.Net.Sockets;
using System.ServiceModel;
using System.ServiceModel.Channels.NetTcp;
using System.ServiceModel.Description;
using System.ServiceModel.PeerResolvers;
using System.ServiceModel.Security;
@@ -38,7 +38,7 @@ using System.Text;
using System.Threading;
using System.Xml;
namespace System.ServiceModel.Channels
namespace System.ServiceModel.Channels.NetTcp
{
// seealso: [MC-NMF] Windows Protocol document.
class TcpBinaryFrameManager
@@ -17,7 +17,7 @@ using System.ServiceModel.Security;
using System.Text;
using System.Xml;
namespace System.ServiceModel.Channels
namespace System.ServiceModel.Channels.NetTcp
{
internal class TcpChannelInfo
{
@@ -38,7 +38,7 @@ using System.Text;
using System.Threading;
using System.Xml;
namespace System.ServiceModel.Channels
namespace System.ServiceModel.Channels.NetTcp
{
internal class TcpChannelListener<TChannel> : InternalChannelListenerBase<TChannel>
where TChannel : class, IChannel
@@ -41,7 +41,7 @@ using System.Text;
using System.Threading;
using System.Xml;
namespace System.ServiceModel.Channels
namespace System.ServiceModel.Channels.NetTcp
{
internal class TcpDuplexSessionChannel : DuplexChannelBase, IDuplexSessionChannel
{
@@ -147,6 +147,9 @@ namespace System.ServiceModel.Channels
}
client.SendTimeout = (int) timeout.TotalMilliseconds;
Logger.LogMessage (MessageLogSourceKind.TransportSend, ref message, info.BindingElement.MaxReceivedMessageSize);
frame.WriteSizedMessage (message);
}
@@ -164,12 +167,16 @@ namespace System.ServiceModel.Channels
if (timeout <= TimeSpan.Zero)
throw new ArgumentException (String.Format ("Timeout value must be positive value. It was {0}", timeout));
client.ReceiveTimeout = (int) timeout.TotalMilliseconds;
message = frame.ReadSizedMessage ();
// FIXME: this may not be precise, but connection might be reused for some weird socket state transition (that's what happens). So as a workaround, avoid closing the session by sending EndRecord from this channel at OnClose().
if (message == null) {
session = null;
return false;
}
Logger.LogMessage (MessageLogSourceKind.TransportReceive, ref message, info.BindingElement.MaxReceivedMessageSize);
return true;
}
Loaded 100 of 468 files, more files were not shown because too many files have changed in this diff. Show more