Open llali opened 11 months ago
there are two issues here. # 1 why serializing fails. # 2 if it fails, dacfx should not create the bacpac with missing origin.xml. for # 1 I was not able to repro the issue. the procedure user has include a � character which export successfully for me. It's possible the local or the machine is different for the user. for issue # 2 we need to catch the errors when serializing the model.xml and fail the operation. here's the stack trace `The surrogate pair (0xDBA4, 0x69) is invalid. A high surrogate character (0xD800 - 0xDBFF) must always be paired with a low surrogate character (0xDC00 - 0xDFFF). (System.Xml)
at System.Xml.XmlEncodedRawTextWriter.EncodeSurrogate(Char pSrc, Char pSrcEnd, Char* pDst)
at System.Xml.XmlEncodedRawTextWriter.WriteCDataSection(String text)
at System.Xml.XmlEncodedRawTextWriter.WriteCData(String text)
at System.Xml.XmlEncodedRawTextWriterIndent.WriteCData(String text)
at System.Xml.XmlWellFormedWriter.WriteCData(String text)
at Microsoft.Data.Tools.Schema.Sql.SchemaModel.SqlSchemaModel.WriteScriptToXml(XmlWriter writer, String script)
at Microsoft.Data.Tools.Schema.Sql.SchemaModel.SqlSchemaModel.SerializeExternalProperty(XmlWriter writer, ModelPropertyClass propertyClass, Object property)
at Microsoft.Data.Tools.Schema.SchemaModel.DataSchemaModel.XmlSerializerInternal.WriteProperties(ModelPropertyContainerClass propertyContainerClass, IModelPropertyContainer propertyContainer)
at Microsoft.Data.Tools.Schema.SchemaModel.DataSchemaModel.XmlSerializerInternal.WriteElement(IModelElement root)
at Microsoft.Data.Tools.Schema.SchemaModel.DataSchemaModel.XmlSerializerInternal.WriteStore()
at Microsoft.Data.Tools.Schema.SchemaModel.DataSchemaModel.Serialize(TextWriter output, IEnumerable1 annotationTypesToInclude, Boolean includePositions, UInt32 minimalSchemVersion) at Microsoft.Data.Tools.Schema.Sql.Build.DacUtilities.AddModelToSqlPackage(SqlPackage package, DataSchemaModel model, IEnumerable
1 annotations, Nullable1 minModelVersion) at Microsoft.SqlServer.Dac.DacPackage.WritePackageContent(SqlPackage package, DataSchemaModel model, DacMetadata metadata, Nullable
1 minModelVersion)
at Microsoft.SqlServer.Dac.DacPackage.Save(Stream stream, DataSchemaModel model, DacMetadata metadata, Nullable1 minModelVersion) at Microsoft.SqlServer.Dac.DacServices.<>c__DisplayClass65.<>c__DisplayClass67.<CreateExportOperation>b__63() at Microsoft.Data.Tools.Schema.Sql.Dac.OperationLogger.Capture(Action action) at Microsoft.SqlServer.Dac.DacServices.<>c__DisplayClass65.<CreateExportOperation>b__62(Object operation, CancellationToken token) at Microsoft.SqlServer.Dac.Operation.Microsoft.SqlServer.Dac.IOperation.Run(OperationContext context) at Microsoft.SqlServer.Dac.OperationExtension.CompositeOperation.Microsoft.SqlServer.Dac.IOperation.Run(OperationContext context) at Microsoft.SqlServer.Dac.OperationExtension.Execute(IOperation operation, DacLoggingContext loggingContext, CancellationToken cancellationToken) at Microsoft.SqlServer.Dac.DacServices.ExportBacpac(Func
1 streamGetter, String databaseName, DacExportOptions exportOptions, IEnumerable1 tables, CancellationToken cancellationToken) at Microsoft.SqlServer.Dac.DacServices.ExportBacpac(String packageFileName, String databaseName, DacExportOptions options, IEnumerable
1 tables, Nullable1 cancellationToken) at Microsoft.SqlServer.Dac.DacServices.ExportBacpac(String packageFileName, String databaseName, DacSchemaModelStorageType modelStorageType, IEnumerable
1 tables, Nullable1 cancellationToken) at Microsoft.SqlServer.Management.Dac.DacWizard.ExportDatabase.DoWork() at Microsoft.SqlServer.Management.TaskForms.SimpleWorkItem.Run()
Tested with the Spanish language too, And the generated bacpac has no issues and clearly accepting the special characters. Like you suspected, it could be customer's machine's configurations issue or something else, If we can get more info related versions and tools they are using, we can give a try. Thanks
I fixed the log to show the failure. I also checked that the origin.xml is created after model.xml so if model.xml fails, there shouldn't be any origin.xml. it is possible that the bacpac file already existed. dacfx support exporting to existing bacpac file. so if it fails it should not delete the bacpac.
Steps to Reproduce:
Expected: export either successfully create the bacpac to fails and show a meaningful error for user Actual: export fails but it creates the bacpac and logs shows export completed successfully. user sees an error in the console:
Did this occur in prior versions? If not - which version(s) did it work in?
(DacFx/SqlPackage/SSMS/Azure Data Studio)