Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Unable to get Streams using batched requests, Length always zero

Aperta
#945 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
38/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
csharp
Ambito
api

Direzione di ricerca

Inizia con BatchRequestContentCollection.AddBatchRequestStepAsync, Batch.PostAsync e GetResponseStreamByIdAsync usando la richiesta di contenuto drive-item fornita. Confronta la risposta batch con la risposta diretta di Content.GetAsync e ispeziona gli header e lo stream restituiti. Il lavoro è completato quando le risposte dello stream batch contengono il contenuto richiesto invece di Content-Length: 0.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Needs: Attention :wave: type:bug
Describe the bug

When using BatchRequestContentCollection (or BatchRequestContent) to request a stream content it only returns an empty stream (Length = 0). This happens regardless of whether there is a single or multiple requests in the collection.

var batchRequestContentCollection = new BatchRequestContentCollection(_graphClient);
var driveItemRequest = _graphClient.Drives[driveId].Items[driveItemId].Content.ToGetRequestInformation();
var requestId = await batchRequestContentCollection.AddBatchRequestStepAsync(driveItemRequest);
var batchResponse = await _graphClient.Batch.PostAsync(batchRequestContentCollection);
var stream = await batchResponse.GetResponseStreamByIdAsync(requestId);

I also tried to just use GetResponseByIdAsync, Header information says

Content-Type: application/octet-stream
Content-Length: 0

This does not occur when doing a single request without batching:

var stream = await _graphClient.Drives[driveId].Items[driveItemId].Content.GetAsync();

The stream gets returned correctly then.

Expected behavior

Batched requests should return stream content correctly.

How to reproduce
var batchRequestContentCollection = new BatchRequestContentCollection(_graphClient);
var driveItemRequest = _graphClient.Drives[driveId].Items[driveItemId].Content.ToGetRequestInformation();
var requestId = await batchRequestContentCollection.AddBatchRequestStepAsync(driveItemRequest);
var batchResponse = await _graphClient.Batch.PostAsync(batchRequestContentCollection);
var stream = await batchResponse.GetResponseStreamByIdAsync(requestId);
SDK Version

3.2.1

Latest version known to work for scenario above?

don't know

Configuration
  • OS: Windows 11
  • x64
Lingua principale
C#
Stelle
163
Fork
65
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di microsoftgraph/msgraph-sdk-dotnet-core

Tutte le issue di microsoftgraph/msgraph-sdk-dotnet-core

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.