Open simsta6 opened 1 year ago
I feel like your description and reproduction steps don't match... Are you saying it crashes "when reusing a single transformer instance on a second source" or "when transforming between any source and target with a same-name dynamic schema"?
@simsta6 I have created this test and it does not reproduce. Could you point out where I'm deviating from your description? (the branch is here if you'd like to fork/edit it)
it.only("handle same name dynamic schemas", async function () {
const makeDynamicSchema = (version: string) => `<?xml version="1.0" encoding="UTF-8"?>
<ECSchema schemaName="Dynamic" alias="d1" version="${version}" displayLabel="dyn" xmlns="http://www.bentley.com/schemas/Bentley.ECXML.3.2">
<ECCustomAttributes>
<DynamicSchema xmlns="CoreCustomAttributes.01.00.03"/>
</ECCustomAttributes>
</ECSchema>
`;
/* eslint-disable @typescript-eslint/naming-convention */
const dynamicSchema1_7_0 = makeDynamicSchema("01.07.00");
const dynamicSchema1_5_2 = makeDynamicSchema("01.05.02");
/* eslint-enable @typescript-eslint/naming-convention */
const sourceDbFile: string = IModelTransformerTestUtils.prepareOutputFile("IModelTransformer", "DynSchemas-Source.bim");
const sourceDb = SnapshotDb.createEmpty(sourceDbFile, { rootSubject: { name: "DynSchemaSource" } });
await sourceDb.importSchemaStrings([dynamicSchema1_7_0]);
sourceDb.saveChanges();
const targetDbFile: string = IModelTransformerTestUtils.prepareOutputFile("IModelTransformer", "DynSchemas-Target.bim");
const targetDb = SnapshotDb.createEmpty(targetDbFile, { rootSubject: { name: "DynSchemasTarget" } });
await targetDb.importSchemaStrings([dynamicSchema1_5_2]);
targetDb.saveChanges();
const transformer = new IModelTransformer(sourceDb, targetDb);
// expect this to not reject, adding chai as promised makes the error less readable
await transformer.processSchemas();
expect(targetDb.querySchemaVersion("Dynamic")).to.equal("1.7.0");
// clean up
transformer.dispose();
sourceDb.close();
targetDb.close();
});
possibly fixed by https://github.com/iTwin/imodel-native/pull/404
will update once iTwin/imodel-native#404 is released in a patch
was release as 4.1.1 (iirc). @simsta6 is it possible to test this?
@MichaelBelousov it will take some time. I will get back to you when I will test it out
Describe the bug proccessSchemas crashes node process with
Segmentation Fault
while importing dynamic schema from source iModel when target iModel has incompatible version of that same dynamic schema.It's possible that this bug is also reproducible with different schema importing issues.
To Reproduce
Expected behavior It should throw an error
Desktop (please complete the applicable information):
Additional context Add any other context about the problem here.
EC Schemas for test cases: