Jump to content

.Net is throwing exceptions out of nowhere.

I'm failing to understand why .Net want's to ruin my morning. 1st off, what is it trying to compare, 2nd off, why?

58f359475f223_Screenshot(22).thumb.png.1df202c4a9e109b1e420f852b39e8c8b.png

Brah, do you even Java?

Link to comment
Share on other sites

Link to post
Share on other sites

Exception says about comparing two elements of array and about invalid string format.

Maybe it highlighted wrong line, I would guess that it is Array.Sort where error occurred, maybe CompareFiles, have you implemented it yourself?

Link to comment
Share on other sites

Link to post
Share on other sites

Has the provinceNumbers.Lenght variable anything in it? Try to declare the provinceNumbers list first. Secondly, I assume you haven't added anything to the provinceNumbers list yet so you are creating tempProvinceNubers array with size of 0 (and you cannot change the size of array since declaration).

Link to comment
Share on other sites

Link to post
Share on other sites

2 hours ago, Mr_KoKa said:

Exception says about comparing two elements of array and about invalid string format.

Maybe it highlighted wrong line, I would guess that it is Array.Sort where error occurred, maybe CompareFiles, have you implemented it yourself?

Yeah, it looks to possibly be in Array.Sort, but the MSDN says that Array.Sort(Array, Array) will throw InvalidOperationException when "One or more elements in the keysArray do not implement the IComparable interface". However, it appears that his keysArray is of type String[], which works just fine using Array.Sort(String[]), so I have no idea what's going on there. 

Link to comment
Share on other sites

Link to post
Share on other sites

5 hours ago, Mr_KoKa said:

Exception says about comparing two elements of array and about invalid string format.

Maybe it highlighted wrong line, I would guess that it is Array.Sort where error occurred, maybe CompareFiles, have you implemented it yourself?

Yeah, found out the it wasn't able to get the location properly because optimze code was on. It came from Array.Sort().

4 hours ago, Merkey said:

Has the provinceNumbers.Lenght variable anything in it? Try to declare the provinceNumbers list first. Secondly, I assume you haven't added anything to the provinceNumbers list yet so you are creating tempProvinceNubers array with size of 0 (and you cannot change the size of array since declaration).

provinceNumbers.Length does have a size, but I didn't think to put in a check for it. I will do that later.

 

2 hours ago, Pinguinsan said:

Yeah, it looks to possibly be in Array.Sort, but the MSDN says that Array.Sort(Array, Array) will throw InvalidOperationException when "One or more elements in the keysArray do not implement the IComparable interface". However, it appears that his keysArray is of type String[], which works just fine using Array.Sort(String[]), so I have no idea what's going on there. 

Yeah, Array.Sort was and wasn't the problem. It came from CompareFiles.

Brah, do you even Java?

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×