我正在構建一個針對.NET 4.0的簡單應用程序。這是我使用Visual Studio 2010構建的POC,並在Raspbian的Mono上運行它。Mono上的System.Xml.Linq問題
我過了Hello World舞臺,現在我添加了第三方Matrix XMPP SDK。該應用程序在Windows中運行得很好。
因此,我將這些文件複製到Raspbian並運行mono SampleForm.exe
。它不會運行併發出異常,所以我使用--debug
標誌運行它,並且部分調試日誌顯示如下所示。 (Full log)
Mono: The request to load the assembly System.Xml.Linq v3.5.0.0 was remapped to v4.0.0.0
Mono: Assembly Loader probing location: '/usr/lib/mono/gac/System.Xml.Linq/4.0.0.0__b77a5c561934e089/System.Xml.Linq.dll'.
Mono: Assembly Loader probing location: '/mnt/win/System.Xml.Linq.dll'.
Mono: Assembly Loader probing location: '/usr/lib/System.Xml.Linq.dll'.
Mono: Assembly Loader probing location: '/usr/lib/mono/4.5/Facades/System.Xml.Linq.dll'.
Mono: Assembly Loader probing location: '/usr/lib/mono/gac/System.Xml.Linq/4.0.0.0__b77a5c561934e089/System.Xml.Linq.exe'.
Mono: Assembly Loader probing location: '/mnt/win/System.Xml.Linq.exe'.
Mono: Assembly Loader probing location: '/usr/lib/System.Xml.Linq.exe'.
Mono: Assembly Loader probing location: '/usr/lib/mono/4.5/Facades/System.Xml.Linq.exe'.
Mono: The following assembly referenced from /mnt/win/Matrix.dll could not be loaded:
Assembly: System.Xml.Linq (assemblyref_index=1)
Version: 3.5.0.0
Public Key: b77a5c561934e089
The assembly was not found in the Global Assembly Cache, a path listed in the MONO_PATH environment variable, or in the location of the executing assembly (/mnt/win/).
Mono: Failed to load assembly Matrix[0x15c30b0]
Mono: Could not load file or assembly 'System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies.
Mono: Could not load file or assembly 'System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies.
Mono: Could not load file or assembly 'System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies.
Mono: Could not load file or assembly 'System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies.
Mono: Could not load file or assembly 'System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies.
System.TypeLoadException: Could not load type 'Matrix.Xmpp.Client.XmppClient' from assembly 'Matrix, Version=1.5.3.0, Culture=neutral, PublicKeyToken=41a432ad608f2ff0'.
at XMPPHandler.DotNetXMPPClient..ctor() [0x00000] in <filename unknown>:0
事情我試圖解決這個問題:
編譯.NET 3.5。但是,這造成了更多的錯誤,Win Form甚至沒有出現。
我試着做一個綁定重定向,但沒有奏效。
<runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="System.Xml.Linq" publicKeyToken="b77a5c561934e089" /> <bindingRedirect oldVersion="3.5.0.0" newVersion="4.0.0.0"/> </dependentAssembly> </assemblyBinding> </runtime>
我試圖把3.5版本的System.Xml.Linq的到我的VS項目,但它不停地自動更改回4.0
我試圖尋找安裝4.0版的方式。 0爲System.Xml.Linq,發現
sudo apt-get install mono-data
應該這樣做,但我被告知該包沒有找到(即使在apt-get更新後)。我檢查了/usr/lib/mono/gac/System.Xml.Linq
目錄,只有目錄3.5.0.0__b77a5c561934e089
出席。我安裝libmono-system-xml-linq4.0-cil,然後運行應用程序。現在我收到了分段錯誤。
我該如何安裝4.0.0.0版本,或者我還能做些什麼才能使它工作?
您使用的是哪種版本的單聲道? – knocte
我正在使用單聲道JIT編譯器版本3.2.8(Debian 3.2.8 + dfsg-4 + rpi1) –
好的,這可能是一個單聲道錯誤,因爲我沒有看到這個程序集列在這裏:https:// github .com/mono/mono/blob/e3b9881e5707953bd37fb3ed0dbeab93e6603a5e/mono/metadata/assembly.c#L74我建議首先用一個最小的測試用例在bugzilla.xamarin.com中提交一個bug,然後嘗試編譯你自己的mono,將該程序集添加到程序集.c試圖解決它(如果你實現它,建議你的更改作爲拉請求) – knocte