diff --git a/Xbim.InformationSpecifications.NewTests/Xbim.InformationSpecifications.Tests.csproj b/Xbim.InformationSpecifications.NewTests/Xbim.InformationSpecifications.Tests.csproj index 6b4f439..8ee8ba4 100644 --- a/Xbim.InformationSpecifications.NewTests/Xbim.InformationSpecifications.Tests.csproj +++ b/Xbim.InformationSpecifications.NewTests/Xbim.InformationSpecifications.Tests.csproj @@ -17,13 +17,13 @@ - + - - + + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/Xbim.InformationSpecifications.NewTests/buildingSmartCompatibility.cs b/Xbim.InformationSpecifications.NewTests/buildingSmartCompatibility.cs index 81fbc69..f069fe0 100644 --- a/Xbim.InformationSpecifications.NewTests/buildingSmartCompatibility.cs +++ b/Xbim.InformationSpecifications.NewTests/buildingSmartCompatibility.cs @@ -104,8 +104,8 @@ public void CanReadIdsSamples(string idsFile) f.Exists.Should().BeTrue("test file must be found"); var loggerMock = Substitute.For>(); // this is to check events - var x = LoadBuildingSmartIDS(f.FullName, loggerMock); - x.Should().NotBeNull(); + var loadedIds = LoadBuildingSmartIDS(f.FullName, loggerMock); + loadedIds.Should().NotBeNull(); var errorAndWarnings = loggerMock.ReceivedCalls().Where(call => call.IsErrorType(true, true, true)); errorAndWarnings.Should().BeEmpty(); } diff --git a/Xbim.InformationSpecifications/Facets/buildingSMART/PartOfFacet.cs b/Xbim.InformationSpecifications/Facets/buildingSMART/PartOfFacet.cs index 6ae3413..f3eb36c 100644 --- a/Xbim.InformationSpecifications/Facets/buildingSMART/PartOfFacet.cs +++ b/Xbim.InformationSpecifications/Facets/buildingSMART/PartOfFacet.cs @@ -200,7 +200,10 @@ public PartOfRelation GetRelation() /// public void SetRelation(PartOfRelation value) { - EntityRelation = value.ToString(); + if (value == PartOfRelation.Undefined) + EntityRelation = string.Empty; + else + EntityRelation = value.ToString(); } /// diff --git a/Xbim.InformationSpecifications/IO/Xids.Io.xml.cs b/Xbim.InformationSpecifications/IO/Xids.Io.xml.cs index d434658..c19d3d7 100644 --- a/Xbim.InformationSpecifications/IO/Xids.Io.xml.cs +++ b/Xbim.InformationSpecifications/IO/Xids.Io.xml.cs @@ -265,12 +265,17 @@ private static void ExportBuildingSmartIDS(IFacet facet, XmlWriter xmlWriter, bo case PartOfFacet pof: xmlWriter.WriteStartElement("partOf", IdsNamespace); WriteFacetBaseAttributes(pof, xmlWriter, logger, forRequirement, requirementOption); - xmlWriter.WriteAttributeString("relation", pof.EntityRelation.ToString()); + if (pof.GetRelation() != PartOfFacet.PartOfRelation.Undefined) + xmlWriter.WriteAttributeString("relation", pof.GetRelation().ToString().ToUpperInvariant()); if (pof.EntityType is not null) { // todo: review the forRequirement parameter here ExportBuildingSmartIDS(pof.EntityType, xmlWriter, false, logger, context, null); } + else + { + logger?.LogError("Invalid null EntityType in partOf facet for buildingSmart requirements."); + } xmlWriter.WriteEndElement(); break; default: @@ -542,8 +547,16 @@ static private void WriteFacetBaseElements(FacetBase cf, XmlWriter xmlWriter) } else { - var main = XElement.Parse(File.ReadAllText(fileName)); - return LoadBuildingSmartIDS(main, logger); + try + { + var main = XElement.Parse(File.ReadAllText(fileName)); + return LoadBuildingSmartIDS(main, logger); + } + catch (Exception ex) + { + logger?.LogError(ex, $"{ex.Message}"); + return null; + } } } diff --git a/Xbim.InformationSpecifications/Xbim.InformationSpecifications.csproj b/Xbim.InformationSpecifications/Xbim.InformationSpecifications.csproj index 133eaa5..db47e4e 100644 --- a/Xbim.InformationSpecifications/Xbim.InformationSpecifications.csproj +++ b/Xbim.InformationSpecifications/Xbim.InformationSpecifications.csproj @@ -19,7 +19,7 @@ Xbim.InformationSpecifications Xbim.InformationSpecifications - 0.3.43 + 0.3.44 $(AssemblyVersion) $(AssemblyVersion) @@ -49,7 +49,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/Xbim.InformationSpecifications/Xids.AssemblyVersion.cs b/Xbim.InformationSpecifications/Xids.AssemblyVersion.cs index 91bf5c0..1928090 100644 --- a/Xbim.InformationSpecifications/Xids.AssemblyVersion.cs +++ b/Xbim.InformationSpecifications/Xids.AssemblyVersion.cs @@ -7,6 +7,6 @@ public partial class Xids /// This is useful for environments that do not allow to load information from the DLL dynamically /// (e.g. Blazor). /// - public static string AssemblyVersion => "0.3.43"; + public static string AssemblyVersion => "0.3.44"; } }