InvalidException on mono

Posts   
 
    
luanzhu
User
Posts: 4
Joined: 01-May-2007
# Posted on: 01-May-2007 17:52:15   

Hi,

I am having problem with the generated code in mono. It seems there is some issue with bigint data type in SQL server table. I kept getting the error:

Unhandled Exception: System.InvalidCastException: Cannot cast from source type to destination type.
  at DAL.EntityClasses.CommunityEntity.get_Id () [0x00000] 
  at test.GetCommunityV2.GetCommunity () [0x00000] 
  at test.Program.Main (System.String[] argv) [0x00000]

But if I do the query manually by using something like:

sc = new Community(reader.GetInt64(0));

mono can handle the bigint reading fine.

I check the generated code in the CommunityEntity and did not find anything suspicious.

 public virtual System.Int64 Id
           {
                 get
                 {
                       object valueToReturn = base.GetCurrentFieldValue((int)CommunityFieldIndex.Id);
                       if(valueToReturn == null)
                       {
                             valueToReturn =TypeDefaultValue.GetDefaultValue(typeof(System.Int64));
                       }
                       return (System.Int64)valueToReturn;
                 }
                 set   { SetNewFieldValue((int)CommunityFieldIndex.Id, value); }
           }

Could you please help this? A lot of tables in our SQL database are using bigint and we really would like to make it work under mono.

I am using LLBL Gen Pro 2.0.0.0 final, mono 1.2.3.1. I tried mono in Windows XP and Mac OS tiger.

Thanks a lot for your help!

luanzhu

Skeeterbug
User
Posts: 165
Joined: 21-May-2004
# Posted on: 01-May-2007 18:41:56   

Just curious, which GUI toolkit/library are you going to use? We were once considering Mono/GTK# here, but GTK support on Mac is rather shady. Also debugging in Sharpdevelop didn't allow you to set breakpoints, etc, so we just went with VS2005 and dropped support for Mac/Linux and not use Mono. I did compile LLBLGen under Mono and run some sample code without problems.

luanzhu
User
Posts: 4
Joined: 01-May-2007
# Posted on: 02-May-2007 03:08:25   

This is a web application so we don't need to worry about the GUI part at this point. simple_smile

As for the GUI, have you checked native System.Windows.Forms? It looks very promising to me.

Thanks a lot!

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 02-May-2007 09:18:40   

Which LLBLGen Pro runtime library version are you using?

Are you using any TypeConverters?

luanzhu
User
Posts: 4
Joined: 01-May-2007
# Posted on: 02-May-2007 17:32:53   

SD.LLBLGen.Pro.DQE.SqlServer.NET11.dll 2.0.0.60701 SD.LLBLGen.Pro.ORMSupportClasses.NET11.dll 2.0.0.60701

No, I do not use any TypeConverters.

Thanks

Skeeterbug
User
Posts: 165
Joined: 21-May-2004
# Posted on: 02-May-2007 18:48:56   

luanzhu wrote:

This is a web application so we don't need to worry about the GUI part at this point. simple_smile

As for the GUI, have you checked native System.Windows.Forms? It looks very promising to me.

Thanks a lot!

I think that was just coming out at the time we looked into this. That was about 8-9 months ago maybe?

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 03-May-2007 09:38:04   

SD.LLBLGen.Pro.DQE.SqlServer.NET11.dll 2.0.0.60701 SD.LLBLGen.Pro.ORMSupportClasses.NET11.dll 2.0.0.60701

These are old ones, would you please download the latest build available and see if the problem disappears.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 04-May-2007 10:03:45   

It can also be that the table field type is different than last time you refreshed the catalog, so the project still thinks it's int32 for example while the value is in fact int64. Or for example 'decimal'. Could you please check that?

Frans Bouma | Lead developer LLBLGen Pro
luanzhu
User
Posts: 4
Joined: 01-May-2007
# Posted on: 08-May-2007 14:27:55   

I did refresh the catalog. I don't have much time right now. I will try the latest version sometime later.

Thanks a lot for your prompt response!

slipserve
User
Posts: 7
Joined: 04-Jul-2007
# Posted on: 04-Jul-2007 18:01:06   

The instructions at http://www.ssgx.com/llblgenpro/LLBLGen_Pro_on_Mono do not seem to match the runtime library source code included with LLBLGenPro 2.0.

After setting up my VS environment, I tried executing the makemono.cmd in the sourcecode/net2.x directory but receive errors indicating that the makemono.cmd is not available in the respective subdirectories.

C:\Program Files\Solutions Design\LLBLGen Pro v2.0\RuntimeLibraries\Sourcecode\N et2.x>makemono.cmd Setting environment for using Microsoft Visual Studio 2005 x86 tools. 'makemono.cmd' is not recognized as an internal or external command, operable program or batch file. 'makemono.cmd' is not recognized as an internal or external command, operable program or batch file. The system cannot find the path specified. The system cannot find the path specified.

Do you have updated source including the makemono.cmd for the ORMSupportClasses and PostgreSqlDQE?

Thanks!

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 05-Jul-2007 09:25:12   

The instructions at http://www.ssgx.com/llblgenpro/LLBLGen_Pro_on_Mono do not seem to match the runtime library source code included with LLBLGenPro 2.0.

Do you have the latest version of the runtime Libraries?

slipserve
User
Posts: 7
Joined: 04-Jul-2007
# Posted on: 05-Jul-2007 13:36:31   

Thanks...the runtime libraries compiled after downloading the latest runtime source.

Are there any other steps not listed in the Wiki? I was expecting to see Mono20 as a platform choice in the generator's menu but it didn't change. After regenerating the source using the .NET 2.0 platform on Windows and compiling on Mono, I am getting a compiler error:

/BusinessObjects/DatabaseSpecific/DataAccessAdapter.cs(157,110): error CS3001: Argument type Npgsql.NpgsqlParameter[]' is not CLS-compliant /BusinessObjects/DatabaseSpecific/DataAccessAdapter.cs(206,114): error CS3001: Argument typeNpgsql.NpgsqlParameter[]' is not CLS-compliant

I'm using Mono C# compiler version 1.2.4.0.

I realize you don't officially support Mono, so any assistance is much appreciated.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 06-Jul-2007 11:25:58   

If you get a CLS compliant error, remove the clscompliant attribute from the assemblyinfo file.

Frans Bouma | Lead developer LLBLGen Pro