The type initializer threw an exception

Posts   
 
    
Posts: 1
Joined: 26-Feb-2013
# Posted on: 26-Feb-2013 17:24:57   

Hi,

We've been using LLBLGenPro Version 2.6 for a few years now without any problems in our ASP.Net project.

I'm now trying to use the same assembly in a Windows forms project.

When I try an instantiate an instance of a particular entity class I get the following exception thrown.

The type initializer for 'Intersalon.DAL.EntityClasses.SalonSmsSettingsEntity' threw an exception.

This issue seems specific to this class because other entity classes instantiate as expected.

The test code is:

private void button1_Click(object sender, EventArgs e) { SalonAppointmentEntity a = new SalonAppointmentEntity(); SalonStylistEntity st = new SalonStylistEntity(); SalonSmsSettingsEntity s = new SalonSmsSettingsEntity();

    }

And the exception is thrown on the third line.

Any ideas what the problem is with this class?

BTW: We are using the self servicing model

Thanks

Glynn

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39910
Joined: 17-Aug-2003
# Posted on: 26-Feb-2013 18:13:48   

3rd line is: SalonAppointmentEntity a = new SalonAppointmentEntity();

? First be sure you use the latest v2.6 runtime builds (please download these from the customer area)

If a type initializer fails with an exception, it's always related to a static constructor which fails. Please check whether your application / tests have a config file, with the following settings:

  • buildInValidationBypassMode
  • scaleOverflowCorrectionActionToUse
  • markSavedEntitiesAsFetched

if so, make sure these are specified correctly. If not, the static constructor might fail (or you use an old build which contains a bug in this area) and you'll get this exception.

Frans Bouma | Lead developer LLBLGen Pro