[Mono-dev] Generic Variance
This is a patch to add runtime support for generic variance. This patch lacks certain features of the spec. For example, only reference type variance is supported. Also, the runtime does not enforce the validity of variant parameters (that they only appear in interface and delegate types, that covariant parameters only appear as return types and in interface inheritance, and the contravariant parameters only appear as by-value method parameter types). This means it is possible to violate type safety will invalid CIL. The patch is contributed under the MIT/X11 license. It is attached and inline. Index: mono/metadata/class.c === --- mono/metadata/class.c(revision 125254) +++ mono/metadata/class.c(working copy) @@ -2034,8 +2034,57 @@ return (key-interface_id - element-interface_id); } +static gboolean +mono_class_has_variant_generic_params (MonoClass *klass) +{ +int i; +MonoGenericContainer *container; + +if (!klass-generic_class) +return FALSE; + +container = klass-generic_class-container_class-generic_container; + +for (i = 0; i container-type_argc; ++i) +if (container-type_params [i].flags GENERIC_PARAMETER_ATTRIBUTE_VARIANCE_MASK) +return TRUE; + +return FALSE; +} + +static gboolean +mono_class_is_variant_of (MonoClass *klass, MonoClass *vklass) { +int i; +MonoClass *generic = klass-generic_class-container_class; +MonoClass *vgeneric = vklass-generic_class-container_class; +MonoGenericContainer *container = vgeneric-generic_container; + +if (generic != vgeneric) +return FALSE; + +for (i = 0; i container-type_argc; i++) { +MonoClass *param_class = mono_class_from_mono_type (klass-generic_class-context.class_inst-type_argv [i]); +MonoClass *vparam_class = mono_class_from_mono_type (vklass-generic_class-context.class_inst-type_argv [i]); + +// FIXME this is incorrect +if (param_class-valuetype || vparam_class-valuetype) +return FALSE; + +if (container-type_params [i].flags GENERIC_PARAMETER_ATTRIBUTE_VARIANCE_MASK) { +if ((container-type_params [i].flags GENERIC_PARAMETER_ATTRIBUTE_CONTRAVARIANT) !mono_class_is_assignable_from (param_class, vparam_class)) +return FALSE; +if ((container-type_params [i].flags GENERIC_PARAMETER_ATTRIBUTE_COVARIANT) !mono_class_is_assignable_from (vparam_class, param_class)) +return FALSE; +} else if (param_class != vparam_class) +return FALSE; +} + +return TRUE; +} + int mono_class_interface_offset (MonoClass *klass, MonoClass *itf) { +int i; MonoClass **result = bsearch ( itf, klass-interfaces_packed, @@ -2044,9 +2093,14 @@ compare_interface_ids); if (result) { return klass-interface_offsets_packed [result - (klass-interfaces_packed)]; -} else { -return -1; +} else if (mono_class_has_variant_generic_params (itf)) { +for (i = 0; i klass-interface_offsets_count; i++) { +if (mono_class_is_variant_of (klass-interfaces_packed[i], itf)) { +return klass-interface_offsets_packed [i]; +} +} } +return -1; } static void @@ -5797,24 +5851,6 @@ return FALSE; } -static gboolean -mono_class_has_variant_generic_params (MonoClass *klass) -{ -int i; -MonoGenericContainer *container; - -if (!klass-generic_class) -return FALSE; - -container = klass-generic_class-container_class-generic_container; - -for (i = 0; i container-type_argc; ++i) -if (container-type_params [i].flags (MONO_GEN_PARAM_VARIANT|MONO_GEN_PARAM_COVARIANT)) -return TRUE; - -return FALSE; -} - /** * mono_class_is_assignable_from: * @klass: the class to be assigned to @@ -5852,55 +5888,23 @@ if (MONO_CLASS_IMPLEMENTS_INTERFACE (oklass, klass-interface_id)) return TRUE; -if (mono_class_has_variant_generic_params (klass)) { -if (oklass-generic_class) { -int i; -gboolean match = FALSE; -MonoClass *container_class1 = klass-generic_class-container_class; -MonoClass *container_class2 = oklass-generic_class-container_class; +if (mono_class_has_variant_generic_params (klass) oklass-generic_class) { +int i; +gboolean match = FALSE; +MonoClass *container_class1 = klass-generic_class-container_class; +MonoClass *container_class2 = oklass-generic_class-container_class; -/* - * Check whenever the generic definition of oklass implements the - * generic definition of klass. The IMPLEMENTS_INTERFACE stuff is not usable - * here since the relevant tables are not set up. - */ -
Re: [Mono-dev] gdal/mono/linux; Native bindings, PInvoke, and tracking TypeLoader exceptions
hi Floris Briolas wrote: fevans wrote: *trim* So when I run the command 'mono GDALInfo.exe' it returns a usage statement. no errors. But when I run 'mono GDALinfo.exe foo.tif', I get a type-loader exception. *trim* This is a yes, me too response, but I've done some analysis on my own. First I was stuck on the DllNotFoundException. My next step was to call GDALAllRegister on gdal_fw (Gdal_wrap uses this one). (*All code was not cut and pasted*) [DllImport(gdal_fw)] public static extern void GDALAllRegister(); And created a small console app that runs this. When run from command line it runs just fine, but when run with mono it gave a DllNotFoundException (startled). The DLL could be found just fine, the environment path was the same, it pointed to the bin of gdal (I've used fwtools 2.2.8) ,.. so what could have gone wrong? I've PInvoked LoadLibrary from Kernel32 [DllImport(Kernel32), SetLastError = true)] Public extern static int LoadLibrary(string name); When you run : Console.WriteLine(LoadLibrary(gdal_fw)); With normal .net it runs fine, a handle is returned. under mono it fails with error code (getlasterror) 182 meaning invalid ordinal? I've checked the dll dependencies of gdal_fw,.. and long story short, it seems the ssleay32.dll fails to load (182) when mono is run. The dependencies of ssleay32 load just fine. btw folks these are all unmanaged dll's.. Now it's time for me to give up. Hoping someone finds a solution, or an explanation why this would occur with mono running. regards Floris Briolas (used mono 2.0.1 on win xp) Sorry but i don't speek english... i was found the solution to the ssleay32.dll load problem. command line del c:\your mono path\bin\libeay32.dll and if you run this code snippet: [DllImport(Kernel32, SetLastError = true)] public extern static int LoadLibrary(string name); static void Main() { ... Console.WriteLine(libeay32.dll: + LoadLibrary(libeay32.dll).ToString ()); Console.WriteLine(ssleay32.dll: + LoadLibrary(ssleay32.dll).ToString ()); ... } command line mono test.exe libeay32.dll: 21037056 ssleay32.dll: 22347776 and it seems that works well! it seems a bug. regards -- View this message in context: http://www.nabble.com/gdal-mono-linux--Native-bindings%2C-PInvoke%2C-and-tracking-TypeLoader-exceptions-tp17622978p21533484.html Sent from the Mono - Dev mailing list archive at Nabble.com. ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
[Mono-dev] Running Asp.net Applications on Mono
I have to perform the following tasks using Mono 2.2. 1.Running unManaged COM component with Mono 2.Running an asp.net portal on Mono Just help me with some links and code.This is very urgent. Harish. -- View this message in context: http://www.nabble.com/Running-Asp.net-Applications-on-Mono-tp21557934p21557934.html Sent from the Mono - Dev mailing list archive at Nabble.com. ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
[Mono-dev] Winforms failing to start -svn 123860 (XIM problem)
Hi, I have a number of winforms applications which are failing to start correctly. They work fine until about 123650 under svn. Under 123775, I had problems with FUTEX_WAIT (and it never completed). Under 123860, when I run using mono -v filename.exe, I get at the end (sorry for any mistakes, I'm on a different machine to the one the code is on) Method System.Windows.Forms.X11Keyboard:SetupXIM() emitted at 0x5e7560 to 0x5e765e (code length 254) [colourmixer.exe] Method (wrapper managed-to-native) System.Windows.Forms.X11Keyboard:XSupportLocale () emitted 0x5e7688 to 0x5e76cc (code length 68) [colourmixer.exe] Method (wrapper managed-to-native) System.Windows.Forms.X11Keyboard:XSetLocaleModifiers (string) emitted at 0x5e76d0 to 0x5e773b (code length 107) [colourmixer.exe] Method (wrapper to native) System.Windows.Forms.X11Keyboard:XOpenIM (intptr, intptr, intptr, intptr) emitted at 0x5e7740 to 0x5e7793 (code length 83) [colourmixer.exe] strace suggests something is either in an endless loop (I get a (time(NULL) = 1232452591, 4 semops, waitpid(3977, 0x3f8294, WNOHANG)=0, nanosleep((10, 0), null) = 0) continually) Is there a simple fix for this or something I can look at to see if it is mono at fault or my X server? Using Fedora rawhide, x86 TTFN Paul -- View this message in context: http://www.nabble.com/Winforms-failing-to-start--svn-123860-%28XIM-problem%29-tp21561767p21561767.html Sent from the Mono - Dev mailing list archive at Nabble.com. ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
[Mono-dev] Problems with ThreadPool
Hello I'm developing an application that will run in windows and linux usign .NET Framework 2.0 and Mono. This application (and ETL) will process files. The operator will change the configuration of the number of files that will process each time according with memory and number of files to process. In .NET framework I can use the ThreadPoll and set the new MaxThreads. In mono, I have that method (ThreadPool.SetMaxThreads) but that method don't do anything. I check the file mcs/class/corlib/System.Threading/ThreadPool.cs and in the method has the tag: [MonoTODO(The max number of threads cannot be decremented.)] In windows I can do .. why I can't do that in linux?? anyone can help me?!? regards Paulo Aboim Pinto Odivelas - Portugal How can I use this? ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
[Mono-dev] ServiceHost Crashes
Hello, I am running a C# ServiceHost in a Winforms application that is identical in code to a Windows application.. using wsHttpBinding on port 8731 on the Suse 11.0 VM that is supplied on the Mono downloads page. The service starts fine but when I try to create a proxy to the service, the Windows application crashes with the following error on the server: Unhandled Exception: Sytem.InvalidOperationException: The reply channel didn't return RequestContext at System.ServiceModel.Dispatcher.ChannelDispatcher+ListenerLoopManger.ProcessRequest () (0x0) at System.ServiceModel.Dispatcher.ChannelDispatcher+ListenerLoopManager.StartLoopCore () (0x0) at System.ServiceModel.Dispatcher.ChannelDispatcher+ListenerLoopManager.StartLoop () (0x0) Client error: The document at the url http://192.168.1.237:8731/ was not recognized as a known document type. The error message from each known type may help you fix the problem: - Report from 'DISCO Document' is 'Discovery document at the URL http://192.168.1.237:8731/ could not be found.'. - The document format is not recognized. - Report from 'WSDL Document' is 'There is an error in XML document (1, 40).'. - Fault xmlns='' was not expected. - Report from 'XML Schema' is 'The root element of a W3C XML Schema should be schema and its namespace should be 'http://www.w3.org/2001/XMLSchema'.'. Metadata contains a reference that cannot be resolved: 'http://192.168.1.237:8731/'. Content Type application/soap+xml; charset=utf-8 was not supported by service http://192.168.1.237:8731/. The client and service bindings may be mismatched. The remote server returned an error: (415) Expected content-type 'text/xml; charset=utf-8' but got 'application/soap+xml; charset=utf-8'. If the service is defined in the current solution, try building the solution and adding the service reference again. Thanks.. any thoughts would be greatly appreciated.. -- View this message in context: http://www.nabble.com/ServiceHost-Crashes-tp21616975p21616975.html Sent from the Mono - Dev mailing list archive at Nabble.com. ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-dev] C++, COM interop
You mentioned you don't want to use SWIG, so its probably foolish of me to comment, but after avoiding swig for years, I've recently had a lot of success in both Windows and Linux. Yes, if you have a lot of exposed methods its work to define the interface files initially, but the results work really well. -- View this message in context: http://www.nabble.com/C%2B%2B%2C-COM-interop-tp21539294p21629943.html Sent from the Mono - Dev mailing list archive at Nabble.com. ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
[Mono-dev] Help on deploying library to gac using autotools
Hi, I'm not an autotools expert. I just want to create a package to distribute my lib into GAC. I signed my library and everything, I created the Makefiles using the addin from MonoDevelop but I don't know how to get it to install the lib into GAC instead of PREFIX/lib. Can someone please help me with that? -- View this message in context: http://www.nabble.com/Help-on-deploying-library-to-gac-using-autotools-tp21636076p21636076.html Sent from the Mono - Dev mailing list archive at Nabble.com. ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
[Mono-dev] Patches to enable off-tree build
When building gtk-sharp and gnome-sharp outside source tree: ,- | $ /home/thep/vcs/gnome_svn/gtk-sharp/bootstrap-2.14 --prefix /opt/gnome2 --libdir '${exec_prefix}/lib64' --disable-static --disable-gtk-doc | /home/thep/vcs/gnome_svn/gtk-sharp/bootstrap-2.14: line 13: ./bootstrap-generic: No such file or directory `- It should be nice to allow off-tree builds. And the attached patches were what I did to make it. Note that I'm not in the list. So, please Cc: me on any reply. Regards, -- Theppitak Karoonboonyanan http://linux.thai.net/~thep/ Index: bootstrap-generic === --- bootstrap-generic (revision 125053) +++ bootstrap-generic (working copy) @@ -96,6 +96,9 @@ esac +topdir=`pwd` +cd $srcdir + if grep ^AM_PROG_LIBTOOL configure.in /dev/null; then if test -z $NO_LIBTOOLIZE ; then echo Running libtoolize... @@ -125,7 +128,9 @@ echo Running autoconf ... autoconf || { echo **Error**: autoconf failed.; exit 1; } +cd $topdir + conf_flags=--enable-maintainer-mode --enable-compile-warnings #--enable-iso-c if test x$NOCONFIGURE = x; then Index: bootstrap-2.14 === --- bootstrap-2.14 (revision 125053) +++ bootstrap-2.14 (working copy) @@ -10,4 +10,7 @@ VERSIONCFLAGS=-DGTK_SHARP_2_6 -DGTK_SHARP_2_8 -DGTK_SHARP_2_10 -DGTK_SHARP_2_12 -DGTK_SHARP_2_14 GTK_API_TAG=2.14 -. ./bootstrap-generic $@ +srcdir=`dirname $0` +test -z $srcdir srcdir=. + +. $srcdir/bootstrap-generic $@ Index: bootstrap-generic === --- bootstrap-generic (revision 125053) +++ bootstrap-generic (working copy) @@ -93,6 +93,9 @@ esac +topdir=`pwd` +cd $srcdir + if grep ^AM_PROG_LIBTOOL configure.in /dev/null; then if test -z $NO_LIBTOOLIZE ; then echo Running libtoolize... @@ -122,7 +125,9 @@ echo Running autoconf ... autoconf || { echo **Error**: autoconf failed.; exit 1; } +cd $topdir + conf_flags=--enable-maintainer-mode --enable-compile-warnings #--enable-iso-c if test x$NOCONFIGURE = x; then Index: bootstrap-2.24 === --- bootstrap-2.24 (revision 125053) +++ bootstrap-2.24 (working copy) @@ -12,4 +12,7 @@ VERSIONCFLAGS=-DGTK_SHARP_2_6 -DGTK_SHARP_2_8 -DGNOME_SHARP_2_16 -DGNOME_SHARP_2_20 -DGNOME_SHARP_2_24 GNOME_API_TAG=2.20 -. ./bootstrap-generic $@ +srcdir=`dirname $0` +test -z $srcdir srcdir=. + +. $srcdir/bootstrap-generic $@ ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
[Mono-dev] high precision real cpu time in MONO (on linux)
Hello All, I am a newbie to Mono and to C# ; I am using only Debian/Sid/AMD64 on a recent linux 2.6.29-rc3 kernel (with CONFIG_HIGH_RES_TIMERS CONFIG_HZ=1000) , mono 2.2 I am searching for a way to measure real clock and cpu time with high precision. The linux system call is clock_gettime. Apparently mono has some way to get it, since mono-2.2 contains the file mono/utils/mono-time.[ch] with functions gint64 mono_100ns_ticks(void) MONO_INTERNAL; gint64 mono_100ns_datetime (void) MONO_INTERNAL; I blindly guess that MONO_INTERNAL would mean that these functions are not accessible from C# 3.0 code. What is the easiest way to get high precision (at least high resolution) time on Linux? Ideally I would like to get CLOCK_REALTIME or CLOCK_MONOTONIC and CLOCK_THREAD_CPUTIME_ID. But any way of measuring milliseconds real cpu (preferably thread) time is ok. Any clues? Thanks. -- Basile Starynkevitch http://starynkevitch.net/Basile/ -- View this message in context: http://www.nabble.com/high-precision-real---cpu-time-in-MONO-%28on-linux%29-tp21767078p21767078.html Sent from the Mono - Dev mailing list archive at Nabble.com. ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
[Mono-dev] Mono 2.2 build problem on ARM9 ..
Hello All.. I am trying to build mono 2.2 on an ARM9 Linux Debian platform and I am getting the exception below. I have previously built versions 2.0 and 2.0.1 just fine on this board. I have found some references to this problem and I checked the proposed patches.. they seem to be in the mono 2.2 code base. Those patches have to do with the floating point code generator. I tried ./configure --with-fpu=NONE but it did not make any difference. Thank you for any info.. Cris.. Here is the exception (and a bit of make context..) . make[7]: Entering directory `/tmp/mono-2.2/mcs/class/System.XML' make all-local make[8]: Entering directory `/tmp/mono-2.2/mcs/class/System.XML' ../../jay/jay -ct ../../jay/skeleton.cs System.Xml.XPath/Parser.jay System.Xml.XPath/Parser.cs ../../jay/jay: 21 rules never reduced ../../jay/jay: 1 shift/reduce conflict, 42 reduce/reduce conflicts. echo #define XSLT_PATTERN Mono.Xml.Xsl/PatternParser.cs ../../jay/jay -ct Mono.Xml.Xsl/PatternParser.jay ../../jay/skeleton.cs Mono.Xml.Xsl/PatternParser.cs ../../jay/jay: 3 rules never reduced ../../jay/jay: 1 shift/reduce conflict, 46 reduce/reduce conflicts. echo #define XSLT_PATTERN Mono.Xml.Xsl/PatternTokenizer.cs cat System.Xml.XPath/Tokenizer.cs Mono.Xml.Xsl/PatternTokenizer.cs MCS [basic] System.Xml.dll Unhandled Exception: System.TypeInitializationException: An exception was thrown by the type initializer for Mono.CSharp.Location --- System.ArgumentException: Size is too big at System.Collections.Hashtable..ctor (Int32 capacity, Single loadFactor, IHashCodeProvider hcp, IComparer comparer) [0x0] at System.Collections.Hashtable..ctor (Int32 capacity, Single loadFactor) [0x0] at System.Collections.Hashtable..ctor () [0x0] at Mono.CSharp.Location..cctor () [0x0] --- End of inner exception stack trace --- make[8]: *** [../../class/lib/basic/System.Xml.dll] Error 1 make[8]: Leaving directory `/tmp/mono-2.2/mcs/class/System.XML' make[7]: *** [do-all] Error 2 make[7]: Leaving directory `/tmp/mono-2.2/mcs/class/System.XML' ... -- View this message in context: http://www.nabble.com/Mono-2.2-build-problem-on-ARM9-..-tp21768123p21768123.html Sent from the Mono - Dev mailing list archive at Nabble.com. ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
[Mono-dev] SVN Repository layout - is this explained anywhere
Apologies to those who have an intimate understanding of the SVN repository. I have been considering helping with developing mono, but the main inhibition at this stage is to know where to find things, becuase the SVN repository has sooo many folders. I don't know where to start to find what. So I was wondering if anyone can point me to a document/page that explains the purpose of each directory under /trunk, that would basically give me an orientation to the repository layout. Or if such a document doesn't exist, could someone consider making such a document? - I don't expect a huge thing, possibly just a few short words to explain the purpose of each directory, e.g. what is the purpose of DemoLib, what is the purpose of Deveel.Pim, what is the purpose of Dumbarton, etc. On a related issue, is there somewhere an Orientation to helping develop mono page, which gives a brief explanation of how to get involved, because I couldn't find that either. All I could find was http://mono-project.com/Mono_Contribution_HOWTO which doesn't really explain such things as what part(s) of the repository should be checked out to do basic things, or a policy on where things are to be checked-in, etc. Thankyou. -- View this message in context: http://www.nabble.com/SVN-Repository-layout---is-this-explained-anywhere-tp21772957p21772957.html Sent from the Mono - Dev mailing list archive at Nabble.com. ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-dev] SVN Repository layout - is this explained anywhere
On 02/01/2009 01:09 AM, Shane Moore wrote: Apologies to those who have an intimate understanding of the SVN repository. I have been considering helping with developing mono, but the main inhibition at this stage is to know where to find things, becuase the SVN repository has sooo many folders. I don't know where to start to find what. So I was wondering if anyone can point me to a document/page that explains the purpose of each directory under /trunk, that would basically give me an orientation to the repository layout. Or if such a document doesn't exist, could someone consider making such a document? - I don't expect a huge thing, possibly just a few short words to explain the purpose of each directory, e.g. what is the purpose of DemoLib, what is the purpose of Deveel.Pim, what is the purpose of Dumbarton, etc. It's pretty common practice for there to be a README file in each of those areas under trunk. There are probably documents explaining the main Mono modules, but I doubt there's anything that documents EVERY module under trunk (since many of them are just personal experiments, etc). Hopefully somebody else can answer the next part of your question. Sandy ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
[Mono-dev] Generic Variance
This patch adds generic variance support to the C# compiler. This patch does not fully support the spec in that it provides variance only for reference types. This limitation is designed to reflect the current (proposed) level of variance support in the VM. New error codes are defined and tests for each code are provided, as well as tests for variance. This patch is contributed under the MIT/X11 license. It is attached. NOTE: This email is a re-send. The original also had the patch inline, but it was too long for the system. Blarg. Index: tests/ChangeLog === --- tests/ChangeLog (revision 125255) +++ tests/ChangeLog (working copy) @@ -1,3 +1,11 @@ +2009-02-01 Scott Peterson lunchtimem...@gmail.com + + This patch is contributed under the MIT/X11 license. + + * test-variance-1.cs: Added test for generic covariance. + + * test-variance-2.cs: Added test for generic contravariance. + 2009-01-22 Jb Evain jbev...@novell.com * gtest-anontype-05.cs: update according to lastest changes in gmcs Index: tests/test-variance-1.cs === --- tests/test-variance-1.cs (revision 0) +++ tests/test-variance-1.cs (revision 0) @@ -0,0 +1,34 @@ +// Compiler options: -langversion:future + +interface IFooout T +{ + T Bar { get; } +} + +class Foo : IFoostring +{ + readonly string bar; + public Foo (string bar) + { + this.bar = bar; + } + public string Bar { get { return bar; } } +} + +public class Test +{ + static int Main () + { + string bar = Who is John Galt?; + IFoostring foo = new Foo(bar); + IFooobject foo2 = foo; + if (!foo2.Bar.Equals (bar)) + return 1; + + foo2 = new Foo(bar); + if (foo2.Bar != bar) + return 2; + + return 0; + } +} Index: tests/test-variance-2.cs === --- tests/test-variance-2.cs (revision 0) +++ tests/test-variance-2.cs (revision 0) @@ -0,0 +1,33 @@ +// Compiler options: -langversion:future + +interface IFooin T +{ + string Bar (T t); +} + +class Foo : IFooobject +{ + public string Bar (object t) + { + return t.GetType ().FullName; + } +} + +public class Test +{ + static int Main () + { + IFooobject foo = new Foo (); + IFoostring foo2 = foo; + + if (foo2.Bar (blah) != typeof (string).FullName) + return 1; + + foo2 = new Foo(); + if (foo2.Bar (blah) != typeof (string).FullName) + return 2; + + + return 0; + } +} Index: mcs/typemanager.cs === --- mcs/typemanager.cs (revision 125255) +++ mcs/typemanager.cs (working copy) @@ -1787,14 +1787,14 @@ TypeManager.CSharpName (mb.DeclaringType) + . + mb.Name); } - pd = ParametersImported.Create (mb); + pd = ParametersCollection.Create (mb); #else MethodBase generic = TypeManager.DropGenericMethodArguments (mb); if (generic != mb) { pd = TypeManager.GetParameterData (generic); -pd = ParametersImported.Create (pd, mb); +pd = ParametersCollection.Create (pd, mb); } else { -pd = ParametersImported.Create (mb); +pd = ParametersCollection.Create (mb); } #endif method_params.Add (mb, pd); @@ -1807,13 +1807,13 @@ AParametersCollection pd = (AParametersCollection)method_params [pi]; if (pd == null) { if (pi is PropertyBuilder) -return ParametersCompiled.EmptyReadOnlyParameters; +return Parameters.EmptyReadOnlyParameters; ParameterInfo [] p = pi.GetIndexParameters (); if (p == null) -return ParametersCompiled.EmptyReadOnlyParameters; +return Parameters.EmptyReadOnlyParameters; - pd = ParametersImported.Create (p, null); + pd = ParametersCollection.Create (p, null); method_params.Add (pi, pd); } @@ -2135,7 +2135,7 @@ if (interfaces != null){ foreach (Type i in interfaces){ - if (i == iface) + if (i == iface || IsVariantOf (i, iface)) return true; } } @@ -2146,6 +2146,64 @@ return false; } + public static bool HasVariantTypeParameter (Type type, Location loc) + { +#if GMCS_SOURCE + if (type.IsGenericType) { + foreach (Type t in type.GetGenericArguments ()) { +if (t.IsGenericParameter) { + if ((t.GenericParameterAttributes GenericParameterAttributes.Contravariant) != 0) { + Report.Error (-34, loc, Contravariant type parameters can only be used + + as input arguments to a method); + return true; + } + if ((t.GenericParameterAttributes GenericParameterAttributes.Covariant) != 0) { + Report.Error (-35, loc, Covariant type parameters can only be used as return types + + or in interface inheritance); + return true; + } +} else if (HasVariantTypeParameter (t, loc)) { + return true; +} + } + } +#endif + return false; + } + + public static bool IsVariantOf (Type type1, Type type2) + { +#if GMCS_SOURCE + if (type1.IsGenericType type2.IsGenericType) { +
Re: [Mono-dev] Mono and IBM
Am 30.01.2009 um 23:57 schrieb Steven Munroe: There might be a mono port for AIX, which might run in the PASE environment, but i don't know the status of that. Some folks recently tried a new port to AIX/ppc64. They gave up last week because, supposedly, Mono relies on an undefined behaviour of NULL dereferencing. Don't know details though. Andreas ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-dev] SVN Repository layout - is this explained anywhere
Shane Moore wrote: Apologies to those who have an intimate understanding of the SVN repository. I have been considering helping with developing mono, but the main inhibition at this stage is to know where to find things, becuase the SVN repository has sooo many folders. I don't know where to start to find what. So I was wondering if anyone can point me to a document/page that explains the purpose of each directory under /trunk, that would basically give me an orientation to the repository layout. Or if such a document doesn't exist, could someone consider making such a document? - I don't expect a huge thing, possibly just a few short words to explain the purpose of each directory, e.g. what is the purpose of DemoLib, what is the purpose of Deveel.Pim, what is the purpose of Dumbarton, etc. If you want to contribute to mono, only 2-4 projects are relevant: http://mono-project.com/Compiling_Mono_From_SVN The incubator of .NET 3.x features (not mentioned on this wiki page) is called olive. Note that, IIRC, the repository protocol has changed from http to svn, so the links mentioned on the wiki page must start with svn://. Robert ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-dev] Running Asp.net Applications on Mono
Mono on Linux or Windows? For linux it is not possible. Try this new site called google.com - type these words asp.net mono and press search. On Tue, Jan 20, 2009 at 12:44 AM, harishr hari...@hcl.in wrote: I have to perform the following tasks using Mono 2.2. 1.Running unManaged COM component with Mono 2.Running an asp.net portal on Mono Just help me with some links and code.This is very urgent. Harish. -- View this message in context: http://www.nabble.com/Running-Asp.net-Applications-on-Mono-tp21557934p21557934.html Sent from the Mono - Dev mailing list archive at Nabble.com. ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list -- Timothy B. Smith Venturality, Inc. 847-420-2378 (Direct/Mobile) 888-317-9338 (Toll Free) web: http://www.venturality.com blog: http://ramblingentrepreneur.blogspot.com linkedin: http://www.linkedin.com/in/timbsmith1971 **Please consider the environment before printing this email.** ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-dev] Mono 2.2 build problem on ARM9 ..
This has been fixed on trunk and on the 2.4 branch. Just apply r125205 to mono 2.2 and it should work. On Sat, Jan 31, 2009 at 6:50 PM, clva5x clv...@yahoo.com wrote: Hello All.. I am trying to build mono 2.2 on an ARM9 Linux Debian platform and I am getting the exception below. I have previously built versions 2.0 and 2.0.1 just fine on this board. I have found some references to this problem and I checked the proposed patches.. they seem to be in the mono 2.2 code base. Those patches have to do with the floating point code generator. I tried ./configure --with-fpu=NONE but it did not make any difference. Thank you for any info.. Cris.. Here is the exception (and a bit of make context..) . make[7]: Entering directory `/tmp/mono-2.2/mcs/class/System.XML' make all-local make[8]: Entering directory `/tmp/mono-2.2/mcs/class/System.XML' ../../jay/jay -ct ../../jay/skeleton.cs System.Xml.XPath/Parser.jay System.Xml.XPath/Parser.cs ../../jay/jay: 21 rules never reduced ../../jay/jay: 1 shift/reduce conflict, 42 reduce/reduce conflicts. echo #define XSLT_PATTERN Mono.Xml.Xsl/PatternParser.cs ../../jay/jay -ct Mono.Xml.Xsl/PatternParser.jay ../../jay/skeleton.cs Mono.Xml.Xsl/PatternParser.cs ../../jay/jay: 3 rules never reduced ../../jay/jay: 1 shift/reduce conflict, 46 reduce/reduce conflicts. echo #define XSLT_PATTERN Mono.Xml.Xsl/PatternTokenizer.cs cat System.Xml.XPath/Tokenizer.cs Mono.Xml.Xsl/PatternTokenizer.cs MCS [basic] System.Xml.dll Unhandled Exception: System.TypeInitializationException: An exception was thrown by the type initializer for Mono.CSharp.Location --- System.ArgumentException: Size is too big at System.Collections.Hashtable..ctor (Int32 capacity, Single loadFactor, IHashCodeProvider hcp, IComparer comparer) [0x0] at System.Collections.Hashtable..ctor (Int32 capacity, Single loadFactor) [0x0] at System.Collections.Hashtable..ctor () [0x0] at Mono.CSharp.Location..cctor () [0x0] --- End of inner exception stack trace --- make[8]: *** [../../class/lib/basic/System.Xml.dll] Error 1 make[8]: Leaving directory `/tmp/mono-2.2/mcs/class/System.XML' make[7]: *** [do-all] Error 2 make[7]: Leaving directory `/tmp/mono-2.2/mcs/class/System.XML' ... -- View this message in context: http://www.nabble.com/Mono-2.2-build-problem-on-ARM9-..-tp21768123p21768123.html Sent from the Mono - Dev mailing list archive at Nabble.com. ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-dev] high precision real cpu time in MONO (on linux)
You can use P/Invoke to call those functions. On Sat, Jan 31, 2009 at 5:06 PM, Basile Starynkevitch bas...@starynkevitch.net wrote: Hello All, I am a newbie to Mono and to C# ; I am using only Debian/Sid/AMD64 on a recent linux 2.6.29-rc3 kernel (with CONFIG_HIGH_RES_TIMERS CONFIG_HZ=1000) , mono 2.2 I am searching for a way to measure real clock and cpu time with high precision. The linux system call is clock_gettime. Apparently mono has some way to get it, since mono-2.2 contains the file mono/utils/mono-time.[ch] with functions gint64 mono_100ns_ticks(void) MONO_INTERNAL; gint64 mono_100ns_datetime (void) MONO_INTERNAL; I blindly guess that MONO_INTERNAL would mean that these functions are not accessible from C# 3.0 code. What is the easiest way to get high precision (at least high resolution) time on Linux? Ideally I would like to get CLOCK_REALTIME or CLOCK_MONOTONIC and CLOCK_THREAD_CPUTIME_ID. But any way of measuring milliseconds real cpu (preferably thread) time is ok. Any clues? Thanks. -- Basile Starynkevitch http://starynkevitch.net/Basile/ -- View this message in context: http://www.nabble.com/high-precision-real---cpu-time-in-MONO-%28on-linux%29-tp21767078p21767078.html Sent from the Mono - Dev mailing list archive at Nabble.com. ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-dev] Help on deploying library to gac using autotools
On Fri, 2009-01-23 at 17:38 -0800, amrhassan wrote: Hi, I'm not an autotools expert. I just want to create a package to distribute my lib into GAC. I signed my library and everything, I created the Makefiles using the addin from MonoDevelop but I don't know how to get it to install the lib into GAC instead of PREFIX/lib. Can someone please help me with that? The way this is usually done is by building the assembly as a noinst_DATA target and adding something like: install-data-local: $(GACUTIL) /i $(ASSEMBLY) /f || exit 1; uninstall-local: $(GACUTIL) /u $(ASSEMBLY_NAME) /f || exit 1; ASSEMBLY_NAME is the name of your assembly without the .dll extension. ASSEMBLY includes the .dll. GACUTIL is setup in configure.in as: AC_PATH_PROG(GACUTIL, gacutil, no) if test x$GACUTIL = xno ; then AC_MSG_ERROR([No gacutil tool found. You need to install either the mono or .Net SDK.]) fi AC_SUBST(GACUTIL) -- Mike Kestner mkest...@gmail.com ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-dev] Mono and IBM
Thanks to all of you for the help that you guys gave me. i think I'll stay with C/C++ to be safe and avoid problems that I'll cannot control. Anyway I'll still looking around, reading and waiting for mono to be ready for my purposes. Best regards. CarlosRD On Sun, Feb 1, 2009 at 1:39 PM, Andreas Färber andreas.faer...@web.dewrote: Am 30.01.2009 um 23:57 schrieb Steven Munroe: There might be a mono port for AIX, which might run in the PASE environment, but i don't know the status of that. Some folks recently tried a new port to AIX/ppc64. They gave up last week because, supposedly, Mono relies on an undefined behaviour of NULL dereferencing. Don't know details though. Andreas ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-dev] Announcing Mono 2.4 Preview 1...
Thomas Wiest wrote: Hey Everyone, We've just released Mono 2.4 Preview 1 today! Please help us out by giving it a try with your applications. As always, you can get the preview/RC releases here: http://mono.ximian.com/monobuild/preview/download-preview/ Please report any bugs that you may find using our Bugs page, AND reply to this thread with the bug numbers so we can track them: http://www.mono-project.com/Bugs Please also add Bug 471389 - mono will fail with stack sizes less then 1MB on systems with 64KB pages ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list