Skip to content

[Bug] Memory stream is closed inside WebApplicationBuilder and MauiAppBuilder while configuring the host configuration. #37030

@EliaCools

Description

@EliaCools

Description

When configuring the host configuration from MauiProgram.cs, using the dotnet Core Generic Host.
The exception "Stream was not readable" is thrown.

This bug appears when adding a MemoryStream to the configurationBuilder.

Below is an image of the locals from the de Microsoft.Maui.MauiAppBuilder, as you can see it tries to read the Memory Stream twice. Throwing a System.ObjectDisposedException the second time.

MauiAppBugLocal png

Steps to Reproduce

I have added a reproduction link. For now it is added as a google drive link as I had trouble inserting the .zip file directly.
Sorry for the inconvenience.

Expected Behavior

Configure the host configuration using the Memory Stream.

Actual Behavior

MauiAppBuilder throws System.ArgumentException: 'Stream was not readable.'

Basic Information

  • Version with issue: .NET MAUI Preview 8
  • Last known good version: .NET MAUI Preview 7
  • IDE: Visual Studio 2022 Preview 4
  • Affected Devices: Android 11.0 - API 30

Reproduction Link

https://drive.google.com/file/d/1m2nfYmfDV2guJLfPAtlMJJupTHU57YH1/view?usp=sharing

Metadata

Metadata

Assignees

Labels

area-minimalIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcbugThis issue describes a behavior which is not expected - a bug.feature-minimal-hostingold-area-web-frameworks-do-not-use*DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions