diff --git a/appveyor.yml b/appveyor.yml index 0af3fc4..3aa1693 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,4 +1,4 @@ -version: 1.9.17.{build} +version: 1.9.18.{build} image: Visual Studio 2019 configuration: Release platform: Any CPU diff --git a/src/indice.Edi/EdiSerializer.cs b/src/indice.Edi/EdiSerializer.cs index 77c517a..2fafffd 100644 --- a/src/indice.Edi/EdiSerializer.cs +++ b/src/indice.Edi/EdiSerializer.cs @@ -662,7 +662,7 @@ private static Dictionary SearchForward(EdiReader reader, Queue< reader.Read(); cache.Enqueue(new EdiEntry(reader.Path, reader.TokenType, reader.Value as string)); } - } while (!found || reader.TokenType != EdiToken.SegmentStart); + } while (!found && reader.TokenType != EdiToken.SegmentStart); if (found) { searchResults[path] = value; diff --git a/src/indice.Edi/indice.Edi.csproj b/src/indice.Edi/indice.Edi.csproj index 87fe878..9bef7ca 100644 --- a/src/indice.Edi/indice.Edi.csproj +++ b/src/indice.Edi/indice.Edi.csproj @@ -3,7 +3,7 @@ Edi.Net Class Library Copyright (c) 2015 Indice Edi.Net - 1.9.17 + 1.9.18 c.leftheris net40;net45;netstandard1.0;netstandard1.3;netstandard2.0 @@ -29,6 +29,7 @@ - Bug fix related to nested segment group structures with the same segment name #172. - Bug fix for Wildcard paths working only for collections #170. - Fix for segment collection serialization. When some collection items where being serialized as elements instead #168. + - Fix missing path (non existing) on condition attirute should not enter infinite loop #188 icon-256.png https://github.com/indice-co/EDI.Net diff --git a/test/indice.Edi.Tests/EdiTextReaderTests.cs b/test/indice.Edi.Tests/EdiTextReaderTests.cs index e32c0df..d37485a 100644 --- a/test/indice.Edi.Tests/EdiTextReaderTests.cs +++ b/test/indice.Edi.Tests/EdiTextReaderTests.cs @@ -1061,22 +1061,19 @@ public void EdiFact_Issue174() { Assert.Equal(3, interchange.Msg.VehicleRecord.GIR_List.Count); } - [Fact(Skip = "This test will eat all your memory. Change the Path on the two EdiCondition attributes to UNH/1/0, and it works.")] + [Fact] [Trait(Traits.Tag, "EDIFact"), Trait(Traits.Issue, "#188")] - public void EdiFact_Issue188() { + public void EdiFact_MissingPath_On_Condition_Doesnot_enter_InfiniteLoop_Issue188() { var grammar = EdiGrammar.NewEdiFact(); var interchange = default(Models.Interchange_Issue188); using (var stream = Helpers.GetResourceStream("edifact.Issue188.edi")) { interchange = new EdiSerializer().Deserialize(new StreamReader(stream), grammar); } + // This test originally would eat all your memory. + // There is a misconfiguration made in order to trigger the bug that makes the SearchForward function to enter into an infinite loop. + // The correct configuration to change the Path on the two EdiCondition attributes to UNH/1/0, and it works. - Assert.Equal(2, interchange.IftminMessages.Count); - Assert.Equal("20210319", interchange.IftminMessages[0].DTMs[0].Value); - Assert.Equal("20210320", interchange.IftminMessages[1].DTMs[0].Value); - - Assert.Equal(2, interchange.InvoiceMessages.Count); - Assert.Equal("20210322", interchange.InvoiceMessages[0].DTMs[0].Value); - Assert.Equal("20210323", interchange.InvoiceMessages[1].DTMs[0].Value); + Assert.Equal(0, interchange.IftminMessages.Count); } } } diff --git a/test/indice.Edi.Tests/indice.Edi.Tests.csproj b/test/indice.Edi.Tests/indice.Edi.Tests.csproj index 56f59ba..ef6233b 100644 --- a/test/indice.Edi.Tests/indice.Edi.Tests.csproj +++ b/test/indice.Edi.Tests/indice.Edi.Tests.csproj @@ -2,7 +2,7 @@ indice.Edi.Tests Class Library - netcoreapp3.0 + netcoreapp3.1 false @@ -22,13 +22,16 @@ - - + + all runtime; build; native; contentfiles; analyzers - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive +