|
Irbos 0 / 0 / 0 Регистрация: 27.03.2018 Сообщений: 189 |
||||
|
1 |
||||
|
.NET Core 13.03.2021, 13:04. Показов 5688. Ответов 3 Метки нет (Все метки)
На строчке ret = br.ReadSingle(); выдаёт эту ошибку.
__________________
0 |
|
Programming Эксперт 94731 / 64177 / 26122 Регистрация: 12.04.2006 Сообщений: 116,782 |
13.03.2021, 13:04 |
|
Ответы с готовыми решениями: Ошибка времени выполнения unable to read beyond the end of stream Пробная база данных.EndOfException: Unable to read the end of the stream (после попытки чтения первой строки) Вывод типизированного файла «unable to read beyond the end of the stream» stream.read(v,stream.size); //здесь ошибка при исполнении 3 |
|
Администратор
15226 / 12265 / 4902 Регистрация: 17.03.2014 Сообщений: 24,867 Записей в блоге: 1 |
|
|
13.03.2021, 13:41 |
2 |
|
Irbos, какая длина у файла?
0 |
|
0 / 0 / 0 Регистрация: 27.03.2018 Сообщений: 189 |
|
|
13.03.2021, 13:52 [ТС] |
3 |
|
OwenGlendower, там несколько файлов и у них разная длина, но она больше чем 18 байт примерно 1000-100к
0 |
|
OwenGlendower Администратор
15226 / 12265 / 4902 Регистрация: 17.03.2014 Сообщений: 24,867 Записей в блоге: 1 |
||||
|
13.03.2021, 14:08 |
4 |
|||
|
Решение
она больше чем 18 байт Очевидно нет раз выдается исключение о невозможности чтения. Добавлено через 2 минуты
1 |
The testing.res file is 240MB size.
I want to read it. But im getting the error on this line:
int v = br.ReadInt32();
EndOfStreamException
Unable to read beyond the end of the stream
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
R();
}
private void Form1_Load(object sender, EventArgs e)
{
}
public void R()
{
using (var br = new System.IO.BinaryReader(File.Open(@"d:testing.res", FileMode.Open)))
{
// 2.
// Position and length variables.
int pos = 0;
// 2A.
// Use BaseStream.
int length = (int)br.BaseStream.Length;
while (br.BaseStream.Position < length)
{
// 3.
// Read integer.
int v = br.ReadInt32();
textBox1.Text = v.ToString();
}
}
}
}
}
The exception:
System.IO.EndOfStreamException was unhandled
Message=Unable to read beyond the end of the stream.
Source=mscorlib
StackTrace:
at System.IO.BinaryReader.FillBuffer(Int32 numBytes)
at System.IO.BinaryReader.ReadInt32()
at WindowsFormsApplication1.Form1.R() in D:C-SharpBinaryReaderWindowsFormsApplication1WindowsFormsApplication1Form1.cs:line 41
at WindowsFormsApplication1.Form1..ctor() in D:C-SharpBinaryReaderWindowsFormsApplication1WindowsFormsApplication1Form1.cs:line 19
at WindowsFormsApplication1.Program.Main() in D:C-SharpBinaryReaderWindowsFormsApplication1WindowsFormsApplication1Program.cs:line 18
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
- Remove From My Forums
-
Question
-
private void button1_Click(object sender, EventArgs e)
{
fs = new FileStream(Directory.GetCurrentDirectory() + "\FTask.dat", FileMode.Append);
BinaryWriter writer = new BinaryWriter(fs);writer.Write(txtName.Text);
writer.Write(txtNickName.Text);if (rdoMale.Checked == true)
writer.Write("Male");
else
writer.Write("Female");writer.Write(txtAge.Text);
writer.Write(dtpBirthDate.Value.ToShortDateString());
writer.Write(txtEmail.Text);
writer.Write(txtPhone.Text);
writer.Write(cbxStatus.SelectedItem.ToString());
writer.Close();}
private void frmOrganizer_Load(object sender, EventArgs e) { fs = new FileStream(Directory.GetCurrentDirectory() + "\FTask.dat", FileMode.Open); BinaryReader reader = new BinaryReader(fs); while (fs.Position < fs.Length) { txtName.Text = reader.ReadString(); txtNickName.Text = reader.ReadString(); if (reader.ReadBoolean() == true) rdoMale.Checked = true; else rdoFemale.Checked = true; txtAge.Text = reader.ReadString(); dtpBirthDate.Value = Convert.ToDateTime(reader.ReadString()); txtEmail.Text = reader.ReadString(); txtPhone.Text = reader.ReadString(); cbxStatus.SelectedItem = reader.ReadString(); } reader.Close(); }
-
Edited by
Saturday, June 15, 2013 3:32 PM
-
Edited by
Answers
-
I do not think you have to use a while loop, but you must write and read the exact kind of data in correct order.
For writing try this:
writer.Write(txtName.Text); writer.Write(txtNickName.Text); writer.Write(rdoMale.Checked); writer.Write(txtAge.Text); writer.Write(dtpBirthDate.Value.ToBinary()); writer.Write(txtEmail.Text); writer.Write(txtPhone.Text); writer.Write(cbxStatus.SelectedItem.ToString());
For reading, remove the while line (or replace with if, which checks that the file is not empty) and try this:
txtName.Text = reader.ReadString(); txtNickName.Text = reader.ReadString(); rdoMale.Checked = reader.ReadBoolean(); txtAge.Text = reader.ReadString(); dtpBirthDate.Value = DateTime.FromBinary(reader.ReadInt64()); txtEmail.Text = reader.ReadString(); txtPhone.Text = reader.ReadString(); cbxStatus.SelectedItem = reader.ReadString();
(If cbxStatus does not contain strings, then it has to be saved in different manner. Show some details about
cbxStatus items if the last line does not work).-
Edited by
Viorel_MVP
Sunday, June 16, 2013 7:40 AM -
Proposed as answer by
Mike Feng
Monday, June 17, 2013 1:27 AM -
Marked as answer by
Mike Feng
Monday, June 24, 2013 2:30 PM
-
Edited by
Узнай цену своей работы
Формулировка задачи:
Ошибка на 11-ой строке. Обясните пожалуйста чём причина.
Код к задаче: «Ошибка времени выполнения unable to read beyond the end of stream»
textual
Листинг программы
assign(i,'C:Seva`s gamesa'); rewrite(i); close(i);
Полезно ли:
12 голосов , оценка 4.000 из 5
Похожие ответы
- Не работает if r = 2 then begin
- Выдает ошибку
- Ошибка в готовой программе
- Ошибка в построении
- Ошибка при вводе значений массива
- Вывод сообщения если строка пустая после выполнения алгоритма
- Ошибка в разделе type
- Ошибка в программе «встречено ‘.’, а ожидвлось «
- Ошибка в типизированном файле
- Добавить меню выбора режима шифрование, расшифровка. Проверку цифр ( если отрицательное число-ошибка)
- Выяснить, предшествует ли время t времени t1
Same here after updating to 2.105.923.0
But after the EndOfStreamException I also have a ErrorException
«Evaluation resulted in a stack overflow and cannot continue.»
DataMashup.Trace Warning: 24579 : {"Start":"2022-05-30T22:57:07.1510658Z","Action":"ErrorTranslatingMessenger/Read","Exception":"Exception:
ExceptionType: System.IO.EndOfStreamException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Message: Unable to read beyond the end of the stream.
StackTrace:
at System.IO.__Error.EndOfFile()
at System.IO.BinaryReader.FillBuffer(Int32 numBytes)
at System.IO.BinaryReader.ReadInt32()
at Microsoft.Mashup.Evaluator.MessageSerializer.Deserialize(BinaryReader reader)
at Microsoft.Mashup.Evaluator.StreamMessenger.Read()
at Microsoft.Mashup.Evaluator.ErrorTranslatingMessenger.MessageChannel.Read()
","ProductVersion":"2.105.923.0 (22.05)","ActivityId":"00000000-0000-0000-0000-000000000000","Process":"msmdsrv","Pid":3876,"Tid":13,"Duration":"00:00:00.0261973"}
DataMashup.Trace Warning: 24579 : {"Start":"2022-05-30T22:57:07.1772767Z","Action":"ErrorTranslatingMessenger/Read","Exception":"Exception:
ExceptionType: Microsoft.Mashup.Evaluator.Interface.ErrorException, Microsoft.MashupEngine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
Message: Evaluation resulted in a stack overflow and cannot continue.
StackTrace:
at Microsoft.Mashup.Evaluator.ErrorTranslatingMessenger.MessageChannel.Read()
at Microsoft.Mashup.Evaluator.ErrorTranslatingMessenger.MessageChannel.Read()
","ProductVersion":"2.105.923.0 (22.05)","ActivityId":"00000000-0000-0000-0000-000000000000","Process":"msmdsrv","Pid":3876,"Tid":13,"Duration":"00:00:00.0009396"}
DataMashup.Trace Warning: 24579 : {"Start":"2022-05-30T22:57:07.1798885Z","Action":"RemoteDocumentEvaluator/RemoteEvaluation/TranslateCancelExceptions","HostProcessId":"3876","identity":null,"evaluationID":"1","cancelled":"False","Exception":"Exception:
ExceptionType: Microsoft.Mashup.Evaluator.Interface.ErrorException, Microsoft.MashupEngine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
Message: Evaluation resulted in a stack overflow and cannot continue.
StackTrace:
at Microsoft.Mashup.Evaluator.ErrorTranslatingMessenger.MessageChannel.Read()
at Microsoft.Mashup.Evaluator.ErrorTranslatingMessenger.MessageChannel.Read()
at Microsoft.Mashup.Evaluator.ChannelMessenger.Read(MessageChannel channel)
at Microsoft.Mashup.Evaluator.ChannelMessenger.MessageChannel.Read()
at Microsoft.Mashup.Evaluator.Interface.IMessageChannelExtensions.WaitFor[T](IMessageChannel channel)
at Microsoft.Mashup.Evaluator.MessageBasedInputStream.ReadNextChunkAndCheckIfClosed()
at Microsoft.Mashup.Evaluator.MessageBasedInputStream.ReadNextChunk()
","ProductVersion":"2.105.923.0 (22.05)","ActivityId":"c6a66d1e-8ac3-4e4c-8c83-13384f19af9c","Process":"msmdsrv","Pid":3876,"Tid":13,"Duration":"00:00:00.0000616"}
And after that impossible to cancel the refresh, I have to kill the process.
thats a permission issue. you didnt follow the install instructions correctly.
**How to Install:**
**+** Stop your Torrent from seeding (close it, maybe check your task manager)
**+** Move the Warhammer Online — Return of Reckoning outside the ReturnofReckoning-March2020 folder and move it to c: … for instance move it to c:Games
(but **NOT** inside c: Program Files or c: Program Files (x86); it should be in a folder which it have write access)
**+** Remove the write-protection from all the files in the Warhammer Online — Return of Reckoning folder.
(right click on the War Online — RoR folder > properties > disable the read-only box)
**+** Check that your whole Warhammer Online — Return of Reckoning folder is whitelisted in your Antivirus program and check if your Firewall or Maleware doesn’t interfere with the install.
**+** You may also try running the launcher with Administrator privileges.
(Right click on the RoRLauncher.exe > properties > run administrator)
**+** Run the RoRLauncher.exe
**+** Let it update (sometimes it needs a few seconds until it starts)
**+** Exit launcher and rerun it again
**+** Repeat the last 2-steps until there is no update left
**+** Launch the game
**!!!** [If you don’t have DirectX 9.0c, installed it is required, and now this is also included in the torrent. In the ReturnOfReckoning-March2020 folder find the dx90c folder, open that and run DXSETUP.exe]
Сообщение было отмечено Irbos как решение
