Search This Blog

Showing posts with label F# Mono MacOSX Linux. Show all posts
Showing posts with label F# Mono MacOSX Linux. Show all posts

Sunday, March 27, 2011

Ordering files in MonoDevelop's F# Plug-in

I have been using Tomas Petricek's F# Plug-in for MonoDevelop a lot recently for some personal projects. The addition of code-completion and on-the-fly compilation has been a nice upgrade from XCode. Mostly it was working well until I added a new module and the main program file couldn't find it and just reported errors. It built fine using my Makefiles.

After looking at the compiler output I realized that the ordering of the files was wrong. The F# compiler enforces strict, non-cyclic dependencies between files (modules) and requires the order of the files on the command line reflect this. That is, the modules with no dependencies (except references) come first, and those dependent on the earlier ones come next.

For example, assume we are building a .DLL with files A.fs, B.fs, and C.fs. If files B and C are independent, but file A references both B and C then A must come after both B and C on the compile line:
    mono fsc.exe [references] B.fs C.fs A.fs

I knew what the issue was but haven't been able to find a way in MonoDevelop to control this. Finally while watching the Australian Grand Prix this morning I found it. Experienced MonoDevelop users probably already know this, though it isn't necessary for C#, but I finally found the option to control the build order.

Under the Project Options menu item (either Project Menu or the right-click popup menu), find the heading 'Build' and click on the 'General' item. This brings up two tabs in the right-hand display both oddly named 'General' as well. The second one controls the build order. Once I fixed the build order to reflect the file dependencies I closed and re-openened the editor tabs and all is well again!

Wednesday, February 17, 2010

Auto SQL generation during update requires a valid SelectCommand

While populating a Postgres DB, some updates (not all) updates failed with the following exception:
Auto SQL generation during Update requires a valid SelectCommand.
at System.Data.Common.DbDataAdapter.Update (System.Data.DataRow[] dataRows, System.Data.Common.DataTableMapping tableMapping) [0x00000]

At first I thought it was due to having several update threads running, but even with a single thread running it still occurred.

The error showed up under Mono 2.4.1 running on Ubuntu 9.10. I was not seeing it under Mac OS running Mono 2.6.1 or Ubuntu 9.10 also running Mono 2.6.1.

Upgrading to Mono 2.6.1 seems to have fixed it, but I have also seen other odd exceptions specifically on that VM. It's possible that the VM has other issues.

Summary:
Platform: Ubuntu Linux 9.10, Mac OS Snow Leopard running Mono 2.4.1 and 2.6.1
Language: F#
Solution: Switching from Mono 2.4 to 2.6.1 appears to have solved it.