[Mono-list] where to put package-config files
I just installed log4net.dll via gacutil. The DLL is now in /Library/Frameworks/Mono.framework/Versions/2.10.9/lib/mono/gac/log4net/1.2.11.0__669e0ddf0bb1aa2a/log4net.dll. Where should I put its corresponding log4net.pc file? ___ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list
Re: [Mono-list] Registry help
This is the only file in my ~/.mono/registry directory. ~/.mono/registry/CurrentUser/software/classes/code/shell/open/command/values.xmlHave you tried creating a trivial program to write to HKEY_CURRENT_USER? Does this trivial program work on other platforms? C_W October 25, 2012 2:22 AMHi all,I am porting a Windows program to run on the Raspberry Pi, but unfortunatelyit uses the registry a lot.I know Mono emulates the registry using a file structure in/etc/mono/registry, as well as .mono/registry in the user's home directoryfor user keys, and am trying to find what to replace "HKEY_CURRENT_USER" etcwith, as all I get is a crash report saying it doesn't start with a validregistry root.I have tried "CurrentUser", "~/.mono/registry/CurrentUser", and variousother combos, as well as converting to lower case. I still get the invalidregistry root error message.What do I need to replace HKEY_CURRENT_USER and HKEY_CLASSES_ROOT etc withto get it to pick up data from the registry folders?ThanksChris--View this message in context: http://mono.1490590.n4.nabble.com/Registry-help-tp4657109.htmlSent from the Mono - General mailing list archive at Nabble.com.___Mono-list maillist - Mono-list@lists.ximian.comhttp://lists.ximian.com/mailman/listinfo/mono-list ___ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list
[Mono-list] System.Diagnostics.Debug.Assert()
Debug builds of my Mono command line application blow right by all Debug.Assert statements, even the ones I know fail the assertion. Heck, even Debug.Assert(false, Foo) gets ignored. Neither running standalone on the command line via Terminal.app nor running in MonoDevelop's debugger makes a difference; the asserts are always ignored. I've checked, double-checked, and even triple checked that I am created Debug builds. Is there any way to force Mono to honor the asserts? -SteveL p.s. I'm running Mono 2.10.6 and MonoDevelop 2.8.1 on OS X 10.5.7 ___ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list
Re: [Mono-list] csharp REPL
It seems there is an additional obstacle to overcome before I could even try to get command line arguments from Environment.CommandLine. $csharp foo bar cs2001: Source file `/source/local/private/main/developer/slessard/tools/foo' not found $csharp -foo -bar error CS2007: Unrecognized command-line option: `-foo' The problem is that csharp.exe complains because it doesn't recognize the arguments that are intended for my script. I need a way to pass in arguments to my script in a way that won't cause csharp.exe to complain about files not found or unrecognized command-line options. The only solution I have been able to find is to prefix each of my script's command-line arguments with -d: (without the quotes) but that would require the script to have additional code to find and strip out the -d: portion of each argument (see output below.) Is there any other trick that might work? I know very, very little about how the shebang works. Would it be possible to leverage the shebang in some crafty way? Would it be possible to get the shebang to convert the command line arguments into local environment variables named ARG1, ARG2, ..., ARGn? The is the output I get from my script after adding code to write to stout all of the process's command line arguments: $./timefromseconds -d:foo -d:bar Environment.GetCommandLineArgs()[0] : '/Library/Frameworks/Mono.framework/Versions/2.10.2/lib/mono/4.0/csharp.exe' Environment.GetCommandLineArgs()[1] : '-lib:$PWD' Environment.GetCommandLineArgs()[2] : './timefromseconds' Environment.GetCommandLineArgs()[3] : '-d:foo' Environment.GetCommandLineArgs()[4] : '-d:bar' Current Time (Total Seconds): 1309369313.60381 Current Local Time: 6/29/2011 9:41:53 AM Current UTC Time: 6/29/2011 4:41:53 PM And here's my new script code: #!/usr/bin/env csharp -lib:$PWD int counter = 0; foreach (string arg in Environment.GetCommandLineArgs()) Console.WriteLine(Environment.GetCommandLineArgs()[{0}] : '{1}', counter++, arg); // Initialize the epoch // The epoch is 12:00:00 AM UTC, January 1, 1970 DateTime epoch = new DateTime().AddYears(1969).AddHours(-8); TimeSpan nowDiff = (DateTime.Now - epoch); System.Console.WriteLine(Current Time (Total Seconds): + nowDiff.TotalSeconds); System.Console.WriteLine(Current Local Time: + epoch.AddSeconds(nowDiff.TotalSeconds).ToString()); System.Console.WriteLine(Current UTC Time: + epoch.AddSeconds(nowDiff.TotalSeconds).ToUniversalTime().ToString()); On Tue, 28 Jun 2011 20:19:32 +0200, Alex wrote: Hi, Arguments should be stored in Environment.CommandLine. Regards, Alex On Tue, Jun 28, 2011 at 7:58 PM, Ian Norton ian.norton-bad...@thales-esecurity.com wrote: Try looking at Mono.Options (aka NDesk.Options) That works quite well for me. Oh.. You don't have a main in repl that gets argv... Are the command line arguments stored in the environment somewhere? Ian On 28 Jun 2011, at 18:59, Steve Lessard s_less...@yahoo.com wrote: Hi, I'm trying to write a shell script in C# using the csharp REPL. The script below works fine as is on OS X, but I would like to pass an argument into this script. I haven't been able to find any docs on how to do this and all of my experiments have turned up nothing. Is there a way to pass an argument into the csharp REPL? I'm running Mono version 2.10.2 with Mono C# compiler version 4.0.0.0 -SteveL #!/usr/bin/env csharp -lib:$PWD // Initialize the epoch // The epoch is 12:00:00 AM UTC, January 1, 1970 DateTime epoch = new DateTime().AddYears(1969).AddHours(-8); TimeSpan nowDiff = (DateTime.Now - epoch); System.Console.WriteLine(Current Time (Total Seconds): + nowDiff.TotalSeconds); System.Console.WriteLine(Current Local Time: + epoch.AddSeconds(nowDiff.TotalSeconds).ToString()); System.Console.WriteLine(Current UTC Time: + epoch.AddSeconds(nowDiff.TotalSeconds).ToUniversalTime().ToString()); ___ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list ___ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list ___ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list
[Mono-list] csharp REPL
Hi, I'm trying to write a shell script in C# using the csharp REPL. The script below works fine as is on OS X, but I would like to pass an argument into this script. I haven't been able to find any docs on how to do this and all of my experiments have turned up nothing. Is there a way to pass an argument into the csharp REPL? I'm running Mono version 2.10.2 with Mono C# compiler version 4.0.0.0 -SteveL #!/usr/bin/env csharp -lib:$PWD // Initialize the epoch // The epoch is 12:00:00 AM UTC, January 1, 1970 DateTime epoch = new DateTime().AddYears(1969).AddHours(-8); TimeSpan nowDiff = (DateTime.Now - epoch); System.Console.WriteLine(Current Time (Total Seconds): + nowDiff.TotalSeconds); System.Console.WriteLine(Current Local Time: + epoch.AddSeconds(nowDiff.TotalSeconds).ToString()); System.Console.WriteLine(Current UTC Time: + epoch.AddSeconds(nowDiff.TotalSeconds).ToUniversalTime().ToString()); ___ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list
Re: [Mono-list] Aquire Root Privileges
Calling POSIX functions like setuid and setgid will never result in OS X popping up the authorization dialog because OS X's Authorization Services is not part of POSIX. To get that auth dialog you need to call Authorization Services APIs. If you don't want to or don't have time to learn those APIs here's something that might still do what you want... http://www.performantdesign.com/2009/10/26/cocoasudo-a-graphical-cocoa-based-alternative-to-sudo/ -SteveL -SteveL On Jun 16, 2011, at 1:48 AM, Robert Jordan robe...@gmx.net wrote: On 16.06.2011 00:40, Enqueue wrote: I expected some kind of Mono wants to access administrator privileges-Popup of the keychain but nothing happened. I would still need Did you actually read the man pages of the functions you're invoking? Hint: they don't state that a popup will appear out of nowhere to steal root passwords ;) to do some chown and chmod stuff (chown root.root, chmod +s) to allow the application accessing root privileges and therefore I still have the same problem. How do all those installers solve this problem? See the generic xdg-su that uses to invoke gksu for Gnome, kdesu for KDE, etc. Robert ___ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list ___ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list
Re: [Mono-list] Trouble building with Microsoft dlls
In the output of pedump for that assembly what is in the Metadata header section? Is it Version string: v2.0.50727 or Version string: v4.0.30319? If it's the latter then you'll need to either upgrade your version of Mono or downgrade your version of System.Web.Extensions.dll. From: doal doal.mil...@mir3.com To: mono-list@lists.ximian.com Sent: Wednesday, May 25, 2011 10:32 AM Subject: Re: [Mono-list] Trouble building with Microsoft dlls The 3 dlls that I'm trying to build with (Microsoft.Exchange.Data.Common.dll lib/Microsoft.Exchange.Data.Transport.dll lib/System.Web.Extensions.dll) have the following flags according to pedump: Flags: ilonly, 32/64, trackdebug, strongnamesigned The ilonly flag means it is pure MSIL and the 32/64 means it is platform independent so sounds to me like it should work. It tuns out the only one that is causing a problem is System.Web.Extensions.dll. That is the one in the error message and if I remove it (I'm only using it to do some JSON serialization and deserialization) then I can build. However, I really want to use it. -- View this message in context: http://mono.1490590.n4.nabble.com/Trouble-building-with-Microsoft-dlls-tp3548648p3550457.html Sent from the Mono - General mailing list archive at Nabble.com. ___ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list___ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list
Re: [Mono-list] Trouble building with Microsoft dlls
Are those Microsoft assemblies 64-bit or mixed-mode? This blog might explain the problem. http://blogs.msdn.com/b/slessard/archive/2010/04/09/types-of-managed-code-assemblies.aspx -SteveL On May 24, 2011, at 5:49 PM, doal doal.mil...@mir3.com wrote: I'm new to Mono so this is probably something simple or maybe I'm misunderstanding what can be done. I'm developing on Linux in Java but we just had a requirement to interface with MS Exchange Server so we wrote a Transport Agent in C#. That agent gets plugged into Exchange so it is obviously going to be run on Windows using .NET. However since our entire product builds under ant on Linux we wanted to build the Agent there also and then install it and run it on Windows, Exchange Server. My first assumption is that this is possible. I read up on NAnt and Mono and got a build of a trivial C# program working. I then tried to build my Agent which uses the Microsoft dlls like Microsoft.Exchange.Data.Common.dll, Microsoft.Exchange.Data.Transport.dll, and a few others. When I look at their file types on Linux it says: lib/Microsoft.Exchange.Data.Transport.dll: PE32 executable for MS Windows (DLL) (console) Intel 80386 32-bit Mono/.Net assembly So they seem to be .NET assembly files which is what Mono wants, right? Yet when I try and build and I point the build to the dlls with the following in my default.build file: references include name=lib/*.dll / /references I get a these errors like this: [csc] Compiling 2 files to '/home/doal/workspace-sts-2.6.0.RELEASE/Cure/ms-exchange/CureTransportAgent/bin/CureTransportAgent.dll'. [csc] ** (/usr/lib/mono/2.0/gmcs.exe:10018): WARNING **: The class System.Web.Management.WebRequestErrorEvent could not be loaded, used in System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a [csc] ** (/usr/lib/mono/2.0/gmcs.exe:10018): WARNING **: The class System.Web.UI.IUpdatePanel could not be loaded, used in System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a [csc] Unhandled Exception: System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded. [csc] at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (bool) [csc] at System.Reflection.Assembly.GetTypes () [0x0] [csc] at Mono.CSharp.RootNamespace.ComputeNamespaces (System.Reflection.Assembly assembly) [0x0] [csc] at Mono.CSharp.RootNamespace.ComputeNamespaces () [0x0] [csc] at Mono.CSharp.Driver.LoadReferences () [0x0] [csc] at Mono.CSharp.Driver.Compile () [0x0] [csc] at Mono.CSharp.Driver.Main (System.String[] args) [0x0] BUILD FAILED - 0 non-fatal error(s), 10 warning(s) /home/doal/workspace-sts-2.6.0.RELEASE/Cure/ms-exchange/CureTransportAgent/default.build(14,10): External Program Failed: /usr/lib/mono/2.0/gmcs.exe (return code was 1) So, shouldn't I be able to build this? I saw one post saying to use the apt-get version of nant but that's what I'm using. Any help would be greatly appreciated. Thanks -- View this message in context: http://mono.1490590.n4.nabble.com/Trouble-building-with-Microsoft-dlls-tp3548648p3548648.html Sent from the Mono - General mailing list archive at Nabble.com. ___ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list ___ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list
Re: [Mono-list] Reflector alternative
Yes I would like to get a copy of Reflector 6.7.0.3. Could you please share it? From: Ivan Zlatev i...@ivanz.com To: mono-list@lists.ximian.com Sent: Saturday, May 21, 2011 10:50 AM Subject: Re: [Mono-list] Reflector alternative I have Reflector 6.7.0.3 which doesn't seem to forcefully auto-update. I can put it online if someone wants it. Also you could always utilize a firewall to block Reflector from accessing teh internetz! Kind Regards, Ivan Zlatev http://ivanz.com LinkedIn: http://linkedin.com/in/ivanzlatev Twitter: http://twitter.com/ivanzlatev On Sat, May 21, 2011 at 3:26 AM, Abe Gillespie abe.gilles...@gmail.com wrote: Man am I irked by Redgate! Reflector checks for updates every time it runs and there's no way to turn it off. I was annoyed after ignoring it a dozen times and updated. Lo and behold I no longer have decompilation. Shady. On Fri, May 20, 2011 at 9:50 PM, Federico Delgado flaker.kap...@gmail.com wrote: sure. No problem: fd@host:~/decomp/dotPeek$ mono dotPeek.exe WARNING: The runtime version supported by this application is unavailable. Using default runtime: v1.1.4322 The assembly mscorlib.dll was not found or could not be loaded. I haven't tried but I am almost sure it is because Ubuntu's Mono version is 2.6. So if you have included any Net 4 in it, it is going to fail (Mono 2.8 was the first with some NET 4 support in it, right?) Thanks, Federico On Fri, May 20, 2011 at 10:05 PM, Alex xtzgzo...@gmail.com wrote: Hi, For what it's worth. ICSharpCode.Decompiler does run under Mono (and uses Mono.Cecil) - we use it in SL#. I don't know about the UI though. Could you give some more information on the failed run? Regards, Alex 2011/5/21 Federico Delgado flaker.kap...@gmail.com: very (very) quick test. - Jetbrains product seem to use wpf (from the zip content) - Telerik's provides an MSI. Trying to install it with Wine fails while checking for the presence of framework 4.0 - ILSpy didn't run but that might be my runtime version (fresh installed ubuntu 11.04) On Fri, May 20, 2011 at 8:40 PM, Federico Delgado flaker.kap...@gmail.com wrote: Telerik is also offering one. http://www.telerik.com/products/decompiling.aspx but I haven't tried it yet. In fact I don't know how or if any of those work with mono assemblies or under Linux. On Fri, May 20, 2011 at 8:25 PM, Alex xtzgzo...@gmail.com wrote: Hi, There are these: http://wiki.sharpdevelop.net/ilspy.ashx http://www.jetbrains.com/decompiler/ Regards, Alex 2011/5/21 dedi mdedirudia...@gmail.com: Hi guys, Just want to know, is there any alternative to RedGate's Reflector or maybe similiar with that? I'm not sure if there is a gui based running on Linux. Thanks, Dedi ___ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list ___ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list ___ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list ___ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list ___ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list___ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list
Re: [Mono-list] Can someone analyze this code and tell me what happens
My initial guess without the info requested by Alex is that the exception thrown has something to do with not being able to serialize your dataStruct instance. In that case the likely cause of the problem is that the dataStruct class is not decorated with the [Serializable] attribute. -SteveL On Apr 5, 2011, at 12:28 PM, Alex xtzgzo...@gmail.com wrote: Hi, You could help us help you by telling us what exception you're getting. A self-contained test case also helps (the more you can reduce the amount of code, the better). Regards, Alex 2011/4/4 Leonel Florin Selles leonel06...@cfg.jovenclub.cu: I have created two applications that connect on the same machine and sent an object, I used Socket to connect, but when the client sends data to the server, and the server revived the data and try to Deserialize is when it get me out with one exception. here is the client and server, the object that they use to communicate and the class to serialize and deserialize dataStruct - using System; namespace server { public class dataStruct { public dataStruct () { } public String clientName; public Int32 clientPid; public String host; public String bd; public String user; public String pass; public String usersCheck; public Boolean systemTryIcon; public String adminpass; public enum signals { ConfFileExist, ConfFileEmpty, SocketServerNoStart, ClientMalCerrado, ClientBienCerrado, TmServiceExist, TmServiseNoExist, CerrarSesion, SendMeConfData, SaveThisConfData, ApagerEquipo, ReiniciarEquipo, ObjetoBdNoInicia, BindToSocketBrouk, ConectarBdImposible, SocketNoListen, ConsultaFallo, ConsultaOK, ExtractConsultaFallo, ExtractConsultaOk, PCNoExiste } public signals orden; } } -- Serialice - using System; using System.Runtime.Serialization.Formatters.Binary; using System.IO; namespace server { public class serializacion { public serializacion () { } public static byte[] Serialize (Object objeto) { BinaryFormatter formater = new BinaryFormatter (); MemoryStream mem = new MemoryStream (); formater.Serialize (mem, objeto); return mem.GetBuffer (); } public static System.Object DeSerialize (byte[] listaByte) { BinaryFormatter formater = new BinaryFormatter (); MemoryStream mem = new MemoryStream (); mem.Write (listaByte, 0, listaByte.Length); mem.Seek (0, 0); return formater.Deserialize (mem); } } } client using System; using System.Text; using System.IO; using System.Net.Sockets; namespace cliente { class MainClass { public static void Main (string[] args) { byte[] sendData; byte[] recvData; Socket clientSocket = new Socket (AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.IP); clientSocket.Connect (localhost, 4069); dataStruct structura = new dataStruct (); structura.clientName = Pepe; structura.clientPid = 1234; structura.host = localhost; structura.bd = Tmaquina; structura.user = TmaquinaLoco; structura.pass = EstoNoCuadra; structura.usersCheck = estudiante,florin; structura.systemTryIcon = true; structura.adminpass = pepeloco; structura.orden = dataStruct.signals.ApagerEquipo; sendData = serializacion.Serialize
Re: [Mono-dev] Faster
I think Sebastian already touched on this issue, but I wanted to shine a little more light on it. If the Something class were defined as below and x was not null wouldn't the Foo method throw an exception incorrectly stating that x was null? class Something { public Something() { } public void DoSomething() { throw new NullReferenceException(); } } void Foo (Something x) { try { x.DoSomething (); } catch (NullReferenceException e){ if (x == null) throw new ArgumentNullException (x); else throw; } x.AndThenMore (); } -- View this message in context: http://mono.1490590.n4.nabble.com/Faster-tp3402943p3404445.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] Launchctl and Mono-Service2 issue
Have a look at the man pages for launchctl and launchd. In there you will find a few very important details about what is required to enable a daemon to launch at system restart. Here's a short version based on my recollection: A daemon loads at system boot, An agent loads at user login The plist file for any daemon or agent under /Library must be owned by root and must not be writable by anyone other than root. (This is a security restriction.) It's best to add keys to the plist to have it run under a lower privileged user account -- View this message in context: http://mono.1490590.n4.nabble.com/Launchctl-and-Mono-Service2-issue-tp3386856p3387292.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-list] compiler errors in XMLDoc
I have a fairly large Visual Studio project that compiles cleanly on .NET. I took this project and built it on Mono 2.10.1 with xbuild. Among the many compilation issues I encountered there were a few real surprises. There were two cases where the compiler said I had XMLDoc on an invalid item, but I disagree and so does the .NET compiler. In one case the XMLDoc comment was on a public enum. Since I couldn't figure out what the problem was I enclosed the XMLDoc comment in a /* ... */ block comment. Another issue was on a private static string property getter. I worked sround that problem by changing the three slashes to two slashes. The most surprising issue of all was that anywhere there was a comment like the one below the compiler report an error saying I had an XMLDoc comment on an invalid item. // /* Check for all pre-conditions */ // The workaround in this case was to change the comment to /* ** */ /* Check for all pre-conditions */ /* ** */ The comment doesn't start with three slashes. Why does the compiler think that's an XMLDoc comment? ___ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list
Re: [Mono-list] csharp REPL scripts
Yes, both Miguel's solution and Ian's solution work. I pretty much understand why Miguel's solution works. As for Ian's solution I read the man page for env but it's not clear as to what env does that makes Ian's solution work. Would you care to share a short explanation? From: Ian Norton ian.norton-bad...@thales-esecurity.com To: Miguel de Icaza mig...@novell.com Cc: Steve Lessard s_less...@yahoo.com; Mono Mono-list@lists.ximian.com Sent: Fri, March 4, 2011 10:44:28 PM Subject: Re: [Mono-list] csharp REPL scripts Would #!/usr/bin/env csharp Work? Ian On 5 Mar 2011, at 01:29, Miguel de Icaza mig...@novell.com wrote: Hello, Seems to be a problem with the way OSX launches the program, try this instead for the first line: #!/usr/bin/mono /Library/Frameworks/Mono.framework/Versions/Current/lib/mono/4.0/ csharp.exe On Thu, Mar 3, 2011 at 1:10 PM, Steve Lessard s_less...@yahoo.com wrote: I read in the release notes for Mono 2.10 (http://www.mono-project.com/Release_Notes_Mono_2.10) that the C# REPL now can be used as a program to run C# scripts in Unix. Your Unix scripts can now contain as their first line the #!/usr/bin/csharp line which allows you to create C# scripts that can be treated like programs. The release notes give this very simple demo: $ echo '#!/usr/bin/csharp' demo $ echo 'System.Console.WriteLine (10+2);' demo $ chmod +x demo $ ./demo 12 $ So I tried it on my machine running 2.10.1, but it always fails with a syntax error. (See below.) Is anyone else able to run this simple demo of the C# REPL? tools$ echo '#!/usr/bin/csharp' demo tools$ echo 'System.Console.WriteLine (10+2);' demo tools$ chmod +x demo tools$ ./demo ./demo: line 2: syntax error near unexpected token `10+2' ./demo: line 2: `System.Console.WriteLine (10+2);' tools$ -SteveL $ uname -a Darwin applejacks 10.6.0 Darwin Kernel Version 10.6.0: Wed Nov 10 18:13:17 PST 2010; root:xnu-1504.9.26~3/RELEASE_I386 i386 $ mono --version Mono JIT compiler version 2.10.1 (tarball Fri Feb 25 15:56:49 MST 2011) Copyright (C) 2002-2011 Novell, Inc and Contributors. www.mono-project.com TLS: normal SIGSEGV: normal Notification: Thread + polling Architecture: x86 Disabled: none Misc: debugger softdebug LLVM: yes(2.9svn-mono) GC:Included Boehm (with typed GC) $ /usr/bin/csharp --version Mono C# compiler version 4.0.0.0 ___ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list ___ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list ___ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list
[Mono-list] csharp REPL scripts
I read in the release notes for Mono 2.10 (http://www.mono-project.com/Release_Notes_Mono_2.10) that the C# REPL now can be used as a program to run C# scripts in Unix. Your Unix scripts can now contain as their first line the #!/usr/bin/csharp line which allows you to create C# scripts that can be treated like programs. The release notes give this very simple demo: $ echo '#!/usr/bin/csharp' demo $ echo 'System.Console.WriteLine (10+2);' demo $ chmod +x demo $ ./demo 12 $ So I tried it on my machine running 2.10.1, but it always fails with a syntax error. (See below.) Is anyone else able to run this simple demo of the C# REPL? tools$ echo '#!/usr/bin/csharp' demo tools$ echo 'System.Console.WriteLine (10+2);' demo tools$ chmod +x demo tools$ ./demo ./demo: line 2: syntax error near unexpected token `10+2' ./demo: line 2: `System.Console.WriteLine (10+2);' tools$ -SteveL $ uname -a Darwin applejacks 10.6.0 Darwin Kernel Version 10.6.0: Wed Nov 10 18:13:17 PST 2010; root:xnu-1504.9.26~3/RELEASE_I386 i386 $ mono --version Mono JIT compiler version 2.10.1 (tarball Fri Feb 25 15:56:49 MST 2011) Copyright (C) 2002-2011 Novell, Inc and Contributors. www.mono-project.com TLS: normal SIGSEGV: normal Notification: Thread + polling Architecture: x86 Disabled: none Misc: debugger softdebug LLVM: yes(2.9svn-mono) GC:Included Boehm (with typed GC) $ /usr/bin/csharp --version Mono C# compiler version 4.0.0.0 ___ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list
Re: [Mono-list] Mono.Addins: Add-ins registered in the global registry must have a namespace.
Could namespace mean the same type of namespace in the XML manifest file for MonoDevelop addins? If so take a look at the MonoDevelop site. There you'll find a link to a very basic MonoDevelop addin project and short tutorial. The tutorial explains the namespace thing quite well. -SteveL On Feb 19, 2011, at 10:34 AM, Nils Andresen n...@nils-andresen.de wrote: Hi, I posted on the Mono.Addin list, but there's only silence there - so I am trying my luck here... I am trying to use Mono.Addin but getting the following error: ERROR: Add-ins registered in the global registry must have a namespace. I can not find anything in the docs. Can someone please hint to what I am doing wrong? Yours, Nils ___ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list ___ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list
Re: [Mono-list] Problem connecting to a secure site via a NTLM authenticating proxy
You should try isolating the problem by removing .NET and Mono altogether. Try using curl to make the same connection. Curl has support for all types of proxy servers as well as good debugging capabilities. Using curl may help you gain more insight into how connections through the proxy work. -SteveL On Feb 14, 2011, at 6:12 AM, Andrew Bryson abry...@rm.com wrote: Hi all, We've had a problem within our software for a while that our client on Mac (OS X 10.5-106, Mono 2.6) has not been able to connect to websites which require HTTPS when connecting through a NTLM authentication proxy (Microsoft ISA 2006). In trying to get to the bottom of this I've discovered: - This is a problem with Mono 2.6 and 2.8(.2). - NTLM authentication works through the ISA proxy when the target site uses plain HTTP. We must connect securely via HTTPS. - The same problem happens on Windows when I execute my C# .NET 2.0 app directly (i.e. not launching it with 'mono'). I have put together a small application to allow me to test this issue. When calling HttpWebRequest.GetResponse() the following exception occurs: http://pastie.org/1562663. I've tried playing around with the HttpWebRequest.PreAuthenticate property, and associating the credentials with the HttpWebRequest.Credentials object (but the website does not require auth, only the proxy). The same binary executed on Windows works. I realy hope that somebody is able to help me out in either fixing the problem, or confirming that it's a known issue in the current Mono framework. Here's the test application: http://pastie.org/1562659. Thanks, andy -- View this message in context: http://mono.1490590.n4.nabble.com/Problem-connecting-to-a-secure-site-via-a-NTLM-authenticating-proxy-tp3305051p3305051.html Sent from the Mono - General mailing list archive at Nabble.com. ___ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list ___ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list
[Mono-list] Working with symbolic links
I've written a custom tool for searching for files in the system's PATH. I use this tool on both Windows and OS X. On OS X the tool recognizes symbolic link files and does a little extra processing on them thanks to Mono's UnixSymbolicLinkFileInfo class and Syscall.lstat. I'd like to have similar functionality on Windows. Is there any equivalent of these classes/methods on Windows? To broaden the question a bit... The Mono.Posix.dll assembly is awesome because it provides managed code that exposes a lot of the OS functions that aren't available in standard .NET. Is there an analogous assembly for Windows? Maybe a Mono.Windows.dll assembly? -SteveL ___ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list
Re: [Mono-list] Socket Creation in Mono
This guide will tell you all about what happens at the OS level. http://beej.us/guide/bgnet/ -SteveL On Feb 5, 2011, at 9:27 AM, liambresnahan liambresna...@hotmail.com wrote: I am looking for some information on how Mono creates a socket and what happens in OS level functions when sockets are created. I have searched around but cannot find anything within documentation, I may be looking in the wrong places but is there any documentation on this or is someone able to help answer my question? -- View this message in context: http://mono.1490590.n4.nabble.com/Socket-Creation-in-Mono-tp3262052p3262052.html Sent from the Mono - General mailing list archive at Nabble.com. ___ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list ___ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list
Re: [Mono-list] Automatic build using mdrun (mdtool)
Do you see this same problem when using XBuild to build the project? -SteveL On Feb 6, 2011, at 12:51 AM, fujiyama fujiy...@tlen.pl wrote: Hi, I have problems to compile solutions using Mono/MonoDevelop on Windows. I'm trying to execute: mdrun.exe build -p MySolution.sln -c:Mono Solution and project is in VS2008 format Unfortunatelly I'm recieving compilation using .NET csc.exe instead of Mono compiler: D:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\csc.exe /noconfig When I create solution in MonoDevelop and point Mono (2.8, 2.10) as default .NET runtime I'm getting compilation using csc.exe but version 3.5 !!! Is there a way to enforce Mono as default compilator for mdrun? Thanks Jerry -- View this message in context: http://mono.1490590.n4.nabble.com/Automatic-build-using-mdrun-mdtool-tp3262627p3262627.html Sent from the Mono - General mailing list archive at Nabble.com. ___ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list ___ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list
Re: [Mono-list] How to: start a process which shows a password window
You should check out Cocoasudo. If using this binary executable won't work for you then taking a look at it's open source implementation might help you figure out how to do it with the aid of MonoMac. http://www.performantdesign.com/2009/10/26/cocoasudo-a-graphical-cocoa-based-alternative-to-sudo/ -- View this message in context: http://mono.1490590.n4.nabble.com/How-to-start-a-process-which-shows-a-password-window-tp3093329p3260490.html Sent from the Mono - General mailing list archive at Nabble.com. ___ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list
[Mono-list] taglib-sharp
It appears Novell has (or had) a C# library named taglib-sharp for editing ID3 tags commonly found in MP3 files (and other audio files.) There doesn't appear to be any download link for it on Novell's web site. Does anyone know how I can get this library? ___ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list
Re: [Mono-list] serious noob here!!
Your console app won't accept input when running inside MonoDevelop because MonoDevelop's console doesn't accept input. (Or at least that has been my experience.) The solution is to run your program on an external console. There is a setting for this in MonoDevelop. Go to Project options - Run - General - Run on external console. From: jmalcolm malcolm.jus...@gmail.com To: mono-list@lists.ximian.com Sent: Fri, December 24, 2010 10:21:55 AM Subject: Re: [Mono-list] serious noob here!! monon000b wrote: Hi! I recently installed ubuntu and monodevelop with it. I already had a small terminal application, when i run it in monodevelop it works perfectly except that it wont accept user input. It starts and says 'what is your name'. At this point I would expect to be able to enter a name. Instead monodevelop does not allow me to enter information into it's Application Output window... What do I do, sorry that i am completely clueless! sorry for wasting your time if this is a completely ridiculous post but i have googled the answer but have come back empty handed. Your message was not accepted by the mailing list so you will probably not get many answers. It is only visible on the forums and most people do not use them. Your question is pretty open ended. If you are going to ask a question like this, it is usually best to include some of your code so people can see what is going on. What happens when you instead run your application from the command-line? -- View this message in context: http://mono.1490590.n4.nabble.com/serious-noob-here-tp3162488p3163429.html Sent from the Mono - General mailing list archive at Nabble.com. ___ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list ___ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list
Re: [Mono-list] Pending posts and top level mono forum hot link
Dave Kolb wrote: And issue two apparently was a FireFox issue and the mono link is hot in IE8. I tested the forum page containing Dave's message (http://go-mono.com/forums/#nabble-td3096414%7Ca3096611) in Safari 5.0.3 (6533.19.4), Google Chrome 8.0.552.231, Firefox 3.6.12 and Opera 11.0 build 1156 all on my Mac running OS X 10.6.5. I wanted to see if the mono link is hot in any of them and what the cause might be. The mono link was hot only in Opera. The link was inaccessible in Safari, Chrome and Firefox. After looking at the HTML source for that page I was able to see that the real problem is slightly different. (The mono link actually is hot as you can see in the code snippet below.) The real problem is that the mono link is inaccessible because it is being eclipsed by the div that contains the word Forums shown just above the mono link. The solution that works on all 4 browsers I tested is quite simple. In the code snippet below on line 2 change div id=content-header to div id=content-header style=z-index:-1. Adding the style=z-index:-1 attribute will make sure all browsers render that div behind the mono link thus making the mono link always accessible. Now that I've diagnosed the bug and provided a solution how can I get the solution incorporated into the forums code? -SteveL div id=page div id=content-headerh2!--BEGIN PAGE TITLE--Forums!--END PAGE TITLE--/h2/div div id=wrapper class=wide div id=sidebar div id=toc-parent/div !-- BEGIN SIDE CONTENT -- !-- END SIDE CONTENT -- /div!--#sidebar-- div id=content class=wide !-- BEGIN MAIN CONTENT -- Mono'http://n4.nabble.com/Mono-f1490590.html;Mono !-- END MAIN CONTENT -- /div!--#content-- /div!--#wrapper-- /div!--#page-- From: CodeSlinger dk...@emdeon.com To: mono-list@lists.ximian.com Sent: Mon, December 20, 2010 1:43:18 PM Subject: Re: [Mono-list] Pending posts and top level mono forum hot link Wel this post did not show pending so only the ones posted before confirming my subscription were the issue. And issue two apparently was a FireFox issue and the mono link is hot in IE8. Dave -- View this message in context: http://mono.1490590.n4.nabble.com/Pending-posts-and-top-level-mono-forum-hot-link-tp3096414p3096611.html Sent from the Mono - General mailing list archive at Nabble.com. ___ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list ___ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list
Re: [Mono-list] Process in Mono different from .Net
Some operating systems have a tool for asynchronously launching applications. On OS X the command line tool is called open. On Windows the command line tool is called start. Is there a similar tool in Linux? From: madrang j...@hotmail.com To: mono-list@lists.ximian.com Sent: Mon, December 20, 2010 8:40:09 AM Subject: Re: [Mono-list] Process in Mono different from .Net On Sun, 2010-12-19 at 06:27 -0800, madrang [via Mono] wrote: I don't need to know when it is terminating, i just need that the child process outlive its parent. Im currently working on a dock that manage the Os application and on Windows when i quit the dock the apps that was started by the dock stays open but not in Linux. I just want the application that i started to stay alive except if i Kill them my self with Close() or Kill(). Like it is on windows. __ View message @ http://mono.1490590.n4.nabble.com/Process-in-Mono-different-from-Net-tp3094257p3094474.html?by-user=t t To unsubscribe from Process in Mono different from .Net, click here. Nobody knows how to start a process that is going to outlive its parents ?? I can use invoke or any workaround that is going to work. View this message in context: Re: Process in Mono different from .Net Sent from the Mono - General mailing list archive at Nabble.com. ___ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list
[Mono-list] MonoDevelop custom commands
I'm working on OS X and trying to use MonoDevelop's custom commands to copy some files and fix the file permissions after the project is built. I've found that any custom command that makes use of wild cards will fail. Is this expected behavior? Complete build log is below. -SteveL p.s. this sounds to me like the code that shells out to execute the custom commands isn't properly handling wildcard characters Building: ImDialer (Debug) Building Solution ImDialer Building: ImDialer (Debug) Performing main compilation... /Library/Frameworks/Mono.framework/Versions/2.8.1/bin/gmcs /noconfig /out:/source/private/main/src/IMDialer/bin/Debug/IMDialer.exe /r:/Library/Frameworks/Mono.framework/Versions/2.8.1/lib/mono/2.0/System.dll /r:/Library/Frameworks/Mono.framework/Versions/2.8.1/lib/mono/2.0/System.Core.dll /r:/Library/Frameworks/Mono.framework/Versions/2.8.1/lib/mono/2.0/System.Data.dll /r:/Library/Frameworks/Mono.framework/Versions/2.8.1/lib/mono/2.0/System.Web.dll /r:/Library/Frameworks/Mono.framework/Versions/2.8.1/lib/mono/2.0/System.Xml.dll /r:/source/private/main/src/IMDialer/lib/collab_platform/6907.168/Microsoft.Rtc.Collaboration.dll /r:/Library/Frameworks/Mono.framework/Versions/2.8.1/lib/mono/2.0/System.Configuration.dll /nologo /warn:4 /debug:+ /debug:full /optimize- /codepage:utf8 /define:TRACE;DEBUG /t:exe /source/private/main/src/IMDialer/ICommand.cs /source/private/main/src/IMDialer/ConferenceJoinCommand.cs /source/private/main/src/IMDialer/DialerSession.cs /source/private/main/src/IMDialer/Helpers.cs /source/private/main/src/IMDialer/ImDialer.cs /source/private/main/src/IMDialer/Logger.cs /source/private/main/src/IMDialer/PlaceCallCommand.cs /source/private/main/src/IMDialer/ShutdownCommand.cs /source/private/main/src/IMDialer/SpeechHelper.cs /source/private/main/src/IMDialer/TestFriends.cs /source/private/main/src/IMDialer/UCMADemoHelper.cs Build complete -- 0 errors, 0 warnings Executing: cp /source/private/main/src/IMDialer/lib/collab_platform/6907.168/default.tmf /source/private/main/src/IMDialer/bin/Debug/ Executing: ls -l /source/private/main/src/IMDialer/bin/Debug/ total 64032 -rwxr-xr-x 1 slessard slessard 29696 Dec 16 12:22 IMDialer.exe -rw-r--r-- 1 slessard slessard 9715 Dec 16 12:22 IMDialer.exe.mdb -r-xr-xr-x 1 slessard slessard 4505600 Dec 16 12:22 Microsoft.Rtc.Collaboration.dll -r-xr-xr-x 1 slessard slessard 12688384 Dec 16 12:22 Microsoft.Rtc.Internal.Media.dll -r-xr-xr-x 1 slessard slessard724992 Dec 16 12:22 Microsoft.Speech.dll -r-xr-xr-x 1 slessard slessard 1714688 Dec 16 12:22 SIPEPS.dll -r-xr-xr-x 1 slessard slessard 13101930 Dec 16 12:22 default.tmf Executing: chmod u+w /source/private/main/src/IMDialer/bin/Debug/* chmod: /source/private/main/src/IMDialer/bin/Debug/*: No such file or directory -- Done -- Build successful. Custom command failed (exit code: 1) ___ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list
Re: [Mono-list] MonoDevelop custom commands
Thanks for the tip. Still something doesn't add up. These exact same commands, including wildcards, do work when building the the project with XBuild. Why does it work with XBuild but not work with MonoDevelop? -SteveL On Dec 16, 2010, at 2:43 PM, Robert Jordan robe...@gmx.net wrote: On 16.12.2010 21:29, Steve Lessard wrote: I'm working on OS X and trying to use MonoDevelop's custom commands to copy some files and fix the file permissions after the project is built. I've found that any custom command that makes use of wild cards will fail. Is this expected behavior? Complete build log is below. -SteveL p.s. this sounds to me like the code that shells out to execute the custom commands isn't properly handling wildcard characters Unix does not handle wildcards at all. If you want wildcards then you should execute the commands using a shell, like this: /bin/bash -c ls * Robert P.S.: MonoDevelop's list is over here: http://lists.ximian.com/mailman/listinfo/monodevelop-list ___ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list ___ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list
[Mono-list] Mono's bin directory
I've been browsing around in the mono/bin directory to see what tools are available. There's a lot of nice stuff in there. Loading the man page for each of these tools wouldn't be very efficient. Is there some easy way to get a short description of what each of these tools does? -SteveL ___ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list
[Mono-list] gacing assemblies
Last night I opened this bug https://bugzilla.novell.com/show_bug.cgi?id=655684 because Mono's gacutil cannot gac delay-signed assemblies. (.NET's gacutil works just fine with delay-signed assemblies.) This bug in Mono's gacutil is blocking me so I want to find a workaround. One option in the .NET world is to use sn.exe -Vr to register the assembly for skipping strongname validation. Unfortunately Mono's sn.exe tool hasn't implemented the -Vr feature, though curiously it has implemented the -Vl and -Vf features both of which only apply to assemblies that have been registered for skipping strong name validation. This leads me to believe that there must be some way to manually register an assembly for skipping strongname validation. I know that when .NET's sn.exe registers an assembly for skipping strongname validation what really happens is a key is created in the registry, e.g. HKEY_LOCAL_MACHINE\System\StrongName\Verification\Microsoft.Rtc.Collaboration,31BF3856AD364E35. In .NET it is possible to manually register an assembly for skipping strong name validation by creating a similar reg key. Does Mono have an analogous way to manually register an assembly for skipping strongname validation? Thanks for your help, -SteveL p.s. Here's the output from Mono's sn.exe -Vr and .NET's sn.exe -Vr. C:\program files\Microsoft Office Communications Server 2007 R2\ucma sdk 2.0\ucmacore\binsn -Vr Microsoft.Rtc.Collaboration.dll Mono StrongName - version 2.8.1.0 StrongName utility for signing assemblies Copyright 2002, 2003 Motus Technologies. Copyright 2004-2008 Novell. BSD licensed. Unimplemented option C:\program files\Microsoft Office Communications Server 2007 R2\ucma sdk 2.0\ucmacore\binsn -Vr Microsoft.Rtc.Collaboration.dll Microsoft (R) .NET Framework Strong Name Utility Version 2.0.50727.42 Copyright (c) Microsoft Corporation. All rights reserved. Verification entry added for assembly 'Microsoft.Rtc.Collaboration,31BF3856AD364E35' ___ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list
[Mono-list] redirecting streams
I've been experimenting with the System.Diagnostics.Process and ProcessStartInfo classes and their ability to redirect standard in, standard out and standard error. Everything works fine. What I would like to know is how do I redirect additional streams? What additional streams are there? Well, glad you asked. I was running a slightly modified version of the sample at http://msdn.microsoft.com/en-us/library/system.diagnostics.process.beginoutputreadline(v=VS.90).aspx. I changed the code to redirect standard error in addition to standard out and standard in. I also changed the code to run /bin/bash instead of sort.exe. With these modifications the program is able to capture the standard out and standard error from the bash process, but it doesn't capture the prompt that is output by bash. In other words it is not capturing applejacks:Debug slessard$. How can I capture the stream that displays the bash prompt? ___ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list
[Mono-list] Interactive C# Shell
It's very easy to get the C# Shell into a state where it will not allow me to exit the shell. How can I correct the state to get it working again? Give this a try in the C# Shell... applejacks:~ slessard$ csharp Mono C# Shell, type help; for help Enter statements below. csharp exit ; {interactive}(1,2): error CS0103: The name `exit' does not exist in the current csharp csharp csharp csharp csharp quit; csharp help; csharp -SteveL p.s. I'm running Mono 2.8.1 on OS X 10.6.5. ___ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list
Re: [Mono-list] An inheritance dilemma
It sounds like what you need is an abstract base class with only a declaration of the SampleMethod method, but no implementation for it. Obviously I do not know anything about your project, but I do wonder why your code needs to know exactly which type the class is. Isn't that one of the great things about polymorphism? -SteveL P.s. Have you tried the typeof operator? On Nov 22, 2010, at 6:27 AM, Abe Gillespie abe.gilles...@gmail.com wrote: I've never run into a situation which required inheritance that I could not get working with some combo of abstract, virtual, and override. We can only help you as detailed as your example is. So without a better description of the problem this is the best help we can offer. You most likely don't have to settle on a half-baked solution. And your example looks like a rather common use of inheritance. Keep thinking about the problem until you find a solution that is 100% satisfying. That or take a little more time to send us a more detailed problem description. -Abe On Mon, Nov 22, 2010 at 9:09 AM, Francisco M. Marzoa fmmar...@gmx.net wrote: Thanks a lot for your help, Abe. The previous code was just a simplified version of a more complex one. The fact is that I need each class to have it's own SampleMethod, so it cannot be just removed from B class. And that's the real root of the problem. Obviusly you couldn't know this. Anyway after look more into this, I've reached the conclussion that there's no chance to obtain the output I want with the class scheme I proposed without, perhaps, dirty hacks based on reflection. And prior doing that, I think it's better to rethink the scheme. So, the best solution I've found is to rewrite both classes like follows: public class A { protected string BuildString( string cname ) { return cname + method; } public virtual void SampleMethod() { Console.WriteLine(this.BuildString(Class A)); } } public class B : A { public override void SampleMethod() { base.SampleMethod(); Console.WriteLine(this.BuildString(Class B)); } } The key point on this is that as there should be a different SampleMethod overrided in each descendant, we do know within that method the class we're executing in, so we can pass it from there instead of use an instance method GetClassName. Best regards, El 21/11/10 19:53, Abe Gillespie escribió: I just realized you *really* doing virtualization in GetClassName(). So the better way to do this is: namespace Dummy { class MainClass { public static void Main (string[] args) { B b = new B(); b.SampleMethod(); } } public class A { protected virtual string GetClassName() { return Class A; } public void SampleMethod () { Console.WriteLine (GetClassName() + method); } } public class B : A { protected override string GetClassName() { return Class B; } } } ___ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list ___ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list
[Mono-list] porting from .NET to Mono
I would like to get your advice on porting code from .NET to Mono. I have a class library that I wrote for .NET 3.5 on Windows. In addition to working in .NET on Windows I want to get it working in Mono on non-Windows platforms (especially OS X on Intel chips.) This class library is currently about 90% C# and 10% managed C++. The C# code is in one assembly and the managed C++ code is in another assembly. The library has no GUI, but does make use of some classes/methods that are not available/implemented in Mono. It also p/invokes to some Win32 APIs. My initial thoughts on a plan for porting the code: * If available replace each p/invoke to a Win32 API with a call to a Mono class/method providing similar functionality. * If not available I plan to leave the p/invoke in place and build a platform specific native library (.dylib on OS X) providing similar functionality with the same signature. * Stub out or #ifdef out the code entirely. (For example the code that ties in to Windows event logging is not essential functionality.) My initial thoughts on a strategy for porting the code: * Port this library to Mono on Windows * Port it to Mono on WINE on non-Windows platforms * Port it to Mono on non-Windows platforms My questions: 1. Aside from unavailable or unimplemented classes/methods in Mono and p/invokes to native code what are some common gotchas when porting .NET code to Mono? 2. Can Mono on Windows run managed C++ code? 3. Assuming the managed C++ code makes no platform specific calls, is clean for 32/64 bit architectures, clean for bit endianness could it be recompiled can Mono on non-Windows platforms run managed C++ code? 4. Would porting to Mono on WINE on OS X as an intermediate step be worth the effort? 5. Is there a better or alternative porting strategy that you would recommend? ___ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list
Re: [Mono-list] about guid
Robert wrote: the algorithms behind MS' implementation are not well documented. Are you talking about the algorithms for and implementation of Type.GUID, or are you talking about the algorithms for and implementation of UUID / GUID generation in general? Why wouldn't an RFC4122-compliant implementation would not be acceptable? From: Robert Jordan robe...@gmx.net To: Mono-list@lists.ximian.com Sent: Sun, August 15, 2010 7:20:06 AM Subject: Re: [Mono-list] about guid On 15.08.2010 14:30, Feng Su wrote: I compile a file to a assembly. I find the Guids of all classes is ----. How can generate the different Guids for these classes? You can manually apply a GuidAttribute to these classes, something like that: using System; using System.Runtime.InteropServices; [Guid(7ADF8247-2749-447E-890C-47BC7B42999F)] class Program { static void Main () { Console.WriteLine (typeof(Program).GUID); } } Automatic Type.GUIDs are not implemented in Mono, mostly because the algorithms behind MS' implementation are not well documented. Robert ___ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list ___ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list
Re: [Mono-list] mono swallows threadpool exceptions
There is a fairly simple workaround. Basically instead of putting the raw Action delegate on the thread pool you wrap it in another Action delegate. (Let's call it the guardian delegate.) The guardian delegate is put on the thread pool. When executed the guardian delegate calls the raw Action delegate from inside a try/catch block. With this workaround you can write the guardian delegate to do whatever you want when it catches any kind of exception. Does Environment.FailFast work in Mono? From: Daniel Hughes tramps...@gmail.com To: mono-list@lists.ximian.com Sent: Wed, July 21, 2010 3:50:35 AM Subject: Re: [Mono-list] mono swallows threadpool exceptions And I found the bug. Bug 491191 Which is over a year old. This one is not in an obscure part of the framework like my serial port bug so it should be fixed quickly?? ___ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list
Re: [Mono-list] mono swallows threadpool exceptions
I haven't looked at the Mono implementation code nor the .NET implementation code but I believe it is highly unlikely that the fix would be trivial. In .NET 2.0 and later the new behavior for the runtime to catch unhandled thread pool exceptions and then raise the AppDomain's UnhandledException event, provided the application has registered for that event. Further complicating implementing a fix to this bug is the fact that this event can be handled in any application domain. However, the event is not necessarily raised in the application domain where the exception occurred. This MSDN doc tries to explain the new behavior: http://msdn.microsoft.com/en-us/library/system.appdomain.unhandledexception.aspx From: Stifu st...@free.fr To: mono-list@lists.ximian.com Sent: Wed, July 21, 2010 5:02:49 AM Subject: Re: [Mono-list] mono swallows threadpool exceptions Among the bugs I reported, the ones which tended to get fixed the fastest were the ones I submitted patches for. :) Not catching an Exception (or throwing one) sounds like a trivial patch, but I could be wrong. Daniel Hughes wrote: And I found the bug. Bug 491191 Which is over a year old. This one is not in an obscure part of the framework like my serial port bug so it should be fixed quickly?? ___ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list
Re: [Mono-list] Debugging mono dll loaded by Unity3d
Instead of attaching to the exe that references your dll have MonoDevelop launch the exe for you. The trick to getting MonoDevelop to launch the exe for you is to create an empty project with the same name as your exe (minus the .exe extension) and add it to the same solution as your dll project. Set that empty project as the startup project. In the directory for the empty project create the bin\Debug directories and copy your exe, exe.mdb, config, etc. files there. Now build the entire solution and select Debug from the Run menu. MonoDevelop will launch your exe in the debugger and should be able to break at breakpoints within your dll project. -SteveL On Jul 16, 2010, at 9:04 AM, and192 andrew.rus...@googlemail.com wrote: Hi there, I have a problem trying to understand how to debug a library I'm writing in MonoDevelop. This library is being referenced from a Unity3d project. I have been pointing the MonoDevelop debugger at the built Unity3d exe and hoping to be able to 'attach' along the lines of the MSVisual studio debugger. However the debugger loads in MonoDevelop and encounters an exception: System.Runtime.InteropServices.COMException (0x80131700): Failed to load the runtime. at Microsoft.Samples.Debugging.CorDebug.NativeMethods.GetRequestedRuntimeVersion etc... I suspect this is because Unity3d is not a mono executable and the Mono debugger cannot detect the runtime version. I appreciate there may not be an easy way to do this, but before I give up, does anyone have any suggestions, other than writing to debug log files etc, on how I can use a debugger to step through my mono code? Many thanks in advance, Andy -- View this message in context: http://mono.1490590.n4.nabble.com/Debugging-mono-dll-loaded-by-Unity3d-tp2291591p2291591.html Sent from the Mono - General mailing list archive at Nabble.com. ___ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list ___ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list
[Mono-list] corflags.exe
Is there a Mono equivalent of Microsoft's CorFlags.exe tool? From: Yury Serdyuk y...@serdyuk.botik.ru To: Jérémie Laval jeremie.la...@gmail.com Cc: mono-list@lists.ximian.com Sent: Wed, July 7, 2010 5:59:32 AM Subject: Re: [Mono-list] PFX still doesn't work correctly (in Mono 2.6.4) One more remark - though in the program using System; using System.Threading; public class Test_PFX_For { public static void Main ( String[] args ) { int num_threads = Convert.ToInt32 ( args [ 0 ] ); ParallelOptions po = new ParallelOptions { MaxDegreeOfParallelism = num_threads }; Parallel.For ( 0, 100, po, i = { long k = 0; while ( true ){ k++; k--; } }); } } ParallelOptions mode works good, but it seems in the Parallel.Invoke construction it doesn't act. Is it true ? The test code for Parallel.Invoke is: using System; using System.Threading; using System.Diagnostics; using System.IO; namespace QuickSort { class Program { static void q_sort(int[] array, int left, int right, bool forceSequential) { int current, last; if (left = right) return; swap(array, left, (left + right) / 2); last = left; for (current = left + 1; current = right; ++current) { if (array[current] array[left]) { ++last; swap(array, last, current); } } swap(array, left, last); if (forceSequential || (last - left) 4096) { q_sort(array, left, last - 1, forceSequential); q_sort(array, last + 1, right, forceSequential); } else { Parallel.Invoke( po, delegate { q_sort(array, left, last - 1, forceSequential); }, delegate { q_sort(array, last + 1, right, forceSequential); }); } } static void swap(int[] array, int i, int j) { int temp; temp = array[i]; array[i] = array[j]; array[j] = temp; } static ParallelOptions po; static void Main(string[] args) { int P = System.Convert.ToInt32 ( args [ 0 ] ); FileStream fs = new FileStream ( args [ 1 ], FileMode.Open, FileAccess.Read ); StreamReader sr = new StreamReader ( fs ); int N = System.Convert.ToInt32 ( sr.ReadLine() ); Console.WriteLine ( N = + N ); int[] array = new int [ N ]; DateTime dt1 = DateTime.Now; for ( int i = 0; i N; i++ ) array [ i ] = System.Convert.ToInt32 ( sr.ReadLine() ); DateTime dt2 = DateTime.Now; Console.WriteLine ( read_data: + (dt2-dt1).TotalSeconds + sec. ); sr.Close(); fs.Close(); po = new ParallelOptions { MaxDegreeOfParallelism = P }; // // Sequential // //dt1 = DateTime.Now; //q_sort(array, 0, array.Length - 1, true); //dt2 = DateTime.Now; //Console.WriteLine(Sequential: {0} sec., (dt2-dt1).TotalSeconds ); // // Parallel // dt1 = DateTime.Now; q_sort(array, 0, array.Length - 1, false); dt2 = DateTime.Now; Console.WriteLine(Parallel: {0} sec., (dt2-dt1).TotalSeconds); } } } Thanks. Yury. ___ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list ___ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list
Re: [Mono-list] Mono.Unix - change translation at run-time
For starters you'll have to set the locale on each thread, use appropriate instances of IFormatProvider and StringComparison. -SteveL On Jun 30, 2010, at 12:16 PM, Miguel de Icaza mig...@novell.com wrote: Hi all. Does anybody know how to use Mono.Unix to translate a desktop application at run-time without restarting? That is, the user selects a different language and all strings immediately change without an interruption. That is a feature of your application, not of Mono.Unix. I am not aware of many applications that support switching the language at runtime, most require you to restart the application as most apps will cache or compute translations just once as opposed to every time the string is used. Miguel. ___ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list ___ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list
[Mono-list] Delay signed assemblies
Noobie question here... I tried to GAC an assembly I downloaded from Microsoft. gacutil failed saying the assembly is delay signed. So I ran sn to dump out the assembly's strong name info and got an error (see below.) What do I have to do to get this assembly installed in the GAC? AppleJacks:Bin slessard$ gacutil -i Microsoft.Rtc.Collaboration.dll Failure adding assembly Microsoft.Rtc.Collaboration.dll to the cache: Strong name cannot be verified for delay-signed assembly AppleJacks:Bin slessard$ sn -t Microsoft.Rtc.Collaboration.dll Mono StrongName - version 2.4.0.0 StrongName utility for signing assemblies Copyright 2002, 2003 Motus Technologies. Copyright 2004-2008 Novell. BSD licensed. ERROR: Unknown blob format. -- View this message in context: http://mono.1490590.n4.nabble.com/Delay-signed-assemblies-tp2271701p2271701.html Sent from the Mono - General mailing list archive at Nabble.com. ___ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list