[prev in list] [next in list] [prev in thread] [next in thread]
List: mono-patches
Subject: [Mono-patches] [mono/mono] [660 commits] 3fb44e93: [xbuild] Update
From: "Ankit Jain (radical () corewars ! org)" <mono-patches () lists ! ximian ! com>
Date: 2011-03-31 21:32:37
Message-ID: 20110331213237.AD9EC2212A () mono ! ximian ! com
[Download RAW message or body]
Branch: refs/heads/mono-2.10
Home: https://github.com/mono/mono
Commit: 3fb44e93e2c6115e6eba773c4ec4aa0364df7dcc
Author: Ankit Jain <radical@corewars.org>
Date: 01/10/2011 18:49:12
URL: https://github.com/mono/mono/commit/3fb44e93e2c6115e6eba773c4ec4aa0364df7dcc
[xbuild] Update man page, new search paths for extensions and .pc files.
Changed paths:
M man/xbuild.1
Modified: man/xbuild.1
===================================================================
--- a/man/xbuild.1
+++ b/man/xbuild.1
@@ -73,9 +73,10 @@ to $prefix/lib/mono/xbuild . When used in Import, like:
xbuild tries various values for the msbuild property $(MSBuildExtensionsPath), in \
order:
- 1. Paths specified in the environment variable $MSBuildExtensionsPath.
- 2. $XDG_CONFIG_HOME/xbuild/tasks (or Environment.SpecialFolder.ApplicationData)
- 3. $prefix/lib/mono/xbuild (default location)
+ 1. /Library/Frameworks/Mono.framework/External/xbuild on Mac OSX.
+ 2. Paths specified in the environment variable $MSBuildExtensionsPath.
+ 3. $XDG_CONFIG_HOME/xbuild/tasks (or Environment.SpecialFolder.ApplicationData)
+ 4. $prefix/lib/mono/xbuild (default location)
Anywhere else in the project files, $(MSBuildExtensionsPath) will always resolve to \
the default location. This is a xbuild-only feature.
@@ -111,6 +112,10 @@ For example, you could set this variable from your shell:
You can disable the built-in color scheme by setting this variable to
"disable".
+.SH NOTES
+On Mac OSX, for locating pkg-config (.pc) files, xbuild additionally
+looks in "/Library/Frameworks/Mono.framework/External/pkgconfig" .
+
.SH SEE ALSO
.BR mono(1), mcs(1)
.SH COPYRIGHT
Commit: 1302702ad5fb5c2d98fb8b2e0141fec44d94c554
Author: Zoltan Varga <vargaz@gmail.com>
Date: 01/10/2011 19:12:47
URL: https://github.com/mono/mono/commit/1302702ad5fb5c2d98fb8b2e0141fec44d94c554
Fix a regression introduced by db4299a1.
Changed paths:
M mono/metadata/marshal.c
Modified: mono/metadata/marshal.c
===================================================================
--- a/mono/metadata/marshal.c
+++ b/mono/metadata/marshal.c
@@ -1869,7 +1869,7 @@ emit_struct_conv (MonoMethodBuilder *mb, MonoClass *klass, \
gboolean to_object) case MONO_TYPE_R8:
mono_mb_emit_ldloc (mb, 1);
mono_mb_emit_ldloc (mb, 0);
- if (ntype == MONO_NATIVE_U1) {
+ if (t == MONO_TYPE_CHAR && ntype == MONO_NATIVE_U1) {
if (to_object) {
mono_mb_emit_byte (mb, CEE_LDIND_U1);
mono_mb_emit_byte (mb, CEE_STIND_I2);
Commit: 32b1aa404aa99e02147380a289c0177804b32a4d
Author: Jonathan Pryor <jonpryor@vt.edu>
Date: 01/10/2011 21:09:26
URL: https://github.com/mono/mono/commit/32b1aa404aa99e02147380a289c0177804b32a4d
[monodoc/osx] Look for docs in additional directories.
Fixes #663182.
OSX allows multiple framework versions to be installed side-by-side,
and the current version is available through
/Library/Frameworks/Mono.framework/Versions/Current.
However, documentation installed into /L/F/M.f/V/C/lib/monodoc/sources
is specific for that Mono version; upgrade Mono.framework, and the
documentation is "lost," not visible to the newly installed version.
To fix this, we're creating an *unversioned* directory to contain
documentation, which will thus be persistent across Mono.framework
upgrades: /Library/Frameworks/Mono.framework/External/monodoc
This will allow Mono.framework to be upgraded without "losing" the
documentation visible within monodoc.
Changed paths:
M mcs/tools/monodoc/Monodoc/provider.cs
Modified: mcs/tools/monodoc/Monodoc/provider.cs
===================================================================
--- a/mcs/tools/monodoc/Monodoc/provider.cs
+++ b/mcs/tools/monodoc/Monodoc/provider.cs
@@ -881,9 +881,14 @@ public class RootTree : Tree {
string layout = Path.Combine (basedir, "monodoc.xml");
doc.Load (layout);
+ string osxExternalDir = "/Library/Frameworks/Mono.framework/External/monodoc";
+ string[] osxExternalSources = Directory.Exists (osxExternalDir)
+ ? Directory.GetFiles (osxExternalDir, "*.source")
+ : new string[0];
+
return LoadTree (basedir, doc,
- Directory.GetFiles (Path.Combine (basedir, "sources"))
- .Where (file => file.EndsWith (".source")));
+ Directory.GetFiles (Path.Combine (basedir, "sources"), "*.source")
+ .Concat (osxExternalSources));
}
Commit: 4264916df50ea2dcec479365514562182aa380da
Author: Geoff Norton <grompf@sublimeintervention.com>
Date: 01/11/2011 00:55:52
URL: https://github.com/mono/mono/commit/4264916df50ea2dcec479365514562182aa380da
Fixed loadedllvm on OSX
The default build of libmono-llvm.dylib includes libmono and all its dependencies,
but our statically compiled mono binary does as well. OSX can actually load both
into its process space, and get confused as to which symbol it should call, leading
to non-deterministic crashes. We'll remove all the mono dependencies, and use
-undefined suppress to mitigate this on OSX.
Changed paths:
M mono/mini/Makefile.am
Modified: mono/mini/Makefile.am
===================================================================
--- a/mono/mini/Makefile.am
+++ b/mono/mini/Makefile.am
@@ -121,7 +121,12 @@ endif
if LOADED_LLVM
lib_LTLIBRARIES += libmono-llvm.la
libmono_llvm_la_SOURCES = mini-llvm.c mini-llvm-cpp.cpp
-libmono_llvm_la_LIBADD = $(top_builddir)/mono/mini/libmono-$(API_VER).la \
$(LLVM_LIBS) $(LLVM_LDFLAGS) $(libs) +libmono_llvm_la_LIBADD = $(LLVM_LIBS) \
$(LLVM_LDFLAGS) +if PLATFORM_DARWIN
+libmono_llvm_la_LDFLAGS=-undefined suppress
+else
+libmono_llvm_la_LIBADD += $(top_builddir)/mono/mini/libmono-$(API_VER).la $(libs)
+endif
endif
endif
Commit: cd6a73c07f63768acaee7bcb843982c51a86aac4
Author: Geoff Norton <grompf@sublimeintervention.com>
Date: 01/11/2011 10:34:03
URL: https://github.com/mono/mono/commit/cd6a73c07f63768acaee7bcb843982c51a86aac4
Fix AOT on OSX/x86
Changed paths:
M mono/mini/aot-compiler.c
Modified: mono/mini/aot-compiler.c
===================================================================
--- a/mono/mini/aot-compiler.c
+++ b/mono/mini/aot-compiler.c
@@ -506,7 +506,6 @@ arch_init (MonoAotCompile *acfg)
#ifdef TARGET_ARM
if (acfg->aot_opts.mtriple && strstr (acfg->aot_opts.mtriple, "darwin")) {
g_string_append (acfg->llc_args, "-mattr=+v6");
- acfg->llvm_label_prefix = "_";
} else {
#ifdef ARM_FPU_VFP
g_string_append (acfg->llc_args, " -mattr=+vfp2,+d16");
@@ -523,6 +522,7 @@ arch_init (MonoAotCompile *acfg)
#endif
#ifdef __APPLE__
+ acfg->llvm_label_prefix = "_";
acfg->need_no_dead_strip = TRUE;
#endif
}
@@ -6755,7 +6755,7 @@ mono_compile_assembly (MonoAssembly *ass, guint32 opts, const \
char *aot_options)
arch_init (acfg);
- acfg->got_symbol_base = g_strdup_printf ("%smono_aot_%s_got", \
acfg->llvm_label_prefix, acfg->image->assembly->aname.name); + acfg->got_symbol_base \
= g_strdup_printf ("mono_aot_%s_got", acfg->image->assembly->aname.name); \
acfg->plt_symbol = g_strdup_printf ("%smono_aot_%s_plt", acfg->llvm_label_prefix, \
acfg->image->assembly->aname.name);
/* Get rid of characters which cannot occur in symbols */
Commit: 2be48ab1fae21e5702dc72b4c3bfb5d13b2c042f
Author: Zoltan Varga <vargaz@gmail.com>
Date: 01/11/2011 14:44:22
URL: https://github.com/mono/mono/commit/2be48ab1fae21e5702dc72b4c3bfb5d13b2c042f
Dump the AOT log upon a failure.
Changed paths:
M mcs/class/aot-compiler/Makefile
Modified: mcs/class/aot-compiler/Makefile
===================================================================
--- a/mcs/class/aot-compiler/Makefile
+++ b/mcs/class/aot-compiler/Makefile
@@ -24,10 +24,10 @@ ifndef SKIP_AOT
ifdef PLATFORM_AOT_SUFFIX
Q_AOT=$(if $(V),,@echo "AOT [$(PROFILE)] $(notdir $(@))";)
$(mcs_aot_image): $(mcs_exe)
- $(Q_AOT) MONO_PATH='$(the_libdir)' > $(PROFILE)_aot.log 2>&1 $(RUNTIME) \
--aot=bind-to-runtime-version --debug $(mcs_exe) + $(Q_AOT) MONO_PATH='$(the_libdir)' \
> $(PROFILE)_aot.log 2>&1 $(RUNTIME) --aot=bind-to-runtime-version --debug $(mcs_exe) \
> || cat $(PROFILE)_aot.log || (cat $(PROFILE)_aot.log; exit 1)
$(mscorlib_aot_image): $(mscorlib_dll)
- $(Q_AOT) MONO_PATH='$(the_libdir)' > $(PROFILE)_aot.log 2>&1 $(RUNTIME) \
--aot=bind-to-runtime-version --debug $(mscorlib_dll) + $(Q_AOT) \
MONO_PATH='$(the_libdir)' > $(PROFILE)_aot.log 2>&1 $(RUNTIME) \
--aot=bind-to-runtime-version --debug $(mscorlib_dll) || (cat $(PROFILE)_aot.log; \
exit 1)
ifdef ENABLE_AOT
Commit: cfa37dc27db0938533144111d44b3f71ffe6bd2c
Author: Zoltan Varga <vargaz@gmail.com>
Date: 01/11/2011 14:56:15
URL: https://github.com/mono/mono/commit/cfa37dc27db0938533144111d44b3f71ffe6bd2c
Disable system AOT when using the loaded llvm, as it seems to cause crashes on the \
x86 buildbot.
Changed paths:
M configure.in
Modified: configure.in
===================================================================
--- a/configure.in
+++ b/configure.in
@@ -2963,6 +2963,11 @@ fi
enable_system_aot=yes
fi
+ if test "x$enable_loadedllvm" = "xyes"; then
+ # This seems to fail on the x86 buildbots
+ enable_system_aot=no
+ fi
+
if test x$host_win32 = xno -a x$platform_darwin != xyes -a x$enable_system_aot = \
xyes; then echo "ENABLE_AOT = 1" >> $mcs_topdir/build/config.make
fi
Commit: 42d8b111ec9baacdf5e80d575ebd410b0b547e0b
Author: Marek Habersack <grendel@twistedcode.net>
Date: 01/11/2011 17:23:58
URL: https://github.com/mono/mono/commit/42d8b111ec9baacdf5e80d575ebd410b0b547e0b
[asp.net] Fix for bug #662918. Do not create the HtmlTitle child control for HtmlHead \
if <title> wasn't used in the page code.
Changed paths:
M mcs/class/System.Web/Makefile
M mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlHead.cs
M mcs/class/System.Web/System.Web_test.dll.sources
Added paths:
A mcs/class/System.Web/Test/System.Web.UI.HtmlControls/HtmlHeadTest.cs
A mcs/class/System.Web/Test/mainsoft/NunitWebResources/HtmlTitleCodeRender_Bug662918.aspx
Modified: mcs/class/System.Web/Makefile
===================================================================
--- a/mcs/class/System.Web/Makefile
+++ b/mcs/class/System.Web/Makefile
@@ -234,7 +234,8 @@ TEST_RESOURCE_FILES = \
Test/mainsoft/NunitWebResources/GridView_Bug595567.aspx \
Test/mainsoft/NunitWebResources/CheckBoxList_Bug600415.aspx \
Test/mainsoft/NunitWebResources/BoundField_Bug646505.aspx \
- Test/mainsoft/NunitWebResources/BoundField_Bug646505.aspx.cs
+ Test/mainsoft/NunitWebResources/BoundField_Bug646505.aspx.cs \
+ Test/mainsoft/NunitWebResources/HtmlTitleCodeRender_Bug662918.aspx
RESX_DIST = resources/TranslationResources.resx
ifneq (1, $(FRAMEWORK_VERSION_MAJOR))
Modified: mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlHead.cs
===================================================================
--- a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlHead.cs
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlHead.cs
@@ -72,9 +72,13 @@ namespace System.Web.UI.HtmlControls
protected internal override void RenderChildren (HtmlTextWriter writer)
{
- EnsureTitleControl ();
-
base.RenderChildren (writer);
+ if (title == null) {
+ writer.RenderBeginTag (HtmlTextWriterTag.Title);
+ if (!String.IsNullOrEmpty (titleText))
+ writer.Write (titleText);
+ writer.RenderEndTag ();
+ }
#if NET_4_0
if (descriptionMeta == null && descriptionText != null) {
writer.AddAttribute ("name", "description");
@@ -129,15 +133,6 @@ namespace System.Web.UI.HtmlControls
#endif
base.RemovedControl (control);
}
-
- void EnsureTitleControl () {
- if (title != null)
- return;
-
- HtmlTitle t = new HtmlTitle ();
- t.Text = titleText;
- Controls.Add (t);
- }
#if NET_4_0
public string Description {
get {
Modified: mcs/class/System.Web/System.Web_test.dll.sources
===================================================================
--- a/mcs/class/System.Web/System.Web_test.dll.sources
+++ b/mcs/class/System.Web/System.Web_test.dll.sources
@@ -126,6 +126,7 @@ System.Web.UI.HtmlControls/HtmlAnchorTest.cs
System.Web.UI.HtmlControls/HtmlButtonTest.cs
System.Web.UI.HtmlControls/HtmlContainerControlTest.cs
System.Web.UI.HtmlControls/HtmlFormTest.cs
+System.Web.UI.HtmlControls/HtmlHeadTest.cs
System.Web.UI.HtmlControls/HtmlImageTest.cs
System.Web.UI.HtmlControls/HtmlInputButtonTest.cs
System.Web.UI.HtmlControls/HtmlInputCheckBoxTest.cs
Added: mcs/class/System.Web/Test/System.Web.UI.HtmlControls/HtmlHeadTest.cs
===================================================================
--- /dev/null
+++ b/mcs/class/System.Web/Test/System.Web.UI.HtmlControls/HtmlHeadTest.cs
@@ -0,0 +1,57 @@
+//
+// Author:
+// Marek Habersack <grendel@twistedcode.net>
+//
+// Copyright (C) 2011 Novell, Inc (http://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.
+//
+using System;
+using System.Web;
+using System.Web.Compilation;
+using System.Threading;
+
+using NUnit.Framework;
+using MonoTests.SystemWeb.Framework;
+using MonoTests.stand_alone.WebHarness;
+
+namespace MonoTests.System.Web.UI.HtmlControls
+{
+ [TestFixture]
+ public class HtmlHeadTest
+ {
+ [TestFixtureSetUp]
+ public void SetUp ()
+ {
+ WebTest.CopyResource (this.GetType (), "HtmlTitleCodeRender_Bug662918.aspx", \
"HtmlTitleCodeRender_Bug662918.aspx"); + }
+
+ [Test (Description="Bug #662918")]
+ public void HtmlTitleCodeRender_Bug662918 ()
+ {
+ string origHtml = "<head><title>\r\n\tTitle text\r\n</title></head>";
+ string pageHtml = new WebTest ("HtmlTitleCodeRender_Bug662918.aspx").Run ();
+ string renderedHtml = HtmlDiff.GetControlFromPageHtml (pageHtml);
+
+ HtmlDiff.AssertAreEqual (origHtml, renderedHtml, "#A1");
+ }
+ }
+}
+
Added: mcs/class/System.Web/Test/mainsoft/NunitWebResources/HtmlTitleCodeRender_Bug662918.aspx
===================================================================
--- /dev/null
+++ b/mcs/class/System.Web/Test/mainsoft/NunitWebResources/HtmlTitleCodeRender_Bug662918.aspx
@@ -0,0 +1,9 @@
+<%@ Page Language="C#" AutoEventWireup="true" CodeFile="MyPage.aspx.cs" \
Inherits="MyPage" %> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" \
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html \
xmlns="http://www.w3.org/1999/xhtml"> +<%= \
MonoTests.stand_alone.WebHarness.HtmlDiff.BEGIN_TAG %><head runat="server"><% \
this.Title = "Title text"; %></head><%= \
MonoTests.stand_alone.WebHarness.HtmlDiff.END_TAG %> +<body>
+Hello
+</body>
+</html>
+
Commit: b2823262bafef6c97204c75ceabeb33cfa2ffc6d
Author: Christian Hergert <chris@dronelabs.com>
Committer: Miguel de Icaza <miguel@gnome.org>
Date: 01/11/2011 19:46:05
URL: https://github.com/mono/mono/commit/b2823262bafef6c97204c75ceabeb33cfa2ffc6d
Fix broken g_int_hash/g_int_equal semantics
Both g_int_hash and g_int_equal used the semantics that an
integer is stored directly in the pointer. This is incorrect
as the pointer actually points to a location containing an
integer.
For those wanting the previous (incorrect) implementation,
they should look at g_direct_hash and g_direct_equal.
Changed paths:
M eglib/src/ghashtable.c
Modified: eglib/src/ghashtable.c
===================================================================
--- a/eglib/src/ghashtable.c
+++ b/eglib/src/ghashtable.c
@@ -579,13 +579,13 @@ g_direct_hash (gconstpointer v1)
gboolean
g_int_equal (gconstpointer v1, gconstpointer v2)
{
- return GPOINTER_TO_INT (v1) == GPOINTER_TO_INT (v2);
+ return *(gint *)v1 == *(gint *)v2;
}
guint
g_int_hash (gconstpointer v1)
{
- return GPOINTER_TO_UINT(v1);
+ return *(guint *)v1;
}
gboolean
Commit: c098d0d842157e231fc1196bf8e81eeab0932123
Author: Marek Safar <marek.safar@gmail.com>
Date: 01/12/2011 04:26:20
URL: https://github.com/mono/mono/commit/c098d0d842157e231fc1196bf8e81eeab0932123
[662222] Import dynamic attribute using attribute type reader
Changed paths:
M mcs/mcs/import.cs
Modified: mcs/mcs/import.cs
===================================================================
--- a/mcs/mcs/import.cs
+++ b/mcs/mcs/import.cs
@@ -53,28 +53,26 @@ namespace Mono.CSharp
//
// Returns true when object at local position has dynamic attribute flag
//
- public bool IsDynamicObject {
- get {
- if (provider != null)
- ReadAttribute ();
+ public bool IsDynamicObject (MetadataImporter importer)
+ {
+ if (provider != null)
+ ReadAttribute (importer);
- return flags != null && Position < flags.Length && flags[Position];
- }
+ return flags != null && Position < flags.Length && flags[Position];
}
//
// Returns true when DynamicAttribute exists
//
- public bool HasDynamicAttribute {
- get {
- if (provider != null)
- ReadAttribute ();
+ public bool HasDynamicAttribute (MetadataImporter importer)
+ {
+ if (provider != null)
+ ReadAttribute (importer);
- return flags != null;
- }
+ return flags != null;
}
- void ReadAttribute ()
+ void ReadAttribute (MetadataImporter importer)
{
IList<CustomAttributeData> cad;
if (provider is MemberInfo) {
@@ -87,9 +85,10 @@ namespace Mono.CSharp
}
if (cad.Count > 0) {
+ string ns, name;
foreach (var ca in cad) {
- var type = ca.Constructor.DeclaringType;
- if (type.Name != "DynamicAttribute" && type.Namespace != \
CompilerServicesNamespace) + importer.GetCustomAttributeTypeName (ca, out ns, \
out name); + if (name != "DynamicAttribute" && ns != CompilerServicesNamespace)
continue;
if (ca.ConstructorArguments.Count == 0) {
@@ -634,7 +633,7 @@ namespace Mono.CSharp
TypeSpec spec;
if (import_cache.TryGetValue (type, out spec)) {
if (spec == TypeManager.object_type) {
- if (dtype.IsDynamicObject)
+ if (dtype.IsDynamicObject (this))
return InternalType.Dynamic;
return spec;
@@ -643,7 +642,7 @@ namespace Mono.CSharp
if (!spec.IsGeneric || type.IsGenericTypeDefinition)
return spec;
- if (!dtype.HasDynamicAttribute)
+ if (!dtype.HasDynamicAttribute (this))
return spec;
// We've found same object in the cache but this one has a dynamic custom \
attribute
Commit: d9619cbfa966cfed61dcb40abc5f80349ab33066
Author: Marek Safar <marek.safar@gmail.com>
Date: 01/12/2011 04:26:46
URL: https://github.com/mono/mono/commit/d9619cbfa966cfed61dcb40abc5f80349ab33066
Install new ikvm based C# compiler as mcs
Changed paths:
M mcs/mcs/Makefile
M scripts/Makefile.am
Added paths:
A scripts/mcs.in
Modified: mcs/mcs/Makefile
===================================================================
--- a/mcs/mcs/Makefile
+++ b/mcs/mcs/Makefile
@@ -16,6 +16,7 @@ EXTRA_DISTFILES = \
ifeq (basic, $(PROFILE))
LOCAL_MCS_FLAGS += -d:STATIC
COMPILER_NAME = mcs
+PROGRAM_INSTALL_DIR = $(mono_libdir)/mono/2.0
endif
ifeq (net_2_0, $(PROFILE))
@@ -58,6 +59,13 @@ csproj-local:
echo $(BUILT_SOURCES); \
echo $(PROGRAM); \
echo $(response)) > $(topdir)/../mono/msvc/scripts/inputs/$$config_file
+
+ifeq (basic, $(PROFILE))
+install-local:
+ $(MKINSTALLDIRS) $(DESTDIR)$(PROGRAM_INSTALL_DIR)
+ $(INSTALL_BIN) $(PROGRAM) $(DESTDIR)$(PROGRAM_INSTALL_DIR)
+ test ! -f $(PROGRAM).mdb || $(INSTALL_BIN) $(PROGRAM).mdb \
$(DESTDIR)$(PROGRAM_INSTALL_DIR) +endif
#
# Below this line we have local targets used for testing and development
Modified: scripts/Makefile.am
===================================================================
--- a/scripts/Makefile.am
+++ b/scripts/Makefile.am
@@ -31,11 +31,11 @@ bin_SCRIPTS = \
$(scripts_service) \
$(scripts_nunit) \
$(scripts_rpmhelpers) \
- $(scripts_mcs) \
$(MDOC_SUBCOMMANDS) \
$(MDOC_COMPAT) \
mono-test-install \
peverify \
+ mcs \
mono-heapviz \
$(scripts_mono_configuration_crypto)
@@ -132,10 +132,9 @@ scripts_defaults = \
scripts_service = mono-service mono-service2
scripts_nunit = nunit-console$(SCRIPT_SUFFIX) nunit-console2$(SCRIPT_SUFFIX)
scripts_rpmhelpers = mono-find-provides mono-find-requires
-scripts_mcs = mcs$(SCRIPT_SUFFIX)
scripts_mono_configuration_crypto = mono-configuration-crypto$(SCRIPT_SUFFIX)
-CLEANFILES = $(scripts_mono_configuration_crypto) $(scripts_mcs) \
$(scripts_4_0_umask) $(scripts_2_0) $(scripts_defaults) $(scripts_4_0) mono-service \
mono-service2 nunit-console nunit-console2 mono-find-provides mono-find-requires mod \
$(MDOC_SUBCOMMANDS) +CLEANFILES = $(scripts_mono_configuration_crypto) \
$(scripts_4_0_umask) $(scripts_2_0) $(scripts_defaults) $(scripts_4_0) mono-service \
mono-service2 nunit-console nunit-console2 mono-find-provides mono-find-requires mod \
$(MDOC_SUBCOMMANDS) DISTCLEANFILES = $(pkgconfig_DATA) $(scripts_rpmhelpers)
EXTRA_DIST = \
@@ -148,6 +147,7 @@ EXTRA_DIST = \
mono-find-provides.in \
mono-find-requires.in \
peverify.in \
+ mcs.in \
mono-test-install \
mono-heapviz \
$(MDOC_COMPAT) \
@@ -197,6 +197,10 @@ peverify: peverify.in Makefile
$(REWRITE_COMMON) $(srcdir)/peverify.in > $@.tmp
mv -f $@.tmp $@
+mcs: mcs.in Makefile
+ $(REWRITE_COMMON) $(srcdir)/mcs.in > $@.tmp
+ mv -f $@.tmp $@
+
mono-service: mono-service.in Makefile
$(REWRITE4) -e 's,@''exe_name@,$@,g' $(srcdir)/mono-service.in > $@.tmp
mv -f $@.tmp $@
@@ -224,10 +228,6 @@ $(scripts_4_0_umask): script_umask.in Makefile
$(REWRITE4) -e "s,@""exe_name@,$$n,g" $(srcdir)/script_umask.in | $(FILTER) > \
$@.tmp mv -f $@.tmp $@
-mcs$(SCRIPT_SUFFIX): $(SCRIPT_IN) Makefile
- $(REWRITE2) -e "s,@exe_name@,gmcs,g" $(srcdir)/$(SCRIPT_IN) > $@.tmp
- mv -f $@.tmp $@
-
$(scripts_defaults): $(SCRIPT_IN) Makefile
n=`echo $@ | sed 's,$(COMPAT_4_0_SUFFIX)$$,,'`; \
$(REWRITE4) -e "s,@""exe_name@,$$n,g" $(srcdir)/$(SCRIPT_IN) | $(FILTER) > $@.tmp
Added: scripts/mcs.in
===================================================================
--- /dev/null
+++ b/scripts/mcs.in
@@ -0,0 +1,3 @@
+#!/bin/sh
+exec @bindir@/mono $MONO_OPTIONS @mono_instdir@/2.0/mcs.exe -lib:@mono_instdir@/2.0 \
-lib:@mono_instdir@/3.5 "$@" +
Commit: a67eb7f2249a4b791923691b1355728f8df022a3
Author: Marek Safar <marek.safar@gmail.com>
Date: 01/12/2011 04:27:39
URL: https://github.com/mono/mono/commit/a67eb7f2249a4b791923691b1355728f8df022a3
Use base type parameters to extract params modifier of virtual method
Changed paths:
M mcs/errors/known-issues-dmcs
M mcs/errors/known-issues-gmcs
M mcs/mcs/ecore.cs
Modified: mcs/errors/known-issues-dmcs
===================================================================
--- a/mcs/errors/known-issues-dmcs
+++ b/mcs/errors/known-issues-dmcs
@@ -45,7 +45,6 @@ cs0307-6.cs
cs0308-7.cs
cs0315.cs NO ERROR
cs0520.cs
-cs1501-2.cs NO ERROR # Needs clarification
cs1509.cs
cs1542.cs NO ERROR
cs1574-3.cs NO ERROR
Modified: mcs/errors/known-issues-gmcs
===================================================================
--- a/mcs/errors/known-issues-gmcs
+++ b/mcs/errors/known-issues-gmcs
@@ -42,7 +42,6 @@ cs0307-6.cs
cs0308-7.cs
cs0315.cs NO ERROR
cs0520.cs
-cs1501-2.cs NO ERROR # Needs clarification
cs1509.cs
cs1542.cs NO ERROR
cs1574-3.cs NO ERROR
Modified: mcs/mcs/ecore.cs
===================================================================
--- a/mcs/mcs/ecore.cs
+++ b/mcs/mcs/ecore.cs
@@ -3731,7 +3731,12 @@ namespace Mono.CSharp {
//
int IsApplicable (ResolveContext ec, ref Arguments arguments, int arg_count, ref \
MemberSpec candidate, IParametersMember pm, ref bool params_expanded_form, ref bool \
dynamicArgument, ref TypeSpec returnType) {
+ // Parameters of most-derived type used mainly for named and optional parameters
var pd = pm.Parameters;
+
+ // Used for params modifier only, that's legacy of C# 1.0 which uses base type \
for + // params modifier instead of most-derived type
+ var cpd = ((IParametersMember) candidate).Parameters;
int param_count = pd.Count;
int optional_count = 0;
int score;
@@ -3751,7 +3756,7 @@ namespace Mono.CSharp {
return int.MaxValue - 10000 + args_gap - optional_count;
// Readjust expected number when params used
- if (pd.HasParams) {
+ if (cpd.HasParams) {
optional_count--;
if (arg_count < param_count)
param_count--;
@@ -3759,7 +3764,7 @@ namespace Mono.CSharp {
return int.MaxValue - 10000 + args_gap;
}
} else if (arg_count != param_count) {
- if (!pd.HasParams)
+ if (!cpd.HasParams)
return int.MaxValue - 10000 + args_gap;
if (arg_count < param_count - 1)
return int.MaxValue - 10000 + args_gap;
@@ -3808,7 +3813,7 @@ namespace Mono.CSharp {
Argument temp;
if (index >= param_count) {
// When using parameters which should not be available to the user
- if ((pd.FixedParameters[index].ModFlags & Parameter.Modifier.PARAMS) == 0)
+ if ((cpd.FixedParameters[index].ModFlags & Parameter.Modifier.PARAMS) == 0)
break;
arguments.Add (null);
@@ -3844,6 +3849,7 @@ namespace Mono.CSharp {
//
// 1. Handle generic method using type arguments when specified or type inference
//
+ TypeSpec[] ptypes;
var ms = candidate as MethodSpec;
if (ms != null && ms.IsGeneric) {
// Setup constraint checker for probing only
@@ -3901,10 +3907,12 @@ namespace Mono.CSharp {
}
candidate = ms;
-
+ ptypes = ms.Parameters.Types;
} else {
if (type_arguments != null)
return int.MaxValue - 15000;
+
+ ptypes = cpd.Types;
}
//
@@ -3912,7 +3920,6 @@ namespace Mono.CSharp {
//
Parameter.Modifier p_mod = 0;
TypeSpec pt = null;
- TypeSpec[] ptypes = ((IParametersMember) candidate).Parameters.Types;
for (int i = 0; i < arg_count; i++) {
Argument a = arguments[i];
@@ -3946,7 +3953,7 @@ namespace Mono.CSharp {
}
if (p_mod != Parameter.Modifier.PARAMS) {
- p_mod = pd.FixedParameters[i].ModFlags;
+ p_mod = (pd.FixedParameters[i].ModFlags & ~Parameter.Modifier.PARAMS) | \
(cpd.FixedParameters[i].ModFlags & Parameter.Modifier.PARAMS); pt = ptypes [i];
} else if (!params_expanded_form) {
params_expanded_form = true;
@@ -4004,7 +4011,7 @@ namespace Mono.CSharp {
//
// When params parameter has no argument it will be provided later if the method \
is the best candidate //
- if (arg_count + 1 == pd.Count && (pd.FixedParameters [arg_count].ModFlags & \
Parameter.Modifier.PARAMS) != 0) + if (arg_count + 1 == pd.Count && \
(cpd.FixedParameters [arg_count].ModFlags & Parameter.Modifier.PARAMS) != 0) \
params_expanded_form = true;
//
@@ -4469,7 +4476,7 @@ namespace Mono.CSharp {
// For candidates which match on parameters count report more details about \
incorrect arguments //
if (pm != null) {
- int unexpanded_count = pm.Parameters.HasParams ? pm.Parameters.Count - 1 : \
pm.Parameters.Count; + int unexpanded_count = ((IParametersMember) \
best_candidate).Parameters.HasParams ? pm.Parameters.Count - 1 : \
pm.Parameters.Count;
if (pm.Parameters.Count == arg_count || params_expanded || unexpanded_count == \
arg_count) { // Reject any inaccessible member
if (!best_candidate.IsAccessible (rc.CurrentType) || \
!best_candidate.DeclaringType.IsAccessible (rc.CurrentType)) {
Commit: 4ae2b5037d1d5bf2396e032ae688885def354c1a
Author: Marek Safar <marek.safar@gmail.com>
Date: 01/12/2011 04:28:03
URL: https://github.com/mono/mono/commit/4ae2b5037d1d5bf2396e032ae688885def354c1a
Update copyright years
Changed paths:
M mcs/mcs/driver.cs
Modified: mcs/mcs/driver.cs
===================================================================
--- a/mcs/mcs/driver.cs
+++ b/mcs/mcs/driver.cs
@@ -162,7 +162,7 @@ namespace Mono.CSharp
static void Usage ()
{
Console.WriteLine (
- "Mono C# compiler, Copyright 2001 - 2008 Novell, Inc.\n" +
+ "Mono C# compiler, Copyright 2001 - 2011 Novell, Inc.\n" +
"mcs [options] source-files\n" +
" --about About the Mono C# compiler\n" +
" -addmodule:M1[,Mn] Adds the module to the generated assembly\n" +
@@ -217,7 +217,7 @@ namespace Mono.CSharp
static void About ()
{
Console.WriteLine (
- "The Mono C# compiler is Copyright 2001-2008, Novell, Inc.\n\n" +
+ "The Mono C# compiler is Copyright 2001-2011, Novell, Inc.\n\n" +
"The compiler source code is released under the terms of the \n"+
"MIT X11 or GNU GPL licenses\n\n" +
Commit: 403346372fc3c53f45330a7e9b1aad15ea4c19d3
Author: Atsushi Eno <atsushi@ximian.com>
Date: 01/12/2011 06:05:08
URL: https://github.com/mono/mono/commit/403346372fc3c53f45330a7e9b1aad15ea4c19d3
Fix cygwin build.
Changed paths:
M mono/metadata/sgen-gc.h
Modified: mono/metadata/sgen-gc.h
===================================================================
--- a/mono/metadata/sgen-gc.h
+++ b/mono/metadata/sgen-gc.h
@@ -26,6 +26,9 @@
/* pthread impl */
#include "config.h"
+
+#ifdef HAVE_SGEN_GC
+
#include <glib.h>
#include <pthread.h>
#include <signal.h>
@@ -802,4 +805,6 @@ void mono_sgen_los_iterate_live_block_ranges \
(sgen_cardtable_block_callback call void mono_sgen_los_scan_card_table \
(SgenGrayQueue *queue) MONO_INTERNAL; FILE *mono_sgen_get_logfile (void) \
MONO_INTERNAL;
+#endif /* HAVE_SGEN_GC */
+
#endif /* __MONO_SGENGC_H__ */
Commit: 6c6008506fdbf58238094eeb1209776267c3b9eb
Author: Rodrigo Kumpera <kumpera@gmail.com>
Date: 01/12/2011 12:32:35
URL: https://github.com/mono/mono/commit/6c6008506fdbf58238094eeb1209776267c3b9eb
Handle more cases of gtd encoded as ginst over itself.
* verify.c (mono_type_is_valid_type_in_context_full):
The trick of encoding the GTD as an instantiation over its
own arguments is also valid for component types such as GTD[]
GTD[,] and Foo<GTD>.
Changed paths:
M mono/metadata/verify.c
Modified: mono/metadata/verify.c
===================================================================
--- a/mono/metadata/verify.c
+++ b/mono/metadata/verify.c
@@ -495,17 +495,17 @@ mono_type_is_valid_type_in_context_full (MonoType *type, \
MonoGenericContext *con return FALSE;
break;
case MONO_TYPE_SZARRAY:
- return mono_type_is_valid_type_in_context_full (&type->data.klass->byval_arg, \
context, TRUE); + return mono_type_is_valid_type_in_context_full \
(&type->data.klass->byval_arg, context, check_gtd); case MONO_TYPE_ARRAY:
- return mono_type_is_valid_type_in_context_full \
(&type->data.array->eklass->byval_arg, context, TRUE); + return \
mono_type_is_valid_type_in_context_full (&type->data.array->eklass->byval_arg, \
context, check_gtd); case MONO_TYPE_PTR:
- return mono_type_is_valid_type_in_context_full (type->data.type, context, TRUE);
+ return mono_type_is_valid_type_in_context_full (type->data.type, context, \
check_gtd); case MONO_TYPE_GENERICINST:
inst = type->data.generic_class->context.class_inst;
if (!inst->is_open)
break;
for (i = 0; i < inst->type_argc; ++i)
- if (!mono_type_is_valid_type_in_context_full (inst->type_argv [i], context, \
TRUE)) + if (!mono_type_is_valid_type_in_context_full (inst->type_argv [i], \
context, check_gtd)) return FALSE;
break;
case MONO_TYPE_CLASS:
Commit: 882fad8a8ebe1651451b93388d9537d5bea7b566
Author: Rodrigo Kumpera <kumpera@gmail.com>
Date: 01/12/2011 12:32:48
URL: https://github.com/mono/mono/commit/882fad8a8ebe1651451b93388d9537d5bea7b566
Fix array assignability to one of its generic interfaces.
* verify.c: mono_class_is_assignable_from can't handle
IList<GTD<T>> x GTD[] since GTD[] won't have the right
iface slots set. This isn't a problem for the runtime
since GTD[] will never happen as it's an unrealizable type.
Fixes #663815
Changed paths:
M mono/metadata/verify.c
Modified: mono/metadata/verify.c
===================================================================
--- a/mono/metadata/verify.c
+++ b/mono/metadata/verify.c
@@ -234,6 +234,9 @@ mono_method_is_valid_generic_instantiation (VerifyContext *ctx, \
MonoMethod *meth
static MonoGenericParam*
verifier_get_generic_param_from_type (VerifyContext *ctx, MonoType *type);
+
+static gboolean
+verifier_class_is_assignable_from (MonoClass *target, MonoClass *candidate);
//////////////////////////////////////////////////////////////////
@@ -624,6 +627,7 @@ is_valid_generic_instantiation (MonoGenericContainer *gc, \
MonoGenericContext *co ctr = mono_class_from_mono_type (inflated);
mono_metadata_free_type (inflated);
+ /*FIXME maybe we need the same this as verifier_class_is_assignable_from*/
if (!mono_class_is_assignable_from_slow (ctr, paramClass))
return FALSE;
}
@@ -675,7 +679,7 @@ mono_generic_param_is_constraint_compatible (VerifyContext *ctx, \
MonoGenericPara cc = mono_class_from_mono_type (inflated);
mono_metadata_free_type (inflated);
- if (mono_class_is_assignable_from (tc, cc))
+ if (verifier_class_is_assignable_from (tc, cc))
break;
/*
@@ -1847,7 +1851,7 @@ is_array_type_compatible (MonoType *target, MonoType \
*candidate) if (left->rank != right->rank)
return FALSE;
- return mono_class_is_assignable_from (left->eklass, right->eklass);
+ return verifier_class_is_assignable_from (left->eklass, right->eklass);
}
static int
@@ -2030,6 +2034,34 @@ init_stack_with_value_at_exception_boundary (VerifyContext \
*ctx, ILCodeDesc *cod code->stack->stype |= BOXED_MASK;
}
+static gboolean
+verifier_class_is_assignable_from (MonoClass *target, MonoClass *candidate)
+{
+ static MonoClass* generic_icollection_class = NULL;
+ static MonoClass* generic_ienumerable_class = NULL;
+ MonoClass *iface_gtd;
+
+ if (mono_class_is_assignable_from (target, candidate))
+ return TRUE;
+
+ if (!MONO_CLASS_IS_INTERFACE (target) || !target->generic_class || candidate->rank \
!= 1) + return FALSE;
+
+ if (generic_icollection_class == NULL) {
+ generic_icollection_class = mono_class_from_name (mono_defaults.corlib,
+ "System.Collections.Generic", "ICollection`1");
+ generic_ienumerable_class = mono_class_from_name (mono_defaults.corlib,
+ "System.Collections.Generic", "IEnumerable`1");
+ }
+ iface_gtd = target->generic_class->container_class;
+ if (iface_gtd != mono_defaults.generic_ilist_class && iface_gtd != \
generic_icollection_class && iface_gtd != generic_ienumerable_class) + return FALSE;
+
+ target = mono_class_from_mono_type \
(target->generic_class->context.class_inst->type_argv [0]); + candidate = \
candidate->element_class; + return mono_class_is_assignable_from (target, candidate);
+}
+
/*Verify if type 'candidate' can be stored in type 'target'.
*
* If strict, check for the underlying type and not the verification stack types
@@ -2137,8 +2169,7 @@ handle_enum:
return FALSE;
return target_klass == candidate_klass;
}
-
- return mono_class_is_assignable_from (target_klass, candidate_klass);
+ return verifier_class_is_assignable_from (target_klass, candidate_klass);
}
case MONO_TYPE_STRING:
@@ -2158,7 +2189,7 @@ handle_enum:
/* If candidate is an enum it should return true for System.Enum and supertypes.
* That's why here we use the original type and not the underlying type.
*/
- return mono_class_is_assignable_from (target->data.klass, \
mono_class_from_mono_type (original_candidate)); + return \
verifier_class_is_assignable_from (target->data.klass, mono_class_from_mono_type \
(original_candidate));
case MONO_TYPE_OBJECT:
return MONO_TYPE_IS_REFERENCE (candidate);
@@ -2172,7 +2203,7 @@ handle_enum:
left = mono_class_from_mono_type (target);
right = mono_class_from_mono_type (candidate);
- return mono_class_is_assignable_from (left, right);
+ return verifier_class_is_assignable_from (left, right);
}
case MONO_TYPE_ARRAY:
@@ -2315,7 +2346,7 @@ is_compatible_boxed_valuetype (VerifyContext *ctx, MonoType \
*type, MonoType *can if (!strict)
return TRUE;
- return MONO_TYPE_IS_REFERENCE (type) && mono_class_is_assignable_from \
(mono_class_from_mono_type (type), mono_class_from_mono_type (candidate)); + return \
MONO_TYPE_IS_REFERENCE (type) && verifier_class_is_assignable_from \
(mono_class_from_mono_type (type), mono_class_from_mono_type (candidate)); }
static int
@@ -2388,18 +2419,18 @@ mono_delegate_type_equal (MonoType *target, MonoType \
*candidate) target_klass = mono_class_from_mono_type (target);
candidate_klass = mono_class_from_mono_type (candidate);
/*FIXME handle nullables and enum*/
- return mono_class_is_assignable_from (target_klass, candidate_klass);
+ return verifier_class_is_assignable_from (target_klass, candidate_klass);
}
case MONO_TYPE_OBJECT:
return MONO_TYPE_IS_REFERENCE (candidate);
case MONO_TYPE_CLASS:
- return mono_class_is_assignable_from(target->data.klass, mono_class_from_mono_type \
(candidate)); + return verifier_class_is_assignable_from(target->data.klass, \
mono_class_from_mono_type (candidate));
case MONO_TYPE_SZARRAY:
if (candidate->type != MONO_TYPE_SZARRAY)
return FALSE;
- return mono_class_is_assignable_from (mono_class_from_mono_type \
(target)->element_class, mono_class_from_mono_type (candidate)->element_class); \
+ return verifier_class_is_assignable_from (mono_class_from_mono_type \
(target)->element_class, mono_class_from_mono_type (candidate)->element_class);
case MONO_TYPE_ARRAY:
if (candidate->type != MONO_TYPE_ARRAY)
Commit: e159ffb74643027963cac3cdf7f5a01cadea4504
Author: Rodrigo Kumpera <kumpera@gmail.com>
Date: 01/13/2011 05:40:42
URL: https://github.com/mono/mono/commit/e159ffb74643027963cac3cdf7f5a01cadea4504
Fix 2.0 remapping of System.Transations to 2.0 and not 3.5.
Changed paths:
M mono/metadata/assembly.c
Modified: mono/metadata/assembly.c
===================================================================
--- a/mono/metadata/assembly.c
+++ b/mono/metadata/assembly.c
@@ -112,7 +112,7 @@ static const AssemblyVersionMap framework_assemblies [] = {
{"System.Runtime.Serialization.Formatters.Soap", 0},
{"System.Security", 0},
{"System.ServiceProcess", 0},
- {"System.Transactions", 2},
+ {"System.Transactions", 0},
{"System.Web", 0},
{"System.Web.Abstractions", 2},
{"System.Web.Mobile", 0},
Commit: 7132ff6bc1c0c67d9bc02a22dc35a96075f80a49
Author: Jérémie Laval <jeremie.laval@gmail.com>
Date: 01/13/2011 09:40:02
URL: https://github.com/mono/mono/commit/7132ff6bc1c0c67d9bc02a22dc35a96075f80a49
Fix continuation not being scheduled because of too early and too greedy disposing.
Changed paths:
M mcs/class/corlib/System.Threading.Tasks/Task.cs
M mcs/class/corlib/Test/System.Threading.Tasks/TaskTest.cs
Modified: mcs/class/corlib/System.Threading.Tasks/Task.cs
===================================================================
--- a/mcs/class/corlib/System.Threading.Tasks/Task.cs
+++ b/mcs/class/corlib/System.Threading.Tasks/Task.cs
@@ -447,8 +447,6 @@ namespace System.Threading.Tasks
if (CheckTaskOptions (taskCreationOptions, TaskCreationOptions.AttachedToParent) \
&& parent != null){ parent.ChildCompleted ();
}
-
- Dispose ();
}
void ProcessCompleteDelegates ()
@@ -722,7 +720,6 @@ namespace System.Threading.Tasks
// any big object references that the user might have captured in a anonymous \
method if (disposing) {
action = null;
- completed.Clear ();
state = null;
}
}
Modified: mcs/class/corlib/Test/System.Threading.Tasks/TaskTest.cs
===================================================================
--- a/mcs/class/corlib/Test/System.Threading.Tasks/TaskTest.cs
+++ b/mcs/class/corlib/Test/System.Threading.Tasks/TaskTest.cs
@@ -194,6 +194,21 @@ namespace MonoTests.System.Threading.Tasks
});
}
+ [Test]
+ public void ContinueWithChildren ()
+ {
+ ParallelTestHelper.Repeat (delegate {
+ bool result = false;
+
+ var t = Task.Factory.StartNew (() => Task.Factory.StartNew (() => \
Thread.Sleep (100), TaskCreationOptions.AttachedToParent)); + t.ContinueWith (_ \
=> result = true); + while (!t.IsCompleted)
+ Thread.Sleep (200);
+
+ Assert.IsTrue (result);
+ }, 2);
+ }
+
[TestAttribute]
public void MultipleTaskTestCase()
{
@@ -248,7 +263,7 @@ namespace MonoTests.System.Threading.Tasks
Assert.IsTrue(r3, "#2");
Assert.IsTrue(r1, "#3");
Assert.AreEqual (TaskStatus.RanToCompletion, t.Status, "#4");
- }, 10);
+ }, 10);
}
[Test]
Commit: 4689cde2f6be1694167b5c2553978c7a95de541f
Author: Jb Evain <jbevain@gmail.com>
Date: 01/13/2011 10:09:17
URL: https://github.com/mono/mono/commit/4689cde2f6be1694167b5c2553978c7a95de541f
Update cecil from upstream
Changed paths:
M mcs/class/Mono.Cecil/Mono.Cecil/AssemblyReader.cs
M mcs/class/Mono.Cecil/Mono.Cecil/AssemblyWriter.cs
M mcs/class/Mono.Cecil/Mono.Cecil/CallSite.cs
M mcs/class/Mono.Cecil/Mono.Cecil/CustomAttribute.cs
M mcs/class/Mono.Cecil/Mono.Cecil/GenericInstanceMethod.cs
M mcs/class/Mono.Cecil/Mono.Cecil/MetadataResolver.cs
M mcs/class/Mono.Cecil/Mono.Cecil/MethodReference.cs
M mcs/class/Mono.Cecil/Mono.Cecil/TypeReference.cs
M mcs/class/Mono.Cecil/revision
Modified: mcs/class/Mono.Cecil/Mono.Cecil/AssemblyReader.cs
===================================================================
--- a/mcs/class/Mono.Cecil/Mono.Cecil/AssemblyReader.cs
+++ b/mcs/class/Mono.Cecil/Mono.Cecil/AssemblyReader.cs
@@ -1884,6 +1884,8 @@ namespace Mono.Cecil {
ReadMethodSignature (signature, call_site);
+ call_site.MetadataToken = token;
+
return call_site;
}
@@ -2803,10 +2805,11 @@ namespace Mono.Cecil {
if (type.IsArray)
return ReadCustomAttributeFixedArrayArgument ((ArrayType) type);
- if (type.etype == ElementType.Object)
- return ReadCustomAttributeElement (ReadCustomAttributeFieldOrPropType ());
-
- return new CustomAttributeArgument (type, ReadCustomAttributeElementValue \
(type)); + return new CustomAttributeArgument (
+ type,
+ type.etype == ElementType.Object
+ ? ReadCustomAttributeElement (ReadCustomAttributeFieldOrPropType ())
+ : ReadCustomAttributeElementValue (type));
}
object ReadCustomAttributeElementValue (TypeReference type)
Modified: mcs/class/Mono.Cecil/Mono.Cecil/AssemblyWriter.cs
===================================================================
--- a/mcs/class/Mono.Cecil/Mono.Cecil/AssemblyWriter.cs
+++ b/mcs/class/Mono.Cecil/Mono.Cecil/AssemblyWriter.cs
@@ -2279,8 +2279,11 @@ namespace Mono.Cecil {
}
if (type.etype == ElementType.Object) {
- WriteCustomAttributeFieldOrPropType (argument.Type);
- WriteCustomAttributeElement (argument.Type, argument);
+ argument = (CustomAttributeArgument) argument.Value;
+ type = argument.Type;
+
+ WriteCustomAttributeFieldOrPropType (type);
+ WriteCustomAttributeElement (type, argument);
return;
}
Modified: mcs/class/Mono.Cecil/Mono.Cecil/CallSite.cs
===================================================================
--- a/mcs/class/Mono.Cecil/Mono.Cecil/CallSite.cs
+++ b/mcs/class/Mono.Cecil/Mono.Cecil/CallSite.cs
@@ -41,5 +41,14 @@ namespace Mono.Cecil {
return signature.ToString ();
}
}
+
+ public override ModuleDefinition Module {
+ get { return ReturnType.Module; }
+ }
+
+ public override MethodDefinition Resolve ()
+ {
+ return null;
+ }
}
}
Modified: mcs/class/Mono.Cecil/Mono.Cecil/CustomAttribute.cs
===================================================================
--- a/mcs/class/Mono.Cecil/Mono.Cecil/CustomAttribute.cs
+++ b/mcs/class/Mono.Cecil/Mono.Cecil/CustomAttribute.cs
@@ -103,6 +103,10 @@ namespace Mono.Cecil {
get { return constructor.DeclaringType; }
}
+ public bool IsResolved {
+ get { return resolved; }
+ }
+
public bool HasConstructorArguments {
get {
Resolve ();
@@ -195,12 +199,23 @@ namespace Mono.Cecil {
if (resolved || !HasImage)
return;
- Module.Read (this, (attribute, reader) => {
- reader.ReadCustomAttributeSignature (attribute);
- return this;
- });
-
- resolved = true;
+ try {
+ Module.Read (this, (attribute, reader) => {
+ reader.ReadCustomAttributeSignature (attribute);
+ return this;
+ });
+
+ resolved = true;
+ } catch (ResolutionException) {
+ if (arguments != null)
+ arguments.Clear ();
+ if (fields != null)
+ fields.Clear ();
+ if (properties != null)
+ properties.Clear ();
+
+ resolved = false;
+ }
}
}
Modified: mcs/class/Mono.Cecil/Mono.Cecil/GenericInstanceMethod.cs
===================================================================
--- a/mcs/class/Mono.Cecil/Mono.Cecil/GenericInstanceMethod.cs
+++ b/mcs/class/Mono.Cecil/Mono.Cecil/GenericInstanceMethod.cs
@@ -70,11 +70,11 @@ namespace Mono.Cecil {
get {
var signature = new StringBuilder ();
var method = this.ElementMethod;
- signature.Append (method.ReturnType.FullName);
- signature.Append (" ");
- signature.Append (method.DeclaringType.FullName);
- signature.Append ("::");
- signature.Append (method.Name);
+ signature.Append (method.ReturnType.FullName)
+ .Append (" ")
+ .Append (method.DeclaringType.FullName)
+ .Append ("::")
+ .Append (method.Name);
this.GenericInstanceFullName (signature);
this.MethodSignatureFullName (signature);
return signature.ToString ();
Modified: mcs/class/Mono.Cecil/Mono.Cecil/MetadataResolver.cs
===================================================================
--- a/mcs/class/Mono.Cecil/Mono.Cecil/MetadataResolver.cs
+++ b/mcs/class/Mono.Cecil/Mono.Cecil/MetadataResolver.cs
@@ -41,6 +41,21 @@ namespace Mono.Cecil {
AssemblyDefinition Resolve (string fullName, ReaderParameters parameters);
}
+ public class ResolutionException : Exception {
+
+ readonly MemberReference member;
+
+ public MemberReference Member {
+ get { return member; }
+ }
+
+ public ResolutionException (MemberReference member)
+ : base ("Failed to resolve " + member.FullName)
+ {
+ this.member = member;
+ }
+ }
+
static class MetadataResolver {
public static TypeDefinition Resolve (IAssemblyResolver resolver, TypeReference \
type)
Modified: mcs/class/Mono.Cecil/Mono.Cecil/MethodReference.cs
===================================================================
--- a/mcs/class/Mono.Cecil/Mono.Cecil/MethodReference.cs
+++ b/mcs/class/Mono.Cecil/Mono.Cecil/MethodReference.cs
@@ -123,9 +123,9 @@ namespace Mono.Cecil {
public override string FullName {
get {
var builder = new StringBuilder ();
- builder.Append (ReturnType.FullName);
- builder.Append (" ");
- builder.Append (MemberFullName ());
+ builder.Append (ReturnType.FullName)
+ .Append (" ")
+ .Append (MemberFullName ());
this.MethodSignatureFullName (builder);
return builder.ToString ();
}
Modified: mcs/class/Mono.Cecil/Mono.Cecil/TypeReference.cs
===================================================================
--- a/mcs/class/Mono.Cecil/Mono.Cecil/TypeReference.cs
+++ b/mcs/class/Mono.Cecil/Mono.Cecil/TypeReference.cs
@@ -319,7 +319,7 @@ namespace Mono.Cecil {
{
var type = self.Resolve ();
if (type == null)
- throw new InvalidOperationException (string.Format ("Failed to resolve type: \
{0}", self.FullName)); + throw new ResolutionException (self);
return type;
}
Modified: mcs/class/Mono.Cecil/revision
===================================================================
--- a/mcs/class/Mono.Cecil/revision
+++ b/mcs/class/Mono.Cecil/revision
@@ -1 +1 @@
-a00566b60e5ae888758b0d26dd4fbbb93523bf6f
+5f427237847cd9acb3bb14317c83f7c67a04ab41
Commit: 92b877112893109200b2fc2cce7324bde3ff0116
Author: Jb Evain <jbevain@gmail.com>
Date: 01/13/2011 10:09:42
URL: https://github.com/mono/mono/commit/92b877112893109200b2fc2cce7324bde3ff0116
Remove custom ResolutionException now that Cecil is providing one
Changed paths:
M mcs/tools/linker/Mono.Linker.csproj
M mcs/tools/linker/monolinker.exe.sources
Removed paths:
D mcs/tools/linker/Mono.Linker/ResolutionException.cs
Modified: mcs/tools/linker/Mono.Linker.csproj
===================================================================
--- a/mcs/tools/linker/Mono.Linker.csproj
+++ b/mcs/tools/linker/Mono.Linker.csproj
@@ -47,7 +47,6 @@
<Compile Include="Mono.Linker.Steps\RegenerateGuidStep.cs" />
<Compile Include="Mono.Linker.Steps\LoadI18nAssemblies.cs" />
<Compile Include="Mono.Linker\IXApiVisitor.cs" />
- <Compile Include="Mono.Linker\ResolutionException.cs" />
<Compile Include="Mono.Linker\I18nAssemblies.cs" />
<Compile Include="Mono.Linker.Steps\IStep.cs" />
<Compile Include="Mono.Linker.Steps\LoadReferencesStep.cs" />
Modified: mcs/tools/linker/monolinker.exe.sources
===================================================================
--- a/mcs/tools/linker/monolinker.exe.sources
+++ b/mcs/tools/linker/monolinker.exe.sources
@@ -8,7 +8,6 @@
./Mono.Linker/Driver.cs
./Mono.Linker/I18nAssemblies.cs
./Mono.Linker/MethodAction.cs
-./Mono.Linker/ResolutionException.cs
./Mono.Linker/XApiReader.cs
./Mono.Linker/IXApiVisitor.cs
./Mono.Linker.Steps/BaseStep.cs
Commit: 97d18f0c3258061204a9248eed0e681f93e6d9d0
Author: Andrew Jorgensen <ajorgensen@novell.com>
Date: 01/13/2011 11:50:27
URL: https://github.com/mono/mono/commit/97d18f0c3258061204a9248eed0e681f93e6d9d0
2.10
Changed paths:
M configure.in
M winconfig.h
Modified: configure.in
===================================================================
--- a/configure.in
+++ b/configure.in
@@ -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.9)
+AM_INIT_AUTOMAKE(mono,2.10)
AM_MAINTAINER_MODE
API_VER=2.0
Modified: winconfig.h
===================================================================
--- a/winconfig.h
+++ b/winconfig.h
@@ -602,4 +602,4 @@
/* #undef USE_MONO_MUTEX */
/* Version number of package */
-#define VERSION "2.9"
+#define VERSION "2.10"
Commit: 6a8c4a62204843eb630b4639cdacc3f05c8f084e
Author: Jérémie Laval <jeremie.laval@gmail.com>
Date: 01/13/2011 12:18:58
URL: https://github.com/mono/mono/commit/6a8c4a62204843eb630b4639cdacc3f05c8f084e
Rework internal wait mechanism in thread workers participation code
Changed paths:
M mcs/class/corlib/System.Threading.Tasks/IScheduler.cs
M mcs/class/corlib/System.Threading.Tasks/Scheduler.cs
M mcs/class/corlib/System.Threading.Tasks/SchedulerProxy.cs
M mcs/class/corlib/System.Threading.Tasks/Task.cs
M mcs/class/corlib/System.Threading.Tasks/ThreadWorker.cs
Modified: mcs/class/corlib/System.Threading.Tasks/IScheduler.cs
===================================================================
--- a/mcs/class/corlib/System.Threading.Tasks/IScheduler.cs
+++ b/mcs/class/corlib/System.Threading.Tasks/IScheduler.cs
@@ -33,7 +33,7 @@ namespace System.Threading.Tasks
{
void AddWork (Task t);
void ParticipateUntil (Task task);
- bool ParticipateUntil (Task task, Func<bool> predicate);
+ bool ParticipateUntil (Task task, ManualResetEventSlim predicateEvt, int \
millisecondsTimeout); void PulseAll ();
}
}
Modified: mcs/class/corlib/System.Threading.Tasks/Scheduler.cs
===================================================================
--- a/mcs/class/corlib/System.Threading.Tasks/Scheduler.cs
+++ b/mcs/class/corlib/System.Threading.Tasks/Scheduler.cs
@@ -63,33 +63,35 @@ namespace System.Threading.Tasks
{
if (task.IsCompleted)
return;
+
+ ManualResetEventSlim evt = new ManualResetEventSlim (false);
+ task.ContinueWith (_ => evt.Set (), \
TaskContinuationOptions.ExecuteSynchronously); + if (evt.IsSet)
+ return;
- ParticipateUntilInternal (task, TaskCompletedPredicate);
+ ParticipateUntilInternal (task, evt, -1);
}
- public bool ParticipateUntil (Task task, Func<bool> predicate)
+ public bool ParticipateUntil (Task task, ManualResetEventSlim evt, int \
millisecondsTimeout) {
if (task.IsCompleted)
return false;
+
+ bool isFromPredicate = true;
+ task.ContinueWith (_ => { isFromPredicate = false; evt.Set (); }, \
TaskContinuationOptions.ExecuteSynchronously);
- bool isFromPredicate = false;
-
- ParticipateUntilInternal (task, delegate {
- if (predicate ()) {
- isFromPredicate = true;
- return true;
- }
- return task.IsCompleted;
- });
+ ParticipateUntilInternal (task, evt, millisecondsTimeout);
return isFromPredicate;
}
// Called with Task.WaitAll(someTasks) or Task.WaitAny(someTasks) so that we can \
remove ourselves // also when our wait condition is ok
- public void ParticipateUntilInternal (Task self, Func<Task, bool> predicate)
- {
- ThreadWorker.WorkerMethod (self, predicate, workQueue, workers, pulseHandle);
+ public void ParticipateUntilInternal (Task self, ManualResetEventSlim evt, int \
millisecondsTimeout) + {
+ if (millisecondsTimeout == -1)
+ millisecondsTimeout = int.MaxValue;
+ ThreadWorker.WorkerMethod (self, evt, millisecondsTimeout, workQueue, workers, \
pulseHandle); }
static bool TaskCompletedPredicate (Task self)
Modified: mcs/class/corlib/System.Threading.Tasks/SchedulerProxy.cs
===================================================================
--- a/mcs/class/corlib/System.Threading.Tasks/SchedulerProxy.cs
+++ b/mcs/class/corlib/System.Threading.Tasks/SchedulerProxy.cs
@@ -50,16 +50,15 @@ namespace System.Threading.Tasks
ParticipateUntil (() => task.IsCompleted);
}
- public bool ParticipateUntil (Task task, Func<bool> predicate)
+ public bool ParticipateUntil (Task task, ManualResetEventSlim evt, int \
millisecondsTimeout) {
bool fromPredicate = false;
ParticipateUntil (() => {
- if (predicate ()) {
+ if (evt.IsSet) {
fromPredicate = true;
return true;
}
-
return task.IsCompleted;
});
@@ -69,7 +68,7 @@ namespace System.Threading.Tasks
public void ParticipateUntil (Func<bool> predicate)
{
SpinWait sw = new SpinWait ();
-
+
while (!predicate ())
sw.SpinOnce ();
}
Modified: mcs/class/corlib/System.Threading.Tasks/Task.cs
===================================================================
--- a/mcs/class/corlib/System.Threading.Tasks/Task.cs
+++ b/mcs/class/corlib/System.Threading.Tasks/Task.cs
@@ -133,7 +133,7 @@ namespace System.Threading.Tasks
static void EmptyFunc (object o)
{
}
-
+
#region Start
public void Start ()
{
@@ -209,6 +209,7 @@ namespace System.Threading.Tasks
{
Task continuation = new Task ((o) => continuationAction ((Task)o), this, \
cancellationToken, GetCreationOptions (continuationOptions)); ContinueWithCore \
(continuation, continuationOptions, scheduler); +
return continuation;
}
@@ -522,9 +523,13 @@ namespace System.Threading.Tasks
millisecondsTimeout = ComputeTimeout (millisecondsTimeout, watch);
}
- Func<bool> stopFunc
- = delegate { cancellationToken.ThrowIfCancellationRequested (); return \
watch.ElapsedMilliseconds > millisecondsTimeout; };
- bool result = scheduler.ParticipateUntil (this, stopFunc);
+ ManualResetEventSlim predicateEvt = new ManualResetEventSlim (false);
+ if (cancellationToken != CancellationToken.None) {
+ cancellationToken.Register (predicateEvt.Set);
+ cancellationToken.ThrowIfCancellationRequested ();
+ }
+
+ bool result = scheduler.ParticipateUntil (this, predicateEvt, \
millisecondsTimeout);
if (exception != null)
throw exception;
@@ -638,6 +643,7 @@ namespace System.Threading.Tasks
IScheduler sched = null;
Task task = null;
Watch watch = Watch.StartNew ();
+ ManualResetEventSlim predicateEvt = new ManualResetEventSlim (false);
foreach (Task t in tasks) {
int indexResult = index++;
@@ -649,6 +655,9 @@ namespace System.Threading.Tasks
// Check if we are the first to have finished
if (result == 1)
indexFirstFinished = indexResult;
+
+ // Stop waiting
+ predicateEvt.Set ();
}, TaskContinuationOptions.ExecuteSynchronously);
if (sched == null && t.scheduler != null) {
@@ -667,20 +676,17 @@ namespace System.Threading.Tasks
task = tasks[shandle];
millisecondsTimeout = ComputeTimeout (millisecondsTimeout, watch);
}
-
+
// One task already finished
if (indexFirstFinished != -1)
return indexFirstFinished;
-
- // All tasks are supposed to use the same TaskScheduler
- sched.ParticipateUntil (task, delegate {
- if (millisecondsTimeout != -1 && watch.ElapsedMilliseconds > \
millisecondsTimeout)
- return true;
+ if (cancellationToken != CancellationToken.None) {
+ cancellationToken.Register (predicateEvt.Set);
cancellationToken.ThrowIfCancellationRequested ();
+ }
- return numFinished >= 1;
- });
+ sched.ParticipateUntil (task, predicateEvt, millisecondsTimeout);
// Index update is still not done
if (indexFirstFinished == -1) {
@@ -688,7 +694,7 @@ namespace System.Threading.Tasks
while (indexFirstFinished == -1)
wait.SpinOnce ();
}
-
+
return indexFirstFinished;
}
Modified: mcs/class/corlib/System.Threading.Tasks/ThreadWorker.cs
===================================================================
--- a/mcs/class/corlib/System.Threading.Tasks/ThreadWorker.cs
+++ b/mcs/class/corlib/System.Threading.Tasks/ThreadWorker.cs
@@ -208,12 +208,18 @@ namespace System.Threading.Tasks
// Predicate should be really fast and not blocking as it is called a good deal of \
time // Also, the method skip tasks that are LongRunning to avoid blocking (Task are \
not LongRunning by default) public static void WorkerMethod (Task self,
- Func<Task, bool> predicate,
+ ManualResetEventSlim predicateEvt,
+ int millisecondsTimeout,
IProducerConsumerCollection<Task> \
sharedWorkQueue, ThreadWorker[] others,
ManualResetEvent evt)
{
- while (!predicate (self)) {
+ const int stage1 = 5, stage2 = 0;
+ int tries = 8;
+ WaitHandle[] handles = null;
+ Watch watch = Watch.StartNew ();
+
+ while (!predicateEvt.IsSet && watch.ElapsedMilliseconds < millisecondsTimeout) {
Task value;
// If we are in fact a normal ThreadWorker, use our own deque
@@ -227,50 +233,66 @@ namespace System.Threading.Tasks
evt.Set ();
}
- if (predicate (self))
+ if (predicateEvt.IsSet || watch.ElapsedMilliseconds > millisecondsTimeout)
return;
}
}
+ int count = sharedWorkQueue.Count;
+
// Dequeue only one item as we have restriction
- while (sharedWorkQueue.TryTake (out value) && value != null) {
+ while (--count >= 0 && sharedWorkQueue.TryTake (out value) && value != null) {
evt.Set ();
if (CheckTaskFitness (self, value))
value.Execute (null);
else {
- sharedWorkQueue.TryAdd (value);
+ if (autoReference == null)
+ sharedWorkQueue.TryAdd (value);
+ else
+ autoReference.dDeque.PushBottom (value);
evt.Set ();
}
- if (predicate (self))
+ if (predicateEvt.IsSet || watch.ElapsedMilliseconds > millisecondsTimeout)
return;
}
// First check to see if we comply to predicate
- if (predicate (self))
+ if (predicateEvt.IsSet || watch.ElapsedMilliseconds > millisecondsTimeout)
return;
// Try to complete other work by stealing since our desired tasks may be in \
other worker ThreadWorker other;
for (int i = 0; i < others.Length; i++) {
- if ((other = others [i]) == null)
+ if ((other = others [i]) == autoReference || other == null)
continue;
-
+
if (other.dDeque.PopTop (out value) == PopResult.Succeed && value != null) {
evt.Set ();
if (CheckTaskFitness (self, value))
value.Execute (null);
else {
- sharedWorkQueue.TryAdd (value);
+ if (autoReference == null)
+ sharedWorkQueue.TryAdd (value);
+ else
+ autoReference.dDeque.PushBottom (value);
evt.Set ();
}
}
-
- if (predicate (self))
+
+ if (predicateEvt.IsSet || watch.ElapsedMilliseconds > millisecondsTimeout)
return;
}
- Thread.Yield ();
+ if (--tries > stage1)
+ Thread.Yield ();
+ else if (tries >= stage2)
+ predicateEvt.Wait (ComputeTimeout (100, millisecondsTimeout, watch));
+ else {
+ if (tries == stage2 - 1)
+ handles = new [] { predicateEvt.WaitHandle, evt };
+ WaitHandle.WaitAny (handles, ComputeTimeout (1000, millisecondsTimeout, \
watch)); + }
}
}
@@ -284,6 +306,11 @@ namespace System.Threading.Tasks
{
return ((t.CreationOptions & TaskCreationOptions.LongRunning) == 0 && t.Id < \
self.Id) || t.Parent == self || t == self; }
+
+ static int ComputeTimeout (int proposedTimeout, int timeout, Watch watch)
+ {
+ return timeout == -1 ? proposedTimeout : Math.Min (proposedTimeout, Math.Max (0, \
(int)(timeout - watch.ElapsedMilliseconds))); + }
public bool Finished {
get {
Commit: 6418ad41d20fefb2f8350d57490b109e537f3414
Author: Jérémie Laval <jeremie.laval@gmail.com>
Date: 01/13/2011 12:19:13
URL: https://github.com/mono/mono/commit/6418ad41d20fefb2f8350d57490b109e537f3414
Make use of the wait changes in the internal TaskScheduler -> IScheduler proxy.
Changed paths:
M mcs/class/corlib/System.Threading.Tasks/SchedulerProxy.cs
Modified: mcs/class/corlib/System.Threading.Tasks/SchedulerProxy.cs
===================================================================
--- a/mcs/class/corlib/System.Threading.Tasks/SchedulerProxy.cs
+++ b/mcs/class/corlib/System.Threading.Tasks/SchedulerProxy.cs
@@ -47,32 +47,27 @@ namespace System.Threading.Tasks
public void ParticipateUntil (Task task)
{
- ParticipateUntil (() => task.IsCompleted);
+ ManualResetEventSlim evt = new ManualResetEventSlim (false);
+ task.ContinueWith (_ => evt.Set (), \
TaskContinuationOptions.ExecuteSynchronously); +
+ ParticipateUntil (evt, -1);
}
public bool ParticipateUntil (Task task, ManualResetEventSlim evt, int \
millisecondsTimeout) {
- bool fromPredicate = false;
-
- ParticipateUntil (() => {
- if (evt.IsSet) {
- fromPredicate = true;
- return true;
- }
- return task.IsCompleted;
- });
-
+ bool fromPredicate = true;
+ task.ContinueWith (_ => { fromPredicate = false; evt.Set (); }, \
TaskContinuationOptions.ExecuteSynchronously); +
+ ParticipateUntil (evt, millisecondsTimeout);
+
return fromPredicate;
}
-
- public void ParticipateUntil (Func<bool> predicate)
- {
- SpinWait sw = new SpinWait ();
- while (!predicate ())
- sw.SpinOnce ();
+ void ParticipateUntil (ManualResetEventSlim evt, int millisecondsTimeout)
+ {
+ evt.Wait (millisecondsTimeout);
}
-
+
public void PulseAll ()
{
Commit: 7d25fb2f5e9353311c07f2dc48a4710dada5b7b1
Author: Zoltan Varga <vargaz@gmail.com>
Date: 01/13/2011 12:42:52
URL: https://github.com/mono/mono/commit/7d25fb2f5e9353311c07f2dc48a4710dada5b7b1
Add null check to stelem_ref_check () jit icall. Fixes #664297.
Changed paths:
M mono/mini/arrays.cs
M mono/mini/jit-icalls.c
Modified: mono/mini/arrays.cs
===================================================================
--- a/mono/mini/arrays.cs
+++ b/mono/mini/arrays.cs
@@ -434,6 +434,14 @@ class Tests {
if (sum != 1800)
return 12;
+ /* Null check */
+ object[,] a13 = null;
+ try {
+ a13 [0, 0] = new Object ();
+ return 13;
+ } catch (NullReferenceException) {
+ }
+
return 0;
}
Modified: mono/mini/jit-icalls.c
===================================================================
--- a/mono/mini/jit-icalls.c
+++ b/mono/mini/jit-icalls.c
@@ -74,6 +74,8 @@ mono_helper_stelem_ref_check (MonoArray *array, MonoObject *val)
{
MONO_ARCH_SAVE_REGS;
+ if (!array)
+ mono_raise_exception (mono_get_exception_null_reference ());
if (val && !mono_object_isinst (val, array->obj.vtable->klass->element_class))
mono_raise_exception (mono_get_exception_array_type_mismatch ());
}
Commit: 71d78c2ceb9b5d2654b31f197798271797da66f0
Author: Marek Habersack <grendel@twistedcode.net>
Date: 01/13/2011 14:23:26
URL: https://github.com/mono/mono/commit/71d78c2ceb9b5d2654b31f197798271797da66f0
[asp.net] Implemented the 4.0 type, FileLevelMasterPageControlBuilder
Changed paths:
M mcs/class/System.Web/net_4_0_System.Web.dll.sources
Added paths:
A mcs/class/System.Web/System.Web.UI/FileLevelMasterPageControlBuilder.cs
Modified: mcs/class/System.Web/net_4_0_System.Web.dll.sources
===================================================================
--- a/mcs/class/System.Web/net_4_0_System.Web.dll.sources
+++ b/mcs/class/System.Web/net_4_0_System.Web.dll.sources
@@ -22,6 +22,7 @@ System.Web.SessionState_2.0/SessionStateBehavior.cs
System.Web.Routing/PageRouteHandler.cs
System.Web.UI/ClientIDMode.cs
System.Web.UI/DataKeyPropertyAttribute.cs
+System.Web.UI/FileLevelMasterPageControlBuilder.cs
System.Web.UI/IDataKeysControl.cs
System.Web.UI/ViewStateMode.cs
System.Web.UI.WebControls/IDataBoundControl.cs
Added: mcs/class/System.Web/System.Web.UI/FileLevelMasterPageControlBuilder.cs
===================================================================
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/FileLevelMasterPageControlBuilder.cs
@@ -0,0 +1,38 @@
+//
+// Authors:
+// Marek Habersack <grendel@twistedcode.net>
+//
+// (C) 2011 Novell, Inc (http://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.
+//
+
+using System.Web.UI;
+using System.Web.UI.WebControls;
+
+namespace System.Web.UI
+{
+ public class FileLevelMasterPageControlBuilder : FileLevelPageControlBuilder
+ {
+
+ }
+}
+
Commit: 4085f52f2cc94d8a331f5bf6d4e21e99394decb5
Author: Marek Habersack <grendel@twistedcode.net>
Date: 01/13/2011 14:23:36
URL: https://github.com/mono/mono/commit/4085f52f2cc94d8a331f5bf6d4e21e99394decb5
[data-annotations] Added some missing 4.0 members
Changed paths:
M mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/DataType.cs
M mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/DisplayFormatAttribute.cs
Modified: mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/DataType.cs
===================================================================
--- a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/DataType.cs
+++ b/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/DataType.cs
@@ -4,7 +4,7 @@
// Author:
// Atsushi Enomoto <atsushi@ximian.com>
//
-// Copyright (C) 2008 Novell Inc. http://novell.com
+// Copyright (C) 2008-2011 Novell Inc. http://novell.com
//
//
@@ -44,6 +44,9 @@ namespace System.ComponentModel.DataAnnotations
MultilineText,
EmailAddress,
Password,
- Url
+ Url,
+#if NET_4_0
+ ImageUrl
+#endif
}
}
Modified: mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/DisplayFormatAttribute.cs
===================================================================
--- a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/DisplayFormatAttribute.cs
+++ b/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/DisplayFormatAttribute.cs
@@ -39,5 +39,8 @@ namespace System.ComponentModel.DataAnnotations
public bool ConvertEmptyStringToNull { get; set; }
public string DataFormatString { get; set; }
public string NullDisplayText { get; set; }
+#if NET_4_0
+ public bool HtmlEncode { get; set; }
+#endif
}
}
Commit: b073713bfa1e85ee7349ee91c831b31261d9549e
Author: Andrew Jorgensen <ajorgensen@novell.com>
Date: 01/13/2011 14:37:39
URL: https://github.com/mono/mono/commit/b073713bfa1e85ee7349ee91c831b31261d9549e
Add vcxproj files for msbuild
Changed paths:
M mcs/jay/Makefile
M msvc/Makefile.am
Modified: mcs/jay/Makefile
===================================================================
--- a/mcs/jay/Makefile
+++ b/mcs/jay/Makefile
@@ -10,7 +10,7 @@ sources = closure.c error.c lalr.c lr0.c main.c mkpar.c output.c \
reader.c \ datafiles = ACKNOWLEDGEMENTS NEW_FEATURES NOTES README README.jay \
skeleton \ skeleton.cs
-DISTFILES = $(datafiles) $(sources) jay.1 $(wildcard *.h)
+DISTFILES = $(datafiles) $(sources) jay.1 $(wildcard *.h) jay.vcxproj
all-local: jay
Modified: msvc/Makefile.am
===================================================================
--- a/msvc/Makefile.am
+++ b/msvc/Makefile.am
@@ -14,7 +14,9 @@ VCPROJS = \
test_eglib.vcproj \
teste.vcproj
-EXTRA_DIST = create-windef.pl mono.def README mono.sln winsetup.bat $(VCPROJS)
+VCXPROJS = $(wildcard *.vcxproj)
+
+EXTRA_DIST = create-windef.pl mono.def README mono.sln winsetup.bat $(VCPROJS) \
$(VCXPROJS)
update-def:
perl create-windef.pl mono.def
Commit: 318ddb4924f962112e5d8d548cd03c26971db65b
Author: Geoff Norton <grompf@sublimeintervention.com>
Committer: Andrew Jorgensen <ajorgensen@novell.com>
Date: 01/13/2011 14:38:34
URL: https://github.com/mono/mono/commit/318ddb4924f962112e5d8d548cd03c26971db65b
Fix win32 build
Changed paths:
M mono/mini/driver.c
Modified: mono/mini/driver.c
===================================================================
--- a/mono/mini/driver.c
+++ b/mono/mini/driver.c
@@ -1248,8 +1248,10 @@ BOOL APIENTRY DllMain (HMODULE module_handle, DWORD reason, \
LPVOID reserved) mono_install_runtime_load (mini_init);
break;
case DLL_PROCESS_DETACH:
+#ifdef ENABLE_COREE
if (coree_module_handle)
FreeLibrary (coree_module_handle);
+#endif
break;
}
return TRUE;
Commit: 5ed112e660c96788c47196d6927cc1ef74976ffd
Author: Geoff Norton <grompf@sublimeintervention.com>
Committer: Andrew Jorgensen <ajorgensen@novell.com>
Date: 01/13/2011 14:38:44
URL: https://github.com/mono/mono/commit/5ed112e660c96788c47196d6927cc1ef74976ffd
Fix the win32 build
Changed paths:
M msvc/mono.def
Modified: msvc/mono.def
===================================================================
--- a/msvc/mono.def
+++ b/msvc/mono.def
@@ -1,7 +1,6 @@
; file generated by create-windef.pl
LIBRARY mono-2.0.dll
EXPORTS
-MonoFixupCorEE
mono_add_internal_call
mono_aot_register_globals
mono_aot_register_module
@@ -835,4 +834,4 @@ mono_walk_stack
mono_win32_compat_CopyMemory
mono_win32_compat_FillMemory
mono_win32_compat_MoveMemory
-mono_win32_compat_ZeroMemory
\ No newline at end of file
+mono_win32_compat_ZeroMemory
Commit: 6140b9ca0971d52e967cc25ee37d499131256259
Author: Ankit Jain <radical@corewars.org>
Date: 01/13/2011 17:40:29
URL: https://github.com/mono/mono/commit/6140b9ca0971d52e967cc25ee37d499131256259
[xbuild] ConsoleLogger - Correctly indent multi-line messages.
Split and correctly indent multi-line messages in ConsoleLogger.
Changed paths:
M mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ConsoleLogger.cs
Modified: mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ConsoleLogger.cs
===================================================================
--- a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ConsoleLogger.cs
+++ b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ConsoleLogger.cs
@@ -456,9 +456,11 @@ namespace Microsoft.Build.BuildEngine {
StringBuilder sb = new StringBuilder ();
for (int i = 0; i < indent; i++)
sb.Append ('\t');
- sb.Append (message);
- writeHandler (sb.ToString ());
+ string indent_str = sb.ToString ();
+
+ foreach (string line in message.Split (new string[] {Environment.NewLine}, \
StringSplitOptions.RemoveEmptyEntries)) + writeHandler (indent_str + line);
} else {
writeHandler (message);
}
Commit: ca46b25e6ad84637b71d1425665fff25a05baddd
Author: Ankit Jain <radical@corewars.org>
Date: 01/13/2011 17:40:37
URL: https://github.com/mono/mono/commit/ca46b25e6ad84637b71d1425665fff25a05baddd
[xbuild] Ensure trailing slash on some properties.
Ensure trailing slash on $(BaseIntermediateOutputPath) and
$(IntermediateOutputPath).
Changed paths:
M mcs/tools/xbuild/xbuild/2.0/Microsoft.Common.targets
M mcs/tools/xbuild/xbuild/3.5/Microsoft.Common.targets
M mcs/tools/xbuild/xbuild/4.0/Microsoft.Common.targets
Modified: mcs/tools/xbuild/xbuild/2.0/Microsoft.Common.targets
===================================================================
--- a/mcs/tools/xbuild/xbuild/2.0/Microsoft.Common.targets
+++ b/mcs/tools/xbuild/xbuild/2.0/Microsoft.Common.targets
@@ -34,6 +34,7 @@
<PropertyGroup>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)' == \
''">obj\</BaseIntermediateOutputPath> + <BaseIntermediateOutputPath \
Condition="'$(BaseIntermediateOutputPath)' != '' and \
!HasTrailingSlash('$(BaseIntermediateOutputPath)')">$(BaseIntermediateOutputPath)\</BaseIntermediateOutputPath>
<CleanFile Condition="'$(CleanFile)'==''">$(MSBuildProjectFile).FilesWrittenAbsolute.txt</CleanFile>
</PropertyGroup>
@@ -42,6 +43,10 @@
<IntermediateOutputPath Condition=" '$(PlatformName)' != \
'AnyCPU'">$(BaseIntermediateOutputPath)$(PlatformName)\$(Configuration)\</IntermediateOutputPath>
</PropertyGroup>
+ <PropertyGroup>
+ <IntermediateOutputPath Condition="'$(IntermediateOutputPath)' != '' and \
!HasTrailingSlash('$(IntermediateOutputPath)')">$(IntermediateOutputPath)\</IntermediateOutputPath>
+ </PropertyGroup>
+
<ItemGroup>
<IntermediateAssembly \
Include="$(IntermediateOutputPath)$(AssemblyName)$(TargetExt)" />
Modified: mcs/tools/xbuild/xbuild/3.5/Microsoft.Common.targets
===================================================================
--- a/mcs/tools/xbuild/xbuild/3.5/Microsoft.Common.targets
+++ b/mcs/tools/xbuild/xbuild/3.5/Microsoft.Common.targets
@@ -34,6 +34,7 @@
<PropertyGroup>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)' == \
''">obj\</BaseIntermediateOutputPath> + <BaseIntermediateOutputPath \
Condition="'$(BaseIntermediateOutputPath)' != '' and \
!HasTrailingSlash('$(BaseIntermediateOutputPath)')">$(BaseIntermediateOutputPath)\</BaseIntermediateOutputPath>
<CleanFile Condition="'$(CleanFile)'==''">$(MSBuildProjectFile).FilesWrittenAbsolute.txt</CleanFile>
</PropertyGroup>
@@ -42,6 +43,10 @@
<IntermediateOutputPath Condition=" '$(PlatformName)' != \
'AnyCPU'">$(BaseIntermediateOutputPath)$(PlatformName)\$(Configuration)\</IntermediateOutputPath>
</PropertyGroup>
+ <PropertyGroup>
+ <IntermediateOutputPath Condition="'$(IntermediateOutputPath)' != '' and \
!HasTrailingSlash('$(IntermediateOutputPath)')">$(IntermediateOutputPath)\</IntermediateOutputPath>
+ </PropertyGroup>
+
<ItemGroup>
<IntermediateAssembly \
Include="$(IntermediateOutputPath)$(AssemblyName)$(TargetExt)" />
Modified: mcs/tools/xbuild/xbuild/4.0/Microsoft.Common.targets
===================================================================
--- a/mcs/tools/xbuild/xbuild/4.0/Microsoft.Common.targets
+++ b/mcs/tools/xbuild/xbuild/4.0/Microsoft.Common.targets
@@ -37,6 +37,7 @@
<PropertyGroup>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)' == \
''">obj\</BaseIntermediateOutputPath> + <BaseIntermediateOutputPath \
Condition="'$(BaseIntermediateOutputPath)' != '' and \
!HasTrailingSlash('$(BaseIntermediateOutputPath)')">$(BaseIntermediateOutputPath)\</BaseIntermediateOutputPath>
<CleanFile Condition="'$(CleanFile)'==''">$(MSBuildProjectFile).FilesWrittenAbsolute.txt</CleanFile>
</PropertyGroup>
@@ -45,6 +46,10 @@
<IntermediateOutputPath Condition=" '$(PlatformName)' != \
'AnyCPU'">$(BaseIntermediateOutputPath)$(PlatformName)\$(Configuration)\</IntermediateOutputPath>
</PropertyGroup>
+ <PropertyGroup>
+ <IntermediateOutputPath Condition="'$(IntermediateOutputPath)' != '' and \
!HasTrailingSlash('$(IntermediateOutputPath)')">$(IntermediateOutputPath)\</IntermediateOutputPath>
+ </PropertyGroup>
+
<ItemGroup>
<IntermediateAssembly \
Include="$(IntermediateOutputPath)$(AssemblyName)$(TargetExt)" />
Commit: 88b0d19f8bb5f87a36fbd981c57ef253e274ec87
Author: Ankit Jain <radical@corewars.org>
Date: 01/13/2011 17:40:46
URL: https://github.com/mono/mono/commit/88b0d19f8bb5f87a36fbd981c57ef253e274ec87
[xbuild] Copy metadata from Project items to target outputs.
Copy metadata from Project items to the corresponding target
outputs in MSBuild task.
Fix the corresponding test also.
Changed paths:
M mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/EngineTest.cs
M mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/MSBuild.cs
Modified: mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/EngineTest.cs
===================================================================
--- a/mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/EngineTest.cs
+++ b/mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/EngineTest.cs
@@ -862,9 +862,10 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
CreateAndCheckGlobalPropertiesTest (mainProject, firstProject, secondProject,
null, null,
- 4, 3, 12,
+ 4, 3, 13,
new string [] {
- "foofoo;barbar;foofoo;barbar: F.Unique: true",
+ "foofoo;barbar: F.Unique: true",
+ "foofoo;barbar: F.Unique: false",
"from_second: F.Unique: unique",
"foofoo;foofoo;from_second: F.Prop1: false",
"barbar;barbar: F.Prop1: bar_false",
Modified: mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/MSBuild.cs
===================================================================
--- a/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/MSBuild.cs
+++ b/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/MSBuild.cs
@@ -66,7 +66,6 @@ namespace Microsoft.Build.Tasks {
Hashtable outputs;
var global_properties = SplitPropertiesToDictionary ();
- Dictionary<string, ITaskItem> projectsByFileName = new Dictionary<string, \
ITaskItem> ();
Log.LogMessage (MessageImportance.Low, "Global Properties:");
if (global_properties != null)
@@ -104,11 +103,6 @@ namespace Microsoft.Build.Tasks {
}
if (result) {
- // Metadata from the first item for the project file is copied
- ITaskItem first_item;
- if (!projectsByFileName.TryGetValue (filename, out first_item))
- projectsByFileName [filename] = first_item = project;
-
foreach (DictionaryEntry de in outputs) {
ITaskItem [] array = (ITaskItem []) de.Value;
foreach (ITaskItem item in array) {
@@ -117,7 +111,7 @@ namespace Microsoft.Build.Tasks {
// copy the metadata from original @project to here
// CopyMetadataTo does _not_ overwrite
- first_item.CopyMetadataTo (new_item);
+ project.CopyMetadataTo (new_item);
outputItems.Add (new_item);
Commit: 035f96e4f8b50f2391b27ea585487a2eb1a04d2c
Author: Ankit Jain <radical@corewars.org>
Date: 01/13/2011 17:41:00
URL: https://github.com/mono/mono/commit/035f96e4f8b50f2391b27ea585487a2eb1a04d2c
[xbuild] Clear the built targets cache on project unload.
Remove the entries for a project from the built targets cache, on
project unload.
* Microsoft.Build.BuildEngine/Engine.cs (ClearBuiltTargetsForProject): New.
* Microsoft.Build.BuildEngine/Project.cs (BuiltTargetKeys): Remove.
(RemoveBuiltTargets): Use Engine.ClearBuiltTargetsForProject .
* Microsoft.Build.BuildEngine/Target.cs: Track api changes.
*
Changed paths:
M mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Engine.cs
M mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Project.cs
M mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Target.cs
Modified: mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Engine.cs
===================================================================
--- a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Engine.cs
+++ b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Engine.cs
@@ -31,6 +31,7 @@ using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
+using System.Linq;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
using Mono.XBuild.Utilities;
@@ -308,8 +309,10 @@ namespace Microsoft.Build.BuildEngine {
internal void RemoveLoadedProject (Project p)
{
- if (p.FullFileName != String.Empty)
+ if (!String.IsNullOrEmpty (p.FullFileName)) {
+ ClearBuiltTargetsForProject (p);
projects.Remove (p.FullFileName);
+ }
}
internal void AddLoadedProject (Project p)
@@ -328,8 +331,7 @@ namespace Microsoft.Build.BuildEngine {
project.CheckUnloaded ();
- if (project.FullFileName != String.Empty)
- projects.Remove (project.FullFileName);
+ RemoveLoadedProject (project);
project.Unload ();
}
@@ -401,6 +403,14 @@ namespace Microsoft.Build.BuildEngine {
}
}
+ internal void ClearBuiltTargetsForProject (Project project)
+ {
+ string project_key = project.GetKeyForTarget (String.Empty, false);
+ var to_remove_keys = BuiltTargetsOutputByName.Keys.Where (key => key.StartsWith \
(project_key)).ToList (); + foreach (string to_remove_key in to_remove_keys)
+ BuiltTargetsOutputByName.Remove (to_remove_key);
+ }
+
void LogProjectStarted (Project project, string [] target_names)
{
string targets;
Modified: mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Project.cs
===================================================================
--- a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Project.cs
+++ b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Project.cs
@@ -73,7 +73,6 @@ namespace Microsoft.Build.BuildEngine {
XmlDocument xmlDocument;
bool unloaded;
bool initialTargetsBuilt;
- List<string> builtTargetKeys;
bool building;
BuildSettings current_settings;
Stack<Batch> batches;
@@ -111,7 +110,6 @@ namespace Microsoft.Build.BuildEngine {
encoding = null;
- builtTargetKeys = new List<string> ();
initialTargets = new List<string> ();
defaultTargets = new string [0];
batches = new Stack<Batch> ();
@@ -352,8 +350,15 @@ namespace Microsoft.Build.BuildEngine {
internal string GetKeyForTarget (string target_name)
{
+ return GetKeyForTarget (target_name, true);
+ }
+
+ internal string GetKeyForTarget (string target_name, bool \
include_global_properties) + {
// target name is case insensitive
- return fullFileName + ":" + target_name.ToLower () + ":" + \
GlobalPropertiesToString (GlobalProperties); + return fullFileName + ":" + \
target_name.ToLower () + + (include_global_properties ? (":" + \
GlobalPropertiesToString (GlobalProperties)) + : String.Empty);
}
string GlobalPropertiesToString (BuildPropertyGroup bgp)
@@ -896,8 +901,7 @@ namespace Microsoft.Build.BuildEngine {
// Removes entries of all earlier built targets for this project
void RemoveBuiltTargets ()
{
- foreach (string key in builtTargetKeys)
- ParentEngine.BuiltTargetsOutputByName.Remove (key);
+ ParentEngine.ClearBuiltTargetsForProject (this);
}
void InitializeProperties (string effective_tools_version)
@@ -1396,10 +1400,6 @@ namespace Microsoft.Build.BuildEngine {
get; internal set;
}
- internal List<string> BuiltTargetKeys {
- get { return builtTargetKeys; }
- }
-
internal Dictionary <string, BuildItemGroup> LastItemGroupContaining {
get { return last_item_group_containing; }
}
Modified: mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Target.cs
===================================================================
--- a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Target.cs
+++ b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Target.cs
@@ -165,7 +165,6 @@ namespace Microsoft.Build.BuildEngine {
}
project.ParentEngine.BuiltTargetsOutputByName [built_targets_key] = (ITaskItem[]) \
Outputs.Clone ();
- project.BuiltTargetKeys.Add (built_targets_key);
return result;
}
Commit: 66a2165e379ef9ddcf88abea8c2f3daa028802c7
Author: Ankit Jain <radical@corewars.org>
Date: 01/13/2011 17:41:12
URL: https://github.com/mono/mono/commit/66a2165e379ef9ddcf88abea8c2f3daa028802c7
[xbuild] Add $(TargetDir) property.
Add $(TargetDir) and set TargetPath only if its not set already.
Changed paths:
M mcs/tools/xbuild/xbuild/2.0/Microsoft.Common.targets
M mcs/tools/xbuild/xbuild/3.5/Microsoft.Common.targets
M mcs/tools/xbuild/xbuild/4.0/Microsoft.Common.targets
Modified: mcs/tools/xbuild/xbuild/2.0/Microsoft.Common.targets
===================================================================
--- a/mcs/tools/xbuild/xbuild/2.0/Microsoft.Common.targets
+++ b/mcs/tools/xbuild/xbuild/2.0/Microsoft.Common.targets
@@ -57,7 +57,8 @@
<PropertyGroup>
<TargetName Condition="'$(TargetName)' == '' ">$(AssemblyName)</TargetName>
<TargetFileName Condition="'$(TargetFileName)' == '' \
">$(TargetName)$(TargetExt)</TargetFileName>
- <TargetPath>@(_OutDirItem->'%(FullPath)\$(TargetFileName)')</TargetPath>
+ <TargetDir Condition=" '$(TargetDir)' == '' \
">@(_OutDirItem->'%(FullPath)')</TargetDir> + <TargetPath Condition=" \
'$(TargetPath)' == '' ">@(_OutDirItem->'%(FullPath)\$(TargetFileName)')</TargetPath> \
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildProjectFullPath);$(MSBuildToolsPath)\Microsoft.Common.targets</MSBuildAllProjects>
<KeyOriginatorFile Condition=" '$(SignAssembly)' == 'true' \
">$(AssemblyOriginatorKeyFile)</KeyOriginatorFile>
Modified: mcs/tools/xbuild/xbuild/3.5/Microsoft.Common.targets
===================================================================
--- a/mcs/tools/xbuild/xbuild/3.5/Microsoft.Common.targets
+++ b/mcs/tools/xbuild/xbuild/3.5/Microsoft.Common.targets
@@ -57,7 +57,8 @@
<PropertyGroup>
<TargetName Condition="'$(TargetName)' == '' ">$(AssemblyName)</TargetName>
<TargetFileName Condition="'$(TargetFileName)' == '' \
">$(TargetName)$(TargetExt)</TargetFileName>
- <TargetPath>@(_OutDirItem->'%(FullPath)\$(TargetFileName)')</TargetPath>
+ <TargetDir Condition=" '$(TargetDir)' == '' \
">@(_OutDirItem->'%(FullPath)')</TargetDir> + <TargetPath Condition=" \
'$(TargetPath)' == '' ">@(_OutDirItem->'%(FullPath)\$(TargetFileName)')</TargetPath> \
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildProjectFullPath);$(MSBuildToolsPath)\Microsoft.Common.targets</MSBuildAllProjects>
<KeyOriginatorFile Condition=" '$(SignAssembly)' == 'true' \
">$(AssemblyOriginatorKeyFile)</KeyOriginatorFile>
Modified: mcs/tools/xbuild/xbuild/4.0/Microsoft.Common.targets
===================================================================
--- a/mcs/tools/xbuild/xbuild/4.0/Microsoft.Common.targets
+++ b/mcs/tools/xbuild/xbuild/4.0/Microsoft.Common.targets
@@ -60,9 +60,9 @@
<PropertyGroup>
<TargetName Condition="'$(TargetName)' == '' ">$(AssemblyName)</TargetName>
<TargetFileName Condition="'$(TargetFileName)' == '' \
">$(TargetName)$(TargetExt)</TargetFileName>
- <TargetPath>@(_OutDirItem->'%(FullPath)\$(TargetFileName)')</TargetPath>
+ <TargetDir Condition=" '$(TargetDir)' == '' \
">@(_OutDirItem->'%(FullPath)')</TargetDir> + <TargetPath Condition=" \
'$(TargetPath)' == '' ">@(_OutDirItem->'%(FullPath)\$(TargetFileName)')</TargetPath> \
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildProjectFullPath);$(MSBuildToolsPath)\Microsoft.Common.targets</MSBuildAllProjects>
-
<KeyOriginatorFile Condition=" '$(SignAssembly)' == 'true' \
">$(AssemblyOriginatorKeyFile)</KeyOriginatorFile> </PropertyGroup>
Commit: 4a914ca1bf51abcad043951c1d720f25a3ff0e6c
Author: Ankit Jain <radical@corewars.org>
Date: 01/13/2011 17:41:18
URL: https://github.com/mono/mono/commit/4a914ca1bf51abcad043951c1d720f25a3ff0e6c
[xbuild] Fix bug #664349 .
* Microsoft.Build.BuildEngine/Project.cs (BuildInternal): Set needToReevaluate to
false, when reevaluating.
Changed paths:
M mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Project.cs
Modified: mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Project.cs
===================================================================
--- a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Project.cs
+++ b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Project.cs
@@ -299,8 +299,10 @@ namespace Microsoft.Build.BuildEngine {
BuildSettings buildFlags)
{
CheckUnloaded ();
- if (buildFlags == BuildSettings.None)
+ if (buildFlags == BuildSettings.None) {
+ needToReevaluate = false;
Reevaluate ();
+ }
if (targetNames == null || targetNames.Length == 0) {
if (defaultTargets != null && defaultTargets.Length != 0)
Commit: 31458593f072c2b759b7384bc7f74fa4aecf7e7c
Author: Ankit Jain <radical@corewars.org>
Date: 01/13/2011 17:41:23
URL: https://github.com/mono/mono/commit/31458593f072c2b759b7384bc7f74fa4aecf7e7c
[xbuild] Use the backing field directly to avoid evaluating again.
* Microsoft.Build.BuildEngine.Project.cs (InitializeProperties): Use
evaluatedProperties field instead of EvaluatedProperties property,
to avoid invoking a Reevaluate, since it is already in progress.
Changed paths:
M mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Project.cs
Modified: mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Project.cs
===================================================================
--- a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Project.cs
+++ b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Project.cs
@@ -914,7 +914,7 @@ namespace Microsoft.Build.BuildEngine {
foreach (BuildProperty gp in GlobalProperties) {
bp = new BuildProperty (gp.Name, gp.Value, PropertyType.Global);
- EvaluatedProperties.AddProperty (bp);
+ evaluatedProperties.AddProperty (bp);
}
foreach (BuildProperty gp in GlobalProperties)
@@ -923,38 +923,38 @@ namespace Microsoft.Build.BuildEngine {
// add properties that we dont have from parent engine's
// global properties
foreach (BuildProperty gp in ParentEngine.GlobalProperties) {
- if (EvaluatedProperties [gp.Name] == null) {
+ if (evaluatedProperties [gp.Name] == null) {
bp = new BuildProperty (gp.Name, gp.Value, PropertyType.Global);
- EvaluatedProperties.AddProperty (bp);
+ evaluatedProperties.AddProperty (bp);
}
}
foreach (DictionaryEntry de in Environment.GetEnvironmentVariables ()) {
bp = new BuildProperty ((string) de.Key, (string) de.Value, \
PropertyType.Environment);
- EvaluatedProperties.AddProperty (bp);
+ evaluatedProperties.AddProperty (bp);
}
- EvaluatedProperties.AddProperty (new BuildProperty ("MSBuildProjectFile", \
Path.GetFileName (fullFileName), + evaluatedProperties.AddProperty (new \
BuildProperty ("MSBuildProjectFile", Path.GetFileName (fullFileName), \
PropertyType.Reserved));
- EvaluatedProperties.AddProperty (new BuildProperty ("MSBuildProjectFullPath", \
fullFileName, PropertyType.Reserved));
- EvaluatedProperties.AddProperty (new BuildProperty ("MSBuildProjectName",
+ evaluatedProperties.AddProperty (new BuildProperty ("MSBuildProjectFullPath", \
fullFileName, PropertyType.Reserved)); + evaluatedProperties.AddProperty (new \
BuildProperty ("MSBuildProjectName", Path.GetFileNameWithoutExtension \
(fullFileName), PropertyType.Reserved));
- EvaluatedProperties.AddProperty (new BuildProperty ("MSBuildProjectExtension",
+ evaluatedProperties.AddProperty (new BuildProperty ("MSBuildProjectExtension",
Path.GetExtension (fullFileName),
PropertyType.Reserved));
string toolsPath = parentEngine.Toolsets [effective_tools_version].ToolsPath;
if (toolsPath == null)
throw new Exception (String.Format ("Invalid tools version '{0}', no tools path \
set for this.", effective_tools_version));
- EvaluatedProperties.AddProperty (new BuildProperty ("MSBuildBinPath", toolsPath, \
PropertyType.Reserved));
- EvaluatedProperties.AddProperty (new BuildProperty ("MSBuildToolsPath", \
toolsPath, PropertyType.Reserved));
- EvaluatedProperties.AddProperty (new BuildProperty ("MSBuildToolsVersion", \
effective_tools_version, PropertyType.Reserved));
- EvaluatedProperties.AddProperty (new BuildProperty ("MSBuildExtensionsPath", \
ExtensionsPath, PropertyType.Reserved));
- EvaluatedProperties.AddProperty (new BuildProperty ("MSBuildExtensionsPath32", \
ExtensionsPath, PropertyType.Reserved));
- EvaluatedProperties.AddProperty (new BuildProperty ("MSBuildExtensionsPath64", \
ExtensionsPath, PropertyType.Reserved));
- EvaluatedProperties.AddProperty (new BuildProperty \
("MSBuildProjectDefaultTargets", DefaultTargets, \
PropertyType.Reserved));
- EvaluatedProperties.AddProperty (new BuildProperty ("OS", OS, \
PropertyType.Environment)); + evaluatedProperties.AddProperty (new BuildProperty \
("MSBuildBinPath", toolsPath, PropertyType.Reserved)); \
+ evaluatedProperties.AddProperty (new BuildProperty ("MSBuildToolsPath", \
toolsPath, PropertyType.Reserved)); + evaluatedProperties.AddProperty (new \
BuildProperty ("MSBuildToolsVersion", effective_tools_version, \
PropertyType.Reserved)); + evaluatedProperties.AddProperty (new BuildProperty \
("MSBuildExtensionsPath", ExtensionsPath, PropertyType.Reserved)); \
+ evaluatedProperties.AddProperty (new BuildProperty ("MSBuildExtensionsPath32", \
ExtensionsPath, PropertyType.Reserved)); + evaluatedProperties.AddProperty (new \
BuildProperty ("MSBuildExtensionsPath64", ExtensionsPath, PropertyType.Reserved)); \
+ evaluatedProperties.AddProperty (new BuildProperty \
("MSBuildProjectDefaultTargets", DefaultTargets, PropertyType.Reserved)); \
+ evaluatedProperties.AddProperty (new BuildProperty ("OS", OS, \
PropertyType.Environment));
// FIXME: make some internal method that will work like GetDirectoryName but \
output String.Empty on null/String.Empty string projectDir;
@@ -963,7 +963,7 @@ namespace Microsoft.Build.BuildEngine {
else
projectDir = Path.GetDirectoryName (FullFileName);
- EvaluatedProperties.AddProperty (new BuildProperty ("MSBuildProjectDirectory", \
projectDir, PropertyType.Reserved)); + evaluatedProperties.AddProperty (new \
BuildProperty ("MSBuildProjectDirectory", projectDir, PropertyType.Reserved)); }
// precedence:
Commit: 10ed451a10dc8123b0da31296a65e43945e8a0b6
Author: Marek Habersack <grendel@twistedcode.net>
Date: 01/14/2011 15:37:18
URL: https://github.com/mono/mono/commit/10ed451a10dc8123b0da31296a65e43945e8a0b6
[asp.net] Make StopRoutingHandler actually stop the routing instead of throwing an \
exception
Patch from Damir Simunic <damir.simunic@wa-research.ch>, thanks!
Changed paths:
M mcs/class/System.Web.Routing/System.Web.Routing/UrlRoutingModule.cs
M mcs/class/System.Web.Routing/Test/System.Web.Routing/UrlRoutingModuleTest.cs
Modified: mcs/class/System.Web.Routing/System.Web.Routing/UrlRoutingModule.cs
===================================================================
--- a/mcs/class/System.Web.Routing/System.Web.Routing/UrlRoutingModule.cs
+++ b/mcs/class/System.Web.Routing/System.Web.Routing/UrlRoutingModule.cs
@@ -119,6 +119,9 @@ namespace System.Web.Routing
if (rd.RouteHandler == null)
throw new InvalidOperationException ("No IRouteHandler is assigned to the \
selected route");
+ if (rd.RouteHandler is StopRoutingHandler)
+ return; //stop further processing
+
var rc = new RequestContext (context, rd);
IHttpHandler http = rd.RouteHandler.GetHttpHandler (rc);
Modified: mcs/class/System.Web.Routing/Test/System.Web.Routing/UrlRoutingModuleTest.cs
===================================================================
--- a/mcs/class/System.Web.Routing/Test/System.Web.Routing/UrlRoutingModuleTest.cs
+++ b/mcs/class/System.Web.Routing/Test/System.Web.Routing/UrlRoutingModuleTest.cs
@@ -155,6 +155,17 @@ namespace MonoTests.System.Web.Routing
#endif
// it internally stores the handler
}
+
+ [Test]
+ public void PostResolveRequestCacheStopRoutingHttpHandler ()
+ {
+ var m = new UrlRoutingModule ();
+ RouteTable.Routes.Add (new MyRoute ("foo/bar", new StopRoutingHandler ()));
+ var hc = new HttpContextStub3 ("~/foo/bar", String.Empty, "apppath", false);
+ m.PostResolveRequestCache (hc);
+ Assert.IsNull (hc.RewrittenPath, "StopRoutingHandler should stop before the path \
is rewritten"); + }
+
[Test]
[Ignore ("looks like RouteExistingFiles ( = false) does not affect... so this test \
needs more investigation")]
Commit: 02c5d6df684cc1e7c74678bca07025a089c95b39
Author: Zoltan Varga <vargaz@gmail.com>
Date: 01/14/2011 16:29:29
URL: https://github.com/mono/mono/commit/02c5d6df684cc1e7c74678bca07025a089c95b39
Make OP_CHECK_THIS do a byte load on arm, since the source argument might point to a \
vtype if a vtype method is inlined.
Changed paths:
M mono/mini/mini-arm.c
Modified: mono/mini/mini-arm.c
===================================================================
--- a/mono/mini/mini-arm.c
+++ b/mono/mini/mini-arm.c
@@ -3737,7 +3737,7 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock \
*bb) break;
case OP_CHECK_THIS:
/* ensure ins->sreg1 is not NULL */
- ARM_LDR_IMM (code, ARMREG_LR, ins->sreg1, 0);
+ ARM_LDRB_IMM (code, ARMREG_LR, ins->sreg1, 0);
break;
case OP_ARGLIST: {
g_assert (cfg->sig_cookie < 128);
Commit: 3229ba977b3d0aa9951f4278e1815a0c8aec44ad
Author: Zoltan Varga <vargaz@gmail.com>
Date: 01/16/2011 15:11:45
URL: https://github.com/mono/mono/commit/3229ba977b3d0aa9951f4278e1815a0c8aec44ad
Pass the string encoding to emit_struct_conv () so marshalling of char arrays works \
on big-ending machines like s390/ppc64.
Changed paths:
M mono/metadata/marshal.c
Modified: mono/metadata/marshal.c
===================================================================
--- a/mono/metadata/marshal.c
+++ b/mono/metadata/marshal.c
@@ -86,6 +86,9 @@ delegate_hash_table_add (MonoDelegate *d);
static void
emit_struct_conv (MonoMethodBuilder *mb, MonoClass *klass, gboolean to_object);
+static void
+emit_struct_conv_full (MonoMethodBuilder *mb, MonoClass *klass, gboolean to_object, \
MonoMarshalNative string_encoding); +
static void
mono_struct_delete_old (MonoClass *klass, char *ptr);
@@ -1766,7 +1769,8 @@ emit_object_to_ptr_conv (MonoMethodBuilder *mb, MonoType *type, \
MonoMarshalConv }
static void
-emit_struct_conv (MonoMethodBuilder *mb, MonoClass *klass, gboolean to_object)
+emit_struct_conv_full (MonoMethodBuilder *mb, MonoClass *klass, gboolean to_object,
+ MonoMarshalNative string_encoding)
{
MonoMarshalType *info;
int i;
@@ -1869,7 +1873,7 @@ emit_struct_conv (MonoMethodBuilder *mb, MonoClass *klass, \
gboolean to_object) case MONO_TYPE_R8:
mono_mb_emit_ldloc (mb, 1);
mono_mb_emit_ldloc (mb, 0);
- if (t == MONO_TYPE_CHAR && ntype == MONO_NATIVE_U1) {
+ if (t == MONO_TYPE_CHAR && ntype == MONO_NATIVE_U1 && string_encoding != \
MONO_NATIVE_LPWSTR) { if (to_object) {
mono_mb_emit_byte (mb, CEE_LDIND_U1);
mono_mb_emit_byte (mb, CEE_STIND_I2);
@@ -1986,6 +1990,12 @@ emit_struct_conv (MonoMethodBuilder *mb, MonoClass *klass, \
gboolean to_object) }
static void
+emit_struct_conv (MonoMethodBuilder *mb, MonoClass *klass, gboolean to_object)
+{
+ emit_struct_conv_full (mb, klass, to_object, -1);
+}
+
+static void
emit_struct_free (MonoMethodBuilder *mb, MonoClass *klass, int struct_var)
{
/* Call DestroyStructure */
@@ -7103,7 +7113,7 @@ emit_marshal_array (EmitMarshalContext *m, int argnum, MonoType \
*t, mono_mb_emit_stloc (mb, 1);
/* emit valuetype conversion code */
- emit_struct_conv (mb, eklass, FALSE);
+ emit_struct_conv_full (mb, eklass, FALSE, encoding);
}
mono_mb_emit_add_to_local (mb, index_var, 1);
@@ -7221,7 +7231,7 @@ emit_marshal_array (EmitMarshalContext *m, int argnum, MonoType \
*t, mono_mb_emit_stloc (mb, 1);
/* emit valuetype conversion code */
- emit_struct_conv (mb, eklass, TRUE);
+ emit_struct_conv_full (mb, eklass, TRUE, encoding);
}
if (need_free) {
Commit: 52ac70bd71242b6de2378f053274fdb379fc617f
Author: Zoltan Varga <vargaz@gmail.com>
Date: 01/16/2011 18:09:39
URL: https://github.com/mono/mono/commit/52ac70bd71242b6de2378f053274fdb379fc617f
Fix the previous marshalling change so it only applies to chars, not structures which \
contain char fields.
Changed paths:
M mono/metadata/marshal.c
Modified: mono/metadata/marshal.c
===================================================================
--- a/mono/metadata/marshal.c
+++ b/mono/metadata/marshal.c
@@ -7113,7 +7113,7 @@ emit_marshal_array (EmitMarshalContext *m, int argnum, MonoType \
*t, mono_mb_emit_stloc (mb, 1);
/* emit valuetype conversion code */
- emit_struct_conv_full (mb, eklass, FALSE, encoding);
+ emit_struct_conv_full (mb, eklass, FALSE, eklass == mono_defaults.char_class ? \
encoding : -1); }
mono_mb_emit_add_to_local (mb, index_var, 1);
@@ -7231,7 +7231,7 @@ emit_marshal_array (EmitMarshalContext *m, int argnum, MonoType \
*t, mono_mb_emit_stloc (mb, 1);
/* emit valuetype conversion code */
- emit_struct_conv_full (mb, eklass, TRUE, encoding);
+ emit_struct_conv_full (mb, eklass, TRUE, eklass == mono_defaults.char_class ? \
encoding : -1); }
if (need_free) {
Commit: 8341dc023dc43061f1c7f6b69973aa5828f83dcd
Author: Marek Habersack <grendel@twistedcode.net>
Date: 01/17/2011 08:03:09
URL: https://github.com/mono/mono/commit/8341dc023dc43061f1c7f6b69973aa5828f83dcd
[asp.net] (4.0) Validate the form data in Form getter
Changed paths:
M mcs/class/System.Web/System.Web/HttpRequest.cs
Modified: mcs/class/System.Web/System.Web/HttpRequest.cs
===================================================================
--- a/mcs/class/System.Web/System.Web/HttpRequest.cs
+++ b/mcs/class/System.Web/System.Web/HttpRequest.cs
@@ -707,7 +707,7 @@ namespace System.Web
// Setting this before calling the validator prevents
// possible endless recursion
checked_form = true;
- ValidateNameValueCollection ("Form", query_string_nvc, \
RequestValidationSource.Form); + ValidateNameValueCollection ("Form", form, \
RequestValidationSource.Form); } else
#endif
if (validate_form && !checked_form){
Commit: 322bc4c9c2e770e57f71a24bb750622de07053f0
Author: Marek Safar <marek.safar@gmail.com>
Date: 01/17/2011 09:13:26
URL: https://github.com/mono/mono/commit/322bc4c9c2e770e57f71a24bb750622de07053f0
Update IKVM.Reflection
Changed paths:
M mcs/class/IKVM.Reflection/Fusion.cs
M mcs/class/IKVM.Reflection/Reader/ByteReader.cs
M mcs/class/IKVM.Reflection/Type.cs
M mcs/class/IKVM.Reflection/Util.cs
M mcs/class/IKVM.Reflection/Writer/ByteBuffer.cs
Modified: mcs/class/IKVM.Reflection/Fusion.cs
===================================================================
--- a/mcs/class/IKVM.Reflection/Fusion.cs
+++ b/mcs/class/IKVM.Reflection/Fusion.cs
@@ -1,5 +1,6 @@
/*
Copyright (C) 2010 Jeroen Frijters
+ Copyright (C) 2011 Marek Safar
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -57,7 +58,8 @@ namespace IKVM.Reflection
[DllImport("fusion", CharSet = CharSet.Unicode)]
private static extern int CompareAssemblyIdentity(string pwzAssemblyIdentity1, \
bool fUnified1, string pwzAssemblyIdentity2, bool fUnified2, out bool pfEquivalent, \
out AssemblyComparisonResult pResult);
- private static bool CompareAssemblyIdentityPure(string assemblyIdentity1, bool \
unified1, string assemblyIdentity2, bool unified2, out AssemblyComparisonResult \
result) + // internal for use by mcs
+ internal static bool CompareAssemblyIdentityPure(string assemblyIdentity1, bool \
unified1, string assemblyIdentity2, bool unified2, out AssemblyComparisonResult \
result) {
ParsedAssemblyName name1;
ParsedAssemblyName name2;
@@ -109,6 +111,11 @@ namespace IKVM.Reflection
result = AssemblyComparisonResult.EquivalentPartialMatch;
return true;
}
+ else if (IsFrameworkAssembly(name2))
+ {
+ result = partial ? AssemblyComparisonResult.EquivalentPartialFXUnified : \
AssemblyComparisonResult.EquivalentFXUnified; + return true;
+ }
else if (name1.Version < name2.Version)
{
if (unified2)
@@ -141,6 +148,11 @@ namespace IKVM.Reflection
return true;
}
}
+ else if (IsStrongNamed(name1))
+ {
+ result = AssemblyComparisonResult.NonEquivalent;
+ return false;
+ }
else
{
result = partial ? AssemblyComparisonResult.EquivalentPartialWeakNamed : \
AssemblyComparisonResult.EquivalentWeakNamed; @@ -148,6 +160,62 @@ namespace \
IKVM.Reflection }
}
+ static bool IsFrameworkAssembly(ParsedAssemblyName name)
+ {
+ // A list of FX assemblies which require some form of remapping
+ // When 4.0 + 1 version is release, assemblies introduced in v4.0
+ // will have to be added
+ switch (name.Name)
+ {
+ case "System":
+ case "System.Core":
+ case "System.Data":
+ case "System.Data.DataSetExtensions":
+ case "System.Data.Linq":
+ case "System.Data.OracleClient":
+ case "System.Data.Services":
+ case "System.Data.Services.Client":
+ case "System.IdentityModel":
+ case "System.IdentityModel.Selectors":
+ case "System.Runtime.Remoting":
+ case "System.Runtime.Serialization":
+ case "System.ServiceModel":
+ case "System.Transactions":
+ case "System.Windows.Forms":
+ case "System.Xml":
+ case "System.Xml.Linq":
+ return name.PublicKeyToken == "b77a5c561934e089";
+
+ case "System.Configuration":
+ case "System.Configuration.Install":
+ case "System.Design":
+ case "System.DirectoryServices":
+ case "System.Drawing":
+ case "System.Drawing.Design":
+ case "System.EnterpriseServices":
+ case "System.Management":
+ case "System.Messaging":
+ case "System.Runtime.Serialization.Formatters.Soap":
+ case "System.Security":
+ case "System.ServiceProcess":
+ case "System.Web":
+ case "System.Web.Mobile":
+ case "System.Web.Services":
+ return name.PublicKeyToken == "b03f5f7f11d50a3a";
+
+ case "System.ComponentModel.DataAnnotations":
+ case "System.ServiceModel.Web":
+ case "System.Web.Abstractions":
+ case "System.Web.Extensions":
+ case "System.Web.Extensions.Design":
+ case "System.Web.DynamicData":
+ case "System.Web.Routing":
+ return name.PublicKeyToken == "31bf3856ad364e35";
+ }
+
+ return false;
+ }
+
// note that this is the fusion specific parser, it is not the same as \
System.Reflection.AssemblyName private static bool ParseAssemblyName(string \
fullName, out ParsedAssemblyName parsedName) {
Modified: mcs/class/IKVM.Reflection/Reader/ByteReader.cs
===================================================================
--- a/mcs/class/IKVM.Reflection/Reader/ByteReader.cs
+++ b/mcs/class/IKVM.Reflection/Reader/ByteReader.cs
@@ -167,11 +167,7 @@ namespace IKVM.Reflection.Reader
internal float ReadSingle()
{
- if (end - pos < 4)
- throw new BadImageFormatException();
- float value = BitConverter.ToSingle(buffer, pos);
- pos += 4;
- return value;
+ return SingleConverter.Int32BitsToSingle(ReadInt32());
}
internal double ReadDouble()
Modified: mcs/class/IKVM.Reflection/Type.cs
===================================================================
--- a/mcs/class/IKVM.Reflection/Type.cs
+++ b/mcs/class/IKVM.Reflection/Type.cs
@@ -741,7 +741,7 @@ namespace IKVM.Reflection
return GetNestedType(name, BindingFlags.Public);
}
- public Type GetNestedType(string name, BindingFlags bindingAttr)
+ public virtual Type GetNestedType(string name, BindingFlags bindingAttr)
{
foreach (Type type in GetNestedTypes(bindingAttr))
{
Modified: mcs/class/IKVM.Reflection/Util.cs
===================================================================
--- a/mcs/class/IKVM.Reflection/Util.cs
+++ b/mcs/class/IKVM.Reflection/Util.cs
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2008-2010 Jeroen Frijters
+ Copyright (C) 2008-2011 Jeroen Frijters
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -265,4 +265,27 @@ namespace IKVM.Reflection
return h;
}
}
+
+ [System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Explicit)]
+ struct SingleConverter
+ {
+ [System.Runtime.InteropServices.FieldOffset(0)]
+ private int i;
+ [System.Runtime.InteropServices.FieldOffset(0)]
+ private float f;
+
+ internal static int SingleToInt32Bits(float v)
+ {
+ SingleConverter c = new SingleConverter();
+ c.f = v;
+ return c.i;
+ }
+
+ internal static float Int32BitsToSingle(int v)
+ {
+ SingleConverter c = new SingleConverter();
+ c.i = v;
+ return c.f;
+ }
+ }
}
Modified: mcs/class/IKVM.Reflection/Writer/ByteBuffer.cs
===================================================================
--- a/mcs/class/IKVM.Reflection/Writer/ByteBuffer.cs
+++ b/mcs/class/IKVM.Reflection/Writer/ByteBuffer.cs
@@ -153,18 +153,7 @@ namespace IKVM.Reflection.Writer
internal void Write(float value)
{
- byte[] s = BitConverter.GetBytes(value);
- if (BitConverter.IsLittleEndian) {
- Write(s);
- } else {
- if (pos + 4 > buffer.Length)
- Grow(4);
-
- buffer[pos++] = s [3];
- buffer[pos++] = s [2];
- buffer[pos++] = s [1];
- buffer[pos++] = s [0];
- }
+ Write(SingleConverter.SingleToInt32Bits(value));
}
internal void Write(double value)
Commit: 2ec8c50752ad762d5d1736533c3d5619e53472a8
Author: Marek Safar <marek.safar@gmail.com>
Date: 01/17/2011 09:15:43
URL: https://github.com/mono/mono/commit/2ec8c50752ad762d5d1736533c3d5619e53472a8
Update to the latest mcs version
Changed paths:
M mcs/mcs/assembly.cs
M mcs/mcs/attribute.cs
M mcs/mcs/cs-parser.jay
M mcs/mcs/ecore.cs
M mcs/mcs/generic.cs
M mcs/mcs/ikvm.cs
M mcs/mcs/import.cs
M mcs/mcs/reflection.cs
M mcs/mcs/report.cs
Modified: mcs/mcs/assembly.cs
===================================================================
--- a/mcs/mcs/assembly.cs
+++ b/mcs/mcs/assembly.cs
@@ -214,7 +214,7 @@ namespace Mono.CSharp
if (value == null || value.Length == 0)
return;
- var vinfo = IsValidAssemblyVersion (value);
+ var vinfo = IsValidAssemblyVersion (value, true);
if (vinfo == null) {
a.Error_AttributeEmitError (string.Format ("Specified version `{0}' is not \
valid", value)); return;
@@ -336,8 +336,16 @@ namespace Mono.CSharp
}
} else if (a.Type == pa.RuntimeCompatibility) {
wrap_non_exception_throws_custom = true;
+ } else if (a.Type == pa.AssemblyFileVersion) {
+ string value = a.GetString ();
+ if (string.IsNullOrEmpty (value) || IsValidAssemblyVersion (value, false) == \
null) { + Report.Warning (1607, 1, a.Location, "The version number `{0}' \
specified for `{1}' is invalid", + value, a.Name);
+ return;
+ }
}
+
SetCustomAttribute (ctor, cdata);
}
@@ -475,7 +483,7 @@ namespace Mono.CSharp
byte[] hash = ha.ComputeHash (public_key);
// we need the last 8 bytes in reverse order
public_key_token = new byte[8];
- Array.Copy (hash, (hash.Length - 8), public_key_token, 0, 8);
+ Buffer.BlockCopy (hash, hash.Length - 8, public_key_token, 0, 8);
Array.Reverse (public_key_token, 0, 8);
return public_key_token;
}
@@ -534,11 +542,19 @@ namespace Mono.CSharp
byte[] publickey = CryptoConvert.ToCapiPublicKeyBlob (rsa);
// AssemblyName.SetPublicKey requires an additional header
- byte[] publicKeyHeader = new byte[12] { 0x00, 0x24, 0x00, 0x00, 0x04, 0x80, \
0x00, 0x00, 0x94, 0x00, 0x00, 0x00 }; + byte[] publicKeyHeader = new byte[8] { \
0x00, 0x24, 0x00, 0x00, 0x04, 0x80, 0x00, 0x00 };
// Encode public key
public_key = new byte[12 + publickey.Length];
- Buffer.BlockCopy (publicKeyHeader, 0, public_key, 0, 12);
+ Buffer.BlockCopy (publicKeyHeader, 0, public_key, 0, publicKeyHeader.Length);
+
+ // Length of Public Key (in bytes)
+ byte[] lastPart = BitConverter.GetBytes (public_key.Length - 12);
+ public_key[8] = lastPart[0];
+ public_key[9] = lastPart[1];
+ public_key[10] = lastPart[2];
+ public_key[11] = lastPart[3];
+
Buffer.BlockCopy (publickey, 0, public_key, 12, publickey.Length);
} catch {
Error_AssemblySigning ("The specified key file `" + keyFile + "' has incorrect \
format"); @@ -871,7 +887,7 @@ namespace Mono.CSharp
Report.Error (1548, "Error during assembly signing. " + text);
}
- static Version IsValidAssemblyVersion (string version)
+ static Version IsValidAssemblyVersion (string version, bool allowGenerated)
{
string[] parts = version.Split ('.');
if (parts.Length < 1 || parts.Length > 4)
@@ -880,7 +896,7 @@ namespace Mono.CSharp
var values = new int[4];
for (int i = 0; i < parts.Length; ++i) {
if (!int.TryParse (parts[i], out values[i])) {
- if (parts[i].Length == 1 && parts[i][0] == '*') {
+ if (parts[i].Length == 1 && parts[i][0] == '*' && allowGenerated) {
if (i == 2) {
// Nothing can follow *
if (parts.Length > 3)
Modified: mcs/mcs/attribute.cs
===================================================================
--- a/mcs/mcs/attribute.cs
+++ b/mcs/mcs/attribute.cs
@@ -1637,6 +1637,7 @@ namespace Mono.CSharp {
public readonly PredefinedAttribute AssemblyVersion;
public readonly PredefinedAttribute AssemblyAlgorithmId;
public readonly PredefinedAttribute AssemblyFlags;
+ public readonly PredefinedAttribute AssemblyFileVersion;
public readonly PredefinedAttribute ComImport;
public readonly PredefinedAttribute CoClass;
public readonly PredefinedAttribute AttributeUsage;
@@ -1690,6 +1691,7 @@ namespace Mono.CSharp {
AssemblyVersion = new PredefinedAttribute (module, "System.Reflection", \
"AssemblyVersionAttribute"); AssemblyAlgorithmId = new PredefinedAttribute (module, \
"System.Reflection", "AssemblyAlgorithmIdAttribute"); AssemblyFlags = new \
PredefinedAttribute (module, "System.Reflection", "AssemblyFlagsAttribute"); \
+ AssemblyFileVersion = new PredefinedAttribute (module, "System.Reflection", \
"AssemblyFileVersionAttribute"); ComImport = new PredefinedAttribute (module, \
"System.Runtime.InteropServices", "ComImportAttribute"); CoClass = new \
PredefinedAttribute (module, "System.Runtime.InteropServices", "CoClassAttribute"); \
AttributeUsage = new PredefinedAttribute (module, "System", \
"AttributeUsageAttribute");
Modified: mcs/mcs/cs-parser.jay
===================================================================
--- a/mcs/mcs/cs-parser.jay
+++ b/mcs/mcs/cs-parser.jay
@@ -4318,6 +4318,11 @@ opt_type_parameter_constraints_clauses
{
$$ = $1;
}
+ | error
+ {
+ Error_SyntaxError (yyToken);
+ $$ = null;
+ }
;
type_parameter_constraints_clauses
Modified: mcs/mcs/ecore.cs
===================================================================
--- a/mcs/mcs/ecore.cs
+++ b/mcs/mcs/ecore.cs
@@ -225,7 +225,7 @@ namespace Mono.CSharp {
var dep = te.type.GetMissingDependencies ();
if (dep != null) {
- ImportedTypeDefinition.Error_MissingDependency (ec.Compiler, dep, loc);
+ ImportedTypeDefinition.Error_MissingDependency (ec, dep, loc);
}
//
@@ -2700,7 +2700,7 @@ namespace Mono.CSharp {
var dep = member.GetMissingDependencies ();
if (dep != null) {
- ImportedTypeDefinition.Error_MissingDependency (rc.Compiler, dep, loc);
+ ImportedTypeDefinition.Error_MissingDependency (rc, dep, loc);
}
if (!rc.IsObsolete) {
@@ -4389,7 +4389,7 @@ namespace Mono.CSharp {
var dep = best_candidate.GetMissingDependencies ();
if (dep != null) {
- ImportedTypeDefinition.Error_MissingDependency (rc.Compiler, dep, loc);
+ ImportedTypeDefinition.Error_MissingDependency (rc, dep, loc);
}
best_candidate.MemberDefinition.SetIsUsed ();
Modified: mcs/mcs/generic.cs
===================================================================
--- a/mcs/mcs/generic.cs
+++ b/mcs/mcs/generic.cs
@@ -2025,7 +2025,7 @@ namespace Mono.CSharp {
if (mc == null)
return false;
- ImportedTypeDefinition.Error_MissingDependency (mc.Compiler, dep, loc);
+ ImportedTypeDefinition.Error_MissingDependency (mc, dep, loc);
ok = false;
}
@@ -2056,7 +2056,7 @@ namespace Mono.CSharp {
if (mc == null)
return false;
- ImportedTypeDefinition.Error_MissingDependency (mc.Compiler, dep, loc);
+ ImportedTypeDefinition.Error_MissingDependency (mc, dep, loc);
ok = false;
// return immediately to avoid duplicate errors because we are scanning
Modified: mcs/mcs/ikvm.cs
===================================================================
--- a/mcs/mcs/ikvm.cs
+++ b/mcs/mcs/ikvm.cs
@@ -55,14 +55,13 @@ namespace Mono.CSharp
{
string name = baseType.Name;
- // TODO: namespace check
- if (name == "ValueType")
+ if (name == "ValueType" && baseType.Namespace == "System")
return MemberKind.Struct;
- if (name == "Enum")
+ if (name == "Enum" && baseType.Namespace == "System")
return MemberKind.Enum;
- if (name == "MulticastDelegate")
+ if (name == "MulticastDelegate" && baseType.Namespace == "System")
return MemberKind.Delegate;
return MemberKind.Class;
@@ -177,6 +176,7 @@ namespace Mono.CSharp
readonly StaticImporter importer;
readonly Universe domain;
Assembly corlib;
+ List<Tuple<AssemblyName, string>> loaded_names;
public StaticLoader (StaticImporter importer, CompilerContext compiler)
: base (compiler)
@@ -184,6 +184,7 @@ namespace Mono.CSharp
this.importer = importer;
domain = new Universe ();
domain.AssemblyResolve += AssemblyReferenceResolver;
+ loaded_names = new List<Tuple<AssemblyName, string>> ();
// TODO: profile specific
paths.Add (Path.GetDirectoryName (typeof (object).Assembly.Location));
@@ -206,9 +207,57 @@ namespace Mono.CSharp
Assembly AssemblyReferenceResolver (object sender, \
IKVM.Reflection.ResolveEventArgs args) {
- if (args.Name == "mscorlib")
+ var refname = args.Name;
+ if (refname == "mscorlib")
return corlib;
+ Assembly version_mismatch = null;
+ foreach (var assembly in domain.GetAssemblies ()) {
+ // TODO: Cannot handle unification into current assembly yet
+ if (assembly is AssemblyBuilder)
+ continue;
+
+ AssemblyComparisonResult result;
+ if (!Fusion.CompareAssemblyIdentityPure (refname, false, assembly.FullName, \
false, out result)) { + if ((result == \
AssemblyComparisonResult.NonEquivalentVersion || result == \
AssemblyComparisonResult.NonEquivalentPartialVersion) && + (version_mismatch == \
null || version_mismatch.GetName ().Version < assembly.GetName ().Version)) { \
+ version_mismatch = assembly; + }
+
+ continue;
+ }
+
+ if (result == AssemblyComparisonResult.EquivalentFXUnified ||
+ result == AssemblyComparisonResult.EquivalentFullMatch ||
+ result == AssemblyComparisonResult.EquivalentWeakNamed ||
+ result == AssemblyComparisonResult.EquivalentPartialMatch) {
+ return assembly;
+ }
+
+ throw new NotImplementedException ("Assembly equality = " + result.ToString ());
+ }
+
+ if (version_mismatch != null) {
+ var v1 = new AssemblyName (refname).Version;
+ var v2 = version_mismatch.GetName ().Version;
+
+ if (v1 > v2) {
+// compiler.Report.SymbolRelatedToPreviousError \
(args.RequestingAssembly.Location); + compiler.Report.Error (1705, "Assembly \
`{0}' references `{1}' which has higher version number than imported assembly `{2}'", \
+ args.RequestingAssembly.FullName, refname, version_mismatch.GetName \
().FullName); + } else if (v1.Major != v2.Major || v1.Minor != v2.Minor) {
+ compiler.Report.Warning (1701, 2,
+ "Assuming assembly reference `{0}' matches assembly `{1}'. You may need to \
supply runtime policy", + refname, version_mismatch.GetName ().FullName);
+ } else {
+ compiler.Report.Warning (1702, 3,
+ "Assuming assembly reference `{0}' matches assembly `{1}'. You may need to \
supply runtime policy", + refname, version_mismatch.GetName ().FullName);
+ }
+
+ return version_mismatch;
+ }
+
// AssemblyReference has not been found in the domain
// create missing reference and continue
return new MissingAssembly (domain, args.Name);
@@ -267,6 +316,39 @@ namespace Mono.CSharp
return null;
}
+ //
+ // check whether the assembly can be actually imported without
+ // collision
+ //
+ var an = module.GetAssemblyName ();
+ foreach (var entry in loaded_names) {
+ var loaded_name = entry.Item1;
+ if (an.Name != loaded_name.Name)
+ continue;
+
+ if (an.CodeBase == loaded_name.CodeBase)
+ return null;
+
+ if (((an.Flags | loaded_name.Flags) & AssemblyNameFlags.PublicKey) == 0) {
+ compiler.Report.SymbolRelatedToPreviousError (entry.Item2);
+ compiler.Report.SymbolRelatedToPreviousError (fileName);
+ compiler.Report.Error (1704,
+ "An assembly with the same name `{0}' has already been imported. Consider \
removing one of the references or sign the assembly", + an.Name);
+ return null;
+ }
+
+ if ((an.Flags & AssemblyNameFlags.PublicKey) == (loaded_name.Flags & \
AssemblyNameFlags.PublicKey) && an.Version.Equals (loaded_name.Version)) { \
+ compiler.Report.SymbolRelatedToPreviousError (entry.Item2); \
+ compiler.Report.SymbolRelatedToPreviousError (fileName); \
+ compiler.Report.Error (1703, + "An assembly with the same identity \
`{0}' has already been imported. Consider removing one of the references", \
+ an.FullName); + return null;
+ }
+ }
+
+ loaded_names.Add (Tuple.Create (an, fileName));
return domain.LoadAssembly (module);
}
} catch {
@@ -315,7 +397,12 @@ namespace Mono.CSharp
continue;
try {
- return domain.LoadFile (file);
+ var a = domain.LoadFile (file);
+ if (a != null) {
+ loaded_names.Add (Tuple.Create (a.GetName (), assembly));
+ }
+
+ return a;
} catch {
// Default assemblies can fail to load without error
return null;
@@ -493,7 +580,7 @@ namespace Mono.CSharp
public override AssemblyName GetName ()
{
- throw new NotImplementedException ();
+ return new AssemblyName (full_name);
}
public override string ImageRuntimeVersion {
@@ -612,6 +699,11 @@ namespace Mono.CSharp
return new MissingType ("#" + index.ToString (), assembly);
}
+ public override MetaType GetNestedType (string name, BindingFlags bindingAttr)
+ {
+ return new MissingType (full_name + name, assembly);
+ }
+
public override bool IsGenericTypeDefinition {
get {
return full_name.IndexOf ('`') > 0;
Modified: mcs/mcs/import.cs
===================================================================
--- a/mcs/mcs/import.cs
+++ b/mcs/mcs/import.cs
@@ -1694,12 +1694,22 @@ namespace Mono.CSharp
#endregion
- public static void Error_MissingDependency (CompilerContext ctx, List<MissingType> \
types, Location loc) + public static void Error_MissingDependency (IMemberContext \
ctx, List<MissingType> types, Location loc) {
foreach (var t in types) {
- ctx.Report.Error (12, loc,
+ string name = t.Name;
+ if (t.Namespace != null)
+ name = t.Namespace + "." + name;
+
+ if (t.Module.Assembly.GetName ().Name == ctx.Module.DeclaringAssembly.Name) {
+ ctx.Compiler.Report.Warning (1683, 1, loc,
+ "Reference to type `{0}' claims it is defined in this assembly, but it is not \
defined in source or any added modules", + name);
+ }
+
+ ctx.Compiler.Report.Error (12, loc,
"The type `{0}' is defined in an assembly that is not referenced. Consider \
adding a reference to assembly `{1}'",
- t.Name, t.Module.Assembly.FullName);
+ name, t.Module.Assembly.FullName);
}
}
Modified: mcs/mcs/reflection.cs
===================================================================
--- a/mcs/mcs/reflection.cs
+++ b/mcs/mcs/reflection.cs
@@ -176,6 +176,12 @@ namespace Mono.CSharp
throw new NotSupportedException ();
}
}
+
+ public string Namespace {
+ get {
+ throw new NotSupportedException ();
+ }
+ }
}
#endif
Modified: mcs/mcs/report.cs
===================================================================
--- a/mcs/mcs/report.cs
+++ b/mcs/mcs/report.cs
@@ -62,8 +62,8 @@ namespace Mono.CSharp {
809,
1030, 1058, 1066,
1522, 1570, 1571, 1572, 1573, 1574, 1580, 1581, 1584, 1587, 1589, 1590, 1591, \
1592,
- 1607, 1616, 1633, 1634, 1635, 1685, 1690, 1691, 1692, 1695, 1696, 1699,
- 1700, 1709, 1717, 1718, 1720,
+ 1607, 1616, 1633, 1634, 1635, 1685, 1690, 1691, 1692, 1695, 1696, 1699, 1683,
+ 1700, 1701, 1702, 1709, 1717, 1718, 1720,
1901, 1981,
2002, 2023, 2029,
3000, 3001, 3002, 3003, 3005, 3006, 3007, 3008, 3009,
@@ -170,7 +170,7 @@ namespace Mono.CSharp {
/// </summary>
public void SymbolRelatedToPreviousError (Location loc, string symbol)
{
- SymbolRelatedToPreviousError (loc.ToString (), symbol);
+ SymbolRelatedToPreviousError (loc.ToString ());
}
public void SymbolRelatedToPreviousError (MemberSpec ms)
@@ -193,7 +193,7 @@ namespace Mono.CSharp {
var imported_type = ms.MemberDefinition as ImportedTypeDefinition;
if (imported_type != null) {
var iad = imported_type.DeclaringAssembly as ImportedAssemblyDefinition;
- SymbolRelatedToPreviousError (iad.Location, "");
+ SymbolRelatedToPreviousError (iad.Location);
}
}
}
@@ -203,7 +203,7 @@ namespace Mono.CSharp {
SymbolRelatedToPreviousError (mc.Location, mc.GetSignatureForError ());
}
- void SymbolRelatedToPreviousError (string loc, string symbol)
+ public void SymbolRelatedToPreviousError (string loc)
{
string msg = String.Format ("{0} (Location of the symbol related to previous ", \
loc); if (extra_information.Contains (msg))
Commit: 029c168ffbb75150c025e90d9209c978028972cc
Author: Jb Evain <jbevain@gmail.com>
Date: 01/17/2011 09:55:11
URL: https://github.com/mono/mono/commit/029c168ffbb75150c025e90d9209c978028972cc
Fix pdb2mdb when a pdb has a method with no seq points.
Patch by Thad Thompson <TThompson@nucsafe.com>
Changed paths:
M mcs/tools/pdb2mdb/Driver.cs
Modified: mcs/tools/pdb2mdb/Driver.cs
===================================================================
--- a/mcs/tools/pdb2mdb/Driver.cs
+++ b/mcs/tools/pdb2mdb/Driver.cs
@@ -43,6 +43,9 @@ namespace Pdb2Mdb {
void ConvertFunction (PdbFunction function)
{
+ if (function.lines == null)
+ return;
+
var method = new SourceMethod { Name = function.name, Token = (int) \
function.token };
var file = GetSourceFile (mdb, function);
@@ -58,9 +61,6 @@ namespace Pdb2Mdb {
void ConvertSequencePoints (PdbFunction function, SourceFile file, \
SourceMethodBuilder builder) {
- if (function.lines == null)
- return;
-
foreach (var line in function.lines.SelectMany (lines => lines.lines))
builder.MarkSequencePoint (
(int) line.offset,
Commit: 61b183faa3ab5b7ff53bd16f414d822bf9170a88
Author: Zoltan Varga <vargaz@gmail.com>
Date: 01/17/2011 10:15:10
URL: https://github.com/mono/mono/commit/61b183faa3ab5b7ff53bd16f414d822bf9170a88
Avoid another case of infinite recursion in AOT.
Changed paths:
M mono/mini/aot-compiler.c
Modified: mono/mini/aot-compiler.c
===================================================================
--- a/mono/mini/aot-compiler.c
+++ b/mono/mini/aot-compiler.c
@@ -2814,6 +2814,9 @@ add_generic_class_with_depth (MonoAotCompile *acfg, MonoClass \
*klass, int depth) MonoMethod *method;
gpointer iter;
+ if (depth > 8)
+ return;
+
mono_class_init (klass);
if (klass->generic_class && klass->generic_class->context.class_inst->is_open)
@@ -2839,7 +2842,7 @@ add_generic_class_with_depth (MonoAotCompile *acfg, MonoClass \
*klass, int depth)
* FIXME: Instances which are referenced by these methods are not added,
* for example Array.Resize<int> for List<int>.Add ().
*/
- add_extra_method_with_depth (acfg, method, depth);
+ add_extra_method_with_depth (acfg, method, depth + 1);
}
if (klass->delegate) {
@@ -3081,16 +3084,18 @@ add_generic_instances (MonoAotCompile *acfg)
/* Add types of args/locals */
for (i = 0; i < acfg->methods->len; ++i) {
- int j;
+ int j, depth;
method = g_ptr_array_index (acfg->methods, i);
+ depth = GPOINTER_TO_UINT (g_hash_table_lookup (acfg->method_depth, method));
+
sig = mono_method_signature (method);
if (sig) {
for (j = 0; j < sig->param_count; ++j)
if (sig->params [j]->type == MONO_TYPE_GENERICINST)
- add_generic_class (acfg, mono_class_from_mono_type (sig->params [j]), FALSE);
+ add_generic_class_with_depth (acfg, mono_class_from_mono_type (sig->params \
[j]), depth + 1); }
header = mono_method_get_header (method);
@@ -3098,7 +3103,7 @@ add_generic_instances (MonoAotCompile *acfg)
if (header) {
for (j = 0; j < header->num_locals; ++j)
if (header->locals [j]->type == MONO_TYPE_GENERICINST)
- add_generic_class (acfg, mono_class_from_mono_type (header->locals [j]), \
FALSE); + add_generic_class_with_depth (acfg, mono_class_from_mono_type \
(header->locals [j]), depth + 1); }
}
Commit: fd66549c354d0f33832161163ababe1011610c23
Author: Marek Safar <marek.safar@gmail.com>
Date: 01/17/2011 12:22:12
URL: https://github.com/mono/mono/commit/fd66549c354d0f33832161163ababe1011610c23
Add new mcs -sdk option
Changed paths:
M man/mcs.1
M mcs/mcs/driver.cs
M mcs/mcs/ikvm.cs
M mcs/mcs/rootcontext.cs
Modified: man/mcs.1
===================================================================
--- a/man/mcs.1
+++ b/man/mcs.1
@@ -351,6 +351,11 @@ shell will perform globbing, so you might want to use it like \
this: $ mcs -recurse:'*.cs'
.fi
.TP
+.I \-sdk:VERSION
+Used to specify the version of Base Class Library assemblies. The possible
+values are: 2 (default), 4. The version number means which .NET version
+should the produced assembly be compatible with.
+.TP
.I \-\-shell
Starts up the compiler in interactive mode, providing a C# shell for
statements and expressions. A shortcut is to use the
Modified: mcs/mcs/driver.cs
===================================================================
--- a/mcs/mcs/driver.cs
+++ b/mcs/mcs/driver.cs
@@ -167,8 +167,8 @@ namespace Mono.CSharp
" --about About the Mono C# compiler\n" +
" -addmodule:M1[,Mn] Adds the module to the generated assembly\n" +
" -checked[+|-] Sets default aritmetic overflow context\n" +
- " -codepage:ID Sets code page to the one in ID (number, utf8, \
reset)\n" + " -clscheck[+|-] Disables CLS Compliance verifications\n" +
+ " -codepage:ID Sets code page to the one in ID (number, utf8, \
reset)\n" +
" -define:S1[;S2] Defines one or more conditional symbols (short: -d)\n" \
+ " -debug[+|-], -g Generate debugging information\n" +
" -delaysign[+|-] Only insert the public key into the assembly (no \
signing)\n" + @@ -191,7 +191,9 @@ namespace Mono.CSharp
" ARCH can be one of: anycpu, x86, x64 or itanium\n" +
" -recurse:SPEC Recursively compiles files according to SPEC pattern\n" \
+
" -reference:A1[,An] Imports metadata from the specified assembly (short: \
-r)\n" +
- " -reference:ALIAS=A Imports metadata using specified extern alias (short: \
-r)\n" + + " -reference:ALIAS=A Imports metadata using specified extern \
alias (short: -r)\n" + + " -sdk:VERSION Specifies SDK version of \
referenced assemlies\n" + + " VERSION can be one of: 2 \
(default), 4\n" +
" -target:KIND Specifies the format of the output assembly (short: \
-t)\n" +
" KIND can be one of: exe, winexe, library, module\n" +
" -unsafe[+|-] Allows to compile code which uses unsafe keyword\n" +
@@ -1193,6 +1195,26 @@ namespace Mono.CSharp
return true;
+ case "/sdk":
+ if (value.Length == 0) {
+ Error_RequiresArgument (option);
+ break;
+ }
+
+ switch (value.ToLowerInvariant ()) {
+ case "2":
+ RootContext.SdkVersion = SdkVersion.v2;
+ break;
+ case "4":
+ RootContext.SdkVersion = SdkVersion.v4;
+ break;
+ default:
+ Report.Error (-26, "Invalid sdk version name");
+ break;
+ }
+
+ return true;
+
// We just ignore this.
case "/errorreport":
case "/filealign":
Modified: mcs/mcs/ikvm.cs
===================================================================
--- a/mcs/mcs/ikvm.cs
+++ b/mcs/mcs/ikvm.cs
@@ -177,6 +177,14 @@ namespace Mono.CSharp
readonly Universe domain;
Assembly corlib;
List<Tuple<AssemblyName, string>> loaded_names;
+ static readonly Dictionary<SdkVersion, string[]> sdk_directory;
+
+ static StaticLoader ()
+ {
+ sdk_directory = new Dictionary<SdkVersion, string[]> ();
+ sdk_directory.Add (SdkVersion.v2, new string[] { "2.0", "net_2_0", "v2.0.50727" \
}); + sdk_directory.Add (SdkVersion.v4, new string[] { "4.0", "net_4_0", \
"v4.0.30319" }); + }
public StaticLoader (StaticImporter importer, CompilerContext compiler)
: base (compiler)
@@ -186,8 +194,23 @@ namespace Mono.CSharp
domain.AssemblyResolve += AssemblyReferenceResolver;
loaded_names = new List<Tuple<AssemblyName, string>> ();
- // TODO: profile specific
- paths.Add (Path.GetDirectoryName (typeof (object).Assembly.Location));
+ var corlib_path = Path.GetDirectoryName (typeof (object).Assembly.Location);
+ string fx_path = corlib_path.Substring (0, corlib_path.LastIndexOf \
(Path.DirectorySeparatorChar)); + string sdk_path = null;
+
+ foreach (var dir in sdk_directory[RootContext.SdkVersion]) {
+ sdk_path = Path.Combine (fx_path, dir);
+ if (Directory.Exists (sdk_path))
+ break;
+
+ sdk_path = null;
+ }
+
+ if (sdk_path == null) {
+ compiler.Report.Warning (-1, 1, "SDK path could not be resolved");
+ } else {
+ paths.Add (sdk_path);
+ }
}
public Assembly Corlib {
@@ -348,6 +371,9 @@ namespace Mono.CSharp
}
}
+ if (Report.DebugFlags > 0)
+ Console.WriteLine ("Loading assembly `{0}'", fileName);
+
loaded_names.Add (Tuple.Create (an, fileName));
return domain.LoadAssembly (module);
}
@@ -397,6 +423,9 @@ namespace Mono.CSharp
continue;
try {
+ if (Report.DebugFlags > 0)
+ Console.WriteLine ("Loading default assembly `{0}'", file);
+
var a = domain.LoadFile (file);
if (a != null) {
loaded_names.Add (Tuple.Create (a.GetName (), assembly));
Modified: mcs/mcs/rootcontext.cs
===================================================================
--- a/mcs/mcs/rootcontext.cs
+++ b/mcs/mcs/rootcontext.cs
@@ -35,6 +35,12 @@ namespace Mono.CSharp {
v4
}
+ public enum SdkVersion
+ {
+ v2,
+ v4
+ }
+
public enum Target
{
Library, Exe, Module, WinExe
@@ -58,6 +64,7 @@ namespace Mono.CSharp {
public static LanguageVersion Version;
public static bool EnhancedWarnings;
public static bool LoadDefaultReferences;
+ public static SdkVersion SdkVersion;
//
// We keep strongname related info here because
@@ -205,6 +212,7 @@ namespace Mono.CSharp {
MainClass = null;
OutputFile = null;
Target = Target.Exe;
+ SdkVersion = SdkVersion.v2;
TargetExt = ".exe";
Platform = Platform.AnyCPU;
Version = LanguageVersion.Default;
Commit: 7dfbfce2c4af2bb0e608625bb100b5dd0c5f080e
Author: Rodrigo Kumpera <kumpera@gmail.com>
Date: 01/17/2011 14:05:16
URL: https://github.com/mono/mono/commit/7dfbfce2c4af2bb0e608625bb100b5dd0c5f080e
Don't check for brokeness when verifying contraints.
* verify.c (is_valid_generic_instantiation): Don't
check if any argument is broken during constraint check
as an instance should be valid, but not realizable, even
if it has broken arguments.
Fixes one of the issues with #664612
Changed paths:
M mono/metadata/verify.c
Modified: mono/metadata/verify.c
===================================================================
--- a/mono/metadata/verify.c
+++ b/mono/metadata/verify.c
@@ -554,7 +554,9 @@ verifier_inflate_type (VerifyContext *ctx, MonoType *type, \
MonoGenericContext *c return result;
}
-
+/*A side note here. We don't need to check if arguments are broken since this
+is only need to be done by the runtime before realizing the type.
+*/
static gboolean
is_valid_generic_instantiation (MonoGenericContainer *gc, MonoGenericContext \
*context, MonoGenericInst *ginst) {
@@ -576,8 +578,6 @@ is_valid_generic_instantiation (MonoGenericContainer *gc, \
MonoGenericContext *co
paramClass = mono_class_from_mono_type (param_type);
- if (paramClass->exception_type != MONO_EXCEPTION_NONE)
- return FALSE;
/* A GTD can't be a generic argument.
*
Commit: fe3cd893f747345f7f970d55098d686688838dd4
Author: Zoltan Varga <vargaz@gmail.com>
Date: 01/17/2011 16:46:43
URL: https://github.com/mono/mono/commit/fe3cd893f747345f7f970d55098d686688838dd4
OP_LCOMPARE_IM has type 'L', not 'I'. Fixes #664630.
This is the same as 6c02c15153, but only for ia64, to avoid destabilizing the
branch.
Changed paths:
M mono/mini/mini-codegen.c
Modified: mono/mini/mini-codegen.c
===================================================================
--- a/mono/mini/mini-codegen.c
+++ b/mono/mini/mini-codegen.c
@@ -2428,7 +2428,9 @@ mono_opcode_to_type (int opcode, int cmp_opcode)
switch (cmp_opcode) {
case OP_ICOMPARE:
case OP_ICOMPARE_IMM:
+#if !defined(__ia64__)
case OP_LCOMPARE_IMM:
+#endif
return CMP_TYPE_I;
default:
return CMP_TYPE_L;
Commit: fe6c36df0a1f8694cd159d2d1b382bb8087543d5
Author: Zoltan Varga <vargaz@gmail.com>
Date: 01/17/2011 17:18:17
URL: https://github.com/mono/mono/commit/fe6c36df0a1f8694cd159d2d1b382bb8087543d5
Make runtime invoke wrappers use cdecl cconv on windows.
Changed paths:
M mono/metadata/marshal.c
Modified: mono/metadata/marshal.c
===================================================================
--- a/mono/metadata/marshal.c
+++ b/mono/metadata/marshal.c
@@ -4604,6 +4604,10 @@ mono_marshal_get_runtime_invoke (MonoMethod *method, gboolean \
virtual) csig->params [2] = &mono_defaults.int_class->byval_arg;
csig->params [3] = &mono_defaults.int_class->byval_arg;
csig->pinvoke = 1;
+#if TARGET_WIN32
+ /* This is called from runtime code so it has to be cdecl */
+ csig->call_convention = MONO_CALL_C;
+#endif
name = mono_signature_to_name (callsig, virtual ? "runtime_invoke_virtual" : \
"runtime_invoke"); mb = mono_mb_new (target_klass, name, \
MONO_WRAPPER_RUNTIME_INVOKE);
Commit: 8e600e2290addbc55f6527d2cc1fba105ee22b75
Author: Marek Safar <marek.safar@gmail.com>
Date: 01/18/2011 08:32:34
URL: https://github.com/mono/mono/commit/8e600e2290addbc55f6527d2cc1fba105ee22b75
Remove devirtualization for Type members
Changed paths:
M mcs/mcs/expression.cs
Modified: mcs/mcs/expression.cs
===================================================================
--- a/mcs/mcs/expression.cs
+++ b/mcs/mcs/expression.cs
@@ -5323,7 +5323,7 @@ namespace Mono.CSharp
//
// It's non-virtual and will never be null
//
- if (!method.IsVirtual && (instance is This || instance is New || instance is \
ArrayCreation || instance is DelegateCreation || instance is TypeOf)) + if \
(!method.IsVirtual && (instance is This || instance is New || instance is \
ArrayCreation || instance is DelegateCreation)) return false;
return true;
Commit: 74d5f80e4a72423a005a9a4686bfbed5cd3920e4
Author: Zoltan Varga <vargaz@gmail.com>
Date: 01/18/2011 10:42:22
URL: https://github.com/mono/mono/commit/74d5f80e4a72423a005a9a4686bfbed5cd3920e4
Allow only primitive types/enums in RuntimeHelpers.InitializeArray ().
Changed paths:
M mono/metadata/icall.c
Modified: mono/metadata/icall.c
===================================================================
--- a/mono/metadata/icall.c
+++ b/mono/metadata/icall.c
@@ -825,12 +825,9 @@ \
ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_InitializeArray (MonoAr int \
align; const char *field_data;
- if (MONO_TYPE_IS_REFERENCE (type) ||
- (type->type == MONO_TYPE_VALUETYPE &&
- (!mono_type_get_class (type) ||
- mono_type_get_class (type)->has_references))) {
+ if (MONO_TYPE_IS_REFERENCE (type) || type->type == MONO_TYPE_VALUETYPE) {
MonoException *exc = mono_get_exception_argument("array",
- "Cannot initialize array containing references");
+ "Cannot initialize array of non-primitive type.");
mono_raise_exception (exc);
}
Commit: 001ea99047a2f3a8106e5ac9cb13e3cf4ee55c6b
Author: Zoltan Varga <vargaz@gmail.com>
Date: 01/18/2011 11:17:42
URL: https://github.com/mono/mono/commit/001ea99047a2f3a8106e5ac9cb13e3cf4ee55c6b
Disable some of the FastCopy fast paths since they are racy.
Changed paths:
M mono/metadata/icall.c
Modified: mono/metadata/icall.c
===================================================================
--- a/mono/metadata/icall.c
+++ b/mono/metadata/icall.c
@@ -687,7 +687,6 @@ ves_icall_System_Array_FastCopy (MonoArray *source, int \
source_idx, MonoArray* d void * source_addr;
MonoClass *src_class;
MonoClass *dest_class;
- int i;
MONO_ARCH_SAVE_REGS;
@@ -711,6 +710,10 @@ ves_icall_System_Array_FastCopy (MonoArray *source, int \
source_idx, MonoArray* d
/* Case1: object[] -> valuetype[] (ArrayList::ToArray) */
if (src_class == mono_defaults.object_class && dest_class->valuetype) {
+ // FIXME: This is racy
+ return FALSE;
+ /*
+ int i;
int has_refs = dest_class->has_references;
for (i = source_idx; i < source_idx + length; ++i) {
MonoObject *elem = mono_array_get (source, MonoObject*, i);
@@ -731,6 +734,7 @@ ves_icall_System_Array_FastCopy (MonoArray *source, int \
source_idx, MonoArray* d memcpy (addr, (char *)elem + sizeof (MonoObject), \
element_size); }
return TRUE;
+ */
}
/* Check if we're copying a char[] <==> (u)short[] */
@@ -741,13 +745,18 @@ ves_icall_System_Array_FastCopy (MonoArray *source, int \
source_idx, MonoArray* d if (mono_class_is_subclass_of (src_class, dest_class, \
FALSE)) ;
/* Case2: object[] -> reftype[] (ArrayList::ToArray) */
- else if (mono_class_is_subclass_of (dest_class, src_class, FALSE))
+ else if (mono_class_is_subclass_of (dest_class, src_class, FALSE)) {
+ // FIXME: This is racy
+ return FALSE;
+ /*
+ int i;
for (i = source_idx; i < source_idx + length; ++i) {
MonoObject *elem = mono_array_get (source, MonoObject*, i);
if (elem && !mono_object_isinst (elem, dest_class))
return FALSE;
}
- else
+ */
+ } else
return FALSE;
}
Commit: 132f745176e2af215eee4712e1dff431101069a2
Author: Marek Safar <marek.safar@gmail.com>
Date: 01/18/2011 12:10:46
URL: https://github.com/mono/mono/commit/132f745176e2af215eee4712e1dff431101069a2
Fallback to corlib location when sdk path cannot be found
Changed paths:
M mcs/mcs/ikvm.cs
Modified: mcs/mcs/ikvm.cs
===================================================================
--- a/mcs/mcs/ikvm.cs
+++ b/mcs/mcs/ikvm.cs
@@ -208,9 +208,10 @@ namespace Mono.CSharp
if (sdk_path == null) {
compiler.Report.Warning (-1, 1, "SDK path could not be resolved");
- } else {
- paths.Add (sdk_path);
+ sdk_path = corlib_path;
}
+
+ paths.Add (sdk_path);
}
public Assembly Corlib {
Commit: ca1199315737fdf935d75911e961d187e957e42e
Author: Marek Safar <marek.safar@gmail.com>
Date: 01/18/2011 12:11:07
URL: https://github.com/mono/mono/commit/ca1199315737fdf935d75911e961d187e957e42e
Checking skd path for is not enough, add check for mscorlib as well
Changed paths:
M mcs/mcs/ikvm.cs
Modified: mcs/mcs/ikvm.cs
===================================================================
--- a/mcs/mcs/ikvm.cs
+++ b/mcs/mcs/ikvm.cs
@@ -200,7 +200,7 @@ namespace Mono.CSharp
foreach (var dir in sdk_directory[RootContext.SdkVersion]) {
sdk_path = Path.Combine (fx_path, dir);
- if (Directory.Exists (sdk_path))
+ if (File.Exists (Path.Combine (sdk_path, "mscorlib.dll")))
break;
sdk_path = null;
Commit: 744c3e2c5b461ef8e1c2c183de66eead04caeac5
Author: Zoltan Varga <vargaz@gmail.com>
Date: 01/18/2011 12:12:47
URL: https://github.com/mono/mono/commit/744c3e2c5b461ef8e1c2c183de66eead04caeac5
Make the stacks of aot image non-executable.
Changed paths:
M mono/mini/aot-compiler.c
M mono/mini/image-writer.c
M mono/utils/freebsd-elf_common.h
Modified: mono/mini/aot-compiler.c
===================================================================
--- a/mono/mini/aot-compiler.c
+++ b/mono/mini/aot-compiler.c
@@ -185,7 +185,7 @@ typedef struct MonoAotCompile {
MonoClass **typespec_classes;
GString *llc_args;
GString *as_args;
- gboolean thumb_mixed, need_no_dead_strip;
+ gboolean thumb_mixed, need_no_dead_strip, need_pt_gnu_stack;
} MonoAotCompile;
typedef struct {
@@ -525,6 +525,10 @@ arch_init (MonoAotCompile *acfg)
acfg->llvm_label_prefix = "_";
acfg->need_no_dead_strip = TRUE;
#endif
+
+#if defined(__linux__)
+ acfg->need_pt_gnu_stack = TRUE;
+#endif
}
/*
@@ -6956,6 +6960,13 @@ mono_compile_assembly (MonoAssembly *ass, guint32 opts, const \
char *aot_options)
emit_mem_end (acfg);
+ if (acfg->need_pt_gnu_stack) {
+ /* This is required so the .so doesn't have an executable stack */
+ /* The bin writer already emits this */
+ if (!acfg->use_bin_writer)
+ fprintf (acfg->fp, "\n.section .note.GNU-stack,\"\",@progbits\n");
+ }
+
TV_GETTIME (btv);
acfg->stats.gen_time = TV_ELAPSED (atv, btv);
Modified: mono/mini/image-writer.c
===================================================================
--- a/mono/mini/image-writer.c
+++ b/mono/mini/image-writer.c
@@ -1070,7 +1070,7 @@ bin_writer_emit_writeout (MonoImageWriter *acfg)
{
FILE *file;
ElfHeader header;
- ElfProgHeader progh [3];
+ ElfProgHeader progh [4];
ElfSectHeader secth [SECT_NUM];
#ifdef USE_ELF_RELA
ElfRelocA *relocs;
@@ -1336,7 +1336,7 @@ bin_writer_emit_writeout (MonoImageWriter *acfg)
header.e_phoff = sizeof (header);
header.e_ehsize = sizeof (header);
header.e_phentsize = sizeof (ElfProgHeader);
- header.e_phnum = 3;
+ header.e_phnum = 4;
header.e_entry = secth [SECT_TEXT].sh_addr;
header.e_shstrndx = SECT_SHSTRTAB;
header.e_shentsize = sizeof (ElfSectHeader);
@@ -1407,6 +1407,13 @@ bin_writer_emit_writeout (MonoImageWriter *acfg)
progh [2].p_align = SIZEOF_VOID_P;
progh [2].p_flags = 6;
+ progh [3].p_type = PT_GNU_STACK;
+ progh [3].p_offset = secth [SECT_DYNAMIC].sh_offset;
+ progh [3].p_vaddr = progh [3].p_paddr = secth [SECT_DYNAMIC].sh_addr;
+ progh [3].p_filesz = progh [3].p_memsz = secth [SECT_DYNAMIC].sh_size;
+ progh [3].p_align = SIZEOF_VOID_P;
+ progh [3].p_flags = 6;
+
/* Compute the addresses of the bin sections, so relocation can be done */
for (i = 0; i < SECT_NUM; ++i) {
if (sections [i]) {
Modified: mono/utils/freebsd-elf_common.h
===================================================================
--- a/mono/utils/freebsd-elf_common.h
+++ b/mono/utils/freebsd-elf_common.h
@@ -257,6 +257,7 @@ typedef struct {
#define PT_LOOS 0x60000000 /* First OS-specific. */
#define PT_SUNW_UNWIND 0x6464e550 /* amd64 UNWIND program header */
#define PT_GNU_EH_FRAME 0x6474e550
+#define PT_GNU_STACK 0x6474e551
#define PT_LOSUNW 0x6ffffffa
#define PT_SUNWBSS 0x6ffffffa /* Sun Specific segment */
#define PT_SUNWSTACK 0x6ffffffb /* describes the stack segment */
Commit: 347ad09426605877813de85f434b830773e5b1fc
Author: Gonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Date: 01/18/2011 22:44:15
URL: https://github.com/mono/mono/commit/347ad09426605877813de85f434b830773e5b1fc
Happy new year.
Changed paths:
M mono/mini/driver.c
M mono/mini/mini.c
Modified: mono/mini/driver.c
===================================================================
--- a/mono/mini/driver.c
+++ b/mono/mini/driver.c
@@ -1393,7 +1393,7 @@ mono_main (int argc, char* argv[])
char *build = mono_get_runtime_build_info ();
char *gc_descr;
- g_print ("Mono JIT compiler version %s\nCopyright (C) 2002-2010 Novell, Inc and \
Contributors. www.mono-project.com\n", build); + g_print ("Mono JIT compiler \
version %s\nCopyright (C) 2002-2011 Novell, Inc and Contributors. \
www.mono-project.com\n", build); g_free (build);
g_print (info);
gc_descr = mono_gc_get_description ();
Modified: mono/mini/mini.c
===================================================================
--- a/mono/mini/mini.c
+++ b/mono/mini/mini.c
@@ -6,7 +6,7 @@
* Dietmar Maurer (dietmar@ximian.com)
*
* Copyright 2002-2003 Ximian, Inc.
- * Coprygith 2003-2010 Novell, Inc.
+ * Copyright 2003-2010 Novell, Inc.
*/
#define MONO_LLVM_IN_MINI 1
Commit: a3d0d6916e12d7fdc0deaf1b37e8ad3f10969fed
Author: Rodrigo Kumpera <kumpera@gmail.com>
Date: 01/19/2011 09:02:09
URL: https://github.com/mono/mono/commit/a3d0d6916e12d7fdc0deaf1b37e8ad3f10969fed
Properly clear weak refs that don't track resurrection.
* sgen-gc.c (finish_gray_stack): We must clear
weak refs that don't track resurrection before
processing finalizable objects otherwise we'll
copy/mark them and the weak ref won't be cleared
until after finalization.
Fixes #657408
Changed paths:
M mono/metadata/sgen-gc.c
Modified: mono/metadata/sgen-gc.c
===================================================================
--- a/mono/metadata/sgen-gc.c
+++ b/mono/metadata/sgen-gc.c
@@ -825,7 +825,7 @@ static void find_pinning_ref_from_thread (char *obj, size_t \
size); static void update_current_thread_stack (void *start);
static void finalize_in_range (CopyOrMarkObjectFunc copy_func, char *start, char \
*end, int generation, GrayQueue *queue); static void add_or_remove_disappearing_link \
(MonoObject *obj, void **link, gboolean track, int generation);
-static void null_link_in_range (CopyOrMarkObjectFunc copy_func, char *start, char \
*end, int generation, GrayQueue *queue); +static void null_link_in_range \
(CopyOrMarkObjectFunc copy_func, char *start, char *end, int generation, gboolean \
before_finalization, GrayQueue *queue); static void null_links_for_domain \
(MonoDomain *domain, int generation); static gboolean search_fragment_for_size \
(size_t size); static int search_fragment_for_size_range (size_t desired_size, \
size_t minimum_size); @@ -2468,6 +2468,15 @@ finish_gray_stack (char *start_addr, \
char *end_addr, int generation, GrayQueue * drain_gray_stack (queue);
TV_GETTIME (atv);
DEBUG (2, fprintf (gc_debug_file, "%s generation done\n", generation_name \
(generation))); +
+ /*
+ We must clear weak links that don't track resurrection before processing object \
ready for + finalization so they can be cleared before that.
+ */
+ null_link_in_range (copy_func, start_addr, end_addr, generation, TRUE, queue);
+ if (generation == GENERATION_OLD)
+ null_link_in_range (copy_func, start_addr, end_addr, GENERATION_NURSERY, TRUE, \
queue); +
/* walk the finalization queue and move also the objects that need to be
* finalized: use the finalized objects as new roots so the objects they depend
* on are also not reclaimed. As with the roots above, only objects in the nursery
@@ -2519,9 +2528,9 @@ finish_gray_stack (char *start_addr, char *end_addr, int \
generation, GrayQueue *
*/
g_assert (gray_object_queue_is_empty (queue));
for (;;) {
- null_link_in_range (copy_func, start_addr, end_addr, generation, queue);
+ null_link_in_range (copy_func, start_addr, end_addr, generation, FALSE, queue);
if (generation == GENERATION_OLD)
- null_link_in_range (copy_func, start_addr, end_addr, GENERATION_NURSERY, queue);
+ null_link_in_range (copy_func, start_addr, end_addr, GENERATION_NURSERY, FALSE, \
queue); if (gray_object_queue_is_empty (queue))
break;
drain_gray_stack (queue);
@@ -4276,7 +4285,7 @@ mark_ephemerons_in_range (CopyOrMarkObjectFunc copy_func, char \
*start, char *end
/* LOCKING: requires that the GC lock is held */
static void
-null_link_in_range (CopyOrMarkObjectFunc copy_func, char *start, char *end, int \
generation, GrayQueue *queue) +null_link_in_range (CopyOrMarkObjectFunc copy_func, \
char *start, char *end, int generation, gboolean before_finalization, GrayQueue \
*queue) {
DisappearingLinkHashTable *hash = get_dislink_hash_table (generation);
DisappearingLink **disappearing_link_hash = hash->table;
@@ -4288,9 +4297,17 @@ null_link_in_range (CopyOrMarkObjectFunc copy_func, char \
*start, char *end, int for (i = 0; i < disappearing_link_hash_size; ++i) {
prev = NULL;
for (entry = disappearing_link_hash [i]; entry;) {
- char *object = DISLINK_OBJECT (entry);
+ char *object;
+ gboolean track = DISLINK_TRACK (entry);
+ if (track == before_finalization) {
+ prev = entry;
+ entry = entry->next;
+ continue;
+ }
+
+ object = DISLINK_OBJECT (entry);
+
if (object >= start && object < end && !major_collector.is_object_live (object)) \
{
- gboolean track = DISLINK_TRACK (entry);
if (!track && object_is_fin_ready (object)) {
void **p = entry->link;
DisappearingLink *old;
Commit: 3914fd479a0ba5cb22fde444ea802ec5763838da
Author: Rodrigo Kumpera <kumpera@gmail.com>
Date: 01/19/2011 09:02:25
URL: https://github.com/mono/mono/commit/3914fd479a0ba5cb22fde444ea802ec5763838da
Document precise marking
Changed paths:
M man/mono.1
Modified: man/mono.1
===================================================================
--- a/man/mono.1
+++ b/man/mono.1
@@ -1021,6 +1021,16 @@ Enables or disables concurrent sweep for the Mark&Sweep \
collector. If enabled, the sweep phase of the garbage collection is done in a \
thread concurrently with the application. Concurrent sweep is disabled by
default.
+.TP
+\fBstack-mark=\fImark-mode\fR
+Specifies how application threads should be scanned. Options are
+`precise` and `conservative`. Precise marking allow the collector
+to know what values on stack are references and what are not.
+Conservative marking threats all values as potentially references
+and leave them untouched. Precise marking reduces floating garbage
+and can speed up nursery collection and allocation rate, it has
+the downside of requiring a significant extra memory per compiled
+method. The right option, unfortunately, requires experimentation.
.ne
.RE
.TP
Commit: 51d92f3a6a73fe5a711043010df808ea87e5689e
Author: Andrew Jorgensen <ajorgensen@novell.com>
Date: 01/19/2011 17:43:12
URL: https://github.com/mono/mono/commit/51d92f3a6a73fe5a711043010df808ea87e5689e
Dist more files needed by MSVC build
Changed paths:
M Makefile.am
M msvc/Makefile.am
Modified: Makefile.am
===================================================================
--- a/Makefile.am
+++ b/Makefile.am
@@ -19,7 +19,16 @@ DIST_SUBDIRS = po libgc eglib mono ikvm-native support data \
runtime scripts man endif
endif
-EXTRA_DIST= nls.m4 po.m4 progtest.m4 mono-uninstalled.pc.in build-mingw32.sh LICENSE \
mkinstalldirs autogen.sh +EXTRA_DIST= \
+ LICENSE \
+ autogen.sh \
+ build-mingw32.sh \
+ mkinstalldirs \
+ mono-uninstalled.pc.in \
+ nls.m4 \
+ po.m4 \
+ progtest.m4 \
+ winconfig.h
DISTCHECK_CONFIGURE_FLAGS = EXTERNAL_MCS=false EXTERNAL_RUNTIME=false
Modified: msvc/Makefile.am
===================================================================
--- a/msvc/Makefile.am
+++ b/msvc/Makefile.am
@@ -16,7 +16,16 @@ VCPROJS = \
VCXPROJS = $(wildcard *.vcxproj)
-EXTRA_DIST = create-windef.pl mono.def README mono.sln winsetup.bat $(VCPROJS) \
$(VCXPROJS) +EXTRA_DIST = \
+ $(VCPROJS) \
+ $(VCXPROJS) \
+ README \
+ create-windef.pl \
+ mono.def \
+ mono.sln \
+ monoposixhelper.def \
+ runmdesc.bat \
+ winsetup.bat
update-def:
perl create-windef.pl mono.def
Commit: 626711d3ac62a1b8f451ede724c312d033645f4c
Author: Zoltan Varga <vargaz@gmail.com>
Date: 01/19/2011 20:14:22
URL: https://github.com/mono/mono/commit/626711d3ac62a1b8f451ede724c312d033645f4c
Add a TID field to ThreadMirror which returns the system thread id.
Changed paths:
M mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs
M mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/ThreadMirror.cs
M mcs/class/Mono.Debugger.Soft/Test/dtest.cs
M mono/mini/debugger-agent.c
Modified: mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs
===================================================================
--- a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs
+++ b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs
@@ -380,7 +380,9 @@ namespace Mono.Debugger.Soft
GET_STATE = 3,
GET_INFO = 4,
/* FIXME: Merge into GET_INFO when the major protocol version is increased */
- GET_ID = 5
+ GET_ID = 5,
+ /* Ditto */
+ GET_TID = 6
}
enum CmdEventRequest {
@@ -1555,6 +1557,10 @@ namespace Mono.Debugger.Soft
return SendReceive (CommandSet.THREAD, (int)CmdThread.GET_ID, new PacketWriter \
().WriteId (id)).ReadLong (); }
+ public long Thread_GetTID (long id) {
+ return SendReceive (CommandSet.THREAD, (int)CmdThread.GET_TID, new PacketWriter \
().WriteId (id)).ReadLong (); + }
+
/*
* MODULE
*/
Modified: mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/ThreadMirror.cs
===================================================================
--- a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/ThreadMirror.cs
+++ b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/ThreadMirror.cs
@@ -61,5 +61,15 @@ namespace Mono.Debugger.Soft
return vm.conn.Thread_GetId (id);
}
}
+
+ /*
+ * Return the system thread id (TID) for this thread, this id is not unique since
+ * a newly started thread might reuse a dead thread's id.
+ */
+ public long TID {
+ get {
+ return vm.conn.Thread_GetTID (id);
+ }
+ }
}
}
Modified: mcs/class/Mono.Debugger.Soft/Test/dtest.cs
===================================================================
--- a/mcs/class/Mono.Debugger.Soft/Test/dtest.cs
+++ b/mcs/class/Mono.Debugger.Soft/Test/dtest.cs
@@ -1999,6 +1999,8 @@ public class DebuggerTests
Assert.IsTrue (e.Thread.ThreadId > 0);
+ Assert.AreEqual (e.Thread.TID, e.Thread.TID);
+
vm.EnableEvents (EventType.ThreadStart, EventType.ThreadDeath);
vm.Resume ();
Modified: mono/mini/debugger-agent.c
===================================================================
--- a/mono/mini/debugger-agent.c
+++ b/mono/mini/debugger-agent.c
@@ -366,7 +366,8 @@ typedef enum {
CMD_THREAD_GET_NAME = 2,
CMD_THREAD_GET_STATE = 3,
CMD_THREAD_GET_INFO = 4,
- CMD_THREAD_GET_ID = 5
+ CMD_THREAD_GET_ID = 5,
+ CMD_THREAD_GET_TID = 6
} CmdThread;
typedef enum {
@@ -6555,6 +6556,9 @@ thread_commands (int command, guint8 *p, guint8 *end, Buffer \
*buf) case CMD_THREAD_GET_ID:
buffer_add_long (buf, (guint64)(gsize)thread);
break;
+ case CMD_THREAD_GET_TID:
+ buffer_add_long (buf, (guint64)thread->tid);
+ break;
default:
return ERR_NOT_IMPLEMENTED;
}
Commit: 15ead88bf2c38dc23656412f3f9124f99bbc20ec
Author: Zoltan Varga <vargaz@gmail.com>
Date: 01/19/2011 23:36:20
URL: https://github.com/mono/mono/commit/15ead88bf2c38dc23656412f3f9124f99bbc20ec
Properly align the stack in the arm generic trampoline.
Changed paths:
M mono/mini/tramp-arm.c
Modified: mono/mini/tramp-arm.c
===================================================================
--- a/mono/mini/tramp-arm.c
+++ b/mono/mini/tramp-arm.c
@@ -269,8 +269,21 @@ mono_arch_create_generic_trampoline (MonoTrampolineType \
tramp_type, MonoTrampInf code += 4;
}
+ /* Align stack to 8 */
+ /* FIXME: Do this properly at the beginning */
+ g_assert (STACK % 8 == 4);
+ ARM_SUB_REG_IMM8 (code, ARMREG_SP, ARMREG_SP, 4);
+ cfa_offset += 4;
+ mono_add_unwind_op_def_cfa (unwind_ops, code, buf, ARMREG_SP, cfa_offset);
+
ARM_MOV_REG_REG (code, ARMREG_LR, ARMREG_PC);
code = emit_bx (code, ARMREG_IP);
+
+ /* Restore stack */
+ ARM_ADD_REG_IMM8 (code, ARMREG_SP, ARMREG_SP, 4);
+ cfa_offset -= 4;
+ mono_add_unwind_op_def_cfa (unwind_ops, code, buf, ARMREG_SP, cfa_offset);
+
/* OK, code address is now on r0. Move it to the place on the stack
* where IP was saved (it is now no more useful to us and it can be
Commit: ba139553af50c3c0e51d1fd741d18341839a2896
Author: Marek Safar <marek.safar@gmail.com>
Date: 01/20/2011 03:36:02
URL: https://github.com/mono/mono/commit/ba139553af50c3c0e51d1fd741d18341839a2896
[665333] Encode Length of Public Key correctly
Changed paths:
M mcs/mcs/assembly.cs
Modified: mcs/mcs/assembly.cs
===================================================================
--- a/mcs/mcs/assembly.cs
+++ b/mcs/mcs/assembly.cs
@@ -549,11 +549,11 @@ namespace Mono.CSharp
Buffer.BlockCopy (publicKeyHeader, 0, public_key, 0, publicKeyHeader.Length);
// Length of Public Key (in bytes)
- byte[] lastPart = BitConverter.GetBytes (public_key.Length - 12);
- public_key[8] = lastPart[0];
- public_key[9] = lastPart[1];
- public_key[10] = lastPart[2];
- public_key[11] = lastPart[3];
+ int lastPart = public_key.Length - 12;
+ public_key[8] = (byte) (lastPart & 0xFF);
+ public_key[9] = (byte) ((lastPart >> 8) & 0xFF);
+ public_key[10] = (byte) ((lastPart >> 16) & 0xFF);
+ public_key[11] = (byte) ((lastPart >> 24) & 0xFF);
Buffer.BlockCopy (publickey, 0, public_key, 12, publickey.Length);
} catch {
Commit: 61f6558eae0fabda211339839419f22562980b02
Author: Marek Habersack <grendel@twistedcode.net>
Date: 01/20/2011 08:37:17
URL: https://github.com/mono/mono/commit/61f6558eae0fabda211339839419f22562980b02
[asp.net] Added the Microsoft.Web.Infrastructure assembly
Changed paths:
M mcs/class/Makefile
Added paths:
A mcs/class/Microsoft.Web.Infrastructure/Assembly/AssemblyInfo.cs
A mcs/class/Microsoft.Web.Infrastructure/Makefile
A mcs/class/Microsoft.Web.Infrastructure/Microsoft.Web.Infrastructure.DynamicModuleHelper/DynamicModuleUtility.cs
A mcs/class/Microsoft.Web.Infrastructure/Microsoft.Web.Infrastructure.DynamicValidationHelper/ValidationUtility.cs
A mcs/class/Microsoft.Web.Infrastructure/Microsoft.Web.Infrastructure.dll.sources
A mcs/class/Microsoft.Web.Infrastructure/Microsoft.Web.Infrastructure/HttpContextHelper.cs
A mcs/class/Microsoft.Web.Infrastructure/Microsoft.Web.Infrastructure/InfrastructureHelper.cs
Modified: mcs/class/Makefile
===================================================================
--- a/mcs/class/Makefile
+++ b/mcs/class/Makefile
@@ -163,7 +163,9 @@ net_4_0_dirs := \
System.ServiceModel.Discovery \
System.Runtime.Caching \
System.Runtime.DurableInstancing \
- Mono.CodeContracts
+ Mono.CodeContracts \
+ Microsoft.Web.Infrastructure
+>>>>>>> c372ab7... [asp.net] Added the Microsoft.Web.Infrastructure assembly
net_2_0_SUBDIRS := $(common_dirs) $(net_2_0_dirs) $(net_2_0_only_dirs)
moonlight_raw_SUBDIRS := $(moonlight_dirs)
Added: mcs/class/Microsoft.Web.Infrastructure/Assembly/AssemblyInfo.cs
===================================================================
--- /dev/null
+++ b/mcs/class/Microsoft.Web.Infrastructure/Assembly/AssemblyInfo.cs
@@ -0,0 +1,55 @@
+???//
+// AssemblyInfo.cs
+//
+// Author:
+// Marek Habersack <grendel@twistedcode.net>
+//
+// Copyright (c) 2011 Novell, Inc (http://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.
+
+using System;
+using System.Diagnostics;
+using System.Reflection;
+using System.Resources;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Versioning;
+using System.Security;
+
+[assembly: AssemblyProduct ("ASP.Net WebPages")]
+[assembly: AssemblyCompany ("Novell, Inc")]
+[assembly: AssemblyCopyright ("?? Novell, Inc. All rights reserved.")]
+[assembly: AssemblyConfiguration ("")]
+[assembly: RuntimeCompatibility (WrapNonExceptionThrows=true)]
+[assembly: AssemblyTrademark ("")]
+[assembly: NeutralResourcesLanguage ("en-US")]
+[assembly: Debuggable (DebuggableAttribute.DebuggingModes.Default | \
DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] +[assembly: \
CLSCompliant (true)] +[assembly: ComVisible (false)]
+[assembly: AssemblyFileVersion ("1.0.20105.407")]
+[assembly: AssemblyVersion ("1.0.0.0")]
+[assembly: TargetFramework (".NETFramework,Version=v4.0", FrameworkDisplayName=".NET \
Framework 4")] +[assembly: AllowPartiallyTrustedCallers]
+[assembly: CompilationRelaxations (8)]
+[assembly: AssemblyTitle ("Microsoft.Web.Infrastructure")]
+[assembly: AssemblyDescription ("")]
+[assembly: AssemblyDelaySign (true)]
+[assembly: AssemblyKeyFile("../winfx.pub")]
+
Added: mcs/class/Microsoft.Web.Infrastructure/Makefile
===================================================================
--- /dev/null
+++ b/mcs/class/Microsoft.Web.Infrastructure/Makefile
@@ -0,0 +1,20 @@
+thisdir = class/Microsoft.Web.Infrastructure
+SUBDIRS =
+include ../../build/rules.make
+
+LIBRARY = Microsoft.Web.Infrastructure.dll
+LIB_MCS_FLAGS = -r:System.dll \
+ -r:System.Web.dll
+
+EXTRA_DISTFILES = $(RESOURCE_FILES)
+
+VALID_PROFILE := $(filter 4.0, $(FRAMEWORK_VERSION))
+ifndef VALID_PROFILE
+LIBRARY_NAME = dummy-Microsoft.Web.Infrastructure.dll
+NO_INSTALL = yes
+NO_SIGN_ASSEMBLY = yes
+NO_TEST = yes
+endif
+
+include ../../build/library.make
+
Added: mcs/class/Microsoft.Web.Infrastructure/Microsoft.Web.Infrastructure.DynamicModuleHelper/DynamicModuleUtility.cs
===================================================================
--- /dev/null
+++ b/mcs/class/Microsoft.Web.Infrastructure/Microsoft.Web.Infrastructure.DynamicModuleHelper/DynamicModuleUtility.cs
@@ -0,0 +1,44 @@
+???//
+// DynamicModuleUtility.cs
+//
+// Author:
+// Marek Habersack <grendel@twistedcode.net>
+//
+// Copyright (c) 2011 Novell, Inc (http://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.
+
+using Microsoft.Web.Infrastructure.DynamicModuleHelper;
+using System;
+using System.ComponentModel;
+using System.Security;
+
+namespace Microsoft.Web.Infrastructure.DynamicModuleHelper
+{
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public static class DynamicModuleUtility
+ {
+ [SecuritySafeCritical]
+ public static void RegisterModule (Type moduleType)
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
+
Added: mcs/class/Microsoft.Web.Infrastructure/Microsoft.Web.Infrastructure.DynamicValidationHelper/ValidationUtility.cs
===================================================================
--- /dev/null
+++ b/mcs/class/Microsoft.Web.Infrastructure/Microsoft.Web.Infrastructure.DynamicValidationHelper/ValidationUtility.cs
@@ -0,0 +1,58 @@
+???//
+// ValidationUtility.cs
+//
+// Author:
+// Marek Habersack <grendel@twistedcode.net>
+//
+// Copyright (c) 2011 Novell, Inc (http://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.
+
+using Microsoft.Web.Infrastructure.DynamicValidationHelper;
+using System;
+using System.ComponentModel;
+using System.Collections.Specialized;
+using System.Security;
+using System.Web;
+
+namespace Microsoft.Web.Infrastructure.DynamicValidationHelper
+{
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public static class ValidationUtility
+ {
+ [SecuritySafeCritical]
+ public static void EnableDynamicValidation (HttpContext context)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [SecuritySafeCritical]
+ public static Nullable <bool> IsValidationEnabled (HttpContext context)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [SecuritySafeCritical]
+ public static void GetUnvalidatedCollections (HttpContext context, out Func \
<NameValueCollection> formGetter, out Func <NameValueCollection> queryStringGetter) \
+ { + throw new NotImplementedException ();
+ }
+ }
+}
+
Added: mcs/class/Microsoft.Web.Infrastructure/Microsoft.Web.Infrastructure.dll.sources
===================================================================
--- /dev/null
+++ b/mcs/class/Microsoft.Web.Infrastructure/Microsoft.Web.Infrastructure.dll.sources
@@ -0,0 +1,10 @@
+../../build/common/Consts.cs
+../../build/common/Locale.cs
+../../build/common/MonoTODOAttribute.cs
+
+./Assembly/AssemblyInfo.cs
+./Microsoft.Web.Infrastructure.DynamicModuleHelper/DynamicModuleUtility.cs
+./Microsoft.Web.Infrastructure.DynamicValidationHelper/ValidationUtility.cs
+./Microsoft.Web.Infrastructure/HttpContextHelper.cs
+./Microsoft.Web.Infrastructure/InfrastructureHelper.cs
+
Added: mcs/class/Microsoft.Web.Infrastructure/Microsoft.Web.Infrastructure/HttpContextHelper.cs
===================================================================
--- /dev/null
+++ b/mcs/class/Microsoft.Web.Infrastructure/Microsoft.Web.Infrastructure/HttpContextHelper.cs
@@ -0,0 +1,45 @@
+???//
+// HttpContextHelper.cs
+//
+// Author:
+// Marek Habersack <grendel@twistedcode.net>
+//
+// Copyright (c) 2011 Novell, Inc (http://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.
+
+using Microsoft.Web.Infrastructure;
+using System;
+using System.ComponentModel;
+using System.Security;
+using System.Web;
+
+namespace Microsoft.Web.Infrastructure
+{
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public static class HttpContextHelper
+ {
+ [SecuritySafeCritical]
+ public static void ExecuteInNullContext (Action action)
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
+
Added: mcs/class/Microsoft.Web.Infrastructure/Microsoft.Web.Infrastructure/InfrastructureHelper.cs
===================================================================
--- /dev/null
+++ b/mcs/class/Microsoft.Web.Infrastructure/Microsoft.Web.Infrastructure/InfrastructureHelper.cs
@@ -0,0 +1,50 @@
+???//
+// InfrastructureHelper.cs
+//
+// Author:
+// Marek Habersack <grendel@twistedcode.net>
+//
+// Copyright (c) 2011 Novell, Inc (http://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.
+
+using Microsoft.Web.Infrastructure;
+using System;
+using System.ComponentModel;
+using System.Security;
+
+namespace Microsoft.Web.Infrastructure
+{
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public static class InfrastructureHelper
+ {
+ [SecuritySafeCritical]
+ public static void UnloadAppDomain ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [SecuritySafeCritical]
+ public static bool IsCodeDomDefinedExtension (string extension)
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
+
Commit: a0c987053df80d923940662ce35614eb38ea431e
Author: Marek Habersack <grendel@twistedcode.net>
Date: 01/20/2011 08:37:33
URL: https://github.com/mono/mono/commit/a0c987053df80d923940662ce35614eb38ea431e
[asp.net] System.Web and Microsoft.Web.Infrastructure are now friends
Changed paths:
M mcs/class/System.Web/Assembly/AssemblyInfo.cs
Modified: mcs/class/System.Web/Assembly/AssemblyInfo.cs
===================================================================
--- a/mcs/class/System.Web/Assembly/AssemblyInfo.cs
+++ b/mcs/class/System.Web/Assembly/AssemblyInfo.cs
@@ -91,6 +91,8 @@ using System.Web.UI;
[assembly: TypeForwardedTo (typeof (System.Web.Security.MembershipUserCollection))]
[assembly: TypeForwardedTo (typeof \
(System.Web.Security.MembershipProviderCollection))] [assembly: TypeForwardedTo \
(typeof (System.Web.Security.MembershipProvider))] +
+[assembly: InternalsVisibleTo ("Microsoft.Web.Infrastructure, \
PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f \
67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5 \
ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]
#endif
[assembly: InternalsVisibleTo ("System.Web.Extensions, \
PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f \
67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5 \
ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]
Commit: bbca7f56601899d58f45a20d08f2d2d5d8b170e8
Author: Marek Habersack <grendel@twistedcode.net>
Date: 01/20/2011 08:37:42
URL: https://github.com/mono/mono/commit/bbca7f56601899d58f45a20d08f2d2d5d8b170e8
[asp.net] Added internal property InputValidationEnabled to report whether the user \
enabled validation for current request.
Changed paths:
M mcs/class/System.Web/System.Web/HttpRequest.cs
Modified: mcs/class/System.Web/System.Web/HttpRequest.cs
===================================================================
--- a/mcs/class/System.Web/System.Web/HttpRequest.cs
+++ b/mcs/class/System.Web/System.Web/HttpRequest.cs
@@ -108,6 +108,7 @@ namespace System.Web
static readonly UrlMappingCollection urlMappings;
readonly static char [] queryTrimChars = {'?'};
#if NET_4_0
+ bool inputValidationEnabled;
RequestContext requestContext;
static bool validateRequestNewMode;
@@ -115,6 +116,10 @@ namespace System.Web
get { return validateRequestNewMode; }
}
+ internal bool InputValidationEnabled {
+ get { return inputValidationEnabled; }
+ }
+
private static char[] RequestPathInvalidCharacters {
get; set;
}
Commit: 14698a4fbf65b45eb956f80c4844deca34117ca2
Author: Marek Habersack <grendel@twistedcode.net>
Date: 01/20/2011 08:37:53
URL: https://github.com/mono/mono/commit/14698a4fbf65b45eb956f80c4844deca34117ca2
[asp.net] Implemented BuildManager.GetObjectFactory
This method is not used by Mono internally but is called by MVC v3.
Changed paths:
M mcs/class/System.Web/System.Web.Compilation/BuildManager.cs
M mcs/class/System.Web/System.Web/HttpApplicationFactory.cs
M mcs/class/System.Web/net_4_0_System.Web.dll.sources
Added paths:
A mcs/class/System.Web/System.Web.Util/SimpleWebObjectFactory.cs
Modified: mcs/class/System.Web/System.Web.Compilation/BuildManager.cs
===================================================================
--- a/mcs/class/System.Web/System.Web.Compilation/BuildManager.cs
+++ b/mcs/class/System.Web/System.Web.Compilation/BuildManager.cs
@@ -117,6 +117,10 @@ namespace System.Web.Compilation
}
#if NET_4_0
+ internal static bool CompilingTopLevelAssemblies {
+ get; set;
+ }
+
internal static bool PreStartMethodsRunning {
get { return preStartMethodsRunning; }
}
@@ -667,10 +671,39 @@ namespace System.Web.Compilation
dynamicallyRegisteredAssemblies.Add (assembly);
}
- [MonoTODO ("A no-op until we use IWebObjectFactory internally. Always returns \
null.")] + [MonoDocumentationNote ("Not used by Mono internally. Needed for MVC3")]
public static IWebObjectFactory GetObjectFactory (string virtualPath, bool \
throwIfNotFound) {
- return null;
+ if (CompilingTopLevelAssemblies)
+ throw new HttpException ("Method must not be called while compiling the top \
level assemblies."); +
+ Type type;
+ if (is_precompiled) {
+ type = GetPrecompiledType (virtualPath);
+ if (type == null) {
+ if (throwIfNotFound)
+ throw new HttpException (String.Format ("Virtual path '{0}' not found in \
precompiled application type cache.", virtualPath)); + else
+ return null;
+ }
+ return new SimpleWebObjectFactory (type);
+ }
+
+ Exception compileException = null;
+ try {
+ type = GetCompiledType (virtualPath);
+ } catch (Exception ex) {
+ compileException = ex;
+ type = null;
+ }
+
+ if (type == null) {
+ if (throwIfNotFound)
+ throw new HttpException (String.Format ("Virtual path '{0}' does not exist.", \
virtualPath), compileException); + return null;
+ }
+
+ return new SimpleWebObjectFactory (type);
}
#endif
public static object CreateInstanceFromVirtualPath (string virtualPath, Type \
requiredBaseType)
Modified: mcs/class/System.Web/System.Web/HttpApplicationFactory.cs
===================================================================
--- a/mcs/class/System.Web/System.Web/HttpApplicationFactory.cs
+++ b/mcs/class/System.Web/System.Web/HttpApplicationFactory.cs
@@ -406,6 +406,7 @@ namespace System.Web
}
#if NET_4_0
BuildManager.CallPreStartMethods ();
+ BuildManager.CompilingTopLevelAssemblies = true;
#endif
#if !TARGET_J2EE
AppResourcesCompiler ac = new AppResourcesCompiler (context);
@@ -447,7 +448,9 @@ namespace System.Web
app_browsers_files = Directory.GetFiles (app_browsers_path, "*.browser");
}
#endif
-
+#if NET_4_0
+ BuildManager.CompilingTopLevelAssemblies = false;
+#endif
app_type = BuildManager.GetPrecompiledApplicationType ();
if (app_type == null && app_file != null) {
#if TARGET_J2EE
Modified: mcs/class/System.Web/net_4_0_System.Web.dll.sources
===================================================================
--- a/mcs/class/System.Web/net_4_0_System.Web.dll.sources
+++ b/mcs/class/System.Web/net_4_0_System.Web.dll.sources
@@ -37,6 +37,7 @@ System.Web.UI.WebControls/RouteParameter.cs
System.Web.UI.WebControls/StyleBlock.cs
System.Web.UI.WebControls/WizardLayoutContainer.cs
System.Web.UI.WebControls/WizardLayoutNavigationContainer.cs
+System.Web.Util/SimpleWebObjectFactory.cs
System.Web.Util/RequestValidationSource.cs
System.Web.Util/RequestValidator.cs
Added: mcs/class/System.Web/System.Web.Util/SimpleWebObjectFactory.cs
===================================================================
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Util/SimpleWebObjectFactory.cs
@@ -0,0 +1,50 @@
+//
+// Authors:
+// Marek Habersack <grendel@twistedcode.net>
+//
+// (C) 2011 Novell, Inc (http://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.
+//
+using System;
+
+namespace System.Web.Util
+{
+ sealed class SimpleWebObjectFactory : IWebObjectFactory
+ {
+ Type type;
+
+ public SimpleWebObjectFactory (Type type)
+ {
+ this.type = type;
+ }
+
+ public object CreateInstance ()
+ {
+ if (type == null)
+ return null;
+
+ return Activator.CreateInstance (type);
+ }
+ }
+}
+
Commit: 5119b6ef0845675c7732cd619071d846c4f1e28a
Author: Marek Habersack <grendel@twistedcode.net>
Date: 01/20/2011 08:38:02
URL: https://github.com/mono/mono/commit/5119b6ef0845675c7732cd619071d846c4f1e28a
[asp.net] Implemented dynamic HTTP module registration
Changed paths:
M mcs/class/Microsoft.Web.Infrastructure/Makefile
M mcs/class/Microsoft.Web.Infrastructure/Microsoft.Web.Infrastructure.DynamicModuleHelper/DynamicModuleUtility.cs
Modified: mcs/class/Microsoft.Web.Infrastructure/Makefile
===================================================================
--- a/mcs/class/Microsoft.Web.Infrastructure/Makefile
+++ b/mcs/class/Microsoft.Web.Infrastructure/Makefile
@@ -4,6 +4,7 @@ include ../../build/rules.make
LIBRARY = Microsoft.Web.Infrastructure.dll
LIB_MCS_FLAGS = -r:System.dll \
+ -r:System.Configuration.dll \
-r:System.Web.dll
EXTRA_DISTFILES = $(RESOURCE_FILES)
Modified: mcs/class/Microsoft.Web.Infrastructure/Microsoft.Web.Infrastructure.DynamicModuleHelper/DynamicModuleUtility.cs
===================================================================
--- a/mcs/class/Microsoft.Web.Infrastructure/Microsoft.Web.Infrastructure.DynamicModuleHelper/DynamicModuleUtility.cs
+++ b/mcs/class/Microsoft.Web.Infrastructure/Microsoft.Web.Infrastructure.DynamicModuleHelper/DynamicModuleUtility.cs
@@ -28,6 +28,8 @@ using Microsoft.Web.Infrastructure.DynamicModuleHelper;
using System;
using System.ComponentModel;
using System.Security;
+using System.Web;
+using System.Web.Configuration;
namespace Microsoft.Web.Infrastructure.DynamicModuleHelper
{
@@ -37,7 +39,12 @@ namespace Microsoft.Web.Infrastructure.DynamicModuleHelper
[SecuritySafeCritical]
public static void RegisterModule (Type moduleType)
{
- throw new NotImplementedException ();
+ if (moduleType == null)
+ return;
+
+ string typeName = moduleType.AssemblyQualifiedName;
+ var cfg = WebConfigurationManager.GetWebApplicationSection \
("system.web/httpModules") as HttpModulesSection; + cfg.Modules.Add (new \
HttpModuleAction ("__Dynamic_Module_" + typeName, typeName)); }
}
}
Commit: 1d180c57e1aa6f0fee137bdbcce30c6d191e8c40
Author: Marek Habersack <grendel@twistedcode.net>
Date: 01/20/2011 08:38:12
URL: https://github.com/mono/mono/commit/1d180c57e1aa6f0fee137bdbcce30c6d191e8c40
[asp.net] Introduced unvalidated versions of Form and QueryString properties for MVC3
Changed paths:
M mcs/class/System.Web/System.Web/HttpRequest.cs
Modified: mcs/class/System.Web/System.Web/HttpRequest.cs
===================================================================
--- a/mcs/class/System.Web/System.Web/HttpRequest.cs
+++ b/mcs/class/System.Web/System.Web/HttpRequest.cs
@@ -691,8 +691,8 @@ namespace System.Web
return String.Compare (ContentType, ct, true, Helpers.InvariantCulture) == 0;
}
-
- public NameValueCollection Form {
+
+ internal NameValueCollection FormUnvalidated {
get {
if (form == null){
form = new WebROCollection ();
@@ -707,6 +707,13 @@ namespace System.Web
form.Protect ();
}
+ return form;
+ }
+ }
+
+ public NameValueCollection Form {
+ get {
+ NameValueCollection form = FormUnvalidated;
#if NET_4_0
if (validateRequestNewMode && !checked_form) {
// Setting this before calling the validator prevents
@@ -1128,7 +1135,7 @@ namespace System.Web
}
}
- public NameValueCollection QueryString {
+ internal NameValueCollection QueryStringUnvalidated {
get {
if (query_string_nvc == null) {
query_string_nvc = new WebROCollection ();
@@ -1142,6 +1149,14 @@ namespace System.Web
query_string_nvc.Protect();
}
+
+ return query_string_nvc;
+ }
+ }
+
+ public NameValueCollection QueryString {
+ get {
+ NameValueCollection query_string_nvc = QueryStringUnvalidated;
#if NET_4_0
if (validateRequestNewMode && !checked_query_string) {
// Setting this before calling the validator prevents
Commit: 66818bb2b68cb1af91f574b3651e54dca4840748
Author: Marek Habersack <grendel@twistedcode.net>
Date: 01/20/2011 08:38:21
URL: https://github.com/mono/mono/commit/66818bb2b68cb1af91f574b3651e54dca4840748
[asp.net] ValidationUtility implementation
Changed paths:
M mcs/class/Microsoft.Web.Infrastructure/Microsoft.Web.Infrastructure.DynamicValidationHelper/ValidationUtility.cs
Modified: mcs/class/Microsoft.Web.Infrastructure/Microsoft.Web.Infrastructure.DynamicValidationHelper/ValidationUtility.cs
===================================================================
--- a/mcs/class/Microsoft.Web.Infrastructure/Microsoft.Web.Infrastructure.DynamicValidationHelper/ValidationUtility.cs
+++ b/mcs/class/Microsoft.Web.Infrastructure/Microsoft.Web.Infrastructure.DynamicValidationHelper/ValidationUtility.cs
@@ -39,19 +39,44 @@ namespace Microsoft.Web.Infrastructure.DynamicValidationHelper
[SecuritySafeCritical]
public static void EnableDynamicValidation (HttpContext context)
{
- throw new NotImplementedException ();
+ // No-op on Mono. We just split form/cookie/query string validation in two
+ // parts and the code in GetUnvalidatedCollections below accesses the first,
+ // unvalidated part.
}
[SecuritySafeCritical]
- public static Nullable <bool> IsValidationEnabled (HttpContext context)
+ public static bool? IsValidationEnabled (HttpContext context)
{
- throw new NotImplementedException ();
+ HttpRequest req = context != null ? context.Request : null;
+ if (req == null)
+ return true;
+
+ return req.InputValidationEnabled;
}
[SecuritySafeCritical]
public static void GetUnvalidatedCollections (HttpContext context, out Func \
<NameValueCollection> formGetter, out Func <NameValueCollection> queryStringGetter) \
{
- throw new NotImplementedException ();
+ if (context == null)
+ throw new ArgumentNullException ("context");
+ formGetter = null;
+ queryStringGetter = null;
+
+ // This is *very* simplified. We should probably create a wrapper class
+ // which would iterate over the collections on demand
+ formGetter = () => {
+ HttpRequest req = context != null ? context.Request : null;
+ if (req == null)
+ return null;
+ return req.FormUnvalidated;
+ };
+
+ queryStringGetter = () => {
+ HttpRequest req = context != null ? context.Request : null;
+ if (req == null)
+ return null;
+ return req.QueryStringUnvalidated;
+ };
}
}
}
Commit: 61aa41abb7d72eb07a1ce98dba703a00cc02ed0a
Author: Marek Habersack <grendel@twistedcode.net>
Date: 01/20/2011 08:38:37
URL: https://github.com/mono/mono/commit/61aa41abb7d72eb07a1ce98dba703a00cc02ed0a
[asp.net] Do not throw NREX when firstError is null in ErrorMessage getter
Changed paths:
M mcs/class/System.Web/System.Web.Compilation/CompilationException.cs
Modified: mcs/class/System.Web/System.Web.Compilation/CompilationException.cs
===================================================================
--- a/mcs/class/System.Web/System.Web.Compilation/CompilationException.cs
+++ b/mcs/class/System.Web/System.Web.Compilation/CompilationException.cs
@@ -124,11 +124,14 @@ namespace System.Web.Compilation
firstError = err;
break;
};
-
- errmsg = firstError.ToString ();
- int idx = errmsg.IndexOf (" : error ");
- if (idx > -1)
- errmsg = errmsg.Substring (idx + 9);
+
+ if (firstError != null) {
+ errmsg = firstError.ToString ();
+ int idx = errmsg.IndexOf (" : error ");
+ if (idx > -1)
+ errmsg = errmsg.Substring (idx + 9);
+ } else
+ errmsg = String.Empty;
}
return errmsg;
Commit: 0a6302739062266fe093fd5910df378252198089
Author: Marek Habersack <grendel@twistedcode.net>
Date: 01/20/2011 08:38:46
URL: https://github.com/mono/mono/commit/0a6302739062266fe093fd5910df378252198089
[asp.net,mvc] Make unobtrustive request validation in MVC v3 possible
Validation is enabled early in the pipeline during request. ValidationUtility makes \
sure that validation is indeed enabled and replaces the default form and query string \
collections with a lazy version which will validate values only when an existing key \
is found and requested.
Changed paths:
M mcs/class/Microsoft.Web.Infrastructure/Microsoft.Web.Infrastructure.DynamicValidationHelper/ValidationUtility.cs
M mcs/class/Microsoft.Web.Infrastructure/Microsoft.Web.Infrastructure.dll.sources
M mcs/class/System.Web/System.Web/HttpRequest.cs
Added paths:
A mcs/class/Microsoft.Web.Infrastructure/Microsoft.Web.Infrastructure.DynamicValidationHelper/LazyWebROCollection.cs
Modified: mcs/class/Microsoft.Web.Infrastructure/Microsoft.Web.Infrastructure.DynamicValidationHelper/ValidationUtility.cs
===================================================================
--- a/mcs/class/Microsoft.Web.Infrastructure/Microsoft.Web.Infrastructure.DynamicValidationHelper/ValidationUtility.cs
+++ b/mcs/class/Microsoft.Web.Infrastructure/Microsoft.Web.Infrastructure.DynamicValidationHelper/ValidationUtility.cs
@@ -24,12 +24,12 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-using Microsoft.Web.Infrastructure.DynamicValidationHelper;
using System;
using System.ComponentModel;
using System.Collections.Specialized;
using System.Security;
using System.Web;
+using System.Web.Util;
namespace Microsoft.Web.Infrastructure.DynamicValidationHelper
{
@@ -39,9 +39,14 @@ namespace Microsoft.Web.Infrastructure.DynamicValidationHelper
[SecuritySafeCritical]
public static void EnableDynamicValidation (HttpContext context)
{
- // No-op on Mono. We just split form/cookie/query string validation in two
- // parts and the code in GetUnvalidatedCollections below accesses the first,
- // unvalidated part.
+ HttpRequest req = context != null ? context.Request : null;
+ if (req == null)
+ return;
+
+ // Just to be safe, make sure it's on
+ req.ValidateInput ();
+ req.SetFormCollection (new LazyWebROCollection (RequestValidationSource.Form, \
req.FormUnvalidated), true); + req.SetQueryStringCollection (new \
LazyWebROCollection (RequestValidationSource.QueryString, \
req.QueryStringUnvalidated), true); }
[SecuritySafeCritical]
@@ -62,8 +67,6 @@ namespace Microsoft.Web.Infrastructure.DynamicValidationHelper
formGetter = null;
queryStringGetter = null;
- // This is *very* simplified. We should probably create a wrapper class
- // which would iterate over the collections on demand
formGetter = () => {
HttpRequest req = context != null ? context.Request : null;
if (req == null)
Modified: mcs/class/Microsoft.Web.Infrastructure/Microsoft.Web.Infrastructure.dll.sources
===================================================================
--- a/mcs/class/Microsoft.Web.Infrastructure/Microsoft.Web.Infrastructure.dll.sources
+++ b/mcs/class/Microsoft.Web.Infrastructure/Microsoft.Web.Infrastructure.dll.sources
@@ -5,5 +5,6 @@
./Assembly/AssemblyInfo.cs
./Microsoft.Web.Infrastructure.DynamicModuleHelper/DynamicModuleUtility.cs
./Microsoft.Web.Infrastructure.DynamicValidationHelper/ValidationUtility.cs
+./Microsoft.Web.Infrastructure.DynamicValidationHelper/LazyWebROCollection.cs
./Microsoft.Web.Infrastructure/HttpContextHelper.cs
./Microsoft.Web.Infrastructure/InfrastructureHelper.cs
Modified: mcs/class/System.Web/System.Web/HttpRequest.cs
===================================================================
--- a/mcs/class/System.Web/System.Web/HttpRequest.cs
+++ b/mcs/class/System.Web/System.Web/HttpRequest.cs
@@ -108,6 +108,8 @@ namespace System.Web
static readonly UrlMappingCollection urlMappings;
readonly static char [] queryTrimChars = {'?'};
#if NET_4_0
+ bool lazyFormValidation;
+ bool lazyQueryStringValidation;
bool inputValidationEnabled;
RequestContext requestContext;
@@ -692,7 +694,7 @@ namespace System.Web
return String.Compare (ContentType, ct, true, Helpers.InvariantCulture) == 0;
}
- internal NameValueCollection FormUnvalidated {
+ internal WebROCollection FormUnvalidated {
get {
if (form == null){
form = new WebROCollection ();
@@ -716,10 +718,12 @@ namespace System.Web
NameValueCollection form = FormUnvalidated;
#if NET_4_0
if (validateRequestNewMode && !checked_form) {
- // Setting this before calling the validator prevents
- // possible endless recursion
- checked_form = true;
- ValidateNameValueCollection ("Form", form, RequestValidationSource.Form);
+ if (!lazyFormValidation) {
+ // Setting this before calling the validator prevents
+ // possible endless recursion
+ checked_form = true;
+ ValidateNameValueCollection ("Form", form, RequestValidationSource.Form);
+ }
} else
#endif
if (validate_form && !checked_form){
@@ -1135,7 +1139,7 @@ namespace System.Web
}
}
- internal NameValueCollection QueryStringUnvalidated {
+ internal WebROCollection QueryStringUnvalidated {
get {
if (query_string_nvc == null) {
query_string_nvc = new WebROCollection ();
@@ -1159,10 +1163,12 @@ namespace System.Web
NameValueCollection query_string_nvc = QueryStringUnvalidated;
#if NET_4_0
if (validateRequestNewMode && !checked_query_string) {
- // Setting this before calling the validator prevents
- // possible endless recursion
- checked_query_string = true;
- ValidateNameValueCollection ("QueryString", query_string_nvc, \
RequestValidationSource.QueryString); + if (!lazyQueryStringValidation) {
+ // Setting this before calling the validator prevents
+ // possible endless recursion
+ checked_query_string = true;
+ ValidateNameValueCollection ("QueryString", query_string_nvc, \
RequestValidationSource.QueryString); + }
} else
#endif
if (validate_query_string && !checked_query_string) {
@@ -1457,6 +1463,9 @@ namespace System.Web
validate_cookies = true;
validate_query_string = true;
validate_form = true;
+#if NET_4_0
+ inputValidationEnabled = true;
+#endif
}
#if NET_4_0
internal void Validate ()
@@ -1482,6 +1491,9 @@ namespace System.Web
);
}
}
+
+ if (validateRequestNewMode)
+ ValidateInput ();
}
#endif
#region internal routines
@@ -1546,7 +1558,23 @@ namespace System.Web
string path = UrlComponents.Path;
UrlComponents.Path = path + PathInfo;
}
+#if NET_4_0
+ internal void SetFormCollection (WebROCollection coll, bool lazyValidation)
+ {
+ if (coll == null)
+ return;
+ form = coll;
+ lazyFormValidation = lazyValidation;
+ }
+ internal void SetQueryStringCollection (WebROCollection coll, bool lazyValidation)
+ {
+ if (coll == null)
+ return;
+ query_string_nvc = coll;
+ lazyQueryStringValidation = lazyValidation;
+ }
+#endif
// Headers is ReadOnly, so we need this hack for cookie-less sessions.
internal void SetHeader (string name, string value)
{
@@ -1687,12 +1715,23 @@ namespace System.Web
throw new HttpRequestValidationException (msg);
}
-
-
+#if NET_4_0
+ internal static void ValidateString (string key, string value, \
RequestValidationSource source) + {
+ if (String.IsNullOrEmpty (value))
+ return;
+#pragma warning disable 219
+ int ignore;
+#pragma warning restore 219
+ if (IsInvalidString (value, out ignore))
+ ThrowValidationException (source.ToString (), key, value);
+ }
+#endif
internal static bool IsInvalidString (string val)
{
+#pragma warning disable 219
int validationFailureIndex;
-
+#pragma warning restore 219
return IsInvalidString (val, out validationFailureIndex);
}
Added: mcs/class/Microsoft.Web.Infrastructure/Microsoft.Web.Infrastructure.DynamicValidationHelper/LazyWebROCollection.cs
===================================================================
--- /dev/null
+++ b/mcs/class/Microsoft.Web.Infrastructure/Microsoft.Web.Infrastructure.DynamicValidationHelper/LazyWebROCollection.cs
@@ -0,0 +1,66 @@
+//
+// Author:
+// Marek Habersack <grendel@twistedcode.net>
+//
+// Copyright (c) 2011 Novell, Inc (http://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.
+
+using System;
+using System.Collections.Specialized;
+using System.Web;
+using System.Web.Util;
+
+namespace Microsoft.Web.Infrastructure.DynamicValidationHelper
+{
+ sealed class LazyWebROCollection : WebROCollection
+ {
+ WebROCollection wrapped;
+ RequestValidationSource validationSource;
+
+ public LazyWebROCollection (RequestValidationSource validationSource, \
WebROCollection wrapped) + {
+ if (wrapped == null)
+ throw new ArgumentNullException ("wrapped");
+
+ this.validationSource = validationSource;
+ this.wrapped = wrapped;
+ }
+
+ public override string Get (string name)
+ {
+ return Validate (name, wrapped.Get (name));
+ }
+
+ public override string Get (int index)
+ {
+ return Validate (wrapped.GetKey (index), wrapped.Get (index));
+ }
+
+ string Validate (string key, string value)
+ {
+ if (String.IsNullOrEmpty (value))
+ return value;
+
+ HttpRequest.ValidateString (key, value, validationSource);
+ return value;
+ }
+ }
+}
+
Commit: 730898592e2c7e4c4b2b8ff129a76fc9172b6c98
Author: Jb Evain <jbevain@gmail.com>
Date: 01/20/2011 10:45:43
URL: https://github.com/mono/mono/commit/730898592e2c7e4c4b2b8ff129a76fc9172b6c98
[bug] Prevent a GetMethodBody call on a dynamic method. Fixes 665788
Changed paths:
M mono/metadata/reflection.c
Modified: mono/metadata/reflection.c
===================================================================
--- a/mono/metadata/reflection.c
+++ b/mono/metadata/reflection.c
@@ -6861,6 +6861,10 @@ mono_method_body_get_object (MonoDomain *domain, MonoMethod \
*method) unsigned char format, flags;
int i;
+ /* for compatibility with .net */
+ if (method->dynamic)
+ mono_raise_exception (mono_get_exception_invalid_operation (NULL));
+
if (!System_Reflection_MethodBody)
System_Reflection_MethodBody = mono_class_from_name (mono_defaults.corlib, \
"System.Reflection", "MethodBody"); if (!System_Reflection_LocalVariableInfo)
Commit: 42afbbaaa48a4a1ed37c8694753a1759a03a5252
Author: Andrew Jorgensen <ajorgensen@novell.com>
Date: 01/20/2011 13:24:24
URL: https://github.com/mono/mono/commit/42afbbaaa48a4a1ed37c8694753a1759a03a5252
remove conflict marker
Changed paths:
M mcs/class/Makefile
Modified: mcs/class/Makefile
===================================================================
--- a/mcs/class/Makefile
+++ b/mcs/class/Makefile
@@ -165,7 +165,6 @@ net_4_0_dirs := \
System.Runtime.DurableInstancing \
Mono.CodeContracts \
Microsoft.Web.Infrastructure
->>>>>>> c372ab7... [asp.net] Added the Microsoft.Web.Infrastructure assembly
net_2_0_SUBDIRS := $(common_dirs) $(net_2_0_dirs) $(net_2_0_only_dirs)
moonlight_raw_SUBDIRS := $(moonlight_dirs)
Commit: c618dfe5198b7e8a3ad8b8d3da8d772384e7329f
Author: Miguel de Icaza <miguel@gnome.org>
Date: 01/20/2011 16:52:49
URL: https://github.com/mono/mono/commit/c618dfe5198b7e8a3ad8b8d3da8d772384e7329f
[sockets] Implement DuplicateAndClose and Socket (SocketInformation) constructor for \
in-process socket passing (AppDomains)
Changed paths:
M mcs/class/System/System.Net.Sockets/Socket.cs
M mcs/class/System/System.dll.sources
Modified: mcs/class/System/System.Net.Sockets/Socket.cs
===================================================================
--- a/mcs/class/System/System.Net.Sockets/Socket.cs
+++ b/mcs/class/System/System.Net.Sockets/Socket.cs
@@ -180,28 +180,22 @@ namespace System.Net.Sockets
}
}
-
- [MonoTODO]
public Socket (SocketInformation socketInformation)
{
- throw new NotImplementedException ("SocketInformation not figured out yet");
+ var options = socketInformation.Options;
+ islistening = (options & SocketInformationOptions.Listening) != 0;
+ connected = (options & SocketInformationOptions.Connected) != 0;
+ blocking = (options & SocketInformationOptions.NonBlocking) == 0;
+ useoverlappedIO = (options & SocketInformationOptions.UseOnlyOverlappedIO) != 0;
- // ifdef to avoid the warnings.
-#if false
- //address_family = socketInformation.address_family;
- //socket_type = socketInformation.socket_type;
- //protocol_type = socketInformation.protocol_type;
- address_family = AddressFamily.InterNetwork;
- socket_type = SocketType.Stream;
- protocol_type = ProtocolType.IP;
+ var result = Mono.DataConverter.Unpack ("iiiil", \
socketInformation.ProtocolInformation, 0);
- int error;
- socket = Socket_internal (address_family, socket_type, protocol_type, out error);
- if (error != 0)
- throw new SocketException (error);
-
+ address_family = (AddressFamily) (int) result [0];
+ socket_type = (SocketType) (int) result [1];
+ protocol_type = (ProtocolType) (int) result [2];
+ isbound = (ProtocolType) (int) result [3] != 0;
+ socket = (IntPtr) (long) result [4];
SocketDefaults ();
-#endif
}
#if !TARGET_JVM
@@ -1320,15 +1314,20 @@ namespace System.Net.Sockets
}
}
- [MonoTODO ("Not implemented")]
+ [MonoLimitation ("We do not support passing sockets across processes, we merely \
allow this API to pass the socket across AppDomains")] public SocketInformation \
DuplicateAndClose (int targetProcessId) {
- /* Need to serialize this socket into a
- * SocketInformation struct, but must study
- * the MS implementation harder to figure out
- * behaviour as documentation is lacking
- */
- throw new NotImplementedException ();
+ var si = new SocketInformation ();
+ si.Options =
+ (islistening ? SocketInformationOptions.Listening : 0) |
+ (connected ? SocketInformationOptions.Connected : 0) |
+ (blocking ? 0 : SocketInformationOptions.NonBlocking) |
+ (useoverlappedIO ? SocketInformationOptions.UseOnlyOverlappedIO : 0);
+
+ si.ProtocolInformation = Mono.DataConverter.Pack ("iiiil", (int)address_family, \
(int)socket_type, (int)protocol_type, isbound ? 1 : 0, (long)socket); + socket = \
(IntPtr) (-1); +
+ return si;
}
public Socket EndAccept (IAsyncResult result)
Modified: mcs/class/System/System.dll.sources
===================================================================
--- a/mcs/class/System/System.dll.sources
+++ b/mcs/class/System/System.dll.sources
@@ -1047,4 +1047,4 @@ System.Collections.Concurrent/ConcurrentBag.cs
../corlib/System.Collections/CollectionDebuggerView.cs
../corlib/System.Collections.Generic/CollectionDebuggerView.cs
-
+../corlib/Mono/DataConverter.cs
Commit: 43937146ace62c4e46ff2c564eee92aa83b0d522
Author: Marek Habersack <grendel@twistedcode.net>
Date: 01/20/2011 17:39:12
URL: https://github.com/mono/mono/commit/43937146ace62c4e46ff2c564eee92aa83b0d522
[asp.net] Don't throw NREX when a cache item to be removed is null
Changed paths:
M mcs/class/System.Web/System.Web.Caching/Cache.cs
Modified: mcs/class/System.Web/System.Web.Caching/Cache.cs
===================================================================
--- a/mcs/class/System.Web/System.Web.Caching/Cache.cs
+++ b/mcs/class/System.Web/System.Web.Caching/Cache.cs
@@ -147,6 +147,9 @@ namespace System.Web.Caching
return null;
CacheItem ret = cache [key];
+ if (ret == null)
+ return null;
+
if (timedItems != null)
timedItems.OnItemDisable (ret);
Commit: f1c1e02c38dcf6d52822118c09fb0655f2ac7bfa
Author: Zoltan Varga <vargaz@gmail.com>
Date: 01/20/2011 19:50:35
URL: https://github.com/mono/mono/commit/f1c1e02c38dcf6d52822118c09fb0655f2ac7bfa
Detect inifinite generic recursion differently in the AOT compiler.
Changed paths:
M mono/mini/aot-compiler.c
Modified: mono/mini/aot-compiler.c
===================================================================
--- a/mono/mini/aot-compiler.c
+++ b/mono/mini/aot-compiler.c
@@ -2807,6 +2807,34 @@ add_generic_class (MonoAotCompile *acfg, MonoClass *klass, \
gboolean force) add_generic_class_with_depth (acfg, klass, 0);
}
+static gboolean
+check_type_depth (MonoType *t, int depth)
+{
+ int i;
+
+ if (depth > 8)
+ return TRUE;
+
+ switch (t->type) {
+ case MONO_TYPE_GENERICINST: {
+ MonoGenericClass *gklass = t->data.generic_class;
+ MonoGenericInst *ginst = gklass->context.class_inst;
+
+ if (ginst) {
+ for (i = 0; i < ginst->type_argc; ++i) {
+ if (check_type_depth (ginst->type_argv [i], depth + 1))
+ return TRUE;
+ }
+ }
+ break;
+ }
+ default:
+ break;
+ }
+
+ return FALSE;
+}
+
/*
* add_generic_class:
*
@@ -2832,6 +2860,9 @@ add_generic_class_with_depth (MonoAotCompile *acfg, MonoClass \
*klass, int depth) if (!klass->generic_class && !klass->rank)
return;
+ if (check_type_depth (&klass->byval_arg, 0))
+ return;
+
iter = NULL;
while ((method = mono_class_get_methods (klass, &iter))) {
if (mono_method_is_generic_sharable_impl_full (method, FALSE, FALSE))
Commit: 3a1ae308b8fe8648392fd06dd48f65f38d5b14a4
Author: Zoltan Varga <vargaz@gmail.com>
Date: 01/20/2011 19:52:51
URL: https://github.com/mono/mono/commit/3a1ae308b8fe8648392fd06dd48f65f38d5b14a4
Avoid emitting .note.GNU-stack on arm.
Changed paths:
M mono/mini/aot-compiler.c
Modified: mono/mini/aot-compiler.c
===================================================================
--- a/mono/mini/aot-compiler.c
+++ b/mono/mini/aot-compiler.c
@@ -526,7 +526,7 @@ arch_init (MonoAotCompile *acfg)
acfg->need_no_dead_strip = TRUE;
#endif
-#if defined(__linux__)
+#if defined(__linux__) && !defined(TARGET_ARM)
acfg->need_pt_gnu_stack = TRUE;
#endif
}
Commit: e235e72884546c2b750a4589a17327a289e9762f
Author: Zoltan Varga <vargaz@gmail.com>
Date: 01/20/2011 20:06:47
URL: https://github.com/mono/mono/commit/e235e72884546c2b750a4589a17327a289e9762f
Only add imt items whose is_equal flag is set to the array passed to the full-aot imt \
thunk.
Changed paths:
M mono/mini/aot-runtime.c
Modified: mono/mini/aot-runtime.c
===================================================================
--- a/mono/mini/aot-runtime.c
+++ b/mono/mini/aot-runtime.c
@@ -3552,25 +3552,38 @@ mono_aot_get_imt_thunk (MonoVTable *vtable, MonoDomain \
*domain, MonoIMTCheckItem guint32 got_offset;
gpointer code;
gpointer *buf;
- int i;
+ int i, index, real_count;
MonoAotModule *amodule;
code = get_numerous_trampoline (MONO_AOT_TRAMP_IMT_THUNK, 1, &amodule, &got_offset, \
NULL);
+ real_count = 0;
+ for (i = 0; i < count; ++i) {
+ MonoIMTCheckItem *item = imt_entries [i];
+
+ if (item->is_equals)
+ real_count ++;
+ }
+
/* Save the entries into an array */
- buf = mono_domain_alloc (domain, (count + 1) * 2 * sizeof (gpointer));
+ buf = mono_domain_alloc (domain, (real_count + 1) * 2 * sizeof (gpointer));
+ index = 0;
for (i = 0; i < count; ++i) {
MonoIMTCheckItem *item = imt_entries [i];
+ if (!item->is_equals)
+ continue;
+
g_assert (item->key);
/* FIXME: */
g_assert (!item->has_target_code);
- buf [(i * 2)] = item->key;
- buf [(i * 2) + 1] = &(vtable->vtable [item->value.vtable_slot]);
+ buf [(index * 2)] = item->key;
+ buf [(index * 2) + 1] = &(vtable->vtable [item->value.vtable_slot]);
+ index ++;
}
- buf [(count * 2)] = NULL;
- buf [(count * 2) + 1] = fail_tramp;
+ buf [(index * 2)] = NULL;
+ buf [(index * 2) + 1] = fail_tramp;
amodule->got [got_offset] = buf;
Commit: 48f3edb3cd4dc34cda1cbc6fd60b0227ad4bcd0f
Author: Zoltan Varga <vargaz@gmail.com>
Date: 01/20/2011 20:07:57
URL: https://github.com/mono/mono/commit/48f3edb3cd4dc34cda1cbc6fd60b0227ad4bcd0f
Add a test for infinite generic recursion + AOT.
Changed paths:
M mono/mini/generics.cs
Modified: mono/mini/generics.cs
===================================================================
--- a/mono/mini/generics.cs
+++ b/mono/mini/generics.cs
@@ -610,6 +610,20 @@ class Tests {
return 0;
}
+
+ struct RecStruct<T> {
+ public void foo (RecStruct<RecStruct<T>> baz) {
+ }
+ }
+
+ public static int test_0_infinite_generic_recursion () {
+ // Check that the AOT compile can deal with infinite generic recursion through
+ // parameter types
+ RecStruct<int> bla;
+
+ return 0;
+ }
+
public static int test_0_partial_sharing () {
if (PartialShared1 (new List<string> (), 1) != typeof (string))
return 1;
Commit: 788535030b0372c375ccf38c091c2b473154dbaa
Author: Gonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Date: 01/20/2011 21:59:47
URL: https://github.com/mono/mono/commit/788535030b0372c375ccf38c091c2b473154dbaa
[System.Web] Razor works now (modulo DB)
Changed paths:
M mcs/class/System.Web/System.Web.Compilation/AppCodeCompiler.cs
M mcs/class/System.Web/System.Web.Compilation/BuildManager.cs
M mcs/class/System.Web/System.Web.Security/Roles.cs
Modified: mcs/class/System.Web/System.Web.Compilation/AppCodeCompiler.cs
===================================================================
--- a/mcs/class/System.Web/System.Web.Compilation/AppCodeCompiler.cs
+++ b/mcs/class/System.Web/System.Web.Compilation/AppCodeCompiler.cs
@@ -273,7 +273,7 @@ namespace System.Web.Compilation
VirtualPath PhysicalToVirtual (string file)
{
- return new VirtualPath (file.Replace (HttpRuntime.AppDomainAppPath, "/").Replace \
(Path.DirectorySeparatorChar, '/')); + return new VirtualPath (file.Replace \
(HttpRuntime.AppDomainAppPath, "~/").Replace (Path.DirectorySeparatorChar, '/')); }
BuildProvider GetBuildProviderFor (string file, BuildProviderCollection \
buildProviders)
Modified: mcs/class/System.Web/System.Web.Compilation/BuildManager.cs
===================================================================
--- a/mcs/class/System.Web/System.Web.Compilation/BuildManager.cs
+++ b/mcs/class/System.Web/System.Web.Compilation/BuildManager.cs
@@ -628,8 +628,8 @@ namespace System.Web.Compilation
public static Type GetGlobalAsaxType ()
{
Type ret = HttpApplicationFactory.AppType;
- if (!preStartMethodsRunning)
- throw new InvalidOperationException ("This method cannot be called during the \
application's pre-start initialization stage."); + if (ret == null)
+ return typeof (HttpApplication);
return ret;
}
Modified: mcs/class/System.Web/System.Web.Security/Roles.cs
===================================================================
--- a/mcs/class/System.Web/System.Web.Security/Roles.cs
+++ b/mcs/class/System.Web/System.Web.Security/Roles.cs
@@ -236,6 +236,7 @@ namespace System.Web.Security {
public static bool Enabled {
get { return config.Enabled; }
+ set { config.Enabled = value; }
}
public static int MaxCachedResults {
Commit: 5920237751ec542181ef212e28d2600ad49d7f21
Author: Atsushi Eno <atsushi@ximian.com>
Date: 01/20/2011 22:13:52
URL: https://github.com/mono/mono/commit/5920237751ec542181ef212e28d2600ad49d7f21
backport JavaScriptObjectDeserializer encoding detection fix.
Changed paths:
M mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JavaScriptObjectDeserializer.cs
Modified: mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JavaScriptObjectDeserializer.cs
===================================================================
--- a/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JavaScriptObjectDeserializer.cs
+++ b/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JavaScriptObjectDeserializer.cs
@@ -15,14 +15,19 @@ namespace System.Runtime.Serialization.Json
public class BufferedStreamReader : StreamReader
{
public BufferedStreamReader (Stream stream)
- : base (stream, JavaScriptObjectDeserializer.DetectEncoding (stream.ReadByte (), \
stream.ReadByte ())) + : base (new BufferedStream (stream))
+ {
+ }
+
+ BufferedStreamReader (BufferedStream stream)
+ : base (stream, JavaScriptObjectDeserializer.DetectEncoding (stream.first, \
stream.second)) {
}
}
class BufferedStream : Stream
{
- int first, second;
+ internal int first, second;
long pos;
Stream source;
@@ -39,15 +44,23 @@ namespace System.Runtime.Serialization.Json
throw new ArgumentNullException ("buffer");
if (index < 0 || index >= buffer.Length)
throw new ArgumentOutOfRangeException ("index");
- if (count < 0 || index + count >= buffer.Length)
+ if (count < 0 || index + count > buffer.Length)
throw new ArgumentOutOfRangeException ("count");
if (count == 0)
return 0;
- if (pos < 2) {
- buffer [pos] = pos == 0 ? (byte) first : (byte) second;
+ int iniCount = count;
+ if (pos == 0) {
+ buffer [index++] = (byte) first;
+ pos++;
+ if (--count == 0)
+ return iniCount;
+ }
+ if (pos == 1) {
+ buffer [index++] = (byte) second;
pos++;
- return Read (buffer, index + 1, count - 1) + 1;
+ if (--count == 0)
+ return iniCount;
}
return source.Read (buffer, index, count);
}
@@ -128,16 +141,24 @@ namespace System.Runtime.Serialization.Json
public static Encoding DetectEncoding (int byte1, int byte2)
{
- if (byte1 == 0) {
+ switch (byte1) {
+ case 0:
if (byte2 == 0)
throw new XmlException ("UTF-32BE is detected, which is not supported");
else
+ return Encoding.UTF8;
+ case 0xFE:
+ if (byte2 == 0xFF)
return Encoding.BigEndianUnicode;
- } else {
- if (byte2 == 0) // could be UTF-32LE, but there is no way to detect that only \
within two bytes. + else
+ return Encoding.UTF8;
+ case 0xFF:
+ if (byte2 == 0xFE) // could be UTF-32LE, but there is no way to detect that only \
within two bytes. return Encoding.Unicode;
else
return Encoding.UTF8;
+ default:
+ return Encoding.UTF8;
}
}
}
Commit: 962fedd1e6a826c3ca31aedd46ff56d84e9c8dad
Author: Miguel de Icaza <miguel@gnome.org>
Date: 01/20/2011 22:50:08
URL: https://github.com/mono/mono/commit/962fedd1e6a826c3ca31aedd46ff56d84e9c8dad
Do not build the Socket passing on Mobile systems
Changed paths:
M mcs/class/System/System.Net.Sockets/Socket.cs
Modified: mcs/class/System/System.Net.Sockets/Socket.cs
===================================================================
--- a/mcs/class/System/System.Net.Sockets/Socket.cs
+++ b/mcs/class/System/System.Net.Sockets/Socket.cs
@@ -180,6 +180,7 @@ namespace System.Net.Sockets
}
}
+#if !MOBILE
public Socket (SocketInformation socketInformation)
{
var options = socketInformation.Options;
@@ -197,7 +198,8 @@ namespace System.Net.Sockets
socket = (IntPtr) (long) result [4];
SocketDefaults ();
}
-
+#endif
+
#if !TARGET_JVM
// Returns the amount of data waiting to be read on socket
[MethodImplAttribute(MethodImplOptions.InternalCall)]
@@ -1314,6 +1316,7 @@ namespace System.Net.Sockets
}
}
+#if !MOBILE
[MonoLimitation ("We do not support passing sockets across processes, we merely \
allow this API to pass the socket across AppDomains")] public SocketInformation \
DuplicateAndClose (int targetProcessId) {
@@ -1329,7 +1332,8 @@ namespace System.Net.Sockets
return si;
}
-
+#endif
+
public Socket EndAccept (IAsyncResult result)
{
int bytes;
Commit: a1681e5ee33c9f8224990d8687389fde254fabf3
Author: Zoltan Varga <vargaz@gmail.com>
Date: 01/20/2011 23:58:29
URL: https://github.com/mono/mono/commit/a1681e5ee33c9f8224990d8687389fde254fabf3
Fix the previous aot fix.
Changed paths:
M mono/mini/aot-compiler.c
Modified: mono/mini/aot-compiler.c
===================================================================
--- a/mono/mini/aot-compiler.c
+++ b/mono/mini/aot-compiler.c
@@ -2846,9 +2846,6 @@ add_generic_class_with_depth (MonoAotCompile *acfg, MonoClass \
*klass, int depth) MonoMethod *method;
gpointer iter;
- if (depth > 8)
- return;
-
mono_class_init (klass);
if (klass->generic_class && klass->generic_class->context.class_inst->is_open)
Commit: ec98a692a1b227bb3bb1ca7111d836e36c7a18ae
Author: Zoltan Varga <vargaz@gmail.com>
Date: 01/21/2011 01:27:30
URL: https://github.com/mono/mono/commit/ec98a692a1b227bb3bb1ca7111d836e36c7a18ae
Add NET 4.0 Assembly.UnsafeLoadFrom () method.
Changed paths:
M mcs/class/corlib/System.Reflection/Assembly.cs
Modified: mcs/class/corlib/System.Reflection/Assembly.cs
===================================================================
--- a/mcs/class/corlib/System.Reflection/Assembly.cs
+++ b/mcs/class/corlib/System.Reflection/Assembly.cs
@@ -506,6 +506,13 @@ namespace System.Reflection {
#endif
#if NET_4_0
+ public static Assembly UnsafeLoadFrom (String assemblyFile)
+ {
+ return LoadFrom (assemblyFile);
+ }
+#endif
+
+#if NET_4_0
[Obsolete]
#endif
public static Assembly LoadFile (String path, Evidence securityEvidence)
Commit: ef3bdc76c2a855eda0fbce89b273b0294d5de251
Author: Sebastien Pouliot <sebastien@ximian.com>
Date: 01/21/2011 08:39:32
URL: https://github.com/mono/mono/commit/ef3bdc76c2a855eda0fbce89b273b0294d5de251
Allow RSACryptoServiceProvider.SignHash to work with SHA-2 family
* System.Security.Cryptography/CryptoConfig.cs: Add OID for RIPEMD160
* System.Security.Cryptography/RSACryptoServiceProvider.cs: Update
GetHashNameFromOID to include SHA2-family OIDs. Remove historical
comments about 1.x FX behavior.
* Test/System.Security.Cryptography/CryptoConfigTest.cs: Add test cases
wrt RIPEMD160 OID
* Test/System.Security.Cryptography/RSACryptoServiceProviderTest.cs: Add
test case for SignHash with all FX-provided hash implementations (all
working except RIPEMD160). Remove some NET_2_0/NET_1_1 defines.
* Test/System.Security.Cryptography/RSAPKCS1SignatureFormatterTest.cs:
Remove hacks that were needed for running the tests under FX 1.x. Remove
some NET_2_0/NET_1_1 defines.
Changed paths:
M mcs/class/corlib/System.Security.Cryptography/CryptoConfig.cs
M mcs/class/corlib/System.Security.Cryptography/RSACryptoServiceProvider.cs
M mcs/class/corlib/Test/System.Security.Cryptography/CryptoConfigTest.cs
M mcs/class/corlib/Test/System.Security.Cryptography/RSACryptoServiceProviderTest.cs
M mcs/class/corlib/Test/System.Security.Cryptography/RSAPKCS1SignatureFormatterTest.cs
Modified: mcs/class/corlib/System.Security.Cryptography/CryptoConfig.cs
===================================================================
--- a/mcs/class/corlib/System.Security.Cryptography/CryptoConfig.cs
+++ b/mcs/class/corlib/System.Security.Cryptography/CryptoConfig.cs
@@ -7,7 +7,7 @@
//
// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
// Copyright (C) Tim Coleman, 2004
-// Copyright (C) 2004-2007 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2004-2007,2011 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
@@ -104,6 +104,7 @@ public partial class CryptoConfig {
private const string oidSHA256 = "2.16.840.1.101.3.4.2.1";
private const string oidSHA384 = "2.16.840.1.101.3.4.2.2";
private const string oidSHA512 = "2.16.840.1.101.3.4.2.3";
+ private const string oidRIPEMD160 = "1.3.36.3.2.1";
// new in 2.0
// private const string oidRSA = "1.2.840.113549.1.1.1";
// private const string oidDSA = "1.2.840.10040.4.1";
@@ -354,6 +355,10 @@ public partial class CryptoConfig {
oid.Add (nameSHA512a, oidSHA512);
oid.Add (nameSHA512c, oidSHA512);
+ oid.Add (defaultRIPEMD160, oidRIPEMD160);
+ oid.Add (nameRIPEMD160a, oidRIPEMD160);
+ oid.Add (nameRIPEMD160c, oidRIPEMD160);
+
// surprise! documented in ".NET Framework Security" book
oid.Add (name3DESKeyWrap, oid3DESKeyWrap);
Modified: mcs/class/corlib/System.Security.Cryptography/RSACryptoServiceProvider.cs
===================================================================
--- a/mcs/class/corlib/System.Security.Cryptography/RSACryptoServiceProvider.cs
+++ b/mcs/class/corlib/System.Security.Cryptography/RSACryptoServiceProvider.cs
@@ -278,19 +278,21 @@ namespace System.Security.Cryptography {
private string GetHashNameFromOID (string oid)
{
switch (oid) {
- case "1.3.14.3.2.26":
- return "SHA1";
- case "1.2.840.113549.2.5":
- return "MD5";
- default:
- throw new NotSupportedException (oid + " is an unsupported hash algorithm for \
RSA signing"); + case "1.3.14.3.2.26":
+ return "SHA1";
+ case "1.2.840.113549.2.5":
+ return "MD5";
+ case "2.16.840.1.101.3.4.2.1":
+ return "SHA256";
+ case "2.16.840.1.101.3.4.2.2":
+ return "SHA384";
+ case "2.16.840.1.101.3.4.2.3":
+ return "SHA512";
+ default:
+ throw new CryptographicException (oid + " is an unsupported hash algorithm for \
RSA signing"); }
}
- // LAMESPEC: str is not the hash name but an OID
- // NOTE: this method is LIMITED to SHA1 and MD5 like the MS framework 1.0
- // and 1.1 because there's no method to get a hash algorithm from an OID.
- // However there's no such limit when using the [De]Formatter class.
public byte[] SignHash (byte[] rgbHash, string str)
{
if (rgbHash == null)
@@ -315,10 +317,6 @@ namespace System.Security.Cryptography {
return PKCS1.Verify_v15 (this, hash, toBeVerified, signature);
}
- // LAMESPEC: str is not the hash name but an OID
- // NOTE: this method is LIMITED to SHA1 and MD5 like the MS framework 1.0
- // and 1.1 because there's no method to get a hash algorithm from an OID.
- // However there's no such limit when using the [De]Formatter class.
public bool VerifyHash (byte[] rgbHash, string str, byte[] rgbSignature)
{
if (rgbHash == null)
Modified: mcs/class/corlib/Test/System.Security.Cryptography/CryptoConfigTest.cs
===================================================================
--- a/mcs/class/corlib/Test/System.Security.Cryptography/CryptoConfigTest.cs
+++ b/mcs/class/corlib/Test/System.Security.Cryptography/CryptoConfigTest.cs
@@ -5,7 +5,7 @@
// Sebastien Pouliot <sebastien@ximian.com>
//
// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-// Copyright (C) 2004-2007 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2004-2007,2011 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
@@ -337,6 +337,9 @@ public class CryptoConfigTest {
MapNameToOID ("SHA512", "2.16.840.1.101.3.4.2.3");
MapNameToOID ("System.Security.Cryptography.SHA512", "2.16.840.1.101.3.4.2.3");
MapNameToOID ("System.Security.Cryptography.SHA512Managed", \
"2.16.840.1.101.3.4.2.3"); + MapNameToOID ("RIPEMD160", "1.3.36.3.2.1");
+ MapNameToOID ("System.Security.Cryptography.RIPEMD160", "1.3.36.3.2.1");
+ MapNameToOID ("System.Security.Cryptography.RIPEMD160Managed", "1.3.36.3.2.1");
#else
MapNameToOID ("SHA256", "2.16.840.1.101.3.4.1");
// MapNameToOID ("SHA-256", "2.16.840.1.101.3.4.1");
Modified: mcs/class/corlib/Test/System.Security.Cryptography/RSACryptoServiceProviderTest.cs
===================================================================
--- a/mcs/class/corlib/Test/System.Security.Cryptography/RSACryptoServiceProviderTest.cs
+++ b/mcs/class/corlib/Test/System.Security.Cryptography/RSACryptoServiceProviderTest.cs
@@ -5,7 +5,7 @@
// Sebastien Pouliot <sebastien@ximian.com>
//
// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-// Copyright (C) 2004,2006 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2004,2006,2011 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
@@ -51,9 +51,6 @@ public class RSACryptoServiceProviderTest : Assertion {
sha1OID = CryptoConfig.MapNameToOID ("SHA1");
disposed = new RSACryptoServiceProvider (minKeySize);
disposed.FromXmlString \
("<RSAKeyValue><Modulus>vtXAf62+o50prNCTiVGTMzdhm4sMjK0QVDkKQLFGu2fJQCULt9NZBab14PiWfG \
1t</Modulus><Exponent>AQAB</Exponent><P>5y2AHOzIhTChIFzLsgZQAGfy3U8OPwFh</P><Q>01NUVJJ \
v+hhIsnbFiSi24FLRrfr/qYuN</Q><DP>HKLAOdUCyazKaK3V9Yleo448wTkntJpB</DP><DQ>AH5MTxo8arAN \
02TVlzliG+n1lVtlp2at</DQ><InverseQ>ZpgJwTxSYpT81sQCuVUvX0AYrvSziNIw</InverseQ><D>CStiJYBmsZvincAj5qw5w3M8yGmE/9ls4yv7wenozzC4kZshpI2MuON0d2Z8f4aB</D></RSAKeyValue>");
- // FX 2.0 beta 1 bug - we must use the key before clearing it
- // http://lab.msdn.microsoft.com/ProductFeedback/viewfeedback.aspx?feedbackid=1bc807eb-c4ca-4c2d-8499-9f0470b71a29
- int ks = disposed.KeySize;
disposed.Clear ();
}
@@ -213,11 +210,7 @@ public class RSACryptoServiceProviderTest : Assertion {
[Test]
// LAMESPEC/BUG: Disposed object can still be used (but original keypair seems \
lost)
-#if NET_1_1
[ExpectedException (typeof (ObjectDisposedException))] // in MS.NET v.1.1
-#else
- [ExpectedException (typeof (CryptographicException))] // in MS.NET v.1.0
-#endif
public void DecryptDisposed ()
{
byte[] encdata = { 0x4C, 0xBF, 0xFD, 0xD9, 0xAD, 0xDB, 0x65, 0x15, 0xB3, 0xE8, \
0xE6, 0xD3, 0x22, 0x99, 0x69, 0x56, 0xD3, 0x1F, 0x1D, 0x2A, 0x66, 0x07, 0x00, 0xBB, \
0x77, 0x47, 0xB6, 0x6F, 0x8E, 0x3A, 0xBA, 0x37, 0xA3, 0x0F, 0x0A, 0xC8, 0x8D, 0x1F, \
0x8D, 0xAB, 0xAC, 0xFD, 0x82, 0x6F, 0x7F, 0x88, 0x3B, 0xA1, 0x0F, 0x9B, 0x4B, 0x8A, \
0x27, 0x3B, 0xEC, 0xFF, 0x69, 0x20, 0x57, 0x64, 0xE1, 0xD8, 0x9E, 0x96, 0x7A, 0x53, \
0x6A, 0x80, 0x63, 0xB0, 0xEE, 0x84, 0xA7, 0x67, 0x38, 0xA5, 0x30, 0x06, 0xA8, 0xBB, \
0x16, 0x77, 0x49, 0x67, 0x0F, 0x90, 0x67, 0xD5, 0xC5, 0x12, 0x92, 0x5A, 0xDA, 0xC3, \
0xFD, 0xC4, 0x8A, 0x89, 0x77, 0x79, 0x11, 0xEC, 0x95, 0xF6, 0x6A, 0x3B, 0xAD, 0xA8, \
0xDF, 0xA1, 0xB0, 0x51, 0x34, 0xE8, 0xC1, 0x05, 0xB9, 0x09, 0x23, 0x33, 0x2A, 0x3E, \
0xE7, 0x6A, 0x77, 0x6F, 0xBD, 0x21 }; @@ -252,11 +245,7 @@ public class \
RSACryptoServiceProviderTest : Assertion { }
[Test]
-#if NET_1_1
[ExpectedException (typeof (ArgumentNullException))]
-#else
- [ExpectedException (typeof (NullReferenceException))]
-#endif
public void SignDataByteArrayNull ()
{
rsa = new RSACryptoServiceProvider (minKeySize);
@@ -282,7 +271,6 @@ public class RSACryptoServiceProviderTest : Assertion {
rsa.SignHash (null, "1.3.14.3.2.26"); // SHA-1
}
-#if NET_2_0
[Test]
public void SignHashNullOID ()
{
@@ -292,26 +280,58 @@ public class RSACryptoServiceProviderTest : Assertion {
Assert ("Null OID == SHA1", rsa.VerifyHash (hash, "1.3.14.3.2.26", signature));
Assert ("Null OID", rsa.VerifyHash (hash, null, signature));
}
-#else
+
+ void SignHash (string name, int size)
+ {
+ string oid = CryptoConfig.MapNameToOID (name);
+ byte [] hash = new byte [size];
+ rsa = new RSACryptoServiceProvider (1024);
+ byte [] signature = rsa.SignHash (hash, oid);
+ Assert (name, rsa.VerifyHash (hash, oid, signature));
+ Assert ("OID", rsa.VerifyHash (hash, oid, signature));
+ }
+
[Test]
- [ExpectedException (typeof (CryptographicException))]
- public void SignHashNullOID ()
+ public void SignHashMD5 ()
{
- byte[] hash = new byte [20];
- rsa = new RSACryptoServiceProvider (minKeySize);
- rsa.SignHash (hash, null);
+ SignHash ("MD5", 16);
+ }
+
+ [Test]
+ public void SignHashSHA1 ()
+ {
+ SignHash ("SHA1", 20);
}
[Test]
+ public void SignHashSHA256 ()
+ {
+ SignHash ("SHA256", 32);
+ }
+
+ [Test]
+ public void SignHashSHA384 ()
+ {
+ SignHash ("SHA384", 48);
+ }
+
+ [Test]
+ public void SignHashSHA512 ()
+ {
+ SignHash ("SHA512", 64);
+ }
+
+ [Test]
[ExpectedException (typeof (CryptographicException))]
- public void VerifyHashNullOID ()
+ public void SignHashRIPEMD160 ()
{
- byte[] sign = new byte [(minKeySize << 3)];
- byte[] hash = new byte [20];
+ string oid = CryptoConfig.MapNameToOID ("RIPEMD160");
+ AssertNotNull (oid);
+ byte [] hash = new byte [20];
rsa = new RSACryptoServiceProvider (minKeySize);
- rsa.VerifyHash (hash, null, sign);
+ // OID not supported
+ rsa.SignHash (hash, oid);
}
-#endif
[Test]
[ExpectedException (typeof (ObjectDisposedException))]
@@ -340,11 +360,7 @@ public class RSACryptoServiceProviderTest : Assertion {
}
[Test]
-#if NET_1_1
[ExpectedException (typeof (ArgumentNullException))]
-#else
- [ExpectedException (typeof (NullReferenceException))]
-#endif
public void VerifyDataNullData ()
{
byte[] sign = new byte [(minKeySize << 3)];
@@ -1149,8 +1165,6 @@ public class RSACryptoServiceProviderTest : Assertion {
AssertEquals ("KeyNumber", KeyNumber.Exchange, info.KeyNumber);
Assert ("MachineKeyStore", !info.MachineKeyStore);
Assert ("Protected", !info.Protected);
- AssertNotNull ("ProviderName", info.ProviderName);
- AssertEquals ("ProviderType", 1, info.ProviderType);
Assert ("RandomlyGenerated", info.RandomlyGenerated);
Assert ("Removable", !info.Removable);
AssertNotNull ("UniqueKeyContainerName", info.UniqueKeyContainerName);
@@ -1172,8 +1186,6 @@ public class RSACryptoServiceProviderTest : Assertion {
AssertEquals ("KeyNumber", KeyNumber.Exchange, info.KeyNumber);
Assert ("MachineKeyStore", !info.MachineKeyStore);
Assert ("Protected", !info.Protected);
- AssertNotNull ("ProviderName", info.ProviderName);
- AssertEquals ("ProviderType", 1, info.ProviderType);
Assert ("RandomlyGenerated", info.RandomlyGenerated);
Assert ("Removable", !info.Removable);
AssertNotNull ("UniqueKeyContainerName", info.UniqueKeyContainerName);
@@ -1196,8 +1208,6 @@ public class RSACryptoServiceProviderTest : Assertion {
AssertEquals ("KeyNumber", KeyNumber.Exchange, info.KeyNumber);
Assert ("MachineKeyStore", !info.MachineKeyStore);
// info.Protected throws a CryptographicException at this stage
- AssertNotNull ("ProviderName", info.ProviderName);
- AssertEquals ("ProviderType", 1, info.ProviderType);
Assert ("RandomlyGenerated", info.RandomlyGenerated);
Assert ("Removable", !info.Removable);
// info.UniqueKeyContainerName throws a CryptographicException at this stage
Modified: mcs/class/corlib/Test/System.Security.Cryptography/RSAPKCS1SignatureFormatterTest.cs
===================================================================
--- a/mcs/class/corlib/Test/System.Security.Cryptography/RSAPKCS1SignatureFormatterTest.cs
+++ b/mcs/class/corlib/Test/System.Security.Cryptography/RSAPKCS1SignatureFormatterTest.cs
@@ -5,7 +5,7 @@
// Sebastien Pouliot (sebastien@ximian.com)
//
// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2004-2005, 2011 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
@@ -34,18 +34,12 @@ using System.Security.Cryptography;
namespace MonoTests.System.Security.Cryptography {
[TestFixture]
- public class RSAPKCS1SignatureFormatterTest : Assertion {
+ public class RSAPKCS1SignatureFormatterTest {
-#if NET_2_0
- // FX 2.0 changed the OID values for SHA256, SHA384 and SHA512 - so the signature \
values are different private static byte[] signatureRSASHA256 = { 0xAD, 0x6E, 0x29, \
0xC8, 0x7D, 0xFE, 0x5F, 0xB3, 0x92, 0x07, 0x4C, 0x51, 0x08, 0xC5, 0x91, 0xA2, 0xCF, \
0x7E, 0xA6, 0x05, 0x66, 0x85, 0xA3, 0x8E, 0x7C, 0xB0, 0xCA, 0x93, 0x4F, 0x4E, 0xF5, \
0x45, 0x0F, 0xED, 0x46, 0xFB, 0x34, 0xBC, 0x8A, 0x6A, 0x48, 0xD9, 0x76, 0x28, 0xE1, \
0x68, 0xA0, 0x1F, 0x7F, 0x3E, 0xCC, 0x0A, 0x5F, 0x06, 0x8E, 0xEB, 0xB7, 0xA7, 0x48, \
0x6B, 0x92, 0x1A, 0x7A, 0x66, 0x42, 0x4F, 0x0B, 0xC1, 0x19, 0x96, 0xAC, 0x67, 0xA0, \
0x6C, 0x3E, 0x39, 0xD2, 0xEB, 0xCA, 0xD7, 0x12, 0x29, 0x46, 0x0A, 0x60, 0x70, 0xA9, \
0x2B, 0x80, 0x9F, 0xCD, 0x08, 0x02, 0xEB, 0xA5, 0x62, 0xEC, 0xAB, 0xBB, 0x64, 0x8B, \
0x2D, 0xB9, 0x55, 0x0A, 0xE3, 0x5A, 0x2C, 0xDA, 0x54, 0xD4, 0x79, 0x0A, 0x8D, 0xB6, \
0x57, 0x05, 0xF7, 0x6C, 0x6D, 0xB7, 0xD8, 0xB4, 0x07, 0xC4, 0xCD, 0x79, 0xD4 }; \
private static byte[] signatureRSASHA384 = { 0x53, 0x80, 0xFD, 0x26, 0x8F, 0xCF, \
0xE5, 0x44, 0x55, 0x4A, 0xC5, 0xB2, 0x46, 0x78, 0x89, 0x42, 0xF8, 0x51, 0xB8, 0x4D, \
0x3B, 0xCA, 0x48, 0x5A, 0x36, 0x9F, 0x62, 0x01, 0x72, 0x1E, 0xD8, 0x2D, 0xC2, 0x2D, \
0x3E, 0x67, 0x1C, 0x5D, 0x89, 0xAB, 0x39, 0x8D, 0x07, 0xC8, 0xD4, 0x47, 0x97, 0xA4, \
0x68, 0x7A, 0x87, 0xA4, 0xCF, 0x7B, 0x32, 0x4F, 0xD3, 0xD1, 0x90, 0xDC, 0x76, 0x23, \
0x51, 0xA7, 0xEE, 0xFC, 0x7F, 0xDF, 0x3C, 0xB0, 0x05, 0xF3, 0xE3, 0xAA, 0x96, 0x30, \
0xE0, 0xE4, 0x8B, 0x09, 0xB1, 0x78, 0xAC, 0x99, 0xDB, 0xC5, 0x0E, 0xFA, 0xAB, 0x4F, \
0xA1, 0x02, 0xCA, 0x77, 0x93, 0x74, 0x5A, 0xB8, 0x71, 0x9C, 0x3E, 0x2E, 0xAE, 0x62, \
0xC7, 0xE5, 0xBF, 0xDA, 0xFE, 0x31, 0xA7, 0x91, 0xC0, 0x04, 0xE3, 0x95, 0xCB, 0x3F, \
0x54, 0xA8, 0x09, 0x25, 0xF7, 0x09, 0x78, 0xE6, 0x09, 0x84 }; private static byte[] \
signatureRSASHA512 = { 0xA8, 0xD0, 0x24, 0xCB, 0xA2, 0x4B, 0x5E, 0x0D, 0xBC, 0x3F, \
0x6F, 0x0F, 0x8D, 0xE4, 0x31, 0x9E, 0x37, 0x84, 0xE0, 0x31, 0x5B, 0x63, 0x24, 0xC5, \
0xA9, 0x05, 0x41, 0xAA, 0x69, 0x02, 0x8F, 0xC1, 0x57, 0x06, 0x1F, 0xBF, 0x3B, 0x8B, \
0xC8, 0x86, 0xB3, 0x02, 0xEA, 0xF1, 0x75, 0xE4, 0x70, 0x21, 0x1E, 0x16, 0x4C, 0x37, \
0xB2, 0x31, 0x78, 0xD0, 0xA0, 0x88, 0xA5, 0x1D, 0x5D, 0x8F, 0xBC, 0xC3, 0x87, 0x94, \
0x4B, 0x8F, 0x4E, 0x92, 0xBC, 0x80, 0xF8, 0xA5, 0x90, 0xF7, 0xA0, 0x6D, 0x96, 0x61, \
0x65, 0x0D, 0xD5, 0x3F, 0xD7, 0x4F, 0x07, 0x58, 0x40, 0xB8, 0xA4, 0x14, 0x14, 0x55, \
0x39, 0x4F, 0xF0, 0xB5, 0x56, 0x99, 0xC8, 0x52, 0x0C, 0xDD, 0xBA, 0x8D, 0xFB, 0x06, \
0x83, 0x6E, 0x79, 0x25, 0x75, 0xEF, 0x0D, 0x26, 0x14, 0x3A, 0xBB, 0x62, 0x29, 0x21, \
0xF6, 0x4B, 0x9E, 0x87, 0x28, 0x57 };
-#else
- private static byte[] signatureRSASHA256 = { 0x0F, 0xE3, 0x15, 0x5B, 0x4D, 0xA1, \
0xB4, 0x13, 0x93, 0x91, 0x1E, 0x17, 0xF9, 0x36, 0xB3, 0x2C, 0xAC, 0x51, 0x77, 0xBC, \
0x86, 0x21, 0xB0, 0x69, 0x75, 0x57, 0xAF, 0xB0, 0xAD, 0xF9, 0x42, 0xF5, 0x58, 0xBC, \
0xD5, 0x61, 0xD5, 0x14, 0x8E, 0xC6, 0xE0, 0xB3, 0xB5, 0x51, 0xCD, 0x17, 0x68, 0x58, \
0x27, 0x74, 0x8A, 0xA7, 0x88, 0xB9, 0x24, 0xD6, 0xE4, 0xC4, 0x93, 0x82, 0x95, 0xB4, \
0x36, 0x14, 0x48, 0xA7, 0xF6, 0x27, 0x87, 0xEB, 0xD8, 0xB9, 0x75, 0x14, 0x75, 0xFB, \
0x6E, 0xA1, 0xF7, 0xAB, 0xA6, 0x78, 0x32, 0xEF, 0x1A, 0x23, 0x60, 0xD3, 0x0C, 0x8D, \
0xFE, 0x89, 0x72, 0xB7, 0x93, 0x6D, 0x00, 0x25, 0xED, 0xF5, 0x55, 0x66, 0xA8, 0x52, \
0x7F, 0x20, 0xFD, 0x77, 0xDA, 0x10, 0x77, 0xE9, 0xF0, 0x58, 0x8D, 0xE6, 0x3A, 0x5A, \
0x00, 0x83, 0x64, 0x42, 0xA5, 0x15, 0x79, 0x3C, 0xB0, 0x8F };
- private static byte[] signatureRSASHA384 = { 0x86, 0x20, 0x2A, 0xB6, 0xA8, 0x0F, \
0x59, 0x42, 0xCA, 0x83, 0xC3, 0x46, 0x2C, 0xA9, 0x2E, 0x62, 0x73, 0x2C, 0xEE, 0x52, \
0xA5, 0xAE, 0x4F, 0xFD, 0xB1, 0x1F, 0xFA, 0x0C, 0x71, 0x4A, 0xFD, 0xE2, 0xAC, 0x64, \
0x1C, 0x63, 0x41, 0xB8, 0x43, 0x3F, 0x8A, 0xF3, 0x7E, 0x1C, 0x25, 0xBE, 0xEE, 0xFC, \
0x7C, 0xCB, 0x33, 0x72, 0x3B, 0x91, 0x1F, 0xF3, 0x78, 0xC2, 0xD0, 0xEA, 0xDF, 0x69, \
0xE9, 0x31, 0x2F, 0x39, 0x32, 0x5F, 0x4A, 0x51, 0xAE, 0x24, 0x9E, 0x96, 0x77, 0xFB, \
0x16, 0xC4, 0xDD, 0x98, 0xDA, 0xA9, 0x9D, 0xA0, 0x7C, 0x2C, 0x95, 0x12, 0x53, 0x1F, \
0x7B, 0x23, 0xEE, 0x78, 0x95, 0x57, 0xFF, 0x02, 0x57, 0x2B, 0x4A, 0x3E, 0x62, 0x6A, \
0xC0, 0x99, 0xDF, 0x4B, 0x7E, 0xBF, 0x86, 0xC4, 0xFB, 0x8E, 0xF3, 0x70, 0xA2, 0xEE, \
0x7B, 0xCA, 0x8B, 0x22, 0xA4, 0x07, 0xBA, 0xBD, 0x16, 0xA9 };
- private static byte[] signatureRSASHA512 = { 0xB7, 0x7E, 0x7E, 0xEF, 0x95, 0xCE, \
0xE8, 0x9D, 0x0F, 0x40, 0x35, 0x50, 0x88, 0xFE, 0x8B, 0xA3, 0x26, 0xD3, 0x9E, 0xA7, \
0x82, 0x23, 0x1A, 0x46, 0x13, 0x46, 0x81, 0x59, 0xD1, 0x24, 0x45, 0xAC, 0x53, 0xEF, \
0x5A, 0x06, 0x31, 0xA7, 0xC2, 0x76, 0xDC, 0x2B, 0x60, 0x69, 0xB1, 0x36, 0x1D, 0xE1, \
0xFC, 0xD5, 0x9A, 0x01, 0x71, 0x08, 0xE9, 0x0C, 0xAE, 0xF4, 0x29, 0xCF, 0xC4, 0xB0, \
0x60, 0xA4, 0xBE, 0x1C, 0x9B, 0x05, 0x2A, 0xA9, 0x6A, 0x12, 0xFF, 0x73, 0x84, 0x5C, \
0xA8, 0x74, 0x5B, 0x9C, 0xA2, 0x07, 0x9D, 0x73, 0xB8, 0xE3, 0x20, 0x16, 0x3C, 0x47, \
0x8F, 0x27, 0x7A, 0x48, 0xAF, 0x01, 0x07, 0xA0, 0x6A, 0x2D, 0x71, 0xAD, 0xDD, 0x8B, \
0x68, 0xC8, 0x32, 0x61, 0x95, 0x68, 0x22, 0x1B, 0x8B, 0xD9, 0x86, 0xA7, 0xBE, 0x60, \
0x06, 0x70, 0x7C, 0xED, 0x51, 0x28, 0x66, 0x28, 0xF0, 0x65 };
-#endif
+
private static RSA rsa;
private static DSA dsa;
@@ -64,31 +58,28 @@ namespace MonoTests.System.Security.Cryptography {
public void AssertEquals (string msg, byte[] array1, byte[] array2)
{
- AllTests.AssertEquals (msg, array1, array2);
+ Assert.AreEqual (array1, array2, msg);
}
[Test]
public void ConstructorEmpty ()
{
fmt = new RSAPKCS1SignatureFormatter ();
- AssertNotNull ("RSAPKCS1SignatureFormatter()", fmt);
+ Assert.IsNotNull (fmt);
}
[Test]
-#if NET_2_0
[ExpectedException (typeof (ArgumentNullException))]
-#endif
public void ConstructorNull ()
{
- fmt = new RSAPKCS1SignatureFormatter (null);
- AssertNotNull ("RSAPKCS1SignatureFormatter(null)", fmt);
+ new RSAPKCS1SignatureFormatter (null);
}
[Test]
public void ConstructorRSA ()
{
fmt = new RSAPKCS1SignatureFormatter (rsa);
- AssertNotNull ("RSAPKCS1SignatureFormatter(rsa)", fmt);
+ Assert.IsNotNull (fmt);
}
[Test]
@@ -114,9 +105,7 @@ namespace MonoTests.System.Security.Cryptography {
}
[Test]
-#if NET_2_0
[ExpectedException (typeof (ArgumentNullException))]
-#endif
public void SetKeyNull ()
{
fmt = new RSAPKCS1SignatureFormatter ();
@@ -209,7 +198,7 @@ namespace MonoTests.System.Security.Cryptography {
fmt.SetHashAlgorithm ("SHA1");
byte[] hash = new byte [20];
byte[] signature = fmt.CreateSignature (hash);
- AssertNotNull ("CreateSignature(SHA1)", signature);
+ Assert.IsNotNull (fmt);
}
[Test]
@@ -235,72 +224,55 @@ namespace MonoTests.System.Security.Cryptography {
fmt.SetHashAlgorithm ("MD5");
byte[] hash = new byte [16];
byte[] signature = fmt.CreateSignature (hash);
- AssertNotNull ("CreateSignature(MD5)", signature);
+ Assert.IsNotNull (fmt);
}
private byte[] CreateSignature (string hashName, int hashSize)
{
- byte[] signature = null;
fmt = new RSAPKCS1SignatureFormatter ();
- bool ms = false;
+
// we need the private key
RSA rsa = RSA.Create ("Mono.Security.Cryptography.RSAManaged"); // only available \
with Mono:: if (rsa == null) {
- ms = true;
rsa = RSA.Create ();
}
rsa.ImportParameters (AllTests.GetRsaKey (true));
fmt.SetKey (rsa);
- try {
- HashAlgorithm ha = HashAlgorithm.Create (hashName);
- byte[] data = new byte [ha.HashSize >> 3];
- // this way we get the same results as CreateSignatureHash
- data = ha.ComputeHash (data);
-
- fmt.SetHashAlgorithm (hashName);
- signature = fmt.CreateSignature (data);
- if (ms)
- Fail ("CreateSignature(" + hashName + ") Expected CryptographicException but \
got none");
- }
- catch (CryptographicException) {
- if (!ms)
- throw;
- }
- catch (Exception e) {
- if (ms)
- Fail ("CreateSignatureHash(" + hashName + ") Expected CryptographicException \
but got " + e.ToString ());
- }
- return signature;
+
+ HashAlgorithm ha = HashAlgorithm.Create (hashName);
+ byte[] data = new byte [ha.HashSize >> 3];
+ // this way we get the same results as CreateSignatureHash
+ data = ha.ComputeHash (data);
+
+ fmt.SetHashAlgorithm (hashName);
+ return fmt.CreateSignature (data);
}
- // not supported using MS framework 1.0 and 1.1 (CryptographicException)
- // supported by Mono::
+ // historical note: this was not supported using MS framework 1.0 and 1.1 \
(CryptographicException) + // but was supported by Mono:: - it's also supported on \
2.0+ (at least on Win XP+) [Test]
public void CreateSignatureRSASHA256 ()
{
byte[] signature = CreateSignature ("SHA256", 32);
- if (signature != null)
- AssertEquals ("CreateSignature(SHA256)", signatureRSASHA256, signature);
+ AssertEquals ("CreateSignature(SHA256)", signatureRSASHA256, signature);
}
- // not supported using MS framework 1.0 and 1.1 (CryptographicException)
- // supported by Mono::
+ // historical note: this was not supported using MS framework 1.0 and 1.1 \
(CryptographicException) + // but was supported by Mono:: - it's also supported on \
2.0+ (at least on Win XP+) [Test]
public void CreateSignatureRSASHA384 ()
{
byte[] signature = CreateSignature ("SHA384", 48);
- if (signature != null)
- AssertEquals ("CreateSignature(SHA384)", signatureRSASHA384, signature);
+ AssertEquals ("CreateSignature(SHA384)", signatureRSASHA384, signature);
}
- // not supported using MS framework 1.0 and 1.1 (CryptographicException)
- // supported by Mono::
+ // historical note: this was not supported using MS framework 1.0 and 1.1 \
(CryptographicException) + // but was supported by Mono:: - it's also supported on \
2.0+ (at least on Win XP+) [Test]
public void CreateSignatureRSASHA512 ()
{
byte[] signature = CreateSignature ("SHA512", 64);
- if (signature != null)
- AssertEquals ("CreateSignature(SHA512)", signatureRSASHA512, signature);
+ AssertEquals ("CreateSignature(SHA512)", signatureRSASHA512, signature);
}
[Test]
@@ -349,7 +321,7 @@ namespace MonoTests.System.Security.Cryptography {
HashAlgorithm hash = SHA1.Create ();
hash.ComputeHash (data);
byte[] signature = fmt.CreateSignature (hash);
- AssertNotNull ("CreateSignature(SHA1)", signature);
+ Assert.IsNotNull (signature);
}
[Test]
@@ -363,69 +335,52 @@ namespace MonoTests.System.Security.Cryptography {
HashAlgorithm hash = MD5.Create ();
hash.ComputeHash (data);
byte[] signature = fmt.CreateSignature (hash);
- AssertNotNull ("CreateSignature(MD5)", signature);
+ Assert.IsNotNull (signature);
}
private byte[] CreateSignatureHash (string hashName)
{
- byte[] signature = null;
fmt = new RSAPKCS1SignatureFormatter ();
- bool ms = false;
+
// we need the private key
RSA rsa = RSA.Create ("Mono.Security.Cryptography.RSAManaged"); // only available \
with Mono:: if (rsa == null) {
- ms = true;
rsa = RSA.Create ();
}
rsa.ImportParameters (AllTests.GetRsaKey (true));
fmt.SetKey (rsa);
- try {
- HashAlgorithm hash = HashAlgorithm.Create (hashName);
- byte[] data = new byte [(hash.HashSize >> 3)];
- hash.ComputeHash (data);
- signature = fmt.CreateSignature (hash);
- if (ms)
- Fail ("CreateSignatureHash(" + hashName + ") Expected CryptographicException \
but got none");
- }
- catch (CryptographicException) {
- if (!ms)
- throw;
- }
- catch (Exception e) {
- if (ms)
- Fail ("CreateSignatureHash(" + hashName + ") Expected CryptographicException \
but got " + e.ToString ());
- }
- return signature; \
+
+ HashAlgorithm hash = HashAlgorithm.Create (hashName);
+ byte[] data = new byte [(hash.HashSize >> 3)];
+ hash.ComputeHash (data);
+ return fmt.CreateSignature (hash);
}
- // not supported using MS framework 1.0 and 1.1 (CryptographicException)
- // supported by Mono::
+ // historical note: this was not supported using MS framework 1.0 and 1.1 \
(CryptographicException) + // but was supported by Mono:: - it's also supported on \
2.0+ (at least on Win XP+) [Test]
public void CreateSignatureHashSHA256 ()
{
byte[] signature = CreateSignatureHash ("SHA256");
- if (signature != null)
- AssertEquals ("CreateSignatureHash(SHA256)", signatureRSASHA256, signature);
+ AssertEquals ("CreateSignatureHash(SHA256)", signatureRSASHA256, signature);
}
- // not supported using MS framework 1.0 and 1.1 (CryptographicException)
- // supported by Mono::
+ // historical note: this was not supported using MS framework 1.0 and 1.1 \
(CryptographicException) + // but was supported by Mono:: - it's also supported on \
2.0+ (at least on Win XP+) [Test]
public void CreateSignatureHashSHA384 ()
{
byte[] signature = CreateSignatureHash ("SHA384");
- if (signature != null)
- AssertEquals ("CreateSignatureHash(SHA384)", signatureRSASHA384, signature);
+ AssertEquals ("CreateSignatureHash(SHA384)", signatureRSASHA384, signature);
}
- // not supported using MS framework 1.0 and 1.1 (CryptographicException)
- // supported by Mono::
+ // historical note: this was not supported using MS framework 1.0 and 1.1 \
(CryptographicException) + // but was supported by Mono:: - it's also supported on \
2.0+ (at least on Win XP+) [Test]
public void CreateSignatureHashSHA512 ()
{
byte[] signature = CreateSignatureHash ("SHA512");
- if (signature != null)
- AssertEquals ("CreateSignatureHash(SHA512)", signatureRSASHA512, signature);
+ AssertEquals ("CreateSignatureHash(SHA512)", signatureRSASHA512, signature);
}
}
}
Commit: 0e29d1e39be991d2c210b9545107adcc90b05cef
Author: Andrew Jorgensen <ajorgensen@novell.com>
Date: 01/21/2011 12:44:36
URL: https://github.com/mono/mono/commit/0e29d1e39be991d2c210b9545107adcc90b05cef
add Microsoft.Web.Infrastructure
Changed paths:
M mono-core.spec.in
Modified: mono-core.spec.in
===================================================================
--- a/mono-core.spec.in
+++ b/mono-core.spec.in
@@ -774,6 +774,7 @@ Mono implementation of ASP.NET, Remoting and Web Services.
%_prefix/lib/mono/4.0/System.Runtime.Serialization.Formatters.Soap.dll
%_prefix/lib/mono/4.0/System.Web.Abstractions.dll
%_prefix/lib/mono/4.0/System.Web.ApplicationServices.dll
+%_prefix/lib/mono/4.0/System.Web.Infrastructure.dll
%_prefix/lib/mono/4.0/System.Web.Routing.dll
%_prefix/lib/mono/4.0/System.Web.Services.dll
%_prefix/lib/mono/4.0/System.Web.dll
@@ -791,6 +792,7 @@ Mono implementation of ASP.NET, Remoting and Web Services.
%_prefix/lib/mono/gac/System.Web
%_prefix/lib/mono/gac/System.Web.Abstractions
%_prefix/lib/mono/gac/System.Web.ApplicationServices
+%_prefix/lib/mono/gac/System.Web.Infrastructure
%_prefix/lib/mono/gac/System.Web.Routing
%_prefix/lib/mono/gac/System.Web.Services
Commit: faac64a083aca5ea778d0ed803642e8a914299a0
Author: Andrew Jorgensen <ajorgensen@novell.com>
Date: 01/21/2011 14:54:13
URL: https://github.com/mono/mono/commit/faac64a083aca5ea778d0ed803642e8a914299a0
Oops, Microsoft.Web.Infrastructure, not System.
Changed paths:
M mono-core.spec.in
Modified: mono-core.spec.in
===================================================================
--- a/mono-core.spec.in
+++ b/mono-core.spec.in
@@ -766,6 +766,7 @@ Mono implementation of ASP.NET, Remoting and Web Services.
%_prefix/lib/mono/2.0/System.Web.dll
%_prefix/lib/mono/2.0/wsdl.exe*
%_prefix/lib/mono/2.0/xsd.exe*
+%_prefix/lib/mono/4.0/Microsoft.Web.Infrastructure.dll
%_prefix/lib/mono/4.0/Mono.Http.dll
%_prefix/lib/mono/4.0/Mono.Web.dll
%_prefix/lib/mono/4.0/System.ComponentModel.Composition.dll
@@ -774,7 +775,6 @@ Mono implementation of ASP.NET, Remoting and Web Services.
%_prefix/lib/mono/4.0/System.Runtime.Serialization.Formatters.Soap.dll
%_prefix/lib/mono/4.0/System.Web.Abstractions.dll
%_prefix/lib/mono/4.0/System.Web.ApplicationServices.dll
-%_prefix/lib/mono/4.0/System.Web.Infrastructure.dll
%_prefix/lib/mono/4.0/System.Web.Routing.dll
%_prefix/lib/mono/4.0/System.Web.Services.dll
%_prefix/lib/mono/4.0/System.Web.dll
@@ -783,6 +783,7 @@ Mono implementation of ASP.NET, Remoting and Web Services.
%_prefix/lib/mono/4.0/soapsuds.exe*
%_prefix/lib/mono/4.0/wsdl.exe*
%_prefix/lib/mono/4.0/xsd.exe*
+%_prefix/lib/mono/gac/Microsoft.Web.Infrastructure
%_prefix/lib/mono/gac/Mono.Http
%_prefix/lib/mono/gac/Mono.Web
%_prefix/lib/mono/gac/System.ComponentModel.Composition
@@ -792,7 +793,6 @@ Mono implementation of ASP.NET, Remoting and Web Services.
%_prefix/lib/mono/gac/System.Web
%_prefix/lib/mono/gac/System.Web.Abstractions
%_prefix/lib/mono/gac/System.Web.ApplicationServices
-%_prefix/lib/mono/gac/System.Web.Infrastructure
%_prefix/lib/mono/gac/System.Web.Routing
%_prefix/lib/mono/gac/System.Web.Services
Commit: 8b52311dfd3c6f93cc25f21c293de4cea358ca47
Author: Zoltan Varga <vargaz@gmail.com>
Date: 01/21/2011 15:54:12
URL: https://github.com/mono/mono/commit/8b52311dfd3c6f93cc25f21c293de4cea358ca47
Initialize klass->has_finalizer lazily. This allows us to remove the \
find_method_in_metadata () optimization without a perf cost which is broken in the \
presence of overrides. Fixes #665769.
Changed paths:
M mono/metadata/class-internals.h
M mono/metadata/class.c
M mono/metadata/object.c
M mono/metadata/reflection.c
Modified: mono/metadata/class-internals.h
===================================================================
--- a/mono/metadata/class-internals.h
+++ b/mono/metadata/class-internals.h
@@ -350,6 +350,8 @@ struct _MonoClass {
guint simd_type : 1; /* class is a simd intrinsic type */
guint is_generic : 1; /* class is a generic type definition */
guint is_inflated : 1; /* class is a generic instance */
+ /* next byte */
+ guint has_finalize_inited : 1; /* has_finalize is initialized */
guint8 exception_type; /* MONO_EXCEPTION_* */
@@ -1297,4 +1299,7 @@ mono_class_get_fields_lazy (MonoClass* klass, gpointer *iter) \
MONO_INTERNAL; gboolean
mono_class_check_vtable_constraints (MonoClass *class, GList *in_setup) \
MONO_INTERNAL;
+gboolean
+mono_class_has_finalizer (MonoClass *klass) MONO_INTERNAL;
+
#endif /* __MONO_METADATA_CLASS_INTERBALS_H__ */
Modified: mono/metadata/class.c
===================================================================
--- a/mono/metadata/class.c
+++ b/mono/metadata/class.c
@@ -4718,6 +4718,7 @@ mono_class_init (MonoClass *class)
/* AOT case */
class->vtable_size = cached_info.vtable_size;
class->has_finalize = cached_info.has_finalize;
+ class->has_finalize_inited = TRUE;
class->ghcimpl = cached_info.ghcimpl;
class->has_cctor = cached_info.has_cctor;
} else if (class->rank == 1 && class->byval_arg.type == MONO_TYPE_SZARRAY) {
@@ -4735,12 +4736,14 @@ mono_class_init (MonoClass *class)
} else {
class->vtable_size = szarray_vtable_size[slot];
}
+ class->has_finalize_inited = TRUE;
} else if (class->generic_class && !MONO_CLASS_IS_INTERFACE (class)) {
MonoClass *gklass = class->generic_class->container_class;
/* Generic instance case */
class->ghcimpl = gklass->ghcimpl;
- class->has_finalize = gklass->has_finalize;
+ class->has_finalize = mono_class_has_finalizer (gklass);
+ class->has_finalize_inited = TRUE;
class->has_cctor = gklass->has_cctor;
mono_class_setup_vtable (gklass);
@@ -4765,45 +4768,6 @@ mono_class_init (MonoClass *class)
}
*/
- /* Interfaces and valuetypes are not supposed to have finalizers */
- if (!(MONO_CLASS_IS_INTERFACE (class) || class->valuetype)) {
- MonoMethod *cmethod = NULL;
-
- if (class->parent && class->parent->has_finalize) {
- class->has_finalize = 1;
- } else {
- if (class->type_token) {
- cmethod = find_method_in_metadata (class, "Finalize", 0, \
METHOD_ATTRIBUTE_VIRTUAL);
- } else if (class->parent) {
- /* FIXME: Optimize this */
- mono_class_setup_vtable (class);
- if (class->exception_type || mono_loader_get_last_error ())
- goto leave;
- cmethod = class->vtable [finalize_slot];
- }
-
- if (cmethod) {
- /* Check that this is really the finalizer method */
- mono_class_setup_vtable (class);
- if (class->exception_type || mono_loader_get_last_error ())
- goto leave;
-
- g_assert (class->vtable_size > finalize_slot);
-
- class->has_finalize = 0;
- if (class->parent) {
- cmethod = class->vtable [finalize_slot];
- g_assert (cmethod);
- if (cmethod->is_inflated)
- cmethod = ((MonoMethodInflated*)cmethod)->declaring;
- if (cmethod != default_finalize) {
- class->has_finalize = 1;
- }
- }
- }
- }
- }
-
/* C# doesn't allow interfaces to have cctors */
if (!MONO_CLASS_IS_INTERFACE (class) || class->image != mono_defaults.corlib) {
MonoMethod *cmethod = NULL;
@@ -4887,6 +4851,66 @@ mono_class_init (MonoClass *class)
return class->exception_type == MONO_EXCEPTION_NONE;
}
+/*
+ * mono_class_has_finalizer:
+ *
+ * Return whenever KLASS has a finalizer, initializing klass->has_finalizer in the
+ * process.
+ */
+gboolean
+mono_class_has_finalizer (MonoClass *klass)
+{
+ if (!klass->has_finalize_inited) {
+ MonoClass *class = klass;
+
+ mono_loader_lock ();
+
+ /* Interfaces and valuetypes are not supposed to have finalizers */
+ if (!(MONO_CLASS_IS_INTERFACE (class) || class->valuetype)) {
+ MonoMethod *cmethod = NULL;
+
+ if (class->parent && class->parent->has_finalize) {
+ class->has_finalize = 1;
+ } else {
+ if (class->parent) {
+ /*
+ * Can't search in metadata for a method named Finalize, because that
+ * ignores overrides.
+ */
+ mono_class_setup_vtable (class);
+ if (class->exception_type || mono_loader_get_last_error ())
+ goto leave;
+ cmethod = class->vtable [finalize_slot];
+ }
+
+ if (cmethod) {
+ g_assert (class->vtable_size > finalize_slot);
+
+ class->has_finalize = 0;
+ if (class->parent) {
+ if (cmethod->is_inflated)
+ cmethod = ((MonoMethodInflated*)cmethod)->declaring;
+ if (cmethod != default_finalize) {
+ class->has_finalize = 1;
+ }
+ }
+ }
+ }
+ }
+
+ mono_memory_barrier ();
+ klass->has_finalize_inited = TRUE;
+
+ mono_loader_unlock ();
+ }
+
+ return klass->has_finalize;
+
+ leave:
+ mono_loader_unlock ();
+ return FALSE;
+}
+
gboolean
mono_is_corlib_image (MonoImage *image)
{
Modified: mono/metadata/object.c
===================================================================
--- a/mono/metadata/object.c
+++ b/mono/metadata/object.c
@@ -1851,6 +1851,9 @@ mono_class_create_runtime_vtable (MonoDomain *domain, MonoClass \
*class, gboolean if (class->generic_class && !class->vtable)
mono_class_check_vtable_constraints (class, NULL);
+ /* Initialize klass->has_finalize */
+ mono_class_has_finalizer (class);
+
if (class->exception_type) {
mono_domain_unlock (domain);
mono_loader_unlock ();
Modified: mono/metadata/reflection.c
===================================================================
--- a/mono/metadata/reflection.c
+++ b/mono/metadata/reflection.c
@@ -11238,6 +11238,7 @@ mono_reflection_create_runtime_class \
(MonoReflectionTypeBuilder *tb) klass->flags = tb->attrs;
klass->has_cctor = 1;
klass->has_finalize = 1;
+ klass->has_finalize_inited = 1;
/* fool mono_class_setup_parent */
klass->supertypes = NULL;
Commit: cef819966aa154124b2702e4439d863b4e72aa5b
Author: Zoltan Varga <vargaz@gmail.com>
Date: 01/21/2011 15:54:31
URL: https://github.com/mono/mono/commit/cef819966aa154124b2702e4439d863b4e72aa5b
Obsolete VirtualMachine.GetNextEvent () as it is impossible to determine when to \
resume after an event, since the debuggee suspends only once per event-set.
Changed paths:
M mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/VirtualMachine.cs
M mcs/class/Mono.Debugger.Soft/Test/dtest.cs
Modified: mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/VirtualMachine.cs
===================================================================
--- a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/VirtualMachine.cs
+++ b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/VirtualMachine.cs
@@ -74,6 +74,11 @@ namespace Mono.Debugger.Soft
EventSet current_es;
int current_es_index;
+ /*
+ * It is impossible to determine when to resume when using this method, since
+ * the debuggee is suspended only once per event-set, not event.
+ */
+ [Obsolete ("Use GetNextEventSet () instead")]
public Event GetNextEvent () {
lock (queue_monitor) {
if (current_es == null || current_es_index == current_es.Events.Length) {
@@ -102,6 +107,7 @@ namespace Mono.Debugger.Soft
}
}
+ [Obsolete ("Use GetNextEventSet () instead")]
public T GetNextEvent<T> () where T : Event {
return GetNextEvent () as T;
}
Modified: mcs/class/Mono.Debugger.Soft/Test/dtest.cs
===================================================================
--- a/mcs/class/Mono.Debugger.Soft/Test/dtest.cs
+++ b/mcs/class/Mono.Debugger.Soft/Test/dtest.cs
@@ -36,6 +36,12 @@ public class DebuggerTests
public static string runtime = Environment.GetEnvironmentVariable ("DBG_RUNTIME");
public static string agent_args = Environment.GetEnvironmentVariable \
("DBG_AGENT_ARGS");
+ Event GetNextEvent () {
+ var es = vm.GetNextEventSet ();
+ Assert.AreEqual (1, es.Events.Length);
+ return es [0];
+ }
+
void Start (string[] args) {
if (!listening) {
var pi = new Diag.ProcessStartInfo ();
@@ -54,7 +60,7 @@ public class DebuggerTests
var load_req = vm.CreateAssemblyLoadRequest ();
load_req.Enable ();
- Event vmstart = vm.GetNextEvent ();
+ Event vmstart = GetNextEvent ();
Assert.AreEqual (EventType.VMStart, vmstart.EventType);
vm.Resume ();
@@ -66,7 +72,7 @@ public class DebuggerTests
/* Find out the entry point */
while (true) {
- e = vm.GetNextEvent ();
+ e = GetNextEvent ();
if (e is AssemblyLoadEvent) {
AssemblyLoadEvent ae = (AssemblyLoadEvent)e;
@@ -91,7 +97,7 @@ public class DebuggerTests
while (true) {
vm.Resume ();
- e = vm.GetNextEvent ();
+ e = GetNextEvent ();
if (e is BreakpointEvent)
break;
}
@@ -107,7 +113,7 @@ public class DebuggerTests
req.Enable ();
vm.Resume ();
- Event e = vm.GetNextEvent ();
+ Event e = GetNextEvent ();
Assert.IsTrue (e is StepEvent);
req.Disable ();
@@ -155,7 +161,7 @@ public class DebuggerTests
vm.Resume ();
while (true) {
- Event e = vm.GetNextEvent ();
+ Event e = GetNextEvent ();
if (e is VMDeathEvent)
break;
@@ -175,7 +181,7 @@ public class DebuggerTests
vm.Resume ();
- e = vm.GetNextEvent ();
+ e = GetNextEvent ();
Assert.AreEqual (EventType.Breakpoint, e.EventType);
Assert.IsTrue (e is BreakpointEvent);
Assert.AreEqual (m.Name, (e as BreakpointEvent).Method.Name);
@@ -189,8 +195,6 @@ public class DebuggerTests
[Test]
public void BreakpointsSameLocation () {
- Event e;
-
MethodMirror m = entry_point.DeclaringType.GetMethod ("bp2");
Assert.IsNotNull (m);
@@ -199,13 +203,13 @@ public class DebuggerTests
vm.Resume ();
- e = vm.GetNextEvent ();
- Assert.IsTrue (e is BreakpointEvent);
- Assert.AreEqual (m, (e as BreakpointEvent).Method);
+ var es = vm.GetNextEventSet ();
+ Assert.AreEqual (2, es.Events.Length);
+ Assert.IsTrue (es [0] is BreakpointEvent);
+ Assert.AreEqual (m, (es [0] as BreakpointEvent).Method);
- e = vm.GetNextEvent ();
- Assert.IsTrue (e is BreakpointEvent);
- Assert.AreEqual (m.Name, (e as BreakpointEvent).Method.Name);
+ Assert.IsTrue (es [1] is BreakpointEvent);
+ Assert.AreEqual (m.Name, (es [1] as BreakpointEvent).Method.Name);
}
[Test]
@@ -224,21 +228,21 @@ public class DebuggerTests
vm.Resume ();
- e = vm.GetNextEvent ();
+ e = GetNextEvent ();
Assert.AreEqual (EventType.Breakpoint, e.EventType);
Assert.AreEqual (m.Name, (e as BreakpointEvent).Method.Name);
vm.Resume ();
/* Non-shared instance */
- e = vm.GetNextEvent ();
+ e = GetNextEvent ();
Assert.AreEqual (EventType.Breakpoint, e.EventType);
Assert.AreEqual (m2.Name, (e as BreakpointEvent).Method.Name);
vm.Resume ();
/* Shared instance */
- e = vm.GetNextEvent ();
+ e = GetNextEvent ();
Assert.AreEqual (EventType.Breakpoint, e.EventType);
Assert.AreEqual (m2.Name, (e as BreakpointEvent).Method.Name);
}
@@ -259,19 +263,19 @@ public class DebuggerTests
/* Run until bp4 */
vm.Resume ();
- e = vm.GetNextEvent ();
- Assert.AreEqual (EventType.Breakpoint, e.EventType);
- Assert.AreEqual (m.Name, (e as BreakpointEvent).Method.Name);
- e = vm.GetNextEvent ();
- Assert.AreEqual (EventType.Breakpoint, e.EventType);
- Assert.AreEqual (m.Name, (e as BreakpointEvent).Method.Name);
+ var es = vm.GetNextEventSet ();
+ Assert.AreEqual (2, es.Events.Length);
+ Assert.AreEqual (EventType.Breakpoint, es [0].EventType);
+ Assert.AreEqual (m.Name, (es [0] as BreakpointEvent).Method.Name);
+ Assert.AreEqual (EventType.Breakpoint, es [1].EventType);
+ Assert.AreEqual (m.Name, (es [1] as BreakpointEvent).Method.Name);
/* Clear one of them */
req1.Disable ();
vm.Resume ();
- e = vm.GetNextEvent ();
+ e = GetNextEvent ();
Assert.AreEqual (EventType.Breakpoint, e.EventType);
Assert.AreEqual (m.Name, (e as BreakpointEvent).Method.Name);
@@ -280,7 +284,7 @@ public class DebuggerTests
vm.Resume ();
- e = vm.GetNextEvent ();
+ e = GetNextEvent ();
Assert.AreEqual (EventType.Breakpoint, e.EventType);
Assert.AreEqual (m2.Name, (e as BreakpointEvent).Method.Name);
}
@@ -301,7 +305,7 @@ public class DebuggerTests
vm.Resume ();
- e = vm.GetNextEvent ();
+ e = GetNextEvent ();
Assert.IsTrue (!(e is BreakpointEvent));
if (e is VMDeathEvent)
vm = null;
@@ -318,7 +322,7 @@ public class DebuggerTests
vm.Resume ();
- e = vm.GetNextEvent ();
+ e = GetNextEvent ();
Assert.AreEqual (EventType.Breakpoint, e.EventType);
Assert.IsTrue (e is BreakpointEvent);
Assert.AreEqual (m.Name, (e as BreakpointEvent).Method.Name);
@@ -335,13 +339,13 @@ public class DebuggerTests
// Step into ss1
vm.Resume ();
- e = vm.GetNextEvent ();
+ e = GetNextEvent ();
Assert.IsTrue (e is StepEvent);
Assert.AreEqual ("ss1", (e as StepEvent).Method.Name);
// Step out of ss1
vm.Resume ();
- e = vm.GetNextEvent ();
+ e = GetNextEvent ();
Assert.IsTrue (e is StepEvent);
Assert.AreEqual ("single_stepping", (e as StepEvent).Method.Name);
@@ -352,7 +356,7 @@ public class DebuggerTests
// Step over ss2
vm.Resume ();
- e = vm.GetNextEvent ();
+ e = GetNextEvent ();
Assert.IsTrue (e is StepEvent);
Assert.AreEqual ("single_stepping", (e as StepEvent).Method.Name);
@@ -363,7 +367,7 @@ public class DebuggerTests
// Step into ss3
vm.Resume ();
- e = vm.GetNextEvent ();
+ e = GetNextEvent ();
Assert.IsTrue (e is StepEvent);
Assert.AreEqual ("ss3", (e as StepEvent).Method.Name);
@@ -374,7 +378,7 @@ public class DebuggerTests
// Step back into single_stepping
vm.Resume ();
- e = vm.GetNextEvent ();
+ e = GetNextEvent ();
Assert.IsTrue (e is StepEvent);
Assert.AreEqual ("single_stepping", (e as StepEvent).Method.Name);
@@ -385,7 +389,7 @@ public class DebuggerTests
// Step into ss3_2 ()
vm.Resume ();
- e = vm.GetNextEvent ();
+ e = GetNextEvent ();
Assert.IsTrue (e is StepEvent);
Assert.AreEqual ("ss3_2", (e as StepEvent).Method.Name);
@@ -396,7 +400,7 @@ public class DebuggerTests
// Step over ss3_2_2 ()
vm.Resume ();
- e = vm.GetNextEvent ();
+ e = GetNextEvent ();
Assert.IsTrue (e is StepEvent);
Assert.AreEqual ("ss3_2", (e as StepEvent).Method.Name);
@@ -406,7 +410,7 @@ public class DebuggerTests
// Step back into single_stepping () with the new request
vm.Resume ();
- e = vm.GetNextEvent ();
+ e = GetNextEvent ();
Assert.IsTrue (e is StepEvent);
Assert.AreEqual ("single_stepping", (e as StepEvent).Method.Name);
@@ -417,7 +421,7 @@ public class DebuggerTests
// Step into ss4 ()
vm.Resume ();
- e = vm.GetNextEvent ();
+ e = GetNextEvent ();
Assert.IsTrue (e is StepEvent);
Assert.AreEqual ("ss4", (e as StepEvent).Method.Name);
@@ -429,7 +433,7 @@ public class DebuggerTests
// Step over ss1 (); ss1 ();
vm.Resume ();
- e = vm.GetNextEvent ();
+ e = GetNextEvent ();
Assert.IsTrue (e is StepEvent);
// Step into ss2 ()
@@ -438,7 +442,7 @@ public class DebuggerTests
req.Enable ();
vm.Resume ();
- e = vm.GetNextEvent ();
+ e = GetNextEvent ();
Assert.IsTrue (e is StepEvent);
Assert.AreEqual ("ss2", (e as StepEvent).Method.Name);
@@ -453,7 +457,7 @@ public class DebuggerTests
// Step into is_even, skipping the linq stuff
vm.Resume ();
- e = vm.GetNextEvent ();
+ e = GetNextEvent ();
Assert.IsTrue (e is StepEvent);
Assert.AreEqual ("is_even", (e as StepEvent).Method.Name);
@@ -470,10 +474,10 @@ public class DebuggerTests
// Check that single stepping works in out-of-line bblocks
vm.Resume ();
- e = vm.GetNextEvent ();
+ e = GetNextEvent ();
Assert.IsTrue (e is StepEvent);
vm.Resume ();
- e = vm.GetNextEvent ();
+ e = GetNextEvent ();
Assert.IsTrue (e is StepEvent);
Assert.AreEqual ("ss6", (e as StepEvent).Method.Name);
@@ -491,12 +495,12 @@ public class DebuggerTests
req2.Enable ();
vm.Resume ();
- Event e = vm.GetNextEvent ();
+ Event e = GetNextEvent ();
Assert.IsTrue (e is MethodEntryEvent);
Assert.AreEqual ("ss1", (e as MethodEntryEvent).Method.Name);
vm.Resume ();
- e = vm.GetNextEvent ();
+ e = GetNextEvent ();
Assert.IsTrue (e is MethodExitEvent);
Assert.AreEqual ("ss1", (e as MethodExitEvent).Method.Name);
@@ -518,13 +522,13 @@ public class DebuggerTests
// Enter ss2, ss1 is skipped
vm.Resume ();
- Event e = vm.GetNextEvent ();
+ Event e = GetNextEvent ();
Assert.IsTrue (e is MethodEntryEvent);
Assert.AreEqual ("ss2", (e as MethodEntryEvent).Method.Name);
// Breakpoint on ss3, the entry event is no longer reported
vm.Resume ();
- e = vm.GetNextEvent ();
+ e = GetNextEvent ();
Assert.IsTrue (e is BreakpointEvent);
req1.Disable ();
@@ -1375,13 +1379,13 @@ public class DebuggerTests
req.Enable ();
vm.Resume ();
- var e = vm.GetNextEvent ();
+ var e = GetNextEvent ();
Assert.IsTrue (e is StepEvent);
Assert.AreEqual ("locals2", (e as StepEvent).Method.Name);
// Execute s = "AB";
vm.Resume ();
- e = vm.GetNextEvent ();
+ e = GetNextEvent ();
Assert.IsTrue (e is StepEvent);
Assert.AreEqual ("locals2", (e as StepEvent).Method.Name);
@@ -1441,7 +1445,7 @@ public class DebuggerTests
// invalid stack frames
vm.Resume ();
- e = vm.GetNextEvent ();
+ e = GetNextEvent ();
Assert.IsTrue (e is StepEvent);
Assert.AreEqual ("locals2", (e as StepEvent).Method.Name);
@@ -1493,7 +1497,7 @@ public class DebuggerTests
vm.Exit (5);
- var e = vm.GetNextEvent ();
+ var e = GetNextEvent ();
Assert.IsInstanceOfType (typeof (VMDeathEvent), e);
var p = vm.Process;
@@ -1517,7 +1521,7 @@ public class DebuggerTests
vm.Dispose ();
- var e = vm.GetNextEvent ();
+ var e = GetNextEvent ();
Assert.IsInstanceOfType (typeof (VMDisconnectEvent), e);
var p = vm.Process;
@@ -1547,7 +1551,7 @@ public class DebuggerTests
vm.Resume ();
- e = vm.GetNextEvent ();
+ e = GetNextEvent ();
Assert.IsTrue (e is StepEvent);
l = e.Thread.GetFrames ()[0].Location;
@@ -1558,28 +1562,28 @@ public class DebuggerTests
int line_base = l.LineNumber;
vm.Resume ();
- e = vm.GetNextEvent ();
+ e = GetNextEvent ();
Assert.IsTrue (e is StepEvent);
l = e.Thread.GetFrames ()[0].Location;
Assert.AreEqual ("ln2", l.Method.Name);
Assert.AreEqual (line_base + 6, l.LineNumber);
vm.Resume ();
- e = vm.GetNextEvent ();
+ e = GetNextEvent ();
Assert.IsTrue (e is StepEvent);
l = e.Thread.GetFrames ()[0].Location;
Assert.AreEqual ("ln1", l.Method.Name);
Assert.AreEqual (line_base + 1, l.LineNumber);
vm.Resume ();
- e = vm.GetNextEvent ();
+ e = GetNextEvent ();
Assert.IsTrue (e is StepEvent);
l = e.Thread.GetFrames ()[0].Location;
Assert.AreEqual ("ln3", l.Method.Name);
Assert.AreEqual (line_base + 10, l.LineNumber);
vm.Resume ();
- e = vm.GetNextEvent ();
+ e = GetNextEvent ();
Assert.IsTrue (e is StepEvent);
l = e.Thread.GetFrames ()[0].Location;
Assert.AreEqual ("ln1", l.Method.Name);
@@ -1637,7 +1641,7 @@ public class DebuggerTests
vm.Resume ();
- e = vm.GetNextEvent ();
+ e = GetNextEvent ();
Assert.IsInstanceOfType (typeof (AssemblyLoadEvent), e);
Assert.IsTrue ((e as AssemblyLoadEvent).Assembly.Location.EndsWith \
("System.dll"));
@@ -1904,7 +1908,7 @@ public class DebuggerTests
StackFrame invoke_frame = null;
try {
- e = vm.GetNextEvent ();
+ e = GetNextEvent ();
Assert.IsInstanceOfType (typeof (BreakpointEvent), e);
// Check stack trace support and invokes
var frames = e.Thread.GetFrames ();
@@ -1982,7 +1986,7 @@ public class DebuggerTests
vm.Resume ();
}, null);
- e = vm.GetNextEvent ();
+ e = GetNextEvent ();
Assert.AreEqual (EventType.TypeLoad, e.EventType);
}
@@ -2005,14 +2009,14 @@ public class DebuggerTests
vm.Resume ();
- e = vm.GetNextEvent ();
+ e = GetNextEvent ();
Assert.IsInstanceOfType (typeof (ThreadStartEvent), e);
var state = e.Thread.ThreadState;
Assert.IsTrue (state == ThreadState.Running || state == ThreadState.Unstarted);
vm.Resume ();
- e = vm.GetNextEvent ();
+ e = GetNextEvent ();
Assert.IsInstanceOfType (typeof (ThreadDeathEvent), e);
Assert.AreEqual (ThreadState.Stopped, e.Thread.ThreadState);
}
@@ -2106,7 +2110,7 @@ public class DebuggerTests
// Step into invoke2
vm.Resume ();
- e = vm.GetNextEvent ();
+ e = GetNextEvent ();
Assert.IsTrue (e is StepEvent);
Assert.AreEqual ("invoke2", (e as StepEvent).Method.Name);
@@ -2123,7 +2127,7 @@ public class DebuggerTests
vm.Resume ();
- e = vm.GetNextEvent ();
+ e = GetNextEvent ();
Assert.IsInstanceOfType (typeof (ExceptionEvent), e);
Assert.AreEqual ("OverflowException", (e as ExceptionEvent).Exception.Type.Name);
@@ -2139,7 +2143,7 @@ public class DebuggerTests
// Skip the throwing of the second OverflowException
vm.Resume ();
- e = vm.GetNextEvent ();
+ e = GetNextEvent ();
Assert.IsInstanceOfType (typeof (ExceptionEvent), e);
Assert.AreEqual ("ArgumentException", (e as ExceptionEvent).Exception.Type.Name);
req.Disable ();
@@ -2150,7 +2154,7 @@ public class DebuggerTests
vm.Resume ();
- e = vm.GetNextEvent ();
+ e = GetNextEvent ();
Assert.IsInstanceOfType (typeof (ExceptionEvent), e);
Assert.AreEqual ("OverflowException", (e as ExceptionEvent).Exception.Type.Name);
req.Disable ();
@@ -2161,7 +2165,7 @@ public class DebuggerTests
vm.Resume ();
- e = vm.GetNextEvent ();
+ e = GetNextEvent ();
Assert.IsInstanceOfType (typeof (ExceptionEvent), e);
Assert.AreEqual ("NullReferenceException", (e as \
ExceptionEvent).Exception.Type.Name); req.Disable ();
@@ -2172,7 +2176,7 @@ public class DebuggerTests
vm.Resume ();
- e = vm.GetNextEvent ();
+ e = GetNextEvent ();
Assert.IsInstanceOfType (typeof (ExceptionEvent), e);
Assert.AreEqual ("Exception", (e as ExceptionEvent).Exception.Type.Name);
frames = e.Thread.GetFrames ();
@@ -2185,7 +2189,7 @@ public class DebuggerTests
sreq.Enable ();
vm.Resume ();
- e = vm.GetNextEvent ();
+ e = GetNextEvent ();
Assert.IsInstanceOfType (typeof (StepEvent), e);
frames = e.Thread.GetFrames ();
Assert.AreEqual ("exceptions", frames [0].Method.Name);
@@ -2208,7 +2212,7 @@ public class DebuggerTests
vm.Resume ();
- e = vm.GetNextEvent ();
+ e = GetNextEvent ();
Assert.AreEqual (EventType.Breakpoint, e.EventType);
Assert.IsTrue (e is BreakpointEvent);
Assert.AreEqual (m.Name, (e as BreakpointEvent).Method.Name);
@@ -2246,7 +2250,7 @@ public class DebuggerTests
vm.Resume ();
- var e = vm.GetNextEvent ();
+ var e = GetNextEvent ();
Assert.AreEqual (EventType.Breakpoint, e.EventType);
Assert.IsTrue (e is BreakpointEvent);
Assert.AreEqual (filter_method.Name, (e as BreakpointEvent).Method.Name);
@@ -2321,7 +2325,7 @@ public class DebuggerTests
vm.Resume ();
- e = vm.GetNextEvent ();
+ e = GetNextEvent ();
Assert.IsInstanceOfType (typeof (ExceptionEvent), e);
Assert.AreEqual ("NullReferenceException", (e as \
ExceptionEvent).Exception.Type.Name);
@@ -2342,7 +2346,7 @@ public class DebuggerTests
vm.Resume ();
- e = vm.GetNextEvent ();
+ e = GetNextEvent ();
Assert.IsInstanceOfType (typeof (AppDomainCreateEvent), e);
var domain = (e as AppDomainCreateEvent).Domain;
@@ -2354,7 +2358,7 @@ public class DebuggerTests
while (true) {
vm.Resume ();
- e = vm.GetNextEvent ();
+ e = GetNextEvent ();
if (e is BreakpointEvent)
break;
}
@@ -2377,7 +2381,7 @@ public class DebuggerTests
while (true) {
vm.Resume ();
- e = vm.GetNextEvent ();
+ e = GetNextEvent ();
if (e is BreakpointEvent)
break;
}
@@ -2390,7 +2394,7 @@ public class DebuggerTests
// Run until the unload
while (true) {
vm.Resume ();
- e = vm.GetNextEvent ();
+ e = GetNextEvent ();
if (e is AssemblyUnloadEvent) {
continue;
} else {
@@ -2563,7 +2567,7 @@ public class DebuggerTests
vm.Resume ();
- e = vm.GetNextEvent ();
+ e = GetNextEvent ();
Assert.IsTrue (e is BreakpointEvent);
var req = vm.CreateStepRequest (e.Thread);
@@ -2573,7 +2577,7 @@ public class DebuggerTests
vm.Resume ();
- e = vm.GetNextEvent ();
+ e = GetNextEvent ();
Assert.IsTrue (e is StepEvent);
}
Commit: 93f8f61c8a5a8eaeeb7332bba18d7e67356941fb
Author: Zoltan Varga <vargaz@gmail.com>
Date: 01/21/2011 16:32:00
URL: https://github.com/mono/mono/commit/93f8f61c8a5a8eaeeb7332bba18d7e67356941fb
Transition non perf-critical users of klass->has_finalize over to \
mono_class_has_finalizer ().
Changed paths:
M mono/metadata/boehm-gc.c
M mono/metadata/class.c
M mono/metadata/object.c
M mono/metadata/sgen-gc.c
Modified: mono/metadata/boehm-gc.c
===================================================================
--- a/mono/metadata/boehm-gc.c
+++ b/mono/metadata/boehm-gc.c
@@ -961,7 +961,7 @@ mono_gc_get_managed_allocator (MonoVTable *vtable, gboolean \
for_box) return NULL;
if (!SMALL_ENOUGH (klass->instance_size))
return NULL;
- if (klass->has_finalize || klass->marshalbyref || (mono_profiler_get_events () & \
MONO_PROFILE_ALLOCATIONS)) + if (mono_class_has_finalizer (klass) || \
klass->marshalbyref || (mono_profiler_get_events () & MONO_PROFILE_ALLOCATIONS)) \
return NULL; if (klass->rank)
return NULL;
Modified: mono/metadata/class.c
===================================================================
--- a/mono/metadata/class.c
+++ b/mono/metadata/class.c
@@ -7506,7 +7506,7 @@ mono_class_get_finalizer (MonoClass *klass)
if (!klass->inited)
mono_class_init (klass);
- if (!klass->has_finalize)
+ if (!mono_class_has_finalizer (klass))
return NULL;
if (mono_class_get_cached_class_info (klass, &cached_info))
Modified: mono/metadata/object.c
===================================================================
--- a/mono/metadata/object.c
+++ b/mono/metadata/object.c
@@ -4371,7 +4371,7 @@ mono_class_get_allocation_ftn (MonoVTable *vtable, gboolean \
for_box, gboolean *p if (!(mono_profiler_get_events () & MONO_PROFILE_ALLOCATIONS))
profile_allocs = FALSE;
- if (vtable->klass->has_finalize || vtable->klass->marshalbyref || \
(mono_profiler_get_events () & MONO_PROFILE_ALLOCATIONS)) + if \
(mono_class_has_finalizer (vtable->klass) || vtable->klass->marshalbyref || \
(mono_profiler_get_events () & MONO_PROFILE_ALLOCATIONS)) return \
mono_object_new_specific;
if (!vtable->klass->has_references) {
Modified: mono/metadata/sgen-gc.c
===================================================================
--- a/mono/metadata/sgen-gc.c
+++ b/mono/metadata/sgen-gc.c
@@ -7548,7 +7548,7 @@ mono_gc_get_managed_array_allocator (MonoVTable *vtable, int \
rank) return NULL;
if (collect_before_allocs)
return NULL;
- g_assert (!klass->has_finalize && !klass->marshalbyref);
+ g_assert (!mono_class_has_finalizer (klass) && !klass->marshalbyref);
return mono_gc_get_managed_allocator_by_type (ATYPE_VECTOR);
#else
Commit: 70feb6a2b3aab5b02fc5e1347be9c21a8b449e08
Author: Miguel de Icaza <miguel@gnome.org>
Date: 01/21/2011 19:56:41
URL: https://github.com/mono/mono/commit/70feb6a2b3aab5b02fc5e1347be9c21a8b449e08
[csharp] repl using statement fix + support for --fatal
Fixes #638585 which kept reporting the same error on the using statements over and \
over Added support for the --fatal flag to the REPL
Changed paths:
M mcs/mcs/eval.cs
Modified: mcs/mcs/eval.cs
===================================================================
--- a/mcs/mcs/eval.cs
+++ b/mcs/mcs/eval.cs
@@ -114,11 +114,13 @@ namespace Mono.CSharp
lock (evaluator_lock){
if (inited)
return new string [0];
-
- driver = Driver.Create (args, false, new ConsoleReportPrinter ());
+
+ var crp = new ConsoleReportPrinter ();
+ driver = Driver.Create (args, false, crp);
if (driver == null)
throw new Exception ("Failed to create compiler driver with the given \
arguments");
+ crp.Fatal = driver.fatal_errors;
ctx = driver.ctx;
CompilerCallableEntryPoint.Reset ();
@@ -240,7 +242,7 @@ namespace Mono.CSharp
compiled = null;
return null;
}
-
+
lock (evaluator_lock){
if (!inited)
Init ();
@@ -264,10 +266,12 @@ namespace Mono.CSharp
if (!(parser_result is Class)){
int errors = ctx.Report.Errors;
-
+
NamespaceEntry.VerifyAllUsing ();
if (errors == ctx.Report.Errors)
parser.CurrentNamespace.Extract (using_alias_list, using_list);
+ else
+ NamespaceEntry.Reset ();
}
#if STATIC
Commit: 6593ea7a5ea36d92bd1fe9a5ab95a5c16431f2ad
Author: Miguel de Icaza <miguel@gnome.org>
Date: 01/21/2011 20:19:38
URL: https://github.com/mono/mono/commit/6593ea7a5ea36d92bd1fe9a5ab95a5c16431f2ad
[Mono.CSharp] Fix bug where overwriting variables cleared the wrong value
This fixes #641910
Changed paths:
M mcs/mcs/eval.cs
Modified: mcs/mcs/eval.cs
===================================================================
--- a/mcs/mcs/eval.cs
+++ b/mcs/mcs/eval.cs
@@ -772,7 +772,7 @@ namespace Mono.CSharp
}
}
- fields [field.Name] = Tuple.Create (old.Item1, fi);
+ fields [field.Name] = Tuple.Create (field.Spec, fi);
} else {
fields.Add (field.Name, Tuple.Create (field.Spec, fi));
}
Commit: 6e81152a9886077a04a530c98959d1c1f45ab74a
Author: Miguel de Icaza <miguel@gnome.org>
Date: 01/21/2011 20:48:51
URL: https://github.com/mono/mono/commit/6e81152a9886077a04a530c98959d1c1f45ab74a
[getline] Fix history search in the cmdline editor
Changed paths:
M mcs/tools/csharp/getline.cs
Modified: mcs/tools/csharp/getline.cs
===================================================================
--- a/mcs/tools/csharp/getline.cs
+++ b/mcs/tools/csharp/getline.cs
@@ -1033,7 +1033,7 @@ namespace Mono.Terminal {
public void Dump ()
{
- Console.WriteLine ("Head={0} Tail={1} Cursor={2}", head, tail, cursor);
+ Console.WriteLine ("Head={0} Tail={1} Cursor={2} count={3}", head, tail, cursor, \
count); for (int i = 0; i < history.Length;i++){
Console.WriteLine (" {0} {1}: {2}", i == cursor ? "==>" : " ", i, \
history[i]); }
@@ -1042,21 +1042,16 @@ namespace Mono.Terminal {
public string SearchBackward (string term)
{
- for (int i = 1; i < count; i++){
- int slot = cursor-i;
+ for (int i = 0; i < count; i++){
+ int slot = cursor-i-1;
if (slot < 0)
- slot = history.Length-1;
+ slot = history.Length+slot;
+ if (slot >= history.Length)
+ slot = 0;
if (history [slot] != null && history [slot].IndexOf (term) != -1){
cursor = slot;
return history [slot];
}
-
- // Will the next hit tail?
- slot--;
- if (slot < 0)
- slot = history.Length-1;
- if (slot == tail)
- break;
}
return null;
@@ -1069,7 +1064,7 @@ namespace Mono.Terminal {
class Demo {
static void Main ()
{
- LineEditor le = new LineEditor (null);
+ LineEditor le = new LineEditor ("foo");
string s;
while ((s = le.Edit ("shell> ", "")) != null){
Commit: 54b00f36309d3b1b6999e22dc8d604f6448a0d84
Author: Bassam Tabbara <bassam@symform.com>
Committer: Miguel de Icaza <miguel@gnome.org>
Date: 01/21/2011 21:00:49
URL: https://github.com/mono/mono/commit/54b00f36309d3b1b6999e22dc8d604f6448a0d84
Fix for 666225
Changed paths:
M mono/metadata/file-io.c
Modified: mono/metadata/file-io.c
===================================================================
--- a/mono/metadata/file-io.c
+++ b/mono/metadata/file-io.c
@@ -343,7 +343,7 @@ ves_icall_System_IO_MonoIO_GetFileSystemEntries (MonoString \
*path, if (find_handle == INVALID_HANDLE_VALUE) {
gint32 find_error = GetLastError ();
- if (find_error == ERROR_FILE_NOT_FOUND) {
+ if (find_error == ERROR_FILE_NOT_FOUND || find_error == ERROR_NO_MORE_FILES) {
/* No files, so just return an empty array */
result = mono_array_new (domain,
mono_defaults.string_class,
Commit: 9e14e62935fbf0e3948b13e7ad2b7d56598eb601
Author: Zoltan Varga <vargaz@gmail.com>
Date: 01/21/2011 21:08:26
URL: https://github.com/mono/mono/commit/9e14e62935fbf0e3948b13e7ad2b7d56598eb601
Fix an assert which happens when a call is made to Nullable.Unbox from gshared code \
in AOT.
Changed paths:
M mono/mini/generics.cs
M mono/mini/method-to-ir.c
Modified: mono/mini/generics.cs
===================================================================
--- a/mono/mini/generics.cs
+++ b/mono/mini/generics.cs
@@ -624,6 +624,26 @@ class Tests {
return 0;
}
+ struct FooStruct {
+ }
+
+ bool IsNull2 <T> (object value) where T : struct {
+ T? item = (T?) value;
+
+ if (item.HasValue)
+ return false;
+
+ return true;
+ }
+
+ public static int test_0_full_aot_nullable_unbox_from_gshared_code () {
+ if (!new Tests ().IsNull2<FooStruct> (null))
+ return 1;
+ if (new Tests ().IsNull2<FooStruct> (new FooStruct ()))
+ return 2;
+ return 0;
+ }
+
public static int test_0_partial_sharing () {
if (PartialShared1 (new List<string> (), 1) != typeof (string))
return 1;
Modified: mono/mini/method-to-ir.c
===================================================================
--- a/mono/mini/method-to-ir.c
+++ b/mono/mini/method-to-ir.c
@@ -2327,9 +2327,6 @@ mono_emit_calli (MonoCompile *cfg, MonoMethodSignature *sig, \
MonoInst **args, Mo MONO_EMIT_NEW_UNALU (cfg, OP_MOVE, rgctx_reg, rgctx_arg->dreg);
}
- if (rgctx_arg)
- printf ("MOO!\n");
-
call = mono_emit_call_args (cfg, sig, args, TRUE, FALSE, FALSE, rgctx_arg ? TRUE : \
FALSE);
call->inst.sreg1 = addr->dreg;
@@ -3157,7 +3154,7 @@ handle_unbox_nullable (MonoCompile* cfg, MonoInst* val, \
MonoClass* klass, int co addr = emit_get_rgctx_method (cfg, context_used, method,
MONO_RGCTX_INFO_GENERIC_METHOD_CODE);
- rgctx = emit_get_rgctx (cfg, method, context_used);
+ rgctx = emit_get_rgctx (cfg, cfg->current_method, context_used);
return mono_emit_calli (cfg, mono_method_signature (method), &val, addr, rgctx);
} else {
Commit: 7dabffd212ac1dabc766a32d971f383cb526bae6
Author: Gonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Date: 01/21/2011 23:53:51
URL: https://github.com/mono/mono/commit/7dabffd212ac1dabc766a32d971f383cb526bae6
[HttpListener] Fix incorrect 411 error
Don't send a 411 for unknown methods without content length.
No need to assign input_stream until requested.
Fixes bug #666251.
Changed paths:
M mcs/class/System/System.Net/HttpListenerRequest.cs
Modified: mcs/class/System/System.Net/HttpListenerRequest.cs
===================================================================
--- a/mcs/class/System/System.Net/HttpListenerRequest.cs
+++ b/mcs/class/System/System.Net/HttpListenerRequest.cs
@@ -58,14 +58,11 @@ namespace System.Net {
bool ka_set;
bool keep_alive;
static byte [] _100continue = Encoding.ASCII.GetBytes ("HTTP/1.1 100 \
Continue\r\n\r\n");
- static readonly string [] no_body_methods = new string [] {
- "GET", "HEAD", "DELETE" };
internal HttpListenerRequest (HttpListenerContext context)
{
this.context = context;
headers = new WebHeaderCollection ();
- input_stream = Stream.Null;
version = HttpVersion.Version10;
}
@@ -169,32 +166,25 @@ namespace System.Net {
CreateQueryString (url.Query);
- string t_encoding = null;
if (version >= HttpVersion.Version11) {
- t_encoding = Headers ["Transfer-Encoding"];
+ string t_encoding = Headers ["Transfer-Encoding"];
+ is_chunked = (t_encoding != null && String.Compare (t_encoding, "chunked", \
StringComparison.OrdinalIgnoreCase) == 0); // 'identity' is not valid!
- if (t_encoding != null && t_encoding != "chunked") {
+ if (t_encoding != null && !is_chunked) {
context.Connection.SendError (null, 501);
return;
}
}
- is_chunked = (t_encoding == "chunked");
-
- foreach (string m in no_body_methods)
- if (string.Compare (method, m, StringComparison.InvariantCultureIgnoreCase) == \
0)
- return;
-
if (!is_chunked && !cl_set) {
- context.Connection.SendError (null, 411);
- return;
- }
-
- if (is_chunked || content_length > 0) {
- input_stream = context.Connection.GetRequestStream (is_chunked, content_length);
+ if (String.Compare (method, "POST", StringComparison.OrdinalIgnoreCase) == 0 ||
+ String.Compare (method, "PUT", StringComparison.OrdinalIgnoreCase) == 0) {
+ context.Connection.SendError (null, 411);
+ return;
+ }
}
- if (Headers ["Expect"] == "100-continue") {
+ if (String.Compare (Headers ["Expect"], "100-continue", \
StringComparison.OrdinalIgnoreCase) == 0) { ResponseStream output = \
context.Connection.GetResponseStream (); output.InternalWrite (_100continue, 0, \
_100continue.Length); }
@@ -369,7 +359,16 @@ namespace System.Net {
}
public Stream InputStream {
- get { return input_stream; }
+ get {
+ if (input_stream == null) {
+ if (is_chunked || content_length > 0)
+ input_stream = context.Connection.GetRequestStream (is_chunked, \
content_length); + else
+ input_stream = Stream.Null;
+ }
+
+ return input_stream;
+ }
}
[MonoTODO ("Always returns false")]
Commit: 38e5ecca9f140cd053b5cb682c68ba9dc43a1563
Author: Marek Habersack <grendel@twistedcode.net>
Date: 01/22/2011 06:44:25
URL: https://github.com/mono/mono/commit/38e5ecca9f140cd053b5cb682c68ba9dc43a1563
[asp.net,routing] Fix for bug #651966. Regular expression constraints must be treated \
as absolute regexps.
Changed paths:
M mcs/class/System.Web.Routing/System.Web.Routing/Route.cs
M mcs/class/System.Web.Routing/Test/System.Web.Routing/RouteTest.cs
Modified: mcs/class/System.Web.Routing/System.Web.Routing/Route.cs
===================================================================
--- a/mcs/class/System.Web.Routing/System.Web.Routing/Route.cs
+++ b/mcs/class/System.Web.Routing/System.Web.Routing/Route.cs
@@ -150,8 +150,22 @@ namespace System.Web.Routing
string s = constraint as string;
if (s != null) {
string v = values [parameterName] as string;
- if (!String.IsNullOrEmpty (v))
+ if (!String.IsNullOrEmpty (v)) {
+ int slen = s.Length;
+ if (slen > 0) {
+ // Bug #651966 - regexp constraints must be treated
+ // as absolute expressions
+ if (s [0] != '^') {
+ s = "^" + s;
+ slen++;
+ }
+
+ if (s [slen - 1] != '$')
+ s += "$";
+ }
+
return Regex.Match (v, s).Success;
+ }
return false;
}
Modified: mcs/class/System.Web.Routing/Test/System.Web.Routing/RouteTest.cs
===================================================================
--- a/mcs/class/System.Web.Routing/Test/System.Web.Routing/RouteTest.cs
+++ b/mcs/class/System.Web.Routing/Test/System.Web.Routing/RouteTest.cs
@@ -960,6 +960,25 @@ namespace MonoTests.System.Web.Routing
Assert.IsNull (rd, "#2");
}
+ [Test (Description="Bug #651966")]
+ public void GetRouteData47 ()
+ {
+ var r = new Route ("Foo/{id}", new StopRoutingHandler ()) {
+ Defaults = new RouteValueDictionary (new {
+ controller = "Foo",
+ action = "Retrieve"
+ }),
+ Constraints = new RouteValueDictionary (new {
+ id = @"\d{1,10}"
+ })
+ };
+
+ var hc = new HttpContextStub ("/Foo/x123", String.Empty);
+ var rd = r.GetRouteData (hc);
+
+ Assert.IsNull (rd, "#1");
+ }
+
[Test]
[ExpectedException (typeof (ArgumentNullException))]
public void GetVirtualPathNullContext ()
Commit: 234a2d72e818e6ac9a6bd087d80d7962dea94831
Author: Gonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Date: 01/22/2011 13:30:22
URL: https://github.com/mono/mono/commit/234a2d72e818e6ac9a6bd087d80d7962dea94831
Fix Dispose()
Changed paths:
M mcs/class/corlib/System.Runtime.InteropServices/CriticalHandle.cs
Modified: mcs/class/corlib/System.Runtime.InteropServices/CriticalHandle.cs
===================================================================
--- a/mcs/class/corlib/System.Runtime.InteropServices/CriticalHandle.cs
+++ b/mcs/class/corlib/System.Runtime.InteropServices/CriticalHandle.cs
@@ -47,17 +47,14 @@ namespace System.Runtime.InteropServices
if (_disposed)
return;
- _disposed = true;
- if (IsInvalid)
- return;
-
- if (disposing == true && !IsInvalid){
- if (!ReleaseHandle ()) {
+ if (!IsInvalid){
+ if (!_disposed && !ReleaseHandle ()) {
GC.SuppressFinalize (this);
} else {
// Failed in release...
}
}
+ _disposed = true;
}
[ReliabilityContract (Consistency.WillNotCorruptState, Cer.Success)]
Commit: e50fc47fd550ba957534850ce8e6bf79440d373e
Author: Zoltan Varga <vargaz@gmail.com>
Date: 01/23/2011 22:15:05
URL: https://github.com/mono/mono/commit/e50fc47fd550ba957534850ce8e6bf79440d373e
Dist finally_guard.cs.
Changed paths:
M mono/tests/Makefile.am
Modified: mono/tests/Makefile.am
===================================================================
--- a/mono/tests/Makefile.am
+++ b/mono/tests/Makefile.am
@@ -376,7 +376,8 @@ BASE_TEST_CS_SRC= \
TEST_CS_SRC_DIST= \
$(BASE_TEST_CS_SRC) \
async-exc-compilation.cs \
- filter-stack.cs
+ filter-stack.cs \
+ finally_guard.cs
TEST_CS_SRC_GEN = \
runtime-invoke.gen.cs \
Commit: 3fc9d42ca02ef90b4316fe2065b9f86e0e36902e
Author: Marek Safar <marek.safar@gmail.com>
Date: 01/24/2011 08:59:33
URL: https://github.com/mono/mono/commit/3fc9d42ca02ef90b4316fe2065b9f86e0e36902e
Use byte array as underlying storage for AttributeEncoder
Changed paths:
M mcs/mcs/assembly.cs
M mcs/mcs/attribute.cs
M mcs/mcs/class.cs
M mcs/mcs/constant.cs
M mcs/mcs/expression.cs
M mcs/mcs/field.cs
M mcs/mcs/reflection.cs
M mcs/mcs/roottypes.cs
Modified: mcs/mcs/assembly.cs
===================================================================
--- a/mcs/mcs/assembly.cs
+++ b/mcs/mcs/assembly.cs
@@ -448,7 +448,7 @@ namespace Mono.CSharp
if (pa.IsDefined && pa.ResolveBuilder ()) {
var prop = pa.GetProperty ("WrapNonExceptionThrows", TypeManager.bool_type, \
Location.Null); if (prop != null) {
- AttributeEncoder encoder = new AttributeEncoder (false);
+ AttributeEncoder encoder = new AttributeEncoder ();
encoder.EncodeNamedPropertyArgument (prop, new BoolLiteral (true, \
Location.Null)); SetCustomAttribute (pa.Constructor, encoder.ToArray ());
}
Modified: mcs/mcs/attribute.cs
===================================================================
--- a/mcs/mcs/attribute.cs
+++ b/mcs/mcs/attribute.cs
@@ -1007,75 +1007,80 @@ namespace Mono.CSharp {
return;
}
- AttributeEncoder encoder = new AttributeEncoder (false);
-
- if (PosArguments != null) {
- var param_types = ctor.Parameters.Types;
- for (int j = 0; j < PosArguments.Count; ++j) {
- var pt = param_types[j];
- var arg_expr = PosArguments[j].Expr;
- if (j == 0) {
- if (Type == predefined.IndexerName || Type == predefined.Conditional) {
- string v = ((StringConstant) arg_expr).Value;
- if (!Tokenizer.IsValidIdentifier (v) || Tokenizer.IsKeyword (v)) {
- context.Compiler.Report.Error (633, arg_expr.Location,
- "The argument to the `{0}' attribute must be a valid identifier", \
GetSignatureForError ());
- }
- } else if (Type == predefined.Guid) {
- try {
+ byte[] cdata;
+ if (PosArguments == null && named_values == null) {
+ cdata = AttributeEncoder.Empty;
+ } else {
+ AttributeEncoder encoder = new AttributeEncoder ();
+
+ if (PosArguments != null) {
+ var param_types = ctor.Parameters.Types;
+ for (int j = 0; j < PosArguments.Count; ++j) {
+ var pt = param_types[j];
+ var arg_expr = PosArguments[j].Expr;
+ if (j == 0) {
+ if (Type == predefined.IndexerName || Type == predefined.Conditional) {
string v = ((StringConstant) arg_expr).Value;
- new Guid (v);
- } catch (Exception e) {
- Error_AttributeEmitError (e.Message);
- return;
- }
- } else if (Type == predefined.AttributeUsage) {
- int v = ((IntConstant)((EnumConstant) arg_expr).Child).Value;
- if (v == 0) {
- context.Compiler.Report.Error (591, Location, "Invalid value for argument to \
`{0}' attribute",
- "System.AttributeUsage");
- }
- } else if (Type == predefined.MarshalAs) {
- if (PosArguments.Count == 1) {
- var u_type = (UnmanagedType) System.Enum.Parse (typeof (UnmanagedType), \
((Constant) PosArguments[0].Expr).GetValue ().ToString ());
- if (u_type == UnmanagedType.ByValArray && !(Owner is FieldBase)) {
- Error_AttributeEmitError ("Specified unmanaged type is only valid on \
fields"); + if (!Tokenizer.IsValidIdentifier (v) || Tokenizer.IsKeyword (v)) {
+ context.Compiler.Report.Error (633, arg_expr.Location,
+ "The argument to the `{0}' attribute must be a valid identifier", \
GetSignatureForError ()); }
+ } else if (Type == predefined.Guid) {
+ try {
+ string v = ((StringConstant) arg_expr).Value;
+ new Guid (v);
+ } catch (Exception e) {
+ Error_AttributeEmitError (e.Message);
+ return;
+ }
+ } else if (Type == predefined.AttributeUsage) {
+ int v = ((IntConstant) ((EnumConstant) arg_expr).Child).Value;
+ if (v == 0) {
+ context.Compiler.Report.Error (591, Location, "Invalid value for argument \
to `{0}' attribute", + "System.AttributeUsage");
+ }
+ } else if (Type == predefined.MarshalAs) {
+ if (PosArguments.Count == 1) {
+ var u_type = (UnmanagedType) System.Enum.Parse (typeof (UnmanagedType), \
((Constant) PosArguments[0].Expr).GetValue ().ToString ()); + if (u_type == \
UnmanagedType.ByValArray && !(Owner is FieldBase)) { \
+ Error_AttributeEmitError ("Specified unmanaged type is only valid on \
fields"); + }
+ }
+ } else if (Type == predefined.DllImport) {
+ if (PosArguments.Count == 1) {
+ var value = ((Constant) PosArguments[0].Expr).GetValue () as string;
+ if (string.IsNullOrEmpty (value))
+ Error_AttributeEmitError ("DllName cannot be empty");
+ }
+ } else if (Type == predefined.MethodImpl && pt == TypeManager.short_type &&
+ !System.Enum.IsDefined (typeof (MethodImplOptions), ((Constant) \
arg_expr).GetValue ().ToString ())) { + Error_AttributeEmitError ("Incorrect \
argument value."); + return;
}
- } else if (Type == predefined.DllImport) {
- if (PosArguments.Count == 1) {
- var value = ((Constant) PosArguments[0].Expr).GetValue () as string;
- if (string.IsNullOrEmpty (value))
- Error_AttributeEmitError ("DllName cannot be empty");
- }
- } else if (Type == predefined.MethodImpl && pt == TypeManager.short_type &&
- !System.Enum.IsDefined (typeof (MethodImplOptions), ((Constant) \
arg_expr).GetValue ().ToString ())) {
- Error_AttributeEmitError ("Incorrect argument value.");
- return;
}
- }
- arg_expr.EncodeAttributeValue (context, encoder, pt);
+ arg_expr.EncodeAttributeValue (context, encoder, pt);
+ }
}
- }
-
- if (named_values != null) {
- encoder.Stream.Write ((ushort) named_values.Count);
- foreach (var na in named_values) {
- if (na.Key is FieldExpr)
- encoder.Stream.Write ((byte) 0x53);
- else
- encoder.Stream.Write ((byte) 0x54);
- encoder.Encode (na.Key.Type);
- encoder.Encode (na.Value.Name);
- na.Value.Expr.EncodeAttributeValue (context, encoder, na.Key.Type);
+ if (named_values != null) {
+ encoder.Encode ((ushort) named_values.Count);
+ foreach (var na in named_values) {
+ if (na.Key is FieldExpr)
+ encoder.Encode ((byte) 0x53);
+ else
+ encoder.Encode ((byte) 0x54);
+
+ encoder.Encode (na.Key.Type);
+ encoder.Encode (na.Value.Name);
+ na.Value.Expr.EncodeAttributeValue (context, encoder, na.Key.Type);
+ }
+ } else {
+ encoder.EncodeEmptyNamedArguments ();
}
- } else {
- encoder.EncodeEmptyNamedArguments ();
- }
- byte[] cdata = encoder.ToArray ();
+ cdata = encoder.ToArray ();
+ }
try {
foreach (Attributable target in targets)
@@ -1349,7 +1354,7 @@ namespace Mono.CSharp {
}
}
- public struct AttributeEncoder
+ public sealed class AttributeEncoder
{
[Flags]
public enum EncodedTypeProperties
@@ -1359,101 +1364,159 @@ namespace Mono.CSharp {
TypeParameter = 1 << 1
}
- const ushort Version = 1;
-
public static readonly byte[] Empty;
- public readonly BinaryWriter Stream;
+ byte[] buffer;
+ int pos;
+ const ushort Version = 1;
static AttributeEncoder ()
{
Empty = new byte[4];
- Array.Copy (BitConverter.GetBytes (Version), Empty, 2);
+ Empty[0] = (byte) Version;
}
- public AttributeEncoder (bool empty)
+ public AttributeEncoder ()
{
- if (empty) {
- Stream = null;
- return;
- }
+ buffer = new byte[32];
+ Encode (Version);
+ }
- Stream = new BinaryWriter (new MemoryStream ());
- Stream.Write (Version);
+ public void Encode (bool value)
+ {
+ Encode (value ? (byte) 1 : (byte) 0);
}
public void Encode (byte value)
{
- Stream.Write (value);
+ if (pos == buffer.Length)
+ Grow (1);
+
+ buffer [pos++] = value;
+ }
+
+ public void Encode (sbyte value)
+ {
+ Encode ((byte) value);
}
public void Encode (short value)
{
- Stream.Write (value);
+ if (pos + 2 > buffer.Length)
+ Grow (2);
+
+ buffer[pos++] = (byte) value;
+ buffer[pos++] = (byte) (value >> 8);
+ }
+
+ public void Encode (ushort value)
+ {
+ Encode ((short) value);
}
public void Encode (int value)
{
- Stream.Write (value);
+ if (pos + 4 > buffer.Length)
+ Grow (4);
+
+ buffer[pos++] = (byte) value;
+ buffer[pos++] = (byte) (value >> 8);
+ buffer[pos++] = (byte) (value >> 16);
+ buffer[pos++] = (byte) (value >> 24);
}
public void Encode (uint value)
{
- Stream.Write (value);
+ Encode ((int) value);
+ }
+
+ public void Encode (long value)
+ {
+ if (pos + 8 > buffer.Length)
+ Grow (8);
+
+ buffer[pos++] = (byte) value;
+ buffer[pos++] = (byte) (value >> 8);
+ buffer[pos++] = (byte) (value >> 16);
+ buffer[pos++] = (byte) (value >> 24);
+ buffer[pos++] = (byte) (value >> 32);
+ buffer[pos++] = (byte) (value >> 40);
+ buffer[pos++] = (byte) (value >> 48);
+ buffer[pos++] = (byte) (value >> 56);
+ }
+
+ public void Encode (ulong value)
+ {
+ Encode ((long) value);
+ }
+
+ public void Encode (float value)
+ {
+ Encode (SingleConverter.SingleToInt32Bits (value));
+ }
+
+ public void Encode (double value)
+ {
+ Encode (BitConverter.DoubleToInt64Bits (value));
}
public void Encode (string value)
{
if (value == null) {
- Stream.Write ((byte) 0xFF);
+ Encode ((byte) 0xFF);
return;
}
var buf = Encoding.UTF8.GetBytes(value);
WriteCompressedValue (buf.Length);
- Stream.Write (buf);
+
+ if (pos + buf.Length > buffer.Length)
+ Grow (buf.Length);
+
+ Buffer.BlockCopy (buf, 0, buffer, pos, buf.Length);
+ pos += buf.Length;
}
public EncodedTypeProperties Encode (TypeSpec type)
{
if (type == TypeManager.bool_type) {
- Stream.Write ((byte) 0x02);
+ Encode ((byte) 0x02);
} else if (type == TypeManager.char_type) {
- Stream.Write ((byte) 0x03);
+ Encode ((byte) 0x03);
} else if (type == TypeManager.sbyte_type) {
- Stream.Write ((byte) 0x04);
+ Encode ((byte) 0x04);
} else if (type == TypeManager.byte_type) {
- Stream.Write ((byte) 0x05);
+ Encode ((byte) 0x05);
} else if (type == TypeManager.short_type) {
- Stream.Write ((byte) 0x06);
+ Encode ((byte) 0x06);
} else if (type == TypeManager.ushort_type) {
- Stream.Write ((byte) 0x07);
+ Encode ((byte) 0x07);
} else if (type == TypeManager.int32_type) {
- Stream.Write ((byte) 0x08);
+ Encode ((byte) 0x08);
} else if (type == TypeManager.uint32_type) {
- Stream.Write ((byte) 0x09);
+ Encode ((byte) 0x09);
} else if (type == TypeManager.int64_type) {
- Stream.Write ((byte) 0x0A);
+ Encode ((byte) 0x0A);
} else if (type == TypeManager.uint64_type) {
- Stream.Write ((byte) 0x0B);
+ Encode ((byte) 0x0B);
} else if (type == TypeManager.float_type) {
- Stream.Write ((byte) 0x0C);
+ Encode ((byte) 0x0C);
} else if (type == TypeManager.double_type) {
- Stream.Write ((byte) 0x0D);
+ Encode ((byte) 0x0D);
} else if (type == TypeManager.string_type) {
- Stream.Write ((byte) 0x0E);
+ Encode ((byte) 0x0E);
} else if (type == TypeManager.type_type) {
- Stream.Write ((byte) 0x50);
+ Encode ((byte) 0x50);
} else if (type == TypeManager.object_type) {
- Stream.Write ((byte) 0x51);
+ Encode ((byte) 0x51);
} else if (TypeManager.IsEnumType (type)) {
- Stream.Write ((byte) 0x55);
+ Encode ((byte) 0x55);
EncodeTypeName (type);
} else if (type.IsArray) {
- Stream.Write ((byte) 0x1D);
+ Encode ((byte) 0x1D);
return Encode (TypeManager.GetElementType (type));
} else if (type == InternalType.Dynamic) {
- Stream.Write ((byte) 0x51);
+ Encode ((byte) 0x51);
return EncodedTypeProperties.DynamicType;
}
@@ -1471,8 +1534,8 @@ namespace Mono.CSharp {
//
public void EncodeNamedPropertyArgument (PropertySpec property, Constant value)
{
- Stream.Write ((ushort) 1); // length
- Stream.Write ((byte) 0x54); // property
+ Encode ((ushort) 1); // length
+ Encode ((byte) 0x54); // property
Encode (property.MemberType);
Encode (property.Name);
value.EncodeAttributeValue (null, this, property.MemberType);
@@ -1483,8 +1546,8 @@ namespace Mono.CSharp {
//
public void EncodeNamedFieldArgument (FieldSpec field, Constant value)
{
- Stream.Write ((ushort) 1); // length
- Stream.Write ((byte) 0x53); // field
+ Encode ((ushort) 1); // length
+ Encode ((byte) 0x53); // field
Encode (field.MemberType);
Encode (field.Name);
value.EncodeAttributeValue (null, this, field.MemberType);
@@ -1492,16 +1555,16 @@ namespace Mono.CSharp {
public void EncodeNamedArguments<T> (T[] members, Constant[] values) where T : \
MemberSpec, IInterfaceMemberSpec {
- Stream.Write ((ushort) members.Length);
+ Encode ((ushort) members.Length);
for (int i = 0; i < members.Length; ++i)
{
var member = members[i];
if (member.Kind == MemberKind.Field)
- Stream.Write ((byte) 0x53);
+ Encode ((byte) 0x53);
else if (member.Kind == MemberKind.Property)
- Stream.Write ((byte) 0x54);
+ Encode ((byte) 0x54);
else
throw new NotImplementedException (member.Kind.ToString ());
@@ -1513,28 +1576,36 @@ namespace Mono.CSharp {
public void EncodeEmptyNamedArguments ()
{
- Stream.Write ((ushort) 0);
+ Encode ((ushort) 0);
+ }
+
+ void Grow (int inc)
+ {
+ int size = System.Math.Max (pos * 4, pos + inc + 2);
+ Array.Resize (ref buffer, size);
}
void WriteCompressedValue (int value)
{
if (value < 0x80) {
- Stream.Write ((byte) value);
+ Encode ((byte) value);
return;
}
if (value < 0x4000) {
- Stream.Write ((byte) (0x80 | (value >> 8)));
- Stream.Write ((byte) value);
+ Encode ((byte) (0x80 | (value >> 8)));
+ Encode ((byte) value);
return;
}
- Stream.Write (value);
+ Encode (value);
}
public byte[] ToArray ()
{
- return ((MemoryStream) Stream.BaseStream).ToArray ();
+ byte[] buf = new byte[pos];
+ Array.Copy (buffer, buf, pos);
+ return buf;
}
}
@@ -1904,7 +1975,7 @@ namespace Mono.CSharp {
return;
int[] bits = decimal.GetBits (value);
- AttributeEncoder encoder = new AttributeEncoder (false);
+ AttributeEncoder encoder = new AttributeEncoder ();
encoder.Encode ((byte) (bits[3] >> 16));
encoder.Encode ((byte) (bits[3] >> 31));
encoder.Encode ((uint) bits[2]);
@@ -1924,7 +1995,7 @@ namespace Mono.CSharp {
return;
int[] bits = decimal.GetBits (value);
- AttributeEncoder encoder = new AttributeEncoder (false);
+ AttributeEncoder encoder = new AttributeEncoder ();
encoder.Encode ((byte) (bits[3] >> 16));
encoder.Encode ((byte) (bits[3] >> 31));
encoder.Encode ((uint) bits[2]);
Modified: mcs/mcs/class.cs
===================================================================
--- a/mcs/mcs/class.cs
+++ b/mcs/mcs/class.cs
@@ -1632,7 +1632,7 @@ namespace Mono.CSharp {
!pa.ResolveConstructor (Location, TypeManager.string_type))
return;
- var encoder = new AttributeEncoder (false);
+ var encoder = new AttributeEncoder ();
encoder.Encode (GetAttributeDefaultMember ());
encoder.EncodeEmptyNamedArguments ();
Modified: mcs/mcs/constant.cs
===================================================================
--- a/mcs/mcs/constant.cs
+++ b/mcs/mcs/constant.cs
@@ -352,7 +352,7 @@ namespace Mono.CSharp {
public override void EncodeAttributeValue (IMemberContext rc, AttributeEncoder \
enc, TypeSpec targetType) {
- enc.Stream.Write (Value);
+ enc.Encode (Value);
}
public override void Emit (EmitContext ec)
@@ -397,7 +397,7 @@ namespace Mono.CSharp {
public override void EncodeAttributeValue (IMemberContext rc, AttributeEncoder \
enc, TypeSpec targetType) {
- enc.Stream.Write (Value);
+ enc.Encode (Value);
}
public override void Emit (EmitContext ec)
@@ -502,7 +502,7 @@ namespace Mono.CSharp {
public override void EncodeAttributeValue (IMemberContext rc, AttributeEncoder \
enc, TypeSpec targetType) {
- enc.Stream.Write ((ushort) Value);
+ enc.Encode ((ushort) Value);
}
public override void Emit (EmitContext ec)
@@ -626,7 +626,7 @@ namespace Mono.CSharp {
public override void EncodeAttributeValue (IMemberContext rc, AttributeEncoder \
enc, TypeSpec targetType) {
- enc.Stream.Write (Value);
+ enc.Encode (Value);
}
public override void Emit (EmitContext ec)
@@ -732,7 +732,7 @@ namespace Mono.CSharp {
public override void EncodeAttributeValue (IMemberContext rc, AttributeEncoder \
enc, TypeSpec targetType) {
- enc.Stream.Write (Value);
+ enc.Encode (Value);
}
public override void Emit (EmitContext ec)
@@ -850,7 +850,7 @@ namespace Mono.CSharp {
public override void EncodeAttributeValue (IMemberContext rc, AttributeEncoder \
enc, TypeSpec targetType) {
- enc.Stream.Write (Value);
+ enc.Encode (Value);
}
public override void Emit (EmitContext ec)
@@ -962,7 +962,7 @@ namespace Mono.CSharp {
public override void EncodeAttributeValue (IMemberContext rc, AttributeEncoder \
enc, TypeSpec targetType) {
- enc.Stream.Write (Value);
+ enc.Encode (Value);
}
public override void Emit (EmitContext ec)
@@ -1143,7 +1143,7 @@ namespace Mono.CSharp {
public override void EncodeAttributeValue (IMemberContext rc, AttributeEncoder \
enc, TypeSpec targetType) {
- enc.Stream.Write (Value);
+ enc.Encode (Value);
}
public override void Emit (EmitContext ec)
@@ -1266,7 +1266,7 @@ namespace Mono.CSharp {
public override void EncodeAttributeValue (IMemberContext rc, AttributeEncoder \
enc, TypeSpec targetType) {
- enc.Stream.Write (Value);
+ enc.Encode (Value);
}
public override void Emit (EmitContext ec)
@@ -1405,7 +1405,7 @@ namespace Mono.CSharp {
public override void EncodeAttributeValue (IMemberContext rc, AttributeEncoder \
enc, TypeSpec targetType) {
- enc.Stream.Write (Value);
+ enc.Encode (Value);
}
public override void Emit (EmitContext ec)
@@ -1522,7 +1522,7 @@ namespace Mono.CSharp {
public override void EncodeAttributeValue (IMemberContext rc, AttributeEncoder \
enc, TypeSpec targetType) {
- enc.Stream.Write (Value);
+ enc.Encode (Value);
}
public override void Emit (EmitContext ec)
@@ -1645,7 +1645,7 @@ namespace Mono.CSharp {
public override void EncodeAttributeValue (IMemberContext rc, AttributeEncoder \
enc, TypeSpec targetType) {
- enc.Stream.Write (Value);
+ enc.Encode (Value);
}
public override void Emit (EmitContext ec)
@@ -2004,9 +2004,9 @@ namespace Mono.CSharp {
if (ac.Rank != 1 || ac.Element.IsArray)
base.EncodeAttributeValue (rc, enc, targetType);
else
- enc.Stream.Write (uint.MaxValue);
+ enc.Encode (uint.MaxValue);
} else {
- enc.Stream.Write (byte.MaxValue);
+ enc.Encode (byte.MaxValue);
}
}
Modified: mcs/mcs/expression.cs
===================================================================
--- a/mcs/mcs/expression.cs
+++ b/mcs/mcs/expression.cs
@@ -6609,13 +6609,13 @@ namespace Mono.CSharp
if (ic == null || !ic.IsDefaultValue) {
base.EncodeAttributeValue (rc, enc, targetType);
} else {
- enc.Stream.Write (0);
+ enc.Encode (0);
}
return;
}
- enc.Stream.Write ((int) array_data.Count);
+ enc.Encode (array_data.Count);
foreach (var element in array_data) {
element.EncodeAttributeValue (rc, enc, array_element_type);
}
Modified: mcs/mcs/field.cs
===================================================================
--- a/mcs/mcs/field.cs
+++ b/mcs/mcs/field.cs
@@ -477,7 +477,7 @@ namespace Mono.CSharp
var char_set = CharSet ?? Module.DefaultCharSet;
- encoder = new AttributeEncoder (false);
+ encoder = new AttributeEncoder ();
encoder.Encode ((short)LayoutKind.Sequential);
encoder.EncodeNamedArguments (
new [] { field_size, field_charset },
@@ -496,7 +496,7 @@ namespace Mono.CSharp
if (pa.Constructor == null && !pa.ResolveConstructor (Location, \
TypeManager.type_type, TypeManager.int32_type)) return;
- encoder = new AttributeEncoder (false);
+ encoder = new AttributeEncoder ();
encoder.EncodeTypeName (MemberType);
encoder.Encode (buffer_size);
encoder.EncodeEmptyNamedArguments ();
Modified: mcs/mcs/reflection.cs
===================================================================
--- a/mcs/mcs/reflection.cs
+++ b/mcs/mcs/reflection.cs
@@ -184,6 +184,22 @@ namespace Mono.CSharp
}
}
+ [System.Runtime.InteropServices.StructLayout \
(System.Runtime.InteropServices.LayoutKind.Explicit)] + struct SingleConverter
+ {
+ [System.Runtime.InteropServices.FieldOffset (0)]
+ int i;
+ [System.Runtime.InteropServices.FieldOffset (0)]
+ float f;
+
+ public static int SingleToInt32Bits (float v)
+ {
+ SingleConverter c = new SingleConverter ();
+ c.f = v;
+ return c.i;
+ }
+ }
+
#endif
public class AssemblyDefinitionDynamic : AssemblyDefinition
Modified: mcs/mcs/roottypes.cs
===================================================================
--- a/mcs/mcs/roottypes.cs
+++ b/mcs/mcs/roottypes.cs
@@ -73,7 +73,7 @@ namespace Mono.CSharp
var pa = Module.PredefinedAttributes.StructLayout;
if (pa.Constructor != null || pa.ResolveConstructor (Location, \
TypeManager.short_type)) {
- var argsEncoded = new AttributeEncoder (false);
+ var argsEncoded = new AttributeEncoder ();
argsEncoded.Encode ((short) LayoutKind.Explicit);
var field_size = pa.GetField ("Size", TypeManager.int32_type, Location);
Commit: 450b15885dfc5825a7a1b4b5689e76bd6e4a9bd3
Author: Marek Safar <marek.safar@gmail.com>
Date: 01/24/2011 09:04:41
URL: https://github.com/mono/mono/commit/450b15885dfc5825a7a1b4b5689e76bd6e4a9bd3
[666476] Use correct parameter count when checking ambiguous params methods
Changed paths:
M mcs/mcs/ecore.cs
Added paths:
A mcs/errors/cs0121-20.cs
Modified: mcs/mcs/ecore.cs
===================================================================
--- a/mcs/mcs/ecore.cs
+++ b/mcs/mcs/ecore.cs
@@ -3688,7 +3688,7 @@ namespace Mono.CSharp {
var best_def_pd = ((IParametersMember) best.MemberDefinition).Parameters;
bool specific_at_least_once = false;
- for (j = 0; j < candidate_param_count; ++j) {
+ for (j = 0; j < args_count; ++j) {
NamedArgument na = args_count == 0 ? null : args [j] as NamedArgument;
if (na != null) {
ct = candidate_def_pd.Types[cparam.GetParameterIndexByName (na.Name)];
Added: mcs/errors/cs0121-20.cs
===================================================================
--- /dev/null
+++ b/mcs/errors/cs0121-20.cs
@@ -0,0 +1,19 @@
+// CS0121: The call is ambiguous between the following methods or properties: \
`Test.Foo(string, params object[])' and `Test.Foo(string, params int[])' +// Line: 16
+
+public class Test
+{
+ static void Foo (string s, params object[] args)
+ {
+ }
+
+ static void Foo (string s, params int[] args)
+ {
+ }
+
+ public static void Main ()
+ {
+ Foo ("a");
+ }
+}
+
Commit: a87db2525231a4eaadaae1b78a25f4f24b234bdf
Author: Marek Habersack <grendel@twistedcode.net>
Date: 01/24/2011 09:30:47
URL: https://github.com/mono/mono/commit/a87db2525231a4eaadaae1b78a25f4f24b234bdf
[asp.net] Avoid passing duplicate assemblies on mcs command line.
Changed paths:
M mcs/class/System.Web/System.Web.Compilation/AppCodeCompiler.cs
M mcs/class/System.Web/System.Web.Compilation/AssemblyBuilder.cs
M mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/WebTest.cs
Modified: mcs/class/System.Web/System.Web.Compilation/AppCodeCompiler.cs
===================================================================
--- a/mcs/class/System.Web/System.Web.Compilation/AppCodeCompiler.cs
+++ b/mcs/class/System.Web/System.Web.Compilation/AppCodeCompiler.cs
@@ -34,6 +34,7 @@ using System.CodeDom.Compiler;
using System.Configuration;
using System.Collections;
using System.Collections.Generic;
+using System.Collections.Specialized;
using System.Globalization;
using System.IO;
using System.Reflection;
@@ -80,8 +81,9 @@ namespace System.Web.Compilation
if (asm == null)
throw new HttpException (String.Format ("Unable to find assembly {0}", \
assemblyName), error);
- assemblyCache.Add (assemblyName, asm.Location);
- return asm.Location;
+ string path = new Uri (asm.CodeBase).LocalPath;
+ assemblyCache.Add (assemblyName, path);
+ return path;
}
}
}
@@ -221,8 +223,15 @@ namespace System.Web.Compilation
CompilerParameters parameters = compilerInfo.CreateDefaultCompilerParameters ();
parameters.IncludeDebugInformation = compilationSection.Debug;
- if (binAssemblies != null && binAssemblies.Length > 0)
- parameters.ReferencedAssemblies.AddRange (binAssemblies);
+ if (binAssemblies != null && binAssemblies.Length > 0) {
+ StringCollection parmRefAsm = parameters.ReferencedAssemblies;
+ foreach (string binAsm in binAssemblies) {
+ if (parmRefAsm.Contains (binAsm))
+ continue;
+
+ parmRefAsm.Add (binAsm);
+ }
+ }
if (compilationSection != null) {
foreach (AssemblyInfo ai in compilationSection.Assemblies)
Modified: mcs/class/System.Web/System.Web.Compilation/AssemblyBuilder.cs
===================================================================
--- a/mcs/class/System.Web/System.Web.Compilation/AssemblyBuilder.cs
+++ b/mcs/class/System.Web/System.Web.Compilation/AssemblyBuilder.cs
@@ -740,7 +740,6 @@ namespace System.Web.Compilation
{
if (options == null)
throw new ArgumentNullException ("options");
-
options.TempFiles = temp_files;
if (options.OutputAssembly == null)
options.OutputAssembly = OutputAssemblyName;
@@ -797,9 +796,12 @@ namespace System.Web.Compilation
options.EmbeddedResources.Add (de.Value);
AddAssemblyReference (BuildManager.GetReferencedAssemblies ());
+ StringCollection optRefAsm = options.ReferencedAssemblies;
foreach (Assembly refasm in ReferencedAssemblies) {
string path = new Uri (refasm.CodeBase).LocalPath;
- options.ReferencedAssemblies.Add (path);
+ string originalPath = refasm.Location;
+ if (!optRefAsm.Contains (path) && !optRefAsm.Contains (originalPath))
+ optRefAsm.Add (path);
}
results = provider.CompileAssemblyFromFile (options, files.ToArray ());
Modified: mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/WebTest.cs
===================================================================
--- a/mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/WebTest.cs
+++ b/mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/WebTest.cs
@@ -544,7 +544,7 @@ namespace MonoTests.SystemWeb.Framework
private static void CopyAssembly (Assembly ass, string dir)
{
- if (ass.GlobalAssemblyCache)
+ if (ass.GlobalAssemblyCache || ass.FullName.StartsWith ("mscorlib"))
return;
string oldfn = ass.Location;
if (oldfn.EndsWith (".exe"))
Commit: 2d2834e4bcc3578b7632bc4066d3ccb134f1e27d
Author: Marek Habersack <grendel@twistedcode.net>
Date: 01/24/2011 09:30:53
URL: https://github.com/mono/mono/commit/2d2834e4bcc3578b7632bc4066d3ccb134f1e27d
[asp.net] Global.asax assembly must be passed as reference when compiling. \
BuildManager.GetType improvements.
When user has their own global application class (global.asax is present) the \
assembly produced from it must be passed as reference to the compiler.
BuildManager.GetType now supports fully-qualified type names for 'typeName' and \
searches for the type in the top-level assemblies, the global.asax assembly and in \
the assemblies specified in as references in web.config.
All of this fixes certain MVC3+Razor applications.
Changed paths:
M mcs/class/System.Web/System.Web.Compilation/AssemblyBuilder.cs
M mcs/class/System.Web/System.Web.Compilation/BuildManager.cs
M mcs/class/System.Web/Test/System.Web.Compilation/BuildManagerTest.cs
Modified: mcs/class/System.Web/System.Web.Compilation/AssemblyBuilder.cs
===================================================================
--- a/mcs/class/System.Web/System.Web.Compilation/AssemblyBuilder.cs
+++ b/mcs/class/System.Web/System.Web.Compilation/AssemblyBuilder.cs
@@ -796,13 +796,20 @@ namespace System.Web.Compilation
options.EmbeddedResources.Add (de.Value);
AddAssemblyReference (BuildManager.GetReferencedAssemblies ());
+ List <Assembly> referencedAssemblies = ReferencedAssemblies;
StringCollection optRefAsm = options.ReferencedAssemblies;
+ Type appType = HttpApplicationFactory.AppType;
+ if (appType != null && !referencedAssemblies.Contains (appType.Assembly))
+ referencedAssemblies.Add (appType.Assembly);
+
foreach (Assembly refasm in ReferencedAssemblies) {
string path = new Uri (refasm.CodeBase).LocalPath;
string originalPath = refasm.Location;
if (!optRefAsm.Contains (path) && !optRefAsm.Contains (originalPath))
optRefAsm.Add (path);
}
+
+
results = provider.CompileAssemblyFromFile (options, files.ToArray ());
Modified: mcs/class/System.Web/System.Web.Compilation/BuildManager.cs
===================================================================
--- a/mcs/class/System.Web/System.Web.Compilation/BuildManager.cs
+++ b/mcs/class/System.Web/System.Web.Compilation/BuildManager.cs
@@ -1147,20 +1147,61 @@ namespace System.Web.Compilation
{
return GetType (typeName, throwOnError, false);
}
-
+
public static Type GetType (string typeName, bool throwOnError, bool ignoreCase)
{
+ if (String.IsNullOrEmpty (typeName))
+ throw new HttpException ("Type name must not be empty.");
+
Type ret = null;
+ Exception ex = null;
try {
- foreach (Assembly asm in TopLevel_Assemblies) {
- ret = asm.GetType (typeName, throwOnError, ignoreCase);
+ string wantedAsmName;
+ string wantedTypeName;
+ int comma = typeName.IndexOf (',');
+
+ if (comma > 0 && comma < typeName.Length - 1) {
+ var aname = new AssemblyName (typeName.Substring (comma + 1));
+ wantedAsmName = aname.ToString ();
+ wantedTypeName = typeName.Substring (0, comma);
+ } else {
+ wantedAsmName = null;
+ wantedTypeName = typeName;
+ }
+
+ var assemblies = new List <Assembly> ();
+ assemblies.AddRange (BuildManager.GetReferencedAssemblies () as List \
<Assembly>); + assemblies.AddRange (TopLevel_Assemblies);
+ Type appType = HttpApplicationFactory.AppType;
+ if (appType != null)
+ assemblies.Add (appType.Assembly);
+
+ foreach (Assembly asm in assemblies) {
+ if (asm == null)
+ continue;
+
+ if (wantedAsmName != null) {
+ // So dumb...
+ if (String.Compare (wantedAsmName, asm.GetName ().ToString (), \
StringComparison.Ordinal) == 0) { + ret = asm.GetType (wantedTypeName, \
throwOnError, ignoreCase); + if (ret != null)
+ return ret;
+ }
+ continue;
+ }
+
+ ret = asm.GetType (wantedTypeName, false, ignoreCase);
if (ret != null)
- break;
+ return ret;
}
- } catch (Exception ex) {
- throw new HttpException ("Failed to find the specified type.", ex);
+ } catch (Exception e) {
+ ex = e;
}
- return ret;
+
+ if (throwOnError)
+ throw new HttpException ("Failed to find the specified type.", ex);
+
+ return null;
}
public static ICollection GetVirtualPathDependencies (string virtualPath)
@@ -1422,11 +1463,11 @@ namespace System.Web.Compilation
if (suppressDebugModeMessages)
return;
- Console.WriteLine ();
- Console.WriteLine ("******* DEBUG MODE MESSAGE *******");
- Console.WriteLine (msg);
- Console.WriteLine ("******* DEBUG MODE MESSAGE *******");
- Console.WriteLine ();
+ Console.Error.WriteLine ();
+ Console.Error.WriteLine ("******* DEBUG MODE MESSAGE *******");
+ Console.Error.WriteLine (msg);
+ Console.Error.WriteLine ("******* DEBUG MODE MESSAGE *******");
+ Console.Error.WriteLine ();
}
static void StoreInCache (BuildProvider bp, Assembly compiledAssembly, \
CompilerResults results)
Modified: mcs/class/System.Web/Test/System.Web.Compilation/BuildManagerTest.cs
===================================================================
--- a/mcs/class/System.Web/Test/System.Web.Compilation/BuildManagerTest.cs
+++ b/mcs/class/System.Web/Test/System.Web.Compilation/BuildManagerTest.cs
@@ -43,6 +43,7 @@ namespace MonoTests.System.Web.Compilation
{
#if NET_4_0
[Test]
+ [Ignore ("Pending investigation if it is indeed the correct test.")]
public void GetGlobalAsaxType ()
{
AssertExtensions.Throws<InvalidOperationException> (() => {
Commit: b57515aa5a59e0a232ad7c4918e0fe9b1953e67f
Author: Jérémie Laval <jeremie.laval@gmail.com>
Date: 01/24/2011 09:33:57
URL: https://github.com/mono/mono/commit/b57515aa5a59e0a232ad7c4918e0fe9b1953e67f
Make sure a synchronous continuation get executed synchronously in all cases
Changed paths:
M mcs/class/corlib/System.Threading.Tasks/Task.cs
Modified: mcs/class/corlib/System.Threading.Tasks/Task.cs
===================================================================
--- a/mcs/class/corlib/System.Threading.Tasks/Task.cs
+++ b/mcs/class/corlib/System.Threading.Tasks/Task.cs
@@ -329,8 +329,7 @@ namespace System.Threading.Tasks
void CheckAndSchedule (Task continuation, TaskContinuationOptions options, \
TaskScheduler scheduler, bool fromCaller) {
- if (!fromCaller
- && (options & TaskContinuationOptions.ExecuteSynchronously) > 0)
+ if ((options & TaskContinuationOptions.ExecuteSynchronously) > 0)
continuation.ThreadStart ();
else
continuation.Start (scheduler);
Commit: 9bcbd52f031ac7de6966a85cd7d16fbe02e3c79c
Author: Jérémie Laval <jeremie.laval@gmail.com>
Date: 01/24/2011 10:01:20
URL: https://github.com/mono/mono/commit/9bcbd52f031ac7de6966a85cd7d16fbe02e3c79c
Add WebMatrix.Data assembly skeleton
Changed paths:
M mcs/class/Makefile
Added paths:
A mcs/class/WebMatrix.Data/Assembly/AssemblyInfo.cs
A mcs/class/WebMatrix.Data/Makefile
A mcs/class/WebMatrix.Data/Test/WebMatrix.Data/ConnectionEventArgsTests.cs
A mcs/class/WebMatrix.Data/WebMatrix.Data.dll.sources
A mcs/class/WebMatrix.Data/WebMatrix.Data/ConnectionEventArgs.cs
A mcs/class/WebMatrix.Data/WebMatrix.Data_test.dll.sources
Modified: mcs/class/Makefile
===================================================================
--- a/mcs/class/Makefile
+++ b/mcs/class/Makefile
@@ -164,7 +164,8 @@ net_4_0_dirs := \
System.Runtime.Caching \
System.Runtime.DurableInstancing \
Mono.CodeContracts \
- Microsoft.Web.Infrastructure
+ Microsoft.Web.Infrastructure \
+ WebMatrix.Data
net_2_0_SUBDIRS := $(common_dirs) $(net_2_0_dirs) $(net_2_0_only_dirs)
moonlight_raw_SUBDIRS := $(moonlight_dirs)
Added: mcs/class/WebMatrix.Data/Assembly/AssemblyInfo.cs
===================================================================
--- /dev/null
+++ b/mcs/class/WebMatrix.Data/Assembly/AssemblyInfo.cs
@@ -0,0 +1,19 @@
+//
+// AssemblyInfo.cs
+//
+// Author:
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+// (C) 2003 Ximian, Inc. http://www.ximian.com
+// (C) 2004 Novell (http://www.novell.com)
+//
+
+using System;
+using System.Reflection;
+using System.Runtime.InteropServices;
+
+[assembly: AssemblyVersion (Consts.FxVersion)]
+
+[assembly: AssemblyDelaySign (true)]
+[assembly: AssemblyKeyFile ("../mono.pub")]
+
Added: mcs/class/WebMatrix.Data/Makefile
===================================================================
--- /dev/null
+++ b/mcs/class/WebMatrix.Data/Makefile
@@ -0,0 +1,11 @@
+thisdir = class/WebMatrix.Data
+SUBDIRS =
+include ../../build/rules.make
+
+LIBRARY = WebMatrix.Data.dll
+
+include ../../build/library.make
+
+LIB_MCS_FLAGS += -r:$(corlib) -r:System.dll -r:System.Data.dll
+TEST_MCS_FLAGS += -r:System.dll -r:System.Data.dll
+
Added: mcs/class/WebMatrix.Data/Test/WebMatrix.Data/ConnectionEventArgsTests.cs
===================================================================
--- /dev/null
+++ b/mcs/class/WebMatrix.Data/Test/WebMatrix.Data/ConnectionEventArgsTests.cs
@@ -0,0 +1,54 @@
+//
+// ConnectionEventArgsTests.cs
+//
+// Author:
+// J??r??mie "garuma" Laval <jeremie.laval@gmail.com>
+//
+// Copyright (c) 2011 Novell
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#if NET_4_0
+
+using System;
+using System.Data.Common;
+using System.Data.SqlClient;
+
+using WebMatrix.Data;
+
+using NUnit.Framework;
+
+namespace MonoTests.WebMatrix.Data
+{
+ [TestFixtureAttribute]
+ public class ConnectionEventArgsTests
+ {
+ [Test]
+ public void InstantiateTest ()
+ {
+ var evtArgs = new ConnectionEventArgs (null);
+ Assert.IsNull (evtArgs.Connection, "#1");
+
+ var conn = new SqlConnection ();
+ evtArgs = new ConnectionEventArgs (conn);
+ Assert.AreEqual (conn, evtArgs.Connection, "#2");
+ }
+ }
+}
+#endif
Added: mcs/class/WebMatrix.Data/WebMatrix.Data.dll.sources
===================================================================
--- /dev/null
+++ b/mcs/class/WebMatrix.Data/WebMatrix.Data.dll.sources
@@ -0,0 +1,5 @@
+../../build/common/Consts.cs
+../../build/common/Locale.cs
+Assembly/AssemblyInfo.cs
+WebMatrix.Data/ConnectionEventArgs.cs
+
Added: mcs/class/WebMatrix.Data/WebMatrix.Data/ConnectionEventArgs.cs
===================================================================
--- /dev/null
+++ b/mcs/class/WebMatrix.Data/WebMatrix.Data/ConnectionEventArgs.cs
@@ -0,0 +1,48 @@
+// ConnectionEventArgs.cs
+//
+// Copyright (c) 2011 Novell
+//
+// Authors:
+// J??r??mie "garuma" Laval
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+
+#if NET_4_0
+
+using System;
+using System.Data.Common;
+
+namespace WebMatrix.Data
+{
+ public class ConnectionEventArgs : EventArgs
+ {
+ public ConnectionEventArgs (DbConnection connection)
+ {
+ Connection = connection;
+ }
+
+ public DbConnection Connection {
+ get;
+ private set;
+ }
+ }
+}
+
+#endif
Added: mcs/class/WebMatrix.Data/WebMatrix.Data_test.dll.sources
===================================================================
--- /dev/null
+++ b/mcs/class/WebMatrix.Data/WebMatrix.Data_test.dll.sources
@@ -0,0 +1,2 @@
+WebMatrix.Data/ConnectionEventArgsTests.cs
+
Commit: 77908fc88a7ac38069a2fa25269a477780c4629b
Author: Jérémie Laval <jeremie.laval@gmail.com>
Date: 01/24/2011 10:04:53
URL: https://github.com/mono/mono/commit/77908fc88a7ac38069a2fa25269a477780c4629b
Stub DynamicRecord
Changed paths:
M mcs/class/WebMatrix.Data/Makefile
M mcs/class/WebMatrix.Data/WebMatrix.Data.dll.sources
M mcs/class/WebMatrix.Data/WebMatrix.Data/ConnectionEventArgs.cs
Added paths:
A mcs/class/WebMatrix.Data/WebMatrix.Data/DynamicRecord.cs
Modified: mcs/class/WebMatrix.Data/Makefile
===================================================================
--- a/mcs/class/WebMatrix.Data/Makefile
+++ b/mcs/class/WebMatrix.Data/Makefile
@@ -6,5 +6,5 @@ LIBRARY = WebMatrix.Data.dll
include ../../build/library.make
-LIB_MCS_FLAGS += -r:$(corlib) -r:System.dll -r:System.Data.dll
+LIB_MCS_FLAGS += -r:$(corlib) -r:System.dll -r:System.Data.dll -r:System.Core.dll
TEST_MCS_FLAGS += -r:System.dll -r:System.Data.dll
Modified: mcs/class/WebMatrix.Data/WebMatrix.Data.dll.sources
===================================================================
--- a/mcs/class/WebMatrix.Data/WebMatrix.Data.dll.sources
+++ b/mcs/class/WebMatrix.Data/WebMatrix.Data.dll.sources
@@ -2,3 +2,4 @@
../../build/common/Locale.cs
Assembly/AssemblyInfo.cs
WebMatrix.Data/ConnectionEventArgs.cs
+WebMatrix.Data/DynamicRecord.cs
Modified: mcs/class/WebMatrix.Data/WebMatrix.Data/ConnectionEventArgs.cs
===================================================================
--- a/mcs/class/WebMatrix.Data/WebMatrix.Data/ConnectionEventArgs.cs
+++ b/mcs/class/WebMatrix.Data/WebMatrix.Data/ConnectionEventArgs.cs
@@ -1,3 +1,4 @@
+//
// ConnectionEventArgs.cs
//
// Copyright (c) 2011 Novell
Added: mcs/class/WebMatrix.Data/WebMatrix.Data/DynamicRecord.cs
===================================================================
--- /dev/null
+++ b/mcs/class/WebMatrix.Data/WebMatrix.Data/DynamicRecord.cs
@@ -0,0 +1,134 @@
+//
+// DynamicRecord.cs
+//
+// Copyright (c) 2011 Novell
+//
+// Authors:
+// J??r??mie "garuma" Laval
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+
+#if NET_4_0
+
+using System;
+using System.Dynamic;
+using System.Data.Common;
+using System.Collections.Generic;
+using System.ComponentModel;
+
+namespace WebMatrix.Data
+{
+ public sealed class DynamicRecord : DynamicObject, ICustomTypeDescriptor
+ {
+ internal DynamicRecord ()
+ {
+ }
+
+ public IList<string> Columns {
+ get;
+ private set;
+ }
+
+ public dynamic this[string name] {
+ get {
+ return null;
+ }
+ }
+
+ public dynamic this[int index] {
+ get {
+ return null;
+ }
+ }
+
+ public override IEnumerable<string> GetDynamicMemberNames ()
+ {
+ return null;
+ }
+
+ public override bool TryGetMember (GetMemberBinder binder, out object result)
+ {
+ result = null;
+ return false;
+ }
+
+ AttributeCollection ICustomTypeDescriptor.GetAttributes ()
+ {
+ return null;
+ }
+
+ string ICustomTypeDescriptor.GetClassName ()
+ {
+ return null;
+ }
+
+ string ICustomTypeDescriptor.GetComponentName ()
+ {
+ return null;
+ }
+
+ TypeConverter ICustomTypeDescriptor.GetConverter ()
+ {
+ return null;
+ }
+
+ EventDescriptor ICustomTypeDescriptor.GetDefaultEvent ()
+ {
+ return null;
+ }
+
+ PropertyDescriptor ICustomTypeDescriptor.GetDefaultProperty ()
+ {
+ return null;
+ }
+
+ Object ICustomTypeDescriptor.GetEditor (Type editorBaseType)
+ {
+ return null;
+ }
+
+ Object ICustomTypeDescriptor.GetPropertyOwner (PropertyDescriptor pd)
+ {
+ return null;
+ }
+
+ EventDescriptorCollection ICustomTypeDescriptor.GetEvents ()
+ {
+ return null;
+ }
+
+ EventDescriptorCollection ICustomTypeDescriptor.GetEvents (Attribute[] attributes)
+ {
+ return null;
+ }
+
+ PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties ()
+ {
+ return null;
+ }
+
+ PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties (Attribute[] \
attributes) + {
+ return null;
+ }
+ }
+}
+
+#endif
Commit: 784198d66ac099a9e37bfc9b2ef4f91d80a377f8
Author: Jérémie Laval <jeremie.laval@gmail.com>
Date: 01/24/2011 10:05:50
URL: https://github.com/mono/mono/commit/784198d66ac099a9e37bfc9b2ef4f91d80a377f8
Complete base DynamicRecord API
Changed paths:
M mcs/class/WebMatrix.Data/WebMatrix.Data/DynamicRecord.cs
Modified: mcs/class/WebMatrix.Data/WebMatrix.Data/DynamicRecord.cs
===================================================================
--- a/mcs/class/WebMatrix.Data/WebMatrix.Data/DynamicRecord.cs
+++ b/mcs/class/WebMatrix.Data/WebMatrix.Data/DynamicRecord.cs
@@ -37,8 +37,12 @@ namespace WebMatrix.Data
{
public sealed class DynamicRecord : DynamicObject, ICustomTypeDescriptor
{
- internal DynamicRecord ()
+ readonly Dictionary<string, object> fields;
+
+ internal DynamicRecord (Dictionary<string, object> fields)
{
+ this.fields = fields;
+ Columns = fields.Keys;
}
public IList<string> Columns {
@@ -46,27 +50,26 @@ namespace WebMatrix.Data
private set;
}
- public dynamic this[string name] {
+ public object this[string name] {
get {
- return null;
+ return fields[name];
}
}
- public dynamic this[int index] {
- get {
- return null;
+ public object this[int index] {
+ get {
+ return fields.Keys[index];
}
}
public override IEnumerable<string> GetDynamicMemberNames ()
{
- return null;
+ return Columns;
}
public override bool TryGetMember (GetMemberBinder binder, out object result)
{
- result = null;
- return false;
+ return fields.TryGetValue (binder.Name, out result);
}
AttributeCollection ICustomTypeDescriptor.GetAttributes ()
Commit: 1b4eee0534bf29f6152e582425172af58b9a1b03
Author: Jérémie Laval <jeremie.laval@gmail.com>
Date: 01/24/2011 10:05:51
URL: https://github.com/mono/mono/commit/1b4eee0534bf29f6152e582425172af58b9a1b03
Add Database type
Changed paths:
M mcs/class/WebMatrix.Data/Makefile
M mcs/class/WebMatrix.Data/WebMatrix.Data.dll.sources
Added paths:
A mcs/class/WebMatrix.Data/WebMatrix.Data/Database.cs
Modified: mcs/class/WebMatrix.Data/Makefile
===================================================================
--- a/mcs/class/WebMatrix.Data/Makefile
+++ b/mcs/class/WebMatrix.Data/Makefile
@@ -6,5 +6,5 @@ LIBRARY = WebMatrix.Data.dll
include ../../build/library.make
-LIB_MCS_FLAGS += -r:$(corlib) -r:System.dll -r:System.Data.dll -r:System.Core.dll
+LIB_MCS_FLAGS += -r:$(corlib) -r:System.dll -r:System.Data.dll -r:System.Core.dll \
-r:System.Configuration.dll TEST_MCS_FLAGS += -r:System.dll -r:System.Data.dll
Modified: mcs/class/WebMatrix.Data/WebMatrix.Data.dll.sources
===================================================================
--- a/mcs/class/WebMatrix.Data/WebMatrix.Data.dll.sources
+++ b/mcs/class/WebMatrix.Data/WebMatrix.Data.dll.sources
@@ -3,3 +3,4 @@
Assembly/AssemblyInfo.cs
WebMatrix.Data/ConnectionEventArgs.cs
WebMatrix.Data/DynamicRecord.cs
+WebMatrix.Data/Database.cs
Added: mcs/class/WebMatrix.Data/WebMatrix.Data/Database.cs
===================================================================
--- /dev/null
+++ b/mcs/class/WebMatrix.Data/WebMatrix.Data/Database.cs
@@ -0,0 +1,174 @@
+//
+// DynamicRecord.cs
+//
+// Copyright (c) 2011 Novell
+//
+// Authors:
+// J??r??mie "garuma" Laval
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+
+#if NET_4_0
+
+using System;
+using System.Dynamic;
+using System.Data.Common;
+using System.Configuration;
+using System.ComponentModel;
+using System.Collections.Generic;
+
+namespace WebMatrix.Data
+{
+ public class Database : IDisposable
+ {
+ DbConnection connection;
+
+ private Database (DbConnection connection)
+ {
+ this.connection = connection;
+ }
+
+ public static Database Open (string name)
+ {
+ var config = ConfigurationManager.ConnectionStrings[name];
+ if (config == null)
+ throw new ArgumentException ("name", string.Format ("Database with name {0} \
doesn't exist", name)); +
+ return OpenConnectionString (config.ConnectionString, config.ProviderName);
+ }
+
+ public static Database OpenConnectionString (string connectionString)
+ {
+ return OpenConnectionString (connectionString, "System.Data.SqlClient");
+ }
+
+ public static Database OpenConnectionString (string connectionString, string \
providerName) + {
+ var factory = DbProviderFactories.GetFactory (providerName);
+ var conn = factory.CreateConnection ();
+ conn.ConnectionString = connectionString;
+
+ return new Database (conn);
+ }
+
+ public void Dispose ()
+ {
+
+ }
+
+ public int Execute (string commandText, params object[] args)
+ {
+ var command = PrepareCommand (commandText);
+ PrepareCommandParameters (command, args);
+
+ connection.Open ();
+ var result = command.ExecuteNonQuery ();
+ connection.Close ();
+
+ return result;
+ }
+
+ public dynamic Query (string commandText, params object[] args)
+ {
+
+ }
+
+ public dynamic QuerySingle (string commandText, params object[] args)
+ {
+ var result = QueryInternal (commandText, args, true);
+
+ return result != null ? new DynamicRecord (result[0]) : null;
+ }
+
+ List<Dictionary<string, object>> QueryInternal (string commandText, params \
object[] args, bool unique) + {
+ var command = PrepareCommand (commandText);
+ PrepareCommandParameters (command, args);
+ string[] columnsNames;
+ var rows = new List<Dictionary<string, object>> ();
+
+ connection.Open ();
+
+ using (var reader = var.ExecuteReader ()) {
+ if (!reader.Read () || !reader.HasRows)
+ return null;
+
+ columnsNames = new string [reader.FieldCount];
+
+ do {
+ var fields = new Dictionary<string, object> ();
+
+ for (int i = 0; i < reader.FieldCount; ++i) {
+ if (columnsNames[i] == null)
+ columnsNames[i] = reader.GetName (i);
+
+ fields[columnsNames[i]] = reader[i];
+ }
+
+ rows.Add (fields);
+ } while (!unique && reader.Read ());
+ }
+
+ connection.Close ();
+
+ return result;
+ }
+
+ public object QueryValue (string commandText, params object[] args)
+ {
+ var command = PrepareCommand (commandText);
+ PrepareCommandParameters (command, args);
+
+ connection.Open ();
+ var result = command.ExecuteScalar ();
+ connection.Close ();
+
+ return result;
+ }
+
+ DbCommand PrepareCommand (string commandText)
+ {
+ var command = connection.CreateCommand ();
+ command.CommandText = commandText;
+
+ return command;
+ }
+
+ static void PrepareCommandParameters (DbCommand command, object[] args)
+ {
+ int index = 0;
+
+ foreach (var arg in args) {
+ var param = command.CreateParameter ();
+ param.ParameterName = "@" + index;
+ param.Value = args[index++];
+ command.Parameters.Add (param);
+ }
+ }
+
+ public DbConnection Connection {
+ get {
+ return connection;
+ }
+ }
+ }
+}
+
+#endif
Commit: d607d237675bcebd7a28e5274e7d86f20efd81d9
Author: Jérémie Laval <jeremie.laval@gmail.com>
Date: 01/24/2011 10:05:52
URL: https://github.com/mono/mono/commit/d607d237675bcebd7a28e5274e7d86f20efd81d9
Add Dispose calls to Database
Changed paths:
M mcs/class/WebMatrix.Data/WebMatrix.Data/Database.cs
Modified: mcs/class/WebMatrix.Data/WebMatrix.Data/Database.cs
===================================================================
--- a/mcs/class/WebMatrix.Data/WebMatrix.Data/Database.cs
+++ b/mcs/class/WebMatrix.Data/WebMatrix.Data/Database.cs
@@ -70,7 +70,13 @@ namespace WebMatrix.Data
public void Dispose ()
{
+ Dispose (true);
+ }
+ protected virtual void Dispose (bool disposing)
+ {
+ if (disposing)
+ connection.Dispose ();
}
public int Execute (string commandText, params object[] args)
@@ -81,6 +87,7 @@ namespace WebMatrix.Data
connection.Open ();
var result = command.ExecuteNonQuery ();
connection.Close ();
+ command.Dispose ();
return result;
}
@@ -127,6 +134,7 @@ namespace WebMatrix.Data
}
connection.Close ();
+ command.Dispose ();
return result;
}
@@ -139,6 +147,7 @@ namespace WebMatrix.Data
connection.Open ();
var result = command.ExecuteScalar ();
connection.Close ();
+ command.Dispose ();
return result;
}
Commit: f5b9efc7840ee50c09d9de5e5156984ce245d6db
Author: Jérémie Laval <jeremie.laval@gmail.com>
Date: 01/24/2011 10:05:52
URL: https://github.com/mono/mono/commit/f5b9efc7840ee50c09d9de5e5156984ce245d6db
Fix up compilation of Database and DynamicRecord
Changed paths:
M mcs/class/WebMatrix.Data/WebMatrix.Data/Database.cs
M mcs/class/WebMatrix.Data/WebMatrix.Data/DynamicRecord.cs
Modified: mcs/class/WebMatrix.Data/WebMatrix.Data/Database.cs
===================================================================
--- a/mcs/class/WebMatrix.Data/WebMatrix.Data/Database.cs
+++ b/mcs/class/WebMatrix.Data/WebMatrix.Data/Database.cs
@@ -28,6 +28,7 @@
#if NET_4_0
using System;
+using System.Linq;
using System.Dynamic;
using System.Data.Common;
using System.Configuration;
@@ -92,9 +93,11 @@ namespace WebMatrix.Data
return result;
}
- public dynamic Query (string commandText, params object[] args)
+ public IEnumerable<dynamic> Query (string commandText, params object[] args)
{
-
+ var result = QueryInternal (commandText, args, false);
+
+ return result != null ? result.Select (r => new DynamicRecord (r)) : null;
}
public dynamic QuerySingle (string commandText, params object[] args)
@@ -104,7 +107,7 @@ namespace WebMatrix.Data
return result != null ? new DynamicRecord (result[0]) : null;
}
- List<Dictionary<string, object>> QueryInternal (string commandText, params \
object[] args, bool unique) + List<Dictionary<string, object>> QueryInternal (string \
commandText, object[] args, bool unique) {
var command = PrepareCommand (commandText);
PrepareCommandParameters (command, args);
@@ -113,7 +116,7 @@ namespace WebMatrix.Data
connection.Open ();
- using (var reader = var.ExecuteReader ()) {
+ using (var reader = command.ExecuteReader ()) {
if (!reader.Read () || !reader.HasRows)
return null;
@@ -136,7 +139,7 @@ namespace WebMatrix.Data
connection.Close ();
command.Dispose ();
- return result;
+ return rows;
}
public object QueryValue (string commandText, params object[] args)
Modified: mcs/class/WebMatrix.Data/WebMatrix.Data/DynamicRecord.cs
===================================================================
--- a/mcs/class/WebMatrix.Data/WebMatrix.Data/DynamicRecord.cs
+++ b/mcs/class/WebMatrix.Data/WebMatrix.Data/DynamicRecord.cs
@@ -42,7 +42,7 @@ namespace WebMatrix.Data
internal DynamicRecord (Dictionary<string, object> fields)
{
this.fields = fields;
- Columns = fields.Keys;
+ Columns = new List<string> (fields.Keys).AsReadOnly ();
}
public IList<string> Columns {
@@ -58,13 +58,13 @@ namespace WebMatrix.Data
public object this[int index] {
get {
- return fields.Keys[index];
+ return fields[Columns[index]];
}
}
public override IEnumerable<string> GetDynamicMemberNames ()
{
- return Columns;
+ return fields.Keys;
}
public override bool TryGetMember (GetMemberBinder binder, out object result)
Commit: 591be8a33f9bf701055e92c991b1e4711fefdf57
Author: Jérémie Laval <jeremie.laval@gmail.com>
Date: 01/24/2011 10:05:53
URL: https://github.com/mono/mono/commit/591be8a33f9bf701055e92c991b1e4711fefdf57
Add ConnectionOpened event to Database
Changed paths:
M mcs/class/WebMatrix.Data/WebMatrix.Data/Database.cs
Modified: mcs/class/WebMatrix.Data/WebMatrix.Data/Database.cs
===================================================================
--- a/mcs/class/WebMatrix.Data/WebMatrix.Data/Database.cs
+++ b/mcs/class/WebMatrix.Data/WebMatrix.Data/Database.cs
@@ -39,6 +39,8 @@ namespace WebMatrix.Data
{
public class Database : IDisposable
{
+ public static event EventHandler<ConnectionEventArgs> ConnectionOpened;
+
DbConnection connection;
private Database (DbConnection connection)
@@ -86,7 +88,10 @@ namespace WebMatrix.Data
PrepareCommandParameters (command, args);
connection.Open ();
+ TriggerConnectionOpened (this, connection);
+
var result = command.ExecuteNonQuery ();
+
connection.Close ();
command.Dispose ();
@@ -115,6 +120,7 @@ namespace WebMatrix.Data
var rows = new List<Dictionary<string, object>> ();
connection.Open ();
+ TriggerConnectionOpened (this, connection);
using (var reader = command.ExecuteReader ()) {
if (!reader.Read () || !reader.HasRows)
@@ -148,7 +154,10 @@ namespace WebMatrix.Data
PrepareCommandParameters (command, args);
connection.Open ();
+ TriggerConnectionOpened (this, connection);
+
var result = command.ExecuteScalar ();
+
connection.Close ();
command.Dispose ();
@@ -175,6 +184,13 @@ namespace WebMatrix.Data
}
}
+ static TriggerConnectionOpened (Database self, DbConnection connection)
+ {
+ EventHandler<ConnectionEventArgs> evt = ConnectionOpened;
+ if (evt != null)
+ evt (self, new ConnectionEventArgs (connection));
+ }
+
public DbConnection Connection {
get {
return connection;
Commit: 98c4b8992d77ff5ac6bf7497cfeb3625926bc8f9
Author: Jérémie Laval <jeremie.laval@gmail.com>
Date: 01/24/2011 10:05:53
URL: https://github.com/mono/mono/commit/98c4b8992d77ff5ac6bf7497cfeb3625926bc8f9
Add Close method
Changed paths:
M mcs/class/WebMatrix.Data/WebMatrix.Data/Database.cs
Modified: mcs/class/WebMatrix.Data/WebMatrix.Data/Database.cs
===================================================================
--- a/mcs/class/WebMatrix.Data/WebMatrix.Data/Database.cs
+++ b/mcs/class/WebMatrix.Data/WebMatrix.Data/Database.cs
@@ -71,6 +71,11 @@ namespace WebMatrix.Data
return new Database (conn);
}
+ public void Close ()
+ {
+ Dispose ();
+ }
+
public void Dispose ()
{
Dispose (true);
Commit: f1acca540bb0cee2d24210ac97be20af4cac075f
Author: Jérémie Laval <jeremie.laval@gmail.com>
Date: 01/24/2011 10:05:54
URL: https://github.com/mono/mono/commit/f1acca540bb0cee2d24210ac97be20af4cac075f
Foobar trigger connection
Changed paths:
M mcs/class/WebMatrix.Data/WebMatrix.Data/Database.cs
Modified: mcs/class/WebMatrix.Data/WebMatrix.Data/Database.cs
===================================================================
--- a/mcs/class/WebMatrix.Data/WebMatrix.Data/Database.cs
+++ b/mcs/class/WebMatrix.Data/WebMatrix.Data/Database.cs
@@ -189,7 +189,7 @@ namespace WebMatrix.Data
}
}
- static TriggerConnectionOpened (Database self, DbConnection connection)
+ static void TriggerConnectionOpened (Database self, DbConnection connection)
{
EventHandler<ConnectionEventArgs> evt = ConnectionOpened;
if (evt != null)
Commit: b364173319d2eaa932a4efa76bf89dc0610626db
Author: Jérémie Laval <jeremie.laval@gmail.com>
Date: 01/24/2011 10:05:55
URL: https://github.com/mono/mono/commit/b364173319d2eaa932a4efa76bf89dc0610626db
Add GetLastInsertId
Changed paths:
M mcs/class/WebMatrix.Data/WebMatrix.Data/Database.cs
Modified: mcs/class/WebMatrix.Data/WebMatrix.Data/Database.cs
===================================================================
--- a/mcs/class/WebMatrix.Data/WebMatrix.Data/Database.cs
+++ b/mcs/class/WebMatrix.Data/WebMatrix.Data/Database.cs
@@ -169,6 +169,14 @@ namespace WebMatrix.Data
return result;
}
+ // TODO: I don't think this is actually quite generic (SQL Server specific)
+ public object GetLastInsertId ()
+ {
+ const string sql = "select @@IDENTITY";
+
+ return QueryValue (sql);
+ }
+
DbCommand PrepareCommand (string commandText)
{
var command = connection.CreateCommand ();
@@ -179,6 +187,9 @@ namespace WebMatrix.Data
static void PrepareCommandParameters (DbCommand command, object[] args)
{
+ if (args.Length == 0)
+ return;
+
int index = 0;
foreach (var arg in args) {
Commit: 1f40d73cdf59b0d10eee087adc324290408b5162
Author: Jérémie Laval <jeremie.laval@gmail.com>
Date: 01/24/2011 10:05:58
URL: https://github.com/mono/mono/commit/1f40d73cdf59b0d10eee087adc324290408b5162
Just fixup comment
Changed paths:
M mcs/class/WebMatrix.Data/WebMatrix.Data/Database.cs
Modified: mcs/class/WebMatrix.Data/WebMatrix.Data/Database.cs
===================================================================
--- a/mcs/class/WebMatrix.Data/WebMatrix.Data/Database.cs
+++ b/mcs/class/WebMatrix.Data/WebMatrix.Data/Database.cs
@@ -1,5 +1,5 @@
//
-// DynamicRecord.cs
+// Database.cs
//
// Copyright (c) 2011 Novell
//
Commit: 7c3bd246b68bbaddc1e9183bdb3392f493700a91
Author: Jérémie Laval <jeremie.laval@gmail.com>
Date: 01/24/2011 10:05:58
URL: https://github.com/mono/mono/commit/7c3bd246b68bbaddc1e9183bdb3392f493700a91
Add unit tests for DynamicRecord
Changed paths:
M mcs/class/WebMatrix.Data/WebMatrix.Data_test.dll.sources
Added paths:
A mcs/class/WebMatrix.Data/Test/WebMatrix.Data/DynamicRecordTests.cs
Modified: mcs/class/WebMatrix.Data/WebMatrix.Data_test.dll.sources
===================================================================
--- a/mcs/class/WebMatrix.Data/WebMatrix.Data_test.dll.sources
+++ b/mcs/class/WebMatrix.Data/WebMatrix.Data_test.dll.sources
@@ -1 +1,3 @@
WebMatrix.Data/ConnectionEventArgsTests.cs
+WebMatrix.Data/DynamicRecordTests.cs
+../WebMatrix.Data/DynamicRecord.cs
Added: mcs/class/WebMatrix.Data/Test/WebMatrix.Data/DynamicRecordTests.cs
===================================================================
--- /dev/null
+++ b/mcs/class/WebMatrix.Data/Test/WebMatrix.Data/DynamicRecordTests.cs
@@ -0,0 +1,99 @@
+//
+// DynamicRecordTests.cs
+//
+// Author:
+// J??r??mie "garuma" Laval <jeremie.laval@gmail.com>
+//
+// Copyright (c) 2011 Novell
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#if NET_4_0
+
+using System;
+using System.Collections.Generic;
+
+using WebMatrix.Data;
+
+using NUnit.Framework;
+
+namespace MonoTests.WebMatrix.Data
+{
+ [TestFixtureAttribute]
+ public class DynamicRecordTests
+ {
+ DynamicRecord record;
+
+ [SetUp]
+ public void Setup ()
+ {
+ var fields = new Dictionary<string, object> () {
+ { "foo", 1 },
+ { "bar", 4.1f },
+ { "foobar", "foobar" }
+ };
+ record = new DynamicRecord (fields);
+ }
+
+ [Test]
+ public void ColumnsTest ()
+ {
+ var columns = record.Columns;
+ Assert.AreEqual (3, columns.Count);
+
+ Assert.AreEqual ("foo", columns[0]);
+ Assert.AreEqual ("bar", columns[1]);
+ Assert.AreEqual ("foobar", columns[2]);
+ }
+
+ [Test]
+ public void AccessByNameTest ()
+ {
+ Assert.AreEqual (1, record["foo"]);
+ Assert.AreEqual (4.1f, record["bar"]);
+ Assert.AreEqual ("foobar", record["foobar"]);
+ }
+
+ [Test]
+ public void AccessByIndexTest ()
+ {
+ Assert.AreEqual (1, record[0]);
+ Assert.AreEqual (4.1f, record[1]);
+ Assert.AreEqual ("foobar", record[2]);
+ }
+
+ [Test]
+ public void AccesByDynamicTest ()
+ {
+ dynamic r = record;
+
+ Assert.AreEqual (1, r.foo);
+ Assert.AreEqual (4.1f, r.bar);
+ Assert.AreEqual ("foobar", r.foobar);
+ }
+
+ [Test]
+ public void GetDynamicMemberNamesTest ()
+ {
+ var expected = new string[] { "foo", "bar", "foobar" };
+ CollectionAssert.AreEquivalent (expected, record.GetDynamicMemberNames ());
+ }
+ }
+}
+#endif
Commit: bc326d8e73e3fdf89b68146e227f86fefaef4860
Author: Jérémie Laval <jeremie.laval@gmail.com>
Date: 01/24/2011 10:06:00
URL: https://github.com/mono/mono/commit/bc326d8e73e3fdf89b68146e227f86fefaef4860
Add unit test for Database
Changed paths:
M mcs/class/WebMatrix.Data/Makefile
M mcs/class/WebMatrix.Data/Test/WebMatrix.Data/DynamicRecordTests.cs
M mcs/class/WebMatrix.Data/WebMatrix.Data_test.dll.sources
Added paths:
A mcs/class/WebMatrix.Data/Test/WebMatrix.Data/DatabaseTests.cs
A mcs/class/WebMatrix.Data/Test/testsqlite.db
Modified: mcs/class/WebMatrix.Data/Makefile
===================================================================
--- a/mcs/class/WebMatrix.Data/Makefile
+++ b/mcs/class/WebMatrix.Data/Makefile
@@ -7,4 +7,4 @@ LIBRARY = WebMatrix.Data.dll
include ../../build/library.make
LIB_MCS_FLAGS += -r:$(corlib) -r:System.dll -r:System.Data.dll -r:System.Core.dll \
-r:System.Configuration.dll
-TEST_MCS_FLAGS += -r:System.dll -r:System.Data.dll
+TEST_MCS_FLAGS += -r:System.dll -r:System.Data.dll -r:Mono.Data.Sqlite.dll
Modified: mcs/class/WebMatrix.Data/Test/WebMatrix.Data/DynamicRecordTests.cs
===================================================================
--- a/mcs/class/WebMatrix.Data/Test/WebMatrix.Data/DynamicRecordTests.cs
+++ b/mcs/class/WebMatrix.Data/Test/WebMatrix.Data/DynamicRecordTests.cs
@@ -96,4 +96,4 @@ namespace MonoTests.WebMatrix.Data
}
}
}
-#endif
\ No newline at end of file
+#endif
Modified: mcs/class/WebMatrix.Data/WebMatrix.Data_test.dll.sources
===================================================================
--- a/mcs/class/WebMatrix.Data/WebMatrix.Data_test.dll.sources
+++ b/mcs/class/WebMatrix.Data/WebMatrix.Data_test.dll.sources
@@ -1,3 +1,4 @@
WebMatrix.Data/ConnectionEventArgsTests.cs
WebMatrix.Data/DynamicRecordTests.cs
../WebMatrix.Data/DynamicRecord.cs
+WebMatrix.Data/DatabaseTests.cs
Added: mcs/class/WebMatrix.Data/Test/WebMatrix.Data/DatabaseTests.cs
===================================================================
--- /dev/null
+++ b/mcs/class/WebMatrix.Data/Test/WebMatrix.Data/DatabaseTests.cs
@@ -0,0 +1,95 @@
+//
+// DatabaseTests.cs
+//
+// Author:
+// J??r??mie "garuma" Laval <jeremie.laval@gmail.com>
+//
+// Copyright (c) 2011 Novell
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#if NET_4_0
+
+using System;
+using System.IO;
+using System.Linq;
+using System.Data.Common;
+using System.Collections.Generic;
+
+using WebMatrix.Data;
+
+using NUnit.Framework;
+
+namespace MonoTests.WebMatrix.Data
+{
+ [TestFixtureAttribute]
+ public class DatabaseTests
+ {
+ Database database;
+
+ [SetUp]
+ public void Setup ()
+ {
+ string path = Path.Combine ("Test", "testsqlite.db");
+ database = Database.OpenConnectionString ("Data Source="+path+";Version=3;", \
"Mono.Data.Sqlite"); + }
+
+ [Test]
+ public void QuerySingleTest ()
+ {
+ var result = database.QuerySingle ("select * from memos where Text=@0 limit 1", \
"Grendel"); +
+ Assert.IsNotNull (result);
+ Assert.AreEqual ("Grendel", result.Text);
+ Assert.AreEqual (5, result.Priority);
+ }
+
+ [Test]
+ public void SimpleQueryTest ()
+ {
+ var result = database.Query ("select * from memos");
+
+ Assert.IsNotNull (result);
+ Assert.AreEqual (5, result.Count ());
+
+ var col1 = new string[] { "Webmatrix", "Grendel", "Garuma", "jpobst", "Gonzalo" \
}; + var col2 = new object[] { 10, 5, -1, 6, 4 };
+ int index = 0;
+
+ foreach (var row in result) {
+ Assert.AreEqual (col1[index], row.Text);
+ Assert.AreEqual (col2[index], row.Priority);
+ index++;
+ }
+ }
+
+ [Test]
+ public void ConnectionOpenedTest ()
+ {
+ bool opened = false;
+ Database.ConnectionOpened += (sender, e) => opened = sender == database;
+
+ var result = database.QuerySingle ("select * from memos where Text=@0 limit 1", \
"Grendel"); +
+ Assert.IsTrue (opened);
+ }
+ }
+}
+#endif
+
Added: mcs/class/WebMatrix.Data/Test/testsqlite.db
===================================================================
--- /dev/null
+++ b/mcs/class/WebMatrix.Data/Test/testsqlite.db
@@ -0,0 +1,4 @@
+SQLite format 3@ -???LytablememosmemosCREATE TABLE memos(Text \
VARCHAR(50), Priority INTEGER)??????Gonzalo +jpobst
+Garuma?GrendelWebmatrix
+
Commit: 8db070aae1d43a77beba19b87bbfaa3d48a2d95b
Author: Geoff Norton <grompf@sublimeintervention.com>
Date: 01/24/2011 11:39:19
URL: https://github.com/mono/mono/commit/8db070aae1d43a77beba19b87bbfaa3d48a2d95b
Fix a mach port leak
Changed paths:
M mono/metadata/sgen-os-mach.c
Modified: mono/metadata/sgen-os-mach.c
===================================================================
--- a/mono/metadata/sgen-os-mach.c
+++ b/mono/metadata/sgen-os-mach.c
@@ -118,6 +118,8 @@ mono_sgen_thread_handshake (int signum)
count ++;
mach_port_deallocate (task, t);
+ } else {
+ mach_port_deallocate (task, t);
}
}
Commit: 7ee94c1ca3fdb84a8465b29c2639086c57e08621
Author: Geoff Norton <grompf@sublimeintervention.com>
Date: 01/24/2011 12:07:24
URL: https://github.com/mono/mono/commit/7ee94c1ca3fdb84a8465b29c2639086c57e08621
Avoid leaking the vmmap allocated by the kernel for the thread_act_array_t
Changed paths:
M mono/metadata/sgen-os-mach.c
M mono/utils/mach-support.c
M mono/utils/mach-support.h
Modified: mono/metadata/sgen-os-mach.c
===================================================================
--- a/mono/metadata/sgen-os-mach.c
+++ b/mono/metadata/sgen-os-mach.c
@@ -123,6 +123,8 @@ mono_sgen_thread_handshake (int signum)
}
}
+ mono_mach_free_threads (thread_list, num_threads);
+
mach_port_deallocate (task, cur_thread);
return count;
Modified: mono/utils/mach-support.c
===================================================================
--- a/mono/utils/mach-support.c
+++ b/mono/utils/mach-support.c
@@ -35,4 +35,10 @@ mono_mach_get_threads (thread_act_array_t *threads, guint32 \
*count)
return ret;
}
+
+kern_return_t
+mono_mach_free_threads (thread_act_array_t threads, guint32 count)
+{
+ return vm_deallocate(current_task (), (vm_address_t) threads, sizeof (thread_t) * \
count); +}
#endif
Modified: mono/utils/mach-support.h
===================================================================
--- a/mono/utils/mach-support.h
+++ b/mono/utils/mach-support.h
@@ -28,6 +28,7 @@ void mono_mach_arch_thread_state_to_mcontext (thread_state_t state, \
mcontext_t c
int mono_mach_arch_get_thread_state_size (void) MONO_INTERNAL;
kern_return_t mono_mach_get_threads (thread_act_array_t *threads, guint32 *count) \
MONO_INTERNAL; +kern_return_t mono_mach_free_threads (thread_act_array_t threads, \
guint32 count) MONO_INTERNAL; kern_return_t mono_mach_arch_get_thread_state \
(thread_port_t thread, thread_state_t state, mach_msg_type_number_t *count) \
MONO_INTERNAL; void *mono_mach_arch_get_tls_value_from_thread (thread_port_t thread, \
guint32 key) MONO_INTERNAL;
Commit: d70c578fc4a39a09373aaf9eca2c5e995c2d97f9
Author: Tomasz Kubacki <tomasz.kubacki@gmail.com>
Committer: Miguel de Icaza <miguel@gnome.org>
Date: 01/24/2011 15:44:42
URL: https://github.com/mono/mono/commit/d70c578fc4a39a09373aaf9eca2c5e995c2d97f9
[Mono.CSharp] Improve error reporting
Changed paths:
M mcs/mcs/eval.cs
Modified: mcs/mcs/eval.cs
===================================================================
--- a/mcs/mcs/eval.cs
+++ b/mcs/mcs/eval.cs
@@ -191,6 +191,9 @@ namespace Mono.CSharp
if (type == null)
throw new ArgumentNullException ();
+ if (!inited)
+ throw new Exception ("Evaluator has to be initiated before seting custom \
InteractiveBase class"); +
lock (evaluator_lock)
interactive_base_class = loader.Importer.ImportType (type);
}
Commit: 8f69b0e0e09714e259f259455363a9235c150045
Author: Andrew Jorgensen <ajorgensen@novell.com>
Date: 01/24/2011 17:17:16
URL: https://github.com/mono/mono/commit/8f69b0e0e09714e259f259455363a9235c150045
Add WebMatrix.Data to spec
Changed paths:
M mono-core.spec.in
Modified: mono-core.spec.in
===================================================================
--- a/mono-core.spec.in
+++ b/mono-core.spec.in
@@ -483,6 +483,7 @@ Database connectivity for Mono.
%_prefix/lib/mono/4.0/System.EnterpriseServices.dll
%_prefix/lib/mono/4.0/System.Runtime.Serialization.dll
%_prefix/lib/mono/4.0/System.Transactions.dll
+%_prefix/lib/mono/4.0/WebMatrix.Data.dll
%_prefix/lib/mono/4.0/sqlmetal.exe*
%_prefix/lib/mono/4.0/sqlsharp.exe*
%_prefix/lib/mono/gac/Mono.Data.Tds
@@ -494,6 +495,7 @@ Database connectivity for Mono.
%_prefix/lib/mono/gac/System.EnterpriseServices
%_prefix/lib/mono/gac/System.Runtime.Serialization
%_prefix/lib/mono/gac/System.Transactions
+%_prefix/lib/mono/gac/WebMatrix.Data
%package -n mono-winforms
License: LGPL v2.1 only
Commit: 6e268ac849bc12e1abda53a26d75d061a6eba50e
Author: Zoltan Varga <vargaz@gmail.com>
Date: 01/24/2011 21:01:48
URL: https://github.com/mono/mono/commit/6e268ac849bc12e1abda53a26d75d061a6eba50e
Fix up CAS tests a bit.
Changed paths:
M mono/tests/cas/assembly/Makefile.am
Modified: mono/tests/cas/assembly/Makefile.am
===================================================================
--- a/mono/tests/cas/assembly/Makefile.am
+++ b/mono/tests/cas/assembly/Makefile.am
@@ -5,7 +5,7 @@ RUNTIME = $(with_mono_path) $(top_builddir)/runtime/mono-wrapper \
--debug CAS_RUNTIME = $(RUNTIME) --security
CSCOMPILE = $(RUNTIME) $(mcs_topdir)/class/lib/net_2_0/gmcs.exe -debug
-PERMVIEW = $(RUNTIME2) $(mcs_topdir)/tools/security/permview.exe
+PERMVIEW = $(RUNTIME) $(mcs_topdir)/tools/security/permview.exe
PROFILE = net_2_0
tests: all.exe min.exe opt.exe ref.exe none.exe
Commit: d1eb847ef2b9b05d268703e6d677aab47f0a5e0d
Author: Geoff Norton <grompf@sublimeintervention.com>
Date: 01/25/2011 01:52:12
URL: https://github.com/mono/mono/commit/d1eb847ef2b9b05d268703e6d677aab47f0a5e0d
Work around a full-aot issue for monotouch System.Json
Changed paths:
M mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JavaScriptReader.cs
Modified: mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JavaScriptReader.cs
===================================================================
--- a/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JavaScriptReader.cs
+++ b/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JavaScriptReader.cs
@@ -80,7 +80,16 @@ namespace System.Runtime.Serialization.Json
if (c == '}')
break;
}
+#if MONOTOUCH
+ int idx = 0;
+ KeyValuePair<string, object> [] ret = new KeyValuePair<string, \
object>[obj.Count]; + foreach (KeyValuePair <string, object> kvp in obj)
+ ret [idx++] = kvp;
+
+ return ret;
+#else
return obj.ToArray ();
+#endif
case 't':
Expect ("true");
return true;
Commit: ff1caafd973bfd9f13b19c0cd271fb6ef4fe6e32
Author: Geoff Norton <grompf@sublimeintervention.com>
Date: 01/25/2011 01:52:17
URL: https://github.com/mono/mono/commit/ff1caafd973bfd9f13b19c0cd271fb6ef4fe6e32
Add pfx to the mobile profile
Changed paths:
M mcs/build/common/Consts.cs.in
M mcs/class/corlib/System.Collections.Concurrent.Partitioners/EnumerablePartitioner.cs
M mcs/class/corlib/System.Collections.Concurrent.Partitioners/ListPartitioner.cs
M mcs/class/corlib/System.Collections.Concurrent.Partitioners/UserRangePartitioner.cs
M mcs/class/corlib/System.Collections.Concurrent/ConcurrentDictionary.cs
M mcs/class/corlib/System.Collections.Concurrent/ConcurrentOrderedList.cs
M mcs/class/corlib/System.Collections.Concurrent/ConcurrentQueue.cs
M mcs/class/corlib/System.Collections.Concurrent/ConcurrentStack.cs
M mcs/class/corlib/System.Collections.Concurrent/IProducerConsumerCollection.cs
M mcs/class/corlib/System.Collections.Concurrent/OrderablePartitioner.cs
M mcs/class/corlib/System.Collections.Concurrent/Partitioner.cs
M mcs/class/corlib/System.Collections.Concurrent/SplitOrderedList.cs
M mcs/class/corlib/System.Collections/IStructuralComparable.cs
M mcs/class/corlib/System.Collections/IStructuralEquatable.cs
M mcs/class/corlib/System.Runtime.CompilerServices/TypeForwardedFromAttribute.cs
M mcs/class/corlib/System.Threading.Tasks/CyclicDeque.cs
M mcs/class/corlib/System.Threading.Tasks/Future.cs
M mcs/class/corlib/System.Threading.Tasks/IScheduler.cs
M mcs/class/corlib/System.Threading.Tasks/Parallel.cs
M mcs/class/corlib/System.Threading.Tasks/ParallelLoopResult.cs
M mcs/class/corlib/System.Threading.Tasks/ParallelLoopState.cs
M mcs/class/corlib/System.Threading.Tasks/ParallelOptions.cs
M mcs/class/corlib/System.Threading.Tasks/Scheduler.cs
M mcs/class/corlib/System.Threading.Tasks/SchedulerProxy.cs
M mcs/class/corlib/System.Threading.Tasks/SimpleConcurrentBag.cs
M mcs/class/corlib/System.Threading.Tasks/Task.cs
M mcs/class/corlib/System.Threading.Tasks/TaskCanceledException.cs
M mcs/class/corlib/System.Threading.Tasks/TaskCompletionSource.cs
M mcs/class/corlib/System.Threading.Tasks/TaskContinuationOptions.cs
M mcs/class/corlib/System.Threading.Tasks/TaskCreationOptions.cs
M mcs/class/corlib/System.Threading.Tasks/TaskFactory.cs
M mcs/class/corlib/System.Threading.Tasks/TaskScheduler.cs
M mcs/class/corlib/System.Threading.Tasks/TaskSchedulerException.cs
M mcs/class/corlib/System.Threading.Tasks/TaskStatus.cs
M mcs/class/corlib/System.Threading.Tasks/ThreadWorker.cs
M mcs/class/corlib/System.Threading.Tasks/UnobservedTaskExceptionEventArgs.cs
M mcs/class/corlib/System.Threading/AsyncFlowControl.cs
M mcs/class/corlib/System.Threading/CancellationToken.cs
M mcs/class/corlib/System.Threading/CancellationTokenRegistration.cs
M mcs/class/corlib/System.Threading/CancellationTokenSource.cs
M mcs/class/corlib/System.Threading/CountdownEvent.cs
M mcs/class/corlib/System.Threading/LazyInitializer.cs
M mcs/class/corlib/System.Threading/LazyThreadSafetyMode.cs
M mcs/class/corlib/System.Threading/LockRecursionException.cs
M mcs/class/corlib/System.Threading/ManualResetEventSlim.cs
M mcs/class/corlib/System.Threading/Monitor.cs
M mcs/class/corlib/System.Threading/SemaphoreSlim.cs
M mcs/class/corlib/System.Threading/SpinLock.cs
M mcs/class/corlib/System.Threading/SpinWait.cs
M mcs/class/corlib/System.Threading/Thread.cs
M mcs/class/corlib/System.Threading/ThreadLocal.cs
M mcs/class/corlib/System.Threading/WaitHandle.cs
M mcs/class/corlib/System.Threading/Watch.cs
M mcs/class/corlib/System/Action.cs
M mcs/class/corlib/System/AggregateException.cs
M mcs/class/corlib/System/Funcs.cs
M mcs/class/corlib/System/OperationCanceledException.cs
M mcs/class/corlib/System/Tuple.cs
M mcs/class/corlib/System/Tuples.cs
Modified: mcs/build/common/Consts.cs.in
===================================================================
--- a/mcs/build/common/Consts.cs.in
+++ b/mcs/build/common/Consts.cs.in
@@ -100,7 +100,7 @@ static class Consts
public const string AssemblySystem_ServiceProcess = "System.ServiceProcess, \
Version=" + FxVersion + ", Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; public \
const string AssemblySystem_Web = "System.Web, Version=" + FxVersion + ", \
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; public const string \
AssemblySystem_Windows_Forms = "System.Windows.Forms, Version=" + FxVersion + ", \
Culture=neutral, PublicKeyToken=b77a5c561934e089";
-#if NET_4_0
+#if NET_4_0 || MOBILE
public const string AssemblySystem_2_0 = "System, Version=2.0.0.0, Culture=neutral, \
PublicKeyToken=b77a5c561934e089"; public const string AssemblySystemCore_3_5 = \
"System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"; \
public const string AssemblySystem_Core = "System.Core, Version=" + FxVersion + ", \
Culture=neutral, PublicKeyToken=b77a5c561934e089";
Modified: mcs/class/corlib/System.Collections.Concurrent.Partitioners/EnumerablePartitioner.cs
===================================================================
--- a/mcs/class/corlib/System.Collections.Concurrent.Partitioners/EnumerablePartitioner.cs
+++ b/mcs/class/corlib/System.Collections.Concurrent.Partitioners/EnumerablePartitioner.cs
@@ -24,7 +24,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
using System.Threading;
Modified: mcs/class/corlib/System.Collections.Concurrent.Partitioners/ListPartitioner.cs
===================================================================
--- a/mcs/class/corlib/System.Collections.Concurrent.Partitioners/ListPartitioner.cs
+++ b/mcs/class/corlib/System.Collections.Concurrent.Partitioners/ListPartitioner.cs
@@ -24,7 +24,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
using System.Collections.Generic;
Modified: mcs/class/corlib/System.Collections.Concurrent.Partitioners/UserRangePartitioner.cs
===================================================================
--- a/mcs/class/corlib/System.Collections.Concurrent.Partitioners/UserRangePartitioner.cs
+++ b/mcs/class/corlib/System.Collections.Concurrent.Partitioners/UserRangePartitioner.cs
@@ -24,7 +24,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
using System.Threading;
Modified: mcs/class/corlib/System.Collections.Concurrent/ConcurrentDictionary.cs
===================================================================
--- a/mcs/class/corlib/System.Collections.Concurrent/ConcurrentDictionary.cs
+++ b/mcs/class/corlib/System.Collections.Concurrent/ConcurrentDictionary.cs
@@ -22,7 +22,7 @@
//
//
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
using System.Threading;
Modified: mcs/class/corlib/System.Collections.Concurrent/ConcurrentOrderedList.cs
===================================================================
--- a/mcs/class/corlib/System.Collections.Concurrent/ConcurrentOrderedList.cs
+++ b/mcs/class/corlib/System.Collections.Concurrent/ConcurrentOrderedList.cs
@@ -22,7 +22,7 @@
//
//
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
using System.Threading;
Modified: mcs/class/corlib/System.Collections.Concurrent/ConcurrentQueue.cs
===================================================================
--- a/mcs/class/corlib/System.Collections.Concurrent/ConcurrentQueue.cs
+++ b/mcs/class/corlib/System.Collections.Concurrent/ConcurrentQueue.cs
@@ -22,7 +22,7 @@
//
//
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
using System.Threading;
Modified: mcs/class/corlib/System.Collections.Concurrent/ConcurrentStack.cs
===================================================================
--- a/mcs/class/corlib/System.Collections.Concurrent/ConcurrentStack.cs
+++ b/mcs/class/corlib/System.Collections.Concurrent/ConcurrentStack.cs
@@ -22,7 +22,7 @@
//
//
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
using System.Threading;
Modified: mcs/class/corlib/System.Collections.Concurrent/IProducerConsumerCollection.cs
===================================================================
--- a/mcs/class/corlib/System.Collections.Concurrent/IProducerConsumerCollection.cs
+++ b/mcs/class/corlib/System.Collections.Concurrent/IProducerConsumerCollection.cs
@@ -22,7 +22,7 @@
//
//
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
using System.Collections;
using System.Collections.Generic;
Modified: mcs/class/corlib/System.Collections.Concurrent/OrderablePartitioner.cs
===================================================================
--- a/mcs/class/corlib/System.Collections.Concurrent/OrderablePartitioner.cs
+++ b/mcs/class/corlib/System.Collections.Concurrent/OrderablePartitioner.cs
@@ -24,7 +24,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
using System.Collections.Generic;
Modified: mcs/class/corlib/System.Collections.Concurrent/Partitioner.cs
===================================================================
--- a/mcs/class/corlib/System.Collections.Concurrent/Partitioner.cs
+++ b/mcs/class/corlib/System.Collections.Concurrent/Partitioner.cs
@@ -24,7 +24,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
using System.Collections.Generic;
Modified: mcs/class/corlib/System.Collections.Concurrent/SplitOrderedList.cs
===================================================================
--- a/mcs/class/corlib/System.Collections.Concurrent/SplitOrderedList.cs
+++ b/mcs/class/corlib/System.Collections.Concurrent/SplitOrderedList.cs
@@ -22,7 +22,7 @@
//
//
-#if NET_4_0 || INSIDE_SYSTEM_WEB
+#if NET_4_0 || INSIDE_SYSTEM_WEB || MOBILE
using System;
using System.Threading;
Modified: mcs/class/corlib/System.Collections/IStructuralComparable.cs
===================================================================
--- a/mcs/class/corlib/System.Collections/IStructuralComparable.cs
+++ b/mcs/class/corlib/System.Collections/IStructuralComparable.cs
@@ -26,7 +26,7 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if MOONLIGHT || NET_4_0
+#if MOONLIGHT || NET_4_0 || MOBILE
using System;
Modified: mcs/class/corlib/System.Collections/IStructuralEquatable.cs
===================================================================
--- a/mcs/class/corlib/System.Collections/IStructuralEquatable.cs
+++ b/mcs/class/corlib/System.Collections/IStructuralEquatable.cs
@@ -26,7 +26,7 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if MOONLIGHT || NET_4_0
+#if MOONLIGHT || NET_4_0 || MOBILE
using System;
Modified: mcs/class/corlib/System.Runtime.CompilerServices/TypeForwardedFromAttribute.cs
===================================================================
--- a/mcs/class/corlib/System.Runtime.CompilerServices/TypeForwardedFromAttribute.cs
+++ b/mcs/class/corlib/System.Runtime.CompilerServices/TypeForwardedFromAttribute.cs
@@ -26,7 +26,7 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
namespace System.Runtime.CompilerServices
{
Modified: mcs/class/corlib/System.Threading.Tasks/CyclicDeque.cs
===================================================================
--- a/mcs/class/corlib/System.Threading.Tasks/CyclicDeque.cs
+++ b/mcs/class/corlib/System.Threading.Tasks/CyclicDeque.cs
@@ -24,7 +24,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
using System.Collections.Generic;
Modified: mcs/class/corlib/System.Threading.Tasks/Future.cs
===================================================================
--- a/mcs/class/corlib/System.Threading.Tasks/Future.cs
+++ b/mcs/class/corlib/System.Threading.Tasks/Future.cs
@@ -22,7 +22,7 @@
//
//
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
namespace System.Threading.Tasks
Modified: mcs/class/corlib/System.Threading.Tasks/IScheduler.cs
===================================================================
--- a/mcs/class/corlib/System.Threading.Tasks/IScheduler.cs
+++ b/mcs/class/corlib/System.Threading.Tasks/IScheduler.cs
@@ -22,7 +22,7 @@
//
//
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
using System.Threading;
using System.Collections.Generic;
Modified: mcs/class/corlib/System.Threading.Tasks/Parallel.cs
===================================================================
--- a/mcs/class/corlib/System.Threading.Tasks/Parallel.cs
+++ b/mcs/class/corlib/System.Threading.Tasks/Parallel.cs
@@ -22,7 +22,7 @@
//
//
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
using System.Collections.Generic;
using System.Collections.Concurrent;
Modified: mcs/class/corlib/System.Threading.Tasks/ParallelLoopResult.cs
===================================================================
--- a/mcs/class/corlib/System.Threading.Tasks/ParallelLoopResult.cs
+++ b/mcs/class/corlib/System.Threading.Tasks/ParallelLoopResult.cs
@@ -24,7 +24,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
namespace System.Threading.Tasks
Modified: mcs/class/corlib/System.Threading.Tasks/ParallelLoopState.cs
===================================================================
--- a/mcs/class/corlib/System.Threading.Tasks/ParallelLoopState.cs
+++ b/mcs/class/corlib/System.Threading.Tasks/ParallelLoopState.cs
@@ -22,7 +22,7 @@
//
//
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
using System.Threading;
Modified: mcs/class/corlib/System.Threading.Tasks/ParallelOptions.cs
===================================================================
--- a/mcs/class/corlib/System.Threading.Tasks/ParallelOptions.cs
+++ b/mcs/class/corlib/System.Threading.Tasks/ParallelOptions.cs
@@ -24,7 +24,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
using System.Threading;
Modified: mcs/class/corlib/System.Threading.Tasks/Scheduler.cs
===================================================================
--- a/mcs/class/corlib/System.Threading.Tasks/Scheduler.cs
+++ b/mcs/class/corlib/System.Threading.Tasks/Scheduler.cs
@@ -22,7 +22,7 @@
//
//
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
using System.Collections.Concurrent;
Modified: mcs/class/corlib/System.Threading.Tasks/SchedulerProxy.cs
===================================================================
--- a/mcs/class/corlib/System.Threading.Tasks/SchedulerProxy.cs
+++ b/mcs/class/corlib/System.Threading.Tasks/SchedulerProxy.cs
@@ -24,7 +24,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
namespace System.Threading.Tasks
Modified: mcs/class/corlib/System.Threading.Tasks/SimpleConcurrentBag.cs
===================================================================
--- a/mcs/class/corlib/System.Threading.Tasks/SimpleConcurrentBag.cs
+++ b/mcs/class/corlib/System.Threading.Tasks/SimpleConcurrentBag.cs
@@ -24,7 +24,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
using System.Threading;
Modified: mcs/class/corlib/System.Threading.Tasks/Task.cs
===================================================================
--- a/mcs/class/corlib/System.Threading.Tasks/Task.cs
+++ b/mcs/class/corlib/System.Threading.Tasks/Task.cs
@@ -22,7 +22,7 @@
//
//
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
using System.Threading;
Modified: mcs/class/corlib/System.Threading.Tasks/TaskCanceledException.cs
===================================================================
--- a/mcs/class/corlib/System.Threading.Tasks/TaskCanceledException.cs
+++ b/mcs/class/corlib/System.Threading.Tasks/TaskCanceledException.cs
@@ -22,7 +22,7 @@
//
//
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
using System.Runtime.Serialization;
Modified: mcs/class/corlib/System.Threading.Tasks/TaskCompletionSource.cs
===================================================================
--- a/mcs/class/corlib/System.Threading.Tasks/TaskCompletionSource.cs
+++ b/mcs/class/corlib/System.Threading.Tasks/TaskCompletionSource.cs
@@ -24,7 +24,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
using System.Collections.Generic;
Modified: mcs/class/corlib/System.Threading.Tasks/TaskContinuationOptions.cs
===================================================================
--- a/mcs/class/corlib/System.Threading.Tasks/TaskContinuationOptions.cs
+++ b/mcs/class/corlib/System.Threading.Tasks/TaskContinuationOptions.cs
@@ -22,7 +22,7 @@
//
//
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
namespace System.Threading.Tasks
Modified: mcs/class/corlib/System.Threading.Tasks/TaskCreationOptions.cs
===================================================================
--- a/mcs/class/corlib/System.Threading.Tasks/TaskCreationOptions.cs
+++ b/mcs/class/corlib/System.Threading.Tasks/TaskCreationOptions.cs
@@ -22,7 +22,7 @@
//
//
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
namespace System.Threading.Tasks
Modified: mcs/class/corlib/System.Threading.Tasks/TaskFactory.cs
===================================================================
--- a/mcs/class/corlib/System.Threading.Tasks/TaskFactory.cs
+++ b/mcs/class/corlib/System.Threading.Tasks/TaskFactory.cs
@@ -24,7 +24,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
using System.Threading;
Modified: mcs/class/corlib/System.Threading.Tasks/TaskScheduler.cs
===================================================================
--- a/mcs/class/corlib/System.Threading.Tasks/TaskScheduler.cs
+++ b/mcs/class/corlib/System.Threading.Tasks/TaskScheduler.cs
@@ -24,7 +24,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
using System.Threading;
using System.Collections.Generic;
Modified: mcs/class/corlib/System.Threading.Tasks/TaskSchedulerException.cs
===================================================================
--- a/mcs/class/corlib/System.Threading.Tasks/TaskSchedulerException.cs
+++ b/mcs/class/corlib/System.Threading.Tasks/TaskSchedulerException.cs
@@ -22,7 +22,7 @@
//
//
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
using System.Runtime.Serialization;
Modified: mcs/class/corlib/System.Threading.Tasks/TaskStatus.cs
===================================================================
--- a/mcs/class/corlib/System.Threading.Tasks/TaskStatus.cs
+++ b/mcs/class/corlib/System.Threading.Tasks/TaskStatus.cs
@@ -24,7 +24,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
namespace System.Threading.Tasks
Modified: mcs/class/corlib/System.Threading.Tasks/ThreadWorker.cs
===================================================================
--- a/mcs/class/corlib/System.Threading.Tasks/ThreadWorker.cs
+++ b/mcs/class/corlib/System.Threading.Tasks/ThreadWorker.cs
@@ -22,7 +22,7 @@
//
//
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
using System.Threading;
using System.Collections.Concurrent;
Modified: mcs/class/corlib/System.Threading.Tasks/UnobservedTaskExceptionEventArgs.cs
===================================================================
--- a/mcs/class/corlib/System.Threading.Tasks/UnobservedTaskExceptionEventArgs.cs
+++ b/mcs/class/corlib/System.Threading.Tasks/UnobservedTaskExceptionEventArgs.cs
@@ -24,7 +24,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
namespace System.Threading.Tasks
@@ -59,4 +59,4 @@ namespace System.Threading.Tasks
}
#endif
-//
\ No newline at end of file
+//
Modified: mcs/class/corlib/System.Threading/AsyncFlowControl.cs
===================================================================
--- a/mcs/class/corlib/System.Threading/AsyncFlowControl.cs
+++ b/mcs/class/corlib/System.Threading/AsyncFlowControl.cs
@@ -65,7 +65,7 @@ namespace System.Threading {
_t = null;
}
-#if NET_4_0
+#if NET_4_0 || MOBILE
public void Dispose ()
#else
void IDisposable.Dispose ()
Modified: mcs/class/corlib/System.Threading/CancellationToken.cs
===================================================================
--- a/mcs/class/corlib/System.Threading/CancellationToken.cs
+++ b/mcs/class/corlib/System.Threading/CancellationToken.cs
@@ -27,7 +27,7 @@
using System;
using System.Threading;
-#if NET_4_0
+#if NET_4_0 || MOBILE
namespace System.Threading
{
[System.Diagnostics.DebuggerDisplay ("IsCancellationRequested = \
{IsCancellationRequested}")]
Modified: mcs/class/corlib/System.Threading/CancellationTokenRegistration.cs
===================================================================
--- a/mcs/class/corlib/System.Threading/CancellationTokenRegistration.cs
+++ b/mcs/class/corlib/System.Threading/CancellationTokenRegistration.cs
@@ -24,7 +24,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
using System.Threading;
Modified: mcs/class/corlib/System.Threading/CancellationTokenSource.cs
===================================================================
--- a/mcs/class/corlib/System.Threading/CancellationTokenSource.cs
+++ b/mcs/class/corlib/System.Threading/CancellationTokenSource.cs
@@ -24,7 +24,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
using System.Collections.Generic;
Modified: mcs/class/corlib/System.Threading/CountdownEvent.cs
===================================================================
--- a/mcs/class/corlib/System.Threading/CountdownEvent.cs
+++ b/mcs/class/corlib/System.Threading/CountdownEvent.cs
@@ -22,7 +22,7 @@
//
//
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
Modified: mcs/class/corlib/System.Threading/LazyInitializer.cs
===================================================================
--- a/mcs/class/corlib/System.Threading/LazyInitializer.cs
+++ b/mcs/class/corlib/System.Threading/LazyInitializer.cs
@@ -24,7 +24,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
Modified: mcs/class/corlib/System.Threading/LazyThreadSafetyMode.cs
===================================================================
--- a/mcs/class/corlib/System.Threading/LazyThreadSafetyMode.cs
+++ b/mcs/class/corlib/System.Threading/LazyThreadSafetyMode.cs
@@ -26,7 +26,7 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
using System;
Modified: mcs/class/corlib/System.Threading/LockRecursionException.cs
===================================================================
--- a/mcs/class/corlib/System.Threading/LockRecursionException.cs
+++ b/mcs/class/corlib/System.Threading/LockRecursionException.cs
@@ -25,7 +25,7 @@
*/
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
using System.Runtime.Serialization;
Modified: mcs/class/corlib/System.Threading/ManualResetEventSlim.cs
===================================================================
--- a/mcs/class/corlib/System.Threading/ManualResetEventSlim.cs
+++ b/mcs/class/corlib/System.Threading/ManualResetEventSlim.cs
@@ -22,7 +22,7 @@
//
//
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
Modified: mcs/class/corlib/System.Threading/Monitor.cs
===================================================================
--- a/mcs/class/corlib/System.Threading/Monitor.cs
+++ b/mcs/class/corlib/System.Threading/Monitor.cs
@@ -177,7 +177,7 @@ namespace System.Threading
}
}
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
[MethodImplAttribute(MethodImplOptions.InternalCall)]
extern static void try_enter_with_atomic_var (object obj, int millisecondsTimeout, \
ref bool lockTaken);
Modified: mcs/class/corlib/System.Threading/SemaphoreSlim.cs
===================================================================
--- a/mcs/class/corlib/System.Threading/SemaphoreSlim.cs
+++ b/mcs/class/corlib/System.Threading/SemaphoreSlim.cs
@@ -25,7 +25,7 @@
using System;
using System.Diagnostics;
-#if NET_4_0
+#if NET_4_0 || MOBILE
namespace System.Threading
{
[System.Diagnostics.DebuggerDisplayAttribute ("Current Count = {currCount}")]
Modified: mcs/class/corlib/System.Threading/SpinLock.cs
===================================================================
--- a/mcs/class/corlib/System.Threading/SpinLock.cs
+++ b/mcs/class/corlib/System.Threading/SpinLock.cs
@@ -22,7 +22,7 @@
//
//
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
using System.Collections.Concurrent;
Modified: mcs/class/corlib/System.Threading/SpinWait.cs
===================================================================
--- a/mcs/class/corlib/System.Threading/SpinWait.cs
+++ b/mcs/class/corlib/System.Threading/SpinWait.cs
@@ -22,7 +22,7 @@
//
//
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
namespace System.Threading
Modified: mcs/class/corlib/System.Threading/Thread.cs
===================================================================
--- a/mcs/class/corlib/System.Threading/Thread.cs
+++ b/mcs/class/corlib/System.Threading/Thread.cs
@@ -360,7 +360,7 @@ namespace System.Threading {
ResetAbort_internal ();
}
-#if NET_4_0
+#if NET_4_0 || MOBILE
[HostProtectionAttribute (SecurityAction.LinkDemand, Synchronization = true, \
ExternalThreading = true)] [MethodImplAttribute(MethodImplOptions.InternalCall)]
public extern static bool Yield ();
Modified: mcs/class/corlib/System.Threading/ThreadLocal.cs
===================================================================
--- a/mcs/class/corlib/System.Threading/ThreadLocal.cs
+++ b/mcs/class/corlib/System.Threading/ThreadLocal.cs
@@ -24,7 +24,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
using System.Runtime.Serialization;
using System.Runtime.InteropServices;
Modified: mcs/class/corlib/System.Threading/WaitHandle.cs
===================================================================
--- a/mcs/class/corlib/System.Threading/WaitHandle.cs
+++ b/mcs/class/corlib/System.Threading/WaitHandle.cs
@@ -213,7 +213,7 @@ namespace System.Threading
GC.SuppressFinalize (this);
}
-#if NET_4_0
+#if NET_4_0 || MOBILE
public void Dispose ()
#else
void IDisposable.Dispose ()
Modified: mcs/class/corlib/System.Threading/Watch.cs
===================================================================
--- a/mcs/class/corlib/System.Threading/Watch.cs
+++ b/mcs/class/corlib/System.Threading/Watch.cs
@@ -22,7 +22,7 @@
//
//
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
namespace System.Threading
Modified: mcs/class/corlib/System/Action.cs
===================================================================
--- a/mcs/class/corlib/System/Action.cs
+++ b/mcs/class/corlib/System/Action.cs
@@ -31,7 +31,7 @@ using System.Runtime.CompilerServices;
namespace System
{
-#if NET_4_0
+#if NET_4_0 || MOBILE
[TypeForwardedFrom (Consts.AssemblySystemCore_3_5)]
public delegate void Action ();
Modified: mcs/class/corlib/System/AggregateException.cs
===================================================================
--- a/mcs/class/corlib/System/AggregateException.cs
+++ b/mcs/class/corlib/System/AggregateException.cs
@@ -22,7 +22,7 @@
//
//
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
using System.Collections.ObjectModel;
using System.Collections.Generic;
Modified: mcs/class/corlib/System/Funcs.cs
===================================================================
--- a/mcs/class/corlib/System/Funcs.cs
+++ b/mcs/class/corlib/System/Funcs.cs
@@ -29,7 +29,7 @@ using System.Runtime.CompilerServices;
namespace System {
-#if NET_4_0
+#if NET_4_0 || MOBILE
[TypeForwardedFrom (Consts.AssemblySystemCore_3_5)]
public delegate TResult Func<out TResult> ();
Modified: mcs/class/corlib/System/OperationCanceledException.cs
===================================================================
--- a/mcs/class/corlib/System/OperationCanceledException.cs
+++ b/mcs/class/corlib/System/OperationCanceledException.cs
@@ -38,7 +38,7 @@ namespace System
public class OperationCanceledException : SystemException
{
const int Result = unchecked ((int)0x8013153b);
-#if NET_4_0
+#if NET_4_0 || MOBILE
CancellationToken? token;
#endif
@@ -66,7 +66,7 @@ namespace System
{
}
-#if NET_4_0
+#if NET_4_0 || MOBILE
public OperationCanceledException (CancellationToken token)
: this ()
{
Modified: mcs/class/corlib/System/Tuple.cs
===================================================================
--- a/mcs/class/corlib/System/Tuple.cs
+++ b/mcs/class/corlib/System/Tuple.cs
@@ -26,7 +26,7 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if MOONLIGHT || NET_4_0
+#if MOONLIGHT || NET_4_0 || MOBILE
using System;
Modified: mcs/class/corlib/System/Tuples.cs
===================================================================
--- a/mcs/class/corlib/System/Tuples.cs
+++ b/mcs/class/corlib/System/Tuples.cs
@@ -27,7 +27,7 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if MOONLIGHT || NET_4_0
+#if MOONLIGHT || NET_4_0 || MOBILE
using System;
using System.Collections;
Commit: 77a05371b4184558c583abd0d96971000c79d250
Author: Marek Safar <marek.safar@gmail.com>
Date: 01/25/2011 05:46:43
URL: https://github.com/mono/mono/commit/77a05371b4184558c583abd0d96971000c79d250
Degrade wrong override member to virtual instead of non-virtual
Changed paths:
M mcs/mcs/import.cs
Modified: mcs/mcs/import.cs
===================================================================
--- a/mcs/mcs/import.cs
+++ b/mcs/mcs/import.cs
@@ -394,6 +394,7 @@ namespace Mono.CSharp
const Modifiers conflict_mask = Modifiers.AccessibilityMask & \
~Modifiers.INTERNAL;
if (candidate == null || (candidate.Modifiers & conflict_mask) != (mod & \
conflict_mask) || candidate.IsStatic) { mod &= ~Modifiers.OVERRIDE;
+ mod |= Modifiers.VIRTUAL;
}
}
}
Commit: b10086345e268c285c101d658fb76ea1df6e57d3
Author: Marek Habersack <grendel@twistedcode.net>
Date: 01/25/2011 09:49:13
URL: https://github.com/mono/mono/commit/b10086345e268c285c101d658fb76ea1df6e57d3
[wcf] Install the System.Data.Services.Client properly.
Changed paths:
M mcs/class/System.Data.Services.Client/Makefile
Modified: mcs/class/System.Data.Services.Client/Makefile
===================================================================
--- a/mcs/class/System.Data.Services.Client/Makefile
+++ b/mcs/class/System.Data.Services.Client/Makefile
@@ -5,7 +5,6 @@ include ../../build/rules.make
LIBRARY = System.Data.Services.Client.dll
LIBRARY_SNK = ../mono.snk
-LIBRARY_PACKAGE = none
LIB_MCS_FLAGS = \
-d:NET_3_5 \
Commit: f96a9873cc72cef1e47b09842c0162665799b421
Author: Marek Habersack <grendel@twistedcode.net>
Date: 01/25/2011 09:49:19
URL: https://github.com/mono/mono/commit/f96a9873cc72cef1e47b09842c0162665799b421
[system] SmtpClient implements IDisposable on 4.0 (a no-op for now)
Changed paths:
M mcs/class/System/System.Net.Mail/SmtpClient.cs
Modified: mcs/class/System/System.Net.Mail/SmtpClient.cs
===================================================================
--- a/mcs/class/System/System.Net.Mail/SmtpClient.cs
+++ b/mcs/class/System/System.Net.Mail/SmtpClient.cs
@@ -57,6 +57,9 @@ using X509CertificateCollection = \
PrebuiltSystem::System.Security.Cryptography.X
namespace System.Net.Mail {
public class SmtpClient
+#if NET_4_0
+ : IDisposable
+#endif
{
#region Fields
@@ -255,7 +258,18 @@ namespace System.Net.Mail {
#endregion // Events
#region Methods
+#if NET_4_0
+ public void Dispose ()
+ {
+ Dispose (true);
+ }
+ [MonoTODO ("Does nothing at the moment.")]
+ protected virtual void Dispose (bool disposing)
+ {
+ // TODO: We should close all the connections and abort any async operations here
+ }
+#endif
private void CheckState ()
{
if (messageInProcess != null)
Commit: 1e0d0e7c4c17a63d94867ca72d8ff3fae47b0228
Author: Marek Habersack <grendel@twistedcode.net>
Date: 01/25/2011 09:49:24
URL: https://github.com/mono/mono/commit/1e0d0e7c4c17a63d94867ca72d8ff3fae47b0228
[corlib,crypto] RandomNumberGenerator implements IDisposable in 4.0
Changed paths:
M mcs/class/corlib/System.Security.Cryptography/RandomNumberGenerator.cs
Modified: mcs/class/corlib/System.Security.Cryptography/RandomNumberGenerator.cs
===================================================================
--- a/mcs/class/corlib/System.Security.Cryptography/RandomNumberGenerator.cs
+++ b/mcs/class/corlib/System.Security.Cryptography/RandomNumberGenerator.cs
@@ -34,7 +34,11 @@ namespace System.Security.Cryptography {
#if !NET_2_1
[ComVisible (true)]
#endif
- public abstract class RandomNumberGenerator {
+ public abstract class RandomNumberGenerator
+#if NET_4_0
+ : IDisposable
+#endif
+ {
protected RandomNumberGenerator ()
{
@@ -54,5 +58,14 @@ namespace System.Security.Cryptography {
public abstract void GetBytes (byte[] data);
public abstract void GetNonZeroBytes (byte[] data);
+#if NET_4_0
+ public void Dispose ()
+ {
+ Dispose (true);
+ }
+
+ protected virtual void Dispose (bool disposing)
+ {}
+#endif
}
}
Commit: f97c2388cb64c2aeb5de42c588307c515efba60c
Author: Mark Probst <mark.probst@gmail.com>
Date: 01/25/2011 10:35:16
URL: https://github.com/mono/mono/commit/f97c2388cb64c2aeb5de42c588307c515efba60c
Merge branch 'sgen-android' into mono-2-10
Conflicts:
mono/metadata/sgen-gc.c
Changed paths:
M configure.in
M data/Makefile.am
M mono-core.spec.in
M mono/metadata/Makefile.am
M mono/metadata/sgen-gc.c
M mono/metadata/sgen-gc.h
M mono/metadata/sgen-internal.c
Added paths:
A data/monosgen-2.pc.in
A mono/metadata/sgen-bridge.c
A mono/metadata/sgen-bridge.h
Modified: configure.in
===================================================================
--- a/configure.in
+++ b/configure.in
@@ -2876,6 +2876,7 @@ data/net_4_0/Makefile
data/net_2_0/Browsers/Makefile
data/mint.pc
data/mono-2.pc
+data/monosgen-2.pc
data/mono.pc
data/mono-cairo.pc
data/mono-nunit.pc
Modified: data/Makefile.am
===================================================================
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -9,7 +9,7 @@ monodir = $(sysconfdir)/mono
EXTRA_DIST = \
config.in \
browscap.ini mono.supp mono.d README ChangeLog \
- mono.pc.in mono-2.pc.in mint.pc.in dotnet.pc.in dotnet35.pc.in wcf.pc.in \
monodoc.pc.in \ + mono.pc.in mono-2.pc.in monosgen-2.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 \ mono-lineeditor.pc.in \
system.web.extensions_1.0.pc.in system.web.extensions.design_1.0.pc.in\ \
dtrace-prelink.sh mono.web.pc.in system.web.mvc.pc.in system.web.mvc2.pc.in \ @@ \
-19,20 +19,26 @@ EXTRA_DIST = \
pkgconfigdir = $(libdir)/pkgconfig
+if SUPPORT_SGEN
+SGENPCFILE=monosgen-2.pc
+else
+SGENPCFILE=
+endif
+
if JIT_SUPPORTED
if INTERP_SUPPORTED
pkgconfig_DATA= mono.pc mono-2.pc mint.pc dotnet.pc dotnet35.pc wcf.pc mono-nunit.pc \
mono-cairo.pc mono-options.pc cecil.pc monodoc.pc mono-lineeditor.pc \
system.web.extensions_1.0.pc \
- system.web.extensions.design_1.0.pc mono.web.pc system.web.mvc.pc \
system.web.mvc2.pc + system.web.extensions.design_1.0.pc mono.web.pc \
system.web.mvc.pc system.web.mvc2.pc $(SGENPCFILE) else
pkgconfig_DATA= mono.pc mono-2.pc dotnet.pc dotnet35.pc wcf.pc mono-nunit.pc \
mono-cairo.pc mono-options.pc cecil.pc monodoc.pc mono-lineeditor.pc \
system.web.extensions_1.0.pc \
- system.web.extensions.design_1.0.pc mono.web.pc system.web.mvc.pc \
system.web.mvc2.pc + system.web.extensions.design_1.0.pc mono.web.pc \
system.web.mvc.pc system.web.mvc2.pc $(SGENPCFILE) endif
else
pkgconfig_DATA= mint.pc mono-nunit.pc mono-cairo.pc mono-options.pc cecil.pc \
monodoc.pc mono-lineeditor.pc endif
DISTCLEANFILES= mono-2.pc mono.pc mint.pc dotnet.pc dotnet35.pc wcf.pc mono-nunit.pc \
mono-cairo.pc mono-options.pc cecil.pc monodoc.pc mono-lineeditor.pc \
system.web.extensions_1.0.pc \
- system.web.extensions.design_1.0.pc mono.web.pc system.web.mvc.pc \
system.web.mvc2.pc + system.web.extensions.design_1.0.pc mono.web.pc \
system.web.mvc.pc system.web.mvc2.pc $(SGENPCFILE)
mono_DATA = config \
browscap.ini
Modified: mono-core.spec.in
===================================================================
--- a/mono-core.spec.in
+++ b/mono-core.spec.in
@@ -350,6 +350,7 @@ A Library for embedding Mono in your Application (sgen version).
%files -n libmonosgen-2_0-0
%defattr(-, root, root)
%_libdir/libmonosgen-2.0.so.0*
+%_libdir/pkgconfig/monosgen-2.pc
%post -n libmonosgen-2_0-0 -p /sbin/ldconfig
Modified: mono/metadata/Makefile.am
===================================================================
--- a/mono/metadata/Makefile.am
+++ b/mono/metadata/Makefile.am
@@ -191,6 +191,8 @@ libmonoruntime_la_SOURCES = \
sgen-major-copying.c \
sgen-los.c \
sgen-protocol.c \
+ sgen-bridge.c \
+ sgen-bridge.h \
sgen-gc.h \
sgen-archdep.h \
sgen-cardtable.h \
@@ -253,6 +255,7 @@ libmonoruntimeinclude_HEADERS = \
mono-config.h \
mono-debug.h \
mono-gc.h \
+ sgen-bridge.h \
object.h \
opcodes.h \
profiler.h \
Modified: mono/metadata/sgen-gc.c
===================================================================
--- a/mono/metadata/sgen-gc.c
+++ b/mono/metadata/sgen-gc.c
@@ -202,6 +202,7 @@
#include "metadata/sgen-cardtable.h"
#include "metadata/sgen-protocol.h"
#include "metadata/sgen-archdep.h"
+#include "metadata/sgen-bridge.h"
#include "metadata/mono-gc.h"
#include "metadata/method-builder.h"
#include "metadata/profiler-private.h"
@@ -2443,6 +2444,28 @@ get_finalize_entry_hash_table (int generation)
}
}
+static MonoObject **finalized_array = NULL;
+static int finalized_array_capacity = 0;
+static int finalized_array_entries = 0;
+
+static void
+bridge_register_finalized_object (MonoObject *object)
+{
+ if (!finalized_array)
+ return;
+
+ if (finalized_array_entries >= finalized_array_capacity) {
+ MonoObject **new_array;
+ g_assert (finalized_array_entries == finalized_array_capacity);
+ finalized_array_capacity *= 2;
+ new_array = mono_sgen_alloc_internal_dynamic (sizeof (MonoObject*) * \
finalized_array_capacity, INTERNAL_MEM_BRIDGE_DATA); + memcpy (new_array, \
finalized_array, sizeof (MonoObject*) * finalized_array_entries); \
+ mono_sgen_free_internal_dynamic (finalized_array, sizeof (MonoObject*) * \
finalized_array_entries, INTERNAL_MEM_BRIDGE_DATA); + finalized_array = new_array;
+ }
+ finalized_array [finalized_array_entries++] = object;
+}
+
static void
finish_gray_stack (char *start_addr, char *end_addr, int generation, GrayQueue \
*queue) {
@@ -2450,6 +2473,7 @@ finish_gray_stack (char *start_addr, char *end_addr, int \
generation, GrayQueue * TV_DECLARE (btv);
int fin_ready;
int ephemeron_rounds = 0;
+ int num_loops;
CopyOrMarkObjectFunc copy_func = current_collection_generation == \
GENERATION_NURSERY ? major_collector.copy_object : \
major_collector.copy_or_mark_object;
/*
@@ -2477,6 +2501,12 @@ finish_gray_stack (char *start_addr, char *end_addr, int \
generation, GrayQueue * if (generation == GENERATION_OLD)
null_link_in_range (copy_func, start_addr, end_addr, GENERATION_NURSERY, TRUE, \
queue);
+ if (finalized_array == NULL && mono_sgen_need_bridge_processing ()) {
+ finalized_array_capacity = 32;
+ finalized_array = mono_sgen_alloc_internal_dynamic (sizeof (MonoObject*) * \
finalized_array_capacity, INTERNAL_MEM_BRIDGE_DATA); + }
+ finalized_array_entries = 0;
+
/* walk the finalization queue and move also the objects that need to be
* finalized: use the finalized objects as new roots so the objects they depend
* on are also not reclaimed. As with the roots above, only objects in the nursery
@@ -2484,6 +2514,7 @@ finish_gray_stack (char *start_addr, char *end_addr, int \
generation, GrayQueue *
* We need a loop here, since objects ready for finalizers may reference other \
objects
* that are fin-ready. Speedup with a flag?
*/
+ num_loops = 0;
do {
/*
* Walk the ephemeron tables marking all values with reachable keys. This must be \
completely done @@ -2504,11 +2535,20 @@ finish_gray_stack (char *start_addr, char \
*end_addr, int generation, GrayQueue * if (generation == GENERATION_OLD)
finalize_in_range (copy_func, nursery_start, nursery_real_end, \
GENERATION_NURSERY, queue);
+ if (fin_ready != num_ready_finalizers) {
+ ++num_loops;
+ if (finalized_array != NULL)
+ mono_sgen_bridge_processing (finalized_array_entries, finalized_array);
+ }
+
/* drain the new stack that might have been created */
DEBUG (6, fprintf (gc_debug_file, "Precise scan of gray area post fin\n"));
drain_gray_stack (queue);
} while (fin_ready != num_ready_finalizers);
+ if (mono_sgen_need_bridge_processing ())
+ g_assert (num_loops <= 1);
+
/*
* Clear ephemeron pairs with unreachable keys.
* We pass the copy func so we can figure out if an array was promoted or not.
@@ -4070,6 +4110,7 @@ finalize_in_range (CopyOrMarkObjectFunc copy_func, char *start, \
char *end, int g num_ready_finalizers++;
hash_table->num_registered--;
queue_finalization_entry (entry);
+ bridge_register_finalized_object ((MonoObject*)copy);
/* Make it survive */
from = entry->object;
entry->object = copy;
@@ -4124,6 +4165,16 @@ object_is_reachable (char *object, char *start, char *end)
return !object_is_fin_ready (object) || major_collector.is_object_live (object);
}
+gboolean
+mono_sgen_object_is_live (void *obj)
+{
+ if (ptr_in_nursery (obj))
+ return object_is_pinned (obj);
+ if (current_collection_generation == GENERATION_NURSERY)
+ return FALSE;
+ return major_collector.is_object_live (obj);
+}
+
/* LOCKING: requires that the GC lock is held */
static void
null_ephemerons_for_domain (MonoDomain *domain)
@@ -6926,10 +6977,6 @@ mono_gc_base_init (void)
struct sigaction sinfo;
glong max_heap = 0;
-#ifdef PLATFORM_ANDROID
- g_assert_not_reached ();
-#endif
-
/* the gc_initialized guard seems to imply this method is
idempotent, but LOCK_INIT(gc_mutex) might not be. It's
defined in sgen-gc.h as nothing, so there's no danger at
Modified: mono/metadata/sgen-gc.h
===================================================================
--- a/mono/metadata/sgen-gc.h
+++ b/mono/metadata/sgen-gc.h
@@ -612,6 +612,7 @@ enum {
INTERNAL_MEM_MS_BLOCK_INFO,
INTERNAL_MEM_EPHEMERON_LINK,
INTERNAL_MEM_WORKER_DATA,
+ INTERNAL_MEM_BRIDGE_DATA,
INTERNAL_MEM_MAX
};
@@ -768,6 +769,11 @@ mono_sgen_par_object_get_size (MonoVTable *vtable, MonoObject* \
o)
const char* mono_sgen_safe_name (void* obj) MONO_INTERNAL;
+gboolean mono_sgen_object_is_live (void *obj) MONO_INTERNAL;
+
+gboolean mono_sgen_need_bridge_processing (void) MONO_INTERNAL;
+void mono_sgen_bridge_processing (int num_objs, MonoObject **objs) MONO_INTERNAL;
+
enum {
SPACE_MAJOR,
SPACE_LOS
Modified: mono/metadata/sgen-internal.c
===================================================================
--- a/mono/metadata/sgen-internal.c
+++ b/mono/metadata/sgen-internal.c
@@ -494,7 +494,8 @@ mono_sgen_dump_internal_mem_usage (FILE *heap_dump_file)
"fin-table", "finalize-entry", "dislink-table",
"dislink", "roots-table", "root-record", "statistics",
"remset", "gray-queue", "store-remset", "marksweep-tables",
- "marksweep-block-info", "ephemeron-link" };
+ "marksweep-block-info", "ephemeron-link", "worker-data",
+ "bridge-data" };
int i;
Added: data/monosgen-2.pc.in
===================================================================
--- /dev/null
+++ b/data/monosgen-2.pc.in
@@ -0,0 +1,12 @@
+prefix=${pcfiledir}/../..
+exec_prefix=${pcfiledir}/../..
+libdir=${prefix}/@reloc_libdir@
+includedir=${prefix}/include/mono-@API_VER@
+sysconfdir=@sysconfdir@
+
+Name: Mono
+Description: Mono Runtime
+Version: @VERSION@
+Libs: -L${libdir} @export_ldflags@ -lmonosgen-@API_VER@ @libmono_ldflags@
+Cflags: -I${includedir} @libmono_cflags@
+
Added: mono/metadata/sgen-bridge.c
===================================================================
--- /dev/null
+++ b/mono/metadata/sgen-bridge.c
@@ -0,0 +1,707 @@
+/*
+ * sgen-bridge.c: Simple generational GC.
+ *
+ * Copyright 2011 Novell, Inc (http://www.novell.com)
+ *
+ * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
+ * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
+ *
+ * Permission is hereby granted to use or copy this program
+ * for any purpose, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ *
+ * Copyright 2001-2003 Ximian, Inc
+ * Copyright 2003-2010 Novell, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifdef HAVE_SGEN_GC
+
+#include <stdlib.h>
+
+#include "sgen-gc.h"
+#include "sgen-bridge.h"
+
+typedef struct {
+ int size;
+ int elem_size;
+ int capacity;
+ char *data;
+} DynArray;
+
+#define DYN_ARRAY_REF(da,i) ((void*)((da)->data + (i) * (da)->elem_size))
+#define DYN_ARRAY_PTR_REF(da,i) (((void**)(da)->data) [(i)])
+#define DYN_ARRAY_INT_REF(da,i) (((int*)(da)->data) [(i)])
+
+static void
+dyn_array_init (DynArray *da, int elem_size)
+{
+ da->size = 0;
+ da->elem_size = elem_size;
+ da->capacity = 0;
+ da->data = NULL;
+}
+
+static void
+dyn_array_ptr_init (DynArray *da)
+{
+ dyn_array_init (da, sizeof (void*));
+}
+
+static void
+dyn_array_int_init (DynArray *da)
+{
+ dyn_array_init (da, sizeof (int));
+}
+
+static void
+dyn_array_uninit (DynArray *da)
+{
+ if (da->capacity <= 0)
+ return;
+
+ mono_sgen_free_internal_dynamic (da->data, da->elem_size * da->capacity, \
INTERNAL_MEM_BRIDGE_DATA); + da->data = NULL;
+}
+
+static void
+dyn_array_ensure_capacity (DynArray *da, int capacity)
+{
+ char *new_data;
+
+ if (capacity <= da->capacity)
+ return;
+
+ if (da->capacity == 0)
+ da->capacity = 2;
+ while (capacity > da->capacity)
+ da->capacity *= 2;
+
+ new_data = mono_sgen_alloc_internal_dynamic (da->elem_size * da->capacity, \
INTERNAL_MEM_BRIDGE_DATA); + memcpy (new_data, da->data, da->elem_size * da->size);
+ mono_sgen_free_internal_dynamic (da->data, da->elem_size * da->size, \
INTERNAL_MEM_BRIDGE_DATA); + da->data = new_data;
+}
+
+static void*
+dyn_array_add (DynArray *da)
+{
+ void *p;
+
+ dyn_array_ensure_capacity (da, da->size + 1);
+
+ p = DYN_ARRAY_REF (da, da->size);
+ ++da->size;
+ return p;
+}
+
+static void
+dyn_array_ptr_add (DynArray *da, void *ptr)
+{
+ void **p = dyn_array_add (da);
+ *p = ptr;
+}
+
+#define dyn_array_ptr_push dyn_array_ptr_add
+
+static void*
+dyn_array_ptr_pop (DynArray *da)
+{
+ void *p;
+ g_assert (da->size > 0);
+ p = DYN_ARRAY_PTR_REF (da, da->size - 1);
+ --da->size;
+ return p;
+}
+
+static void
+dyn_array_int_add (DynArray *da, int x)
+{
+ int *p = dyn_array_add (da);
+ *p = x;
+}
+
+/*
+static gboolean
+dyn_array_ptr_contains (DynArray *da, void *ptr)
+{
+ int i;
+ for (i = 0; i < da->size; ++i)
+ if (DYN_ARRAY_PTR_REF (da, i) == ptr)
+ return TRUE;
+ return FALSE;
+}
+*/
+
+static gboolean
+dyn_array_int_contains (DynArray *da, int x)
+{
+ int i;
+ for (i = 0; i < da->size; ++i)
+ if (DYN_ARRAY_INT_REF (da, i) == x)
+ return TRUE;
+ return FALSE;
+}
+
+static void
+dyn_array_append (DynArray *dst, DynArray *src)
+{
+ g_assert (dst->elem_size == src->elem_size);
+
+ dyn_array_ensure_capacity (dst, dst->size + src->size);
+ memcpy (DYN_ARRAY_REF (dst, dst->size), DYN_ARRAY_REF (src, 0), src->size * \
src->elem_size); + dst->size += src->size;
+}
+
+/*
+ * FIXME: Optimizations:
+ *
+ * Don't allocate a scrs array for just one source. Most objects have
+ * just one source, so use the srcs pointer itself.
+ */
+typedef struct _HashEntry {
+ MonoObject *obj;
+ gboolean is_bridge;
+ gboolean is_visited;
+
+ int finishing_time;
+
+ DynArray srcs;
+
+ int scc_index;
+
+ struct _HashEntry *next;
+} HashEntry;
+
+typedef struct _SCC {
+ int index;
+ int api_index;
+ int num_bridge_entries;
+ DynArray xrefs; /* these are incoming, not outgoing */
+} SCC;
+
+static int num_hash_entries = 0;
+static int hash_size = 0;
+static HashEntry **hash_table = NULL;
+
+static MonoGCBridgeCallbacks bridge_callbacks;
+
+static int current_time;
+
+void
+mono_gc_register_bridge_callbacks (MonoGCBridgeCallbacks *callbacks)
+{
+ bridge_callbacks = *callbacks;
+}
+
+gboolean
+mono_sgen_need_bridge_processing (void)
+{
+ return bridge_callbacks.cross_references != NULL;
+}
+
+static HashEntry**
+alloc_hash_table (int size)
+{
+ HashEntry **table;
+ table = mono_sgen_alloc_internal_dynamic (sizeof (HashEntry*) * size, \
INTERNAL_MEM_BRIDGE_DATA); + memset (table, 0, sizeof (HashEntry*) * size);
+ return table;
+}
+
+static void
+rehash (void)
+{
+ HashEntry **new_table;
+ int new_size = hash_size << 1;
+ int i;
+
+ new_table = alloc_hash_table (new_size);
+ for (i = 0; i < hash_size; ++i) {
+ HashEntry *entry = hash_table [i];
+ while (entry != NULL) {
+ HashEntry *next = entry->next;
+ int hash = ((mword)entry->obj >> 4) & (new_size - 1);
+ entry->next = new_table [hash];
+ new_table [hash] = entry;
+ entry = next;
+ }
+ }
+
+ mono_sgen_free_internal_dynamic (hash_table, sizeof (HashEntry*) * hash_size, \
INTERNAL_MEM_BRIDGE_DATA); +
+ hash_table = new_table;
+ hash_size = new_size;
+}
+
+static HashEntry*
+lookup_hash_entry (MonoObject *obj)
+{
+ int hash = (mword)obj >> 4;
+ HashEntry *entry;
+
+ if (!hash_table) {
+ g_assert (hash_size == 0 && num_hash_entries == 0);
+ hash_size = 32;
+ hash_table = alloc_hash_table (hash_size);
+ }
+
+ hash &= hash_size - 1;
+ for (entry = hash_table [hash]; entry != NULL; entry = entry->next) {
+ if (entry->obj == obj)
+ return entry;
+ }
+
+ return NULL;
+}
+
+static HashEntry*
+get_hash_entry (MonoObject *obj)
+{
+ HashEntry *entry = lookup_hash_entry (obj);
+ int hash;
+
+ if (entry)
+ return entry;
+
+ entry = mono_sgen_alloc_internal_dynamic (sizeof (HashEntry), \
INTERNAL_MEM_BRIDGE_DATA); + memset (entry, 0, sizeof (HashEntry));
+
+ entry->obj = obj;
+ dyn_array_ptr_init (&entry->srcs);
+ entry->finishing_time = -1;
+ entry->scc_index = -1;
+
+ hash = ((mword)obj >> 4) & (hash_size - 1);
+ entry->next = hash_table [hash];
+ hash_table [hash] = entry;
+
+ ++num_hash_entries;
+
+ if (num_hash_entries > hash_size >> 1)
+ rehash ();
+
+ return entry;
+}
+
+static void
+add_source (HashEntry *entry, HashEntry *src)
+{
+ dyn_array_ptr_add (&entry->srcs, src);
+}
+
+static void
+free_data (void)
+{
+ int i;
+ int total_srcs = 0;
+ int max_srcs = 0;
+
+ if (hash_table == NULL)
+ return;
+
+ for (i = 0; i < hash_size; ++i) {
+ HashEntry *entry = hash_table [i];
+ while (entry != NULL) {
+ HashEntry *next = entry->next;
+ total_srcs += entry->srcs.size;
+ if (entry->srcs.size > max_srcs)
+ max_srcs = entry->srcs.size;
+ dyn_array_uninit (&entry->srcs);
+ mono_sgen_free_internal_dynamic (entry, sizeof (HashEntry), \
INTERNAL_MEM_BRIDGE_DATA); + entry = next;
+ }
+ }
+
+ mono_sgen_free_internal_dynamic (hash_table, sizeof (HashEntry*) * hash_size, \
INTERNAL_MEM_BRIDGE_DATA); +
+ hash_size = 0;
+ num_hash_entries = 0;
+ hash_table = NULL;
+
+ //g_print ("total srcs %d - max %d\n", total_srcs, max_srcs);
+}
+
+static void
+register_bridge_object (MonoObject *obj)
+{
+ HashEntry *entry = get_hash_entry (obj);
+ g_assert (!entry->is_bridge);
+ entry->is_bridge = TRUE;
+}
+
+static void
+register_finishing_time (HashEntry *entry, int t)
+{
+ g_assert (entry->finishing_time < 0);
+ entry->finishing_time = t;
+}
+
+static gboolean
+object_is_live (MonoObject **objp)
+{
+ MonoObject *obj = *objp;
+ MonoObject *fwd = SGEN_OBJECT_IS_FORWARDED (obj);
+ if (fwd) {
+ *objp = fwd;
+ return lookup_hash_entry (fwd) == NULL;
+ }
+ if (!mono_sgen_object_is_live (obj))
+ return FALSE;
+ return lookup_hash_entry (obj) == NULL;
+}
+
+static DynArray dfs_stack;
+
+#undef HANDLE_PTR
+#define HANDLE_PTR(ptr,obj) do { \
+ MonoObject *dst = (MonoObject*)*(ptr); \
+ if (dst && !object_is_live (&dst)) { \
+ dyn_array_ptr_push (&dfs_stack, obj_entry); \
+ dyn_array_ptr_push (&dfs_stack, get_hash_entry (dst)); \
+ } \
+ } while (0)
+
+static void
+dfs1 (HashEntry *obj_entry, HashEntry *src)
+{
+ g_assert (dfs_stack.size == 0);
+
+ dyn_array_ptr_push (&dfs_stack, src);
+ dyn_array_ptr_push (&dfs_stack, obj_entry);
+
+ do {
+ MonoObject *obj;
+ char *start;
+
+ obj_entry = dyn_array_ptr_pop (&dfs_stack);
+ if (obj_entry) {
+ src = dyn_array_ptr_pop (&dfs_stack);
+
+ obj = obj_entry->obj;
+ start = (char*)obj;
+
+ if (src) {
+ //g_print ("link %s -> %s\n", mono_sgen_safe_name (src->obj), \
mono_sgen_safe_name (obj)); + add_source (obj_entry, src);
+ } else {
+ //g_print ("starting with %s\n", mono_sgen_safe_name (obj));
+ }
+
+ if (obj_entry->is_visited)
+ continue;
+
+ obj_entry->is_visited = TRUE;
+
+ dyn_array_ptr_push (&dfs_stack, obj_entry);
+ /* NULL marks that the next entry is to be finished */
+ dyn_array_ptr_push (&dfs_stack, NULL);
+
+#include "sgen-scan-object.h"
+ } else {
+ obj_entry = dyn_array_ptr_pop (&dfs_stack);
+
+ //g_print ("finish %s\n", mono_sgen_safe_name (obj_entry->obj));
+ register_finishing_time (obj_entry, current_time++);
+ }
+ } while (dfs_stack.size > 0);
+}
+
+static void
+scc_add_xref (SCC *src, SCC *dst)
+{
+ g_assert (src != dst);
+ g_assert (src->index != dst->index);
+
+ if (dyn_array_int_contains (&dst->xrefs, src->index))
+ return;
+ if (src->num_bridge_entries) {
+ dyn_array_int_add (&dst->xrefs, src->index);
+ } else {
+ int i;
+ // FIXME: uniq here
+ dyn_array_append (&dst->xrefs, &src->xrefs);
+ for (i = 0; i < dst->xrefs.size; ++i)
+ g_assert (DYN_ARRAY_INT_REF (&dst->xrefs, i) != dst->index);
+ }
+}
+
+static void
+scc_add_entry (SCC *scc, HashEntry *entry)
+{
+ g_assert (entry->scc_index < 0);
+ entry->scc_index = scc->index;
+ if (entry->is_bridge)
+ ++scc->num_bridge_entries;
+}
+
+static DynArray sccs;
+static SCC *current_scc;
+
+static void
+dfs2 (HashEntry *entry)
+{
+ int i;
+
+ g_assert (dfs_stack.size == 0);
+
+ dyn_array_ptr_push (&dfs_stack, entry);
+
+ do {
+ entry = dyn_array_ptr_pop (&dfs_stack);
+
+ if (entry->scc_index >= 0) {
+ if (entry->scc_index != current_scc->index)
+ scc_add_xref (DYN_ARRAY_REF (&sccs, entry->scc_index), current_scc);
+ continue;
+ }
+
+ scc_add_entry (current_scc, entry);
+
+ for (i = 0; i < entry->srcs.size; ++i)
+ dyn_array_ptr_push (&dfs_stack, DYN_ARRAY_PTR_REF (&entry->srcs, i));
+ } while (dfs_stack.size > 0);
+}
+
+static int
+compare_hash_entries (const void *ep1, const void *ep2)
+{
+ HashEntry *e1 = *(HashEntry**)ep1;
+ HashEntry *e2 = *(HashEntry**)ep2;
+ return e2->finishing_time - e1->finishing_time;
+}
+
+void
+mono_sgen_bridge_processing (int num_objs, MonoObject **objs)
+{
+ HashEntry **all_entries;
+ int j = 0;
+ int num_sccs, num_xrefs;
+ int max_entries, max_xrefs;
+ int i;
+ MonoGCBridgeSCC **api_sccs;
+ MonoGCBridgeXRef *api_xrefs;
+
+ g_assert (mono_sgen_need_bridge_processing ());
+
+ //g_print ("%d finalized objects\n", num_objs);
+
+ /* remove objects that are not bridge objects */
+
+ for (i = 0; i < num_objs; ++i) {
+ MonoObject *obj = objs [i];
+ //g_assert (!mono_sgen_object_is_live (obj));
+ if (bridge_callbacks.is_bridge_object (obj)) {
+ register_bridge_object (obj);
+ objs [j++] = obj;
+ }
+ }
+ num_objs = j;
+
+ //g_print ("%d bridge objects\n", num_objs);
+
+ /* first DFS pass */
+
+ dyn_array_ptr_init (&dfs_stack);
+
+ current_time = 0;
+ for (i = 0; i < num_objs; ++i)
+ dfs1 (get_hash_entry (objs [i]), NULL);
+
+ //g_print ("%d entries - hash size %d\n", num_hash_entries, hash_size);
+
+ /* alloc and fill array of all entries */
+
+ all_entries = mono_sgen_alloc_internal_dynamic (sizeof (HashEntry*) * \
num_hash_entries, INTERNAL_MEM_BRIDGE_DATA); +
+ j = 0;
+ max_entries = 0;
+ for (i = 0; i < hash_size; ++i) {
+ HashEntry *entry;
+ int length = 0;
+ for (entry = hash_table [i]; entry != NULL; entry = entry->next) {
+ g_assert (entry->finishing_time >= 0);
+ all_entries [j++] = entry;
+ ++length;
+ }
+ if (length > max_entries)
+ max_entries = length;
+ }
+ g_assert (j == num_hash_entries);
+
+ //g_print ("max hash bucket length %d\n", max_entries);
+
+ /* sort array according to decreasing finishing time */
+
+ qsort (all_entries, num_hash_entries, sizeof (HashEntry*), compare_hash_entries);
+
+ /* second DFS pass */
+
+ dyn_array_init (&sccs, sizeof (SCC));
+ for (i = 0; i < num_hash_entries; ++i) {
+ HashEntry *entry = all_entries [i];
+ if (entry->scc_index < 0) {
+ int index = sccs.size;
+ current_scc = dyn_array_add (&sccs);
+ current_scc->index = index;
+ current_scc->num_bridge_entries = 0;
+ current_scc->api_index = -1;
+ dyn_array_int_init (¤t_scc->xrefs);
+
+ dfs2 (entry);
+ }
+ }
+
+ //g_print ("%d sccs\n", sccs.size);
+
+ dyn_array_uninit (&dfs_stack);
+
+ /* init data for callback */
+
+ num_sccs = 0;
+ for (i = 0; i < sccs.size; ++i) {
+ SCC *scc = DYN_ARRAY_REF (&sccs, i);
+ g_assert (scc->index == i);
+ if (scc->num_bridge_entries)
+ ++num_sccs;
+ }
+
+ api_sccs = mono_sgen_alloc_internal_dynamic (sizeof (MonoGCBridgeSCC*) * num_sccs, \
INTERNAL_MEM_BRIDGE_DATA); + num_xrefs = 0;
+ j = 0;
+ for (i = 0; i < sccs.size; ++i) {
+ SCC *scc = DYN_ARRAY_REF (&sccs, i);
+ if (!scc->num_bridge_entries)
+ continue;
+
+ api_sccs [j] = mono_sgen_alloc_internal_dynamic (sizeof (MonoGCBridgeSCC) + sizeof \
(MonoObject*) * scc->num_bridge_entries, INTERNAL_MEM_BRIDGE_DATA); + api_sccs \
[j]->num_objs = scc->num_bridge_entries; + scc->num_bridge_entries = 0;
+ scc->api_index = j++;
+
+ num_xrefs += scc->xrefs.size;
+ }
+
+ for (i = 0; i < hash_size; ++i) {
+ HashEntry *entry;
+ for (entry = hash_table [i]; entry != NULL; entry = entry->next) {
+ SCC *scc;
+ if (!entry->is_bridge)
+ continue;
+ scc = DYN_ARRAY_REF (&sccs, entry->scc_index);
+ api_sccs [scc->api_index]->objs [scc->num_bridge_entries++] = entry->obj;
+ }
+ }
+
+ api_xrefs = mono_sgen_alloc_internal_dynamic (sizeof (MonoGCBridgeXRef) * \
num_xrefs, INTERNAL_MEM_BRIDGE_DATA); + j = 0;
+ for (i = 0; i < sccs.size; ++i) {
+ int k;
+ SCC *scc = DYN_ARRAY_REF (&sccs, i);
+ if (!scc->num_bridge_entries)
+ continue;
+ for (k = 0; k < scc->xrefs.size; ++k) {
+ SCC *src_scc = DYN_ARRAY_REF (&sccs, DYN_ARRAY_INT_REF (&scc->xrefs, k));
+ if (!src_scc->num_bridge_entries)
+ continue;
+ api_xrefs [j].src_scc_index = src_scc->api_index;
+ api_xrefs [j].dst_scc_index = scc->api_index;
+ ++j;
+ }
+ }
+
+ /* free data */
+
+ j = 0;
+ max_entries = max_xrefs = 0;
+ for (i = 0; i < sccs.size; ++i) {
+ SCC *scc = DYN_ARRAY_REF (&sccs, i);
+ if (scc->num_bridge_entries)
+ ++j;
+ if (scc->num_bridge_entries > max_entries)
+ max_entries = scc->num_bridge_entries;
+ if (scc->xrefs.size > max_xrefs)
+ max_xrefs = scc->xrefs.size;
+ dyn_array_uninit (&scc->xrefs);
+
+ }
+ dyn_array_uninit (&sccs);
+
+ mono_sgen_free_internal_dynamic (all_entries, sizeof (HashEntry*) * \
num_hash_entries, INTERNAL_MEM_BRIDGE_DATA); +
+ free_data ();
+
+ //g_print ("%d sccs containing bridges - %d max bridge objects - %d max xrefs\n", \
j, max_entries, max_xrefs); +
+ /* callback */
+
+ bridge_callbacks.cross_references (num_sccs, api_sccs, num_xrefs, api_xrefs);
+
+ /* free callback data */
+
+ for (i = 0; i < num_sccs; ++i) {
+ mono_sgen_free_internal_dynamic (api_sccs [i],
+ sizeof (MonoGCBridgeSCC) + sizeof (MonoObject*) * api_sccs [i]->num_objs,
+ INTERNAL_MEM_BRIDGE_DATA);
+ }
+ mono_sgen_free_internal_dynamic (api_sccs, sizeof (MonoGCBridgeSCC*) * num_sccs, \
INTERNAL_MEM_BRIDGE_DATA); +
+ mono_sgen_free_internal_dynamic (api_xrefs, sizeof (MonoGCBridgeXRef) * num_xrefs, \
INTERNAL_MEM_BRIDGE_DATA); +}
+
+static gboolean
+bridge_test_is_bridge_object (MonoObject *obj)
+{
+ return TRUE;
+}
+
+static void
+bridge_test_cross_reference (int num_sccs, MonoGCBridgeSCC **sccs, int num_xrefs, \
MonoGCBridgeXRef *xrefs) +{
+ int i;
+ for (i = 0; i < num_sccs; ++i) {
+ int j;
+ g_print ("--- SCC %d\n", i);
+ for (j = 0; j < sccs [i]->num_objs; ++j)
+ g_print (" %s\n", mono_sgen_safe_name (sccs [i]->objs [j]));
+ }
+ for (i = 0; i < num_xrefs; ++i) {
+ g_assert (xrefs [i].src_scc_index >= 0 && xrefs [i].src_scc_index < num_sccs);
+ g_assert (xrefs [i].dst_scc_index >= 0 && xrefs [i].dst_scc_index < num_sccs);
+ g_print ("%d -> %d\n", xrefs [i].src_scc_index, xrefs [i].dst_scc_index);
+ }
+}
+
+
+void
+mono_sgen_register_test_bridge_callbacks (void)
+{
+ MonoGCBridgeCallbacks callbacks;
+ callbacks.is_bridge_object = bridge_test_is_bridge_object;
+ callbacks.cross_references = bridge_test_cross_reference;
+ mono_gc_register_bridge_callbacks (&callbacks);
+}
+
+#endif
+
Added: mono/metadata/sgen-bridge.h
===================================================================
--- /dev/null
+++ b/mono/metadata/sgen-bridge.h
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2011 Novell, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef _MONO_SGEN_BRIDGE_H_
+#define _MONO_SGEN_BRIDGE_H_
+
+#include <mono/utils/mono-publib.h>
+
+MONO_BEGIN_DECLS
+
+typedef struct {
+ int num_objs;
+ MonoObject *objs [MONO_ZERO_LEN_ARRAY];
+} MonoGCBridgeSCC;
+
+typedef struct {
+ int src_scc_index;
+ int dst_scc_index;
+} MonoGCBridgeXRef;
+
+typedef struct {
+ mono_bool (*is_bridge_object) (MonoObject *obj);
+ void (*cross_references) (int num_sccs, MonoGCBridgeSCC **sccs, int num_xrefs, \
MonoGCBridgeXRef *xrefs); +} MonoGCBridgeCallbacks;
+
+void mono_gc_register_bridge_callbacks (MonoGCBridgeCallbacks *callbacks);
+
+MONO_END_DECLS
+
+#endif
+
Commit: 8c3c6c4b543fba61d58dc065be43ef34ab49ea05
Author: Geoff Norton <grompf@sublimeintervention.com>
Date: 01/25/2011 14:16:11
URL: https://github.com/mono/mono/commit/8c3c6c4b543fba61d58dc065be43ef34ab49ea05
Fix the mobile build
Changed paths:
M mcs/class/System.Core/System/Actions.cs
M mcs/class/System.Core/System/Funcs.cs
Modified: mcs/class/System.Core/System/Actions.cs
===================================================================
--- a/mcs/class/System.Core/System/Actions.cs
+++ b/mcs/class/System.Core/System/Actions.cs
@@ -29,7 +29,7 @@
using System;
using System.Runtime.CompilerServices;
-#if NET_4_0
+#if NET_4_0 || MOBILE
[assembly:TypeForwardedTo (typeof(Action<>))]
[assembly:TypeForwardedTo (typeof(Action<,>))]
[assembly:TypeForwardedTo (typeof(Action<,,>))]
@@ -41,7 +41,7 @@ using System.Runtime.CompilerServices;
namespace System
{
-#if NET_4_0
+#if NET_4_0 || MOBILE
public delegate void Action<in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8, \
in T9> ( T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 \
arg9);
Modified: mcs/class/System.Core/System/Funcs.cs
===================================================================
--- a/mcs/class/System.Core/System/Funcs.cs
+++ b/mcs/class/System.Core/System/Funcs.cs
@@ -25,7 +25,7 @@
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
//
-#if NET_4_0
+#if NET_4_0 || MOBILE
using System;
using System.Runtime.CompilerServices;
@@ -38,7 +38,7 @@ using System.Runtime.CompilerServices;
namespace System
{
-#if NET_4_0
+#if NET_4_0 || MOBILE
public delegate TResult Func<in T1, in T2, in T3, in T4, in T5, in T6, in T7, in \
T8, in T9, out TResult> ( T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 \
arg7, T8 arg8, T9 arg9);
Commit: e9f180be6af6cf8b324dc03d31834e5fe200e887
Author: Miguel de Icaza <miguel@gnome.org>
Date: 01/25/2011 17:56:00
URL: https://github.com/mono/mono/commit/e9f180be6af6cf8b324dc03d31834e5fe200e887
Restoring some of the formal beauty of this text document as
we carefully restore the missing tabs that helped carefully
align the continuation characters in a list of assemblies.
As we align these newline separators, suddenly, a new form
emerges from the chaos, something that gives us the illusion
that this stream of bytes is indeed almost like a dawn of a
new day as we breathe the air in a valley overlooking a beautiful
mountain at the beginning of the spring.
Changed paths:
M mcs/class/Makefile
Modified: mcs/class/Makefile
===================================================================
--- a/mcs/class/Makefile
+++ b/mcs/class/Makefile
@@ -103,8 +103,8 @@ net_2_0_dirs := \
Mono.CSharp \
Moonlight.Build.Tasks \
WindowsBase \
- System.Data.Services \
- System.Data.Services.Client \
+ System.Data.Services \
+ System.Data.Services.Client \
System.Net
net_2_0_only_dirs := \
Commit: dcad2f1b22d0d228d7a4d0524e3e134b37c264fe
Author: Jb Evain <jbevain@gmail.com>
Date: 01/25/2011 18:10:30
URL: https://github.com/mono/mono/commit/dcad2f1b22d0d228d7a4d0524e3e134b37c264fe
[linq] fix Range extreme boundaries
Changed paths:
M mcs/class/System.Core/System.Linq/Enumerable.cs
Modified: mcs/class/System.Core/System.Linq/Enumerable.cs
===================================================================
--- a/mcs/class/System.Core/System.Linq/Enumerable.cs
+++ b/mcs/class/System.Core/System.Linq/Enumerable.cs
@@ -2163,18 +2163,16 @@ namespace System.Linq
if (count < 0)
throw new ArgumentOutOfRangeException ("count");
- long upto = ((long) start + count) - 1;
-
- if (upto > int.MaxValue)
+ if (((long) start + count) - 1L > int.MaxValue)
throw new ArgumentOutOfRangeException ();
- return CreateRangeIterator (start, (int) upto);
+ return CreateRangeIterator (start, count);
}
- static IEnumerable<int> CreateRangeIterator (int start, int upto)
+ static IEnumerable<int> CreateRangeIterator (int start, int count)
{
- for (int i = start; i <= upto; i++)
- yield return i;
+ for (int i = 0; i < count; i++)
+ yield return start + i;
}
#endregion
Commit: bbd7f831681397b9071299dd5a51f56542215a4a
Author: Jb Evain <jbevain@gmail.com>
Date: 01/25/2011 18:10:41
URL: https://github.com/mono/mono/commit/bbd7f831681397b9071299dd5a51f56542215a4a
[linq] Fix overflow check for Count
Changed paths:
M mcs/class/System.Core/System.Linq/Enumerable.cs
Modified: mcs/class/System.Core/System.Linq/Enumerable.cs
===================================================================
--- a/mcs/class/System.Core/System.Linq/Enumerable.cs
+++ b/mcs/class/System.Core/System.Linq/Enumerable.cs
@@ -637,7 +637,7 @@ namespace System.Linq
int counter = 0;
using (var enumerator = source.GetEnumerator ())
while (enumerator.MoveNext ())
- counter++;
+ checked { counter++; }
return counter;
}
@@ -649,7 +649,7 @@ namespace System.Linq
int counter = 0;
foreach (var element in source)
if (predicate (element))
- counter++;
+ checked { counter++; }
return counter;
}
Commit: e413cf2327b4f0aa0dcf371fee52c1217e971dfd
Author: Jb Evain <jbevain@gmail.com>
Date: 01/25/2011 18:10:55
URL: https://github.com/mono/mono/commit/e413cf2327b4f0aa0dcf371fee52c1217e971dfd
[linq] Fix Reverse for IList implementors
Changed paths:
M mcs/class/System.Core/System.Linq/Enumerable.cs
Modified: mcs/class/System.Core/System.Linq/Enumerable.cs
===================================================================
--- a/mcs/class/System.Core/System.Linq/Enumerable.cs
+++ b/mcs/class/System.Core/System.Linq/Enumerable.cs
@@ -2206,12 +2206,10 @@ namespace System.Linq
static IEnumerable<TSource> CreateReverseIterator<TSource> (IEnumerable<TSource> \
source) {
- var list = source as IList<TSource>;
- if (list == null)
- list = new List<TSource> (source);
+ var array = source.ToArray ();
- for (int i = list.Count - 1; i >= 0; i--)
- yield return list [i];
+ for (int i = array.Length - 1; i >= 0; i--)
+ yield return array [i];
}
#endregion
Commit: 5789f96b3c576e0fffedee3a15a2e31b07285c55
Author: Ankit Jain <radical@corewars.org>
Date: 01/25/2011 18:33:07
URL: https://github.com/mono/mono/commit/5789f96b3c576e0fffedee3a15a2e31b07285c55
[xbuild] Error out, if no target is found in a project.
Changed paths:
M mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Project.cs
Modified: mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Project.cs
===================================================================
--- a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Project.cs
+++ b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Project.cs
@@ -305,12 +305,18 @@ namespace Microsoft.Build.BuildEngine {
}
if (targetNames == null || targetNames.Length == 0) {
- if (defaultTargets != null && defaultTargets.Length != 0)
+ if (defaultTargets != null && defaultTargets.Length != 0) {
targetNames = defaultTargets;
- else if (firstTargetName != null)
+ } else if (firstTargetName != null) {
targetNames = new string [1] { firstTargetName};
- else
+ } else {
+ if (targets == null || targets.Count == 0) {
+ LogError (fullFileName, "No target found in the project");
+ return false;
+ }
+
return false;
+ }
}
if (!initialTargetsBuilt) {
Commit: f995310582e1ebedc13bf72eaad20f00e9241115
Author: Ankit Jain <radical@corewars.org>
Date: 01/25/2011 18:33:08
URL: https://github.com/mono/mono/commit/f995310582e1ebedc13bf72eaad20f00e9241115
[xbuild] Update Novell copyright.
Changed paths:
M mcs/tools/xbuild/ErrorUtilities.cs
Modified: mcs/tools/xbuild/ErrorUtilities.cs
===================================================================
--- a/mcs/tools/xbuild/ErrorUtilities.cs
+++ b/mcs/tools/xbuild/ErrorUtilities.cs
@@ -35,7 +35,7 @@ namespace Mono.XBuild.CommandLine {
static string[] version = {
String.Format ("XBuild Engine Version {0}", Consts.MonoVersion),
String.Format ("Mono, Version {0}", Consts.MonoVersion),
- "Copyright (C) Marek Sieradzki 2005-2008, Novell 2008-2009.",
+ "Copyright (C) Marek Sieradzki 2005-2008, Novell 2008-2011.",
};
Commit: b0f9fd65a1e28b474b72ce75568f9e3febb8532b
Author: Ankit Jain <radical@corewars.org>
Date: 01/25/2011 18:33:10
URL: https://github.com/mono/mono/commit/b0f9fd65a1e28b474b72ce75568f9e3febb8532b
[xbuild] Fix bug #665004. Honor /nologo option.
* tools/xbuild/Parameters.cs (DisplayVersion): Remove, not required.
Changed paths:
M mcs/tools/xbuild/Main.cs
M mcs/tools/xbuild/Parameters.cs
Modified: mcs/tools/xbuild/Main.cs
===================================================================
--- a/mcs/tools/xbuild/Main.cs
+++ b/mcs/tools/xbuild/Main.cs
@@ -76,7 +76,7 @@ namespace Mono.XBuild.CommandLine {
show_stacktrace = (parameters.LoggerVerbosity == LoggerVerbosity.Detailed ||
parameters.LoggerVerbosity == LoggerVerbosity.Diagnostic);
- if (parameters.DisplayVersion)
+ if (!parameters.NoLogo)
ErrorUtilities.ShowVersion (false);
engine = Engine.GlobalEngine;
Modified: mcs/tools/xbuild/Parameters.cs
===================================================================
--- a/mcs/tools/xbuild/Parameters.cs
+++ b/mcs/tools/xbuild/Parameters.cs
@@ -43,7 +43,6 @@ namespace Mono.XBuild.CommandLine {
string consoleLoggerParameters;
bool displayHelp;
- bool displayVersion;
IList flatArguments;
IList loggers;
LoggerVerbosity loggerVerbosity;
@@ -64,7 +63,6 @@ namespace Mono.XBuild.CommandLine {
{
consoleLoggerParameters = "";
displayHelp = false;
- displayVersion = true;
loggers = new ArrayList ();
loggerVerbosity = LoggerVerbosity.Normal;
noConsoleLogger = false;
@@ -354,10 +352,6 @@ namespace Mono.XBuild.CommandLine {
get { return noLogo; }
}
- public bool DisplayVersion {
- get { return displayVersion; }
- }
-
public string ProjectFile {
get { return projectFile; }
}
Commit: 081dc45b722dc541605a223471d6901e9dc105c9
Author: Ankit Jain <radical@corewars.org>
Date: 01/25/2011 18:33:11
URL: https://github.com/mono/mono/commit/081dc45b722dc541605a223471d6901e9dc105c9
[xbuild] Fix bug #665637.
Pass $(WarningsNotAsErrors) to Csc task.
Changed paths:
M mcs/tools/xbuild/xbuild/Microsoft.CSharp.targets
Modified: mcs/tools/xbuild/xbuild/Microsoft.CSharp.targets
===================================================================
--- a/mcs/tools/xbuild/xbuild/Microsoft.CSharp.targets
+++ b/mcs/tools/xbuild/xbuild/Microsoft.CSharp.targets
@@ -71,6 +71,7 @@
Utf8Output="$(Utf8Output)"
WarningLevel="$(WarningLevel)"
WarningsAsErrors="$(WarningsAsErrors)"
+ WarningsNotAsErrors="$(WarningsNotAsErrors)"
Win32Icon="$(Win32Icon)"
Win32Resource="$(Win32Resource)"
Resources="@(ManifestResourceWithNoCulture);@(ManifestNonResxWithNoCultureOnDisk);@(CompiledLicenseFile)"
Commit: ad8508c148dd43e8680f59b2e1d9ce7768178729
Author: Ankit Jain <radical@corewars.org>
Date: 01/25/2011 18:33:13
URL: https://github.com/mono/mono/commit/ad8508c148dd43e8680f59b2e1d9ce7768178729
[xbuild] Correctly set CscToolExe if TargetFrameworkVersion is not set.
* tools/xbuild/xbuild/Microsoft.CSharp.targets: $(CscToolExe)
is set depending on the value of $(TargetFrameworkVersion).
Since, $(TargetFrameworkVersion)'s default value is set
by MS.Common.targets, set $(CscToolExe) *after* importing
MS.Common.targets .
Changed paths:
M mcs/tools/xbuild/xbuild/Microsoft.CSharp.targets
Modified: mcs/tools/xbuild/xbuild/Microsoft.CSharp.targets
===================================================================
--- a/mcs/tools/xbuild/xbuild/Microsoft.CSharp.targets
+++ b/mcs/tools/xbuild/xbuild/Microsoft.CSharp.targets
@@ -14,12 +14,6 @@
<CreateManifestResourceNamesDependsOn></CreateManifestResourceNamesDependsOn>
<CoreCompileDependsOn></CoreCompileDependsOn>
- <CscToolExe Condition="'$(CscToolExe)' == '' and '$(TargetFrameworkVersion)' != \
'v4.0' and '$(OS)' != 'Windows_NT'">gmcs</CscToolExe>
- <CscToolExe Condition="'$(CscToolExe)' == '' and '$(TargetFrameworkVersion)' != \
'v4.0' and '$(OS)' == 'Windows_NT'">gmcs.bat</CscToolExe>
-
- <CscToolExe Condition="'$(CscToolExe)' == '' and '$(TargetFrameworkVersion)' == \
'v4.0' and '$(OS)' != 'Windows_NT'">dmcs</CscToolExe>
- <CscToolExe Condition="'$(CscToolExe)' == '' and '$(TargetFrameworkVersion)' == \
'v4.0' and '$(OS)' == 'Windows_NT'">dmcs.bat</CscToolExe>
-
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildToolsPath)\Microsoft.CSharp.targets</MSBuildAllProjects>
</PropertyGroup>
@@ -103,4 +97,13 @@
</Target>
<Import Project="Microsoft.Common.targets" />
+
+ <PropertyGroup>
+ <CscToolExe Condition="'$(CscToolExe)' == '' and '$(TargetFrameworkVersion)' != \
'v4.0' and '$(OS)' != 'Windows_NT'">gmcs</CscToolExe> + <CscToolExe \
Condition="'$(CscToolExe)' == '' and '$(TargetFrameworkVersion)' != 'v4.0' and \
'$(OS)' == 'Windows_NT'">gmcs.bat</CscToolExe> +
+ <CscToolExe Condition="'$(CscToolExe)' == '' and '$(TargetFrameworkVersion)' == \
'v4.0' and '$(OS)' != 'Windows_NT'">dmcs</CscToolExe> + <CscToolExe \
Condition="'$(CscToolExe)' == '' and '$(TargetFrameworkVersion)' == 'v4.0' and \
'$(OS)' == 'Windows_NT'">dmcs.bat</CscToolExe> + </PropertyGroup>
+
</Project>
Commit: a8f4de0f3731a9030175f62f7f7e52c0cc153d1c
Author: Ankit Jain <radical@corewars.org>
Date: 01/25/2011 18:33:14
URL: https://github.com/mono/mono/commit/a8f4de0f3731a9030175f62f7f7e52c0cc153d1c
[xbuild] Support short-circuiting in conditions.
Changed paths:
M mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ConditionAndExpression.cs
M mcs/class/Microsoft.Build.Engine/Test/various/Conditions.cs
Modified: mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ConditionAndExpression.cs
===================================================================
--- a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ConditionAndExpression.cs
+++ b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ConditionAndExpression.cs
@@ -72,7 +72,9 @@ namespace Microsoft.Build.BuildEngine {
public override bool CanEvaluateToBool (Project context)
{
- return left.CanEvaluateToBool (context) && right.CanEvaluateToBool (context);
+ // Short-circuiting, check only left expr, right
+ // would be required only if left == true
+ return left.CanEvaluateToBool (context);
}
public override bool CanEvaluateToNumber (Project context)
Modified: mcs/class/Microsoft.Build.Engine/Test/various/Conditions.cs
===================================================================
--- a/mcs/class/Microsoft.Build.Engine/Test/various/Conditions.cs
+++ b/mcs/class/Microsoft.Build.Engine/Test/various/Conditions.cs
@@ -336,6 +336,27 @@ namespace MonoTests.Microsoft.Build.BuildEngine.Various {
Assert.AreEqual ("fr_c.txt", bgp [2].FinalItemSpec, "A4");
}
+ // Test shortcircuiting
+ [Test]
+ public void TestCondition12 ()
+ {
+ Engine engine = new Engine (Consts.BinPath);
+ Project proj = engine.CreateNewProject ();
+
+ string documentString = @"
+ <Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
+ <PropertyGroup>
+ <A Condition=""'$(NonExistant)' != '' and $(NonExistant)""></A>
+ </PropertyGroup>
+ </Project>
+ ";
+
+ proj.LoadXml (documentString);
+
+ Assert.IsNull (proj.EvaluatedProperties ["A"], "A1");
+ }
+
+
[Test]
public void TestHasTrailingSlash1 ()
{
Commit: 16669c9944933e5d6a4b177549559cdffaf49dee
Author: Ankit Jain <radical@corewars.org>
Date: 01/25/2011 18:33:16
URL: https://github.com/mono/mono/commit/16669c9944933e5d6a4b177549559cdffaf49dee
[xbuild] Improve error messages for condition evaluation.
Also, add new ExpressionEvaluationException class.
Wrap Expression*Exceptions in InvalidProjectFileException with
info about the full condition being evaluated.
Changed paths:
M mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ConditionFactorExpresion.cs
M mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ConditionParser.cs
M mcs/class/Microsoft.Build.Engine/Microsoft.Build.Engine.dll.sources
M mcs/class/Microsoft.Build.Engine/Test/various/Conditions.cs
Added paths:
A mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ExpressionEvaluationException.cs
Modified: mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ConditionFactorExpresion.cs
===================================================================
--- a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ConditionFactorExpresion.cs
+++ b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ConditionFactorExpresion.cs
@@ -77,7 +77,9 @@ namespace Microsoft.Build.BuildEngine {
else if (falseValues [evaluatedToken.Value] != null)
return false;
else
- throw new InvalidProjectFileException ();
+ throw new ExpressionEvaluationException (
+ String.Format ("Expression \"{0}\" evaluated to \"{1}\" instead of a boolean \
value", + token.Value, evaluatedToken.Value));
}
public override float NumberEvaluate (Project context)
Modified: mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ConditionParser.cs
===================================================================
--- a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ConditionParser.cs
+++ b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ConditionParser.cs
@@ -53,12 +53,22 @@ namespace Microsoft.Build.BuildEngine {
if (String.IsNullOrEmpty (condition))
return true;
- ConditionExpression ce = ParseCondition (condition);
+ try {
+ ConditionExpression ce = ParseCondition (condition);
- if (!ce.CanEvaluateToBool (context))
- throw new InvalidProjectFileException (String.Format ("Can not evaluate \"{0}\" \
to bool.", condition)); + if (!ce.CanEvaluateToBool (context))
+ throw new InvalidProjectFileException (String.Format ("Can not evaluate \"{0}\" \
to bool.", condition));
- return ce.BoolEvaluate (context);
+ return ce.BoolEvaluate (context);
+ } catch (ExpressionParseException epe) {
+ throw new InvalidProjectFileException (
+ String.Format ("Unable to parse condition \"{0}\" : {1}", condition, \
epe.Message), + epe);
+ } catch (ExpressionEvaluationException epe) {
+ throw new InvalidProjectFileException (
+ String.Format ("Unable to evaluate condition \"{0}\" : {1}", condition, \
epe.Message), + epe);
+ }
}
public static ConditionExpression ParseCondition (string condition)
Modified: mcs/class/Microsoft.Build.Engine/Microsoft.Build.Engine.dll.sources
===================================================================
--- a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.Engine.dll.sources
+++ b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.Engine.dll.sources
@@ -37,6 +37,7 @@ Microsoft.Build.BuildEngine/Engine.cs
Microsoft.Build.BuildEngine/EventSource.cs
Microsoft.Build.BuildEngine/Expression.cs
Microsoft.Build.BuildEngine/ExpressionCollection.cs
+Microsoft.Build.BuildEngine/ExpressionEvaluationException.cs
Microsoft.Build.BuildEngine/ExpressionParseException.cs
Microsoft.Build.BuildEngine/FileLogger.cs
Microsoft.Build.BuildEngine/GroupingCollection.cs
Modified: mcs/class/Microsoft.Build.Engine/Test/various/Conditions.cs
===================================================================
--- a/mcs/class/Microsoft.Build.Engine/Test/various/Conditions.cs
+++ b/mcs/class/Microsoft.Build.Engine/Test/various/Conditions.cs
@@ -502,5 +502,24 @@ namespace MonoTests.Microsoft.Build.BuildEngine.Various {
proj.LoadXml (documentString);
}
+
+ [Test]
+ [ExpectedException (typeof (InvalidProjectFileException))]
+ public void TestIncorrectCondition6 ()
+ {
+ Engine engine = new Engine (Consts.BinPath);
+ Project proj = engine.CreateNewProject ();
+
+ string documentString = @"
+ <Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
+ <ItemGroup>
+ <A Include='a' Condition=""'$(NonExistant)' != '' or $(NonExistant)""/>
+ </ItemGroup>
+ </Project>
+ ";
+
+ proj.LoadXml (documentString);
+ }
+
}
}
Added: mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ExpressionEvaluationException.cs
===================================================================
--- /dev/null
+++ b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ExpressionEvaluationException.cs
@@ -0,0 +1,62 @@
+//
+// ExpressionEvaluationException.cs
+//
+// Author:
+// Ankit Jain (jankit@novell.com)
+//
+// Copyright 2011 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.Runtime.Serialization;
+
+namespace Microsoft.Build.BuildEngine {
+ [Serializable]
+ internal class ExpressionEvaluationException : Exception {
+
+ public ExpressionEvaluationException ()
+ : base ("Exception occured when evaluating the expression.")
+ {
+ }
+
+ public ExpressionEvaluationException (string message)
+ : base (message)
+ {
+ }
+
+ public ExpressionEvaluationException (string message,
+ Exception innerException)
+ : base (message, innerException)
+ {
+ }
+
+ protected ExpressionEvaluationException (SerializationInfo info,
+ StreamingContext context)
+ : base (info, context)
+ {
+ }
+ }
+}
+
+#endif
+
Commit: 3d19f5b62479e7fd95a165971896f789534229dd
Author: Geoff Norton <grompf@sublimeintervention.com>
Date: 01/25/2011 20:11:19
URL: https://github.com/mono/mono/commit/3d19f5b62479e7fd95a165971896f789534229dd
Further .NET 4.0 ification of the mobile profile
Changed paths:
M mcs/build/common/Consts.cs.in
M mcs/class/System.Core/Assembly/AssemblyInfo.cs
M mcs/class/System.Core/System.Collections.Generic/HashSet.cs
M mcs/class/System.Core/System.Linq/Enumerable.cs
M mcs/class/System.Core/System.Linq/EnumerableExecutor.cs
M mcs/class/System.Core/System.Linq/EnumerableExecutor_T.cs
M mcs/class/System.Core/System.Linq/EnumerableQuery.cs
M mcs/class/System.Core/System.Linq/EnumerableQuery_T.cs
M mcs/class/System.Core/System.Runtime.CompilerServices/DynamicAttribute.cs
M mcs/class/System.Core/System.Runtime.CompilerServices/StrongBox_T.cs
M mcs/class/System.Core/System.Security.Cryptography/Aes.cs
M mcs/class/System.Core/System/InvalidTimeZoneException.cs
M mcs/class/System.Core/System/TimeZoneInfo.AdjustmentRule.cs
M mcs/class/System.Core/System/TimeZoneInfo.Android.cs
M mcs/class/System.Core/System/TimeZoneInfo.TransitionTime.cs
M mcs/class/System.Core/System/TimeZoneInfo.cs
M mcs/class/System.Core/System/TimeZoneNotFoundException.cs
M mcs/class/System.XML/System.Xml/XmlWriterSettings.cs
M mcs/class/System.Xml.Linq/System.Xml.Linq/SaveOptions.cs
M mcs/class/System.Xml.Linq/System.Xml.Linq/XElement.cs
M mcs/class/System/System/Uri.cs
M mcs/class/corlib/System.Globalization/CultureNotFoundException.cs
M mcs/class/corlib/System.Globalization/TimeSpanStyles.cs
M mcs/class/corlib/System.IO/Directory.cs
M mcs/class/corlib/System.IO/DirectoryInfo.cs
M mcs/class/corlib/System.IO/FileStream.cs
M mcs/class/corlib/System.IO/Path.cs
M mcs/class/corlib/System.Reflection.Emit/AssemblyBuilder.cs
M mcs/class/corlib/System.Reflection.Emit/ModuleBuilder.cs
M mcs/class/corlib/System.Reflection/Assembly.cs
M mcs/class/corlib/System.Reflection/Module.cs
M mcs/class/corlib/System.Reflection/MonoAssembly.cs
M mcs/class/corlib/System.Reflection/MonoModule.cs
M mcs/class/corlib/System.Runtime.CompilerServices/ConditionalWeakTable.cs
M mcs/class/corlib/System.Runtime.CompilerServices/ReferenceAssemblyAttribute.cs
M mcs/class/corlib/System.Text/StringBuilder.cs
M mcs/class/corlib/System.Threading/LockRecursionException.cs
M mcs/class/corlib/System.Threading/SpinLock.cs
M mcs/class/corlib/System/Action.cs
M mcs/class/corlib/System/AppDomain.cs
M mcs/class/corlib/System/AppDomainSetup.cs
M mcs/class/corlib/System/Array.cs
M mcs/class/corlib/System/Enum.cs
M mcs/class/corlib/System/Environment.cs
M mcs/class/corlib/System/Funcs.cs
M mcs/class/corlib/System/GC.cs
M mcs/class/corlib/System/Guid.cs
M mcs/class/corlib/System/InvalidTimeZoneException.cs
M mcs/class/corlib/System/Lazy.cs
M mcs/class/corlib/System/String.cs
M mcs/class/corlib/System/TimeSpan.cs
M mcs/class/corlib/System/TimeZoneNotFoundException.cs
M mcs/class/corlib/System/TypeAccessException.cs
M mcs/class/corlib/System/Version.cs
M mcs/class/corlib/corlib.dll.sources
Modified: mcs/build/common/Consts.cs.in
===================================================================
--- a/mcs/build/common/Consts.cs.in
+++ b/mcs/build/common/Consts.cs.in
@@ -100,7 +100,7 @@ static class Consts
public const string AssemblySystem_ServiceProcess = "System.ServiceProcess, \
Version=" + FxVersion + ", Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; public \
const string AssemblySystem_Web = "System.Web, Version=" + FxVersion + ", \
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; public const string \
AssemblySystem_Windows_Forms = "System.Windows.Forms, Version=" + FxVersion + ", \
Culture=neutral, PublicKeyToken=b77a5c561934e089";
-#if NET_4_0 || MOBILE
+#if NET_4_0
public const string AssemblySystem_2_0 = "System, Version=2.0.0.0, Culture=neutral, \
PublicKeyToken=b77a5c561934e089"; public const string AssemblySystemCore_3_5 = \
"System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"; \
public const string AssemblySystem_Core = "System.Core, Version=" + FxVersion + ", \
Culture=neutral, PublicKeyToken=b77a5c561934e089";
Modified: mcs/class/System.Core/Assembly/AssemblyInfo.cs
===================================================================
--- a/mcs/class/System.Core/Assembly/AssemblyInfo.cs
+++ b/mcs/class/System.Core/Assembly/AssemblyInfo.cs
@@ -74,7 +74,7 @@ using System.Runtime.InteropServices;
[assembly: SecurityPermission (SecurityAction.RequestMinimum, SkipVerification = \
true)]
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
[assembly: TypeForwardedTo (typeof (System.Security.Cryptography.Aes))]
#endif
Modified: mcs/class/System.Core/System.Collections.Generic/HashSet.cs
===================================================================
--- a/mcs/class/System.Core/System.Collections.Generic/HashSet.cs
+++ b/mcs/class/System.Core/System.Collections.Generic/HashSet.cs
@@ -44,7 +44,7 @@ namespace System.Collections.Generic {
[DebuggerDisplay ("Count={Count}")]
[DebuggerTypeProxy (typeof (CollectionDebuggerView<,>))]
public class HashSet<T> : ICollection<T>, ISerializable, IDeserializationCallback
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
, ISet<T>
#endif
{
Modified: mcs/class/System.Core/System.Linq/Enumerable.cs
===================================================================
--- a/mcs/class/System.Core/System.Linq/Enumerable.cs
+++ b/mcs/class/System.Core/System.Linq/Enumerable.cs
@@ -2968,7 +2968,7 @@ namespace System.Linq
#endregion
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
#region Zip
public static IEnumerable<TResult> Zip<TFirst, TSecond, TResult> (this \
IEnumerable<TFirst> first, IEnumerable<TSecond> second, Func<TFirst, TSecond, \
TResult> resultSelector)
Modified: mcs/class/System.Core/System.Linq/EnumerableExecutor.cs
===================================================================
--- a/mcs/class/System.Core/System.Linq/EnumerableExecutor.cs
+++ b/mcs/class/System.Core/System.Linq/EnumerableExecutor.cs
@@ -26,7 +26,7 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
namespace System.Linq
{
Modified: mcs/class/System.Core/System.Linq/EnumerableExecutor_T.cs
===================================================================
--- a/mcs/class/System.Core/System.Linq/EnumerableExecutor_T.cs
+++ b/mcs/class/System.Core/System.Linq/EnumerableExecutor_T.cs
@@ -26,7 +26,7 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
using System.Linq.Expressions;
Modified: mcs/class/System.Core/System.Linq/EnumerableQuery.cs
===================================================================
--- a/mcs/class/System.Core/System.Linq/EnumerableQuery.cs
+++ b/mcs/class/System.Core/System.Linq/EnumerableQuery.cs
@@ -26,7 +26,7 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
namespace System.Linq
{
Modified: mcs/class/System.Core/System.Linq/EnumerableQuery_T.cs
===================================================================
--- a/mcs/class/System.Core/System.Linq/EnumerableQuery_T.cs
+++ b/mcs/class/System.Core/System.Linq/EnumerableQuery_T.cs
@@ -27,7 +27,7 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
using System.Collections;
using System.Collections.Generic;
Modified: mcs/class/System.Core/System.Runtime.CompilerServices/DynamicAttribute.cs
===================================================================
--- a/mcs/class/System.Core/System.Runtime.CompilerServices/DynamicAttribute.cs
+++ b/mcs/class/System.Core/System.Runtime.CompilerServices/DynamicAttribute.cs
@@ -26,7 +26,7 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
using System;
using System.Collections.Generic;
Modified: mcs/class/System.Core/System.Runtime.CompilerServices/StrongBox_T.cs
===================================================================
--- a/mcs/class/System.Core/System.Runtime.CompilerServices/StrongBox_T.cs
+++ b/mcs/class/System.Core/System.Runtime.CompilerServices/StrongBox_T.cs
@@ -32,7 +32,7 @@ namespace System.Runtime.CompilerServices {
public T Value;
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
public StrongBox ()
{
}
Modified: mcs/class/System.Core/System.Security.Cryptography/Aes.cs
===================================================================
--- a/mcs/class/System.Core/System.Security.Cryptography/Aes.cs
+++ b/mcs/class/System.Core/System.Security.Cryptography/Aes.cs
@@ -31,7 +31,7 @@
//
// Since 4.0 (both FX and SL) this type is defined in mscorlib - before 4.0 it was \
in System.Core.dll
-#if (INSIDE_CORLIB && (NET_4_0 || MOONLIGHT)) || (!INSIDE_CORLIB && !NET_4_0 && \
!MOONLIGHT) +#if (INSIDE_CORLIB && (NET_4_0 || MOONLIGHT || MOBILE)) || \
(!INSIDE_CORLIB && !NET_4_0 && !MOONLIGHT && !MOBILE)
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
@@ -44,7 +44,7 @@ namespace System.Security.Cryptography {
#if INSIDE_CORLIB
// since 4.0 (both FX and SL) this type now resides inside mscorlib.dll and link \
back to System.Core.dll
- #if MOONLIGHT
+ #if MOONLIGHT || MOBILE
// version has not changed between SL3 (System.Core) and SL4
[TypeForwardedFrom (Consts.AssemblySystem_Core)]
#elif NET_4_0
Modified: mcs/class/System.Core/System/InvalidTimeZoneException.cs
===================================================================
--- a/mcs/class/System.Core/System/InvalidTimeZoneException.cs
+++ b/mcs/class/System.Core/System/InvalidTimeZoneException.cs
@@ -24,7 +24,7 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
using System;
using System.Runtime.CompilerServices;
Modified: mcs/class/System.Core/System/TimeZoneInfo.AdjustmentRule.cs
===================================================================
--- a/mcs/class/System.Core/System/TimeZoneInfo.AdjustmentRule.cs
+++ b/mcs/class/System.Core/System/TimeZoneInfo.AdjustmentRule.cs
@@ -24,8 +24,7 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-#if (INSIDE_CORLIB && (NET_4_0 || MOONLIGHT)) || (MOBILE && !INSIDE_CORLIB) || \
(NET_3_5 && !NET_4_0)
-
+#if (INSIDE_CORLIB && (NET_4_0 || MOONLIGHT || MOBILE)) || (!INSIDE_CORLIB && \
(NET_3_5 && !NET_4_0 && !MOBILE)) using System.Runtime.CompilerServices;
using System.Runtime.Serialization;
@@ -35,7 +34,7 @@ namespace System
[SerializableAttribute]
#if NET_4_0
[TypeForwardedFrom (Consts.AssemblySystemCore_3_5)]
-#elif MOONLIGHT
+#elif MOONLIGHT || MOBILE
[TypeForwardedFrom (Consts.AssemblySystem_Core)]
#endif
public sealed class AdjustmentRule : IEquatable<TimeZoneInfo.AdjustmentRule>, \
ISerializable, IDeserializationCallback
Modified: mcs/class/System.Core/System/TimeZoneInfo.Android.cs
===================================================================
--- a/mcs/class/System.Core/System/TimeZoneInfo.Android.cs
+++ b/mcs/class/System.Core/System/TimeZoneInfo.Android.cs
@@ -18,7 +18,7 @@
* limitations under the License.
*/
-#if MONODROID
+#if (INSIDE_CORLIB && ANDROID)
using System;
using System.Collections.Generic;
Modified: mcs/class/System.Core/System/TimeZoneInfo.TransitionTime.cs
===================================================================
--- a/mcs/class/System.Core/System/TimeZoneInfo.TransitionTime.cs
+++ b/mcs/class/System.Core/System/TimeZoneInfo.TransitionTime.cs
@@ -24,7 +24,7 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-#if (INSIDE_CORLIB && (NET_4_0 || MOONLIGHT)) || (MOBILE && !INSIDE_CORLIB) || \
(NET_3_5 && !NET_4_0) +#if (INSIDE_CORLIB && (NET_4_0 || MOONLIGHT || MOBILE)) || \
(!INSIDE_CORLIB && (NET_3_5 && !NET_4_0 && !MOBILE))
using System.Runtime.CompilerServices;
using System.Runtime.Serialization;
@@ -36,7 +36,7 @@ namespace System
[SerializableAttribute]
#if NET_4_0
[TypeForwardedFrom (Consts.AssemblySystemCore_3_5)]
-#elif MOONLIGHT
+#elif MOONLIGHT || MOBILE
[TypeForwardedFrom (Consts.AssemblySystem_Core)]
#endif
public struct TransitionTime : IEquatable<TimeZoneInfo.TransitionTime>, \
ISerializable, IDeserializationCallback
Modified: mcs/class/System.Core/System/TimeZoneInfo.cs
===================================================================
--- a/mcs/class/System.Core/System/TimeZoneInfo.cs
+++ b/mcs/class/System.Core/System/TimeZoneInfo.cs
@@ -27,11 +27,11 @@
using System;
using System.Runtime.CompilerServices;
-#if !INSIDE_CORLIB && (NET_4_0 || MOONLIGHT)
+#if !INSIDE_CORLIB && (NET_4_0 || MOONLIGHT || MOBILE)
[assembly:TypeForwardedTo (typeof(TimeZoneInfo))]
-#elif NET_3_5 || (MOBILE && !INSIDE_CORLIB) || (MOONLIGHT && INSIDE_CORLIB)
+#elif NET_3_5 || (MOONLIGHT && INSIDE_CORLIB)
using System.Collections.Generic;
using System.Collections.ObjectModel;
@@ -50,7 +50,7 @@ namespace System
{
#if NET_4_0
[TypeForwardedFrom (Consts.AssemblySystemCore_3_5)]
-#elif MOONLIGHT
+#elif MOONLIGHT || MOBILE
[TypeForwardedFrom (Consts.AssemblySystem_Core)]
#endif
[SerializableAttribute]
Modified: mcs/class/System.Core/System/TimeZoneNotFoundException.cs
===================================================================
--- a/mcs/class/System.Core/System/TimeZoneNotFoundException.cs
+++ b/mcs/class/System.Core/System/TimeZoneNotFoundException.cs
@@ -24,7 +24,7 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
using System;
using System.Runtime.CompilerServices;
Modified: mcs/class/System.XML/System.Xml/XmlWriterSettings.cs
===================================================================
--- a/mcs/class/System.XML/System.Xml/XmlWriterSettings.cs
+++ b/mcs/class/System.XML/System.Xml/XmlWriterSettings.cs
@@ -155,7 +155,7 @@ namespace System.Xml
//set { outputMethod = value; }
}
-#if MOONLIGHT || NET_4_0
+#if MOONLIGHT || MOBILE || NET_4_0
public
#else
internal
Modified: mcs/class/System.Xml.Linq/System.Xml.Linq/SaveOptions.cs
===================================================================
--- a/mcs/class/System.Xml.Linq/System.Xml.Linq/SaveOptions.cs
+++ b/mcs/class/System.Xml.Linq/System.Xml.Linq/SaveOptions.cs
@@ -33,7 +33,7 @@ namespace System.Xml.Linq
{
None = 0,
DisableFormatting = 1,
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
OmitDuplicateNamespaces = 2
#endif
}
Modified: mcs/class/System.Xml.Linq/System.Xml.Linq/XElement.cs
===================================================================
--- a/mcs/class/System.Xml.Linq/System.Xml.Linq/XElement.cs
+++ b/mcs/class/System.Xml.Linq/System.Xml.Linq/XElement.cs
@@ -454,7 +454,7 @@ namespace System.Xml.Linq
}
}
-#if MOONLIGHT || NET_4_0
+#if MOONLIGHT || MOBILE || NET_4_0
public static XElement Load (Stream stream)
{
return Load (stream, LoadOptions.None);
@@ -536,7 +536,7 @@ namespace System.Xml.Linq
if ((options & SaveOptions.DisableFormatting) == SaveOptions.None)
s.Indent = true;
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
if ((options & SaveOptions.OmitDuplicateNamespaces) == \
SaveOptions.OmitDuplicateNamespaces) s.NamespaceHandling |= \
NamespaceHandling.OmitDuplicates; #endif
@@ -556,7 +556,7 @@ namespace System.Xml.Linq
if ((options & SaveOptions.DisableFormatting) == SaveOptions.None)
s.Indent = true;
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
if ((options & SaveOptions.OmitDuplicateNamespaces) == \
SaveOptions.OmitDuplicateNamespaces) s.NamespaceHandling |= \
NamespaceHandling.OmitDuplicates; #endif
@@ -570,7 +570,7 @@ namespace System.Xml.Linq
WriteTo (w);
}
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
public void Save (Stream stream)
{
Save (stream, SaveOptions.None);
Modified: mcs/class/System/System/Uri.cs
===================================================================
--- a/mcs/class/System/System/Uri.cs
+++ b/mcs/class/System/System/Uri.cs
@@ -326,7 +326,7 @@ namespace System {
query = relativeUri.Substring (pos);
if (!userEscaped)
query = EscapeString (query);
-#if !NET_4_0 && !MOONLIGHT
+#if !NET_4_0 && !MOONLIGHT && !MOBILE
consider_query = query.Length > 0;
#endif
relativeUri = pos == 0 ? String.Empty : relativeUri.Substring (0, pos);
@@ -1004,7 +1004,7 @@ namespace System {
//
public Uri MakeRelativeUri (Uri uri)
{
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
if (uri == null)
throw new ArgumentNullException ("uri");
#endif
@@ -2011,7 +2011,7 @@ namespace System {
public bool IsBaseOf (Uri uri)
{
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
if (uri == null)
throw new ArgumentNullException ("uri");
#endif
@@ -2182,7 +2182,7 @@ namespace System {
result = null;
if ((baseUri == null) || !baseUri.IsAbsoluteUri)
return false;
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
if (relativeUri == null)
return false;
#endif
Modified: mcs/class/corlib/System.Globalization/CultureNotFoundException.cs
===================================================================
--- a/mcs/class/corlib/System.Globalization/CultureNotFoundException.cs
+++ b/mcs/class/corlib/System.Globalization/CultureNotFoundException.cs
@@ -26,7 +26,7 @@
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
using System;
using System.Runtime.InteropServices;
Modified: mcs/class/corlib/System.Globalization/TimeSpanStyles.cs
===================================================================
--- a/mcs/class/corlib/System.Globalization/TimeSpanStyles.cs
+++ b/mcs/class/corlib/System.Globalization/TimeSpanStyles.cs
@@ -26,7 +26,7 @@
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
using System;
Modified: mcs/class/corlib/System.IO/Directory.cs
===================================================================
--- a/mcs/class/corlib/System.IO/Directory.cs
+++ b/mcs/class/corlib/System.IO/Directory.cs
@@ -503,7 +503,7 @@ namespace System.IO
return result;
}
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
public static string[] GetFileSystemEntries (string path, string searchPattern, \
SearchOption searchOption) {
// Take the simple way home:
Modified: mcs/class/corlib/System.IO/DirectoryInfo.cs
===================================================================
--- a/mcs/class/corlib/System.IO/DirectoryInfo.cs
+++ b/mcs/class/corlib/System.IO/DirectoryInfo.cs
@@ -378,7 +378,7 @@ namespace System.IO {
}
#endif
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
public IEnumerable<DirectoryInfo> EnumerateDirectories ()
{
Modified: mcs/class/corlib/System.IO/FileStream.cs
===================================================================
--- a/mcs/class/corlib/System.IO/FileStream.cs
+++ b/mcs/class/corlib/System.IO/FileStream.cs
@@ -845,7 +845,7 @@ namespace System.IO
FlushBuffer ();
}
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
public virtual void Flush (bool flushToDisk)
{
FlushBuffer ();
Modified: mcs/class/corlib/System.IO/Path.cs
===================================================================
--- a/mcs/class/corlib/System.IO/Path.cs
+++ b/mcs/class/corlib/System.IO/Path.cs
@@ -747,7 +747,7 @@ namespace System.IO {
return String.Compare (subset, slast, path, slast, subset.Length - slast) == 0;
}
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
public
#else
internal
@@ -787,7 +787,7 @@ namespace System.IO {
return ret.ToString ();
}
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
public
#else
internal
@@ -806,7 +806,7 @@ namespace System.IO {
return Combine (new string [] { path1, path2, path3 });
}
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
public
#else
internal
Modified: mcs/class/corlib/System.Reflection.Emit/AssemblyBuilder.cs
===================================================================
--- a/mcs/class/corlib/System.Reflection.Emit/AssemblyBuilder.cs
+++ b/mcs/class/corlib/System.Reflection.Emit/AssemblyBuilder.cs
@@ -1216,7 +1216,7 @@ namespace System.Reflection.Emit
throw new NotImplementedException ();
}
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
public override Type GetType (string name, bool throwOnError, bool ignoreCase)
{
if (name == null)
Modified: mcs/class/corlib/System.Reflection.Emit/ModuleBuilder.cs
===================================================================
--- a/mcs/class/corlib/System.Reflection.Emit/ModuleBuilder.cs
+++ b/mcs/class/corlib/System.Reflection.Emit/ModuleBuilder.cs
@@ -824,7 +824,7 @@ namespace System.Reflection.Emit {
throw new NotImplementedException ();
}
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
public override Assembly Assembly {
get { return assemblyb; }
}
Modified: mcs/class/corlib/System.Reflection/Assembly.cs
===================================================================
--- a/mcs/class/corlib/System.Reflection/Assembly.cs
+++ b/mcs/class/corlib/System.Reflection/Assembly.cs
@@ -76,7 +76,7 @@ namespace System.Reflection {
private bool fromByteArray;
private string assemblyName;
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
protected
#else
internal
@@ -615,7 +615,7 @@ namespace System.Reflection {
[MonoTODO ("Not implemented")]
public
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
virtual
#endif
Module LoadModule (string moduleName, byte [] rawModule, byte [] rawSymbolStore)
@@ -670,7 +670,7 @@ namespace System.Reflection {
}
public
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
virtual
#endif
Object CreateInstance (String typeName, Boolean ignoreCase,
@@ -760,7 +760,7 @@ namespace System.Reflection {
[MonoTODO ("Currently it always returns zero")]
[ComVisible (false)]
public
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
virtual
#endif
long HostContext {
@@ -799,7 +799,7 @@ namespace System.Reflection {
}
#if NET_4_0
-#if MOONLIGHT
+#if MOONLIGHT || MOBILE
public virtual IList<CustomAttributeData> GetCustomAttributesData () {
return CustomAttributeData.GetCustomAttributes (this);
}
@@ -897,7 +897,7 @@ namespace System.Reflection {
}
#endif
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
static Exception CreateNIE ()
{
return new NotImplementedException ("Derived classes must implement it");
Modified: mcs/class/corlib/System.Reflection/Module.cs
===================================================================
--- a/mcs/class/corlib/System.Reflection/Module.cs
+++ b/mcs/class/corlib/System.Reflection/Module.cs
@@ -48,7 +48,7 @@ namespace System.Reflection {
[Serializable]
[ClassInterfaceAttribute (ClassInterfaceType.None)]
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
public abstract class Module : ISerializable, ICustomAttributeProvider, _Module {
#else
public partial class Module : ISerializable, ICustomAttributeProvider, _Module {
@@ -75,7 +75,7 @@ namespace System.Reflection {
}
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
protected
#else
internal
@@ -321,7 +321,7 @@ namespace System.Reflection {
#endif
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
public virtual Assembly Assembly {
get { throw CreateNIE (); }
Modified: mcs/class/corlib/System.Reflection/MonoAssembly.cs
===================================================================
--- a/mcs/class/corlib/System.Reflection/MonoAssembly.cs
+++ b/mcs/class/corlib/System.Reflection/MonoAssembly.cs
@@ -35,7 +35,7 @@ using System.Collections.Generic;
namespace System.Reflection {
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
[ComVisible (true)]
[ComDefaultInterfaceAttribute (typeof (_Assembly))]
[Serializable]
@@ -45,7 +45,7 @@ namespace System.Reflection {
public partial class Assembly {
#endif
public
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
override
#endif
Type GetType (string name, bool throwOnError, bool ignoreCase)
@@ -57,7 +57,7 @@ namespace System.Reflection {
throw new ArgumentException ("name", "Name cannot be empty");
res = InternalGetType (null, name, throwOnError, ignoreCase);
-#if !(NET_4_0 || MOONLIGHT)
+#if !(NET_4_0 || MOONLIGHT || MOBILE)
if (res is TypeBuilder) {
if (throwOnError)
throw new TypeLoadException (string.Format ("Could not load type '{0}' from \
assembly '{1}'", name, this)); @@ -68,7 +68,7 @@ namespace System.Reflection {
}
public
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
override
#endif
Module GetModule (String name)
@@ -88,7 +88,7 @@ namespace System.Reflection {
}
public
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
override
#endif
AssemblyName[] GetReferencedAssemblies () {
@@ -96,7 +96,7 @@ namespace System.Reflection {
}
public
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
override
#endif
Module[] GetModules (bool getResourceModules) {
@@ -115,7 +115,7 @@ namespace System.Reflection {
[MonoTODO ("Always returns the same as GetModules")]
public
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
override
#endif
Module[] GetLoadedModules (bool getResourceModules)
@@ -124,7 +124,7 @@ namespace System.Reflection {
}
public
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
override
#endif
Assembly GetSatelliteAssembly (CultureInfo culture)
@@ -133,7 +133,7 @@ namespace System.Reflection {
}
public
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
override
#endif
Assembly GetSatelliteAssembly (CultureInfo culture, Version version)
@@ -144,7 +144,7 @@ namespace System.Reflection {
//FIXME remove GetManifestModule under v4, it's a v2 artifact
[ComVisible (false)]
public
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
override
#endif
Module ManifestModule {
Modified: mcs/class/corlib/System.Reflection/MonoModule.cs
===================================================================
--- a/mcs/class/corlib/System.Reflection/MonoModule.cs
+++ b/mcs/class/corlib/System.Reflection/MonoModule.cs
@@ -38,7 +38,7 @@ using System.Security.Permissions;
namespace System.Reflection {
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
[ComVisible (true)]
[ComDefaultInterfaceAttribute (typeof (_Module))]
[Serializable]
@@ -49,7 +49,7 @@ namespace System.Reflection {
#endif
public
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
override
#endif
Assembly Assembly {
@@ -57,7 +57,7 @@ namespace System.Reflection {
}
public
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
override
#endif
// Note: we do not ask for PathDiscovery because no path is returned here.
@@ -67,7 +67,7 @@ namespace System.Reflection {
}
public
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
override
#endif
string ScopeName {
@@ -75,7 +75,7 @@ namespace System.Reflection {
}
public
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
override
#endif
int MDStreamVersion {
@@ -87,7 +87,7 @@ namespace System.Reflection {
}
public
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
override
#endif
Guid ModuleVersionId {
@@ -96,7 +96,7 @@ namespace System.Reflection {
}
}
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
public override
#else
public virtual
@@ -113,7 +113,7 @@ namespace System.Reflection {
}
public
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
override
#endif
bool IsResource()
@@ -121,7 +121,7 @@ namespace System.Reflection {
return is_resource;
}
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
public override
#else
public virtual
@@ -136,7 +136,7 @@ namespace System.Reflection {
return filtered.ToArray ();
}
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
public override
#else
public virtual
@@ -146,7 +146,7 @@ namespace System.Reflection {
return MonoCustomAttrs.GetCustomAttributes (this, inherit);
}
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
public override
#else
public virtual
@@ -156,7 +156,7 @@ namespace System.Reflection {
return MonoCustomAttrs.GetCustomAttributes (this, attributeType, inherit);
}
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
public override
#else
public virtual
@@ -170,7 +170,7 @@ namespace System.Reflection {
return (globalType != null) ? globalType.GetField (name, bindingAttr) : null;
}
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
public override
#else
public virtual
@@ -184,7 +184,7 @@ namespace System.Reflection {
return (globalType != null) ? globalType.GetFields (bindingFlags) : new FieldInfo \
[0]; }
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
public override
#else
public virtual
@@ -193,7 +193,7 @@ namespace System.Reflection {
get { return get_MetadataToken (this); }
}
protected
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
override
#else
virtual
@@ -212,7 +212,7 @@ namespace System.Reflection {
}
public
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
override
#endif
MethodInfo[] GetMethods (BindingFlags bindingFlags) {
@@ -223,7 +223,7 @@ namespace System.Reflection {
return (globalType != null) ? globalType.GetMethods (bindingFlags) : new \
MethodInfo [0]; }
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
public override
#else
public virtual
@@ -232,7 +232,7 @@ namespace System.Reflection {
ModuleHandle.GetPEKind (out peKind, out machine);
}
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
public override
#else
public virtual
@@ -246,7 +246,7 @@ namespace System.Reflection {
return assembly.InternalGetType (this, className, throwOnError, ignoreCase);
}
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
public override
#else
public virtual
@@ -257,7 +257,7 @@ namespace System.Reflection {
}
public
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
override
#endif
FieldInfo ResolveField (int metadataToken, Type [] genericTypeArguments, Type [] \
genericMethodArguments) { @@ -271,7 +271,7 @@ namespace System.Reflection {
}
public
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
override
#endif
MemberInfo ResolveMember (int metadataToken, Type [] genericTypeArguments, Type [] \
genericMethodArguments) { @@ -286,7 +286,7 @@ namespace System.Reflection {
}
public
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
override
#endif
MethodBase ResolveMethod (int metadataToken, Type [] genericTypeArguments, Type [] \
genericMethodArguments) { @@ -300,7 +300,7 @@ namespace System.Reflection {
}
public
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
override
#endif
string ResolveString (int metadataToken) {
@@ -314,7 +314,7 @@ namespace System.Reflection {
}
public
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
override
#endif
Type ResolveType (int metadataToken, Type [] genericTypeArguments, Type [] \
genericMethodArguments) { @@ -328,7 +328,7 @@ namespace System.Reflection {
}
public
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
override
#endif
byte[] ResolveSignature (int metadataToken) {
@@ -358,7 +358,7 @@ namespace System.Reflection {
}
#endif
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
public override
#else
public virtual
@@ -368,7 +368,7 @@ namespace System.Reflection {
return InternalGetTypes ();
}
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
public override IList<CustomAttributeData> GetCustomAttributesData () {
return CustomAttributeData.GetCustomAttributes (this);
}
Modified: mcs/class/corlib/System.Runtime.CompilerServices/ConditionalWeakTable.cs
===================================================================
--- a/mcs/class/corlib/System.Runtime.CompilerServices/ConditionalWeakTable.cs
+++ b/mcs/class/corlib/System.Runtime.CompilerServices/ConditionalWeakTable.cs
@@ -26,7 +26,7 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
using System;
using System.Collections;
Modified: mcs/class/corlib/System.Runtime.CompilerServices/ReferenceAssemblyAttribute.cs
===================================================================
--- a/mcs/class/corlib/System.Runtime.CompilerServices/ReferenceAssemblyAttribute.cs
+++ b/mcs/class/corlib/System.Runtime.CompilerServices/ReferenceAssemblyAttribute.cs
@@ -25,7 +25,7 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
using System;
using System.Runtime.InteropServices;
Modified: mcs/class/corlib/System.Text/StringBuilder.cs
===================================================================
--- a/mcs/class/corlib/System.Text/StringBuilder.cs
+++ b/mcs/class/corlib/System.Text/StringBuilder.cs
@@ -503,7 +503,7 @@ namespace System.Text {
return this;
}
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
public StringBuilder Clear ()
{
_length = 0;
Modified: mcs/class/corlib/System.Threading/LockRecursionException.cs
===================================================================
--- a/mcs/class/corlib/System.Threading/LockRecursionException.cs
+++ b/mcs/class/corlib/System.Threading/LockRecursionException.cs
@@ -25,7 +25,7 @@
*/
-#if NET_4_0 || MOBILE
+#if NET_4_0
using System;
using System.Runtime.Serialization;
Modified: mcs/class/corlib/System.Threading/SpinLock.cs
===================================================================
--- a/mcs/class/corlib/System.Threading/SpinLock.cs
+++ b/mcs/class/corlib/System.Threading/SpinLock.cs
@@ -22,7 +22,7 @@
//
//
-#if NET_4_0 || MOBILE
+#if NET_4_0
using System;
using System.Collections.Concurrent;
Modified: mcs/class/corlib/System/Action.cs
===================================================================
--- a/mcs/class/corlib/System/Action.cs
+++ b/mcs/class/corlib/System/Action.cs
@@ -32,18 +32,34 @@ using System.Runtime.CompilerServices;
namespace System
{
#if NET_4_0 || MOBILE
+#if NET_4_0
[TypeForwardedFrom (Consts.AssemblySystemCore_3_5)]
+#elif MOBILE
+ [TypeForwardedFrom (Consts.AssemblySystem_Core)]
+#endif
public delegate void Action ();
public delegate void Action <in T> (T obj);
+#if NET_4_0
[TypeForwardedFrom (Consts.AssemblySystemCore_3_5)]
+#elif MOBILE
+ [TypeForwardedFrom (Consts.AssemblySystem_Core)]
+#endif
public delegate void Action <in T1, in T2> (T1 arg1, T2 arg2);
+#if NET_4_0
[TypeForwardedFrom (Consts.AssemblySystemCore_3_5)]
+#elif MOBILE
+ [TypeForwardedFrom (Consts.AssemblySystem_Core)]
+#endif
public delegate void Action <in T1, in T2, in T3> (T1 arg1, T2 arg2, T3 arg3);
+#if NET_4_0
[TypeForwardedFrom (Consts.AssemblySystemCore_3_5)]
+#elif MOBILE
+ [TypeForwardedFrom (Consts.AssemblySystem_Core)]
+#endif
public delegate void Action <in T1, in T2, in T3, in T4> (T1 arg1, T2 arg2, T3 \
arg3, T4 arg4);
public delegate void Action <in T1, in T2, in T3, in T4, in T5> (T1 arg1, T2 arg2, \
T3 arg3, T4 arg4, T5 arg5);
Modified: mcs/class/corlib/System/AppDomain.cs
===================================================================
--- a/mcs/class/corlib/System/AppDomain.cs
+++ b/mcs/class/corlib/System/AppDomain.cs
@@ -1536,7 +1536,7 @@ namespace System {
}
#endif
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
List<string> compatibility_switch;
public bool? IsCompatibilitySwitchSet (string value)
Modified: mcs/class/corlib/System/AppDomainSetup.cs
===================================================================
--- a/mcs/class/corlib/System/AppDomainSetup.cs
+++ b/mcs/class/corlib/System/AppDomainSetup.cs
@@ -386,7 +386,7 @@ namespace System
serialized_non_primitives = ms.ToArray ();
}
#endif // !NET_2_1
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
[MonoTODO ("not implemented, does not throw because it's used in testing \
moonlight")] public void SetCompatibilitySwitches (IEnumerable<string> switches)
{
Modified: mcs/class/corlib/System/Array.cs
===================================================================
--- a/mcs/class/corlib/System/Array.cs
+++ b/mcs/class/corlib/System/Array.cs
@@ -45,7 +45,7 @@ namespace System
[ComVisible (true)]
// FIXME: We are doing way to many double/triple exception checks for the \
overloaded functions" public abstract class Array : ICloneable, ICollection, IList, \
IEnumerable
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
, IStructuralComparable, IStructuralEquatable
#endif
{
@@ -434,7 +434,7 @@ namespace System
return new SimpleEnumerator (this);
}
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
int IStructuralComparable.CompareTo (object other, IComparer comparer)
{
if (other == null)
Modified: mcs/class/corlib/System/Enum.cs
===================================================================
--- a/mcs/class/corlib/System/Enum.cs
+++ b/mcs/class/corlib/System/Enum.cs
@@ -619,7 +619,7 @@ namespace System
return true;
}
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
public static bool TryParse<TEnum> (string value, out TEnum result) where TEnum : \
struct {
return TryParse (value, false, out result);
@@ -1012,7 +1012,7 @@ namespace System
}
return retVal;
}
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
public bool HasFlag (Enum flag)
{
ulong mvalue = Convert.ToUInt64 (get_value (), null);
Modified: mcs/class/corlib/System/Environment.cs
===================================================================
--- a/mcs/class/corlib/System/Environment.cs
+++ b/mcs/class/corlib/System/Environment.cs
@@ -84,7 +84,7 @@ namespace System {
ProgramFiles = 0x26,
MyPictures = 0x27,
CommonProgramFiles = 0x2b,
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
MyVideos = 0x0e,
#endif
#if NET_4_0
@@ -609,7 +609,7 @@ namespace System {
case SpecialFolder.Templates:
return ReadXdgUserDir (config, home, "XDG_TEMPLATES_DIR", "Templates");
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
case SpecialFolder.MyVideos:
return ReadXdgUserDir (config, home, "XDG_VIDEOS_DIR", "Videos");
#endif
@@ -812,7 +812,7 @@ namespace System {
throw new NotImplementedException ();
}
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
[SecurityCritical]
public static void FailFast (string message, Exception exception)
{
Modified: mcs/class/corlib/System/Funcs.cs
===================================================================
--- a/mcs/class/corlib/System/Funcs.cs
+++ b/mcs/class/corlib/System/Funcs.cs
@@ -30,19 +30,39 @@ using System.Runtime.CompilerServices;
namespace System {
#if NET_4_0 || MOBILE
+#if NET_4_0
[TypeForwardedFrom (Consts.AssemblySystemCore_3_5)]
+#elif MOBILE
+ [TypeForwardedFrom (Consts.AssemblySystem_Core)]
+#endif
public delegate TResult Func<out TResult> ();
+#if NET_4_0
[TypeForwardedFrom (Consts.AssemblySystemCore_3_5)]
+#elif MOBILE
+ [TypeForwardedFrom (Consts.AssemblySystem_Core)]
+#endif
public delegate TResult Func<in T, out TResult> (T arg);
+#if NET_4_0
[TypeForwardedFrom (Consts.AssemblySystemCore_3_5)]
+#elif MOBILE
+ [TypeForwardedFrom (Consts.AssemblySystem_Core)]
+#endif
public delegate TResult Func<in T1, in T2, out TResult> (T1 arg1, T2 arg2);
+#if NET_4_0
[TypeForwardedFrom (Consts.AssemblySystemCore_3_5)]
+#elif MOBILE
+ [TypeForwardedFrom (Consts.AssemblySystem_Core)]
+#endif
public delegate TResult Func<in T1, in T2, in T3, out TResult> (T1 arg1, T2 arg2, \
T3 arg3);
+#if NET_4_0
[TypeForwardedFrom (Consts.AssemblySystemCore_3_5)]
+#elif MOBILE
+ [TypeForwardedFrom (Consts.AssemblySystem_Core)]
+#endif
public delegate TResult Func<in T1, in T2, in T3, in T4, out TResult> (T1 arg1, T2 \
arg2, T3 arg3, T4 arg4);
public delegate TResult Func<in T1, in T2, in T3, in T4, in T5, out TResult> (T1 \
arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5); @@ -50,6 +70,9 @@ namespace System {
public delegate TResult Func<in T1, in T2, in T3, in T4, in T5, in T6, in T7, out \
TResult> (T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7); public \
delegate TResult Func<in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8, out \
TResult> (T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8); \
#elif MOONLIGHT + public delegate TResult Func<T1, T2, T3, T4, TResult> (
+ T1 arg1, T2 arg2, T3 arg3, T4 arg4);
+
public delegate TResult Func<T1, T2, T3, T4, T5, TResult> (
T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5);
Modified: mcs/class/corlib/System/GC.cs
===================================================================
--- a/mcs/class/corlib/System/GC.cs
+++ b/mcs/class/corlib/System/GC.cs
@@ -145,7 +145,7 @@ namespace System
}
#endif
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
[MethodImplAttribute (MethodImplOptions.InternalCall)]
internal extern static void register_ephemeron_array (Ephemeron[] array);
@@ -155,4 +155,4 @@ namespace System
internal static readonly object EPHEMERON_TOMBSTONE = get_ephemeron_tombstone ();
#endif
}
-}
\ No newline at end of file
+}
Modified: mcs/class/corlib/System/Guid.cs
===================================================================
--- a/mcs/class/corlib/System/Guid.cs
+++ b/mcs/class/corlib/System/Guid.cs
@@ -667,7 +667,7 @@ namespace System {
return !( a.Equals (b) );
}
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
public static Guid Parse (string input)
{
Guid guid;
Modified: mcs/class/corlib/System/InvalidTimeZoneException.cs
===================================================================
--- a/mcs/class/corlib/System/InvalidTimeZoneException.cs
+++ b/mcs/class/corlib/System/InvalidTimeZoneException.cs
@@ -24,7 +24,7 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
using System.Runtime.CompilerServices;
@@ -33,7 +33,7 @@ namespace System
[Serializable]
#if NET_4_0
[TypeForwardedFrom (Consts.AssemblySystemCore_3_5)]
-#elif MOONLIGHT
+#elif MOONLIGHT || MOBILE
[TypeForwardedFrom (Consts.AssemblySystem_Core)]
#endif
public class InvalidTimeZoneException : Exception
Modified: mcs/class/corlib/System/Lazy.cs
===================================================================
--- a/mcs/class/corlib/System/Lazy.cs
+++ b/mcs/class/corlib/System/Lazy.cs
@@ -27,7 +27,7 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
using System;
using System.Runtime.Serialization;
Modified: mcs/class/corlib/System/String.cs
===================================================================
--- a/mcs/class/corlib/System/String.cs
+++ b/mcs/class/corlib/System/String.cs
@@ -2217,7 +2217,7 @@ namespace System
return InternalIsInterned (str);
}
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
public static string Join (string separator, params string [] value)
#else
public static string Join (string separator, string [] value)
@@ -2525,7 +2525,7 @@ namespace System
}
}
-#if MOONLIGHT || NET_4_0
+#if MOONLIGHT || MOBILE || NET_4_0
[ComVisible(false)]
public static string Concat (IEnumerable<string> values)
{
Modified: mcs/class/corlib/System/TimeSpan.cs
===================================================================
--- a/mcs/class/corlib/System/TimeSpan.cs
+++ b/mcs/class/corlib/System/TimeSpan.cs
@@ -39,7 +39,7 @@ namespace System
[Serializable]
[System.Runtime.InteropServices.ComVisible (true)]
public struct TimeSpan : IComparable, IComparable<TimeSpan>, IEquatable <TimeSpan>
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
, IFormattable
#endif
{
@@ -359,7 +359,7 @@ namespace System
return p.Execute (true, out result);
}
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
public static TimeSpan Parse (string input, IFormatProvider formatProvider)
{
if (input == null)
@@ -526,7 +526,7 @@ namespace System
return sb.ToString ();
}
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
public string ToString (string format)
{
return ToString (format, null);
@@ -719,7 +719,7 @@ namespace System
private int _cur = 0;
private int _length;
ParseError parse_error;
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
bool parsed_ticks;
NumberFormatInfo number_format;
int parsed_numbers_count;
@@ -735,12 +735,12 @@ namespace System
{
_src = src;
_length = _src.Length;
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
number_format = GetNumberFormatInfo (null);
#endif
}
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
// Reset state data, so we can execute another parse over the input.
void Reset ()
{
@@ -806,7 +806,7 @@ namespace System
return res;
}
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
// Used for custom formats parsing, where we may need to declare how
// many digits we expect, as well as the maximum allowed.
private int ParseIntExact (int digit_count, int max_digit_count)
@@ -855,7 +855,7 @@ namespace System
if (!optional && (count == 0))
SetParseError (ParseError.Format);
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
if (count > 0)
parsed_numbers_count++;
#endif
@@ -876,7 +876,7 @@ namespace System
return false;
}
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
// This behaves pretty much like ParseOptDot, but we need to have it
// as a separated routine for both days and decimal separators.
private bool ParseOptDaysSeparator ()
@@ -963,7 +963,7 @@ namespace System
if (!digitseen)
SetParseError (ParseError.Format);
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
else if (!AtEnd && Char.IsDigit (_src, _cur))
SetParseError (ParseError.Overflow);
@@ -973,7 +973,7 @@ namespace System
return res;
}
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
// Used by custom formats parsing
// digits_count = 0 for digits up to max_digits_count (optional), and other value \
to // force a precise number of digits.
@@ -1007,7 +1007,7 @@ namespace System
parse_error = error;
}
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
bool CheckParseSuccess (bool tryParse)
#else
bool CheckParseSuccess (int hours, int minutes, int seconds, bool tryParse)
@@ -1015,7 +1015,7 @@ namespace System
{
// We always report the first error, but for 2.0 we need to give a higher
// precence to per-element overflow (as opposed to int32 overflow).
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
if (parse_error == ParseError.Overflow) {
#else
if (parse_error == ParseError.Overflow || hours > 23 || minutes > 59 || seconds \
> 59) { @@ -1036,7 +1036,7 @@ namespace System
return true;
}
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
// We are using a different parse approach in 4.0, due to some changes in the \
behaviour // of the parse routines.
// The input string is documented as:
@@ -1220,7 +1220,7 @@ namespace System
}
#endif
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
public bool ExecuteWithFormat (string format, TimeSpanStyles style, bool \
tryParse, out TimeSpan result) {
int days, hours, minutes, seconds;
@@ -1327,7 +1327,7 @@ namespace System
}
#endif
}
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
enum FormatElementType
{
Days,
Modified: mcs/class/corlib/System/TimeZoneNotFoundException.cs
===================================================================
--- a/mcs/class/corlib/System/TimeZoneNotFoundException.cs
+++ b/mcs/class/corlib/System/TimeZoneNotFoundException.cs
@@ -24,7 +24,7 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
using System.Runtime.CompilerServices;
@@ -33,7 +33,7 @@ namespace System
[Serializable]
#if NET_4_0
[TypeForwardedFrom (Consts.AssemblySystemCore_3_5)]
-#elif MOONLIGHT
+#elif MOONLIGHT || MOBILE
[TypeForwardedFrom (Consts.AssemblySystem_Core)]
#endif
public class TimeZoneNotFoundException : Exception
Modified: mcs/class/corlib/System/TypeAccessException.cs
===================================================================
--- a/mcs/class/corlib/System/TypeAccessException.cs
+++ b/mcs/class/corlib/System/TypeAccessException.cs
@@ -25,7 +25,7 @@
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_4_0 || MOONLIGHT
+#if NET_4_0 || MOONLIGHT || MOBILE
using System.Runtime.Serialization;
using System.Runtime.InteropServices;
Modified: mcs/class/corlib/System/Version.cs
===================================================================
--- a/mcs/class/corlib/System/Version.cs
+++ b/mcs/class/corlib/System/Version.cs
@@ -306,7 +306,7 @@ namespace System {
return v1.CompareTo (v2) <= 0;
}
-#if BOOSTRAP_NET_4_0 || NET_4_0 || MOONLIGHT
+#if BOOSTRAP_NET_4_0 || NET_4_0 || MOONLIGHT || MOBILE
public static Version Parse (string input)
{
// Exactly the same as calling Version(string) .ctor
Modified: mcs/class/corlib/corlib.dll.sources
===================================================================
--- a/mcs/class/corlib/corlib.dll.sources
+++ b/mcs/class/corlib/corlib.dll.sources
@@ -251,6 +251,7 @@ System/TimeSpan.cs
System/TimeZone.cs
../System.Core/System/TimeZoneInfo.cs
../System.Core/System/TimeZoneInfo.AdjustmentRule.cs
+../System.Core/System/TimeZoneInfo.Android.cs
../System.Core/System/TimeZoneInfo.TransitionTime.cs
System/TimeZoneNotFoundException.cs
System/TimeoutException.cs
Commit: 7d5fce6c1bd0c62c672ca3863a88473608b87595
Author: Zoltan Varga <vargaz@gmail.com>
Date: 01/25/2011 22:17:08
URL: https://github.com/mono/mono/commit/7d5fce6c1bd0c62c672ca3863a88473608b87595
Add a 'suspend-on-unhandled' MONO_DEBUG option to help track down the random build \
failures on ia64.
Changed paths:
M mono/mini/mini-exceptions.c
M mono/mini/mini.c
M mono/mini/mini.h
Modified: mono/mini/mini-exceptions.c
===================================================================
--- a/mono/mini/mini-exceptions.c
+++ b/mono/mini/mini-exceptions.c
@@ -1469,6 +1469,13 @@ mono_handle_exception_internal (MonoContext *ctx, gpointer \
obj, gpointer origina if (mono_break_on_exc)
G_BREAKPOINT ();
mono_debugger_agent_handle_exception (obj, ctx, NULL);
+
+ if (mini_get_debug_options ()->suspend_on_unhandled) {
+ fprintf (stderr, "Unhandled exception, suspending...");
+ while (1)
+ ;
+ }
+
// FIXME: This runs managed code so it might cause another stack overflow when
// we are handling a stack overflow
mono_unhandled_exception (obj);
Modified: mono/mini/mini.c
===================================================================
--- a/mono/mini/mini.c
+++ b/mono/mini/mini.c
@@ -5944,6 +5944,8 @@ mini_parse_debug_options (void)
debug_options.no_gdb_backtrace = TRUE;
else if (!strcmp (arg, "suspend-on-sigsegv"))
debug_options.suspend_on_sigsegv = TRUE;
+ else if (!strcmp (arg, "suspend-on-unhandled"))
+ debug_options.suspend_on_unhandled = TRUE;
else if (!strcmp (arg, "dont-free-domains"))
mono_dont_free_domains = TRUE;
else if (!strcmp (arg, "dyn-runtime-invoke"))
@@ -5960,7 +5962,7 @@ mini_parse_debug_options (void)
debug_options.better_cast_details = TRUE;
else {
fprintf (stderr, "Invalid option for the MONO_DEBUG env variable: %s\n", arg);
- fprintf (stderr, "Available options: 'handle-sigint', 'keep-delegates', \
'reverse-pinvoke-exceptions', 'collect-pagefault-stats', 'break-on-unverified', \
'no-gdb-backtrace', 'dont-free-domains', 'suspend-on-sigsegv', 'dyn-runtime-invoke', \
'gdb', 'explicit-null-checks', 'init-stacks'\n"); + fprintf (stderr, "Available \
options: 'handle-sigint', 'keep-delegates', 'reverse-pinvoke-exceptions', \
'collect-pagefault-stats', 'break-on-unverified', 'no-gdb-backtrace', \
'dont-free-domains', 'suspend-on-sigsegv', 'suspend-on-unhandled', \
'dyn-runtime-invoke', 'gdb', 'explicit-null-checks', 'init-stacks'\n"); exit (1);
}
}
Modified: mono/mini/mini.h
===================================================================
--- a/mono/mini/mini.h
+++ b/mono/mini/mini.h
@@ -1581,6 +1581,7 @@ typedef struct {
gboolean mdb_optimizations;
gboolean no_gdb_backtrace;
gboolean suspend_on_sigsegv;
+ gboolean suspend_on_unhandled;
gboolean dyn_runtime_invoke;
gboolean gdb;
gboolean gen_seq_points;
Commit: 97c46a7be65eac490f486656e37c64b4d1a22788
Author: Geoff Norton <grompf@sublimeintervention.com>
Date: 01/25/2011 23:04:33
URL: https://github.com/mono/mono/commit/97c46a7be65eac490f486656e37c64b4d1a22788
MonoTouch doesnt support SRE, so we need to disable this code on MT
Changed paths:
M mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeAnd.cs
M mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeArgument.cs
M mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeArgumentReference.cs
M mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeArithmeticOperation.cs
M mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeArrayItem.cs
M mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeArrayLength.cs
M mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeAssignment.cs
M mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeBinaryComparison.cs
M mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeBinaryOperation.cs
M mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeBlock.cs
M mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeBuilder.cs
M mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeCast.cs
M mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeClass.cs
M mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeCustomAttribute.cs
M mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeDecrement.cs
M mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeEquals.cs
M mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeExpression.cs
M mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeFieldReference.cs
M mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeFor.cs
M mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeForeach.cs
M mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeGenerationHelper.cs
M mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeIf.cs
M mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeIncrement.cs
M mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeIs.cs
M mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeItem.cs
M mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeLiteral.cs
M mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeMethod.cs
M mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeMethodCall.cs
M mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeModule.cs
M mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeNew.cs
M mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeNewArray.cs
M mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeNotEquals.cs
M mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeOr.cs
M mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeProperty.cs
M mcs/class/System.ServiceModel/Mono.CodeGeneration/CodePropertyReference.cs
M mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeReturn.cs
M mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeSelect.cs
M mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeSelfIncrement.cs
M mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeTryBlock.cs
M mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeUnaryOperation.cs
M mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeValueReference.cs
M mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeVariableDeclaration.cs
M mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeVariableReference.cs
M mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeWhen.cs
M mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeWhile.cs
M mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeWriter.cs
M mcs/class/System.ServiceModel/Mono.CodeGeneration/Exp.cs
M mcs/class/System.ServiceModel/System.ServiceModel/ClientProxyGenerator.cs
Modified: mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeAnd.cs
===================================================================
--- a/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeAnd.cs
+++ b/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeAnd.cs
@@ -22,6 +22,7 @@
//
+#if !MONOTOUCH
using System;
using System.Reflection;
using System.Reflection.Emit;
@@ -113,4 +114,5 @@ namespace Mono.CodeGeneration
return typeof (bool);
}
}
-}
\ No newline at end of file
+}
+#endif
Modified: mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeArgument.cs
===================================================================
--- a/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeArgument.cs
+++ b/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeArgument.cs
@@ -1,5 +1,6 @@
// created on 28/08/2004 at 17:07
+#if !MONOTOUCH
using System;
using System.Reflection;
using System.Reflection.Emit;
@@ -36,3 +37,4 @@ namespace Mono.CodeGeneration
}
}
}
+#endif
Modified: mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeArgumentReference.cs
===================================================================
--- a/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeArgumentReference.cs
+++ b/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeArgumentReference.cs
@@ -21,6 +21,7 @@
// Copyright (C) Lluis Sanchez Gual, 2004
//
+#if !MONOTOUCH
using System;
using System.Reflection;
using System.Reflection.Emit;
@@ -79,3 +80,4 @@ namespace Mono.CodeGeneration
}
}
}
+#endif
Modified: mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeArithmeticOperation.cs
===================================================================
--- a/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeArithmeticOperation.cs
+++ b/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeArithmeticOperation.cs
@@ -21,6 +21,7 @@
// Copyright (C) Lluis Sanchez Gual, 2004
//
+#if !MONOTOUCH
using System;
using System.Reflection;
using System.Reflection.Emit;
@@ -141,3 +142,4 @@ namespace Mono.CodeGeneration
}
}
}
+#endif
Modified: mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeArrayItem.cs
===================================================================
--- a/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeArrayItem.cs
+++ b/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeArrayItem.cs
@@ -21,6 +21,7 @@
// Copyright (C) Lluis Sanchez Gual, 2004
//
+#if !MONOTOUCH
using System;
using System.Reflection;
using System.Reflection.Emit;
@@ -174,3 +175,4 @@ namespace Mono.CodeGeneration
}
}
}
+#endif
Modified: mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeArrayLength.cs
===================================================================
--- a/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeArrayLength.cs
+++ b/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeArrayLength.cs
@@ -21,6 +21,7 @@
// Copyright (C) Lluis Sanchez Gual, 2004
//
+#if !MONOTOUCH
using System;
using System.Reflection;
using System.Reflection.Emit;
@@ -56,3 +57,4 @@ namespace Mono.CodeGeneration
}
}
}
+#endif
Modified: mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeAssignment.cs
===================================================================
--- a/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeAssignment.cs
+++ b/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeAssignment.cs
@@ -21,6 +21,7 @@
// Copyright (C) Lluis Sanchez Gual, 2004
//
+#if !MONOTOUCH
using System;
using System.Reflection;
using System.Reflection.Emit;
@@ -70,3 +71,4 @@ namespace Mono.CodeGeneration
}
}
}
+#endif
Modified: mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeBinaryComparison.cs
===================================================================
--- a/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeBinaryComparison.cs
+++ b/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeBinaryComparison.cs
@@ -21,6 +21,7 @@
// Copyright (C) Lluis Sanchez Gual, 2004
//
+#if !MONOTOUCH
using System;
using System.Reflection;
using System.Reflection.Emit;
@@ -165,4 +166,5 @@ namespace Mono.CodeGeneration
gen.Emit (OpCodes.Bgt, label);
}
}
-}
\ No newline at end of file
+}
+#endif
Modified: mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeBinaryOperation.cs
===================================================================
--- a/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeBinaryOperation.cs
+++ b/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeBinaryOperation.cs
@@ -1,5 +1,6 @@
// created on 28/08/2004 at 17:30
+#if !MONOTOUCH
using System;
using System.Reflection;
using System.Reflection.Emit;
@@ -36,3 +37,4 @@ namespace Mono.CodeGeneration
}
}
}
+#endif
Modified: mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeBlock.cs
===================================================================
--- a/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeBlock.cs
+++ b/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeBlock.cs
@@ -21,6 +21,7 @@
// Copyright (C) Lluis Sanchez Gual, 2004
//
+#if !MONOTOUCH
using System;
using System.Collections;
using System.Reflection;
@@ -86,3 +87,4 @@ namespace Mono.CodeGeneration
}
}
}
+#endif
Modified: mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeBuilder.cs
===================================================================
--- a/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeBuilder.cs
+++ b/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeBuilder.cs
@@ -21,6 +21,7 @@
// Copyright (C) Lluis Sanchez Gual, 2004
//
+#if !MONOTOUCH
using System;
using System.IO;
using System.Collections;
@@ -421,3 +422,4 @@ namespace Mono.CodeGeneration
}
}
}
+#endif
Modified: mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeCast.cs
===================================================================
--- a/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeCast.cs
+++ b/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeCast.cs
@@ -21,6 +21,7 @@
// Copyright (C) Lluis Sanchez Gual, 2004
//
+#if !MONOTOUCH
using System;
using System.Reflection;
using System.Reflection.Emit;
@@ -131,3 +132,4 @@ namespace Mono.CodeGeneration
}
}
}
+#endif
Modified: mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeClass.cs
===================================================================
--- a/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeClass.cs
+++ b/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeClass.cs
@@ -21,6 +21,7 @@
// Copyright (C) Lluis Sanchez Gual, 2004
//
+#if !MONOTOUCH
using System;
using System.IO;
using System.Collections;
@@ -346,3 +347,4 @@ namespace Mono.CodeGeneration
}
}
+#endif
Modified: mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeCustomAttribute.cs
===================================================================
--- a/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeCustomAttribute.cs
+++ b/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeCustomAttribute.cs
@@ -18,6 +18,7 @@
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#if !MONOTOUCH
using System;
using System.IO;
using System.Collections;
@@ -145,3 +146,4 @@ namespace Mono.CodeGeneration
}
}
}
+#endif
Modified: mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeDecrement.cs
===================================================================
--- a/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeDecrement.cs
+++ b/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeDecrement.cs
@@ -21,6 +21,7 @@
// Copyright (C) Lluis Sanchez Gual, 2004
//
+#if !MONOTOUCH
using System;
using System.Reflection;
using System.Reflection.Emit;
@@ -146,3 +147,4 @@ namespace Mono.CodeGeneration
}
}
}
+#endif
Modified: mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeEquals.cs
===================================================================
--- a/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeEquals.cs
+++ b/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeEquals.cs
@@ -21,6 +21,7 @@
// Copyright (C) Lluis Sanchez Gual, 2004
//
+#if !MONOTOUCH
using System;
using System.Reflection;
using System.Reflection.Emit;
@@ -97,4 +98,5 @@ namespace Mono.CodeGeneration
return typeof (bool);
}
}
-}
\ No newline at end of file
+}
+#endif
Modified: mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeExpression.cs
===================================================================
--- a/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeExpression.cs
+++ b/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeExpression.cs
@@ -21,6 +21,7 @@
// Copyright (C) Lluis Sanchez Gual, 2004
//
+#if !MONOTOUCH
using System;
using System.Reflection;
using System.Reflection.Emit;
@@ -196,3 +197,4 @@ namespace Mono.CodeGeneration
}
}
}
+#endif
Modified: mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeFieldReference.cs
===================================================================
--- a/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeFieldReference.cs
+++ b/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeFieldReference.cs
@@ -21,6 +21,7 @@
// Copyright (C) Lluis Sanchez Gual, 2004
//
+#if !MONOTOUCH
using System;
using System.Reflection;
using System.Reflection.Emit;
@@ -90,3 +91,4 @@ namespace Mono.CodeGeneration
}
}
}
+#endif
Modified: mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeFor.cs
===================================================================
--- a/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeFor.cs
+++ b/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeFor.cs
@@ -21,6 +21,7 @@
// Copyright (C) Lluis Sanchez Gual, 2004
//
+#if !MONOTOUCH
using System;
using System.Reflection;
using System.Reflection.Emit;
@@ -82,3 +83,4 @@ namespace Mono.CodeGeneration
}
}
}
+#endif
Modified: mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeForeach.cs
===================================================================
--- a/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeForeach.cs
+++ b/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeForeach.cs
@@ -21,6 +21,7 @@
// Copyright (C) Lluis Sanchez Gual, 2004
//
+#if !MONOTOUCH
using System;
using System.Collections;
using System.Reflection;
@@ -122,3 +123,4 @@ namespace Mono.CodeGeneration
}
}
}
+#endif
Modified: mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeGenerationHelper.cs
===================================================================
--- a/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeGenerationHelper.cs
+++ b/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeGenerationHelper.cs
@@ -21,6 +21,7 @@
// Copyright (C) Lluis Sanchez Gual, 2004
//
+#if !MONOTOUCH
using System;
using System.Collections;
using System.Reflection.Emit;
@@ -207,3 +208,4 @@ namespace Mono.CodeGeneration
}
}
}
+#endif
Modified: mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeIf.cs
===================================================================
--- a/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeIf.cs
+++ b/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeIf.cs
@@ -21,6 +21,7 @@
// Copyright (C) Lluis Sanchez Gual, 2004
//
+#if !MONOTOUCH
using System;
using System.Reflection;
using System.Reflection.Emit;
@@ -108,3 +109,4 @@ namespace Mono.CodeGeneration
}
}
}
+#endif
Modified: mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeIncrement.cs
===================================================================
--- a/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeIncrement.cs
+++ b/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeIncrement.cs
@@ -21,6 +21,7 @@
// Copyright (C) Lluis Sanchez Gual, 2004
//
+#if !MONOTOUCH
using System;
using System.Reflection;
using System.Reflection.Emit;
@@ -151,3 +152,4 @@ namespace Mono.CodeGeneration
}
}
}
+#endif
Modified: mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeIs.cs
===================================================================
--- a/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeIs.cs
+++ b/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeIs.cs
@@ -21,6 +21,7 @@
// Copyright (C) Lluis Sanchez Gual, 2004
//
+#if !MONOTOUCH
using System;
using System.Reflection;
using System.Reflection.Emit;
@@ -94,3 +95,4 @@ namespace Mono.CodeGeneration
}
}
}
+#endif
Modified: mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeItem.cs
===================================================================
--- a/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeItem.cs
+++ b/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeItem.cs
@@ -21,6 +21,7 @@
// Copyright (C) Lluis Sanchez Gual, 2004
//
+#if !MONOTOUCH
using System;
using System.Reflection;
using System.Reflection.Emit;
@@ -37,3 +38,4 @@ namespace Mono.CodeGeneration
{
}
}
+#endif
Modified: mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeLiteral.cs
===================================================================
--- a/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeLiteral.cs
+++ b/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeLiteral.cs
@@ -21,6 +21,7 @@
// Copyright (C) Lluis Sanchez Gual, 2004
//
+#if !MONOTOUCH
using System;
using System.Globalization;
using System.Reflection;
@@ -143,3 +144,4 @@ namespace Mono.CodeGeneration
}
}
}
+#endif
Modified: mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeMethod.cs
===================================================================
--- a/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeMethod.cs
+++ b/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeMethod.cs
@@ -21,6 +21,7 @@
// Copyright (C) Lluis Sanchez Gual, 2004
//
+#if !MONOTOUCH
using System;
using System.Collections;
using System.IO;
@@ -226,3 +227,4 @@ namespace Mono.CodeGeneration
}
}
}
+#endif
Modified: mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeMethodCall.cs
===================================================================
--- a/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeMethodCall.cs
+++ b/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeMethodCall.cs
@@ -21,6 +21,7 @@
// Copyright (C) Lluis Sanchez Gual, 2004
//
+#if !MONOTOUCH
using System;
using System.Reflection;
using System.Reflection.Emit;
@@ -142,3 +143,4 @@ namespace Mono.CodeGeneration
}
}
+#endif
Modified: mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeModule.cs
===================================================================
--- a/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeModule.cs
+++ b/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeModule.cs
@@ -21,6 +21,7 @@
// Copyright (C) Lluis Sanchez Gual, 2004
//
+#if !MONOTOUCH
using System;
using System.IO;
using System.Collections;
@@ -78,3 +79,4 @@ namespace Mono.CodeGeneration
}
}
+#endif
Modified: mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeNew.cs
===================================================================
--- a/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeNew.cs
+++ b/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeNew.cs
@@ -21,6 +21,7 @@
// Copyright (C) Lluis Sanchez Gual, 2004
//
+#if !MONOTOUCH
using System;
using System.Reflection;
using System.Reflection.Emit;
@@ -69,3 +70,4 @@ namespace Mono.CodeGeneration
}
}
}
+#endif
Modified: mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeNewArray.cs
===================================================================
--- a/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeNewArray.cs
+++ b/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeNewArray.cs
@@ -21,6 +21,7 @@
// Copyright (C) Lluis Sanchez Gual, 2004
//
+#if !MONOTOUCH
using System;
using System.Reflection;
using System.Reflection.Emit;
@@ -59,3 +60,4 @@ namespace Mono.CodeGeneration
}
}
}
+#endif
Modified: mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeNotEquals.cs
===================================================================
--- a/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeNotEquals.cs
+++ b/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeNotEquals.cs
@@ -21,6 +21,7 @@
// Copyright (C) Lluis Sanchez Gual, 2004
//
+#if !MONOTOUCH
using System;
using System.Reflection;
using System.Reflection.Emit;
@@ -114,4 +115,5 @@ namespace Mono.CodeGeneration
return typeof (bool);
}
}
-}
\ No newline at end of file
+}
+#endif
Modified: mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeOr.cs
===================================================================
--- a/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeOr.cs
+++ b/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeOr.cs
@@ -21,6 +21,7 @@
// Copyright (C) Lluis Sanchez Gual, 2004
//
+#if !MONOTOUCH
using System;
using System.Reflection;
using System.Reflection.Emit;
@@ -114,4 +115,5 @@ namespace Mono.CodeGeneration
return typeof (bool);
}
}
-}
\ No newline at end of file
+}
+#endif
Modified: mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeProperty.cs
===================================================================
--- a/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeProperty.cs
+++ b/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeProperty.cs
@@ -21,6 +21,7 @@
// Copyright (C) Lluis Sanchez Gual, 2004
//
+#if !MONOTOUCH
using System;
using System.Collections;
using System.IO;
@@ -242,3 +243,4 @@ namespace Mono.CodeGeneration
}
}
}
+#endif
Modified: mcs/class/System.ServiceModel/Mono.CodeGeneration/CodePropertyReference.cs
===================================================================
--- a/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodePropertyReference.cs
+++ b/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodePropertyReference.cs
@@ -21,6 +21,7 @@
// Copyright (C) Lluis Sanchez Gual, 2004
//
+#if !MONOTOUCH
using System;
using System.Reflection;
using System.Reflection.Emit;
@@ -61,3 +62,4 @@ namespace Mono.CodeGeneration
}
}
}
+#endif
Modified: mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeReturn.cs
===================================================================
--- a/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeReturn.cs
+++ b/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeReturn.cs
@@ -21,6 +21,7 @@
// Copyright (C) Lluis Sanchez Gual, 2004
//
+#if !MONOTOUCH
using System;
using System.Reflection;
using System.Reflection.Emit;
@@ -62,3 +63,4 @@ namespace Mono.CodeGeneration
}
}
}
+#endif
Modified: mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeSelect.cs
===================================================================
--- a/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeSelect.cs
+++ b/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeSelect.cs
@@ -21,6 +21,7 @@
// Copyright (C) Lluis Sanchez Gual, 2004
//
+#if !MONOTOUCH
using System;
using System.Collections;
using System.Reflection;
@@ -86,3 +87,4 @@ namespace Mono.CodeGeneration
}
}
}
+#endif
Modified: mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeSelfIncrement.cs
===================================================================
--- a/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeSelfIncrement.cs
+++ b/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeSelfIncrement.cs
@@ -1,5 +1,6 @@
// created on 28/08/2004 at 17:30
+#if !MONOTOUCH
using System;
using System.Reflection;
using System.Reflection.Emit;
@@ -90,3 +91,4 @@ namespace Mono.CodeGeneration
}
}
}
+#endif
Modified: mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeTryBlock.cs
===================================================================
--- a/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeTryBlock.cs
+++ b/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeTryBlock.cs
@@ -21,6 +21,7 @@
// Copyright (C) 2009 Novell, Inc
//
+#if !MONOTOUCH
using System;
using System.Collections;
#if NET_2_0
@@ -123,3 +124,4 @@ namespace Mono.CodeGeneration
}
}
}
+#endif
Modified: mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeUnaryOperation.cs
===================================================================
--- a/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeUnaryOperation.cs
+++ b/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeUnaryOperation.cs
@@ -21,6 +21,7 @@
// Copyright (C) Lluis Sanchez Gual, 2004
//
+#if !MONOTOUCH
using System;
using System.Reflection;
using System.Reflection.Emit;
@@ -100,3 +101,4 @@ namespace Mono.CodeGeneration
}
}
}
+#endif
Modified: mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeValueReference.cs
===================================================================
--- a/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeValueReference.cs
+++ b/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeValueReference.cs
@@ -21,6 +21,7 @@
// Copyright (C) Lluis Sanchez Gual, 2004
//
+#if !MONOTOUCH
using System;
using System.Reflection;
using System.Reflection.Emit;
@@ -32,3 +33,4 @@ namespace Mono.CodeGeneration
public abstract void GenerateSet (ILGenerator gen, CodeExpression value);
}
}
+#endif
Modified: mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeVariableDeclaration.cs
===================================================================
--- a/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeVariableDeclaration.cs
+++ b/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeVariableDeclaration.cs
@@ -21,6 +21,7 @@
// Copyright (C) Lluis Sanchez Gual, 2004
//
+#if !MONOTOUCH
using System;
using System.Reflection;
using System.Reflection.Emit;
@@ -52,3 +53,4 @@ namespace Mono.CodeGeneration
}
}
}
+#endif
Modified: mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeVariableReference.cs
===================================================================
--- a/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeVariableReference.cs
+++ b/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeVariableReference.cs
@@ -21,6 +21,7 @@
// Copyright (C) Lluis Sanchez Gual, 2004
//
+#if !MONOTOUCH
using System;
using System.Reflection;
using System.Reflection.Emit;
@@ -78,3 +79,4 @@ namespace Mono.CodeGeneration
}
}
}
+#endif
Modified: mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeWhen.cs
===================================================================
--- a/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeWhen.cs
+++ b/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeWhen.cs
@@ -21,6 +21,7 @@
// Copyright (C) Lluis Sanchez Gual, 2004
//
+#if !MONOTOUCH
using System;
using System.Reflection;
using System.Reflection.Emit;
@@ -84,3 +85,4 @@ namespace Mono.CodeGeneration
}
}
}
+#endif
Modified: mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeWhile.cs
===================================================================
--- a/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeWhile.cs
+++ b/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeWhile.cs
@@ -21,6 +21,7 @@
// Copyright (C) Lluis Sanchez Gual, 2004
//
+#if !MONOTOUCH
using System;
using System.Reflection;
using System.Reflection.Emit;
@@ -76,3 +77,4 @@ namespace Mono.CodeGeneration
}
}
}
+#endif
Modified: mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeWriter.cs
===================================================================
--- a/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeWriter.cs
+++ b/mcs/class/System.ServiceModel/Mono.CodeGeneration/CodeWriter.cs
@@ -21,6 +21,7 @@
// Copyright (C) Lluis Sanchez Gual, 2004
//
+#if !MONOTOUCH
using System;
using System.IO;
@@ -89,3 +90,4 @@ public class CodeWriter
}
}
+#endif
Modified: mcs/class/System.ServiceModel/Mono.CodeGeneration/Exp.cs
===================================================================
--- a/mcs/class/System.ServiceModel/Mono.CodeGeneration/Exp.cs
+++ b/mcs/class/System.ServiceModel/Mono.CodeGeneration/Exp.cs
@@ -21,6 +21,7 @@
// Copyright (C) Lluis Sanchez Gual, 2004
//
+#if !MONOTOUCH
using System;
using System.Reflection;
using System.Reflection.Emit;
@@ -96,3 +97,4 @@ namespace Mono.CodeGeneration
}
}
+#endif
Modified: mcs/class/System.ServiceModel/System.ServiceModel/ClientProxyGenerator.cs
===================================================================
--- a/mcs/class/System.ServiceModel/System.ServiceModel/ClientProxyGenerator.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel/ClientProxyGenerator.cs
@@ -25,6 +25,7 @@
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !MONOTOUCH
using System;
using System.Collections.Generic;
using System.Reflection;
@@ -304,3 +305,4 @@ namespace System.ServiceModel
}
}
}
+#endif
Commit: e984af04439a0e0bc8dcf2b340b0603b60881d92
Author: Marek Safar <marek.safar@gmail.com>
Date: 01/26/2011 04:04:50
URL: https://github.com/mono/mono/commit/e984af04439a0e0bc8dcf2b340b0603b60881d92
Optimized constructor readonly access has to be inside same declarting type
Changed paths:
M mcs/mcs/ecore.cs
Added paths:
A mcs/tests/gtest-551.cs
Modified: mcs/mcs/ecore.cs
===================================================================
--- a/mcs/mcs/ecore.cs
+++ b/mcs/mcs/ecore.cs
@@ -5156,7 +5156,7 @@ namespace Mono.CSharp {
bool need_copy;
if (spec.IsReadOnly){
need_copy = true;
- if (ec.HasSet (EmitContext.Options.ConstructorScope)){
+ if (ec.HasSet (EmitContext.Options.ConstructorScope) && spec.DeclaringType == \
ec.CurrentType) { if (IsStatic){
if (ec.IsStatic)
need_copy = false;
Added: mcs/tests/gtest-551.cs
===================================================================
--- /dev/null
+++ b/mcs/tests/gtest-551.cs
@@ -0,0 +1,27 @@
+using System;
+
+class Base<T> where T : new ()
+{
+ protected readonly T field = new T ();
+}
+
+class Derived<T> : Base<T> where T : ICloneable, new ()
+{
+ public Derived()
+ {
+ field.Clone();
+ }
+}
+
+class C : ICloneable
+{
+ public object Clone ()
+ {
+ return null;
+ }
+
+ public static void Main ()
+ {
+ var a = new Derived<C> ();
+ }
+}
Commit: 9aa0d0ba0bf2f2248badd8c82dec9f806de3b3be
Author: Rodrigo Kumpera <kumpera@gmail.com>
Date: 01/26/2011 06:37:39
URL: https://github.com/mono/mono/commit/9aa0d0ba0bf2f2248badd8c82dec9f806de3b3be
Fix freeing of delegate wrappers.
* marshal.c (mono_marshal_get_delegate_invoke): If
the target is a static method with first arg bound
and it belongs to a different assembly than the delegate
we might end up with a freed signature in the hashtable.
Fix a moonlight crash.
Changed paths:
M mono/metadata/marshal.c
Modified: mono/metadata/marshal.c
===================================================================
--- a/mono/metadata/marshal.c
+++ b/mono/metadata/marshal.c
@@ -4023,6 +4023,8 @@ mono_marshal_get_delegate_invoke (MonoMethod *method, \
MonoDelegate *del) res = newm;
new_key = g_new0 (SignatureMethodPair, 1);
*new_key = key;
+ if (static_method_with_first_arg_bound)
+ new_key->sig = signature_dup (del->method->klass->image, key.sig);
g_hash_table_insert (cache, new_key, res);
mono_marshal_set_wrapper_info (res, new_key);
mono_marshal_unlock ();
Commit: 93966536b50d8220426c8e92798868857dadecb4
Author: Geoff Norton <grompf@sublimeintervention.com>
Date: 01/26/2011 11:24:38
URL: https://github.com/mono/mono/commit/93966536b50d8220426c8e92798868857dadecb4
Dynamic methods are classes already here
Changed paths:
M mono/mini/debugger-agent.c
Modified: mono/mini/debugger-agent.c
===================================================================
--- a/mono/mini/debugger-agent.c
+++ b/mono/mini/debugger-agent.c
@@ -6423,7 +6423,10 @@ method_commands_internal (int command, MonoMethod *method, \
MonoDomain *domain, g
if (handle_class == mono_defaults.typehandle_class) {
buffer_add_byte (buf, TOKEN_TYPE_TYPE);
- buffer_add_typeid (buf, domain, mono_class_from_mono_type ((MonoType*)val));
+ if (method->wrapper_type == MONO_WRAPPER_DYNAMIC_METHOD)
+ buffer_add_typeid (buf, domain, (MonoClass *) val);
+ else
+ buffer_add_typeid (buf, domain, mono_class_from_mono_type ((MonoType*)val));
} else if (handle_class == mono_defaults.fieldhandle_class) {
buffer_add_byte (buf, TOKEN_TYPE_FIELD);
buffer_add_fieldid (buf, domain, val);
Commit: e62983964b303379540e8916d9221dcb90e1260b
Author: Andrew Jorgensen <ajorgensen@novell.com>
Date: 01/26/2011 11:48:47
URL: https://github.com/mono/mono/commit/e62983964b303379540e8916d9221dcb90e1260b
Add 2.0 and 4.0 S.D.S.C
Changed paths:
M mono-core.spec.in
Modified: mono-core.spec.in
===================================================================
--- a/mono-core.spec.in
+++ b/mono-core.spec.in
@@ -705,7 +705,9 @@ Mono implementation of core WinFX APIs
%files -n mono-winfxcore
%defattr(-, root, root)
+%_prefix/lib/mono/2.0/System.Data.Services.Client.dll*
%_prefix/lib/mono/2.0/WindowsBase.dll*
+%_prefix/lib/mono/4.0/System.Data.Services.Client.dll*
%_prefix/lib/mono/4.0/WindowsBase.dll*
%_prefix/lib/mono/gac/System.Data.Services.Client
%_prefix/lib/mono/gac/WindowsBase
Commit: acba62755ddda479df61d79ce1b175c465096279
Author: Geoff Norton <grompf@sublimeintervention.com>
Date: 01/26/2011 12:13:52
URL: https://github.com/mono/mono/commit/acba62755ddda479df61d79ce1b175c465096279
Ensure we properly align the stack before resuming from breakpoint signal handlers
Changed paths:
M mono/mini/exceptions-x86.c
M mono/mini/mini-x86.h
Modified: mono/mini/exceptions-x86.c
===================================================================
--- a/mono/mini/exceptions-x86.c
+++ b/mono/mini/exceptions-x86.c
@@ -1295,3 +1295,18 @@ mono_tasklets_arch_restore (void)
}
#endif
+/*
+ * mono_arch_setup_resume_sighandler_ctx:
+ *
+ * Setup CTX so execution continues at FUNC.
+ */
+void
+mono_arch_setup_resume_sighandler_ctx (MonoContext *ctx, gpointer func)
+{
+ int align = (((gint32)MONO_CONTEXT_GET_SP (ctx)) % MONO_ARCH_FRAME_ALIGNMENT + 4);
+
+ if (align != 0)
+ MONO_CONTEXT_SET_SP (ctx, MONO_CONTEXT_GET_SP (ctx) - align);
+
+ MONO_CONTEXT_SET_IP (ctx, func);
+}
Modified: mono/mini/mini-x86.h
===================================================================
--- a/mono/mini/mini-x86.h
+++ b/mono/mini/mini-x86.h
@@ -318,6 +318,7 @@ typedef struct {
#define MONO_ARCH_HAVE_HANDLER_BLOCK_GUARD 1
#define MONO_ARCH_HAVE_CARD_TABLE_WBARRIER 1
+#define MONO_ARCH_HAVE_SETUP_RESUME_FROM_SIGNAL_HANDLER_CTX 1
#define MONO_ARCH_GC_MAPS_SUPPORTED 1
gboolean
Commit: eb3626b925d61a20519c4e9e18495ab812f9d44d
Author: Geoff Norton <grompf@sublimeintervention.com>
Date: 01/26/2011 12:34:48
URL: https://github.com/mono/mono/commit/eb3626b925d61a20519c4e9e18495ab812f9d44d
Include operands when emitting the IL stream to sdb clients
Changed paths:
M mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/MethodBodyMirror.cs
Modified: mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/MethodBodyMirror.cs
===================================================================
--- a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/MethodBodyMirror.cs
+++ b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/MethodBodyMirror.cs
@@ -105,28 +105,23 @@ namespace Mono.Debugger.Soft
instr.Operand = br.ReadByte ();
break;
case OperandType.ShortInlineVar :
- br.ReadByte ();
- //instr.Operand = GetVariable (body, br.ReadByte ());
+ instr.Operand = br.ReadByte ();
break;
case OperandType.ShortInlineArg :
- br.ReadByte ();
- //instr.Operand = GetParameter (body, br.ReadByte ());
+ instr.Operand = br.ReadByte ();
break;
case OperandType.InlineSig :
br.ReadInt32 ();
//instr.Operand = GetCallSiteAt (br.ReadInt32 (), context);
break;
case OperandType.InlineI :
- br.ReadInt32 ();
- //instr.Operand = br.ReadInt32 ();
+ instr.Operand = br.ReadInt32 ();
break;
case OperandType.InlineVar :
- br.ReadInt16 ();
- //instr.Operand = GetVariable (body, br.ReadInt16 ());
+ instr.Operand = br.ReadInt16 ();
break;
case OperandType.InlineArg :
- br.ReadInt16 ();
- //instr.Operand = GetParameter (body, br.ReadInt16 ());
+ instr.Operand = br.ReadInt16 ();
break;
case OperandType.InlineI8 :
instr.Operand = br.ReadInt64 ();
Commit: c7f33c19043529e3cf1006a55d9b818626bd0e82
Author: Antoine Cailliau <antoine.cailliau@uclouvain.be>
Committer: Miguel de Icaza <miguel@gnome.org>
Date: 01/26/2011 17:28:56
URL: https://github.com/mono/mono/commit/c7f33c19043529e3cf1006a55d9b818626bd0e82
Implements System.ComponentModel.DataAnnotations.RegularExpressionAttribute
Changed paths:
M mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/RegularExpressionAttribute.cs
M mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations_test.dll.sources
Added paths:
A mcs/class/System.ComponentModel.DataAnnotations/Test/System.ComponentModel.DataAnnotations/RegularExpressionAttributeTest.cs
Modified: mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/RegularExpressionAttribute.cs
===================================================================
--- a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/RegularExpressionAttribute.cs
+++ b/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/RegularExpressionAttribute.cs
@@ -3,8 +3,10 @@
//
// Author:
// Atsushi Enomoto <atsushi@ximian.com>
+// Antoine Cailliau <a.cailliau@maximux.net>
//
// Copyright (C) 2008 Novell Inc. http://novell.com
+// Copyright (C) 20011 Maximux Scris. http://maximux.net
//
//
@@ -29,29 +31,47 @@
//
using System;
using System.ComponentModel;
+using System.Text.RegularExpressions;
namespace System.ComponentModel.DataAnnotations
{
- [AttributeUsage (AttributeTargets.Property|AttributeTargets.Field, AllowMultiple = \
false)] +
+#if NET_4_0
+ [AttributeUsage (AttributeTargets.Property|AttributeTargets.Field|AttributeTargets.Parameter, \
AllowMultiple = false)] +#else
+ [AttributeUsage (AttributeTargets.Property|AttributeTargets.Field, AllowMultiple = \
false)] +#endif
public class RegularExpressionAttribute : ValidationAttribute
{
public RegularExpressionAttribute (string pattern)
+ : base(GetDefaultErrorMessage)
{
+ if (pattern == null)
+ throw new ArgumentNullException("pattern");
Pattern = pattern;
}
public string Pattern { get; private set; }
- [MonoTODO]
+ static string GetDefaultErrorMessage ()
+ {
+ return "The field {0} must match the regular expression {1}.";
+ }
+
public override string FormatErrorMessage (string name)
{
- throw new NotImplementedException ();
+ return string.Format(ErrorMessageString, name, Pattern);
}
- [MonoTODO]
+ // LAMESPEC: does not throw ValidationException when value does not match the \
regular expression public override bool IsValid (object value)
{
- throw new NotImplementedException ();
+ if (value == null)
+ return true;
+
+ string str = (string) value;
+ Regex regex = new Regex(Pattern);
+ return regex.IsMatch(str);
}
}
}
Modified: mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations_test.dll.sources
===================================================================
--- a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations_test.dll.sources
+++ b/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations_test.dll.sources
@@ -9,3 +9,4 @@ System.ComponentModel.DataAnnotations/StringLengthAttributeTest.cs
System.ComponentModel.DataAnnotations/ValidationAttributeTest.cs
System.ComponentModel.DataAnnotations/ValidationContextTest.cs
System.ComponentModel.DataAnnotations/ValidationResultTest.cs
+System.ComponentModel.DataAnnotations/RegularExpressionAttributeTest.cs
Added: mcs/class/System.ComponentModel.DataAnnotations/Test/System.ComponentModel.DataAnnotations/RegularExpressionAttributeTest.cs
===================================================================
--- /dev/null
+++ b/mcs/class/System.ComponentModel.DataAnnotations/Test/System.ComponentModel.DataAnnotations/RegularExpressionAttributeTest.cs
@@ -0,0 +1,116 @@
+???//
+// StringLengthAttributeTest.cs
+//
+// Authors:
+// Marek Habersack <mhabersack@novell.com>
+//
+// Copyright (C) 2010 Novell, Inc. (http://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.
+//
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.Text;
+
+using NUnit.Framework;
+using MonoTests.Common;
+
+namespace MonoTests.System.ComponentModel.DataAnnotations
+{
+ [TestFixture]
+ public class RegularExpressionAttributeTest
+ {
+ class RegularExpressionAttributePoker : RegularExpressionAttribute
+ {
+ public RegularExpressionAttributePoker (string pattern)
+ : base(pattern)
+ { }
+
+ public string GetErrorMessageString ()
+ {
+ return ErrorMessageString;
+ }
+ }
+
+ [Test]
+ public void Constructor ()
+ {
+ var rea = new RegularExpressionAttributePoker (@"[A-Za-z]");
+ Assert.AreEqual (@"[A-Za-z]", rea.Pattern, "Patterns not saved correctly.");
+ Assert.AreEqual (null, rea.ErrorMessage, "Error message not null when not yet \
matched."); + Assert.AreEqual ("The field {0} must match the regular expression \
{1}.", rea.GetErrorMessageString (), "Error message not valid."); + }
+
+ [Test]
+ public void FormatMessageString ()
+ {
+ var rea = new RegularExpressionAttributePoker (@"[A-Za-z]");
+
+ Assert.AreEqual ("The field MyField must match the regular expression [A-Za-z].", \
+ rea.FormatErrorMessage ("MyField"),
+ "Error message not correctly formatted.");
+
+#if !NET_4_0
+ rea = new RegularExpressionAttributePoker (@"[A-Za-z]");
+#endif
+ rea.ErrorMessage = "Param 0: {0}";
+ Assert.AreEqual ("Param 0: MyField", rea.FormatErrorMessage ("MyField"), "Error \
message not correctly updated."); +
+#if !NET_4_0
+ rea = new RegularExpressionAttributePoker (@"[A-Za-z]");
+#endif
+ rea.ErrorMessage = "Param 0: {0}; Param 1: {1}";
+ Assert.AreEqual ("Param 0: MyField; Param 1: [A-Za-z]", rea.FormatErrorMessage \
("MyField"), "Error message not correctly updated."); + Assert.AreEqual ("Param 0: \
; Param 1: [A-Za-z]", rea.FormatErrorMessage (null), "Error message fails on null \
value."); + }
+
+ [Test]
+ public void IsValid ()
+ {
+ var rea = new RegularExpressionAttributePoker (@"[A-Za-z]");
+
+ Assert.IsTrue (rea.IsValid (null), "Null does not match [A-Za-z].");
+ Assert.IsTrue (rea.IsValid ("A"), "'A' does not match [A-Za-z].");
+ Assert.IsTrue (rea.IsValid ("a"), "'a' does not match [A-Za-z].");
+ Assert.IsTrue (rea.IsValid ("Bz"), "'Bz' does not match [A-Za-z].");
+ Assert.IsTrue (rea.IsValid ("string"), "'string' does not match [A-Za-z].");
+ Assert.IsFalse (rea.IsValid (String.Empty), "Empty string matches [A-Za-z].");
+ Assert.IsFalse (rea.IsValid ("0123456789"), "'0123456789' matches [A-Za-z].");
+ Assert.IsFalse (rea.IsValid ("0123456789"), "'0123456789A' matches [A-Za-z].");
+ AssertExtensions.Throws<InvalidCastException> (() => {
+ rea.IsValid (123);
+ }, "Casting does not fails");
+ AssertExtensions.Throws<InvalidCastException> (() => {
+ rea.IsValid (DateTime.Now);
+ }, "Casting does not fails");
+
+ rea = new RegularExpressionAttributePoker ("");
+ Assert.IsTrue (rea.IsValid (null), "null does not match empty pattern");
+ Assert.IsTrue (rea.IsValid (String.Empty), "empty string does not match empty \
pattern"); + Assert.IsTrue (rea.IsValid ("string"), "'string' does not match empty \
pattern"); +
+ AssertExtensions.Throws<ArgumentNullException> (() => {
+ rea = new RegularExpressionAttributePoker (null);
+ }, "Null pattern allowed");
+ }
+ }
+}
+
Commit: 27729c4b207e0afedfa9c51549d51107726c0438
Author: Kenneth Bell <ken.git@chezbell.org.uk>
Committer: Miguel de Icaza <miguel@gnome.org>
Date: 01/26/2011 17:46:28
URL: https://github.com/mono/mono/commit/27729c4b207e0afedfa9c51549d51107726c0438
Implement SecurityIdentifier and improve NTAccount.
* Only translates between SecurityIdentifier and NTAccount for
well-known accounts.
* NTAccount changed to not upper-case values to match behaviour
observed in Microsoft's .NET (see also unit tests)
* Add unit tests for both classes
Changed paths:
M mcs/class/corlib/System.Security.Principal/NTAccount.cs
M mcs/class/corlib/System.Security.Principal/SecurityIdentifier.cs
M mcs/class/corlib/corlib.dll.sources
M mcs/class/corlib/corlib_test.dll.sources
Added paths:
A mcs/class/corlib/System.Security.Principal/WellKnownAccount.cs
A mcs/class/corlib/Test/System.Security.Principal/NTAccountTest.cs
A mcs/class/corlib/Test/System.Security.Principal/SecurityIdentifierTest.cs
Modified: mcs/class/corlib/System.Security.Principal/NTAccount.cs
===================================================================
--- a/mcs/class/corlib/System.Security.Principal/NTAccount.cs
+++ b/mcs/class/corlib/System.Security.Principal/NTAccount.cs
@@ -3,6 +3,7 @@
//
// Author:
// Sebastien Pouliot <sebastien@ximian.com>
+// Kenneth Bell
//
// Copyright (C) 2005, 2006 Novell, Inc (http://www.novell.com)
//
@@ -43,7 +44,7 @@ namespace System.Security.Principal {
throw new ArgumentNullException ("name");
if (name.Length == 0)
throw new ArgumentException (Locale.GetText ("Empty"), "name");
- _value = name.ToUpper ();
+ _value = name;
}
public NTAccount (string domainName, string accountName)
@@ -53,9 +54,9 @@ namespace System.Security.Principal {
if (accountName.Length == 0)
throw new ArgumentException (Locale.GetText ("Empty"), "accountName");
if (domainName == null)
- _value = domainName.ToUpper ();
+ _value = accountName;
else
- _value = domainName.ToUpper () + "\\" + domainName.ToUpper ();
+ _value = domainName + "\\" + accountName;
}
@@ -95,7 +96,16 @@ namespace System.Security.Principal {
{
if (targetType == typeof (NTAccount))
return this; // ? copy
- return null;
+
+ if(targetType == typeof(SecurityIdentifier)) {
+ WellKnownAccount acct = WellKnownAccount.LookupByName(this.Value);
+ if (acct == null || acct.Sid == null)
+ throw new IdentityNotMappedException("Cannot map account name: " + this.Value);
+
+ return new SecurityIdentifier(acct.Sid);
+ }
+
+ throw new ArgumentException("Unknown type", "targetType");
}
public static bool operator == (NTAccount left, NTAccount right)
Modified: mcs/class/corlib/System.Security.Principal/SecurityIdentifier.cs
===================================================================
--- a/mcs/class/corlib/System.Security.Principal/SecurityIdentifier.cs
+++ b/mcs/class/corlib/System.Security.Principal/SecurityIdentifier.cs
@@ -3,6 +3,7 @@
//
// Author:
// Sebastien Pouliot <sebastien@ximian.com>
+// Kenneth Bell
//
// Copyright (C) 2005, 2006 Novell, Inc (http://www.novell.com)
//
@@ -29,35 +30,42 @@
using System.Globalization;
using System.Runtime.InteropServices;
+using System.Text;
namespace System.Security.Principal {
- [MonoTODO ("not implemented")]
[ComVisible (false)]
public sealed class SecurityIdentifier : IdentityReference, \
IComparable<SecurityIdentifier> { + private byte[] buffer;
- private string _value;
-
- public static readonly int MaxBinaryLength = 0;
- public static readonly int MinBinaryLength = 0;
+ public static readonly int MaxBinaryLength = 68;
+ public static readonly int MinBinaryLength = 8;
public SecurityIdentifier (string sddlForm)
{
if (sddlForm == null)
throw new ArgumentNullException ("sddlForm");
-
- _value = sddlForm.ToUpperInvariant ();
+
+ buffer = ParseSddlForm (sddlForm);
}
public SecurityIdentifier (byte[] binaryForm, int offset)
{
if (binaryForm == null)
throw new ArgumentNullException ("binaryForm");
- if ((offset < 0) || (offset > binaryForm.Length - 1))
+ if ((offset < 0) || (offset > binaryForm.Length - 2))
throw new ArgumentException ("offset");
-
- throw new NotImplementedException ();
+
+ int revision = binaryForm[offset];
+ int numSubAuthorities = binaryForm[offset + 1];
+ if (revision != 1 || numSubAuthorities > 15)
+ throw new ArgumentException ("Value was invalid.");
+ if (offset > binaryForm.Length - (8 + (numSubAuthorities * 4)))
+ throw new ArgumentException ("offset");
+
+ buffer = new byte[8 + (numSubAuthorities * 4)];
+ Array.Copy (binaryForm, offset, buffer, 0, buffer.Length);
}
public SecurityIdentifier (IntPtr binaryForm)
@@ -65,44 +73,68 @@ namespace System.Security.Principal {
throw new NotImplementedException ();
}
- public SecurityIdentifier (WellKnownSidType sidType, SecurityIdentifier domainSid)
- {
- switch (sidType) {
- case WellKnownSidType.LogonIdsSid:
- throw new ArgumentException ("sidType");
- case WellKnownSidType.AccountAdministratorSid:
- case WellKnownSidType.AccountGuestSid:
- case WellKnownSidType.AccountKrbtgtSid:
- case WellKnownSidType.AccountDomainAdminsSid:
- case WellKnownSidType.AccountDomainUsersSid:
- case WellKnownSidType.AccountDomainGuestsSid:
- case WellKnownSidType.AccountComputersSid:
- case WellKnownSidType.AccountControllersSid:
- case WellKnownSidType.AccountCertAdminsSid:
- case WellKnownSidType.AccountSchemaAdminsSid:
- case WellKnownSidType.AccountEnterpriseAdminsSid:
- case WellKnownSidType.AccountPolicyAdminsSid:
- case WellKnownSidType.AccountRasAndIasServersSid:
+ public SecurityIdentifier (WellKnownSidType sidType,
+ SecurityIdentifier domainSid)
+ {
+ WellKnownAccount acct = WellKnownAccount.LookupByType (sidType);
+ if (acct == null)
+ throw new ArgumentException ("Unable to convert SID type: " + sidType);
+
+ if (acct.IsAbsolute) {
+ buffer = ParseSddlForm (acct.Sid);
+ } else {
if (domainSid == null)
throw new ArgumentNullException ("domainSid");
- // TODO
- break;
- default:
- // TODO
- break;
+
+ buffer = ParseSddlForm (domainSid.Value + "-" + acct.Rid);
}
}
public SecurityIdentifier AccountDomainSid {
- get { throw new ArgumentNullException ("AccountDomainSid"); }
+ get {
+ string strForm = this.Value;
+
+ // Check prefix, and ensure at least 4 sub authorities
+ if (!strForm.StartsWith ("S-1-5-21") || buffer[1] < 4)
+ return null;
+
+ // Domain is first four sub-authorities
+ byte[] temp = new byte[8 + (4 * 4)];
+ Array.Copy (buffer, 0, temp, 0, temp.Length);
+ temp[1] = 4;
+ return new SecurityIdentifier (temp, 0);
+ }
}
public int BinaryLength {
- get { return -1; }
+ get { return buffer.Length; }
}
- public override string Value {
- get { return _value; }
+ public override string Value {
+ get {
+ StringBuilder s = new StringBuilder ();
+
+ ulong authority = (((ulong)buffer[2]) << 40) | (((ulong)buffer[3]) << 32)
+ | (((ulong)buffer[4]) << 24) | (((ulong)buffer[5]) << 16)
+ | (((ulong)buffer[6]) << 8) | (((ulong)buffer[7]) << 0);
+ s.AppendFormat (CultureInfo.InvariantCulture, "S-1-{0}", authority);
+
+ for (int i = 0; i < buffer[1]; ++i) {
+ // Note sub authorities little-endian, authority (above) is big-endian!
+ int offset = 8 + (i * 4);
+
+ uint subAuthority =
+ (((uint)buffer[offset + 0]) << 0)
+ | (((uint)buffer[offset + 1]) << 8)
+ | (((uint)buffer[offset + 2]) << 16)
+ | (((uint)buffer[offset + 3]) << 24);
+ s.AppendFormat (
+ CultureInfo.InvariantCulture,
+ "-{0}", subAuthority);
+ }
+
+ return s.ToString ();
+ }
}
public int CompareTo (SecurityIdentifier sid)
@@ -126,10 +158,10 @@ namespace System.Security.Principal {
{
if (binaryForm == null)
throw new ArgumentNullException ("binaryForm");
- if ((offset < 0) || (offset > binaryForm.Length - 1 - this.BinaryLength))
+ if ((offset < 0) || (offset > binaryForm.Length - buffer.Length))
throw new ArgumentException ("offset");
-
- // TODO
+
+ Array.Copy (buffer, 0, binaryForm, offset, buffer.Length);
}
public override int GetHashCode ()
@@ -139,26 +171,40 @@ namespace System.Security.Principal {
public bool IsAccountSid ()
{
- throw new NotImplementedException ();
+ return AccountDomainSid != null;
}
public bool IsEqualDomainSid (SecurityIdentifier sid)
{
- throw new NotImplementedException ();
+ SecurityIdentifier domSid = AccountDomainSid;
+ if (domSid == null)
+ return false;
+
+ return domSid.Equals (sid.AccountDomainSid);
}
public override bool IsValidTargetType (Type targetType)
{
- if (targetType == typeof (SecurityIdentifier))
+ if (targetType == typeof(SecurityIdentifier))
return true;
- if (targetType == typeof (NTAccount))
+ if (targetType == typeof(NTAccount))
return true;
return false;
}
public bool IsWellKnown (WellKnownSidType type)
{
- throw new NotImplementedException ();
+ WellKnownAccount acct = WellKnownAccount.LookupByType (type);
+ if (acct == null)
+ return false;
+
+ string sid = Value;
+
+ if (acct.IsAbsolute)
+ return sid == acct.Sid;
+
+ return sid.StartsWith ("S-1-5-21", StringComparison.OrdinalIgnoreCase)
+ && sid.EndsWith ("-" + acct.Rid, StringComparison.OrdinalIgnoreCase);
}
public override string ToString ()
@@ -168,9 +214,18 @@ namespace System.Security.Principal {
public override IdentityReference Translate (Type targetType)
{
- if (targetType == typeof (SecurityIdentifier))
- return this; // ? copy
- return null;
+ if (targetType == typeof(SecurityIdentifier))
+ return this;
+
+ if (targetType == typeof(NTAccount)) {
+ WellKnownAccount acct = WellKnownAccount.LookupBySid (this.Value);
+ if (acct == null || acct.Name == null)
+ throw new IdentityNotMappedException ("Unable to map SID: " + this.Value);
+
+ return new NTAccount (acct.Name);
+ }
+
+ throw new ArgumentException ("Unknown type.", "targetType");
}
public static bool operator == (SecurityIdentifier left, SecurityIdentifier right)
@@ -190,6 +245,139 @@ namespace System.Security.Principal {
return true;
return (left.Value != right.Value);
}
+
+ internal string GetSddlForm()
+ {
+ string sidString = Value;
+
+ WellKnownAccount acct = WellKnownAccount.LookupBySid(sidString);
+ if(acct == null || acct.SddlForm == null)
+ return sidString;
+
+ return acct.SddlForm;
+ }
+
+ internal static SecurityIdentifier ParseSddlForm(string sddlForm, ref int pos)
+ {
+ if (sddlForm.Length - pos < 2)
+ throw new ArgumentException("Invalid SDDL string.", "sddlForm");
+
+ string sid;
+ int len;
+
+ string prefix = sddlForm.Substring(pos, 2).ToUpperInvariant();
+ if (prefix == "S-")
+ {
+ // Looks like a SID, try to parse it.
+ int endPos = pos;
+
+ char ch = Char.ToUpperInvariant(sddlForm[endPos]);
+ while (ch == 'S' || ch == '-' || ch == 'X'
+ || (ch >= '0' && ch <= '9') || (ch >= 'A' && ch <= 'F')) {
+ ++endPos;
+ ch = Char.ToUpperInvariant(sddlForm[endPos]);
+ }
+
+ sid = sddlForm.Substring(pos, endPos - pos);
+ len = endPos - pos;
+ } else {
+ sid = prefix;
+ len = 2;
+ }
+
+ SecurityIdentifier ret = new SecurityIdentifier(sid);
+ pos += len;
+ return ret;
+ }
+
+ private static byte[] ParseSddlForm (string sddlForm)
+ {
+ string sid = sddlForm;
+
+ // If only 2 characters long, can't be a full SID string - so assume
+ // it's an attempted alias. Do that conversion first.
+ if(sddlForm.Length == 2) {
+ WellKnownAccount acct = WellKnownAccount.LookupBySddlForm(sddlForm);
+ if (acct == null)
+ throw new ArgumentException(
+ "Invalid SDDL string - unrecognized account: " + sddlForm,
+ "sddlForm");
+ if (!acct.IsAbsolute)
+ throw new NotImplementedException(
+ "Mono unable to convert account to SID: "
+ + (acct.Name != null ? acct.Name : sddlForm));
+
+ sid = acct.Sid;
+ }
+
+ string[] elements = sid.ToUpperInvariant ().Split ('-');
+ int numSubAuthorities = elements.Length - 3;
+
+ if (elements.Length < 3 || elements[0] != "S" || numSubAuthorities > 15)
+ throw new ArgumentException ("Value was invalid.");
+
+ if (elements[1] != "1")
+ throw new ArgumentException ("Only SIDs with revision 1 are supported");
+
+ byte[] buffer = new byte[8 + (numSubAuthorities * 4)];
+ buffer[0] = 1;
+ buffer[1] = (byte)numSubAuthorities;
+
+ ulong authority;
+ if (!TryParseAuthority (elements[2], out authority))
+ throw new ArgumentException ("Value was invalid.");
+ buffer[2] = (byte)((authority >> 40) & 0xFF);
+ buffer[3] = (byte)((authority >> 32) & 0xFF);
+ buffer[4] = (byte)((authority >> 24) & 0xFF);
+ buffer[5] = (byte)((authority >> 16) & 0xFF);
+ buffer[6] = (byte)((authority >> 8) & 0xFF);
+ buffer[7] = (byte)((authority >> 0) & 0xFF);
+
+ for (int i = 0; i < numSubAuthorities; ++i) {
+ uint subAuthority;
+
+ if (!TryParseSubAuthority (elements[i + 3],
+ out subAuthority))
+ throw new ArgumentException ("Value was invalid.");
+
+ // Note sub authorities little-endian!
+ int offset = 8 + (i * 4);
+ buffer[offset + 0] = (byte)(subAuthority >> 0);
+ buffer[offset + 1] = (byte)(subAuthority >> 8);
+ buffer[offset + 2] = (byte)(subAuthority >> 16);
+ buffer[offset + 3] = (byte)(subAuthority >> 24);
+ }
+
+ return buffer;
+ }
+
+ private static bool TryParseAuthority (string s, out ulong result)
+ {
+ if (s.StartsWith ("0X")) {
+ return ulong.TryParse (s.Substring (2),
+ NumberStyles.HexNumber,
+ CultureInfo.InvariantCulture,
+ out result);
+ } else {
+ return ulong.TryParse (s, NumberStyles.Integer,
+ CultureInfo.InvariantCulture,
+ out result);
+ }
+ }
+
+ private static bool TryParseSubAuthority (string s, out uint result)
+ {
+ if (s.StartsWith ("0X")) {
+ return uint.TryParse (s.Substring (2),
+ NumberStyles.HexNumber,
+ CultureInfo.InvariantCulture,
+ out result);
+ } else {
+ return uint.TryParse (s, NumberStyles.Integer,
+ CultureInfo.InvariantCulture,
+ out result);
+ }
+ }
}
}
Modified: mcs/class/corlib/corlib.dll.sources
===================================================================
--- a/mcs/class/corlib/corlib.dll.sources
+++ b/mcs/class/corlib/corlib.dll.sources
@@ -1423,6 +1423,7 @@ System.Security.Principal/PrincipalPolicy.cs
System.Security.Principal/SecurityIdentifier.cs
System.Security.Principal/TokenAccessLevels.cs
System.Security.Principal/TokenImpersonationLevel.cs
+System.Security.Principal/WellKnownAccount.cs
System.Security.Principal/WellKnownSidType.cs
System.Security.Principal/WindowsAccountType.cs
System.Security.Principal/WindowsBuiltInRole.cs
Modified: mcs/class/corlib/corlib_test.dll.sources
===================================================================
--- a/mcs/class/corlib/corlib_test.dll.sources
+++ b/mcs/class/corlib/corlib_test.dll.sources
@@ -331,6 +331,8 @@ System.Security.Policy/ZoneTest.cs
System.Security.Policy/ZoneMembershipConditionTest.cs
System.Security.Principal/GenericIdentityTest.cs
System.Security.Principal/GenericPrincipalTest.cs
+System.Security.Principal/NTAccountTest.cs
+System.Security.Principal/SecurityIdentifierTest.cs
System.Security.Principal/WindowsIdentityTest.cs
System.Security.Principal/WindowsPrincipalTest.cs
System.Security/SecureStringTest.cs
Added: mcs/class/corlib/System.Security.Principal/WellKnownAccount.cs
===================================================================
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Principal/WellKnownAccount.cs
@@ -0,0 +1,130 @@
+//
+// System.Security.Policy.WellKnownAccount.cs
+//
+// Author:
+// Kenneth Bell
+//
+
+
+namespace System.Security.Principal
+{
+ internal class WellKnownAccount
+ {
+ public WellKnownSidType WellKnownValue { get; set; }
+ public bool IsAbsolute { get; set; }
+ public string Sid { get; set; }
+ public string Rid { get; set; }
+ public string Name { get; set; }
+ public string SddlForm { get; set; }
+
+ public static WellKnownAccount LookupByType (WellKnownSidType sidType)
+ {
+ foreach (var acct in accounts) {
+ if (acct.WellKnownValue == sidType)
+ return acct;
+ }
+
+ return null;
+ }
+
+ public static WellKnownAccount LookupBySid(string s)
+ {
+ foreach (var acct in accounts) {
+ if (acct.Sid == s)
+ return acct;
+ }
+
+ return null;
+ }
+
+ public static WellKnownAccount LookupByName(string s)
+ {
+ foreach (var acct in accounts) {
+ if (acct.Name == s)
+ return acct;
+ }
+
+ return null;
+ }
+
+ public static WellKnownAccount LookupBySddlForm(string s)
+ {
+ foreach (var acct in accounts) {
+ if (acct.SddlForm == s)
+ return acct;
+ }
+
+ return null;
+ }
+
+ private static readonly WellKnownAccount[] accounts = new WellKnownAccount[] {
+ new WellKnownAccount { WellKnownValue = WellKnownSidType.NullSid, IsAbsolute = \
true, Sid = "S-1-0-0", Name = @"NULL SID"}, + new WellKnownAccount { WellKnownValue \
= WellKnownSidType.WorldSid, IsAbsolute = true, Sid = "S-1-1-0", Name = @"Everyone", \
SddlForm = "WD"}, + new WellKnownAccount { WellKnownValue = \
WellKnownSidType.LocalSid, IsAbsolute = true, Sid = "S-1-2-0", Name = @"LOCAL"}, \
+ new WellKnownAccount { WellKnownValue = WellKnownSidType.CreatorOwnerSid, \
IsAbsolute = true, Sid = "S-1-3-0", Name = @"CREATOR OWNER", SddlForm = "CO"}, \
+ new WellKnownAccount { WellKnownValue = WellKnownSidType.CreatorGroupSid, \
IsAbsolute = true, Sid = "S-1-3-1", Name = @"CREATOR GROUP", SddlForm = "CG"}, \
+ new WellKnownAccount { WellKnownValue = WellKnownSidType.CreatorOwnerServerSid, \
IsAbsolute = true, Sid = "S-1-3-2", Name = @"CREATOR OWNER SERVER"}, + new \
WellKnownAccount { WellKnownValue = WellKnownSidType.CreatorGroupServerSid, \
IsAbsolute = true, Sid = "S-1-3-3", Name = @"CREATOR GROUP SERVER"}, + new \
WellKnownAccount { WellKnownValue = WellKnownSidType.NTAuthoritySid, IsAbsolute = \
true, Sid = "S-1-5", Name = null}, + new WellKnownAccount { WellKnownValue = \
WellKnownSidType.DialupSid, IsAbsolute = true, Sid = "S-1-5-1", Name = @"NT \
AUTHORITY\DIALUP"}, + new WellKnownAccount { WellKnownValue = \
WellKnownSidType.NetworkSid, IsAbsolute = true, Sid = "S-1-5-2", Name = @"NT \
AUTHORITY\NETWORK", SddlForm = "NU"}, + new WellKnownAccount { WellKnownValue = \
WellKnownSidType.BatchSid, IsAbsolute = true, Sid = "S-1-5-3", Name = @"NT \
AUTHORITY\BATCH"}, + new WellKnownAccount { WellKnownValue = \
WellKnownSidType.InteractiveSid, IsAbsolute = true, Sid = "S-1-5-4", Name = @"NT \
AUTHORITY\INTERACTIVE", SddlForm = "IU"}, + new WellKnownAccount { WellKnownValue = \
WellKnownSidType.ServiceSid, IsAbsolute = true, Sid = "S-1-5-6", Name = @"NT \
AUTHORITY\SERVICE", SddlForm = "SU"}, + new WellKnownAccount { WellKnownValue = \
WellKnownSidType.AnonymousSid, IsAbsolute = true, Sid = "S-1-5-7", Name = @"NT \
AUTHORITY\ANONYMOUS LOGON", SddlForm = "AN"}, + new WellKnownAccount { \
WellKnownValue = WellKnownSidType.ProxySid, IsAbsolute = true, Sid = "S-1-5-8", Name \
= @"NT AUTHORITY\PROXY"}, + new WellKnownAccount { WellKnownValue = \
WellKnownSidType.EnterpriseControllersSid, IsAbsolute = true, Sid = "S-1-5-9", Name = \
@"NT AUTHORITY\ENTERPRISE DOMAIN CONTROLLERS", SddlForm = "ED"}, + new \
WellKnownAccount { WellKnownValue = WellKnownSidType.SelfSid, IsAbsolute = true, Sid \
= "S-1-5-10", Name = @"NT AUTHORITY\SELF", SddlForm = "PS"}, + new WellKnownAccount \
{ WellKnownValue = WellKnownSidType.AuthenticatedUserSid, IsAbsolute = true, Sid = \
"S-1-5-11", Name = @"NT AUTHORITY\Authenticated Users", SddlForm = "AU"}, + new \
WellKnownAccount { WellKnownValue = WellKnownSidType.RestrictedCodeSid, IsAbsolute = \
true, Sid = "S-1-5-12", Name = @"NT AUTHORITY\RESTRICTED", SddlForm = "RC"}, + new \
WellKnownAccount { WellKnownValue = WellKnownSidType.TerminalServerSid, IsAbsolute = \
true, Sid = "S-1-5-13", Name = @"NT AUTHORITY\TERMINAL SERVER USER"}, + new \
WellKnownAccount { WellKnownValue = WellKnownSidType.RemoteLogonIdSid, IsAbsolute = \
true, Sid = "S-1-5-14", Name = @"NT AUTHORITY\REMOTE INTERACTIVE LOGON"}, + new \
WellKnownAccount { WellKnownValue = WellKnownSidType.LocalSystemSid, IsAbsolute = \
true, Sid = "S-1-5-18", Name = @"NT AUTHORITY\SYSTEM", SddlForm = "SY"}, + new \
WellKnownAccount { WellKnownValue = WellKnownSidType.LocalServiceSid, IsAbsolute = \
true, Sid = "S-1-5-19", Name = @"NT AUTHORITY\LOCAL SERVICE", SddlForm = "LS"}, \
+ new WellKnownAccount { WellKnownValue = WellKnownSidType.NetworkServiceSid, \
IsAbsolute = true, Sid = "S-1-5-20", Name = @"NT AUTHORITY\NETWORK SERVICE", SddlForm \
= "NS"}, + new WellKnownAccount { WellKnownValue = \
WellKnownSidType.BuiltinDomainSid, IsAbsolute = true, Sid = "S-1-5-32", Name = null}, \
+ new WellKnownAccount { WellKnownValue = \
WellKnownSidType.BuiltinAdministratorsSid, IsAbsolute = true, Sid = "S-1-5-32-544", \
Name = @"BUILTIN\Administrators", SddlForm = "BA"}, + new WellKnownAccount { \
WellKnownValue = WellKnownSidType.BuiltinUsersSid, IsAbsolute = true, Sid = \
"S-1-5-32-545", Name = @"BUILTIN\Users", SddlForm = "BU"}, + new WellKnownAccount { \
WellKnownValue = WellKnownSidType.BuiltinGuestsSid, IsAbsolute = true, Sid = \
"S-1-5-32-546", Name = @"BUILTIN\Guests", SddlForm = "BG"}, + new WellKnownAccount \
{ WellKnownValue = WellKnownSidType.BuiltinPowerUsersSid, IsAbsolute = true, Sid = \
"S-1-5-32-547", Name = null, SddlForm = "PU"}, + new WellKnownAccount { \
WellKnownValue = WellKnownSidType.BuiltinAccountOperatorsSid, IsAbsolute = true, Sid \
= "S-1-5-32-548", Name = null, SddlForm = "AO"}, + new WellKnownAccount { \
WellKnownValue = WellKnownSidType.BuiltinSystemOperatorsSid, IsAbsolute = true, Sid = \
"S-1-5-32-549", Name = null, SddlForm = "SO"}, + new WellKnownAccount { \
WellKnownValue = WellKnownSidType.BuiltinPrintOperatorsSid, IsAbsolute = true, Sid = \
"S-1-5-32-550", Name = null, SddlForm = "PO"}, + new WellKnownAccount { \
WellKnownValue = WellKnownSidType.BuiltinBackupOperatorsSid, IsAbsolute = true, Sid = \
"S-1-5-32-551", Name = null, SddlForm = "BO"}, + new WellKnownAccount { \
WellKnownValue = WellKnownSidType.BuiltinReplicatorSid, IsAbsolute = true, Sid = \
"S-1-5-32-552", Name = null, SddlForm = "RE"}, + new WellKnownAccount { \
WellKnownValue = WellKnownSidType.BuiltinPreWindows2000CompatibleAccessSid, \
IsAbsolute = true, Sid = "S-1-5-32-554", Name = null, SddlForm = "RU"}, + new \
WellKnownAccount { WellKnownValue = WellKnownSidType.BuiltinRemoteDesktopUsersSid, \
IsAbsolute = true, Sid = "S-1-5-32-555", Name = null, SddlForm = "RD"}, + new \
WellKnownAccount { WellKnownValue = \
WellKnownSidType.BuiltinNetworkConfigurationOperatorsSid, IsAbsolute = true, Sid = \
"S-1-5-32-556", Name = null, SddlForm = "NO"}, + new WellKnownAccount { \
WellKnownValue = WellKnownSidType.AccountAdministratorSid, IsAbsolute = false, Rid = \
"500", SddlForm = "LA"}, + new WellKnownAccount { WellKnownValue = \
WellKnownSidType.AccountGuestSid, IsAbsolute = false, Rid = "501", SddlForm = "LG"}, \
+ new WellKnownAccount { WellKnownValue = WellKnownSidType.AccountKrbtgtSid, \
IsAbsolute = false, Rid = "502"}, + new WellKnownAccount { WellKnownValue = \
WellKnownSidType.AccountDomainAdminsSid, IsAbsolute = false, Rid = "512", SddlForm = \
"DA"}, + new WellKnownAccount { WellKnownValue = \
WellKnownSidType.AccountDomainUsersSid, IsAbsolute = false, Rid = "513", SddlForm = \
"DU"}, + new WellKnownAccount { WellKnownValue = \
WellKnownSidType.AccountDomainGuestsSid, IsAbsolute = false, Rid = "514", SddlForm = \
"DG"}, + new WellKnownAccount { WellKnownValue = \
WellKnownSidType.AccountComputersSid, IsAbsolute = false, Rid = "515", SddlForm = \
"DC"}, + new WellKnownAccount { WellKnownValue = \
WellKnownSidType.AccountControllersSid, IsAbsolute = false, Rid = "516", SddlForm = \
"DD"}, + new WellKnownAccount { WellKnownValue = \
WellKnownSidType.AccountCertAdminsSid, IsAbsolute = false, Rid = "517", SddlForm = \
"CA"}, + new WellKnownAccount { WellKnownValue = \
WellKnownSidType.AccountSchemaAdminsSid, IsAbsolute = false, Rid = "518", SddlForm = \
"SA"}, + new WellKnownAccount { WellKnownValue = \
WellKnownSidType.AccountEnterpriseAdminsSid, IsAbsolute = false, Rid = "519", \
SddlForm = "EA"}, + new WellKnownAccount { WellKnownValue = \
WellKnownSidType.AccountPolicyAdminsSid, IsAbsolute = false, Rid = "520", SddlForm = \
"PA"}, + new WellKnownAccount { WellKnownValue = \
WellKnownSidType.AccountRasAndIasServersSid, IsAbsolute = false, Rid = "553", \
SddlForm = "RS"}, + new WellKnownAccount { WellKnownValue = \
WellKnownSidType.NtlmAuthenticationSid, IsAbsolute = true, Sid = "S-1-5-64-10", Name \
= @"NT AUTHORITY\NTLM Authentication"}, + new WellKnownAccount { WellKnownValue = \
WellKnownSidType.DigestAuthenticationSid, IsAbsolute = true, Sid = "S-1-5-64-21", \
Name = @"NT AUTHORITY\Digest Authentication"}, + new WellKnownAccount { \
WellKnownValue = WellKnownSidType.SChannelAuthenticationSid, IsAbsolute = true, Sid = \
"S-1-5-64-14", Name = @"NT AUTHORITY\SChannel Authentication"}, + new \
WellKnownAccount { WellKnownValue = WellKnownSidType.ThisOrganizationSid, IsAbsolute \
= true, Sid = "S-1-5-15", Name = @"NT AUTHORITY\This Organization"}, + new \
WellKnownAccount { WellKnownValue = WellKnownSidType.OtherOrganizationSid, IsAbsolute \
= true, Sid = "S-1-5-1000", Name = @"NT AUTHORITY\Other Organization"}, + new \
WellKnownAccount { WellKnownValue = \
WellKnownSidType.BuiltinIncomingForestTrustBuildersSid, IsAbsolute = true, Sid = \
"S-1-5-32-557", Name = null}, + new WellKnownAccount { WellKnownValue = \
WellKnownSidType.BuiltinPerformanceMonitoringUsersSid, IsAbsolute = true, Sid = \
"S-1-5-32-558", Name = @"BUILTIN\Performance Monitor Users", SddlForm = "MU"}, \
+ new WellKnownAccount { WellKnownValue = \
WellKnownSidType.BuiltinPerformanceLoggingUsersSid, IsAbsolute = true, Sid = \
"S-1-5-32-559", Name = @"BUILTIN\Performance Log Users"}, + new WellKnownAccount { \
WellKnownValue = WellKnownSidType.BuiltinAuthorizationAccessSid, IsAbsolute = true, \
Sid = "S-1-5-32-560", Name = null}, + new WellKnownAccount { WellKnownValue = \
WellKnownSidType.WinBuiltinTerminalServerLicenseServersSid, IsAbsolute = true, Sid = \
"S-1-5-32-561", Name = null}, + new WellKnownAccount { WellKnownValue = \
(WellKnownSidType)66, IsAbsolute = false, Rid = "4096", SddlForm = "LW"}, + new \
WellKnownAccount { WellKnownValue = (WellKnownSidType)67, IsAbsolute = false, Rid = \
"8192", SddlForm = "ME"}, + new WellKnownAccount { WellKnownValue = \
(WellKnownSidType)68, IsAbsolute = false, Rid = "12288", SddlForm = "HI"}, + new \
WellKnownAccount { WellKnownValue = (WellKnownSidType)69, IsAbsolute = false, Rid = \
"16384", SddlForm = "SI"}, + new WellKnownAccount { WellKnownValue = \
(WellKnownSidType)74, IsAbsolute = false, Rid = "521", SddlForm = "RO"}, + new \
WellKnownAccount { WellKnownValue = (WellKnownSidType)78, IsAbsolute = false, Rid = \
"574", SddlForm = "CD"}, + };
+ }
+}
+
Added: mcs/class/corlib/Test/System.Security.Principal/NTAccountTest.cs
===================================================================
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.Principal/NTAccountTest.cs
@@ -0,0 +1,50 @@
+//
+// NTAccountTest.cs - NUnit Test Cases for NTAccount
+//
+// Author:
+// Kenneth Bell
+//
+
+using System;
+using System.Security.Principal;
+using System.Text;
+using NUnit.Framework;
+
+namespace MonoTests.System.Security.Principal
+{
+ [TestFixture]
+ public class NTAccountTest : Assert
+ {
+ [Test]
+ public void ConstructorOneString()
+ {
+ Assert.AreEqual(@"Everyone", new NTAccount("Everyone").Value);
+ Assert.AreEqual(@"EVERYONE", new NTAccount("EVERYONE").Value);
+ Assert.AreEqual(@"DoMaIn\uSeR", new NTAccount(@"DoMaIn\uSeR").Value);
+ }
+
+ [Test]
+ public void ConstructorTwoString()
+ {
+ Assert.AreEqual(@"DoMaIn\uSeR", new NTAccount("DoMaIn", "uSeR").Value);
+ Assert.AreEqual(@"uSeR", new NTAccount(null, "uSeR").Value);
+ }
+
+ [Test]
+ public void Translate()
+ {
+ NTAccount acct = new NTAccount("Everyone");
+ SecurityIdentifier sid = \
(SecurityIdentifier)acct.Translate(typeof(SecurityIdentifier)); + \
Assert.AreEqual("S-1-1-0", sid.Value); + }
+
+ [Test]
+ [ExpectedException(typeof(IdentityNotMappedException))]
+ public void TranslateUnknown()
+ {
+ NTAccount acct = new NTAccount(@"UnknownDomain\UnknownUser");
+ acct.Translate(typeof(SecurityIdentifier));
+ }
+ }
+}
+
Added: mcs/class/corlib/Test/System.Security.Principal/SecurityIdentifierTest.cs
===================================================================
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.Principal/SecurityIdentifierTest.cs
@@ -0,0 +1,307 @@
+???//
+// SecurityIdentifierTest.cs - NUnit Test Cases for SecurityIdentifier
+//
+// Author:
+// Kenneth Bell
+//
+
+using System;
+using System.Security.Principal;
+using System.Text;
+using NUnit.Framework;
+
+namespace MonoTests.System.Security.Principal {
+ [TestFixture]
+ public class SecurityIdentifierTest : Assert {
+ [Test]
+ [ExpectedException(typeof(ArgumentNullException))]
+ public void ConstructorNull ()
+ {
+ new SecurityIdentifier (null);
+ }
+
+ private void CheckStringCtor (string strValue, byte[] expectedBinary)
+ {
+ SecurityIdentifier sid = new SecurityIdentifier (strValue);
+ byte[] buffer = new byte[sid.BinaryLength];
+ sid.GetBinaryForm (buffer, 0);
+
+ Assert.AreEqual (expectedBinary.Length, buffer.Length, "SID length mismatch");
+ Assert.AreEqual (expectedBinary, buffer, "SIDs different in binary form");
+ }
+
+ private void CheckUnqualifiedWellKnownSid (WellKnownSidType type, string sddl)
+ {
+ SecurityIdentifier sid = new SecurityIdentifier (type, null);
+ Assert.AreEqual (sddl, sid.Value, "Bad SID for type: " + type);
+ }
+
+ private void CheckQualifiedWellKnownSid (WellKnownSidType type, SecurityIdentifier \
domain, string sddl) + {
+ SecurityIdentifier sid = new SecurityIdentifier (type, domain);
+ Assert.AreEqual (sddl, sid.Value, "Bad SID for type: " + type);
+ }
+
+ private void CheckWellKnownSidLookup (WellKnownSidType wellKnownSidType, string \
name) + {
+ Assert.AreEqual (name, ((NTAccount)new SecurityIdentifier (wellKnownSidType, \
null).Translate (typeof(NTAccount))).Value); + }
+
+ [Test]
+ public void ConstructorString ()
+ {
+ CheckStringCtor ("S-1-0-0",
+ new byte[] {
+ 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00 });
+ CheckStringCtor ("S-1-5-33",
+ new byte[] {
+ 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x21, 0x00,
+ 0x00, 0x00 });
+ CheckStringCtor ("s-1-5-334-234",
+ new byte[] {
+ 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x4E, 0x01,
+ 0x00, 0x00, 0xEA, 0x00, 0x00, 0x00 });
+ CheckStringCtor ("S-1-5-0x3432",
+ new byte[] {
+ 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x32, 0x34,
+ 0x00, 0x00 });
+ CheckStringCtor ("S-1-0xCBA987654321-0",
+ new byte[] {
+ 0x01, 0x01, 0xCB, 0xA9, 0x87, 0x65, 0x43, 0x21, 0x00, 0x00,
+ 0x00, 0x00 });
+ }
+
+ [Test]
+ public void ConstructorStringSddl ()
+ {
+ Assert.AreEqual ("S-1-5-32-545",
+ new SecurityIdentifier ("BU").Value);
+ }
+
+ [Test]
+ [ExpectedException(typeof(ArgumentException))]
+ public void ConstructorStringBadRevision ()
+ {
+ CheckStringCtor ("S-2-0-0",
+ new byte[] {
+ 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00 });
+ }
+
+ [Test]
+ [ExpectedException(typeof(ArgumentException))]
+ public void ConstructorInvalidString ()
+ {
+ new SecurityIdentifier ("M");
+ }
+
+ [Test]
+ public void ConstructorBinary ()
+ {
+ byte[] inForm = new byte[] {
+ 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x4E, 0x01,
+ 0x00, 0x00, 0xEA, 0x00, 0x00, 0x00 };
+ SecurityIdentifier sid = new SecurityIdentifier (inForm, 0);
+
+ byte[] outForm = new byte[inForm.Length];
+ sid.GetBinaryForm (outForm, 0);
+ Assert.AreEqual (inForm, outForm);
+ }
+
+ [Test]
+ public void ConstructorWellKnownSids ()
+ {
+ CheckUnqualifiedWellKnownSid (WellKnownSidType.NullSid, "S-1-0-0");
+ CheckUnqualifiedWellKnownSid (WellKnownSidType.WorldSid, "S-1-1-0");
+ CheckUnqualifiedWellKnownSid (WellKnownSidType.LocalSid, "S-1-2-0");
+ CheckUnqualifiedWellKnownSid (WellKnownSidType.CreatorOwnerSid, "S-1-3-0");
+ CheckUnqualifiedWellKnownSid (WellKnownSidType.CreatorGroupSid, "S-1-3-1");
+ CheckUnqualifiedWellKnownSid (WellKnownSidType.CreatorOwnerServerSid, "S-1-3-2");
+ CheckUnqualifiedWellKnownSid (WellKnownSidType.CreatorGroupServerSid, "S-1-3-3");
+ CheckUnqualifiedWellKnownSid (WellKnownSidType.NTAuthoritySid, "S-1-5");
+ CheckUnqualifiedWellKnownSid (WellKnownSidType.DialupSid, "S-1-5-1");
+ CheckUnqualifiedWellKnownSid (WellKnownSidType.NetworkSid, "S-1-5-2");
+ CheckUnqualifiedWellKnownSid (WellKnownSidType.BatchSid, "S-1-5-3");
+ CheckUnqualifiedWellKnownSid (WellKnownSidType.InteractiveSid, "S-1-5-4");
+ CheckUnqualifiedWellKnownSid (WellKnownSidType.ServiceSid, "S-1-5-6");
+ CheckUnqualifiedWellKnownSid (WellKnownSidType.AnonymousSid, "S-1-5-7");
+ CheckUnqualifiedWellKnownSid (WellKnownSidType.ProxySid, "S-1-5-8");
+ CheckUnqualifiedWellKnownSid (WellKnownSidType.EnterpriseControllersSid, \
"S-1-5-9"); + CheckUnqualifiedWellKnownSid (WellKnownSidType.SelfSid, "S-1-5-10");
+ CheckUnqualifiedWellKnownSid (WellKnownSidType.AuthenticatedUserSid, "S-1-5-11");
+ CheckUnqualifiedWellKnownSid (WellKnownSidType.RestrictedCodeSid, "S-1-5-12");
+ CheckUnqualifiedWellKnownSid (WellKnownSidType.TerminalServerSid, "S-1-5-13");
+ CheckUnqualifiedWellKnownSid (WellKnownSidType.RemoteLogonIdSid, "S-1-5-14");
+ CheckUnqualifiedWellKnownSid (WellKnownSidType.LocalSystemSid, "S-1-5-18");
+ CheckUnqualifiedWellKnownSid (WellKnownSidType.LocalServiceSid, "S-1-5-19");
+ CheckUnqualifiedWellKnownSid (WellKnownSidType.NetworkServiceSid, "S-1-5-20");
+ CheckUnqualifiedWellKnownSid (WellKnownSidType.BuiltinDomainSid, "S-1-5-32");
+ CheckUnqualifiedWellKnownSid (WellKnownSidType.BuiltinAdministratorsSid, \
"S-1-5-32-544"); + CheckUnqualifiedWellKnownSid (WellKnownSidType.BuiltinUsersSid, \
"S-1-5-32-545"); + CheckUnqualifiedWellKnownSid (WellKnownSidType.BuiltinGuestsSid, \
"S-1-5-32-546"); + CheckUnqualifiedWellKnownSid \
(WellKnownSidType.BuiltinPowerUsersSid, "S-1-5-32-547"); \
+ CheckUnqualifiedWellKnownSid (WellKnownSidType.BuiltinAccountOperatorsSid, \
"S-1-5-32-548"); + CheckUnqualifiedWellKnownSid \
(WellKnownSidType.BuiltinSystemOperatorsSid, "S-1-5-32-549"); \
+ CheckUnqualifiedWellKnownSid (WellKnownSidType.BuiltinPrintOperatorsSid, \
"S-1-5-32-550"); + CheckUnqualifiedWellKnownSid \
(WellKnownSidType.BuiltinBackupOperatorsSid, "S-1-5-32-551"); \
+ CheckUnqualifiedWellKnownSid (WellKnownSidType.BuiltinReplicatorSid, \
"S-1-5-32-552"); + CheckUnqualifiedWellKnownSid \
(WellKnownSidType.BuiltinPreWindows2000CompatibleAccessSid, "S-1-5-32-554"); \
+ CheckUnqualifiedWellKnownSid (WellKnownSidType.BuiltinRemoteDesktopUsersSid, \
"S-1-5-32-555"); + CheckUnqualifiedWellKnownSid \
(WellKnownSidType.BuiltinNetworkConfigurationOperatorsSid, "S-1-5-32-556"); \
+ CheckQualifiedWellKnownSid (WellKnownSidType.AccountAdministratorSid, new \
SecurityIdentifier ("S-1-5-21-125-3215-342"), "S-1-5-21-125-3215-342-500"); \
+ CheckQualifiedWellKnownSid (WellKnownSidType.AccountGuestSid, new \
SecurityIdentifier ("S-1-5-21-125-3215-342"), "S-1-5-21-125-3215-342-501"); \
+ CheckQualifiedWellKnownSid (WellKnownSidType.AccountKrbtgtSid, new \
SecurityIdentifier ("S-1-5-21-125-3215-342"), "S-1-5-21-125-3215-342-502"); \
+ CheckQualifiedWellKnownSid (WellKnownSidType.AccountDomainAdminsSid, new \
SecurityIdentifier ("S-1-5-21-125-3215-342"), "S-1-5-21-125-3215-342-512"); \
+ CheckQualifiedWellKnownSid (WellKnownSidType.AccountDomainUsersSid, new \
SecurityIdentifier ("S-1-5-21-125-3215-342"), "S-1-5-21-125-3215-342-513"); \
+ CheckQualifiedWellKnownSid (WellKnownSidType.AccountDomainGuestsSid, new \
SecurityIdentifier ("S-1-5-21-125-3215-342"), "S-1-5-21-125-3215-342-514"); \
+ CheckQualifiedWellKnownSid (WellKnownSidType.AccountComputersSid, new \
SecurityIdentifier ("S-1-5-21-125-3215-342"), "S-1-5-21-125-3215-342-515"); \
+ CheckQualifiedWellKnownSid (WellKnownSidType.AccountControllersSid, new \
SecurityIdentifier ("S-1-5-21-125-3215-342"), "S-1-5-21-125-3215-342-516"); \
+ CheckQualifiedWellKnownSid (WellKnownSidType.AccountCertAdminsSid, new \
SecurityIdentifier ("S-1-5-21-125-3215-342"), "S-1-5-21-125-3215-342-517"); \
+ CheckQualifiedWellKnownSid (WellKnownSidType.AccountSchemaAdminsSid, new \
SecurityIdentifier ("S-1-5-21-125-3215-342"), "S-1-5-21-125-3215-342-518"); \
+ CheckQualifiedWellKnownSid (WellKnownSidType.AccountEnterpriseAdminsSid, new \
SecurityIdentifier ("S-1-5-21-125-3215-342"), "S-1-5-21-125-3215-342-519"); \
+ CheckQualifiedWellKnownSid (WellKnownSidType.AccountPolicyAdminsSid, new \
SecurityIdentifier ("S-1-5-21-125-3215-342"), "S-1-5-21-125-3215-342-520"); \
+ CheckQualifiedWellKnownSid (WellKnownSidType.AccountRasAndIasServersSid, new \
SecurityIdentifier ("S-1-5-21-125-3215-342"), "S-1-5-21-125-3215-342-553"); \
+ CheckUnqualifiedWellKnownSid (WellKnownSidType.NtlmAuthenticationSid, \
"S-1-5-64-10"); + CheckUnqualifiedWellKnownSid \
(WellKnownSidType.DigestAuthenticationSid, "S-1-5-64-21"); \
+ CheckUnqualifiedWellKnownSid (WellKnownSidType.SChannelAuthenticationSid, \
"S-1-5-64-14"); + CheckUnqualifiedWellKnownSid \
(WellKnownSidType.ThisOrganizationSid, "S-1-5-15"); + CheckUnqualifiedWellKnownSid \
(WellKnownSidType.OtherOrganizationSid, "S-1-5-1000"); \
+ CheckUnqualifiedWellKnownSid \
(WellKnownSidType.BuiltinIncomingForestTrustBuildersSid, "S-1-5-32-557"); \
+ CheckUnqualifiedWellKnownSid \
(WellKnownSidType.BuiltinPerformanceMonitoringUsersSid, "S-1-5-32-558"); \
+ CheckUnqualifiedWellKnownSid (WellKnownSidType.BuiltinPerformanceLoggingUsersSid, \
"S-1-5-32-559"); + CheckUnqualifiedWellKnownSid \
(WellKnownSidType.BuiltinAuthorizationAccessSid, "S-1-5-32-560"); \
+ CheckUnqualifiedWellKnownSid \
(WellKnownSidType.WinBuiltinTerminalServerLicenseServersSid, "S-1-5-32-561"); \
+ CheckUnqualifiedWellKnownSid (WellKnownSidType.MaxDefined, "S-1-5-32-561"); + }
+
+ [Test]
+ [ExpectedException(typeof(ArgumentException))]
+ public void ConstructorWellKnownSidLogonIds ()
+ {
+ CheckQualifiedWellKnownSid (WellKnownSidType.LogonIdsSid,
+ new SecurityIdentifier ("S-1-5-21-125-3215-342"),
+ "S-1-5-21-125-3215-342-3");
+ }
+
+ [Test]
+ public void AccountDomainSid ()
+ {
+ Assert.AreEqual ("S-1-5-21-125-3215-342", new SecurityIdentifier \
("S-1-5-21-125-3215-342-324-1000").AccountDomainSid.Value); + Assert.AreEqual \
("S-1-5-21-125-3215-342", new SecurityIdentifier \
("S-1-5-21-125-3215-342-1000").AccountDomainSid.Value); + Assert.AreEqual \
("S-1-5-21-125-3215-1", new SecurityIdentifier \
("S-1-5-21-125-3215-1").AccountDomainSid.Value); + Assert.IsNull (new \
SecurityIdentifier ("S-1-5-21-125-1").AccountDomainSid); + Assert.IsNull (new \
SecurityIdentifier ("S-1-0-0").AccountDomainSid); + Assert.IsNull (new \
SecurityIdentifier ("S-1-5-44-125-3215-1").AccountDomainSid); + }
+
+ [Test]
+ public void BinaryLength ()
+ {
+ Assert.AreEqual (12, new SecurityIdentifier ("S-1-0-0").BinaryLength);
+ }
+
+ [Test]
+ public void Value ()
+ {
+ Assert.AreEqual ("S-1-5-13362", new SecurityIdentifier ("s-1-5-0x3432").Value);
+ }
+
+ [Test]
+ public void Equals ()
+ {
+ Assert.IsTrue (new SecurityIdentifier ("S-1-5-13362").Equals (new \
SecurityIdentifier ("s-1-5-0x3432"))); + }
+
+ [Test]
+ public void IsAccountSid ()
+ {
+ Assert.IsTrue (new SecurityIdentifier \
("S-1-5-21-125-3215-342-324-1000").IsAccountSid ()); + Assert.IsTrue (new \
SecurityIdentifier ("S-1-5-21-125-3215-342-1000").IsAccountSid ()); + Assert.IsTrue \
(new SecurityIdentifier ("S-1-5-21-125-3215-1").IsAccountSid ()); + Assert.IsFalse \
(new SecurityIdentifier ("S-1-5-21-125-1").IsAccountSid ()); + Assert.IsFalse (new \
SecurityIdentifier ("S-1-0-0").IsAccountSid ()); + }
+
+ [Test]
+ public void IsEqualDomainSid ()
+ {
+ Assert.IsTrue (new SecurityIdentifier \
("S-1-5-21-125-3215-342-1000").IsEqualDomainSid (new SecurityIdentifier \
("S-1-5-21-125-3215-342-333"))); + Assert.IsTrue (new SecurityIdentifier \
("S-1-5-21-125-3215-342-1000").IsEqualDomainSid (new SecurityIdentifier \
("S-1-5-21-125-3215-342-324-333"))); + Assert.IsFalse (new SecurityIdentifier \
("S-1-5-21-125-1").IsEqualDomainSid (new SecurityIdentifier ("S-1-5-21-125-2"))); \
+ Assert.IsFalse (new SecurityIdentifier ("S-1-0-0").IsEqualDomainSid (new \
SecurityIdentifier ("S-1-0-0"))); + }
+
+ [Test]
+ public void IsValidTargetType ()
+ {
+ Assert.IsTrue (new SecurityIdentifier ("S-1-0-0").IsValidTargetType \
(typeof(SecurityIdentifier))); + Assert.IsTrue (new SecurityIdentifier \
("S-1-0-0").IsValidTargetType (typeof(NTAccount))); + Assert.IsFalse (new \
SecurityIdentifier ("S-1-0-0").IsValidTargetType (typeof(WindowsPrincipal))); \
+ Assert.IsFalse (new SecurityIdentifier ("S-1-0-0").IsValidTargetType \
(typeof(WindowsIdentity))); + }
+
+ [Test]
+ public void IsWellKnown ()
+ {
+ Assert.IsTrue (new SecurityIdentifier ("S-1-0-0").IsWellKnown \
(WellKnownSidType.NullSid)); + Assert.IsTrue (new SecurityIdentifier \
("S-1-5-21-125-3215-342-500").IsWellKnown \
(WellKnownSidType.AccountAdministratorSid)); + Assert.IsTrue (new \
SecurityIdentifier ("S-1-5-21-125-3215-342-513").IsWellKnown \
(WellKnownSidType.AccountDomainUsersSid)); + Assert.IsFalse (new SecurityIdentifier \
("S-1-6-21-125-3215-342-513").IsWellKnown (WellKnownSidType.AccountDomainUsersSid)); \
+ Assert.IsFalse (new SecurityIdentifier ("S-1-5-22-125-3215-342-513").IsWellKnown \
(WellKnownSidType.AccountDomainUsersSid)); + }
+
+ [Test]
+ public void Translate ()
+ {
+ CheckWellKnownSidLookup (WellKnownSidType.NullSid, @"NULL SID");
+ CheckWellKnownSidLookup (WellKnownSidType.WorldSid, @"Everyone");
+ CheckWellKnownSidLookup (WellKnownSidType.LocalSid, @"LOCAL");
+ CheckWellKnownSidLookup (WellKnownSidType.CreatorOwnerSid, @"CREATOR OWNER");
+ CheckWellKnownSidLookup (WellKnownSidType.CreatorGroupSid, @"CREATOR GROUP");
+ CheckWellKnownSidLookup (WellKnownSidType.CreatorOwnerServerSid, @"CREATOR OWNER \
SERVER"); + CheckWellKnownSidLookup (WellKnownSidType.CreatorGroupServerSid, \
@"CREATOR GROUP SERVER"); + CheckWellKnownSidLookup (WellKnownSidType.DialupSid, \
@"NT AUTHORITY\DIALUP"); + CheckWellKnownSidLookup (WellKnownSidType.NetworkSid, \
@"NT AUTHORITY\NETWORK"); + CheckWellKnownSidLookup (WellKnownSidType.BatchSid, \
@"NT AUTHORITY\BATCH"); + CheckWellKnownSidLookup (WellKnownSidType.InteractiveSid, \
@"NT AUTHORITY\INTERACTIVE"); + CheckWellKnownSidLookup \
(WellKnownSidType.ServiceSid, @"NT AUTHORITY\SERVICE"); + CheckWellKnownSidLookup \
(WellKnownSidType.AnonymousSid, @"NT AUTHORITY\ANONYMOUS LOGON"); \
+ CheckWellKnownSidLookup (WellKnownSidType.ProxySid, @"NT AUTHORITY\PROXY"); \
+ CheckWellKnownSidLookup (WellKnownSidType.EnterpriseControllersSid, @"NT \
AUTHORITY\ENTERPRISE DOMAIN CONTROLLERS"); + CheckWellKnownSidLookup \
(WellKnownSidType.SelfSid, @"NT AUTHORITY\SELF"); + CheckWellKnownSidLookup \
(WellKnownSidType.AuthenticatedUserSid, @"NT AUTHORITY\Authenticated Users"); \
+ CheckWellKnownSidLookup (WellKnownSidType.RestrictedCodeSid, @"NT \
AUTHORITY\RESTRICTED"); + CheckWellKnownSidLookup \
(WellKnownSidType.TerminalServerSid, @"NT AUTHORITY\TERMINAL SERVER USER"); \
+ CheckWellKnownSidLookup (WellKnownSidType.RemoteLogonIdSid, @"NT AUTHORITY\REMOTE \
INTERACTIVE LOGON"); + CheckWellKnownSidLookup (WellKnownSidType.LocalSystemSid, \
@"NT AUTHORITY\SYSTEM"); + CheckWellKnownSidLookup \
(WellKnownSidType.LocalServiceSid, @"NT AUTHORITY\LOCAL SERVICE"); \
+ CheckWellKnownSidLookup (WellKnownSidType.NetworkServiceSid, @"NT \
AUTHORITY\NETWORK SERVICE"); + CheckWellKnownSidLookup \
(WellKnownSidType.BuiltinAdministratorsSid, @"BUILTIN\Administrators"); \
+ CheckWellKnownSidLookup (WellKnownSidType.BuiltinUsersSid, @"BUILTIN\Users"); \
+ CheckWellKnownSidLookup (WellKnownSidType.BuiltinGuestsSid, @"BUILTIN\Guests"); \
+ CheckWellKnownSidLookup (WellKnownSidType.NtlmAuthenticationSid, @"NT \
AUTHORITY\NTLM Authentication"); + CheckWellKnownSidLookup \
(WellKnownSidType.DigestAuthenticationSid, @"NT AUTHORITY\Digest Authentication"); \
+ CheckWellKnownSidLookup (WellKnownSidType.SChannelAuthenticationSid, @"NT \
AUTHORITY\SChannel Authentication"); + CheckWellKnownSidLookup \
(WellKnownSidType.ThisOrganizationSid, @"NT AUTHORITY\This Organization"); \
+ CheckWellKnownSidLookup (WellKnownSidType.OtherOrganizationSid, @"NT \
AUTHORITY\Other Organization"); + CheckWellKnownSidLookup \
(WellKnownSidType.BuiltinPerformanceMonitoringUsersSid, @"BUILTIN\Performance Monitor \
Users"); + CheckWellKnownSidLookup \
(WellKnownSidType.BuiltinPerformanceLoggingUsersSid, @"BUILTIN\Performance Log \
Users"); + }
+
+ [Test]
+ [ExpectedException(typeof(IdentityNotMappedException))]
+ public void TranslateUnknown ()
+ {
+ new SecurityIdentifier ("S-1-5-21-125-3215-342-513").Translate \
(typeof(NTAccount)); + }
+
+ [Test]
+ public void LengthLimits ()
+ {
+ Assert.AreEqual (8, SecurityIdentifier.MinBinaryLength);
+ Assert.AreEqual (68, SecurityIdentifier.MaxBinaryLength);
+ }
+ }
+}
+
Commit: c0a4dd98cf9361472b96fcf0c506d34f53369f4e
Author: Kenneth Bell <ken.git@chezbell.org.uk>
Committer: Miguel de Icaza <miguel@gnome.org>
Date: 01/26/2011 17:58:57
URL: https://github.com/mono/mono/commit/c0a4dd98cf9361472b96fcf0c506d34f53369f4e
Implement RawSecurityDescriptor.
* Marshals to/from SDDL and binary form.
* Supports 'Common' ACEs and 'Object' ACEs
Changed paths:
M mcs/class/corlib/System.Security.AccessControl/CommonAce.cs
M mcs/class/corlib/System.Security.AccessControl/CommonAcl.cs
M mcs/class/corlib/System.Security.AccessControl/CompoundAce.cs
M mcs/class/corlib/System.Security.AccessControl/CustomAce.cs
M mcs/class/corlib/System.Security.AccessControl/GenericAce.cs
M mcs/class/corlib/System.Security.AccessControl/GenericAcl.cs
M mcs/class/corlib/System.Security.AccessControl/GenericSecurityDescriptor.cs
M mcs/class/corlib/System.Security.AccessControl/KnownAce.cs
M mcs/class/corlib/System.Security.AccessControl/ObjectAce.cs
M mcs/class/corlib/System.Security.AccessControl/QualifiedAce.cs
M mcs/class/corlib/System.Security.AccessControl/RawAcl.cs
M mcs/class/corlib/System.Security.AccessControl/RawSecurityDescriptor.cs
M mcs/class/corlib/System.Security.AccessControl/SystemAcl.cs
M mcs/class/corlib/corlib.dll.sources
M mcs/class/corlib/corlib_test.dll.sources
Added paths:
A mcs/class/corlib/System.Security.AccessControl/SddlAccessRight.cs
A mcs/class/corlib/Test/System.Security.AccessControl/CommonAceTest.cs
A mcs/class/corlib/Test/System.Security.AccessControl/RawAclTest.cs
A mcs/class/corlib/Test/System.Security.AccessControl/RawSecurityDescriptorTest.cs
Modified: mcs/class/corlib/System.Security.AccessControl/CommonAce.cs
===================================================================
--- a/mcs/class/corlib/System.Security.AccessControl/CommonAce.cs
+++ b/mcs/class/corlib/System.Security.AccessControl/CommonAce.cs
@@ -4,6 +4,7 @@
// Authors:
// Dick Porter <dick@ximian.com>
// Atsushi Enomoto <atsushi@ximian.com>
+// Kenneth Bell
//
// Copyright (C) 2006-2007 Novell, Inc (http://www.novell.com)
//
@@ -27,40 +28,129 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+using System.Globalization;
using System.Security.Principal;
namespace System.Security.AccessControl {
- public sealed class CommonAce : QualifiedAce
- {
+ public sealed class CommonAce : QualifiedAce {
public CommonAce (AceFlags flags, AceQualifier qualifier,
- int accessMask, SecurityIdentifier sid,
- bool isCallback, byte[] opaque)
- : base (InheritanceFlags.None, PropagationFlags.None, qualifier, isCallback, \
opaque) + int accessMask, SecurityIdentifier sid,
+ bool isCallback, byte[] opaque)
+ : base(ConvertType (qualifier, isCallback),
+ flags,
+ opaque)
{
AccessMask = accessMask;
SecurityIdentifier = sid;
}
-
- [MonoTODO]
- public override int BinaryLength
+
+ internal CommonAce (AceType type, AceFlags flags, int accessMask,
+ SecurityIdentifier sid, byte[] opaque)
+ : base(type, flags, opaque)
{
+ AccessMask = accessMask;
+ SecurityIdentifier = sid;
+ }
+
+ internal CommonAce(byte[] binaryForm, int offset)
+ : base(binaryForm, offset)
+ {
+ int len = ReadUShort(binaryForm, offset + 2);
+ if (offset > binaryForm.Length - len)
+ throw new ArgumentException("Invalid ACE - truncated", "binaryForm");
+ if (len < 8 + SecurityIdentifier.MinBinaryLength)
+ throw new ArgumentException("Invalid ACE", "binaryForm");
+
+ AccessMask = ReadInt(binaryForm, offset + 4);
+ SecurityIdentifier = new SecurityIdentifier(binaryForm,
+ offset + 8);
+
+ int opaqueLen = len - (8 + SecurityIdentifier.BinaryLength);
+ if (opaqueLen > 0) {
+ byte[] opaque = new byte[opaqueLen];
+ Array.Copy(binaryForm,
+ offset + 8 + SecurityIdentifier.BinaryLength,
+ opaque, 0, opaqueLen);
+ }
+ }
+
+ public override int BinaryLength {
get {
- throw new NotImplementedException ();
+ return 8 + SecurityIdentifier.BinaryLength
+ + OpaqueLength;
}
}
- [MonoTODO]
public override void GetBinaryForm (byte[] binaryForm,
- int offset)
+ int offset)
{
- throw new NotImplementedException ();
+ int len = BinaryLength;
+ binaryForm[offset] = (byte)this.AceType;
+ binaryForm[offset + 1] = (byte)this.AceFlags;
+ WriteUShort ((ushort)len, binaryForm, offset + 2);
+ WriteInt (AccessMask, binaryForm, offset + 4);
+
+ SecurityIdentifier.GetBinaryForm (binaryForm,
+ offset + 8);
+
+ byte[] opaque = GetOpaque ();
+ if (opaque != null)
+ Array.Copy (opaque, 0, binaryForm,
+ offset + 8 + SecurityIdentifier.BinaryLength,
+ opaque.Length);
}
-
- [MonoTODO]
+
public static int MaxOpaqueLength (bool isCallback)
{
- throw new NotImplementedException ();
+ // Varies by platform?
+ return 65459;
+ }
+
+ internal override string GetSddlForm ()
+ {
+ if (OpaqueLength != 0)
+ throw new NotImplementedException (
+ "Unable to convert conditional ACEs to SDDL");
+
+ return string.Format (CultureInfo.InvariantCulture,
+ "({0};{1};{2};;;{3})",
+ GetSddlAceType (AceType),
+ GetSddlAceFlags (AceFlags),
+ GetSddlAccessRights (AccessMask),
+ SecurityIdentifier.GetSddlForm ());
+ }
+
+ private static AceType ConvertType (AceQualifier qualifier,
+ bool isCallback)
+ {
+ switch (qualifier) {
+ case AceQualifier.AccessAllowed:
+ if (isCallback)
+ return AceType.AccessAllowedCallback;
+ else
+ return AceType.AccessAllowed;
+
+ case AceQualifier.AccessDenied:
+ if (isCallback)
+ return AceType.AccessDeniedCallback;
+ else
+ return AceType.AccessDenied;
+
+ case AceQualifier.SystemAlarm:
+ if (isCallback)
+ return AceType.SystemAlarmCallback;
+ else
+ return AceType.SystemAlarm;
+
+ case AceQualifier.SystemAudit:
+ if (isCallback)
+ return AceType.SystemAuditCallback;
+ else
+ return AceType.SystemAudit;
+
+ default:
+ throw new ArgumentException ("Unrecognized ACE qualifier: " + qualifier, \
"qualifier"); + }
}
}
}
-
Modified: mcs/class/corlib/System.Security.AccessControl/CommonAcl.cs
===================================================================
--- a/mcs/class/corlib/System.Security.AccessControl/CommonAcl.cs
+++ b/mcs/class/corlib/System.Security.AccessControl/CommonAcl.cs
@@ -111,6 +111,11 @@ namespace System.Security.AccessControl {
{
throw new NotImplementedException ();
}
+
+ internal override string GetSddlForm(ControlFlags sdFlags, bool isDacl)
+ {
+ throw new NotImplementedException();
+ }
}
}
Modified: mcs/class/corlib/System.Security.AccessControl/CompoundAce.cs
===================================================================
--- a/mcs/class/corlib/System.Security.AccessControl/CompoundAce.cs
+++ b/mcs/class/corlib/System.Security.AccessControl/CompoundAce.cs
@@ -33,13 +33,12 @@ namespace System.Security.AccessControl
{
public sealed class CompoundAce : KnownAce
{
- CompoundAceType compound_ace_type;
+ private CompoundAceType compound_ace_type;
public CompoundAce (AceFlags flags, int accessMask, CompoundAceType \
compoundAceType, SecurityIdentifier sid)
- : base (InheritanceFlags.None, PropagationFlags.None)
+ : base (AceType.AccessAllowedCompound, flags)
{
this.compound_ace_type = compoundAceType;
- this.AceFlags = flags;
this.AccessMask = accessMask;
this.SecurityIdentifier = sid;
}
@@ -62,6 +61,11 @@ namespace System.Security.AccessControl
{
throw new NotImplementedException ();
}
+
+ internal override string GetSddlForm ()
+ {
+ throw new NotImplementedException();
+ }
}
}
Modified: mcs/class/corlib/System.Security.AccessControl/CustomAce.cs
===================================================================
--- a/mcs/class/corlib/System.Security.AccessControl/CustomAce.cs
+++ b/mcs/class/corlib/System.Security.AccessControl/CustomAce.cs
@@ -29,53 +29,56 @@
using System.Collections;
-namespace System.Security.AccessControl
-{
- public sealed class CustomAce : GenericAce
- {
- public CustomAce (AceType type, AceFlags flags, byte [] opaque)
- : base (type)
- {
- AceFlags = flags;
+namespace System.Security.AccessControl {
+ public sealed class CustomAce : GenericAce {
+ private byte[] opaque;
+ public CustomAce (AceType type, AceFlags flags, byte[] opaque)
+ : base(type, flags)
+ {
/* FIXME: check length of opaque >
* MaxOpaqueLength or !multiple of 4
- */
- SetOpaque (opaque);
+ */
+ SetOpaque (opaque);
}
- byte [] opaque;
-
[MonoTODO]
public static readonly int MaxOpaqueLength;
-
+
[MonoTODO]
public override int BinaryLength {
- get { throw new NotImplementedException (); }
+ get {
+ throw new NotImplementedException ();
+ }
}
-
+
public int OpaqueLength {
get { return opaque.Length; }
}
[MonoTODO]
public override void GetBinaryForm (byte[] binaryForm,
- int offset)
+ int offset)
{
throw new NotImplementedException ();
}
-
- public byte [] GetOpaque ()
+
+ public byte[] GetOpaque ()
{
- return (byte []) opaque.Clone ();
+ return (byte[])opaque.Clone ();
}
-
- public void SetOpaque (byte [] opaque)
+
+ public void SetOpaque (byte[] opaque)
{
if (opaque == null)
- throw new ArgumentNullException ("opaque");
- this.opaque = (byte []) opaque.Clone ();
+ this.opaque = null;
+ else
+ this.opaque = (byte[])opaque.Clone ();
}
- }
-}
+ internal override string GetSddlForm ()
+ {
+ throw new NotSupportedException ();
+ }
+ }
+}
\ No newline at end of file
Modified: mcs/class/corlib/System.Security.AccessControl/GenericAce.cs
===================================================================
--- a/mcs/class/corlib/System.Security.AccessControl/GenericAce.cs
+++ b/mcs/class/corlib/System.Security.AccessControl/GenericAce.cs
@@ -4,6 +4,7 @@
// Authors:
// Dick Porter <dick@ximian.com>
// Atsushi Enomoto <atsushi@ximian.com>
+// Kenneth Bell
//
// Copyright (C) 2006-2007 Novell, Inc (http://www.novell.com)
//
@@ -27,33 +28,41 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-using System.Collections;
+using System.Globalization;
+using System.Security.Principal;
+using System.Text;
namespace System.Security.AccessControl {
public abstract class GenericAce
{
- internal GenericAce (InheritanceFlags inheritanceFlags, PropagationFlags \
propagationFlags)
- {
- inheritance = inheritanceFlags;
- propagation = propagationFlags;
- }
-
- internal GenericAce (AceType type)
+ private AceFlags ace_flags;
+ private AceType ace_type;
+
+ internal GenericAce (AceType type, AceFlags flags)
{
- if (type <= AceType.MaxDefinedAceType) {
+ if (type > AceType.MaxDefinedAceType) {
throw new ArgumentOutOfRangeException ("type");
}
+
this.ace_type = type;
+ this.ace_flags = flags;
}
-
- InheritanceFlags inheritance;
- PropagationFlags propagation;
- AceFlags aceflags;
- AceType ace_type;
-
+
+ internal GenericAce(byte[] binaryForm, int offset)
+ {
+ if (binaryForm == null)
+ throw new ArgumentNullException("binaryForm");
+
+ if (offset < 0 || offset > binaryForm.Length - 2)
+ throw new ArgumentOutOfRangeException("offset", offset, "Offset out of range");
+
+ ace_type = (AceType)binaryForm[offset];
+ ace_flags = (AceFlags)binaryForm[offset + 1];
+ }
+
public AceFlags AceFlags {
- get { return aceflags; }
- set { aceflags = value; }
+ get { return ace_flags; }
+ set { ace_flags = value; }
}
public AceType AceType {
@@ -63,9 +72,9 @@ namespace System.Security.AccessControl {
public AuditFlags AuditFlags {
get {
AuditFlags ret = AuditFlags.None;
- if ((aceflags & AceFlags.SuccessfulAccess) != 0)
+ if ((ace_flags & AceFlags.SuccessfulAccess) != 0)
ret |= AuditFlags.Success;
- if ((aceflags & AceFlags.FailedAccess) != 0)
+ if ((ace_flags & AceFlags.FailedAccess) != 0)
ret |= AuditFlags.Failure;
return ret;
}
@@ -74,57 +83,378 @@ namespace System.Security.AccessControl {
public abstract int BinaryLength { get; }
public InheritanceFlags InheritanceFlags {
- get { return inheritance; }
+ get {
+ InheritanceFlags ret = InheritanceFlags.None;
+ if ((ace_flags & AceFlags.ObjectInherit) != 0)
+ ret |= InheritanceFlags.ObjectInherit;
+ if ((ace_flags & AceFlags.ContainerInherit) != 0)
+ ret |= InheritanceFlags.ContainerInherit;
+ return ret;
+ }
}
- [MonoTODO]
public bool IsInherited {
- get { return(false); }
+ get { return (ace_flags & AceFlags.Inherited) != AceFlags.None; }
}
public PropagationFlags PropagationFlags {
- get { return propagation; }
+ get {
+ PropagationFlags ret = PropagationFlags.None;
+ if ((ace_flags & AceFlags.InheritOnly) != 0)
+ ret |= PropagationFlags.InheritOnly;
+ if ((ace_flags & AceFlags.NoPropagateInherit) != 0)
+ ret |= PropagationFlags.NoPropagateInherit;
+ return ret;
+ }
}
- [MonoTODO]
public GenericAce Copy ()
{
- throw new NotImplementedException ();
+ byte[] buffer = new byte[BinaryLength];
+ GetBinaryForm(buffer, 0);
+ return GenericAce.CreateFromBinaryForm(buffer, 0);
}
- [MonoTODO]
public static GenericAce CreateFromBinaryForm (byte[] binaryForm, int offset)
{
- throw new NotImplementedException ();
+ if (binaryForm == null)
+ throw new ArgumentNullException("binaryForm");
+
+ if (offset < 0 || offset > binaryForm.Length - 1)
+ throw new ArgumentOutOfRangeException("offset", offset, "Offset out of range");
+
+ AceType type = (AceType)binaryForm[offset];
+ if (IsObjectType(type))
+ return new ObjectAce(binaryForm, offset);
+ else
+ return new CommonAce(binaryForm, offset);
}
- [MonoTODO]
public override sealed bool Equals (object o)
{
- throw new NotImplementedException ();
+ return this == (o as GenericAce);
}
- [MonoTODO]
public abstract void GetBinaryForm (byte[] binaryForm, int offset);
- [MonoTODO]
public override sealed int GetHashCode ()
{
- throw new NotImplementedException ();
+ byte[] buffer = new byte[BinaryLength];
+ GetBinaryForm(buffer, 0);
+
+ int code = 0;
+ for(int i = 0; i < buffer.Length; ++i)
+ {
+ code = (code << 3) | ((code >> 29) & 0x7);
+ code ^= ((int)buffer[i]) & 0xff;
+ }
+
+ return code;
+ }
+
+ public static bool operator== (GenericAce left, GenericAce right)
+ {
+ if(((object)left) == null)
+ return((object)right) == null;
+
+ if(((object)right) == null)
+ return false;
+
+ int leftLen = left.BinaryLength;
+ int rightLen = right.BinaryLength;
+ if( leftLen != rightLen)
+ return false;
+
+ byte[] leftBuffer = new byte[leftLen];
+ byte[] rightBuffer = new byte[rightLen];
+ left.GetBinaryForm(leftBuffer, 0);
+ right.GetBinaryForm(rightBuffer, 0);
+
+ for(int i = 0; i < leftLen; ++i) {
+ if(leftBuffer[i] != rightBuffer[i])
+ return false;
+ }
+
+ return true;
+ }
+
+ public static bool operator!= (GenericAce left, GenericAce right)
+ {
+ if(((object)left) == null)
+ return((object)right) != null;
+
+ if(((object)right) == null)
+ return true;
+
+ int leftLen = left.BinaryLength;
+ int rightLen = right.BinaryLength;
+ if( leftLen != rightLen)
+ return true;
+
+ byte[] leftBuffer = new byte[leftLen];
+ byte[] rightBuffer = new byte[rightLen];
+ left.GetBinaryForm(leftBuffer, 0);
+ right.GetBinaryForm(rightBuffer, 0);
+
+ for(int i = 0; i < leftLen; ++i) {
+ if(leftBuffer[i] != rightBuffer[i])
+ return true;
+ }
+
+ return false;
+ }
+
+ internal abstract string GetSddlForm();
+
+ static internal GenericAce CreateFromSddlForm (string sddlForm, ref int pos)
+ {
+ if (sddlForm[pos] != '(')
+ throw new ArgumentException ("Invalid SDDL string.", "sddlForm");
+
+ int endPos = sddlForm.IndexOf (')', pos);
+ if (endPos < 0)
+ throw new ArgumentException ("Invalid SDDL string.", "sddlForm");
+
+ int count = endPos - (pos + 1);
+ string elementsStr = sddlForm.Substring (pos + 1,
+ count);
+ elementsStr = elementsStr.ToUpperInvariant ();
+ string[] elements = elementsStr.Split (';');
+ if (elements.Length != 6)
+ throw new ArgumentException ("Invalid SDDL string.", "sddlForm");
+
+
+ ObjectAceFlags objFlags = ObjectAceFlags.None;
+
+ AceType type = ParseSddlAceType (elements[0]);
+
+ AceFlags flags = ParseSddlAceFlags (elements[1]);
+
+ int accessMask = ParseSddlAccessRights (elements[2]);
+
+ Guid objectType = Guid.Empty;
+ if (!string.IsNullOrEmpty (elements[3])) {
+ objectType = new Guid(elements[3]);
+ objFlags |= ObjectAceFlags.ObjectAceTypePresent;
+ }
+
+ Guid inhObjectType = Guid.Empty;
+ if (!string.IsNullOrEmpty (elements[4])) {
+ inhObjectType = new Guid(elements[4]);
+ objFlags |= ObjectAceFlags.InheritedObjectAceTypePresent;
+ }
+
+ SecurityIdentifier sid
+ = new SecurityIdentifier (elements[5]);
+
+ if (type == AceType.AccessAllowedCallback
+ || type == AceType.AccessDeniedCallback)
+ throw new NotImplementedException ("Conditional ACEs not supported");
+
+ pos = endPos + 1;
+
+ if (IsObjectType(type))
+ return new ObjectAce(type, flags, accessMask, sid, objFlags, objectType, \
inhObjectType, null); + else {
+ if (objFlags != ObjectAceFlags.None)
+ throw new ArgumentException( "Invalid SDDL string.", "sddlForm");
+ return new CommonAce (type, flags, accessMask, sid, null);
+ }
+ }
+
+ private static bool IsObjectType(AceType type)
+ {
+ return type == AceType.AccessAllowedCallbackObject
+ || type == AceType.AccessAllowedObject
+ || type == AceType.AccessDeniedCallbackObject
+ || type == AceType.AccessDeniedObject
+ || type == AceType.SystemAlarmCallbackObject
+ || type == AceType.SystemAlarmObject
+ || type == AceType.SystemAuditCallbackObject
+ || type == AceType.SystemAuditObject;
+ }
+
+ protected static string GetSddlAceType (AceType type)
+ {
+ switch (type) {
+ case AceType.AccessAllowed:
+ return "A";
+ case AceType.AccessDenied:
+ return "D";
+ case AceType.AccessAllowedObject:
+ return "OA";
+ case AceType.AccessDeniedObject:
+ return "OD";
+ case AceType.SystemAudit:
+ return "AU";
+ case AceType.SystemAlarm:
+ return "AL";
+ case AceType.SystemAuditObject:
+ return "OU";
+ case AceType.SystemAlarmObject:
+ return "OL";
+ case AceType.AccessAllowedCallback:
+ return "XA";
+ case AceType.AccessDeniedCallback:
+ return "XD";
+ default:
+ throw new ArgumentException ("Unable to convert to SDDL ACE type: " + type, \
"type"); + }
+ }
+
+ private static AceType ParseSddlAceType (string type)
+ {
+ switch (type) {
+ case "A":
+ return AceType.AccessAllowed;
+ case "D":
+ return AceType.AccessDenied;
+ case "OA":
+ return AceType.AccessAllowedObject;
+ case "OD":
+ return AceType.AccessDeniedObject;
+ case "AU":
+ return AceType.SystemAudit;
+ case "AL":
+ return AceType.SystemAlarm;
+ case "OU":
+ return AceType.SystemAuditObject;
+ case "OL":
+ return AceType.SystemAlarmObject;
+ case "XA":
+ return AceType.AccessAllowedCallback;
+ case "XD":
+ return AceType.AccessDeniedCallback;
+ default:
+ throw new ArgumentException ("Unable to convert SDDL to ACE type: " + type, \
"type"); + }
+ }
+
+ protected static string GetSddlAceFlags (AceFlags flags)
+ {
+ StringBuilder result = new StringBuilder ();
+ if ((flags & AceFlags.ObjectInherit) != 0)
+ result.Append ("OI");
+ if ((flags & AceFlags.ContainerInherit) != 0)
+ result.Append ("CI");
+ if ((flags & AceFlags.NoPropagateInherit) != 0)
+ result.Append ("NP");
+ if ((flags & AceFlags.InheritOnly) != 0)
+ result.Append ("IO");
+ if ((flags & AceFlags.Inherited) != 0)
+ result.Append ("ID");
+ if ((flags & AceFlags.SuccessfulAccess) != 0)
+ result.Append ("SA");
+ if ((flags & AceFlags.FailedAccess) != 0)
+ result.Append ("FA");
+ return result.ToString ();
+ }
+
+ private static AceFlags ParseSddlAceFlags (string flags)
+ {
+ AceFlags ret = AceFlags.None;
+
+ int pos = 0;
+ while (pos < flags.Length - 1) {
+ string flag = flags.Substring (pos, 2);
+ switch (flag) {
+ case "CI":
+ ret |= AceFlags.ContainerInherit;
+ break;
+ case "OI":
+ ret |= AceFlags.ObjectInherit;
+ break;
+ case "NP":
+ ret |= AceFlags.NoPropagateInherit;
+ break;
+ case "IO":
+ ret |= AceFlags.InheritOnly;
+ break;
+ case "ID":
+ ret |= AceFlags.Inherited;
+ break;
+ case "SA":
+ ret |= AceFlags.SuccessfulAccess;
+ break;
+ case "FA":
+ ret |= AceFlags.FailedAccess;
+ break;
+ default:
+ throw new ArgumentException ("Invalid SDDL string.", "flags");
+ }
+
+ pos += 2;
+ }
+
+ if (pos != flags.Length)
+ throw new ArgumentException ("Invalid SDDL string.", "flags");
+
+ return ret;
}
- [MonoTODO]
- public static bool operator== (GenericAce left,
- GenericAce right)
+ private static int ParseSddlAccessRights (string accessMask)
+ {
+ if (accessMask.StartsWith ("0X")) {
+ return int.Parse (accessMask.Substring (2),
+ NumberStyles.HexNumber,
+ CultureInfo.InvariantCulture);
+ } else if (Char.IsDigit (accessMask, 0)) {
+ return int.Parse (accessMask,
+ NumberStyles.Integer,
+ CultureInfo.InvariantCulture);
+ } else {
+ return ParseSddlAliasRights (accessMask);
+ }
+ }
+
+ private static int ParseSddlAliasRights(string accessMask)
+ {
+ int ret = 0;
+
+ int pos = 0;
+ while (pos < accessMask.Length - 1) {
+ string flag = accessMask.Substring (pos, 2);
+ SddlAccessRight right = SddlAccessRight.LookupByName(flag);
+ if (right == null)
+ throw new ArgumentException ("Invalid SDDL string.", "accessMask");
+
+ ret |= right.Value;
+ pos += 2;
+ }
+
+ if (pos != accessMask.Length)
+ throw new ArgumentException ("Invalid SDDL string.", "accessMask");
+
+ return ret;
+ }
+
+ internal static ushort ReadUShort (byte[] buffer, int offset)
+ {
+ return (ushort)((((int)buffer[offset + 0]) << 0)
+ | (((int)buffer[offset + 1]) << 8));
+ }
+
+ internal static int ReadInt (byte[] buffer, int offset)
+ {
+ return (((int)buffer[offset + 0]) << 0)
+ | (((int)buffer[offset + 1]) << 8)
+ | (((int)buffer[offset + 2]) << 16)
+ | (((int)buffer[offset + 3]) << 24);
+ }
+
+ internal static void WriteInt (int val, byte[] buffer, int offset)
{
- throw new NotImplementedException ();
+ buffer[offset] = (byte)val;
+ buffer[offset + 1] = (byte)(val >> 8);
+ buffer[offset + 2] = (byte)(val >> 16);
+ buffer[offset + 3] = (byte)(val >> 24);
}
- [MonoTODO]
- public static bool operator!= (GenericAce left,
- GenericAce right)
+ internal static void WriteUShort (ushort val, byte[] buffer,
+ int offset)
{
- throw new NotImplementedException ();
+ buffer[offset] = (byte)val;
+ buffer[offset + 1] = (byte)(val >> 8);
}
}
}
Modified: mcs/class/corlib/System.Security.AccessControl/GenericAcl.cs
===================================================================
--- a/mcs/class/corlib/System.Security.AccessControl/GenericAcl.cs
+++ b/mcs/class/corlib/System.Security.AccessControl/GenericAcl.cs
@@ -93,6 +93,9 @@ namespace System.Security.AccessControl {
{
return GetEnumerator ();
}
+
+ internal abstract string GetSddlForm(ControlFlags sdFlags,
+ bool isDacl);
}
}
Modified: mcs/class/corlib/System.Security.AccessControl/GenericSecurityDescriptor.cs
===================================================================
--- a/mcs/class/corlib/System.Security.AccessControl/GenericSecurityDescriptor.cs
+++ b/mcs/class/corlib/System.Security.AccessControl/GenericSecurityDescriptor.cs
@@ -3,6 +3,7 @@
//
// Author:
// Dick Porter <dick@ximian.com>
+// Kenneth Bell
//
// Copyright (C) 2006 Novell, Inc (http://www.novell.com)
//
@@ -26,68 +27,172 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+using System.Globalization;
using System.Security.Principal;
+using System.Text;
namespace System.Security.AccessControl {
- public abstract class GenericSecurityDescriptor
- {
-// bool isContainer;
-// bool isDS;
-// ControlFlags flags;
-// SecurityIdentifier owner;
-// SecurityIdentifier group;
-// SystemAcl systemAcl;
-// DiscretionaryAcl discretionaryAcl;
-
+ public abstract class GenericSecurityDescriptor {
+
protected GenericSecurityDescriptor ()
{
}
- public int BinaryLength
- {
+ public int BinaryLength {
get {
- throw new NotImplementedException ();
+ int len = 0x14;
+ if (Owner != null)
+ len += Owner.BinaryLength;
+ if (Group != null)
+ len += Group.BinaryLength;
+ if (DaclPresent)
+ len += InternalDacl.BinaryLength;
+ if (SaclPresent)
+ len += InternalSacl.BinaryLength;
+ return len;
}
}
-
- public abstract ControlFlags ControlFlags
- {
- get;
+
+ public abstract ControlFlags ControlFlags { get; }
+
+ public abstract SecurityIdentifier Group { get; set; }
+
+ public abstract SecurityIdentifier Owner { get; set; }
+
+ public static byte Revision {
+ get { return 1; }
}
-
- public abstract SecurityIdentifier Group
- {
- get;
- set;
+
+ internal virtual GenericAcl InternalDacl {
+ get { return null; }
}
-
- public abstract SecurityIdentifier Owner
+
+ internal virtual GenericAcl InternalSacl {
+ get { return null; }
+ }
+
+ internal virtual byte InternalReservedField {
+ get { return 0; }
+ }
+
+ public void GetBinaryForm (byte[] binaryForm, int offset)
{
- get;
- set;
+ ControlFlags controlFlags = ControlFlags;
+ binaryForm[offset + 0x00] = Revision;
+ binaryForm[offset + 0x01] = InternalReservedField;
+ WriteUShort ((ushort)controlFlags, binaryForm,
+ offset + 0x02);
+
+ // Skip 'offset' fields (will fill later)
+ int pos = 0x14;
+
+ if (Owner != null) {
+ WriteInt (pos, binaryForm, offset + 0x04);
+ Owner.GetBinaryForm (binaryForm, offset + pos);
+ pos += Owner.BinaryLength;
+ } else {
+ WriteInt (0, binaryForm, offset + 0x04);
+ }
+
+ if (Group != null) {
+ WriteInt (pos, binaryForm, offset + 0x08);
+ Group.GetBinaryForm (binaryForm, offset + pos);
+ pos += Group.BinaryLength;
+ } else {
+ WriteInt (0, binaryForm, offset + 0x08);
+ }
+
+ GenericAcl sysAcl = InternalSacl;
+ if (SaclPresent) {
+ WriteInt (pos, binaryForm, offset + 0x0C);
+ sysAcl.GetBinaryForm (binaryForm, offset + pos);
+ pos += InternalSacl.BinaryLength;
+ } else {
+ WriteInt (0, binaryForm, offset + 0x0C);
+ }
+
+ GenericAcl discAcl = InternalDacl;
+ if (DaclPresent) {
+ WriteInt (pos, binaryForm, offset + 0x10);
+ discAcl.GetBinaryForm (binaryForm, offset + pos);
+ pos += InternalDacl.BinaryLength;
+ } else {
+ WriteInt (0, binaryForm, offset + 0x10);
+ }
}
- public static byte Revision
+ public string GetSddlForm (AccessControlSections includeSections)
{
- get {
- throw new NotImplementedException ();
+ StringBuilder result = new StringBuilder ();
+
+ if ((includeSections & AccessControlSections.Owner) != 0
+ && Owner != null) {
+ result.AppendFormat (
+ CultureInfo.InvariantCulture,
+ "O:{0}", Owner.GetSddlForm ());
+ }
+
+ if ((includeSections & AccessControlSections.Group) != 0
+ && Group != null) {
+ result.AppendFormat (
+ CultureInfo.InvariantCulture,
+ "G:{0}", Group.GetSddlForm ());
}
+
+ if ((includeSections & AccessControlSections.Access) != 0
+ && InternalDacl != null) {
+ result.AppendFormat (
+ CultureInfo.InvariantCulture,
+ "D:{0}",
+ InternalDacl.GetSddlForm (ControlFlags,
+ true));
+ }
+
+ if ((includeSections & AccessControlSections.Audit) != 0
+ && InternalSacl != null) {
+ result.AppendFormat (
+ CultureInfo.InvariantCulture,
+ "S:{0}",
+ InternalSacl.GetSddlForm (ControlFlags,
+ false));
+ }
+
+ return result.ToString ();
}
- public void GetBinaryForm (byte[] binaryForm, int offset)
+ public static bool IsSddlConversionSupported ()
{
- throw new NotImplementedException ();
+ return true;
}
- public string GetSddlForm (AccessControlSections includeSections)
+ private bool DaclPresent {
+ get {
+ return InternalDacl != null
+ && (ControlFlags & ControlFlags.DiscretionaryAclPresent) != 0;
+ }
+ }
+
+ private bool SaclPresent {
+ get {
+ return InternalSacl != null
+ && (ControlFlags & ControlFlags.SystemAclPresent) != 0;
+ }
+ }
+
+ private void WriteUShort (ushort val, byte[] buffer, int offset)
{
- throw new NotImplementedException ();
+ buffer[offset] = (byte)val;
+ buffer[offset + 1] = (byte)(val >> 8);
}
- public static bool IsSddlConversionSupported ()
+ private void WriteInt (int val, byte[] buffer, int offset)
{
- throw new NotImplementedException ();
+ buffer[offset] = (byte)val;
+ buffer[offset + 1] = (byte)(val >> 8);
+ buffer[offset + 2] = (byte)(val >> 16);
+ buffer[offset + 3] = (byte)(val >> 24);
}
+
}
}
Modified: mcs/class/corlib/System.Security.AccessControl/KnownAce.cs
===================================================================
--- a/mcs/class/corlib/System.Security.AccessControl/KnownAce.cs
+++ b/mcs/class/corlib/System.Security.AccessControl/KnownAce.cs
@@ -4,6 +4,7 @@
// Authors:
// Dick Porter <dick@ximian.com>
// Atsushi Enomoto <atsushi@ximian.com>
+// Kenneth Bell
//
// Copyright (C) 2006-2007 Novell, Inc (http://www.novell.com)
//
@@ -27,17 +28,24 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+using System.Globalization;
using System.Security.Principal;
+using System.Text;
namespace System.Security.AccessControl
{
public abstract class KnownAce : GenericAce
{
- int access_mask;
- SecurityIdentifier identifier;
+ private int access_mask;
+ private SecurityIdentifier identifier;
- internal KnownAce (InheritanceFlags inheritanceFlags, PropagationFlags \
propagationFlags)
- : base (inheritanceFlags, propagationFlags)
+ internal KnownAce (AceType type, AceFlags flags)
+ : base (type, flags)
+ {
+ }
+
+ internal KnownAce (byte[] binaryForm, int offset)
+ : base (binaryForm, offset)
{
}
@@ -50,6 +58,30 @@ namespace System.Security.AccessControl
get { return identifier; }
set { identifier = value; }
}
+
+ internal static string GetSddlAccessRights (int accessMask)
+ {
+ string ret = GetSddlAliasRights(accessMask);
+ if (!string.IsNullOrEmpty(ret))
+ return ret;
+
+ return string.Format (CultureInfo.InvariantCulture,
+ "0x{0:x}", accessMask);
+ }
+
+ private static string GetSddlAliasRights(int accessMask)
+ {
+ SddlAccessRight[] rights = SddlAccessRight.Decompose(accessMask);
+ if (rights == null)
+ return null;
+
+ StringBuilder ret = new StringBuilder();
+ foreach (var right in rights) {
+ ret.Append(right.Name);
+ }
+
+ return ret.ToString();
+ }
}
}
Modified: mcs/class/corlib/System.Security.AccessControl/ObjectAce.cs
===================================================================
--- a/mcs/class/corlib/System.Security.AccessControl/ObjectAce.cs
+++ b/mcs/class/corlib/System.Security.AccessControl/ObjectAce.cs
@@ -4,6 +4,7 @@
// Authors:
// Dick Porter <dick@ximian.com>
// Atsushi Enomoto <atsushi@ximian.com>
+// Kenneth Bell
//
// Copyright (C) 2006-2007 Novell, Inc (http://www.novell.com)
//
@@ -28,33 +29,70 @@
//
using System.Security.Principal;
+using System.Globalization;
namespace System.Security.AccessControl
{
public sealed class ObjectAce : QualifiedAce
{
+ private Guid object_ace_type;
+ private Guid inherited_object_type;
+ private ObjectAceFlags object_ace_flags;
+
public ObjectAce (AceFlags aceFlags, AceQualifier qualifier,
int accessMask, SecurityIdentifier sid,
ObjectAceFlags flags, Guid type,
Guid inheritedType, bool isCallback,
byte[] opaque)
- : base (InheritanceFlags.None, PropagationFlags.None, qualifier, isCallback, \
opaque) + : base (ConvertType(qualifier, isCallback), aceFlags, opaque)
{
- AceFlags = aceFlags;
+ AccessMask = accessMask;
SecurityIdentifier = sid;
object_ace_flags = flags;
object_ace_type = type;
inherited_object_type = inheritedType;
}
- Guid object_ace_type, inherited_object_type;
- ObjectAceFlags object_ace_flags;
+ internal ObjectAce (AceType type, AceFlags flags, int accessMask,
+ SecurityIdentifier sid, ObjectAceFlags objFlags,
+ Guid objType, Guid inheritedType, byte[] opaque)
+ : base(type, flags, opaque)
+ {
+ AccessMask = accessMask;
+ SecurityIdentifier = sid;
+ object_ace_flags = objFlags;
+ object_ace_type = objType;
+ inherited_object_type = inheritedType;
+ }
+
+ internal ObjectAce(byte[] binaryForm, int offset)
+ : base(binaryForm, offset)
+ {
+ int len = ReadUShort(binaryForm, offset + 2);
+ if (offset > binaryForm.Length - len)
+ throw new ArgumentException("Invalid ACE - truncated", "binaryForm");
+ if (len < 44 + SecurityIdentifier.MinBinaryLength)
+ throw new ArgumentException("Invalid ACE", "binaryForm");
+
+ AccessMask = ReadInt(binaryForm, offset + 4);
+ object_ace_flags = (ObjectAceFlags)ReadInt(binaryForm, offset + 8);
+ object_ace_type = ReadGuid(binaryForm, offset + 12);
+ inherited_object_type = ReadGuid(binaryForm, offset + 28);
+ SecurityIdentifier = new SecurityIdentifier(binaryForm, offset + 44);
+
+ int opaqueLen = len - (44 + SecurityIdentifier.BinaryLength);
+ if (opaqueLen > 0) {
+ byte[] opaque = new byte[opaqueLen];
+ Array.Copy(binaryForm, offset + 44 + SecurityIdentifier.BinaryLength,
+ opaque, 0, opaqueLen);
+ }
+ }
- [MonoTODO]
public override int BinaryLength
{
get {
- throw new NotImplementedException ();
+ return 44 + SecurityIdentifier.BinaryLength
+ + OpaqueLength;
}
}
@@ -73,17 +111,103 @@ namespace System.Security.AccessControl
set { object_ace_type = value; }
}
- [MonoTODO]
public override void GetBinaryForm (byte[] binaryForm,
int offset)
{
- throw new NotImplementedException ();
+ int len = BinaryLength;
+ binaryForm[offset] = (byte)this.AceType;
+ binaryForm[offset + 1] = (byte)this.AceFlags;
+ WriteUShort ((ushort)len, binaryForm, offset + 2);
+ WriteInt (AccessMask, binaryForm, offset + 4);
+ WriteInt ((int)ObjectAceFlags, binaryForm, offset + 8);
+ WriteGuid (ObjectAceType, binaryForm, offset + 12);
+ WriteGuid (InheritedObjectAceType, binaryForm, offset + 28);
+
+ SecurityIdentifier.GetBinaryForm (binaryForm,
+ offset + 44);
+
+ byte[] opaque = GetOpaque ();
+ if (opaque != null)
+ Array.Copy (opaque, 0, binaryForm,
+ offset + 44 + SecurityIdentifier.BinaryLength,
+ opaque.Length);
}
- [MonoTODO]
public static int MaxOpaqueLength (bool isCallback)
{
- throw new NotImplementedException ();
+ // Varies by platform?
+ return 65423;
+ }
+
+ internal override string GetSddlForm()
+ {
+ if (OpaqueLength != 0)
+ throw new NotImplementedException (
+ "Unable to convert conditional ACEs to SDDL");
+
+ string objType = "";
+ if ((ObjectAceFlags & ObjectAceFlags.ObjectAceTypePresent) != 0)
+ objType = object_ace_type.ToString("D");
+
+ string inhObjType = "";
+ if ((ObjectAceFlags & ObjectAceFlags.InheritedObjectAceTypePresent) != 0)
+ inhObjType = inherited_object_type.ToString("D");
+
+ return string.Format (CultureInfo.InvariantCulture,
+ "({0};{1};{2};{3};{4};{5})",
+ GetSddlAceType (AceType),
+ GetSddlAceFlags (AceFlags),
+ GetSddlAccessRights (AccessMask),
+ objType,
+ inhObjType,
+ SecurityIdentifier.GetSddlForm ());
+ }
+
+ private static AceType ConvertType(AceQualifier qualifier, bool isCallback)
+ {
+ switch(qualifier)
+ {
+ case AceQualifier.AccessAllowed:
+ if (isCallback)
+ return AceType.AccessAllowedCallbackObject;
+ else
+ return AceType.AccessAllowedObject;
+
+ case AceQualifier.AccessDenied:
+ if (isCallback)
+ return AceType.AccessDeniedCallbackObject;
+ else
+ return AceType.AccessDeniedObject;
+
+ case AceQualifier.SystemAlarm:
+ if (isCallback)
+ return AceType.SystemAlarmCallbackObject;
+ else
+ return AceType.SystemAlarmObject;
+
+ case AceQualifier.SystemAudit:
+ if (isCallback)
+ return AceType.SystemAuditCallbackObject;
+ else
+ return AceType.SystemAuditObject;
+
+ default:
+ throw new ArgumentException("Unrecognized ACE qualifier: " + qualifier, \
"qualifier"); + }
+ }
+
+ private void WriteGuid (Guid val, byte[] buffer,
+ int offset)
+ {
+ byte[] guidData = val.ToByteArray();
+ Array.Copy(guidData, 0, buffer, offset, 16);
+ }
+
+ private Guid ReadGuid(byte[] buffer, int offset)
+ {
+ byte[] temp = new byte[16];
+ Array.Copy(buffer, offset, temp, 0, 16);
+ return new Guid(temp);
}
}
}
Modified: mcs/class/corlib/System.Security.AccessControl/QualifiedAce.cs
===================================================================
--- a/mcs/class/corlib/System.Security.AccessControl/QualifiedAce.cs
+++ b/mcs/class/corlib/System.Security.AccessControl/QualifiedAce.cs
@@ -4,6 +4,7 @@
// Authors:
// Dick Porter <dick@ximian.com>
// Atsushi Enomoto <atsushi@ximian.com>
+// Kenneth Bell
//
// Copyright (C) 2006-2007 Novell, Inc (http://www.novell.com)
//
@@ -30,40 +31,89 @@
namespace System.Security.AccessControl {
public abstract class QualifiedAce : KnownAce
{
- internal QualifiedAce (InheritanceFlags inheritanceFlags, PropagationFlags \
propagationFlags, AceQualifier aceQualifier, bool isCallback, byte [] \
opaque)
- : base (inheritanceFlags, propagationFlags)
+ private byte [] opaque;
+
+ internal QualifiedAce (AceType type, AceFlags flags,
+ byte[] opaque)
+ : base (type, flags)
{
- ace_qualifier = aceQualifier;
- is_callback = isCallback;
SetOpaque (opaque);
}
-
- AceQualifier ace_qualifier;
- bool is_callback;
- byte [] opaque;
+
+ internal QualifiedAce (byte[] binaryForm, int offset)
+ : base(binaryForm, offset)
+ {
+ }
public AceQualifier AceQualifier {
- get { return ace_qualifier; }
+ get {
+ switch(AceType)
+ {
+ case AceType.AccessAllowed:
+ case AceType.AccessAllowedCallback:
+ case AceType.AccessAllowedCallbackObject:
+ case AceType.AccessAllowedCompound:
+ case AceType.AccessAllowedObject:
+ return AceQualifier.AccessAllowed;
+
+ case AceType.AccessDenied:
+ case AceType.AccessDeniedCallback:
+ case AceType.AccessDeniedCallbackObject:
+ case AceType.AccessDeniedObject:
+ return AceQualifier.AccessDenied;
+
+ case AceType.SystemAlarm:
+ case AceType.SystemAlarmCallback:
+ case AceType.SystemAlarmCallbackObject:
+ case AceType.SystemAlarmObject:
+ return AceQualifier.SystemAlarm;
+
+ case AceType.SystemAudit:
+ case AceType.SystemAuditCallback:
+ case AceType.SystemAuditCallbackObject:
+ case AceType.SystemAuditObject:
+ return AceQualifier.SystemAudit;
+
+ default:
+ throw new ArgumentException("Unrecognised ACE type: " + AceType);
+ }
+ }
}
public bool IsCallback {
- get { return is_callback; }
+ get {
+ return AceType == AceType.AccessAllowedCallback
+ || AceType == AceType.AccessAllowedCallbackObject
+ || AceType == AceType.AccessDeniedCallback
+ || AceType == AceType.AccessDeniedCallbackObject
+ || AceType == AceType.SystemAlarmCallback
+ || AceType == AceType.SystemAlarmCallbackObject
+ || AceType == AceType.SystemAuditCallback
+ || AceType == AceType.SystemAuditCallbackObject;
+ }
}
public int OpaqueLength {
- get { return opaque.Length; }
+ get {
+ if (opaque == null)
+ return 0;
+ return opaque.Length;
+ }
}
public byte[] GetOpaque ()
{
- return (byte []) opaque.Clone ();
+ if (opaque == null)
+ return null;
+ return (byte []) opaque.Clone();
}
public void SetOpaque (byte[] opaque)
{
if (opaque == null)
- throw new ArgumentNullException ("opaque");
- this.opaque = (byte []) opaque.Clone ();
+ this.opaque = null;
+ else
+ this.opaque = (byte []) opaque.Clone();
}
}
}
Modified: mcs/class/corlib/System.Security.AccessControl/RawAcl.cs
===================================================================
--- a/mcs/class/corlib/System.Security.AccessControl/RawAcl.cs
+++ b/mcs/class/corlib/System.Security.AccessControl/RawAcl.cs
@@ -4,6 +4,7 @@
// Authors:
// Dick Porter <dick@ximian.com>
// Atsushi Enomoto <atsushi@ximian.com>
+// Kenneth Bell
//
// Copyright (C) 2006-2007 Novell, Inc (http://www.novell.com)
//
@@ -28,10 +29,14 @@
//
using System.Collections.Generic;
+using System.Text;
namespace System.Security.AccessControl {
public sealed class RawAcl : GenericAcl
{
+ private byte revision;
+ private List<GenericAce> list;
+
public RawAcl (byte revision, int capacity)
{
this.revision = revision;
@@ -39,18 +44,46 @@ namespace System.Security.AccessControl {
}
public RawAcl (byte [] binaryForm, int offset)
- : this (0, 10)
{
+ if (binaryForm == null)
+ throw new ArgumentNullException("binaryForm");
+
+ if (offset < 0 || offset > binaryForm.Length - 8)
+ throw new ArgumentOutOfRangeException("offset", offset, "Offset out of range");
+
+ revision = binaryForm[offset];
+ if (revision != AclRevision && revision != AclRevisionDS)
+ throw new ArgumentException("Invalid ACL - unknown revision", "binaryForm");
+
+ int binaryLength = ReadUShort(binaryForm, offset + 2);
+ if (offset > binaryForm.Length - binaryLength)
+ throw new ArgumentException("Invalid ACL - truncated", "binaryForm");
+
+ int pos = offset + 8;
+ int numAces = ReadUShort(binaryForm, offset + 4);
+ list = new List<GenericAce>(numAces);
+ for (int i = 0; i < numAces; ++i) {
+ GenericAce newAce = GenericAce.CreateFromBinaryForm(binaryForm, pos);
+ list.Add(newAce);
+ pos += newAce.BinaryLength;
+ }
}
-
- byte revision;
- List<GenericAce> list;
-
- [MonoTODO]
+
+ internal RawAcl(byte revision, List<GenericAce> aces)
+ {
+ this.revision = revision;
+ this.list = aces;
+ }
+
public override int BinaryLength
{
get {
- throw new NotImplementedException ();
+ int len = 8;
+ foreach(var ace in list)
+ {
+ len += ace.BinaryLength;
+ }
+ return len;
}
}
@@ -68,11 +101,30 @@ namespace System.Security.AccessControl {
get { return revision; }
}
- [MonoTODO]
public override void GetBinaryForm (byte[] binaryForm,
- int offset)
+ int offset)
{
- throw new NotImplementedException ();
+ if(binaryForm == null)
+ throw new ArgumentNullException("binaryForm");
+
+ if(offset < 0
+ || offset > binaryForm.Length - BinaryLength)
+ throw new ArgumentException("Offset out of range", "offset");
+
+ binaryForm[offset] = Revision;
+ binaryForm[offset + 1] = 0;
+ WriteUShort((ushort)BinaryLength, binaryForm,
+ offset + 2);
+ WriteUShort((ushort)list.Count, binaryForm,
+ offset + 4);
+ WriteUShort(0, binaryForm, offset + 6);
+
+ int pos = offset + 8;
+ foreach(var ace in list)
+ {
+ ace.GetBinaryForm(binaryForm, pos);
+ pos += ace.BinaryLength;
+ }
}
public void InsertAce (int index, GenericAce ace)
@@ -86,6 +138,105 @@ namespace System.Security.AccessControl {
{
list.RemoveAt (index);
}
+
+ internal override string GetSddlForm(ControlFlags sdFlags,
+ bool isDacl)
+ {
+ StringBuilder result = new StringBuilder();
+
+ if(isDacl) {
+ if((sdFlags & ControlFlags.DiscretionaryAclProtected) != 0)
+ result.Append("P");
+ if((sdFlags & ControlFlags.DiscretionaryAclAutoInheritRequired) != 0)
+ result.Append("AR");
+ if((sdFlags & ControlFlags.DiscretionaryAclAutoInherited) != 0)
+ result.Append("AI");
+ } else {
+ if((sdFlags & ControlFlags.SystemAclProtected) != 0)
+ result.Append("P");
+ if((sdFlags & ControlFlags.SystemAclAutoInheritRequired) != 0)
+ result.Append("AR");
+ if((sdFlags & ControlFlags.SystemAclAutoInherited) != 0)
+ result.Append("AI");
+ }
+
+ foreach(var ace in list)
+ {
+ result.Append(ace.GetSddlForm());
+ }
+
+ return result.ToString();
+ }
+
+ internal static RawAcl ParseSddlForm(string sddlForm,
+ bool isDacl,
+ ref ControlFlags sdFlags,
+ ref int pos)
+ {
+ ParseFlags(sddlForm, isDacl, ref sdFlags, ref pos);
+
+ byte revision = GenericAcl.AclRevision;
+ List<GenericAce> aces = new List<GenericAce>();
+ while(pos < sddlForm.Length && sddlForm[pos] == '(') {
+ GenericAce ace = GenericAce.CreateFromSddlForm(
+ sddlForm, ref pos);
+ if ((ace as ObjectAce) != null)
+ revision = GenericAcl.AclRevisionDS;
+ aces.Add(ace);
+ }
+
+
+ return new RawAcl(revision, aces);
+ }
+
+ private static void ParseFlags(string sddlForm,
+ bool isDacl,
+ ref ControlFlags sdFlags,
+ ref int pos)
+ {
+ char ch = Char.ToUpperInvariant(sddlForm[pos]);
+ while(ch == 'P' || ch == 'A') {
+ if(ch == 'P') {
+ if (isDacl)
+ sdFlags |= ControlFlags.DiscretionaryAclProtected;
+ else
+ sdFlags |= ControlFlags.SystemAclProtected;
+ pos++;
+ } else if(sddlForm.Length > pos + 1) {
+ ch = Char.ToUpperInvariant(sddlForm[pos + 1]);
+ if(ch == 'R') {
+ if (isDacl)
+ sdFlags |= ControlFlags.DiscretionaryAclAutoInheritRequired;
+ else
+ sdFlags |= ControlFlags.SystemAclAutoInheritRequired;
+ pos += 2;
+ } else if (ch == 'I') {
+ if (isDacl)
+ sdFlags |= ControlFlags.DiscretionaryAclAutoInherited;
+ else
+ sdFlags |= ControlFlags.SystemAclAutoInherited;
+ pos += 2;
+ } else {
+ throw new ArgumentException("Invalid SDDL string.", "sddlForm");
+ }
+ } else {
+ throw new ArgumentException("Invalid SDDL string.", "sddlForm");
+ }
+ }
+
+ }
+
+ private void WriteUShort (ushort val, byte[] buffer, int offset)
+ {
+ buffer[offset] = (byte)val;
+ buffer[offset + 1] = (byte)(val >> 8);
+ }
+
+ private ushort ReadUShort (byte[] buffer, int offset)
+ {
+ return (ushort)((((int)buffer[offset + 0]) << 0)
+ | (((int)buffer[offset + 1]) << 8));
+ }
}
}
Modified: mcs/class/corlib/System.Security.AccessControl/RawSecurityDescriptor.cs
===================================================================
--- a/mcs/class/corlib/System.Security.AccessControl/RawSecurityDescriptor.cs
+++ b/mcs/class/corlib/System.Security.AccessControl/RawSecurityDescriptor.cs
@@ -3,6 +3,7 @@
//
// Author:
// Dick Porter <dick@ximian.com>
+// Kenneth Bell
//
// Copyright (C) 2006 Novell, Inc (http://www.novell.com)
//
@@ -30,84 +31,168 @@
using System.Security.Principal;
namespace System.Security.AccessControl {
- public sealed class RawSecurityDescriptor : GenericSecurityDescriptor
- {
+ public sealed class RawSecurityDescriptor : GenericSecurityDescriptor {
+ private ControlFlags control_flags;
+ private SecurityIdentifier owner_sid;
+ private SecurityIdentifier group_sid;
+ private RawAcl system_acl;
+ private RawAcl discretionary_acl;
+ private byte resourcemgr_control;
+
public RawSecurityDescriptor (string sddlForm)
{
+ if (sddlForm == null)
+ throw new ArgumentNullException ("sddlForm");
+
+ ParseSddl (sddlForm.Replace (" ", ""));
+
+ control_flags |= ControlFlags.SelfRelative;
}
public RawSecurityDescriptor (byte[] binaryForm, int offset)
{
+ if (binaryForm == null)
+ throw new ArgumentNullException("binaryForm");
+
+ if (offset < 0 || offset > binaryForm.Length - 0x14)
+ throw new ArgumentOutOfRangeException("offset", offset, "Offset out of range");
+
+ if (binaryForm[offset] != 1)
+ throw new ArgumentException("Unrecognized Security Descriptor revision.", \
"binaryForm"); +
+ resourcemgr_control = binaryForm[offset + 0x01];
+ control_flags = (ControlFlags)ReadUShort(binaryForm, offset + 0x02);
+
+ int ownerPos = ReadInt(binaryForm, offset + 0x04);
+ int groupPos = ReadInt(binaryForm, offset + 0x08);
+ int saclPos = ReadInt(binaryForm, offset + 0x0C);
+ int daclPos = ReadInt(binaryForm, offset + 0x10);
+
+ if (ownerPos != 0)
+ owner_sid = new SecurityIdentifier(binaryForm, ownerPos);
+
+ if (groupPos != 0)
+ group_sid = new SecurityIdentifier(binaryForm, groupPos);
+
+ if (saclPos != 0)
+ system_acl = new RawAcl(binaryForm, saclPos);
+
+ if (daclPos != 0)
+ discretionary_acl = new RawAcl(binaryForm, daclPos);
}
-
+
public RawSecurityDescriptor (ControlFlags flags,
- SecurityIdentifier owner,
- SecurityIdentifier group,
- RawAcl systemAcl,
- RawAcl discretionaryAcl)
+ SecurityIdentifier owner,
+ SecurityIdentifier @group,
+ RawAcl systemAcl,
+ RawAcl discretionaryAcl)
{
+ control_flags = flags;
+ owner_sid = owner;
+ group_sid = @group;
+ system_acl = systemAcl;
+ discretionary_acl = discretionaryAcl;
}
-
- public override ControlFlags ControlFlags
- {
- get {
- throw new NotImplementedException ();
- }
+
+ public override ControlFlags ControlFlags {
+ get { return control_flags; }
}
- public RawAcl DiscretionaryAcl
- {
- get {
- throw new NotImplementedException ();
- }
- set {
- throw new NotImplementedException ();
- }
+ public RawAcl DiscretionaryAcl {
+ get { return discretionary_acl; }
+ set { discretionary_acl = value; }
}
-
- public override SecurityIdentifier Group
- {
- get {
- throw new NotImplementedException ();
- }
- set {
- throw new NotImplementedException ();
- }
+
+ public override SecurityIdentifier Group {
+ get { return group_sid; }
+ set { group_sid = value; }
}
-
- public override SecurityIdentifier Owner
- {
- get {
- throw new NotImplementedException ();
- }
- set {
- throw new NotImplementedException ();
- }
+
+ public override SecurityIdentifier Owner {
+ get { return owner_sid; }
+ set { owner_sid = value; }
}
- public byte ResourceManagerControl
+ public byte ResourceManagerControl {
+ get { return resourcemgr_control; }
+ set { resourcemgr_control = value; }
+ }
+
+ public RawAcl SystemAcl {
+ get { return system_acl; }
+ set { system_acl = value; }
+ }
+
+ public void SetFlags (ControlFlags flags)
{
- get {
- throw new NotImplementedException ();
- }
- set {
- throw new NotImplementedException ();
- }
+ control_flags = flags | ControlFlags.SelfRelative;
}
- public RawAcl SystemAcl
+ internal override GenericAcl InternalDacl {
+ get { return this.DiscretionaryAcl; }
+ }
+
+ internal override GenericAcl InternalSacl {
+ get { return this.SystemAcl; }
+ }
+
+ internal override byte InternalReservedField {
+ get { return this.ResourceManagerControl; }
+ }
+
+ private void ParseSddl (string sddlForm)
{
- get {
- throw new NotImplementedException ();
+ ControlFlags flags = ControlFlags.None;
+
+ int pos = 0;
+ while (pos < sddlForm.Length - 2) {
+ switch (sddlForm.Substring (pos, 2)) {
+ case "O:":
+ pos += 2;
+ Owner = SecurityIdentifier.ParseSddlForm (sddlForm, ref pos);
+ break;
+
+ case "G:":
+ pos += 2;
+ Group = SecurityIdentifier.ParseSddlForm (sddlForm, ref pos);
+ break;
+
+ case "D:":
+ pos += 2;
+ DiscretionaryAcl = RawAcl.ParseSddlForm (sddlForm, true, ref flags, ref pos);
+ flags |= ControlFlags.DiscretionaryAclPresent;
+ break;
+
+ case "S:":
+ pos += 2;
+ SystemAcl = RawAcl.ParseSddlForm (sddlForm, false, ref flags, ref pos);
+ flags |= ControlFlags.SystemAclPresent;
+ break;
+ default:
+
+ throw new ArgumentException ("Invalid SDDL.", "sddlForm");
+ }
}
- set {
- throw new NotImplementedException ();
+
+ if (pos != sddlForm.Length) {
+ throw new ArgumentException ("Invalid SDDL.", "sddlForm");
}
+
+ SetFlags (flags);
}
-
- public void SetFlags (ControlFlags flags)
+
+ private ushort ReadUShort (byte[] buffer, int offset)
+ {
+ return (ushort)((((int)buffer[offset + 0]) << 0)
+ | (((int)buffer[offset + 1]) << 8));
+ }
+
+ private int ReadInt (byte[] buffer, int offset)
{
- throw new NotImplementedException ();
+ return (((int)buffer[offset + 0]) << 0)
+ | (((int)buffer[offset + 1]) << 8)
+ | (((int)buffer[offset + 2]) << 16)
+ | (((int)buffer[offset + 3]) << 24);
}
}
}
Modified: mcs/class/corlib/System.Security.AccessControl/SystemAcl.cs
===================================================================
--- a/mcs/class/corlib/System.Security.AccessControl/SystemAcl.cs
+++ b/mcs/class/corlib/System.Security.AccessControl/SystemAcl.cs
@@ -134,6 +134,11 @@ namespace System.Security.AccessControl {
{
throw new NotImplementedException ();
}
+
+ internal override string GetSddlForm(ControlFlags sdFlags, bool isDacl)
+ {
+ throw new NotImplementedException();
+ }
}
}
Modified: mcs/class/corlib/corlib.dll.sources
===================================================================
--- a/mcs/class/corlib/corlib.dll.sources
+++ b/mcs/class/corlib/corlib.dll.sources
@@ -1220,6 +1220,7 @@ System.Security.AccessControl/RegistryAuditRule.cs
System.Security.AccessControl/RegistryRights.cs
System.Security.AccessControl/RegistrySecurity.cs
System.Security.AccessControl/ResourceType.cs
+System.Security.AccessControl/SddlAccessRight.cs
System.Security.AccessControl/SecurityInfos.cs
System.Security.AccessControl/SystemAcl.cs
../System.Core/System.Security.Cryptography/Aes.cs
Modified: mcs/class/corlib/corlib_test.dll.sources
===================================================================
--- a/mcs/class/corlib/corlib_test.dll.sources
+++ b/mcs/class/corlib/corlib_test.dll.sources
@@ -198,6 +198,9 @@ System.Runtime.Versioning/TargetFrameworkAttributeTest.cs
System.Runtime.Versioning/VersioningHelperTest.cs
System/SByteTest.cs
System.Security/CodeAccessPermissionTest.cs
+System.Security.AccessControl/CommonAceTest.cs
+System.Security.AccessControl/RawAclTest.cs
+System.Security.AccessControl/RawSecurityDescriptorTest.cs
System.Security.Cryptography/AllTests2.cs
System.Security.Cryptography/AsymmetricAlgorithmTest.cs
System.Security.Cryptography/CipherModeTest.cs
Added: mcs/class/corlib/System.Security.AccessControl/SddlAccessRight.cs
===================================================================
--- /dev/null
+++ b/mcs/class/corlib/System.Security.AccessControl/SddlAccessRight.cs
@@ -0,0 +1,99 @@
+//
+// System.Security.AccessControl.SddlAccessRight.cs
+//
+// Author:
+// Kenneth Bell
+//
+
+using System.Collections.Generic;
+
+namespace System.Security.AccessControl
+{
+ internal class SddlAccessRight
+ {
+ public string Name { get; set; }
+ public int Value { get; set; }
+ public int ObjectType { get; set; }
+
+ public static SddlAccessRight LookupByName(string s)
+ {
+ foreach (var right in rights) {
+ if (right.Name == s)
+ return right;
+ }
+
+ return null;
+ }
+
+ public static SddlAccessRight[] Decompose(int mask)
+ {
+ foreach (var right in rights) {
+ if (mask == right.Value)
+ return new SddlAccessRight[] {right};
+ }
+
+ int foundType = 0;
+ List<SddlAccessRight> found = new List<SddlAccessRight>();
+ int accountedBits = 0;
+ foreach (var right in rights) {
+ if ((mask & right.Value) == right.Value
+ && (accountedBits | right.Value) != accountedBits) {
+
+ if (foundType == 0)
+ foundType = right.ObjectType;
+
+ if(right.ObjectType != 0
+ && foundType != right.ObjectType)
+ return null;
+
+ found.Add(right);
+ accountedBits |= right.Value;
+ }
+
+ if (accountedBits == mask)
+ {
+ return found.ToArray();
+ }
+ }
+
+ return null;
+ }
+
+ private static readonly SddlAccessRight[] rights = new SddlAccessRight[] {
+ new SddlAccessRight { Name = "CC", Value = 0x00000001, ObjectType = 1},
+ new SddlAccessRight { Name = "DC", Value = 0x00000002, ObjectType = 1},
+ new SddlAccessRight { Name = "LC", Value = 0x00000004, ObjectType = 1},
+ new SddlAccessRight { Name = "SW", Value = 0x00000008, ObjectType = 1},
+ new SddlAccessRight { Name = "RP", Value = 0x00000010, ObjectType = 1},
+ new SddlAccessRight { Name = "WP", Value = 0x00000020, ObjectType = 1},
+ new SddlAccessRight { Name = "DT", Value = 0x00000040, ObjectType = 1},
+ new SddlAccessRight { Name = "LO", Value = 0x00000080, ObjectType = 1},
+ new SddlAccessRight { Name = "CR", Value = 0x00000100, ObjectType = 1},
+
+ new SddlAccessRight { Name = "SD", Value = 0x00010000},
+ new SddlAccessRight { Name = "RC", Value = 0x00020000},
+ new SddlAccessRight { Name = "WD", Value = 0x00040000},
+ new SddlAccessRight { Name = "WO", Value = 0x00080000},
+
+ new SddlAccessRight { Name = "GA", Value = 0x10000000},
+ new SddlAccessRight { Name = "GX", Value = 0x20000000},
+ new SddlAccessRight { Name = "GW", Value = 0x40000000},
+ new SddlAccessRight { Name = "GR", Value = unchecked((int)0x80000000)},
+
+ new SddlAccessRight { Name = "FA", Value = 0x001F01FF, ObjectType = 2},
+ new SddlAccessRight { Name = "FR", Value = 0x00120089, ObjectType = 2},
+ new SddlAccessRight { Name = "FW", Value = 0x00120116, ObjectType = 2},
+ new SddlAccessRight { Name = "FX", Value = 0x001200A0, ObjectType = 2},
+
+ new SddlAccessRight { Name = "KA", Value = 0x000F003F, ObjectType = 3},
+ new SddlAccessRight { Name = "KR", Value = 0x00020019, ObjectType = 3},
+ new SddlAccessRight { Name = "KW", Value = 0x00020006, ObjectType = 3},
+ new SddlAccessRight { Name = "KX", Value = 0x00020019, ObjectType = 3},
+
+ new SddlAccessRight { Name = "NW", Value = 0x00000001},
+ new SddlAccessRight { Name = "NR", Value = 0x00000002},
+ new SddlAccessRight { Name = "NX", Value = 0x00000004},
+ };
+ }
+}
+
Added: mcs/class/corlib/Test/System.Security.AccessControl/CommonAceTest.cs
===================================================================
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.AccessControl/CommonAceTest.cs
@@ -0,0 +1,40 @@
+//
+// CommonAceTest.cs - NUnit Test Cases for CommonAce
+//
+// Author:
+// Kenneth Bell
+//
+
+using System.Security.AccessControl;
+using System.Security.Principal;
+using NUnit.Framework;
+
+namespace MonoTests.System.Security.AccessControl {
+ [TestFixture]
+ public class CommonAceTest {
+ [Test]
+ public void GetBinaryForm ()
+ {
+ SecurityIdentifier builtInAdmins = new SecurityIdentifier \
(WellKnownSidType.BuiltinAdministratorsSid, null); + CommonAce ace = new CommonAce \
(AceFlags.None, AceQualifier.AccessAllowed, 0x7FFFFFFF, builtInAdmins, false, null); \
+ + byte[] buffer = new byte[ace.BinaryLength];
+ ace.GetBinaryForm (buffer, 0);
+ byte[] aceBinary = new byte[] {
+ 0x00, 0x00, 0x18, 0x00, 0xFF, 0xFF, 0xFF, 0x7F, 0x01, 0x02,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x20, 0x00, 0x00, 0x00,
+ 0x20, 0x02, 0x00, 0x00 };
+ Assert.AreEqual (aceBinary, buffer);
+ }
+
+ [Test]
+ public void MaxOpaqueLength ()
+ {
+ Assert.AreEqual (65459, CommonAce.MaxOpaqueLength (true));
+ Assert.AreEqual (65459, CommonAce.MaxOpaqueLength (false));
+ Assert.AreEqual (65423, ObjectAce.MaxOpaqueLength (true));
+ Assert.AreEqual (65423, ObjectAce.MaxOpaqueLength (false));
+ }
+ }
+}
+
Added: mcs/class/corlib/Test/System.Security.AccessControl/RawAclTest.cs
===================================================================
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.AccessControl/RawAclTest.cs
@@ -0,0 +1,42 @@
+//
+// RawAclTest.cs - NUnit Test Cases for RawAclTest
+//
+// Author:
+// Kenneth Bell
+//
+
+using System.Security.AccessControl;
+using System.Security.Principal;
+using NUnit.Framework;
+
+namespace MonoTests.System.Security.AccessControl {
+
+ [TestFixture]
+ public class AclTest {
+
+ [Test]
+ public void GetBinaryForm ()
+ {
+ RawAcl acl = new RawAcl (1, 0);
+
+ byte[] buffer = new byte[acl.BinaryLength];
+ acl.GetBinaryForm (buffer, 0);
+ byte[] sdBinary = new byte[] { 0x01, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00 };
+ Assert.AreEqual (sdBinary, buffer);
+
+
+ SecurityIdentifier builtInAdmins = new SecurityIdentifier \
(WellKnownSidType.BuiltinAdministratorsSid, null); + CommonAce ace = new CommonAce \
(AceFlags.None, AceQualifier.AccessAllowed, 0x7FFFFFFF, builtInAdmins, false, null); \
+ acl.InsertAce (0, ace); + buffer = new byte[acl.BinaryLength];
+ acl.GetBinaryForm (buffer, 0);
+ sdBinary = new byte[] {
+ 0x01, 0x00, 0x20, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x18, 0x00, 0xFF, 0xFF, 0xFF, 0x7F, 0x01, 0x02, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x05, 0x20, 0x00, 0x00, 0x00, 0x20, 0x02,
+ 0x00, 0x00 };
+ Assert.AreEqual (sdBinary, buffer);
+ }
+ }
+}
+
Added: mcs/class/corlib/Test/System.Security.AccessControl/RawSecurityDescriptorTest.cs
===================================================================
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.AccessControl/RawSecurityDescriptorTest.cs
@@ -0,0 +1,287 @@
+//
+// RawSecurityDescriptorTest.cs - NUnit Test Cases for RawSecurityDescriptor
+//
+// Author:
+// Kenneth Bell
+//
+
+using System;
+using System.Security.AccessControl;
+using System.Security.Principal;
+using NUnit.Framework;
+
+namespace MonoTests.System.Security.AccessControl {
+
+ [TestFixture]
+ public class RawSecurityDescriptorTest {
+ private void CheckSddlConstructor (string sddl, byte[] expectedBinary)
+ {
+ RawSecurityDescriptor sd = new RawSecurityDescriptor (sddl);
+
+ Assert.GreaterOrEqual (sd.BinaryLength, 0);
+ byte[] buffer = new byte[sd.BinaryLength];
+
+ sd.GetBinaryForm (buffer, 0);
+ Assert.AreEqual (expectedBinary, buffer);
+ }
+
+ private void CheckBinaryConstructor (string expectedSddl, byte[] binary)
+ {
+ RawSecurityDescriptor sd = new RawSecurityDescriptor (binary, 0);
+
+ Assert.AreEqual (sd.BinaryLength, binary.Length);
+ Assert.AreEqual (expectedSddl, sd.GetSddlForm (AccessControlSections.All));
+ }
+
+ private void CheckRoundTrip (string sddl)
+ {
+ RawSecurityDescriptor sd = new RawSecurityDescriptor (sddl);
+
+ byte[] buffer = new byte[sd.BinaryLength];
+ sd.GetBinaryForm (buffer, 0);
+
+ sd = new RawSecurityDescriptor (buffer, 0);
+ Assert.AreEqual (sddl, sd.GetSddlForm (AccessControlSections.All));
+ }
+
+ [Test]
+ public void ConstructorEmptyString ()
+ {
+ byte[] sdBinary = new byte[] {
+ 0x01, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+ CheckSddlConstructor ("", sdBinary);
+ }
+
+ [Test]
+ public void ConstructorString ()
+ {
+ byte[] sdBinary = new byte[] {
+ 0x01, 0x00, 0x04, 0x80, 0x14, 0x00, 0x00, 0x00, 0x24, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00,
+ 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x20, 0x00,
+ 0x00, 0x00, 0x21, 0x02, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x05, 0x20, 0x00, 0x00, 0x00, 0x20, 0x02,
+ 0x00, 0x00, 0x02, 0x00, 0x1C, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x14, 0x00, 0x3F, 0x00, 0x0E, 0x10, 0x01, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+ CheckSddlConstructor ("O:BUG:BAD:(A;;RPWPCCDCLCSWRCWDWOGA;;;S-1-0-0)", sdBinary);
+ CheckSddlConstructor ("G:BAO:BUD:(A;;RPWPCCDCLCSWRCWDWOGA;;;S-1-0-0)", sdBinary);
+ CheckSddlConstructor ("G:BAD:(A; ;RPWPCCDCLCSWRCWDWOGA;;;S-1-0-0)O:BU", \
sdBinary); + CheckSddlConstructor ("O:buG:baD:(a;;rpwpccdclcswrcwdwoga;;;s-1-0-0)", \
sdBinary); +
+ sdBinary = new byte[] {
+ 0x01, 0x00, 0x00, 0x80, 0x14, 0x00, 0x00, 0x00, 0x24, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x20, 0x00,
+ 0x00, 0x00, 0x21, 0x02, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x05, 0x20, 0x00, 0x00, 0x00, 0x20, 0x02,
+ 0x00, 0x00 };
+ CheckSddlConstructor ("O:BUG:BA", sdBinary);
+
+ sdBinary = new byte[] {
+ 0x01, 0x00, 0x04, 0x80, 0x14, 0x00, 0x00, 0x00, 0x24, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00,
+ 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x20, 0x00,
+ 0x00, 0x00, 0x21, 0x02, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x05, 0x20, 0x00, 0x00, 0x00, 0x20, 0x02,
+ 0x00, 0x00, 0x04, 0x00, 0x40, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x38, 0x00, 0x3F, 0x00, 0x0E, 0x10, 0x03, 0x00,
+ 0x00, 0x00, 0x53, 0x1A, 0x72, 0xAB, 0x2F, 0x1E, 0xD0, 0x11,
+ 0x98, 0x19, 0x00, 0xAA, 0x00, 0x40, 0x52, 0x9B, 0x53, 0x1A,
+ 0x72, 0xAB, 0x2F, 0x1E, 0xD0, 0x11, 0x98, 0x19, 0x00, 0xAA,
+ 0x00, 0x40, 0x52, 0x9B, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+ CheckSddlConstructor \
("O:BUG:BAD:(OA;;RPWPCCDCLCSWRCWDWOGA;ab721a53-1e2f-11d0-9819-00aa0040529b;ab721a53-1e2f-11d0-9819-00aa0040529b;S-1-0-0)", \
sdBinary); + }
+
+ [Test]
+ public void ConstructorBinary ()
+ {
+ byte[] sdBinary = new byte[] {
+ 0x01, 0x00, 0x04, 0x80, 0x14, 0x00, 0x00, 0x00, 0x24, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00,
+ 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x20, 0x00,
+ 0x00, 0x00, 0x21, 0x02, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x05, 0x20, 0x00, 0x00, 0x00, 0x20, 0x02,
+ 0x00, 0x00, 0x02, 0x00, 0x1C, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x14, 0x00, 0x3F, 0x00, 0x0E, 0x10, 0x01, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+ CheckBinaryConstructor ("O:BUG:BAD:(A;;CCDCLCSWRPWPRCWDWOGA;;;S-1-0-0)", \
sdBinary); + sdBinary = new byte[] {
+ 0x01, 0x00, 0x00, 0x80, 0x14, 0x00, 0x00, 0x00, 0x24, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x20, 0x00,
+ 0x00, 0x00, 0x21, 0x02, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x05, 0x20, 0x00, 0x00, 0x00, 0x20, 0x02,
+ 0x00, 0x00 };
+ CheckBinaryConstructor ("O:BUG:BA", sdBinary);
+
+ sdBinary = new byte[] {
+ 0x01, 0x00, 0x04, 0x80, 0x14, 0x00, 0x00, 0x00, 0x24, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00,
+ 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x20, 0x00,
+ 0x00, 0x00, 0x21, 0x02, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x05, 0x20, 0x00, 0x00, 0x00, 0x20, 0x02,
+ 0x00, 0x00, 0x04, 0x00, 0x40, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x38, 0x00, 0x3F, 0x00, 0x0E, 0x10, 0x03, 0x00,
+ 0x00, 0x00, 0x53, 0x1A, 0x72, 0xAB, 0x2F, 0x1E, 0xD0, 0x11,
+ 0x98, 0x19, 0x00, 0xAA, 0x00, 0x40, 0x52, 0x9B, 0x53, 0x1A,
+ 0x72, 0xAB, 0x2F, 0x1E, 0xD0, 0x11, 0x98, 0x19, 0x00, 0xAA,
+ 0x00, 0x40, 0x52, 0x9B, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+ CheckBinaryConstructor \
("O:BUG:BAD:(OA;;CCDCLCSWRPWPRCWDWOGA;ab721a53-1e2f-11d0-9819-00aa0040529b;ab721a53-1e2f-11d0-9819-00aa0040529b;S-1-0-0)", \
sdBinary); + }
+
+ [Test]
+ public void FlagMismatch ()
+ {
+ // Check setting DACL-present flag on empty SD
+ RawSecurityDescriptor sd = new RawSecurityDescriptor ("");
+ Assert.AreEqual (20, sd.BinaryLength);
+ sd.SetFlags (ControlFlags.DiscretionaryAclPresent);
+ Assert.AreEqual (20, sd.BinaryLength);
+ byte[] buffer = new byte[sd.BinaryLength];
+ sd.GetBinaryForm (buffer, 0);
+ byte[] sdBinary = new byte[] {
+ 0x01, 0x00, 0x04, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+ Assert.AreEqual (sdBinary, buffer);
+
+ // Check unsetting DACL-present flag on SD with DACL
+ sd = new RawSecurityDescriptor ("O:BUG:BAD:(A;;RPWPCCDCLCSWRCWDWOGA;;;S-1-0-0)");
+ Assert.AreEqual (80, sd.BinaryLength);
+ sd.SetFlags (sd.ControlFlags & ~ControlFlags.DiscretionaryAclPresent);
+ Assert.AreEqual (ControlFlags.SelfRelative, sd.ControlFlags);
+ Assert.AreEqual (52, sd.BinaryLength);
+ buffer = new byte[sd.BinaryLength];
+ sd.GetBinaryForm (buffer, 0);
+ sdBinary = new byte[] {
+ 0x01, 0x00, 0x00, 0x80, 0x14, 0x00, 0x00, 0x00, 0x24, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x20, 0x00,
+ 0x00, 0x00, 0x21, 0x02, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x05, 0x20, 0x00, 0x00, 0x00, 0x20, 0x02,
+ 0x00, 0x00 };
+ Assert.AreEqual (sdBinary, buffer);
+ }
+
+ [Test]
+ public void GetBinaryForm ()
+ {
+ RawSecurityDescriptor sd = new RawSecurityDescriptor ("");
+ sd.Owner = new SecurityIdentifier (WellKnownSidType.BuiltinUsersSid, null);
+ sd.Group = new SecurityIdentifier (WellKnownSidType.BuiltinAdministratorsSid, \
null); + sd.DiscretionaryAcl = new RawAcl (1, 0);
+ sd.SystemAcl = new RawAcl (1, 0);
+ sd.SetFlags (sd.ControlFlags | ControlFlags.DiscretionaryAclPresent | \
ControlFlags.SystemAclPresent); +
+ // Empty ACL form
+ byte[] buffer = new byte[sd.BinaryLength];
+ sd.GetBinaryForm (buffer, 0);
+ byte[] sdBinary = new byte[] {
+ 0x01, 0x00, 0x14, 0x80, 0x14, 0x00, 0x00, 0x00, 0x24, 0x00,
+ 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00,
+ 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x20, 0x00,
+ 0x00, 0x00, 0x21, 0x02, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x05, 0x20, 0x00, 0x00, 0x00, 0x20, 0x02,
+ 0x00, 0x00, 0x01, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00 };
+ Assert.AreEqual (sdBinary, buffer);
+
+ // Add an ACE to the DACL
+ SecurityIdentifier builtInAdmins = new SecurityIdentifier \
(WellKnownSidType.BuiltinAdministratorsSid, null); + CommonAce ace = new CommonAce \
(AceFlags.None, AceQualifier.AccessAllowed, 0x7FFFFFFF, builtInAdmins, false, null); \
+ sd.DiscretionaryAcl.InsertAce (0, ace); + buffer = new byte[sd.BinaryLength];
+ sd.GetBinaryForm (buffer, 0);
+ sdBinary = new byte[] {
+ 0x01, 0x00, 0x14, 0x80, 0x14, 0x00, 0x00, 0x00, 0x24, 0x00,
+ 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00,
+ 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x20, 0x00,
+ 0x00, 0x00, 0x21, 0x02, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x05, 0x20, 0x00, 0x00, 0x00, 0x20, 0x02,
+ 0x00, 0x00, 0x01, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x20, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x18, 0x00, 0xFF, 0xFF, 0xFF, 0x7F, 0x01, 0x02, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x05, 0x20, 0x00, 0x00, 0x00, 0x20, 0x02,
+ 0x00, 0x00 };
+ Assert.AreEqual (sdBinary, buffer);
+
+ // This time with an Object ACE
+ ObjectAce objectAce = new ObjectAce (AceFlags.Inherited, \
AceQualifier.AccessAllowed, 0x12345678, builtInAdmins, \
ObjectAceFlags.ObjectAceTypePresent | ObjectAceFlags.InheritedObjectAceTypePresent, \
new Guid ("189c0dc7-b849-4dea-93a5-6d4cb8857a5c"), new Guid \
("53b4a3d4-fe39-468b-bc60-b4fcba772fa5"), false, null); + sd.DiscretionaryAcl = new \
RawAcl (2, 0); + sd.DiscretionaryAcl.InsertAce (0, objectAce);
+ buffer = new byte[sd.BinaryLength];
+ sd.GetBinaryForm (buffer, 0);
+ sdBinary = new byte[] {
+ 0x01, 0x00, 0x14, 0x80, 0x14, 0x00, 0x00, 0x00, 0x24, 0x00,
+ 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00,
+ 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x20, 0x00,
+ 0x00, 0x00, 0x21, 0x02, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x05, 0x20, 0x00, 0x00, 0x00, 0x20, 0x02,
+ 0x00, 0x00, 0x01, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x44, 0x00, 0x01, 0x00, 0x00, 0x00, 0x05, 0x10,
+ 0x3C, 0x00, 0x78, 0x56, 0x34, 0x12, 0x03, 0x00, 0x00, 0x00,
+ 0xC7, 0x0D, 0x9C, 0x18, 0x49, 0xB8, 0xEA, 0x4D, 0x93, 0xA5,
+ 0x6D, 0x4C, 0xB8, 0x85, 0x7A, 0x5C, 0xD4, 0xA3, 0xB4, 0x53,
+ 0x39, 0xFE, 0x8B, 0x46, 0xBC, 0x60, 0xB4, 0xFC, 0xBA, 0x77,
+ 0x2F, 0xA5, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05,
+ 0x20, 0x00, 0x00, 0x00, 0x20, 0x02, 0x00, 0x00 };
+ Assert.AreEqual (sdBinary, buffer);
+ }
+
+ [Test]
+ public void GetSddlForm ()
+ {
+ RawSecurityDescriptor sd = new RawSecurityDescriptor ("");
+ Assert.AreEqual ("", sd.GetSddlForm (AccessControlSections.All));
+
+ // Ask for part of SD that isn't represented
+ sd.Owner = new SecurityIdentifier (WellKnownSidType.BuiltinUsersSid, null);
+ sd.Group = new SecurityIdentifier (WellKnownSidType.BuiltinAdministratorsSid, \
null); + Assert.AreEqual ("", sd.GetSddlForm (AccessControlSections.Access));
+
+ // Empty ACL form
+ sd.DiscretionaryAcl = new RawAcl (2, 0);
+ sd.SystemAcl = new RawAcl (1, 0);
+ sd.SetFlags (sd.ControlFlags | ControlFlags.DiscretionaryAclPresent | \
ControlFlags.SystemAclPresent); + Assert.AreEqual ("O:BUG:BAD:S:", sd.GetSddlForm \
(AccessControlSections.All)); +
+ // Add an ACE to the DACL
+ SecurityIdentifier builtInAdmins = new SecurityIdentifier \
(WellKnownSidType.BuiltinAdministratorsSid, null); + CommonAce ace = new CommonAce \
(AceFlags.None, AceQualifier.AccessAllowed, 0x7FFFFFFF, builtInAdmins, false, null); \
+ sd.DiscretionaryAcl.InsertAce (0, ace); + Assert.AreEqual \
("O:BUG:BAD:(A;;0x7fffffff;;;BA)S:", sd.GetSddlForm (AccessControlSections.All)); \
+ + // Add second ACE to the DACL
+ SecurityIdentifier randomUser = new SecurityIdentifier \
("S-1-5-21-324-23423-234-334"); + ace = new CommonAce (AceFlags.Inherited | \
AceFlags.ContainerInherit, AceQualifier.AccessDenied, 0x12345678, randomUser, true, \
null); + sd.DiscretionaryAcl.InsertAce (0, ace);
+ Assert.AreEqual ("O:BUD:(XD;CIID;0x12345678;;;S-1-5-21-324-23423-234-334)(A;;0x7fffffff;;;BA)", \
sd.GetSddlForm (AccessControlSections.Owner | AccessControlSections.Access)); +
+ // DACL & SACL flags
+ sd.SetFlags (sd.ControlFlags | ControlFlags.DiscretionaryAclProtected | \
ControlFlags.DiscretionaryAclAutoInherited | \
ControlFlags.DiscretionaryAclAutoInheritRequired | \
ControlFlags.SystemAclAutoInherited); + sd.DiscretionaryAcl = new RawAcl (1, 0);
+ ace = new CommonAce (AceFlags.None, AceQualifier.AccessAllowed, 0x7FFFFFFF, \
builtInAdmins, false, null); + sd.DiscretionaryAcl.InsertAce (0, ace);
+ Assert.AreEqual ("O:BUG:BAD:PARAI(A;;0x7fffffff;;;BA)S:AI", sd.GetSddlForm \
(AccessControlSections.All)); +
+ sd.SetFlags (sd.ControlFlags | ControlFlags.ServerSecurity | \
ControlFlags.DiscretionaryAclDefaulted); + Assert.AreEqual \
("O:BUG:BAD:PARAI(A;;0x7fffffff;;;BA)S:AI", sd.GetSddlForm \
(AccessControlSections.All)); + }
+
+ [Test]
+ public void RoundTrip ()
+ {
+ CheckRoundTrip ("O:BUG:BAD:(A;;CCDCLCSWRPWPRCWDWOGA;;;S-1-0-0)");
+ CheckRoundTrip ("O:BUG:BAD:(A;;KR;;;S-1-0-0)");
+ CheckRoundTrip ("O:BUG:BAD:(OA;;CCDCLCSWRPWPRCWDWOGA;ab721a53-1e2f-11d0-9819-00aa0040529b;ab721a53-1e2f-11d0-9819-00aa0040529b;S-1-0-0)");
+ CheckRoundTrip ("O:BUG:BAD:(A;;CCDCLCSWRPRC;;;S-1-0-0)");
+ CheckRoundTrip ("O:SYG:BAD:(A;;0x12019f;;;SY)(A;;0x12019f;;;BA)");
+ CheckRoundTrip ("O:SYG:BAD:(A;OICINPIOID;0x12019f;;;SY)");
+ CheckRoundTrip ("O:SYG:BAS:(AU;SAFA;0x12019f;;;SY)");
+ }
+ }
+}
+
Commit: 51a47770f2d3ff7d52181644a5f5bade64cd4f03
Author: Kyle Ambroff <kyle@ambroff.com>
Committer: Miguel de Icaza <miguel@gnome.org>
Date: 01/26/2011 18:07:42
URL: https://github.com/mono/mono/commit/51a47770f2d3ff7d52181644a5f5bade64cd4f03
version tolerant serialization fails with missing primitive members
Modifies ObjectReader so that when it encounters a primitive typed member in
an object stream which has no corresponding member in the app domain, it will
read the value anyway and throw it away. That way it can read the next block
from the stream.
Added a unit test which passes with the changes to ObjectReader.
Fixes bug #641821.
Changed paths:
M mcs/class/corlib/Makefile
M mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/ObjectReader.cs
M mcs/class/corlib/Test/System.Runtime.Serialization.Formatters.Binary/VersionTolerantSerialization/BinarySerializationOverVersions.cs
Added paths:
A mcs/class/corlib/Test/System.Runtime.Serialization.Formatters.Binary/VersionTolerantSerialization/VersionTolerantSerializationTestLib/6.0/Address.cs
Modified: mcs/class/corlib/Makefile
===================================================================
--- a/mcs/class/corlib/Makefile
+++ b/mcs/class/corlib/Makefile
@@ -95,6 +95,8 @@ test-vts:
$(vtsdir)/$(vts)TestLib/4.0/Address.cs
$(MCS) -target:library \
$(vtsdir)/$(vts)TestLib/5.0/Address.cs
+ $(MCS) -target:library \
+ $(vtsdir)/$(vts)TestLib/6.0/Address.cs
run-test-vts: test-vts
$(TEST_RUNTIME) $(RUNTIME_FLAGS) $(TEST_HARNESS) -noshadow \
$(vtsdir)/BinarySerializationOverVersions.exe
Modified: mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/ObjectReader.cs
===================================================================
--- a/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/ObjectReader.cs
+++ b/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/ObjectReader.cs
@@ -294,13 +294,22 @@ namespace System.Runtime.Serialization.Formatters.Binary
info = metadata.NeedsSerializationInfo ? new SerializationInfo(metadata.Type, new \
FormatterConverter()) : null;
- if (metadata.MemberNames != null)
+ if (metadata.MemberNames != null) {
for (int n=0; n<metadata.FieldCount; n++)
ReadValue (reader, objectInstance, objectId, info, metadata.MemberTypes[n], \
metadata.MemberNames[n], null, null);
- else
- for (int n=0; n<metadata.FieldCount; n++)
+ } else
+ for (int n=0; n<metadata.FieldCount; n++) {
if (metadata.MemberInfos [n] != null)
- ReadValue (reader, objectInstance, objectId, info, metadata.MemberTypes[n], \
metadata.MemberInfos[n].Name, metadata.MemberInfos[n], null); + ReadValue \
(reader, objectInstance, objectId, info, metadata.MemberTypes[n], \
metadata.MemberInfos[n].Name, metadata.MemberInfos[n], null); + else if \
(BinaryCommon.IsPrimitive(metadata.MemberTypes[n])) { + // Since the member info \
is null, the type in this + // domain does not have this type. Even though we
+ // are not going to store the value, we will read
+ // it from the stream so that we can advance to the
+ // next block.
+ ReadPrimitiveTypeValue (reader, metadata.MemberTypes[n]);
+ }
+ }
}
private void RegisterObject (long objectId, object objectInstance, \
SerializationInfo info, long parentObjectId, MemberInfo parentObjectMemeber, int[] \
indices)
Modified: mcs/class/corlib/Test/System.Runtime.Serialization.Formatters.Binary/VersionTolerantSerialization/BinarySerializationOverVersions.cs
===================================================================
--- a/mcs/class/corlib/Test/System.Runtime.Serialization.Formatters.Binary/VersionTolerantSerialization/BinarySerializationOverVersions.cs
+++ b/mcs/class/corlib/Test/System.Runtime.Serialization.Formatters.Binary/VersionTolerantSerialization/BinarySerializationOverVersions.cs
@@ -124,6 +124,18 @@ namespace \
MonoTests.System.Runtime.Serialization.Formatters.Binary Deserialize ("4.0", \
Serialize ("5.0")); }
+ [Test]
+ public void TestDroppedPrimitiveTypeField() //eliminate Id (int)
+ {
+ Deserialize ("5.0", Serialize ("6.0"));
+ }
+
+ [Test]
+ public void TestAddedPrimitiveTypeField () //add Id (int)
+ {
+ Deserialize ("6.0", Serialize ("5.0"));
+ }
+
private static string Serialize (string assemblyVersion)
{
return SerializeOOP (SetEnvironment (assemblyVersion)); ;
Added: mcs/class/corlib/Test/System.Runtime.Serialization.Formatters.Binary/VersionTolerantSerialization/VersionTolerantSerializationTestLib/6.0/Address.cs
===================================================================
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Runtime.Serialization.Formatters.Binary/VersionTolerantSerialization/VersionTolerantSerializationTestLib/6.0/Address.cs
@@ -0,0 +1,23 @@
+using System;
+using System.Runtime.Serialization;
+
+namespace VersionTolerantSerializationTestLib
+{
+ [Serializable]
+ public class Address
+ {
+ private string Street;
+ private string City;
+ private string CountryCode;
+
+ [OptionalField (VersionAdded = 4)]
+ private string PostCode;
+
+ [OptionalField (VersionAdded = 5)]
+ private string AreaCode = "0";
+
+ [OptionalField (VersionAdded = 6)]
+ private int Id = 0;
+ }
+}
+
Commit: 36d4336429db0fef9b45408c9775598dd3150e16
Author: Zoltan Varga <vargaz@gmail.com>
Date: 01/26/2011 19:44:47
URL: https://github.com/mono/mono/commit/36d4336429db0fef9b45408c9775598dd3150e16
Add AOT support for castclass_with_cache wrappers.
Changed paths:
M mono/mini/aot-compiler.c
M mono/mini/aot-runtime.c
M mono/mini/method-to-ir.c
M mono/mini/mini.c
M mono/mini/mini.h
M mono/mini/patch-info.h
Modified: mono/mini/aot-compiler.c
===================================================================
--- a/mono/mini/aot-compiler.c
+++ b/mono/mini/aot-compiler.c
@@ -2036,6 +2036,13 @@ encode_method_ref (MonoAotCompile *acfg, MonoMethod *method, \
guint8 *buf, guint8 g_assert_not_reached ();
}
break;
+ case MONO_WRAPPER_CASTCLASS:
+ if (!strcmp (method->name, "__castclass_with_cache")) {
+ encode_value (MONO_AOT_WRAPPER_CASTCLASS_WITH_CACHE, p, &p);
+ } else {
+ g_assert_not_reached ();
+ }
+ break;
default:
g_assert_not_reached ();
}
@@ -2610,6 +2617,9 @@ add_wrappers (MonoAotCompile *acfg)
if (klass)
add_method (acfg, mono_marshal_get_virtual_stelemref (mono_array_class_get \
(klass, 1))); }
+
+ /* castclass_with_check wrapper */
+ add_method (acfg, mono_marshal_get_castclass_with_cache ());
}
/*
@@ -3507,6 +3517,7 @@ encode_patch (MonoAotCompile *acfg, MonoJumpInfo *patch_info, \
guint8 *buf, guint break;
case MONO_PATCH_INFO_MSCORLIB_GOT_ADDR:
case MONO_PATCH_INFO_GC_CARD_TABLE_ADDR:
+ case MONO_PATCH_INFO_CASTCLASS_CACHE:
break;
case MONO_PATCH_INFO_METHOD_REL:
encode_value ((gint)patch_info->data.offset, p, &p);
@@ -4641,6 +4652,11 @@ can_encode_patch (MonoAotCompile *acfg, MonoJumpInfo \
*patch_info) return TRUE;
else
return FALSE;
+ case MONO_WRAPPER_CASTCLASS:
+ if (!strcmp (method->name, "__castclass_with_cache"))
+ return TRUE;
+ else
+ return FALSE;
default:
//printf ("Skip (wrapper call): %d -> %s\n", patch_info->type, \
mono_method_full_name (patch_info->data.method, TRUE)); return FALSE;
@@ -5182,7 +5198,7 @@ emit_llvm_file (MonoAotCompile *acfg)
* then removing tailcallelim + the global opts, and adding a second gvn.
*/
opts = g_strdup ("-instcombine -simplifycfg");
- opts = g_strdup ("-simplifycfg -domtree -domfrontier -scalarrepl -instcombine \
-simplifycfg -basiccg -prune-eh -inline -functionattrs -domtree -domfrontier \
-scalarrepl -simplify-libcalls -instcombine -simplifycfg -instcombine -simplifycfg \
-reassociate -domtree -loops -loopsimplify -domfrontier -loopsimplify -lcssa \
-loop-rotate -licm -lcssa -loop-unswitch -instcombine -scalar-evolution -loopsimplify \
-lcssa -iv-users -indvars -loop-deletion -loopsimplify -lcssa -loop-unroll \
-instcombine -memdep -gvn -memdep -memcpyopt -sccp -instcombine -domtree -memdep -dse \
-adce -gvn -simplifycfg -preverify -domtree -verify"); + opts = g_strdup \
("-simplifycfg -domtree -domfrontier -scalarrepl -instcombine -simplifycfg -basiccg \
-prune-eh -inline -functionattrs -domtree -domfrontier -scalarrepl -simplify-libcalls \
-instcombine -simplifycfg -instcombine -simplifycfg -reassociate -domtree -loops \
-loopsimplify -domfrontier -loopsimplify -lcssa -loop-rotate -licm -lcssa \
-loop-unswitch -instcombine -scalar-evolution -loopsimplify -lcssa -iv-users -indvars \
-loop-deletion -loopsimplify -lcssa -loop-unroll -instcombine -memdep -gvn -memdep \
-memcpyopt -sccp -instcombine -domtree -memdep -dse -adce -simplifycfg -preverify \
-domtree -verify"); #if 1
command = g_strdup_printf ("%sopt -f %s -o temp.opt.bc temp.bc", \
acfg->aot_opts.llvm_path, opts); printf ("Executing opt: %s\n", command);
Modified: mono/mini/aot-runtime.c
===================================================================
--- a/mono/mini/aot-runtime.c
+++ b/mono/mini/aot-runtime.c
@@ -654,6 +654,15 @@ decode_method_ref_with_target (MonoAotModule *module, MethodRef \
*ref, MonoMethod return FALSE;
break;
}
+ case MONO_WRAPPER_CASTCLASS: {
+ int subtype = decode_value (p, &p);
+
+ if (subtype == MONO_AOT_WRAPPER_CASTCLASS_WITH_CACHE)
+ ref->method = mono_marshal_get_castclass_with_cache ();
+ else
+ g_assert_not_reached ();
+ break;
+ }
default:
g_assert_not_reached ();
}
@@ -2348,6 +2357,7 @@ decode_patch (MonoAotModule *aot_module, MonoMemPool *mp, \
MonoJumpInfo *ji, guin case MONO_PATCH_INFO_MONITOR_ENTER:
case MONO_PATCH_INFO_MONITOR_EXIT:
case MONO_PATCH_INFO_GC_CARD_TABLE_ADDR:
+ case MONO_PATCH_INFO_CASTCLASS_CACHE:
break;
case MONO_PATCH_INFO_RGCTX_FETCH: {
gboolean res;
Modified: mono/mini/method-to-ir.c
===================================================================
--- a/mono/mini/method-to-ir.c
+++ b/mono/mini/method-to-ir.c
@@ -8136,7 +8136,10 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, \
MonoBasicBlock *start_b
/* inline cache*/
/*FIXME AOT support*/
- EMIT_NEW_PCONST (cfg, args [2], mono_domain_alloc0 (cfg->domain, sizeof \
(gpointer))); + if (cfg->compile_aot)
+ EMIT_NEW_AOTCONST (cfg, args [2], MONO_PATCH_INFO_CASTCLASS_CACHE, NULL);
+ else
+ EMIT_NEW_PCONST (cfg, args [2], mono_domain_alloc0 (cfg->domain, sizeof \
(gpointer)));
/*The wrapper doesn't inline well so the bloat of inlining doesn't pay off.*/
*sp++ = mono_emit_method_call (cfg, mono_castclass, args, NULL);
@@ -8258,7 +8261,10 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, \
MonoBasicBlock *start_b
/* inline cache*/
/*FIXME AOT support*/
- EMIT_NEW_PCONST (cfg, args [2], mono_domain_alloc0 (cfg->domain, sizeof \
(gpointer))); + if (cfg->compile_aot)
+ EMIT_NEW_AOTCONST (cfg, args [2], MONO_PATCH_INFO_CASTCLASS_CACHE, NULL);
+ else
+ EMIT_NEW_PCONST (cfg, args [2], mono_domain_alloc0 (cfg->domain, sizeof \
(gpointer)));
/*The wrapper doesn't inline well so the bloat of inlining doesn't pay off.*/
*sp++ = mono_emit_method_call (cfg, mono_castclass, args, NULL);
Modified: mono/mini/mini.c
===================================================================
--- a/mono/mini/mini.c
+++ b/mono/mini/mini.c
@@ -3230,6 +3230,10 @@ mono_resolve_patch_target (MonoMethod *method, MonoDomain \
*domain, guint8 *code, target = mono_gc_get_card_table (&card_table_shift_bits, \
&card_table_mask); break;
}
+ case MONO_PATCH_INFO_CASTCLASS_CACHE: {
+ target = mono_domain_alloc0 (domain, sizeof (gpointer));
+ break;
+ }
default:
g_assert_not_reached ();
}
Modified: mono/mini/mini.h
===================================================================
--- a/mono/mini/mini.h
+++ b/mono/mini/mini.h
@@ -2432,6 +2432,7 @@ enum {
MONO_AOT_WRAPPER_ELEMENT_ADDR,
MONO_AOT_WRAPPER_PTR_TO_STRUCTURE,
MONO_AOT_WRAPPER_STRUCTURE_TO_PTR,
+ MONO_AOT_WRAPPER_CASTCLASS_WITH_CACHE,
MONO_AOT_WRAPPER_LAST
};
Modified: mono/mini/patch-info.h
===================================================================
--- a/mono/mini/patch-info.h
+++ b/mono/mini/patch-info.h
@@ -41,4 +41,5 @@ PATCH_INFO(MSCORLIB_GOT_ADDR, "mscorlib_got_addr")
PATCH_INFO(SEQ_POINT_INFO, "seq_point_info")
PATCH_INFO(LLVM_IMT_TRAMPOLINE, "llvm_imt_trampoline")
PATCH_INFO(GC_CARD_TABLE_ADDR, "gc_card_table_addr")
+PATCH_INFO(CASTCLASS_CACHE, "castclass_cache")
PATCH_INFO(NONE, "none")
Commit: ae3683b3c2bf786616fb7bef8fffc61689a4b52c
Author: Gonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Date: 01/26/2011 23:09:50
URL: https://github.com/mono/mono/commit/ae3683b3c2bf786616fb7bef8fffc61689a4b52c
Prevent abort
When cleaning up the sockets we no longer have access to Tls.
Changed paths:
M mono/io-layer/sockets.c
Modified: mono/io-layer/sockets.c
===================================================================
--- a/mono/io-layer/sockets.c
+++ b/mono/io-layer/sockets.c
@@ -54,6 +54,7 @@
#undef DEBUG
static guint32 startup_count=0;
+static guint32 in_cleanup = 0;
static void socket_close (gpointer handle, gpointer data);
@@ -82,7 +83,7 @@ static void socket_close (gpointer handle, gpointer data)
g_message ("%s: closing socket handle %p", __func__, handle);
#endif
- if (startup_count == 0) {
+ if (startup_count == 0 && !in_cleanup) {
WSASetLastError (WSANOTINITIALISED);
return;
}
@@ -103,10 +104,12 @@ static void socket_close (gpointer handle, gpointer data)
g_message ("%s: close error: %s", __func__, strerror (errno));
#endif
errnum = errno_to_WSA (errnum, __func__);
- WSASetLastError (errnum);
+ if (!in_cleanup)
+ WSASetLastError (errnum);
}
- socket_handle->saved_error = 0;
+ if (!in_cleanup)
+ socket_handle->saved_error = 0;
}
int WSAStartup(guint32 requested, WapiWSAData *data)
@@ -156,7 +159,9 @@ int WSACleanup(void)
return(0);
}
+ in_cleanup = 1;
_wapi_handle_foreach (WAPI_HANDLE_SOCKET, cleanup_close, NULL);
+ in_cleanup = 0;
return(0);
}
Commit: d2fddf50625649474c8f209a89d75e4d10b65d52
Author: Zoltan Varga <vargaz@gmail.com>
Date: 01/27/2011 01:16:44
URL: https://github.com/mono/mono/commit/d2fddf50625649474c8f209a89d75e4d10b65d52
Fix dist issues in Mono.Debugger.Soft.
Changed paths:
M mcs/class/Mono.Debugger.Soft/Makefile
Modified: mcs/class/Mono.Debugger.Soft/Makefile
===================================================================
--- a/mcs/class/Mono.Debugger.Soft/Makefile
+++ b/mcs/class/Mono.Debugger.Soft/Makefile
@@ -15,9 +15,14 @@ dtest-app.exe: Test/dtest-app.cs
$(CSCOMPILE) -out:$@ -unsafe -debug Test/dtest-app.cs
dtest-excfilter.exe: Test/dtest-excfilter.il
- $(INTERNAL_ILASM) -out:$@ /exe /debug Test/dtest-excfilter.il
+ MONO_PATH=$(topdir)/class/lib/$(PROFILE) $(INTERNAL_ILASM) -out:$@ /exe /debug \
Test/dtest-excfilter.il
-CLEAN_FILES = dtest-app.exe dtest-app.exe.mdb
+CLEAN_FILES = dtest-app.exe dtest-app.exe.mdb dtest-excfilter.exe \
dtest-excfilter.exe.mdb +
+EXTRA_DISTFILES = \
+ Test/dtest-app.cs \
+ Test/dtest.cs \
+ Test/dtest-excfilter.il
#NO_TEST = yes
Commit: fb6c06445f91043f75aeefdd0870e4ca8262805f
Author: Marek Safar <marek.safar@gmail.com>
Date: 01/27/2011 04:06:10
URL: https://github.com/mono/mono/commit/fb6c06445f91043f75aeefdd0870e4ca8262805f
[667261] Fixes overload resolution of an optional parameter followed by a params \
parameter of the same type
Changed paths:
M mcs/mcs/ecore.cs
Modified: mcs/mcs/ecore.cs
===================================================================
--- a/mcs/mcs/ecore.cs
+++ b/mcs/mcs/ecore.cs
@@ -3750,20 +3750,18 @@ namespace Mono.CSharp {
}
}
- int args_gap = System.Math.Abs (arg_count - param_count);
if (optional_count != 0) {
- if (args_gap > optional_count)
- return int.MaxValue - 10000 + args_gap - optional_count;
-
// Readjust expected number when params used
if (cpd.HasParams) {
optional_count--;
if (arg_count < param_count)
param_count--;
} else if (arg_count > param_count) {
+ int args_gap = System.Math.Abs (arg_count - param_count);
return int.MaxValue - 10000 + args_gap;
}
} else if (arg_count != param_count) {
+ int args_gap = System.Math.Abs (arg_count - param_count);
if (!cpd.HasParams)
return int.MaxValue - 10000 + args_gap;
if (arg_count < param_count - 1)
Commit: 4512ede1a032fe28f93bab507ac3834e6051cea6
Author: Zoltan Varga <vargaz@gmail.com>
Date: 01/27/2011 05:06:35
URL: https://github.com/mono/mono/commit/4512ede1a032fe28f93bab507ac3834e6051cea6
Fix compilation of tests/assemblyresolve with newer mcs-es.
Changed paths:
M mono/tests/assemblyresolve/Makefile.am
Modified: mono/tests/assemblyresolve/Makefile.am
===================================================================
--- a/mono/tests/assemblyresolve/Makefile.am
+++ b/mono/tests/assemblyresolve/Makefile.am
@@ -13,7 +13,7 @@ test/asm.dll: test/.dirstamp
deps/test.dll deps/TestBase.dll: deps/.dirstamp
test/asm.dll: deps/test.dll asm.cs
- $(MCS) -out:test/asm.dll -r:deps/test.dll $(srcdir)/asm.cs
+ $(MCS) -out:test/asm.dll -r:deps/TestBase.dll -r:deps/test.dll $(srcdir)/asm.cs
deps/test.dll: deps/TestBase.dll Test.cs
$(MCS) -out:deps/test.dll -r:deps/TestBase.dll $(srcdir)/Test.cs
@@ -22,3 +22,6 @@ deps/TestBase.dll: TestBase.cs
$(MCS) -out:deps/TestBase.dll $(srcdir)/TestBase.cs
EXTRA_DIST = asm.cs Test.cs TestBase.cs
+
+clean:
+ rm -f deps/*.dll test/*.dll
Commit: cdd5b3f397a2134d22d5eeb9ff2160ae0786a6ec
Author: Jérémie Laval <jeremie.laval@gmail.com>
Date: 01/27/2011 08:18:19
URL: https://github.com/mono/mono/commit/cdd5b3f397a2134d22d5eeb9ff2160ae0786a6ec
Leave db connection opened until requested to close it and add more unit tests
Changed paths:
M mcs/class/WebMatrix.Data/Test/WebMatrix.Data/DatabaseTests.cs
M mcs/class/WebMatrix.Data/WebMatrix.Data/Database.cs
Modified: mcs/class/WebMatrix.Data/Test/WebMatrix.Data/DatabaseTests.cs
===================================================================
--- a/mcs/class/WebMatrix.Data/Test/WebMatrix.Data/DatabaseTests.cs
+++ b/mcs/class/WebMatrix.Data/Test/WebMatrix.Data/DatabaseTests.cs
@@ -42,12 +42,13 @@ namespace MonoTests.WebMatrix.Data
public class DatabaseTests
{
Database database;
+ string dbPath;
[SetUp]
public void Setup ()
{
- string path = Path.Combine ("Test", "testsqlite.db");
- database = Database.OpenConnectionString ("Data Source="+path+";Version=3;", \
"Mono.Data.Sqlite"); + dbPath = Path.Combine ("Test", "testsqlite.db");
+ database = Database.OpenConnectionString ("Data Source="+dbPath+";Version=3;", \
"Mono.Data.Sqlite"); }
[Test]
@@ -80,6 +81,28 @@ namespace MonoTests.WebMatrix.Data
}
[Test]
+ public void InsertTest ()
+ {
+ string newPath = dbPath + ".tmp";
+ File.Copy (dbPath, newPath, true);
+
+ database = Database.OpenConnectionString ("Data Source="+newPath+";Version=3;", \
"Mono.Data.Sqlite"); + database.Execute ("insert into memos values ('foo', @0);", \
42); +
+ Assert.AreEqual (42, database.QueryValue ("select Priority from memos where \
Text='foo'")); + Assert.AreEqual (6, database.GetLastInsertId ());
+
+ File.Delete (newPath);
+ }
+
+ [Test]
+ public void QueryValueTest ()
+ {
+ var res = database.QueryValue ("select Priority from memos where \
Text='Webmatrix'"); + Assert.AreEqual (10, res);
+ }
+
+ [Test]
public void ConnectionOpenedTest ()
{
bool opened = false;
Modified: mcs/class/WebMatrix.Data/WebMatrix.Data/Database.cs
===================================================================
--- a/mcs/class/WebMatrix.Data/WebMatrix.Data/Database.cs
+++ b/mcs/class/WebMatrix.Data/WebMatrix.Data/Database.cs
@@ -29,6 +29,7 @@
using System;
using System.Linq;
+using System.Threading;
using System.Dynamic;
using System.Data.Common;
using System.Configuration;
@@ -41,11 +42,25 @@ namespace WebMatrix.Data
{
public static event EventHandler<ConnectionEventArgs> ConnectionOpened;
+ bool opened;
DbConnection connection;
+ readonly string providerName;
- private Database (DbConnection connection)
+ static readonly Dictionary<string, string> lastInsertedIdStmts = new \
Dictionary<string, string> (); +
+ static Database ()
+ {
+ // Add your own DB-specific way to do so
+ lastInsertedIdStmts.Add ("System.Data.SqlClient", "select @@IDENTITY;");
+ lastInsertedIdStmts.Add ("Mono.Data.Sqlite", "select last_insert_rowid ();");
+ lastInsertedIdStmts.Add ("MySql.Data", "SELECT LAST_INSERT_ID();");
+ lastInsertedIdStmts.Add ("Npgsql", "SELECT lastval();");
+ }
+
+ private Database (DbConnection connection, string providerName)
{
this.connection = connection;
+ this.providerName = providerName;
}
public static Database Open (string name)
@@ -68,12 +83,13 @@ namespace WebMatrix.Data
var conn = factory.CreateConnection ();
conn.ConnectionString = connectionString;
- return new Database (conn);
+ return new Database (conn, providerName);
}
public void Close ()
{
- Dispose ();
+ opened = false;
+ connection.Close ();
}
public void Dispose ()
@@ -83,8 +99,11 @@ namespace WebMatrix.Data
protected virtual void Dispose (bool disposing)
{
- if (disposing)
+ if (disposing) {
+ if (opened)
+ connection.Close ();
connection.Dispose ();
+ }
}
public int Execute (string commandText, params object[] args)
@@ -92,12 +111,10 @@ namespace WebMatrix.Data
var command = PrepareCommand (commandText);
PrepareCommandParameters (command, args);
- connection.Open ();
- TriggerConnectionOpened (this, connection);
+ EnsureConnectionOpened ();
var result = command.ExecuteNonQuery ();
- connection.Close ();
command.Dispose ();
return result;
@@ -119,14 +136,13 @@ namespace WebMatrix.Data
List<Dictionary<string, object>> QueryInternal (string commandText, object[] args, \
bool unique) {
+ EnsureConnectionOpened ();
+
var command = PrepareCommand (commandText);
PrepareCommandParameters (command, args);
string[] columnsNames;
var rows = new List<Dictionary<string, object>> ();
- connection.Open ();
- TriggerConnectionOpened (this, connection);
-
using (var reader = command.ExecuteReader ()) {
if (!reader.Read () || !reader.HasRows)
return null;
@@ -147,7 +163,6 @@ namespace WebMatrix.Data
} while (!unique && reader.Read ());
}
- connection.Close ();
command.Dispose ();
return rows;
@@ -155,24 +170,23 @@ namespace WebMatrix.Data
public object QueryValue (string commandText, params object[] args)
{
+ EnsureConnectionOpened ();
+
var command = PrepareCommand (commandText);
PrepareCommandParameters (command, args);
- connection.Open ();
- TriggerConnectionOpened (this, connection);
-
var result = command.ExecuteScalar ();
- connection.Close ();
command.Dispose ();
return result;
}
- // TODO: I don't think this is actually quite generic (SQL Server specific)
public object GetLastInsertId ()
{
- const string sql = "select @@IDENTITY";
+ string sql;
+ if (!lastInsertedIdStmts.TryGetValue (providerName, out sql))
+ throw new NotSupportedException ("This operation is not available for your \
database");
return QueryValue (sql);
}
@@ -207,6 +221,16 @@ namespace WebMatrix.Data
evt (self, new ConnectionEventArgs (connection));
}
+ void EnsureConnectionOpened ()
+ {
+ if (opened)
+ return;
+
+ connection.Open ();
+ opened = true;
+ TriggerConnectionOpened (this, connection);
+ }
+
public DbConnection Connection {
get {
return connection;
Commit: 30f5e30bc4c4afee315172d1c6b5616562280145
Author: Zoltan Varga <vargaz@gmail.com>
Date: 01/27/2011 09:35:25
URL: https://github.com/mono/mono/commit/30f5e30bc4c4afee315172d1c6b5616562280145
Applied patch from Burkhard Linke <blinke@cebitec.uni-bielefeld.de>. Add support for \
newer boehm-gc versions.
Changed paths:
M configure.in
M mono/metadata/boehm-gc.c
Modified: configure.in
===================================================================
--- a/configure.in
+++ b/configure.in
@@ -851,6 +851,14 @@ case "x$gc" in
if test "x$found_gc_enable" = "xyes"; then
BOEHM_DEFINES="-DHAVE_GC_ENABLE $BOEHM_DEFINES"
fi
+
+ # check whether we need to explicitly allow
+ # thread registering
+ AC_CHECK_LIB(gc, GC_allow_register_threads, \
found_allow_register_threads="yes",,$libdl) + if test \
"x$found_allow_register_threads" = "xyes"; then + \
AC_DEFINE(HAVE_GC_ALLOW_REGISTER_THREADS, 1, [GC requires thread registration]) + \
fi +
;;
xincluded)
Modified: mono/metadata/boehm-gc.c
===================================================================
--- a/mono/metadata/boehm-gc.c
+++ b/mono/metadata/boehm-gc.c
@@ -132,6 +132,10 @@ mono_gc_base_init (void)
GC_init_gcj_malloc (5, NULL);
#endif
+#ifdef HAVE_GC_ALLOW_REGISTER_THREADS
+ GC_allow_register_threads();
+#endif
+
if ((env = getenv ("MONO_GC_PARAMS"))) {
char **ptr, **opts = g_strsplit (env, ",", -1);
for (ptr = opts; *ptr; ++ptr) {
Commit: ef2c84591a9b8e94e89f8865d65780a283ee526f
Author: Marek Habersack <grendel@twistedcode.net>
Date: 01/27/2011 09:36:45
URL: https://github.com/mono/mono/commit/ef2c84591a9b8e94e89f8865d65780a283ee526f
[machine.config] Added the <system.transactions> section definition
Changed paths:
M data/net_2_0/machine.config
M data/net_4_0/machine.config
Modified: data/net_2_0/machine.config
===================================================================
--- a/data/net_2_0/machine.config
+++ b/data/net_2_0/machine.config
@@ -84,6 +84,10 @@
<section name="serviceHostingEnvironment" \
type="System.ServiceModel.Configuration.ServiceHostingEnvironmentSection, \
System.ServiceModel, Version=3.0.0.0, Culture=neutral, \
PublicKeyToken=b77a5c561934e089" /> <section name="services" \
type="System.ServiceModel.Configuration.ServicesSection, System.ServiceModel, \
Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> \
</sectionGroup> + <sectionGroup name="system.transactions" \
type="System.Transactions.Configuration.TransactionsSectionGroup, \
System.Transactions, Version=2.0.0.0, Culture=neutral, \
PublicKeyToken=b77a5c561934e089, Custom=null"> + <section name="defaultSettings" \
type="System.Transactions.Configuration.DefaultSettingsSection, System.Transactions, \
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, Custom=null"/> \
+ <section name="machineSettings" \
type="System.Transactions.Configuration.MachineSettingsSection, System.Transactions, \
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, Custom=null" \
allowDefinition="MachineOnly" allowExeDefinition="MachineOnly"/> + </sectionGroup>
<section name="system.webServer" type="System.Configuration.IgnoreSection, \
System.Configuration, Version=2.0.0.0, Culture=neutral, \
PublicKeyToken=b03f5f7f11d50a3a" /> <section name="uri" \
type="System.Configuration.UriSection, System, Version=2.0.0.0, Culture=neutral, \
PublicKeyToken=b77a5c561934e089" /> </configSections>
Modified: data/net_4_0/machine.config
===================================================================
--- a/data/net_4_0/machine.config
+++ b/data/net_4_0/machine.config
@@ -98,6 +98,10 @@
<section name="routing" \
type="System.ServiceModel.Routing.Configuration.RoutingSection, \
System.ServiceModel.Routing, Version=4.0.0.0, Culture=neutral, \
PublicKeyToken=31bf3856ad364e35"/> <section name="protocolMapping" \
type="System.ServiceModel.Configuration.ProtocolMappingSection, System.ServiceModel, \
Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/> </sectionGroup>
+ <sectionGroup name="system.transactions" \
type="System.Transactions.Configuration.TransactionsSectionGroup, \
System.Transactions, Version=4.0.0.0, Culture=neutral, \
PublicKeyToken=b77a5c561934e089, Custom=null"> + <section name="defaultSettings" \
type="System.Transactions.Configuration.DefaultSettingsSection, System.Transactions, \
Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, Custom=null"/> \
+ <section name="machineSettings" \
type="System.Transactions.Configuration.MachineSettingsSection, System.Transactions, \
Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, Custom=null" \
allowDefinition="MachineOnly" allowExeDefinition="MachineOnly"/> + </sectionGroup>
<section name="system.webServer" type="System.Configuration.IgnoreSection, \
System.Configuration, Version=4.0.0.0, Culture=neutral, \
PublicKeyToken=b03f5f7f11d50a3a" /> <section name="uri" \
type="System.Configuration.UriSection, System, Version=4.0.0.0, Culture=neutral, \
PublicKeyToken=b77a5c561934e089" /> <sectionGroup name="system.runtime.caching" \
type="System.Runtime.Caching.Configuration.CachingSectionGroup, \
System.Runtime.Caching, Version=4.0.0.0, Culture=neutral, \
PublicKeyToken=b03f5f7f11d50a3a">
Commit: dead19bc1e4f94ef0fc0524a7570b026f891bf10
Author: Marek Habersack <grendel@twistedcode.net>
Date: 01/27/2011 09:36:45
URL: https://github.com/mono/mono/commit/dead19bc1e4f94ef0fc0524a7570b026f891bf10
[asp.net] A bunch of fixes related to the default VirtualPathProvider (needed for \
Orchard)
* DefaultVirtualDirectory is now more careful when snipping off parts of the path \
passed to its constructor. Before removing the file part it checks whether the file \
indeed exists. Also sealed the class and made it use generic List instead of \
ArrayList
* HttpRequest does not normalize mapped paths when converting them to absolute ones. \
This is to avoid errors when path like "~/bin/../../file.txt" is passed to MapPath.
* VirtualPathUtility.ToAbsolute overload with normalize parameter really doesn't \
normalize the resulting path now.
Changed paths:
M mcs/class/System.Web/System.Web.Hosting/DefaultVirtualDirectory.cs
M mcs/class/System.Web/System.Web/HttpRequest.cs
M mcs/class/System.Web/System.Web/VirtualPathUtility.cs
Modified: mcs/class/System.Web/System.Web.Hosting/DefaultVirtualDirectory.cs
===================================================================
--- a/mcs/class/System.Web/System.Web.Hosting/DefaultVirtualDirectory.cs
+++ b/mcs/class/System.Web/System.Web.Hosting/DefaultVirtualDirectory.cs
@@ -28,15 +28,14 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
-
using System;
using System.Collections;
+using System.Collections.Generic;
using System.IO;
namespace System.Web.Hosting {
- class DefaultVirtualDirectory : VirtualDirectory
+ sealed class DefaultVirtualDirectory : VirtualDirectory
{
string phys_dir;
string virtual_dir;
@@ -50,33 +49,37 @@ namespace System.Web.Hosting {
{
if (phys_dir == null) {
string vpath = VirtualPath;
- virtual_dir = VirtualPathUtility.GetDirectory (vpath);
- phys_dir = HostingEnvironment.MapPath (virtual_dir);
+ string path = HostingEnvironment.MapPath (vpath);
+ if (File.Exists (path)) {
+ virtual_dir = VirtualPathUtility.GetDirectory (vpath);
+ phys_dir = HostingEnvironment.MapPath (virtual_dir);
+ } else {
+ virtual_dir = VirtualPathUtility.AppendTrailingSlash (vpath);
+ phys_dir = path;
+ }
}
}
- ArrayList AddDirectories (ArrayList list, string dir)
+ List <VirtualFileBase> AddDirectories (List <VirtualFileBase> list, string dir)
{
- foreach (string name in Directory.GetDirectories (phys_dir)) {
- string vdir = VirtualPathUtility.Combine (virtual_dir, Path.GetFileName (name));
- list.Add (new DefaultVirtualDirectory (vdir));
- }
+ foreach (string name in Directory.GetDirectories (phys_dir))
+ list.Add (new DefaultVirtualDirectory (VirtualPathUtility.Combine (virtual_dir, \
Path.GetFileName (name)))); +
return list;
}
- ArrayList AddFiles (ArrayList list, string dir)
+ List <VirtualFileBase> AddFiles (List <VirtualFileBase> list, string dir)
{
- foreach (string name in Directory.GetFiles (phys_dir)) {
- string vdir = VirtualPathUtility.Combine (virtual_dir, Path.GetFileName (name));
- list.Add (new DefaultVirtualFile (vdir));
- }
+ foreach (string name in Directory.GetFiles (phys_dir))
+ list.Add (new DefaultVirtualFile (VirtualPathUtility.Combine (virtual_dir, \
Path.GetFileName (name)))); +
return list;
}
public override IEnumerable Children {
get {
Init ();
- ArrayList list = new ArrayList ();
+ var list = new List <VirtualFileBase> ();
AddDirectories (list, phys_dir);
return AddFiles (list, phys_dir);
}
@@ -85,19 +88,17 @@ namespace System.Web.Hosting {
public override IEnumerable Directories {
get {
Init ();
- ArrayList list = new ArrayList ();
- return AddDirectories (list, phys_dir);
+ return AddDirectories (new List <VirtualFileBase> (), phys_dir);
}
}
public override IEnumerable Files {
get {
Init ();
- ArrayList list = new ArrayList ();
- return AddFiles (list, phys_dir);
+ return AddFiles (new List <VirtualFileBase> (), phys_dir);
}
}
}
}
-#endif
+
Modified: mcs/class/System.Web/System.Web/HttpRequest.cs
===================================================================
--- a/mcs/class/System.Web/System.Web/HttpRequest.cs
+++ b/mcs/class/System.Web/System.Web/HttpRequest.cs
@@ -1387,9 +1387,9 @@ namespace System.Web
baseVirtualDir = appVirtualPath;
virtualPath = VirtualPathUtility.Combine (VirtualPathUtility.AppendTrailingSlash \
(baseVirtualDir), virtualPath); if (!VirtualPathUtility.IsAbsolute (virtualPath))
- virtualPath = VirtualPathUtility.ToAbsolute (virtualPath);
+ virtualPath = VirtualPathUtility.ToAbsolute (virtualPath, false);
} else if (!VirtualPathUtility.IsAbsolute (virtualPath))
- virtualPath = VirtualPathUtility.ToAbsolute (virtualPath);
+ virtualPath = VirtualPathUtility.ToAbsolute (virtualPath, false);
bool isAppVirtualPath = String.Compare (virtualPath, appVirtualPath, \
RuntimeHelpers.StringComparison) == 0; appVirtualPath = \
VirtualPathUtility.AppendTrailingSlash (appVirtualPath);
Modified: mcs/class/System.Web/System.Web/VirtualPathUtility.cs
===================================================================
--- a/mcs/class/System.Web/System.Web/VirtualPathUtility.cs
+++ b/mcs/class/System.Web/System.Web/VirtualPathUtility.cs
@@ -253,7 +253,7 @@ namespace System.Web {
if (virtualPath.Length == 1 && virtualPath [0] == '~')
return apppath;
- return ToAbsolute (virtualPath,apppath);
+ return ToAbsolute (virtualPath, apppath, normalize);
}
// If virtualPath is:
Commit: 77f13bc288c28f18ed45f2678a19315c4ba74278
Author: Zoltan Varga <vargaz@gmail.com>
Date: 01/27/2011 11:25:07
URL: https://github.com/mono/mono/commit/77f13bc288c28f18ed45f2678a19315c4ba74278
Increase an aot buffer size again.
Changed paths:
M mono/mini/aot-compiler.c
Modified: mono/mini/aot-compiler.c
===================================================================
--- a/mono/mini/aot-compiler.c
+++ b/mono/mini/aot-compiler.c
@@ -3809,7 +3809,7 @@ emit_exception_debug_info (MonoAotCompile *acfg, MonoCompile \
*cfg)
seq_points = cfg->seq_point_info;
- buf_size = header->num_clauses * 256 + debug_info_size + 1024 + (seq_points ? \
(seq_points->len * 64) : 0) + cfg->gc_map_size; + buf_size = header->num_clauses * \
256 + debug_info_size + 2048 + (seq_points ? (seq_points->len * 64) : 0) + \
cfg->gc_map_size; p = buf = g_malloc (buf_size);
#ifdef MONO_ARCH_HAVE_XP_UNWIND
Commit: b8bf630538e34654e77f91b5cae64477e97f378e
Author: Zoltan Varga <vargaz@gmail.com>
Date: 01/27/2011 13:28:18
URL: https://github.com/mono/mono/commit/b8bf630538e34654e77f91b5cae64477e97f378e
Fix AOT support for types in the EXPORTEDTYPE table.
Changed paths:
M mono/metadata/class.c
Modified: mono/metadata/class.c
===================================================================
--- a/mono/metadata/class.c
+++ b/mono/metadata/class.c
@@ -7044,7 +7044,8 @@ mono_class_from_name (MonoImage *image, const char* name_space, \
const char *name name = buf;
}
- if (get_class_from_name) {
+ /* FIXME: get_class_from_name () can't handle types in the EXPORTEDTYPE table */
+ if (get_class_from_name && image->tables [MONO_TABLE_EXPORTEDTYPE].rows == 0) {
gboolean res = get_class_from_name (image, name_space, name, &class);
if (res) {
if (!class)
Commit: 2151a961f8cb407c35df3f77679f5095d9c5091d
Author: Gonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Date: 01/27/2011 15:47:53
URL: https://github.com/mono/mono/commit/2151a961f8cb407c35df3f77679f5095d9c5091d
[HttpListener] Set each cookie in its own header
Send a Set-Cookie header per cookie instead of a Set-Cookie2 with
multiple cookies.
Fixes bug #667550.
Changed paths:
M mcs/class/System/System.Net/HttpListenerResponse.cs
M mcs/class/System/System.Net/WebHeaderCollection.cs
Modified: mcs/class/System/System.Net/HttpListenerResponse.cs
===================================================================
--- a/mcs/class/System/System.Net/HttpListenerResponse.cs
+++ b/mcs/class/System/System.Net/HttpListenerResponse.cs
@@ -471,20 +471,13 @@ namespace System.Net {
headers.SetInternal ("Location", location);
if (cookies != null) {
- bool firstDone = false;
- StringBuilder cookieSB = new StringBuilder ();
- foreach (Cookie cookie in cookies) {
- if (firstDone)
- cookieSB.Append (",");
- firstDone = true;
- cookieSB.Append (cookie.ToClientString ());
- }
- headers.SetInternal("Set-Cookie2", cookieSB.ToString ());
+ foreach (Cookie cookie in cookies)
+ headers.SetInternal ("Set-Cookie", cookie.ToClientString ());
}
StreamWriter writer = new StreamWriter (ms, encoding);
writer.Write ("HTTP/{0} {1} {2}\r\n", version, status_code, status_description);
- string headers_str = headers.ToString ();
+ string headers_str = headers.ToStringMultiValue ();
writer.Write (headers_str);
writer.Flush ();
int preamble = encoding.GetPreamble ().Length;
Modified: mcs/class/System/System.Net/WebHeaderCollection.cs
===================================================================
--- a/mcs/class/System/System.Net/WebHeaderCollection.cs
+++ b/mcs/class/System/System.Net/WebHeaderCollection.cs
@@ -310,6 +310,30 @@ namespace System.Net
return Encoding.UTF8.GetBytes(ToString ());
}
+ internal string ToStringMultiValue ()
+ {
+ StringBuilder sb = new StringBuilder();
+
+ int count = base.Count;
+ for (int i = 0; i < count ; i++) {
+ string key = GetKey (i);
+ if (IsMultiValue (key)) {
+ foreach (string v in GetValues (i)) {
+ sb.Append (key)
+ .Append (": ")
+ .Append (v)
+ .Append ("\r\n");
+ }
+ } else {
+ sb.Append (key)
+ .Append (": ")
+ .Append (Get (i))
+ .Append ("\r\n");
+ }
+ }
+ return sb.Append("\r\n").ToString();
+ }
+
public override string ToString ()
{
StringBuilder sb = new StringBuilder();
@@ -320,7 +344,7 @@ namespace System.Net
.Append (": ")
.Append (Get (i))
.Append ("\r\n");
-
+
return sb.Append("\r\n").ToString();
}
#if !TARGET_JVM
Commit: d23601d20bef0f493fa1e53bdbf61453b3b71224
Author: Geoff Norton <grompf@sublimeintervention.com>
Date: 01/27/2011 23:23:27
URL: https://github.com/mono/mono/commit/d23601d20bef0f493fa1e53bdbf61453b3b71224
Dont leak loader errors in the aot compiler, as it could cause later methods to not \
get compiled erroneously
Changed paths:
M mono/mini/aot-compiler.c
Modified: mono/mini/aot-compiler.c
===================================================================
--- a/mono/mini/aot-compiler.c
+++ b/mono/mini/aot-compiler.c
@@ -2616,6 +2616,8 @@ add_wrappers (MonoAotCompile *acfg)
klass = mono_class_get (acfg->image, token);
if (klass)
add_method (acfg, mono_marshal_get_virtual_stelemref (mono_array_class_get \
(klass, 1))); + else
+ mono_loader_clear_error ();
}
/* castclass_with_check wrapper */
@@ -2652,6 +2654,11 @@ add_wrappers (MonoAotCompile *acfg)
token = MONO_TOKEN_TYPE_DEF | (i + 1);
klass = mono_class_get (acfg->image, token);
+ if (!klass) {
+ mono_loader_clear_error ();
+ continue;
+ }
+
if (klass->delegate && klass != mono_defaults.delegate_class && klass != \
mono_defaults.multicastdelegate_class && !klass->generic_container) { method = \
mono_get_delegate_invoke (klass);
@@ -2759,6 +2766,11 @@ add_wrappers (MonoAotCompile *acfg)
token = MONO_TOKEN_TYPE_DEF | (i + 1);
klass = mono_class_get (acfg->image, token);
+ if (!klass) {
+ mono_loader_clear_error ();
+ continue;
+ }
+
if (klass->valuetype && !klass->generic_container && can_marshal_struct (klass)) {
add_method (acfg, mono_marshal_get_struct_to_ptr (klass));
add_method (acfg, mono_marshal_get_ptr_to_struct (klass));
@@ -3118,8 +3130,10 @@ add_generic_instances (MonoAotCompile *acfg)
token = MONO_TOKEN_TYPE_SPEC | (i + 1);
klass = mono_class_get (acfg->image, token);
- if (!klass || klass->rank)
+ if (!klass || klass->rank) {
+ mono_loader_clear_error ();
continue;
+ }
add_generic_class (acfg, klass, FALSE);
}
@@ -3989,6 +4003,8 @@ emit_klass_info (MonoAotCompile *acfg, guint32 token)
gpointer iter = NULL;
if (!klass) {
+ mono_loader_clear_error ();
+
buf_size = 16;
p = buf = g_malloc (buf_size);
@@ -4760,6 +4776,7 @@ compile_method (MonoAotCompile *acfg, MonoMethod *method)
return;
}
if (cfg->exception_type != MONO_EXCEPTION_NONE) {
+ //printf ("E: %s\n", mono_method_full_name (method, TRUE));
/* Let the exception happen at runtime */
return;
}
@@ -5904,8 +5921,10 @@ emit_class_name_table (MonoAotCompile *acfg)
for (i = 0; i < acfg->image->tables [MONO_TABLE_TYPEDEF].rows; ++i) {
token = MONO_TOKEN_TYPE_DEF | (i + 1);
klass = mono_class_get (acfg->image, token);
- if (!klass)
+ if (!klass) {
+ mono_loader_clear_error ();
continue;
+ }
full_name = mono_type_get_name_full (mono_class_get_type (klass), \
MONO_TYPE_NAME_FORMAT_FULL_NAME); hash = mono_metadata_str_hash (full_name) % \
table_size; g_free (full_name);
Commit: abc793ffbd908c7443f558ede6697600c59d5ce7
Author: Geoff Norton <grompf@sublimeintervention.com>
Date: 01/28/2011 00:26:12
URL: https://github.com/mono/mono/commit/abc793ffbd908c7443f558ede6697600c59d5ce7
Bump SDB protocol so MonoDevelop can guard IL inspection of dynamic methods
Changed paths:
M mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs
M mono/mini/debugger-agent.c
Modified: mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs
===================================================================
--- a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs
+++ b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs
@@ -308,7 +308,7 @@ namespace Mono.Debugger.Soft
* with newer runtimes, and vice versa.
*/
public const int MAJOR_VERSION = 2;
- public const int MINOR_VERSION = 2;
+ public const int MINOR_VERSION = 3;
enum WPSuspendPolicy {
NONE = 0,
Modified: mono/mini/debugger-agent.c
===================================================================
--- a/mono/mini/debugger-agent.c
+++ b/mono/mini/debugger-agent.c
@@ -252,7 +252,7 @@ typedef struct {
#define HEADER_LENGTH 11
#define MAJOR_VERSION 2
-#define MINOR_VERSION 2
+#define MINOR_VERSION 3
typedef enum {
CMD_SET_VM = 1,
Commit: 54fe90cf1c60d1c7c6846f6daa24ecb910d9558b
Author: Zoltan Varga <vargaz@gmail.com>
Date: 01/28/2011 00:28:55
URL: https://github.com/mono/mono/commit/54fe90cf1c60d1c7c6846f6daa24ecb910d9558b
Add an AtLeast version to sdb's VersionInfo class.
Changed paths:
M mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs
Modified: mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs
===================================================================
--- a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs
+++ b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs
@@ -21,6 +21,16 @@ namespace Mono.Debugger.Soft
public int MinorVersion {
get; set;
}
+
+ /*
+ * Check that this version is at least major:minor
+ */
+ public bool AtLeast (int major, int minor) {
+ if ((MajorVersion > major) || ((MajorVersion == major && MinorVersion >= minor)))
+ return true;
+ else
+ return false;
+ }
}
class DebugInfo {
Commit: e0dd2115d62767393d4dad4026b246105e9b1097
Author: Geoff Norton <grompf@sublimeintervention.com>
Date: 01/28/2011 01:08:57
URL: https://github.com/mono/mono/commit/e0dd2115d62767393d4dad4026b246105e9b1097
Ensure we setup the vtable before accessing it
Changed paths:
M mono/metadata/icall.c
Modified: mono/metadata/icall.c
===================================================================
--- a/mono/metadata/icall.c
+++ b/mono/metadata/icall.c
@@ -7096,6 +7096,8 @@ ves_icall_MonoMethod_get_base_method (MonoReflectionMethod *m, \
gboolean definiti if (method->slot >= klass->vtable_size)
return m;
+ mono_class_setup_vtable (klass);
+
result = klass->vtable [method->slot];
if (result == NULL) {
/* It is an abstract method */
Commit: 8e4b73cb4a58cb4535c8d47d9e982eebf9982006
Author: Geoff Norton <grompf@sublimeintervention.com>
Date: 01/28/2011 19:05:21
URL: https://github.com/mono/mono/commit/8e4b73cb4a58cb4535c8d47d9e982eebf9982006
Avoid a crash when shutting down jit attached threads
Changed paths:
M mono/metadata/sgen-gc.c
Modified: mono/metadata/sgen-gc.c
===================================================================
--- a/mono/metadata/sgen-gc.c
+++ b/mono/metadata/sgen-gc.c
@@ -5836,7 +5836,15 @@ unregister_current_thread (void)
static void
unregister_thread (void *k)
{
- g_assert (!mono_domain_get ());
+ /* If a delegate is passed to native code and invoked on a thread we dont
+ * know about, the jit will register it with mono_jit_thead_attach, but
+ * we have no way of knowing when that thread goes away. SGen has a TSD
+ * so we assume that if the domain is still registered, we can detach
+ * the thread
+ */
+ if (mono_domain_get ())
+ mono_thread_detach ();
+
LOCK_GC;
unregister_current_thread ();
UNLOCK_GC;
Commit: 51a4f125d13b6bf9e718d4dc32b74f6be71950ce
Author: Geoff Norton <grompf@sublimeintervention.com>
Date: 01/29/2011 11:37:17
URL: https://github.com/mono/mono/commit/51a4f125d13b6bf9e718d4dc32b74f6be71950ce
Typo
Changed paths:
M mono/metadata/sgen-gc.c
Modified: mono/metadata/sgen-gc.c
===================================================================
--- a/mono/metadata/sgen-gc.c
+++ b/mono/metadata/sgen-gc.c
@@ -5843,7 +5843,7 @@ unregister_thread (void *k)
* the thread
*/
if (mono_domain_get ())
- mono_thread_detach ();
+ mono_thread_detach (mono_thread_current ());
LOCK_GC;
unregister_current_thread ();
Commit: 70adac78be756ebd14b20137a65cc5c2bb2bb2c2
Author: Zoltan Varga <vargaz@gmail.com>
Date: 01/29/2011 14:52:23
URL: https://github.com/mono/mono/commit/70adac78be756ebd14b20137a65cc5c2bb2bb2c2
Clear the 'need_rgctx_tramp' flag when creating a synchronized wrapper. Fixes
Changed paths:
M mono/mini/generics.cs
M mono/mini/mini-trampolines.c
Modified: mono/mini/generics.cs
===================================================================
--- a/mono/mini/generics.cs
+++ b/mono/mini/generics.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using System.Runtime.CompilerServices;
class Tests {
@@ -824,4 +825,27 @@ class Tests {
static T Unbox <T> (object o) {
return (T) o;
}
+
+ interface IDefaultRetriever
+ {
+ T GetDefault<T>();
+ }
+
+ class DefaultRetriever : IDefaultRetriever
+ {
+ [MethodImpl(MethodImplOptions.Synchronized)]
+ public T GetDefault<T>()
+ {
+ return default(T);
+ }
+ }
+
+ public static int test_0_regress_668095_synchronized_gshared () {
+ return DoSomething (new DefaultRetriever ());
+ }
+
+ static int DoSomething(IDefaultRetriever foo) {
+ int result = foo.GetDefault<int>();
+ return result;
+ }
}
Modified: mono/mini/mini-trampolines.c
===================================================================
--- a/mono/mini/mini-trampolines.c
+++ b/mono/mini/mini-trampolines.c
@@ -466,8 +466,10 @@ common_call_trampoline (mgreg_t *regs, guint8 *code, MonoMethod \
*m, guint8* tram ji = NULL;
/* Avoid recursion */
- if (!(ji && ji->method->wrapper_type == MONO_WRAPPER_SYNCHRONIZED))
+ if (!(ji && ji->method->wrapper_type == MONO_WRAPPER_SYNCHRONIZED)) {
m = mono_marshal_get_synchronized_wrapper (m);
+ need_rgctx_tramp = FALSE;
+ }
}
/* Calls made through delegates on platforms without delegate trampolines */
Commit: 07b052d9c645e03bdd7a9ac53c426394c26a2fe5
Author: Zoltan Varga <vargaz@gmail.com>
Date: 01/30/2011 01:00:30
URL: https://github.com/mono/mono/commit/07b052d9c645e03bdd7a9ac53c426394c26a2fe5
Don't crash when inlining static methods called using callvirt. Fixes #668170.
Changed paths:
M mono/mini/method-to-ir.c
Modified: mono/mini/method-to-ir.c
===================================================================
--- a/mono/mini/method-to-ir.c
+++ b/mono/mini/method-to-ir.c
@@ -4831,7 +4831,7 @@ inline_method (MonoCompile *cfg, MonoMethod *cmethod, \
MonoMethodSignature *fsig, guint32 prev_cil_offset_to_bb_len;
MonoMethod *prev_current_method;
MonoGenericContext *prev_generic_context;
- gboolean ret_var_set, prev_ret_var_set;
+ gboolean ret_var_set, prev_ret_var_set, virtual = FALSE;
g_assert (cfg->exception_type == MONO_EXCEPTION_NONE);
@@ -4878,7 +4878,6 @@ inline_method (MonoCompile *cfg, MonoMethod *cmethod, \
MonoMethodSignature *fsig, rvar = mono_compile_create_var (cfg, fsig->ret, \
OP_LOCAL); }
-
prev_locals = cfg->locals;
cfg->locals = mono_mempool_alloc0 (cfg->mempool, cheader->num_locals * sizeof \
(MonoInst*)); for (i = 0; i < cheader->num_locals; ++i)
@@ -4909,7 +4908,10 @@ inline_method (MonoCompile *cfg, MonoMethod *cmethod, \
MonoMethodSignature *fsig, prev_generic_context = cfg->generic_context;
prev_ret_var_set = cfg->ret_var_set;
- costs = mono_method_to_ir (cfg, cmethod, sbblock, ebblock, rvar, dont_inline, sp, \
real_offset, *ip == CEE_CALLVIRT); + if (*ip == CEE_CALLVIRT && !(cmethod->flags & \
METHOD_ATTRIBUTE_STATIC)) + virtual = TRUE;
+
+ costs = mono_method_to_ir (cfg, cmethod, sbblock, ebblock, rvar, dont_inline, sp, \
real_offset, virtual);
ret_var_set = cfg->ret_var_set;
Commit: 5a862ae52aef57ca76eda1ac2d05eb24eb7e9afc
Author: Zoltan Varga <vargaz@gmail.com>
Date: 01/30/2011 03:13:05
URL: https://github.com/mono/mono/commit/5a862ae52aef57ca76eda1ac2d05eb24eb7e9afc
Mark a newly added test as !FULLAOT.
Changed paths:
M mono/mini/generics.cs
Modified: mono/mini/generics.cs
===================================================================
--- a/mono/mini/generics.cs
+++ b/mono/mini/generics.cs
@@ -840,6 +840,7 @@ class Tests {
}
}
+ [Category ("!FULLAOT")]
public static int test_0_regress_668095_synchronized_gshared () {
return DoSomething (new DefaultRetriever ());
}
Commit: 9cffdf6cf4ab487c600966ce0db4b2bd3105d5b1
Author: Zoltan Varga <vargaz@gmail.com>
Date: 01/30/2011 03:13:36
URL: https://github.com/mono/mono/commit/9cffdf6cf4ab487c600966ce0db4b2bd3105d5b1
Improve hashing of MONO_PATCH_INFO_TYPE_FROM_HANDLE.
Changed paths:
M mono/mini/mini.c
Modified: mono/mini/mini.c
===================================================================
--- a/mono/mini/mini.c
+++ b/mono/mini/mini.c
@@ -2860,10 +2860,11 @@ mono_patch_info_hash (gconstpointer data)
switch (ji->type) {
case MONO_PATCH_INFO_RVA:
case MONO_PATCH_INFO_LDSTR:
- case MONO_PATCH_INFO_TYPE_FROM_HANDLE:
case MONO_PATCH_INFO_LDTOKEN:
case MONO_PATCH_INFO_DECLSEC:
return (ji->type << 8) | ji->data.token->token;
+ case MONO_PATCH_INFO_TYPE_FROM_HANDLE:
+ return (ji->type << 8) | ji->data.token->token | (ji->data.token->has_context ? \
(gsize)ji->data.token->context.class_inst : 0); case \
MONO_PATCH_INFO_INTERNAL_METHOD: return (ji->type << 8) | g_str_hash \
(ji->data.name); case MONO_PATCH_INFO_VTABLE:
Commit: af6065a81013aa185e01470356694dd3b7b0cd76
Author: Zoltan Varga <vargaz@gmail.com>
Date: 01/30/2011 03:13:51
URL: https://github.com/mono/mono/commit/af6065a81013aa185e01470356694dd3b7b0cd76
Fix some quadratic behavior in the AOT compiler.
Changed paths:
M mono/mini/aot-compiler.c
Modified: mono/mini/aot-compiler.c
===================================================================
--- a/mono/mini/aot-compiler.c
+++ b/mono/mini/aot-compiler.c
@@ -144,7 +144,7 @@ typedef struct MonoAotCompile {
GPtrArray *extra_methods;
GPtrArray *image_table;
GPtrArray *globals;
- GList *method_order;
+ GPtrArray *method_order;
guint32 *plt_got_info_offsets;
guint32 got_offset, plt_offset, plt_got_offset_base;
guint32 final_got_size;
@@ -2324,8 +2324,7 @@ add_method_full (MonoAotCompile *acfg, MonoMethod *method, \
gboolean extra, int d index = acfg->method_index;
add_method_with_index (acfg, method, index, extra);
- /* FIXME: Fix quadratic behavior */
- acfg->method_order = g_list_append (acfg->method_order, GUINT_TO_POINTER (index));
+ g_ptr_array_add (acfg->method_order, GUINT_TO_POINTER (index));
g_hash_table_insert (acfg->method_depth, method, GUINT_TO_POINTER (depth));
@@ -5029,7 +5028,8 @@ load_profile_files (MonoAotCompile *acfg)
int file_index, res, method_index, i;
char ver [256];
guint32 token;
- GList *unordered;
+ GList *unordered, *l;
+ gboolean found;
file_index = 0;
while (TRUE) {
@@ -5075,9 +5075,15 @@ load_profile_files (MonoAotCompile *acfg)
token = mono_method_get_token (method);
method_index = mono_metadata_token_index (token) - 1;
- if (!g_list_find (acfg->method_order, GUINT_TO_POINTER (method_index))) {
- acfg->method_order = g_list_append (acfg->method_order, GUINT_TO_POINTER \
(method_index)); + found = FALSE;
+ for (i = 0; i < acfg->method_order->len; ++i) {
+ if (g_ptr_array_index (acfg->method_order, i) == GUINT_TO_POINTER \
(method_index)) { + found = TRUE;
+ break;
+ }
}
+ if (!found)
+ g_ptr_array_add (acfg->method_order, GUINT_TO_POINTER (method_index));
} else {
//printf ("No method found matching '%s'.\n", name);
}
@@ -5087,15 +5093,20 @@ load_profile_files (MonoAotCompile *acfg)
/* Add missing methods */
unordered = NULL;
- for (i = 0; i < acfg->image->tables [MONO_TABLE_METHOD].rows; ++i) {
- if (!g_list_find (acfg->method_order, GUINT_TO_POINTER (i)))
- unordered = g_list_prepend (unordered, GUINT_TO_POINTER (i));
+ for (method_index = 0; method_index < acfg->image->tables [MONO_TABLE_METHOD].rows; \
++method_index) { + found = FALSE;
+ for (i = 0; i < acfg->method_order->len; ++i) {
+ if (g_ptr_array_index (acfg->method_order, i) == GUINT_TO_POINTER (method_index)) \
{ + found = TRUE;
+ break;
+ }
+ }
+ if (!found)
+ unordered = g_list_prepend (unordered, GUINT_TO_POINTER (method_index));
}
unordered = g_list_reverse (unordered);
- if (acfg->method_order)
- g_list_last (acfg->method_order)->next = unordered;
- else
- acfg->method_order = unordered;
+ for (l = unordered; l; l = l->next)
+ g_ptr_array_add (acfg->method_order, l->data);
}
/* Used by the LLVM backend */
@@ -5253,10 +5264,9 @@ emit_llvm_file (MonoAotCompile *acfg)
static void
emit_code (MonoAotCompile *acfg)
{
- int i;
+ int oindex, i;
char symbol [256];
char end_symbol [256];
- GList *l;
#if defined(TARGET_POWERPC64)
sprintf (symbol, ".Lgot_addr");
@@ -5302,13 +5312,12 @@ emit_code (MonoAotCompile *acfg)
emit_bytes (acfg, pad_buffer, kPaddingSize);
}
#endif
-
- for (l = acfg->method_order; l != NULL; l = l->next) {
+ for (oindex = 0; oindex < acfg->method_order->len; ++oindex) {
MonoCompile *cfg;
MonoMethod *method;
- i = GPOINTER_TO_UINT (l->data);
+ i = GPOINTER_TO_UINT (g_ptr_array_index (acfg->method_order, oindex));
cfg = acfg->cfgs [i];
@@ -5391,15 +5400,14 @@ emit_code (MonoAotCompile *acfg)
static void
emit_info (MonoAotCompile *acfg)
{
- int i;
+ int oindex, i;
char symbol [256];
- GList *l;
gint32 *offsets;
offsets = g_new0 (gint32, acfg->nmethods);
- for (l = acfg->method_order; l != NULL; l = l->next) {
- i = GPOINTER_TO_UINT (l->data);
+ for (oindex = 0; oindex < acfg->method_order->len; ++oindex) {
+ i = GPOINTER_TO_UINT (g_ptr_array_index (acfg->method_order, oindex));
if (acfg->cfgs [i]) {
emit_method_info (acfg, acfg->cfgs [i]);
@@ -6710,6 +6718,7 @@ acfg_create (MonoAssembly *ass, guint32 opts)
acfg->unwind_info_offsets = g_hash_table_new (NULL, NULL);
acfg->unwind_ops = g_ptr_array_new ();
acfg->method_label_hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, \
NULL); + acfg->method_order = g_ptr_array_new ();
InitializeCriticalSection (&acfg->mutex);
return acfg;
Commit: abf855afe1a37520a484ac26f888bed83d200a9b
Author: Miguel de Icaza <miguel@gnome.org>
Date: 01/30/2011 11:33:00
URL: https://github.com/mono/mono/commit/abf855afe1a37520a484ac26f888bed83d200a9b
[repl] Fix running specified scripts from command line, allow #! syntax, add print \
command
We were calling the Reset () method after we had initialized the driver
with the new command line arguments, clearing the list of files to execute
before we executed them.
Added support for #! in the csharp repl, and added the print() command to
the InteractiveBase
Changed paths:
M mcs/mcs/eval.cs
M mcs/tools/csharp/repl.cs
Modified: mcs/mcs/eval.cs
===================================================================
--- a/mcs/mcs/eval.cs
+++ b/mcs/mcs/eval.cs
@@ -115,6 +115,7 @@ namespace Mono.CSharp
if (inited)
return new string [0];
+ CompilerCallableEntryPoint.Reset ();
var crp = new ConsoleReportPrinter ();
driver = Driver.Create (args, false, crp);
if (driver == null)
@@ -123,7 +124,6 @@ namespace Mono.CSharp
crp.Fatal = driver.fatal_errors;
ctx = driver.ctx;
- CompilerCallableEntryPoint.Reset ();
RootContext.ToplevelTypes = new ModuleContainer (ctx);
var startup_files = new List<string> ();
@@ -1044,6 +1044,16 @@ namespace Mono.CSharp
{
Evaluator.LoadAssembly (assembly);
}
+
+ static public void print (string text)
+ {
+ Output.WriteLine (text);
+ }
+
+ static public void print (string fmt, params object [] args)
+ {
+ Output.WriteLine (fmt, args);
+ }
#endif
/// <summary>
@@ -1060,6 +1070,7 @@ namespace Mono.CSharp
" Prompt - The prompt used by the C# shell\n" +
" ContinuationPrompt - The prompt for partial input\n" +
" Time(() -> { }) - Times the specified code\n" +
+ " print (obj) - Shorthand for Console.WriteLine\n" +
" quit; - You'll never believe it - this quits the repl!\n" \
+ " help; - This help text\n";
}
Modified: mcs/tools/csharp/repl.cs
===================================================================
--- a/mcs/tools/csharp/repl.cs
+++ b/mcs/tools/csharp/repl.cs
@@ -59,7 +59,6 @@ namespace Mono {
} catch {
return 1;
}
-
return new CSharpShell ().Run (startup_files);
}
}
@@ -202,11 +201,20 @@ namespace Mono {
void ExecuteSources (IEnumerable<string> sources, bool ignore_errors)
{
+ bool first = true;
+
foreach (string file in sources){
try {
try {
using (System.IO.StreamReader r = System.IO.File.OpenText (file)){
- ReadEvalPrintLoopWith (p => r.ReadLine ());
+ ReadEvalPrintLoopWith (p => {
+ var line = r.ReadLine ();
+ if (first && line.StartsWith ("#!")){
+ line = r.ReadLine ();
+ first = false;
+ }
+ return line;
+ });
}
} catch (FileNotFoundException){
Console.Error.WriteLine ("cs2001: Source file `{0}' not found", file);
Commit: 0b17f7feab9c03ed96a5cf0c115a180fe900ee8a
Author: Miguel de Icaza <miguel@gnome.org>
Date: 01/30/2011 11:41:09
URL: https://github.com/mono/mono/commit/0b17f7feab9c03ed96a5cf0c115a180fe900ee8a
Document csharp #! support
Changed paths:
M man/csharp.1
Modified: man/csharp.1
===================================================================
--- a/man/csharp.1
+++ b/man/csharp.1
@@ -29,6 +29,16 @@ target process.
.PP
Files specified in the command line will be loaded and executed as
scripts.
+.PP
+Starting with Mono 2.10, the
+.I csharp
+command can be used as an interpreter executed by executables flagged
+with the Unix execute attribute. To do this, make the first line of
+your C# source code look like this:
+.nf
+"#!/usr/bin/csharp"
+Console.WriteLine ("Hello, World");
+.fi
.SH OPTIONS
.TP
.I "\-\-attach"
Commit: b56b8ad2c3d96938bb48028c999905791bf14661
Author: Miguel de Icaza <miguel@gnome.org>
Date: 01/30/2011 12:06:10
URL: https://github.com/mono/mono/commit/b56b8ad2c3d96938bb48028c999905791bf14661
[repl] Add support for -e EXPRESSION to the csharp command
Changed paths:
M man/csharp.1
M mcs/mcs/driver.cs
M mcs/mcs/eval.cs
M mcs/tools/csharp/repl.cs
Modified: man/csharp.1
===================================================================
--- a/man/csharp.1
+++ b/man/csharp.1
@@ -6,7 +6,7 @@
.SH NAME
csharp, gsharp \- Interactive C# Shell
.SH SYNOPSIS
-.B csharp [--attach PID] [file1 [file2]]
+.B csharp [--attach PID] [-e EXPRESSION] [file1 [file2]]
[options]
.P
.B gsharp [file1 [file2]]
@@ -40,6 +40,11 @@ your C# source code look like this:
Console.WriteLine ("Hello, World");
.fi
.SH OPTIONS
+The commands accept all of the commands that are available to the
+.I mcs
+command, so you can reference assemblies, specify paths, language
+level and so on from the command line. In addition, the following
+command line options are supported:
.TP
.I "\-\-attach"
This is an advanced option and should only be used if you have a deep
@@ -52,6 +57,9 @@ special measures to avoid crashing the target application while \
using it. For example, you might have to take the proper locks before
issuing any commands that might affect the target process state, or
sending commands through a method dispatcher.
+.TP
+.I "\-e" EXPRESSION
+This will evaluate the specified C# EXPRESSION and exit
.SH OPERATION
Once you launch the csharp command, you will be greeted with the
interactive prompt:
Modified: mcs/mcs/driver.cs
===================================================================
--- a/mcs/mcs/driver.cs
+++ b/mcs/mcs/driver.cs
@@ -42,6 +42,11 @@ namespace Mono.CSharp
static readonly char[] argument_value_separator = new char [] { ';', ',' };
+#if !STATIC
+ // The expression to evaluate if -e is passed to the REPL
+ public static string EvalExpression;
+#endif
+
private Driver (CompilerContext ctx)
{
this.ctx = ctx;
@@ -749,6 +754,17 @@ namespace Mono.CSharp
RootContext.LoadDefaultReferences = false;
return true;
+#if !STATIC
+ case "-e":
+ if ((i + 1) >= args.Length){
+ Report.Error (
+ 1900,
+ "-e requires an expression");
+ Environment.Exit (1);
+ }
+ EvalExpression = args [++i];
+ return true;
+#endif
default:
if (arg.StartsWith ("--fatal")){
if (arg.StartsWith ("--fatal=")){
@@ -1649,7 +1665,7 @@ namespace Mono.CSharp
{
CSharpParser.yacc_verbose_flag = 0;
Location.Reset ();
-
+
if (!full_flag)
return;
Modified: mcs/mcs/eval.cs
===================================================================
--- a/mcs/mcs/eval.cs
+++ b/mcs/mcs/eval.cs
@@ -148,6 +148,12 @@ namespace Mono.CSharp
}
}
+ public static string StartupEvalExpression {
+ get {
+ return Driver.EvalExpression;
+ }
+ }
+
static void Init ()
{
Init (new string [0]);
Modified: mcs/tools/csharp/repl.cs
===================================================================
--- a/mcs/tools/csharp/repl.cs
+++ b/mcs/tools/csharp/repl.cs
@@ -172,7 +172,7 @@ namespace Mono {
Evaluate ("using System; using System.Linq; using System.Collections.Generic; \
using System.Collections;"); }
- void InitTerminal ()
+ void InitTerminal (bool show_banner)
{
#if ON_DOTNET
is_unix = false;
@@ -194,7 +194,7 @@ namespace Mono {
// Report.Stderr = Console.Out;
SetupConsole ();
- if (isatty)
+ if (isatty && show_banner)
Console.WriteLine ("Mono C# Shell, type \"help;\" for help\n\nEnter statements \
below.");
}
@@ -273,7 +273,7 @@ namespace Mono {
public int ReadEvalPrintLoop ()
{
if (startup_files != null && startup_files.Length == 0)
- InitTerminal ();
+ InitTerminal (startup_files.Length == 0 && Evaluator.StartupEvalExpression == \
null);
InitializeUsing ();
@@ -282,9 +282,17 @@ namespace Mono {
//
// Interactive or startup files provided?
//
+ string startup_expression = Evaluator.StartupEvalExpression;
+
if (startup_files.Length != 0)
ExecuteSources (startup_files, false);
- else
+ else if (Evaluator.StartupEvalExpression != null){
+ ReadEvalPrintLoopWith (p => {
+ var ret = startup_expression;
+ startup_expression = null;
+ return ret;
+ });
+ } else
ReadEvalPrintLoopWith (GetLine);
return 0;
Commit: a11120ae3619f53529c83d34384127720181b68a
Author: Miguel de Icaza <miguel@gnome.org>
Date: 01/30/2011 17:43:44
URL: https://github.com/mono/mono/commit/a11120ae3619f53529c83d34384127720181b68a
[repl] Fix running specified scripts from command line, allow #! syntax, add print \
command
We were calling the Reset () method after we had initialized the driver
with the new command line arguments, clearing the list of files to execute
before we executed them.
Added support for #! in the csharp repl, and added the print() command to
the InteractiveBase
Add a better way of dealing with -e, without adding hacks to the core that wont work
in the future
Changed paths:
M mcs/mcs/driver.cs
M mcs/mcs/eval.cs
M mcs/tools/csharp/repl.cs
Modified: mcs/mcs/driver.cs
===================================================================
--- a/mcs/mcs/driver.cs
+++ b/mcs/mcs/driver.cs
@@ -42,21 +42,16 @@ namespace Mono.CSharp
static readonly char[] argument_value_separator = new char [] { ';', ',' };
-#if !STATIC
- // The expression to evaluate if -e is passed to the REPL
- public static string EvalExpression;
-#endif
-
private Driver (CompilerContext ctx)
{
this.ctx = ctx;
}
- public static Driver Create (string[] args, bool require_files, ReportPrinter \
printer) + public static Driver Create (string[] args, bool require_files, \
Func<string [], int, int> unknown_option_parser, ReportPrinter printer) {
Driver d = new Driver (new CompilerContext (new Report (printer)));
- if (!d.ParseArguments (args, require_files))
+ if (!d.ParseArguments (args, require_files, unknown_option_parser))
return null;
return d;
@@ -239,7 +234,7 @@ namespace Mono.CSharp
{
Location.InEmacs = Environment.GetEnvironmentVariable ("EMACS") == "t";
var crp = new ConsoleReportPrinter ();
- Driver d = Driver.Create (args, true, crp);
+ Driver d = Driver.Create (args, true, null, crp);
if (d == null)
return 1;
@@ -346,7 +341,7 @@ namespace Mono.CSharp
Location.AddFile (Report, f);
}
- bool ParseArguments (string[] args, bool require_files)
+ bool ParseArguments (string[] args, bool require_files, Func<string [], int, int> \
unknown_option_parser) {
List<string> response_file_list = null;
bool parsing_options = true;
@@ -398,6 +393,14 @@ namespace Mono.CSharp
if (CSCParseOption (csc_opt, ref args))
continue;
+ if (unknown_option_parser != null){
+ var ret = unknown_option_parser (args, i);
+ if (ret != -1){
+ i = ret;
+ return true;
+ }
+ }
+
Error_WrongOption (arg);
return false;
}
@@ -754,17 +757,6 @@ namespace Mono.CSharp
RootContext.LoadDefaultReferences = false;
return true;
-#if !STATIC
- case "-e":
- if ((i + 1) >= args.Length){
- Report.Error (
- 1900,
- "-e requires an expression");
- Environment.Exit (1);
- }
- EvalExpression = args [++i];
- return true;
-#endif
default:
if (arg.StartsWith ("--fatal")){
if (arg.StartsWith ("--fatal=")){
@@ -1635,7 +1627,7 @@ namespace Mono.CSharp
{
try {
StreamReportPrinter srp = new StreamReportPrinter (error);
- Driver d = Driver.Create (args, true, srp);
+ Driver d = Driver.Create (args, true, null, srp);
if (d == null)
return false;
Modified: mcs/mcs/eval.cs
===================================================================
--- a/mcs/mcs/eval.cs
+++ b/mcs/mcs/eval.cs
@@ -92,6 +92,11 @@ namespace Mono.CSharp
return ctx.Report.SetPrinter (report_printer);
}
+ public static string [] InitAndGetStartupFiles (string [] args)
+ {
+ return InitAndGetStartupFiles (args, null);
+ }
+
/// <summary>
/// Optional initialization for the Evaluator.
/// </summary>
@@ -108,8 +113,13 @@ namespace Mono.CSharp
///
/// This method return an array of strings that contains any
/// files that were specified in `args'.
+ ///
+ /// If the unknownOptionParser is not null, this function is invoked
+ /// with the current args array and the index of the option that is not
+ /// known. A value of true means that the value was processed, otherwise
+ /// it will be reported as an error
/// </remarks>
- public static string [] InitAndGetStartupFiles (string [] args)
+ public static string [] InitAndGetStartupFiles (string [] args, Func<string [], \
int, int> unknownOptionParser) {
lock (evaluator_lock){
if (inited)
@@ -117,7 +127,7 @@ namespace Mono.CSharp
CompilerCallableEntryPoint.Reset ();
var crp = new ConsoleReportPrinter ();
- driver = Driver.Create (args, false, crp);
+ driver = Driver.Create (args, false, unknownOptionParser, crp);
if (driver == null)
throw new Exception ("Failed to create compiler driver with the given \
arguments");
@@ -148,12 +158,6 @@ namespace Mono.CSharp
}
}
- public static string StartupEvalExpression {
- get {
- return Driver.EvalExpression;
- }
- }
-
static void Init ()
{
Init (new string [0]);
Modified: mcs/tools/csharp/repl.cs
===================================================================
--- a/mcs/tools/csharp/repl.cs
+++ b/mcs/tools/csharp/repl.cs
@@ -32,6 +32,7 @@ using Mono.CSharp;
namespace Mono {
public class Driver {
+ public static string StartupEvalExpression;
static int Main (string [] args)
{
@@ -53,7 +54,7 @@ namespace Mono {
{
string[] startup_files;
try {
- startup_files = Evaluator.InitAndGetStartupFiles (args);
+ startup_files = Evaluator.InitAndGetStartupFiles (args, HandleExtraArguments);
Evaluator.DescribeTypeExpressions = true;
Evaluator.SetInteractiveBaseClass (typeof (InteractiveBaseShell));
} catch {
@@ -61,6 +62,16 @@ namespace Mono {
}
return new CSharpShell ().Run (startup_files);
}
+
+ static int HandleExtraArguments (string [] args, int pos)
+ {
+ if (args [pos] == "-e" && pos+1 < args.Length){
+ StartupEvalExpression = args [pos+1];
+ return pos+1;
+ }
+ return -1;
+ }
+
}
public class InteractiveBaseShell : InteractiveBase {
@@ -201,11 +212,11 @@ namespace Mono {
void ExecuteSources (IEnumerable<string> sources, bool ignore_errors)
{
- bool first = true;
-
foreach (string file in sources){
try {
try {
+ bool first = true;
+
using (System.IO.StreamReader r = System.IO.File.OpenText (file)){
ReadEvalPrintLoopWith (p => {
var line = r.ReadLine ();
@@ -273,23 +284,18 @@ namespace Mono {
public int ReadEvalPrintLoop ()
{
if (startup_files != null && startup_files.Length == 0)
- InitTerminal (startup_files.Length == 0 && Evaluator.StartupEvalExpression == \
null); + InitTerminal (startup_files.Length == 0 && Driver.StartupEvalExpression \
== null);
InitializeUsing ();
LoadStartupFiles ();
- //
- // Interactive or startup files provided?
- //
- string startup_expression = Evaluator.StartupEvalExpression;
-
if (startup_files.Length != 0)
ExecuteSources (startup_files, false);
- else if (Evaluator.StartupEvalExpression != null){
+ else if (Driver.StartupEvalExpression != null){
ReadEvalPrintLoopWith (p => {
- var ret = startup_expression;
- startup_expression = null;
+ var ret = Driver.StartupEvalExpression;
+ Driver.StartupEvalExpression = null;
return ret;
});
} else
Commit: b057032956aa6e243a7f8f30c368fbbf57e7fa24
Author: Atsushi Eno <atsushi@ximian.com>
Committer: Miguel de Icaza <miguel@gnome.org>
Date: 01/30/2011 23:38:57
URL: https://github.com/mono/mono/commit/b057032956aa6e243a7f8f30c368fbbf57e7fa24
add public NetTcpSecurity .ctor() and close #667429.
Changed paths:
M mcs/class/System.ServiceModel/System.ServiceModel/NetTcpSecurity.cs
Modified: mcs/class/System.ServiceModel/System.ServiceModel/NetTcpSecurity.cs
===================================================================
--- a/mcs/class/System.ServiceModel/System.ServiceModel/NetTcpSecurity.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel/NetTcpSecurity.cs
@@ -33,6 +33,12 @@ namespace System.ServiceModel
{
public sealed class NetTcpSecurity
{
+#if NET_4_0
+ public NetTcpSecurity ()
+ {
+ }
+#endif
+
internal NetTcpSecurity (SecurityMode mode)
{
this.mode = mode;
Commit: 2d13b63f4e6ad1cad74efe4bcb45d86f0d0540d2
Author: Atsushi Eno <atsushi@ximian.com>
Date: 01/30/2011 23:46:55
URL: https://github.com/mono/mono/commit/2d13b63f4e6ad1cad74efe4bcb45d86f0d0540d2
Fixed bug #666872; XElement.Changed and .Changing were not triggered.
Changed paths:
M mcs/class/System.Xml.Linq/System.Xml.Linq/XContainer.cs
M mcs/class/System.Xml.Linq/System.Xml.Linq/XObject.cs
M mcs/class/System.Xml.Linq/Test/System.Xml.Linq/XElementTest.cs
Modified: mcs/class/System.Xml.Linq/System.Xml.Linq/XContainer.cs
===================================================================
--- a/mcs/class/System.Xml.Linq/System.Xml.Linq/XContainer.cs
+++ b/mcs/class/System.Xml.Linq/System.Xml.Linq/XContainer.cs
@@ -71,10 +71,16 @@ namespace System.Xml.Linq
return;
foreach (object o in XUtil.ExpandArray (content))
+ {
if (!OnAddingObject (o, false, last, false))
+ {
+ OnAddingObject ();
AddNode (XUtil.ToNode (o));
+ OnAddedObject ();
+ }
+ }
}
-
+
void AddNode (XNode n)
{
CheckChildType (n, false);
@@ -121,7 +127,7 @@ namespace System.Xml.Linq
{
return false;
}
-
+
public XmlWriter CreateWriter ()
{
return new XNodeWriter (this);
Modified: mcs/class/System.Xml.Linq/System.Xml.Linq/XObject.cs
===================================================================
--- a/mcs/class/System.Xml.Linq/System.Xml.Linq/XObject.cs
+++ b/mcs/class/System.Xml.Linq/System.Xml.Linq/XObject.cs
@@ -162,5 +162,21 @@ namespace System.Xml.Linq
if ((options & LoadOptions.SetBaseUri) != LoadOptions.None)
BaseUri = r.BaseURI;
}
+
+ internal virtual void OnAddingObject ()
+ {
+ if (Parent != null)
+ Parent.OnAddingObject ();
+ if (Changing != null)
+ Changing.Invoke (this, null);
+ }
+
+ internal virtual void OnAddedObject ()
+ {
+ if (Parent != null)
+ Parent.OnAddedObject ();
+ if (Changed != null)
+ Changed.Invoke (this, null);
+ }
}
}
Modified: mcs/class/System.Xml.Linq/Test/System.Xml.Linq/XElementTest.cs
===================================================================
--- a/mcs/class/System.Xml.Linq/Test/System.Xml.Linq/XElementTest.cs
+++ b/mcs/class/System.Xml.Linq/Test/System.Xml.Linq/XElementTest.cs
@@ -1601,5 +1601,60 @@ namespace MonoTests.System.Xml.Linq
</rt>";
Assert.AreEqual (xml, root.ToString ().Replace ("\r\n", "\n"), "#1");
}
+
+ private class EventHandler
+ {
+ public bool ChangingInvoked { get; private set; }
+
+ public bool HasChanged { get; private set; }
+
+ public void OnChanging (object node, XObjectChangeEventArgs args)
+ {
+ ChangingInvoked = true;
+ }
+
+ public void OnChanged (object node, XObjectChangeEventArgs args)
+ {
+ HasChanged = true;
+ }
+ }
+
+ [Test]
+ public void Add_ToRootNode_ChangeTriggers ()
+ {
+ var inputXml = "<root><a><b /></a></root>";
+ var reader = XmlReader.Create (new StringReader (inputXml), new XmlReaderSettings \
()); + XDocument doc = XDocument.Load (reader);
+ var eventHandler = new EventHandler ();
+ doc.Root.Changing += eventHandler.OnChanging;
+ doc.Root.Changed += eventHandler.OnChanged;
+
+ var newElement = XElement.Parse ("<c/>");
+
+ doc.Root.Add (newElement);
+
+ Assert.IsTrue (eventHandler.ChangingInvoked, "OnChanging not triggered");
+ Assert.IsTrue (eventHandler.HasChanged, "OnChanged not triggered");
+ }
+
+ [Test]
+ public void Add_ToChildNode_ChangeTriggersOnRoot ()
+ {
+ var inputXml = "<root><a><b /></a></root>";
+ var reader = XmlReader.Create (new StringReader (inputXml), new XmlReaderSettings \
()); + XDocument doc = XDocument.Load (reader);
+ var eventHandler = new EventHandler ();
+
+ var newElement = XElement.Parse ("<c/>");
+ doc.Root.Add (newElement);
+
+ doc.Root.Changing += eventHandler.OnChanging;
+ doc.Root.Changed += eventHandler.OnChanged;
+ var nextNewElement = XElement.Parse ("<d/>");
+ newElement.Add (nextNewElement);
+
+ Assert.IsTrue (eventHandler.ChangingInvoked, "OnChanging not triggered");
+ Assert.IsTrue (eventHandler.HasChanged, "OnChanged not triggered");
+ }
}
}
Commit: fc0ec2635d8332823ae7a728854e0a59fd2b4a26
Author: Atsushi Eno <atsushi@ximian.com>
Date: 01/30/2011 23:48:00
URL: https://github.com/mono/mono/commit/fc0ec2635d8332823ae7a728854e0a59fd2b4a26
Do not return DocumentFragment from AppendChild() etc. Fixed bug #666249.
Changed paths:
M mcs/class/System.XML/System.Xml/XmlNode.cs
M mcs/class/System.XML/Test/System.Xml/XmlDocumentFragmentTests.cs
Modified: mcs/class/System.XML/System.Xml/XmlNode.cs
===================================================================
--- a/mcs/class/System.XML/System.Xml/XmlNode.cs
+++ b/mcs/class/System.XML/System.Xml/XmlNode.cs
@@ -540,10 +540,13 @@ namespace System.Xml
if (newChild.NodeType == XmlNodeType.DocumentFragment) {
// This recursively invokes events. (It is compatible with MS implementation.)
- while (newChild.FirstChild != null)
- this.InsertBefore (newChild.FirstChild, refChild);
- }
- else {
+ XmlNode ret = null;
+ while (newChild.FirstChild != null) {
+ var c = this.InsertBefore (newChild.FirstChild, refChild);
+ ret = ret ?? c;
+ }
+ return ret;
+ } else {
XmlLinkedNode newLinkedChild = (XmlLinkedNode) newChild;
newLinkedChild.parentNode = this;
@@ -585,8 +588,8 @@ namespace System.Xml
if (raiseEvent)
ownerDoc.onNodeInserted (newChild, newChild.ParentNode);
+ return newChild;
}
- return newChild;
}
private void CheckNodeInsertion (XmlNode newChild, XmlNode refChild)
Modified: mcs/class/System.XML/Test/System.Xml/XmlDocumentFragmentTests.cs
===================================================================
--- a/mcs/class/System.XML/Test/System.Xml/XmlDocumentFragmentTests.cs
+++ b/mcs/class/System.XML/Test/System.Xml/XmlDocumentFragmentTests.cs
@@ -57,11 +57,12 @@ namespace MonoTests.System.Xml
fragment.AppendChild (document.CreateElement ("div"));
// appending fragment to element
- body.AppendChild (fragment);
+ XmlNode ret = body.AppendChild (fragment);
Assert.IsNotNull (body.FirstChild, "#AppendFragmentToElement.Exist");
Assert.AreEqual (XmlNodeType.Element, body.FirstChild.NodeType, \
"#AppendFragmentToElement.ChildIsElement"); Assert.AreEqual ("p", \
body.FirstChild.Name, "#AppendFragmentToElement.FirstChild"); Assert.AreEqual \
("div", body.LastChild.Name, "#AppendFragmentToElement.LastChild"); \
+ Assert.AreEqual ("p", ret.LocalName, "#AppendFragmentToElement.ReturnValue"); }
[Test]
Commit: c5302b7b52ade6288c23b7053e1d9316643d86c2
Author: Jo Shields <directhex@apebox.org>
Committer: Zoltan Varga <vargaz@gmail.com>
Date: 01/31/2011 01:47:05
URL: https://github.com/mono/mono/commit/c5302b7b52ade6288c23b7053e1d9316643d86c2
Really fix sgen on PowerPC Linux. Assembler on Linux requires that register names are \
just bare numbers, unlike OSX, i.e. "r0" must be "0" on Linux.
Changed paths:
M mono/metadata/sgen-archdep.h
Modified: mono/metadata/sgen-archdep.h
===================================================================
--- a/mono/metadata/sgen-archdep.h
+++ b/mono/metadata/sgen-archdep.h
@@ -107,12 +107,21 @@
#define REDZONE_SIZE 224
#define ARCH_NUM_REGS 32
+#ifdef __APPLE__
#define ARCH_STORE_REGS(ptr) \
__asm__ __volatile__( \
"stmw r0, 0(%0)\n" \
: \
: "b" (ptr) \
)
+#else
+#define ARCH_STORE_REGS(ptr) \
+ __asm__ __volatile__( \
+ "stmw 0, 0(%0)\n" \
+ : \
+ : "b" (ptr) \
+ )
+#endif
#define ARCH_SIGCTX_SP(ctx) (UCONTEXT_REG_Rn((ctx), 1))
#define ARCH_SIGCTX_IP(ctx) (UCONTEXT_REG_NIP((ctx)))
#define ARCH_COPY_SIGCTX_REGS(a,ctx) do { \
Commit: 684266d2b38ead382551f4dbbe29db723bde82d6
Author: Marek Habersack <grendel@twistedcode.net>
Date: 01/31/2011 03:47:20
URL: https://github.com/mono/mono/commit/684266d2b38ead382551f4dbbe29db723bde82d6
[runtime] Use IOAMP-aware method of looking for domain configuration file
Changed paths:
M mono/metadata/appdomain.c
M mono/metadata/assembly.c
M mono/metadata/icall.c
M mono/utils/mono-io-portability.c
Modified: mono/metadata/appdomain.c
===================================================================
--- a/mono/metadata/appdomain.c
+++ b/mono/metadata/appdomain.c
@@ -816,7 +816,7 @@ void
mono_set_private_bin_path_from_config (MonoDomain *domain)
{
MonoError error;
- gchar *config_file, *text;
+ gchar *config_file_name = NULL, *text = NULL, *config_file_path = NULL;
gsize len;
GMarkupParseContext *context;
RuntimeConfig runtime_config;
@@ -825,21 +825,23 @@ mono_set_private_bin_path_from_config (MonoDomain *domain)
if (!domain || !domain->setup || !domain->setup->configuration_file)
return;
- config_file = mono_string_to_utf8_checked (domain->setup->configuration_file, \
&error); + config_file_name = mono_string_to_utf8_checked \
(domain->setup->configuration_file, &error); if (!mono_error_ok (&error)) {
mono_error_cleanup (&error);
- return;
+ goto free_and_out;
}
- if (!g_file_get_contents (config_file, &text, &len, NULL)) {
- g_free (config_file);
- return;
- }
+ config_file_path = mono_portability_find_file (config_file_name, TRUE);
+ if (!config_file_path)
+ config_file_path = config_file_name;
+
+ if (!g_file_get_contents (config_file_path, &text, &len, NULL))
+ goto free_and_out;
runtime_config.runtime_count = 0;
runtime_config.assemblybinding_count = 0;
runtime_config.domain = domain;
- runtime_config.filename = config_file;
+ runtime_config.filename = config_file_path;
offset = 0;
if (len > 3 && text [0] == '\xef' && text [1] == (gchar) '\xbb' && text [2] == \
'\xbf') @@ -849,8 +851,12 @@ mono_set_private_bin_path_from_config (MonoDomain \
*domain) if (g_markup_parse_context_parse (context, text + offset, len - offset, \
NULL)) g_markup_parse_context_end_parse (context, NULL);
g_markup_parse_context_free (context);
+
+ free_and_out:
g_free (text);
- g_free (config_file);
+ if (config_file_name != config_file_path)
+ g_free (config_file_name);
+ g_free (config_file_path);
}
MonoAppDomain *
Modified: mono/metadata/assembly.c
===================================================================
--- a/mono/metadata/assembly.c
+++ b/mono/metadata/assembly.c
@@ -32,6 +32,7 @@
#include <mono/utils/mono-path.h>
#include <mono/metadata/reflection.h>
#include <mono/metadata/coree.h>
+#include <mono/utils/mono-io-portability.h>
#ifndef HOST_WIN32
#include <sys/types.h>
@@ -2454,11 +2455,17 @@ mono_assembly_apply_binding (MonoAssemblyName *aname, \
MonoAssemblyName *dest_nam if (domain && domain->setup && \
domain->setup->configuration_file) { mono_domain_lock (domain);
if (!domain->assembly_bindings_parsed) {
- gchar *domain_config_file = mono_string_to_utf8 \
(domain->setup->configuration_file); + gchar *domain_config_file_name = \
mono_string_to_utf8 (domain->setup->configuration_file); + gchar \
*domain_config_file_path = mono_portability_find_file (domain_config_file_name, \
TRUE);
- mono_config_parse_assembly_bindings (domain_config_file, aname->major, \
aname->minor, domain, assembly_binding_info_parsed); + if \
(!domain_config_file_path) + domain_config_file_path = domain_config_file_name;
+
+ mono_config_parse_assembly_bindings (domain_config_file_path, aname->major, \
aname->minor, domain, assembly_binding_info_parsed); \
domain->assembly_bindings_parsed = TRUE;
- g_free (domain_config_file);
+ if (domain_config_file_name != domain_config_file_path)
+ g_free (domain_config_file_name);
+ g_free (domain_config_file_path);
}
mono_domain_unlock (domain);
Modified: mono/metadata/icall.c
===================================================================
--- a/mono/metadata/icall.c
+++ b/mono/metadata/icall.c
@@ -77,6 +77,7 @@
#include <mono/utils/mono-string.h>
#include <mono/utils/mono-error-internals.h>
#include <mono/utils/mono-mmap.h>
+#include <mono/utils/mono-io-portability.h>
#if defined (HOST_WIN32)
#include <windows.h>
@@ -6920,7 +6921,7 @@ get_bundled_app_config (void)
const gchar *app_config;
MonoDomain *domain;
MonoString *file;
- gchar *config_file;
+ gchar *config_file_name, *config_file_path;
gsize len;
gchar *module;
@@ -6932,15 +6933,20 @@ get_bundled_app_config (void)
return NULL;
// Retrieve config file and remove the extension
- config_file = mono_string_to_utf8 (file);
- len = strlen (config_file) - strlen (".config");
+ config_file_name = mono_string_to_utf8 (file);
+ config_file_path = mono_portability_find_file (config_file_name, TRUE);
+ if (!config_file_path)
+ config_file_path = config_file_name;
+ len = strlen (config_file_path) - strlen (".config");
module = g_malloc0 (len + 1);
- memcpy (module, config_file, len);
+ memcpy (module, config_file_path, len);
// Get the config file from the module name
app_config = mono_config_string_for_assembly_file (module);
// Clean-up
g_free (module);
- g_free (config_file);
+ if (config_file_name != config_file_path)
+ g_free (config_file_name);
+ g_free (config_file_path);
if (!app_config)
return NULL;
Modified: mono/utils/mono-io-portability.c
===================================================================
--- a/mono/utils/mono-io-portability.c
+++ b/mono/utils/mono-io-portability.c
@@ -25,7 +25,6 @@ mono_portability_helpers_init (void)
gchar *
mono_portability_find_file (const gchar *pathname, gboolean last_exists)
{
- g_assert_not_reached();
return NULL;
}
@@ -147,7 +146,11 @@ static inline void do_mono_profiler_iomap (GString **report, \
const char *pathnam gchar *mono_portability_find_file (const gchar *pathname, \
gboolean last_exists) {
GString *report = NULL;
- gchar *ret = mono_portability_find_file_internal (&report, pathname, last_exists);
+ gchar *ret;
+
+ if (!pathname || !pathname [0])
+ return NULL;
+ ret = mono_portability_find_file_internal (&report, pathname, last_exists);
if (report)
g_string_free (report, TRUE);
Commit: 789c5a7f91fd010ab3aaa911c8f18633ba73e8d9
Author: Marek Habersack <grendel@twistedcode.net>
Date: 01/31/2011 05:08:33
URL: https://github.com/mono/mono/commit/789c5a7f91fd010ab3aaa911c8f18633ba73e8d9
[asp.net] Ignore directories that don't exist instead of throwing.
Changed paths:
M mcs/class/System.Web/System.Web.Hosting/DefaultVirtualDirectory.cs
Modified: mcs/class/System.Web/System.Web.Hosting/DefaultVirtualDirectory.cs
===================================================================
--- a/mcs/class/System.Web/System.Web.Hosting/DefaultVirtualDirectory.cs
+++ b/mcs/class/System.Web/System.Web.Hosting/DefaultVirtualDirectory.cs
@@ -6,7 +6,7 @@
//
//
-// Copyright (c) 2006 Novell, Inc (http://www.novell.com)
+// Copyright (c) 2006-2011 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
@@ -62,6 +62,9 @@ namespace System.Web.Hosting {
List <VirtualFileBase> AddDirectories (List <VirtualFileBase> list, string dir)
{
+ if (String.IsNullOrEmpty (dir) || !Directory.Exists (dir))
+ return list;
+
foreach (string name in Directory.GetDirectories (phys_dir))
list.Add (new DefaultVirtualDirectory (VirtualPathUtility.Combine (virtual_dir, \
Path.GetFileName (name))));
@@ -70,6 +73,9 @@ namespace System.Web.Hosting {
List <VirtualFileBase> AddFiles (List <VirtualFileBase> list, string dir)
{
+ if (String.IsNullOrEmpty (dir) || !Directory.Exists (dir))
+ return list;
+
foreach (string name in Directory.GetFiles (phys_dir))
list.Add (new DefaultVirtualFile (VirtualPathUtility.Combine (virtual_dir, \
Path.GetFileName (name))));
Commit: 15aed192fb85f63eee429eb210f232b57fe7ead2
Author: Zoltan Varga <vargaz@gmail.com>
Date: 01/31/2011 08:02:29
URL: https://github.com/mono/mono/commit/15aed192fb85f63eee429eb210f232b57fe7ead2
When using xdebug, allocate all code from the code manager of the root domain. \
Hopefully fixes #666152.
Changed paths:
M mono/mini/mini.c
Modified: mono/mini/mini.c
===================================================================
--- a/mono/mini/mini.c
+++ b/mono/mini/mini.c
@@ -3554,6 +3554,17 @@ mono_codegen (MonoCompile *cfg)
MonoBasicBlock *bb;
int max_epilog_size;
guint8 *code;
+ MonoDomain *code_domain;
+
+ if (mono_using_xdebug)
+ /*
+ * Recent gdb versions have trouble processing symbol files containing
+ * overlapping address ranges, so allocate all code from the code manager
+ * of the root domain. (#666152).
+ */
+ code_domain = mono_get_root_domain ();
+ else
+ code_domain = cfg->domain;
#if defined(__native_client_codegen__) && defined(__native_client__)
void *code_dest;
@@ -3641,13 +3652,17 @@ mono_codegen (MonoCompile *cfg)
mono_dynamic_code_hash_insert (cfg->domain, cfg->method, cfg->dynamic_info);
mono_domain_unlock (cfg->domain);
- code = mono_code_manager_reserve (cfg->dynamic_info->code_mp, cfg->code_size + \
unwindlen); + if (mono_using_xdebug)
+ /* See the comment for cfg->code_domain */
+ code = mono_domain_code_reserve (code_domain, cfg->code_size + unwindlen);
+ else
+ code = mono_code_manager_reserve (cfg->dynamic_info->code_mp, cfg->code_size + \
unwindlen); } else {
guint unwindlen = 0;
#ifdef MONO_ARCH_HAVE_UNWIND_TABLE
unwindlen = mono_arch_unwindinfo_get_size (cfg->arch.unwindinfo);
#endif
- code = mono_domain_code_reserve (cfg->domain, cfg->code_size + unwindlen);
+ code = mono_domain_code_reserve (code_domain, cfg->code_size + unwindlen);
}
#if defined(__native_client_codegen__) && defined(__native_client__)
nacl_allow_target_modification (TRUE);
@@ -3720,9 +3735,12 @@ if (valgrind_register){
mono_arch_patch_code (cfg->method, cfg->domain, cfg->native_code, cfg->patch_info, \
cfg->run_cctors);
if (cfg->method->dynamic) {
- mono_code_manager_commit (cfg->dynamic_info->code_mp, cfg->native_code, \
cfg->code_size, cfg->code_len); + if (mono_using_xdebug)
+ mono_domain_code_commit (code_domain, cfg->native_code, cfg->code_size, \
cfg->code_len); + else
+ mono_code_manager_commit (cfg->dynamic_info->code_mp, cfg->native_code, \
cfg->code_size, cfg->code_len); } else {
- mono_domain_code_commit (cfg->domain, cfg->native_code, cfg->code_size, \
cfg->code_len); + mono_domain_code_commit (code_domain, cfg->native_code, \
cfg->code_size, cfg->code_len); }
#if defined(__native_client_codegen__) && defined(__native_client__)
cfg->native_code = code_dest;
Commit: 879cb82456c166f2651bb4e2cdf393829d3cbff0
Author: Marek Habersack <grendel@twistedcode.net>
Date: 01/31/2011 09:20:57
URL: https://github.com/mono/mono/commit/879cb82456c166f2651bb4e2cdf393829d3cbff0
[asp.net] Implemented 4.0 types System.Web.Security.{MachineKey,MachineKeyProtection} \
plus tests
Changed paths:
M mcs/class/System.Web/System.Web_test.dll.sources
M mcs/class/System.Web/net_4_0_System.Web.dll.sources
Added paths:
A mcs/class/System.Web/System.Web.Security/MachineKey.cs
A mcs/class/System.Web/System.Web.Security/MachineKeyProtection.cs
A mcs/class/System.Web/Test/System.Web.Security/MachineKeyTest.cs
Modified: mcs/class/System.Web/System.Web_test.dll.sources
===================================================================
--- a/mcs/class/System.Web/System.Web_test.dll.sources
+++ b/mcs/class/System.Web/System.Web_test.dll.sources
@@ -379,6 +379,7 @@ System.Web.Security/FormsAuthenticationEventArgsCas.cs
System.Web.Security/FormsAuthenticationModuleCas.cs
System.Web.Security/FormsAuthenticationTicketCas.cs
System.Web.Security/FormsIdentityCas.cs
+System.Web.Security/MachineKeyTest.cs
System.Web.Security/PassportAuthenticationEventArgsCas.cs
System.Web.Security/PassportAuthenticationModuleCas.cs
System.Web.Security/PassportIdentityCas.cs
Modified: mcs/class/System.Web/net_4_0_System.Web.dll.sources
===================================================================
--- a/mcs/class/System.Web/net_4_0_System.Web.dll.sources
+++ b/mcs/class/System.Web/net_4_0_System.Web.dll.sources
@@ -18,6 +18,8 @@ System.Web.Compilation/FolderLevelBuildProviderAppliesTo.cs
System.Web.Compilation/FolderLevelBuildProviderAppliesToAttribute.cs
System.Web.Compilation/RouteUrlExpressionBuilder.cs
System.Web.Compilation/RouteValueExpressionBuilder.cs
+System.Web.Security/MachineKey.cs
+System.Web.Security/MachineKeyProtection.cs
System.Web.SessionState_2.0/SessionStateBehavior.cs
System.Web.Routing/PageRouteHandler.cs
System.Web.UI/ClientIDMode.cs
Added: mcs/class/System.Web/System.Web.Security/MachineKey.cs
===================================================================
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Security/MachineKey.cs
@@ -0,0 +1,109 @@
+//
+// Authors:
+// Marek Habersack <grendel@twistedcode.net>
+//
+// (C) 2011 Novell, Inc (http://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.
+//
+
+using System;
+using System.Web;
+using System.Web.Configuration;
+using System.Web.Util;
+
+namespace System.Web.Security
+{
+ public static class MachineKey
+ {
+ public static byte[] Decode (string encodedData, MachineKeyProtection \
protectionOption) + {
+ if (encodedData == null)
+ throw new ArgumentNullException ("encodedData");
+
+ int dlen = encodedData.Length;
+ if (dlen == 0 || dlen % 2 == 1)
+ throw new ArgumentException ("encodedData");
+
+ byte[] data = MachineKeySectionUtils.GetBytes (encodedData, dlen);
+ if (data == null || data.Length == 0)
+ throw new ArgumentException ("encodedData");
+
+ var config = WebConfigurationManager.GetWebApplicationSection \
("system.web/machineKey") as MachineKeySection; + byte[] result = null;
+ Exception ex = null;
+ try {
+ switch (protectionOption) {
+ case MachineKeyProtection.All:
+ result = MachineKeySectionUtils.VerifyDecrypt (config, data);
+ break;
+
+ case MachineKeyProtection.Encryption:
+ result = MachineKeySectionUtils.Decrypt (config, data);
+ break;
+
+ case MachineKeyProtection.Validation:
+ result = MachineKeySectionUtils.Verify (config, data);
+ break;
+
+ default:
+ return MachineKeySectionUtils.GetBytes (encodedData, dlen);
+ }
+ } catch (Exception e) {
+ ex = e;
+ }
+
+ if (result == null || ex != null)
+ throw new HttpException ("Unable to verify passed data.", ex);
+
+ return result;
+ }
+
+ public static string Encode (byte[] data, MachineKeyProtection protectionOption)
+ {
+ if (data == null)
+ throw new ArgumentNullException ("data");
+
+ var config = WebConfigurationManager.GetWebApplicationSection \
("system.web/machineKey") as MachineKeySection; + byte[] result;
+ switch (protectionOption) {
+ case MachineKeyProtection.All:
+ result = MachineKeySectionUtils.EncryptSign (config, data);
+ break;
+
+ case MachineKeyProtection.Encryption:
+ result = MachineKeySectionUtils.Encrypt (config, data);
+ break;
+
+ case MachineKeyProtection.Validation:
+ result = MachineKeySectionUtils.Sign (config, data);
+ break;
+
+ default:
+ return String.Empty;
+ }
+
+ return MachineKeySectionUtils.GetHexString (result);
+ }
+ }
+}
+
Added: mcs/class/System.Web/System.Web.Security/MachineKeyProtection.cs
===================================================================
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Security/MachineKeyProtection.cs
@@ -0,0 +1,41 @@
+//
+// Authors:
+// Marek Habersack <grendel@twistedcode.net>
+//
+// (C) 2011 Novell, Inc (http://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.
+//
+
+using System;
+
+namespace System.Web.Security
+{
+ public enum MachineKeyProtection
+ {
+ All,
+ Encryption,
+ Validation
+ }
+}
+
+
Added: mcs/class/System.Web/Test/System.Web.Security/MachineKeyTest.cs
===================================================================
--- /dev/null
+++ b/mcs/class/System.Web/Test/System.Web.Security/MachineKeyTest.cs
@@ -0,0 +1,171 @@
+???//
+// Authors:
+// Marek Habersack <grendel@twistedcode.net>
+//
+// (C) 2011 Novell, Inc (http://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_4_0
+using System;
+using System.Text;
+using System.Web.Security;
+
+using MonoTests.Common;
+using NUnit.Framework;
+
+namespace MonoTests.System.Web.Security
+{
+ [TestFixture]
+ public class MachineKeyTest
+ {
+ [Test]
+ [MonoTODO ("Find out why the difference in result sizes exists between .NET and \
Mono")] + public void Encode ()
+ {
+#if DOT_NET
+ const int ALL_EXPECTED_SIZE = 192;
+ const int ENCRYPTION_EXPECTED_SIZE = 128;
+#else
+ const int ALL_EXPECTED_SIZE = 128;
+ const int ENCRYPTION_EXPECTED_SIZE = 64;
+#endif
+ const int VALIDATION_EXPECTED_SIZE = 64;
+
+ AssertExtensions.Throws<ArgumentNullException> (() => {
+ MachineKey.Encode (null, MachineKeyProtection.All);
+ }, "#A1-1");
+
+ string result = MachineKey.Encode (new byte[] {}, (MachineKeyProtection)12345);
+ Assert.IsNotNull (result, "#A1-1");
+ Assert.AreEqual (0, result.Length, "#A1-2");
+
+ result = MachineKey.Encode (new byte[] {}, MachineKeyProtection.All);
+ Assert.IsNotNull (result, "#B1-1");
+ Assert.AreEqual (ALL_EXPECTED_SIZE, result.Length, "#B1-2");
+
+ result = MachineKey.Encode (new byte [] { }, MachineKeyProtection.Encryption);
+ Assert.IsNotNull (result, "#C1-1");
+ Assert.AreEqual (ENCRYPTION_EXPECTED_SIZE, result.Length, "#C1-2");
+
+ result = MachineKey.Encode (new byte [] { }, MachineKeyProtection.Validation);
+ Assert.IsNotNull (result, "#D1-1");
+ Assert.AreEqual (VALIDATION_EXPECTED_SIZE, result.Length, "#D1-2");
+ }
+
+ [Test]
+ public void Decode ()
+ {
+ byte[] decoded;
+
+ AssertExtensions.Throws<ArgumentNullException> (() => {
+ MachineKey.Decode (null, MachineKeyProtection.All);
+ }, "#A1-1");
+
+ AssertExtensions.Throws<ArgumentException> (() => {
+ decoded = MachineKey.Decode (String.Empty, MachineKeyProtection.All);
+ }, "#A1-2");
+
+ var sb = new StringBuilder ().Append ('0', 192);
+ decoded = MachineKey.Decode (sb.ToString (), (MachineKeyProtection)12345);
+ Assert.IsNotNull (decoded, "#A2-1");
+ Assert.AreEqual (96, decoded.Length, "#A2-2");
+
+ sb = new StringBuilder ().Append ('0', 128);
+ decoded = MachineKey.Decode (sb.ToString (), (MachineKeyProtection) 12345);
+ Assert.IsNotNull (decoded, "#A3-1");
+ Assert.AreEqual (64, decoded.Length, "#A3-2");
+
+ sb = new StringBuilder ().Append ('0', 96);
+ decoded = MachineKey.Decode (sb.ToString (), (MachineKeyProtection) 12345);
+ Assert.IsNotNull (decoded, "#A4-1");
+ Assert.AreEqual (48, decoded.Length, "#A4-2");
+
+ sb = new StringBuilder ().Append ('0', 10);
+ decoded = MachineKey.Decode (sb.ToString (), (MachineKeyProtection) 12345);
+ Assert.IsNotNull (decoded, "#A5-1");
+ Assert.AreEqual (5, decoded.Length, "#A5-2");
+
+ AssertExtensions.Throws<ArgumentException> (() => {
+ decoded = MachineKey.Decode ("test", MachineKeyProtection.All);
+ }, "#B1-1");
+
+ AssertExtensions.Throws<ArgumentException> (() => {
+ decoded = MachineKey.Decode ("test", MachineKeyProtection.Encryption);
+ }, "#B1-2");
+
+ AssertExtensions.Throws<ArgumentException> (() => {
+ decoded = MachineKey.Decode ("test", MachineKeyProtection.Validation);
+ }, "#B1-3");
+
+ sb = new StringBuilder ().Append ('0', 1);
+ try {
+ decoded = MachineKey.Decode (sb.ToString (), MachineKeyProtection.All);
+ Assert.Fail ("#C1-2 [no exception]");
+ } catch (ArgumentException) {
+ // success
+ } catch {
+ Assert.Fail ("#C1-2 [invalid exception]");
+ }
+
+ sb = new StringBuilder ().Append ('0', 2);
+ try {
+ decoded = MachineKey.Decode (sb.ToString (), MachineKeyProtection.All);
+ } catch (ArgumentException ex) {
+ Console.WriteLine (ex);
+ Assert.Fail ("#C1-3");
+ } catch {
+ // success
+ }
+
+ sb = new StringBuilder ().Append ('0', 193);
+ try {
+ decoded = MachineKey.Decode (sb.ToString (), MachineKeyProtection.All);
+ Assert.Fail ("#C2-1 [no exception]");
+ } catch (ArgumentException) {
+ // success
+ } catch {
+ Assert.Fail ("#C2-1 [invalid exception]");
+ }
+
+ sb = new StringBuilder ().Append ('0', 129);
+ try {
+ decoded = MachineKey.Decode (sb.ToString (), MachineKeyProtection.All);
+ Assert.Fail ("#C3-1 [no exception]");
+ } catch (ArgumentException) {
+ // success
+ } catch {
+ Assert.Fail ("#C3-2 [invalid exception]");
+ }
+
+ sb = new StringBuilder ().Append ('0', 64);
+ try {
+ decoded = MachineKey.Decode (sb.ToString (), MachineKeyProtection.All);
+ } catch (ArgumentException) {
+ Assert.Fail ("#C4-1");
+ } catch {
+ // Success
+ }
+ }
+ }
+}
+#endif
Commit: b5da420c2877e8cb8debc462da76db9413629eb2
Author: Lluis Sanchez <lluis@novell.com>
Date: 01/31/2011 10:34:17
URL: https://github.com/mono/mono/commit/b5da420c2877e8cb8debc462da76db9413629eb2
Handle possible exceptions thrown by Socket.Close
Changed paths:
M mcs/class/Mono.Posix/Mono.Remoting.Channels.Unix/UnixServerChannel.cs
Modified: mcs/class/Mono.Posix/Mono.Remoting.Channels.Unix/UnixServerChannel.cs
===================================================================
--- a/mcs/class/Mono.Posix/Mono.Remoting.Channels.Unix/UnixServerChannel.cs
+++ b/mcs/class/Mono.Posix/Mono.Remoting.Channels.Unix/UnixServerChannel.cs
@@ -310,9 +310,12 @@ namespace Mono.Remoting.Channels.Unix
}
finally
{
- _stream.Close();
- _client.Close ();
- _serverChannel.ReleaseConnection (Thread.CurrentThread);
+ try {
+ _serverChannel.ReleaseConnection (Thread.CurrentThread);
+ _stream.Close();
+ _client.Close ();
+ } catch {
+ }
}
}
Commit: 1258d11fc3447687fcda720e23a8060d503d4f46
Author: Gonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Date: 01/31/2011 10:49:40
URL: https://github.com/mono/mono/commit/1258d11fc3447687fcda720e23a8060d503d4f46
Allow forcing HTTP protocol version
If the version is manually set, ignore the version from the service
point when set.
Fixes bug #668199.
Changed paths:
M mcs/class/System/System.Net/HttpWebRequest.cs
Modified: mcs/class/System/System.Net/HttpWebRequest.cs
===================================================================
--- a/mcs/class/System/System.Net/HttpWebRequest.cs
+++ b/mcs/class/System/System.Net/HttpWebRequest.cs
@@ -75,6 +75,7 @@ namespace System.Net
bool preAuthenticate;
bool usedPreAuth;
Version version = HttpVersion.Version11;
+ bool force_version;
Version actualVersion;
IWebProxy proxy;
bool sendChunked;
@@ -450,6 +451,7 @@ namespace System.Net
if (value != HttpVersion.Version10 && value != HttpVersion.Version11)
throw new ArgumentException ("value");
+ force_version = true;
version = value;
}
}
@@ -1073,7 +1075,7 @@ namespace System.Net
actualUri.PathAndQuery);
}
- if (servicePoint.ProtocolVersion != null && servicePoint.ProtocolVersion < \
version) { + if (!force_version && servicePoint.ProtocolVersion != null && \
servicePoint.ProtocolVersion < version) { actualVersion = \
servicePoint.ProtocolVersion; } else {
actualVersion = version;
Commit: 8cc7997a69743e9bb6c393573b63702eb21dce5b
Author: Jonathan Pryor <jonpryor@vt.edu>
Date: 01/31/2011 14:05:19
URL: https://github.com/mono/mono/commit/8cc7997a69743e9bb6c393573b63702eb21dce5b
Fix the MonoDroid build.
Most System.TimeZoneInfo members weren't being included.
Changed paths:
M mcs/class/System.Core/System/TimeZoneInfo.Android.cs
M mcs/class/System.Core/System/TimeZoneInfo.cs
Modified: mcs/class/System.Core/System/TimeZoneInfo.Android.cs
===================================================================
--- a/mcs/class/System.Core/System/TimeZoneInfo.Android.cs
+++ b/mcs/class/System.Core/System/TimeZoneInfo.Android.cs
@@ -18,7 +18,7 @@
* limitations under the License.
*/
-#if (INSIDE_CORLIB && ANDROID)
+#if (INSIDE_CORLIB && MONODROID)
using System;
using System.Collections.Generic;
Modified: mcs/class/System.Core/System/TimeZoneInfo.cs
===================================================================
--- a/mcs/class/System.Core/System/TimeZoneInfo.cs
+++ b/mcs/class/System.Core/System/TimeZoneInfo.cs
@@ -31,7 +31,7 @@ using System.Runtime.CompilerServices;
[assembly:TypeForwardedTo (typeof(TimeZoneInfo))]
-#elif NET_3_5 || (MOONLIGHT && INSIDE_CORLIB)
+#else
using System.Collections.Generic;
using System.Collections.ObjectModel;
@@ -528,8 +528,9 @@ namespace System
}
#endif
#if MONODROID
- systemTimeZones.AddRange (ZoneInfoDB.GetAvailableIds ()
- .Select (id => ZoneInfoDB.GetTimeZone (id)));
+ foreach (string id in ZoneInfoDB.GetAvailableIds ()) {
+ systemTimeZones.Add (ZoneInfoDB.GetTimeZone (id));
+ }
#elif LIBC
string[] continents = new string [] {"Africa", "America", "Antarctica", \
"Arctic", "Asia", "Atlantic", "Brazil", "Canada", "Chile", "Europe", "Indian", \
"Mexico", "Mideast", "Pacific", "US"}; foreach (string continent in continents) {
Commit: 0577648c00c0b8930509ad4688134f387ae816a3
Author: Jonathan Pryor <jonpryor@vt.edu>
Date: 01/31/2011 15:16:05
URL: https://github.com/mono/mono/commit/0577648c00c0b8930509ad4688134f387ae816a3
Fix the basic-profile build.
Changed paths:
M mcs/class/System.Core/System/TimeZoneInfo.cs
Modified: mcs/class/System.Core/System/TimeZoneInfo.cs
===================================================================
--- a/mcs/class/System.Core/System/TimeZoneInfo.cs
+++ b/mcs/class/System.Core/System/TimeZoneInfo.cs
@@ -31,7 +31,7 @@ using System.Runtime.CompilerServices;
[assembly:TypeForwardedTo (typeof(TimeZoneInfo))]
-#else
+#elif (INSIDE_CORLIB && (NET_4_0 || MOONLIGHT || MOBILE)) || (!INSIDE_CORLIB && \
(NET_3_5 && !NET_4_0 && !MOBILE))
using System.Collections.Generic;
using System.Collections.ObjectModel;
Commit: 79633ee3d182f8f7545be5354b29ad330c1df5ae
Author: Gonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Date: 01/31/2011 16:36:16
URL: https://github.com/mono/mono/commit/79633ee3d182f8f7545be5354b29ad330c1df5ae
Handle wrapped ThreadAbortException
Third party ProcessRequest() like the one from Razor can wrap a
ThreadAbortException originated from response.Redirect().
Changed paths:
M mcs/class/System.Web/System.Web/HttpApplication.cs
Modified: mcs/class/System.Web/System.Web/HttpApplication.cs
===================================================================
--- a/mcs/class/System.Web/System.Web/HttpApplication.cs
+++ b/mcs/class/System.Web/System.Web/HttpApplication.cs
@@ -956,7 +956,13 @@ namespace System.Web
stop_processing = true;
PipelineDone ();
} catch (Exception e) {
- ProcessError (e);
+ ThreadAbortException inner = e.InnerException as ThreadAbortException;
+ if (inner != null && FlagEnd.Value == inner.ExceptionState && \
!HttpRuntime.DomainUnloading) { + context.ClearError ();
+ Thread.ResetAbort ();
+ } else {
+ ProcessError (e);
+ }
stop_processing = true;
PipelineDone ();
}
Commit: ca0ededdc63e7af50a8b1548975cd56aae9e65b6
Author: Zoltan Varga <vargaz@gmail.com>
Date: 01/31/2011 16:40:11
URL: https://github.com/mono/mono/commit/ca0ededdc63e7af50a8b1548975cd56aae9e65b6
Fix stack walks on sparc.
Changed paths:
M mono/mini/exceptions-sparc.c
Modified: mono/mini/exceptions-sparc.c
===================================================================
--- a/mono/mini/exceptions-sparc.c
+++ b/mono/mini/exceptions-sparc.c
@@ -351,6 +351,9 @@ mono_arch_find_jit_info (MonoDomain *domain, MonoJitTlsData \
*jit_tls, if (ji != NULL) {
frame->type = FRAME_TYPE_MANAGED;
+ if (!ji->method->wrapper_type || ji->method->wrapper_type == \
MONO_WRAPPER_DYNAMIC_METHOD) + frame->managed = TRUE;
+
if (*lmf && (MONO_CONTEXT_GET_BP (ctx) >= (gpointer)(*lmf)->ebp)) {
/* remove any unused lmf */
*lmf = (*lmf)->previous_lmf;
Commit: 0a8a210791f802235424d69d476d488a8496f6ea
Author: Bit Diff <lists@bitdiff.com>
Committer: Miguel de Icaza <miguel@gnome.org>
Date: 01/31/2011 17:59:03
URL: https://github.com/mono/mono/commit/0a8a210791f802235424d69d476d488a8496f6ea
Fixes #527447 whereby it was not possible to pass additional arguments to \
mono-service2 (if your executable required command-line arguments of it's own).
Changed paths:
M mcs/tools/mono-service/mono-service.cs
Modified: mcs/tools/mono-service/mono-service.cs
===================================================================
--- a/mcs/tools/mono-service/mono-service.cs
+++ b/mcs/tools/mono-service/mono-service.cs
@@ -9,6 +9,7 @@
* (C) 2005 Novell Inc
*/
using System;
+using System.Collections.Generic;
using System.IO;
using System.Reflection;
using Mono.Unix;
@@ -20,6 +21,7 @@ using System.Runtime.InteropServices;
class MonoServiceRunner : MarshalByRefObject
{
string assembly, name, logname;
+ string[] args;
static void info (string prefix, string format, params object [] args)
{
@@ -55,6 +57,7 @@ class MonoServiceRunner : MarshalByRefObject
string lockfile = null;
string name = null;
string logname = null;
+ var assebmlyArgs = new List<string>();
foreach (string s in args){
if (s.Length > 3 && s [0] == '-' && s [2] == ':'){
@@ -69,9 +72,13 @@ class MonoServiceRunner : MarshalByRefObject
}
} else {
if (assembly != null)
- Usage ();
-
- assembly = s;
+ {
+ assebmlyArgs.Add(s);
+ }
+ else
+ {
+ assembly = s;
+ }
}
}
@@ -131,7 +138,7 @@ class MonoServiceRunner : MarshalByRefObject
true,
BindingFlags.Default,
null,
- new object [] {assembly, name, logname},
+ new object [] {assembly, name, logname, assebmlyArgs.ToArray()},
null, null, null) as MonoServiceRunner;
if (rnr == null) {
@@ -147,11 +154,12 @@ class MonoServiceRunner : MarshalByRefObject
}
}
- public MonoServiceRunner (string assembly, string name, string logname)
+ public MonoServiceRunner (string assembly, string name, string logname, string[] \
args) {
this.assembly = assembly;
this.name = name;
this.logname = logname;
+ this.args = args;
}
public int StartService ()
@@ -196,7 +204,7 @@ class MonoServiceRunner : MarshalByRefObject
// And run its Main. Our RunService handler is invoked from
// ServiceBase.Run.
- return AppDomain.CurrentDomain.ExecuteAssembly (assembly, \
AppDomain.CurrentDomain.Evidence); + return AppDomain.CurrentDomain.ExecuteAssembly \
(assembly, AppDomain.CurrentDomain.Evidence, args);
} catch ( Exception ex ) {
for (Exception e = ex; e != null; e = e.InnerException) {
Commit: 38bdb82f955c43b4fd5504ef50ab11db703f9056
Author: Atsushi Eno <atsushi@ximian.com>
Date: 01/31/2011 21:05:11
URL: https://github.com/mono/mono/commit/38bdb82f955c43b4fd5504ef50ab11db703f9056
in NET_4_0, remove types that went into System.Xaml.dll. Change build order.
Changed paths:
M mcs/class/Makefile
M mcs/class/WindowsBase/Makefile
M mcs/class/WindowsBase/System.Windows.Markup/AmbientAttribute.cs
M mcs/class/WindowsBase/System.Windows.Markup/ConstructorArgumentAttribute.cs
M mcs/class/WindowsBase/System.Windows.Markup/ContentPropertyAttribute.cs
M mcs/class/WindowsBase/System.Windows.Markup/ContentWrapperAttribute.cs
M mcs/class/WindowsBase/System.Windows.Markup/DateTimeValueSerializer.cs
M mcs/class/WindowsBase/System.Windows.Markup/DependsOnAttribute.cs
M mcs/class/WindowsBase/System.Windows.Markup/DictionaryKeyPropertyAttribute.cs
M mcs/class/WindowsBase/System.Windows.Markup/IComponentConnector.cs
M mcs/class/WindowsBase/System.Windows.Markup/INameScope.cs
M mcs/class/WindowsBase/System.Windows.Markup/IValueSerializerContext.cs
M mcs/class/WindowsBase/System.Windows.Markup/IXamlTypeResolver.cs
M mcs/class/WindowsBase/System.Windows.Markup/MarkupExtension.cs
M mcs/class/WindowsBase/System.Windows.Markup/MarkupExtensionReturnTypeAttribute.cs
M mcs/class/WindowsBase/System.Windows.Markup/NameScopePropertyAttribute.cs
M mcs/class/WindowsBase/System.Windows.Markup/RootNamespaceAttribute.cs
M mcs/class/WindowsBase/System.Windows.Markup/RuntimeNamePropertyAttribute.cs
M mcs/class/WindowsBase/System.Windows.Markup/TrimSurroundingWhitespaceAttribute.cs
M mcs/class/WindowsBase/System.Windows.Markup/UidDuringInitializationAttribute.cs
M mcs/class/WindowsBase/System.Windows.Markup/UidPropertyAttribute.cs
M mcs/class/WindowsBase/System.Windows.Markup/UsableDuringInitializationAttribute.cs
M mcs/class/WindowsBase/System.Windows.Markup/ValueSerializer.cs
M mcs/class/WindowsBase/System.Windows.Markup/ValueSerializerAttribute.cs
M mcs/class/WindowsBase/System.Windows.Markup/WhitespaceSignificantCollectionAttribute.cs
M mcs/class/WindowsBase/System.Windows.Markup/XmlLangPropertyAttribute.cs
M mcs/class/WindowsBase/System.Windows.Markup/XmlnsCompatibleWithAttribute.cs
M mcs/class/WindowsBase/System.Windows.Markup/XmlnsDefinitionAttribute.cs
M mcs/class/WindowsBase/System.Windows.Markup/XmlnsPrefixAttribute.cs
Modified: mcs/class/Makefile
===================================================================
--- a/mcs/class/Makefile
+++ b/mcs/class/Makefile
@@ -102,7 +102,6 @@ net_2_0_dirs := \
Mono.Tasklets \
Mono.CSharp \
Moonlight.Build.Tasks \
- WindowsBase \
System.Data.Services \
System.Data.Services.Client \
System.Net
@@ -110,7 +109,8 @@ net_2_0_dirs := \
net_2_0_only_dirs := \
System.Web.Extensions_1.0 \
System.Web.Extensions.Design_1.0 \
- Compat.ICSharpCode.SharpZipLib
+ Compat.ICSharpCode.SharpZipLib \
+ WindowsBase
moonlight_dirs := \
corlib \
@@ -159,6 +159,7 @@ net_4_0_dirs := \
System.Windows.Forms.DataVisualization \
System.ComponentModel.Composition \
System.Xaml \
+ WindowsBase \
System.ServiceModel.Routing \
System.ServiceModel.Discovery \
System.Runtime.Caching \
Modified: mcs/class/WindowsBase/Makefile
===================================================================
--- a/mcs/class/WindowsBase/Makefile
+++ b/mcs/class/WindowsBase/Makefile
@@ -9,5 +9,8 @@ TEST_MCS_FLAGS = -unsafe -r:WindowsBase.dll
ifeq (2.0, $(FRAMEWORK_VERSION))
LIB_MCS_FLAGS += -d:NET_3_0
endif
+ifeq (4.0, $(FRAMEWORK_VERSION))
+LIB_MCS_FLAGS += -d:NET_4_0 -r:System.Xaml.dll
+endif
include ../../build/library.make
Modified: mcs/class/WindowsBase/System.Windows.Markup/AmbientAttribute.cs
===================================================================
--- a/mcs/class/WindowsBase/System.Windows.Markup/AmbientAttribute.cs
+++ b/mcs/class/WindowsBase/System.Windows.Markup/AmbientAttribute.cs
@@ -1,3 +1,4 @@
+#if !NET_4_0
// 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
@@ -28,4 +29,5 @@ namespace System.Windows.Markup {
[AttributeUsage (AttributeTargets.Property)]
public class AmbientAttribute : Attribute {
}
-}
\ No newline at end of file
+}
+#endif
Modified: mcs/class/WindowsBase/System.Windows.Markup/ConstructorArgumentAttribute.cs
===================================================================
--- a/mcs/class/WindowsBase/System.Windows.Markup/ConstructorArgumentAttribute.cs
+++ b/mcs/class/WindowsBase/System.Windows.Markup/ConstructorArgumentAttribute.cs
@@ -1,3 +1,4 @@
+#if !NET_4_0
// 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
@@ -42,4 +43,5 @@ namespace System.Windows.Markup {
string argumentName;
}
-}
\ No newline at end of file
+}
+#endif
Modified: mcs/class/WindowsBase/System.Windows.Markup/ContentPropertyAttribute.cs
===================================================================
--- a/mcs/class/WindowsBase/System.Windows.Markup/ContentPropertyAttribute.cs
+++ b/mcs/class/WindowsBase/System.Windows.Markup/ContentPropertyAttribute.cs
@@ -1,3 +1,4 @@
+#if !NET_4_0
// 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
@@ -46,3 +47,4 @@ namespace System.Windows.Markup {
}
}
}
+#endif
Modified: mcs/class/WindowsBase/System.Windows.Markup/ContentWrapperAttribute.cs
===================================================================
--- a/mcs/class/WindowsBase/System.Windows.Markup/ContentWrapperAttribute.cs
+++ b/mcs/class/WindowsBase/System.Windows.Markup/ContentWrapperAttribute.cs
@@ -1,3 +1,4 @@
+#if !NET_4_0
// 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
@@ -62,3 +63,4 @@ namespace System.Windows.Markup {
}
}
+#endif
Modified: mcs/class/WindowsBase/System.Windows.Markup/DateTimeValueSerializer.cs
===================================================================
--- a/mcs/class/WindowsBase/System.Windows.Markup/DateTimeValueSerializer.cs
+++ b/mcs/class/WindowsBase/System.Windows.Markup/DateTimeValueSerializer.cs
@@ -1,3 +1,4 @@
+#if !NET_4_0
// 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
@@ -64,3 +65,4 @@ namespace System.Windows.Markup {
}
}
+#endif
Modified: mcs/class/WindowsBase/System.Windows.Markup/DependsOnAttribute.cs
===================================================================
--- a/mcs/class/WindowsBase/System.Windows.Markup/DependsOnAttribute.cs
+++ b/mcs/class/WindowsBase/System.Windows.Markup/DependsOnAttribute.cs
@@ -1,3 +1,4 @@
+#if !NET_4_0
// 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
@@ -47,3 +48,4 @@ namespace System.Windows.Markup {
}
}
+#endif
Modified: mcs/class/WindowsBase/System.Windows.Markup/DictionaryKeyPropertyAttribute.cs
===================================================================
--- a/mcs/class/WindowsBase/System.Windows.Markup/DictionaryKeyPropertyAttribute.cs
+++ b/mcs/class/WindowsBase/System.Windows.Markup/DictionaryKeyPropertyAttribute.cs
@@ -1,3 +1,4 @@
+#if !NET_4_0
// 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
@@ -38,4 +39,5 @@ namespace System.Windows.Markup {
get; private set;
}
}
-}
\ No newline at end of file
+}
+#endif
Modified: mcs/class/WindowsBase/System.Windows.Markup/IComponentConnector.cs
===================================================================
--- a/mcs/class/WindowsBase/System.Windows.Markup/IComponentConnector.cs
+++ b/mcs/class/WindowsBase/System.Windows.Markup/IComponentConnector.cs
@@ -1,3 +1,4 @@
+#if !NET_4_0
// 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
@@ -32,4 +33,5 @@ namespace System.Windows.Markup {
void InitializeComponent ();
}
-}
\ No newline at end of file
+}
+#endif
Modified: mcs/class/WindowsBase/System.Windows.Markup/INameScope.cs
===================================================================
--- a/mcs/class/WindowsBase/System.Windows.Markup/INameScope.cs
+++ b/mcs/class/WindowsBase/System.Windows.Markup/INameScope.cs
@@ -1,3 +1,4 @@
+#if !NET_4_0
// 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
@@ -33,4 +34,5 @@ namespace System.Windows.Markup {
void RegisterName (string name, object scopedElement);
void UnregisterName (string name);
}
-}
\ No newline at end of file
+}
+#endif
Modified: mcs/class/WindowsBase/System.Windows.Markup/IValueSerializerContext.cs
===================================================================
--- a/mcs/class/WindowsBase/System.Windows.Markup/IValueSerializerContext.cs
+++ b/mcs/class/WindowsBase/System.Windows.Markup/IValueSerializerContext.cs
@@ -1,3 +1,4 @@
+#if !NET_4_0
// 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
@@ -32,4 +33,5 @@ namespace System.Windows.Markup {
ValueSerializer GetValueSerializerFor (PropertyDescriptor descriptor);
ValueSerializer GetValueSerializerFor (Type type);
}
-}
\ No newline at end of file
+}
+#endif
Modified: mcs/class/WindowsBase/System.Windows.Markup/IXamlTypeResolver.cs
===================================================================
--- a/mcs/class/WindowsBase/System.Windows.Markup/IXamlTypeResolver.cs
+++ b/mcs/class/WindowsBase/System.Windows.Markup/IXamlTypeResolver.cs
@@ -1,3 +1,4 @@
+#if !NET_4_0
// 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
@@ -30,4 +31,5 @@ namespace System.Windows.Markup {
public interface IXamlTypeResolver {
Type Resolve (string qualifiedTypeName);
}
-}
\ No newline at end of file
+}
+#endif
Modified: mcs/class/WindowsBase/System.Windows.Markup/MarkupExtension.cs
===================================================================
--- a/mcs/class/WindowsBase/System.Windows.Markup/MarkupExtension.cs
+++ b/mcs/class/WindowsBase/System.Windows.Markup/MarkupExtension.cs
@@ -1,3 +1,4 @@
+#if !NET_4_0
// 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
@@ -36,3 +37,4 @@ namespace System.Windows.Markup {
public abstract object ProvideValue (IServiceProvider serviceProvider);
}
}
+#endif
Modified: mcs/class/WindowsBase/System.Windows.Markup/MarkupExtensionReturnTypeAttribute.cs
===================================================================
--- a/mcs/class/WindowsBase/System.Windows.Markup/MarkupExtensionReturnTypeAttribute.cs
+++ b/mcs/class/WindowsBase/System.Windows.Markup/MarkupExtensionReturnTypeAttribute.cs
@@ -1,3 +1,4 @@
+#if !NET_4_0
// 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
@@ -57,3 +58,4 @@ namespace System.Windows.Markup {
}
}
+#endif
Modified: mcs/class/WindowsBase/System.Windows.Markup/NameScopePropertyAttribute.cs
===================================================================
--- a/mcs/class/WindowsBase/System.Windows.Markup/NameScopePropertyAttribute.cs
+++ b/mcs/class/WindowsBase/System.Windows.Markup/NameScopePropertyAttribute.cs
@@ -1,3 +1,4 @@
+#if !NET_4_0
// 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
@@ -51,4 +52,5 @@ namespace System.Windows.Markup {
}
}
-}
\ No newline at end of file
+}
+#endif
Modified: mcs/class/WindowsBase/System.Windows.Markup/RootNamespaceAttribute.cs
===================================================================
--- a/mcs/class/WindowsBase/System.Windows.Markup/RootNamespaceAttribute.cs
+++ b/mcs/class/WindowsBase/System.Windows.Markup/RootNamespaceAttribute.cs
@@ -1,3 +1,4 @@
+#if !NET_4_0
// 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
@@ -41,4 +42,5 @@ namespace System.Windows.Markup {
string nameSpace;
}
-}
\ No newline at end of file
+}
+#endif
Modified: mcs/class/WindowsBase/System.Windows.Markup/RuntimeNamePropertyAttribute.cs
===================================================================
--- a/mcs/class/WindowsBase/System.Windows.Markup/RuntimeNamePropertyAttribute.cs
+++ b/mcs/class/WindowsBase/System.Windows.Markup/RuntimeNamePropertyAttribute.cs
@@ -1,3 +1,4 @@
+#if !NET_4_0
// 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
@@ -41,4 +42,5 @@ namespace System.Windows.Markup {
string name;
}
-}
\ No newline at end of file
+}
+#endif
Modified: mcs/class/WindowsBase/System.Windows.Markup/TrimSurroundingWhitespaceAttribute.cs
===================================================================
--- a/mcs/class/WindowsBase/System.Windows.Markup/TrimSurroundingWhitespaceAttribute.cs
+++ b/mcs/class/WindowsBase/System.Windows.Markup/TrimSurroundingWhitespaceAttribute.cs
@@ -1,3 +1,4 @@
+#if !NET_4_0
// 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
@@ -31,4 +32,5 @@ namespace System.Windows.Markup {
public sealed class TrimSurroundingWhitespaceAttribute : Attribute
{
}
-}
\ No newline at end of file
+}
+#endif
Modified: mcs/class/WindowsBase/System.Windows.Markup/UidDuringInitializationAttribute.cs
===================================================================
--- a/mcs/class/WindowsBase/System.Windows.Markup/UidDuringInitializationAttribute.cs
+++ b/mcs/class/WindowsBase/System.Windows.Markup/UidDuringInitializationAttribute.cs
@@ -1,3 +1,4 @@
+#if !NET_4_0
// 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
@@ -38,4 +39,5 @@ namespace System.Windows.Markup {
private set;
}
}
-}
\ No newline at end of file
+}
+#endif
Modified: mcs/class/WindowsBase/System.Windows.Markup/UidPropertyAttribute.cs
===================================================================
--- a/mcs/class/WindowsBase/System.Windows.Markup/UidPropertyAttribute.cs
+++ b/mcs/class/WindowsBase/System.Windows.Markup/UidPropertyAttribute.cs
@@ -1,3 +1,4 @@
+#if !NET_4_0
// 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
@@ -38,4 +39,5 @@ namespace System.Windows.Markup {
private set;
}
}
-}
\ No newline at end of file
+}
+#endif
Modified: mcs/class/WindowsBase/System.Windows.Markup/UsableDuringInitializationAttribute.cs
===================================================================
--- a/mcs/class/WindowsBase/System.Windows.Markup/UsableDuringInitializationAttribute.cs
+++ b/mcs/class/WindowsBase/System.Windows.Markup/UsableDuringInitializationAttribute.cs
@@ -1,3 +1,4 @@
+#if !NET_4_0
// 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
@@ -38,4 +39,5 @@ namespace System.Windows.Markup {
private set;
}
}
-}
\ No newline at end of file
+}
+#endif
Modified: mcs/class/WindowsBase/System.Windows.Markup/ValueSerializer.cs
===================================================================
--- a/mcs/class/WindowsBase/System.Windows.Markup/ValueSerializer.cs
+++ b/mcs/class/WindowsBase/System.Windows.Markup/ValueSerializer.cs
@@ -1,3 +1,4 @@
+#if !NET_4_0
// 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
@@ -167,3 +168,4 @@ namespace System.Windows.Markup {
}
}
+#endif
Modified: mcs/class/WindowsBase/System.Windows.Markup/ValueSerializerAttribute.cs
===================================================================
--- a/mcs/class/WindowsBase/System.Windows.Markup/ValueSerializerAttribute.cs
+++ b/mcs/class/WindowsBase/System.Windows.Markup/ValueSerializerAttribute.cs
@@ -1,3 +1,4 @@
+#if !NET_4_0
// 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
@@ -55,4 +56,5 @@ namespace System.Windows.Markup {
Type valueSerializerType;
}
-}
\ No newline at end of file
+}
+#endif
Modified: mcs/class/WindowsBase/System.Windows.Markup/WhitespaceSignificantCollectionAttribute.cs
===================================================================
--- a/mcs/class/WindowsBase/System.Windows.Markup/WhitespaceSignificantCollectionAttribute.cs
+++ b/mcs/class/WindowsBase/System.Windows.Markup/WhitespaceSignificantCollectionAttribute.cs
@@ -1,3 +1,4 @@
+#if !NET_4_0
// 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
@@ -31,4 +32,5 @@ namespace System.Windows.Markup {
public sealed class WhitespaceSignificantCollectionAttribute : Attribute
{
}
-}
\ No newline at end of file
+}
+#endif
Modified: mcs/class/WindowsBase/System.Windows.Markup/XmlLangPropertyAttribute.cs
===================================================================
--- a/mcs/class/WindowsBase/System.Windows.Markup/XmlLangPropertyAttribute.cs
+++ b/mcs/class/WindowsBase/System.Windows.Markup/XmlLangPropertyAttribute.cs
@@ -1,3 +1,4 @@
+#if !NET_4_0
// 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
@@ -41,4 +42,5 @@ namespace System.Windows.Markup {
string name;
}
-}
\ No newline at end of file
+}
+#endif
Modified: mcs/class/WindowsBase/System.Windows.Markup/XmlnsCompatibleWithAttribute.cs
===================================================================
--- a/mcs/class/WindowsBase/System.Windows.Markup/XmlnsCompatibleWithAttribute.cs
+++ b/mcs/class/WindowsBase/System.Windows.Markup/XmlnsCompatibleWithAttribute.cs
@@ -1,3 +1,4 @@
+#if !NET_4_0
// 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
@@ -47,4 +48,5 @@ namespace System.Windows.Markup {
string newNamespace;
string oldNamespace;
}
-}
\ No newline at end of file
+}
+#endif
Modified: mcs/class/WindowsBase/System.Windows.Markup/XmlnsDefinitionAttribute.cs
===================================================================
--- a/mcs/class/WindowsBase/System.Windows.Markup/XmlnsDefinitionAttribute.cs
+++ b/mcs/class/WindowsBase/System.Windows.Markup/XmlnsDefinitionAttribute.cs
@@ -1,3 +1,4 @@
+#if !NET_4_0
// 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
@@ -53,4 +54,5 @@ namespace System.Windows.Markup {
string clrNamespace;
string assemblyName;
}
-}
\ No newline at end of file
+}
+#endif
Modified: mcs/class/WindowsBase/System.Windows.Markup/XmlnsPrefixAttribute.cs
===================================================================
--- a/mcs/class/WindowsBase/System.Windows.Markup/XmlnsPrefixAttribute.cs
+++ b/mcs/class/WindowsBase/System.Windows.Markup/XmlnsPrefixAttribute.cs
@@ -1,3 +1,4 @@
+#if !NET_4_0
// 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
@@ -47,4 +48,5 @@ namespace System.Windows.Markup {
string prefix;
string xmlNamespace;
}
-}
\ No newline at end of file
+}
+#endif
Commit: 157111dbb58a3b554c823f47c67c80664316a206
Author: Atsushi Eno <atsushi@ximian.com>
Date: 01/31/2011 23:01:50
URL: https://github.com/mono/mono/commit/157111dbb58a3b554c823f47c67c80664316a206
quick build workaround.
Changed paths:
M mcs/class/Makefile
Modified: mcs/class/Makefile
===================================================================
--- a/mcs/class/Makefile
+++ b/mcs/class/Makefile
@@ -103,14 +103,14 @@ net_2_0_dirs := \
Mono.CSharp \
Moonlight.Build.Tasks \
System.Data.Services \
- System.Data.Services.Client \
System.Net
net_2_0_only_dirs := \
System.Web.Extensions_1.0 \
System.Web.Extensions.Design_1.0 \
Compat.ICSharpCode.SharpZipLib \
- WindowsBase
+ WindowsBase \
+ System.Data.Services.Client
moonlight_dirs := \
corlib \
@@ -160,6 +160,7 @@ net_4_0_dirs := \
System.ComponentModel.Composition \
System.Xaml \
WindowsBase \
+ System.Data.Services.Client \
System.ServiceModel.Routing \
System.ServiceModel.Discovery \
System.Runtime.Caching \
Commit: 5d7723bc375eb0f7036450c29a9ff1b319ee59b8
Author: Atsushi Eno <atsushi@ximian.com>
Date: 02/01/2011 01:59:00
URL: https://github.com/mono/mono/commit/5d7723bc375eb0f7036450c29a9ff1b319ee59b8
Members in the base type in different namespace are serialized in base ns.
When the serializer serializes a Type B which is derived from A, it used to
serialize member M in A as in namespace_of_B, not in namespace_of_A.
This should fix bug #652331.
Changed paths:
M mcs/class/System.Runtime.Serialization/System.Runtime.Serialization/SerializationMap.cs
M mcs/class/System.Runtime.Serialization/Test/System.Runtime.Serialization/XmlObjectSerializerTest.cs
Modified: mcs/class/System.Runtime.Serialization/System.Runtime.Serialization/SerializationMap.cs
===================================================================
--- a/mcs/class/System.Runtime.Serialization/System.Runtime.Serialization/SerializationMap.cs
+++ b/mcs/class/System.Runtime.Serialization/System.Runtime.Serialization/SerializationMap.cs
@@ -456,7 +456,7 @@ namespace System.Runtime.Serialization
if (!pi.CanRead || (!pi.CanWrite && !(map is ICollectionTypeMap)))
throw new InvalidDataContractException (String.Format (
"DataMember property '{0}' on type '{1}' must have both getter and setter.", \
pi, pi.DeclaringType));
- data_members.Add (CreateDataMemberInfo (dma, pi, pi.PropertyType, \
qname.Namespace)); + data_members.Add (CreateDataMemberInfo (dma, pi, \
pi.PropertyType, KnownTypeCollection.GetStaticQName (pi.DeclaringType).Namespace)); \
}
foreach (FieldInfo fi in type.GetFields (flags)) {
@@ -464,7 +464,7 @@ namespace System.Runtime.Serialization
GetDataMemberAttribute (fi);
if (dma == null)
continue;
- data_members.Add (CreateDataMemberInfo (dma, fi, fi.FieldType, \
qname.Namespace)); + data_members.Add (CreateDataMemberInfo (dma, fi, \
fi.FieldType, KnownTypeCollection.GetStaticQName (fi.DeclaringType).Namespace)); }
return data_members;
@@ -502,7 +502,8 @@ namespace System.Runtime.Serialization
continue;
if (mi.GetCustomAttributes (typeof (IgnoreDataMemberAttribute), false).Length != \
0) continue;
- l.Add (CreateDataMemberInfo (new DataMemberAttribute (), mi, mt, \
XmlName.Namespace)); + string ns = KnownTypeCollection.GetStaticQName \
(mi.DeclaringType).Namespace; + l.Add (CreateDataMemberInfo (new \
DataMemberAttribute (), mi, mt, ns)); }
l.Sort (DataMemberInfo.DataMemberInfoComparer.Instance);
return l;
@@ -892,7 +893,7 @@ namespace System.Runtime.Serialization
if (fi.IsInitOnly)
throw new InvalidDataContractException (String.Format ("DataMember field {0} \
must not be read-only.", fi)); DataMemberAttribute dma = new DataMemberAttribute ();
- data_members.Add (CreateDataMemberInfo (dma, fi, fi.FieldType, \
qname.Namespace)); + data_members.Add (CreateDataMemberInfo (dma, fi, \
fi.FieldType, KnownTypeCollection.GetStaticQName (fi.DeclaringType).Namespace)); }
}
Modified: mcs/class/System.Runtime.Serialization/Test/System.Runtime.Serialization/XmlObjectSerializerTest.cs
===================================================================
--- a/mcs/class/System.Runtime.Serialization/Test/System.Runtime.Serialization/XmlObjectSerializerTest.cs
+++ b/mcs/class/System.Runtime.Serialization/Test/System.Runtime.Serialization/XmlObjectSerializerTest.cs
@@ -1499,6 +1499,27 @@ namespace MonoTests.System.Runtime.Serialization
var ds = (DataSet) x.ReadObject (r);
}
+
+ [Test] // bug #652331
+ public void MembersNamespacesInBaseType ()
+ {
+ string xml1 = @"<Currency>JPY</Currency><Description i:nil=""true"" />";
+ string xml2 = @"<Currency \
xmlns=""http://schemas.datacontract.org/2004/07/SLProto5"">JPY</Currency><Description \
i:nil=""true"" xmlns=""http://schemas.datacontract.org/2004/07/SLProto5"" />"; \
+ Assert.AreEqual ("JPY", MembersNamespacesInBaseType_Part<SLProto5.CashAmount> \
(new SLProto5.CashAmount () { Currency = "JPY" }, xml1, "#1").Currency, "r#1"); \
+ Assert.AreEqual ("JPY", \
MembersNamespacesInBaseType_Part<SLProto5_Different.CashAmount> (new \
SLProto5_Different.CashAmount () { Currency = "JPY" }, xml2, "#2").Currency, "r#2"); \
+ Assert.AreEqual ("JPY", MembersNamespacesInBaseType_Part<SLProto5.CashAmountDC> \
(new SLProto5.CashAmountDC () { Currency = "JPY" }, xml1, "#3").Currency, "r#3"); \
+ Assert.AreEqual ("JPY", \
MembersNamespacesInBaseType_Part<SLProto5_Different.CashAmountDC> (new \
SLProto5_Different.CashAmountDC () { Currency = "JPY" }, xml2, "#4").Currency, \
"r#4"); + }
+
+ T MembersNamespacesInBaseType_Part<T> (T instance, string expectedPart, string \
assert) + {
+ var ds = new DataContractSerializer (typeof (T));
+ var sw = new StringWriter ();
+ using (var w = XmlWriter.Create (sw))
+ ds.WriteObject (w, instance);
+ Assert.IsTrue (sw.ToString ().IndexOf (expectedPart) > 0, assert);
+ return (T) ds.ReadObject (XmlReader.Create (new StringReader (sw.ToString ())));
+ }
}
[DataContract]
@@ -2005,4 +2026,43 @@ public class Child
public Parent Parent;
}
+namespace SLProto5
+{
+ public class CashAmount : Amount
+ {
+ }
+
+ [DataContract]
+ public class CashAmountDC : AmountDC
+ {
+ }
+
+ public class Amount
+ {
+ public string Currency { get; set; }
+ public string Description { get; set; }
+ }
+
+ [DataContract]
+ public class AmountDC
+ {
+ [DataMember]
+ public string Currency { get; set; }
+ [DataMember]
+ public string Description { get; set; }
+ }
+}
+
+namespace SLProto5_Different
+{
+ public class CashAmount : SLProto5.Amount
+ {
+ }
+
+ [DataContract]
+ public class CashAmountDC : SLProto5.AmountDC
+ {
+ }
+}
+
#endregion
Commit: e44310c079a968a4b7f294892c7eabde9986e00a
Author: Marek Habersack <grendel@twistedcode.net>
Date: 02/01/2011 03:21:07
URL: https://github.com/mono/mono/commit/e44310c079a968a4b7f294892c7eabde9986e00a
[runtime] AddWatcher icall must look up the path in an IOMAP-aware way
Changed paths:
M mono/metadata/filewatcher.c
Modified: mono/metadata/filewatcher.c
===================================================================
--- a/mono/metadata/filewatcher.c
+++ b/mono/metadata/filewatcher.c
@@ -16,6 +16,7 @@
#include <mono/metadata/filewatcher.h>
#include <mono/metadata/marshal.h>
#include <mono/utils/mono-dl.h>
+#include <mono/utils/mono-io-portability.h>
#ifdef HOST_WIN32
/*
@@ -171,7 +172,7 @@ ves_icall_System_IO_InotifyWatcher_GetInotifyInstance ()
int
ves_icall_System_IO_InotifyWatcher_AddWatch (int fd, MonoString *name, gint32 mask)
{
- char *str;
+ char *str, *path;
int retval;
MONO_ARCH_SAVE_REGS;
@@ -180,7 +181,11 @@ ves_icall_System_IO_InotifyWatcher_AddWatch (int fd, MonoString \
*name, gint32 ma return -1;
str = mono_string_to_utf8 (name);
- retval = syscall (__NR_inotify_add_watch, fd, str, mask);
+ path = mono_portability_find_file (str, TRUE);
+ if (!path)
+ path = str;
+
+ retval = syscall (__NR_inotify_add_watch, fd, path, mask);
if (retval < 0) {
switch (errno) {
case EACCES:
@@ -207,6 +212,8 @@ ves_icall_System_IO_InotifyWatcher_AddWatch (int fd, MonoString \
*name, gint32 ma }
mono_marshal_set_last_error ();
}
+ if (path != str)
+ g_free (path);
g_free (str);
return retval;
}
Commit: b27182bd5d8d89133c3a3dc41d7fecd9fce5ad16
Author: Marek Habersack <grendel@twistedcode.net>
Date: 02/01/2011 03:21:13
URL: https://github.com/mono/mono/commit/b27182bd5d8d89133c3a3dc41d7fecd9fce5ad16
[asp.net] FormsAuthenticationTicket.FromByteArray stops early if it is passed a null \
parameter
Changed paths:
M mcs/class/System.Web/System.Web.Security/FormsAuthenticationTicket.cs
Modified: mcs/class/System.Web/System.Web.Security/FormsAuthenticationTicket.cs
===================================================================
--- a/mcs/class/System.Web/System.Web.Security/FormsAuthenticationTicket.cs
+++ b/mcs/class/System.Web/System.Web.Security/FormsAuthenticationTicket.cs
@@ -87,6 +87,9 @@ namespace System.Web.Security
internal static FormsAuthenticationTicket FromByteArray (byte [] bytes)
{
+ if (bytes == null)
+ throw new ArgumentNullException ("bytes");
+
MemoryStream ms = new MemoryStream (bytes);
BinaryReader reader = new BinaryReader (ms);
FormsAuthenticationTicket ticket = new FormsAuthenticationTicket ();
Commit: efcd37f7305d0d529a8423d16e1c111ab4772901
Author: Marek Safar <marek.safar@gmail.com>
Date: 02/01/2011 09:29:49
URL: https://github.com/mono/mono/commit/efcd37f7305d0d529a8423d16e1c111ab4772901
Fix empty cast conversion from dynamic type object type argument
Changed paths:
M mcs/mcs/convert.cs
Modified: mcs/mcs/convert.cs
===================================================================
--- a/mcs/mcs/convert.cs
+++ b/mcs/mcs/convert.cs
@@ -1370,8 +1370,12 @@ namespace Mono.CSharp {
if (expr_type == InternalType.Arglist && target_type == \
TypeManager.arg_iterator_type) return expr;
- if (TypeSpecComparer.IsEqual (expr_type, target_type))
- return expr;
+ if (TypeSpecComparer.IsEqual (expr_type, target_type)) {
+ if (expr_type == target_type)
+ return expr;
+
+ return EmptyCast.Create (expr, target_type);
+ }
return null;
}
Commit: 88bfc71d89d4a0c71014161456dabf1f7d8a5467
Author: Zoltan Varga <vargaz@gmail.com>
Date: 02/01/2011 11:09:45
URL: https://github.com/mono/mono/commit/88bfc71d89d4a0c71014161456dabf1f7d8a5467
Make caching in mono_marshal_get_virtual_stelemref () thread-safe. Fixes #668489.
Changed paths:
M mono/metadata/marshal.c
Modified: mono/metadata/marshal.c
===================================================================
--- a/mono/metadata/marshal.c
+++ b/mono/metadata/marshal.c
@@ -10134,10 +10134,18 @@ mono_marshal_get_virtual_stelemref (MonoClass *array_class)
res = mono_mb_create_method (mb, signature, 4);
res->flags |= METHOD_ATTRIBUTE_VIRTUAL;
mono_marshal_set_wrapper_info (res, GUINT_TO_POINTER (kind + 1));
- cached_methods [kind] = res;
+
+ mono_marshal_lock ();
+ if (!cached_methods [kind]) {
+ cached_methods [kind] = res;
+ mono_marshal_unlock ();
+ } else {
+ mono_marshal_unlock ();
+ mono_free_method (res);
+ }
mono_mb_free (mb);
- return res;
+ return cached_methods [kind];
}
MonoMethod*
Commit: fd57b963ad3e43cc1d7c6a5bad87d9342d9038e0
Author: Rodrigo Kumpera <kumpera@gmail.com>
Date: 02/01/2011 11:35:11
URL: https://github.com/mono/mono/commit/fd57b963ad3e43cc1d7c6a5bad87d9342d9038e0
Implement a reference queue API.
* gc.c: A reference queue allows one to queue
callbcks for when objects are collected.
It allows for safe cleanup of objects that can
only be done when it is effectively collected.
The major difference with regular finalization
is that the collector makes sure the object
was collected - and can't be resurrected.
* gc-internal.h: Export entrypoints for the
new API.
Changed paths:
M mono/metadata/gc-internal.h
M mono/metadata/gc.c
Modified: mono/metadata/gc-internal.h
===================================================================
--- a/mono/metadata/gc-internal.h
+++ b/mono/metadata/gc-internal.h
@@ -331,5 +331,32 @@ pthread_t mono_gc_get_mach_exception_thread (void) \
MONO_INTERNAL;
gboolean mono_gc_parse_environment_string_extract_number (const char *str, glong \
*out) MONO_INTERNAL;
+gboolean mono_gc_precise_stack_mark_enabled (void) MONO_INTERNAL;
+
+FILE *mono_gc_get_logfile (void) MONO_INTERNAL;
+
+typedef void (*mono_reference_queue_callback) (void *user_data);
+
+typedef struct _MonoReferenceQueue MonoReferenceQueue;
+typedef struct _RefQueueEntry RefQueueEntry;
+
+struct _RefQueueEntry {
+ void *dis_link;
+ void *user_data;
+ RefQueueEntry *next;
+};
+
+struct _MonoReferenceQueue {
+ RefQueueEntry *queue;
+ mono_reference_queue_callback callback;
+ MonoReferenceQueue *next;
+ gboolean should_be_deleted;
+};
+
+MonoReferenceQueue* mono_gc_reference_queue_new (mono_reference_queue_callback \
callback) MONO_INTERNAL; +void mono_gc_reference_queue_free (MonoReferenceQueue \
*queue) MONO_INTERNAL; +gboolean mono_gc_reference_queue_add (MonoReferenceQueue \
*queue, MonoObject *obj, void *user_data) MONO_INTERNAL; +
+
#endif /* __MONO_METADATA_GC_INTERNAL_H__ */
Modified: mono/metadata/gc.c
===================================================================
--- a/mono/metadata/gc.c
+++ b/mono/metadata/gc.c
@@ -54,6 +54,7 @@ static gboolean finalizing_root_domain = FALSE;
#define mono_finalizer_lock() EnterCriticalSection (&finalizer_mutex)
#define mono_finalizer_unlock() LeaveCriticalSection (&finalizer_mutex)
static CRITICAL_SECTION finalizer_mutex;
+static CRITICAL_SECTION reference_queue_mutex;
static GSList *domains_to_finalize= NULL;
static MonoMList *threads_to_finalize = NULL;
@@ -64,6 +65,7 @@ static void object_register_finalizer (MonoObject *obj, void \
(*callback)(void *,
static void mono_gchandle_set_target (guint32 gchandle, MonoObject *obj);
+static void reference_queue_proccess_all (void);
#ifndef HAVE_NULL_GC
static HANDLE pending_done_event;
static HANDLE shutdown_event;
@@ -1059,6 +1061,8 @@ finalizer_thread (gpointer unused)
mono_attach_maybe_start ();
#endif
+ reference_queue_proccess_all ();
+
if (domains_to_finalize) {
mono_finalizer_lock ();
if (domains_to_finalize) {
@@ -1077,6 +1081,7 @@ finalizer_thread (gpointer unused)
*/
mono_gc_invoke_finalizers ();
+
SetEvent (pending_done_event);
}
@@ -1091,6 +1096,7 @@ mono_gc_init (void)
InitializeCriticalSection (&allocator_section);
InitializeCriticalSection (&finalizer_mutex);
+ InitializeCriticalSection (&reference_queue_mutex);
MONO_GC_REGISTER_ROOT_FIXED (gc_handles [HANDLE_NORMAL].entries);
MONO_GC_REGISTER_ROOT_FIXED (gc_handles [HANDLE_PINNED].entries);
@@ -1168,6 +1174,7 @@ mono_gc_cleanup (void)
DeleteCriticalSection (&handle_section);
DeleteCriticalSection (&allocator_section);
DeleteCriticalSection (&finalizer_mutex);
+ DeleteCriticalSection (&reference_queue_mutex);
}
#else
@@ -1286,3 +1293,137 @@ mono_gc_alloc_mature (MonoVTable *vtable)
return mono_object_new_specific (vtable);
}
#endif
+
+
+static MonoReferenceQueue *ref_queues;
+
+static void
+ref_list_remove_element (RefQueueEntry **prev, RefQueueEntry *element)
+{
+ do {
+ /* Guard if head is changed concurrently. */
+ while (*prev != element)
+ prev = &(*prev)->next;
+ } while (prev && InterlockedCompareExchangePointer ((void*)prev, element->next, \
element) != element); +}
+
+static void
+ref_list_push (RefQueueEntry **head, RefQueueEntry *value)
+{
+ RefQueueEntry *current;
+ do {
+ current = *head;
+ value->next = current;
+ } while (InterlockedCompareExchangePointer ((void*)head, value, current) != \
current); +}
+
+static void
+reference_queue_proccess (MonoReferenceQueue *queue)
+{
+ RefQueueEntry **iter = &queue->queue;
+ RefQueueEntry *entry;
+ while ((entry = *iter)) {
+ if (queue->should_be_deleted || !mono_gc_weak_link_get (&entry->dis_link)) {
+ ref_list_remove_element (iter, entry);
+ mono_gc_weak_link_remove (&entry->dis_link);
+ queue->callback (entry->user_data);
+ g_free (entry);
+ } else {
+ iter = &entry->next;
+ }
+ }
+}
+
+static void
+reference_queue_proccess_all (void)
+{
+ MonoReferenceQueue **iter;
+ MonoReferenceQueue *queue = ref_queues;
+ for (; queue; queue = queue->next)
+ reference_queue_proccess (queue);
+
+restart:
+ EnterCriticalSection (&reference_queue_mutex);
+ for (iter = &ref_queues; *iter;) {
+ queue = *iter;
+ if (!queue->should_be_deleted) {
+ iter = &queue->next;
+ continue;
+ }
+ if (queue->queue) {
+ LeaveCriticalSection (&reference_queue_mutex);
+ reference_queue_proccess (queue);
+ goto restart;
+ }
+ *iter = queue->next;
+ g_free (queue);
+ }
+ LeaveCriticalSection (&reference_queue_mutex);
+}
+
+/**
+ * mono_gc_reference_queue_new:
+ * @callback callback used when processing dead entries.
+ *
+ * Create a new reference queue used to process collected objects.
+ * A reference queue let you queue the pair (managed object, user data).
+ * Once the managed object is collected @callback will be called
+ * in the finalizer thread with 'user data' as argument.
+ *
+ * The callback is called without any locks held.
+ */
+MonoReferenceQueue*
+mono_gc_reference_queue_new (mono_reference_queue_callback callback)
+{
+ MonoReferenceQueue *res = g_new0 (MonoReferenceQueue, 1);
+ res->callback = callback;
+
+ EnterCriticalSection (&reference_queue_mutex);
+ res->next = ref_queues;
+ ref_queues = res;
+ LeaveCriticalSection (&reference_queue_mutex);
+
+ return res;
+}
+
+/**
+ * mono_gc_reference_queue_add:
+ * @queue the queue to add the reference to.
+ * @obj the object to be watched for collection
+ * @user_data parameter to be passed to the queue callback
+ *
+ * Queue an object to be watched for collection.
+ *
+ * @returns false if the queue is scheduled to be freed.
+ */
+gboolean
+mono_gc_reference_queue_add (MonoReferenceQueue *queue, MonoObject *obj, void \
*user_data) +{
+ RefQueueEntry *head;
+ RefQueueEntry *entry;
+ if (queue->should_be_deleted)
+ return FALSE;
+
+ entry = g_new0 (RefQueueEntry, 1);
+ entry->user_data = user_data;
+ mono_gc_weak_link_add (&entry->dis_link, obj, TRUE);
+ ref_list_push (&queue->queue, entry);
+ return TRUE;
+}
+
+/**
+ * mono_gc_reference_queue_free:
+ * @queue the queue that should be deleted.
+ *
+ * This operation signals that @queue should be deleted. This operation is deferred
+ * as it happens on the finalizer thread.
+ *
+ * After this call, no further objects can be queued. It's the responsibility of the
+ * caller to make sure that no further attempt to access queue will be made.
+ */
+void
+mono_gc_reference_queue_free (MonoReferenceQueue *queue)
+{
+ queue->should_be_deleted = TRUE;
+}
+
Commit: e7785a27abfc1d09940a9a0439961095362757a0
Author: Rodrigo Kumpera <kumpera@gmail.com>
Date: 02/01/2011 11:35:11
URL: https://github.com/mono/mono/commit/e7785a27abfc1d09940a9a0439961095362757a0
Don't use finalization to cleanup dynamic methods.
* reflection.c: Use a reference queue to cleanup
dynamic methods instead of finalization.
* runtime.c: Shutdown the dynamic method queue
before runtime cleanup begins.
* DynamicMethod.cs: No longer finalizable.
* icall-def.h: Remove unused dynamic method icall.
Fixes #660422
Changed paths:
M mcs/class/corlib/System.Reflection.Emit/DynamicMethod.cs
M mono/metadata/icall-def.h
M mono/metadata/object-internals.h
M mono/metadata/reflection.c
M mono/metadata/runtime.c
Modified: mcs/class/corlib/System.Reflection.Emit/DynamicMethod.cs
===================================================================
--- a/mcs/class/corlib/System.Reflection.Emit/DynamicMethod.cs
+++ b/mcs/class/corlib/System.Reflection.Emit/DynamicMethod.cs
@@ -127,9 +127,6 @@ namespace System.Reflection.Emit {
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private extern void create_dynamic_method (DynamicMethod m);
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- private extern void destroy_dynamic_method (DynamicMethod m);
-
private void CreateDynMethod () {
if (mhandle.Value == IntPtr.Zero) {
if (ilgen == null || ilgen.ILOffset == 0)
@@ -158,11 +155,6 @@ namespace System.Reflection.Emit {
}
}
- ~DynamicMethod ()
- {
- destroy_dynamic_method (this);
- }
-
[ComVisible (true)]
public Delegate CreateDelegate (Type delegateType)
{
Modified: mono/metadata/icall-def.h
===================================================================
--- a/mono/metadata/icall-def.h
+++ b/mono/metadata/icall-def.h
@@ -524,7 +524,6 @@ ICALL(DERIVEDTYPE_1, "create_unmanaged_type", \
mono_reflection_create_unmanaged_t
ICALL_TYPE(DYNM, "System.Reflection.Emit.DynamicMethod", DYNM_1)
ICALL(DYNM_1, "create_dynamic_method", mono_reflection_create_dynamic_method)
-ICALL(DYNM_2, "destroy_dynamic_method", mono_reflection_destroy_dynamic_method)
ICALL_TYPE(ENUMB, "System.Reflection.Emit.EnumBuilder", ENUMB_1)
ICALL(ENUMB_1, "setup_enum_type", ves_icall_EnumBuilder_setup_enum_type)
Modified: mono/metadata/object-internals.h
===================================================================
--- a/mono/metadata/object-internals.h
+++ b/mono/metadata/object-internals.h
@@ -1539,6 +1539,9 @@ mono_object_new_pinned (MonoDomain *domain, MonoClass *klass) \
MONO_INTERNAL; void
mono_field_static_get_value_for_thread (MonoInternalThread *thread, MonoVTable *vt, \
MonoClassField *field, void *value) MONO_INTERNAL;
+void
+mono_reflection_shutdown (void) MONO_INTERNAL;
+
#endif /* __MONO_OBJECT_INTERNALS_H__ */
Modified: mono/metadata/reflection.c
===================================================================
--- a/mono/metadata/reflection.c
+++ b/mono/metadata/reflection.c
@@ -11441,15 +11441,56 @@ mono_reflection_sighelper_get_signature_field \
(MonoReflectionSigHelper *sig) return result;
}
+typedef struct {
+ MonoMethod *handle;
+ MonoDomain *domain;
+} DynamicMethodReleaseData;
+
+static MonoReferenceQueue *dynamic_method_queue;
+
+void
+mono_reflection_shutdown (void)
+{
+ MonoReferenceQueue *queue;
+ mono_loader_lock ();
+ queue = dynamic_method_queue;
+ dynamic_method_queue = NULL;
+ if (queue)
+ mono_gc_reference_queue_free (queue);
+ mono_loader_unlock ();
+}
+
+static void
+free_dynamic_method (void *dynamic_method)
+{
+ DynamicMethodReleaseData *data = dynamic_method;
+
+ mono_runtime_free_method (data->domain, data->handle);
+ g_free (data);
+}
+
void
mono_reflection_create_dynamic_method (MonoReflectionDynamicMethod *mb)
{
+ MonoReferenceQueue *queue;
+ MonoMethod *handle;
+ DynamicMethodReleaseData *release_data;
ReflectionMethodBuilder rmb;
MonoMethodSignature *sig;
MonoClass *klass;
GSList *l;
int i;
+ if (mono_runtime_is_shutting_down ())
+ mono_raise_exception (mono_get_exception_invalid_operation (""));
+
+ if (!(queue = dynamic_method_queue)) {
+ mono_loader_lock ();
+ if (!(queue = dynamic_method_queue))
+ queue = dynamic_method_queue = mono_gc_reference_queue_new (free_dynamic_method);
+ mono_loader_unlock ();
+ }
+
sig = dynamic_method_to_signature (mb);
reflection_methodbuilder_from_dynamic_method (&rmb, mb);
@@ -11507,7 +11548,12 @@ mono_reflection_create_dynamic_method \
(MonoReflectionDynamicMethod *mb)
klass = mb->owner ? mono_class_from_mono_type (mono_reflection_type_get_handle \
((MonoReflectionType*)mb->owner)) : mono_defaults.object_class;
- mb->mhandle = reflection_methodbuilder_to_mono_method (klass, &rmb, sig);
+ mb->mhandle = handle = reflection_methodbuilder_to_mono_method (klass, &rmb, sig);
+ release_data = g_new (DynamicMethodReleaseData, 1);
+ release_data->handle = handle;
+ release_data->domain = mono_object_get_domain ((MonoObject*)mb);
+ if (!mono_gc_reference_queue_add (queue, (MonoObject*)mb, release_data))
+ g_free (release_data);
/* Fix up refs entries pointing at us */
for (l = mb->referenced_by; l; l = l->next) {
@@ -11533,16 +11579,6 @@ mono_reflection_create_dynamic_method \
(MonoReflectionDynamicMethod *mb)
#endif /* DISABLE_REFLECTION_EMIT */
-void
-mono_reflection_destroy_dynamic_method (MonoReflectionDynamicMethod *mb)
-{
- g_assert (mb);
-
- if (mb->mhandle)
- mono_runtime_free_method (
- mono_object_get_domain ((MonoObject*)mb), mb->mhandle);
-}
-
/**
*
* mono_reflection_is_valid_dynamic_token:
Modified: mono/metadata/runtime.c
===================================================================
--- a/mono/metadata/runtime.c
+++ b/mono/metadata/runtime.c
@@ -39,5 +39,8 @@ void
mono_runtime_shutdown (void)
{
mono_domain_foreach (fire_process_exit_event, NULL);
+
+ /*From this point on, no more DM methods can be created. */
+ mono_reflection_shutdown ();
}
Commit: ca201f34783835c2b995ca873cf344db2a069382
Author: Lucas Meijer <lucas@unity3d.com>
Committer: Zoltan Varga <vargaz@gmail.com>
Date: 02/01/2011 15:55:57
URL: https://github.com/mono/mono/commit/ca201f34783835c2b995ca873cf344db2a069382
make mono_print_thread_dump output to the visualstudio debugger window, for better \
debugger experience
Changed paths:
M mono/mini/mini-exceptions.c
Modified: mono/mini/mini-exceptions.c
===================================================================
--- a/mono/mini/mini-exceptions.c
+++ b/mono/mini/mini-exceptions.c
@@ -2206,6 +2206,11 @@ mono_print_thread_dump_internal (void *sigctx, MonoContext \
*start_ctx) #endif
fprintf (stdout, "%s", text->str);
+
+#if PLATFORM_WIN32 && TARGET_WIN32 && _DEBUG
+ OutputDebugStringA(text->str);
+#endif
+
g_string_free (text, TRUE);
fflush (stdout);
}
Commit: a40312f1c1a9653f00be1429b496a5df798057cf
Author: Geoff Norton <grompf@sublimeintervention.com>
Date: 02/01/2011 23:54:06
URL: https://github.com/mono/mono/commit/a40312f1c1a9653f00be1429b496a5df798057cf
Avoid a stack overflow when deactivating a window
Changed paths:
M mcs/class/Managed.Windows.Forms/System.Windows.Forms.CarbonInternal/WindowHandler.cs
M mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUICarbon.cs
Modified: mcs/class/Managed.Windows.Forms/System.Windows.Forms.CarbonInternal/WindowHandler.cs
===================================================================
--- a/mcs/class/Managed.Windows.Forms/System.Windows.Forms.CarbonInternal/WindowHandler.cs
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.CarbonInternal/WindowHandler.cs
@@ -148,7 +148,7 @@ namespace System.Windows.Forms.CarbonInternal {
Control c = Control.FromHandle (hwnd.client_window);
if (c != null) {
Form form = c.FindForm ();
- if (form != null) {
+ if (form != null && XplatUICarbon.UnactiveWindow != form.Handle) {
Driver.SendMessage (form.Handle, Msg.WM_ACTIVATE, (IntPtr) \
WindowActiveFlags.WA_INACTIVE, IntPtr.Zero); XplatUICarbon.ActiveWindow = \
IntPtr.Zero; }
Modified: mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUICarbon.cs
===================================================================
--- a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUICarbon.cs
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUICarbon.cs
@@ -48,6 +48,7 @@ namespace System.Windows.Forms {
// Internal members available to the event handler sub-system
internal static IntPtr FocusWindow;
internal static IntPtr ActiveWindow;
+ internal static IntPtr UnactiveWindow;
internal static IntPtr ReverseWindow;
internal static IntPtr CaretWindow;
@@ -785,6 +786,7 @@ namespace System.Windows.Forms {
internal override void Activate(IntPtr handle) {
if (ActiveWindow != IntPtr.Zero) {
+ UnactiveWindow = ActiveWindow;
ActivateWindow (HIViewGetWindow (ActiveWindow), false);
}
ActivateWindow (HIViewGetWindow (handle), true);
Commit: 8dba5569931487f756b9b5bd04859582249a695f
Author: Rodrigo Kumpera <kumpera@gmail.com>
Date: 02/02/2011 07:03:04
URL: https://github.com/mono/mono/commit/8dba5569931487f756b9b5bd04859582249a695f
Align call instructions to make code patching SMP safe.
* mini-x86.c (emit_call): Align call instructions on
3 mod 4 so the address is 4 bytes aligned and can't span
two cache lines. This is required for proper SMP support
as CAS is not atomic across cache lines.
Fixes one of the crashes due to #667921.
Changed paths:
M mono/mini/mini-x86.c
Modified: mono/mini/mini-x86.c
===================================================================
--- a/mono/mini/mini-x86.c
+++ b/mono/mini/mini-x86.c
@@ -1803,6 +1803,13 @@ if (ins->inst_true_bb->native_offset) { \
static guint8*
emit_call (MonoCompile *cfg, guint8 *code, guint32 patch_type, gconstpointer data)
{
+ /*The address must be 4 bytes aligned to avoid spanning multiple cache lines.
+ This is required for code patching to be safe on SMP machines.
+ */
+ guint32 pad_size = (guint32)(code + 1 - cfg->native_code) & 0x3;
+ if (pad_size)
+ x86_padding (code, pad_size);
+
mono_add_patch_info (cfg, code - cfg->native_code, patch_type, data);
x86_call_code (code, 0);
Commit: 15514b1b269639fbd1ad89233954914245a05b62
Author: Ankit Jain <radical@corewars.org>
Date: 02/02/2011 07:56:43
URL: https://github.com/mono/mono/commit/15514b1b269639fbd1ad89233954914245a05b62
[xbuild] Warn for unknown toolsVersion only on build.
Emit warning for unknown toolsversion only on a build, and
*not* everytime the project file is parsed.
* class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Project.cs
(GetToolsVersionToUse): Add a 'emitWarning' bool param.
(Build): Call GetToolsVersionToUse () to ensure that a warning is
emitted in case of a unknown tools version.
Changed paths:
M mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Project.cs
Modified: mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Project.cs
===================================================================
--- a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Project.cs
+++ b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Project.cs
@@ -277,6 +277,11 @@ namespace Microsoft.Build.BuildEngine {
{
bool result = false;
ParentEngine.StartProjectBuild (this, targetNames);
+
+ // Invoking this to emit a warning in case of unsupported
+ // ToolsVersion
+ GetToolsVersionToUse (true);
+
string current_directory = Environment.CurrentDirectory;
try {
current_settings = buildFlags;
@@ -811,7 +816,7 @@ namespace Microsoft.Build.BuildEngine {
targets = new TargetCollection (this);
last_item_group_containing = new Dictionary <string, BuildItemGroup> ();
- string effective_tools_version = GetToolsVersionToUse ();
+ string effective_tools_version = GetToolsVersionToUse (false);
taskDatabase = new TaskDatabase ();
taskDatabase.CopyTasks (ParentEngine.GetDefaultTasks (effective_tools_version));
@@ -976,7 +981,7 @@ namespace Microsoft.Build.BuildEngine {
// ToolsVersion property
// ToolsVersion attribute on the project
// parentEngine's DefaultToolsVersion
- string GetToolsVersionToUse ()
+ string GetToolsVersionToUse (bool emitWarning)
{
if (!String.IsNullOrEmpty (ToolsVersion))
return ToolsVersion;
@@ -985,7 +990,8 @@ namespace Microsoft.Build.BuildEngine {
return parentEngine.DefaultToolsVersion;
if (parentEngine.Toolsets [DefaultToolsVersion] == null) {
- LogWarning (FullFileName, "Project has unknown ToolsVersion '{0}'. Using the \
default tools version '{1}' instead.", + if (emitWarning)
+ LogWarning (FullFileName, "Project has unknown ToolsVersion '{0}'. Using the \
default tools version '{1}' instead.", DefaultToolsVersion, \
parentEngine.DefaultToolsVersion); return parentEngine.DefaultToolsVersion;
}
Commit: bf12c6eb03f9e0b4680c10cfcb530903b8df10c4
Author: Marek Safar <marek.safar@gmail.com>
Date: 02/02/2011 12:25:22
URL: https://github.com/mono/mono/commit/bf12c6eb03f9e0b4680c10cfcb530903b8df10c4
Implement support for implicit user conversion for DefaultParameterValue (very odd)
Changed paths:
M mcs/mcs/attribute.cs
M mcs/mcs/cs-parser.jay
M mcs/mcs/ecore.cs
M mcs/mcs/parameter.cs
Modified: mcs/mcs/attribute.cs
===================================================================
--- a/mcs/mcs/attribute.cs
+++ b/mcs/mcs/attribute.cs
@@ -191,6 +191,11 @@ namespace Mono.CSharp {
target.OptAttributes = null;
}
+ public ResolveContext CreateResolveContext ()
+ {
+ return new ResolveContext (context, ResolveContext.Options.ConstantScope);
+ }
+
static void Error_InvalidNamedArgument (ResolveContext rc, NamedArgument name)
{
rc.Report.Error (617, name.Location, "`{0}' is not a valid named attribute \
argument. Named attribute arguments " + @@ -400,7 +405,7 @@ namespace Mono.CSharp {
}
}
- ResolveContext rc = new ResolveContext (context, \
ResolveContext.Options.ConstantScope); + ResolveContext rc = CreateResolveContext \
(); ctor = ResolveConstructor (rc);
if (ctor == null) {
return null;
@@ -956,22 +961,19 @@ namespace Mono.CSharp {
//
public bool IsExplicitLayoutKind ()
{
- if (PosArguments.Count != 1)
+ if (PosArguments == null || PosArguments.Count != 1)
return false;
var value = (LayoutKind) System.Enum.Parse (typeof (LayoutKind), ((Constant) \
PosArguments[0].Expr).GetValue ().ToString ()); return value == LayoutKind.Explicit;
}
- public Constant GetParameterDefaultValue (out TypeSpec type)
+ public Expression GetParameterDefaultValue ()
{
- var expr = PosArguments[0].Expr;
-
- if (expr is TypeCast)
- expr = ((TypeCast) expr).Child;
+ if (PosArguments == null)
+ return null;
- type = expr.Type;
- return expr as Constant;
+ return PosArguments[0].Expr;
}
public override bool Equals (object obj)
Modified: mcs/mcs/cs-parser.jay
===================================================================
--- a/mcs/mcs/cs-parser.jay
+++ b/mcs/mcs/cs-parser.jay
@@ -1552,7 +1552,7 @@ fixed_parameter
lbag.AddLocation ($$, GetLocation ($5));
if ($7 != null)
- ((Parameter) $$).DefaultValue = (Expression) $7;
+ ((Parameter) $$).DefaultValue = new DefaultParameterValueExpression ((Expression) \
$7); }
;
Modified: mcs/mcs/ecore.cs
===================================================================
--- a/mcs/mcs/ecore.cs
+++ b/mcs/mcs/ecore.cs
@@ -1986,7 +1986,7 @@ namespace Mono.CSharp {
//
public abstract class CompositeExpression : Expression
{
- Expression expr;
+ protected Expression expr;
protected CompositeExpression (Expression expr)
{
Modified: mcs/mcs/parameter.cs
===================================================================
--- a/mcs/mcs/parameter.cs
+++ b/mcs/mcs/parameter.cs
@@ -247,15 +247,28 @@ namespace Mono.CSharp {
#region Properties
- public Expression DefaultValue {
+ public DefaultParameterValueExpression DefaultValue {
get {
- return default_expr;
+ return default_expr as DefaultParameterValueExpression;
}
set {
default_expr = value;
}
}
+ Expression IParameterData.DefaultValue {
+ get {
+ var expr = default_expr as DefaultParameterValueExpression;
+ return expr == null ? default_expr : expr.Child;
+ }
+ }
+
+ bool HasOptionalExpression {
+ get {
+ return default_expr is DefaultParameterValueExpression;
+ }
+ }
+
public Location Location {
get {
return loc;
@@ -305,35 +318,15 @@ namespace Mono.CSharp {
a.Report.Warning (3022, 1, a.Location, "CLSCompliant attribute has no meaning \
when applied to parameters. Try putting it on the method instead"); }
- if (HasDefaultValue && (a.Type == pa.DefaultParameterValue || a.Type == \
pa.OptionalParameter)) {
- a.Report.Error (1745, a.Location,
- "Cannot specify `{0}' attribute on optional parameter `{1}'",
- TypeManager.CSharpName (a.Type).Replace ("Attribute", ""), Name);
- return;
- }
-
- if (a.Type == pa.DefaultParameterValue) {
- TypeSpec arg_type;
- var c = a.GetParameterDefaultValue (out arg_type);
- if (c == null) {
- if (parameter_type == TypeManager.object_type) {
- a.Report.Error (1910, a.Location, "Argument of type `{0}' is not applicable \
for the DefaultParameterValue attribute",
- arg_type.GetSignatureForError ());
- } else {
- a.Report.Error (1909, a.Location, "The DefaultParameterValue attribute is not \
applicable on parameters of type `{0}'",
- parameter_type.GetSignatureForError ()); ;
- }
-
- return;
+ if (a.Type == pa.DefaultParameterValue || a.Type == pa.OptionalParameter) {
+ if (HasOptionalExpression) {
+ a.Report.Error (1745, a.Location,
+ "Cannot specify `{0}' attribute on optional parameter `{1}'",
+ TypeManager.CSharpName (a.Type).Replace ("Attribute", ""), Name);
}
- if (arg_type == parameter_type || parameter_type == TypeManager.object_type ||
- (c.IsNull && TypeManager.IsReferenceType (parameter_type) && \
!TypeManager.IsGenericParameter (parameter_type)))
- builder.SetConstant (c.GetValue ());
- else
- a.Report.Error (1908, a.Location, "The type of the default value should match \
the type of the parameter");
-
- return;
+ if (a.Type == pa.DefaultParameterValue)
+ return;
}
base.ApplyAttributeBuilder (a, ctor, cdata, pa);
@@ -402,87 +395,72 @@ namespace Mono.CSharp {
// Default value was specified using an expression
//
if (default_expr != null) {
- default_expr = ResolveDefaultExpression (rc);
+ ((DefaultParameterValueExpression)default_expr).Resolve (rc, this);
return;
}
if (attributes == null)
return;
- var pa = attributes.Search (rc.Module.PredefinedAttributes.OptionalParameter);
- if (pa == null)
- return;
-
- //
- // Default value was specified using an attribute
- //
- attributes.Attrs.Remove (pa);
-
- TypeSpec expr_type = null;
- pa = attributes.Search (rc.Module.PredefinedAttributes.DefaultParameterValue);
- if (pa != null) {
- attributes.Attrs.Remove (pa);
- default_expr = pa.GetParameterDefaultValue (out expr_type);
- } else {
- default_expr = EmptyExpression.MissingValue;
- }
-
- if (default_expr == null) {
- if (expr_type == null)
- expr_type = parameter_type;
-
- default_expr = new DefaultValueExpression (new TypeExpression (expr_type, \
Location), Location);
- }
-
- default_expr = default_expr.Resolve (rc);
- }
-
- Expression ResolveDefaultExpression (ResolveContext rc)
- {
- default_expr = default_expr.Resolve (rc);
- if (default_expr == null)
- return null;
+ var opt_attr = attributes.Search \
(rc.Module.PredefinedAttributes.OptionalParameter); + var def_attr = \
attributes.Search (rc.Module.PredefinedAttributes.DefaultParameterValue); + if \
(def_attr != null) { + if (def_attr.Resolve () == null)
+ return;
- if (!(default_expr is Constant || default_expr is DefaultValueExpression || \
(default_expr is New && ((New)default_expr).IsDefaultStruct))) {
- rc.Compiler.Report.Error (1736, default_expr.Location,
- "The expression being assigned to optional parameter `{0}' must be a constant \
or default value",
- Name);
+ var default_expr_attr = def_attr.GetParameterDefaultValue ();
+ if (default_expr_attr == null)
+ return;
- return null;
- }
+ var dpa_rc = def_attr.CreateResolveContext ();
+ default_expr = default_expr_attr.Resolve (dpa_rc);
- if (default_expr.Type == parameter_type)
- return default_expr;
+ if (default_expr is BoxedCast)
+ default_expr = ((BoxedCast) default_expr).Child;
- var res = Convert.ImplicitConversionStandard (rc, default_expr, parameter_type, \
default_expr.Location);
- if (res != null) {
- if (TypeManager.IsNullableType (parameter_type) && res is Nullable.Wrap) {
- Nullable.Wrap wrap = (Nullable.Wrap) res;
- res = wrap.Child;
- if (!(res is Constant)) {
- rc.Compiler.Report.Error (1770, default_expr.Location,
- "The expression being assigned to nullable optional parameter `{0}' must be \
default value",
- Name);
- return null;
+ Constant c = default_expr as Constant;
+ if (c == null) {
+ if (parameter_type == TypeManager.object_type) {
+ rc.Compiler.Report.Error (1910, default_expr.Location,
+ "Argument of type `{0}' is not applicable for the DefaultParameterValue \
attribute", + default_expr.Type.GetSignatureForError ());
+ } else {
+ rc.Compiler.Report.Error (1909, default_expr.Location,
+ "The DefaultParameterValue attribute is not applicable on parameters of type \
`{0}'", + default_expr.Type.GetSignatureForError ()); ;
}
- }
- if (!default_expr.IsNull && TypeManager.IsReferenceType (parameter_type) && \
parameter_type != TypeManager.string_type) {
- rc.Compiler.Report.Error (1763, default_expr.Location,
- "Optional parameter `{0}' of type `{1}' can only be initialized with `null'",
- Name, GetSignatureForError ());
+ default_expr = null;
+ return;
+ }
- return null;
+ if (TypeSpecComparer.IsEqual (default_expr.Type, parameter_type) ||
+ (default_expr is NullConstant && TypeManager.IsReferenceType (parameter_type) \
&& !parameter_type.IsGenericParameter) || + TypeSpecComparer.IsEqual \
(parameter_type, TypeManager.object_type)) { + return;
}
- return res;
+ //
+ // LAMESPEC: Some really weird csc behaviour which we have to mimic
+ // User operators returning same type as parameter type are considered
+ // valid for this attribute only
+ //
+ // struct S { public static implicit operator S (int i) {} }
+ //
+ // void M ([DefaultParameterValue (3)]S s)
+ //
+ var expr = Convert.ImplicitUserConversion (dpa_rc, default_expr, parameter_type, \
loc); + if (expr != null && TypeSpecComparer.IsEqual (expr.Type, parameter_type)) \
{ + return;
+ }
+
+ rc.Compiler.Report.Error (1908, default_expr.Location, "The type of the default \
value should match the type of the parameter"); + return;
}
- rc.Compiler.Report.Error (1750, Location,
- "Optional parameter expression of type `{0}' cannot be converted to parameter \
type `{1}'",
- TypeManager.CSharpName (default_expr.Type), GetSignatureForError ());
-
- return null;
+ if (opt_attr != null) {
+ default_expr = EmptyExpression.MissingValue;
+ }
}
public bool HasDefaultValue {
@@ -514,11 +492,6 @@ namespace Mono.CSharp {
set { name = value; }
}
- ParameterAttributes Attributes {
- get { return ParametersCompiled.GetParameterAttribute (modFlags) |
- (HasDefaultValue ? ParameterAttributes.Optional : ParameterAttributes.None); }
- }
-
public override AttributeTargets AttributeTargets {
get {
return AttributeTargets.Parameter;
@@ -570,10 +543,14 @@ namespace Mono.CSharp {
if (builder != null)
throw new InternalErrorException ("builder already exists");
+ var pattrs = ParametersCompiled.GetParameterAttribute (modFlags);
+ if (HasOptionalExpression)
+ pattrs |= ParameterAttributes.Optional;
+
if (mb == null)
- builder = cb.DefineParameter (index, Attributes, Name);
+ builder = cb.DefineParameter (index, pattrs, Name);
else
- builder = mb.DefineParameter (index, Attributes, Name);
+ builder = mb.DefineParameter (index, pattrs, Name);
if (OptAttributes != null)
OptAttributes.Emit ();
@@ -583,7 +560,8 @@ namespace Mono.CSharp {
// Emit constant values for true constants only, the other
// constant-like expressions will rely on default value expression
//
- Constant c = default_expr as Constant;
+ var def_value = DefaultValue;
+ Constant c = def_value != null ? def_value.Child as Constant : default_expr as \
Constant; if (c != null) {
if (default_expr.Type == TypeManager.decimal_type) {
pa.DecimalConstant.EmitAttribute (builder, (decimal) c.GetValue (), \
c.Location); @@ -1209,4 +1187,74 @@ namespace Mono.CSharp {
return p;
}
}
+
+ //
+ // Default parameter value expression. We need this wrapper to handle
+ // default parameter values of folded constants when for indexer parameters
+ // The expression is resolved only once but applied to two methods which
+ // both share reference to this expression and we ensure that resolving
+ // this expression always returns same instance
+ //
+ public class DefaultParameterValueExpression : CompositeExpression
+ {
+ public DefaultParameterValueExpression (Expression expr)
+ : base (expr)
+ {
+ }
+
+ protected override Expression DoResolve (ResolveContext rc)
+ {
+ return base.DoResolve (rc);
+ }
+
+ public void Resolve (ResolveContext rc, Parameter p)
+ {
+ var expr = Resolve (rc);
+ if (expr == null)
+ return;
+
+ expr = Child;
+
+ if (!(expr is Constant || expr is DefaultValueExpression || (expr is New && \
((New) expr).IsDefaultStruct))) { + rc.Compiler.Report.Error (1736, Location,
+ "The expression being assigned to optional parameter `{0}' must be a constant \
or default value", + p.Name);
+
+ return;
+ }
+
+ var parameter_type = p.Type;
+ if (type == parameter_type)
+ return;
+
+ var res = Convert.ImplicitConversionStandard (rc, expr, parameter_type, \
Location); + if (res != null) {
+ if (TypeManager.IsNullableType (parameter_type) && res is Nullable.Wrap) {
+ Nullable.Wrap wrap = (Nullable.Wrap) res;
+ res = wrap.Child;
+ if (!(res is Constant)) {
+ rc.Compiler.Report.Error (1770, Location,
+ "The expression being assigned to nullable optional parameter `{0}' must be \
default value", + p.Name);
+ return;
+ }
+ }
+
+ if (!expr.IsNull && TypeManager.IsReferenceType (parameter_type) && \
parameter_type != TypeManager.string_type) { + rc.Compiler.Report.Error (1763, \
Location, + "Optional parameter `{0}' of type `{1}' can only be initialized with \
`null'", + p.Name, parameter_type.GetSignatureForError ());
+
+ return;
+ }
+
+ this.expr = res;
+ return;
+ }
+
+ rc.Compiler.Report.Error (1750, Location,
+ "Optional parameter expression of type `{0}' cannot be converted to parameter \
type `{1}'", + type.GetSignatureForError (), parameter_type.GetSignatureForError \
()); + }
+ }
}
Commit: b4e49b89b46a4beeaf4b17e11c25268d937281d4
Author: Miguel de Icaza <miguel@gnome.org>
Date: 02/02/2011 13:09:53
URL: https://github.com/mono/mono/commit/b4e49b89b46a4beeaf4b17e11c25268d937281d4
[csharp] Change the signature for print
Changed paths:
M mcs/mcs/eval.cs
Modified: mcs/mcs/eval.cs
===================================================================
--- a/mcs/mcs/eval.cs
+++ b/mcs/mcs/eval.cs
@@ -1055,9 +1055,9 @@ namespace Mono.CSharp
Evaluator.LoadAssembly (assembly);
}
- static public void print (string text)
+ static public void print (string obj)
{
- Output.WriteLine (text);
+ Output.WriteLine (obj);
}
static public void print (string fmt, params object [] args)
Commit: 0efd1e04f6af20c63c45906471d50b4d7b540005
Author: Rodrigo Kumpera <kumpera@gmail.com>
Date: 02/02/2011 14:28:30
URL: https://github.com/mono/mono/commit/0efd1e04f6af20c63c45906471d50b4d7b540005
Fix dynamic method cleanup at shutdown.
* gc.c (mono_gc_cleanup): Cleanup all reference
queues after regular finalization.
* reflection.c: The dynamic method ref queue is finalized
by the runtime itself.
* runtime.c: Ditto.
Changed paths:
M mono/metadata/gc.c
M mono/metadata/object-internals.h
M mono/metadata/reflection.c
M mono/metadata/runtime.c
Modified: mono/metadata/gc.c
===================================================================
--- a/mono/metadata/gc.c
+++ b/mono/metadata/gc.c
@@ -66,6 +66,7 @@ static void object_register_finalizer (MonoObject *obj, void \
(*callback)(void *, static void mono_gchandle_set_target (guint32 gchandle, \
MonoObject *obj);
static void reference_queue_proccess_all (void);
+static void mono_reference_queue_cleanup (void);
#ifndef HAVE_NULL_GC
static HANDLE pending_done_event;
static HANDLE shutdown_event;
@@ -1171,6 +1172,8 @@ mono_gc_cleanup (void)
#endif
}
+ mono_reference_queue_cleanup ();
+
DeleteCriticalSection (&handle_section);
DeleteCriticalSection (&allocator_section);
DeleteCriticalSection (&finalizer_mutex);
@@ -1361,6 +1364,15 @@ restart:
LeaveCriticalSection (&reference_queue_mutex);
}
+static void
+mono_reference_queue_cleanup (void)
+{
+ MonoReferenceQueue *queue = ref_queues;
+ for (; queue; queue = queue->next)
+ queue->should_be_deleted = TRUE;
+ reference_queue_proccess_all ();
+}
+
/**
* mono_gc_reference_queue_new:
* @callback callback used when processing dead entries.
Modified: mono/metadata/object-internals.h
===================================================================
--- a/mono/metadata/object-internals.h
+++ b/mono/metadata/object-internals.h
@@ -1539,9 +1539,6 @@ mono_object_new_pinned (MonoDomain *domain, MonoClass *klass) \
MONO_INTERNAL; void
mono_field_static_get_value_for_thread (MonoInternalThread *thread, MonoVTable *vt, \
MonoClassField *field, void *value) MONO_INTERNAL;
-void
-mono_reflection_shutdown (void) MONO_INTERNAL;
-
#endif /* __MONO_OBJECT_INTERNALS_H__ */
Modified: mono/metadata/reflection.c
===================================================================
--- a/mono/metadata/reflection.c
+++ b/mono/metadata/reflection.c
@@ -11445,20 +11445,11 @@ typedef struct {
MonoMethod *handle;
MonoDomain *domain;
} DynamicMethodReleaseData;
-
-static MonoReferenceQueue *dynamic_method_queue;
-void
-mono_reflection_shutdown (void)
-{
- MonoReferenceQueue *queue;
- mono_loader_lock ();
- queue = dynamic_method_queue;
- dynamic_method_queue = NULL;
- if (queue)
- mono_gc_reference_queue_free (queue);
- mono_loader_unlock ();
-}
+/*
+ * The runtime automatically clean up those after finalization.
+*/
+static MonoReferenceQueue *dynamic_method_queue;
static void
free_dynamic_method (void *dynamic_method)
Modified: mono/metadata/runtime.c
===================================================================
--- a/mono/metadata/runtime.c
+++ b/mono/metadata/runtime.c
@@ -39,8 +39,5 @@ void
mono_runtime_shutdown (void)
{
mono_domain_foreach (fire_process_exit_event, NULL);
-
- /*From this point on, no more DM methods can be created. */
- mono_reflection_shutdown ();
}
Commit: 63f4b4cdd45c05d4b90737878f578f2316f26328
Author: Zoltan Varga <vargaz@gmail.com>
Date: 02/02/2011 18:36:41
URL: https://github.com/mono/mono/commit/63f4b4cdd45c05d4b90737878f578f2316f26328
Fix a warning.
Changed paths:
M mono/metadata/gc.c
Modified: mono/metadata/gc.c
===================================================================
--- a/mono/metadata/gc.c
+++ b/mono/metadata/gc.c
@@ -1411,7 +1411,6 @@ mono_gc_reference_queue_new (mono_reference_queue_callback \
callback) gboolean
mono_gc_reference_queue_add (MonoReferenceQueue *queue, MonoObject *obj, void \
*user_data) {
- RefQueueEntry *head;
RefQueueEntry *entry;
if (queue->should_be_deleted)
return FALSE;
Commit: db64c7f8f1c3d790772a0303efb60317ad387761
Author: Zoltan Varga <vargaz@gmail.com>
Date: 02/02/2011 18:37:45
URL: https://github.com/mono/mono/commit/db64c7f8f1c3d790772a0303efb60317ad387761
Add support for --debug=casts to Array:SetValue (). Fixes #668851.
Changed paths:
M mono/metadata/icall.c
M mono/metadata/object-internals.h
M mono/mini/mini-exceptions.c
M mono/mini/mini.c
M mono/mini/mini.h
Modified: mono/metadata/icall.c
===================================================================
--- a/mono/metadata/icall.c
+++ b/mono/metadata/icall.c
@@ -246,7 +246,8 @@ ves_icall_System_Array_SetValueImpl (MonoArray *this, MonoObject \
*value, guint32 "value", "not a widening conversion")); \
}G_STMT_END
-#define INVALID_CAST G_STMT_START{\
+#define INVALID_CAST G_STMT_START{ \
+ mono_get_runtime_callbacks ()->set_cast_details (vc, ec); \
mono_raise_exception (mono_get_exception_invalid_cast ()); \
}G_STMT_END
Modified: mono/metadata/object-internals.h
===================================================================
--- a/mono/metadata/object-internals.h
+++ b/mono/metadata/object-internals.h
@@ -568,6 +568,7 @@ typedef struct {
char* (*get_runtime_build_info) (void);
gpointer (*get_vtable_trampoline) (int slot_index);
gpointer (*get_imt_trampoline) (int imt_slot_index);
+ void (*set_cast_details) (MonoClass *from, MonoClass *to);
} MonoRuntimeCallbacks;
/* used to free a dynamic method */
Modified: mono/mini/mini-exceptions.c
===================================================================
--- a/mono/mini/mini-exceptions.c
+++ b/mono/mini/mini-exceptions.c
@@ -2374,3 +2374,15 @@ mono_install_handler_block_guard (MonoInternalThread *thread, \
MonoContext *ctx)
#endif
+void
+mono_set_cast_details (MonoClass *from, MonoClass *to)
+{
+ MonoJitTlsData *jit_tls = NULL;
+
+ if (mini_get_debug_options ()->better_cast_details) {
+ jit_tls = TlsGetValue (mono_jit_tls_id);
+ jit_tls->class_cast_from = from;
+ jit_tls->class_cast_to = to;
+ }
+}
+
Modified: mono/mini/mini.c
===================================================================
--- a/mono/mini/mini.c
+++ b/mono/mini/mini.c
@@ -6176,6 +6176,7 @@ mini_init (const char *filename, const char *runtime_version)
callbacks.create_ftnptr = mini_create_ftnptr;
callbacks.get_addr_from_ftnptr = mini_get_addr_from_ftnptr;
callbacks.get_runtime_build_info = mono_get_runtime_build_info;
+ callbacks.set_cast_details = mono_set_cast_details;
#ifdef MONO_ARCH_HAVE_IMT
if (mono_use_imt) {
Modified: mono/mini/mini.h
===================================================================
--- a/mono/mini/mini.h
+++ b/mono/mini/mini.h
@@ -2141,6 +2141,7 @@ MonoBoolean ves_icall_get_frame_info (gint32 skip, \
MonoBoolean need_f gint32 *iloffset, gint32 *native_offset,
MonoString **file, gint32 *line, gint32 *column) MONO_INTERNAL;
MonoString *ves_icall_System_Exception_get_trace (MonoException *exc) MONO_INTERNAL;
+void mono_set_cast_details (MonoClass *from, MonoClass *to) \
MONO_INTERNAL;
/* Dominator/SSA methods */
void mono_compile_dominator_info (MonoCompile *cfg, int dom_flags) \
MONO_INTERNAL;
Commit: fe7386298f0996904e67f2807f628611217aa366
Author: Marek Habersack <grendel@twistedcode.net>
Date: 02/02/2011 20:23:15
URL: https://github.com/mono/mono/commit/fe7386298f0996904e67f2807f628611217aa366
[reflection] Default binder's AdjustArguments method treats ParamArray parameters \
which are already arrays properly
Such parameters are not adjusted as it would lead to an InvalidCastException whenever \
an attempt to set an array index's value would be made.
Changed paths:
M mcs/class/corlib/System.Reflection/Binder.cs
M mcs/class/corlib/Test/System.Reflection/BinderTests.cs
Modified: mcs/class/corlib/System.Reflection/Binder.cs
===================================================================
--- a/mcs/class/corlib/System.Reflection/Binder.cs
+++ b/mcs/class/corlib/System.Reflection/Binder.cs
@@ -182,22 +182,31 @@ namespace System.Reflection
static void AdjustArguments (MethodBase selected, ref object [] args)
{
var parameters = selected.GetParameters ();
- if (parameters.Length == 0)
+ var parameters_length = parameters.Length;
+ if (parameters_length == 0)
return;
var last_parameter = parameters [parameters.Length - 1];
+ Type last_parameter_type = last_parameter.ParameterType;
if (!Attribute.IsDefined (last_parameter, typeof (ParamArrayAttribute)))
return;
- var adjusted = new object [parameters.Length];
- Array.Copy (args, adjusted, parameters.Length - 1);
-
- var param_args_count = args.Length + 1 - parameters.Length;
- var params_args = Array.CreateInstance \
(last_parameter.ParameterType.GetElementType (), param_args_count);
-
+ var args_length = args.Length;
+ var param_args_count = args_length + 1 - parameters_length;
+ var first_vararg_index = args_length - param_args_count;
+ if (first_vararg_index < args_length) {
+ var first_vararg = args [first_vararg_index];
+ if (first_vararg != null && first_vararg.GetType () == last_parameter_type)
+ return;
+ }
+
+ var params_args = Array.CreateInstance (last_parameter_type.GetElementType (), \
param_args_count); for (int i = 0; i < param_args_count; i++)
- params_args.SetValue (args [args.Length - param_args_count + i], i);
+ params_args.SetValue (args [first_vararg_index + i], i);
+ var adjusted = new object [parameters_length];
+ Array.Copy (args, adjusted, parameters_length - 1);
+
adjusted [adjusted.Length - 1] = params_args;
args = adjusted;
}
Modified: mcs/class/corlib/Test/System.Reflection/BinderTests.cs
===================================================================
--- a/mcs/class/corlib/Test/System.Reflection/BinderTests.cs
+++ b/mcs/class/corlib/Test/System.Reflection/BinderTests.cs
@@ -20,6 +20,12 @@ namespace MonoTests.System.Reflection
One,
Two
}
+
+ class ParamsArrayTest
+ {
+ public ParamsArrayTest (params string[] strings)
+ {}
+ }
class SampleClass {
public static void SampleMethod (object o) { }
@@ -101,6 +107,14 @@ namespace MonoTests.System.Reflection
Binder binder = Type.DefaultBinder;
[Test]
+ public void ParamsArrayTestCast ()
+ {
+ string[] test_args = { "one", "two", "three" };
+ var o = Activator.CreateInstance (typeof (ParamsArrayTest), new object[] { \
test_args }); + Assert.IsNotNull (o, "#A1");
+ }
+
+ [Test]
[ExpectedException (typeof (ArgumentException))]
public void SelectPropertyTestNull1 ()
{
Commit: a5f9b5d9c6119b40459c4f9e88b0c933a35a88dd
Author: Marek Safar <marek.safar@gmail.com>
Date: 02/03/2011 08:55:28
URL: https://github.com/mono/mono/commit/a5f9b5d9c6119b40459c4f9e88b0c933a35a88dd
Allow any expression to be used in where clause. Some custom linq implementations use \
non-predicate version of where
Changed paths:
M mcs/mcs/cs-parser.jay
M mcs/mcs/linq.cs
Modified: mcs/mcs/cs-parser.jay
===================================================================
--- a/mcs/mcs/cs-parser.jay
+++ b/mcs/mcs/cs-parser.jay
@@ -5661,9 +5661,9 @@ where_clause
{
current_block = new Linq.QueryBlock (compiler, current_block, lexer.Location);
}
- boolean_expression
+ expression
{
- $$ = new Linq.Where ((Linq.QueryBlock)current_block, (BooleanExpression)$3, \
GetLocation ($1)); + $$ = new Linq.Where ((Linq.QueryBlock)current_block, \
(Expression)$3, GetLocation ($1));
current_block.SetEndLocation (lexer.Location);
current_block = current_block.Parent;
Modified: mcs/mcs/linq.cs
===================================================================
--- a/mcs/mcs/linq.cs
+++ b/mcs/mcs/linq.cs
@@ -644,7 +644,7 @@ namespace Mono.CSharp.Linq
public class Where : AQueryClause
{
- public Where (QueryBlock block, BooleanExpression expr, Location loc)
+ public Where (QueryBlock block, Expression expr, Location loc)
: base (block, expr, loc)
{
}
Commit: a96d06832153f191d2960c1307a86b9a130f5dcf
Author: Zoltan Varga <vargaz@gmail.com>
Date: 02/03/2011 10:06:25
URL: https://github.com/mono/mono/commit/a96d06832153f191d2960c1307a86b9a130f5dcf
Fix the passing of vtype arguments for methods which return floats in soft-float \
mode. Fixes #668905.
Changed paths:
M mono/mini/decompose.c
M mono/mini/mini-arm.c
M mono/mini/mini-codegen.c
M mono/mini/mini-ops.h
M mono/mini/mini.h
M mono/mini/objects.cs
Modified: mono/mini/decompose.c
===================================================================
--- a/mono/mini/decompose.c
+++ b/mono/mini/decompose.c
@@ -1527,6 +1527,7 @@ mono_decompose_soft_float (MonoCompile *cfg)
MonoCallInst *call2;
MonoInst *iargs [1];
MonoInst *conv;
+ GSList *l;
/* Convert the call into a call returning an int */
MONO_INST_NEW_CALL (cfg, call2, OP_CALL);
@@ -1547,6 +1548,10 @@ mono_decompose_soft_float (MonoCompile *cfg)
call2->inst.dreg = mono_alloc_ireg (cfg);
MONO_ADD_INS (cfg->cbb, (MonoInst*)call2);
+ /* Remap OUTARG_VT instructions referencing this call */
+ for (l = call->outarg_vts; l; l = l->next)
+ ((MonoInst*)(l->data))->inst_p0 = call2;
+
/* FIXME: Optimize this */
/* Emit an r4->r8 conversion */
Modified: mono/mini/mini-arm.c
===================================================================
--- a/mono/mini/mini-arm.c
+++ b/mono/mini/mini-arm.c
@@ -1605,6 +1605,7 @@ mono_arch_emit_call (MonoCompile *cfg, MonoCallInst *call)
ins->inst_p0 = call;
ins->inst_p1 = mono_mempool_alloc (cfg->mempool, sizeof (ArgInfo));
memcpy (ins->inst_p1, ainfo, sizeof (ArgInfo));
+ mono_call_inst_add_outarg_vt (cfg, call, ins);
MONO_ADD_INS (cfg->cbb, ins);
break;
case RegTypeBase:
Modified: mono/mini/mini-codegen.c
===================================================================
--- a/mono/mini/mini-codegen.c
+++ b/mono/mini/mini-codegen.c
@@ -271,6 +271,17 @@ mono_call_inst_add_outarg_reg (MonoCompile *cfg, MonoCallInst \
*call, int vreg, i }
}
+/*
+ * mono_call_inst_add_outarg_vt:
+ *
+ * Register OUTARG_VT as belonging to CALL.
+ */
+void
+mono_call_inst_add_outarg_vt (MonoCompile *cfg, MonoCallInst *call, MonoInst \
*outarg_vt) +{
+ call->outarg_vts = g_slist_append_mempool (cfg->mempool, call->outarg_vts, \
outarg_vt); +}
+
static void
resize_spill_info (MonoCompile *cfg, int bank)
{
Modified: mono/mini/mini-ops.h
===================================================================
--- a/mono/mini/mini-ops.h
+++ b/mono/mini/mini-ops.h
@@ -17,6 +17,10 @@ MINI_OP(OP_ICOMPARE_IMM, "icompare_imm", NONE, IREG, NONE)
MINI_OP(OP_LCOMPARE_IMM, "lcompare_imm", NONE, LREG, NONE)
MINI_OP(OP_LOCAL, "local", NONE, NONE, NONE)
MINI_OP(OP_ARG, "arg", NONE, NONE, NONE)
+/*
+ * Represents passing a valuetype argument which has not been decomposed yet.
+ * inst_p0 points to the call.
+ */
MINI_OP(OP_OUTARG_VT, "outarg_vt", NONE, VREG, NONE)
MINI_OP(OP_OUTARG_VTRETADDR, "outarg_vtretaddr", IREG, NONE, NONE)
MINI_OP(OP_SETRET, "setret", NONE, IREG, NONE)
Modified: mono/mini/mini.h
===================================================================
--- a/mono/mini/mini.h
+++ b/mono/mini/mini.h
@@ -799,6 +799,7 @@ struct MonoCallInst {
regmask_t used_fregs;
GSList *out_ireg_args;
GSList *out_freg_args;
+ GSList *outarg_vts;
#ifdef ENABLE_LLVM
LLVMCallInfo *cinfo;
int rgctx_arg_reg, imt_arg_reg;
@@ -1970,6 +1971,7 @@ void *mono_arch_instrument_epilog (MonoCompile \
*cfg, void *func, v void *mono_arch_instrument_epilog_full (MonoCompile \
*cfg, void *func, void *p, gboolean enable_arguments, gboolean \
preserve_argument_registers) MONO_INTERNAL; void mono_codegen \
(MonoCompile *cfg) MONO_INTERNAL; void mono_call_inst_add_outarg_reg \
(MonoCompile *cfg, MonoCallInst *call, int vreg, int hreg, int bank) \
MONO_LLVM_INTERNAL; +void mono_call_inst_add_outarg_vt (MonoCompile \
*cfg, MonoCallInst *call, MonoInst *outarg_vt) MONO_INTERNAL; const char \
*mono_arch_regname (int reg) MONO_INTERNAL; const char \
*mono_arch_fregname (int reg) MONO_INTERNAL; void \
mono_arch_exceptions_init (void) MONO_INTERNAL;
Modified: mono/mini/objects.cs
===================================================================
--- a/mono/mini/objects.cs
+++ b/mono/mini/objects.cs
@@ -1352,6 +1352,19 @@ ncells ) {
return 1;
}
+ struct AStruct2 {
+ public int i;
+ public int j;
+ }
+
+ static float pass_vtype_return_float (AStruct2 s) {
+ return s.i + s.j == 6 ? 1.0f : -1.0f;
+ }
+
+ public static int test_0_vtype_arg_soft_float () {
+ return pass_vtype_return_float (new AStruct2 () { i = 2, j = 4 }) > 0.0 ? 0 : 1;
+ }
+
static int range_check_strlen (int i, string s) {
if (i < 0 || i > s.Length)
return 1;
Commit: 8b1e1255e6021a550781d0bfd508e35bc1091a69
Author: Marek Safar <marek.safar@gmail.com>
Date: 02/03/2011 10:16:50
URL: https://github.com/mono/mono/commit/8b1e1255e6021a550781d0bfd508e35bc1091a69
Fix importing of private types under dynamic context
Changed paths:
M mcs/mcs/import.cs
Modified: mcs/mcs/import.cs
===================================================================
--- a/mcs/mcs/import.cs
+++ b/mcs/mcs/import.cs
@@ -1790,7 +1790,7 @@ namespace Mono.CSharp
var t = (MetaType) member;
// Ignore compiler generated types, mostly lambda containers
- if ((t.Attributes & TypeAttributes.VisibilityMask) == \
TypeAttributes.NestedPrivate) + if ((t.Attributes & \
TypeAttributes.VisibilityMask) == TypeAttributes.NestedPrivate && \
importer.IgnorePrivateMembers) continue;
imported = importer.CreateNestedType (t, declaringType);
@@ -1803,7 +1803,7 @@ namespace Mono.CSharp
var t = (MetaType) member;
- if ((t.Attributes & TypeAttributes.VisibilityMask) == \
TypeAttributes.NestedPrivate) + if ((t.Attributes & \
TypeAttributes.VisibilityMask) == TypeAttributes.NestedPrivate && \
importer.IgnorePrivateMembers) continue;
importer.ImportTypeBase (t);
Commit: 320645f3128d112157b58e93b720b0cfe730660e
Author: Marek Safar <marek.safar@gmail.com>
Date: 02/03/2011 10:21:13
URL: https://github.com/mono/mono/commit/320645f3128d112157b58e93b720b0cfe730660e
Add handling of broken Convert callsite from Orchard Project
Changed paths:
M mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpBinder.cs
M mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/RuntimeBinderContext.cs
Modified: mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpBinder.cs
===================================================================
--- a/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpBinder.cs
+++ b/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpBinder.cs
@@ -69,7 +69,7 @@ namespace Microsoft.CSharp.RuntimeBinder
{
Expression res;
try {
- var rc = new Compiler.ResolveContext (new RuntimeBinderContext (ctx, \
ctx.ImportType (callingType)), ResolveOptions); + var rc = new \
Compiler.ResolveContext (new RuntimeBinderContext (ctx, callingType), \
ResolveOptions);
// Static typemanager and internal caches are not thread-safe
lock (resolver) {
Modified: mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/RuntimeBinderContext.cs
===================================================================
--- a/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/RuntimeBinderContext.cs
+++ b/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/RuntimeBinderContext.cs
@@ -1,4 +1,4 @@
-???//
+//
// RuntimeBinderContext.cs
//
// Authors:
@@ -35,18 +35,39 @@ namespace Microsoft.CSharp.RuntimeBinder
class RuntimeBinderContext : Compiler.IMemberContext
{
readonly Compiler.ModuleContainer module;
- readonly Compiler.TypeSpec currentType;
+ readonly Type callingType;
+ readonly DynamicContext ctx;
+ Compiler.TypeSpec callingTypeImported;
- public RuntimeBinderContext (DynamicContext ctx, Compiler.TypeSpec currentType)
+ public RuntimeBinderContext (DynamicContext ctx, Compiler.TypeSpec callingType)
{
+ this.ctx = ctx;
this.module = ctx.Module;
- this.currentType = currentType;
+ this.callingTypeImported = callingType;
+ }
+
+ public RuntimeBinderContext (DynamicContext ctx, Type callingType)
+ {
+ this.ctx = ctx;
+ this.module = ctx.Module;
+ this.callingType = callingType;
}
#region IMemberContext Members
public Compiler.TypeSpec CurrentType {
- get { return currentType; }
+ get {
+ //
+ // Delay importing of calling type to be compatible with .net
+ // Some libraries are setting it to null which is invalid
+ // but the NullReferenceException is thrown only when the context
+ // is used and not during initialization
+ //
+ if (callingTypeImported == null)
+ callingTypeImported = ctx.ImportType (callingType);
+
+ return callingTypeImported;
+ }
}
public Compiler.TypeParameter[] CurrentTypeParameters {
Commit: c139a0e52dd4578e43c1e37fd999dc5a016835bb
Author: Marek Safar <marek.safar@gmail.com>
Date: 02/03/2011 10:21:38
URL: https://github.com/mono/mono/commit/c139a0e52dd4578e43c1e37fd999dc5a016835bb
Don't even try to import type when its context is wrong
Changed paths:
M mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/RuntimeBinderContext.cs
Modified: mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/RuntimeBinderContext.cs
===================================================================
--- a/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/RuntimeBinderContext.cs
+++ b/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/RuntimeBinderContext.cs
@@ -63,7 +63,7 @@ namespace Microsoft.CSharp.RuntimeBinder
// but the NullReferenceException is thrown only when the context
// is used and not during initialization
//
- if (callingTypeImported == null)
+ if (callingTypeImported == null && callingType != null)
callingTypeImported = ctx.ImportType (callingType);
return callingTypeImported;
Commit: c7f2fda73da44f403d84ad8f20c89a7cd59e8628
Author: Marek Habersack <grendel@twistedcode.net>
Date: 02/03/2011 11:43:02
URL: https://github.com/mono/mono/commit/c7f2fda73da44f403d84ad8f20c89a7cd59e8628
[xml] XmlReaderSettings.{DtdProcessing,MaxCharactersFromEntities,MaxCharactersInDocument} \
are present in 3.5+
With the exception of DtdProcessing, the properties are part of .NET 3.5+. \
DtdProcessing appeared in 4.0.
Changed paths:
M mcs/class/System.XML/System.Xml/XmlReaderSettings.cs
Modified: mcs/class/System.XML/System.Xml/XmlReaderSettings.cs
===================================================================
--- a/mcs/class/System.XML/System.Xml/XmlReaderSettings.cs
+++ b/mcs/class/System.XML/System.Xml/XmlReaderSettings.cs
@@ -60,11 +60,11 @@ namespace System.Xml
private ValidationType validationType;
#endif
private XmlResolver xmlResolver;
-#if MOONLIGHT || NET_4_0
+#if NET_4_0
private DtdProcessing dtdProcessing;
+#endif
private long maxCharactersFromEntities;
private long maxCharactersInDocument;
-#endif
public XmlReaderSettings ()
{
@@ -118,7 +118,7 @@ namespace System.Xml
get { return conformance; }
set { conformance = value; }
}
-#if MOONLIGHT || NET_4_0
+#if NET_4_0
public DtdProcessing DtdProcessing {
get { return dtdProcessing; }
set {
@@ -126,7 +126,7 @@ namespace System.Xml
prohibitDtd = (value == DtdProcessing.Prohibit);
}
}
-
+#endif
public long MaxCharactersFromEntities {
get { return maxCharactersFromEntities; }
set { maxCharactersFromEntities = value; }
@@ -137,7 +137,6 @@ namespace System.Xml
get { return maxCharactersInDocument; }
set { maxCharactersInDocument = value; }
}
-#endif
public bool IgnoreComments {
get { return ignoreComments; }
Commit: 568f9ab996b6bf3e7dfbe1fe2c553144389b79f2
Author: Marek Habersack <grendel@twistedcode.net>
Date: 02/03/2011 11:43:31
URL: https://github.com/mono/mono/commit/568f9ab996b6bf3e7dfbe1fe2c553144389b79f2
[asp.net] HttpRuntimeSection.RequestPathInvalidCharacters default value is different
Changed paths:
M mcs/class/System.Web/System.Web.Configuration_2.0/HttpRuntimeSection.cs
Modified: mcs/class/System.Web/System.Web.Configuration_2.0/HttpRuntimeSection.cs
===================================================================
--- a/mcs/class/System.Web/System.Web.Configuration_2.0/HttpRuntimeSection.cs
+++ b/mcs/class/System.Web/System.Web.Configuration_2.0/HttpRuntimeSection.cs
@@ -118,7 +118,7 @@ namespace System.Web.Configuration
PropertyHelper.IntFromZeroToMaxValidator,
ConfigurationPropertyOptions.None);
#if NET_4_0
- requestPathInvalidCharactersProp = new ConfigurationProperty \
("requestPathInvalidCharacters", typeof (string), ",*,%,&,:,\\,?"); \
+ requestPathInvalidCharactersProp = new ConfigurationProperty \
("requestPathInvalidCharacters", typeof (string), "<,>,*,%,&,:,\\,?"); \
requestValidationTypeProp = new ConfigurationProperty ("requestValidationType", \
typeof (string),"System.Web.Util.RequestValidator", TypeDescriptor.GetConverter \
(typeof (string)), PropertyHelper.NonEmptyStringValidator,
Commit: d47a028ed4c9dcd34f057d58f30643472b298f58
Author: Ankit Jain <radical@corewars.org>
Date: 02/03/2011 14:33:45
URL: https://github.com/mono/mono/commit/d47a028ed4c9dcd34f057d58f30643472b298f58
[webservices] Extensions can be unknown XmlElements also, fix.
* class/System.Web.Services/System.Web.Services.Description/BasicProfileChecker.cs:
Extensions can be XmlElement or ServiceDescriptionFormatExtension.
* class/System.Web.Services/System.Web.Services.Description/ServiceDescription.cs:
(AddExtensionNamespaces): Likewise. Also, ignore namespaces from
XmlElement, as we retain and write them out as-is.
(WriteExtension): Emit the XmlElement as-is.
* class/System.Web.Services/Test/System.Web.Services.Description/ServiceDescriptionTest.cs:
Update to write out the wsdl also.
Changed paths:
M mcs/class/System.Web.Services/System.Web.Services.Description/BasicProfileChecker.cs
M mcs/class/System.Web.Services/System.Web.Services.Description/ServiceDescription.cs
M mcs/class/System.Web.Services/Test/System.Web.Services.Description/ServiceDescriptionTest.cs
Modified: mcs/class/System.Web.Services/System.Web.Services.Description/BasicProfileChecker.cs
===================================================================
--- a/mcs/class/System.Web.Services/System.Web.Services.Description/BasicProfileChecker.cs
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/BasicProfileChecker.cs
@@ -142,7 +142,7 @@ namespace System.Web.Services.Description
public override void Check (ConformanceCheckContext ctx, BindingCollection value) \
{ foreach (Binding b in value)
- foreach (ServiceDescriptionFormatExtension ext in b.Extensions)
+ foreach (object ext in b.Extensions)
if (ext.GetType () == typeof (SoapBinding))
return;
Modified: mcs/class/System.Web.Services/System.Web.Services.Description/ServiceDescription.cs
===================================================================
--- a/mcs/class/System.Web.Services/System.Web.Services.Description/ServiceDescription.cs
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/ServiceDescription.cs
@@ -339,8 +339,13 @@ namespace System.Web.Services.Description
void AddExtensionNamespaces (XmlSerializerNamespaces ns, \
ServiceDescriptionFormatExtensionCollection extensions) {
- foreach (ServiceDescriptionFormatExtension ext in extensions)
+ foreach (object o in extensions)
{
+ ServiceDescriptionFormatExtension ext = o as ServiceDescriptionFormatExtension;
+ if (ext == null)
+ // o can be XmlElement, skipping that
+ continue;
+
ExtensionInfo einf = ExtensionManager.GetFormatExtensionInfo (ext.GetType ());
foreach (XmlQualifiedName qname in einf.NamespaceDeclarations)
ns.Add (qname.Name, qname.Namespace);
@@ -352,8 +357,12 @@ namespace System.Web.Services.Description
ServiceDescriptionFormatExtensionCollection extensions = \
ExtensionManager.GetExtensionPoint (ob); if (extensions != null)
{
- foreach (ServiceDescriptionFormatExtension ext in extensions)
- WriteExtension (writer, ext);
+ foreach (object o in extensions) {
+ if (o is ServiceDescriptionFormatExtension)
+ WriteExtension (writer, (ServiceDescriptionFormatExtension)o);
+ else if (o is XmlElement)
+ ((XmlElement)o).WriteTo (writer);
+ }
}
}
Modified: mcs/class/System.Web.Services/Test/System.Web.Services.Description/ServiceDescriptionTest.cs
===================================================================
--- a/mcs/class/System.Web.Services/Test/System.Web.Services.Description/ServiceDescriptionTest.cs
+++ b/mcs/class/System.Web.Services/Test/System.Web.Services.Description/ServiceDescriptionTest.cs
@@ -141,6 +141,14 @@ namespace MonoTests.System.Web.Services.Description
Assert.AreEqual (typeof (SoapAddressBinding), sd.Services [0].Ports \
[0].Extensions [0].GetType ());
CheckXmlElement (sd.Services [0].Ports [0].Extensions [1], "portElem");
+ string out_file = Path.GetTempFileName ();
+ try {
+ using (FileStream out_fs = new FileStream(out_file, FileMode.Create))
+ sd.Write (out_fs);
+ } finally {
+ if (!String.IsNullOrEmpty (out_file))
+ File.Delete (out_file);
+ }
}
void CheckExtensions (DocumentableItem di, string elemName, string val)
Commit: 8f45703547cfa2e8ba64776e64ed6d2444a2f57e
Author: Zoltan Varga <vargaz@gmail.com>
Date: 02/03/2011 15:59:34
URL: https://github.com/mono/mono/commit/8f45703547cfa2e8ba64776e64ed6d2444a2f57e
Fix the handling of CompareExchange icalls in AOT, we were using the 'object' \
versions for everything, which broke with 64 bit types on 32 bit platforms.
Changed paths:
M mono/mini/aot-runtime.c
Modified: mono/mini/aot-runtime.c
===================================================================
--- a/mono/mini/aot-runtime.c
+++ b/mono/mini/aot-runtime.c
@@ -2920,7 +2920,7 @@ mono_aot_get_method (MonoDomain *domain, MonoMethod *method)
}
/* Same for CompareExchange<T> */
- if (method_index == 0xffffff && method->wrapper_type == \
MONO_WRAPPER_MANAGED_TO_NATIVE && method->klass->image == mono_defaults.corlib && \
!strcmp (method->klass->name_space, "System.Threading") && !strcmp \
(method->klass->name, "Interlocked") && !strcmp (method->name, "CompareExchange")) { \
+ if (method_index == 0xffffff && method->wrapper_type == \
MONO_WRAPPER_MANAGED_TO_NATIVE && method->klass->image == mono_defaults.corlib && \
!strcmp (method->klass->name_space, "System.Threading") && !strcmp \
(method->klass->name, "Interlocked") && !strcmp (method->name, "CompareExchange") && \
MONO_TYPE_IS_REFERENCE (mono_method_signature (method)->params [1])) { MonoMethod \
*m; MonoGenericContext ctx;
MonoType *args [16];
Commit: 719afa9b598f84032c7c8958aee946d68942532f
Author: Zoltan Varga <vargaz@gmail.com>
Date: 02/03/2011 17:04:47
URL: https://github.com/mono/mono/commit/719afa9b598f84032c7c8958aee946d68942532f
Print a normal stack trace on a hard stack overflow.
Changed paths:
M mono/mini/mini-exceptions.c
M mono/mini/mini.c
M mono/mini/mini.h
Modified: mono/mini/mini-exceptions.c
===================================================================
--- a/mono/mini/mini-exceptions.c
+++ b/mono/mini/mini-exceptions.c
@@ -1998,6 +1998,74 @@ mono_handle_soft_stack_ovf (MonoJitTlsData *jit_tls, \
MonoJitInfo *ji, void *ctx, return FALSE;
}
+typedef struct {
+ FILE *stream;
+ MonoMethod *omethod;
+ int count;
+} PrintOverflowUserData;
+
+static gboolean
+print_overflow_stack_frame (MonoMethod *method, gint32 native_offset, gint32 \
il_offset, gboolean managed, gpointer data) +{
+ PrintOverflowUserData *user_data = data;
+ FILE *stream = user_data->stream;
+ gchar *location;
+
+ if (method) {
+ if (user_data->count == 0) {
+ /* The first frame is in its prolog, so a line number cannot be computed */
+ user_data->count ++;
+ return FALSE;
+ }
+
+ /* If this is a one method overflow, skip the other instances */
+ if (method == user_data->omethod)
+ return FALSE;
+
+ location = mono_debug_print_stack_frame (method, native_offset, mono_domain_get \
()); + fprintf (stream, " %s\n", location);
+ g_free (location);
+
+ if (user_data->count == 1) {
+ fprintf (stream, " <...>\n");
+ user_data->omethod = method;
+ } else {
+ user_data->omethod = NULL;
+ }
+
+ user_data->count ++;
+ } else
+ fprintf (stream, " at <unknown> <0x%05x>\n", native_offset);
+
+ return FALSE;
+}
+
+void
+mono_handle_hard_stack_ovf (MonoJitTlsData *jit_tls, MonoJitInfo *ji, void *ctx, \
guint8* fault_addr) +{
+ const char *method;
+ /* we don't do much now, but we can warn the user with a useful message */
+ fprintf (stderr, "Stack overflow: IP: %p, fault addr: %p\n", \
mono_arch_ip_from_context (ctx), fault_addr); + if (ji && ji->method) {
+ PrintOverflowUserData ud;
+ MonoContext mctx;
+
+ mono_arch_sigctx_to_monoctx (ctx, &mctx);
+
+ method = mono_method_full_name (ji->method, TRUE);
+ fprintf (stderr, "Stacktrace:\n");
+
+ memset (&ud, 0, sizeof (ud));
+ ud.stream = stderr;
+
+ mono_jit_walk_stack_from_ctx (print_overflow_stack_frame, &mctx, \
MONO_UNWIND_LOOKUP_ACTUAL_METHOD, &ud); + } else {
+ method = "Unmanaged";
+ fprintf (stderr, " at %s\n", method);
+ }
+ _exit (1);
+}
+
static gboolean
print_stack_frame (MonoMethod *method, gint32 native_offset, gint32 il_offset, \
gboolean managed, gpointer data) {
Modified: mono/mini/mini.c
===================================================================
--- a/mono/mini/mini.c
+++ b/mono/mini/mini.c
@@ -5824,20 +5824,14 @@ SIG_HANDLER_SIGNATURE (mono_sigsegv_signal_handler)
}
#endif
- /* The hard-guard page has been hit: there is not much we can do anymore
- * Print a hopefully clear message and abort.
- */
if (jit_tls->stack_size &&
ABS ((guint8*)fault_addr - ((guint8*)jit_tls->end_of_stack - jit_tls->stack_size)) \
< 8192 * sizeof (gpointer)) {
- const char *method;
- /* we don't do much now, but we can warn the user with a useful message */
- fprintf (stderr, "Stack overflow: IP: %p, fault addr: %p\n", \
mono_arch_ip_from_context (ctx), (gpointer)info->si_addr);
- if (ji && ji->method)
- method = mono_method_full_name (ji->method, TRUE);
- else
- method = "Unmanaged";
- fprintf (stderr, "At %s\n", method);
- _exit (1);
+ /*
+ * The hard-guard page has been hit: there is not much we can do anymore
+ * Print a hopefully clear message and abort.
+ */
+ mono_handle_hard_stack_ovf (jit_tls, ji, ctx, (guint8*)info->si_addr);
+ g_assert_not_reached ();
} else {
/* The original handler might not like that it is executed on an altstack... */
if (!ji && mono_chain_signal (SIG_HANDLER_PARAMS))
Modified: mono/mini/mini.h
===================================================================
--- a/mono/mini/mini.h
+++ b/mono/mini/mini.h
@@ -2053,6 +2053,7 @@ gpointer mono_arch_get_throw_pending_exception (MonoTrampInfo \
**info, gboolean gboolean mono_arch_handle_exception (void *sigctx, \
gpointer obj, gboolean test_only) MONO_INTERNAL; void \
mono_arch_handle_altstack_exception (void *sigctx, gpointer fault_addr, gboolean \
stack_ovf) MONO_INTERNAL; gboolean mono_handle_soft_stack_ovf \
(MonoJitTlsData *jit_tls, MonoJitInfo *ji, void *ctx, guint8* fault_addr) \
MONO_INTERNAL; +void mono_handle_hard_stack_ovf (MonoJitTlsData \
*jit_tls, MonoJitInfo *ji, void *ctx, guint8* fault_addr) MONO_INTERNAL; gpointer \
mono_arch_ip_from_context (void *sigctx) MONO_INTERNAL; void \
mono_arch_sigctx_to_monoctx (void *sigctx, MonoContext *ctx) \
MONO_INTERNAL; void mono_arch_monoctx_to_sigctx (MonoContext *mctx, \
void *ctx) MONO_INTERNAL;
Commit: 1c51463ed098fe3911d07b82d0e0f2184a2e5fd7
Author: Zoltan Varga <vargaz@gmail.com>
Date: 02/04/2011 06:55:47
URL: https://github.com/mono/mono/commit/1c51463ed098fe3911d07b82d0e0f2184a2e5fd7
Print a normal stack trace even if a hard stack overflow happens in unmanaged code.
Changed paths:
M mono/mini/mini-exceptions.c
Modified: mono/mini/mini-exceptions.c
===================================================================
--- a/mono/mini/mini-exceptions.c
+++ b/mono/mini/mini-exceptions.c
@@ -2043,26 +2043,21 @@ print_overflow_stack_frame (MonoMethod *method, gint32 \
native_offset, gint32 il_ void
mono_handle_hard_stack_ovf (MonoJitTlsData *jit_tls, MonoJitInfo *ji, void *ctx, \
guint8* fault_addr) {
- const char *method;
+ PrintOverflowUserData ud;
+ MonoContext mctx;
+
/* we don't do much now, but we can warn the user with a useful message */
fprintf (stderr, "Stack overflow: IP: %p, fault addr: %p\n", \
mono_arch_ip_from_context (ctx), fault_addr);
- if (ji && ji->method) {
- PrintOverflowUserData ud;
- MonoContext mctx;
- mono_arch_sigctx_to_monoctx (ctx, &mctx);
+ mono_arch_sigctx_to_monoctx (ctx, &mctx);
- method = mono_method_full_name (ji->method, TRUE);
- fprintf (stderr, "Stacktrace:\n");
+ fprintf (stderr, "Stacktrace:\n");
- memset (&ud, 0, sizeof (ud));
- ud.stream = stderr;
+ memset (&ud, 0, sizeof (ud));
+ ud.stream = stderr;
+
+ mono_jit_walk_stack_from_ctx (print_overflow_stack_frame, &mctx, \
MONO_UNWIND_LOOKUP_ACTUAL_METHOD, &ud);
- mono_jit_walk_stack_from_ctx (print_overflow_stack_frame, &mctx, \
MONO_UNWIND_LOOKUP_ACTUAL_METHOD, &ud);
- } else {
- method = "Unmanaged";
- fprintf (stderr, " at %s\n", method);
- }
_exit (1);
}
Commit: 129cfd47eea21ad0a57099a0114d37252ae8d835
Author: Rodrigo Kumpera <kumpera@gmail.com>
Date: 02/05/2011 07:38:42
URL: https://github.com/mono/mono/commit/129cfd47eea21ad0a57099a0114d37252ae8d835
Fixes ldfnt to ldvtftn conversion.
* mini-trampolines.c (mono_delegate_trampoline): The ldftn
to ldvtftn conversion must check if the method is abstract,
otherwise it breaks delegate to base classes.
Fixes #666008
Changed paths:
M mono/mini/mini-trampolines.c
Modified: mono/mini/mini-trampolines.c
===================================================================
--- a/mono/mini/mini-trampolines.c
+++ b/mono/mini/mini-trampolines.c
@@ -911,7 +911,10 @@ mono_delegate_trampoline (mgreg_t *regs, guint8 *code, gpointer \
*tramp_data, gui mono_error_raise_exception (&err);
callvirt = !delegate->target && sig->hasthis;
- if (delegate->target && method->flags & METHOD_ATTRIBUTE_VIRTUAL && \
method->klass->flags & TYPE_ATTRIBUTE_ABSTRACT) { + if (delegate->target &&
+ method->flags & METHOD_ATTRIBUTE_VIRTUAL &&
+ method->flags & METHOD_ATTRIBUTE_ABSTRACT &&
+ method->klass->flags & TYPE_ATTRIBUTE_ABSTRACT) {
method = mono_object_get_virtual_method (delegate->target, method);
enable_caching = FALSE;
}
Commit: a962434e90ebfebd0ad5a6bd869f799add948b1f
Author: Zoltan Varga <vargaz@gmail.com>
Date: 02/05/2011 18:08:16
URL: https://github.com/mono/mono/commit/a962434e90ebfebd0ad5a6bd869f799add948b1f
Fix the ia64 build.
Changed paths:
M mono/mini/mini-exceptions.c
Modified: mono/mini/mini-exceptions.c
===================================================================
--- a/mono/mini/mini-exceptions.c
+++ b/mono/mini/mini-exceptions.c
@@ -2049,6 +2049,7 @@ mono_handle_hard_stack_ovf (MonoJitTlsData *jit_tls, \
MonoJitInfo *ji, void *ctx, /* we don't do much now, but we can warn the user with a \
useful message */ fprintf (stderr, "Stack overflow: IP: %p, fault addr: %p\n", \
mono_arch_ip_from_context (ctx), fault_addr);
+#ifdef MONO_ARCH_HAVE_SIGCTX_TO_MONOCTX
mono_arch_sigctx_to_monoctx (ctx, &mctx);
fprintf (stderr, "Stacktrace:\n");
@@ -2057,6 +2058,12 @@ mono_handle_hard_stack_ovf (MonoJitTlsData *jit_tls, \
MonoJitInfo *ji, void *ctx, ud.stream = stderr;
mono_jit_walk_stack_from_ctx (print_overflow_stack_frame, &mctx, \
MONO_UNWIND_LOOKUP_ACTUAL_METHOD, &ud); +#else
+ if (ji && ji->method)
+ fprintf (stderr, "At %s\n", mono_method_full_name (ji->method, TRUE));
+ else
+ fprintf (stderr, "At <unmanaged>.\n");
+#endif
_exit (1);
}
Commit: ccedbc64dc097c18657151679a901635712561a8
Author: Zoltan Varga <vargaz@gmail.com>
Date: 02/07/2011 10:11:47
URL: https://github.com/mono/mono/commit/ccedbc64dc097c18657151679a901635712561a8
Use mono_method_get_vtable_slot () instead of accessing method->slot directly. Fixes \
#669808.
Changed paths:
M mono/metadata/icall.c
Modified: mono/metadata/icall.c
===================================================================
--- a/mono/metadata/icall.c
+++ b/mono/metadata/icall.c
@@ -7065,6 +7065,7 @@ ves_icall_MonoMethod_get_base_method (MonoReflectionMethod *m, \
gboolean definiti MonoClass *klass, *parent;
MonoMethod *method = m->method;
MonoMethod *result = NULL;
+ int slot;
MONO_ARCH_SAVE_REGS;
@@ -7076,6 +7077,10 @@ ves_icall_MonoMethod_get_base_method (MonoReflectionMethod *m, \
gboolean definiti method->flags & METHOD_ATTRIBUTE_NEW_SLOT)
return m;
+ slot = mono_method_get_vtable_slot (method);
+ if (slot == -1)
+ return m;
+
klass = method->klass;
if (klass->generic_class)
klass = klass->generic_class->container_class;
@@ -7084,7 +7089,7 @@ ves_icall_MonoMethod_get_base_method (MonoReflectionMethod *m, \
gboolean definiti /* At the end of the loop, klass points to the eldest class that \
has this virtual function slot. */ for (parent = klass->parent; parent != NULL; \
parent = parent->parent) { mono_class_setup_vtable (parent);
- if (parent->vtable_size <= method->slot)
+ if (parent->vtable_size <= slot)
break;
klass = parent;
}
@@ -7100,17 +7105,17 @@ ves_icall_MonoMethod_get_base_method (MonoReflectionMethod \
*m, gboolean definiti /*This is possible if definition == FALSE.
* Do it here to be really sure we don't read invalid memory.
*/
- if (method->slot >= klass->vtable_size)
+ if (slot >= klass->vtable_size)
return m;
mono_class_setup_vtable (klass);
- result = klass->vtable [method->slot];
+ result = klass->vtable [slot];
if (result == NULL) {
/* It is an abstract method */
gpointer iter = NULL;
while ((result = mono_class_get_methods (klass, &iter)))
- if (result->slot == method->slot)
+ if (result->slot == slot)
break;
}
Commit: 6b9347a35ba02a78eb1cfc74f3e77b9b1e3a9437
Author: Zoltan Varga <vargaz@gmail.com>
Date: 02/07/2011 17:33:11
URL: https://github.com/mono/mono/commit/6b9347a35ba02a78eb1cfc74f3e77b9b1e3a9437
Include sys/types.h for pid_t on mingw. Fixes #670076.
Changed paths:
M eglib/configure.ac
M eglib/src/glib.h
M mono/mini/mini.h
Modified: eglib/configure.ac
===================================================================
--- a/eglib/configure.ac
+++ b/eglib/configure.ac
@@ -126,7 +126,7 @@ if test "x$have_iso_varargs" = "xyes"; then
fi
AC_SUBST(G_HAVE_ISO_VARARGS)
-AC_CHECK_HEADERS(getopt.h sys/time.h sys/wait.h pwd.h langinfo.h iconv.h \
localcharset.h) +AC_CHECK_HEADERS(getopt.h sys/time.h sys/wait.h pwd.h langinfo.h \
iconv.h localcharset.h sys/types.h) AC_CHECK_HEADER(alloca.h, [HAVE_ALLOCA_H=1], \
[HAVE_ALLOCA_H=0]) AC_SUBST(HAVE_ALLOCA_H)
Modified: eglib/src/glib.h
===================================================================
--- a/eglib/src/glib.h
+++ b/eglib/src/glib.h
@@ -16,6 +16,10 @@
/* For pid_t */
#ifndef WIN32
#include <unistd.h>
+#else
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
#endif
#endif
Modified: mono/mini/mini.h
===================================================================
--- a/mono/mini/mini.h
+++ b/mono/mini/mini.h
@@ -4,6 +4,9 @@
#include "config.h"
#include <glib.h>
#include <signal.h>
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
#include <mono/metadata/loader.h>
#include <mono/metadata/mempool.h>
#include <mono/utils/monobitset.h>
Commit: 632a3c70c72bb372e6851b559b043b0fe1f5967d
Author: Zoltan Varga <vargaz@gmail.com>
Date: 02/07/2011 17:36:41
URL: https://github.com/mono/mono/commit/632a3c70c72bb372e6851b559b043b0fe1f5967d
Cast the result of MONO_CONTEXT_GET_SP () to an int to fix the windows build.
Changed paths:
M mono/mini/exceptions-x86.c
Modified: mono/mini/exceptions-x86.c
===================================================================
--- a/mono/mini/exceptions-x86.c
+++ b/mono/mini/exceptions-x86.c
@@ -1306,7 +1306,7 @@ mono_arch_setup_resume_sighandler_ctx (MonoContext *ctx, \
gpointer func) int align = (((gint32)MONO_CONTEXT_GET_SP (ctx)) % \
MONO_ARCH_FRAME_ALIGNMENT + 4);
if (align != 0)
- MONO_CONTEXT_SET_SP (ctx, MONO_CONTEXT_GET_SP (ctx) - align);
+ MONO_CONTEXT_SET_SP (ctx, (gsize)MONO_CONTEXT_GET_SP (ctx) - align);
MONO_CONTEXT_SET_IP (ctx, func);
}
Commit: dd8a1f28311d7fa459fd06ffb4e61b781864140c
Author: Hib Eris <hib@hiberis.nl>
Committer: Zoltan Varga <vargaz@gmail.com>
Date: 02/07/2011 17:41:28
URL: https://github.com/mono/mono/commit/dd8a1f28311d7fa459fd06ffb4e61b781864140c
Include config.h in mono-profiler-aot.c
This change is nescessary for compiling with a mingw-w64 compiler.
Changed paths:
M mono/profiler/mono-profiler-aot.c
Modified: mono/profiler/mono-profiler-aot.c
===================================================================
--- a/mono/profiler/mono-profiler-aot.c
+++ b/mono/profiler/mono-profiler-aot.c
@@ -11,6 +11,7 @@
* allowing more efficient function ordering in the AOT files.
*/
+#include <config.h>
#include <mono/metadata/profiler.h>
#include <mono/metadata/tokentype.h>
#include <mono/metadata/tabledefs.h>
Commit: 0ab1c822238a0ec2ffdfca93bf76e0eeaa27a6f2
Author: Hib Eris <hib@hiberis.nl>
Committer: Zoltan Varga <vargaz@gmail.com>
Date: 02/07/2011 17:43:37
URL: https://github.com/mono/mono/commit/0ab1c822238a0ec2ffdfca93bf76e0eeaa27a6f2
Use _vscprintf() for mingw-w64 compilers
The mingw-w64 compilers implement a vsnprintf() function that do not
conform to the C99 standard (just like MSVC).
Changed paths:
M eglib/src/vasprintf.c
Modified: eglib/src/vasprintf.c
===================================================================
--- a/eglib/src/vasprintf.c
+++ b/eglib/src/vasprintf.c
@@ -9,7 +9,7 @@ int vasprintf(char **ret, const char *fmt, va_list ap)
size_t buflen;
va_list ap2;
-#ifdef _MSC_VER
+#if defined(_MSC_VER) || defined(__MINGW64_VERSION_MAJOR)
ap2 = ap;
len = _vscprintf(fmt, ap2); // NOTE MS specific extension ( :-( )
#else
Commit: d1ef6f2e4b4e0280e1b41016675b64399f4fe8c9
Author: Hib Eris <hib@hiberis.nl>
Committer: Zoltan Varga <vargaz@gmail.com>
Date: 02/07/2011 17:55:47
URL: https://github.com/mono/mono/commit/d1ef6f2e4b4e0280e1b41016675b64399f4fe8c9
Do not distribute eglib-config.h
The file eglib-config.h is generated when running configure.
Distributing eglib-config.h in tarballs causes errors when building
out of the source tree.
Changed paths:
M eglib/src/Makefile.am
Modified: eglib/src/Makefile.am
===================================================================
--- a/eglib/src/Makefile.am
+++ b/eglib/src/Makefile.am
@@ -24,7 +24,6 @@ os_files = $(unix_files)
endif
libeglib_la_SOURCES = \
- eglib-config.h \
eglib-remap.h \
sort.frag.h \
glib.h \
Commit: 6eca3e53edf817b82e1e38779dc39b8b8a9e4ec4
Author: Marek Habersack <grendel@twistedcode.net>
Date: 02/07/2011 18:34:33
URL: https://github.com/mono/mono/commit/6eca3e53edf817b82e1e38779dc39b8b8a9e4ec4
[crypto] Added missing 4.0 algorithm names
Changed paths:
M mcs/class/corlib/System.Security.Cryptography/CryptoConfig.cs
Modified: mcs/class/corlib/System.Security.Cryptography/CryptoConfig.cs
===================================================================
--- a/mcs/class/corlib/System.Security.Cryptography/CryptoConfig.cs
+++ b/mcs/class/corlib/System.Security.Cryptography/CryptoConfig.cs
@@ -213,7 +213,58 @@ public partial class CryptoConfig {
// new (2.0) X509 Chain
private const string nameX509Chain = "X509Chain";
private const string defaultX509Chain = defaultNamespace + \
"X509Certificates.X509Chain, " + Consts.AssemblySystem;
-
+#if NET_4_0
+ // AES
+ const string system_core_assembly = ", System.Core, Version=4.0.0.0, \
Culture=neutral, PublicKeyToken=b77a5c561934e089"; + const string nameAES_1 = "AES";
+ const string nameAES_2 = "System.Security.Cryptography.AesCryptoServiceProvider";
+ const string defaultAES_1 = "System.Security.Cryptography.AesCryptoServiceProvider" \
+ system_core_assembly; +
+ const string nameAESManaged_1 = "AesManaged";
+ const string nameAESManaged_2 = "System.Security.Cryptography.AesManaged";
+ const string defaultAESManaged = "System.Security.Cryptography.AesManaged" + \
system_core_assembly; +
+ // ECDiffieHellman - not implemented in System.Core at the moment
+ const string nameECDiffieHellman_1 = "ECDH";
+ const string nameECDiffieHellman_2 = "ECDiffieHellman";
+ const string nameECDiffieHellman_3 = "ECDiffieHellmanCng";
+ const string nameECDiffieHellman_4 = \
"System.Security.Cryptography.ECDiffieHellmanCng"; + const string \
defaultECDiffieHellman = "System.Security.Cryptography.ECDiffieHellmanCng" + \
system_core_assembly; +
+ // ECDsa - not implemented in System.Core at the moment
+ const string nameECDsa_1 = "ECDsa";
+ const string nameECDsa_2 = "ECDsaCng";
+ const string nameECDsa_3 = "System.Security.Cryptography.ECDsaCng";
+ const string defaultECDsa = "System.Security.Cryptography.ECDsaCng" + \
system_core_assembly; +
+ // SHA1Cng
+ const string nameSHA1Cng = "System.Security.Cryptography.SHA1Cng";
+ const string defaultSHA1Cng = "System.Security.Cryptography.SHA1Cng" + \
system_core_assembly; +
+ // SHA256Cng
+ const string nameSHA256Cng = "System.Security.Cryptography.SHA256Cng";
+ const string defaultSHA256Cng = "System.Security.Cryptography.SHA256Cng" + \
system_core_assembly; +
+ // SHA256 provider
+ const string nameSHA256Provider = \
"System.Security.Cryptography.SHA256CryptoServiceProvider"; + const string \
defaultSHA256Provider = "System.Security.Cryptography.SHA256CryptoServiceProvider" + \
system_core_assembly; +
+ // SHA384Cng
+ const string nameSHA384Cng = "System.Security.Cryptography.SHA384Cng";
+ const string defaultSHA384Cng = "System.Security.Cryptography.SHA384Cng" + \
system_core_assembly; +
+ // SHA384 provider
+ const string nameSHA384Provider = \
"System.Security.Cryptography.SHA384CryptoServiceProvider"; + const string \
defaultSHA384Provider = "System.Security.Cryptography.SHA384CryptoServiceProvider" + \
system_core_assembly; +
+ // SHA512Cng
+ const string nameSHA512Cng = "System.Security.Cryptography.SHA512Cng";
+ const string defaultSHA512Cng = "System.Security.Cryptography.SHA512Cng" + \
system_core_assembly; +
+ // SHA512 provider
+ const string nameSHA512Provider = \
"System.Security.Cryptography.SHA512CryptoServiceProvider"; + const string \
defaultSHA512Provider = "System.Security.Cryptography.SHA512CryptoServiceProvider" + \
system_core_assembly; +#endif
static CryptoConfig ()
{
// lock(this) is bad
@@ -329,7 +380,29 @@ public partial class CryptoConfig {
algorithms.Add (oidX509EnhancedKeyUsage, nameX509EnhancedKeyUsage);
// note: the default X.509Chain can also be created this way
algorithms.Add (nameX509Chain, defaultX509Chain);
-
+#if NET_4_0
+ algorithms.Add (nameAES_1, defaultAES_1);
+ algorithms.Add (nameAES_2, defaultAES_1);
+ algorithms.Add (nameAESManaged_1, defaultAESManaged);
+ algorithms.Add (nameAESManaged_2, defaultAESManaged);
+
+ algorithms.Add (nameECDiffieHellman_1, defaultECDiffieHellman);
+ algorithms.Add (nameECDiffieHellman_2, defaultECDiffieHellman);
+ algorithms.Add (nameECDiffieHellman_3, defaultECDiffieHellman);
+ algorithms.Add (nameECDiffieHellman_4, defaultECDiffieHellman);
+
+ algorithms.Add (nameECDsa_1, defaultECDsa);
+ algorithms.Add (nameECDsa_2, defaultECDsa);
+ algorithms.Add (nameECDsa_3, defaultECDsa);
+
+ algorithms.Add (nameSHA1Cng, defaultSHA1Cng);
+ algorithms.Add (nameSHA256Cng, defaultSHA256Cng);
+ algorithms.Add (nameSHA256Provider, defaultSHA256Provider);
+ algorithms.Add (nameSHA384Cng, defaultSHA384Cng);
+ algorithms.Add (nameSHA384Provider, defaultSHA384Provider);
+ algorithms.Add (nameSHA512Cng, defaultSHA512Cng);
+ algorithms.Add (nameSHA512Provider, defaultSHA512Provider);
+#endif
Hashtable oid = new Hashtable (new CaseInsensitiveHashCodeProvider (), new \
CaseInsensitiveComparer ());
// comments here are to match with MS implementation (but not with doc)
Commit: e99c8b5a770d6158d288449c792f11cf9c633802
Author: Atsushi Eno <atsushi@ximian.com>
Date: 02/07/2011 22:04:43
URL: https://github.com/mono/mono/commit/e99c8b5a770d6158d288449c792f11cf9c633802
Serialize non-mapped message parameter as body content. Part of bug #656020 fix.
Changed paths:
M mcs/class/System.ServiceModel.Web/System.ServiceModel.Dispatcher/WebMessageFormatter.cs
Modified: mcs/class/System.ServiceModel.Web/System.ServiceModel.Dispatcher/WebMessageFormatter.cs
===================================================================
--- a/mcs/class/System.ServiceModel.Web/System.ServiceModel.Dispatcher/WebMessageFormatter.cs
+++ b/mcs/class/System.ServiceModel.Web/System.ServiceModel.Dispatcher/WebMessageFormatter.cs
@@ -139,6 +139,19 @@ namespace System.ServiceModel.Dispatcher
throw new SystemException ("INTERNAL ERROR: should not happen");
}
+ protected string GetMediaTypeString (WebContentFormat fmt)
+ {
+ switch (fmt) {
+ case WebContentFormat.Raw:
+ return "application/octet-stream";
+ case WebContentFormat.Json:
+ return "application/json";
+ case WebContentFormat.Xml:
+ default:
+ return "application/xml";
+ }
+ }
+
protected void CheckMessageVersion (MessageVersion messageVersion)
{
if (messageVersion == null)
@@ -264,25 +277,37 @@ namespace System.ServiceModel.Dispatcher
if (parameters.Length != md.Body.Parts.Count)
throw new ArgumentException ("Parameter array length does not match the number \
of message body parts");
+ object msgpart = null;
+
for (int i = 0; i < parameters.Length; i++) {
var p = md.Body.Parts [i];
string name = p.Name.ToUpper (CultureInfo.InvariantCulture);
if (UriTemplate.PathSegmentVariableNames.Contains (name) ||
UriTemplate.QueryValueVariableNames.Contains (name))
c.Add (name, parameters [i] != null ? Converter.ConvertValueToString \
(parameters [i], parameters [i].GetType ()) : null);
- else
+ else {
// FIXME: bind as a message part
- throw new NotImplementedException (String.Format ("parameter {0} is not \
contained in the URI template {1} {2} {3}", p.Name, UriTemplate, \
UriTemplate.PathSegmentVariableNames.Count, \
UriTemplate.QueryValueVariableNames.Count)); + if (msgpart == null)
+ msgpart = parameters [i];
+ else
+ throw new NotImplementedException (String.Format ("More than one parameters \
including {0} that are not contained in the URI template {1} was found.", p.Name, \
UriTemplate)); + }
}
Uri to = UriTemplate.BindByName (Endpoint.Address.Uri, c);
- Message ret = Message.CreateMessage (messageVersion, (string) null);
+ Message ret = Message.CreateMessage (messageVersion, (string) null, msgpart);
ret.Headers.To = to;
var hp = new HttpRequestMessageProperty ();
hp.Method = Info.Method;
+ WebMessageFormat msgfmt = Info.IsResponseFormatSetExplicitly ? \
Info.ResponseFormat : Behavior.DefaultOutgoingResponseFormat; + var contentFormat \
= ToContentFormat (msgfmt, msgpart); + string mediaType = GetMediaTypeString \
(contentFormat); + // FIXME: get encoding from somewhere
+ hp.Headers ["Content-Type"] = mediaType + "; charset=utf-8";
+
#if !NET_2_1
if (WebOperationContext.Current != null)
WebOperationContext.Current.OutgoingRequest.Apply (hp);
@@ -449,7 +474,6 @@ namespace System.ServiceModel.Dispatcher
WebMessageFormat msgfmt = Info.IsResponseFormatSetExplicitly ? \
Info.ResponseFormat : Behavior.DefaultOutgoingResponseFormat;
- string mediaType = null;
XmlObjectSerializer serializer = null;
// FIXME: serialize ref/out parameters as well.
@@ -459,19 +483,18 @@ namespace System.ServiceModel.Dispatcher
switch (msgfmt) {
case WebMessageFormat.Xml:
serializer = GetSerializer (WebContentFormat.Xml);
- mediaType = "application/xml";
name = IsResponseBodyWrapped ? md.Body.WrapperName : null;
ns = IsResponseBodyWrapped ? md.Body.WrapperNamespace : null;
break;
case WebMessageFormat.Json:
serializer = GetSerializer (WebContentFormat.Json);
- mediaType = "application/json";
name = IsResponseBodyWrapped ? (BodyName ?? md.Body.ReturnValue.Name) : null;
ns = String.Empty;
break;
}
var contentFormat = ToContentFormat (msgfmt, result);
+ string mediaType = GetMediaTypeString (contentFormat);
Message ret = contentFormat == WebContentFormat.Raw ? new RawMessage ((Stream) \
result) : Message.CreateMessage (MessageVersion.None, null, new WrappedBodyWriter \
(result, serializer, name, ns, contentFormat));
// Message properties
Commit: fbc54c3de51088c4501d663a34bd721bcd8a2084
Author: Atsushi Eno <atsushi@ximian.com>
Date: 02/07/2011 22:04:53
URL: https://github.com/mono/mono/commit/fbc54c3de51088c4501d663a34bd721bcd8a2084
Fix template match logic to first check HTTP-method-matching ones.
Part of the fix for bug #656020.
Changed paths:
M mcs/class/System.ServiceModel.Web/System.ServiceModel.Dispatcher/WebHttpDispatchOperationSelector.cs
M mcs/class/System.ServiceModel.Web/Test/System.ServiceModel.Dispatcher/WebHttpDispatchOperationSelectorTest.cs
Modified: mcs/class/System.ServiceModel.Web/System.ServiceModel.Dispatcher/WebHttpDispatchOperationSelector.cs
===================================================================
--- a/mcs/class/System.ServiceModel.Web/System.ServiceModel.Dispatcher/WebHttpDispatchOperationSelector.cs
+++ b/mcs/class/System.ServiceModel.Web/System.ServiceModel.Dispatcher/WebHttpDispatchOperationSelector.cs
@@ -26,6 +26,7 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
+using System.Collections.Generic;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.ServiceModel.Description;
@@ -39,7 +40,7 @@ namespace System.ServiceModel.Dispatcher
{
public const string HttpOperationSelectorUriMatchedPropertyName = "UriMatched";
- UriTemplateTable table;
+ Dictionary<string,UriTemplateTable> tables = new \
Dictionary<string,UriTemplateTable> ();
protected WebHttpDispatchOperationSelector ()
{
@@ -52,12 +53,16 @@ namespace System.ServiceModel.Dispatcher
if (endpoint.Address == null)
throw new InvalidOperationException ("EndpointAddress must be set in the \
argument ServiceEndpoint");
- table = new UriTemplateTable (endpoint.Address.Uri);
-
foreach (OperationDescription od in endpoint.Contract.Operations) {
WebAttributeInfo info = od.GetWebAttributeInfo ();
- if (info != null)
+ if (info != null) {
+ UriTemplateTable table;
+ if (!tables.TryGetValue (info.Method, out table)) {
+ table = new UriTemplateTable (endpoint.Address.Uri);
+ tables.Add (info.Method, table);
+ }
table.KeyValuePairs.Add (new TemplateTablePair (info.BuildUriTemplate (od, \
null), od)); + }
}
}
@@ -71,14 +76,26 @@ namespace System.ServiceModel.Dispatcher
{
if (message == null)
throw new ArgumentNullException ("message");
- if (message.Properties.ContainsKey (WebBodyFormatMessageProperty.Name))
- throw new ArgumentException ("There is already message property for Web body \
format"); + // FIXME: something like this check is required here or somewhere else. \
See WebHttpDispatchOperationSelectorTest.SelectOperationCheckExistingProperty() \
+// if (message.Properties.ContainsKey (WebBodyFormatMessageProperty.Name)) \
+// throw new ArgumentException ("There is already message property for Web body \
format"); uriMatched = false;
Uri to = message.Headers.To;
if (to == null)
return String.Empty;
- UriTemplateMatch match = table.MatchSingle (to);
+ // First, UriTemplateTable with corresponding HTTP method is tested. Then other \
tables can be tested for match. + UriTemplateTable table;
+ var hp = (HttpRequestMessageProperty) message.Properties \
[HttpRequestMessageProperty.Name]; + tables.TryGetValue (hp == null ? null : \
hp.Method, out table); + UriTemplateMatch match = table == null ? null : \
table.MatchSingle (to); + if (match == null)
+ foreach (var tab in tables.Values)
+ if ((match = tab.MatchSingle (to)) != null) {
+ table = tab;
+ break;
+ }
+
OperationDescription od = null;
if (match != null) {
uriMatched = true;
Modified: mcs/class/System.ServiceModel.Web/Test/System.ServiceModel.Dispatcher/WebHttpDispatchOperationSelectorTest.cs
===================================================================
--- a/mcs/class/System.ServiceModel.Web/Test/System.ServiceModel.Dispatcher/WebHttpDispatchOperationSelectorTest.cs
+++ b/mcs/class/System.ServiceModel.Web/Test/System.ServiceModel.Dispatcher/WebHttpDispatchOperationSelectorTest.cs
@@ -64,14 +64,12 @@ namespace MonoTests.System.ServiceModel.Dispatcher
}
[Test]
- [Category("NotWorking")]
public void SelectOperation2 ()
{
SelectOperationCore (Create2 ());
}
[Test]
- [Category("NotWorking")]
public void SelectOperation3 ()
{
ContractDescription cd = ContractDescription.GetContract (typeof (MyService2));
Commit: 97a48b0eab33c3675fed7aee369a51905d86b457
Author: Atsushi Eno <atsushi@ximian.com>
Date: 02/07/2011 22:05:03
URL: https://github.com/mono/mono/commit/97a48b0eab33c3675fed7aee369a51905d86b457
Enable duplicate "UriMatched" error check, with couple of FIXMEs.
.NET is very unclear about those UriTemplate behavior. Too minor to mind.
Changed paths:
M mcs/class/System.ServiceModel.Web/System.ServiceModel.Dispatcher/WebHttpDispatchOperationSelector.cs
M mcs/class/System.ServiceModel.Web/Test/System.ServiceModel.Dispatcher/WebHttpDispatchOperationSelectorTest.cs
M mcs/class/System.ServiceModel.Web/Test/System/UriTemplateTest.cs
Modified: mcs/class/System.ServiceModel.Web/System.ServiceModel.Dispatcher/WebHttpDispatchOperationSelector.cs
===================================================================
--- a/mcs/class/System.ServiceModel.Web/System.ServiceModel.Dispatcher/WebHttpDispatchOperationSelector.cs
+++ b/mcs/class/System.ServiceModel.Web/System.ServiceModel.Dispatcher/WebHttpDispatchOperationSelector.cs
@@ -27,6 +27,7 @@
//
using System;
using System.Collections.Generic;
+using System.Linq;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.ServiceModel.Description;
@@ -68,42 +69,53 @@ namespace System.ServiceModel.Dispatcher
public string SelectOperation (ref Message message)
{
- bool dummy;
- return SelectOperation (ref message, out dummy);
+ // FIXME: uriMatched should be used to differentiate 404 and 405 (method not \
allowed) + bool uriMatched;
+ return SelectOperation (ref message, out uriMatched);
}
protected virtual string SelectOperation (ref Message message, out bool \
uriMatched) {
if (message == null)
throw new ArgumentNullException ("message");
- // FIXME: something like this check is required here or somewhere else. See \
WebHttpDispatchOperationSelectorTest.SelectOperationCheckExistingProperty()
-// if (message.Properties.ContainsKey (WebBodyFormatMessageProperty.Name))
-// throw new ArgumentException ("There is already message property for Web body \
format"); + if (message.Properties.ContainsKey (UriMatchedProperty.Name))
+ throw new ArgumentException (String.Format ("There is already a message property \
for template-matched URI '{0}'", UriMatchedProperty.Name)); uriMatched = false;
- Uri to = message.Headers.To;
- if (to == null)
- return String.Empty;
+ var hp = (HttpRequestMessageProperty) message.Properties \
[HttpRequestMessageProperty.Name]; +
+ OperationDescription od = null;
+ Message dummy = message; // since lambda expression prohibits ref variable...
+ Uri to = message.Headers.To;
// First, UriTemplateTable with corresponding HTTP method is tested. Then other \
tables can be tested for match.
- UriTemplateTable table;
- var hp = (HttpRequestMessageProperty) message.Properties \
[HttpRequestMessageProperty.Name];
- tables.TryGetValue (hp == null ? null : hp.Method, out table);
- UriTemplateMatch match = table == null ? null : table.MatchSingle (to);
- if (match == null)
+ UriTemplateTable table = null;
+ if (hp != null && hp.Method != null)
+ tables.TryGetValue (hp.Method, out table);
+ // FIXME: looks like To header does not matter on .NET. (But how to match then? I \
have no idea) + UriTemplateMatch match = to == null || table == null ? null : \
table.MatchSingle (to); + if (to != null && match == null) {
foreach (var tab in tables.Values)
if ((match = tab.MatchSingle (to)) != null) {
table = tab;
break;
}
+ }
- OperationDescription od = null;
if (match != null) {
uriMatched = true;
foreach (TemplateTablePair p in table.KeyValuePairs)
if (p.Key == match.Template)
od = p.Value as OperationDescription;
}
- return od != null ? od.Name : String.Empty;
+ if (od != null)
+ message.Properties.Add (UriMatchedProperty.Name, new UriMatchedProperty ());
+
+ return uriMatched && od != null ? od.Name : String.Empty;
+ }
+
+ internal class UriMatchedProperty
+ {
+ public static string Name = "UriMatched"; // this is what .NET uses for \
MessageProperty that represents a matched URI. }
}
}
Modified: mcs/class/System.ServiceModel.Web/Test/System.ServiceModel.Dispatcher/WebHttpDispatchOperationSelectorTest.cs
===================================================================
--- a/mcs/class/System.ServiceModel.Web/Test/System.ServiceModel.Dispatcher/WebHttpDispatchOperationSelectorTest.cs
+++ b/mcs/class/System.ServiceModel.Web/Test/System.ServiceModel.Dispatcher/WebHttpDispatchOperationSelectorTest.cs
@@ -133,12 +133,17 @@ namespace MonoTests.System.ServiceModel.Dispatcher
[Test]
[ExpectedException (typeof (ArgumentException))]
- [Category ("NotWorking")]
public void SelectOperationCheckExistingProperty ()
{
var d = Create ();
- var msg = Message.CreateMessage (MessageVersion.None, \
"http://temuri.org/MyService/Echo"); + var msg = Message.CreateMessage \
(MessageVersion.None, "http://temuri.org/MyService/Echo"); // heh, I mistyped it and \
turned to prove that Action does not matter. + msg.Headers.To = new Uri \
("http://localhost:8080/Echo"); +
+ // LAMESPEC: .NET does returns String.Empty, while we return the name of the \
operation (as IOperationSelector.SelectOperation is expected to do!) + // \
Assert.AreEqual (String.Empty, d.SelectOperation (ref msg), "#1"); d.SelectOperation \
(ref msg); +
+ // The second invocation should raise the expected exception
d.SelectOperation (ref msg);
}
Modified: mcs/class/System.ServiceModel.Web/Test/System/UriTemplateTest.cs
===================================================================
--- a/mcs/class/System.ServiceModel.Web/Test/System/UriTemplateTest.cs
+++ b/mcs/class/System.ServiceModel.Web/Test/System/UriTemplateTest.cs
@@ -320,6 +320,22 @@ namespace MonoTests.System
}
[Test]
+ [ExpectedException (typeof (ArgumentNullException))]
+ public void MatchNullArgument1 ()
+ {
+ var t = new UriTemplate ("/hooray");
+ t.Match (null, new Uri ("http://localhost/"));
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentNullException))]
+ public void MatchNullArgument2 ()
+ {
+ var t = new UriTemplate ("/hooray");
+ t.Match (new Uri ("http://localhost/"), null);
+ }
+
+ [Test]
public void MatchNoTemplateItem ()
{
var t = new UriTemplate ("/hooray");
Commit: be5559c59f3a4474c848d5926d6149caa91e65f9
Author: Atsushi Eno <atsushi@ximian.com>
Date: 02/07/2011 22:05:13
URL: https://github.com/mono/mono/commit/be5559c59f3a4474c848d5926d6149caa91e65f9
Read body content if required. Fixed all issues in bug #656020.
Now it considers message content format and IsWrapped[Request|Response] to
retrieve XmlObjectSerializer.
Changed paths:
M mcs/class/System.ServiceModel.Web/System.ServiceModel.Dispatcher/WebMessageFormatter.cs
M mcs/class/System.ServiceModel.Web/Test/System.ServiceModel.Dispatcher/WebHttpDispatchOperationSelectorTest.cs
Modified: mcs/class/System.ServiceModel.Web/System.ServiceModel.Dispatcher/WebMessageFormatter.cs
===================================================================
--- a/mcs/class/System.ServiceModel.Web/System.ServiceModel.Dispatcher/WebMessageFormatter.cs
+++ b/mcs/class/System.ServiceModel.Web/System.ServiceModel.Dispatcher/WebMessageFormatter.cs
@@ -99,6 +99,17 @@ namespace System.ServiceModel.Dispatcher
get { return info.IsBodyStyleSetExplicitly ? info.BodyStyle : \
behavior.DefaultBodyStyle; } }
+ public bool IsRequestBodyWrapped {
+ get {
+ switch (BodyStyle) {
+ case WebMessageBodyStyle.Wrapped:
+ case WebMessageBodyStyle.WrappedRequest:
+ return true;
+ }
+ return BodyName != null;
+ }
+ }
+
public bool IsResponseBodyWrapped {
get {
switch (BodyStyle) {
@@ -169,24 +180,22 @@ namespace System.ServiceModel.Dispatcher
throw new SystemException ("INTERNAL ERROR: no corresponding message description \
for the specified direction: " + dir); }
- protected XmlObjectSerializer GetSerializer (WebContentFormat msgfmt)
+ protected XmlObjectSerializer GetSerializer (WebContentFormat msgfmt, bool \
isWrapped, MessagePartDescription part) {
switch (msgfmt) {
case WebContentFormat.Xml:
- if (IsResponseBodyWrapped)
- return GetSerializer (ref xml_serializer, p => new DataContractSerializer \
(p.Type, p.Name, p.Namespace));
- else
- return GetSerializer (ref xml_serializer, p => new DataContractSerializer \
(p.Type));
-
+ if (xml_serializer == null)
+ xml_serializer = isWrapped ? new DataContractSerializer (part.Type, part.Name, \
part.Namespace) : new DataContractSerializer (part.Type); + return xml_serializer;
case WebContentFormat.Json:
// FIXME: after name argument they are hack
-#if !MOONLIGHT
- if (IsResponseBodyWrapped)
- return GetSerializer (ref json_serializer, p => new DataContractJsonSerializer \
(p.Type, BodyName ?? p.Name, null, 0x100000, false, null, true));
- else
+ if (json_serializer == null)
+#if MOONLIGHT
+ json_serializer = new DataContractJsonSerializer (part.Type);
+#else
+ json_serializer = isWrapped ? new DataContractJsonSerializer (part.Type, \
BodyName ?? part.Name, null, 0x100000, false, null, true) : new \
DataContractJsonSerializer (part.Type); #endif
- return GetSerializer (ref json_serializer, p => new DataContractJsonSerializer \
(p.Type));
-
+ return json_serializer;
default:
throw new NotImplementedException ();
}
@@ -194,13 +203,36 @@ namespace System.ServiceModel.Dispatcher
XmlObjectSerializer xml_serializer, json_serializer;
- XmlObjectSerializer GetSerializer (ref XmlObjectSerializer serializer, \
Func<MessagePartDescription,XmlObjectSerializer> f) + protected object \
DeserializeObject (XmlObjectSerializer serializer, Message message, \
MessageDescription md, bool isWrapped, WebContentFormat fmt) {
- if (serializer == null) {
- MessageDescription md = GetMessageDescription (MessageDirection.Output);
- serializer = f (md.Body.ReturnValue);
+ // FIXME: handle ref/out parameters
+
+ var reader = message.GetReaderAtBodyContents ();
+
+ if (isWrapped) {
+ if (fmt == WebContentFormat.Json)
+ reader.ReadStartElement ("root", String.Empty); // note that the wrapper name \
is passed to the serializer. + else
+ reader.ReadStartElement (md.Body.WrapperName, md.Body.WrapperNamespace);
}
- return serializer;
+
+ var ret = ReadObjectBody (serializer, reader);
+
+ if (isWrapped)
+ reader.ReadEndElement ();
+
+ return ret;
+ }
+
+ protected object ReadObjectBody (XmlObjectSerializer serializer, XmlReader reader)
+ {
+#if NET_2_1
+ return (serializer is DataContractJsonSerializer) ?
+ ((DataContractJsonSerializer) serializer).ReadObject (reader) :
+ ((DataContractSerializer) serializer).ReadObject (reader, true);
+#else
+ return serializer.ReadObject (reader, true);
+#endif
}
internal class RequestClientFormatter : WebClientMessageFormatter
@@ -331,32 +363,11 @@ namespace System.ServiceModel.Dispatcher
if (!message.Properties.ContainsKey (pname))
throw new SystemException ("INTERNAL ERROR: it expects \
WebBodyFormatMessageProperty existence"); var wp = (WebBodyFormatMessageProperty) \
message.Properties [pname];
-
- var serializer = GetSerializer (wp.Format);
-
- // FIXME: handle ref/out parameters
+ var fmt = wp != null ? wp.Format : WebContentFormat.Xml;
var md = GetMessageDescription (MessageDirection.Output);
-
- var reader = message.GetReaderAtBodyContents ();
-
- if (IsResponseBodyWrapped) {
- if (wp.Format == WebContentFormat.Json)
- reader.ReadStartElement ("root", String.Empty); // note that the wrapper name \
is passed to the serializer.
- else
- reader.ReadStartElement (md.Body.WrapperName, md.Body.WrapperNamespace);
- }
-
-#if NET_2_1
- var ret = (serializer is DataContractJsonSerializer) ?
- ((DataContractJsonSerializer) serializer).ReadObject (reader) :
- ((DataContractSerializer) serializer).ReadObject (reader, true);
-#else
- var ret = serializer.ReadObject (reader, true);
-#endif
-
- if (IsResponseBodyWrapped)
- reader.ReadEndElement ();
+ var serializer = GetSerializer (wp.Format, IsResponseBodyWrapped, \
md.Body.ReturnValue); + var ret = DeserializeObject (serializer, message, md, \
IsResponseBodyWrapped, fmt);
return ret;
}
@@ -482,12 +493,12 @@ namespace System.ServiceModel.Dispatcher
switch (msgfmt) {
case WebMessageFormat.Xml:
- serializer = GetSerializer (WebContentFormat.Xml);
+ serializer = GetSerializer (WebContentFormat.Xml, IsResponseBodyWrapped, \
md.Body.ReturnValue); name = IsResponseBodyWrapped ? md.Body.WrapperName : null;
ns = IsResponseBodyWrapped ? md.Body.WrapperNamespace : null;
break;
case WebMessageFormat.Json:
- serializer = GetSerializer (WebContentFormat.Json);
+ serializer = GetSerializer (WebContentFormat.Json, IsResponseBodyWrapped, \
md.Body.ReturnValue);
name = IsResponseBodyWrapped ? (BodyName ?? md.Body.ReturnValue.Name) : null;
ns = String.Empty;
break;
@@ -529,7 +540,8 @@ namespace System.ServiceModel.Dispatcher
}
var wp = message.Properties [WebBodyFormatMessageProperty.Name] as \
WebBodyFormatMessageProperty;
- if (wp != null && wp.Format == WebContentFormat.Raw) {
+ var fmt = wp != null ? wp.Format : WebContentFormat.Xml;
+ if (fmt == WebContentFormat.Raw) {
var rmsg = (RawMessage) message;
parameters [0] = rmsg.Stream;
return;
@@ -549,7 +561,12 @@ namespace System.ServiceModel.Dispatcher
var p = md.Body.Parts [i];
string name = p.Name.ToUpperInvariant ();
var str = match.BoundVariables [name];
- parameters [i] = Converter.ConvertStringToValue (str, p.Type);
+ if (str != null)
+ parameters [i] = Converter.ConvertStringToValue (str, p.Type);
+ else {
+ var serializer = GetSerializer (fmt, IsRequestBodyWrapped, p);
+ parameters [i] = DeserializeObject (serializer, message, md, \
IsRequestBodyWrapped, fmt); + }
}
}
}
Modified: mcs/class/System.ServiceModel.Web/Test/System.ServiceModel.Dispatcher/WebHttpDispatchOperationSelectorTest.cs
===================================================================
--- a/mcs/class/System.ServiceModel.Web/Test/System.ServiceModel.Dispatcher/WebHttpDispatchOperationSelectorTest.cs
+++ b/mcs/class/System.ServiceModel.Web/Test/System.ServiceModel.Dispatcher/WebHttpDispatchOperationSelectorTest.cs
@@ -57,6 +57,8 @@ namespace MonoTests.System.ServiceModel.Dispatcher
new WebHttpDispatchOperationSelector (se);
}
+ #region SelectOperation
+
[Test]
public void SelectOperation ()
{
@@ -212,5 +214,63 @@ namespace MonoTests.System.ServiceModel.Dispatcher
//se.Contract.Operations [0].Behaviors.Add (new WebGetAttribute ());
return new MySelector (se);
}
+
+ #endregion
+
+ #region "bug #656020"
+
+ [DataContract]
+ public class User
+ {
+ [DataMember]
+ public string Name { get; set; }
+ }
+
+ [ServiceContract]
+ interface IHello
+ {
+ [WebGet(UriTemplate = "{name}?age={age}&blah={blah}")]
+ [OperationContract]
+ string SayHi (string name, int age, string blah);
+
+ [WebInvoke(UriTemplate = "blah")]
+ [OperationContract]
+ string SayHi2 (User user);
+ }
+
+ class Hello : IHello
+ {
+ public string SayHi (string name, int age, string blah)
+ {
+ return string.Format ("Hi {0}: {1}, {2}", name, age, blah == null);
+ }
+
+ public string SayHi2 (User user)
+ {
+ return string.Format ("Hi {0}.", user.Name);
+ }
+ }
+
+ [Test]
+ public void WebMessageFormats ()
+ {
+ var host = new WebServiceHost (typeof (Hello));
+ host.AddServiceEndpoint (typeof (IHello), new WebHttpBinding (), \
"http://localhost:37564/"); + host.Open ();
+ try {
+ // run client
+ using (ChannelFactory<IHello> factory = new ChannelFactory<IHello> (new \
WebHttpBinding (), "http://localhost:37564/")) + {
+ factory.Endpoint.Behaviors.Add (new WebHttpBehavior ());
+ IHello h = factory.CreateChannel ();
+ //Console.WriteLine(h.SayHi("Joe", 42, null));
+ Assert.AreEqual ("Hi Joe.", h.SayHi2 (new User { Name = "Joe" }), "#1");
+ }
+ } finally {
+ host.Close ();
+ }
+ }
+
+ #endregion
}
}
Commit: cf586923d5a37da98b9eaec0585e0497df465906
Author: Atsushi Eno <atsushi@ximian.com>
Date: 02/07/2011 22:05:24
URL: https://github.com/mono/mono/commit/cf586923d5a37da98b9eaec0585e0497df465906
Sessions should not be keyed by MessageId but be done by channel SessionId.
Changed paths:
M mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/SessionInstanceContextProvider.cs
Modified: mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/SessionInstanceContextProvider.cs
===================================================================
--- a/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/SessionInstanceContextProvider.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/SessionInstanceContextProvider.cs
@@ -36,7 +36,7 @@ namespace System.ServiceModel.Dispatcher
internal class SessionInstanceContextProvider : IInstanceContextProvider
{
ServiceHostBase host;
- Dictionary<UniqueId,InstanceContext> pool = new \
Dictionary<UniqueId,InstanceContext> (); + Dictionary<string,InstanceContext> pool = \
new Dictionary<string,InstanceContext> ();
public SessionInstanceContextProvider (ServiceHostBase host)
{
@@ -46,15 +46,14 @@ namespace System.ServiceModel.Dispatcher
public InstanceContext GetExistingInstanceContext (Message message, \
IContextChannel channel) {
InstanceContext ctx;
- var key = message.Headers.RelatesTo;
- return key != null && pool.TryGetValue (key, out ctx) ? ctx : null;
+ var key = channel.SessionId;
+ return pool.TryGetValue (key, out ctx) ? ctx : null;
}
public void InitializeInstanceContext (InstanceContext instanceContext, Message \
message, IContextChannel channel) {
- var key = message.Headers.MessageId;
- if (key != null)
- pool [key] = instanceContext;
+ var key = channel.SessionId;
+ pool [key] = instanceContext;
}
public bool IsIdle (InstanceContext instanceContext)
Commit: 561ec9f0e6c5a6adcb0241d26a313ae316371e28
Author: Atsushi Eno <atsushi@ximian.com>
Date: 02/07/2011 22:05:34
URL: https://github.com/mono/mono/commit/561ec9f0e6c5a6adcb0241d26a313ae316371e28
Rename InstanceBhavior, too ambiguous among IXxxBehavior interfaces.
Changed paths:
M mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/InitializingHandler.cs
M mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/InstanceBehavior.cs
M mcs/class/System.ServiceModel/System.ServiceModel/InstanceContext.cs
Modified: mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/InitializingHandler.cs
===================================================================
--- a/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/InitializingHandler.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/InitializingHandler.cs
@@ -30,7 +30,7 @@ namespace System.ServiceModel.Dispatcher
iCtx = new InstanceContext (dispatchRuntime.ChannelDispatcher.Host, null, \
false); }
- iCtx.Behavior = new InstanceBehavior (dispatchRuntime);
+ iCtx.InstanceManager = new InstanceManager (dispatchRuntime);
return iCtx;
}
}
Modified: mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/InstanceBehavior.cs
===================================================================
--- a/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/InstanceBehavior.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/InstanceBehavior.cs
@@ -8,11 +8,11 @@ using System.Text;
namespace System.ServiceModel.Dispatcher
{
- internal class InstanceBehavior
+ internal class InstanceManager
{
DispatchRuntime dispatch_runtime;
- internal InstanceBehavior (DispatchRuntime runtime) {
+ internal InstanceManager (DispatchRuntime runtime) {
dispatch_runtime = runtime;
}
Modified: mcs/class/System.ServiceModel/System.ServiceModel/InstanceContext.cs
===================================================================
--- a/mcs/class/System.ServiceModel/System.ServiceModel/InstanceContext.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel/InstanceContext.cs
@@ -39,7 +39,7 @@ namespace System.ServiceModel
ServiceHostBase host;
object implementation;
int manual_flow_limit;
- InstanceBehavior _behavior;
+ InstanceManager instance_manager;
bool is_user_instance_provider;
bool is_user_context_provider;
@@ -79,12 +79,12 @@ namespace System.ServiceModel
}
}
- internal InstanceBehavior Behavior {
+ internal InstanceManager InstanceManager {
get {
- return _behavior;
+ return instance_manager;
}
set {
- _behavior = value;
+ instance_manager = value;
}
}
@@ -124,8 +124,8 @@ namespace System.ServiceModel
public object GetServiceInstance (Message message)
{
- if (implementation == null && Behavior != null) {
- implementation = Behavior.GetServiceInstance (this, message, ref \
is_user_instance_provider); + if (implementation == null && instance_manager != \
null) { + implementation = instance_manager.GetServiceInstance (this, message, ref \
is_user_instance_provider); }
return implementation;
}
@@ -136,9 +136,9 @@ namespace System.ServiceModel
}
internal void CloseIfIdle () {
- if (Behavior.InstanceContextProvider != null && !IsUserProvidedContext) {
- if (!Behavior.InstanceContextProvider.IsIdle (this)) {
- Behavior.InstanceContextProvider.NotifyIdle (IdleCallback, this);
+ if (instance_manager.InstanceContextProvider != null && !IsUserProvidedContext) {
+ if (!instance_manager.InstanceContextProvider.IsIdle (this)) {
+ instance_manager.InstanceContextProvider.NotifyIdle (IdleCallback, this);
}
else {
if (State != CommunicationState.Closed)
@@ -159,7 +159,7 @@ namespace System.ServiceModel
public void ReleaseServiceInstance ()
{
- Behavior.ReleaseServiceInstance (this, implementation);
+ instance_manager.ReleaseServiceInstance (this, implementation);
implementation = null;
}
@@ -188,8 +188,8 @@ namespace System.ServiceModel
protected override void OnOpening ()
{
base.OnOpening ();
- if (Behavior != null)
- Behavior.Initialize (this);
+ if (instance_manager != null)
+ instance_manager.Initialize (this);
}
protected override IAsyncResult OnBeginOpen (
Commit: 84c27ca8186e5d77082daab28da1a71ffb600284
Author: Atsushi Eno <atsushi@ximian.com>
Date: 02/07/2011 22:05:44
URL: https://github.com/mono/mono/commit/84c27ca8186e5d77082daab28da1a71ffb600284
And rename source file name.
Changed paths:
M mcs/class/System.ServiceModel/System.ServiceModel.dll.sources
Added paths:
A mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/InstanceManager.cs
Removed paths:
D mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/InstanceBehavior.cs
Modified: mcs/class/System.ServiceModel/System.ServiceModel.dll.sources
===================================================================
--- a/mcs/class/System.ServiceModel/System.ServiceModel.dll.sources
+++ b/mcs/class/System.ServiceModel/System.ServiceModel.dll.sources
@@ -693,7 +693,7 @@ System.ServiceModel.Dispatcher/XPathMessageContext.cs
System.ServiceModel.Dispatcher/XPathMessageFilter.cs
System.ServiceModel.Dispatcher/XPathMessageFilterTable.cs
System.ServiceModel.Dispatcher/XPathNavigatorException.cs
-System.ServiceModel.Dispatcher/InstanceBehavior.cs
+System.ServiceModel.Dispatcher/InstanceManager.cs
System.ServiceModel.MsmqIntegration/MsmqIntegrationBinding.cs
System.ServiceModel.MsmqIntegration/MsmqIntegrationBindingElement.cs
System.ServiceModel.MsmqIntegration/MsmqIntegrationMessageProperty.cs
Added: mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/InstanceManager.cs
===================================================================
--- /dev/null
+++ b/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/InstanceManager.cs
@@ -0,0 +1,56 @@
+using System;
+using System.Collections.Generic;
+using System.Reflection;
+using System.ServiceModel;
+using System.ServiceModel.Dispatcher;
+using System.ServiceModel.Channels;
+using System.Text;
+
+namespace System.ServiceModel.Dispatcher
+{
+ internal class InstanceManager
+ {
+ DispatchRuntime dispatch_runtime;
+
+ internal InstanceManager (DispatchRuntime runtime) {
+ dispatch_runtime = runtime;
+ }
+
+ internal void Initialize (InstanceContext iCtx) {
+ Message message = OperationContext.Current.IncomingMessage;
+ IContextChannel channel = OperationContext.Current.Channel;
+ if (dispatch_runtime.InstanceContextProvider != null) {
+ dispatch_runtime.InstanceContextProvider.InitializeInstanceContext (iCtx,
+ message,
+ channel);
+ }
+ foreach (IInstanceContextInitializer init in \
dispatch_runtime.InstanceContextInitializers) + init.Initialize (iCtx, \
message); + }
+
+ internal object GetServiceInstance (InstanceContext ctx, Message m, ref bool \
createdByUserProvider) { + if (dispatch_runtime.InstanceProvider != null) {
+ createdByUserProvider = true;
+ return dispatch_runtime.InstanceProvider.GetInstance (ctx, m);
+ }
+ createdByUserProvider = false;
+ return Activator.CreateInstance (
+ dispatch_runtime.ChannelDispatcher.Host.Description.ServiceType, true);
+ }
+
+ internal IInstanceContextProvider InstanceContextProvider {
+ get {
+ return dispatch_runtime.InstanceContextProvider;
+ }
+ }
+
+ internal void ReleaseServiceInstance (InstanceContext ctx, object impl)
+ {
+ if (ctx.IsUserProvidedInstance) {
+ dispatch_runtime.InstanceProvider.ReleaseInstance (ctx, impl);
+
+ }
+ }
+ }
+}
+
Commit: 184d565783a44ff25f29abc5183e4f69fb6ee1c8
Author: Atsushi Eno <atsushi@ximian.com>
Date: 02/07/2011 22:05:55
URL: https://github.com/mono/mono/commit/184d565783a44ff25f29abc5183e4f69fb6ee1c8
Fix regression, avoid null key.
Changed paths:
M mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/SessionInstanceContextProvider.cs
Modified: mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/SessionInstanceContextProvider.cs
===================================================================
--- a/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/SessionInstanceContextProvider.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/SessionInstanceContextProvider.cs
@@ -46,13 +46,13 @@ namespace System.ServiceModel.Dispatcher
public InstanceContext GetExistingInstanceContext (Message message, \
IContextChannel channel) {
InstanceContext ctx;
- var key = channel.SessionId;
+ var key = channel.SessionId ?? String.Empty;
return pool.TryGetValue (key, out ctx) ? ctx : null;
}
public void InitializeInstanceContext (InstanceContext instanceContext, Message \
message, IContextChannel channel) {
- var key = channel.SessionId;
+ var key = channel.SessionId ?? String.Empty;
pool [key] = instanceContext;
}
Commit: c4c9b57b9de0e8f3fc9d2f619caa573c08f21bbe
Author: Atsushi Eno <atsushi@ximian.com>
Date: 02/07/2011 22:06:07
URL: https://github.com/mono/mono/commit/c4c9b57b9de0e8f3fc9d2f619caa573c08f21bbe
Make sure to close session once the client opened one.
Changed paths:
M mcs/class/System.ServiceModel/System.ServiceModel.Channels/TcpDuplexSessionChannel.cs
Modified: mcs/class/System.ServiceModel/System.ServiceModel.Channels/TcpDuplexSessionChannel.cs
===================================================================
--- a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/TcpDuplexSessionChannel.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/TcpDuplexSessionChannel.cs
@@ -219,6 +219,7 @@ namespace System.ServiceModel.Channels
Via = this.Via };
frame.ProcessPreambleInitiator ();
frame.ProcessPreambleAckInitiator ();
+ session = new TcpDuplexSession (this); // make sure to shutdown the session once \
it has initiated one. } else {
// server side
Stream s = client.GetStream ();
Commit: 0870ad290dfa7edcc5b239fa42ade9889833b1d7
Author: Atsushi Eno <atsushi@ximian.com>
Date: 02/07/2011 22:06:18
URL: https://github.com/mono/mono/commit/0870ad290dfa7edcc5b239fa42ade9889833b1d7
Avoid possible list modification error during close process.
Changed paths:
M mcs/class/System.ServiceModel/System.ServiceModel.Channels/HttpRequestChannel.cs
Modified: mcs/class/System.ServiceModel/System.ServiceModel.Channels/HttpRequestChannel.cs
===================================================================
--- a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/HttpRequestChannel.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/HttpRequestChannel.cs
@@ -294,7 +294,7 @@ namespace System.ServiceModel.Channels
protected override void OnAbort ()
{
- foreach (var web_request in web_requests)
+ foreach (var web_request in web_requests.ToArray ())
web_request.Abort ();
web_requests.Clear ();
}
Commit: ab26a0788e61b99d9183c56cb0ea2fdad513c4ac
Author: Atsushi Eno <atsushi@ximian.com>
Date: 02/07/2011 22:06:29
URL: https://github.com/mono/mono/commit/ab26a0788e61b99d9183c56cb0ea2fdad513c4ac
Implemented a couple of async methods in InstanceContext as well as disposing.
Changed paths:
M mcs/class/System.ServiceModel/System.ServiceModel/InstanceContext.cs
Modified: mcs/class/System.ServiceModel/System.ServiceModel/InstanceContext.cs
===================================================================
--- a/mcs/class/System.ServiceModel/System.ServiceModel/InstanceContext.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel/InstanceContext.cs
@@ -32,7 +32,6 @@ using System.ServiceModel.Dispatcher;
namespace System.ServiceModel
{
- [MonoTODO]
public sealed class InstanceContext : CommunicationObject,
IExtensibleObject<InstanceContext>
{
@@ -55,12 +54,12 @@ namespace System.ServiceModel
{
}
- public InstanceContext (ServiceHostBase host,
- object implementation) : this(host, implementation, true)
- {}
+ public InstanceContext (ServiceHostBase host, object implementation)
+ : this (host, implementation, true)
+ {
+ }
- internal InstanceContext(ServiceHostBase host,
- object implementation, bool userContextProvider)
+ internal InstanceContext (ServiceHostBase host, object implementation, bool \
userContextProvider) {
this.host = host;
this.implementation = implementation;
@@ -74,18 +73,12 @@ namespace System.ServiceModel
}
internal bool IsUserProvidedContext {
- get {
- return is_user_context_provider;
- }
+ get { return is_user_context_provider; }
}
internal InstanceManager InstanceManager {
- get {
- return instance_manager;
- }
- set {
- instance_manager = value;
- }
+ get { return instance_manager; }
+ set { instance_manager = value; }
}
protected internal override TimeSpan DefaultCloseTimeout {
@@ -158,24 +151,33 @@ namespace System.ServiceModel
}
public void ReleaseServiceInstance ()
- {
+ {
instance_manager.ReleaseServiceInstance (this, implementation);
+ // FIXME: should Dispose() be invoked here?
implementation = null;
}
+ void DisposeInstance ()
+ {
+ var disp = implementation as IDisposable;
+ if (disp != null)
+ disp.Dispose ();
+ }
+
protected override void OnAbort ()
{
+ DisposeInstance ();
}
- [MonoTODO]
protected override void OnFaulted ()
{
+ DisposeInstance ();
base.OnFaulted ();
}
- [MonoTODO]
protected override void OnClosed ()
{
+ DisposeInstance ();
base.OnClosed ();
}
@@ -192,14 +194,19 @@ namespace System.ServiceModel
instance_manager.Initialize (this);
}
+ Action<TimeSpan> open_delegate, close_delegate;
+
protected override IAsyncResult OnBeginOpen (
TimeSpan timeout, AsyncCallback callback, object state)
{
- throw new NotImplementedException ();
+ if (open_delegate == null)
+ open_delegate = new Action<TimeSpan> (OnOpen);
+ return open_delegate.BeginInvoke (timeout, callback, state);
}
protected override void OnEndOpen (IAsyncResult result)
{
+ open_delegate.EndInvoke (result);
}
protected override void OnOpen (TimeSpan timeout)
@@ -209,15 +216,18 @@ namespace System.ServiceModel
protected override IAsyncResult OnBeginClose (
TimeSpan timeout, AsyncCallback callback, object state)
{
- throw new NotImplementedException ();
+ if (close_delegate == null)
+ close_delegate = new Action<TimeSpan> (OnClose);
+ return close_delegate.BeginInvoke (timeout, callback, state);
}
protected override void OnEndClose (IAsyncResult result)
{
+ close_delegate.EndInvoke (result);
}
protected override void OnClose (TimeSpan timeout)
{
- }
+ }
}
}
Commit: 44a9e7eef734d4c70c634d5ddbd324d5bccfa0f6
Author: Atsushi Eno <atsushi@ximian.com>
Date: 02/07/2011 22:06:39
URL: https://github.com/mono/mono/commit/44a9e7eef734d4c70c634d5ddbd324d5bccfa0f6
Manage opened proxy channels and close them when ChannelFactory is closed.
Changed paths:
M mcs/class/System.ServiceModel/System.ServiceModel/ChannelFactory.cs
M mcs/class/System.ServiceModel/System.ServiceModel/ChannelFactory_1.cs
Modified: mcs/class/System.ServiceModel/System.ServiceModel/ChannelFactory.cs
===================================================================
--- a/mcs/class/System.ServiceModel/System.ServiceModel/ChannelFactory.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel/ChannelFactory.cs
@@ -26,6 +26,7 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
+using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ServiceModel.Channels;
using System.ServiceModel.Description;
@@ -44,6 +45,7 @@ namespace System.ServiceModel
ServiceEndpoint service_endpoint;
IChannelFactory factory;
+ List<IClientChannel> opened_channels = new List<IClientChannel> ();
protected ChannelFactory ()
{
@@ -63,6 +65,10 @@ namespace System.ServiceModel
}
}
+ internal List<IClientChannel> OpenedChannels {
+ get { return opened_channels; }
+ }
+
public ServiceEndpoint Endpoint {
get { return service_endpoint; }
}
@@ -341,8 +347,11 @@ namespace System.ServiceModel
protected override void OnClose (TimeSpan timeout)
{
+ DateTime start = DateTime.Now;
+ foreach (var ch in opened_channels.ToArray ())
+ ch.Close (timeout - (DateTime.Now - start));
if (OpenedChannelFactory != null)
- OpenedChannelFactory.Close (timeout);
+ OpenedChannelFactory.Close (timeout - (DateTime.Now - start));
}
protected override void OnOpen (TimeSpan timeout)
Modified: mcs/class/System.ServiceModel/System.ServiceModel/ChannelFactory_1.cs
===================================================================
--- a/mcs/class/System.ServiceModel/System.ServiceModel/ChannelFactory_1.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel/ChannelFactory_1.cs
@@ -146,7 +146,11 @@ namespace System.ServiceModel
// But since there is no remoting in SL2 (and we have
// no special magic), we have to use different approach
// that should work either.
- object proxy = Activator.CreateInstance (type, new object [] {Endpoint, this, \
address ?? Endpoint.Address, via}); + var proxy = (IClientChannel) \
Activator.CreateInstance (type, new object [] {Endpoint, this, address ?? \
Endpoint.Address, via}); + OpenedChannels.Add (proxy);
+ proxy.Closed += delegate {
+ OpenedChannels.Remove (proxy);
+ };
return (TChannel) proxy;
} catch (TargetInvocationException ex) {
if (ex.InnerException != null)
Commit: be19163ffec80b9dedbb288eb3debf4ceedc62c6
Author: Atsushi Eno <atsushi@ximian.com>
Date: 02/07/2011 22:06:50
URL: https://github.com/mono/mono/commit/be19163ffec80b9dedbb288eb3debf4ceedc62c6
Members in the base type in different namespace are serialized in base ns.
When the serializer serializes a Type B which is derived from A, it used to
serialize member M in A as in namespace_of_B, not in namespace_of_A.
This should fix bug #652331.
Changed paths:
M mcs/class/System.Runtime.Serialization/Test/System.Runtime.Serialization/XmlObjectSerializerTest.cs
Modified: mcs/class/System.Runtime.Serialization/Test/System.Runtime.Serialization/XmlObjectSerializerTest.cs
===================================================================
--- a/mcs/class/System.Runtime.Serialization/Test/System.Runtime.Serialization/XmlObjectSerializerTest.cs
+++ b/mcs/class/System.Runtime.Serialization/Test/System.Runtime.Serialization/XmlObjectSerializerTest.cs
@@ -1520,6 +1520,27 @@ namespace MonoTests.System.Runtime.Serialization
Assert.IsTrue (sw.ToString ().IndexOf (expectedPart) > 0, assert);
return (T) ds.ReadObject (XmlReader.Create (new StringReader (sw.ToString ())));
}
+
+ [Test] // bug #652331
+ public void MembersNamespacesInBaseType ()
+ {
+ string xml1 = @"<Currency>JPY</Currency><Description i:nil=""true"" />";
+ string xml2 = @"<Currency \
xmlns=""http://schemas.datacontract.org/2004/07/SLProto5"">JPY</Currency><Description \
i:nil=""true"" xmlns=""http://schemas.datacontract.org/2004/07/SLProto5"" />"; \
+ Assert.AreEqual ("JPY", MembersNamespacesInBaseType_Part<SLProto5.CashAmount> \
(new SLProto5.CashAmount () { Currency = "JPY" }, xml1, "#1").Currency, "r#1"); \
+ Assert.AreEqual ("JPY", \
MembersNamespacesInBaseType_Part<SLProto5_Different.CashAmount> (new \
SLProto5_Different.CashAmount () { Currency = "JPY" }, xml2, "#2").Currency, "r#2"); \
+ Assert.AreEqual ("JPY", MembersNamespacesInBaseType_Part<SLProto5.CashAmountDC> \
(new SLProto5.CashAmountDC () { Currency = "JPY" }, xml1, "#3").Currency, "r#3"); \
+ Assert.AreEqual ("JPY", \
MembersNamespacesInBaseType_Part<SLProto5_Different.CashAmountDC> (new \
SLProto5_Different.CashAmountDC () { Currency = "JPY" }, xml2, "#4").Currency, \
"r#4"); + }
+
+ T MembersNamespacesInBaseType_Part<T> (T instance, string expectedPart, string \
assert) + {
+ var ds = new DataContractSerializer (typeof (T));
+ var sw = new StringWriter ();
+ using (var w = XmlWriter.Create (sw))
+ ds.WriteObject (w, instance);
+ Assert.IsTrue (sw.ToString ().IndexOf (expectedPart) > 0, assert);
+ return (T) ds.ReadObject (XmlReader.Create (new StringReader (sw.ToString ())));
+ }
}
[DataContract]
Commit: e2884a6c5721ef178ba5098d79cd43c045e6d4d2
Author: Atsushi Eno <atsushi@ximian.com>
Date: 02/07/2011 22:07:00
URL: https://github.com/mono/mono/commit/e2884a6c5721ef178ba5098d79cd43c045e6d4d2
standard endpoint and protocol mapping support were lacking at client side.
Turned out that they had nothing to do with #668089..
Changed paths:
M mcs/class/System.ServiceModel/System.ServiceModel.Configuration/ConfigUtil.cs
M mcs/class/System.ServiceModel/System.ServiceModel/ChannelFactory.cs
M mcs/class/System.ServiceModel/System.ServiceModel/ServiceHostBase.cs
Modified: mcs/class/System.ServiceModel/System.ServiceModel.Configuration/ConfigUtil.cs
===================================================================
--- a/mcs/class/System.ServiceModel/System.ServiceModel.Configuration/ConfigUtil.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel.Configuration/ConfigUtil.cs
@@ -99,6 +99,49 @@ namespace System.ServiceModel.Configuration
}
#if NET_4_0
+ public static Binding GetBindingByProtocolMapping (Uri address)
+ {
+ ProtocolMappingElement el = \
ConfigUtil.ProtocolMappingSection.ProtocolMappingCollection [address.Scheme]; + if \
(el == null) + return null;
+ return ConfigUtil.CreateBinding (el.Binding, el.BindingConfiguration);
+ }
+
+ public static ServiceEndpoint ConfigureStandardEndpoint (ContractDescription cd, \
ChannelEndpointElement element) + {
+ string kind = element.Kind;
+ string endpointConfiguration = element.EndpointConfiguration;
+
+ EndpointCollectionElement section = ConfigUtil.StandardEndpointsSection [kind];
+ if (section == null)
+ throw new ArgumentException (String.Format ("standard endpoint section for '{0}' \
was not found.", kind)); +
+ StandardEndpointElement e = section.GetDefaultStandardEndpointElement ();
+
+ ServiceEndpoint inst = e.CreateServiceEndpoint (cd);
+
+ foreach (StandardEndpointElement el in section.ConfiguredEndpoints) {
+ if (el.Name == endpointConfiguration) {
+ el.InitializeAndValidate (element);
+ el.ApplyConfiguration (inst, element);
+ break;
+ }
+ }
+
+ return inst;
+ }
+
+ public static Type GetTypeFromConfigString (string name)
+ {
+ Type type = Type.GetType (name);
+ if (type != null)
+ return type;
+ foreach (var ass in AppDomain.CurrentDomain.GetAssemblies ())
+ if ((type = ass.GetType (name)) != null)
+ return type;
+ return null;
+ }
+
public static ServiceEndpoint ConfigureStandardEndpoint (ContractDescription cd, \
ServiceEndpointElement element) {
string kind = element.Kind;
Modified: mcs/class/System.ServiceModel/System.ServiceModel/ChannelFactory.cs
===================================================================
--- a/mcs/class/System.ServiceModel/System.ServiceModel/ChannelFactory.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel/ChannelFactory.cs
@@ -117,25 +117,45 @@ namespace System.ServiceModel
string contractName = Endpoint.Contract.ConfigurationName;
ClientSection client = ConfigUtil.ClientSection;
- ChannelEndpointElement res = null;
+ ChannelEndpointElement endpoint = null;
+
foreach (ChannelEndpointElement el in client.Endpoints) {
if (el.Contract == contractName && (endpointConfig == el.Name || endpointConfig \
== "*")) {
- if (res != null)
+ if (endpoint != null)
throw new InvalidOperationException (String.Format ("More then one endpoint \
matching contract {0} was found.", contractName));
- res = el;
+ endpoint = el;
}
}
- if (res == null)
+ if (endpoint == null)
throw new InvalidOperationException (String.Format ("Client endpoint \
configuration '{0}' was not found in {1} endpoints.", endpointConfig, \
client.Endpoints.Count));
+#if NET_4_0
+ var binding = String.IsNullOrEmpty (endpoint.Binding) ? null : \
ConfigUtil.CreateBinding (endpoint.Binding, endpoint.BindingConfiguration); + var \
contract = String.IsNullOrEmpty (endpoint.Contract) ? Endpoint.Contract : \
ContractDescription.GetContract (ConfigUtil.GetTypeFromConfigString \
(endpoint.Contract)); +
+ if (!String.IsNullOrEmpty (endpoint.Kind)) {
+ var se = ConfigUtil.ConfigureStandardEndpoint (contract, endpoint);
+ if (se.Binding == null)
+ se.Binding = binding;
+ if (se.Address == null && se.Binding != null) // standard endpoint might have \
empty address + se.Address = new EndpointAddress (endpoint.Address);
+ if (se.Binding == null && se.Address != null) // look for protocol mapping
+ se.Binding = ConfigUtil.GetBindingByProtocolMapping (se.Address.Uri);
+
+ service_endpoint = se;
+ } else {
+ if (binding == null && endpoint.Address != null) // look for protocol mapping
+ Endpoint.Binding = ConfigUtil.GetBindingByProtocolMapping (endpoint.Address);
+ }
+#endif
if (Endpoint.Binding == null)
- Endpoint.Binding = ConfigUtil.CreateBinding (res.Binding, \
res.BindingConfiguration); + Endpoint.Binding = ConfigUtil.CreateBinding \
(endpoint.Binding, endpoint.BindingConfiguration); if (Endpoint.Address == null)
- Endpoint.Address = new EndpointAddress (res.Address);
+ Endpoint.Address = new EndpointAddress (endpoint.Address);
- if (res.BehaviorConfiguration != "")
- ApplyBehavior (res.BehaviorConfiguration);
+ if (endpoint.BehaviorConfiguration != "")
+ ApplyBehavior (endpoint.BehaviorConfiguration);
#endif
}
Modified: mcs/class/System.ServiceModel/System.ServiceModel/ServiceHostBase.cs
===================================================================
--- a/mcs/class/System.ServiceModel/System.ServiceModel/ServiceHostBase.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel/ServiceHostBase.cs
@@ -380,7 +380,7 @@ namespace System.ServiceModel
// behaviors
AddServiceBehaviors (service.BehaviorConfiguration, true);
- // services
+ // endpoints
foreach (ServiceEndpointElement endpoint in service.Endpoints) {
ServiceEndpoint se;
@@ -395,13 +395,13 @@ namespace System.ServiceModel
if (se.Address == null && se.Binding != null) // standard endpoint might have \
empty address
se.Address = new EndpointAddress (CreateUri (se.Binding.Scheme, \
endpoint.Address));
if (se.Binding == null && se.Address != null) // look for protocol mapping
- se.Binding = GetBindingByProtocolMapping (se.Address.Uri);
+ se.Binding = ConfigUtil.GetBindingByProtocolMapping (se.Address.Uri);
AddServiceEndpoint (se);
}
else {
if (binding == null && endpoint.Address != null) // look for protocol mapping
- binding = GetBindingByProtocolMapping (endpoint.Address);
+ binding = ConfigUtil.GetBindingByProtocolMapping (endpoint.Address);
se = AddServiceEndpoint (endpoint.Contract, binding, endpoint.Address);
}
#else
@@ -419,16 +419,6 @@ namespace System.ServiceModel
}
}
-#if NET_4_0
- Binding GetBindingByProtocolMapping (Uri address)
- {
- ProtocolMappingElement el = \
ConfigUtil.ProtocolMappingSection.ProtocolMappingCollection \
[address.Scheme];
- if (el == null)
- return null;
- return ConfigUtil.CreateBinding (el.Binding, el.BindingConfiguration);
- }
-#endif
-
private ServiceElement GetServiceElement() {
Type serviceType = Description.ServiceType;
if (serviceType == null)
@@ -506,7 +496,7 @@ namespace System.ServiceModel
foreach (var baddr in BaseAddresses) {
if (!baddr.IsAbsoluteUri)
continue;
- var binding = GetBindingByProtocolMapping (baddr);
+ var binding = ConfigUtil.GetBindingByProtocolMapping (baddr);
if (binding == null)
continue;
AddServiceEndpoint (iface.FullName, binding, baddr);
Commit: a303481db4bda87d8627812ab19068150dca70f0
Author: Atsushi Eno <atsushi@ximian.com>
Date: 02/07/2011 22:07:11
URL: https://github.com/mono/mono/commit/a303481db4bda87d8627812ab19068150dca70f0
Implement GetInheritedContracts(), towards bugfix #668089.
Changed paths:
M mcs/class/System.ServiceModel/System.ServiceModel.Description/ContractDescription.cs
M mcs/class/System.ServiceModel/System.ServiceModel.Description/ContractDescriptionGenerator.cs
M mcs/class/System.ServiceModel/Test/System.ServiceModel.Description/ContractDescriptionTest.cs
Modified: mcs/class/System.ServiceModel/System.ServiceModel.Description/ContractDescription.cs
===================================================================
--- a/mcs/class/System.ServiceModel/System.ServiceModel.Description/ContractDescription.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel.Description/ContractDescription.cs
@@ -29,6 +29,7 @@ using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
+using System.Linq;
using System.Net.Security;
using System.Reflection;
using System.Runtime.Serialization;
@@ -139,10 +140,15 @@ namespace System.ServiceModel.Description
set { session = value; }
}
- [MonoTODO]
public Collection<ContractDescription> GetInheritedContracts ()
{
- throw new NotImplementedException ();
+ var ret = new Collection<ContractDescription> ();
+ foreach (var it in ContractType.GetInterfaces ()) {
+ var icd = ContractDescriptionGenerator.GetContractInternal (it, null, null);
+ if (icd != null)
+ ret.Add (icd);
+ }
+ return ret;
}
internal ClientRuntime CreateClientRuntime (object callbackDispatchRuntime)
Modified: mcs/class/System.ServiceModel/System.ServiceModel.Description/ContractDescriptionGenerator.cs
===================================================================
--- a/mcs/class/System.ServiceModel/System.ServiceModel.Description/ContractDescriptionGenerator.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel.Description/ContractDescriptionGenerator.cs
@@ -132,13 +132,21 @@ namespace System.ServiceModel.Description
static ContractDescription GetContract (Type givenContractType, Type \
givenServiceType, Type serviceTypeForCallback) {
+ var ret = GetContractInternal (givenContractType, givenServiceType, \
serviceTypeForCallback); + if (ret == null)
+ throw new InvalidOperationException (String.Format ("Attempted to get contract \
type from '{0}' which neither is a service contract nor does it inherit service \
contract.", serviceTypeForCallback ?? givenContractType)); + return ret;
+ }
+
+ internal static ContractDescription GetContractInternal (Type givenContractType, \
Type givenServiceType, Type serviceTypeForCallback) + {
// FIXME: serviceType should be used for specifying attributes like \
OperationBehavior.
Type exactContractType = null;
ServiceContractAttribute sca = null;
Dictionary<Type, ServiceContractAttribute> contracts =
GetServiceContractAttributes (serviceTypeForCallback ?? givenServiceType ?? \
givenContractType);
- if (contracts.ContainsKey(givenContractType)) {
+ if (contracts.ContainsKey (givenContractType)) {
exactContractType = givenContractType;
sca = contracts [givenContractType];
} else {
@@ -158,7 +166,7 @@ namespace System.ServiceModel.Description
if (serviceTypeForCallback != null)
sca = contracts.Values.First ();
else
- throw new InvalidOperationException (String.Format ("Attempted to get contract \
type from '{0}' which neither is a service contract nor does it inherit service \
contract.", serviceTypeForCallback ?? givenContractType)); + return null; // no \
contract }
string name = sca.Name ?? exactContractType.Name;
string ns = sca.Namespace ?? "http://tempuri.org/";
Modified: mcs/class/System.ServiceModel/Test/System.ServiceModel.Description/ContractDescriptionTest.cs
===================================================================
--- a/mcs/class/System.ServiceModel/Test/System.ServiceModel.Description/ContractDescriptionTest.cs
+++ b/mcs/class/System.ServiceModel/Test/System.ServiceModel.Description/ContractDescriptionTest.cs
@@ -422,13 +422,22 @@ namespace MonoTests.System.ServiceModel.Description
}
[Test]
- public static void MultipleContractsInTypeHierarchy ()
+ public void MultipleContractsInTypeHierarchy ()
{
ContractDescription.GetContract (typeof \
(DuplicateCheckClassWrapper.ServiceInterface));
var host = new ServiceHost (typeof (DuplicateCheckClassWrapper.DummyService)); // \
fine in MS, fails in Mono with "A contract cannot have two operations that have the \
identical names and different set of parameters" }
+ [Test]
+ public void GetInheritedContracts ()
+ {
+ var cd = ContractDescription.GetContract (typeof (IService));
+ var ccd = cd.GetInheritedContracts ();
+ Assert.AreEqual (1, ccd.Count, "#1");
+ Assert.AreEqual (typeof (IServiceBase), ccd [0].ContractType, "#2");
+ }
+
// It is for testing attribute search in interfaces.
public class Foo : IFoo
{
@@ -664,5 +673,19 @@ namespace MonoTests.System.ServiceModel.Description
public void Foo() { }
}
}
+
+ [ServiceContract]
+ public interface IServiceBase
+ {
+ [OperationContract(IsOneWay = true)]
+ void Say(string word);
+ }
+
+ [ServiceContract(CallbackContract = typeof(IServiceBase))]
+ public interface IService : IServiceBase
+ {
+ [OperationContract]
+ void Join();
+ }
}
}
Commit: 176c92c21def3e4569ee3d7a34b45cc3e991b2c6
Author: Atsushi Eno <atsushi@ximian.com>
Date: 02/07/2011 22:07:22
URL: https://github.com/mono/mono/commit/176c92c21def3e4569ee3d7a34b45cc3e991b2c6
Now operations are collected per corresponding ContractDescription.
This fixes naming of MessageDescription Action URI from its type.
Changed paths:
M mcs/class/System.ServiceModel/System.ServiceModel.Description/ContractDescriptionGenerator.cs
M mcs/class/System.ServiceModel/System.ServiceModel.Description/OperationDescriptionCollection.cs
M mcs/class/System.ServiceModel/Test/System.ServiceModel.Description/ContractDescriptionTest.cs
Modified: mcs/class/System.ServiceModel/System.ServiceModel.Description/ContractDescriptionGenerator.cs
===================================================================
--- a/mcs/class/System.ServiceModel/System.ServiceModel.Description/ContractDescriptionGenerator.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel.Description/ContractDescriptionGenerator.cs
@@ -183,7 +183,14 @@ namespace System.ServiceModel.Description
if (sca.HasProtectionLevel)
cd.ProtectionLevel = sca.ProtectionLevel;
+ foreach (var icd in cd.GetInheritedContracts ()) {
+ FillOperationsForInterface (icd, icd.ContractType, givenServiceType, false);
+ foreach (var od in icd.Operations)
+ cd.Operations.Add (od);
+ }
+
FillOperationsForInterface (cd, cd.ContractType, givenServiceType, false);
+
if (cd.CallbackContractType != null && cd.CallbackContractType != \
cd.ContractType) FillOperationsForInterface (cd, cd.CallbackContractType, null, \
true);
@@ -198,7 +205,7 @@ namespace System.ServiceModel.Description
static void FillOperationsForInterface (ContractDescription cd, Type \
exactContractType, Type givenServiceType, bool isCallback) {
// FIXME: load Behaviors
- MethodInfo [] contractMethods = exactContractType.IsInterface ? GetAllMethods \
(exactContractType) : exactContractType.GetMethods (); + MethodInfo [] \
contractMethods = /*exactContractType.IsInterface ? GetAllMethods (exactContractType) \
:*/ exactContractType.GetMethods (BindingFlags.Public | BindingFlags.Instance | \
BindingFlags.DeclaredOnly); MethodInfo [] serviceMethods = contractMethods;
if (givenServiceType != null && exactContractType.IsInterface) {
var l = new List<MethodInfo> ();
@@ -263,7 +270,7 @@ namespace System.ServiceModel.Description
{
string name = oca.Name ?? (oca.AsyncPattern ? mi.Name.Substring (5) : mi.Name);
- OperationDescription od = cd.Operations.FirstOrDefault (o => o.Name == name);
+ OperationDescription od = isCallback ? null : cd.Operations.FirstOrDefault (o => \
o.Name == name); if (od == null) {
od = new OperationDescription (name, cd);
od.IsOneWay = oca.IsOneWay;
@@ -290,8 +297,8 @@ namespace System.ServiceModel.Description
}
cd.Operations.Add (od);
}
- else if (oca.AsyncPattern && od.BeginMethod != null && od.BeginMethod != mi ||
- !oca.AsyncPattern && od.SyncMethod != null && od.SyncMethod != mi)
+ else if ((oca.AsyncPattern && od.BeginMethod != null && od.BeginMethod != mi ||
+ !oca.AsyncPattern && od.SyncMethod != null && od.SyncMethod != mi) && \
od.InCallbackContract == isCallback) throw new InvalidOperationException \
(String.Format ("contract '{1}' cannot have two operations for '{0}' that have the \
identical names and different set of parameters.", name, cd.Name));
if (oca.AsyncPattern)
Modified: mcs/class/System.ServiceModel/System.ServiceModel.Description/OperationDescriptionCollection.cs
===================================================================
--- a/mcs/class/System.ServiceModel/System.ServiceModel.Description/OperationDescriptionCollection.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel.Description/OperationDescriptionCollection.cs
@@ -60,16 +60,11 @@ namespace System.ServiceModel.Description
protected override void InsertItem (int index, OperationDescription item)
{
- if (Find (item.Name) == null)
- base.InsertItem (index, item);
- else
- throw new InvalidOperationException ("A contract cannot have two operations that \
have the identical names and different set of parameters."); + base.InsertItem \
(index, item); }
protected override void SetItem (int index, OperationDescription item)
{
- if (Find (item.Name) != null)
- base.RemoveItem (index);
base.SetItem (index, item);
}
}
Modified: mcs/class/System.ServiceModel/Test/System.ServiceModel.Description/ContractDescriptionTest.cs
===================================================================
--- a/mcs/class/System.ServiceModel/Test/System.ServiceModel.Description/ContractDescriptionTest.cs
+++ b/mcs/class/System.ServiceModel/Test/System.ServiceModel.Description/ContractDescriptionTest.cs
@@ -27,6 +27,7 @@
//
using System;
using System.Collections.ObjectModel;
+using System.Linq;
using System.Net.Security;
using System.Reflection;
using System.ServiceModel;
@@ -438,6 +439,15 @@ namespace MonoTests.System.ServiceModel.Description
Assert.AreEqual (typeof (IServiceBase), ccd [0].ContractType, "#2");
}
+ [Test]
+ public void InheritedContractAndNamespaces ()
+ {
+ var cd = ContractDescription.GetContract (typeof (IService));
+ Assert.IsTrue (cd.Operations.Any (od => od.Messages.Any (md => md.Action == \
"http://tempuri.org/IServiceBase/Say")), "#1"); // inherited + Assert.IsTrue \
(cd.Operations.Any (od => od.SyncMethod == typeof (IService).GetMethod ("Join") && \
od.Messages.Any (md => md.Action == "http://tempuri.org/IService/Join")), "#2"); // \
self + Assert.IsTrue (cd.Operations.Any (od => od.SyncMethod == typeof \
(IService2).GetMethod ("Join") && od.Messages.Any (md => md.Action == \
"http://tempuri.org/IService/Join")), "#3"); // callback + }
+
// It is for testing attribute search in interfaces.
public class Foo : IFoo
{
@@ -677,15 +687,29 @@ namespace MonoTests.System.ServiceModel.Description
[ServiceContract]
public interface IServiceBase
{
- [OperationContract(IsOneWay = true)]
- void Say(string word);
+ [OperationContract (IsOneWay = true)]
+ void Say (string word);
}
- [ServiceContract(CallbackContract = typeof(IServiceBase))]
+ [ServiceContract (CallbackContract = typeof (IService2))]
public interface IService : IServiceBase
{
[OperationContract]
- void Join();
+ void Join ();
+ }
+
+ [ServiceContract]
+ public interface IServiceBase2
+ {
+ [OperationContract (IsOneWay = true)]
+ void Say (string word);
+ }
+
+ [ServiceContract]
+ public interface IService2 : IServiceBase2
+ {
+ [OperationContract]
+ void Join ();
}
}
}
Commit: 34fad98bf0252296263f924623d3559a5b4ebd7f
Author: Atsushi Eno <atsushi@ximian.com>
Date: 02/07/2011 22:07:33
URL: https://github.com/mono/mono/commit/34fad98bf0252296263f924623d3559a5b4ebd7f
Callback contract should be distinguished from others for DispatchOperation.
Changed paths:
M mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/EndpointDispatcher.cs
M mcs/class/System.ServiceModel/System.ServiceModel/ServiceHostBase.cs
Modified: mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/EndpointDispatcher.cs
===================================================================
--- a/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/EndpointDispatcher.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/EndpointDispatcher.cs
@@ -124,7 +124,7 @@ namespace System.ServiceModel.Dispatcher
IsSystemEndpoint = se.IsSystemEndpoint;
#endif
- this.ContractFilter = GetContractFilter (se.Contract);
+ this.ContractFilter = GetContractFilter (se.Contract, isCallback);
this.DispatchRuntime.Type = serviceType;
@@ -137,7 +137,7 @@ namespace System.ServiceModel.Dispatcher
ccd.FillClientOperations (db.CallbackClientRuntime, true);
}
foreach (OperationDescription od in se.Contract.Operations)
- if (!db.Operations.Contains (od.Name))
+ if (od.InCallbackContract == isCallback/* && !db.Operations.Contains \
(od.Name)*/) PopulateDispatchOperation (db, od);
}
@@ -191,17 +191,20 @@ namespace System.ServiceModel.Dispatcher
db.Operations.Add (o);
}
- MessageFilter GetContractFilter (ContractDescription cd)
+ MessageFilter GetContractFilter (ContractDescription cd, bool isCallback)
{
List<string> actions = new List<string> ();
- foreach (var od in cd.Operations)
+ foreach (var od in cd.Operations) {
foreach (var md in od.Messages)
- if (md.IsRequest)
+ // For callback EndpointDispatcher (i.e. for duplex client), it should get \
"incoming" request for callback operations and "outgoing" response for non-callback \
operations. + // For non-callback EndpointDispatcher, it should get "outgoing" \
request for non-callback operations and "incoming" response for callback operations. \
+ if ((od.InCallbackContract == isCallback) == md.IsRequest) { if (md.Action == \
"*") return new MatchAllMessageFilter ();
else
actions.Add (md.Action);
-
+ }
+ }
return new ActionMessageFilter (actions.ToArray ());
}
}
Modified: mcs/class/System.ServiceModel/System.ServiceModel/ServiceHostBase.cs
===================================================================
--- a/mcs/class/System.ServiceModel/System.ServiceModel/ServiceHostBase.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel/ServiceHostBase.cs
@@ -684,6 +684,8 @@ namespace System.ServiceModel
foreach (IEndpointBehavior b in endPoint.Behaviors)
b.ApplyDispatchBehavior (endPoint, ed);
foreach (OperationDescription operation in endPoint.Contract.Operations) {
+ if (operation.InCallbackContract)
+ continue; // irrelevant
foreach (IOperationBehavior b in operation.Behaviors)
b.ApplyDispatchBehavior (operation, ed.DispatchRuntime.Operations \
[operation.Name]); }
Commit: 68ce0748e53c8a584cb506e1b587c3b5b6899c4f
Author: Atsushi Eno <atsushi@ximian.com>
Date: 02/07/2011 22:07:45
URL: https://github.com/mono/mono/commit/68ce0748e53c8a584cb506e1b587c3b5b6899c4f
Duplex client has its own listener loop, so special care on reply is needed.
Changed paths:
M mcs/class/System.ServiceModel/System.ServiceModel/ClientRuntimeChannel.cs
M mcs/class/System.ServiceModel/System.ServiceModel/DuplexClientRuntimeChannel.cs
Modified: mcs/class/System.ServiceModel/System.ServiceModel/ClientRuntimeChannel.cs
===================================================================
--- a/mcs/class/System.ServiceModel/System.ServiceModel/ClientRuntimeChannel.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel/ClientRuntimeChannel.cs
@@ -26,6 +26,7 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
+using System.Collections.Generic;
using System.Reflection;
using System.Runtime.Serialization;
using System.ServiceModel.Channels;
@@ -576,11 +577,15 @@ namespace System.ServiceModel.MonoInternal
{
if (RequestChannel != null)
return RequestChannel.Request (msg, timeout);
- else {
- DateTime startTime = DateTime.Now;
- OutputChannel.Send (msg, timeout);
- return ((IDuplexChannel) OutputChannel).Receive (timeout - (DateTime.Now - \
startTime));
- }
+ else
+ return RequestCorrelated (msg, timeout, OutputChannel);
+ }
+
+ internal virtual Message RequestCorrelated (Message msg, TimeSpan timeout, \
IOutputChannel channel) + {
+ DateTime startTime = DateTime.Now;
+ OutputChannel.Send (msg, timeout);
+ return ((IDuplexChannel) channel).Receive (timeout - (DateTime.Now - startTime));
}
internal IAsyncResult BeginRequest (Message msg, TimeSpan timeout, AsyncCallback \
callback, object state)
Modified: mcs/class/System.ServiceModel/System.ServiceModel/DuplexClientRuntimeChannel.cs
===================================================================
--- a/mcs/class/System.ServiceModel/System.ServiceModel/DuplexClientRuntimeChannel.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel/DuplexClientRuntimeChannel.cs
@@ -26,6 +26,8 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
+using System.Collections.Generic;
+using System.Linq;
using System.Reflection;
using System.ServiceModel.Channels;
using System.ServiceModel.Description;
@@ -93,6 +95,7 @@ namespace System.ServiceModel.MonoInternal
IAsyncResult loop_result;
AutoResetEvent loop_handle = new AutoResetEvent (false);
AutoResetEvent finish_handle = new AutoResetEvent (false);
+ AutoResetEvent receive_reply_handle = new AutoResetEvent (false);
protected override void OnOpen (TimeSpan timeout)
{
@@ -152,12 +155,28 @@ namespace System.ServiceModel.MonoInternal
}
}
- void ProcessInput (IInputChannel input, Message message)
+ void ProcessInputCore (IInputChannel input, Message message)
{
- try {
+ bool isReply = message != null && Contract.Operations.Any (od => \
!od.InCallbackContract && od.Messages.Any (md => md.Action == \
message.Headers.Action)); + if (isReply) {
+ if (ReplyHandlerQueue.Count > 0) {
+ if (isReply) {
+ var h = ReplyHandlerQueue.Dequeue ();
+ h (message);
+ return;
+ }
+ }
+ }
+
if (!MessageMatchesEndpointDispatcher (message, \
Runtime.CallbackDispatchRuntime.EndpointDispatcher)) throw new \
EndpointNotFoundException (String.Format ("The request message has the target '{0}' \
with action '{1}' which is not reachable in this service contract", \
message.Headers.To, message.Headers.Action));
new InputOrReplyRequestProcessor (Runtime.CallbackDispatchRuntime, \
input).ProcessInput (message); + }
+
+ void ProcessInput (IInputChannel input, Message message)
+ {
+ try {
+ ProcessInputCore (input, message);
} catch (Exception ex) {
// FIXME: log it.
Console.WriteLine (ex);
@@ -174,5 +193,23 @@ namespace System.ServiceModel.MonoInternal
return endpoint.ContractFilter.Match (req);
}
+
+ internal override Message RequestCorrelated (Message msg, TimeSpan timeout, \
IOutputChannel channel) + {
+ DateTime startTime = DateTime.Now;
+ Message ret = null;
+ ManualResetEvent wait = new ManualResetEvent (false);
+ Action<Message> handler = delegate (Message reply) {
+ ret = reply;
+ wait.Set ();
+ };
+ ReplyHandlerQueue.Enqueue (handler);
+ channel.Send (msg, timeout);
+ if (ret == null && !wait.WaitOne (timeout - (DateTime.Now - startTime)))
+ throw new TimeoutException ();
+ return ret;
+ }
+
+ internal Queue<Action<Message>> ReplyHandlerQueue = new Queue<Action<Message>> ();
}
}
Commit: f3ddd9df63db241d5131ca1c0953eb5c0bb9d151
Author: Atsushi Eno <atsushi@ximian.com>
Date: 02/07/2011 22:07:57
URL: https://github.com/mono/mono/commit/f3ddd9df63db241d5131ca1c0953eb5c0bb9d151
handle IsTerminating.
Changed paths:
M mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/EndpointDispatcher.cs
M mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/FinalizeProcessingHandler.cs
Modified: mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/EndpointDispatcher.cs
===================================================================
--- a/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/EndpointDispatcher.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/EndpointDispatcher.cs
@@ -153,6 +153,7 @@ namespace System.ServiceModel.Dispatcher
od.IsOneWay ?
new DispatchOperation (db, od.Name, reqA) :
new DispatchOperation (db, od.Name, reqA, resA);
+ o.IsTerminating = od.IsTerminating;
bool no_serialized_reply = od.IsOneWay;
foreach (MessageDescription md in od.Messages) {
if (md.IsRequest &&
Modified: mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/FinalizeProcessingHandler.cs
===================================================================
--- a/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/FinalizeProcessingHandler.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/FinalizeProcessingHandler.cs
@@ -15,10 +15,11 @@ namespace System.ServiceModel.Dispatcher
}
void FinishRequest (MessageProcessingContext mrc)
- {
- if (mrc.Operation != null && mrc.Operation.ReleaseInstanceAfterCall) {
+ {
+ if (mrc.Operation != null && mrc.Operation.IsTerminating && \
mrc.OperationContext.Channel.InputSession != null) \
+ mrc.OperationContext.Channel.Close (); // FIXME: timeout? + if (mrc.Operation \
!= null && mrc.Operation.ReleaseInstanceAfterCall) \
mrc.InstanceContext.ReleaseServiceInstance ();
- }
mrc.InstanceContext.CloseIfIdle ();
}
}
Commit: 20453fcb9c72670d6ea87469adebc25341b99e5f
Author: Atsushi Eno <atsushi@ximian.com>
Date: 02/07/2011 22:08:10
URL: https://github.com/mono/mono/commit/20453fcb9c72670d6ea87469adebc25341b99e5f
Open and close client/service runtime channels in chains. Fixed bug #663278.
Changed paths:
M mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/InputOrReplyRequestProcessor.cs
M mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/SessionInstanceContextProvider.cs
M mcs/class/System.ServiceModel/System.ServiceModel/ServiceRuntimeChannel.cs
M mcs/class/System.ServiceModel/Test/System.ServiceModel/IntegratedConnectionTest.cs
Modified: mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/InputOrReplyRequestProcessor.cs
===================================================================
--- a/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/InputOrReplyRequestProcessor.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/InputOrReplyRequestProcessor.cs
@@ -60,6 +60,7 @@ namespace System.ServiceModel.Dispatcher
}
else
contextChannel = new ServiceRuntimeChannel (reply_or_input, dispatch_runtime);
+ contextChannel.Open (); // FIXME: timeout?
OperationContext opCtx = new OperationContext (contextChannel);
opCtx.IncomingMessage = incoming;
opCtx.EndpointDispatcher = dispatch_runtime.EndpointDispatcher;
Modified: mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/SessionInstanceContextProvider.cs
===================================================================
--- a/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/SessionInstanceContextProvider.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/SessionInstanceContextProvider.cs
@@ -54,6 +54,10 @@ namespace System.ServiceModel.Dispatcher
{
var key = channel.SessionId ?? String.Empty;
pool [key] = instanceContext;
+ channel.Closed += delegate {
+ pool.Remove (key);
+ instanceContext.Close (); // FIXME: timeout?
+ };
}
public bool IsIdle (InstanceContext instanceContext)
Modified: mcs/class/System.ServiceModel/System.ServiceModel/ServiceRuntimeChannel.cs
===================================================================
--- a/mcs/class/System.ServiceModel/System.ServiceModel/ServiceRuntimeChannel.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel/ServiceRuntimeChannel.cs
@@ -118,6 +118,7 @@ namespace System.ServiceModel.MonoInternal
public ServiceRuntimeChannel (IChannel channel, DispatchRuntime runtime)
{
this.channel = channel;
+ channel.Closing += delegate { Close (); };
this.runtime = runtime;
}
@@ -197,7 +198,8 @@ namespace System.ServiceModel.MonoInternal
protected override void OnClose (TimeSpan timeout)
{
- channel.Close (timeout);
+ if (channel.State == CommunicationState.Opened)
+ channel.Close (timeout);
}
protected override IAsyncResult OnBeginOpen (
@@ -213,7 +215,8 @@ namespace System.ServiceModel.MonoInternal
protected override void OnOpen (TimeSpan timeout)
{
- channel.Open (timeout);
+ if (channel.State == CommunicationState.Created)
+ channel.Open (timeout);
}
// IChannel
Modified: mcs/class/System.ServiceModel/Test/System.ServiceModel/IntegratedConnectionTest.cs
===================================================================
--- a/mcs/class/System.ServiceModel/Test/System.ServiceModel/IntegratedConnectionTest.cs
+++ b/mcs/class/System.ServiceModel/Test/System.ServiceModel/IntegratedConnectionTest.cs
@@ -34,6 +34,8 @@ using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.ServiceModel.Description;
+using System.ServiceModel.Dispatcher;
+using System.Threading;
using System.Xml;
using NUnit.Framework;
@@ -134,6 +136,81 @@ namespace MonoTests.System.ServiceModel
host.Close ();
}
}
+
+ [ServiceContract(SessionMode = SessionMode.Required)]
+ interface IFoo3
+ {
+ [OperationContract]
+ int GetInstanceCounter ();
+ }
+
+ [ServiceBehavior (InstanceContextMode = InstanceContextMode.PerSession)]
+ class Foo3 : IFoo3, IDisposable
+ {
+ public static int CreatedInstances { get; set; }
+ public static int DisposedInstances { get; set; }
+
+ public static int InstanceCounter {
+ get { return CreatedInstances - DisposedInstances; }
+ }
+
+ public Foo3 ()
+ {
+ CreatedInstances++;
+ }
+
+ public int GetInstanceCounter ()
+ {
+ return InstanceCounter;
+ }
+
+ public virtual void Dispose ()
+ {
+ DisposedInstances++;
+ }
+
+ }
+
+ private void TestSessionbehaviour (Binding binding, Uri address)
+ {
+ ServiceHost host = new ServiceHost (typeof (Foo3), address);
+ host.AddServiceEndpoint (typeof (IFoo3), binding, address);
+ host.Description.Behaviors.Add (new ServiceThrottlingBehavior () { \
MaxConcurrentSessions = 1 }); + Foo3.CreatedInstances = Foo3.DisposedInstances = 0; \
// Reset + host.Open ();
+ Assert.AreEqual (0, Foo3.InstanceCounter, "Initial state wrong"); // just to be \
sure + var cd = (ChannelDispatcher) host.ChannelDispatchers [0];
+ for (int i = 1; i <= 3; ++i) {
+ var factory = new ChannelFactory<IFoo3Client> (binding, address.ToString ());
+ var proxy = factory.CreateChannel ();
+ Assert.AreEqual (1, proxy.GetInstanceCounter (), "One server instance after \
first call in session #" + i); + Assert.AreEqual (1, proxy.GetInstanceCounter (), \
"One server instance after second call in session #" + i); + factory.Close (); // \
should close session even when no IsTerminating method has been invoked \
+ Thread.Sleep (500); // give WCF time to dispose service object \
+ Assert.AreEqual (0, Foo3.InstanceCounter, "Service instances must be disposed \
after channel is closed"); + Assert.AreEqual (i, Foo3.CreatedInstances, "One new \
instance per session"); + }
+ host.Close ();
+ }
+
+ interface IFoo3Client : IFoo3, IClientChannel {}
+
+ [Test (Description = "Tests InstanceContextMode.PerSession behavior for NetTcp \
binding")] + public void TestSessionInstancesNetTcp ()
+ {
+ Binding binding = new NetTcpBinding (SecurityMode.None, false);
+ Uri address = new Uri (binding.Scheme + "://localhost:9999/test");
+ TestSessionbehaviour (binding, address);
+ }
+
+ [Test (Description = "Tests InstanceContextMode.PerSession behavior for WsHttp \
binding")] + [Category ("NotWorking")] // no working WSHttpBinding in mono.
+ public void TestSessionInstancesWsHttp ()
+ {
+ Binding binding = new WSHttpBinding (SecurityMode.None, true);
+ Uri address = new Uri (binding.Scheme + "://localhost:9999/test");
+ TestSessionbehaviour(binding, address);
+ }
}
#region SimpleConnection classes
Commit: f5ef8da8e56c93dced3184cde12f0accc84ca33a
Author: Atsushi Eno <atsushi@ximian.com>
Date: 02/07/2011 22:13:57
URL: https://github.com/mono/mono/commit/f5ef8da8e56c93dced3184cde12f0accc84ca33a
Contract-based type must ensure that the base type is also contract-based.
Fixed bug #661987 on WCF side.
Conflicts:
mcs/class/System.Runtime.Serialization/Test/System.Runtime.Serialization/XmlObjectSerializerTest.cs
Changed paths:
M mcs/class/System.Runtime.Serialization/System.Runtime.Serialization/DataContractSerializer.cs
M mcs/class/System.Runtime.Serialization/System.Runtime.Serialization/KnownTypeCollection.cs
M mcs/class/System.Runtime.Serialization/System.Runtime.Serialization/SerializationMap.cs
M mcs/class/System.Runtime.Serialization/Test/System.Runtime.Serialization/XmlObjectSerializerTest.cs
Modified: mcs/class/System.Runtime.Serialization/System.Runtime.Serialization/DataContractSerializer.cs
===================================================================
--- a/mcs/class/System.Runtime.Serialization/System.Runtime.Serialization/DataContractSerializer.cs
+++ b/mcs/class/System.Runtime.Serialization/System.Runtime.Serialization/DataContractSerializer.cs
@@ -386,7 +386,7 @@ namespace System.Runtime.Serialization
}
#endif
- [MonoTODO ("support arrays; support Serializable; support SharedType; use \
DataContractSurrogate")] + [MonoTODO ("use DataContractSurrogate")]
/*
when writeContentOnly is true, then the input XmlWriter
must be at element state. This is to write possible
Modified: mcs/class/System.Runtime.Serialization/System.Runtime.Serialization/KnownTypeCollection.cs
===================================================================
--- a/mcs/class/System.Runtime.Serialization/System.Runtime.Serialization/KnownTypeCollection.cs
+++ b/mcs/class/System.Runtime.Serialization/System.Runtime.Serialization/KnownTypeCollection.cs
@@ -792,6 +792,12 @@ namespace System.Runtime.Serialization
contracts.Add (ret);
ret.Initialize ();
+ if (type.BaseType != typeof (object)) {
+ TryRegister (type.BaseType);
+ if (!FindUserMap (type.BaseType).IsContractAllowedType)
+ throw new InvalidDataContractException (String.Format ("To be serializable by \
data contract, type '{0}' cannot inherit from non-contract and non-Serializable type \
'{1}'", type, type.BaseType)); + }
+
object [] attrs = type.GetCustomAttributes (typeof (KnownTypeAttribute), true);
for (int i = 0; i < attrs.Length; i++) {
KnownTypeAttribute kt = (KnownTypeAttribute) attrs [i];
Modified: mcs/class/System.Runtime.Serialization/System.Runtime.Serialization/SerializationMap.cs
===================================================================
--- a/mcs/class/System.Runtime.Serialization/System.Runtime.Serialization/SerializationMap.cs
+++ b/mcs/class/System.Runtime.Serialization/System.Runtime.Serialization/SerializationMap.cs
@@ -124,6 +124,8 @@ namespace System.Runtime.Serialization
public QName XmlName { get; set; }
+ public abstract bool IsContractAllowedType { get; }
+
protected void HandleId (XmlReader reader, XmlFormatterDeserializer deserializer, \
object instance) {
HandleId (reader.GetAttribute ("Id", KnownTypeCollection.MSSimpleNamespace), \
deserializer, instance); @@ -381,6 +383,8 @@ namespace System.Runtime.Serialization
internal partial class XmlSerializableMap : SerializationMap
{
+ public override bool IsContractAllowedType { get { return true; } }
+
public XmlSerializableMap (Type type, QName qname, KnownTypeCollection knownTypes)
: base (type, qname, knownTypes)
{
@@ -419,6 +423,8 @@ namespace System.Runtime.Serialization
{
}
+ public override bool IsContractAllowedType { get { return true; } }
+
internal void Initialize ()
{
Type type = RuntimeType;
@@ -483,6 +489,8 @@ namespace System.Runtime.Serialization
{
}
+ public override bool IsContractAllowedType { get { return false; } }
+
internal void Initialize ()
{
Members.AddRange (GetDefaultMembers ());
@@ -530,6 +538,8 @@ namespace System.Runtime.Serialization
internal override string CurrentNamespace {
get { return XmlName.Namespace; }
}
+
+ public override bool IsContractAllowedType { get { return true; } }
}
internal interface ICollectionTypeMap
@@ -575,6 +585,8 @@ namespace System.Runtime.Serialization
return null;
}
+ public override bool IsContractAllowedType { get { return false; } }
+
public override bool OutputXsiType {
get { return false; }
}
@@ -718,6 +730,8 @@ namespace System.Runtime.Serialization
get { return a != null && !String.IsNullOrEmpty (a.Namespace) ? a.Namespace : \
KnownTypeCollection.MSArraysNamespace; } }
+ public override bool IsContractAllowedType { get { return a != null; } }
+
public Type KeyType { get { return key_type; } }
public Type ValueType { get { return value_type; } }
@@ -873,6 +887,8 @@ namespace System.Runtime.Serialization
{
}
+ public override bool IsContractAllowedType { get { return true; } }
+
public void Initialize ()
{
Members = GetMembers (RuntimeType, XmlName, false);
@@ -945,6 +961,8 @@ namespace System.Runtime.Serialization
}
}
+ public override bool IsContractAllowedType { get { return false; } }
+
private EnumMemberAttribute GetEnumMemberAttribute (
MemberInfo mi)
{
Modified: mcs/class/System.Runtime.Serialization/Test/System.Runtime.Serialization/XmlObjectSerializerTest.cs
===================================================================
--- a/mcs/class/System.Runtime.Serialization/Test/System.Runtime.Serialization/XmlObjectSerializerTest.cs
+++ b/mcs/class/System.Runtime.Serialization/Test/System.Runtime.Serialization/XmlObjectSerializerTest.cs
@@ -1500,25 +1500,17 @@ namespace MonoTests.System.Runtime.Serialization
var ds = (DataSet) x.ReadObject (r);
}
- [Test] // bug #652331
- public void MembersNamespacesInBaseType ()
+ [Test]
+ [ExpectedException (typeof (InvalidDataContractException))] // BaseConstraintType1 \
is neither DataContract nor Serializable. + public void BaseConstraint1 ()
{
- string xml1 = @"<Currency>JPY</Currency><Description i:nil=""true"" />";
- string xml2 = @"<Currency \
xmlns=""http://schemas.datacontract.org/2004/07/SLProto5"">JPY</Currency><Description \
i:nil=""true"" \
xmlns=""http://schemas.datacontract.org/2004/07/SLProto5"" />";
- Assert.AreEqual ("JPY", MembersNamespacesInBaseType_Part<SLProto5.CashAmount> \
(new SLProto5.CashAmount () { Currency = "JPY" }, xml1, \
"#1").Currency, "r#1");
- Assert.AreEqual ("JPY", \
MembersNamespacesInBaseType_Part<SLProto5_Different.CashAmount> (new \
SLProto5_Different.CashAmount () { Currency = "JPY" }, xml2, \
"#2").Currency, "r#2");
- Assert.AreEqual ("JPY", MembersNamespacesInBaseType_Part<SLProto5.CashAmountDC> \
(new SLProto5.CashAmountDC () { Currency = "JPY" }, xml1, \
"#3").Currency, "r#3");
- Assert.AreEqual ("JPY", \
MembersNamespacesInBaseType_Part<SLProto5_Different.CashAmountDC> (new \
SLProto5_Different.CashAmountDC () { Currency = "JPY" }, xml2, "#4").Currency, \
"r#4"); + new DataContractSerializer (typeof (BaseConstraintType3)).WriteObject \
(XmlWriter.Create (TextWriter.Null), new BaseConstraintType3 ()); }
- T MembersNamespacesInBaseType_Part<T> (T instance, string expectedPart, string \
assert) + [Test]
+ public void BaseConstraint2 ()
{
- var ds = new DataContractSerializer (typeof (T));
- var sw = new StringWriter ();
- using (var w = XmlWriter.Create (sw))
- ds.WriteObject (w, instance);
- Assert.IsTrue (sw.ToString ().IndexOf (expectedPart) > 0, assert);
- return (T) ds.ReadObject (XmlReader.Create (new StringReader (sw.ToString ())));
+ new DataContractSerializer (typeof (BaseConstraintType4)).WriteObject \
(XmlWriter.Create (TextWriter.Null), new BaseConstraintType4 ()); }
[Test] // bug #652331
@@ -1842,6 +1834,25 @@ namespace MonoTests.System.Runtime.Serialization
[DataMember]
public string X = "x";
}
+
+ class BaseConstraintType1 // non-serializable
+ {
+ }
+
+ [Serializable]
+ class BaseConstraintType2
+ {
+ }
+
+ [DataContract]
+ class BaseConstraintType3 : BaseConstraintType1
+ {
+ }
+
+ [DataContract]
+ class BaseConstraintType4 : BaseConstraintType2
+ {
+ }
}
[DataContract]
Commit: 38fe929b9f82fad567862ecb2ede9c5ffb29196b
Author: Atsushi Eno <atsushi@ximian.com>
Date: 02/08/2011 03:11:15
URL: https://github.com/mono/mono/commit/38fe929b9f82fad567862ecb2ede9c5ffb29196b
There's a tricky namespace-mismatching deserialization in .NET implementation.
Fixed bug #666333.
Changed paths:
M mcs/class/System.Runtime.Serialization/System.Runtime.Serialization/SerializationMap.cs
M mcs/class/System.Runtime.Serialization/System.Runtime.Serialization_test.dll.sources
Added paths:
A mcs/class/System.Runtime.Serialization/Test/System.Runtime.Serialization/Bug666333Test.cs
Modified: mcs/class/System.Runtime.Serialization/System.Runtime.Serialization/SerializationMap.cs
===================================================================
--- a/mcs/class/System.Runtime.Serialization/System.Runtime.Serialization/SerializationMap.cs
+++ b/mcs/class/System.Runtime.Serialization/System.Runtime.Serialization/SerializationMap.cs
@@ -266,7 +266,7 @@ namespace System.Runtime.Serialization
reader.MoveToContent ();
if (!isEmpty && reader.NodeType == XmlNodeType.EndElement)
reader.ReadEndElement ();
- else if (!isEmpty && reader.NodeType != XmlNodeType.None) {
+ else if (!isEmpty && !reader.EOF && reader.NodeType != XmlNodeType.EndElement) {
var li = reader as IXmlLineInfo;
throw new SerializationException (String.Format ("Deserializing type '{3}'. \
Expecting state 'EndElement'. Encountered state '{0}' with name '{1}' with namespace \
'{2}'.{4}", reader.NodeType,
@@ -302,36 +302,48 @@ namespace System.Runtime.Serialization
int depth = reader.NodeType == XmlNodeType.None ? reader.Depth : reader.Depth - \
1; bool [] filled = new bool [Members.Count];
+ bool [] nsmatched = new bool [Members.Count];
int memberInd = -1, ordered = -1;
while (!empty && reader.NodeType == XmlNodeType.Element && reader.Depth > depth) \
{ DataMemberInfo dmi = null;
int i = 0;
+ bool nsmatchedOne = false;
for (; i < Members.Count; i++) { // unordered
if (Members [i].Order >= 0)
break;
- if (reader.LocalName == Members [i].XmlName &&
- (Members [i].XmlRootNamespace == null || reader.NamespaceURI == Members \
[i].XmlRootNamespace)) { + if (reader.LocalName == Members [i].XmlName) {
memberInd = i;
dmi = Members [i];
- break;
+ nsmatchedOne = (dmi.XmlRootNamespace == null || reader.NamespaceURI == \
dmi.XmlRootNamespace); + if (nsmatchedOne)
+ break;
}
}
for (i = Math.Max (i, ordered); i < Members.Count; i++) { // ordered
if (dmi != null)
break;
- if (reader.LocalName == Members [i].XmlName &&
- (Members [i].XmlRootNamespace == null || reader.NamespaceURI == Members \
[i].XmlRootNamespace)) {
- memberInd = i;
+ if (reader.LocalName == Members [i].XmlName) {
ordered = i;
+ memberInd = i;
dmi = Members [i];
- break;
+ nsmatchedOne = (dmi.XmlRootNamespace == null || reader.NamespaceURI == \
dmi.XmlRootNamespace); + if (nsmatchedOne)
+ break;
}
}
-
+
if (dmi == null) {
reader.Skip ();
+ reader.MoveToContent ();
+ continue;
+ }
+ if (filled [memberInd] && nsmatched [memberInd]) {
+ // The strictly-corresponding member (i.e. that matches namespace URI too, not \
only local name) already exists, so skip this element. + reader.Skip ();
+ reader.MoveToContent ();
continue;
}
+ nsmatched [memberInd] = nsmatchedOne;
SetValue (dmi, instance, deserializer.Deserialize (dmi.MemberType, reader));
filled [memberInd] = true;
reader.MoveToContent ();
@@ -1016,7 +1028,7 @@ namespace System.Runtime.Serialization
if (value != String.Empty) {
if (flag_attr && value.IndexOf (' ') != -1) {
- long flags = 0l;
+ long flags = 0L;
foreach (string flag in value.Split (' ')) {
foreach (EnumMemberInfo emi in enum_members) {
if (emi.XmlName == flag) {
Modified: mcs/class/System.Runtime.Serialization/System.Runtime.Serialization_test.dll.sources
===================================================================
--- a/mcs/class/System.Runtime.Serialization/System.Runtime.Serialization_test.dll.sources
+++ b/mcs/class/System.Runtime.Serialization/System.Runtime.Serialization_test.dll.sources
@@ -1,3 +1,4 @@
+System.Runtime.Serialization/Bug666333Test.cs
System.Runtime.Serialization/DataContractResolverTest.cs
System.Runtime.Serialization/XmlObjectSerializerTest.cs
System.Runtime.Serialization/XsdDataContractExporterTest.cs
Added: mcs/class/System.Runtime.Serialization/Test/System.Runtime.Serialization/Bug666333Test.cs
===================================================================
--- /dev/null
+++ b/mcs/class/System.Runtime.Serialization/Test/System.Runtime.Serialization/Bug666333Test.cs
@@ -0,0 +1,360 @@
+using System;
+using System.Runtime.Serialization;
+using System.IO;
+using System.Diagnostics;
+using System.Xml.Serialization;
+using System.Globalization;
+using System.ComponentModel;
+using System.ServiceModel;
+using System.ServiceModel.Channels;
+using System.ServiceModel.Description;
+using System.Xml;
+using System.CodeDom.Compiler;
+using NUnit.Framework;
+
+namespace MonoTests.System.Runtime.Serialization
+{
+ [TestFixture]
+ public class Bug666333Test
+ {
+ [Test]
+ public void Bug666333 ()
+ {
+ // xml : original xml in the test
+ // xml2 : when it is *appropriately* serialized
+ // xml3 : mixed, d4p1:activeuser comes first
+ // xml4 : mixed, d4p1:activeuser comes second
+ // (Note that d4p1:activeuser is the actual element to be deserialized which \
takes precedence over urn:foo activeuser.) +
+ string xml = @"
+ <CheckLoginResponse xmlns='http://tempuri.org/'>
+ <playeractiveuser>
+ <activeuser>
+ <id>id</id>
+ <hkey>hkey</hkey>
+ <email>FOO@BAR.com</email>
+ <lastcheck>2011-01-21T22:50:52.02</lastcheck>
+ </activeuser>
+ <response>
+ <responsemessage>Acceso correcto, creado nuevo hkey!</responsemessage>
+ <responsecode>1</responsecode>
+ <langId>6</langId>
+ </response>
+ </playeractiveuser>
+ </CheckLoginResponse>
+ ";
+
+ string xml2 = @"
+<CheckLoginResponse xmlns='http://tempuri.org/'>
+ <playeractiveuser xmlns:d4p1='http://schemas.datacontract.org/2004/07/' \
xmlns:i='http://www.w3.org/2001/XMLSchema-instance'> + <d4p1:activeuser>
+ <d4p1:email i:nil='true' />
+ <d4p1:hkey i:nil='true' />
+ <d4p1:id>idd</d4p1:id>
+ <d4p1:lastcheck i:nil='true' />
+ </d4p1:activeuser>
+ <d4p1:response>
+ <d4p1:langId i:nil='true' />
+ <d4p1:responsecode>100</d4p1:responsecode>
+ <d4p1:responsemessage i:nil='true' />
+ </d4p1:response>
+ </playeractiveuser>
+</CheckLoginResponse>";
+
+ string xml3 = @"
+<CheckLoginResponse xmlns='http://tempuri.org/'>
+ <playeractiveuser xmlns:d4p1='http://schemas.datacontract.org/2004/07/' \
xmlns:i='http://www.w3.org/2001/XMLSchema-instance'> + <d4p1:activeuser>
+ <d4p1:email i:nil='true' />
+ <d4p1:hkey i:nil='true' />
+ <d4p1:id>iddd</d4p1:id>
+ <d4p1:lastcheck i:nil='true' />
+ </d4p1:activeuser>
+ <activeuser xmlns='urn:foo'>
+ <email i:nil='true' />
+ <hkey i:nil='true' />
+ <id>idd</id>
+ <lastcheck i:nil='true' />
+ </activeuser>
+ <response xmlns='urn:foo'>
+ <langId i:nil='true' />
+ <responsecode>200</responsecode>
+ <responsemessage i:nil='true' />
+ </response>
+ </playeractiveuser>
+</CheckLoginResponse>";
+
+ string xml4 = @"
+<CheckLoginResponse xmlns='http://tempuri.org/'>
+ <playeractiveuser xmlns:d4p1='http://schemas.datacontract.org/2004/07/' \
xmlns:i='http://www.w3.org/2001/XMLSchema-instance'> + <activeuser \
xmlns='urn:foo'> + <email i:nil='true' />
+ <hkey i:nil='true' />
+ <id>idd</id>
+ <lastcheck i:nil='true' />
+ </activeuser>
+ <d4p1:activeuser>
+ <d4p1:email i:nil='true' />
+ <d4p1:hkey i:nil='true' />
+ <d4p1:id>iddd</d4p1:id>
+ <d4p1:lastcheck i:nil='true' />
+ </d4p1:activeuser>
+ <response xmlns='urn:foo'>
+ <langId i:nil='true' />
+ <responsecode>200</responsecode>
+ <responsemessage i:nil='true' />
+ </response>
+ </playeractiveuser>
+</CheckLoginResponse>";
+
+ var tm = TypedMessageConverter.Create (typeof (CheckLoginResponse), "urn:foo");
+ var m = Message.CreateMessage (MessageVersion.Default, "urn:foo", \
XmlReader.Create (new StringReader (xml))); + m = Message.CreateMessage \
(MessageVersion.Default, "urn:foo", XmlReader.Create (new StringReader (xml2))); \
+ m = Message.CreateMessage (MessageVersion.Default, "urn:foo", XmlReader.Create \
(new StringReader (xml3))); + var clr = (CheckLoginResponse) tm.FromMessage (m);
+ Assert.IsNotNull (clr.playeractiveuser, "#1");
+ Assert.IsNotNull (clr.playeractiveuser.activeuser, "#2");
+ Assert.AreEqual ("iddd", clr.playeractiveuser.activeuser.id, "#3");
+
+ m = Message.CreateMessage (MessageVersion.Default, "urn:foo", XmlReader.Create \
(new StringReader (xml4))); + Assert.AreEqual ("iddd
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic