The stream cannot be read to construct the DacType.

Nov 28, 2011 at 9:32 AM

I've recently started getting an error when trying to import a .bacpac export taken from the SQL Azure Import / Export CTP into a SQL Server 2008 instance.  I've successfully done this before once I'd installed the required assemblies.  The error and stack trace are:

 

DAC Exception: Microsoft.SqlServer.Management.Dac.DacException: The stream cannot be read to construct the DacType. ---> Microsoft.SqlServer.Management.SqlParser.MetadataSerialization.ion: Invalid 'RE:Grantor' element.
   at Microsoft.SqlServer.Management.SqlParser.MetadataSerialization.XmlMetadataDeserializer.ReadProperty(XmlScanner scanner, MetadataTypeInfo typeInfo, Object[] values, Int32 objId)
   at Microsoft.SqlServer.Management.SqlParser.MetadataSerialization.XmlMetadataDeserializer.ReadMetadataObject(XmlScanner scanner, Int32 id, MetadataTypeInfo typeInfo)
   at Microsoft.SqlServer.Management.SqlParser.MetadataSerialization.XmlMetadataDeserializer.ReadMetadataCollection(XmlScanner scanner, TypeInfo elementType, Int32 parentId)
   at Microsoft.SqlServer.Management.SqlParser.MetadataSerialization.XmlMetadataDeserializer.ReadProperty(XmlScanner scanner, MetadataTypeInfo typeInfo, Object[] values, Int32 objId)
   at Microsoft.SqlServer.Management.SqlParser.MetadataSerialization.XmlMetadataDeserializer.ReadMetadataObject(XmlScanner scanner, Int32 id, MetadataTypeInfo typeInfo)
   at Microsoft.SqlServer.Management.SqlParser.MetadataSerialization.XmlMetadataDeserializer.ReadXml(XmlScanner scanner)
   at Microsoft.SqlServer.Management.SqlParser.MetadataSerialization.XmlMetadataDeserializer.Deserialize(IServer sourceServer)
   at Microsoft.SqlServer.Management.DacSerialization.DacSerializer.Deserialize(Stream inputLogicalStream, Stream inputPhysicalStream, CollationInfo collationInfo)
   at Microsoft.SqlServer.Management.Dac.DacType.Load(Stream stream, Boolean typeMetadataOnly)
   --- End of inner exception stack trace ---
   at Microsoft.SqlServer.Management.Dac.DacType.Load(Stream stream, Boolean typeMetadataOnly)
   at Microsoft.SqlServer.Management.Dac.DacStore.Import(Stream stream, DatabaseDeploymentProperties deploymentProperties, Boolean skipPolicyValidation)
   at Microsoft.SqlServer.Management.Dac.DacStore.Import(DatabaseDeploymentProperties deploymentProperties, String path, Boolean skipPolicyValidation)
   at DacImportExportCli.Program.ImportAction()
Import Complete.  Total time: 00:01:27.4627146

 

The .bacpac file is taken from blob down to a local server, the parameters used are:

D:\Databases\Backup\DacImportExportCli.exe -s WATSON\DEVELOPMENT -d TargetDBName -e -f D:\Databases\Backup\SourceDB.bacpac -i

Has anyone else encountered this? Is there a part of our schema that isn't DAC compliant?

Dec 1, 2011 at 7:02 PM

1. Could you tell us what is the DACFx version that you are using ? Please try and use the RC0 bits,also available @
http://sqldacexamples.codeplex.com/wikipage?title=Required%20Assemblies%20Links&referringTitle=Home

Also, please ensure you are using the latest CLI tool
http://sqldacexamples.codeplex.com/releases

2. If it still repros with the latest binaries, if it is possible, could you please send the dacpac (w/o data in the bacpac) for us to repro locally.
Please send it to preethas  @  live . com

Preetha
MSFT

Dec 2, 2011 at 9:11 AM

Ah the DAC framework I'm using is indeed out of date; thank you Preetha I'll have a go on those