EDI.Net
EDI.Net copied to clipboard
[Q] Error was thrown for repeated segment groups
Code that was run
EloToJaa/EDI Program.cs INVOIC EdiMessage
INVOIC was created based on stylusstudio using EDIFACT D97A
Error details
indice.Edi.EdiException
HResult=0x80131500
Message=More than one properties on type 'INVOIC' have the 'SegmentGroup' attribute. Please add a 'Condition' attribute to all properties in order to discriminate where each SegmentGroup will go.
Source=indice.Edi
StackTrace:
at indice.Edi.EdiSerializer.ConditionalMatch(EdiReader reader, EdiStructure currentStructure, EdiStructureType newContainerType, EdiPropertyDescriptor[] candidates)
at indice.Edi.EdiSerializer.FindForCurrentSegment(EdiReader reader, EdiStructure currentStructure, EdiStructureType newContainerType)
at indice.Edi.EdiSerializer.TryCreateContainer(EdiReader reader, Stack`1 stack, EdiStructureType newContainer)
at indice.Edi.EdiSerializer.DeserializeInternal(EdiReader reader, Type objectType)
at indice.Edi.EdiSerializer.Deserialize(EdiReader reader, Type objectType)
at indice.Edi.EdiSerializer.Deserialize(TextReader reader, IEdiGrammar grammar, Type objectType)
at indice.Edi.EdiSerializer.Deserialize[T](TextReader reader, IEdiGrammar grammar)
at Edi.Program.CheckParse() in C:\PATH\edi\Edi\Program.cs:line 33
at Edi.Program.Main(String[] args) in C:\PATH\edi\Edi\Program.cs:line 13
Cause of the problem
It seems like this problem was caused by segment groups with repeated segments (SG6 & SG51).
I would appreciate any help on how to deal with this Exception
Hi @EloToJaa,
thanks for your interest in the library. Do you think it would be easy to isolate the problem into a test with a pull request so I can take a look. Add your models a sample transmission and a test.
C.
I wrote the test like you asked
Thank you for putting in the work and making this library available. @cleftheris are there any updates on this issue?