Type-Initialisation function for aM has caused an exception

Automate and integrate using the SQL comparison API

Moderator: Chris Auckland

Type-Initialisation function for aM has caused an exception

Postby Gillian » Thu Mar 24, 2011 9:52 am

Hello,

I'm trying to do a schema compare with a backup file.
I followed the instructions on http://78.31.104.66/index.php/Schema_Ob ... ckup_SDK_8.

But when i run the code it shows the exception "Type-Initialisation function for aM has caused an exception".

my code:
Code: Select all
        Public Shared Function RegisterBackup(ByVal filename As String, ByVal databaseName As String) As Global.RedGate.SQLCompare.Engine.ReadFromBackup.BackupSetDatabase
            Dim bdsBackup = New Global.RedGate.SQLCompare.Engine.ReadFromBackup.BackupDatabaseSource
            Dim files As New List(Of String)(1)
            files.Add(filename)
            bdsBackup.Files = files
            Dim bsdBackup As New Global.RedGate.SQLCompare.Engine.ReadFromBackup.BackupSetDatabase
            Dim cpBdsBackup As ConnectionProperties = bdsBackup.ToConnectionProperties
            bsdBackup.Register(cpBdsBackup, Global.RedGate.SQLCompare.Engine.Options.Default)

            Return bsdBackup
        End Function


When i call the ToConnectionProperties, i get the error.

When I "watch" the BackupDatabaseSource.
I see the error in the IsCaseSensitive property
In the Innerexception underneath that there is another error: Can't load one or more multiple types. Look at LoaderException property for more information.
So when i watch that. I get a specific error:
The method get_IsIncomplete in the type Redgate.BackupReader.BackupSet out of the assembly RedGate.BackupReader, Version=1.3.0.106, Culture=neutral, PublicKeyToken=7f465a1c156d4d57 does not have an implementation.

Note: I translated the errors from dutch to english. They could be slightly different.

How can I solve this issue?

Thanks in advance,
Gillian
Gillian
 
Posts: 4
Joined: Wed Mar 02, 2011 9:32 am

Postby Brian Donahue » Fri Mar 25, 2011 5:41 pm

Hello,
Are you trying to compare a SQL Backup file or a regular backup file? You may just need to reference RedGate.BackupReader.SqbReader.dll.
Brian Donahue
 
Posts: 6670
Joined: Mon Aug 23, 2004 10:48 am

Re:

Postby Gillian » Mon Mar 28, 2011 8:06 am

Brian Donahue wrote:Hello,
Are you trying to compare a SQL Backup file or a regular backup file? You may just need to reference RedGate.BackupReader.SqbReader.dll.


Thank you for your reply

I've already referenced Redgate.BackupReader.SqbReader.dll. Specific Version is set to false and i've added them locally.

I'm trying to compare a .bak file which I created with SMO.
Gillian
 
Posts: 4
Joined: Wed Mar 02, 2011 9:32 am

Postby Brian Donahue » Mon Mar 28, 2011 9:17 am

Compiling the application as 32-bit (x86)? Because the backupreader DLL is 32-bit only.
Brian Donahue
 
Posts: 6670
Joined: Mon Aug 23, 2004 10:48 am

Postby Gillian » Mon Mar 28, 2011 9:52 am

I know, I'm compiling it as a x86..
Gillian
 
Posts: 4
Joined: Wed Mar 02, 2011 9:32 am

Postby Brian Donahue » Mon Mar 28, 2011 11:06 am

Have you also put RedGate.Shared.Utils.dll in the output folder? The BackupSet class implements IRedGateSerializable, which is in that assembly.
Brian Donahue
 
Posts: 6670
Joined: Mon Aug 23, 2004 10:48 am

Postby Gillian » Mon Mar 28, 2011 11:21 am

Yes,

I've referenced:
RedGate.BackupReader.dll
RedGate.BackupReader.SqbReader.dll
RedGate.Licensing.Client.dll
RedGate.Shared.SQL.dll
RedGate.Shared.Utils.dll
RedGate.SQLCompare.ASTParser.dll
RedGate.SQLCompare.Engine.dll
RedGate.SQLCompare.Rewriter.dll
RedGate.SQLDataCompare.Engine.dll

I've also added the xml files.. Just trying.. But that doesn't work either..
Gillian
 
Posts: 4
Joined: Wed Mar 02, 2011 9:32 am

Postby Brian Donahue » Mon Mar 28, 2011 2:21 pm

Maybe mismatched versions of some RedGate components. Did you replace any of the DLLS with versions from different packages? For instance, different versions of the assemblies exist in the SDK distribution compared to SQL and Data Compare.

You may also have some outdated RedGate.* dlls in the GAC.
Brian Donahue
 
Posts: 6670
Joined: Mon Aug 23, 2004 10:48 am

Postby Authorized_ » Tue Mar 29, 2011 1:50 pm

I have uninstalled "SQL Toolbelt", ran a Registery cleaner, checked if all files were deleted from the GAC. Rebooted, and installed "SQL Toolbelt" again.

I added the "new" libraries, and it worked! :D

Thank you very much for your support.
Authorized_
 
Posts: 5
Joined: Wed Mar 02, 2011 9:38 am


Return to SQL Comparison SDK Previous Versions

Who is online

Users browsing this forum: No registered users and 1 guest