Tag: mono

在Travis CI上使用Mono 5.14.0.177,msbuild 15.0,nuget 4.7.1构建失败,但在VirtualBox中无法重现

对于Xenial和Trusty Ubuntu,我在Travis CI上使用Mono 5.14.0.177,msbuild 15.0,nuget 4.7.1进行构建失败,但在VirtualBox,Ubuntu Xenial中无法重现。 跑完后: mono tools/nuget/nuget.exe restore pythonnet.sln -o packages 错误消息是: Currently running NuGet.exe 4.1.0. Updating NuGet.exe to 4.7.1. Update successful. MSBuild auto-detection: using msbuild version ‘15.0’ from ‘/usr/lib/mono/msbuild/15.0/bin’. Error parsing solution file at /home/travis/build/pythonnet/pythonnet/pythonnet.sln: Invalid Image 这是VirtualBox的成功构建: https://gist.github.com/denfromufa/23557331aba2ad548eba2fbff84f2307 并且在Travis CI中失败了: https://travis-ci.org/pythonnet/pythonnet/jobs/419381040 关于GitHub的这个问题的更多细节: https://github.com/pythonnet/pythonnet/pull/698

Mono中的C#FileStream – 文件共享冲突

我有一个使用Mono在Raspbian上运行的C#WinForms应用程序。 它有一个计时器。 当OnTimedEvent触发时,我检查是否可以独占访问我要上传的文件(以确保它已完成写入磁盘),然后尝试上传。 如果上传成功,我将文件移动到存档文件夹,否则我将其留在那里并等待下一个计时器事件。 连接到Internet时没有问题,但是当我测试没有并且我的上传失败时,第二个OnTimedEvent在检查同一文件是否准备就绪时会再次出现exception。 我正进入(状态 : Error message: ***Sharing violation on path ‘path’ ***HResult: ***-2147024864 检查文件是否准备好的方法: public static bool IsFileReady(string filename) { // If the file can be opened for exclusive access it means that the file // is no longer locked by another process. try { var inputStream = File.Open(filename, FileMode.Open, FileAccess.Read, FileShare.None); […]

C#代码在IIS上运行速度很快,但在Mono上运行缓慢 – 如何改进它?

我有一个在我的Windows开发机器上运行良好的ASP.NET应用程序。 服务器是运行Mono的Linux,一旦上传,相同的代码运行速度比在Windows机器上运行慢4到5倍(例如,对于一个任务,需要25秒对5秒)。 这种性能是Mono的已知问题吗? 我能做些什么吗? 代码主要是文本处理,字符串替换,正则表达式等,如果这有任何区别。 我在本地使用VS分析和调试了我的代码,但我不知道是否可以在服务器上用Mono进行远程调试,或者我接下来需要做什么才能真正解决它。

TPL可以在多个线程上运行任务吗?

Mono / Xamarin特定的答案受到欢迎。 我正在使用Task.Run()运行System.Threading.Tasks。 TPL是否会在任务执行期间将创建的任务分配给单个线程? 或者创建的任务是否可能在运行时被抢占,然后再次在另一个线程上安排? Thread.CurrentThread.ManagedThreadId会在任务的生命周期内保持不变吗? 对于长期运行的任务,答案是否不同? 有没有办法控制这方面的TPL行为?

绘图区域中的GTK#鼠标事件

我有一个DrawingArea,我想收到鼠标事件。 从教程中我发现KeyPressEvent也会捕获鼠标事件。 但是对于以下代码,从不调用处理程序。 static void Main () { Application.Init (); Gtk.Window w = new Gtk.Window (“”); DrawingArea a = new CairoGraphic (); a.KeyPressEvent += KeyPressHandler; w.Add(a); w.Resize (500, 500); w.DeleteEvent += close_window; w.ShowAll (); Application.Run (); } private static void KeyPressHandler(object sender, KeyPressEventArgs args) { Console.WriteLine(“key press event”); } 我通过阅读不同的论坛和教程尝试了很多东西,包括: 将EventBox添加到窗口并将DrawingArea放入事件框并订阅EventBox的KeyPressEvent。 (没用) 调用AddEvents((int)Gdk.EventMask.AllEventsMask); 在任何和所有小部件上 我确实发现订阅Windows […]

在不知道索引的情况下在C#中解析json

我想用JSON.NET在C#中解析这段JSON,但我不知道如何去做。 JSON: { “success”:true, “rgInventory”:{ “967633758”:{ “id”:”967633758″, “classid”:”23973033″, “instanceid”:”11040671″, “amount”:”1″, “pos”:1 }, “302756826”:{ “id”:”302756826″, “classid”:”15″, “instanceid”:”11041143″, “amount”:”1″, “pos”:2 },… } } 完整的Json: http ://steamcommunity.com/id/jessecar/inventory/json/440/2/?trading =1 我需要获取每个“rgInventory”子元素的元素,但我不能为它创建一个类,因为项目名称总是在变化。 我尝试使用这段代码,但我总是得到一个例外。 dynamic jsObject = JsonConvert.DeserializeObject(jsonString); Console.WriteLine(“Status: “+jsObject[“success”]); //This works fine foreach(var i in jsObject[“rgInventory”]){ Console.WriteLine(“Item ID: “+i[“id”]); //This gives an exception } 例外: 未处理的exception:System.InvalidOperationException:无法访问Newtonsoft.Json.Linq.JProperty上的子值。

Dapper是否适用于Mono?

我们正在考虑转移到Mono ,我发现Dapper可以使用MySql。 但是,这是使用ADO.NET提供程序。 Mono / Linux是否有MySql ADO.NET提供程序并且与Dapper一起使用? 最终我们计划将我们当前的站点从MySql迁移到PostgreSql,我也想知道同样的问题,还有Linux上的PostrgreSql,Mono和Dapper的内容?

GTK#图像按钮在运行时不显示图像

我试图在GTK#(Xamarin Studio)中使用图像按钮。我将图像设置为按钮,在UI Builder中,图像即将出现。 但是当我运行程序时,按钮中没有图像 我在不同版本的IDE和不同平台(Mac和Windows)上试过这个 请帮忙 更新:MainWindow.cs using System; using Gtk; public partial class MainWindow: Gtk.Window { public MainWindow () : base (Gtk.WindowType.Toplevel) { Build (); } protected void OnDeleteEvent (object sender, DeleteEventArgs a) { Application.Quit (); a.RetVal = true; } } 在gtk-gui文件夹中,我可以找到这些文件 generated.cs // This file has been generated by the GUI designer. Do […]

Gstreamer在Linux上运行良好

因为我目前正在为我的项目制作gstreamer绑定并获得信息,gstreamer-sharp 0.99.x只能使用glib-sharp 2.99.x,我认为创建一个测试项目是一个好主意。 所以我下载了名为“GTK#3简单项目模板”的monodevelop插件并编译了它 – >工作。 现在我添加了之前编译的gstreamer-sharp 0.99 dll并添加了以下代码: Gst.Application.Init(); Element music = Parse.Launch(“playbin uri=\”file:////media/Auslagerung/DJ/IDs/android.mp3\””); music.SetState(Gst.State.Playing); 当我播放此代码时,我得到以下exception: Marshaling clicked signal Exception in Gtk# callback delegate Note: Applications can use GLib.ExceptionManager.UnhandledException to handle the exception. System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. —> System.Reflection.TargetInvocationException: Exception has been thrown by the target of […]

从C#连接到Accumulo

我不熟悉与Accumulo合作。 我需要通过C#从远程Accumulo读取/写入数据。 我发现C#的唯一代码示例/文档是 – Accumulo createBatchScanner范围不能按预期工作 我试图在Mac上的Xamarin Studio中编译代码。 我遇到的问题是这一行: AccumuloProxy.Client client = new AccumuloProxy.Client(protocol); 错误CS0246:找不到类型或命名空间名称AccumuloProxy’ could not be found. Are you missing AccumuloProxy’ could not be found. Are you missing org.apache.accumulo.proxy.thrift’使用指令吗? (CS0246)(AccumuloIntegratorPrototype) 在哪里可以找到要添加到与AccumuloProxy客户端相关的CSharp项目的DLL? 有没有办法可以生成相同的? 这是一个代码片段: namespace AccumuloIntegratorPrototype { class MainClass { static byte[] GetBytes(string str) { return Encoding.ASCII.GetBytes(str); } static string GetString(byte[] bytes) { return […]