Open wilmaier opened 2 months ago
@ColinKerr
the US Survey volumes were added in Units 1.0.7: https://github.com/iTwin/bis-schemas/blob/fac8b94583872514c97cc2e4aabbe425e4af39e4/SchemaInventory.json#L298
This iModel has units 1.0.4.
Units 1.0.7 was added about 3 years ago which is around the same time the format using CUB_US_SURVEY_FT was added to the default formats: https://github.com/iTwin/itwinjs-core/blob/fd427e43f7e34263b16b80365b6143aff37348d1/core/frontend/src/quantity-formatting/QuantityFormatter.ts#L1242
The code needs to either check schema version before creating this formatter or needs to wrap in a try/catch. Remember very old iModels will not even have a units schema because units were hard coded in EC 3.1 ECDb profile 4.0.0.1.
There are several code paths in addition to the one in the stack above that get the default format for a unit system then load it. We could handle in loadFormatAndParserSpec
but that would leave us with no format, maybe the correct answer is to fall back on the hard coded unit system that is used if we find an iModel that has a 4.0.0.1 ECDb profile and has no units schema at all.
When setting the unit system to US Survey in pineapple viewer, we see an uncaught exception:
Open following iModel (likely happens for any iModel): https://qa-review-eus.itwin.bentley.com/context/8b3d0653-02b5-4a76-832e-7c16ed50ff21/imodel/b9bf7a2d-bf2e-4d3f-b127-90c8029a855e?changesetid=308791f67a9c5ece81a1c792b3ab3cf1ab584b47&it3mode
Open Settings dialog and under General Tab select Unit System US Survey
Notice in DevTools console an exception is shown
The Model tree is no longer display in the Models widget