Questions tagged [memorystream]

A memory stream is a kind of stream that has several methods to access and store data in memory.

memorystream
Filter by
Sorted by
Tagged with
0 votes
1 answer
322 views

How can I specify the download location of pdf?

How can I specify the download location of the converted pdf in the server? When I run in the server I want to save the pdf in server files but I don't know how can I manipulate the memory stream or ...
Mirac Akdag's user avatar
0 votes
1 answer
1k views

Empty File Created without text in .txt file in .NET Core

[HttpPost] public FileResult DownloadFile(int id) { using (MemoryStream ms = new MemoryStream()) { var sw = new StreamWriter(ms); sw.Write("Hi"); ...
CoderGuy's user avatar
0 votes
1 answer
1k views

MemoryStream - Data getting truncated [duplicate]

Original Problem - CSV file is too big (700k) records - so looking to create smaller CSV files from that big CSV file. Got the following code to dissect the file and create smaller files. private ...
Robert Dinaro's user avatar
0 votes
1 answer
1k views

Stream.Read() is Slow Performance

Converting Stream to Array by using memorystream.Read(arr, 0, length) for 19 Mb file. When Running it in machine1 it takes approx 1.26 Sec, in Machine2 it takes approx 3 sec. Why there is a difference ...
Nour Khashan's user avatar
0 votes
1 answer
54 views

Unable to evaluate expression error while trying to display PDF using memorystream

I'm trying to generate PDF of my SharePoint page but keep getting an "Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack." error. Am I ...
DanielJ's user avatar
  • 51
0 votes
0 answers
187 views

How to create an EMF file from a MS Chart graph using a Stream

I am trying to create an EMF image from a MS Chart graph. I have got no problem using a FileStream to temporary store the image like this: FileStream fileStream = new FileStream("test.emf", ...
stenio's user avatar
  • 317
0 votes
1 answer
1k views

Writing/Reading the contents in a Memory Stream instead of File Stream in C++

I want to write and read the contents to a memory stream instead of any file stream like fstream, ifstream or ofstream. So that all the contents which should be written in a file should be there in ...
Abhishek Kumar Singh's user avatar
0 votes
0 answers
314 views

Itextsharp SetField not replacing the text as expected in mail attachment .Net C# core

I have a pdf template with below content First Name: {{FirstName}} Contact Number: {{ContactNumber}} Email Id: {{EmailId}} Address 1: {{Address1}} Address 2: {{Address2}} Qualification: {{...
Nidhin Paul's user avatar
0 votes
1 answer
743 views

PDF file is not get generating properly in C# .net core project from MemoryStream

I have below code to create a pdf file To read contents i used String path = System.IO.Directory.GetCurrentDirectory() +Path.DirectorySeparatorChar.ToString() + "Templates&...
Nidhin Paul's user avatar
0 votes
1 answer
820 views

Getting Object Reference Not set Error in SMTP mail.send() C#.net core API project while using memory stream

I have a .docx template with some dynamic display strings defined in it like below {{FirstName}}, {{ContactNumber}}",{{EmailId}} Now i need to read this .docx file and need to replace this ...
Nidhin Paul's user avatar
2 votes
1 answer
2k views

moq verify method was called with stream of data

I have a method that calls another method with a stream. I would like to test that the data inserted in the first method is what is sent in the second. public MyMessage Parse(byte[] data) { return ...
PMO1948's user avatar
  • 2,388
0 votes
1 answer
748 views

TelegramBot 400 Bad Request: media not found

I try to send album by telegram bot. Sometimes I get error Telegram.Bot.Exceptions.ApiRequestException: Bad Request: media not found at Telegram.Bot.TelegramBotClient.MakeRequestAsync[TResponse](...
dmitriy's user avatar
  • 316
4 votes
2 answers
9k views

C# write memorystream to file [duplicate]

I have an easy function, which should receive Stream object and write it to the file "result.txt" Here is my function: public void WriteToFile(Stream stream) { ...
Radcriminal's user avatar
0 votes
1 answer
333 views

c# - Create and upload csv file to ADLS

I am trying to create a .csv file to upload into ADLS using DataLakeFileClient and MemoryStream. It works fine but the csv file has a garbage value after each letter in the csv. (I can see those as '...
Gadam's user avatar
  • 2,864
3 votes
3 answers
6k views

How to parse CSV via CSV Helper to my custom class IFormFile .Net Core c#

I'm uploading CSV file from client to .NET CORE Web Api app. I'm using CsvHelper .net library. I receive file successfully and I would like to parse it to my custom classes so I could loop throught ...
Roxy'Pro's user avatar
  • 4,366
-1 votes
2 answers
4k views

Reading and copying large files/blobs without storing them in memory stream in C#

below is the code which reads the blobs from my blob storage and then copy the contents in a tabular storage. Everything works fine now. but I know that if my file is too big then it will fail this ...
Ankit Kumar's user avatar
2 votes
2 answers
5k views

Create text file in memory then upload it to Azure Blob Storage

Right now I am creating a Parquet file in memory with the help of a library and I am uploading it to Azure Blob storage. However, I want something simpler this time, namely just a text file to write ...
crystyxn's user avatar
  • 1,521
1 vote
1 answer
2k views

Create a MemoryStream that covers a section of a byte array without copying the data in memory

I'm writing some library code, in which there is a byte[] that holds some data in memory. I would like to expose some part of the byte[] via a Stream object to the library consumer. For example, I ...
scharnyw's user avatar
  • 2,594
0 votes
1 answer
543 views

How can I free up MemoryStream in C#?

I'm a bit of a noob with C#. I've tried to do the right thing in terms of managing memory, but I am now getting "out of memory" errors. UPDATE #2 5 DEC I solved it! (sort of) I don't ...
xtempore's user avatar
  • 5,355
2 votes
1 answer
228 views

Uploading file using MemoryStream via WCF MessageContract to SQL FileStream is empty when it reaches service

I have googled my *** off and cannot find a reason why this is happening. I have a WCF service (file) where I upload a PDF that is only in a memorystream. The memorystream shows I have data before it ...
Mike's user avatar
  • 21
0 votes
0 answers
111 views

Need explanation on the behavior of async file download for blobs

I have below code which runs smoothly in some cases, while in other case( mostly during debugging) it comes out with a message that "the code exited at line 0". When it happens then I change ...
Ankit Kumar's user avatar
1 vote
2 answers
722 views

How to get data from BlazorInputfile

i use BlazorInputFile on my project but dont know how to transform the stream that i get from the input file(a zipFile) to an ZipArchive to loop in it.... i see the stream is ok but when i try to make ...
Khalid Ab's user avatar
  • 195
-1 votes
1 answer
505 views

image color is becoming inverted when bitmap is converted to byte array and then to memory stream and saved

image color is becoming inverted when bitmap is converted to byte array and then to memory stream and saved. This code was part of the dynamic image creation at my site ommrudraksha.com using (var ...
Sashmita Sahoo's user avatar
0 votes
1 answer
2k views

Is it possible to use Memory Stream how input file for FFMpeg?

I'm trying to work with ffmpeg in a .NET application. Is it possible to use a memory stream instead -i [string inputFilePath] to get some frames for example? Many thanks for any answer.
Fedor Zhilkin's user avatar
0 votes
2 answers
1k views

Using statement around XmlWriter causes premature closing of stream [duplicate]

I'm trying to write a small piece of XML to a memory stream, then read the written content from the memory stream and save it to a variable. I have the following logic that works for writing and ...
Prolog's user avatar
  • 2,949
1 vote
1 answer
1k views

C# - Cannot access a closed stream

My code for PDF creation with iTextSharp version 5.5.13.2 is returning error, "Cannot access a closed stream." I am unsure how this error could arise as I have my code encapsulated within ...
user avatar
2 votes
2 answers
911 views

ByteBuffer.wrap().getInt() equivalent in c#

Java byte[] input = new byte[] { 83, 77, 45, 71, 57, 51, 53, 70 }; int buff = ByteBuffer.wrap(input).getInt(); Output: 1397566791 C# byte [] array = { 83, 77, 45, 71, 57, 51, 53, 70 }; MemoryStream ...
xoxoxs's user avatar
  • 23
1 vote
3 answers
10k views

Can we send a memory stream object with web API?

I have one memory stream object in my server-side, this object should be accessible in another party, which I call it a client or a consumer for my API. In server-side I have a method like this (...
someone's user avatar
  • 565
0 votes
0 answers
37 views

DataTable Image to MemorySteam Error: 'MemoryStream' does not contain a constructor that takes 1 arguments

Overview I'm trying to pull out 1 record from a datatable and display it in my PictureBox (pbCharacter) Issue: I have a datatable that is returned from a function GetCompetitionCollections. It's a ...
Jay's user avatar
  • 11
7 votes
1 answer
428 views

Problem with counting MD5 from bitmap stream C#

When im passing Bmp as stream, function always return, D4-1D-8C-D9-8F-00-B2-04-E9-80-09-98-EC-F8-42-7E but file saving on disk correctly. When I load bpm from disk, function return correct MD5. Also ...
Yszty's user avatar
  • 95
1 vote
1 answer
2k views

Append memory stream with data byte to download in csv

I am trying to append the memory stream in a loop and then pass it to the HTTPResponseMessage as a csv file, however when i download the file, no data is displayed. var stream = new System.IO....
Nirusma's user avatar
  • 13
1 vote
2 answers
1k views

Export multiple files (with different file types) from database (Byte Array) to single zipped file

I need to export multiple files with varying file types (pdf, xlsx, .docx) stored in a database (Byte Array) and save them as a single zipped file. How should I handle the multiple files? I'm assuming ...
Shane's user avatar
  • 542
2 votes
0 answers
116 views

Azure Databricks MemoryStream support

I tried some simple MemoryStream samples in Azure databricks: val input = MemoryStream[T] ... input.addData(...) input.toDS() .writeStream .queryName("events") ....
Koenig Lear's user avatar
  • 2,406
0 votes
2 answers
770 views

Sftp upload from memory stream asp.net

I am trying to upload a csv file that is created from a query and upload via sftp. I am trying to avoid creating a file and then reading the file to upload it by keeping the data in memory. Thanks in ...
usernamewasfree's user avatar
0 votes
2 answers
2k views

Solved: C# MemoryStream converted to byte array, then to base64 string removes RTL characters

I am adding page numbers to a pdf file, It works correctly with english, but when I try to add hebrew text it ommits those letters. I assume the problem is with the encoding to base64, how do I solve ...
BatshevaRich's user avatar
0 votes
1 answer
163 views

Reloading Img to memorystream causes a [ A generic error occurred in GDI+ ]

am having a problem when i attempt to update a Record image in the DB. the workflow am using goes as follows : the user loads the image to a picture box using FilaDialog. DialogResult path = ...
hossam ismat's user avatar
0 votes
1 answer
39 views

Saving File conversion to variable instead of physical location

I'm trying out to use the XML - Mind converter https://www.xmlmind.com/foconverter/ to convert some xsl-fo to an rtf and this works well . Just to be clear this is nothing specific to the conveter or ...
techdev's user avatar
2 votes
0 answers
191 views

How to save an Aspose.PDF Document between disposing memory streams?

I'm loading byte arrays into objects and then concatenating these together. The problem is that whenever my using statement is exiting, the stream is closed and my concatenated object fails because ...
drewler7's user avatar
-1 votes
2 answers
864 views

Out Of Memory Exception when downloading a video file

We currently download video(s) from Twilio, once the video has been downloaded we save the video in AWS S3. However when deploying to production I'm currently getting: Exception of type 'System....
Code Ratchet's user avatar
  • 5,871
1 vote
1 answer
137 views

MemoryStream in response alongside other parameters possible?

in my project (Backend: c# - Frontend: JavaScript) I want to send a csv file as MemoryStream in a response object to the frontend. At first I sent back a HttpResponse object which worked. But now I ...
Marcus's user avatar
  • 91
1 vote
1 answer
283 views

Unable to create System.Drawing.Image object from WebResponse Stream

I am trying to create a System.Drawing.Image object from a WebResponse's response stream. Here's what I'm doing: using (WebResponse response = await request.GetResponseAsync()) { using (Stream ...
kdeez's user avatar
  • 691
1 vote
2 answers
237 views

Translating from Java to C# a snippet of ByteBuffer code

I've been trying to translate the following Java code to C#. // two bytes to make a short (16 bit integer) private short bytesToShort(byte hi, byte low) { return ByteBuffer.wrap(new byte[]{hi, ...
Nick's user avatar
  • 368
5 votes
1 answer
3k views

ASP.Net Core returns a 500 INTERNAL SERVER ERROR from a FileStreamResult [closed]

ASP.Net Core returns a 500 server error from a FileStreamResult when using MemoryStream to write into PDF public async Task <Stream> DownloadDocumentInfoAsPdfAsync(User loggedInUser) { try { ...
Dev-lop-er's user avatar
0 votes
0 answers
178 views

WCF - Memory stream not sending files \ stream correctly

I have a WCF service that needs to send files and an xml \ SOAP message to the caller. In this instance the calling object is SOAP UI. I have tried returning the object as a byte array which gets ...
Simon Price's user avatar
  • 3,111
-1 votes
1 answer
737 views

Memory stream length always zero

when running the following code, my memory stream always has a length of zero (documentStream.length) I've tried setting resetting the position to zero which seems to solve for most, but im still ...
treendy's user avatar
  • 453
0 votes
1 answer
2k views

Why does BlobClient.UploadAsync hang when uploading JSON via a memory stream?

I'm trying to upload JSON to an Azure blob via a memory stream. When I call UploadAsync my application hangs. If I move the UploadAsync call outside the StreamWriter curly brackets I get a System....
Dave Moran's user avatar
3 votes
1 answer
7k views

Get memory stream from IFormFile exceptions

I upload an image and want to send it to a third party service(Cloudinary) without saving the file in my server. public async Task<List<string>> GetImagesUrlsByImage(IFormFile image) { ...
Offir's user avatar
  • 3,383
0 votes
0 answers
300 views

InvalidOperationException was thrown

I have an API endpoint that has a "hash" key that is sent via the HTTPheader request. When then end point is hit I need to compare the hash key from the header to the hash key on my end point as ...
josh's user avatar
  • 29
1 vote
1 answer
429 views

I am getting a "system.runtime.serialization.serializationexception" when using the binary formatter

private byte[] ToByteArray(Message msg) { if(msg == null) { return null; } BinaryFormatter bf = new BinaryFormatter(); using(MemoryStream ms = ...
abdulmueez emiola's user avatar
1 vote
1 answer
953 views

Getting XPS FixedDocumentSequence from a MemoryStream

I'm using the Spire library to convert a DocX file to an XPS file so that I can display a preview of the document in my Windows Desktop (WPF, C#) application. The conversion is fine - and I can save ...
AJ.'s user avatar
  • 1,641

1 2 3
4
5
26