Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Q] Error was thrown for repeated segment groups #256

Open
EloToJaa opened this issue Apr 9, 2024 · 3 comments
Open

[Q] Error was thrown for repeated segment groups #256

EloToJaa opened this issue Apr 9, 2024 · 3 comments

Comments

@EloToJaa
Copy link

EloToJaa commented Apr 9, 2024

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

@cleftheris
Copy link
Contributor

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.

@EloToJaa
Copy link
Author

I wrote the test like you asked

@EloToJaa
Copy link
Author

EloToJaa commented Jun 3, 2024

Thank you for putting in the work and making this library available.
@cleftheris are there any updates on this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants