mono

Workaround for bug in mono: Wrong Process.ProcessName

淺唱寂寞╮ 提交于 2020-01-05 06:29:25
问题 If you work with mono and use Process.ProcessName you may get wrong results on some computers. For example instead of the process name " kwrite " you may get " kdeinit4 " (seen on SUSE). On Ubuntu I have even seen complete bullshit like " kdeinit4;5535948c (deleted) " instead of " kwrite ". Note: On other computers the result may be correct. If I use Process.MainModule.ModuleName it retruns the same wrong name. And if I use Process.MainModule.FileName it gives the wrong path. Apart from that

Workaround for bug in mono: Wrong Process.ProcessName

…衆ロ難τιáo~ 提交于 2020-01-05 06:29:06
问题 If you work with mono and use Process.ProcessName you may get wrong results on some computers. For example instead of the process name " kwrite " you may get " kdeinit4 " (seen on SUSE). On Ubuntu I have even seen complete bullshit like " kdeinit4;5535948c (deleted) " instead of " kwrite ". Note: On other computers the result may be correct. If I use Process.MainModule.ModuleName it retruns the same wrong name. And if I use Process.MainModule.FileName it gives the wrong path. Apart from that

Asynchronous UDP receiving null bytes

孤街醉人 提交于 2020-01-05 05:50:12
问题 I have a server like this: public void Run() { while (true) { if (curThreads < maxThreads) { curThreads++; AsyncCallback callback = new AsyncCallback (ProcessRequest); client.BeginReceive (callback, this); } } } And the callback is: public static void ProcessRequest(IAsyncResult result) { LogSink lg = result.AsyncState as LogSink; IPEndPoint endPoint = new IPEndPoint (IPAddress.Any, 0); byte[] message = lg.client.EndReceive (result, ref endPoint); String str = Encoding.ASCII.GetString

How to start a service in C# on Linux

会有一股神秘感。 提交于 2020-01-05 04:52:07
问题 I would like to start a service on my Linux server using a C# console application, through Mono. public static void StartService(string serviceName, int timeoutMilliseconds) { ServiceController service = new ServiceController(serviceName); try { TimeSpan timeout = TimeSpan.FromMilliseconds(timeoutMilliseconds); service.Start(); service.WaitForStatus(ServiceControllerStatus.Running, timeout); } catch { // ... } } Would this work? As an alternative, is there a way to send a command to Linux

Hooking up .NET method for profiling purposes [duplicate]

余生颓废 提交于 2020-01-05 03:38:25
问题 This question already has answers here : Closed 8 years ago . Possible Duplicate: Profiling a method in C# to know how long does it take to run I need to check how long does it take to run a method. For example, I need to know how long does it take to run GetTypes() method in using System.Reflection in my project. foreach (Type t2 in a.GetTypes()) { Console.WriteLine(t2); } The easiest way might be running profiler or insert Stopwatch all the source files that uses GetTypes(), but I hope I

cannot compile gtk# example

南笙酒味 提交于 2020-01-04 15:29:48
问题 I'm trying to compile the "GTK# Hello World" example at http://mono-project.com/Mono_Basics in Windows 7 (64bits). I'm getting this error: error CS8027: Couldn't run pkg-config: ApplicationName='pkg-config', CommandLine ='--libs gtk-sharp-2.0', CurrentDirectory='' I have successfully compiled and run the "Console Hello World" example. I have installed Mono-2.10.8. Thanks in advance for your help 回答1: I tried to compile a GTK# example in a Windows 7 with Mono 2.10.8 and the options you used

Mono for Android is a framework that need to be installed on android devices or is a compiler that compiles to java bytecode?

二次信任 提交于 2020-01-04 08:06:05
问题 I'm trying to understand how mono for android works and I'm not found this explanation in official site. Taking into account that android reads java bytecode, Mono for Android is a framework that need to be installed on android devices or is a compiler that compiles to java byte code? 回答1: This article on Xamarin's site describes how the architecture is put together. Long story short, there is nothing compiling C# into Java byte code. Mono for Android applications ship with the Mono runtime

pkg-config path for mono on mac

会有一股神秘感。 提交于 2020-01-04 07:04:30
问题 I installed mono in Mac OS X. I was following these instructions on the mono website. The first console application worked because it didn't use any packages. However, when I ran gmcs hello.cs -pkg:gtk-sharp-2.0 , it told me I didn't have pkg-config installed. So I installed pkg-config. Now I get this error because pkg-config doesn't know the mono package path: Perhaps you should add the directory containing `gtk-sharp-2.0.pc' to the PKG_CONFIG_PATH environment variable No package 'gtk-sharp

pkg-config path for mono on mac

陌路散爱 提交于 2020-01-04 07:04:10
问题 I installed mono in Mac OS X. I was following these instructions on the mono website. The first console application worked because it didn't use any packages. However, when I ran gmcs hello.cs -pkg:gtk-sharp-2.0 , it told me I didn't have pkg-config installed. So I installed pkg-config. Now I get this error because pkg-config doesn't know the mono package path: Perhaps you should add the directory containing `gtk-sharp-2.0.pc' to the PKG_CONFIG_PATH environment variable No package 'gtk-sharp

Monotouch - Issue with QLPreviewController

主宰稳场 提交于 2020-01-04 05:53:21
问题 I am trying to use QLPreviewController to see a PDF file and send it, but I have an issue with the action button after previewing the PDF document. When I press the action button (at the top right) app crashes and I get: "Unhandled managed exception: Objective-C exception thrown. Name: NSInternalInconsistencyException Reason: UIDocumentInteractionController: invalid scheme (null). Only the file scheme is supported. (MonoTouch.Foundation.MonoTouchException)" I did some research and it seams