Unable to read beyond the end of the stream раст ошибка

Irbos

0 / 0 / 0

Регистрация: 27.03.2018

Сообщений: 189

1

.NET Core

13.03.2021, 13:04. Показов 5688. Ответов 3

Метки нет (Все метки)


На строчке ret = br.ReadSingle(); выдаёт эту ошибку.
«System.IO.EndOfStreamException: «Unable to read beyond the end of the stream.»»

C#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
            float ret = 0.0f;
 
            string finalPath = g_Path_Main + @"" + FilePath;
 
            if (!File.Exists(finalPath))
                return ret;
 
            using (var fs = new FileStream(finalPath, FileMode.Open))
            {
                using (var br = new BinaryReader(fs))
                {
                    br.BaseStream.Position += 18;
 
                    ret = br.ReadSingle();
                }
            }
 
            return ret;

__________________
Помощь в написании контрольных, курсовых и дипломных работ, диссертаций здесь

0

Programming

Эксперт

94731 / 64177 / 26122

Регистрация: 12.04.2006

Сообщений: 116,782

13.03.2021, 13:04

Ответы с готовыми решениями:

Ошибка времени выполнения unable to read beyond the end of stream
uses graphabc;
var a, b, c:integer;
i:file of integer;
begin
SetWindowWidth(500);…

Пробная база данных.EndOfException: Unable to read the end of the stream (после попытки чтения первой строки)
Написал на С# учебно-тренировочную базу данных,но работать
она не хочет.Прошу помочь…

Вывод типизированного файла «unable to read beyond the end of the stream»
uses crt;
label 1,2;
var f1:file of integer;
x,i,i1,i2,n:integer;
begin
assign(f1,…

stream.read(v,stream.size); //здесь ошибка при исполнении
var
stream:Tfilestream;
v:variant;
begin

3

Администратор

Эксперт .NET

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

Администратор

Эксперт .NET

15226 / 12265 / 4902

Регистрация: 17.03.2014

Сообщений: 24,867

Записей в блоге: 1

13.03.2021, 14:08

4

Лучший ответ Сообщение было отмечено Irbos как решение

Решение

Цитата
Сообщение от Irbos
Посмотреть сообщение

она больше чем 18 байт

Очевидно нет раз выдается исключение о невозможности чтения.

Добавлено через 2 минуты
Попробуйте добавить проверку

C#
1
2
3
4
5
6
7
8
9
10
11
12
13
using (var fs = new FileStream(finalPath, FileMode.Open))
{
    const int start = 18;
    if (fs.Length >= start+sizeof(float))
    {
        using (var br = new BinaryReader(fs))
        {
            br.BaseStream.Position = start;
 
            ret = br.ReadSingle();
        }
    }
}

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

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

Формулировка задачи:

Ошибка на 11-ой строке. Обясните пожалуйста чём причина.

Код к задаче: «Ошибка времени выполнения unable to read beyond the end of stream»

textual

Листинг программы

assign(i,'C:Seva`s gamesa');
rewrite(i);
close(i);

Полезно ли:

12   голосов , оценка 4.000 из 5

Похожие ответы

  1. Не работает if r = 2 then begin
  2. Выдает ошибку
  3. Ошибка в готовой программе
  4. Ошибка в построении
  5. Ошибка при вводе значений массива
  6. Вывод сообщения если строка пустая после выполнения алгоритма
  7. Ошибка в разделе type
  8. Ошибка в программе «встречено ‘.’, а ожидвлось «
  9. Ошибка в типизированном файле
  10. Добавить меню выбора режима шифрование, расшифровка. Проверку цифр ( если отрицательное число-ошибка)
  11. Выяснить, предшествует ли время 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.
MarcVL_0-1653952981408.png

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]

Describe the bug

When I double click the left mouse button a hoodwink.vmdl_c file an «Unable to read beyond the end of the stream» error appears. If you click on the ‘Continue’ button, it opens a tab hoodwink.vmdl_c with emty subtab MODEL.

************** Exception Text **************
System.IO.EndOfStreamException: Unable to read beyond the end of the stream.
   at System.IO.BinaryReader.InternalRead(Int32 numBytes)
   at System.IO.BinaryReader.ReadInt16()
   at ValveResourceFormat.ResourceTypes.ModelAnimation.Animation.ReadSegment(Int64 frame, IKeyValueCollection segment, IKeyValueCollection decodeKey, AnimDecoderType[] decoderArray, Frame& outFrame) in D:aValveResourceFormatValveResourceFormatValveResourceFormatResourceResourceTypesModelAnimationAnimation.cs:line 225
   at ValveResourceFormat.ResourceTypes.ModelAnimation.Animation.ConstructFromDesc(IKeyValueCollection animDesc, IKeyValueCollection decodeKey, AnimDecoderType[] decoderArray, IKeyValueCollection[] segmentArray) in D:aValveResourceFormatValveResourceFormatValveResourceFormatResourceResourceTypesModelAnimationAnimation.cs:line 190
   at ValveResourceFormat.ResourceTypes.ModelAnimation.Animation..ctor(IKeyValueCollection animDesc, IKeyValueCollection decodeKey, AnimDecoderType[] decoderArray, IKeyValueCollection[] segmentArray) in D:aValveResourceFormatValveResourceFormatValveResourceFormatResourceResourceTypesModelAnimationAnimation.cs:line 28
   at ValveResourceFormat.ResourceTypes.ModelAnimation.Animation.<>c__DisplayClass17_0.<FromData>b__0(IKeyValueCollection anim) in D:aValveResourceFormatValveResourceFormatValveResourceFormatResourceResourceTypesModelAnimationAnimation.cs:line 44
   at System.Linq.Enumerable.SelectArrayIterator`2.MoveNext()
   at System.Collections.Generic.List`1.InsertRange(Int32 index, IEnumerable`1 collection)
   at ValveResourceFormat.ResourceTypes.Model.GetEmbeddedAnimations() in D:aValveResourceFormatValveResourceFormatValveResourceFormatResourceResourceTypesModel.cs:line 109
   at GUI.Types.Renderer.ModelSceneNode.LoadAnimations() in D:aValveResourceFormatValveResourceFormatGUITypesRendererModelSceneNode.cs:line 214
   at GUI.Types.Renderer.ModelSceneNode..ctor(Scene scene, Model model, String skin, Boolean loadAnimations) in D:aValveResourceFormatValveResourceFormatGUITypesRendererModelSceneNode.cs:line 67
   at GUI.Types.Renderer.GLModelViewer.LoadScene() in D:aValveResourceFormatValveResourceFormatGUITypesRendererGLModelViewer.cs:line 74
   at GUI.Types.Renderer.GLSceneViewer.OnLoad(Object sender, EventArgs e) in D:aValveResourceFormatValveResourceFormatGUITypesRendererGLSceneViewer.cs:line 85
   at GUI.Controls.GLViewerControl.OnLoad(Object sender, EventArgs e) in D:aValveResourceFormatValveResourceFormatGUIControlsGLViewerControl.cs:line 246
   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   at System.Windows.Forms.Control.CreateControl()
   at System.Windows.Forms.Control.SetVisibleCore(Boolean value)
   at System.Windows.Forms.TabControl.UpdateTabSelection(Boolean updateFocus)
   at System.Windows.Forms.TabControl.OnHandleCreated(EventArgs e)
   at System.Windows.Forms.Control.WmCreate(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.TabControl.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, WM msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
System.Private.CoreLib
    Assembly Version: 5.0.0.0
    Win32 Version: 5.0.721.25508
    CodeBase: file:///C:/Users/Username/AppData/Local/Temp/.net/VRF/pptqb30n.dwq/System.Private.CoreLib.dll
----------------------------------------
VRF
    Assembly Version: 0.1.9.0
    Win32 Version: 0.1.9.731
    CodeBase: file:///C:/Users/Username/AppData/Local/Temp/.net/VRF/pptqb30n.dwq/VRF.dll
----------------------------------------
System.Windows.Forms
    Assembly Version: 5.0.7.0
    Win32 Version: 5.0.721.26307
    CodeBase: file:///C:/Users/Username/AppData/Local/Temp/.net/VRF/pptqb30n.dwq/System.Windows.Forms.dll
----------------------------------------
System.ComponentModel.Primitives
    Assembly Version: 5.0.0.0
    Win32 Version: 5.0.721.25508
    CodeBase: file:///C:/Users/Username/AppData/Local/Temp/.net/VRF/pptqb30n.dwq/System.ComponentModel.Primitives.dll
----------------------------------------
System.Windows.Forms.Primitives
    Assembly Version: 5.0.7.0
    Win32 Version: 5.0.721.26307
    CodeBase: file:///C:/Users/Username/AppData/Local/Temp/.net/VRF/pptqb30n.dwq/System.Windows.Forms.Primitives.dll
----------------------------------------
System.Runtime.InteropServices
    Assembly Version: 5.0.0.0
    Win32 Version: 5.0.721.25508
    CodeBase: file:///C:/Users/Username/AppData/Local/Temp/.net/VRF/pptqb30n.dwq/System.Runtime.InteropServices.dll
----------------------------------------
System.Drawing.Primitives
    Assembly Version: 5.0.0.0
    Win32 Version: 5.0.721.25508
    CodeBase: file:///C:/Users/Username/AppData/Local/Temp/.net/VRF/pptqb30n.dwq/System.Drawing.Primitives.dll
----------------------------------------
System.Collections.Specialized
    Assembly Version: 5.0.0.0
    Win32 Version: 5.0.721.25508
    CodeBase: file:///C:/Users/Username/AppData/Local/Temp/.net/VRF/pptqb30n.dwq/System.Collections.Specialized.dll
----------------------------------------
System.Diagnostics.TraceSource
    Assembly Version: 5.0.0.0
    Win32 Version: 5.0.721.25508
    CodeBase: file:///C:/Users/Username/AppData/Local/Temp/.net/VRF/pptqb30n.dwq/System.Diagnostics.TraceSource.dll
----------------------------------------
System.Console
    Assembly Version: 5.0.0.0
    Win32 Version: 5.0.721.25508
    CodeBase: file:///C:/Users/Username/AppData/Local/Temp/.net/VRF/pptqb30n.dwq/System.Console.dll
----------------------------------------
System.IO.FileSystem
    Assembly Version: 5.0.0.0
    Win32 Version: 5.0.721.25508
    CodeBase: file:///C:/Users/Username/AppData/Local/Temp/.net/VRF/pptqb30n.dwq/System.IO.FileSystem.dll
----------------------------------------
System.Drawing.Common
    Assembly Version: 5.0.0.2
    Win32 Version: 5.0.421.11614
    CodeBase: file:///C:/Users/Username/AppData/Local/Temp/.net/VRF/pptqb30n.dwq/System.Drawing.Common.dll
----------------------------------------
Microsoft.Win32.Primitives
    Assembly Version: 5.0.0.0
    Win32 Version: 5.0.721.25508
    CodeBase: file:///C:/Users/Username/AppData/Local/Temp/.net/VRF/pptqb30n.dwq/Microsoft.Win32.Primitives.dll
----------------------------------------
System.ComponentModel.EventBasedAsync
    Assembly Version: 5.0.0.0
    Win32 Version: 5.0.721.25508
    CodeBase: file:///C:/Users/Username/AppData/Local/Temp/.net/VRF/pptqb30n.dwq/System.ComponentModel.EventBasedAsync.dll
----------------------------------------
Accessibility
    Assembly Version: 4.0.0.0
    Win32 Version: 5.0.721.26307
    CodeBase: file:///C:/Users/Username/AppData/Local/Temp/.net/VRF/pptqb30n.dwq/Accessibility.dll
----------------------------------------
System.Linq
    Assembly Version: 5.0.0.0
    Win32 Version: 5.0.721.25508
    CodeBase: file:///C:/Users/Username/AppData/Local/Temp/.net/VRF/pptqb30n.dwq/System.Linq.dll
----------------------------------------
System.ComponentModel.TypeConverter
    Assembly Version: 5.0.0.0
    Win32 Version: 5.0.721.25508
    CodeBase: file:///C:/Users/Username/AppData/Local/Temp/.net/VRF/pptqb30n.dwq/System.ComponentModel.TypeConverter.dll
----------------------------------------
System.ComponentModel
    Assembly Version: 5.0.0.0
    Win32 Version: 5.0.721.25508
    CodeBase: file:///C:/Users/Username/AppData/Local/Temp/.net/VRF/pptqb30n.dwq/System.ComponentModel.dll
----------------------------------------
System.Collections.Concurrent
    Assembly Version: 5.0.0.0
    Win32 Version: 5.0.721.25508
    CodeBase: file:///C:/Users/Username/AppData/Local/Temp/.net/VRF/pptqb30n.dwq/System.Collections.Concurrent.dll
----------------------------------------
Microsoft.Win32.SystemEvents
    Assembly Version: 5.0.0.0
    Win32 Version: 5.0.20.51904
    CodeBase: file:///C:/Users/Username/AppData/Local/Temp/.net/VRF/pptqb30n.dwq/Microsoft.Win32.SystemEvents.dll
----------------------------------------
System.Collections.NonGeneric
    Assembly Version: 5.0.0.0
    Win32 Version: 5.0.721.25508
    CodeBase: file:///C:/Users/Username/AppData/Local/Temp/.net/VRF/pptqb30n.dwq/System.Collections.NonGeneric.dll
----------------------------------------
System.Resources.Extensions
    Assembly Version: 5.0.0.0
    Win32 Version: 5.0.20.51904
    CodeBase: file:///C:/Users/Username/AppData/Local/Temp/.net/VRF/pptqb30n.dwq/System.Resources.Extensions.dll
----------------------------------------
System.ObjectModel
    Assembly Version: 5.0.0.0
    Win32 Version: 5.0.721.25508
    CodeBase: file:///C:/Users/Username/AppData/Local/Temp/.net/VRF/pptqb30n.dwq/System.ObjectModel.dll
----------------------------------------
System.Diagnostics.FileVersionInfo
    Assembly Version: 5.0.0.0
    Win32 Version: 5.0.721.25508
    CodeBase: file:///C:/Users/Username/AppData/Local/Temp/.net/VRF/pptqb30n.dwq/System.Diagnostics.FileVersionInfo.dll
----------------------------------------
System.Diagnostics.Process
    Assembly Version: 5.0.0.0
    Win32 Version: 5.0.721.25508
    CodeBase: file:///C:/Users/Username/AppData/Local/Temp/.net/VRF/pptqb30n.dwq/System.Diagnostics.Process.dll
----------------------------------------
ValveKeyValue
    Assembly Version: 0.5.0.0
    Win32 Version: 0.5.0.4
    CodeBase: file:///C:/Users/Username/AppData/Local/Temp/.net/VRF/pptqb30n.dwq/ValveKeyValue.dll
----------------------------------------
System.Runtime.InteropServices.RuntimeInformation
    Assembly Version: 5.0.0.0
    Win32 Version: 5.0.721.25508
    CodeBase: file:///C:/Users/Username/AppData/Local/Temp/.net/VRF/pptqb30n.dwq/System.Runtime.InteropServices.RuntimeInformation.dll
----------------------------------------
System.Collections
    Assembly Version: 5.0.0.0
    Win32 Version: 5.0.721.25508
    CodeBase: file:///C:/Users/Username/AppData/Local/Temp/.net/VRF/pptqb30n.dwq/System.Collections.dll
----------------------------------------
System.Runtime.Serialization.Formatters
    Assembly Version: 5.0.0.0
    Win32 Version: 5.0.721.25508
    CodeBase: file:///C:/Users/Username/AppData/Local/Temp/.net/VRF/pptqb30n.dwq/System.Runtime.Serialization.Formatters.dll
----------------------------------------
System.Runtime.CompilerServices.Unsafe
    Assembly Version: 5.0.0.0
    Win32 Version: 5.0.721.25508
    CodeBase: file:///C:/Users/Username/AppData/Local/Temp/.net/VRF/pptqb30n.dwq/System.Runtime.CompilerServices.Unsafe.dll
----------------------------------------
System.Threading
    Assembly Version: 5.0.0.0
    Win32 Version: 5.0.721.25508
    CodeBase: file:///C:/Users/Username/AppData/Local/Temp/.net/VRF/pptqb30n.dwq/System.Threading.dll
----------------------------------------
System.Text.RegularExpressions
    Assembly Version: 5.0.0.0
    Win32 Version: 5.0.721.25508
    CodeBase: file:///C:/Users/Username/AppData/Local/Temp/.net/VRF/pptqb30n.dwq/System.Text.RegularExpressions.dll
----------------------------------------
ValvePak
    Assembly Version: 1.0.2.35
    Win32 Version: 1.0.2.35
    CodeBase: file:///C:/Users/Username/AppData/Local/Temp/.net/VRF/pptqb30n.dwq/ValvePak.dll
----------------------------------------
ValveResourceFormat
    Assembly Version: 0.1.9.0
    Win32 Version: 0.1.9.731
    CodeBase: file:///C:/Users/Username/AppData/Local/Temp/.net/VRF/pptqb30n.dwq/ValveResourceFormat.dll
----------------------------------------
SkiaSharp
    Assembly Version: 2.80.0.0
    Win32 Version: 2.80.2.0
    CodeBase: file:///C:/Users/Username/AppData/Local/Temp/.net/VRF/pptqb30n.dwq/SkiaSharp.dll
----------------------------------------
SkiaSharp.Views.Desktop.Common
    Assembly Version: 2.80.0.0
    Win32 Version: 2.80.2.0
    CodeBase: file:///C:/Users/Username/AppData/Local/Temp/.net/VRF/pptqb30n.dwq/SkiaSharp.Views.Desktop.Common.dll
----------------------------------------
System.Windows.Forms.Design
    Assembly Version: 5.0.7.0
    Win32 Version: 5.0.721.26307
    CodeBase: file:///C:/Users/Username/AppData/Local/Temp/.net/VRF/pptqb30n.dwq/System.Windows.Forms.Design.dll
----------------------------------------
ZstdSharp
    Assembly Version: 0.3.0.0
    Win32 Version: 0.3.0.0
    CodeBase: file:///C:/Users/Username/AppData/Local/Temp/.net/VRF/pptqb30n.dwq/ZstdSharp.dll
----------------------------------------
K4os.Compression.LZ4
    Assembly Version: 1.2.6.0
    Win32 Version: 1.2.6
    CodeBase: file:///C:/Users/Username/AppData/Local/Temp/.net/VRF/pptqb30n.dwq/K4os.Compression.LZ4.dll
----------------------------------------
OpenTK
    Assembly Version: 3.3.1.0
    Win32 Version: 3.3.1
    CodeBase: file:///C:/Users/Username/AppData/Local/Temp/.net/VRF/pptqb30n.dwq/OpenTK.dll
----------------------------------------
OpenTK.GLControl
    Assembly Version: 3.1.0.0
    Win32 Version: 3.1.0
    CodeBase: file:///C:/Users/Username/AppData/Local/Temp/.net/VRF/pptqb30n.dwq/OpenTK.GLControl.dll
----------------------------------------
System.Linq.Expressions
    Assembly Version: 5.0.0.0
    Win32 Version: 5.0.721.25508
    CodeBase: file:///C:/Users/Username/AppData/Local/Temp/.net/VRF/pptqb30n.dwq/System.Linq.Expressions.dll
----------------------------------------
Anonymously Hosted DynamicMethods Assembly
    Assembly Version: 0.0.0.0
    Win32 Version: 5.0.721.25508
    CodeBase: file:///C:/Users/Username/AppData/Local/Temp/.net/VRF/pptqb30n.dwq/System.Private.CoreLib.dll
----------------------------------------
System.Private.Uri
    Assembly Version: 5.0.0.0
    Win32 Version: 5.0.721.25508
    CodeBase: file:///C:/Users/Username/AppData/Local/Temp/.net/VRF/pptqb30n.dwq/System.Private.Uri.dll
----------------------------------------
System.Diagnostics.StackTrace
    Assembly Version: 5.0.0.0
    Win32 Version: 5.0.721.25508
    CodeBase: file:///C:/Users/Username/AppData/Local/Temp/.net/VRF/pptqb30n.dwq/System.Diagnostics.StackTrace.dll
----------------------------------------
System.Reflection.Metadata
    Assembly Version: 5.0.0.0
    Win32 Version: 5.0.721.25508
    CodeBase: file:///C:/Users/Username/AppData/Local/Temp/.net/VRF/pptqb30n.dwq/System.Reflection.Metadata.dll
----------------------------------------
System.Collections.Immutable
    Assembly Version: 5.0.0.0
    Win32 Version: 5.0.721.25508
    CodeBase: file:///C:/Users/Username/AppData/Local/Temp/.net/VRF/pptqb30n.dwq/System.Collections.Immutable.dll
----------------------------------------
System.IO.MemoryMappedFiles
    Assembly Version: 5.0.0.0
    Win32 Version: 5.0.721.25508
    CodeBase: file:///C:/Users/Username/AppData/Local/Temp/.net/VRF/pptqb30n.dwq/System.IO.MemoryMappedFiles.dll
----------------------------------------
System.IO.Compression
    Assembly Version: 5.0.0.0
    Win32 Version: 5.0.721.25508
    CodeBase: file:///C:/Users/Username/AppData/Local/Temp/.net/VRF/pptqb30n.dwq/System.IO.Compression.dll
----------------------------------------
Microsoft.Win32.Registry
    Assembly Version: 5.0.0.0
    Win32 Version: 5.0.721.25508
    CodeBase: file:///C:/Users/Username/AppData/Local/Temp/.net/VRF/pptqb30n.dwq/Microsoft.Win32.Registry.dll
----------------------------------------
System.Drawing
    Assembly Version: 5.0.7.0
    Win32 Version: 5.0.721.26307
    CodeBase: file:///C:/Users/Username/AppData/Local/Temp/.net/VRF/pptqb30n.dwq/System.Drawing.dll
----------------------------------------
SharpGLTF.Core
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///C:/Users/Username/AppData/Local/Temp/.net/VRF/pptqb30n.dwq/SharpGLTF.Core.dll
----------------------------------------
SharpGLTF.Toolkit
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///C:/Users/Username/AppData/Local/Temp/.net/VRF/pptqb30n.dwq/SharpGLTF.Toolkit.dll
----------------------------------------
System.Text.Json
    Assembly Version: 5.0.0.0
    Win32 Version: 5.0.721.25508
    CodeBase: file:///C:/Users/Username/AppData/Local/Temp/.net/VRF/pptqb30n.dwq/System.Text.Json.dll
----------------------------------------
System.Memory
    Assembly Version: 5.0.0.0
    Win32 Version: 5.0.721.25508
    CodeBase: file:///C:/Users/Username/AppData/Local/Temp/.net/VRF/pptqb30n.dwq/System.Memory.dll
----------------------------------------
System.Text.Encodings.Web
    Assembly Version: 5.0.0.1
    Win32 Version: 5.0.721.25508
    CodeBase: file:///C:/Users/Username/AppData/Local/Temp/.net/VRF/pptqb30n.dwq/System.Text.Encodings.Web.dll
----------------------------------------

************** JIT Debugging **************

What Valve game does this happen in

Dota 2

Reference file in a Source 2 game

D:SteamSteamAppscommondota 2 betagamedotapak01_dir.vpkmodelsheroeshoodwinkhoodwink.vmdl_c

Expected behavior

I expect when I double click the left mouse button a hoodwink.vmdl_c file, no error should appear and the MODEL subtab should display the loaded model that I can export.

What version of VRF are you using? On what platform?

Version of VRF: 0.1.9.731 Platform: Windows 8.1 x64

Irbos

0 / 0 / 0

Регистрация: 27.03.2018

Сообщений: 199

1

.NET Core

13.03.2021, 13:04. Показов 6628. Ответов 3

Метки нет (Все метки)


Студворк — интернет-сервис помощи студентам

На строчке ret = br.ReadSingle(); выдаёт эту ошибку.
«System.IO.EndOfStreamException: «Unable to read beyond the end of the stream.»»

C#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
            float ret = 0.0f;
 
            string finalPath = g_Path_Main + @"" + FilePath;
 
            if (!File.Exists(finalPath))
                return ret;
 
            using (var fs = new FileStream(finalPath, FileMode.Open))
            {
                using (var br = new BinaryReader(fs))
                {
                    br.BaseStream.Position += 18;
 
                    ret = br.ReadSingle();
                }
            }
 
            return ret;



0



Programming

Эксперт

94731 / 64177 / 26122

Регистрация: 12.04.2006

Сообщений: 116,782

13.03.2021, 13:04

Ответы с готовыми решениями:

Ошибка времени выполнения unable to read beyond the end of stream
uses graphabc;
var a, b, c:integer;
i:file of integer;
begin
SetWindowWidth(500);…

Пробная база данных.EndOfException: Unable to read the end of the stream (после попытки чтения первой строки)
Написал на С# учебно-тренировочную базу данных,но работать
она не хочет.Прошу помочь…

Вывод типизированного файла «unable to read beyond the end of the stream»
uses crt;
label 1,2;
var f1:file of integer;
x,i,i1,i2,n:integer;
begin
assign(f1,…

stream.read(v,stream.size); //здесь ошибка при исполнении
var
stream:Tfilestream;
v:variant;
begin

3

Администратор

Эксперт .NET

15668 / 12629 / 5003

Регистрация: 17.03.2014

Сообщений: 25,708

Записей в блоге: 1

13.03.2021, 13:41

2

Irbos, какая длина у файла?



0



0 / 0 / 0

Регистрация: 27.03.2018

Сообщений: 199

13.03.2021, 13:52

 [ТС]

3

OwenGlendower, там несколько файлов и у них разная длина, но она больше чем 18 байт примерно 1000-100к



0



OwenGlendower

Администратор

Эксперт .NET

15668 / 12629 / 5003

Регистрация: 17.03.2014

Сообщений: 25,708

Записей в блоге: 1

13.03.2021, 14:08

4

Лучший ответ Сообщение было отмечено Irbos как решение

Решение

Цитата
Сообщение от Irbos
Посмотреть сообщение

она больше чем 18 байт

Очевидно нет раз выдается исключение о невозможности чтения.

Добавлено через 2 минуты
Попробуйте добавить проверку

C#
1
2
3
4
5
6
7
8
9
10
11
12
13
using (var fs = new FileStream(finalPath, FileMode.Open))
{
    const int start = 18;
    if (fs.Length >= start+sizeof(float))
    {
        using (var br = new BinaryReader(fs))
        {
            br.BaseStream.Position = start;
 
            ret = br.ReadSingle();
        }
    }
}



1



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.
MarcVL_0-1653952981408.png

  • 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

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

  • Unable to lock the disk boot your computer from a linux based bootable media ошибка
  • Unable to lock the disk acronis ошибка
  • Unable to locate package python termux ошибка
  • Unable to locate adb android studio ошибка
  • Unable to build entity manager factory ошибка фсс при запуске