Skip to content

Missing dependency not reflected in exception when using WriteRecords (but is with WriteRecord) #2361

@jhdepoys

Description

@jhdepoys

Describe the bug

An unknown issue was occurring in the release version of our software with use of the CSVHelper library which was not occurring in our debug version. The only information we were getting in the exception was showing the writer state.

An unexpected error occurred.

IWriter state:

Row: 1

Index: 0

HeaderRecord:

1

After converting the code to manually write each record, the exception finally stated that the code couldn't find the dependency "Microsoft.Bcl.HashCode.dll". Indeed this file was missing in our release setup.

Could not load file or assembly 'Microsoft.Bcl.HashCode, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.

To Reproduce

With a simple example of a list of string, call CsvWriter.WriteRecords when the dependency "Microsoft.Bcl.HashCode.dll" is missing.

Expected behavior

A better exception when using WriteRecords to reflect the missing dependency.

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions