Compare commits

..
301 Commits
Author SHA1 Message Date
Gonzalo Paniagua Javier 27589b59b9 2009-03-11 Gonzalo Paniagua Javier <[email protected]>
* InotifyWatcher.cs: don't send events when a directory is created
	unless it matches the pattern.  Fixes bug #484082.


svn path=/branches/mono-2-4-0/mcs/; revision=129114
2009-03-12 00:33:26 +00:00
Zoltan Varga 8f4c7c9e1a 2009-03-11 Zoltan Varga <[email protected]>
* mini-amd64.c (mono_arch_output_basic_block): Fix % 1. Fixes #484323.

	* basic.cs: Add a test.

svn path=/branches/mono-2-4/mono/; revision=129066
2009-03-11 14:29:38 +00:00
Mark Probst 950b5dc41b 2009-03-11 Mark Probst <[email protected]>
* mini-x86.c (mono_arch_output_basic_block): Use different
	registers in case the ones we want to overwrite are used by the
	other operand.  Fixes regression in #480807.

	Backport of r129058.

svn path=/branches/mono-2-4/mono/; revision=129064
2009-03-11 14:27:20 +00:00
Zoltan Varga 5901f1de17 2009-03-10 Zoltan Varga <[email protected]>
Backport of r129009.

	* reflection.c (ensure_complete_type): New helper function to call
	type resolve handlers for unfinished dynamic types.
	(resolve_object): Call it for MonoClassFields. Fixes #483852.

svn path=/branches/mono-2-4/mono/; revision=129010
2009-03-10 19:48:57 +00:00
Marek Habersack 84c1469a25 Backport of r128972
svn path=/branches/mono-2-4/mcs/; revision=128973
2009-03-10 14:23:03 +00:00
Zoltan Varga e08028625d 2009-03-10 Zoltan Varga <[email protected]>
Backport of r128924.
	
	* mini-s390x.c: Fix support for vtypes whose addresses are passed on the
	stack.

svn path=/branches/mono-2-4/mono/; revision=128926
2009-03-10 00:21:40 +00:00
Miguel de Icaza acbaa50498 Backport from 128830
svn path=/branches/mono-2-4/mcs/; revision=128925
2009-03-10 00:20:25 +00:00
Mark Probst b92652fb0c 2009-03-09 Mark Probst <[email protected]>
Contributed under the terms of the MIT/X11 license by Steven
        Munroe <[email protected]>.

        * mini-ppc.c: Correct handling of OP_LOADI4_MEMINDEX for ppc64.
        Fixes #483462.

        Backport of r128904.

svn path=/branches/mono-2-4/mono/; revision=128905
2009-03-09 20:03:44 +00:00
Mark Probst b400a612a4 2009-03-09 Mark Probst <[email protected]>
* mini-trampolines.c (mono_create_jump_trampoline): If the method
	is shared generic code, return the trampoline, even if the method
	has already been compiled.  Fixes #479763.

	* mini.c, mini.h: New function
	mono_jit_find_compiled_method_with_jit_info() which is the same as
	mono_jit_find_compiled_method() but also returns the jit info.

	Backport of r128723.

2009-03-09  Mark Probst  <[email protected]>

	* generic-sharing.c (instantiate_other_info): Always return a jump
	trampoline for method code.

	Backport of r128723.

2009-03-09  Mark Probst  <[email protected]>

	* bug-479763.2.cs: New test.

	* Makefile.am: Test added.

	Backport of r128723.

svn path=/branches/mono-2-4/mono/; revision=128903
2009-03-09 19:57:22 +00:00
Rodrigo Kumpera f75dddbe61 2009-03-08 Rodrigo Kumpera <[email protected]>
Backport of r128853.

	* appdomain.c (get_shadow_assembly_location): Fix memleak.


svn path=/branches/mono-2-4/mono/; revision=128882
2009-03-09 14:24:35 +00:00
Marek Safar ce5c0e651e 2009-03-08 Marek Safar <[email protected]>
* class.cs: Use correct common base type for unmanaged delayed
	check.

	* rootcontext.cs: Wrap unhandled exception.


svn path=/branches/mono-2-4/mcs/; revision=128854
2009-03-08 19:15:50 +00:00
Gonzalo Paniagua Javier 11cd4f09ed 2009-03-06 Gonzalo Paniagua Javier <[email protected]>
* ResourceSet.cs: for custom resource sets without a reader, pretende
	that's we've already read the stream.


svn path=/branches/mono-2-4/mcs/; revision=128815
2009-03-07 00:06:31 +00:00
Miguel de Icaza 15c1fae0ea 2009-03-05 Tom Hindle <[email protected]>
* Marshal.cs: Implemented GenerateGuidForType

svn path=/branches/mono-2-4/mcs/; revision=128809
2009-03-06 23:31:51 +00:00
Miguel de Icaza b712e0ae63 Backport
svn path=/branches/mono-2-4/mcs/; revision=128808
2009-03-06 23:30:19 +00:00
Marek Habersack 7304ee6ef0 Backport of r128801
svn path=/branches/mono-2-4/mcs/; revision=128802
2009-03-06 22:17:10 +00:00
Marek Habersack ef23c9aaeb Backport of r128799
svn path=/branches/mono-2-4/mcs/; revision=128800
2009-03-06 21:30:17 +00:00
Marek Habersack 5eecf6b197 Backport of r128796
svn path=/branches/mono-2-4/mcs/; revision=128797
2009-03-06 20:55:33 +00:00
Marek Habersack 74dcf0f4e7 Backport of r128793
svn path=/branches/mono-2-4/mcs/; revision=128794
2009-03-06 20:05:35 +00:00
Zoltan Varga 2a21dbb533 2009-03-06 Zoltan Varga <[email protected]>
* arm/tramp.c: Include a change from the debian patches. Avoid #include-ing
	a file in the middle of a function.

svn path=/branches/mono-2-4/mono/; revision=128784
2009-03-06 15:56:44 +00:00
Zoltan Varga fdf4913561 2009-03-06 Zoltan Varga <[email protected]>
Backport of r128749.
	
	* method-to-ir.c (mini_emit_memset): Fix the handling of size '3'. Fixes
	#481458.

	* iltests.il.in: Add a test.

svn path=/branches/mono-2-4/mono/; revision=128751
2009-03-06 02:43:14 +00:00
Mark Probst a1ea9b3ab8 2009-03-05 Mark Probst <[email protected]>
* method-to-ir.c (mono_method_to_ir): Only force the vtable var
	for methods which actually have one.  For all other methods, make
	sure the this argument var is live the whole method.

	* mini.c (mini_method_compile): Every shared method has a
	this/vtable/mrgctx info.  Fixes #480807.

	Backport of r128720.

svn path=/branches/mono-2-4/mono/; revision=128724
2009-03-05 21:17:28 +00:00
Marek Habersack d22d581784 Backport of r128714
svn path=/branches/mono-2-4/mono/; revision=128715
2009-03-05 18:06:35 +00:00
Bill Holmes 7ff68d17a2 2009-03-05 Bill Holmes <[email protected]>
* mono.def : Removing missing methods to remove link errors for
	  MSVC build.  

	Code is contributed under MIT/X11 license.

svn path=/branches/mono-2-4/mono/; revision=128712
2009-03-05 17:50:48 +00:00
Mark Probst ebbca31e3c 2009-03-05 Mark Probst <[email protected]>
Contributed under the terms of the MIT/X11 license by Steven
	Munroe <[email protected]>.

	* mini-ppc.c, mini-ppc.h: Implement TLS for PPC64.

	Backport of r127060.

2009-03-05  Mark Probst  <[email protected]>

	Contributed under the terms of the MIT/X11 license by Steven
	Munroe <[email protected]>.

	* mono-compiler.h: MONO_THREAD_VAR_OFFSET for PPC(64).

	Backport of r127060.

svn path=/branches/mono-2-4/mono/; revision=128711
2009-03-05 17:49:49 +00:00
Marek Safar fbe5f68924 2009-03-05 Marek Safar <[email protected]>
A fix for bug #480100
	* parameter.cs: A parameter is not hoisted when used directly as ET.


svn path=/branches/mono-2-4/mcs/; revision=128680
2009-03-05 11:41:25 +00:00
Martin Baulig aca813ba8d ***** Backport of r128549 *****
svn path=/branches/mono-2-4/mono/; revision=128622
2009-03-04 20:46:47 +00:00
Martin Baulig d4955be897 ***** Backport of r128556 *****
2009-03-04  Martin Baulig  <[email protected]>

	* debug-mini.c: Clean up the exception API and add documentation.
	(mono_debugger_handle_exception): New public method; this is
	called when throwing an exception or encountering an unhandled one.
	(mono_debugger_call_exception_handler): Formerly known as
	mono_debugger_handle_exception(); this is used to tell the
	debugger that we're about to invoke an exception handler.


svn path=/branches/mono-2-4/mono/; revision=128614
2009-03-04 20:24:02 +00:00
Martin Baulig 84ada866ad ***** Backport of r128544 *****
2009-03-04  Martin Baulig  <[email protected]>

	* debug-mini.c (mono_debugger_runtime_invoke): Moved here from
	../metadata/mono-debug-debugger.c; save and reset exception state.

2009-03-02  Martin Baulig  <[email protected]>

	* debug-mini.c: Moved the debugger exception handling here from
	../metadata/mono-debug-debugger.c.

	* debug-mini.h
	(MonoDebuggerExceptionAction): New exception typedef.

	* debug-mini.c
	(MonoDebuggerThreadInfo): Added `MonoObject *last_exception'.

	* exceptions-amd64.c
	(mono_amd64_throw_exception): Use the new debugger exception
	handling code.

	* mini-exceptions.c
	(mono_handle_exception_internal): Don't call
	mono_debugger_unhandled_exception() here.

2009-03-04  Martin Baulig  <[email protected]>

	* mono-debug.h
	(mono_debugger_runtime_invoke): Removed.

	* mono-debug-debugger.c
	(mono_runtime_invoke): Moved into ../mini/debug-mini.c.

2009-03-02  Martin Baulig  <[email protected]>

	* mono-debug.h
	(mono_debugger_unhandled_exception): Removed.
	(mono_debugger_handle_exception): Removed.
	(mono_debugger_throw_exception): Removed.

	* mono-debug.h (MONO_DEBUGGER_MINOR_VERSION): Bump to 1.

	* mono-debug.c
	(mono_debug_debugger_version): Bump to 5.

	* mono-debug-debugger.c: Moved the exception handling code to
	../mini/debug-mini.c


svn path=/branches/mono-2-4/mono/; revision=128613
2009-03-04 20:19:14 +00:00
Marek Habersack d7e563dd87 Backport of r128602
svn path=/branches/mono-2-4/mcs/; revision=128603
2009-03-04 19:06:26 +00:00
Mark Probst 2085fa219c 2009-03-04 Mark Probst <[email protected]>
* method-to-ir.c: Don't inline methods that use JMP.  Fixes
	#481403.

	Backport of r128552.

2009-03-04  Mark Probst  <[email protected]>

	* bug-481403.il: New test.

	* Makefile.am: Test added.

	Backport of r128552.

svn path=/branches/mono-2-4/mono/; revision=128560
2009-03-04 15:58:15 +00:00
Marek Safar 8d34f01dfc 2009-03-03 Marek Safar <[email protected]>
A fix for bug #481258
	* class.cs: Set extension method flag in partial container.


svn path=/branches/mono-2-4/mcs/; revision=128434
2009-03-03 12:58:09 +00:00
Marek Habersack ac1aa9d309 Backport of r128407 and r128408
svn path=/branches/mono-2-4/mcs/; revision=128409
2009-03-03 01:34:29 +00:00
Gonzalo Paniagua Javier 97434a0a9b 2009-03-01 Gonzalo Paniagua Javier <[email protected]>
* WebEncoding.cs: another GetWebApplication here.


svn path=/branches/mono-2-4/mcs/; revision=128294
2009-03-01 07:43:09 +00:00
Gonzalo Paniagua Javier 1c03c661b4 patch from Marek in trunk
svn path=/branches/mono-2-4/mcs/; revision=128280
2009-02-28 23:45:29 +00:00
Gonzalo Paniagua Javier 7e204d02b5 2009-02-28 Gonzalo Paniagua Javier <[email protected]>
* AppResourcesAssemblyBuilder.cs:
	* AspComponentFoundry.cs:
	* AssemblyBuilder.cs:
	* CachingCompiler.cs:
	* AspGenerator.cs:
	* WsdlBuildProvider.cs:
	* BaseCompiler.cs:
	* BuildProvider.cs:
	* AppWebReferencesCompiler.cs:
	* TemplateControlCompiler.cs:
	* BuildManager.cs:
	* AppCodeCompiler.cs: settings that have to be in
	machine.config or the root level web.config now call
	GetWebApplicationSection.


svn path=/branches/mono-2-4/mcs/; revision=128277
2009-02-28 20:41:32 +00:00
Gonzalo Paniagua Javier 34d0ee8c95 2009-02-28 Gonzalo Paniagua Javier <[email protected]>
* BaseParser.cs:
	* PageParser.cs:
	* ControlBuilder.cs:
	* TemplateParser.cs:
	* Page.cs:
	* SimpleWebHandlerParser.cs: settings that have to be in
	machine.config or the root level web.config now call
	GetWebApplicationSection.


svn path=/branches/mono-2-4/mcs/; revision=128274
2009-02-28 20:05:24 +00:00
Gonzalo Paniagua Javier 05442e11d7 2009-02-28 Gonzalo Paniagua Javier <[email protected]>
* System.Web/HttpResponseHeader.cs:
	* System.Web/HttpResponse.cs:
	* System.Web/QueueManager.cs:
	* System.Web/HttpRequest.cs:
	* System.Web/TraceManager.cs:
	* System.Web/HttpServerUtility.cs:
	* System.Web/HttpApplication.cs:
	* System.Web.UI/ObjectStateFormatter.cs:
	* System.Web.Security/FormsAuthentication.cs: use GetWebApplication
	instead of GetSection for application level configuration.


svn path=/branches/mono-2-4/mcs/; revision=128271
2009-02-28 19:00:51 +00:00
Zoltan Varga 42f06c7663 2009-02-28 Zoltan Varga <[email protected]>
* Enum.cs (FindName): Use a hash table for looking up names instead of
	a linear search for enums with a lot of values.

svn path=/branches/mono-2-4/mcs/; revision=128268
2009-02-28 16:23:19 +00:00
Rodrigo Kumpera 8c002790f7 2008-02-28 Rodrigo Kumpera <[email protected]>
* MonoProperty.cs (GetValue): Don't use the delegate optimization for valuetypes.


svn path=/branches/mono-2-4/mcs/; revision=128263
2009-02-28 06:26:39 +00:00
Gonzalo Paniagua Javier 7172bcccf8 2009-02-17 Gonzalo Paniagua Javier <[email protected]>
* Socket.cs: instead of clearing the sockets form the output and then
	adding them back, we just remove the ones that have not been signaled.
	Fixes bug #354090 and bug #476138.



svn path=/branches/mono-2-4/mcs/; revision=128260
2009-02-28 05:59:06 +00:00
Marek Habersack 4ff65f3ac1 Backport of r128249
svn path=/branches/mono-2-4/mcs/; revision=128250
2009-02-28 02:05:10 +00:00
Gonzalo Paniagua Javier de4d2ec78b 2009-02-27 Gonzalo Paniagua Javier <[email protected]>
* ResourceSet.cs: populating the resource should be locked because the
	resourceset could be shared.


svn path=/branches/mono-2-4/mcs/; revision=128216
2009-02-27 17:32:57 +00:00
Rodrigo Kumpera 6e6489d471 2008-02-26 Rodrigo Kumpera <[email protected]>
* MonoProperty.cs (GetValue): Optimize getters for properties without arguments.

2008-02-26  Rodrigo Kumpera  <[email protected]>

	* MonoProperty.cs (GetValue): Optimize getters for properties without arguments.
	The optimization is to create a pair of chained delegates that duplicate the workings
	on MethodBase::Invoke without all the aditional overhead and without doing two
	managed/native transitions.

	Simple Getter performance is up to 17x faster.

	This patch reduces contention on domain and domain jit code hash locks, which
	can be very hot on asp.net applications.


svn path=/branches/mono-2-4/mcs/; revision=128174
2009-02-27 01:53:16 +00:00
Zoltan Varga 986524c0bb 2009-02-27 Zoltan Varga <[email protected]>
* BaseMachine.cs (LTRReplace): Initialize the StringBuilder with an
	appropriate initial length.

svn path=/branches/mono-2-4/mcs/; revision=128159
2009-02-26 23:28:25 +00:00
Gonzalo Paniagua Javier ffe099d2fc 2009-02-26 Gonzalo Paniagua Javier <[email protected]>
* appdomain.c: make the check to avoid copying when the assembly is
	already shadow copied actually work.


svn path=/branches/mono-2-4/mono/; revision=128126
2009-02-26 17:42:12 +00:00
Gonzalo Paniagua Javier a317249bec 2009-02-26 Gonzalo Paniagua Javier <[email protected]>
* WebConfigurationManager.cs: generate a hash from the string hsah
	codes instead of concatenating them.


svn path=/branches/mono-2-4/mcs/; revision=128122
2009-02-26 17:24:40 +00:00
Jonathan Pryor fc98dcc51c * Makefile:
- s/TEST_FILES/MAN_TEST_FILES/g: $(TEST_FILES) is used by the normal
	    build process, so the local definition is lost (and thus ignored).
	    Result: Test/* isn't actually copied.  Oops.  Changing to
	    MAN_TEST_FILES allows things to be copied.
	  - Fix the filenames within $(MAN_TEST_FILES) so `make dist-local'
	    works without error.
	  - Fixes #479753.

svn path=/branches/mono-2-4/mcs/; revision=128120
2009-02-26 17:08:58 +00:00
Zoltan Varga 48ee1b70a0 2009-02-26 Zoltan Varga <[email protected]>
* String.cs (FormatHelper): If all the arguments are strings, compute an
	initial length for the stringbuilder to avoid reallocations.

svn path=/branches/mono-2-4/mcs/; revision=128116
2009-02-26 16:38:34 +00:00
Zoltan Varga ab154c2bdb 2009-02-26 Zoltan Varga <[email protected]>
* mini-x86.c (mono_arch_get_this_arg_from_call): Avoid expensive calls
	to  get_generic_context_from_code () + get_call_info () if possible.

svn path=/branches/mono-2-4/mono/; revision=128113
2009-02-26 16:26:23 +00:00
Zoltan Varga e2bde717f8 2009-02-25 Zoltan Varga <[email protected]>
* object.c (mono_get_delegate_invoke): Call setup_methods () to avoid the
	slower search in metadata.

svn path=/branches/mono-2-4/mono/; revision=128095
2009-02-26 14:20:50 +00:00
Marek Habersack e34e7f2de8 Backport of r128091
svn path=/branches/mono-2-4/mcs/; revision=128092
2009-02-26 14:16:55 +00:00
Gonzalo Paniagua Javier 1e30039a0a fix the build
svn path=/branches/mono-2-4/mono/; revision=128063
2009-02-26 07:30:06 +00:00
Marek Habersack 4881df3014 Backport of r128040
svn path=/branches/mono-2-4/mono/; revision=128041
2009-02-26 02:03:10 +00:00
Marek Safar 38af1d1400 2009-02-25 Marek Safar <[email protected]>
A fix for bug #479532
	* expression.cs: Implement NewInitialize::AddressOf.


svn path=/branches/mono-2-4/mcs/; revision=128016
2009-02-25 16:46:27 +00:00
Marek Habersack 6a50c9ec35 Backport of: r124779, r124780, r124783, r124784, r126769, r126855, r126856, r126891, r127259, r127333, r127334 and r127343
svn path=/branches/mono-2-4/mcs/; revision=128005
2009-02-25 14:16:21 +00:00
Marek Safar 5e0f8cda9a 2009-02-25 Marek Safar <[email protected]>
A fix for bug #413633
	* expression.cs: Iterate all base class-constraint types.


svn path=/branches/mono-2-4/mcs/; revision=127990
2009-02-25 11:39:30 +00:00
Marek Habersack a094e9a735 Backport of r127935
svn path=/branches/mono-2-4/mcs/; revision=127936
2009-02-25 02:50:15 +00:00
Zoltan Varga 816e0e8fdd 2009-02-25 Zoltan Varga <[email protected]>
Backport of r127929.
	
	* Enum.cs (GetInfo): Add a global cache in addition to the thread-local
	caches to accomodate short living threads like threadpool threads.

svn path=/branches/mono-2-4/mcs/; revision=127930
2009-02-25 02:16:00 +00:00
Gonzalo Paniagua Javier 47e1dbf970 2009-02-24 Gonzalo Paniagua Javier <[email protected]>
* StringReader.cs: LF followed by CR is 2 lines.


svn path=/branches/mono-2-4/mcs/; revision=127917
2009-02-24 23:51:00 +00:00
Gonzalo Paniagua Javier aa19449ebb 2009-02-24 Gonzalo Paniagua Javier <[email protected]>
* StringReaderTest.cs: new test for ReadLine.


svn path=/branches/mono-2-4/mcs/; revision=127916
2009-02-24 23:50:24 +00:00
Andrew Jorgensen 90041dc378 Backport of r127907, bnc#479237
svn path=/branches/mono-2-4/mcs/; revision=127908
2009-02-24 22:15:56 +00:00
Zoltan Varga 922912292b 2009-02-24 Zoltan Varga <[email protected]>
* CILCompiler.cs: Partially inline calls to Char.ToLower () to speed
	up ignorecase matching.

svn path=/branches/mono-2-4/mcs/; revision=127902
2009-02-24 20:51:30 +00:00
Ivan Zlatev c92fff7043 2009-02-24 Ivan N. Zlatev <[email protected]>
* DataGridViewCell.cs: Invalidate the datagrid when the cell is selected
	or deselected.
	[Fixes bug #479124]

svn path=/branches/mono-2-4/mcs/; revision=127893
2009-02-24 20:10:30 +00:00
Jb Evain e3931f38b6 2009-02-24 Jb Evain <[email protected]>
backport of 127871.

	* Expression.cs (BinaryCoreCheck): fix comparison of enums.


svn path=/branches/mono-2-4/mcs/; revision=127872
2009-02-24 17:11:47 +00:00
Veerapuram Varadhan 493e003258 backport of r127849
svn path=/branches/mono-2-4/mcs/; revision=127850
2009-02-24 09:34:15 +00:00
Veerapuram Varadhan 32bf6cac04 * OracleException: 2.0 changes - patch submitted by
Jay Wren <[email protected]>


svn path=/branches/mono-2-4/mcs/; revision=127840
2009-02-24 05:21:40 +00:00
Veerapuram Varadhan 0c8aa2ee8b * Fixes #476523
* DbType.cs: Add DateTime2 and DateTimeOffset - 3.5 additions
        Patch by Jay Wren <[email protected]>


svn path=/branches/mono-2-4/mcs/; revision=127838
2009-02-24 05:10:23 +00:00
Jb Evain 0ee8a2414d 2009-02-23 Jb Evain <[email protected]>
backport of 127784.

	* XUtil.cs (ToString): properly stringify datetimes.

svn path=/branches/mono-2-4/mcs/; revision=127787
2009-02-23 19:20:54 +00:00
Jb Evain eb08b06215 2009-02-23 Jb Evain <[email protected]>
backport of 127772.

	* Enumerable.cs (IterateNullable): fix initial value
	for nullables.


svn path=/branches/mono-2-4/mcs/; revision=127774
2009-02-23 18:16:14 +00:00
Jb Evain 88b7acff98 2009-02-23 Jb Evain <[email protected]>
backport of 127755.

	* Expression.cs (IsNumber): actually decimal is rather a special
	case, and not a primitive number.


svn path=/branches/mono-2-4/mcs/; revision=127756
2009-02-23 17:06:08 +00:00
Jb Evain 84fd92865b 2009-02-23 Jb Evain <[email protected]>
backport of 127746.

	* Expression.cs (BinaryCoreCheck): add decimal operations
	are provided by custom operators.

svn path=/branches/mono-2-4/mcs/; revision=127748
2009-02-23 16:44:42 +00:00
Ivan Zlatev 400afe1a8f 2009-02-23 Ivan N. Zlatev <[email protected]>
* DataGridView.cs: Make the ScrollBars property work properly.

svn path=/branches/mono-2-4/mcs/; revision=127718
2009-02-23 09:43:23 +00:00
Gonzalo Paniagua Javier d9755b89e6 2009-02-23 Gonzalo Paniagua Javier <[email protected]>
* WebClient.cs: append the QueryString in DownloadData.
	Fixes bug #323788.


svn path=/branches/mono-2-4/mcs/; revision=127700
2009-02-23 05:10:24 +00:00
Gonzalo Paniagua Javier 8c8593fd96 2009-02-22 Gonzalo Paniagua Javier <[email protected]>
* HttpServerUtility.cs: allow Transfer to static files too.


svn path=/branches/mono-2-4/mcs/; revision=127678
2009-02-23 00:22:39 +00:00
Mark Probst 200118c485 2009-02-22 Mark Probst <[email protected]>
Backport of r127665.

	* tramp-ppc.c (mono_arch_create_trampoline_code): Store the
	correct frame pointer in the LMF.  Should fix #478394.

svn path=/branches/mono-2-4/mono/; revision=127666
2009-02-22 21:08:04 +00:00
Gonzalo Paniagua Javier 8575b3983a 2009-02-22 Gonzalo Paniagua Javier <[email protected]>
* socket-io.c: support SO_MAXCONN, SO_USELOOPBACK and
	SO_EXLUSIVEADDRUSE where available.


svn path=/branches/mono-2-4/mono/; revision=127651
2009-02-22 06:42:55 +00:00
Gonzalo Paniagua Javier d99e8f21af fix
svn path=/branches/mono-2-4/mcs/; revision=127646
2009-02-22 03:08:15 +00:00
Ivan Zlatev df53237ac6 2009-02-22 Ivan N. Zlatev <[email protected]>
* DataGridView.cs: Fix row removal in the data-bound scenario.

svn path=/branches/mono-2-4/mcs/; revision=127643
2009-02-22 00:54:39 +00:00
Gonzalo Paniagua Javier 24ad061817 2009-02-21 Gonzalo Paniagua Javier <[email protected]>
* FtpWebResponse.cs: return a Null stream when there's no response to
	be read.
	* FtpWebRequest.cs: provide the error returned by the server in the
	exception.
	* WebClient.cs: set the correct method when doing a FTP upload.
	Fixes bug #478451.


svn path=/branches/mono-2-4/mcs/; revision=127641
2009-02-21 23:30:33 +00:00
Zoltan Varga 76ffb82a48 2009-02-21 Zoltan Varga <[email protected]>
* marshal.c (mono_marshal_get_runtime_invoke): Fix _another_ bug sharing
	runtime invoke wrappers, this time it is string ctor wrappers, which
	pass a dummy string as 'this' instead of their obj argument. Fixes
	#478473.

svn path=/branches/mono-2-4/mono/; revision=127638
2009-02-21 21:27:35 +00:00
Zoltan Varga 53cc1f8d6d 2009-02-21 Zoltan Varga <[email protected]>
* method-to-ir.c (mono_method_to_ir): Don't assert if string ctors
	are called from runtime invoke wrappers.

svn path=/branches/mono-2-4/mono/; revision=127636
2009-02-21 21:24:16 +00:00
Jb Evain 0489b56686 backport of r127631.
in System.Reflection:
2008-02-21  Jb Evain  <[email protected]>

	* Module.cs: add a new virtual GetModuleVersionId method,
	and make the properties .MvId and ModuleVersionId call it.
	This way, we can override it in ModuleBuilder.
	Part of the fix for #471302.

in System.Reflection.Emit:
2008-02-21  Jb Evain  <[email protected]>

	* ModuleBuilder.cs: override GetModuleVersionId
	so that we can get the module guid from Module.ModuleVersionId.
	Part of the fix for #471302.

svn path=/branches/mono-2-4/mcs/; revision=127632
2009-02-21 16:20:07 +00:00
Jb Evain 4f856e94a3 2009-02-21 Jb Evain <[email protected]>
backport of r127628.

	* MonoType.cs (InvokeMember): don't pass a null args to
	Binder.BindToMethod. Fix for #471275.

svn path=/branches/mono-2-4/mcs/; revision=127629
2009-02-21 15:36:47 +00:00
Jb Evain a927203608 2009-02-21 Jb Evain <[email protected]>
* EventHandlerList.cs: fix the 1.1 profile.


svn path=/branches/mono-2-4/mcs/; revision=127625
2009-02-21 12:51:59 +00:00
Gonzalo Paniagua Javier 4313c50b3d oops
svn path=/branches/mono-2-4/mcs/; revision=127618
2009-02-21 07:35:31 +00:00
Gonzalo Paniagua Javier 09a2a27d27 2009-02-21 Gonzalo Paniagua Javier <[email protected]>
* EventHandlerList.cs: there's no need for HandlerEntry here.
	Just store the delegate.


svn path=/branches/mono-2-4/mcs/; revision=127616
2009-02-21 07:33:08 +00:00
Gonzalo Paniagua Javier c6c5c7c8b6 this was checked in by mistake
svn path=/branches/mono-2-4/mcs/; revision=127598
2009-02-20 23:35:18 +00:00
Gonzalo Paniagua Javier 8a19ec3273 2009-02-20 Gonzalo Paniagua Javier <[email protected]>
* TemplateControl.cs: implement the other ReadStringResource method.
	Patch from Kornel Pal.


svn path=/branches/mono-2-4/mcs/; revision=127597
2009-02-20 23:34:35 +00:00
Gonzalo Paniagua Javier 32d603eda4 fix the 1.x build
svn path=/branches/mono-2-4/mcs/; revision=127589
2009-02-20 22:57:08 +00:00
Gonzalo Paniagua Javier 11b4aef454 2009-02-20 Gonzalo Paniagua Javier <[email protected]>
* System.Web/HttpWriter.cs: new Response property and WriteUTF8Ptr
	method.
	* System.Web/HttpResponseStream.cs: added support for writing from an
	IntPtr. copied the memcpy method from String.cs.

	* System.Web.Compilation/BuildManager.cs: updated comment.

	* System.Web.UI/ResourceBasedLiteralControl.cs: new Control. It's just
	like a LiteralControl but will render itself from the bytes pointed to
	by an IntPtr and not create any string from the underlying data unless
	needed.

	* System.Web.UI/TemplateControl.cs: implemented a bunch of methods
	that are used from the precompiled assemblies for a web project. The
	most notable change needed is to be able to read a win32 resource from
	the dll of the control. The resource is a concatenation of literals
	with plain text for the control and a specialized LiteralControl is
	generated from different chunks of the resource.

	* System.Web.UI/HtmlTextWriter.cs: new method that returns the
	HttpWriter in use.

	* System.Web.dll.sources: added new file.

	* System.Web.Util/ICalls.cs: new internal call to get a pointer to the
	win32 resource associated with the control's assembly.


svn path=/branches/mono-2-4/mcs/; revision=127580
2009-02-20 21:32:50 +00:00
Gonzalo Paniagua Javier b1b4f52b34 2009-02-20 Gonzalo Paniagua Javier <[email protected]>
* cil-coff.h:
	* icall-def.h:
	* icall.c: add new GetUnmanagedResourcePtr that returns a pointer to a
	win32 resource loaded from a PE file.

	* image.c: fix mono_image_lookup_resource.


svn path=/branches/mono-2-4/mono/; revision=127575
2009-02-20 21:07:43 +00:00
Gonzalo Paniagua Javier bff28446a2 changelog
svn path=/branches/mono-2-4/mcs/; revision=127572
2009-02-20 20:46:03 +00:00
Gonzalo Paniagua Javier 08df38ca1b .
svn path=/branches/mono-2-4/mcs/; revision=127571
2009-02-20 20:37:44 +00:00
Gonzalo Paniagua Javier 21eef2e77e ChangeLog
svn path=/branches/mono-2-4/mcs/; revision=127570
2009-02-20 20:36:31 +00:00
Gonzalo Paniagua Javier cff463913d 2009-02-20 Gonzalo Paniagua Javier <[email protected]>
* WaitHandle.cs: implemented SignalAndWait.

svn path=/branches/mono-2-4/mcs/; revision=127568
2009-02-20 20:33:23 +00:00
Zoltan Varga e040c39674 2009-02-20 Zoltan Varga <[email protected]>
* cpu-ppc.md (store_memindex): Increase the size of this.

svn path=/branches/mono-2-4/mono/; revision=127567
2009-02-20 20:30:39 +00:00
Veerapuram Varadhan eeca83c94d Test for Bug#419224
svn path=/branches/mono-2-4/mcs/; revision=127543
2009-02-20 15:47:16 +00:00
Veerapuram Varadhan 1a66d85f3b backport of r127530
svn path=/branches/mono-2-4/mcs/; revision=127532
2009-02-20 11:50:35 +00:00
Marek Safar 8508387f81 2009-02-20 Marek Safar <[email protected]>
A fix for bug #477447
	* statement.cs: Add reference to correct parent storey when this
	is accessible from deep children storey (more than 1 level).


svn path=/branches/mono-2-4/mcs/; revision=127528
2009-02-20 11:16:43 +00:00
Veerapuram Varadhan cd41807bcb * TdsDataReader.cs: Access TdsDataColumn correctly for NET_2_0.
Fixes #466199. Patch by Tom Hindle <[email protected]>


svn path=/branches/mono-2-4/mcs/; revision=127493
2009-02-20 02:30:12 +00:00
Ivan Zlatev fff850ae00 2009-02-19 Ivan N. Zlatev <[email protected]>
* DataGridViewCell.cs: Use strict equality comparison in order to
	prevent superfluous CellValueChanged events.

svn path=/branches/mono-2-4/mcs/; revision=127452
2009-02-19 20:16:25 +00:00
Gonzalo Paniagua Javier c4af40f5cf 2009-02-19 Gonzalo Paniagua Javier <[email protected]>
* FtpWebRequest.cs: avoid errors when creating a temporary Uri to get
	the local path.
	* WebClient.cs: when setting up the request for downloading, use the
	default method. Fixes bug #477611.


svn path=/branches/mono-2-4/mcs/; revision=127451
2009-02-19 20:14:31 +00:00
Ivan Zlatev ace3196c2b 2009-02-19 Ivan N. Zlatev <[email protected]>
* DataGridView.cs: Do not reset the columns when the data list changes,
	but only the rows. Fixes multiple bugs related to sorting, custom
	column styles being reset and more.

svn path=/branches/mono-2-4/mcs/; revision=127435
2009-02-19 18:25:02 +00:00
Veerapuram Varadhan 890a4f46f5 backport of r127379
svn path=/branches/mono-2-4/mcs/; revision=127424
2009-02-19 17:11:14 +00:00
Gonzalo Paniagua Javier fd89397e70 2009-02-19 Gonzalo Paniagua Javier <[email protected]>
* OleDbFactory.cs: New file.


svn path=/branches/mono-2-4/mcs/; revision=127376
2009-02-19 06:50:42 +00:00
Gonzalo Paniagua Javier 50c7e593cb 2009-02-18 Gonzalo Paniagua Javier <[email protected]>
* TemplateControl.cs: ReadStringResource returns null now.


svn path=/branches/mono-2-4/mcs/; revision=127359
2009-02-19 02:43:33 +00:00
Gonzalo Paniagua Javier c06c09bd60 svn path=/branches/mono-2-4/mcs/; revision=127354 2009-02-18 23:52:50 +00:00
Gonzalo Paniagua Javier 4a3bf3d995 2009-02-18 Gonzalo Paniagua Javier <[email protected]>
* System.Web/HttpApplicationFactory.cs: check of global.asax was precompiled.
	* System.Web.UI/MasterPage.cs: the items in ContentPlaceHolders are lowercase.
	* System.Web.Compilation/TemplateControlCompiler.cs: lowercase place holder names
	* System.Web.Compilation/BuildManager.cs: initial support for
	precompilation. No 'updatable', please.



svn path=/branches/mono-2-4/mcs/; revision=127353
2009-02-18 23:51:15 +00:00
Zoltan Varga f59cfce9df 2009-02-19 Zoltan Varga <[email protected]>
Backport of r127347.

	* marshal.c (mono_ftnptr_to_delegate): Convert a NULL ftnptr to a null
	delegate. Fixes #477396.

svn path=/branches/mono-2-4/mono/; revision=127349
2009-02-18 23:14:25 +00:00
Marek Safar b73876a464 Fixes build.
svn path=/branches/mono-2-4/mcs/; revision=127341
2009-02-18 23:02:17 +00:00
Bill Holmes 836e73df60 2009-02-18 Bill Holmes <[email protected]>
backport of r127338

	* mono.def : Adding mono_jit_set_trace_options

	Code is contributed under MIT/X11 license.

svn path=/branches/mono-2-4/mono/; revision=127339
2009-02-18 23:01:08 +00:00
Marek Safar c524bc933b 2009-02-18 Marek Safar <[email protected]>
A fix for bug #472805
	* typemanager.cs, namespace.cs: Import only visible extension method
	types.


svn path=/branches/mono-2-4/mcs/; revision=127311
2009-02-18 19:54:14 +00:00
Marek Safar 9d136bfc7c 2009-02-18 Marek Safar <[email protected]>
A fix for bug #476266
	* anonymous.cs: Mutate multi-dimensional arrays.


svn path=/branches/mono-2-4/mcs/; revision=127294
2009-02-18 17:05:03 +00:00
Bill Holmes ac220e9c0e 2009-02-18 Bill Holmes <[email protected]>
backport of r127279.

	* marshal.c (cominterop_get_managed_wrapper_adjusted) :
	  Adding exception handling for all CCW calls.

	Code is contributed under MIT/X11 license.

svn path=/branches/mono-2-4/mono/; revision=127280
2009-02-18 15:31:07 +00:00
Zoltan Varga ee8370eb8d 2009-02-18 Zoltan Varga <[email protected]>
Backport of r127232.
	
	* marshal.c (emit_marshal_boolean): Add null checks to the new 
	native->managed marshalling code. Fixes #476247.

svn path=/branches/mono-2-4/mono/; revision=127233
2009-02-17 23:51:25 +00:00
Zoltan Varga bdffeb6712 2009-02-02 Zoltan Varga <[email protected]>
Backport of r125348.

	* marshal.c (mono_marshal_get_runtime_invoke): Disable sharing for
	methods taking vtype/byref arguments, to fix yet another bug caused by
	the sharing of runtime invoke wrappers. Partly fixes #471259.

svn path=/branches/mono-2-4/mono/; revision=127080
2009-02-16 23:23:52 +00:00
Zoltan Varga eb24cb0d59 2009-02-15 Zoltan Varga <[email protected]>
Backport of r125349.

	* marshal.c (mono_marshal_free_dynamic_wrappers): New function for
	freeing wrappers of dynamic methods.

	* loader.c (mono_free_method): Call it. Fixes #463323.

svn path=/branches/mono-2-4/mono/; revision=127076
2009-02-16 22:08:08 +00:00
Zoltan Varga 034798235b 2009-02-15 Zoltan Varga <[email protected]>
Backport of r125349.

	* marshal.c (mono_marshal_free_dynamic_wrappers): New function for
	freeing wrappers of dynamic methods.

	* loader.c (mono_free_method): Call it. Fixes #463323.

svn path=/branches/mono-2-4/mono/; revision=127075
2009-02-16 22:07:04 +00:00
Zoltan Varga f049ca86f7 2009-02-15 Zoltan Varga <[email protected]>
Backport of r126958.
	
	* reflection.c (clear_cached_object): New helper function.
	(mono_method_clear_object): New function to clear the cached reflection
	objects for a dynamic method.

	* object.c (mono_runtime_free_method): Call mono_method_clear_object ().
	Partly fixes # 463323.

svn path=/branches/mono-2-4/mono/; revision=127074
2009-02-16 21:59:09 +00:00
Rodrigo Kumpera bcd05ee327 In .:
* loader.c (method_from_memberref): Properly fix #474271 and
	don't break the runtime bad.

2009-02-16 Rodrigo Kumpera  <[email protected]>


svn path=/branches/mono-2-4/mono/; revision=127073
2009-02-16 21:51:24 +00:00
Zoltan Varga 4ed001307d 2009-02-16 Zoltan Varga <[email protected]>
Backport of r126983 + r127069.

	* ssa.c (visit_inst): Fix a crash if the instruction following a switch
	was optimized away.

	Backport of r126980.

	* mini-x86.c (mono_arch_get_vcall_slot): Handle yet another
	code sequence which matches a non-virtual call. Fixes #472654.

	Backport of r124419.

	* mini-amd64.c (mono_arch_get_vcall_slot): Handle yet another
	code sequence which matches a non-virtual call.

svn path=/branches/mono-2-4/mono/; revision=127071
2009-02-16 21:49:34 +00:00
Rodrigo Kumpera 4b4f5466cd In .:
2009-02-16 Rodrigo Kumpera  <[email protected]>

	Backport of r127032.

	* loader.c (method_from_memberref): Don't abort if the array
	method is not found. A regular loader failure is more informative
	and correct.

	Fixes #474271.
	

svn path=/branches/mono-2-4/mono/; revision=127061
2009-02-16 18:12:54 +00:00
Mark Probst 914d38a33e 2009-02-16 Mark Probst <[email protected]>
Backport of r125679.

	Contributed under the terms of the MIT/X11 license by Steven
	Munroe <[email protected]>.

	* mini-ppc.c (mono_arch_output_basic_block): Generate better code
	for LOADI4_MEMBASE.  Use addi instead of addic if it's not
	necessary.

svn path=/branches/mono-2-4/mono/; revision=127059
2009-02-16 17:12:39 +00:00
Mark Probst 8e677f9921 2009-02-16 Mark Probst <[email protected]>
Backport of r125676.

	Contributed under the terms of the MIT/X11 license by Steven
	Munroe <[email protected]>.

	* exceptions-ppc.c (mono_arch_get_restore_context): Code size
	comparison fix.

	* tramp-ppc.c (mono_arch_create_generic_class_init_trampoline):
	The trampoline can be longer on PPC64.

svn path=/branches/mono-2-4/mono/; revision=127056
2009-02-16 17:07:03 +00:00
Mark Probst 12815c0c7e 2009-02-16 Mark Probst <[email protected]>
Backport of r125672.

	Contributed under the terms of the MIT/X11 license by Steven
	Munroe <[email protected]>.

	* mini-ppc.c: Compiler warning fixes and trivial code
	simplifications.

svn path=/branches/mono-2-4/mono/; revision=127055
2009-02-16 17:06:12 +00:00
Mark Probst b535b7d4c0 2009-02-16 Mark Probst <[email protected]>
Backport of r125443.

	Contributed under the terms of the MIT/X11 license by Steven
	Munroe <[email protected]>.

	* ppc/ppc-codegen.h: Make operand order and case consistent
	(assembler order) for ppc_load_reg_update, ppc_load_multiple_regs,
	ppc_store_multiple_regs, ppc_lwz, ppc_lhz, ppc_lbz,
	ppc_stw,ppc_sth, ppc_stb, ppc_stwu, ppc_lbzu, ppc_lfdu, ppc_lfsu,
	ppc_lfsux, ppc_lfsx, ppc_lha, ppc_lhau, ppc_lhzu, ppc_lmw,
	ppc_lwzu, ppc_stbu, ppc_stfdu, ppc_stfsu, ppc_sthu, ppc_stmw.  Use
	"i" or "ui" instead of "d" for immediated operands to immediate
	arthimetic and logical instructions in macros ppc_addi, ppc_addis,
	ppc_ori, ppc_addic, ppc_addicd, ppc_andid, ppc_andisd.
	[__mono_ppc64__]: Make operand order and case consistent
	(assembler order) for ppc_load_multiple_regs,
	ppc_store_multiple_regs.  Simplify the DS form and make them
	consistent with D forms for ppc_load_reg, ppc_load_reg_update,
	ppc_store_reg, ppc_store_reg_update. ppc_ld, ppc_lwa, ppc_ldu,
	ppc_std, ppc_stdu.  Define ppc_lwax and ppc_lwaux.

2009-02-16  Mark Probst  <[email protected]>

	Backport of r125443.

	Contributed under the terms of the MIT/X11 license by Steven
	Munroe <[email protected]>.

	* exceptions-ppc.c (restore_regs_from_context): Correct operand
	order (offset then base reg) for ppc_load_multiple_regs.
	(emit_save_saved_regs) Correct operand order for
	ppc_store_multiple_regs.
	(mono_arch_get_call_filter): Correct operand order for
	ppc_load_multiple_regs.

	* mini-ppc.c (emit_memcpy): Fix operand order for
	ppc_load_reg_update and ppc_store_reg_update.
	(mono_arch_output_basic_block): Correct operand order for ppc_lha.
	(mono_arch_emit_epilog): Correct operand order for
	ppc_load_multiple_regs.

	* tramp-ppc.c (mono_arch_create_trampoline_code): Correct operand
	order for ppc_store_multiple_regs and ppc_load_multiple_regs.

svn path=/branches/mono-2-4/mono/; revision=127054
2009-02-16 17:04:06 +00:00
Mark Probst 3f1a1dbdfe 2009-02-16 Mark Probst <[email protected]>
Backport of r125430.

	* cpu-ppc64.md: Fixed storer4_memindex length.

svn path=/branches/mono-2-4/mono/; revision=127053
2009-02-16 17:01:59 +00:00
Marek Safar eceec54500 2009-02-16 Marek Safar <[email protected]>
A fix for bug #475965
	* generics.cs: Check generic parameter type after extracting from
	Expression<T>.


svn path=/branches/mono-2-4/mcs/; revision=127041
2009-02-16 15:33:42 +00:00
Atsushi Eno c3335e6f62 branch is broken too.
svn path=/branches/mono-2-4/mcs/; revision=127000
2009-02-16 08:07:02 +00:00
Zoltan Varga d8feb83640 2009-02-14 Zoltan Varga <[email protected]>
Backport of r126897.
	
	* method-to-ir.c (mini_emit_ldelema_1_ins): If the array index is a long,
	convert it to an in32. Fixes #475859.

	* arrays.cs: Add a test.

svn path=/branches/mono-2-4/mono/; revision=126900
2009-02-14 00:07:00 +00:00
Gonzalo Paniagua Javier 3a520d36c4 2009-02-13 Gonzalo Paniagua Javier <[email protected]>
* WebConnectionStream.cs: implemente (Read|Write)Timeout.
	Fixes bug #348159.


svn path=/branches/mono-2-4/mcs/; revision=126841
2009-02-13 15:08:53 +00:00
Marek Safar 3fe2bf4538 2009-02-13 Marek Safar <[email protected]>
A fix for bug #475327
	* expression.cs (ArrayCreation): Don't mutate values optimized away.


svn path=/branches/mono-2-4/mcs/; revision=126826
2009-02-13 12:08:57 +00:00
Zoltan Varga 00f2704267 2009-02-12 Zoltan Varga <[email protected]>
Backport of r126717.

	* mini-amd64.c (mono_arch_build_imt_thunk): Fix size calculation after
	the fail_tramp changes. Hopefully fixes #475132.

svn path=/branches/mono-2-4/mono/; revision=126811
2009-02-13 09:39:00 +00:00
Gonzalo Paniagua Javier 150b04b1b9 2009-02-05 Miguel De Icaza <[email protected]>
* sockets.c (_wapi_setsockopt): SO_REUSEPORT is needed also on
	MacOS X.  Fixes bug #471292


svn path=/branches/mono-2-4/mono/; revision=126772
2009-02-12 23:44:05 +00:00
Lluis Sanchez 098fc0b907 2009-02-12 Lluis Sanchez Gual <[email protected]>
* MarshalByRefObject.cs: Implemented MemberwiseClone(bool).


svn path=/branches/mono-2-4/mcs/; revision=126750
2009-02-12 19:46:11 +00:00
Zoltan Varga 1b5cea04fc 2009-02-12 Zoltan Varga <[email protected]>
Backport of r126737.

	* mini-s390x.c (mono_arch_output_basic_block): Fix the shift amounts in 
	OP_LCONV_TO_U2.

	* basic-long.cs: Add a test.

svn path=/branches/mono-2-4/mono/; revision=126742
2009-02-12 18:46:42 +00:00
Bill Holmes e61b2cd43d 2009-02-12 Bill Holmes <[email protected]>
Backport of r126738.  This is a safer variant of the
	  trunk for the 2.4 branch. The default in emit_marshal_boolean
	  for this version is I1.

	* object-internals.h : Fixing a typo in the
	  MonoReflectionComVisibleAttribute struct.

	* marshal.c (cominterop_com_visible): Check the implemented
	  interfaces for ComImport.

	* marshal.c (cominterop_get_native_wrapper_adjusted): For COM calls
	  assume that bools should be treated as VARIANTBOOLs.

	* marshal.c (emit_marshal_boolean): Adding cases for
	  MARSHAL_ACTION_MANAGED_CONV_IN and MARSHAL_ACTION_MANAGED_CONV_OUT.

	* marshal.c (mono_marshal_emit_managed_wrapper): Adding calls to
	  emit_marshal MARSHAL_ACTION_MANAGED_CONV_IN and OUT for bools.

	* marshal.c (cominterop_get_ccw): For COM calls assume that bools
	  should be treated as VARIANTBOOLs.

	Code is contributed under MIT/X11 license.


svn path=/branches/mono-2-4/mono/; revision=126740
2009-02-12 18:40:22 +00:00
Zoltan Varga 69b329a4a5 2009-02-12 Zoltan Varga <[email protected]>
Backport of r126737.

	* mini-s390x.c (mono_arch_output_basic_block): Fix the shift amounts in 
	OP_LCONV_TO_U2.

	* basic-long.cs: Add a test.

svn path=/branches/mono-2-4/mono/; revision=126739
2009-02-12 18:40:13 +00:00
Marek Safar 8cc06e5e77 2009-02-12 Marek Safar <[email protected]>
A fix for bug ##475246
	* expression.cs: More broken flowanalysis hacking needed.


svn path=/branches/mono-2-4/mcs/; revision=126729
2009-02-12 17:47:59 +00:00
Mark Probst 4fd91bf1c0 2009-02-12 Mark Probst <[email protected]>
* generic-sharing.c: Fixed a locking bug: The loader lock has to
	be taken before the templates lock.  Fixes part of #473150.

svn path=/branches/mono-2-4/mono/; revision=126715
2009-02-12 14:08:07 +00:00
Gonzalo Paniagua Javier 6b9376a9bf 2009-02-12 Gonzalo Paniagua Javier <[email protected]>
* io.c: EXDEV when moving directories fails now without creating a
	file in the destination.
	Fixes bug #326983.


svn path=/branches/mono-2-4/mono/; revision=126691
2009-02-12 07:44:10 +00:00
Gonzalo Paniagua Javier c457bcfa42 2009-02-12 Gonzalo Paniagua Javier <[email protected]>
* MonoIO.cs:
	* MonoIOError.cs: enable ERROR_NOT_SAME_DEVICE.


svn path=/branches/mono-2-4/mcs/; revision=126689
2009-02-12 07:43:36 +00:00
Zoltan Varga 63d82ffc3c 2009-02-12 Zoltan Varga <[email protected]>
Backport of r126668.
	
	* ssa.c (fold_ins): Use MONO_IS_JUMP_TABLE () and MONO_JUMP_TABLE_FROM_INS ()
	for processing jump tables. Fixes #473787.

svn path=/branches/mono-2-4/mono/; revision=126669
2009-02-12 00:23:23 +00:00
Mark Probst 2bdd7e92d3 2009-02-11 Mark Probst <[email protected]>
Backport of r126631.

	* class.c, class-internals.h: mono_method_get_context_general()
	combines the functionality of mono_method_get_context() and
	mini_method_get_context().

	* generic-sharing.c, domain-internals.h:
	mono_method_construct_object_context() and
	mono_domain_lookup_shared_generic() moved from mini.

	* icall.c (ves_icall_InternalInvoke): Handle the case where the
	method doesn't have the correct instantiation because it's shared
	generic code.  Fixes #473999.

2009-02-11  Mark Probst  <[email protected]>

	Backport of r126631.

	* mini-generic-sharing.c: mini_method_get_context() just calls
	mono_method_get_context_general() now.

	* mini.c, mini.h: Moved get_object_generic_inst(),
	construct_object_context_for_method() and
	mono_domain_lookup_shared_generic() to metadata/generic-sharing.c.

2009-02-11  Mark Probst  <[email protected]>

	Backport of r126631.

	* bug-473999.2.cs: New test.

	* Makefile.am: Test added.

svn path=/branches/mono-2-4/mono/; revision=126635
2009-02-11 19:23:28 +00:00
Andrew Jorgensen 5bb5d1d407 Missed part of the merge (not sure how that happened... I used svn diff
and patch.  Oh well, easy enough to fix.

svn path=/branches/mono-2-4/mono/; revision=126624
2009-02-11 17:23:13 +00:00
Zoltan Varga ca426640a8 2009-02-11 Zoltan Varga <[email protected]>
Backport of 126604.

	* branch-opts.c (mono_if_conversion): Handle the case where the merged 
	basic block fell through to its successor bblock without a branch. Fixes
	#474718.

	* iltests.il.in: Add a test.

svn path=/branches/mono-2-4/mono/; revision=126606
2009-02-11 14:36:29 +00:00
Bill Holmes 718382bad7 2009-02-11 Bill Holmes <[email protected]>
Backport of r126596.

	* socket-io.c (ves_icall_System_Net_Sockets_Socket_Accept_internal):
	  For Win32, add additional break conditions for accept.

	Code is contributed under MIT/X11 license.


svn path=/branches/mono-2-4/mono/; revision=126598
2009-02-11 13:50:55 +00:00
Gonzalo Paniagua Javier 32bf4798e3 2009-02-10 Gonzalo Paniagua Javier <[email protected]>
* CookieContainer.cs: separate cookies with "; " instead of just ';'.
	Fixes bug #386727.


svn path=/branches/mono-2-4/mcs/; revision=126531
2009-02-10 23:35:16 +00:00
Gonzalo Paniagua Javier dcff2f2285 Fix the windows build in the branch too
svn path=/branches/mono-2-4/mono/; revision=126513
2009-02-10 21:04:58 +00:00
Marek Habersack 17c171a0f9 Backport of r126482
svn path=/branches/mono-2-4/mcs/; revision=126483
2009-02-10 18:12:48 +00:00
Mark Probst 2debaf6612 2009-02-10 Mark Probst <[email protected]>
Backport of r126467.

	* mini-x86.c (mono_arch_context_get_int_reg): Handle all registers
	individually.  Fixes #473482.

2009-02-10  Mark Probst  <[email protected]>

	Backport of r126467.

	* bug-473482.2.cs: New test.

	* Makefile.am: Test added.

svn path=/branches/mono-2-4/mono/; revision=126469
2009-02-10 15:22:00 +00:00
Gonzalo Paniagua Javier 42d8948ea3 2009-02-10 Gonzalo Paniagua Javier <[email protected]>
* AppDomain.cs: this fixes the remoting tests.
	Zoltan found out that there was a domain improperly using shadow
	copy.


svn path=/branches/mono-2-4/mcs/; revision=126431
2009-02-10 07:37:33 +00:00
Andrew Jorgensen 6b01c59030 Backport of r126400
svn path=/branches/mono-2-4/mono/; revision=126402
2009-02-10 00:38:41 +00:00
Marek Habersack 00acd5fd49 Backport of r126371.
svn path=/branches/mono-2-4/mcs/; revision=126372
2009-02-09 21:09:25 +00:00
Andrew Jorgensen f434ba459c Fix Bug 472021 - Windows installation sqlsharp.bat (etc) broken
svn path=/branches/mono-2-4/mono/; revision=126349
2009-02-09 16:52:28 +00:00
Gonzalo Paniagua Javier 34c5d71769 2009-02-08 Gert Driesen <[email protected]>
* Dns.cs: BeginGetHostAddresses - renamed argument to match MS,
	reject "any" IP addresses. BeginGetHostEntry - renamed argument
	to match MS, reject "any" IP addresses. GetHostEntry - reject
	"any" IP addresses. GetHostAddresses - reject "any" IP addresses.
	GetHostByName - use "hostName" as paramname in ANE.


svn path=/branches/mono-2-4/mcs/; revision=126295
2009-02-08 23:20:27 +00:00
Gonzalo Paniagua Javier 53acf05e01 2009-02-08 Gert Driesen <[email protected]>
* DnsTest.cs: Use Assert syntax, and spaces to tabs. Added tests
	for argument checks.

svn path=/branches/mono-2-4/mcs/; revision=126294
2009-02-08 23:18:43 +00:00
Gonzalo Paniagua Javier be859b75ff 2009-02-08 Gonzalo Paniagua Javier <[email protected]>
* HttpWebRequest.cs: lock SetResponseError.


svn path=/branches/mono-2-4/mcs/; revision=126293
2009-02-08 23:11:33 +00:00
Zoltan Varga f958258d28 2009-02-09 Zoltan Varga <[email protected]>
Backport of r126290.

	* wait.c (WaitForMultipleObjectsEx): Initialize poll variable.

svn path=/branches/mono-2-4/mono/; revision=126291
2009-02-08 23:08:59 +00:00
Gonzalo Paniagua Javier a5d0787137 2009-02-08 Gonzalo Paniagua Javier <[email protected]>
* HttpClientTransportSink.cs: if we get an WebException that does not
	have a response, dispatch it to the sink.



svn path=/branches/mono-2-4/mcs/; revision=126289
2009-02-08 22:51:35 +00:00
Ivan Zlatev fc990b1fdc 2009-02-07 Ivan N. Zlatev <[email protected]>
* DataGridView.cs: End or if end fails then cancel the current edit
	operation before clearing the data source.

svn path=/branches/mono-2-4/mcs/; revision=126215
2009-02-07 23:27:17 +00:00
Ivan Zlatev f97835553c 2009-02-07 Ivan N. Zlatev <[email protected]>
* DataGridView.cs: Data-bind only after the handle is created.
	[Fixes bug #473680]

svn path=/branches/mono-2-4/mcs/; revision=126214
2009-02-07 23:27:12 +00:00
Gonzalo Paniagua Javier 9dd4b35d13 2009-02-07 Gonzalo Paniagua Javier <[email protected]>
* socket-io.c: when requesting all the local ips, if there are no
	interfaces up and running, MS returns 127.0.0.1.


svn path=/branches/mono-2-4/mono/; revision=126204
2009-02-07 19:57:55 +00:00
Gonzalo Paniagua Javier 5a440ac217 2009-02-07 Gonzalo Paniagua Javier <[email protected]>
* mono-perfcounters-def.h: processor time is an inverse time.
	Fixes bug #468625.


svn path=/branches/mono-2-4/mono/; revision=126194
2009-02-07 18:57:36 +00:00
Gonzalo Paniagua Javier 67cbfb1f5c 2009-02-07 Gonzalo Paniagua Javier <[email protected]>
* configure.in: include stdio so that NULL is defined when checking
	for ifreq.


svn path=/branches/mono-2-4/mono/; revision=126165
2009-02-07 05:25:30 +00:00
Gonzalo Paniagua Javier 90a94a6b8b 2009-02-07 Gonzalo Paniagua Javier <[email protected]>
* Dns.cs: empty string for host (also 0.0.0.0) is just passed to the
	runtime, which will then retrieve the local IP addresses. Fixes bug
	#386637 part 2/2.


svn path=/branches/mono-2-4/mcs/; revision=126163
2009-02-07 05:22:36 +00:00
Gonzalo Paniagua Javier f6479e150f 2009-02-07 Gonzalo Paniagua Javier <[email protected]>
* socket-io.c: an empty host name returns the list of local IPs.
	Fixes bug #386637 part 1/2.


svn path=/branches/mono-2-4/mono/; revision=126161
2009-02-07 05:21:42 +00:00
Gonzalo Paniagua Javier 1208b12f69 2009-02-06 Gonzalo Paniagua Javier <[email protected]>
* StreamReader.cs: when a LF ends a decoded buffer and is not followed
	by a CR in the next decoded buffer, we didn't flush the string.
	Fixes bug #445326.


svn path=/branches/mono-2-4/mcs/; revision=126132
2009-02-06 23:02:06 +00:00
Gonzalo Paniagua Javier d3d80927e1 2009-02-06 Gonzalo Paniagua Javier <[email protected]>
* FtpWebRequest.cs: some servers have a comment after the directory
	name. Fixes bugs #471149 and #471216.


svn path=/branches/mono-2-4/mcs/; revision=126102
2009-02-06 20:19:30 +00:00
Gonzalo Paniagua Javier 73146ea69a 2009-02-06 Gonzalo Paniagua Javier <[email protected]>
* WebConnectionStream.cs: set the content length to 0 when the
	response is not supposed to have any content.


svn path=/branches/mono-2-4/mcs/; revision=126091
2009-02-06 19:33:54 +00:00
Zoltan Varga f7d427a360 2009-02-06 Zoltan Varga <[email protected]>
Backport of r126054.

	* marshal.c (get_runtime_invoke_type): Avoid sharing enum types since they
	need to be boxed.

svn path=/branches/mono-2-4/mono/; revision=126055
2009-02-06 15:18:43 +00:00
Marek Habersack 2b8f2bd2eb Backport of r126051
svn path=/branches/mono-2-4/mcs/; revision=126052
2009-02-06 15:06:58 +00:00
Marek Habersack 11d0202305 Reverting 126038
svn path=/branches/mono-2-4/mcs/; revision=126046
2009-02-06 14:11:25 +00:00
Marek Habersack a755dfc8ab Backport of r126037
svn path=/branches/mono-2-4/mcs/; revision=126038
2009-02-06 13:09:51 +00:00
Marek Habersack 2c9a79735d Backport of r126025
svn path=/branches/mono-2-4/mcs/; revision=126030
2009-02-06 12:26:30 +00:00
Marek Habersack abc43192bf Backport of r125945
svn path=/branches/mono-2-4/mcs/; revision=125946
2009-02-05 22:09:11 +00:00
Mark Probst 791e158847 2009-02-05 Mark Probst <[email protected]>
Backport of r125887.

	* object.c (mono_object_get_virtual_method): Properly inflate
	generic methods.  Fixes #472692.

2009-02-05  Mark Probst  <[email protected]>

	Backport of r125887.

	* jit-icalls.c (mono_helper_compile_generic_method): Don't inflate
	the method we get from mono_object_get_virtual_method() because
	that function does it properly, now.

2009-02-05  Mark Probst  <[email protected]>

	Backport of r125887.

	* bug-472692.2.cs: New test.

	* Makefile.am: Test added.

svn path=/branches/mono-2-4/mono/; revision=125910
2009-02-05 18:46:12 +00:00
Ivan Zlatev 35022b4629 2009-02-05 Ivan N. Zlatev <[email protected]>
* DataGridViewRowCollection.cs, DataGridView.cs: Fix row insertation:
	   - Use ArrayList.Insert instead of the Item property so that the item
	   is actually inserted and not an existing item replaced.
	   - Call DataGridView.OnRowsAddedInternal and drop internal from
	   OnRowsAdded for binary compitability. This also fixes several
	   redrawing issues.
	[Fixes bug #472968]

svn path=/branches/mono-2-4/mcs/; revision=125901
2009-02-05 18:26:32 +00:00
Andrés G. Aragoneses 13e7da0b12 (Backport typo fix in r125894.)
System.Windows.Forms/ToolBarButton.cs: Doh, fire OnUIATextChanged
  *after* setting the value.

svn path=/branches/mono-2-4/mcs/; revision=125896
2009-02-05 18:07:46 +00:00
Marek Habersack 31d1906af8 Backport of r125885
svn path=/branches/mono-2-4/mcs/; revision=125888
2009-02-05 17:06:35 +00:00
Andrés G. Aragoneses e8030a1270 oops, fix build
svn path=/branches/mono-2-4/mcs/; revision=125877
2009-02-05 16:15:30 +00:00
Andrés G. Aragoneses 81732363f2 * ToolBarButton.cs: OnTextChanged added.
(Backport of r125802.) r: jpobst

svn path=/branches/mono-2-4/mcs/; revision=125876
2009-02-05 16:10:56 +00:00
Miguel de Icaza e47086ae2c Backport the fix for the nullref on WebConnectionStream
svn path=/branches/mono-2-4/mcs/; revision=125875
2009-02-05 16:09:10 +00:00
Marek Habersack adb5812097 Backport of r125857
svn path=/branches/mono-2-4/mcs/; revision=125858
2009-02-05 13:15:31 +00:00
Rodrigo Kumpera a629d14e14 2009-02-05 Rodrigo Kumpera <[email protected]>
Backport of r125849.

	* class.c (mono_class_create_from_typedef): The CLR supports SystemF
	recursive types such as List<T>:Cons<T,List<T>> so when doing the lookup
	for the parent type, the created type must be ready to be used on a generic
	instantiation.
	We fill this_arg/byval_arg if the parent is a generic instance to make sure
	we won't have duplicated entries in generic_inst_cache.

	Fixes #469553.



svn path=/branches/mono-2-4/mono/; revision=125851
2009-02-05 11:52:52 +00:00
Mark Probst 455afec78e 2009-02-05 Mark Probst <[email protected]>
Backport of r125839.

	* mini-exceptions.c (ves_icall_get_frame_info): Account for the
	fact that mono_find_jit_info() sometimes returns the context
	corresponding to the jit info in new_ctx.  Fixes #472600.

2009-02-05  Mark Probst  <[email protected]>

	Backport of r125839.

	* bug-472600.2.cs: New test.

	* Makefile.am: Test added.

svn path=/branches/mono-2-4/mono/; revision=125850
2009-02-05 11:45:58 +00:00
Marek Habersack cee2f48565 Backport of r125798
svn path=/branches/mono-2-4/mcs/; revision=125799
2009-02-05 00:58:02 +00:00
Gonzalo Paniagua Javier 3a1003365a new tests for empty string
svn path=/branches/mono-2-4/mcs/; revision=125796
2009-02-05 00:22:18 +00:00
Gonzalo Paniagua Javier d8f224fa77 2009-02-04 Gonzalo Paniagua Javier <[email protected]>
* DateTime.cs: check for null and empty strings before anything else
	in CoreParse.


svn path=/branches/mono-2-4/mcs/; revision=125794
2009-02-05 00:21:03 +00:00
Miguel de Icaza 22492c37cc Remove public
svn path=/branches/mono-2-4/mcs/; revision=125749
2009-02-04 20:58:29 +00:00
Zoltan Varga a9e7fb0abd 2009-02-04 Zoltan Varga <[email protected]>
Backport of 125697.

	* mini-exceptions.c (mono_setup_altstack): Use a more reasonable altstack
	size on systems with 64k pages. Fixes #471389.

svn path=/branches/mono-2-4/mono/; revision=125698
2009-02-04 16:34:19 +00:00
Marek Safar 02284d8008 Fixed typo.
svn path=/branches/mono-2-4/mcs/; revision=125684
2009-02-04 14:08:30 +00:00
Marek Habersack 0b4c366520 Backport of r125663
svn path=/branches/mono-2-4/mcs/; revision=125664
2009-02-04 10:45:22 +00:00
Marek Habersack f5c7491d79 Backport of r125659
svn path=/branches/mono-2-4/mcs/; revision=125660
2009-02-04 09:04:05 +00:00
Zoltan Varga 4dd31c484d 2009-02-04 Zoltan Varga <[email protected]>
Backport of 125637.
	
	* Regex.cs: Disable the new regex engine for now.

svn path=/branches/mono-2-4/mcs/; revision=125638
2009-02-04 02:21:16 +00:00
Gonzalo Paniagua Javier 48c4359548 2009-02-03 Gonzalo Paniagua Javier <[email protected]>
* WebConnection.cs:
	* HttpWebRequest.cs: calling Abort is safe now if the request has been
	read entirely.


svn path=/branches/mono-2-4/mcs/; revision=125635
2009-02-04 01:50:26 +00:00
Rodrigo Kumpera 3d48548a24 In metadata:
Backport of r125603.

	* verify.c (is_compatible_boxed_valuetype): When checking if the boxed 
	valuetype is compatible with target type, check by inheritance as a
	VT is not really compatible with System.ValueType, for example.

	* verify.c (do_invoke_method): Improve error message.

	* verify.c (do_box_value): If boxing a nullable, use the type argument
	on stack instead.

	* verify.c (do_newobj): Improve error message.	

	Fixes #469549.

2009-02-03 Rodrigo Kumpera  <[email protected]>

In tests/verifier:
	Backport of r125604.

	* valid_boxed_vt_compatible_with_sys_vt_or_sys_enum.il:
	Regression test for #469549.

2009-02-03 Rodrigo Kumpera  <[email protected]>


svn path=/branches/mono-2-4/mono/; revision=125606
2009-02-03 22:05:30 +00:00
Ivan Zlatev bfb47f0422 2009-02-03 Ivan N. Zlatev <[email protected]>
* DataGridViewRowCollection.cs, DataGridView.cs: Move row completion
	code in the row collection code, so that the completion happens before
	the CollectionChanged event, also better encapsulation.
	[Fixes bug #471987]

svn path=/branches/mono-2-4/mcs/; revision=125587
2009-02-03 19:43:40 +00:00
Rodrigo Kumpera c5e9df9a7d In metadata:
2009-02-03 Rodrigo Kumpera  <[email protected]>

	Backport of r125581.

	* verify.c (mono_delegate_signature_equal): Make it possible to check
	first-arg-bound delegates to static method.

	* verify.c (verify_delegate_compatibility): Correctly verify delegates to
	static methods with the first arg bound.

	Fixes #469529.


In tests/verifier:
	Backport of r125582.

	* unverifiable_delegate_with_bad_bound_first_arg_to_static_method.il:
	* mono/tests/verifier/valid_ldfnt_delegates_of_static_methods.il:
	Regression test for #469529.

2009-02-03 Rodrigo Kumpera  <[email protected]>


svn path=/branches/mono-2-4/mono/; revision=125586
2009-02-03 19:41:23 +00:00
Mark Probst 4bfa3b8cb4 2009-02-03 Mark Probst <[email protected]>
Backport of r125565.

	* generic-sharing.c: Don't hold domain lock when calling
	instantiate_other_info().  Fixes #471958.

	* domain-internals.h, loader.c: Describe locking policy of domain
	lock vs loader lock.

svn path=/branches/mono-2-4/mono/; revision=125570
2009-02-03 18:41:15 +00:00
Rodrigo Kumpera d0cfd383a1 In metadata:
Backport of r125539.

	* verify.c: Added stack_slot_full_name to provide decent and more meanfull
	errors.

	* verify.c (is_compatible_boxed_valuetype): Be less restrictive when not
	under strict mode. Any type, when boxed can be seen as a reference type.

	Fixes #469528.

2009-02-03 Rodrigo Kumpera  <[email protected]>

In tests/verifier:
2009-02-03 Rodrigo Kumpera  <[email protected]>

	Backport of r125540.

	* valid_valuetype_boxed_types_are_merge_compatible.il:
	Regression test for #469528.


svn path=/branches/mono-2-4/mono/; revision=125561
2009-02-03 17:54:42 +00:00
Marek Safar 236f5b982c Fixes build.
svn path=/branches/mono-2-4/mcs/; revision=125550
2009-02-03 16:50:46 +00:00
Marek Safar 082abf401a 2009-02-03 Marek Safar <[email protected]>
* class.cs, generic.cs: Emit type parameter constraints for nested
	types.


svn path=/branches/mono-2-4/mcs/; revision=125508
2009-02-03 12:08:02 +00:00
Gonzalo Paniagua Javier bc2585699c 2009-02-03 Gonzalo Paniagua Javier <[email protected]>
* WebProxy.cs: use TryParse when checking for a localhost IP.


svn path=/branches/mono-2-4/mcs/; revision=125500
2009-02-03 10:08:56 +00:00
Gonzalo Paniagua Javier 6dad7702ea 2009-01-26 Gonzalo Paniagua Javier <[email protected]>
* HttpWebResponse.cs: avoid throwing an exception when
	Content-Length is not present.

svn path=/branches/mono-2-4/mcs/; revision=125493
2009-02-03 08:18:25 +00:00
Raja R Harinath 84031f8584 Fix #463999
* CommittableTransaction.cs (CommitCallback): Handle the case
where the callback is invoked before BeginCommit ends due to the
async call ending synchronously.

svn path=/branches/mono-2-4/mcs/; revision=125490
2009-02-03 07:20:32 +00:00
Rodrigo Kumpera 243a027520 In metadata:
2009-02-03 Rodrigo Kumpera  <[email protected]>

	Backport of r125458.

	* object.h: The lower bound of an array is a signed integer value.
	Introduce mono_array_lower_bound_t typedef. It should be used instead of
	gint32 as under MONO_BIG_ARRAYS it will be a gint64.

	* icall.c: Cast MonoArrayBounds::length to a signed value so correctly
	calculate the upper bound.
	
	Fixes #471252.

In mini:
2009-02-03  Rodrigo Kumpera  <[email protected]>

	Backport of r125459.

	* arrays.cs: Test for Get/SetValue of array with negate lower bounds.
	

svn path=/branches/mono-2-4/mono/; revision=125461
2009-02-03 03:06:01 +00:00
Rodrigo Kumpera 5b78093eef 2008-02-03 Rodrigo Kumpera <[email protected]>
* MonoMethod.cs (ToString): Fix the 1.1 build.


svn path=/branches/mono-2-4/mcs/; revision=125457
2009-02-03 02:53:00 +00:00
Ivan Zlatev 4b6d5edc78 2009-02-02 Ivan N. Zlatev <[email protected]>
* DataGridView.cs: When editing is finished do not remove the editing
	row, because it has already become a real one. Instead add a new one.
	[Fixes bug #471754]

svn path=/branches/mono-2-4/mcs/; revision=125445
2009-02-02 23:36:15 +00:00
Rodrigo Kumpera b9d3e3262c Backport of r125415.
* MonoMethod.cs (ToString): Fix the representation of non primitive structs.

2008-02-02  Rodrigo Kumpera  <[email protected]>


svn path=/branches/mono-2-4/mcs/; revision=125417
2009-02-02 22:01:46 +00:00
Rodrigo Kumpera 77c4302bdf In Test/System.Reflection:
2008-02-02  Rodrigo Kumpera  <[email protected]>

	Backport of r125410.

	* MethodInfoTest.cs: Test for #409583.

In System.Reflection:
2008-02-02  Rodrigo Kumpera  <[email protected]>

	Backport of r125409.

	* MonoMethod.cs (ToString): Fix representation of pointer types.

	Fixes #409583.


svn path=/branches/mono-2-4/mcs/; revision=125411
2009-02-02 21:11:19 +00:00
Rodrigo Kumpera 7f13ce00ce 2009-02-02 Rodrigo Kumpera <[email protected]>
Backport of r125402.

	* icall.c (type_from_name): Ignore reflection frames to find out the real caller.

	Fixes #471255.


svn path=/branches/mono-2-4/mono/; revision=125404
2009-02-02 20:40:08 +00:00
Mark Probst 643a83b9a0 2009-02-02 Mark Probst <[email protected]>
Backport of r125388.

	* generic-sharing.c (lookup_or_register_other_info): Make sure the
	loader lock is not taken while the templates lock is held.  Fixes
	#471089.

svn path=/branches/mono-2-4/mono/; revision=125391
2009-02-02 18:48:15 +00:00
Mark Probst 25b50b1c80 2009-02-02 Mark Probst <[email protected]>
Backport or r125371.

	* metadata.c (type_in_image): Added a check to fix a monodis
	crash.

svn path=/branches/mono-2-4/mono/; revision=125377
2009-02-02 17:07:07 +00:00
Andrés G. Aragoneses 2e3f003f5f 2009-02-02 Andrés G. Aragoneses <[email protected]>
* ToolBar.cs: Add new UIAPerformClick method to be called by
        UIAutomationWinforms when someone calls Invoke() on the
        ToolBarButtonProvider. (Backport of r125354.) r: jpobst


svn path=/branches/mono-2-4/mcs/; revision=125358
2009-02-02 16:02:09 +00:00
Marek Safar b8a1e12c73 2009-02-02 Marek Safar <[email protected]>
A fix for bug #471213
	* class.cs: Avoid emitting backing field for abstract event fields.


svn path=/branches/mono-2-4/mcs/; revision=125335
2009-02-02 11:33:07 +00:00
Ivan Zlatev 95ca868476 2009-02-01 Ivan N. Zlatev <[email protected]>
* DataGridView.cs: Complete incomplete rows when they are added to
	the grid.
	[Fixes bug #471068]

svn path=/branches/mono-2-4/mcs/; revision=125278
2009-02-01 20:00:30 +00:00
Ivan Zlatev 58c2baf6a6 2009-02-01 Ivan N. Zlatev <[email protected]>
* DataGridView.cs, DataGridViewColumnCollection.cs: Ensure that the
	binding is cleared prior to setting it to null. Fixes a regression
	causing exceptions when the DataSource is set to null and then set
	again to a data source.

svn path=/branches/mono-2-4/mcs/; revision=125272
2009-02-01 18:33:43 +00:00
Marek Safar 3fc405788c 2009-02-01 Marek Safar <[email protected]>
A fix for bug #359731
	* cs-tokenizer.cs, cs-parser.jay: Correctly parse nested query
	expressions.


svn path=/branches/mono-2-4/mcs/; revision=125270
2009-02-01 18:23:45 +00:00
Ivan Zlatev 79d7ad5921 2009-02-01 Ivan N. Zlatev <[email protected]>
* DataGridView.cs, DataGridViewImageColumn.cs, DataGridViewCell.cs:
	   - Make Image/Bitmap cells work.
	   - Handle images with size greater than the cell.
	   - Default to MiddleCenter alignment for image cells.
	[Fixes bug #471101]

svn path=/branches/mono-2-4/mcs/; revision=125260
2009-02-01 16:31:21 +00:00
Rodrigo Kumpera 4809f77419 2009-01-31 Rodrigo Kumpera <[email protected]>
Backport of r125172, r125205 and r125206 

	* basic-calls.cs: Test for the weird crash found on arm.
	
	* cpu-arm.md: Increase the size of storer8_membase_reg and
	loadr8_membase_reg to 24 bytes to accomodate the extra add.

	* mini-arm.c (mono_arch_output_basic_block): Under FPA, when emitting
	OP_STORER8_MEMBASE_REG and OP_LOADR8_MEMBASE_REG, add the original
	reg to LR otherwise we'll be loading/storing from just the offset.

	* cpu-arm.md: Increase the size of storer8_membase_reg to 20 bytes
	as it might use decomposed ops.


svn path=/branches/mono-2-4/mono/; revision=125207
2009-01-31 03:55:25 +00:00
Rodrigo Kumpera 71b8786ee9 2009-01-30 Rodrigo Kumpera <[email protected]>
Backport of r125077-79
	* exceptions-arm.c (mono_arch_find_jit_info): The frame layout on arm have
	separate frame and stack pointers, so we must use FP to find the register
	spill area.
	The FP reg is retrieved from the MonoContext::regs array.


	* mini-arm.c (mono_arch_output_basic_block): Emit two cond ops for OP_FBGE
	as FPA requires it.

	* mini-arm.c (mono_arch_emit_setret): Emit OP_FMOVE for methods that
	return R4 and R8 when not running under softfloat.

	Fixes basic-calls.exe


svn path=/branches/mono-2-4/mono/; revision=125116
2009-01-30 17:12:46 +00:00
Marek Habersack 0c0fa5ec89 Backport of r125111.
svn path=/branches/mono-2-4/mcs/; revision=125112
2009-01-30 16:53:05 +00:00
Marek Safar 57e29afeaf 2009-01-30 Marek Safar <[email protected]>
A fix for bug #470767
	* statement.cs: Introduced BlockScopeExpression, needed when 
	expression tree conversion has to emit scope variables.


svn path=/branches/mono-2-4/mcs/; revision=125096
2009-01-30 14:51:17 +00:00
Gonzalo Paniagua Javier c1577730af revert changes that should not be here yet
svn path=/branches/mono-2-4/mcs/; revision=124989
2009-01-29 19:00:13 +00:00
Gonzalo Paniagua Javier e22310c6b8 fix the 1.x build. Patch from Marek Safar
svn path=/branches/mono-2-4/mcs/; revision=124986
2009-01-29 18:57:41 +00:00
Gonzalo Paniagua Javier dc34921ff7 fix changelog
svn path=/branches/mono-2-4/mcs/; revision=124960
2009-01-29 17:18:54 +00:00
Gonzalo Paniagua Javier c4c2071766 2009-01-29 Gonzalo Paniagua Javier <[email protected]>
* Tds70.cs: fix for output parameters and '@'.
	Fixes bug #470120.


svn path=/branches/mono-2-4/mcs/; revision=124959
2009-01-29 17:16:46 +00:00
Gonzalo Paniagua Javier 16e7814ee4 2009-01-29 Gonzalo Paniagua Javier <[email protected]>
* HttpApplicationFactory.cs: fix check that avoids lock. Keep one
	HttpApplication instance ready to be returned in an instance variable
	to avoid a few locks.


svn path=/branches/mono-2-4/mcs/; revision=124949
2009-01-29 16:41:12 +00:00
Carlos Alberto Cortez 568d44fd06 2009-01-29 Carlos Alberto Cortez <[email protected]>
* XplatUIX11.cs: We should use utf8 handling clipboard transference
        with other x11 applications, and use utf16 when handling clipboard
        data in the class library. Update the related points as well.
        Fixes #468683.


svn path=/branches/mono-2-4/mcs/; revision=124920
2009-01-29 14:15:30 +00:00
Ivan Zlatev bcdc624995 2009-01-28 Ivan N. Zlatev <[email protected]>
* DataGridViewCell.cs: Format strings according to the supplied
	CellStyle.Format.
	[Fixes bug #470384]

svn path=/branches/mono-2-4/mcs/; revision=124878
2009-01-28 23:34:19 +00:00
Marek Habersack f2b360fc5d Backport of r124872
svn path=/branches/mono-2-4/mcs/; revision=124874
2009-01-28 23:29:31 +00:00
Bill Holmes f913aabf5c 2009-01-28 Bill Holmes <[email protected]>
Backport of r124869.

	* Uri.cs (IsWellFormedUriString):  Changing IsWellFormedUriString
	  to not throw an exception but return false instead.

	Contributed under MIT/X11 license.


svn path=/branches/mono-2-4/mcs/; revision=124870
2009-01-28 23:24:09 +00:00
Ivan Zlatev 3cd16ddbdb 2009-01-28 Ivan N. Zlatev <[email protected]>
* DataGridView.cs: Reset the hover cell if it gets moved due to row(s)
	addition or removal. Fixes multiple crashes in OnMouseMove.

svn path=/branches/mono-2-4/mcs/; revision=124868
2009-01-28 22:48:56 +00:00
Carlos Alberto Cortez 8edff05440 2009-01-28 Carlos Alberto Cortez <[email protected]>
* TreeNode.cs: NextVisibleNode and PrevVisibleNode properties don't
	take into account the fact that OpenTreeNodeEnumerator needs to call
	MoveNext/MovePrevious to actually put the passed node as the one
	retrieved in Current. This way this property should work as really
	expected in .net.
	Fixes part of #467225.


svn path=/branches/mono-2-4/mcs/; revision=124802
2009-01-28 17:14:50 +00:00
Carlos Alberto Cortez bd3a3e1ec5 2009-01-28 Carlos Alberto Cortez <[email protected]>
* TreeView.cs: When calculating the scrollbars, don't use
	TreeNode.Bounds, since it still can have the values of the previous
	-and now invalid- layout -which depends on TreeView.skipped_nodes, and
	could not have been updated as well-, and use the actual number of
	visible number of nodes to compute the height needed to contain all
	the nodes. Also reset the value of vbar to 0 when disabled - this way
	we make sure that, when re-enabled, it will update the visible area of
	the treeview, even if the previous value before disabling it is the
	same as now. Finally don't do anything for the vbar.ValueChanged
	handler - for the case wheer we manually set the value but don't the
	vbar is disabled already.
	Fixes part of #467225.


svn path=/branches/mono-2-4/mcs/; revision=124801
2009-01-28 17:12:51 +00:00
Carlos Alberto Cortez 330dee9522 2009-01-28 Carlos Alberto Cortez <[email protected]>
* TreeView.cs: In CollapseAll, set vbar to the maximum value, instead 
	of trying to set as top node the highest parent of the previous
	top node. Moving to the bottom of the TreeView after a call
	to CollapseAll is exactly what .net does. This should avoid some
	nasty issue when CollapseAll is called and we don't need the
	vertical scroll bar.
	

svn path=/branches/mono-2-4/mcs/; revision=124800
2009-01-28 17:09:34 +00:00
Marek Safar e65b5f396b 2009-01-28 Marek Safar <[email protected]>
A fix for bug #470227
	* cs-tokenizer.cs: Remove too agressive parser optimization.


svn path=/branches/mono-2-4/mcs/; revision=124787
2009-01-28 16:13:16 +00:00
Marek Safar 5c4721c3d5 2009-01-28 Marek Safar <[email protected]>
A fix for bug #324319
	* class.cs: Remove too early base type resolve.


svn path=/branches/mono-2-4/mcs/; revision=124770
2009-01-28 12:29:20 +00:00
Mark Probst 3f7fdcc82d 2009-01-27 Mark Probst <[email protected]>
Backport of r124712.

	* method-to-ir.c (emit_stloc_ir): Only apply the reg-reg move
	optimization if the top of stack is the last instruction in the
	bblock.  Otherwise it might have been used after its definition.
	Fixes #469742.

2009-01-27  Mark Probst  <[email protected]>

	Backport of r124712.

	* bug469742.2.il: New test.

	* Makefile.am: Test added.

svn path=/branches/mono-2-4/mono/; revision=124715
2009-01-27 21:49:44 +00:00
Zoltan Varga a3d384dbbf 2009-01-27 Zoltan Varga <[email protected]>
* Backport of r123987.

	* method-to-ir.c (method-to-ir.c): Add support for the constrained prefix
	on type variables in AOTed code.

svn path=/branches/mono-2-4/mono/; revision=124691
2009-01-27 18:31:49 +00:00
Ivan Zlatev 699f408478 2009-01-27 Ivan N. Zlatev <[email protected]>
* DataGridView.cs: Fix a NRE when setting the CurrentCell to null.

svn path=/branches/mono-2-4/mcs/; revision=124671
2009-01-27 16:48:12 +00:00
Ivan Zlatev 332943e496 2009-01-27 Ivan N. Zlatev <[email protected]>
* XplatUIX11.cs: Fire Timer.Tick even if there is no MainForm for the
	current context.
	[Fixes bug #469239]

svn path=/branches/mono-2-4/mcs/; revision=124669
2009-01-27 16:41:05 +00:00
Marek Habersack 204dc4ea04 Backport of r124659
svn path=/branches/mono-2-4/mcs/; revision=124660
2009-01-27 14:25:33 +00:00
Gonzalo Paniagua Javier 49bbf1f4c3 2009-01-26 Christian Prochnow <[email protected]>
* Ping.cs: ignore ICMP echo request packet in case we ping
	  localhost.


svn path=/branches/mono-2-4/mcs/; revision=124625
2009-01-27 04:23:18 +00:00
Andreia Gaita 401cabfc6a 2009-01-26 Andreia Gaita <[email protected]>
* WebBrowser.cs: fix initial value of ScrollbarsEnabled, so they
	won't be disabled by default.
	[Backported from r124596, fixes #468690]

svn path=/branches/mono-2-4/mcs/; revision=124615
2009-01-27 00:44:14 +00:00
Marek Safar a2e8d38fa6 2009-01-27 Marek Safar <[email protected]>
* anonymous.cs: Fixed recent regression when initializing captured 
	this.


svn path=/branches/mono-2-4/mcs/; revision=124608
2009-01-27 00:01:40 +00:00
Zoltan Varga 099b6e3c26 2009-01-26 Zoltan Varga <[email protected]>
Backport of r124582.

	* mini-s390x.c: Remove a stray declaration of emit_sig_cookie () to fix
	the s390x build.

svn path=/branches/mono-2-4/mono/; revision=124583
2009-01-26 22:12:45 +00:00
Ivan Zlatev 9979ab1f91 2009-01-26 Ivan N. Zlatev <[email protected]>
* DataGridView.cs: Do not clear the rows if we are not databound.

svn path=/branches/mono-2-4/mcs/; revision=124570
2009-01-26 21:58:17 +00:00
Ivan Zlatev f11abca644 2009-01-26 Ivan N. Zlatev <[email protected]>
* DataGridView.cs: Do not be too smart about selecting the first cell
	when the first row is added as this is not what MS does. Fixes the
	failing unit tests.

svn path=/branches/mono-2-4/mcs/; revision=124566
2009-01-26 21:45:47 +00:00
Marek Habersack c12233306a Backport of r124547
svn path=/branches/mono-2-4/mcs/; revision=124548
2009-01-26 18:58:39 +00:00
Marek Safar 5995136419 2009-01-26 Marek Safar <[email protected]>
A fix for bug #469019
	* anonymous.cs: Use all parent type parameters when instantiating
	nested generic storey.


svn path=/branches/mono-2-4/mcs/; revision=124533
2009-01-26 16:49:46 +00:00
Marek Safar 2441d1f521 2009-01-26 Marek Safar <[email protected]>
* expression.cs: Check for null instance methodgroup expression.


svn path=/branches/mono-2-4/mcs/; revision=124506
2009-01-26 15:28:26 +00:00
Marek Habersack 410a27b2bf Backport of r124491
svn path=/branches/mono-2-4/mcs/; revision=124492
2009-01-26 13:27:30 +00:00
Marek Safar a05f9f8b5e 2009-01-26 Marek Safar <[email protected]>
A fix for bug #469244
	* cs-tokenizer.cs, cs-parser.jay: Fixed parsing of nullable type
	instance inside a conditional expression.


svn path=/branches/mono-2-4/mcs/; revision=124489
2009-01-26 13:20:16 +00:00
Marek Habersack 6e5c11cd30 Backport of r124479
svn path=/branches/mono-2-4/mcs/; revision=124481
2009-01-26 11:39:43 +00:00
Marek Habersack b1c0dfa135 Backport of r124475
svn path=/branches/mono-2-4/mcs/; revision=124476
2009-01-26 10:47:02 +00:00
Gonzalo Paniagua Javier 3653a83b39 2009-01-26 Gonzalo Paniagua Javier <[email protected]>
* SocketTest.cs:
	(TestSelect1) avoid RST by reading the bytes from the client.

svn path=/branches/mono-2-4/mcs/; revision=124464
2009-01-26 07:02:18 +00:00
Zoltan Varga cb0c6ba813 2009-01-26 Zoltan Varga <[email protected]>
Backport of r124456.

	* exceptions-amd64.c (mono_arch_exceptions_init): Call 
	get_throw_pending_exception () to avoid initialization races.

	* mini-exceptions.c (mono_exceptions_init): Call an arch specific
	mono_arch_exceptions_init () function.

svn path=/branches/mono-2-4/mono/; revision=124462
2009-01-26 06:52:10 +00:00
Gonzalo Paniagua Javier 16eaf2a641 2009-01-26 Gonzalo Paniagua Javier <[email protected]>
* HttpWebRequest.cs: added locking in SetResponseData for the case
	when we get an error response before BeginGetResponse has been
	called.


svn path=/branches/mono-2-4/mcs/; revision=124453
2009-01-26 05:03:35 +00:00
Gonzalo Paniagua Javier 516a0835f0 fix ChangeLog
svn path=/branches/mono-2-4/mcs/; revision=124413
2009-01-24 08:16:23 +00:00
Gonzalo Paniagua Javier 7ff67aa81a Improved TDS connection pooling and synched with HEAD
svn path=/branches/mono-2-4/mcs/; revision=124409
2009-01-24 05:56:39 +00:00
Gonzalo Paniagua Javier 6f0d5440ce Do not throw exceptions when attempting to load satellite assemblies
svn path=/branches/mono-2-4/mcs/; revision=124407
2009-01-24 05:35:35 +00:00
Gonzalo Paniagua Javier 06c1a5f74c 2009-01-24 Gonzalo Paniagua Javier <[email protected]>
* appdomain.c: return NULL instead of throwing FileNotFoundException
	when LoadAssembly() fails.


svn path=/branches/mono-2-4/mono/; revision=124406
2009-01-24 05:35:23 +00:00
Gonzalo Paniagua Javier 572fa90350 2009-01-23 Gonzalo Paniagua Javier <[email protected]>
* AspComponentFoundry.cs: no need to throw. Caller handles a null
	return value.


svn path=/branches/mono-2-4/mcs/; revision=124398
2009-01-24 03:28:19 +00:00
Gonzalo Paniagua Javier 9a7ac8152c 2009-01-23 Gonzalo Paniagua Javier <[email protected]>
* HttpResponse.cs: make sure config is not null here.
	* HttpApplication.cs: add a timer (-d:PIPELINE_TIMER) for the pipeline.
	Handle timeouts for OutputPage() too.


svn path=/branches/mono-2-4/mcs/; revision=124396
2009-01-24 03:20:13 +00:00
Gonzalo Paniagua Javier 9468c9429f 2009-01-23 Gonzalo Paniagua Javier <[email protected]>
* HttpApplicationFactory.cs: set/reset the context for the application
	when creating/disposing. Dispose() out of the lock.


svn path=/branches/mono-2-4/mcs/; revision=124394
2009-01-24 03:04:12 +00:00
Marek Habersack 0c702ece52 Backport of r124385
svn path=/branches/mono-2-4/mcs/; revision=124386
2009-01-24 00:38:33 +00:00
Marek Habersack 8b2e70be67 Backport of r124377
svn path=/branches/mono-2-4/mcs/; revision=124378
2009-01-23 21:50:04 +00:00
Mark Probst 8ee63bd04a 2009-01-23 Mark Probst <[email protected]>
Backport of r124339.

	* mini-ppc.c (mono_arch_context_get_int_reg): Allow access to the
	stack pointer (r1).

svn path=/branches/mono-2-4/mono/; revision=124340
2009-01-23 16:48:19 +00:00
Marek Habersack 30f6ae193f 2009-01-23 Marek Habersack <[email protected]>
* BuildManager.cs: if dependencyCache already contains the virtual
	path, replace its corresponding file set (in AddToCache). This can
	happen only if the requested virtual path compilation resulted in
	errors and the compilation has been retried. Fixes bug #46268


svn path=/branches/mono-2-4/mcs/; revision=124326
2009-01-23 14:07:17 +00:00
Mark Probst 6d52bd6446 2009-01-23 Mark Probst <[email protected]>
Backport of r124022 and r124301.

	* metadata.c (mono_metadata_generic_param_equal): Owner as well as
	image must match.  Only compare the image if the owner is NULL.
	Fixes the AOT failures.

svn path=/branches/mono-2-4/mono/; revision=124305
2009-01-23 09:40:04 +00:00
Ivan Zlatev 85b4874919 2009-01-23 Ivan N. Zlatev <[email protected]>
* DataGridView.cs, DataGridViewCell.cs: Fix crashes when there is no
	editing control.

svn path=/branches/mono-2-4/mcs/; revision=124281
2009-01-23 01:35:31 +00:00
Ivan Zlatev ab52d70383 2009-01-23 Ivan N. Zlatev <[email protected]>
* DataGridView.cs: Fix new row adding/editing in the non-databound
	scenario.

svn path=/branches/mono-2-4/mcs/; revision=124280
2009-01-23 01:35:26 +00:00
Zoltan Varga 64d093c92a 2009-01-23 Zoltan Varga <[email protected]>
Backport of r124266.
	
	* metadata.c (mono_metadata_load_generic_params): Initialize the 
	MonoGenericParam structure using memset so the image field is initialized
	as well.

svn path=/branches/mono-2-4/mono/; revision=124268
2009-01-22 23:43:26 +00:00
Zoltan Varga b0af86bfc2 2009-01-22 Zoltan Varga <[email protected]>
Backport of r124260.
	
	* Stopwatch.cs: Reorder the calculations in Elapsed and ElapsedMilliseconds
	to avoid overflow. Fixes #468570. Patch by Yoni Shalom <[email protected]>.

svn path=/branches/mono-2-4/mcs/; revision=124262
2009-01-22 22:19:55 +00:00
Mark Probst 655579cbb1 2009-01-22 Mark Probst <[email protected]>
Backport of r124246.

	* mini-exceptions.c (ves_icall_get_frame_info): Fetch the generic
	info from the (correct) context.

2009-01-22  Mark Probst  <[email protected]>

	Backport of r124246.

	* generic-stack-traces2.2.cs: Another generic sharing test for
	stack traces.

	* Makefile.am: Test added.

svn path=/branches/mono-2-4/mono/; revision=124249
2009-01-22 21:15:17 +00:00
Jb Evain 2809fe1936 idiotic test NotWorking
svn path=/branches/mono-2-4/mcs/; revision=124242
2009-01-22 20:10:33 +00:00
Jb Evain e5590d4ff5 backport the linq fixes that happened in 124200:124231
svn path=/branches/mono-2-4/mcs/; revision=124232
2009-01-22 17:43:38 +00:00
Neville Gao 4d259921aa Backported r124045: Control enabled to support accessibility. Added
UIACollectionChangedEvent.

svn path=/branches/mono-2-4/mcs/; revision=124172
2009-01-22 06:01:24 +00:00
Mike Gorse 0043b1fd2b * TrackBar.cs: Backported R124116: Make LargeIncrement/Decrement
internal so that UIA can use them.
  Added UIAValueParamChangedEvent.

svn path=/branches/mono-2-4/mcs/; revision=124129
2009-01-21 23:32:53 +00:00
Atsushi Eno 8b50ed4dbb backport r124126.
svn path=/branches/mono-2-4/mcs/; revision=124127
2009-01-21 23:21:22 +00:00
Marek Habersack 7727921d34 Backport of r124121 and r124122
svn path=/branches/mono-2-4/mcs/; revision=124123
2009-01-21 22:53:22 +00:00
Zoltan Varga 56c1d33ae4 Revert r124022 as it is breaking AOT.
svn path=/branches/mono-2-4/mono/; revision=124102
2009-01-21 20:16:59 +00:00
Zoltan Varga cad348bcb2 2009-01-21 Zoltan Varga <[email protected]>
Backport of r124092.
	
	* method-to-ir.c (handle_alloc): Avoid generic instances in the
	out_of_line optimization.

svn path=/branches/mono-2-4/mono/; revision=124095
2009-01-21 19:34:51 +00:00
Mario Carrion c643703e79 2009-01-21 Mario Carrion <[email protected]>
* Form.cs: Backported r124064: UIA Support: Internal events
        added: UIAWindowStateChanged and UIATopMostChanged.

svn path=/branches/mono-2-4/mcs/; revision=124082
2009-01-21 18:54:38 +00:00
Zoltan Varga 9c234e78b1 Fix the 1.1 build.
svn path=/branches/mono-2-4/mcs/; revision=124077
2009-01-21 18:13:20 +00:00
Rodrigo Kumpera 85c63ecffe 2009-01-21 Rodrigo Kumpera <[email protected]>
Backport of r124059.

	* appdomain-unload-callback.cs: New test for the AppDomain::DomainUnload
	deadlock.

	* Makefile.am: Test added.


svn path=/branches/mono-2-4/mono/; revision=124072
2009-01-21 18:00:02 +00:00
Rodrigo Kumpera 86877ecd25 2009-01-21 Rodrigo Kumpera <[email protected]>
Backport of r124068.

	* appdomain.c (mono_domain_unload): Change the InterlockedIncrement to
	a plain store.

2009-01-21 Rodrigo Kumpera  <[email protected]>

	Backport of r124058.

	* domain-internals.h: Add new appdomain state MONO_APPDOMAIN_UNLOADING_START
	which signals that the unloading has started but all appdomain services must
	remain operational.

	* appdomain.c (mono_domain_unload): The initial state for unloading now
	is unloading_start and we switch to unloading after the managed call to
	AppDomain::DomainUnload has finished.

	The new unloading state has to be created because managed code in the
	DomainUnload event can depend on things like the threadpool still working.
	The domain must remain fully functional while the event executes.

	This shown as an issue due to Process::WaitForExit, which waits for
	async reads of stdout and stderr to complete. Since those are processed
	in the threadpool the code deadlocks because the DomainUnload callback 
	waits for the async read finished event, which should have been set by a
	threadpool job but has been discarded due to the domain been in unload
	state.


svn path=/branches/mono-2-4/mono/; revision=124071
2009-01-21 17:58:36 +00:00
Zoltan Varga a228d05aec 2009-01-21 Zoltan Varga <[email protected]>
Backport of r124065.
	
	* class.c (mono_class_setup_vtable_general): In the generic instance
	optimization, set method->slot for abstract virtual methods. Fixes part of
	#467834.

svn path=/branches/mono-2-4/mono/; revision=124067
2009-01-21 17:42:11 +00:00
Martin Baulig 19503869ca 2009-01-21 Martin Baulig <[email protected]>
Backport or r124060.

	* mini.h
	(MonoCompile): Added `disable_deadce_vars' to disable removing
	unused variables.

	* mini.c
	(mini_method_compile): Set `cfg->disable_deadce_vars' when running
	inside the debugger.

	* liveness.c (mono_analyze_liveness): Don't remove any unused
	variables if `cfg->disable_deadce_vars' is set.


svn path=/branches/mono-2-4/mono/; revision=124061
2009-01-21 17:00:39 +00:00
Sandy Armstrong 9e91c826fd * Managed.Windows.Forms/System.Windows.Forms/MenuItem.cs: Add
UIACheckChanged, UIARadioCheckChanged, UIAEnabledChanged, and
  UIATextChanged events.

* Managed.Windows.Forms/System.Windows.Forms/Form.cs: Add UIAMenuChanged
  event.

* Managed.Windows.Forms/System.Windows.Forms/Menu.cs:
* Managed.Windows.Forms/System.Windows.Forms/MenuAPI.cs: Note which
  internal APIs are being used by UIA.

svn path=/branches/mono-2-4/mcs/; revision=124055
2009-01-21 16:31:22 +00:00
Mark Probst ebb82987f6 2009-01-21 Mark Probst <[email protected]>
Backport of r124028.

	* method-to-ir.c: Only apply exception constructor optimization if
	the the method actually belongs to an exception class.  Fixes
	#467456.

2009-01-21  Mark Probst  <[email protected]>

	Backport of r124028.

	* bug-467456.cs: New test case.

	* Makefile.am: Test added.

svn path=/branches/mono-2-4/mono/; revision=124031
2009-01-21 12:36:49 +00:00
Mark Probst e311191ef7 2009-01-21 Mark Probst <[email protected]>
Backport of r124022.

	* metadata.c (mono_metadata_generic_param_equal): Owner as well as
	image must match.

2009-01-21  Mark Probst  <[email protected]>

	Backport of r124022.

	* generic-unloading.2.cs, generic-unloading-sub.2.cs: Test case
	for unloading images whose MonoGenericInst's are still in use.

	* Makefile.am: Test added.

svn path=/branches/mono-2-4/mono/; revision=124025
2009-01-21 11:11:54 +00:00
Zoltan Varga ab819e4118 2009-01-21 Zoltan Varga <[email protected]>
Backport of r123989.
	
	* mini-trampolines.c (mono_delegate_trampoline): Put back the previous
	change inside a #ifdef __mono_ppc64__.

svn path=/branches/mono-2-4/mono/; revision=123990
2009-01-21 04:33:07 +00:00
Zoltan Varga dc3f9d3f6d Fix the windows build.
svn path=/branches/mono-2-4/mono/; revision=123981
2009-01-21 01:55:25 +00:00
Mark Probst 451bc2a8a8 2009-01-21 Mark Probst <[email protected]>
Backport of r123959.

	* TypeBuilderTest.cs: Add test for fields in dynamic generic
	classes.

svn path=/branches/mono-2-4/mcs/; revision=123965
2009-01-21 00:03:59 +00:00
Mark Probst 84b2d6bfec 2009-01-21 Mark Probst <[email protected]>
Backport of r123958.

	* reflection.c (resolve_object): For fields, inflate the class and
	then get the field in the inflated class.

svn path=/branches/mono-2-4/mono/; revision=123964
2009-01-21 00:03:38 +00:00
Mark Probst a498cddad7 2009-01-20 Mark Probst <[email protected]>
Backport of r123917.

	* method-to-ir.c: Force the vtable variable in shared generic code
	for the case that they might show up on a stack trace where they
	are needed.

	* mini-exceptions.c: Save and use generic sharing info as well as
	IP in stack traces to resolve shared generic instantiations.

2009-01-20  Mark Probst  <[email protected]>

	Backport of r123917.

	* object-internals.h (struct _MonoException): Added a comment
	explaining the new use of trace_ips.

2009-01-20  Mark Probst  <[email protected]>

	Backport of r123917.

	* generic-stack-traces.2.cs: Generic sharing test for stack
	traces.

	* Makefile.am: Test added.

svn path=/branches/mono-2-4/mono/; revision=123946
2009-01-20 22:14:33 +00:00
Zoltan Varga 03c6b6918b 2009-01-20 Zoltan Varga <[email protected]>
Backport of r123914.
	
	* mini-trampolines.c (mono_delegate_trampoline): Revert the change which
	added a mono_get_addr_from_ftnptr () as it breaks the ia64 build.

svn path=/branches/mono-2-4/mono/; revision=123927
2009-01-20 21:22:20 +00:00
Andrew Jorgensen dc279e74dc update version numbers to 2.4
svn path=/branches/mono-2-4/mono/; revision=123902
2009-01-20 18:21:18 +00:00
1472 changed files with 58973 additions and 72980 deletions

No files matched your search

+6 -41
View File
@@ -1,49 +1,14 @@
2009-02-26 Marek Habersack <[email protected]>
* data/mono.web.pc.in: added. Fixes bug #479760
* data/Makefile.am: added mono.pc{.in} wherever necessary
2009-02-07 Gonzalo Paniagua Javier <[email protected]>
* configure.in: include stdio so that NULL is defined when checking
for ifreq.
2009-02-06 Miguel De Icaza <[email protected]>
* Disable parallel marking on OSX as it hangs during collections
in the bootstrap stage of Mono.
As we find more platforms that hang, we should disable it there as
well.
2009-02-03 Miguel de Icaza <[email protected]>
* configure.in (PLATFORM_NO_SYMLINKS): New define that replaces
PLATFORM_WIN32.
2009-02-02 Rodrigo Kumpera <[email protected]>
* configure.in: Add --with-mcs-docs to make it possible to disable building of documentation under mcs.
2009-01-29 Zoltan Varga <[email protected]>
* configure.in: Remove -Wcast-align from the warning list, it leads to a lot of
useless warnings which can only be fixed by casting a pointer to (void*).
2009-01-29 Miguel de Icaza <[email protected]>
* configure.in: Add a couple of new AM conditionals for POSIX and
DARWIN, these are used to conditionally include some files in
mono/mini.
2009-01-27 Jb Evain <[email protected]>
* configure.in: bump Mono's version to 2.5 now that 2.4
has been branched.
2009-01-25 Zoltan Varga <[email protected]>
* acinclude.m4 (dolt_supported): Handle ARM as well.
2009-01-23 Zoltan Varga <[email protected]>
* configure.in: Make --enable-parallel-mark=yes the default.
2009-01-17 Zoltan Varga <[email protected]>
* configure.in: Complete the OPROFILE checks.
+2 -2
View File
@@ -37,8 +37,8 @@ For comments, corrections and updates, please contact [email protected]
We consider non-LGPL use instances where you use this on an
embedded system where the end user is not able to upgrade the
Mono VM or Moonlight installation or distribution that is part
of your product (Section 6 and 7), you would have to obtain a
Moonlight installation or distribution that is part of your
product (Section 6 and 7), you would have to obtain a
commercial license from Novell (consider software burned into
a ROM, systems where end users would not be able to upgrade,
an embedded console, a game console that imposes limitations
+1 -1
View File
@@ -23,7 +23,7 @@ if test x$GCC != xyes; then
fi
case $host in
i?86-*-linux*|x86_64-*-linux*|powerpc-*-linux* \
|amd64-*-freebsd*|i?86-*-freebsd*|ia64-*-freebsd*|arm*-*-linux*)
|amd64-*-freebsd*|i?86-*-freebsd*|ia64-*-freebsd*)
pic_options='-fPIC'
;;
i?86-apple-darwin*)
+18 -42
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.5)
AM_INIT_AUTOMAKE(mono,2.4)
AM_MAINTAINER_MODE
API_VER=1.0
@@ -64,13 +64,10 @@ need_link_unlink=no
AC_MSG_CHECKING([host platform characteristics])
libgc_threads=no
has_dtrace=no
parallel_mark=yes
case "$host" in
*-*-mingw*|*-*-cygwin*)
platform_win32=yes
AC_DEFINE(PLATFORM_WIN32,1,[Platform is Win32])
AC_DEFINE(DISABLE_PORTABILITY,1,[Disable the io-portability layer])
AC_DEFINE(PLATFORM_NO_SYMLINKS,1,[This platform does not support symlinks])
if test "x$cross_compiling" = "xno"; then
CC="gcc -mno-cygwin -g"
# So libgc configure gets -mno-cygwin
@@ -100,7 +97,6 @@ case "$host" in
libdl="-ldl"
libgc_threads=pthreads
with_sigaltstack=no
use_sigposix=yes
;;
*-*-*freebsd*)
platform_win32=no
@@ -129,11 +125,10 @@ case "$host" in
# but NOT library support)
#
with_tls=pthread
use_sigposix=yes
;;
*-*-*openbsd*)
platform_win32=no
CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE -DGC_FREEBSD_THREADS -DPLATFORM_BSD"
CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE -DGC_FREEBSD_THREADS"
libmono_cflags="-D_THREAD_SAFE"
LDFLAGS="$LDFLAGS -pthread"
libmono_ldflags="-pthread"
@@ -141,7 +136,6 @@ case "$host" in
AC_DEFINE(PTHREAD_POINTER_ID)
libdl=
libgc_threads=pthreads
use_sigposix=yes
;;
*-*-linux*)
platform_win32=no
@@ -151,10 +145,9 @@ case "$host" in
libdl="-ldl"
libgc_threads=pthreads
AOT_SUPPORTED="yes"
use_sigposix=yes
;;
*-*-hpux*)
platform_win32=no
platform_win32=no
CPPFLAGS="$CPPFLAGS -DGC_HPUX_THREADS -D_HPUX_SOURCE -D_XOPEN_SOURCE_EXTENDED -D_REENTRANT"
# +ESdbgasm only valid on bundled cc on RISC
# silently ignored for ia64
@@ -170,7 +163,6 @@ case "$host" in
libmono_ldflags="-lpthread"
libgc_threads=pthreads
need_link_unlink=yes
use_sigposix=yes
;;
*-*-solaris*)
platform_win32=no
@@ -181,10 +173,8 @@ case "$host" in
# This doesn't seem to work on solaris/x86, but the configure test runs
with_tls=pthread
has_dtrace=yes
use_sigposix=yes
;;
*-*-darwin*)
parallel_mark="Disabled_Currently_Hangs_On_MacOSX"
platform_win32=no
platform_darwin=yes
CPPFLAGS="$CPPFLAGS -no-cpp-precomp -D_THREAD_SAFE -DGC_MACOSX_THREADS -DPLATFORM_MACOSX -DUSE_MMAP -DUSE_MUNMAP"
@@ -217,8 +207,6 @@ fi
AM_CONDITIONAL(PLATFORM_WIN32, test x$platform_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)
AC_CHECK_TOOL(CC, gcc, gcc)
AC_PROG_CC
@@ -334,7 +322,7 @@ AC_CHECK_SIZEOF(void *, 4)
WARN=''
if test x"$GCC" = xyes; then
WARN='-Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wno-cast-qual -Wwrite-strings'
WARN='-Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wno-cast-qual -Wcast-align -Wwrite-strings'
# The runtime code does not respect ANSI C strict aliasing rules
CFLAGS="$CFLAGS -fno-strict-aliasing"
@@ -652,7 +640,7 @@ AC_TRY_COMPILE([], [
AC_MSG_RESULT(no)
])
AC_ARG_ENABLE(parallel-mark, [ --enable-parallel-mark Enables GC Parallel Marking], enable_parallel_mark=$enableval, enable_parallel_mark=$parallel_mark)
AC_ARG_ENABLE(parallel-mark, [ --enable-parallel-mark Enables GC Parallel Marking])
if test x$enable_parallel_mark = xyes; then
libgc_configure_args="$libgc_configure_args --enable-parallel-mark"
fi
@@ -2183,14 +2171,6 @@ AC_ARG_WITH(malloc_mempools,[ --with-malloc-mempools=yes,no Use malloc for each
fi
])
DISABLE_MCS_DOCS=no
AC_ARG_WITH(mcs_docs,[ --with-mcs-docs=yes,no If you want to build the documentation under mcs (defaults to YES)],[
if test x$with_mcs_docs != xyes; then
DISABLE_MCS_DOCS=yes
fi
])
AM_CONDITIONAL(HAVE_OPROFILE, test x$OPROFILE = xyes)
AC_SUBST(OPROFILE_CFLAGS)
AC_SUBST(OPROFILE_LIBS)
@@ -2388,6 +2368,7 @@ data/mono-nunit.pc
data/mono-options.pc
data/mono-lineeditor.pc
data/monodoc.pc
data/mono.web.pc
data/dotnet.pc
data/dotnet35.pc
data/wcf.pc
@@ -2482,10 +2463,6 @@ fi
fi
fi
fi
if test x$DISABLE_MCS_DOCS = xyes; then
echo "DISABLE_MCS_DOCS = yes" >> $srcdir/$mcsdir/build/config.make
fi
)
libgdiplus_msg=${libgdiplus_loc:-assumed to be installed}
@@ -2494,19 +2471,18 @@ echo "
mcs source: $mcs_topdir
olive source: $olive_topdir
GC: $gc
TLS: $with_tls
SIGALTSTACK: $with_sigaltstack
Engine: $jit_status
2.0 Beta: $PREVIEW
2.1 Alpha: $MOONLIGHT
JNI support: $jdk_headers_found
libgdiplus: $libgdiplus_msg
zlib: $zlib_msg
oprofile: $OPROFILE
BigArrays: $enable_big_arrays
DTrace: $enable_dtrace
Parallel Mark: $enable_parallel_mark
GC: $gc
TLS: $with_tls
SIGALTSTACK: $with_sigaltstack
Engine: $jit_status
2.0 Beta: $PREVIEW
2.1 Alpha: $MOONLIGHT
JNI support: $jdk_headers_found
libgdiplus: $libgdiplus_msg
zlib: $zlib_msg
oprofile: $OPROFILE
BigArrays: $enable_big_arrays
DTrace: $enable_dtrace
$disabled
"
+4 -4
View File
@@ -8,24 +8,24 @@ EXTRA_DIST = \
mono.pc.in mint.pc.in dotnet.pc.in dotnet35.pc.in wcf.pc.in monodoc.pc.in \
mono-nunit.pc.in mono-cairo.pc.in mono-options.pc.in cecil.pc.in smcs.pc.in \
mono-lineeditor.pc.in system.web.extensions_1.0.pc.in system.web.extensions.design_1.0.pc.in\
dtrace-prelink.sh
dtrace-prelink.sh mono.web.pc.in
pkgconfigdir = $(libdir)/pkgconfig
if JIT_SUPPORTED
if INTERP_SUPPORTED
pkgconfig_DATA= mono.pc mint.pc dotnet.pc dotnet35.pc wcf.pc mono-nunit.pc mono-cairo.pc mono-options.pc cecil.pc smcs.pc monodoc.pc mono-lineeditor.pc system.web.extensions_1.0.pc \
system.web.extensions.design_1.0.pc
system.web.extensions.design_1.0.pc mono.web.pc
else
pkgconfig_DATA= mono.pc dotnet.pc dotnet35.pc wcf.pc mono-nunit.pc mono-cairo.pc mono-options.pc cecil.pc smcs.pc monodoc.pc mono-lineeditor.pc system.web.extensions_1.0.pc \
system.web.extensions.design_1.0.pc
system.web.extensions.design_1.0.pc mono.web.pc
endif
else
pkgconfig_DATA= mint.pc mono-nunit.pc mono-cairo.pc mono-options.pc cecil.pc smcs.pc monodoc.pc mono-lineeditor.pc
endif
DISTCLEANFILES= mono.pc mint.pc dotnet.pc dotnet35.pc wcf.pc mono-nunit.pc mono-cairo.pc mono-options.pc cecil.pc smcs.pc monodoc.pc mono-lineeditor.pc system.web.extensions_1.0.pc \
system.web.extensions.design_1.0.pc
system.web.extensions.design_1.0.pc mono.web.pc
mono_DATA = config \
browscap.ini
-22
View File
@@ -1,22 +0,0 @@
2009-02-03 Zoltan Varga <[email protected]>
* mono-gdb.py: Remove the --64 argument to as, it is not needed.
* mono-gdb.py (stringify_class_name): Helper function to print base types
using their short name. Also add a prototype implementation of registering
the hooks from python code instead of needing the mono-gdbinit file.
* gdb-python.diff: Changes against the gdb archer branch at
http://sourceware.org/gdb/wiki/PythonGdb to fix some problems/add functionality.
2009-02-03 Geoff Norton <[email protected]>
* mono-gdbinit: Hook into backtrace as hook-stop seems to crash gdb
* mono-gdb.py: Find the gdbinit name from the executable name instead of
hardcoding mono
2009-01-29 Zoltan Varga <[email protected]>
* mono-gdb.py mono-gdbinit: Support files to help debugging mono/mono apps
using a python enabled gdb.
-163
View File
@@ -1,163 +0,0 @@
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 640998b..fb73e9d 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,10 @@
+2009-02-03 Zoltan Varga <[email protected]>
+
+ * cil-script.c python/python-cmd.c: Allow registration of pre/post hooks from
+ python.
+
+ * symfile.c (add_symbol_file_command): Comment out verbose messages.
+
2009-02-03 Thiago Jung Bauermann <[email protected]>
* gdb/c-lang.c (c_get_string): Remove superfluous parenthesis from
diff --git a/gdb/cli/cli-script.c b/gdb/cli/cli-script.c
index 835d29c..3941aa5 100644
--- a/gdb/cli/cli-script.c
+++ b/gdb/cli/cli-script.c
@@ -299,6 +299,13 @@ execute_user_command (struct cmd_list_element *c, char *args)
static int user_call_depth = 0;
extern int max_user_call_depth;
+ /* Might be a user defined command implemented in Python */
+ if (!c->user_commands && c->func)
+ {
+ (*c->func) (c, args, FALSE);
+ return;
+ }
+
old_chain = setup_user_args (args);
cmdlines = c->user_commands;
diff --git a/gdb/python/python-cmd.c b/gdb/python/python-cmd.c
index 61d5e5d..a3fbc08 100644
--- a/gdb/python/python-cmd.c
+++ b/gdb/python/python-cmd.c
@@ -339,7 +339,8 @@ gdbpy_parse_command_name (char *text, struct cmd_list_element ***base_list,
/* Object initializer; sets up gdb-side structures for command.
- Use: __init__(NAME, CMDCLASS, [COMPLETERCLASS, [PREFIX]]).
+ Use: __init__(NAME, CMDCLASS, [completerclass=COMPLETERCLASS, prefix=PREFIX,
+ pre_hook_of=PREHOOK_OF, post_hook_of=POSTHOOK_OF]).
NAME is the name of the command. It may consist of multiple words,
in which case the final word is the name of the new command, and
@@ -354,6 +355,11 @@ gdbpy_parse_command_name (char *text, struct cmd_list_element ***base_list,
If PREFIX is True, then this command is a prefix command.
+ PREHOOK_OF is the name of a gdb command this command becomes a
+ pre-execution hook of, same as if this command was defined using
+ "define hook-<cmdname>"
+ POSTHOOK_OF is the same for post-execution hooks.
+
The documentation for the command is taken from the doc string for
the python class.
@@ -362,15 +368,18 @@ static int
cmdpy_init (PyObject *self, PyObject *args, PyObject *kwds)
{
cmdpy_object *obj = (cmdpy_object *) self;
- char *name;
+ char *name, *pre_hook_of = NULL, *post_hook_of = NULL;
int cmdtype;
int completetype = -1;
char *docstring = NULL;
volatile struct gdb_exception except;
struct cmd_list_element **cmd_list;
+ struct cmd_list_element *pre_hookc = NULL, *post_hookc = NULL;
char *cmd_name, *pfx_name;
PyObject *is_prefix = NULL;
int cmp;
+ static char *kwlist[] = {"name", "cmdclass", "completerclass", "prefix",
+ "pre_hook_of", "post_hook_of", NULL};
if (obj->command)
{
@@ -381,8 +390,9 @@ cmdpy_init (PyObject *self, PyObject *args, PyObject *kwds)
return -1;
}
- if (! PyArg_ParseTuple (args, "si|iO", &name, &cmdtype,
- &completetype, &is_prefix))
+ if (! PyArg_ParseTupleAndKeywords (args, kwds, "si|iOss", kwlist, &name, &cmdtype,
+ &completetype, &is_prefix, &pre_hook_of,
+ &post_hook_of))
return -1;
if (cmdtype != no_class && cmdtype != class_run
@@ -402,6 +412,30 @@ cmdpy_init (PyObject *self, PyObject *args, PyObject *kwds)
return -1;
}
+ if (pre_hook_of)
+ {
+ char *text = pre_hook_of;
+
+ pre_hookc = lookup_cmd_1 (&text, cmdlist, NULL, 1);
+ if (! pre_hookc)
+ {
+ PyErr_Format (PyExc_RuntimeError, _("command name given by pre_hook argument not found"));
+ return -1;
+ }
+ }
+
+ if (post_hook_of)
+ {
+ char *text = post_hook_of;
+
+ post_hookc = lookup_cmd_1 (&text, cmdlist, NULL, 1);
+ if (! post_hookc)
+ {
+ PyErr_Format (PyExc_RuntimeError, _("command name given by post_hook argument not found"));
+ return -1;
+ }
+ }
+
cmd_name = gdbpy_parse_command_name (name, &cmd_list, &cmdlist);
if (! cmd_name)
return -1;
@@ -470,6 +504,18 @@ cmdpy_init (PyObject *self, PyObject *args, PyObject *kwds)
cmd->func = cmdpy_function;
cmd->destroyer = cmdpy_destroyer;
+ if (pre_hookc)
+ {
+ pre_hookc->hook_pre = cmd;
+ cmd->hookee_pre = pre_hookc;
+ }
+
+ if (post_hookc)
+ {
+ post_hookc->hook_post = cmd;
+ cmd->hookee_post = post_hookc;
+ }
+
obj->command = cmd;
set_cmd_context (cmd, self);
set_cmd_completer (cmd, ((completetype == -1) ? cmdpy_completer
diff --git a/gdb/symfile.c b/gdb/symfile.c
index 14cb7b8..6d0bb40 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -2196,7 +2196,7 @@ add_symbol_file_command (char *args, int from_tty)
statements because hex_string returns a local static
string. */
- printf_unfiltered (_("add symbol table from file \"%s\" at\n"), filename);
+ /* printf_unfiltered (_("add symbol table from file \"%s\" at\n"), filename); */
section_addrs = alloc_section_addr_info (section_index);
make_cleanup (xfree, section_addrs);
for (i = 0; i < section_index; i++)
@@ -2211,7 +2211,7 @@ add_symbol_file_command (char *args, int from_tty)
entered on the command line. */
section_addrs->other[sec_num].name = sec;
section_addrs->other[sec_num].addr = addr;
- printf_unfiltered ("\t%s_addr = %s\n", sec, paddress (addr));
+ /* printf_unfiltered ("\t%s_addr = %s\n", sec, paddress (addr)); */
sec_num++;
/* The object's sections are initialized when a
-181
View File
@@ -1,181 +0,0 @@
#
# Author: Zoltan Varga ([email protected])
# License: MIT/X11
#
#
# This is a mono support mode for a python-enabled gdb:
# http://sourceware.org/gdb/wiki/PythonGdb
# Usage:
# - copy/symlink this file, plus mono-gdbinit to the directory where the mono
# executable lives.
# - run mono under gdb, or attach to a mono process using gdb
# - Type 'xdb' in gdb to load/reload the debugging info emitted by the runtime.
# - The debug info is emitted to a file called xdb.s in the current working directory.
# When attaching to a mono process, make sure you are in the same directory.
#
import os
class StringPrinter:
"Print a C# string"
def __init__(self, val):
self.val = val
def to_string(self):
if int(self.val.cast (gdb.Type ("guint64"))) == 0:
return "null"
obj = self.val.cast (gdb.Type ("MonoString").pointer ()).dereference ()
len = obj ['length']
chars = obj ['chars']
i = 0
res = ['"']
while i < len:
c = chr ((chars.cast(gdb.Type ("gint64")) + (i * 2)).cast(gdb.Type ("gunichar2").pointer ()).dereference ())
res.append (c)
i = i + 1
res.append ('"')
return ''.join (res)
def stringify_class_name(ns, name):
if ns == "System":
if name == "Byte":
return "byte"
if name == "String":
return "string"
return "%s.%s" % (ns, name)
class ArrayPrinter:
"Print a C# array"
def __init__(self, val, class_ns, class_name):
self.val = val
self.class_ns = class_ns
self.class_name = class_name
def to_string(self):
obj = self.val.cast (gdb.Type ("MonoArray").pointer ()).dereference ()
length = obj ['max_length']
return "%s [%d]" % (stringify_class_name (self.class_ns, self.class_name [0:len(self.class_name) - 2]), int(length))
class ObjectPrinter:
"Print a C# object"
def __init__(self, val):
self.val = val
class _iterator:
def __init__(self,obj):
self.obj = obj
self.iter = self.obj.type ().fields ().__iter__ ()
pass
def __iter__(self):
return self
def next(self):
field = self.iter.next ()
return (field.name, self.obj [field.name])
def children(self):
# FIXME: It would be easier if gdb.Value would support iteration itself
# It would also be better if we could return None
if int(self.val.cast (gdb.Type ("guint64"))) == 0:
return {}.__iter__ ()
try:
obj = self.val.cast (gdb.Type ("MonoObject").pointer ()).dereference ()
class_ns = obj ['vtable'].dereference ()['klass'].dereference ()['name_space'].string ()
class_name = obj ['vtable'].dereference ()['klass'].dereference ()['name'].string ()
gdb_type = gdb.Type ("struct %s.%s" % (class_ns, class_name))
return self._iterator(obj.cast (gdb_type))
except:
return {}.__iter__ ()
def to_string(self):
if int(self.val.cast (gdb.Type ("guint64"))) == 0:
return "null"
try:
obj = self.val.cast (gdb.Type ("MonoObject").pointer ()).dereference ()
class_ns = obj ['vtable'].dereference ()['klass'].dereference ()['name_space'].string ()
class_name = obj ['vtable'].dereference ()['klass'].dereference ()['name'].string ()
if class_ns == "System" and class_name == "String":
return StringPrinter (self.val).to_string ()
if class_name [-2:len(class_name)] == "[]":
return ArrayPrinter (self.val,class_ns,class_name).to_string ()
if class_ns != "":
try:
gdb_type = gdb.Type ("struct %s.%s" % (class_ns, class_name))
except:
# Maybe there is no debug info for that type
return "%s.%s" % (class_ns, class_name)
#return obj.cast (gdb_type)
return "%s.%s" % (class_ns, class_name)
return class_name
except:
print sys.exc_info ()[0]
print sys.exc_info ()[1]
# FIXME: This can happen because we don't have liveness information
return self.val.cast (gdb.Type ("guint64"))
def register_csharp_printers(obj):
"Register C# pretty-printers with objfile Obj."
if obj == None:
obj = gdb
obj.pretty_printers['object'] = ObjectPrinter
obj.pretty_printers['string'] = StringPrinter
register_csharp_printers (gdb.current_objfile())
class MonoSupport(object):
def __init__(self):
self.s_size = 0
def run_hook(self):
if os.access ("xdb.s", os.F_OK):
os.remove ("xdb.s")
gdb.execute ("set environment MONO_XDEBUG 1")
def stop_hook(self):
# Called when the program is stopped
# Need to recompile+reload the xdb.s file if needed
# FIXME: Need to detect half-written files created when the child is
# interrupted while executing the xdb.s writing code
# FIXME: Handle appdomain unload
if os.access ("xdb.s", os.F_OK):
new_size = os.stat ("xdb.s").st_size
if new_size > self.s_size:
sofile = "xdb.so"
gdb.execute ("shell as -o xdb.o xdb.s && ld -shared -o %s xdb.o" % sofile)
# FIXME: This prints messages which couldn't be turned off
gdb.execute ("add-symbol-file %s 0" % sofile)
self.s_size = new_size
class RunHook (gdb.Command):
def __init__ (self):
super (RunHook, self).__init__ ("hook-run", gdb.COMMAND_NONE,
gdb.COMPLETE_COMMAND, pre_hook_of="run")
def invoke(self, arg, from_tty):
mono_support.run_hook ()
print "Mono support loaded."
mono_support = MonoSupport ()
# This depends on the changes in gdb-python.diff to work
#RunHook ()
# Register our hooks
# This currently cannot be done from python code
exec_file = gdb.current_objfile ().filename
# FIXME: Is there a way to detect symbolic links ?
if os.stat (exec_file).st_size != os.lstat (exec_file).st_size:
exec_file = os.readlink (exec_file)
exec_dir = os.path.dirname (exec_file)
gdb.execute ("source %s/%s-gdbinit" % (exec_dir, os.path.basename (exec_file)))
-20
View File
@@ -1,20 +0,0 @@
# Loaded by mono-gdb.py
# FIXME: According to gdb docs, this is called _before_ anything is printed
# Got broken by this patch:
# http://sourceware.org/ml/gdb-patches/2008-09/msg00193.html
# FIXME: This seems to cause crashes inside gdb
#define hook-stop
# python mono_support.stop_hook ()
#end
define hook-backtrace
python mono_support.stop_hook ()
end
define hook-run
python mono_support.run_hook ()
end
define xdb
python mono_support.stop_hook ()
end
+4
View File
@@ -0,0 +1,4 @@
Name: Mono.Web
Description: Mono ASP.NET extension classes
Version: 2.0.0.0
Libs: -r:@prefix@/lib/mono/gac/Mono.Web/2.0.0.0__0738eb9f132ed756/Mono.Web.dll
-4
View File
@@ -1,7 +1,3 @@
2009-01-23 Atsushi Enomoto <[email protected]>
* web.config : added .svc handler.
2009-01-07 Kornél Pál <[email protected]>
* DefaultWsdlHelpGenerator.aspx: Move <script> at the end of <head> that
+2 -3
View File
@@ -37,9 +37,8 @@
<add verb="*" path="*.vbproj" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<add verb="*" path="*.licx" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<add verb="*" path="*.dll" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<add verb="*" path="*.rem" type="System.Runtime.Remoting.Channels.Http.HttpRemotingHandlerFactory, System.Runtime.Remoting, Culture=neutral, PublicKeyToken=b77a5c561934e089" validate="false" />
<add verb="*" path="*.soap" type="System.Runtime.Remoting.Channels.Http.HttpRemotingHandlerFactory, System.Runtime.Remoting, Culture=neutral, PublicKeyToken=b77a5c561934e089" validate="false" />
<add verb="*" path="*.svc" type="System.ServiceModel.Channels.SvcHttpHandlerFactory, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<add verb="*" path="*.rem" type="System.Runtime.Remoting.Channels.Http.HttpRemotingHandlerFactory, System.Runtime.Remoting, Culture=neutral, PublicKeyToken=b77a5c561934e089" validate="false" />
<add verb="*" path="*.soap" type="System.Runtime.Remoting.Channels.Http.HttpRemotingHandlerFactory, System.Runtime.Remoting, Culture=neutral, PublicKeyToken=b77a5c561934e089" validate="false" />
<add verb="GET,HEAD" path="*" type="System.Web.StaticFileHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<add verb="*" path="*" type="System.Web.HttpMethodNotAllowedHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</httpHandlers>
-19
View File
@@ -1,22 +1,3 @@
2009-02-12 Zoltan Varga <[email protected]>
* Makefile.am (EXTRA_DIST): Remove removed files.
* README: Point to the documentation on the wiki.
* call-sites.txt: Remove this, its contents is in jit-trampolines.
* memory-management.txt thread-safety.txt aot-compiler.txt jit-regalloc
exception-handling.txt: Remove documents which are now on the wiki.
2009-02-11 Rodrigo Kumpera <[email protected]>
* thread-safety.txt: Improve the docs about image lock.
2009-02-11 Rodrigo Kumpera <[email protected]>
* thread-safety.txt: Document the new image lock.
2008-12-12 Mark Probst <[email protected]>
* mini-porting.txt: Added some details about function descriptors
+4
View File
@@ -14,6 +14,7 @@ ASSEMBLED_DOCS = \
EXTRA_DIST = \
abc-removal.txt \
AgilityPack.dll \
aot-compiler.txt \
api-style.css \
assembly-bundle \
check-exports \
@@ -24,6 +25,7 @@ EXTRA_DIST = \
docs.make \
documented \
embedded-api \
exception-handling.txt \
exceptions \
exdoc \
file-share-modes \
@@ -34,6 +36,7 @@ EXTRA_DIST = \
internal-calls \
ir-desc \
jit-imt \
jit-regalloc \
jit-thoughts \
jit-trampolines \
local-regalloc.txt \
@@ -60,6 +63,7 @@ EXTRA_DIST = \
ssapre.txt \
stack-alignment \
stack-overflow.txt \
thread-safety.txt \
threading \
toc.xml \
TODO \
-6
View File
@@ -1,9 +1,3 @@
Documentation is now maintained on the mono wiki:
http://www.mono-project.com/Mono:Runtime:Documentation
Older documents or documents which were not yet migrated to the wiki are kept here.
* Scripts to maintain the Mono VM internal API
Layout
+393
View File
@@ -0,0 +1,393 @@
Mono Ahead Of Time Compiler
===========================
The Ahead of Time compilation feature in Mono allows Mono to
precompile assemblies to minimize JIT time, reduce memory
usage at runtime and increase the code sharing across multiple
running Mono application.
To precompile an assembly use the following command:
mono --aot -O=all assembly.exe
The `--aot' flag instructs Mono to ahead-of-time compile your
assembly, while the -O=all flag instructs Mono to use all the
available optimizations.
* Caching metadata
------------------
Besides code, the AOT file also contains cached metadata information which allows
the runtime to avoid certain computations at runtime, like the computation of
generic vtables. This reduces both startup time, and memory usage. It is possible
to create an AOT image which contains only this cached information and no code by
using the 'metadata-only' option during compilation:
mono --aot=metadata-only assembly.exe
This works even on platforms where AOT is not normally supported.
* Position Independent Code
---------------------------
On x86 and x86-64 the code generated by Ahead-of-Time compiled
images is position-independent code. This allows the same
precompiled image to be reused across multiple applications
without having different copies: this is the same way in which
ELF shared libraries work: the code produced can be relocated
to any address.
The implementation of Position Independent Code had a
performance impact on Ahead-of-Time compiled images but
compiler bootstraps are still faster than JIT-compiled images,
specially with all the new optimizations provided by the Mono
engine.
* How to support Position Independent Code in new Mono Ports
------------------------------------------------------------
Generated native code needs to reference various runtime
structures/functions whose address is only known at run
time. JITted code can simple embed the address into the native
code, but AOT code needs to do an indirection. This
indirection is done through a table called the Global Offset
Table (GOT), which is similar to the GOT table in the Elf
spec. When the runtime saves the AOT image, it saves some
information for each method describing the GOT table entries
used by that method. When loading a method from an AOT image,
the runtime will fill out the GOT entries needed by the
method.
* Computing the address of the GOT
Methods which need to access the GOT first need to compute its
address. On the x86 it is done by code like this:
call <IP + 5>
pop ebx
add <OFFSET TO GOT>, ebx
<save got addr to a register>
The variable representing the got is stored in
cfg->got_var. It is allways allocated to a global register to
prevent some problems with branches + basic blocks.
* Referencing GOT entries
Any time the native code needs to access some other runtime
structure/function (i.e. any time the backend calls
mono_add_patch_info ()), the code pointed by the patch needs
to load the value from the got. For example, instead of:
call <ABSOLUTE ADDR>
it needs to do:
call *<OFFSET>(<GOT REG>)
Here, the <OFFSET> can be 0, it will be fixed up by the AOT compiler.
For more examples on the changes required, see
svn diff -r 37739:38213 mini-x86.c
* The Program Linkage Table
As in ELF, calls made from AOT code do not go through the GOT. Instead, a direct call is
made to an entry in the Program Linkage Table (PLT). This is based on the fact that on
most architectures, call instructions use a displacement instead of an absolute address, so
they are already position independent. An PLT entry is usually a jump instruction, which
initially points to some trampoline code which transfers control to the AOT loader, which
will compile the called method, and patch the PLT entry so that further calls are made
directly to the called method.
If the called method is in the same assembly, and does not need initialization (i.e. it
doesn't have GOT slots etc), then the call is made directly, bypassing the PLT.
* Implementation
----------------
** The Precompiled File Format
-----------------------------
We use the native object format of the platform. That way it
is possible to reuse existing tools like objdump and the
dynamic loader. All we need is a working assembler, i.e. we
write out a text file which is then passed to gas (the gnu
assembler) to generate the object file.
The precompiled image is stored in a file next to the original
assembly that is precompiled with the native extension for a shared
library (on Linux its ".so" to the generated file).
For example: basic.exe -> basic.exe.so; corlib.dll -> corlib.dll.so
To avoid symbol lookup overhead and to save space, some things like the
compiled code of the individual methods are not identified by specific symbols
like method_code_1234. Instead, they are stored in one big array and the
offsets inside this array are stored in another array, requiring just two
symbols. The offsets array is usually named 'FOO_offsets', where FOO is the
array the offsets refer to, like 'methods', and 'method_offsets'.
Generating code using an assembler and linker has some disadvantages:
- it requires GNU binutils or an equivalent package to be installed on the
machine running the aot compilation.
- it is slow.
There is some support in the aot compiler for directly emitting elf files, but
its not complete (yet).
The following things are saved in the object file and can be
looked up using the equivalent to dlsym:
mono_assembly_guid
A copy of the assembly GUID.
mono_aot_version
The format of the AOT file format.
mono_aot_opt_flags
The optimizations flags used to build this
precompiled image.
method_infos
Contains additional information needed by the runtime for using the
precompiled method, like the GOT entries it uses.
method_info_offsets
Maps method indexes to offsets in the method_infos array.
mono_icall_table
A table that lists all the internal calls
references by the precompiled image.
mono_image_table
A list of assemblies referenced by this AOT
module.
methods
The precompiled code itself.
method_offsets
Maps method indexes to offsets in the methods array.
ex_info
Contains information about methods which is rarely used during normal execution,
like exception and debug info.
ex_info_offsets
Maps method indexes to offsets in the ex_info array.
class_info
Contains precomputed metadata used to speed up various runtime functions.
class_info_offsets
Maps class indexes to offsets in the class_info array.
class_name_table
A hash table mapping class names to class indexes. Used to speed up
mono_class_from_name ().
plt
The Program Linkage Table
plt_info
Contains information needed to find the method belonging to a given PLT entry.
** Source file structure
-----------------------------
The AOT infrastructure is split into two files, aot-compiler.c and
aot-runtime.c. aot-compiler.c contains the AOT compiler which is invoked by
--aot, while aot-runtime.c contains the runtime support needed for loading
code and other things from the aot files.
** Compilation process
----------------------------
AOT compilation consists of the following stages:
- collecting the methods to be compiled.
- compiling them using the JIT.
- emitting the JITted code and other information into an assembly file (.s).
- assembling the file using the system assembler.
- linking the resulting object file into a shared library using the system
linker.
** Handling compiled code
----------------------------
Each method is identified by a method index. For normal methods, this is
equivalent to its index in the METHOD metadata table. For runtime generated
methods (wrappers), it is an arbitrary number.
Compiled code is created by invoking the JIT, requesting it to created AOT
code instead of normal code. This is done by the compile_method () function.
The output of the JIT is compiled code and a set of patches (relocations). Each
relocation specifies an offset inside the compiled code, and a runtime object
whose address is accessed at that offset.
Patches are described by a MonoJumpInfo structure. From the perspective
of the AOT compiler, there are two kinds of patches:
- calls, which require an entry in the PLT table.
- everything else, which require an entry in the GOT table.
How patches is handled is described in the next section.
After all the method are compiled, they are emitted into the output file into
a byte array called 'methods', The emission
is done by the emit_method_code () and emit_and_reloc_code () functions. Each
piece of compiled code is identified by the local symbol .Lm_<method index>.
While compiled code is emitted, all the locations which have an associated patch
are rewritten using a platform specific process so the final generated code will
refer to the plt and got entries belonging to the patches.
The compiled code array
can be accessed using the 'methods' global symbol.
** Handling patches
----------------------------
Before a piece of AOTed code can be used, the GOT entries used by it must be
filled out with the addresses of runtime objects. Those objects are identified
by MonoJumpInfo structures. These stuctures are saved in a serialized form in
the AOT file, so the AOT loader can deconstruct them. The serialization is done
by the encode_patch () function, while the deserialization is done by the
decode_patch_info () function.
Every method has an associated method info blob inside the 'method_info' byte
array in the AOT file. This contains all the information required to load the
method at runtime:
- the first got entry used by the method.
- the number of got entries used by the method.
- the serialized patch info for the got entries.
Some patches, like vtables, icalls are very common, so instead of emitting their
info every time they are used by a method, we emit the info only once into a
byte array named 'got_info', and only emit an index into this array for every
access.
** The Procedure Linkage Table (PLT)
------------------------------------
Our PLT is similar to the elf PLT, it is used to handle calls between methods.
If method A needs to call method B, then an entry is allocated in the PLT for
method B, and A calls that entry instead of B directly. This is useful because
in some cases the runtime needs to do some processing the first time B is
called.
There are two cases:
- if B is in another assembly, then it needs to be looked up, then JITted or the
corresponding AOT code needs to be found.
- if B is in the same assembly, but has got slots, then the got slots need to be
initialized.
If none of these cases is true, then the PLT is not used, and the call is made
directly to the native code of the target method.
A PLT entry is usually implemented by a jump though a jump table, where the
jump table entries are initially filled up with the address of a trampoline so
the runtime can get control, and after the native code of the called method is
created/found, the jump table entry is changed to point to the native code.
All PLT entries also embed a integer offset after the jump which indexes into
the 'plt_info' table, which stores the information required to find the called
method. The PLT is emitted by the emit_plt () function.
** Exception/Debug info
----------------------------
Each compiled method has some additional info generated by the JIT, usable
for debugging (IL offset-native offset maps) and exception handling
(saved registers, native offsets of try/catch clauses). Since this info is
rarely needed, it is saved into a separate byte array called 'ex_info'.
** Cached metadata
---------------------------
When the runtime loads a class, it needs to compute a variety of information
which is not readily available in the metadata, like the instance size,
vtable, whenever the class has a finalizer/type initializer etc. Computing this
information requires a lot of time, causes the loading of lots of metadata,
and it usually involves the creation of many runtime data structures
(MonoMethod/MonoMethodSignature etc), which are long living, and usually persist
for the lifetime of the app. To avoid this, we compute the required information
at aot compilation time, and save it into the aot image, into an array called
'class_info'. The runtime can query this information using the
mono_aot_get_cached_class_info () function, and if the information is available,
it can avoid computing it.
** Full AOT mode
-------------------------
Some platforms like the iphone prohibit JITted code, using technical and/or
legal means. This is a significant problem for the mono runtime, since it
generates a lot of code dynamically, using either the JIT or more low-level
code generation macros. To solve this, the AOT compiler is able to function in
full-aot or aot-only mode, where it generates and saves all the neccesary code
in the aot image, so at runtime, no code needs to be generated.
There are two kinds of code which needs to be considered:
- wrapper methods, that is methods whose IL is generated dynamically by the
runtime. They are handled by generating them in the add_wrappers () function,
then emitting them the same way as the 'normal' methods. The only problem is
that these methods do not have a methoddef token, so we need a separate table
in the aot image ('wrapper_info') to find their method index.
- trampolines and other small hand generated pieces of code. They are handled
in an ad-hoc way in the emit_trampolines () function.
* Performance considerations
----------------------------
Using AOT code is a trade-off which might lead to higher or
slower performance, depending on a lot of circumstances. Some
of these are:
- AOT code needs to be loaded from disk before being used, so
cold startup of an application using AOT code MIGHT be
slower than using JITed code. Warm startup (when the code is
already in the machines cache) should be faster. Also,
JITing code takes time, and the JIT compiler also need to
load additional metadata for the method from the disk, so
startup can be faster even in the cold startup case.
- AOT code is usually compiled with all optimizations turned
on, while JITted code is usually compiled with default
optimizations, so the generated code in the AOT case should
be faster.
- JITted code can directly access runtime data structures and
helper functions, while AOT code needs to go through an
indirection (the GOT) to access them, so it will be slower
and somewhat bigger as well.
- When JITting code, the JIT compiler needs to load a lot of
metadata about methods and types into memory.
- JITted code has better locality, meaning that if A method
calls B, then the native code for A and B is usually quite
close in memory, leading to better cache behaviour thus
improved performance. In contrast, the native code of
methods inside the AOT file is in a somewhat random order.
* Future Work
-------------
- Currently, when an AOT module is loaded, all of its
dependent assemblies are also loaded eagerly, and these
assemblies need to be exactly the same as the ones loaded
when the AOT module was created ('hard binding'). Non-hard
binding should be allowed.
- On x86, the generated code uses call 0, pop REG, add
GOTOFFSET, REG to materialize the GOT address. Newer
versions of gcc use a separate function to do this, maybe we
need to do the same.
- Currently, we get vtable addresses from the GOT. Another
solution would be to store the data from the vtables in the
.bss section, so accessing them would involve less
indirection.
+27
View File
@@ -0,0 +1,27 @@
Call Sites
Extracted from emails from Paolo Molaro
There are 3 basic different kinds of call sites:
1) normal calls:
call relative_displacement
2) virtual calls:
call *positive_offset(%register)
3) interface calls:
mov constant, %imt_register
call *negative_offset(%register)
The above is what happens on x86 and amd64, with different values of
%imt_register for each arch (this register is a constant, but it could
change with different mono builds, it should be likely one of
constants the runtime comunicates to the debugger). %register can
change depending on the callsite based on the register allocator
choices. Note that the constant for the interface calls won't
necessarily be a MonoMethod address: this could change in the future
to a simple number.
In all the 3 cases the JIT trampolines will need to inspect the call
site, but only in the first case the call site will be changed.
+330
View File
@@ -0,0 +1,330 @@
Exception Handling In the Mono Runtime
--------------------------------------
* Introduction
--------------
There are many types of exceptions which the runtime needs to
handle. These are:
- exceptions thrown from managed code using the 'throw' or 'rethrow' CIL
instructions.
- exceptions thrown by some IL instructions like InvalidCastException thrown
by the 'castclass' CIL instruction.
- exceptions thrown by runtime code
- synchronous signals received while in managed code
- synchronous signals received while in native code
- asynchronous signals
Since exception handling is very arch dependent, parts of the
exception handling code reside in the arch specific
exceptions-<ARCH>.c files. The architecture independent parts
are in mini-exceptions.c. The different exception types listed
above are generated in different parts of the runtime, but
ultimately, they all end up in the mono_handle_exception ()
function in mini-exceptions.c.
* Exceptions throw programmatically from managed code
-----------------------------------------------------
These exceptions are thrown from managed code using 'throw' or
'rethrow' CIL instructions. The JIT compiler will translate
them to a call to a helper function called
'mono_arch_throw/rethrow_exception'.
These helper functions do not exist at compile time, they are
created dynamically at run time by the code in the
exceptions-<ARCH>.c files.
They perform various stack manipulation magic, then call a
helper function usually named throw_exception (), which does
further processing in C code, then calls
mono_handle_exception() to do the rest.
* Exceptions thrown implicitly from managed code
------------------------------------------------
These exceptions are thrown by some IL instructions when
something goes wrong. When the JIT needs to throw such an
exception, it emits a forward conditional branch and remembers
its position, along with the exception which needs to be
emitted. This is usually done in macros named
EMIT_COND_SYSTEM_EXCEPTION in the mini-<ARCH>.c files.
After the machine code for the method is emitted, the JIT
calls the arch dependent mono_arch_emit_exceptions () function
which will add the exception throwing code to the end of the
method, and patches up the previous forward branches so they
will point to this code.
This has the advantage that the rarely-executed exception
throwing code is kept separate from the method body, leading
to better icache performance.
The exception throwing code braches to the dynamically
generated mono_arch_throw_corlib_exception helper function,
which will create the proper exception object, does some stack
manipulation, then calls throw_exception ().
* Exceptions thrown by runtime code
-----------------------------------
These exceptions are usually thrown by the implementations of
InternalCalls (icalls). First an appropriate exception object
is created with the help of various helper functions in
metadata/exception.c, which has a separate helper function for
allocating each kind of exception object used by the runtime
code. Then the mono_raise_exception () function is called to
actually throw the exception. That function never returns.
An example:
if (something_is_wrong)
mono_raise_exception (mono_get_exception_index_out_of_range ());
mono_raise_exception () simply passes the exception to the JIT
side through an API, where it will be received by helper
created by mono_arch_throw_exception (). From now on, it is
treated as an exception thrown from managed code.
* Synchronous signals
---------------------
For performance reasons, the runtime does not do same checks
required by the CLI spec. Instead, it relies on the CPU to do
them. The two main checks which are omitted are null-pointer
checks, and arithmetic checks. When a null pointer is
dereferenced by JITted code, the CPU will notify the kernel
through an interrupt, and the kernel will send a SIGSEGV
signal to the process. The runtime installs a signal handler
for SIGSEGV, which is sigsegv_signal_handler () in mini.c. The
signal handler creates the appropriate exception object and
calls mono_handle_exception () with it. Arithmetic exceptions
like division by zero are handled similarly.
* Synchronous signals in native code
------------------------------------
Receiving a signal such as SIGSEGV while in native code means
something very bad has happened. Because of this, the runtime
will abort after trying to print a managed plus a native stack
trace. The logic is in the mono_handle_native_sigsegv ()
function.
Note that there are two kinds of native code which can be the
source of the signal:
- code inside the runtime
- code inside a native library loaded by an application, ie. libgtk+
* Stack overflow checking
-------------------------
Stack overflow exceptions need special handling. When a thread
overflows its stack, the kernel sends it a normal SIGSEGV
signal, but the signal handler tries to execute on the same as
the thread leading to a further SIGSEGV which will terminate
the thread. A solution is to use an alternative signal stack
supported by UNIX operating systems through the sigaltstack
(2) system call. When a thread starts up, the runtime will
install an altstack using the mono_setup_altstack () function
in mini-exceptions.c. When a SIGSEGV is received, the signal
handler checks whenever the fault address is near the bottom
of the threads normal stack. If it is, a
StackOverflowException is created instead of a
NullPointerException. This exception is handled like any other
exception, with some minor differences.
There are two reasons why sigaltstack is disabled by default:
* The main problem with sigaltstack() is that the stack
employed by it is not visible to the GC and it is possible
that the GC will miss it.
* Working sigaltstack support is very much os/kernel/libc
dependent, so it is disabled by default.
* Asynchronous signals
----------------------
Async signals are used by the runtime to notify a thread that
it needs to change its state somehow. Currently, it is used
for implementing thread abort/suspend/resume.
Handling async signals correctly is a very hard problem,
since the receiving thread can be in basically any state upon
receipt of the signal. It can execute managed code, native
code, it can hold various managed/native locks, or it can be
in a process of acquiring them, it can be starting up,
shutting down etc. Most of the C APIs used by the runtime are
not asynch-signal safe, meaning it is not safe to call them
from an async signal handler. In particular, the pthread
locking functions are not async-safe, so if a signal handler
interrupted code which was in the process of acquiring a lock,
and the signal handler tries to acquire a lock, the thread
will deadlock. Unfortunately, the current signal handling
code does acquire locks, so sometimes it does deadlock.
When receiving an async signal, the signal handler first tries
to determine whenever the thread was executing managed code
when it was interrupted. If it did, then it is safe to
interrupt it, so a ThreadAbortException is constructed and
thrown. If the thread was executing native code, then it is
generally not safe to interrupt it. In this case, the runtime
sets a flag then returns from the signal handler. That flag is
checked every time the runtime returns from native code to
managed code, and the exception is thrown then. Also, a
platform specific mechanism is used to cause the thread to
interrupt any blocking operation it might be doing.
The async signal handler is in sigusr1_signal_handler () in
mini.c, while the logic which determines whenever an exception
is safe to be thrown is in mono_thread_request_interruption
().
* Stack unwinding during exception handling
-------------------------------------------
The execution state of a thread during exception handling is
stored in an arch-specific structure called MonoContext. This
structure contains the values of all the CPU registers
relevant during exception handling, which usually means:
- IP (instruction pointer)
- SP (stack pointer)
- FP (frame pointer)
- callee saved registers
Callee saved registers are the registers which are required by
any procedure to be saved/restored before/after using
them. They are usually defined by each platforms ABI
(Application Binary Interface). For example, on x86, they are
EBX, ESI and EDI.
The code which calls mono_handle_exception () is required to
construct the initial MonoContext. How this is done depends on
the caller. For exceptions thrown from managed code, the
mono_arch_throw_exception helper function saves the values of
the required registers and passes them to throw_exception (),
which will save them in the MonoContext structure. For
exceptions thrown from signal handlers, the MonoContext
stucture is initialized from the signal info received from the
kernel.
During exception handling, the runtime needs to 'unwind' the
stack, i.e. given the state of the thread at a stack frame,
construct the state at its callers. Since this is platform
specific, it is done by a platform specific function called
mono_arch_find_jit_info ().
Two kinds of stack frames need handling:
- Managed frames are easier. The JIT will store some
information about each managed method, like which
callee-saved registers it uses. Based on this information,
mono_arch_find_jit_info () can find the values of the
registers on the thread stack, and restore them.
- Native frames are problematic, since we have no information
about how to unwind through them. Some compilers generate
unwind information for code, some don't. Also, there is no
general purpose library to obtain and decode this unwind
information. So the runtime uses a different solution. When
managed code needs to call into native code, it does through
a managed->native wrapper function, which is generated by
the JIT. This function is responsible for saving the machine
state into a per-thread structure called MonoLMF (Last
Managed Frame). These LMF structures are stored on the
threads stack, and are linked together using one of their
fields. When the unwinder encounters a native frame, it
simply pops one entry of the LMF 'stack', and uses it to
restore the frame state to the moment before control passed
to native code. In effect, all successive native frames are
skipped together.
Problems/future work
--------------------
1. Async signal safety
----------------------
The current async signal handling code is not async safe, so
it can and does deadlock in practice. It needs to be rewritten
to avoid taking locks at least until it can determine that it
was interrupting managed code.
Another problem is the managed stack frame unwinding code. It
blindly assumes that if the IP points into a managed frame,
then all the callee saved registers + the stack pointer are
saved on the stack. This is not true if the thread was
interrupted while executing the method prolog/epilog.
2. Raising exceptions from native code
--------------------------------------
Currently, exceptions are raised by calling
mono_raise_exception () in the middle of runtime code. This
has two problems:
- No cleanup is done, ie. if the caller of the function which
throws an exception has taken locks, or allocated memory,
that is not cleaned up. For this reason, it is only safe to
call mono_raise_exception () 'very close' to managed code,
ie. in the icall functions themselves.
- To allow mono_raise_exception () to unwind through native
code, we need to save the LMF structures which can add a lot
of overhead even in the common case when no exception is
thrown. So this is not zero-cost exception handling.
An alternative might be to use a JNI style
set-pending-exception API. Runtime code could call
mono_set_pending_exception (), then return to its caller with
an error indication allowing the caller to clean up. When
execution returns to managed code, then managed->native
wrapper could check whenever there is a pending exception and
throw it if neccesary. Since we already check for pending
thread interruption, this would have no overhead, allowing us
to drop the LMF saving/restoring code, or significant parts of
it.
4. libunwind
------------
There is an OSS project called libunwind which is a standalone
stack unwinding library. It is currently in development, but
it is used by default by gcc on ia64 for its stack
unwinding. The mono runtime also uses it on ia64. It has
several advantages in relation to our current unwinding code:
- it has a platform independent API, i.e. the same unwinding
code can be used on multiple platforms.
- it can generate unwind tables which are correct at every
instruction, i.e. can be used for unwinding from async
signals.
- given sufficient unwind info generated by a C compiler, it
can unwind through C code.
- most of its API is async-safe
- it implements the gcc C++ exception handling API, so in
theory it can be used to implement mixed-language exception
handling (i.e. C++ exception caught in mono, mono exception
caught in C++).
- it is MIT licensed
The biggest problem with libuwind is its platform support. ia64 support is
complete/well tested, while support for other platforms is missing/incomplete.
http://www.hpl.hp.com/research/linux/libunwind/
+283
View File
@@ -0,0 +1,283 @@
Register Allocation
===================
The current JIT implementation uses a tree matcher to generate code. We use a
simple algorithm to allocate registers in trees, and limit the number of used
temporary register to 4 when evaluating trees. So we can use 2 registers for
global register allocation.
Register Allocation for Trees
=============================
We always evaluate trees from left to right. When there are no more registers
available we need to spill values to memory. Here is the simplified algorithm.
gboolean
tree_allocate_regs (tree, exclude_reg)
{
if (!tree_allocate_regs (tree->left, -1))
return FALSE;
if (!tree_allocate_regs (tree->right, -1)) {
tree->left->spilled == TRUE;
free_used_regs (tree->left);
if (!tree_allocate_regs (tree->right, tree->left->reg))
return FALSE;
}
free_used_regs (tree->left);
free_used_regs (tree->right);
/* try to allocate a register (reg != exclude_reg) */
if ((tree->reg = next_free_reg (exclude_reg)) != -1)
return TRUE;
return FALSE;
}
The emit routing actually spills the registers:
tree_emit (tree)
{
tree_emit (tree->left);
if (tree->left->spilled)
save_reg (tree->left->reg);
tree_emit (tree->right);
if (tree->left->spilled)
restore_reg (tree->left->reg);
emit_code (tree);
}
Global Register Allocation
==========================
TODO.
Local Register Allocation
=========================
This section describes the cross-platform local register allocator which is
in the file mini-codegen.c.
The input to the allocator is a basic block which contains linear IL, ie.
instructions of the form:
DEST <- SRC1 OP SRC2
where DEST, SRC1, and SRC2 are virtual registers (vregs). The job of the
allocator is to assign hard or physical registers (hregs) to each virtual
registers so the vreg references in the instructions can be replaced with their
assigned hreg, allowing machine code to be generated later.
The allocator needs information about the number and types of arguments of
instructions. It takes this information from the machine description files. It
also needs arch specific information, like the number and type of the hard
registers. It gets this information from arch-specific macros.
Currently, the vregs and hregs are partitioned into two classes: integer and
floating point.
The allocator consists of two phases: In the first phase, a forward pass is
made over the instructions, collecting liveness information for vregs. In the
second phase, a backward pass is made over the instructions, assigning
registers. This backward mode of operation makes understanding the allocator
somewhat difficult to understand, but leads to better code in most cases.
Allocator state
===============
The state of the allocator is stored in two arrays: iassign and isymbolic.
iassign maps vregs to hregs, while isymbolic is the opposite.
For a vreg, iassign [vreg] can contain the following values:
* -1 vreg has no assigned hreg
* hreg index (>= 0) vreg is assigned to the given hreg. This means
later instructions (which we have already
processed due to the backward direction) expect
the value of vreg to be found in hreg.
* spill slot index (< -1) vreg is spilled to the given spill slot. This
means later instructions expect the value of
vreg to be found on the stack in the given
spill slot.
Also, the allocator keeps track of which hregs are free and which are used.
This information is stored in a bitmask called ifree_mask.
There is a similar set of data structures for floating point registers.
Spilling
========
When an allocator needs a free hreg, but all of them are assigned, it needs to
free up one of them. It does this by spilling the contents of the vreg which
is currently assigned to the selected hreg. Since later instructions expect
the vreg to be found in the selected hreg, the allocator emits a spill-load
instruction to load the value from the spill slot into the hreg after the
currently processed instruction. When the vreg which is spilled is a
destination in an instruction, the allocator will emit a spill-store to store
the value into the spill slot.
Fixed registers
===============
Some architectures, notably x86/amd64 require that the arguments/results of
some instructions be assigned to specific hregs. An example is the shift
opcodes on x86, where the second argument must be in ECX. The allocator
has support for this. It tries to allocate the vreg to the required hreg. If
thats not possible, then it will emit compensation code which moves values to
the correct registers before/after the instruction.
Fixed registers are mainly used on x86, but they are useful on more regular
architectures on well, for example to model that after a call instruction, the
return of the call is in a specific register.
A special case of fixed registers is two address architectures, like the x86,
where the instructions place their results into their first argument. This is
modelled in the allocator by allocating SRC1 and DEST to the same hreg.
Global registers
================
Some variables might already be allocated to hardware registers during the
global allocation phase. In this case, SRC1, SRC2 and DEST might already be
a hardware register. The allocator needs to do nothing in this case, except
when the architecture uses fixed registers, in which case it needs to emit
compensation code.
Register pairs
==============
64 bit arithmetic on 32 bit machines requires instructions whose arguments are
not registers, but register pairs. The allocator has support for this, both
for freely allocatable register pairs, and for register pairs which are
constrained to specific hregs (EDX:EAX on x86).
Floating point stack
====================
The x86 architecture uses a floating point register stack instead of a set of
fp registers. The allocator supports this by keeping track of the height of the
fp stack, and spilling/loading values from the stack as neccesary.
Calls
=====
Calls need special handling for two reasons: first, they will clobber all
caller-save registers, meaning their contents will need to be spilled. Also,
some architectures pass arguments in registers. The registers used for
passing arguments are usually the same as the ones used for local allocation,
so the allocator needs to handle them specially. This is done as follows:
the MonoInst for the call instruction contains a map mapping vregs which
contain the argument values to hregs where the argument needs to be placed,
like this (on amd64):
R33 -> RDI
R34 -> RSI
...
When the allocator processes the call instruction, it allocates the vregs
in the map to their associated hregs. So the call instruction is processed as
if having a variable number of arguments which fixed register assignments.
An example:
R33 <- 1
R34 <- 2
call
When the call instruction is processed, R33 is assigned to RDI, and R34 is
assigned to RSI. Later, when the two assignment instructions are processed,
R33 and R34 are already assigned to a hreg, so they are replaced with the
associated hreg leading to the following final code:
RDI <- 1
RSI <- 1
call
Machine description files
=========================
A typical entry in the machine description files looks like this:
shl: dest:i src1:i src2:s clob:1 len:2
The allocator is only interested in the dest,src1,src2 and clob fields.
It understands the following values for the dest, src1, src2 fields:
i - integer register
f - fp register
b - base register (same as i, but the instruction does not modify the reg)
m - fp register, even if an fp stack is used (no fp stack tracking)
It understands the following values for the clob field:
1 - sreg1 needs to be the same as dreg
c - instruction clobbers the caller-save registers
Beside these values, an architecture can define additional values (like the 's'
in the example). The allocator depends on a set of arch-specific macros to
convert these values to information it needs during allocation.
Arch specific macros
====================
These macros usually receive a value from the machine description file (like
the 's' in the example). The examples below are for x86.
/*
* A bitmask selecting the caller-save registers (these are used for local
* allocation).
*/
#define MONO_ARCH_CALLEE_REGS X86_CALLEE_REGS
/*
* A bitmask selecting the callee-saved registers (these are usually used for
* global allocation).
*/
#define MONO_ARCH_CALLEE_SAVED_REGS X86_CALLER_REGS
/* Same for the floating point registers */
#define MONO_ARCH_CALLEE_FREGS 0
#define MONO_ARCH_CALLEE_SAVED_FREGS 0
/* Whenever the target uses a floating point stack */
#define MONO_ARCH_USE_FPSTACK TRUE
/* The size of the floating point stack */
#define MONO_ARCH_FPSTACK_SIZE 6
/*
* Given a descriptor value from the machine description file, return the fixed
* hard reg corresponding to that value.
*/
#define MONO_ARCH_INST_FIXED_REG(desc) ((desc == 's') ? X86_ECX : ((desc == 'a') ? X86_EAX : ((desc == 'd') ? X86_EDX : ((desc == 'y') ? X86_EAX : ((desc == 'l') ? X86_EAX : -1)))))
/*
* A bitmask selecting the hregs which can be used for allocating sreg2 for
* a given instruction.
*/
#define MONO_ARCH_INST_SREG2_MASK(ins) (((ins [MONO_INST_CLOB] == 'a') || (ins [MONO_INST_CLOB] == 'd')) ? (1 << X86_EDX) : 0)
/*
* Given a descriptor value, return whenever it denotes a register pair.
*/
#define MONO_ARCH_INST_IS_REGPAIR(desc) (desc == 'l' || desc == 'L')
/*
* Given a descriptor value, and the first register of a regpair, return a
* bitmask selecting the hregs which can be used for allocating the second
* register of the regpair.
*/
#define MONO_ARCH_INST_REGPAIR_REG2(desc,hreg1) (desc == 'l' ? X86_EDX : -1)
+32
View File
@@ -0,0 +1,32 @@
Metadata memory management
--------------------------
Most metadata structures have a lifetime which is equal to the MonoImage where they are
loaded from. These structures should be allocated from the memory pool of the
corresponding MonoImage. The memory pool is protected by the loader lock.
Examples of metadata structures in this category:
- MonoClass
- MonoMethod
- MonoType
Memory owned by these structures should be allocated from the image mempool as well.
Examples include: klass->methods, klass->fields, method->signature etc.
Generics complicates things. A generic class could have many instantinations where the
generic arguments are from different assemblies. Where should we allocate memory for
instantinations ? We can allocate from the mempool of the image which contains the
generic type definition, but that would mean that the instantinations would remain in
memory even after the assemblies containing their type arguments are unloaded, leading
to a memory leak. Therefore, we do the following:
- data structures representing the generic definitions are allocated from the image
mempool as usual. These include:
- generic class definition (MonoGenericClass->container_class)
- generic method definitions
- type parameters (MonoGenericParam)
- data structures representing inflated classes/images are allocated from the heap. These
structures are kept in a cache, indexed by type arguments of the instantinations. When
an assembly is unloaded, this cache is searched and all instantinations referencing
types from the assembly are freed. This is done by mono_metadata_clean_for_image ()
in metadata.c. The structures handled this way include:
- MonoGenericClass
- MonoGenericInst
- inflated MonoMethods
+113
View File
@@ -0,0 +1,113 @@
1. Thread safety of metadata structures
----------------------------------------
1.1 Synchronization of read-only data
-------------------------------------
Read-only data is data which is not modified after creation, like the
actual binary metadata in the metadata tables.
There are three kinds of threads with regards to read-only data:
- readers
- the creator of the data
- the destroyer of the data
Most threads are readers.
- synchronization between readers is not neccesary
- synchronization between the writers is done using locks.
- synchronization between the readers and the creator is done by not exposing
the data to readers before it is fully constructed.
- synchronization between the readers and the destroyer: TBD.
1.2 Deadlock prevention plan
----------------------------
Hold locks for the shortest time possible. Avoid calling functions inside
locks which might obtain global locks (i.e. locks known outside this module).
1.3 Locks
----------
1.3.1 Simple locks
------------------
There are a lot of global data structures which can be protected by a 'simple' lock. Simple means:
- the lock protects only this data structure or it only protects the data structures in a given C module.
An example would be the appdomains list in domain.c
- the lock is only held for a short amount of time, and no other lock is acquired inside this simple lock. Thus there is
no possibility of deadlock.
1.3.2 The class loader lock
---------------------------
This locks is held by the class loading routines in class.c and loader.c. It
protects the various caches inside MonoImage which are used by these modules.
1.3.3 The domain lock
---------------------
Each appdomain has a lock which protects the per-domain data structures.
1.3.4 The locking hierarchy
---------------------------
It is useful to model locks by a locking hierarchy, which is a relation between locks, which is reflexive, transitive,
and antisymmetric, in other words, a lattice. If a thread wants to acquire a lock B, while already holding A, it can only
do it if A < B. If all threads work this way, then no deadlocks can occur.
Our locking hierarchy so far looks like this:
<DOMAIN LOCK>
\
<CLASS LOADER LOCK>
\ \
<SIMPLE LOCK 1> <SIMPLE LOCK 2>
1.4 Notes
----------
Some common scenarios:
- if a function needs to access a data structure, then it should lock it itself, and do not count on its caller locking it.
So for example, the image->class_cache hash table would be locked by mono_class_get().
- there are lots of places where a runtime data structure is created and stored in a cache. In these places, care must be
taken to avoid multiple threads creating the same runtime structure, for example, two threads might call mono_class_get ()
with the same class name. There are two choices here:
<enter mutex>
<check that item is created>
if (created) {
<leave mutex>
return item
}
<create item>
<store it in cache>
<leave mutex>
This is the easiest solution, but it requires holding the lock for the whole time which might create a scalability problem, and could also lead to deadlock.
<enter mutex>
<check that item is created>
<leave mutex>
if (created) {
return item
}
<create item>
<enter mutex>
<check that item is created>
if (created) {
/* Another thread already created and stored the same item */
<free our item>
<leave mutex>
return orig item
}
else {
<store item in cache>
<leave mutex>
return item
}
This solution does not present scalability problems, but the created item might be hard to destroy (like a MonoClass).
- lazy initialization of hashtables etc. is not thread safe
-6
View File
@@ -1,9 +1,3 @@
2009-02-05 Miguel de Icaza <[email protected]>
* src/gstr.c: Add g_strnfill
* src/glib.h: Add g_list_previous
2009-01-19 Bill Holmes <[email protected]>
* gmisc-win32.c (g_path_is_absolute): Adding support for UNC
+1 -1
View File
@@ -2,7 +2,7 @@ AC_INIT(README)
AC_CANONICAL_SYSTEM
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE(eglib,0.3)
AM_INIT_AUTOMAKE(eglib,0.2)
AM_MAINTAINER_MODE
AC_PROG_CC
-1
View File
@@ -39,7 +39,6 @@ libeglib_la_SOURCES = \
gmarkup.c \
gutf8.c \
gunicode.c \
unicode-data.h \
$(os_files)
libeglib_la_CFLAGS = -Wall -D_FORTIFY_SOURCE=2
-4
View File
@@ -234,7 +234,6 @@ gchar *g_strjoinv (const gchar *separator, gchar **str_array);
gchar *g_strchug (gchar *str);
gchar *g_strchomp (gchar *str);
void g_strdown (gchar *string);
gchar *g_strnfill (gsize length, gchar fill_char);
gchar *g_strdelimit (gchar *string, const gchar *delimiters, gchar new_delimiter);
gchar *g_strescape (const gchar *source, const gchar *exceptions);
@@ -367,7 +366,6 @@ struct _GList {
};
#define g_list_next(list) ((list) ? (((GList *) (list))->next) : NULL)
#define g_list_previous(list) ((list) ? (((GList *) (list))->prev) : NULL)
GList *g_list_alloc (void);
GList *g_list_append (GList *list,
@@ -841,8 +839,6 @@ glong g_utf8_strlen (const gchar *str, gssize max);
#define G_TRYLOCK(name)
#define G_UNLOCK(name)
#define GUINT16_SWAP_LE_BE_CONSTANT(x) ((((guint16) x) >> 8) | ((((guint16) x) << 8)))
#define GUINT16_SWAP_LE_BE(x) ((guint16) (((guint16) x) >> 8) | ((((guint16)(x)) & 0xff) << 8))
#define GUINT32_SWAP_LE_BE(x) ((guint32) \
( (((guint32) (x)) << 24)| \
+2 -5
View File
@@ -47,9 +47,7 @@ g_build_path (const gchar *separator, const gchar *first_element, ...)
va_list args;
g_return_val_if_fail (separator != NULL, NULL);
if (first_element == NULL)
return g_strdup ("");
g_return_val_if_fail (first_element != NULL, NULL);
result = g_string_sized_new (48);
@@ -68,8 +66,7 @@ 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))
g_string_append (result, separator);
g_string_append (result, separator);
for (; strncmp (next, separator, slen) == 0; )
next += slen;
+2 -11
View File
@@ -826,15 +826,6 @@ g_ascii_xdigit_value (gchar c)
(c - 'A' + 10))));
}
gchar *
g_strnfill (gsize length, gchar fill_char)
{
gchar *ret = g_new (gchar, length + 1);
int i;
for (i = 0; i < length; i++)
ret [i] = fill_char;
ret [length] = 0;
return ret;
}
+2 -23
View File
@@ -92,14 +92,7 @@ test_buildpath ()
if (strcmp (s, "/a/c/") != 0)
return FAILED ("14 Got wrong result, got: %s", s);
g_free (s);
/* Null */
s = g_build_path ("/", NULL);
if (s == NULL)
return FAILED ("must get a non-NULL return");
if (s [0] != 0)
return FAILED ("must get an empty string");
g_free (s);
return OK;
}
@@ -116,20 +109,6 @@ test_buildfname ()
#endif
return FAILED ("1 Got wrong result, got: %s", s);
g_free (s);
s = g_build_filename ("/", "a", NULL);
#ifdef G_OS_WIN32
if (strcmp (s, "\\a") != 0)
#else
if (strcmp (s, "/a") != 0)
#endif
return FAILED ("1 Got wrong result, got: %s", s);
#ifndef OS_WIN32
s = g_build_filename ("/", "foo", "/bar", "tolo/", "/meo/", NULL);
if (strcmp (s, "/foo/bar/tolo/meo/") != 0)
return FAILED ("1 Got wrong result, got: %s", s);
#endif
return OK;
}
@@ -305,8 +284,8 @@ test_misc ()
}
static Test path_tests [] = {
{"g_build_filename", test_buildfname},
{"g_buildpath", test_buildpath},
{"g_build_filename", test_buildfname},
{"g_path_get_dirname", test_dirname},
{"g_path_get_basename", test_basename},
{"g_find_program_in_path", test_ppath},
+1 -1
View File
@@ -28,7 +28,7 @@
#include <malloc.h>
#define ALLOCA _alloca
#else
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
#if defined(__FreeBSD__) || defined(__NetBSD__)
#include <stdlib.h>
#else
#include <alloca.h>
+6 -13
View File
@@ -1,17 +1,10 @@
2009-02-03 Rodrigo Kumpera <rkumpera@novell.com>
2009-02-24 Jonathan Pryor <jpryor@novell.com>
* docs/Makefile: Fix install-local and uninstall-local if
DISABLE_MCS_DOCS is defined.
2009-02-02 Rodrigo Kumpera <[email protected]>
* docs/Makefile: Don't build build-documentation if DISABLE_MCS_DOCS
is defined.
2009-01-31 Rodrigo Kumpera <[email protected]>
* docs/Makefile: use -f with rm on the clean target so
rm doesn't complain about missing files.
* docs/Makefile: Remove and don't install nunit-docs.source. As
Atsushi Enomoto said on 2008-11-26, Mono's NUnit is for internal use
only, and installing nunit-docs.source causes an warning message
during monodoc startup.
* docs/nunit-docs.source: Remove.
2008-12-10 Atsushi Enomoto <[email protected]>
-6
View File
@@ -1,9 +1,3 @@
2009-01-22 Marek Habersack <[email protected]>
* Makefile (net_2_0_dirs): added System.Web - it now depends on
System.Core, so it needs to be recompiled one more time after
System.Core is done.
2008-12-08 Atsushi Enomoto <[email protected]>
* Makefile : revert previous one and retry before I revert everything.
@@ -1,8 +1,3 @@
2009-02-17 Atsushi Enomoto <[email protected]>
* XsdDatatypeProvider.cs : workaround .NET/Mono Regex bug that
does not handle \p{Latin-1Supplement} to work with OOXML grammar.
2009-01-20 Atsushi Enomoto <[email protected]>
* RelaxngReader.cs : fixed wrong text skip and ns/datatypeLibrary
@@ -138,7 +138,6 @@ namespace Commons.Xml.Relaxng.XmlSchema
r.BaseTypeName = new XmlQualifiedName (primitive.Name, ns);
foreach (RelaxngParam p in parameters) {
XmlSchemaFacet f = null;
string value = p.Value;
switch (p.Name) {
case "maxExclusive":
f = new XmlSchemaMaxExclusiveFacet ();
@@ -154,9 +153,6 @@ namespace Commons.Xml.Relaxng.XmlSchema
break;
case "pattern":
f = new XmlSchemaPatternFacet ();
// .NET/Mono Regex has a bug that it does not support "IsLatin-1Supplement"
// (it somehow breaks at '-').
value = value.Replace ("\\p{IsLatin-1Supplement}", "[\\x80-\\xFF]");
break;
case "whiteSpace":
f = new XmlSchemaWhiteSpaceFacet ();
@@ -179,7 +175,7 @@ namespace Commons.Xml.Relaxng.XmlSchema
default:
throw new RelaxngException (String.Format ("XML Schema facet {0} is not recognized or not supported.", p.Name));
}
f.Value = value;
f.Value = p.Value;
r.Facets.Add (f);
}
-1
View File
@@ -106,7 +106,6 @@ net_2_0_dirs := \
System.Xml.Linq \
System.Data.DataSetExtensions \
System.Data.Linq \
System.Web \
System.Web.Abstractions \
System.Web.Routing \
System.Web.Extensions_1.0 \
+1 -1
View File
@@ -6,7 +6,7 @@
* Makefile: here is another nunit24 option breakage.
2008-11-11 Andrés G. Aragoneses <[email protected]>
2008-11-11 Andres G. Aragoneses <[email protected]>
* Application.cs: After UIA assembly is successfully loaded,
dump any exception that happens on initialization to stderr.
@@ -1,9 +1,3 @@
2009-02-04 Jonathan Pobst <[email protected]>
* FlowLayout.cs: When laying out ToolStripItems, they should be
the height of the ToolStrip, not their preferred height.
[Fixes bug #469196]
2008-11-07 Jonathan Pobst <[email protected]>
* DefaultLayout.cs: Apply patch from Jonathan Anderson that keeps
@@ -358,13 +358,9 @@ namespace System.Windows.Forms.Layout
// Only apply layout to visible controls.
if (!c.Available) { continue; }
// Resize any AutoSize controls to their preferred width
// (the height should fill the ToolStrip)
if (c.AutoSize == true) {
Size preferred_size = c.GetPreferredSize (c.Size);
preferred_size.Height = parentDisplayRectangle.Height;
c.SetBounds (new Rectangle (c.Location, preferred_size));
}
// Resize any AutoSize controls to their preferred size
if (c.AutoSize == true)
c.SetBounds (new Rectangle (c.Location, c.GetPreferredSize (c.Size)));
switch (settings.FlowDirection) {
case FlowDirection.BottomUp:
@@ -1,36 +1,27 @@
2009-02-17 Andrés G. Aragoneses <[email protected]>
2009-02-24 Ivan N. Zlatev <[email protected]>
* ToolBarButton.cs: Event for Enabled property (needed to fix
UIA #474197).
* DataGridViewCell.cs: Invalidate the datagrid when the cell is selected
or deselected.
[Fixes bug #479124]
2009-02-16 Carlos Alberto Cortez <[email protected]>
2009-02-23 Ivan N. Zlatev <[email protected]>
* TextBox.cs: When handling WndProc with autocomplete activated,
event if the new text is not causing any change in the look up
algorithm, save it as we normally do when numbers and letters.
Fixes #469967.
* DataGridView.cs: Make the ScrollBars property work properly.
2009-02-16 Carlos Alberto Cortez <[email protected]>
2009-02-22 Ivan N. Zlatev <[email protected]>
* TreeNode.cs: When Text/StateImageIndex/StateImageKey/NodeFont change
Invalidate the proper bounds in the TreeView, not only resetting the
width.
Fixes #475542.
* DataGridView.cs: Fix row removal in the data-bound scenario.
2009-02-09 Carlos Alberto Cortez <[email protected]>
2009-02-19 Ivan N. Zlatev <[email protected]>
* TreeNode.cs: Don't return TreeView.BackColor when retrieving our own
BackColor property. This is what .net does in both 1.1 and 2.0.
* TreeView.cs: When selected_node is not the same as highlighted_node,
we need to handle the back color in a different way, trying to use the
node's BackColor if it's not Color.Empty.
Fixes #464200.
* DataGridViewCell.cs: Use strict equality comparison in order to
prevent superfluous CellValueChanged events.
2009-02-09 Carlos Alberto Cortez <[email protected]>
2009-02-19 Ivan N. Zlatev <[email protected]>
* TreeView.cs: When canceling selection in our MouseUp handler,
invalidate also the previous selected node bounds.
Fixes #464191.
* DataGridView.cs: Do not reset the columns when the data list changes,
but only the rows. Fixes multiple bugs related to sorting, custom
column styles being reset and more.
2009-02-07 Ivan N. Zlatev <[email protected]>
@@ -42,19 +33,6 @@
* DataGridView.cs: Data-bind only after the handle is created.
[Fixes bug #473680]
2009-02-06 Carlos Alberto Cortez <[email protected]>
* TreeView.cs: When handling the MouseMove event, check if
focused_node and selected_node fields are null - usually they are non
null, since we have always a selected node, but canceling selection by
handling BeforeSelect event leaves the two of them as null.
Fixes #470451.
2009-02-06 Neville Gao <[email protected]>
* TabControl.cs: Control enabled to support accessibility.
[Fixes Bug #472428]
2009-02-05 Ivan N. Zlatev <[email protected]>
* DataGridViewRowCollection.cs, DataGridView.cs: Fix row insertation:
@@ -67,30 +45,8 @@
2009-02-05 Andrés G. Aragoneses <[email protected]>
* ToolBarButton.cs: Doh, fire OnUIATextChanged *after* setting
the value.
2009-02-04 Andrés G. Aragoneses <[email protected]>
* ToolBarButton.cs: Add another event (OnUIATextChanged).
2009-02-04 Andrés G. Aragoneses <[email protected]>
* ToolBarButton: Fix typo in previous commit (r125704).
2009-02-04 Andrés G. Aragoneses <[email protected]>
* ToolBar.cs, ToolBarButton.cs: Add new UIA events to know
when a button gets focus, firing the events from the ToolBar.
r: jpobst
2009-02-04 Mario Carrion <[email protected]>
* ColumnHeader.cs: Raising ListView.ColumnWidthChanged when setting
Width.
* ListView.cs: Internal method added: RaiseColumnWidthChanged, used by
ColumnHeader to raise ColumnWidthChanged.
[Fixes Bug #467086]
* ToolBarButton.cs: OnTextChanged added.
(Backport of r125802.) r: jpobst
2009-02-03 Ivan N. Zlatev <[email protected]>
@@ -105,26 +61,11 @@
row, because it has already become a real one. Instead add a new one.
[Fixes bug #471754]
2009-02-02 Carlos Alberto Cortez <[email protected]>
* TreeView.cs: When drawing the node's image, check that the index
specified by the node is valid for the ImageList.
Fixes #471094.
2009-02-02 Andrés G. Aragoneses <[email protected]>
* ToolBar.cs: Add new UIAPerformClick method to be called by
UIAutomationWinforms when someone calls Invoke() on the
ToolBarButtonProvider. r: jpobst
2009-02-02 Carlos Alberto Cortez <[email protected]>
* XplatUIX11.cs: Don't send a WM_SHOWWINDOW message when receiving
MapNotify/UnmapNotify events - we are already firing those events in
the proper places, so we avoid this way to send the same message two
times. I'm leaving the handling code in case we could break something
in the future, as this change seems dangerous (but needed).
Fixes #467546.
* ToolBar.cs: Add new UIAPerformClick method to be called by
UIAutomationWinforms when someone calls Invoke() on the
ToolBarButtonProvider. (Backport of r125354.) r: jpobst
2009-02-01 Ivan N. Zlatev <[email protected]>
@@ -147,16 +88,12 @@
- Default to MiddleCenter alignment for image cells.
[Fixes bug #471101]
2009-01-30 Ivan N. Zlatev <[email protected]>
* UpDownBase.cs: Force Height to PreferredHeight.
2009-01-29 Carlos Alberto Cortez <[email protected]>
* XplatUIX11.cs: We should use utf8 handling clipboard transference
with other x11 applications, and use utf16 when handling clipboard
data in the class library. Update the related points as well.
Fixes #468683.
* XplatUIX11.cs: We should use utf8 handling clipboard transference
with other x11 applications, and use utf16 when handling clipboard
data in the class library. Update the related points as well.
Fixes #468683.
2009-01-28 Ivan N. Zlatev <[email protected]>
@@ -169,6 +106,39 @@
* DataGridView.cs: Reset the hover cell if it gets moved due to row(s)
addition or removal. Fixes multiple crashes in OnMouseMove.
2009-01-28 Carlos Alberto Cortez <[email protected]>
* TreeNode.cs: NextVisibleNode and PrevVisibleNode properties don't
take into account the fact that OpenTreeNodeEnumerator needs to call
MoveNext/MovePrevious to actually put the passed node as the one
retrieved in Current. This way this property should work as really
expected in .net.
Fixes part of #467225.
2009-01-28 Carlos Alberto Cortez <[email protected]>
* TreeView.cs: When calculating the scrollbars, don't use
TreeNode.Bounds, since it still can have the values of the previous
-and now invalid- layout -which depends on TreeView.skipped_nodes, and
could not have been updated as well-, and use the actual number of
visible number of nodes to compute the height needed to contain all
the nodes. Also reset the value of vbar to 0 when disabled - this way
we make sure that, when re-enabled, it will update the visible area of
the treeview, even if the previous value before disabling it is the
same as now. Finally don't do anything for the vbar.ValueChanged
handler - for the case wheer we manually set the value but don't the
vbar is disabled already.
Fixes part of #467225.
2009-01-28 Carlos Alberto Cortez <[email protected]>
* TreeView.cs: In CollapseAll, set vbar to the maximum value, instead
of trying to set as top node the highest parent of the previous
top node. Moving to the bottom of the TreeView after a call
to CollapseAll is exactly what .net does. This should avoid some
nasty issue when CollapseAll is called and we don't need the
vertical scroll bar.
2009-01-27 Ivan N. Zlatev <[email protected]>
* DataGridView.cs: Fix a NRE when setting the CurrentCell to null.
@@ -195,35 +165,6 @@
when the first row is added as this is not what MS does. Fixes the
failing unit tests.
2009-01-26 Carlos Alberto Cortez <[email protected]>
* TreeNode.cs: NextVisibleNode and PrevVisibleNode properties don't
take into account the fact that OpenTreeNodeEnumerator needs to call
MoveNext/MovePrevious to actually put the passed node as the one
retrieved in Current. This way this property should work as really
expected in .net.
Fixes part of #467225.
2000-01-26 Carlos Alberto Cortez <[email protected]>
* TreeView.cs: When calculating the scrollbars, don't use
TreeNode.Bounds, since it still can have the values of the previous
-and now invalid- layout -which depends on TreeView.skipped_nodes, and
could not have been updated as well-, and use the actual number of
visible number of nodes to compute the height needed to contain all
the nodes. Also reset the value of vbar to 0 when disabled - this way
we make sure that, when re-enabled, it will update the visible area of
the treeview, even if the previous value before disabling it is the
same as now. Finally don't do anything for the vbar.ValueChanged
handler - for the case wheer we manually set the value but don't the
vbar is disabled already.
Fixes part of #467225.
2009-01-23 Jonathan Pobst <[email protected]>
* ToolStrip.cs: Switch from foreach to for, in case the collection
somehow changes while enumerating it.
2009-01-23 Ivan N. Zlatev <[email protected]>
* DataGridView.cs, DataGridViewCell.cs: Fix crashes when there is no
@@ -234,24 +175,22 @@
* DataGridView.cs: Fix new row adding/editing in the non-databound
scenario.
2009-01-21 Neville Gao <[email protected]>
* ToolBar.cs: Backported r124045: Control enabled to support
accessibility. Added UIACollectionChangedEvent.
[Fixes Bug #455950]
2009-01-21 Mike Gorse <[email protected]>
* TrackBar.cs: Make LargeIncrement/Decrement internal so that UIA can
use them.
* TrackBar.cs: Backported R124116: Make LargeIncrement/Decrement
internal so that UIA can use them.
Added UIAValueParamChangedEvent.
2009-01-21 Carlos Alberto Cortez <[email protected]>
* TreeView.cs: In CollapseAll, set vbar to the maximum value, instead
of trying to set as top node the highest parent of the previous top
node. Moving to the bottom of the TreeView after a call to CollapseAll
is exactly what .net does. This should avoid some nasty issue when
CollapseAll is called and we don't need the vertical scroll bar.
2009-01-21 Mario Carrion <[email protected]>
* Form.cs: UIA Support: Internal events added: UIAWindowStateChanged
and UIATopMostChanged.
* Form.cs: Backported r124064: UIA Support: Internal events
added: UIAWindowStateChanged and UIATopMostChanged.
2009-01-21 Sandy Armstrong <[email protected]>
@@ -263,11 +202,6 @@
* Menu.cs:
* MenuAPI.cs: Note which internal APIs are being used by UIA.
2009-01-21 Neville Gao <[email protected]>
* ToolBar.cs: Control enabled to support accessibility.
[Fixes Bug #455950]
2009-01-19 Carlos Alberto Cortez <[email protected]>
* TreeView.cs: When handling mouse up event, check whether
@@ -322,13 +322,9 @@ namespace System.Windows.Forms
public int Width {
get { return width; }
set {
if (width != value) {
width = value;
if (owner != null) {
owner.Redraw (true);
owner.RaiseColumnWidthChanged (this);
}
}
width = value;
if (owner != null)
owner.Redraw (true);
}
}
#endregion // Public Instance Properties
@@ -215,6 +215,7 @@ namespace System.Windows.Forms {
selectionMode = DataGridViewSelectionMode.RowHeaderSelect;
showCellErrors = true;
showEditingIcon = true;
scrollBars = ScrollBars.Both;
userSetCursor = Cursor.Current;
virtualMode = false;
@@ -1168,6 +1169,8 @@ namespace System.Windows.Forms {
/// or canceled.
///////////////////////////////////////////////////////////
scrollBars = value;
PerformLayout ();
Invalidate ();
}
}
@@ -4615,23 +4618,25 @@ namespace System.Windows.Forms {
bool verticalVisible = false;
if (AutoSize) {
if (gridWidth > Size.Width || gridHeight > Size.Height) {
if (gridWidth > Size.Width || gridHeight > Size.Height)
Size = new Size(gridWidth, gridHeight);
}
}
else {
if (gridWidth > Size.Width) {
if (gridWidth > Size.Width)
horizontalVisible = true;
}
if (gridHeight > Size.Height) {
if (gridHeight > Size.Height)
verticalVisible = true;
}
if (horizontalScrollBar.Visible && (gridHeight + horizontalScrollBar.Height) > Size.Height) {
if (horizontalScrollBar.Visible && (gridHeight + horizontalScrollBar.Height) > Size.Height)
verticalVisible = true;
}
if (verticalScrollBar.Visible && (gridWidth + verticalScrollBar.Width) > Size.Width) {
if (verticalScrollBar.Visible && (gridWidth + verticalScrollBar.Width) > Size.Width)
horizontalVisible = true;
}
if (scrollBars != ScrollBars.Vertical && scrollBars != ScrollBars.Both)
verticalVisible = false;
if (scrollBars != ScrollBars.Horizontal && scrollBars != ScrollBars.Both)
horizontalVisible = false;
if (horizontalVisible) {
horizontalScrollBar.Minimum = 0;
horizontalScrollBar.Maximum = gridWidth;
@@ -5033,7 +5038,7 @@ namespace System.Windows.Forms {
protected bool ProcessDeleteKey (Keys keyData)
{
if (!allowUserToDeleteRows || SelectedRows.Count == 0)
if (!AllowUserToDeleteRows || SelectedRows.Count == 0)
return false;
int index = Math.Max (selected_row - SelectedRows.Count + 1, 0);
@@ -5047,8 +5052,8 @@ namespace System.Windows.Forms {
if (hover_cell != null && hover_cell.OwningRow == row)
hover_cell = null;
if (DataSource != null && DataSource is DataSet)
(DataSource as DataSet).Tables[dataMember].Rows.RemoveAt (row.Index);
if (DataManager != null)
DataManager.RemoveAt (row.Index);
else
Rows.RemoveAt (row.Index);
}
@@ -5889,6 +5894,18 @@ namespace System.Windows.Forms {
RemoveEditingRow ();
}
}
private void ResetRows ()
{
rows.Clear ();
RemoveEditingRow ();
if (DataManager != null) {
foreach (object element in DataManager.List)
AddBoundRow (element);
}
PrepareEditingRow (false, true);
OnListPositionChanged (this, EventArgs.Empty);
}
private void DoBinding ()
{
@@ -6069,7 +6086,7 @@ namespace System.Windows.Forms {
case ListChangedType.ItemChanged:
break;
default:
ReBind ();
ResetRows ();
break;
}
@@ -316,11 +316,11 @@ namespace System.Windows.Forms {
return false;
}
set {
bool changed = selected != value;
selected = value;
if (value != ((State & DataGridViewElementStates.Selected) != 0)) {
if (value != ((State & DataGridViewElementStates.Selected) != 0))
SetState(State ^ DataGridViewElementStates.Selected);
}
// If our row is selected, unselect it and select
// the first cell in it that isn't us
@@ -332,6 +332,9 @@ namespace System.Windows.Forms {
else if (OwningRow.Cells.Count > 1)
OwningRow.Cells[1].Selected = true;
}
if (changed && DataGridView != null && DataGridView.IsHandleCreated)
DataGridView.Invalidate ();
}
}
@@ -1300,7 +1303,7 @@ namespace System.Windows.Forms {
else
valuex = value;
if (oldValue != value) {
if (!Object.ReferenceEquals (oldValue, value) || !Object.Equals (oldValue, value)) {
RaiseCellValueChanged (new DataGridViewCellEventArgs (ColumnIndex, RowIndex));
// Set this dirty flag back to false
@@ -1381,7 +1381,6 @@ namespace System.Windows.Forms {
if (old_state != window_state)
OnUIAWindowStateChanged ();
#endif
}
}
@@ -6244,12 +6244,6 @@ namespace System.Windows.Forms
}
#endif
internal void RaiseColumnWidthChanged (ColumnHeader column)
{
int index = Columns.IndexOf (column);
RaiseColumnWidthChanged (index);
}
#if NET_2_0
#region UIA Framework: Methods, Properties and Events
@@ -66,48 +66,6 @@ namespace System.Windows.Forms {
#endif
#endregion // Fields
#region UIA Framework Events
#if NET_2_0
static object UIAHorizontallyScrollableChangedEvent = new object ();
internal event EventHandler UIAHorizontallyScrollableChanged {
add { Events.AddHandler (UIAHorizontallyScrollableChangedEvent, value); }
remove { Events.RemoveHandler (UIAHorizontallyScrollableChangedEvent, value); }
}
internal void OnUIAHorizontallyScrollableChanged (EventArgs e)
{
EventHandler eh
= (EventHandler) Events [UIAHorizontallyScrollableChangedEvent];
if (eh != null)
eh (this, e);
}
static object UIAHorizontallyScrolledEvent = new object ();
internal event EventHandler UIAHorizontallyScrolled {
add { Events.AddHandler (UIAHorizontallyScrolledEvent, value); }
remove { Events.RemoveHandler (UIAHorizontallyScrolledEvent, value); }
}
internal void OnUIAHorizontallyScrolled (EventArgs e)
{
EventHandler eh
= (EventHandler) Events [UIAHorizontallyScrolledEvent];
if (eh != null)
eh (this, e);
}
#endif
#endregion
#region UIA Framework Property
#if NET_2_0
internal double UIAHorizontalViewSize {
get { return LeftScrollButtonArea.Left * 100 / TabPages [TabCount - 1].TabBounds.Right; }
}
#endif
#endregion
#region Public Constructors
public TabControl ()
{
@@ -492,14 +450,7 @@ namespace System.Windows.Forms {
#region Internal Properties
internal bool ShowSlider {
get { return show_slider; }
set {
show_slider = value;
#if NET_2_0
// UIA Framework Event: HorizontallyScrollable Changed
OnUIAHorizontallyScrollableChanged (EventArgs.Empty);
#endif
}
set { show_slider = value; }
}
internal int SliderPos {
@@ -969,11 +920,6 @@ namespace System.Windows.Forms {
slider_pos++;
SizeTabs ();
#if NET_2_0
// UIA Framework Event: Horizontally Scrolled
OnUIAHorizontallyScrolled (EventArgs.Empty);
#endif
switch (this.Alignment) {
case TabAlignment.Top:
Invalidate (new Rectangle (0, 0, Width, ItemSize.Height));
@@ -999,11 +945,6 @@ namespace System.Windows.Forms {
slider_pos--;
SizeTabs ();
#if NET_2_0
// UIA Framework Event: Horizontally Scrolled
OnUIAHorizontallyScrolled (EventArgs.Empty);
#endif
switch (this.Alignment) {
case TabAlignment.Top:
Invalidate (new Rectangle (0, 0, Width, ItemSize.Height));
@@ -681,12 +681,8 @@ namespace System.Windows.Forms {
break;
bool is_backspace = m.WParam.ToInt32 () == 8;
if (!Char.IsLetterOrDigit ((char)m.WParam) && !is_backspace) {
// Update Text and save it before returning
base.WndProc (ref m);
auto_complete_original_text = Text;
return;
}
if (!Char.IsLetterOrDigit ((char)m.WParam) && !is_backspace)
break;
if (!is_backspace)
Text = auto_complete_original_text;
@@ -525,8 +525,6 @@ namespace System.Windows.Forms
}
#if NET_2_0
private ToolBarButton button_for_focus = null;
internal void UIAPerformClick (ToolBarButton button)
{
ToolBarItem previous_item = current_item;
@@ -547,7 +545,7 @@ namespace System.Windows.Forms
}
}
#endif
protected virtual void OnButtonClick (ToolBarButtonClickEventArgs e)
{
if (e.Button.Style == ToolBarButtonStyle.ToggleButton) {
@@ -560,11 +558,6 @@ namespace System.Windows.Forms
current_item.Pressed = false;
current_item.Invalidate ();
#if NET_2_0
button_for_focus = current_item.Button;
button_for_focus.UIAHasFocus = true;
#endif
ToolBarButtonClickEventHandler eh = (ToolBarButtonClickEventHandler)(Events [ButtonClickEvent]);
if (eh != null)
eh (this, e);
@@ -658,12 +651,6 @@ namespace System.Windows.Forms
#region Private Methods
private void FocusChanged (object sender, EventArgs args)
{
#if NET_2_0
if (!Focused && button_for_focus != null)
button_for_focus.UIAHasFocus = false;
button_for_focus = null;
#endif
if (Appearance != ToolBarAppearance.Flat || Buttons.Count == 0)
return;
@@ -116,10 +116,6 @@ namespace System.Windows.Forms
enabled = value;
Invalidate ();
#if NET_2_0
OnEnabledChanged (EventArgs.Empty);
#endif
}
}
@@ -322,60 +318,23 @@ namespace System.Windows.Forms
}
#if NET_2_0
bool uiaHasFocus = false;
internal bool UIAHasFocus {
get { return uiaHasFocus; }
set {
uiaHasFocus = value;
EventHandler eh =
(EventHandler) (value ? Events [UIAGotFocusEvent] : Events [UIALostFocusEvent]);
if (eh != null)
eh (this, EventArgs.Empty);
}
}
static object UIAGotFocusEvent = new object ();
static object UIALostFocusEvent = new object ();
static object UIATextChangedEvent = new object ();
static object UIAEnabledChangedEvent = new object ();
internal event EventHandler UIAGotFocus {
add { Events.AddHandler (UIAGotFocusEvent, value); }
remove { Events.RemoveHandler (UIAGotFocusEvent, value); }
}
internal event EventHandler UIALostFocus {
add { Events.AddHandler (UIALostFocusEvent, value); }
remove { Events.RemoveHandler (UIALostFocusEvent, value); }
}
internal event EventHandler UIATextChanged {
add { Events.AddHandler (UIATextChangedEvent, value); }
remove { Events.RemoveHandler (UIATextChangedEvent, value); }
}
internal event EventHandler UIAEnabledChanged {
add { Events.AddHandler (UIATextChangedEvent, value); }
remove { Events.RemoveHandler (UIATextChangedEvent, value); }
}
protected virtual void OnUIATextChanged(EventArgs e)
protected virtual void OnUIATextChanged (EventArgs e)
{
EventHandler eh = (EventHandler)(Events [UIATextChangedEvent]);
if (eh != null)
eh (this, e);
}
protected virtual void OnEnabledChanged (EventArgs e)
{
EventHandler eh = (EventHandler)(Events [UIAEnabledChangedEvent]);
if (eh != null)
eh (this, e);
}
#endif
#endregion Internal Methods
#endregion Internal Methods
#region methods
protected override void Dispose (bool disposing)
@@ -974,9 +974,7 @@ namespace System.Windows.Forms
this.OnPaintGrip (e);
// Make each item draw itself
for (int i = 0; i < displayed_items.Count; i++) {
ToolStripItem tsi = displayed_items[i];
foreach (ToolStripItem tsi in this.displayed_items) {
if (tsi.Visible) {
e.Graphics.TranslateTransform (tsi.Bounds.Left, tsi.Bounds.Top);
tsi.FireEvent (e, ToolStripItemEventType.Paint);
@@ -214,6 +214,8 @@ namespace System.Windows.Forms
get {
if (prop_bag != null)
return prop_bag.BackColor;
if (TreeView != null)
return TreeView.BackColor;
return Color.Empty;
}
set {
@@ -559,7 +561,7 @@ namespace System.Windows.Forms
if (prop_bag == null)
prop_bag = new OwnerDrawPropertyBag ();
prop_bag.Font = value;
Invalidate ();
InvalidateWidth ();
}
}
@@ -655,7 +657,7 @@ namespace System.Windows.Forms
if (state_image_index != value) {
state_image_index = value;
state_image_key = string.Empty;
Invalidate ();
InvalidateWidth ();
}
}
}
@@ -672,7 +674,7 @@ namespace System.Windows.Forms
if (state_image_key != value) {
state_image_key = value;
state_image_index = -1;
Invalidate ();
InvalidateWidth ();
}
}
}
@@ -698,7 +700,7 @@ namespace System.Windows.Forms
if (text == value)
return;
text = value;
Invalidate ();
InvalidateWidth ();
#if NET_2_0
// UIA Framework Event: Text Changed
TreeView view = TreeView;
@@ -1061,22 +1063,6 @@ namespace System.Windows.Forms
get { return width == -1; }
}
internal void Invalidate ()
{
// invalidate width first so Bounds retrieves
// the updated value (we don't use it here however)
width = -1;
TreeView tv = TreeView;
if (tv == null)
return;
// Use actual TreeView width to invalidate total prev/new area
Rectangle bounds = Bounds;
bounds.Width = tv.ClientSize.Width;
tv.Invalidate (bounds);
}
internal void InvalidateWidth ()
{
// bounds.Width = 0;
@@ -810,7 +810,7 @@ namespace System.Windows.Forms {
root_node.CollapseAll ();
EndUpdate ();
if (vbar.VisibleInternal)
if (IsHandleCreated && vbar.VisibleInternal)
vbar.Value = vbar.Maximum - VisibleCount + 1;
}
@@ -1605,7 +1605,7 @@ namespace System.Windows.Forms {
int use_index = node.Image;
if (use_index > -1 && use_index < ImageList.Images.Count)
if (use_index != -1)
ImageList.Draw (dc, x, y, ImageList.ImageSize.Width, ImageList.ImageSize.Height, use_index);
}
@@ -1726,19 +1726,12 @@ namespace System.Windows.Forms {
return;
r.Inflate (-1, -1);
if (Focused && node == highlighted_node) {
// Use the node's BackColor if is not empty, and is not actually the selected one (yet)
Color back_color = node != selected_node && node.BackColor != Color.Empty ? node.BackColor :
ThemeEngine.Current.ColorHighlight;
dc.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (back_color), r);
dc.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (ThemeEngine.Current.ColorHighlight), r);
} else if (!hide_selection && node == highlighted_node) {
dc.FillRectangle (SystemBrushes.Control, r);
} else {
// If selected_node is not the current highlighted one, use the color of the TreeView
Color back_color = node == selected_node ? BackColor : node.BackColor;
dc.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (back_color), r);
dc.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (node.BackColor), r);
}
}
@@ -2190,8 +2183,6 @@ namespace System.Windows.Forms {
highlighted_node = focused_node;
selected_node = focused_node;
if (selected_node != null)
Invalidate (selected_node.Bounds);
}
}
@@ -2236,10 +2227,8 @@ namespace System.Windows.Forms {
return;
Invalidate (highlighted_node.Bounds);
if (selected_node != null)
Invalidate (selected_node.Bounds);
if (focused_node != null)
Invalidate (focused_node.Bounds);
Invalidate (selected_node.Bounds);
Invalidate (focused_node.Bounds);
highlighted_node = selected_node;
focused_node = selected_node;
@@ -842,11 +842,6 @@ namespace System.Windows.Forms
}
#endif
internal override void SetBoundsCoreInternal(int x, int y, int width, int height, BoundsSpecified specified)
{
base.SetBoundsCoreInternal (x, y, width, Math.Min (width, PreferredHeight), specified);
}
protected abstract void UpdateEditText ();
protected virtual void ValidateEditText ()
@@ -48,7 +48,7 @@ namespace System.Windows.Forms
bool isWebBrowserContextMenuEnabled;
object objectForScripting;
bool webBrowserShortcutsEnabled;
bool scrollbarsEnabled = true;
bool scrollbarsEnabled = true;
WebBrowserReadyState readyState;
@@ -4367,27 +4367,25 @@ namespace System.Windows.Forms {
goto ProcessNextMessage;
}
// We are already firing WM_SHOWWINDOW messages in the proper places, but I'm leaving this code
// in case we break a scenario not taken into account in the tests
case XEventName.MapNotify: {
/*if (client && (xevent.ConfigureEvent.xevent == xevent.ConfigureEvent.window)) { // Ignore events for children (SubstructureNotify) and client areas
if (client && (xevent.ConfigureEvent.xevent == xevent.ConfigureEvent.window)) { // Ignore events for children (SubstructureNotify) and client areas
hwnd.mapped = true;
msg.message = Msg.WM_SHOWWINDOW;
msg.wParam = (IntPtr) 1;
// XXX we're missing the lParam..
break;
}*/
}
goto ProcessNextMessage;
}
case XEventName.UnmapNotify: {
/*if (client && (xevent.ConfigureEvent.xevent == xevent.ConfigureEvent.window)) { // Ignore events for children (SubstructureNotify) and client areas
if (client && (xevent.ConfigureEvent.xevent == xevent.ConfigureEvent.window)) { // Ignore events for children (SubstructureNotify) and client areas
hwnd.mapped = false;
msg.message = Msg.WM_SHOWWINDOW;
msg.wParam = (IntPtr) 0;
// XXX we're missing the lParam..
break;
}*/
}
goto ProcessNextMessage;
}
@@ -1,17 +1,3 @@
2009-02-04 Mario Carrion <[email protected]>
* ColumnHeaderTest.cs: Testing ListView.ColumnWidthChanged when
changing Width (for bug #467086).
2009-02-02 Carlos Alberto Cortez <[email protected]>
* FormEventTest.cs: New test for VisibleChanged event (and children
controls as well).
2009-01-30 Ivan N. Zlatev <[email protected]>
* NumericUpDownTest.cs: Add a test to check Height == PreferredHeight.
2009-01-19 Carlos Alberto Cortez <[email protected]>
* ListBoxTest.cs: New test for RemoveAt and selection.
@@ -388,16 +388,6 @@ namespace MonoTests.System.Windows.Forms
col.Width = -2;
Assert.IsTrue (col.Width > 0, "#2");
#if NET_2_0
bool eventRaised = false;
lv.ColumnWidthChanged += delegate (object sender, ColumnWidthChangedEventArgs e) {
Assert.AreEqual (e.ColumnIndex, 0, "#3");
eventRaised = true;
};
col.Width = 100;
Assert.IsTrue (eventRaised, "#4");
#endif
}
[Test]
@@ -479,59 +479,6 @@ namespace MonoTests.System.Windows.Forms
}
#endif
[Test]
public void VisibleChangedEvent ()
{
_form = new Form ();
_form.VisibleChanged += new EventHandler (FormVisibleChangedHandler);
Control control1 = new Control ();
control1.Location = new Point (5, 5);
control1.VisibleChanged += new EventHandler (Control1VisibleChangedHandler);
control1_visiblechanged_count = 0;
Assert.AreEqual (true, control1.Visible, "#A1");
Assert.AreEqual (false, _form.Visible, "#A2");
// case one - change without being added to the form
control1.Visible = false;
Assert.AreEqual (false, control1.Visible, "#B1");
Assert.AreEqual (1, control1_visiblechanged_count, "#B2");
control1.Visible = true;
control1_visiblechanged_count = 0;
_form.Controls.Add (control1);
Assert.AreEqual (false, control1.Visible, "#C1");
Assert.AreEqual (1, control1_visiblechanged_count, "#C2");
// Add a second control that actually is not visible
Control control2 = new Control ();
control2.Visible = false;
_form.Controls.Add (control2);
control1_visiblechanged_count = control2_visiblechanged_count = form_visiblechanged_count = 0;
_form.Show ();
Assert.AreEqual (1, control1_visiblechanged_count, "#D1");
Assert.AreEqual (0, control2_visiblechanged_count, "#D2");
Assert.AreEqual (1, form_visiblechanged_count, "#D3");
_form.Dispose ();
}
int control1_visiblechanged_count;
int control2_visiblechanged_count;
int form_visiblechanged_count;
void Control1VisibleChangedHandler (object o, EventArgs args)
{
control1_visiblechanged_count++;
}
void FormVisibleChangedHandler (object o, EventArgs args)
{
form_visiblechanged_count++;
}
class DelayedCloseForm : Form
{
private Timer _timer;
@@ -115,15 +115,6 @@ namespace MonoTests.System.Windows.Forms
f.Dispose ();
}
[Test]
public void Height ()
{
NumericUpDown nud = new NumericUpDown ();
Assert.AreEqual (20, nud.PreferredHeight, "#1");
nud.Height = 9999;
Assert.AreEqual (nud.PreferredHeight, nud.Height, "#2");
}
[Test]
#if NET_2_0
[ExpectedException (typeof (ArgumentOutOfRangeException))]
@@ -1,12 +1,3 @@
2009-02-15 Jonathan Chambers <[email protected]>
* Microsoft.Build.Engine_test.dll.sources: Add BuildChooseTest.cs.
2009-01-31 Ankit Jain <[email protected]>
* Microsoft.Build.Engine_test.dll.sources: Replace BatchingImpl.cs with
BatchingImplBase.cs, TargetBatchingImpl.cs and TaskBatchingImpl.cs
2009-01-06 Ankit Jain <[email protected]>
* Microsoft.Build.Engine_test.dll.sources: Add TestMessageLogger from
@@ -0,0 +1,337 @@
//
// BatchingImpl.cs: Class that implements BatchingAlgorithm from the wiki.
//
// Author:
// Marek Sieradzki ([email protected])
// Ankit Jain ([email protected])
//
// (C) 2005 Marek Sieradzki
// Copyright 2008 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#if NET_2_0
using System;
using System.IO;
using System.Collections.Generic;
using System.Text;
using System.Xml;
using Microsoft.Build.Framework;
namespace Microsoft.Build.BuildEngine {
internal class BatchingImpl {
string inputs;
string outputs;
Project project;
List<BuildItemGroup> consumedItemNames;
List<MetadataReference> consumedMetadataReferences;
List<MetadataReference> consumedQMetadataReferences;
List<MetadataReference> consumedUQMetadataReferences;
Dictionary<string, BuildItemGroup> batchedItemsByName;
Dictionary<string, BuildItemGroup> commonItemsByName;
public BatchingImpl (Project project, XmlElement targetElement)
{
if (targetElement == null)
throw new ArgumentNullException ("targetElement");
if (project == null)
throw new ArgumentNullException ("project");
this.project = project;
inputs = targetElement.GetAttribute ("Inputs");
outputs = targetElement.GetAttribute ("Outputs");
}
public bool BuildNeeded ()
{
// FIXME: change this to ITaskItem instead of string
Expression inputExpr, outputExpr;
string[] inputFiles, outputFiles;
DateTime oldestInput, youngestOutput;
if (inputs == String.Empty)
return true;
if (outputs == String.Empty)
return true;
inputExpr = new Expression ();
inputExpr.Parse (inputs, true);
outputExpr = new Expression ();
outputExpr.Parse (outputs, true);
inputFiles = (string[]) inputExpr.ConvertTo (project, typeof (string[]));
outputFiles = (string[]) outputExpr.ConvertTo (project, typeof (string[]));
if (inputFiles == null)
return true;
if (outputFiles == null)
return true;
if (inputFiles.Length == 0)
return true;
if (outputFiles.Length == 0)
return true;
if (File.Exists (inputFiles [0]))
oldestInput = File.GetLastWriteTime (inputFiles [0]);
else
return true;
if (File.Exists (outputFiles [0]))
youngestOutput = File.GetLastWriteTime (outputFiles [0]);
else
return true;
foreach (string file in inputFiles) {
if (file.Trim () == String.Empty)
continue;
if (File.Exists (file.Trim ())) {
if (File.GetLastWriteTime (file.Trim ()) > oldestInput)
oldestInput = File.GetLastWriteTime (file.Trim ());
} else {
return true;
}
}
foreach (string file in outputFiles) {
if (file.Trim () == String.Empty)
continue;
if (File.Exists (file.Trim ())) {
if (File.GetLastWriteTime (file.Trim ()) < youngestOutput)
youngestOutput = File.GetLastWriteTime (file.Trim ());
} else
return true;
}
if (oldestInput > youngestOutput)
return true;
else
return false;
}
public bool BatchBuildTask (BuildTask buildTask)
{
try {
return BatchBuildTaskInternal (buildTask);
} finally {
consumedItemNames = null;
consumedMetadataReferences = null;
consumedQMetadataReferences = null;
consumedUQMetadataReferences = null;
batchedItemsByName = null;
commonItemsByName = null;
}
}
//FIXME: Target batching
bool BatchBuildTaskInternal (BuildTask buildTask)
{
// all referenced item lists
consumedItemNames = new List<BuildItemGroup> ();
// all referenced metadata
consumedMetadataReferences = new List<MetadataReference> ();
consumedQMetadataReferences = new List<MetadataReference> ();
consumedUQMetadataReferences = new List<MetadataReference> ();
// populate list of referenced items and metadata
ParseAttributesForBatching (buildTask);
if (consumedMetadataReferences.Count == 0) {
// No batching required
if (ConditionParser.ParseAndEvaluate (buildTask.Condition, project))
return buildTask.Execute ();
else // skipped, it should be logged
return true;
}
batchedItemsByName = new Dictionary<string, BuildItemGroup> ();
// These will passed as is for every batch
commonItemsByName = new Dictionary<string, BuildItemGroup> ();
ValidateUnqualifiedMetadataReferences ();
if (consumedUQMetadataReferences.Count > 0) {
// Atleast one unqualified metadata ref is found, so
// batching will be done for all referenced item lists
foreach (BuildItemGroup group in consumedItemNames)
batchedItemsByName [group [0].Name] = group;
}
// All items referred via qualified metadata refs will be batched
foreach (MetadataReference mr in consumedQMetadataReferences) {
BuildItemGroup group;
if (project.EvaluatedItemsByName.TryGetValue (mr.ItemName, out group))
batchedItemsByName [mr.ItemName] = group;
}
// CommonItemNames = ConsumedItemNames - BatchedItemNames
foreach (BuildItemGroup group in consumedItemNames) {
if (!batchedItemsByName.ContainsKey (group [0].Name))
commonItemsByName [group [0].Name] = group;
}
// Bucketizing
IEnumerable<Dictionary<string, BuildItemGroup>> buckets = Bucketize ();
// Run the task in batches
bool retval = true;
foreach (Dictionary<string, BuildItemGroup> bucket in buckets) {
project.SetBatchedItems (bucket, commonItemsByName);
if (ConditionParser.ParseAndEvaluate (buildTask.Condition, project)) {
if (! (retval = buildTask.Execute ()))
break;
}
}
project.SetBatchedItems (null, null);
return retval;
}
// Parse task attributes to get list of referenced metadata and items
// to determine batching
//
void ParseAttributesForBatching (BuildTask buildTask)
{
foreach (XmlAttribute attrib in buildTask.TaskElement.Attributes) {
Expression expr = new Expression ();
expr.Parse (attrib.Value, true);
foreach (object o in expr.Collection) {
MetadataReference mr = o as MetadataReference;
if (mr != null) {
consumedMetadataReferences.Add (mr);
if (mr.IsQualified)
consumedQMetadataReferences.Add (mr);
else
consumedUQMetadataReferences.Add (mr);
continue;
}
ItemReference ir = o as ItemReference;
if (ir != null) {
BuildItemGroup group;
if (project.EvaluatedItemsByName.TryGetValue (ir.ItemName, out group))
consumedItemNames.Add (group);
}
}
}
}
//Ensure that for every metadataReference in consumedUQMetadataReferences,
//every item in every itemlist in consumedItemNames has a non-null value
//for that metadata
void ValidateUnqualifiedMetadataReferences ()
{
if (consumedUQMetadataReferences.Count > 0 &&
consumedItemNames.Count == 0 &&
consumedQMetadataReferences.Count == 0) {
throw new Exception (String.Format (
"Item metadata should be referenced with the item name %(ItemName.{0})",
consumedQMetadataReferences [0].MetadataName));
}
foreach (MetadataReference mr in consumedUQMetadataReferences) {
foreach (BuildItemGroup group in consumedItemNames) {
foreach (BuildItem item in group) {
if (item.HasMetadata (mr.MetadataName))
continue;
throw new Exception (String.Format (
"Metadata named '{0}' not found in item named {1} in item list named {2}",
mr.MetadataName, item.FinalItemSpec, group [0].Name));
}
}
}
}
IEnumerable<Dictionary<string, BuildItemGroup>> Bucketize ()
{
Dictionary<string, Dictionary<string, BuildItemGroup>> buckets = new Dictionary<string, Dictionary<string, BuildItemGroup>> ();
// For each item list represented in "BatchedItemNames", and then for each item
// within that list, get the values for that item for each of the metadata in
// "ConsumedMetadataReferences". In the table of metadata values, "%(MyItem.MyMetadata)"
// would get a separate entry than "%(MyMetadata)", even though the metadata name is the same.
foreach (BuildItemGroup group in batchedItemsByName.Values) {
string itemName = group [0].Name;
foreach (BuildItem item in group) {
StringBuilder key_sb = new StringBuilder ();
string value = String.Empty;
// build the bucket key, unique set of metadata values
foreach (MetadataReference mr in consumedMetadataReferences) {
value = String.Empty;
if (mr.IsQualified) {
if (String.Compare (mr.ItemName, itemName) == 0)
value = item.GetEvaluatedMetadata (mr.MetadataName);
} else {
if (item.HasMetadata (mr.MetadataName))
value = item.GetEvaluatedMetadata (mr.MetadataName);
}
key_sb.AppendFormat ("{0}.{1}:{2},",
mr.IsQualified ? mr.ItemName : "",
mr.MetadataName,
value);
}
// Every bucket corresponds to a unique _set_ of metadata values
// So, every bucket would have itemGroups with same set of metadata
// values
string bucket_key = key_sb.ToString ();
Dictionary<string, BuildItemGroup> bucket;
if (!buckets.TryGetValue (bucket_key, out bucket))
// new bucket
buckets [bucket_key] = bucket = new Dictionary<string, BuildItemGroup> ();
string itemGroup_key = item.Name;
BuildItemGroup itemGroup;
if (!bucket.TryGetValue (itemGroup_key, out itemGroup))
bucket [itemGroup_key] = itemGroup = new BuildItemGroup ();
itemGroup.AddItem (item);
}
}
return buckets.Values;
}
}
}
#endif
@@ -1,238 +0,0 @@
//
// BatchingImplBase.cs: Base class that implements BatchingAlgorithm from the wiki.
//
// Author:
// Marek Sieradzki ([email protected])
// Ankit Jain ([email protected])
//
// (C) 2005 Marek Sieradzki
// Copyright 2008 Novell, Inc (http://www.novell.com)
// Copyright 2009 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#if NET_2_0
using System;
using System.IO;
using System.Collections.Generic;
using System.Text;
using System.Xml;
using Microsoft.Build.Framework;
namespace Microsoft.Build.BuildEngine {
internal class BatchingImplBase {
protected Dictionary<string, BuildItemGroup> consumedItemsByName;
protected List<MetadataReference> consumedMetadataReferences;
protected List<MetadataReference> consumedQMetadataReferences;
protected List<MetadataReference> consumedUQMetadataReferences;
protected Dictionary<string, BuildItemGroup> batchedItemsByName;
protected Dictionary<string, BuildItemGroup> commonItemsByName;
protected Project project;
protected ICollection<Dictionary<string, BuildItemGroup>> buckets;
protected BatchingImplBase (Project project)
{
if (project == null)
throw new ArgumentNullException ("project");
this.project = project;
}
protected void Init ()
{
// all referenced item lists
consumedItemsByName = new Dictionary<string, BuildItemGroup> ();
// all referenced metadata
consumedMetadataReferences = new List<MetadataReference> ();
consumedQMetadataReferences = new List<MetadataReference> ();
consumedUQMetadataReferences = new List<MetadataReference> ();
}
protected void BatchAndPrepareBuckets ()
{
batchedItemsByName = new Dictionary<string, BuildItemGroup> ();
// These will passed as is for every batch
commonItemsByName = new Dictionary<string, BuildItemGroup> ();
ValidateUnqualifiedMetadataReferences ();
if (consumedUQMetadataReferences.Count > 0) {
// Atleast one unqualified metadata ref is found, so
// batching will be done for all referenced item lists
foreach (KeyValuePair<string, BuildItemGroup> pair in consumedItemsByName)
batchedItemsByName [pair.Key] = pair.Value;
}
// All items referred via qualified metadata refs will be batched
foreach (MetadataReference mr in consumedQMetadataReferences) {
BuildItemGroup group;
if (project.TryGetEvaluatedItemByNameBatched (mr.ItemName, out group))
batchedItemsByName [mr.ItemName] = group;
}
// CommonItemNames = ConsumedItemNames - BatchedItemNames
foreach (KeyValuePair<string, BuildItemGroup> pair in consumedItemsByName) {
if (!batchedItemsByName.ContainsKey (pair.Key))
commonItemsByName [pair.Key] = pair.Value;
}
// Bucketizing
buckets = Bucketize ();
}
protected void ParseAttribute (string value)
{
Expression expr = new Expression ();
expr.Parse (value, true);
foreach (object o in expr.Collection) {
MetadataReference mr = o as MetadataReference;
if (mr != null) {
consumedMetadataReferences.Add (mr);
if (mr.IsQualified)
consumedQMetadataReferences.Add (mr);
else
consumedUQMetadataReferences.Add (mr);
continue;
}
ItemReference ir = o as ItemReference;
if (ir != null) {
BuildItemGroup group;
if (!project.TryGetEvaluatedItemByNameBatched (ir.ItemName, out group))
if (!project.EvaluatedItemsByName.TryGetValue (ir.ItemName, out group))
group = new BuildItemGroup ();
consumedItemsByName [ir.ItemName] = group;
}
}
}
//Ensure that for every metadataReference in consumedUQMetadataReferences,
//every item in every itemlist in consumedItemsByName has a non-null value
//for that metadata
void ValidateUnqualifiedMetadataReferences ()
{
if (consumedUQMetadataReferences.Count > 0 &&
consumedItemsByName.Count == 0 &&
consumedQMetadataReferences.Count == 0) {
throw new Exception ("Item metadata should be referenced with the item name %(ItemName.MetadataName)");
}
foreach (MetadataReference mr in consumedUQMetadataReferences) {
foreach (KeyValuePair<string, BuildItemGroup> pair in consumedItemsByName) {
foreach (BuildItem item in pair.Value) {
if (item.HasMetadata (mr.MetadataName))
continue;
throw new Exception (String.Format (
"Metadata named '{0}' not found in item named {1} in item list named {2}",
mr.MetadataName, item.FinalItemSpec, pair.Key));
}
}
}
}
ICollection<Dictionary<string, BuildItemGroup>> Bucketize ()
{
Dictionary<string, Dictionary<string, BuildItemGroup>> buckets =
new Dictionary<string, Dictionary<string, BuildItemGroup>> ();
// For each item list represented in "BatchedItemNames", and then for each item
// within that list, get the values for that item for each of the metadata in
// "ConsumedMetadataReferences". In the table of metadata values, "%(MyItem.MyMetadata)"
// would get a separate entry than "%(MyMetadata)", even though the metadata name is the same.
foreach (KeyValuePair<string, BuildItemGroup> pair in batchedItemsByName) {
string itemName = pair.Key;
BuildItemGroup group = pair.Value;
foreach (BuildItem item in group) {
StringBuilder key_sb = new StringBuilder ();
string value = String.Empty;
// build the bucket key, unique set of metadata values
foreach (MetadataReference mr in consumedMetadataReferences) {
value = String.Empty;
if (mr.IsQualified) {
if (String.Compare (mr.ItemName, itemName) == 0)
value = item.GetEvaluatedMetadata (mr.MetadataName);
} else {
if (item.HasMetadata (mr.MetadataName))
value = item.GetEvaluatedMetadata (mr.MetadataName);
}
key_sb.AppendFormat ("{0}.{1}:{2},",
mr.IsQualified ? mr.ItemName : "",
mr.MetadataName,
value);
}
// Every bucket corresponds to a unique _set_ of metadata values
// So, every bucket would have itemGroups with same set of metadata
// values
string bucket_key = key_sb.ToString ();
Dictionary<string, BuildItemGroup> bucket;
if (!buckets.TryGetValue (bucket_key, out bucket))
// new bucket
buckets [bucket_key] = bucket = new Dictionary<string, BuildItemGroup> ();
string itemGroup_key = item.Name;
BuildItemGroup itemGroup;
if (!bucket.TryGetValue (itemGroup_key, out itemGroup))
bucket [itemGroup_key] = itemGroup = new BuildItemGroup ();
itemGroup.AddItem (item);
}
}
if (buckets.Values.Count == 0) {
// no buckets
buckets.Add ("none", new Dictionary<string, BuildItemGroup> ());
AddEmptyGroups (buckets);
if (buckets ["none"].Values.Count == 0)
buckets.Remove ("none");
} else {
AddEmptyGroups (buckets);
}
return buckets.Values;
}
void AddEmptyGroups (Dictionary<string, Dictionary<string, BuildItemGroup>> buckets)
{
foreach (Dictionary<string, BuildItemGroup> bucket in buckets.Values) {
foreach (string name in batchedItemsByName.Keys) {
BuildItemGroup group;
if (!bucket.TryGetValue (name, out group))
bucket [name] = new BuildItemGroup ();
}
}
}
}
}
#endif
@@ -59,8 +59,7 @@ namespace Microsoft.Build.BuildEngine {
IDictionary targetOutputs)
{
if (String.IsNullOrEmpty (projectFileName)) {
return engine.BuildProject (project, targetNames, targetOutputs,
BuildSettings.DoNotResetPreviouslyBuiltTargets);
return engine.BuildProject (project, targetNames, targetOutputs);
} else {
BuildPropertyGroup bpg = new BuildPropertyGroup ();
if (globalProperties != null)
@@ -69,7 +68,7 @@ namespace Microsoft.Build.BuildEngine {
(string) de.Key, (string) de.Value,
PropertyType.Global));
return engine.BuildProjectFile (projectFileName,
targetNames, bpg, targetOutputs, BuildSettings.DoNotResetPreviouslyBuiltTargets);
targetNames, bpg, targetOutputs);
}
}
@@ -41,7 +41,7 @@ using Mono.XBuild.Utilities;
namespace Microsoft.Build.BuildEngine {
public class BuildItem {
List<BuildItem> child_items;
BuildItemGroup child_items;
XmlElement itemElement;
string finalItemSpec;
bool isImported;
@@ -82,10 +82,10 @@ namespace Microsoft.Build.BuildEngine {
unevaluatedMetadata = CollectionsUtil.CreateCaseInsensitiveHashtable ();
evaluatedMetadata = CollectionsUtil.CreateCaseInsensitiveHashtable ();
}
internal BuildItem (XmlElement itemElement, BuildItemGroup parentItemGroup)
{
child_items = new List<BuildItem> ();
child_items = new BuildItemGroup ();
isImported = parentItemGroup.IsImported;
unevaluatedMetadata = CollectionsUtil.CreateCaseInsensitiveHashtable ();
evaluatedMetadata = CollectionsUtil.CreateCaseInsensitiveHashtable ();
@@ -102,7 +102,7 @@ namespace Microsoft.Build.BuildEngine {
isImported = parent.isImported;
name = parent.Name;
parent_item = parent;
parent_item.child_items.Add (this);
parent_item.child_items.AddItem (this);
parent_item_group = parent.parent_item_group;
unevaluatedMetadata = CollectionsUtil.CreateCaseInsensitiveHashtable (parent.unevaluatedMetadata);
evaluatedMetadata = CollectionsUtil.CreateCaseInsensitiveHashtable (parent.evaluatedMetadata);
@@ -169,7 +169,7 @@ namespace Microsoft.Build.BuildEngine {
XmlNode node = itemElement [metadataName];
itemElement.RemoveChild (node);
}
} else if (HasParentItem) {
} else if (HasParent) {
if (parent_item.child_items.Count > 1)
SplitParentItem ();
parent_item.RemoveMetadata (metadataName);
@@ -198,7 +198,7 @@ namespace Microsoft.Build.BuildEngine {
throw new ArgumentException (String.Format ("\"{0}\" is a reserved item meta-data, and cannot be modified or deleted.",
metadataName));
if (treatMetadataValueAsLiteral && !HasParentItem)
if (treatMetadataValueAsLiteral && !HasParent)
metadataValue = Utilities.Escape (metadataValue);
if (FromXml) {
@@ -209,12 +209,12 @@ namespace Microsoft.Build.BuildEngine {
itemElement.AppendChild (element);
} else
element.InnerText = metadataValue;
} else if (HasParentItem) {
} else if (HasParent) {
if (parent_item.child_items.Count > 1)
SplitParentItem ();
parent_item.SetMetadata (metadataName, metadataValue, treatMetadataValueAsLiteral);
}
if (FromXml || HasParentItem) {
if (FromXml || HasParent) {
parent_item_group.ParentProject.MarkProjectAsDirty ();
parent_item_group.ParentProject.NeedToReevaluate ();
}
@@ -330,7 +330,7 @@ namespace Microsoft.Build.BuildEngine {
{
if (FromXml)
itemElement.ParentNode.RemoveChild (itemElement);
else if (HasParentItem) {
else if (HasParent) {
if (parent_item.child_items.Count > 1)
SplitParentItem ();
parent_item.Detach ();
@@ -388,7 +388,7 @@ namespace Microsoft.Build.BuildEngine {
parent.itemElement.ParentNode.InsertAfter (newElement, insertAfter);
newParent = new BuildItem (newElement, parent.parent_item_group);
newParent.child_items.Add (child);
newParent.child_items.AddItem (child);
child.parent_item = newParent;
return newParent;
@@ -404,7 +404,7 @@ namespace Microsoft.Build.BuildEngine {
set {
if (FromXml)
itemElement.SetAttribute ("Condition", value);
else if (!HasParentItem)
else if (!HasParent)
throw new InvalidOperationException ("Cannot set a condition on an object not represented by an XML element in the project file.");
}
}
@@ -432,7 +432,7 @@ namespace Microsoft.Build.BuildEngine {
get {
if (FromXml)
return itemElement.GetAttribute ("Include");
else if (HasParentItem)
else if (HasParent)
return parent_item.Include;
else
return itemInclude;
@@ -440,7 +440,7 @@ namespace Microsoft.Build.BuildEngine {
set {
if (FromXml)
itemElement.SetAttribute ("Include", value);
else if (HasParentItem) {
else if (HasParent) {
if (parent_item.child_items.Count > 1)
SplitParentItem ();
parent_item.Include = value;
@@ -457,7 +457,7 @@ namespace Microsoft.Build.BuildEngine {
get {
if (FromXml)
return itemElement.Name;
else if (HasParentItem)
else if (HasParent)
return parent_item.Name;
else
return name;
@@ -471,7 +471,7 @@ namespace Microsoft.Build.BuildEngine {
newElement.AppendChild (xe.Clone ());
itemElement.ParentNode.ReplaceChild (newElement, itemElement);
itemElement = newElement;
} else if (HasParentItem) {
} else if (HasParent) {
if (parent_item.child_items.Count > 1)
SplitParentItem ();
parent_item.Name = value;
@@ -484,7 +484,7 @@ namespace Microsoft.Build.BuildEngine {
get { return itemElement != null; }
}
internal bool HasParentItem {
internal bool HasParent {
get { return parent_item != null; }
}
@@ -494,7 +494,6 @@ namespace Microsoft.Build.BuildEngine {
internal BuildItemGroup ParentItemGroup {
get { return parent_item_group; }
set { parent_item_group = value; }
}
}
}
@@ -49,12 +49,7 @@ namespace Microsoft.Build.BuildEngine {
: this (null, null, null, false)
{
}
internal BuildItemGroup (Project project)
: this (null, project, null, false)
{
}
internal BuildItemGroup (XmlElement xmlElement, Project project, ImportedProject importedProject, bool readOnly)
{
this.buildItems = new List <BuildItem> ();
@@ -100,7 +95,6 @@ namespace Microsoft.Build.BuildEngine {
item = new BuildItem (element, this);
} else {
item = new BuildItem (itemName, itemInclude);
item.ParentItemGroup = this;
}
item.Evaluate (null, true);
@@ -181,7 +175,6 @@ namespace Microsoft.Build.BuildEngine {
{
BuildItem buildItem;
buildItem = new BuildItem (name, taskItem);
buildItem.ParentItemGroup = this;
buildItems.Add (buildItem);
}
@@ -276,11 +269,6 @@ namespace Microsoft.Build.BuildEngine {
internal Project ParentProject {
get { return parentProject; }
set {
if (parentProject != null)
throw new InvalidOperationException ("parentProject is already set");
parentProject = value;
}
}
internal bool FromXml {
@@ -74,7 +74,7 @@ namespace Microsoft.Build.BuildEngine {
this.propertyType = PropertyType.Normal;
this.parentProject = parentProject;
this.name = propertyElement.Name;
this.value = propertyElement.InnerXml;
this.value = propertyElement.InnerText;
this.isImported = false;
}
@@ -166,7 +166,7 @@ namespace Microsoft.Build.BuildEngine {
set {
this.@value = value;
if (FromXml) {
propertyElement.InnerXml = value;
propertyElement.InnerText = value;
} else {
finalValue = value;
}
@@ -1,52 +1,3 @@
2009-02-12 Jonathan Chambers <[email protected]>
* BuildProperty.cs: Value corresponds to XmlElement.InnerXml
no XmlElement.InnerText. This allows properties to be additional
xml elements.
2009-02-01 Ankit Jain <[email protected]>
* BuildEngine.cs (BuildProjectFile): Use
BuildSettings.DoNotResetPreviouslyBuiltTargets for building projects.
* Engine.cs (BuiltTargetsOutputByName): New. Table of targets already
built. Move logging of project start/finish to ..
* Project.cs: .. here. Build a target only if hasn't been built already.
Keep track of target outputs, and return those even if an already built
target has been invoked again.
Honor BuildSettings.None and DoNotResetPreviouslyBuiltTargets .
2009-01-31 Ankit Jain <[email protected]>
* BatchingImpl.cs: Split into ..
* BatchingImplBase.cs: .. this,
* TaskBatchingImpl.cs: .. this ..
* TargetBatchingImpl.cs: .. and this. Implement target batching here.
* Target.cs (DoBuild): Use TargetBatchingImpl for building.
(Log*): Move to TargetBatchingImpl .
(BuildTasks): New.
(Engine): New.
2009-01-30 Ankit Jain <[email protected]>
* TaskEngine.cs (GetObjectFromString): Empty value is allowed only for
arrays.
2009-01-29 Ankit Jain <[email protected]>
* BuildItem.cs (child_items): Change type from BuildItemGroup to
List<BuildItem>.
(HasParent): Rename to ..
(HasParentItem): .. this.
(ParentItemGroup): Add setter.
* BuildItemGroup.cs (.ctor): Add overload with @project param.
(AddNewItem):
(AddItem): Correctly set the ParentItemGroup for new build items.
(ParentProject): Add setter.
* Project.cs: Set the project for new BuildItemGroup instances.
* TaskEngine.cs (PublishItemGroup): Likewise.
2009-01-06 Ankit Jain <[email protected]>
* Project.cs (Build): Honor InitialTargets list.
@@ -49,7 +49,6 @@ namespace Microsoft.Build.BuildEngine {
List <ILogger> loggers;
//bool onlyLogCriticalEvents;
Dictionary <string, Project> projects;
Dictionary <string, ITaskItem[]> builtTargetsOutputByName;
static Engine globalEngine;
static Version version;
@@ -75,7 +74,6 @@ namespace Microsoft.Build.BuildEngine {
this.loggers = new List <ILogger> ();
this.buildStarted = false;
this.globalProperties = new BuildPropertyGroup ();
this.builtTargetsOutputByName = new Dictionary<string, ITaskItem[]> ();
RegisterDefaultTasks ();
}
@@ -119,13 +117,21 @@ namespace Microsoft.Build.BuildEngine {
IDictionary targetOutputs,
BuildSettings buildFlags)
{
bool result;
if (project == null)
throw new ArgumentException ("project");
if (targetNames == null)
return false;
StartBuild ();
return project.Build (targetNames, targetOutputs, buildFlags);
LogProjectStarted (project, targetNames);
result = project.Build (targetNames, targetOutputs);
LogProjectFinished (project, result);
return result;
}
[MonoTODO]
@@ -172,18 +178,25 @@ namespace Microsoft.Build.BuildEngine {
IDictionary targetOutputs,
BuildSettings buildFlags)
{
bool result;
Project project;
StartBuild ();
if (projects.ContainsKey (projectFile)) {
project = (Project) projects [projectFile];
LogProjectStarted (project, targetNames);
result = project.Build (targetNames, targetOutputs);
} else {
project = CreateNewProject ();
project.Load (projectFile);
LogProjectStarted (project, targetNames);
result = project.Build (targetNames, targetOutputs);
}
return project.Build (targetNames, targetOutputs, buildFlags);
LogProjectFinished (project, result);
return result;
}
void CheckBinPath ()
@@ -275,6 +288,28 @@ namespace Microsoft.Build.BuildEngine {
}
}
void LogProjectStarted (Project project, string [] targetNames)
{
ProjectStartedEventArgs psea;
if (targetNames == null || targetNames.Length == 0) {
if (project.DefaultTargets != String.Empty)
psea = new ProjectStartedEventArgs ("Project started.", null, project.FullFileName,
project.DefaultTargets, null, null);
else
psea = new ProjectStartedEventArgs ("Project started.", null, project.FullFileName, "default", null, null);
} else
psea = new ProjectStartedEventArgs ("Project started.", null, project.FullFileName, String.Join (";",
targetNames), null, null);
eventSource.FireProjectStarted (this, psea);
}
void LogProjectFinished (Project project, bool succeeded)
{
ProjectFinishedEventArgs pfea;
pfea = new ProjectFinishedEventArgs ("Project started.", null, project.FullFileName, succeeded);
eventSource.FireProjectFinished (this, pfea);
}
void LogBuildStarted ()
{
BuildStartedEventArgs bsea;
@@ -350,10 +385,6 @@ namespace Microsoft.Build.BuildEngine {
internal TaskDatabase DefaultTasks {
get { return defaultTasks; }
}
internal Dictionary<string, ITaskItem[]> BuiltTargetsOutputByName {
get { return builtTargetsOutputByName; }
}
}
}
@@ -71,7 +71,6 @@ namespace Microsoft.Build.BuildEngine {
XmlDocument xmlDocument;
bool unloaded;
bool initialTargetsBuilt;
List<string> builtTargetKeys;
static XmlNamespaceManager manager;
static string ns = "http://schemas.microsoft.com/developer/msbuild/2003";
@@ -252,26 +251,10 @@ namespace Microsoft.Build.BuildEngine {
IDictionary targetOutputs,
BuildSettings buildFlags)
{
bool result = false;
LogProjectStarted (targetNames);
try {
result = BuildInternal (targetNames, targetOutputs, buildFlags);
} finally {
LogProjectFinished (result);
}
return result;
}
bool BuildInternal (string [] targetNames,
IDictionary targetOutputs,
BuildSettings buildFlags)
{
CheckUnloaded ();
ParentEngine.StartBuild ();
if (buildFlags == BuildSettings.None)
Reevaluate ();
NeedToReevaluate ();
if (targetNames == null || targetNames.Length == 0) {
if (defaultTargets != null && defaultTargets.Length != 0)
@@ -308,20 +291,9 @@ namespace Microsoft.Build.BuildEngine {
return false;
}
string key = fullFileName + ":" + target;
ITaskItem[] outputs;
if (ParentEngine.BuiltTargetsOutputByName.TryGetValue (key, out outputs)) {
if (targetOutputs != null)
targetOutputs.Add (target, outputs);
LogTargetSkipped ();
return true;
}
if (!targets [target].Build ())
return false;
ParentEngine.BuiltTargetsOutputByName [key] = (ITaskItem[]) targets [target].Outputs.Clone ();
builtTargetKeys.Add (key);
if (targetOutputs != null)
targetOutputs.Add (target, targets [target].Outputs);
@@ -347,7 +319,7 @@ namespace Microsoft.Build.BuildEngine {
if (evaluatedItemsByName.ContainsKey (itemName))
return evaluatedItemsByName [itemName];
else
return new BuildItemGroup (this);
return new BuildItemGroup ();
}
public BuildItemGroup GetEvaluatedItemsByNameIgnoringCondition (string itemName)
@@ -360,7 +332,7 @@ namespace Microsoft.Build.BuildEngine {
if (evaluatedItemsByNameIgnoringCondition.ContainsKey (itemName))
return evaluatedItemsByNameIgnoringCondition [itemName];
else
return new BuildItemGroup (this);
return new BuildItemGroup ();
}
public string GetEvaluatedProperty (string propertyName)
@@ -454,7 +426,7 @@ namespace Microsoft.Build.BuildEngine {
if (itemToRemove == null)
throw new ArgumentNullException ("itemToRemove");
if (!itemToRemove.FromXml && !itemToRemove.HasParentItem)
if (!itemToRemove.FromXml && !itemToRemove.HasParent)
throw new InvalidOperationException ("The object passed in is not part of the project.");
BuildItemGroup big = itemToRemove.ParentItemGroup;
@@ -522,7 +494,7 @@ namespace Microsoft.Build.BuildEngine {
[MonoTODO]
public void ResetBuildStatus ()
{
Reevaluate ();
throw new NotImplementedException ();
}
public void Save (string projectFileName)
@@ -790,7 +762,6 @@ namespace Microsoft.Build.BuildEngine {
evaluatedItemsByName = new Dictionary <string, BuildItemGroup> (StringComparer.InvariantCultureIgnoreCase);
evaluatedItemsByNameIgnoringCondition = new Dictionary <string, BuildItemGroup> (StringComparer.InvariantCultureIgnoreCase);
evaluatedProperties = new BuildPropertyGroup (null, null, null, true);
RemoveBuiltTargets ();
InitializeProperties ();
@@ -801,16 +772,6 @@ namespace Microsoft.Build.BuildEngine {
usingTask.Evaluate ();
}
// Removes entries of all earlier built targets for this project
void RemoveBuiltTargets ()
{
if (builtTargetKeys != null)
foreach (string key in builtTargetKeys)
ParentEngine.BuiltTargetsOutputByName.Remove (key);
builtTargetKeys = new List<string> ();
}
void InitializeProperties ()
{
BuildProperty bp;
@@ -1034,15 +995,6 @@ namespace Microsoft.Build.BuildEngine {
return default (T);
}
void LogTargetSkipped ()
{
BuildMessageEventArgs bmea;
bmea = new BuildMessageEventArgs ("Target {0} skipped, as it has already been built.",
null, null, MessageImportance.Low);
ParentEngine.EventSource.FireMessageRaised (this, bmea);
}
public BuildPropertyGroup EvaluatedProperties {
get {
if (needToReevaluate) {
@@ -1155,29 +1107,6 @@ namespace Microsoft.Build.BuildEngine {
internal static string XmlNamespace {
get { return ns; }
}
void LogProjectStarted (string [] targetNames)
{
ProjectStartedEventArgs psea;
if (targetNames == null || targetNames.Length == 0) {
if (DefaultTargets != String.Empty)
psea = new ProjectStartedEventArgs ("Project started.", null, FullFileName,
DefaultTargets, null, null);
else
psea = new ProjectStartedEventArgs ("Project started.", null, FullFileName, "default", null, null);
} else
psea = new ProjectStartedEventArgs ("Project started.", null, FullFileName, String.Join (";",
targetNames), null, null);
ParentEngine.EventSource.FireProjectStarted (this, psea);
}
void LogProjectFinished (bool succeeded)
{
ProjectFinishedEventArgs pfea;
pfea = new ProjectFinishedEventArgs ("Project started.", null, FullFileName, succeeded);
ParentEngine.EventSource.FireProjectFinished (this, pfea);
}
}
}
@@ -37,7 +37,7 @@ using Microsoft.Build.Utilities;
namespace Microsoft.Build.BuildEngine {
public class Target : IEnumerable {
TargetBatchingImpl batchingImpl;
BatchingImpl batchingImpl;
BuildState buildState;
Engine engine;
ImportedProject importedProject;
@@ -64,7 +64,7 @@ namespace Microsoft.Build.BuildEngine {
this.onErrorElements = new List <XmlElement> ();
this.buildState = BuildState.NotStarted;
this.buildTasks = new List <BuildTask> ();
this.batchingImpl = new TargetBatchingImpl (project, this.targetElement);
this.batchingImpl = new BatchingImpl (project, this.targetElement);
bool onErrorFound = false;
foreach (XmlNode xn in targetElement.ChildNodes) {
@@ -171,16 +171,26 @@ namespace Microsoft.Build.BuildEngine {
bool DoBuild ()
{
bool executeOnErrors;
bool executeOnErrors = false;
bool result = true;
try {
result = batchingImpl.Build (this, out executeOnErrors);
} catch (Exception e) {
Console.WriteLine (e.ToString ());
throw;
LogTargetStarted ();
if (batchingImpl.BuildNeeded ()) {
foreach (BuildTask bt in buildTasks) {
result = batchingImpl.BatchBuildTask (bt);
if (!result && !bt.ContinueOnError) {
executeOnErrors = true;
break;
}
}
} else {
LogTargetSkipped ();
}
LogTargetFinished (result);
if (executeOnErrors == true)
ExecuteOnErrors ();
@@ -199,6 +209,29 @@ namespace Microsoft.Build.BuildEngine {
}
}
void LogTargetSkipped ()
{
BuildMessageEventArgs bmea;
bmea = new BuildMessageEventArgs (String.Format ("Skipping target \"{0}\" because its outputs are up-to-date.",
name), null, "MSBuild", MessageImportance.Normal);
engine.EventSource.FireMessageRaised (this, bmea);
}
void LogTargetStarted ()
{
TargetStartedEventArgs tsea;
string projectFile = project.FullFileName;
tsea = new TargetStartedEventArgs (String.Format ("Target {0} started.", name), null, name, projectFile, null);
engine.EventSource.FireTargetStarted (this, tsea);
}
void LogTargetFinished (bool succeeded)
{
TargetFinishedEventArgs tfea;
string projectFile = project.FullFileName;
tfea = new TargetFinishedEventArgs (String.Format ("Target {0} finished.", name), null, name, projectFile, null, succeeded);
engine.EventSource.FireTargetFinished (this, tfea);
}
public string Condition {
get { return targetElement.GetAttribute ("Condition"); }
@@ -221,14 +254,6 @@ namespace Microsoft.Build.BuildEngine {
internal Project Project {
get { return project; }
}
internal List<BuildTask> BuildTasks {
get { return buildTasks; }
}
internal Engine Engine {
get { return engine; }
}
internal BuildState BuildState {
get { return buildState; }
@@ -1,262 +0,0 @@
//
// TargetBatchingImpl.cs: Class that implements Target Batching Algorithm from the wiki.
//
// Author:
// Marek Sieradzki ([email protected])
// Ankit Jain ([email protected])
//
// (C) 2005 Marek Sieradzki
// Copyright 2008 Novell, Inc (http://www.novell.com)
// Copyright 2009 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#if NET_2_0
using System;
using System.IO;
using System.Collections.Generic;
using System.Xml;
using Microsoft.Build.Framework;
namespace Microsoft.Build.BuildEngine {
internal class TargetBatchingImpl : BatchingImplBase
{
string inputs;
string outputs;
public TargetBatchingImpl (Project project, XmlElement targetElement)
: base (project)
{
if (targetElement == null)
throw new ArgumentNullException ("targetElement");
inputs = targetElement.GetAttribute ("Inputs");
outputs = targetElement.GetAttribute ("Outputs");
}
public bool Build (Target target, out bool executeOnErrors)
{
executeOnErrors = false;
try {
if (!BuildTargetNeeded ()) {
LogTargetStarted (target);
LogTargetSkipped (target);
LogTargetFinished (target, true);
return true;
}
Init ();
ParseTargetAttributes (target);
BatchAndPrepareBuckets ();
return Run (target, out executeOnErrors);
} finally {
consumedItemsByName = null;
consumedMetadataReferences = null;
consumedQMetadataReferences = null;
consumedUQMetadataReferences = null;
batchedItemsByName = null;
commonItemsByName = null;
}
}
bool Run (Target target, out bool executeOnErrors)
{
executeOnErrors = false;
if (buckets.Count > 0)
return RunBatched (target, out executeOnErrors);
else
return RunUnbatched (target, out executeOnErrors);
}
bool RunBatched (Target target, out bool executeOnErrors)
{
bool result = true;
executeOnErrors = false;
foreach (Dictionary<string, BuildItemGroup> bucket in buckets) {
LogTargetStarted (target);
try {
project.SetBatchedItems (bucket, commonItemsByName);
if (!BuildTargetNeeded ()) {
LogTargetSkipped (target);
continue;
}
for (int i = 0; i < target.BuildTasks.Count; i ++) {
//required setting here, as batchtask.Run resets
//these to null before returning!
project.SetBatchedItems (bucket, commonItemsByName);
//FIXME: parsing attributes repeatedly
BuildTask task = target.BuildTasks [i];
result = new TaskBatchingImpl (project).Build (task, out executeOnErrors);
if (!result && !task.ContinueOnError) {
executeOnErrors = true;
break;
}
}
} finally {
LogTargetFinished (target, result);
}
}
project.SetBatchedItems (null, null);
return result;
}
bool RunUnbatched (Target target, out bool executeOnErrors)
{
bool result = true;
executeOnErrors = false;
LogTargetStarted (target);
try {
if (!BuildTargetNeeded ()) {
LogTargetSkipped (target);
LogTargetFinished (target, true);
return true;
}
foreach (BuildTask bt in target.BuildTasks) {
TaskBatchingImpl batchingImpl = new TaskBatchingImpl (project);
result = batchingImpl.Build (bt, out executeOnErrors);
if (!result && !bt.ContinueOnError) {
executeOnErrors = true;
break;
}
}
} finally {
LogTargetFinished (target, result);
}
return result;
}
// Parse target's Input and Output attributes to get list of referenced
// metadata and items to determine batching
void ParseTargetAttributes (Target target)
{
if (!String.IsNullOrEmpty (inputs))
ParseAttribute (inputs);
if (!String.IsNullOrEmpty (outputs))
ParseAttribute (outputs);
}
bool BuildTargetNeeded ()
{
ITaskItem [] inputFiles;
ITaskItem [] outputFiles;
DateTime oldestInput, youngestOutput;
if (String.IsNullOrEmpty (inputs.Trim ()))
return true;
if (String.IsNullOrEmpty (outputs.Trim ()))
return true;
Expression e = new Expression ();
e.Parse (inputs, true);
inputFiles = (ITaskItem[]) e.ConvertTo (project, typeof (ITaskItem[]));
e = new Expression ();
e.Parse (outputs, true);
outputFiles = (ITaskItem[]) e.ConvertTo (project, typeof (ITaskItem[]));
if (inputFiles == null || inputFiles.Length == 0)
return false;
//FIXME: if input specified, then output must also
// be there, add tests and confirm
if (outputFiles == null || outputFiles.Length == 0)
return false;
if (File.Exists (inputFiles [0].ItemSpec))
oldestInput = File.GetLastWriteTime (inputFiles [0].ItemSpec);
else
return true;
if (File.Exists (outputFiles [0].ItemSpec))
youngestOutput = File.GetLastWriteTime (outputFiles [0].ItemSpec);
else
return true;
foreach (ITaskItem item in inputFiles) {
string file = item.ItemSpec;
if (file.Trim () == String.Empty)
continue;
if (File.Exists (file.Trim ())) {
if (File.GetLastWriteTime (file.Trim ()) > oldestInput)
oldestInput = File.GetLastWriteTime (file.Trim ());
} else {
return true;
}
}
foreach (ITaskItem item in outputFiles) {
string file = item.ItemSpec;
if (file.Trim () == String.Empty)
continue;
if (File.Exists (file.Trim ())) {
if (File.GetLastWriteTime (file.Trim ()) < youngestOutput)
youngestOutput = File.GetLastWriteTime (file.Trim ());
} else
return true;
}
if (oldestInput > youngestOutput)
return true;
else
return false;
}
void LogTargetSkipped (Target target)
{
BuildMessageEventArgs bmea;
bmea = new BuildMessageEventArgs (String.Format ("Skipping target \"{0}\" because its outputs are up-to-date.",
target.Name), null, "MSBuild", MessageImportance.Normal);
target.Engine.EventSource.FireMessageRaised (this, bmea);
}
void LogTargetStarted (Target target)
{
TargetStartedEventArgs tsea;
string projectFile = project.FullFileName;
tsea = new TargetStartedEventArgs (String.Format ("Target {0} started.", target.Name), null, target.Name, projectFile, null);
target.Engine.EventSource.FireTargetStarted (this, tsea);
}
void LogTargetFinished (Target target, bool succeeded)
{
TargetFinishedEventArgs tfea;
string projectFile = project.FullFileName;
tfea = new TargetFinishedEventArgs (String.Format ("Target {0} finished.", target.Name), null, target.Name, projectFile, null, succeeded);
target.Engine.EventSource.FireTargetFinished (this, tfea);
}
}
}
#endif
@@ -1,104 +0,0 @@
//
// TaskBatchingImpl.cs: Class that implements Task Batching Algorithm from the wiki.
//
// Author:
// Marek Sieradzki ([email protected])
// Ankit Jain ([email protected])
//
// (C) 2005 Marek Sieradzki
// Copyright 2008 Novell, Inc (http://www.novell.com)
// Copyright 2009 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#if NET_2_0
using System;
using System.Collections.Generic;
using System.Xml;
namespace Microsoft.Build.BuildEngine {
internal class TaskBatchingImpl : BatchingImplBase
{
public TaskBatchingImpl (Project project)
: base (project)
{
}
public bool Build (BuildTask buildTask, out bool executeOnErrors)
{
executeOnErrors = false;
try {
Init ();
// populate list of referenced items and metadata
ParseTaskAttributes (buildTask);
if (consumedMetadataReferences.Count == 0) {
// No batching required
if (ConditionParser.ParseAndEvaluate (buildTask.Condition, project))
return buildTask.Execute ();
else // skipped, it should be logged
return true;
}
BatchAndPrepareBuckets ();
return Run (buildTask, out executeOnErrors);
} finally {
consumedItemsByName = null;
consumedMetadataReferences = null;
consumedQMetadataReferences = null;
consumedUQMetadataReferences = null;
batchedItemsByName = null;
commonItemsByName = null;
}
}
bool Run (BuildTask buildTask, out bool executeOnErrors)
{
executeOnErrors = false;
// Run the task in batches
bool retval = true;
foreach (Dictionary<string, BuildItemGroup> bucket in buckets) {
project.SetBatchedItems (bucket, commonItemsByName);
if (ConditionParser.ParseAndEvaluate (buildTask.Condition, project)) {
if (! (retval = buildTask.Execute ()))
break;
}
}
project.SetBatchedItems (null, null);
return retval;
}
// Parse task attributes to get list of referenced metadata and items
// to determine batching
//
void ParseTaskAttributes (BuildTask buildTask)
{
foreach (XmlAttribute attrib in buildTask.TaskElement.Attributes)
ParseAttribute (attrib.Value);
}
}
}
#endif
@@ -162,7 +162,6 @@ namespace Microsoft.Build.BuildEngine {
string itemName)
{
BuildItemGroup newItems = ChangeType.ToBuildItemGroup (o, propertyInfo.PropertyType, itemName);
newItems.ParentProject = parentProject;
if (parentProject.EvaluatedItemsByName.ContainsKey (itemName)) {
BuildItemGroup big = parentProject.EvaluatedItemsByName [itemName];
@@ -182,11 +181,8 @@ namespace Microsoft.Build.BuildEngine {
e = new Expression ();
e.Parse (raw, true);
// Empty contents allowed only for arrays
// See TestRequiredTask_*
if (!type.IsArray &&
(string) e.ConvertTo (parentProject, typeof (string)) == String.Empty)
if ((string) e.ConvertTo (parentProject, typeof (string)) == String.Empty)
return null;
result = e.ConvertTo (parentProject, type);
@@ -3,9 +3,7 @@
Assembly/AssemblyInfo.cs
../Microsoft.Build.Framework/Mono.XBuild.Framework/AssemblyLoadInfo.cs
../Microsoft.Build.Utilities/Mono.XBuild.Utilities/ReservedNameUtils.cs
Microsoft.Build.BuildEngine/BatchingImplBase.cs
Microsoft.Build.BuildEngine/TargetBatchingImpl.cs
Microsoft.Build.BuildEngine/TaskBatchingImpl.cs
Microsoft.Build.BuildEngine/BatchingImpl.cs
Microsoft.Build.BuildEngine/BuildChoose.cs
Microsoft.Build.BuildEngine/BuildEngine.cs
Microsoft.Build.BuildEngine/BuildItem.cs
@@ -1,4 +1,3 @@
Microsoft.Build.BuildEngine/BuildChooseTest.cs
Microsoft.Build.BuildEngine/BuildItemGroupCollectionTest.cs
Microsoft.Build.BuildEngine/BuildItemGroupTest.cs
Microsoft.Build.BuildEngine/BuildItemTest.cs
@@ -1,287 +0,0 @@
//
// BuildChoose.cs
//
// Author:
// Jonathan Chambers ([email protected])
//
// (C) 2009 Jonathan Chambers
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
using System;
using System.Collections;
using Microsoft.Build.BuildEngine;
using NUnit.Framework;
namespace MonoTests.Microsoft.Build.BuildEngine {
[TestFixture]
public class BuildChooseTest {
[Test]
[Category ("NotWorking")]
public void TestEmptyWhen () {
Engine engine;
Project project;
BuildItemGroup[] groups = new BuildItemGroup[1];
string documentString = @"
<Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
<Choose>
<When Condition=""'$(Configuration)' == ''"">
<ItemGroup>
<A Include='a' />
</ItemGroup>
</When>
</Choose>
</Project>
";
engine = new Engine (Consts.BinPath);
project = engine.CreateNewProject ();
project.LoadXml (documentString);
Assert.AreEqual (1, project.ItemGroups.Count, "A1");
Assert.AreEqual (0, project.PropertyGroups.Count, "A2");
Assert.AreEqual (1, project.EvaluatedItems.Count, "A3");
Assert.AreEqual (1, project.EvaluatedItemsIgnoringCondition.Count, "A4");
}
[Test]
[Category ("NotWorking")]
public void TestFalseWhen () {
Engine engine;
Project project;
BuildItemGroup[] groups = new BuildItemGroup[1];
string documentString = @"
<Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
<Choose>
<When Condition=""'$(Configuration)' == 'False'"">
<ItemGroup>
<A Include='a' />
</ItemGroup>
</When>
</Choose>
</Project>
";
engine = new Engine (Consts.BinPath);
project = engine.CreateNewProject ();
project.LoadXml (documentString);
Assert.AreEqual (1, project.ItemGroups.Count, "A1");
Assert.AreEqual (0, project.PropertyGroups.Count, "A2");
Assert.AreEqual (0, project.EvaluatedItems.Count, "A3");
Assert.AreEqual (0, project.EvaluatedItemsIgnoringCondition.Count, "A4");
}
[Test]
[Category ("NotWorking")]
public void TestMultipleTrueWhen () {
Engine engine;
Project project;
BuildItemGroup[] groups = new BuildItemGroup[1];
string documentString = @"
<Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
<Choose>
<When Condition=""'$(Configuration)' == ''"">
<ItemGroup>
<A Include='a' />
</ItemGroup>
</When>
<When Condition=""'$(Configuration)' == ''"">
<ItemGroup>
<B Include='a' />
</ItemGroup>
</When>
</Choose>
</Project>
";
engine = new Engine (Consts.BinPath);
project = engine.CreateNewProject ();
project.LoadXml (documentString);
Assert.AreEqual (2, project.ItemGroups.Count, "A1");
Assert.AreEqual (0, project.PropertyGroups.Count, "A2");
Assert.AreEqual (1, project.EvaluatedItems.Count, "A3");
Assert.AreEqual ("A", project.EvaluatedItems[0].Name, "A4");
Assert.AreEqual (1, project.EvaluatedItemsIgnoringCondition.Count, "A5");
}
[Test]
[Category ("NotWorking")]
public void TestMultipleFalseWhen () {
Engine engine;
Project project;
BuildItemGroup[] groups = new BuildItemGroup[1];
string documentString = @"
<Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
<Choose>
<When Condition=""'$(Configuration)' == 'False'"">
<ItemGroup>
<A Include='a' />
</ItemGroup>
</When>
<When Condition=""'$(Configuration)' == 'False'"">
<ItemGroup>
<B Include='a' />
</ItemGroup>
</When>
</Choose>
</Project>
";
engine = new Engine (Consts.BinPath);
project = engine.CreateNewProject ();
project.LoadXml (documentString);
Assert.AreEqual (2, project.ItemGroups.Count, "A1");
Assert.AreEqual (0, project.PropertyGroups.Count, "A2");
Assert.AreEqual (0, project.EvaluatedItems.Count, "A3");
Assert.AreEqual (0, project.EvaluatedItemsIgnoringCondition.Count, "A4");
}
[Test]
[Category ("NotWorking")]
[ExpectedException (typeof (InvalidProjectFileException))]
public void TestMissingWhen () {
Engine engine;
Project project;
BuildItemGroup[] groups = new BuildItemGroup[1];
// a <Choose> requires at least one <When>
string documentString = @"
<Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
<Choose>
<Otherwise>
<ItemGroup>
<A Include='a' />
</ItemGroup>
</Otherwise>
</Choose>
</Project>
";
engine = new Engine (Consts.BinPath);
project = engine.CreateNewProject ();
project.LoadXml (documentString);
}
[Test]
[Category ("NotWorking")]
[ExpectedException (typeof (InvalidProjectFileException))]
public void TestMissingConditionWhen () {
Engine engine;
Project project;
BuildItemGroup[] groups = new BuildItemGroup[1];
// a <When> requires a Condition
string documentString = @"
<Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
<Choose>
<When>
<ItemGroup>
<A Include='a' />
</ItemGroup>
</When>
</Choose>
</Project>
";
engine = new Engine (Consts.BinPath);
project = engine.CreateNewProject ();
project.LoadXml (documentString);
}
[Test]
[Category ("NotWorking")]
public void TestWhenOtherwise1 () {
Engine engine;
Project project;
BuildItemGroup[] groups = new BuildItemGroup[1];
string documentString = @"
<Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
<Choose>
<When Condition=""'$(Configuration)' == ''"">
<ItemGroup>
<A Include='a' />
</ItemGroup>
</When>
<Otherwise>
<ItemGroup>
<B Include='a' />
</ItemGroup>
</Otherwise>
</Choose>
</Project>
";
engine = new Engine (Consts.BinPath);
project = engine.CreateNewProject ();
project.LoadXml (documentString);
Assert.AreEqual (2, project.ItemGroups.Count, "A1");
Assert.AreEqual (0, project.PropertyGroups.Count, "A2");
Assert.AreEqual (1, project.EvaluatedItems.Count, "A3");
Assert.AreEqual ("A", project.EvaluatedItems[0].Name, "A4");
Assert.AreEqual (1, project.EvaluatedItemsIgnoringCondition.Count, "A5");
}
[Test]
[Category ("NotWorking")]
public void TestWhenOtherwise2 () {
Engine engine;
Project project;
BuildItemGroup[] groups = new BuildItemGroup[1];
string documentString = @"
<Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
<Choose>
<When Condition=""'$(Configuration)' == 'False'"">
<ItemGroup>
<A Include='a' />
</ItemGroup>
</When>
<Otherwise>
<ItemGroup>
<B Include='a' />
</ItemGroup>
</Otherwise>
</Choose>
</Project>
";
engine = new Engine (Consts.BinPath);
project = engine.CreateNewProject ();
project.LoadXml (documentString);
Assert.AreEqual (2, project.ItemGroups.Count, "A1");
Assert.AreEqual (0, project.PropertyGroups.Count, "A2");
Assert.AreEqual (1, project.EvaluatedItems.Count, "A3");
Assert.AreEqual ("B", project.EvaluatedItems[0].Name, "A4");
Assert.AreEqual (1, project.EvaluatedItemsIgnoringCondition.Count, "A5");
}
}
}
@@ -802,50 +802,5 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
project.ItemGroups.CopyTo (groups, 0);
Assert.AreEqual (1, groups [0].Count, "A3");
}
[Test]
public void TestBuildItemTransform ()
{
string projectText = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
<UsingTask TaskName='BatchingTestTask' AssemblyFile='Test\resources\TestTasks.dll' />
<ItemGroup>
<Foo Include='abc'/>
<Foo Include='def'/>
</ItemGroup>
<PropertyGroup>
<FooProp>PropValue/</FooProp>
</PropertyGroup>
<Target Name=""main"">
<CreateItem Include=""@(Foo)"">
<Output TaskParameter =""Include"" ItemName=""SyntheticFoo""/>
</CreateItem>
<BatchingTestTask
TaskItemsOutput=""@(SyntheticFoo->'$(FooProp)%(Identity).txt')"">
<Output TaskParameter='TaskItemsOutput' ItemName='I0' />
</BatchingTestTask>
</Target>
</Project>";
Engine engine = new Engine (Consts.BinPath);
MonoTests.Microsoft.Build.Tasks.TestMessageLogger logger =
new MonoTests.Microsoft.Build.Tasks.TestMessageLogger ();
engine.RegisterLogger (logger);
Project project = engine.CreateNewProject ();
project.LoadXml (projectText);
bool result = project.Build ("main");
if (!result) {
logger.DumpMessages ();
Assert.Fail ("Build failed");
}
BuildItemGroup grp = project.GetEvaluatedItemsByName ("I0");
Assert.AreEqual (2, grp.Count, "A1");
Assert.AreEqual ("PropValue/abc.txt", grp [0].FinalItemSpec, "A2");
Assert.AreEqual ("PropValue/def.txt", grp [1].FinalItemSpec, "A3");
}
}
}
@@ -347,37 +347,5 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
node = xd.SelectSingleNode ("tns:Project/tns:PropertyGroup/tns:Name", TestNamespaceManager.NamespaceManager);
Assert.AreEqual ("AnotherValue", node.InnerText, "A1");
}
[Test]
public void TestValueXml ()
{
BuildPropertyGroup [] bpgs = new BuildPropertyGroup [1];
BuildProperty [] props;
XmlDocument xd;
XmlNode node;
string documentString = @"
<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
<PropertyGroup>
<Name>Value</Name>
</PropertyGroup>
</Project>
";
engine = new Engine (Consts.BinPath);
project = engine.CreateNewProject ();
project.LoadXml (documentString);
project.PropertyGroups.CopyTo (bpgs, 0);
bpgs[0].AddNewProperty("XmlProp", "<XmlStuff></XmlStuff>");
xd = new XmlDocument ();
xd.LoadXml (project.Xml);
Console.WriteLine(project.Xml);
node = xd.SelectSingleNode ("tns:Project/tns:PropertyGroup/tns:XmlProp/tns:XmlStuff", TestNamespaceManager.NamespaceManager);
Assert.IsNotNull (node, "A1");
}
}
}
@@ -1,30 +1,3 @@
2009-02-15 Jonathan Chambers <[email protected]>
* BuildChooseTest.cs (TestValueXml): Add tests for Choose.
Currently not working.
2009-02-12 Jonathan Chambers <[email protected]>
* BuildPropertyTest.cs (TestValueXml): New.
2009-02-01 Ankit Jain <[email protected]>
* ProjectTest.cs (TestBuild[23]): Check number of task started/finished
events.
(TestResetBuildStat): Remove "NotWorking".
(TestBuild4): Likewise. Check number of task started/finished events.
* TargetTest.cs (TestTargetOutputs1): New.
2009-01-30 Ankit Jain <[email protected]>
* ProjectTest.cs (TestRequiredTask_*): New.
(TestBatchedMetadataRef5): New.
2009-01-29 Ankit Jain <[email protected]>
* BuildItemTest.cs (TestBuildItemTransform): New.
2009-01-06 Ankit Jain <[email protected]>
* ProjectTest.cs (TestInitialTargets): New.
@@ -36,8 +36,6 @@ using Microsoft.Build.Utilities;
using NUnit.Framework;
using System.Text;
using MBT = MonoTests.Microsoft.Build.Tasks;
namespace MonoTests.Microsoft.Build.BuildEngine {
class TestLogger : Logger {
@@ -373,14 +371,14 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
string documentString = @"
<Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
<Target Name='T'>
<Target Name='T' Inputs='Test\resources\TestTasks.cs' Outputs='Test\resources\TestTasks.dll'>
<Message Text='text' />
</Target>
</Project>
";
engine = new Engine (Consts.BinPath);
MBT.TestMessageLogger tl = new MBT.TestMessageLogger();
TestLogger tl = new TestLogger ();
engine.RegisterLogger (tl);
project = engine.CreateNewProject ();
project.LoadXml (documentString);
@@ -388,10 +386,8 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
project.Build ("T");
project.Build ("T");
Assert.AreEqual (2, tl.TargetStarted, "A1");
Assert.AreEqual (2, tl.TargetFinished, "A2");
Assert.AreEqual (2, tl.TaskStarted, "A3");
Assert.AreEqual (2, tl.TaskFinished, "A4");
Assert.AreEqual (2, tl.TargetStartedEvents, "A1");
Assert.AreEqual (2, tl.TargetFinishedEvents, "A2");
}
[Test]
@@ -402,14 +398,14 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
string documentString = @"
<Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
<Target Name='T'>
<Target Name='T' Inputs='Test\resources\TestTasks.cs' Outputs='Test\resources\TestTasks.dll'>
<Message Text='text' />
</Target>
</Project>
";
engine = new Engine (Consts.BinPath);
MBT.TestMessageLogger tl = new MBT.TestMessageLogger ();
TestLogger tl = new TestLogger ();
engine.RegisterLogger (tl);
project = engine.CreateNewProject ();
project.LoadXml (documentString);
@@ -417,13 +413,12 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
project.Build (new string [1] { "T" }, null, BuildSettings.None);
project.Build (new string [1] { "T" }, null, BuildSettings.None);
Assert.AreEqual (2, tl.TargetStarted, "A1");
Assert.AreEqual (2, tl.TargetFinished, "A2");
Assert.AreEqual (2, tl.TaskStarted, "A3");
Assert.AreEqual (2, tl.TaskFinished, "A4");
Assert.AreEqual (2, tl.TargetStartedEvents, "A1");
Assert.AreEqual (2, tl.TargetFinishedEvents, "A2");
}
[Test]
[Category ("NotWorking")]
public void TestBuild4 ()
{
Engine engine;
@@ -431,14 +426,14 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
string documentString = @"
<Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
<Target Name='T'>
<Target Name='T' Inputs='Test\resources\TestTasks.cs' Outputs='Test\resources\TestTasks.dll'>
<Message Text='text' />
</Target>
</Project>
";
engine = new Engine (Consts.BinPath);
MBT.TestMessageLogger tl = new MBT.TestMessageLogger ();
TestLogger tl = new TestLogger ();
engine.RegisterLogger (tl);
project = engine.CreateNewProject ();
project.LoadXml (documentString);
@@ -446,10 +441,8 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
project.Build (new string [1] { "T" }, null, BuildSettings.DoNotResetPreviouslyBuiltTargets);
project.Build (new string [1] { "T" }, null, BuildSettings.DoNotResetPreviouslyBuiltTargets);
Assert.AreEqual (1, tl.TargetStarted, "A1");
Assert.AreEqual (1, tl.TargetFinished, "A2");
Assert.AreEqual (1, tl.TaskStarted, "A3");
Assert.AreEqual (1, tl.TaskFinished, "A4");
Assert.AreEqual (1, tl.TargetStartedEvents, "A1");
Assert.AreEqual (1, tl.TargetFinishedEvents, "A2");
}
[Test]
@@ -1044,6 +1037,7 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
}
[Test]
[Category ("NotWorking")]
public void TestResetBuildStatus ()
{
Engine engine;
@@ -1450,42 +1444,6 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
Assert.AreEqual (0, include.Count, "A2");
}
[Test]
public void TestBatchedMetadataRef5 ()
{
string projectString = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
<UsingTask TaskName=""BatchingTestTask"" AssemblyFile=""Test/resources/TestTasks.dll"" />
<ItemGroup>
<Coll1 Include=""A1""><Name>Abc</Name></Coll1>
<Coll1 Include=""A2""><Name>Def</Name></Coll1>
<Coll1 Include=""A3""><Name>Xyz</Name></Coll1>
<Coll2 Include=""B1""><Name>Bar</Name></Coll2>
</ItemGroup>
<Target Name=""ShowMessage"">
<Message Text=""Coll1: @(Coll1->'Foo%(Name)Bar')"" />
<BatchingTestTask Sources=""@(Coll1->'Foo%(Name)Bar')"" >
<Output TaskParameter=""Output"" ItemName=""FinalList"" />
</BatchingTestTask>
</Target>
</Project>";
Engine engine = new Engine (Consts.BinPath);
Project project = engine.CreateNewProject ();
MonoTests.Microsoft.Build.Tasks.TestMessageLogger logger =
new MonoTests.Microsoft.Build.Tasks.TestMessageLogger ();
engine.RegisterLogger (logger);
project.LoadXml (projectString);
bool result = project.Build ("ShowMessage");
if (!result) {
logger.DumpMessages ();
Assert.Fail ("A1: Build failed");
}
logger.DumpMessages ();
BuildItemGroup include = project.GetEvaluatedItemsByName ("FinalList");
Assert.AreEqual (3, include.Count, "A2");
}
[Test]
public void TestInitialTargets ()
{
@@ -1517,94 +1475,6 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
}
}
[Test]
public void TestRequiredTask_String1 ()
{
CheckProjectForRequiredTests ("RequiredTestTask_String", "@(NonExistant)",
false, "Should've failed: No value specified for required field - 'Property' of RequiredTestTask_String");
}
[Test]
public void TestRequiredTask_String2 ()
{
CheckProjectForRequiredTests ("RequiredTestTask_String", "$(NonExistant)",
false, "Should've failed: No value specified for required field - 'Property' of RequiredTestTask_String");
}
[Test]
public void TestRequiredTask_TaskItem1 ()
{
Project p = CheckProjectForRequiredTests ("RequiredTestTask_TaskItem", "@(NonExistant)",
false, "Should've failed: No value specified for required field - 'Property' of RequiredTestTask_TaskItem");
}
[Test]
public void TestRequiredTask_TaskItem2 ()
{
Project p = CheckProjectForRequiredTests ("RequiredTestTask_TaskItem", "$(NonExistant)",
false, "Should've failed: No value specified for required field - 'Property' of RequiredTestTask_TaskItem");
}
[Test]
public void TestRequiredTask_TaskItemArray1 ()
{
Project p = CheckProjectForRequiredTests ("RequiredTestTask_TaskItems", "@(NonExistant)",
true, "Build failed");
BuildItemGroup group = p.GetEvaluatedItemsByName ("OutItem");
Assert.AreEqual (1, group.Count, "A2");
Assert.AreEqual ("count: 0", group [0].FinalItemSpec, "A3");
}
[Test]
public void TestRequiredTask_TaskItemArray2 ()
{
Project p = CheckProjectForRequiredTests ("RequiredTestTask_TaskItems", "$(NonExistant)",
true, "Build failed");
BuildItemGroup group = p.GetEvaluatedItemsByName ("OutItem");
Assert.AreEqual (1, group.Count, "A2");
Assert.AreEqual ("count: 0", group [0].FinalItemSpec, "A3");
}
[Test]
public void TestRequiredTask_TaskItemArray3 ()
{
Project p = CheckProjectForRequiredTests ("RequiredTestTask_IntArray", "$(NonExistant)",
true, "Build failed");
BuildItemGroup group = p.GetEvaluatedItemsByName ("OutItem");
Assert.AreEqual (1, group.Count, "A2");
Assert.AreEqual ("count: 0", group [0].FinalItemSpec, "A3");
}
Project CheckProjectForRequiredTests (string taskname, string property_arg, bool expected_result, string error_msg)
{
string projectString = String.Format (@"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
<UsingTask TaskName=""{0}"" AssemblyFile=""Test/resources/TestTasks.dll"" />
<Target Name=""foo"">
<{0} Property=""{1}"">
<Output TaskParameter=""Output"" ItemName=""OutItem""/>
</{0}>
</Target>
</Project>", taskname, property_arg);
Engine engine = new Engine (Consts.BinPath);
MonoTests.Microsoft.Build.Tasks.TestMessageLogger logger =
new MonoTests.Microsoft.Build.Tasks.TestMessageLogger ();
engine.RegisterLogger (logger);
Project project = engine.CreateNewProject ();
project.LoadXml (projectString);
try {
Assert.AreEqual (expected_result, project.Build (), error_msg);
} finally {
logger.DumpMessages ();
}
return project;
}
static void CheckBuildItem (BuildItem item, string name, string [,] metadata, string finalItemSpec, string prefix)
{
Assert.AreEqual (name, item.Name, prefix + "#1");
@@ -234,81 +234,5 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
project.Targets.CopyTo (t, 0);
t [0].RemoveTask (null);
}
[Test]
public void TestTargetOutputs1 ()
{
Engine engine;
Project project;
string documentString = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
<ItemGroup>
<fruit Include=""apple""/>
<fruit Include=""rhubarb""/>
<fruit Include=""apricot""/>
</ItemGroup>
<Target Name=""Main"">
<CallTarget Targets=""foo"">
<Output TaskParameter=""TargetOutputs"" ItemName=""AllOut""/>
</CallTarget>
<CallTarget Targets=""foo"">
<Output TaskParameter=""TargetOutputs"" ItemName=""AllOut""/>
</CallTarget>
<Message Text=""AllOut: @(AllOut)""/>
</Target>
<Target Name=""foo"" Outputs=""@(FooItem)"">
<Message Text=""foo called""/>
<CreateItem Include=""%(fruit.Identity)"">
<Output TaskParameter=""Include"" ItemName=""FooItem""/>
</CreateItem>
<Message Text=""FooItem: @(FooItem)""/>
</Target>
</Project>";
engine = new Engine (Consts.BinPath);
project = engine.CreateNewProject ();
project.LoadXml (documentString);
MonoTests.Microsoft.Build.Tasks.TestMessageLogger logger =
new MonoTests.Microsoft.Build.Tasks.TestMessageLogger ();
engine.RegisterLogger (logger);
bool result = project.Build ("Main");
if (!result) {
logger.DumpMessages ();
Assert.Fail ("Build failed");
}
try {
Assert.AreEqual (3, logger.NormalMessageCount, "Expected number of messages");
CheckLoggedMessageHead (logger, "foo called", "A1");
CheckLoggedMessageHead (logger, "FooItem: apple;rhubarb;apricot", "A2");
CheckLoggedMessageHead (logger, "AllOut: apple;rhubarb;apricot;apple;rhubarb;apricot", "A3");
Assert.AreEqual (0, logger.NormalMessageCount, "Extra messages found");
Assert.AreEqual (2, logger.TargetStarted, "TargetStarted count");
Assert.AreEqual (2, logger.TargetFinished, "TargetFinished count");
Assert.AreEqual (8, logger.TaskStarted, "TaskStarted count");
Assert.AreEqual (8, logger.TaskFinished, "TaskFinished count");
} catch (AssertionException) {
logger.DumpMessages ();
throw;
}
}
void CheckLoggedMessageHead (MonoTests.Microsoft.Build.Tasks.TestMessageLogger logger, string expected, string id)
{
string actual;
int result = logger.CheckHead (expected, MessageImportance.Normal, out actual);
if (result == 1)
Assert.Fail ("{0}: Expected message '{1}' was not emitted.", id, expected);
if (result == 2)
Assert.AreEqual (expected, actual, id);
}
}
}
@@ -1,13 +1,3 @@
2009-01-30 Ankit Jain <[email protected]>
* TestTasks.cs (RequiredTestTask): Rename to ..
(RequiredTestTask_TaskItems): .. this.
(RequiredTestTask_*): New types.
2009-01-29 Ankit Jain <[email protected]>
* TestTasks.cs (BatchingTestTask.TaskItemsOutput): New.
2008-12-30 Ankit Jain <[email protected]>
* TestTasks.cs (BatchingTestTask): Add specific properties
@@ -41,94 +41,18 @@ public class OutputTestTask : Task {
}
}
public class RequiredTestTask_TaskItems : Task {
string output;
public class RequiredTestTask : Task {
public override bool Execute ()
{
output = items == null ? "null" : "count: " + items.Length.ToString ();
return true;
}
ITaskItem [] items;
[Required]
public ITaskItem[] Property {
set { items = value; }
}
[Output]
public string Output
{
get { return output; }
}
}
public class RequiredTestTask_TaskItem : Task
{
string output;
public override bool Execute ()
{
output = item == null ? "null" : "not null: " + item.ItemSpec;
return true;
}
ITaskItem item;
[Required]
public ITaskItem Property
{
set { item = value; }
}
[Output]
public string Output
{
get { return output; }
}
}
public class RequiredTestTask_String : Task
{
string output;
public override bool Execute ()
{
output = property == null ? "null" : property.Length.ToString ();
return true;
}
string property;
[Required]
public string Property
{
public string Property {
set { property = value; }
}
[Output]
public string Output
{
get { return output; }
}
}
public class RequiredTestTask_IntArray: Task
{
string output;
public override bool Execute ()
{
output = items == null ? "null" : "count: " + items.Length.ToString ();
return true;
}
int[] items;
[Required]
public int[] Property
{
set { items = value; }
}
[Output]
public string Output
{
get { return output; }
}
}
@@ -269,13 +193,5 @@ public class BatchingTestTask : Task
{
get { return strings; }
}
[Output]
public ITaskItem [] TaskItemsOutput
{
get { return sources; }
set { sources = value; }
}
}
@@ -3,10 +3,8 @@
//
// Author:
// Marek Sieradzki ([email protected])
// Ankit Jain ([email protected])
//
// (C) 2006 Marek Sieradzki
// Copyright 2009 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
@@ -41,14 +39,12 @@ namespace Microsoft.Build.Tasks {
internal class AssemblyResolver {
// name -> (version -> assemblypath)
Dictionary<string, TargetFrameworkAssemblies> target_framework_cache;
Dictionary<string, Dictionary<Version, string>> gac;
Dictionary <string, Dictionary <Version, string>> gac;
TaskLoggingHelper log;
public AssemblyResolver ()
{
gac = new Dictionary<string, Dictionary<Version, string>> ();
target_framework_cache = new Dictionary <string, TargetFrameworkAssemblies> ();
gac = new Dictionary <string, Dictionary <Version, string>> ();
GatherGacAssemblies ();
}
@@ -92,98 +88,71 @@ namespace Microsoft.Build.Tasks {
}
}
public string FindInTargetFramework (ITaskItem reference, string framework_dir)
public string ResolveAssemblyReference (ITaskItem reference)
{
AssemblyName key_aname = new AssemblyName (reference.ItemSpec);
TargetFrameworkAssemblies gac_asm;
if (!target_framework_cache.TryGetValue (framework_dir, out gac_asm)) {
// fill gac_asm
gac_asm = target_framework_cache [framework_dir] = PopulateTargetFrameworkAssemblies (framework_dir);
}
AssemblyName name = null;
string resolved = null;
KeyValuePair<AssemblyName, string> pair;
if (gac_asm.NameToAssemblyNameCache.TryGetValue (key_aname.Name, out pair)) {
if (AssemblyNamesCompatible (key_aname, pair.Key, false))
return pair.Value;
name = new AssemblyName (reference.ItemSpec);
if (reference.GetMetadata ("HintPath") != String.Empty) {
bool specificVersion;
if (reference.GetMetadata ("SpecificVersion") != String.Empty) {
specificVersion = Boolean.Parse (reference.GetMetadata ("SpecificVersion"));
} else {
specificVersion = IsStrongNamed (name);
}
resolved = ResolveHintPathReference (name, reference.GetMetadata ("HintPath"), specificVersion);
}
return null;
if (resolved == null)
resolved = ResolveGacReference (name, gac);
return resolved;
}
public string FindInDirectory (ITaskItem reference, string directory)
{
AssemblyName key_aname = new AssemblyName (reference.ItemSpec);
foreach (string file in Directory.GetFiles (directory, "*.dll")) {
AssemblyName found = AssemblyName.GetAssemblyName (file);
if (AssemblyNamesCompatible (key_aname, found, false))
return file;
}
return null;
}
TargetFrameworkAssemblies PopulateTargetFrameworkAssemblies (string directory)
{
TargetFrameworkAssemblies gac_asm = new TargetFrameworkAssemblies (directory);
foreach (string file in Directory.GetFiles (directory, "*.dll")) {
AssemblyName aname = AssemblyName.GetAssemblyName (file);
gac_asm.NameToAssemblyNameCache [aname.Name] =
new KeyValuePair<AssemblyName, string> (aname, file);
}
return gac_asm;
}
public string ResolveGacReference (ITaskItem reference)
string ResolveGacReference (AssemblyName name, Dictionary <string, Dictionary <Version, string>> dic)
{
// FIXME: deal with SpecificVersion=False
AssemblyName name = new AssemblyName (reference.ItemSpec);
if (!gac.ContainsKey (name.Name))
if (!dic.ContainsKey (name.Name))
return null;
if (name.Version != null) {
if (!gac [name.Name].ContainsKey (name.Version))
if (!dic [name.Name].ContainsKey (name.Version))
return null;
else
return gac [name.Name] [name.Version];
return dic [name.Name] [name.Version];
}
Version [] versions = new Version [gac [name.Name].Keys.Count];
gac [name.Name].Keys.CopyTo (versions, 0);
Version [] versions = new Version [dic [name.Name].Keys.Count];
dic [name.Name].Keys.CopyTo (versions, 0);
Array.Sort (versions, (IComparer <Version>) null);
Version highest = versions [versions.Length - 1];
return gac [name.Name] [highest];
return dic [name.Name] [highest];
}
public string ResolveHintPathReference (ITaskItem reference)
string ResolveHintPathReference (AssemblyName name, string hintpath, bool specificVersion)
{
AssemblyName name = new AssemblyName (reference.ItemSpec);
string resolved = null;
AssemblyName found;
string ret = null;
string hintpath = reference.GetMetadata ("HintPath");
if (String.IsNullOrEmpty (hintpath))
return null;
bool specificVersion;
if (!String.IsNullOrEmpty (reference.GetMetadata ("SpecificVersion")))
specificVersion = Boolean.Parse (reference.GetMetadata ("SpecificVersion"));
else
specificVersion = IsStrongNamed (name);
if (!File.Exists (hintpath)) {
if (!File.Exists (hintpath))
log.LogMessage (MessageImportance.Low, "HintPath {0} does not exist.", hintpath);
return null;
}
try {
AssemblyName found = AssemblyName.GetAssemblyName (hintpath);
found = AssemblyName.GetAssemblyName (hintpath);
if (AssemblyNamesCompatible (name, found, specificVersion))
resolved = hintpath;
ret = hintpath;
else
log.LogMessage (MessageImportance.Low, "Assembly names are not compatible.");
} catch {
}
return resolved;
return ret;
}
static bool AssemblyNamesCompatible (AssemblyName a, AssemblyName b, bool specificVersion)
@@ -191,7 +160,7 @@ namespace Microsoft.Build.Tasks {
if (a.Name != b.Name)
return false;
if (a.CultureInfo != null && !a.CultureInfo.Equals (b.CultureInfo))
if (a.CultureInfo != null && a.CultureInfo != b.CultureInfo)
return false;
if (specificVersion && a.Version != null && a.Version > b.Version)
@@ -223,19 +192,6 @@ namespace Microsoft.Build.Tasks {
set { log = value; }
}
}
class TargetFrameworkAssemblies {
public string Path;
// assembly (simple) name -> (AssemblyName, file path)
public Dictionary <string, KeyValuePair<AssemblyName, string>> NameToAssemblyNameCache;
public TargetFrameworkAssemblies (string path)
{
this.Path = path;
NameToAssemblyNameCache = new Dictionary<string, KeyValuePair<AssemblyName, string>> ();
}
}
}
#endif
@@ -29,7 +29,6 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using Microsoft.Build.Framework;
@@ -37,26 +36,27 @@ namespace Microsoft.Build.Tasks {
public class CallTarget : TaskExtension {
bool runEachTargetSeparately;
List<ITaskItem> targetOutputs_list;
ITaskItem[] targetOutputs_array;
ITaskItem[] targetOutputs;
string[] targets;
public CallTarget ()
{
targetOutputs_list = new List<ITaskItem> ();
}
[MonoTODO]
public override bool Execute ()
{
Hashtable targets_table = new Hashtable ();
targetOutputs = new ITaskItem [targets.Length];
if (!RunEachTargetSeparately) {
bool ret = BuildEngine.BuildProjectFile (BuildEngine.ProjectFileOfTaskNode,
targets, null, targets_table);
int i = 0;
foreach (ITaskItem[] items in targets_table.Values) {
if (items != null)
targetOutputs_list.AddRange (items);
//FIXME: can a target return multiple taskitems?
if (items != null && items.Length > 0)
targetOutputs [i ++] = items [0];
}
return ret;
@@ -76,8 +76,9 @@ namespace Microsoft.Build.Tasks {
continue;
ITaskItem [] items = (ITaskItem[]) targets_table [target];
if (items != null)
targetOutputs_list.AddRange (items);
if (items != null && items.Length > 0)
//FIXME:
targetOutputs [i] = items [0];
}
return allPassed;
@@ -90,11 +91,7 @@ namespace Microsoft.Build.Tasks {
[Output]
public ITaskItem[] TargetOutputs {
get {
if (targetOutputs_array == null)
targetOutputs_array = targetOutputs_list.ToArray ();
return targetOutputs_array;
}
get { return targetOutputs; }
}
public string[] Targets {
@@ -1,38 +1,3 @@
2009-02-11 Leszek Ciesielski <[email protected]>
* ResolveAssemblyReference.cs : AllowedRelatedFileExtensions stub
2009-02-02 Ankit Jain <[email protected]>
* MSBuild.cs (Execute): Disable incorrect 'rebaseOutputs' behavior.
2009-02-02 Ankit Jain <[email protected]>
* ResolveAssemblyReference.cs: Honor SearchPaths and the special
items like '{HintPathFromItem}', '{TargetFrameworkDirectory}' etc.
* AssemblyResolver.cs: Add api for more specific search, like search
in a directory, target frameworks, gac etc.
2009-02-01 Ankit Jain <[email protected]>
* CallTarget.cs: Copy all items from target to TargetOutputs.
2009-02-01 Ankit Jain <[email protected]>
* Csc.cs (AddResponseFileCommands):
* ManagedCompiler.cs (AddResponseFileCommands): 'AddModules' and
'AdditionalLibPaths' can be empty.
2009-01-30 Ankit Jain <[email protected]>
* Copy.cs (Execute): Use for loop instead of enumerators.
sourceFiles and destinationFiles can be null, handle that.
Create new directory if required.
2009-01-27 Ankit Jain <[email protected]>
* Delete.cs (Execute): Skip non-existant files.
2009-01-06 Ankit Jain <[email protected]>
* CreateManifestResourceName.cs (Execute): Use full path, also helps
@@ -52,15 +52,18 @@ namespace Microsoft.Build.Tasks {
try {
List <ITaskItem> temporaryCopiedFiles = new List <ITaskItem> ();
if (sourceFiles != null && destinationFiles != null &&
sourceFiles.Length != destinationFiles.Length)
if (sourceFiles.Length != destinationFiles.Length)
throw new Exception ("Number of source files is different than number of destination files.");
if (destinationFiles != null && destinationFolder != null)
throw new Exception ("You must specify only one attribute from DestinationFiles and DestinationFolder");
if (destinationFiles != null) {
for (int i = 0; i < sourceFiles.Length; i ++) {
ITaskItem sourceItem = sourceFiles [i];
ITaskItem destinationItem = destinationFiles [i];
IEnumerator <ITaskItem> source, destination;
source = ((IEnumerable <ITaskItem>) sourceFiles).GetEnumerator ();
destination = ((IEnumerable <ITaskItem>) destinationFiles).GetEnumerator ();
while (source.MoveNext ()) {
destination.MoveNext ();
ITaskItem sourceItem = source.Current;
ITaskItem destinationItem = destination.Current;
string sourceFile = sourceItem.GetMetadata ("FullPath");
string destinationFile = destinationItem.GetMetadata ("FullPath");
@@ -71,27 +74,23 @@ namespace Microsoft.Build.Tasks {
File.GetLastWriteTime (destinationFile))
continue;
}
string dest_dir = Path.GetDirectoryName (destinationFile);
if (!Directory.Exists (dest_dir)) {
Log.LogMessage ("Creating directory '{0}'", dest_dir);
Directory.CreateDirectory (dest_dir);
}
Log.LogMessage ("Copying file from '{0}' to '{1}'", sourceFile, destinationFile);
File.Copy (sourceFile, destinationFile, true);
temporaryCopiedFiles.Add (sourceItem);
temporaryCopiedFiles.Add (source.Current);
}
} else if (destinationFolder != null) {
bool directoryCreated = false;
string destinationDirectory = destinationFolder.GetMetadata ("FullPath");
if (Directory.Exists (destinationDirectory) == false) {
Log.LogMessage ("Creating directory '{0}'", destinationDirectory);
Directory.CreateDirectory (destinationDirectory);
directoryCreated = true;
}
foreach (ITaskItem sourceItem in sourceFiles) {
IEnumerator <ITaskItem> source;
source = (IEnumerator <ITaskItem>) sourceFiles.GetEnumerator ();
while (source.MoveNext ()) {
ITaskItem sourceItem = source.Current;
string sourceFile = sourceItem.GetMetadata ("FullPath");
string filename = sourceItem.GetMetadata ("Filename") + sourceItem.GetMetadata ("Extension");
string destinationFile = Path.Combine (destinationDirectory,filename);
@@ -105,7 +104,7 @@ namespace Microsoft.Build.Tasks {
}
Log.LogMessage ("Copying file from '{0}' to '{1}'", sourceFile, destinationFile);
File.Copy (sourceFile, destinationFile, true);
temporaryCopiedFiles.Add (sourceItem);
temporaryCopiedFiles.Add (source.Current);
}
} else {
throw new Exception ("You must specify DestinationFolder or DestinationFiles attribute.");
@@ -44,8 +44,7 @@ namespace Microsoft.Build.Tasks {
{
base.AddResponseFileCommands (commandLine);
if (AdditionalLibPaths != null && AdditionalLibPaths.Length > 0)
commandLine.AppendSwitchIfNotNull ("/lib:", AdditionalLibPaths, ",");
commandLine.AppendSwitchIfNotNull ("/lib:", AdditionalLibPaths, ",");
if (Bag ["AllowUnsafeBlocks"] != null)
if (AllowUnsafeBlocks)
@@ -50,15 +50,13 @@ namespace Microsoft.Build.Tasks {
List <ITaskItem> temporaryDeletedFiles = new List <ITaskItem> ();
foreach (ITaskItem file in files) {
string path = file.GetMetadata ("FullPath");
if (path == null || !File.Exists (path))
//skip
continue;
try {
File.Delete (path);
File.Delete (file.GetMetadata ("FullPath"));
temporaryDeletedFiles.Add (file);
}
catch (ArgumentNullException ex) {
LogException (ex);
}
catch (ArgumentException ex) {
LogException (ex);
}
@@ -74,10 +74,8 @@ namespace Microsoft.Build.Tasks {
ITaskItem [] array = (ITaskItem []) de.Value;
foreach (ITaskItem item in array) {
outputItems.Add (item);
//FIXME: Correctly rebase output paths to be relative to the
// calling project
//if (rebaseOutputs)
// File.Copy (item.ItemSpec, Path.Combine (currentDirectory, item.ItemSpec), true);
if (rebaseOutputs)
File.Copy (item.ItemSpec, Path.Combine (currentDirectory, item.ItemSpec), true);
}
}
} else {
@@ -54,8 +54,7 @@ namespace Microsoft.Build.Tasks {
protected internal override void AddResponseFileCommands (
CommandLineBuilderExtension commandLine)
{
if (AddModules != null && AddModules.Length > 0)
commandLine.AppendSwitchIfNotNull ("/addmodule:", AddModules, ",");
commandLine.AppendSwitchIfNotNull ("/addmodule:", AddModules, ",");
if (Bag ["CodePage"] != null)
commandLine.AppendSwitchIfNotNull ("/codepage:", CodePage.ToString ());
@@ -42,7 +42,6 @@ namespace Microsoft.Build.Tasks {
ITaskItem[] assemblies;
string appConfigFile;
string[] allowedAssemblyExtensions;
string[] allowedRelatedFileExtensions;
string[] candidateAssemblyFiles;
ITaskItem[] copyLocalFiles;
ITaskItem[] filesWritten;
@@ -77,28 +76,7 @@ namespace Microsoft.Build.Tasks {
List <ITaskItem> tempResolvedFiles = new List <ITaskItem> ();
foreach (ITaskItem item in assemblies) {
//FIXME: Copy local
string resolved = null;
foreach (string spath in searchPaths) {
if (String.Compare (spath, "{HintPathFromItem}") == 0) {
resolved = assembly_resolver.ResolveHintPathReference (item);
} else if (String.Compare (spath, "{TargetFrameworkDirectory}") == 0) {
foreach (string fpath in targetFrameworkDirectories) {
resolved = assembly_resolver.FindInTargetFramework (item, fpath);
if (resolved != null)
break;
}
} else if (String.Compare (spath, "{GAC}") == 0) {
resolved = assembly_resolver.ResolveGacReference (item);
} else if (String.Compare (spath, "{RawFileName}") == 0) {
resolved = item.ItemSpec;
} else {
resolved = assembly_resolver.FindInDirectory (item, spath);
}
if (resolved != null)
break;
}
string resolved = assembly_resolver.ResolveAssemblyReference (item);
if (resolved == null) {
Log.LogWarning ("Reference {0} not resolved", item.ItemSpec);
@@ -137,11 +115,6 @@ namespace Microsoft.Build.Tasks {
get { return allowedAssemblyExtensions; }
set { allowedAssemblyExtensions = value; }
}
public string[] AllowedRelatedFileExtensions {
get { return allowedRelatedFileExtensions; }
set { allowedRelatedFileExtensions = value; }
}
public string[] CandidateAssemblyFiles {
get { return candidateAssemblyFiles; }
@@ -1,11 +1,3 @@
2009-01-31 Ankit Jain <[email protected]>
* TaskBatchingTest.cs (*): Add tests for target/task events.
(TestTargetBatching*): New tests for target batching.
* TestMessageLogger.cs: Add counts for target/task started/finished
events.
(NormalMessageCount): New.
2008-12-22 Ankit Jain <[email protected]>
* TestMessageLogger.cs: Emit debug messages to stderr.
@@ -83,8 +83,6 @@ namespace MonoTests.Microsoft.Build.Tasks
CheckMessage (testLogger, "en", "Item3", "A3");
CheckMessage (testLogger, "gb", "Item4", "A4");
CheckMessage (testLogger, "it", "Item6", "A5");
CheckEngineEventCounts (testLogger, 1, 1, 4, 4);
}
// Test1 with unqualified %(Culture)
@@ -132,8 +130,6 @@ namespace MonoTests.Microsoft.Build.Tasks
CheckMessage (testLogger, "en", "Item3", "A3");
CheckMessage (testLogger, "gb", "Item4", "A4");
CheckMessage (testLogger, "it", "Item6", "A5");
CheckEngineEventCounts (testLogger, 1, 1, 4, 4);
}
[Test]
@@ -166,11 +162,7 @@ namespace MonoTests.Microsoft.Build.Tasks
//Fails as Culture is being referenced unqualified, and no Culture is
//specified for "Item5"
bool result = project.Build ("ShowMessage");
if (result)
Assert.Fail ("A1: Build should have failed");
CheckEngineEventCounts (testLogger, 1, 1, 0, 0);
Assert.IsFalse (project.Build ("ShowMessage"), "A1: Build should have failed");
}
[Test]
@@ -208,7 +200,6 @@ namespace MonoTests.Microsoft.Build.Tasks
CheckMessage (testLogger, "fr", "Item1", "A2");
CheckMessage (testLogger, "", "Item5", "A3");
CheckMessage (testLogger, "it", "Item6", "A3");
CheckEngineEventCounts (testLogger, 1, 1, 3, 3);
}
[Test]
@@ -262,7 +253,6 @@ namespace MonoTests.Microsoft.Build.Tasks
CheckMessage2 (testLogger, "en", "Item3", "Item8;Item9", "A3");
CheckMessage2 (testLogger, "gb", "Item4", string.Empty, "A4");
CheckMessage2 (testLogger, "it", "Item6", "Item7", "A6");
CheckEngineEventCounts (testLogger, 1, 1, 4, 4);
}
[Test]
@@ -314,7 +304,6 @@ namespace MonoTests.Microsoft.Build.Tasks
Assert.IsTrue (project.Build ("ShowMessage"), "A1: Build failed");
CheckLoggedMessageHead (testLogger, "ResXFiles: Item1;Item2 NonResXFiles: ", "A2");
CheckEngineEventCounts (testLogger, 1, 1, 1, 1);
}
[Test]
@@ -363,7 +352,6 @@ namespace MonoTests.Microsoft.Build.Tasks
CheckLoggedMessageAny (testLogger, "Number: 3 Color: Green-- Items in ExampColl: ExampColl2: Item6", "A4");
CheckLoggedMessageAny (testLogger, "Number: 2 Color: -- Items in ExampColl: Item2 ExampColl2: ", "A5");
Assert.AreEqual (0, testLogger.Count, "A6");
CheckEngineEventCounts (testLogger, 1, 1, 4, 4);
}
[Test]
@@ -398,7 +386,6 @@ namespace MonoTests.Microsoft.Build.Tasks
Project project = engine.CreateNewProject ();
TestMessageLogger testLogger = new TestMessageLogger ();
engine.RegisterLogger (testLogger);
project.LoadXml (projectString);
Assert.IsTrue (project.Build ("Build"), "A1: Build failed");
@@ -415,8 +402,6 @@ namespace MonoTests.Microsoft.Build.Tasks
additional_metadata = new string [,] { { "Identity", "file3.txt" } };
CreateItemTest.CheckBuildItem (include [2], "GroupC", additional_metadata, "file3.txt", "A5");
CreateItemTest.CheckBuildItem (include [3], "GroupC", additional_metadata, "file3.txt", "A6");
CheckEngineEventCounts (testLogger, 1, 1, 5, 5);
}
[Test]
@@ -453,7 +438,6 @@ namespace MonoTests.Microsoft.Build.Tasks
CheckLoggedMessageAny (testLogger, "Identity: Item5 -- Items in ExampColl: Item5", "A6");
CheckLoggedMessageAny (testLogger, "Identity: Item6 -- Items in ExampColl: Item6", "A7");
Assert.AreEqual (0, testLogger.Count, "A8");
CheckEngineEventCounts (testLogger, 1, 1, 6, 6);
}
[Test]
@@ -504,361 +488,8 @@ namespace MonoTests.Microsoft.Build.Tasks
additional_metadata = new string [,] { { "Identity", "apricot" } };
CreateItemTest.CheckBuildItem (include [2], "Final", additional_metadata, "apricot", "A5");
CheckEngineEventCounts (testLogger, 1, 1, 2, 2);
}
//Target batching
[Test]
public void TestTargetBatching1 ()
{
string projectString = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
<ItemGroup>
<List1 Include=""fr_a.txt""><Culture>fr</Culture></List1>
<List1 Include=""en_b.txt""><Culture>en</Culture></List1>
<List1 Include=""fr_c.txt""><Culture>fr</Culture></List1>
<List1 Include=""gb_d.txt""><Culture>gb</Culture></List1>
<List2 Include=""fr_x.txt""><Culture>fr</Culture></List2>
<List2 Include=""gb_z.txt""><Culture>gb</Culture></List2>
<Foo Include=""1_a1""><Md>1</Md></Foo>
<Foo Include=""2_b1""><Md>2</Md></Foo>
<Foo Include=""1_c1""><Md>1</Md></Foo>
</ItemGroup>
<Target Name=""foo"" >
<Message Text=""TargetStarted""/>
<Message Text=""List1: @(List1): %(Culture)""/>
<Message Text=""Foo: @(Foo): %(Md)""/>
</Target>
</Project>";
Engine engine = new Engine (Consts.BinPath);
Project project = engine.CreateNewProject ();
TestMessageLogger testLogger = new TestMessageLogger ();
engine.RegisterLogger (testLogger);
project.LoadXml (projectString);
bool res = project.Build ("foo");
if (!res) {
testLogger.DumpMessages ();
Assert.Fail ("A1: Build failed");
}
CheckLoggedMessagesInOrder (testLogger, new string [] {
"TargetStarted", "List1: fr_a.txt;fr_c.txt: fr",
"List1: en_b.txt: en", "List1: gb_d.txt: gb",
"Foo: 1_a1;1_c1: 1", "Foo: 2_b1: 2"
}, "A2");
CheckEngineEventCounts (testLogger, 1, 1, 6, 6);
}
[Test]
public void TestTargetBatching2 ()
{
string projectString = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
<ItemGroup>
<List1 Include=""fr_a.txt""><Culture>fr</Culture></List1>
<List1 Include=""en_b.txt""><Culture>en</Culture></List1>
<List1 Include=""fr_c.txt""><Culture>fr</Culture></List1>
<List1 Include=""gb_d.txt""><Culture>gb</Culture></List1>
<List2 Include=""fr_x.txt""><Culture>fr</Culture></List2>
<List2 Include=""gb_z.txt""><Culture>gb</Culture></List2>
<Foo Include=""1_a1""><Md>1</Md></Foo>
<Foo Include=""2_b1""><Md>2</Md></Foo>
<Foo Include=""1_c1""><Md>1</Md></Foo>
</ItemGroup>
<Target Name=""foo"" Inputs=""@(List1)"" Outputs=""%(Culture).foo"">
<Message Text=""TargetStarted""/>
<Message Text=""List1: @(List1): %(Culture)""/>
<Message Text=""Foo: @(Foo): %(Md)""/>
</Target>
</Project>";
Engine engine = new Engine (Consts.BinPath);
Project project = engine.CreateNewProject ();
TestMessageLogger testLogger = new TestMessageLogger ();
engine.RegisterLogger (testLogger);
project.LoadXml (projectString);
bool res = project.Build ("foo");
if (!res) {
testLogger.DumpMessages ();
Assert.Fail ("A1: Build failed");
}
CheckLoggedMessagesInOrder (testLogger, new string [] {
"TargetStarted", "List1: fr_a.txt;fr_c.txt: fr",
"Foo: 1_a1;1_c1: 1", "Foo: 2_b1: 2",
"TargetStarted", "List1: en_b.txt: en",
"Foo: 1_a1;1_c1: 1", "Foo: 2_b1: 2",
"TargetStarted", "List1: gb_d.txt: gb",
"Foo: 1_a1;1_c1: 1", "Foo: 2_b1: 2"
}, "A2");
CheckEngineEventCounts (testLogger, 3, 3, 12, 12);
}
[Test]
public void TestTargetBatching3 ()
{
string projectString = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
<ItemGroup>
<List1 Include=""fr_a.txt""><Culture>fr</Culture></List1>
<List1 Include=""en_b.txt""><Culture>en</Culture></List1>
<List1 Include=""fr_c.txt""><Culture>fr</Culture></List1>
<List1 Include=""gb_d.txt""><Culture>gb</Culture></List1>
<List2 Include=""fr_x.txt""><Culture>fr</Culture></List2>
<List2 Include=""gb_z.txt""><Culture>gb</Culture></List2>
<Foo Include=""1_a1""><Md>1</Md></Foo>
<Foo Include=""2_b1""><Md>2</Md></Foo>
<Foo Include=""1_c1""><Md>1</Md></Foo>
</ItemGroup>
<Target Name=""foo"" Inputs=""@(Foo)"" Outputs=""%(Md).foo"">
<Message Text=""TargetStarted""/>
<Message Text=""List1: @(List1): %(Culture)""/>
<Message Text=""Foo: @(Foo): %(Md)""/>
</Target>
</Project>";
Engine engine = new Engine (Consts.BinPath);
Project project = engine.CreateNewProject ();
TestMessageLogger testLogger = new TestMessageLogger ();
engine.RegisterLogger (testLogger);
project.LoadXml (projectString);
bool res = project.Build ("foo");
if (!res) {
testLogger.DumpMessages ();
Assert.Fail ("A1: Build failed");
}
CheckLoggedMessagesInOrder (testLogger, new string [] {
"TargetStarted", "List1: fr_a.txt;fr_c.txt: fr",
"List1: en_b.txt: en", "List1: gb_d.txt: gb",
"Foo: 1_a1;1_c1: 1",
"TargetStarted", "List1: fr_a.txt;fr_c.txt: fr",
"List1: en_b.txt: en", "List1: gb_d.txt: gb",
"Foo: 2_b1: 2"
}, "A2");
CheckEngineEventCounts (testLogger, 2, 2, 10, 10);
}
[Test]
public void TestTargetBatching4 ()
{
string projectString = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
<ItemGroup>
<List1 Include=""fr_a.txt""><Culture>fr</Culture></List1>
<List1 Include=""en_b.txt""><Culture>en</Culture></List1>
<List1 Include=""fr_c.txt""><Culture>fr</Culture></List1>
<List1 Include=""gb_d.txt""><Culture>gb</Culture></List1>
<List2 Include=""fr_x.txt""><Culture>fr</Culture></List2>
<List2 Include=""gb_z.txt""><Culture>gb</Culture></List2>
<Foo Include=""1_a1""><Md>1</Md></Foo>
<Foo Include=""2_b1""><Md>2</Md></Foo>
<Foo Include=""1_c1""><Md>1</Md></Foo>
</ItemGroup>
<Target Name=""foo"" Inputs=""@(List1)"" Outputs=""%(Culture).foo"">
<Message Text=""TargetStarted""/>
<Message Text=""List1: @(List1): %(Culture)""/>
<Message Text=""List2: @(List2): %(Culture)""/>
<Message Text=""Foo: @(Foo): %(Md)""/>
</Target>
</Project>";
Engine engine = new Engine (Consts.BinPath);
Project project = engine.CreateNewProject ();
TestMessageLogger testLogger = new TestMessageLogger ();
engine.RegisterLogger (testLogger);
project.LoadXml (projectString);
bool res = project.Build ("foo");
if (!res) {
testLogger.DumpMessages ();
Assert.Fail ("A1: Build failed");
}
CheckLoggedMessagesInOrder (testLogger, new string [] {
"TargetStarted", "List1: fr_a.txt;fr_c.txt: fr",
"List2: fr_x.txt: fr", "List2: gb_z.txt: gb",
"Foo: 1_a1;1_c1: 1", "Foo: 2_b1: 2",
"TargetStarted", "List1: en_b.txt: en",
"List2: fr_x.txt: fr", "List2: gb_z.txt: gb",
"Foo: 1_a1;1_c1: 1", "Foo: 2_b1: 2",
"TargetStarted", "List1: gb_d.txt: gb",
"List2: fr_x.txt: fr", "List2: gb_z.txt: gb",
"Foo: 1_a1;1_c1: 1", "Foo: 2_b1: 2"
}, "A2");
CheckEngineEventCounts (testLogger, 3, 3, 18, 18);
}
[Test]
public void TestTargetBatching5 ()
{
string projectString = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
<Target Name=""foo"" Inputs=""@(List1)"" Outputs=""%(Culture).foo"">
<Message Text=""TargetStarted""/>
</Target>
</Project>";
Engine engine = new Engine (Consts.BinPath);
Project project = engine.CreateNewProject ();
TestMessageLogger testLogger = new TestMessageLogger ();
engine.RegisterLogger (testLogger);
project.LoadXml (projectString);
bool res = project.Build ("foo");
if (!res) {
testLogger.DumpMessages ();
Assert.Fail ("A1: Build failed");
}
Assert.AreEqual (1, testLogger.CheckAny ("TargetStarted", MessageImportance.Normal),
"A2: Target should've been skipped because of no inputs");
CheckEngineEventCounts (testLogger, 1, 1, 0, 0);
}
[Test]
public void TestTargetBatching6 ()
{
string projectString = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
<ItemGroup>
<List1 Include=""fr_a.txt""><Culture>fr</Culture></List1>
<List1 Include=""en_b.txt""><Culture>en</Culture></List1>
<List1 Include=""fr_c.txt""><Culture>fr</Culture></List1>
<List1 Include=""gb_d.txt""><Culture>gb</Culture></List1>
<List3 Include=""fr_x.txt""><Culture>fr</Culture></List3>
<List3 Include=""gb_z.txt""><Culture>gb</Culture></List3>
<Foo Include=""1_a1""><Md>1</Md></Foo>
<Foo Include=""2_b1""><Md>2</Md></Foo>
<Foo Include=""1_c1""><Md>1</Md></Foo>
</ItemGroup>
<Target Name=""foo"" Inputs=""@(List1);@(List2)"" Outputs=""%(Culture).foo"">
<Message Text=""TargetStarted"" />
<Message Text=""List1: %(List1.Culture), List2: %(List2.Culture)"" />
<Message Text=""List2: @(List2), Culture: %(Culture)"" />
<Message Text=""List3: @(List3), Culture: %(Culture)"" />
</Target>
</Project>";
Engine engine = new Engine (Consts.BinPath);
Project project = engine.CreateNewProject ();
TestMessageLogger testLogger = new TestMessageLogger ();
engine.RegisterLogger (testLogger);
project.LoadXml (projectString);
bool res = project.Build ("foo");
if (!res) {
testLogger.DumpMessages ();
Assert.Fail ("A1: Build failed");
}
CheckLoggedMessagesInOrder (testLogger, new string [] {
"TargetStarted",
"List1: fr, List2: ",
"List2: , Culture: ",
"List3: fr_x.txt, Culture: fr",
"List3: gb_z.txt, Culture: gb",
"TargetStarted",
"List1: en, List2: ",
"List2: , Culture: ",
"List3: fr_x.txt, Culture: fr",
"List3: gb_z.txt, Culture: gb",
"TargetStarted",
"List1: gb, List2: ",
"List2: , Culture: ",
"List3: fr_x.txt, Culture: fr",
"List3: gb_z.txt, Culture: gb"
}, "A2");
CheckEngineEventCounts (testLogger, 3, 3, 15, 15);
}
[Test]
public void TestTargetBatching7 ()
{
string projectString = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
<ItemGroup>
<List1 Include=""fr_a.txt""><Culture>fr</Culture></List1>
<List1 Include=""en_b.txt""><Culture>en</Culture></List1>
<List1 Include=""fr_c.txt""><Culture>fr</Culture></List1>
<List1 Include=""gb_d.txt""><Culture>gb</Culture></List1>
<List2 Include=""fr_x.txt""><Culture>fr</Culture></List2>
<List2 Include=""gb_z.txt""><Culture>gb</Culture></List2>
<Foo Include=""1_a1""><Md>1</Md></Foo>
<Foo Include=""2_b1""><Md>2</Md></Foo>
<Foo Include=""1_c1""><Md>1</Md></Foo>
</ItemGroup>
<Target Name=""foo"" Inputs=""@(List1);@(List2)"" Outputs=""%(Culture).foo"">
<Message Text=""TargetStarted"" />
<Message Text=""List1: @(List1), List2: @(List2)""/>
</Target>
</Project>";
Engine engine = new Engine (Consts.BinPath);
Project project = engine.CreateNewProject ();
TestMessageLogger testLogger = new TestMessageLogger ();
engine.RegisterLogger (testLogger);
project.LoadXml (projectString);
bool res = project.Build ("foo");
if (!res) {
testLogger.DumpMessages ();
Assert.Fail ("A1: Build failed");
}
CheckLoggedMessagesInOrder (testLogger, new string [] {
"TargetStarted",
"List1: fr_a.txt;fr_c.txt, List2: fr_x.txt",
"TargetStarted",
"List1: en_b.txt, List2: ",
"TargetStarted",
"List1: gb_d.txt, List2: gb_z.txt"
}, "A2");
CheckEngineEventCounts (testLogger, 3, 3, 6, 6);
}
void CheckLoggedMessagesInOrder (TestMessageLogger logger, string [] values, string prefix)
{
try {
for (int i = 0; i < values.Length; i++) {
CheckLoggedMessageHead (logger, values [i], prefix + "#" + i);
}
if (logger.NormalMessageCount > 0)
Assert.Fail ("{0}: Expected {1} messages, but found {2}",
prefix, values.Length, values.Length + logger.NormalMessageCount);
} catch (NUnit.Framework.AssertionException) {
logger.DumpMessages ();
throw;
}
}
void CheckMessage (TestMessageLogger logger, string culture, string items, string id)
{
@@ -885,13 +516,5 @@ namespace MonoTests.Microsoft.Build.Tasks
if (logger.CheckAny (expected, MessageImportance.Normal) == 1)
Assert.Fail ("{0}: Expected message '{1}' was not emitted.", id, expected);
}
void CheckEngineEventCounts (TestMessageLogger logger, int target_start, int target_finish, int task_start, int task_finish)
{
Assert.AreEqual (target_start, logger.TargetStarted, "TargetStarted event count doesn't match");
Assert.AreEqual (target_finish, logger.TargetFinished, "TargetFinished event count doesn't match");
Assert.AreEqual (task_start, logger.TaskStarted, "TaskStarted event count doesn't match");
Assert.AreEqual (task_finish, logger.TaskFinished, "TaskFinished event count doesn't match");
}
}
}
@@ -8,38 +8,12 @@ namespace MonoTests.Microsoft.Build.Tasks
internal class TestMessageLogger : ILogger
{
List<BuildMessageEventArgs> messages;
List<BuildEventArgs> all_messages;
int target_started, target_finished;
int task_started, task_finished;
List<BuildEventArgs> errorsAndWarnings;
public TestMessageLogger ()
{
messages = new List<BuildMessageEventArgs> ();
all_messages = new List<BuildEventArgs> ();
}
public int TargetFinished
{
get { return target_finished; }
set { target_finished = value; }
}
public int TargetStarted
{
get { return target_started; }
set { target_started = value; }
}
public int TaskStarted
{
get { return task_started; }
set { task_started = value; }
}
public int TaskFinished
{
get { return task_finished; }
set { task_finished = value; }
errorsAndWarnings = new List<BuildEventArgs> ();
}
public int Count
@@ -54,12 +28,8 @@ namespace MonoTests.Microsoft.Build.Tasks
public void Initialize (IEventSource eventSource)
{
eventSource.MessageRaised += new BuildMessageEventHandler (MessageHandler);
eventSource.ErrorRaised += new BuildErrorEventHandler (AllMessagesHandler);
eventSource.WarningRaised += new BuildWarningEventHandler(AllMessagesHandler);
eventSource.TargetStarted += delegate { target_started++; };
eventSource.TargetFinished += delegate { target_finished++; };
eventSource.TaskStarted += delegate { task_started++; };
eventSource.TaskFinished += delegate { task_finished++; };
eventSource.ErrorRaised += new BuildErrorEventHandler (ErrorHandler);
eventSource.WarningRaised += new BuildWarningEventHandler (WarningHandler);
}
public void Shutdown ()
@@ -70,23 +40,16 @@ namespace MonoTests.Microsoft.Build.Tasks
{
if (args.Message.StartsWith ("Using") == false)
messages.Add (args);
all_messages.Add (args);
}
private void AllMessagesHandler (object sender, BuildEventArgs args)
private void ErrorHandler (object sender, BuildEventArgs args)
{
all_messages.Add (args);
errorsAndWarnings.Add (args);
}
public int NormalMessageCount {
get
{
int count = 0, i = 0;
while (i ++ < messages.Count)
if (messages [i - 1].Importance == MessageImportance.Normal)
count++;
return count;
}
private void WarningHandler (object sender, BuildEventArgs args)
{
errorsAndWarnings.Add (args);
}
public int CheckHead (string text, MessageImportance importance)
@@ -101,13 +64,8 @@ namespace MonoTests.Microsoft.Build.Tasks
actual_msg = String.Empty;
if (messages.Count > 0) {
//find first @importance level message
int i = 0;
while (messages [i].Importance != importance && i < messages.Count)
i++;
actual = messages [i];
messages.RemoveAt (i);
actual = messages [0];
messages.RemoveAt (0);
} else
return 1;
@@ -144,7 +102,10 @@ namespace MonoTests.Microsoft.Build.Tasks
public void DumpMessages ()
{
foreach (BuildEventArgs arg in all_messages)
foreach (BuildEventArgs arg in errorsAndWarnings)
Console.WriteLine ("{0} {1}", (arg is BuildErrorEventArgs) ? "Err:" : "Warn:", arg.Message);
foreach (BuildMessageEventArgs arg in messages)
Console.WriteLine ("Msg: {0}", arg.Message);
}
}
-12
View File
@@ -1,15 +1,3 @@
2009-02-12 Jordi Mas i Hernandez <[email protected]>
* Mono.Cairo/ScaledFont.cs: Fixes Dispose signature
* Mono.Cairo/FontFace.cs: Fixes Dispose signature
* Mono.Cairo/Surface.cs: Fixes Dispose signature
* Mono.Cairo/Path.cs: Fixes Dispose signature
* Mono.Cairo/Pattern.cs: Fixes Dispose signature
2009-02-07 Jordi Mas i Hernandez <[email protected]>
* Mono.Cairo/NativeMethods.cs: class should be internal not public
2008-11-30 Jordi Mas i Hernandez <[email protected]>
* Mono.Cairo/ImageSurface.cs: Fixes ImageSurface constructor signature.
+2 -2
View File
@@ -51,13 +51,13 @@ namespace Cairo
~FontFace ()
{
// Since Cairo is not thread safe, we can not unref the
// font_face here, the programmer must do this with Dispose
// font_face here, the programmer must do this with IDisposable.Dispose
Console.Error.WriteLine ("Programmer forgot to call Dispose on the FontFace");
Dispose (false);
}
public void Dispose ()
void IDisposable.Dispose ()
{
Dispose (true);
}
@@ -39,7 +39,7 @@ namespace Cairo
// sort these so it is easier to find what is missing
// http://www.cairographics.org/manual/ix01.html
internal static class NativeMethods
public static class NativeMethods
{
const string cairo = "libcairo-2.dll";
+1 -1
View File
@@ -49,7 +49,7 @@ namespace Cairo {
}
public void Dispose ()
void IDisposable.Dispose ()
{
Dispose (true);
GC.SuppressFinalize (this);
+1 -1
View File
@@ -89,7 +89,7 @@ namespace Cairo {
NativeMethods.cairo_pattern_reference (pattern);
}
public void Dispose ()
void IDisposable.Dispose ()
{
Dispose (true);
}
@@ -91,7 +91,7 @@ namespace Cairo {
get { return NativeMethods.cairo_scaled_font_status (handle); }
}
public void Dispose ()
void IDisposable.Dispose ()
{
Dispose (true);
GC.SuppressFinalize (this);
+1 -1
View File
@@ -139,7 +139,7 @@ namespace Cairo {
NativeMethods.cairo_paint (gr.Handle);
}
public void Dispose ()
void IDisposable.Dispose ()
{
Dispose (true);
GC.SuppressFinalize (this);
Loaded 100 of 1472 files, more files were not shown because too many files have changed in this diff. Show more