-
When I try to read my EDI file, I get the following error:
"Could not load file or assembly 'AssemblyName' or one of its dependencies. The system cannot find the file specified."
How to resolve it?
The error message means that there is no reference to the aforementioned assembly. The assembly name is specified in the reader constructor like this:
using (var ediReader = new X12Reader(ediStream, "AssemblyName"))
Internally the parser uses Assembly.Load(AssemblyName), where the assembly name can be found in the project references.
For example - to read EDI files, according to EDI templates that are compiled as part of a project named "EdiFabric.Templates.X12" with assembly name:
you need to:
-
Add a reference to that project
-
Use the exact assembly name in the reader constructor
var ediReader = new X12Reader(ediStream, "EdiFabric.Templates.X12")
-
-
When writing directly to a file, sometimes you may unexpectedly get 3 extra characters written at the beginning of the file:
0xef, 0xbb, and 0xbf
How to prevent it from happening?
This is due to the encoding. By default, the writer uses UTF8 and initializes it with Encoding.UTF8 , which is a UTF8Encoding object that provides a Unicode byte order mark (BOM).
To instantiate a writer that doesn't provide a BOM, call it with an overload of the UTF8Encoding constructor:
var writer = new X12Writer(customFilename,
new X12WriterSettings { Encoding = new UTF8Encoding() }); -
The ReaderErrorContext is an IEdiItem that is returned in one of the following situations:
- Control segments can't be parsed, e.g., issues with either X12 Control Segments or EDIFACT Control Segments
- Segments were found outside of any message, group, or interchange
- The end of the file was reached, but trailer segments are missing
- The transaction type and version can't be identified from ST and GS for X12 and from UNH for EDIFACT
- Can't find a matching EDI template for the transaction being parsed
- A duplicate EDI template was found in the same assembly
- The EDI stream is null
- Any unknown exception that was thrown internally
-
The error message means that you are still using the trial. Follow all the steps in the How to upgrade from the trial article, as suggested in the order email.
Comments
0 comments
Please sign in to leave a comment.