[BulkInsert] I got an ArgumentOutOfRangeException
Question
bulkinsert
Service icon
Forge component by Galter

Hi,

An ArgumentOutOfRangeException has occurred.

Can you tell me what is happening?



Best Regart,



Hi @Shohei Nakata , can you share your OML or a sample with the thing that you are trying to do?

Hi,


I don't have permissions so I can't provide samples or OML files.

I would like to know when this happens.

Hi @Shohei Nakata , ok. But if you don’t find the root cause based in Aj. Answer, you can try to build a sample oml, and share with us.

Hello @Shohei Nakata,

The 'ArgumentOutOfRange' exception can happen for a variety of reasons. Since you mentioned you are doing a bulk insert the likely root causes 'may' be:

1. If you have invalid data for e.g. a badly formed/ invalid date.

2. If there is a data type or attribute name mis-match.

3. If you are referencing a value in a list by its index number or attempting to add a value using an index number, and the index number is invalid.

4. If you try to extract a substring that is outside the range of a given string.

Hope that gives you an idea of where to look for a root cause,

Regards,

AJ

The exception that is thrown when the value of an argument is outside the allowable range of values as defined by the invoked method. Indexing an empty list will always throw an exception. Use a method like Add to append the item to the end of the list, or Insert to place the item in the middle of the list somewhere, etc. You cannot index into a C# list if that offset doesn't exist.

Typically, an ArgumentOutOfRangeException results from developer error. Instead of handling the exception in a try/catch block, you should eliminate the cause of the exception or, if the argument is returned by a method call or input by the user before being passed to the method that throws the exception, you should validate arguments before passing them to the method.



Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.