Red Gate forums :: View topic - Type-Initialisation function for aM has caused an exception
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
SQL Comparison SDK Previous Versions
SQL Comparison SDK Previous Versions forum

Type-Initialisation function for aM has caused an exception

Search in SQL Comparison SDK Previous Versions forum
Post new topic   Reply to topic
Jump to:  
Author Message
Gillian



Joined: 02 Mar 2011
Posts: 4

PostPosted: Thu Mar 24, 2011 9:52 am    Post subject: Type-Initialisation function for aM has caused an exception Reply with quote

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_Object_Restore_from_Backup_SDK_8.

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

my code:
Code:

        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
Back to top
View user's profile Send private message
Brian Donahue



Joined: 23 Aug 2004
Posts: 6645

PostPosted: Fri Mar 25, 2011 5:41 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
Gillian



Joined: 02 Mar 2011
Posts: 4

PostPosted: Mon Mar 28, 2011 8:06 am    Post subject: Re: Reply with quote

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.
Back to top
View user's profile Send private message
Brian Donahue



Joined: 23 Aug 2004
Posts: 6645

PostPosted: Mon Mar 28, 2011 9:17 am    Post subject: Reply with quote

Compiling the application as 32-bit (x86)? Because the backupreader DLL is 32-bit only.
Back to top
View user's profile Send private message
Gillian



Joined: 02 Mar 2011
Posts: 4

PostPosted: Mon Mar 28, 2011 9:52 am    Post subject: Reply with quote

I know, I'm compiling it as a x86..
Back to top
View user's profile Send private message
Brian Donahue



Joined: 23 Aug 2004
Posts: 6645

PostPosted: Mon Mar 28, 2011 11:06 am    Post subject: Reply with quote

Have you also put RedGate.Shared.Utils.dll in the output folder? The BackupSet class implements IRedGateSerializable, which is in that assembly.
Back to top
View user's profile Send private message
Gillian



Joined: 02 Mar 2011
Posts: 4

PostPosted: Mon Mar 28, 2011 11:21 am    Post subject: Reply with quote

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..
Back to top
View user's profile Send private message
Brian Donahue



Joined: 23 Aug 2004
Posts: 6645

PostPosted: Mon Mar 28, 2011 2:21 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
Authorized_



Joined: 02 Mar 2011
Posts: 5

PostPosted: Tue Mar 29, 2011 1:50 pm    Post subject: Reply with quote

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! Very Happy

Thank you very much for your support.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group