TypeInitializationException on DynamicQueryEngine

Posts   
 
    
Ccs
User
Posts: 5
Joined: 22-Nov-2007
# Posted on: 02-Jan-2008 08:38:35   

In my generated code there is an instance created of the DynamicQueryEngine in constructor of the DAO class.


Public Class DatabaseInformationDAO 
        Inherits DaoBase
        
        ''' <summary>CTor</summary>
        Public Sub New()
            MyBase.New(InheritanceInfoProviderSingleton.GetInstance(), New DynamicQueryEngine(), InheritanceHierarchyType.None, "DatabaseInformationEntity", New DatabaseInformationEntityFactory())
        End Sub

When doing a getmulti on the belonging collection class this method is called. Next I get an exception on the constructor of the DynamicQueryEngine.

An exception of type 'System.TypeInitializationException' occurred in CCS.DesignStudio.DataLayer.dll but was not handled in user code

Additional information: De type-initialisatiefunctie voor SD.LLBLGen.Pro.DQE.SqlServer.DynamicQueryEngine heeft een uitzondering veroorzaakt.

(i'm sorry it's in dutch, it's the well kwown TypeInitializationException)disappointed

This call is done in a different thread, in a background worker. Can this have something to do with it.

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 02-Jan-2008 10:06:01   

This is typically due to an exception in the static CTor of the DQE. There might be some thing wrong in the config file settings, which are read in the Static CTor.

Would you please post your config file? (remove credentials in connection strings etc.)

And please post more info as described here: http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=7717

Ccs
User
Posts: 5
Joined: 22-Nov-2007
# Posted on: 02-Jan-2008 13:11:51   

I Use LLBLGEN pro version 2.5

SD.LLBLGen.Pro.DQE.SqlServer.NET20.dll version: 2.5.7.1129 SD.LLBLGen.Pro.ORMSupportClasses.NET20.dll version:2.5.7.1214

both downloaded today.

I use the selfservising template group for dotnet20.

Beneath the call stack:

bij System.Environment.GetStackTrace(Exception e, Boolean needFileInfo) bij System.Environment.get_StackTrace() bij SD.LLBLGen.Pro.DQE.SqlServer.DynamicQueryEngine..ctor() bij CCS.DesignStudio.DataLayer.DaoClasses.DatabaseInformationDAO..ctor() in C:\CCSFO\SourceControl\FrontOffice\Branches\Dev\Main-FB-3\Projecten\CCS.Designstudio.DataLayer\DaoClasses\ DatabaseInformationDAO.vb:regel 44 bij CCS.DesignStudio.DataLayer.FactoryClasses.DAOFactory.CreateDatabaseInformationDAO() in C:\CCSFO\SourceControl\FrontOffice\Branches\Dev\Main-FB-3\Projecten\CCS.Designstudio.DataLayer\ FactoryClasses\DaoFactory.vb:regel 101 bij CCS.Designstudio.DataLayer.CollectionClasses.DatabaseInformationCollection.CreateDAOInstance() in C:\CCSFO\SourceControl\FrontOffice\Branches\Dev\Main-FB-3\Projecten\CCS.Designstudio.DataLayer\CollectionClasses\ DatabaseInformationCollection.vb:regel 163 bij SD.LLBLGen.Pro.ORMSupportClasses.EntityCollectionBase1.GetMulti(IPredicate selectFilter, Int64 maxNumberOfItemsToReturn, ISortExpression sortClauses, IRelationCollection relations, IPrefetchPath prefetchPathToUse, ExcludeIncludeFieldsList excludedIncludedFields, Int32 pageNumber, Int32 pageSize) bij SD.LLBLGen.Pro.ORMSupportClasses.EntityCollectionBase1.GetMulti(IPredicate selectFilter, Int64 maxNumberOfItemsToReturn, ISortExpression sortClauses) bij CCS.Designstudio.DataLayer.CollectionClasses.DatabaseInformationCollection.GetAll() in C:\CCSFO\SourceControl\FrontOffice\Branches\Dev\Main-FB-3\Projecten\CCS.Designstudio.DataLayer\CollectionClassesCCS\ DatabaseInformationCollection.vb:regel 31 bij CCS.DesignStudio.Update.Library.UpdateProcessor.get_DatabaseInformationCollection() in C:\CCSFO\SourceControl\FrontOffice\Branches\Dev\Main-FB-3\Projecten\CCS.DesignStudio.Update.Library\ src\UpdateProcessor.vb:regel 53 bij CCS.DesignStudio.Update.Library.UpdateProcessor.GetUpdateList() in C:\CCSFO\SourceControl\FrontOffice\Branches\Dev\Main-FB-3\Projecten\CCS.DesignStudio.Update.Library\ src\UpdateProcessor.vb:regel 296 bij CCS.DesignStudio.Update.Library.UpdateProcessor.backgroundWorker_DoWork(Object sender, DoWorkEventArgs e) in C:\CCSFO\SourceControl\FrontOffice\Branches\Dev\Main-FB-3\Projecten\CCS.DesignStudio.Update.Library\ src\UpdateProcessor.vb:regel 114 bij System.ComponentModel.BackgroundWorker.OnDoWork(DoWorkEventArgs e) bij System.ComponentModel.BackgroundWorker.WorkerThreadStart(Object argument) bij System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs) bij System.Runtime.Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(RuntimeMethodHandle md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs) bij System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(IMessage msg, IMessageSink replySink) bij System.Runtime.Remoting.Proxies.AgileAsyncWorkerItem.ThreadPoolCallBack(Object o) bij System.Threading._ThreadPoolWaitCallback.WaitCallback_Context(Object state) bij System.Threading.ExecutionContext.runTryCode(Object userData) bij System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData) bij System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) bij System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) bij System.Threading._ThreadPoolWaitCallback.PerformWaitCallback(Object state)

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39898
Joined: 17-Aug-2003
# Posted on: 02-Jan-2008 15:36:24   

I've removed the attachments, they're not needed, we do have teh dll's ourselves. What you should post is the lines in your .config file which configure DQE/SqlServer specific settings for LLBLGen Pro, e.g. catalog name overwriting, compatibility mode..

remove connection strings from the text, to avoid posting credentials to servers here, we only need the llblgen pro specific settings in your application's config file. These are read in a static constructor in the Sqlserver DQE and if there's an exception, you'll get this exception.

Frans Bouma | Lead developer LLBLGen Pro
Ccs
User
Posts: 5
Joined: 22-Nov-2007
# Posted on: 03-Jan-2008 08:53:34   

Beneath my entire app.config. There is nothing llblgen specific in it.


<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <configSections>
    </configSections>
    <connectionStrings>
        <add name="CCS.DesignStudio.Update.Application.My.MySettings.ccs_designstudio_sander_2_0_3_ccsConnectionString"
            connectionString="Data Source=W290\SQLEXPRESS;Initial Catalog=ccs_designstudio_sander_2_0_3_ccs;Integrated Security=True"
            providerName="System.Data.SqlClient" />
    </connectionStrings>
    <system.diagnostics>
        <sources>
            <!-- This section defines the logging configuration for My.Application.Log -->
            <source name="DefaultSource" switchName="DefaultSwitch">
                <listeners>
                    <add name="FileLog"/>
                    <!-- Uncomment the below section to write to the Application Event Log -->
                    <!--<add name="EventLog"/>-->
                </listeners>
            </source>
        </sources>
        <switches>
            <add name="DefaultSwitch" value="Information" />
        </switches>
        <sharedListeners>
            <add name="FileLog"
                 type="Microsoft.VisualBasic.Logging.FileLogTraceListener, Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"
                 initializeData="FileLogWriter"/>
            <!-- Uncomment the below section and replace APPLICATION_NAME with the name of your application to write to the Application Event Log -->
            <!--<add name="EventLog" type="System.Diagnostics.EventLogTraceListener" initializeData="APPLICATION_NAME"/> -->
        </sharedListeners>
    </system.diagnostics>
</configuration>


Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 03-Jan-2008 09:41:34   

Where is the connection string that LLBLGen code should use? Have you specified "CCS.DesignStudio.Update.Application.My.MySettings.ccs_designstudio_sander_2_0_3_ccsConnectionString" in the lgp file to be the connection string key?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39898
Joined: 17-Aug-2003
# Posted on: 03-Jan-2008 09:56:39   

Also, please check again that you have referenced in the generated code project the correct ORMSupport classes dll ( the ....NET20.dll one) and the correct SqlServer DQE dll (the ....NET20.dll one, not the CF one). The exception occurs in the CTor but that's empty, it does refer to the base class, which is in the ORMSupportclasses assembly.

Frans Bouma | Lead developer LLBLGen Pro
Ccs
User
Posts: 5
Joined: 22-Nov-2007
# Posted on: 03-Jan-2008 12:39:17   

The connection is set at runtime, set the actualConnectionString of the dbutils class The reference is to the right DLL

SD.LLBLGen.Pro.ORMSupportClasses.NET20

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 03-Jan-2008 14:40:24   

and the correct SqlServer DQE dll (the ....NET20.dll one, not the CF one)

What about the SQLServer DQE? Sorry for asking again but check the references both in your application and in the generated project.

Could you please provide us with a simple repro solution?