Arama butonu
Bu konudaki kullanıcılar: 1 misafir
0
Cevap
694
Tıklama
0
Öne Çıkarma
C# - ArgumentOutOfRangeException Nedeni
D
9 yıl
Yüzbaşı
Konu Sahibi

Herkese Merhabalar,

MONO Lib ile çalışıyorum. Elimdeki kod tamamen doğru bir hata yok kesinlikle eminim yani. Daha öncedende kullandım ve sorunsuz çalışıyordu.

EDIT: Kullanabilmek için dosyayı byte[] 'a çevirmek gerekiyor.
EDIT2: Konuyu yanlışlıkla Python bölümüne açmışım. Yönetici biri taşırsa sevinirim.

Kodun amacı ;

"KEY"="ENGLISH"
"KEY1","ENGLISH1"

gibi satırların 1.değerini Key'e, 2.değerini Value 'e aktarmak. Tabiki bir dictionary'e.

Şimdi kullandığım zaman mono bana "ArgRange_Array" hatası döndürüyor.

ERROR OUTPUT :


ArgumentOutOfRangeException: ArgRange_Array
Parameter name: count
System.Text.UTF8Encoding.InternalGetCharCount (System.Byte[] bytes, Int32 index, Int32 count, UInt32 leftOverBits, UInt32 leftOverCount, System.Object provider, System.Text.DecoderFallbackBuffer& fallbackBuffer, System.Byte[]& bufferArg, Boolean flush) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Text/UTF8Encoding.cs:462)
System.Text.UTF8Encoding.GetCharCount (System.Byte[] bytes, Int32 index, Int32 count) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Text/UTF8Encoding.cs:687)
System.Text.Encoding.GetChars (System.Byte[] bytes, Int32 index, Int32 count) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Text/Encoding.cs:328)
System.Text.Encoding.GetString (System.Byte[] bytes, Int32 index, Int32 count) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Text/Encoding.cs:751)
System.Text.UTF8Encoding.GetString (System.Byte[] bytes, Int32 index, Int32 count) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Text/UTF8Encoding.cs:1052)


HATA verdiği yer :


//Hatayı tam bu satırda veriyor, count değeri -1 geliyor.

return Encoding.UTF8.GetString(buffer, start, count);


ÇÖZÜLDÜ: Bunu yazarken aklıma geldi, Satırı okumadan önce offset'i arttırıyormuşum, okuduktan sonra arttırdım ve çalıştı.





< Bu mesaj bu kişi tarafından değiştirildi Dentrax -- 24 Kasım 2016; 18:22:28 >

DH Mobil uygulaması ile devam edin. Mobil tarayıcınız ile mümkün olanların yanı sıra, birçok yeni ve faydalı özelliğe erişin. Gizle ve güncelleme çıkana kadar tekrar gösterme.