0

i have written a C# .NET 4.5 WinForms application with Visual Studio 2013. Now i would like to run this application with Mono on my Linux machine (Mint 17.1).

I have already done the following steps:

  • Analysed my .exe under Windows with the Mono Migration Analyser
    • All tests of Moma were pass (i had to adapt a RTL property)
  • Installed mono-complete (apt-get install mono-complete, current version is 3.2.8)
  • compiled with xbuild (no options) my csproj file (0 errors 1 warning: /usr/lib/mono/4.5/Microsoft.Common.targets: warning : Reference 'System.Deployment' not resolved)
  • tried to start the application with ./app.exe from my console

The application does not start, but i see an exception, which doesn't give me any hint about what could be wrong. Here is the excepion:

Unhandled Exception:
System.ArgumentException: dataMember
  at System.Windows.Forms.ListBindingHelper.GetList (System.Object dataSource, System.String dataMember) [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.BindingSource.ResetList () [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.BindingSource.set_DataMember (System.String value) [0x00000] in <filename unknown>:0 
  at (wrapper remoting-invoke-with-check) System.Windows.Forms.BindingSource:set_DataMember (string)
  at mda.vaulty.main.Database.VaultManagment.InitializeBindingSources () [0x00000] in <filename unknown>:0 
  at mda.vaulty.main.Database.VaultManagment..ctor () [0x00000] in <filename unknown>:0 
  at mda.vaulty.main.MainForm..ctor () [0x00000] in <filename unknown>:0 
  at (wrapper remoting-invoke-with-check) mda.vaulty.main.MainForm:.ctor ()
  at mda.vaulty.main.Program.Main () [0x00000] in <filename unknown>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.ArgumentException: dataMember
  at System.Windows.Forms.ListBindingHelper.GetList (System.Object dataSource, System.String dataMember) [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.BindingSource.ResetList () [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.BindingSource.set_DataMember (System.String value) [0x00000] in <filename unknown>:0 
  at (wrapper remoting-invoke-with-check) System.Windows.Forms.BindingSource:set_DataMember (string)
  at mda.vaulty.main.Database.VaultManagment.InitializeBindingSources () [0x00000] in <filename unknown>:0 
  at mda.vaulty.main.Database.VaultManagment..ctor () [0x00000] in <filename unknown>:0 
  at mda.vaulty.main.MainForm..ctor () [0x00000] in <filename unknown>:0 
  at (wrapper remoting-invoke-with-check) mda.vaulty.main.MainForm:.ctor ()
  at mda.vaulty.main.Program.Main () [0x00000] in <filename unknown>:0 

The project is a .NET 4.5 project, which as far as i know is fully compatible with Mono. I am using a strong typed DataSet, DataGrids with DataBindings and user specific application settings. Could one of those Components cause the problem? The app.config is created by the xbuild process and it contains the expected content (app settings with default values).

What is also created by the xbuild compiler, is an mdb file. But this file unknown to me, because VS2013 does not create such.

Do you have an idea why the application is not starting?

Thanks,

Regards,

Michael

Michael
  • 153
  • 1
  • 14

1 Answers1

0

at (wrapper remoting-invoke-with-check) System.Windows.Forms.BindingSource:set_DataMember (string) at mda.vaulty.main.Database.VaultManagment.InitializeBindingSources () [0x00000] in <filename unknown>:0 at mda.vaulty.main.Database.VaultManagment..ctor () [0x00000] in <filename unknown>:0 at mda.vaulty.main.MainForm..ctor () [0x00000] in <filename unknown>:0

It appears that you do not have a database/datasource defined on your Linux/Mint box and thus the filename exception. Out of the box, Mono provides a SQLite install but that is it. There are (were) a number of ODBC providers available for various flavors of Linux at one time (check with your DB provider).

This of course would not be checked this Moma.

Also, I would recommend running it under Mono on your Windows box. Install a Windows build of mono and try running your app.

BTW: mdb files are mono's version of pdb files for debug builds. They contain extra info (fully-qualified paths to source files, symbols, etc.. for the soft debugger (i.e. gdb)

SushiHangover
  • 73,120
  • 10
  • 106
  • 165
  • Thanks for the hint. currently i dont use any Database within my App. It's just a DataSet object which is written to XML. If the data model remains stable, i will try to integrate the usage of a data base. But for now its just a DataSet. Would I still need an ODBC-Driver - as far as i understand ODBC is only if i have a real relational database. Nevertheless i will try it running with Mono on my Windows machine. – Michael Jun 21 '15 at 21:09
  • Is that XML file read and written? i.e. the Xml file location hard coded. Windows path style? Or are you using Path.Combine, etc to build that OS independent path? Running it on Windows will show you fairly quickly. – SushiHangover Jun 21 '15 at 23:38
  • i could run my application on Windows with Mono and received at least the same exception message. Therefore i can run the app and debug it under windows. But I still don't know what the actual problem is :-( – Michael Jun 22 '15 at 06:57
  • The app tries to read the xml file which is usually saved in a user specific version of the app.config. In the default app.config the path is empty. If so, the application does not try to read the xml file. Due to the fact that i am trying to run the app with mono on windows, there should be no problem with the path. – Michael Jun 23 '15 at 06:28
  • I wrote an example application with a strong typed dataset, a single datagridview, a binding source and a bindingnavigator. So far i could run the application! But as soon as i enter data in the datagridview the application crashes. I can retrieve the exception by redirecting the output to a file. In general i could try to debug this error, but at this point it seems to me too, that i have to invest too much effort. I will either rewrite the app with monodevelop, or port it to another more portable language. Thanks – Michael Jun 23 '15 at 20:32
  • Good luck. WinForms under Mono is really old and while it 'works', kind-of, it is getting zero development from Xamarin due to its age and the direction they have taken since. GTK# is an option under Mono/MonoDevelop, personally I hate it. It is stuck at an old version 2.x of Gtk and gets zero love from Xamarin. Xamarin does work on it, but only in relation to Xamarin Studio/MonoDevelop and thus things like the GTK# Visual Designer (static) in MD is quirky and there is very little community – SushiHangover Jun 23 '15 at 21:19
  • If you stay with C# .Net/Mono, take a look at Mono's XWT (https://github.com/mono/xwt). No GUI designer, so manual coding the forms/controls but it produces native GUIs on each OS. – SushiHangover Jun 23 '15 at 21:30
  • I am planning to start with Java 8 and Netbeans. I already wrote some applications in Java, i just need some time to get into the topics. Thanks – Michael Jun 25 '15 at 11:53