Skip to content

[VS2022] "Stream does not support writing" #12239

Closed

Description

@0x53A

I got this error after updating from preview 4 to preview 5.
It only happens when building inside VS, not when using dotnet build from the command line.

Build started...
1>------ Build started: Project: ebosYC.CarouselView3D.RemotingContracts, Configuration: Debug Any CPU ------
1>FSC : error FS0229: Error opening binary file 'C:\Users\Lukas\.nuget\packages\fsharp.core\4.1.18\lib\net40\FSharp.Core.dll': Stream does not support writing.
1>FSC : error FS3160: Problem reading assembly 'C:\Users\Lukas\.nuget\packages\fsharp.core\4.1.18\lib\net40\FSharp.Core.dll': The exception has been reported. This internal exception should now be caught at an error recovery point on the stack. Original message: Error opening binary file 'C:\Users\Lukas\.nuget\packages\fsharp.core\4.1.18\lib\net40\FSharp.Core.dll': Stream does not support writing.)
1>error FS0073 : internal error : BuildFrameworkTcImports: no successful import of C:\Users\Lukas\.nuget\packages\fsharp.core\4.1.18\lib\net40\FSharp.Core.dll
1>Done building project "ebosYC.CarouselView3D.RemotingContracts.fsproj" -- FAILED.
1>ebosYC.CarouselView3D.RemotingContracts -> C:\Projekte\ebos\ebosYCRemotingContracts\ebosYC.CarouselView.RemotingContracts\bin\Debug\net5.0\ebosYC.CarouselView3D.RemotingContracts.dll

For me this is reproducible when creating a new F# project and then pasting this project file:

<Project Sdk="Microsoft.NET.Sdk">

	<PropertyGroup>
		<TargetFrameworks>net40</TargetFrameworks>

		<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
		<DisableImplicitSystemValueTupleReference>true</DisableImplicitSystemValueTupleReference>
		<OutputType>Exe</OutputType>
	</PropertyGroup>

	<ItemGroup>
		<PackageReference Include="FSharp.Core" Version="4.1.18" />
		<Compile Include="Program.fs" />
	</ItemGroup>

</Project>

I think it's related to the .net40 TFM?

Related information

Provide any related information (optional):

  • Operating system: windows 10 2004 x64
  • .NET Runtime kind (.NET Core, .NET Framework, Mono)
.NET SDK (reflecting any global.json):
 Version:   5.0.402
 Commit:    e9d3381880

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.19041
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\5.0.402\

Host (useful for support):
  Version: 6.0.0-rc.2.21480.5
  Commit:  6b11d64e7e

.NET SDKs installed:
  3.1.414 [C:\Program Files\dotnet\sdk]
  5.0.208 [C:\Program Files\dotnet\sdk]
  5.0.303 [C:\Program Files\dotnet\sdk]
  5.0.401 [C:\Program Files\dotnet\sdk]
  5.0.402 [C:\Program Files\dotnet\sdk]
  6.0.100-preview.7.21379.14 [C:\Program Files\dotnet\sdk]
  6.0.100-rc.2.21505.57 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.All 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.19 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.20 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.10 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.0-preview.7.21378.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.0-rc.2.21480.10 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.19 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.20 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.10 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.0-preview.7.21377.19 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.0-rc.2.21480.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.1.19 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 3.1.20 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.10 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.11 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.0-preview.7.21378.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.0-rc.2.21501.6 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

To install additional .NET runtimes or SDKs:
  https://aka.ms/dotnet-download
  • Editing Tools (e.g. Visual Studio Version, Visual Studio): VS2022 Preview 5

Activity

  1. self-assigned this
    on Oct 13, 2021
  2. vzarytovskii commented on Oct 13, 2021

    @vzarytovskii
    Member

    I'll look into it.

    We were using CoreCLR compiler in preview4, and switched back to desktop one with preview5. Same reason why it's failing in VS and not with dotnet build.

  3. vzarytovskii commented on Oct 13, 2021

    @vzarytovskii
    Member

    Interestingly enough, it doesn't reproduce on net452.

  4. 0x53A commented on Oct 13, 2021

    @0x53A
    ContributorAuthor

    the good news is that <FSharpPreferNetFrameworkTools>false</FSharpPreferNetFrameworkTools> works, so I'm not blocked.

  5. added
    Impact-Low
    on Nov 3, 2021
  6. added
    Area-Compiler-Checking
    Impact-Medium
    Area-Compiler-Options
    and removed
    Impact-Low
    on Mar 31, 2022
  7. changed the title [-][VS2022 preview 5] "Stream does not support writing"[/-] [+][VS2022] "Stream does not support writing"[/+] on Apr 20, 2022
  8. removed
    Area-Compiler-Checking
    on Apr 20, 2022
  9. abelbraaksma commented on Aug 13, 2022

    @abelbraaksma
    Contributor

    @0x53A, how did you make that working? In a minimal repro, where I reference a local build FSharp.Core from the latest of main, I keep getting the errors you mention. Changing to net452 doesn't help, nor does net48. It builds just fine with netstandard2.0 though.

    In my case, this happens both in VS 2022 and using dotnet build...

    My errors are:

    FSC : error FS0229: Error opening binary file 'C:\Users\Abel\.nuget\packages\fsharp.core\4.0.0.1\lib\net40\FSharp.Core.dll': Stream does not support writing. [d:\Projects\OpenSource\TestFsCheck\QuickThrowOnFailure\QuickThrowOnFailure\QuickThrowOnFailure.fsproj]
    FSC : error FS3160: Problem reading assembly 'C:\Users\Abel\.nuget\packages\fsharp.core\4.0.0.1\lib\net40\FSharp.Core.dll': The exception has been reported. This internal exception should now be caught at an error recovery point on the stack. Original message: Error opening binary file 'C:\Users\Abel\.nuget\packages\fsharp.core\4.0.0.1\lib\net40\FSharp.Core.dll': Stream does not support writing.) [d:\Projects\OpenSource\TestFsCheck\QuickThrowOnFailure\QuickThrowOnFailure\QuickThrowOnFailure.fsproj]
    error FS0073 : internal error : no import of C:\Users\Abel\.nuget\packages\fsharp.core\4.0.0.1\lib\net40\FSharp.Core.dll [d:\Projects\OpenSource\TestFsCheck\QuickThrowOnFailure\QuickThrowOnFailure\QuickThrowOnFailure.fsproj]
    

    My project file (anything can go in Library.fs):

    <Project Sdk="Microsoft.NET.Sdk">
      <PropertyGroup>
        <TargetFramework>net472</TargetFramework> 
        <FSharpPreferNetFrameworkTools>false</FSharpPreferNetFrameworkTools>
        <GenerateDocumentationFile>true</GenerateDocumentationFile>
        <WarnOn>3390;$(WarnOn)</WarnOn>
        <PreRelease>true</PreRelease>
        <LangVersion>preview</LangVersion>
        <DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
      </PropertyGroup>
    
      <ItemGroup>
        <Compile Include="Library1.fs" />
      </ItemGroup>
    
      <ItemGroup>
        <PackageReference Include="FsCheck" Version="3.0.0-alpha4" />
        <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.0" />
        <PackageReference Include="xunit" Version="2.4.2" />
      </ItemGroup>
    
      <ItemGroup>
        <Reference Include="FSharp.Core">
          <HintPath>..\..\..\FSharp6\artifacts\bin\FSharp.Core.UnitTests\Debug\net472\FSharp.Core.dll</HintPath>
        </Reference>
      </ItemGroup>
    </Project>
    
  10. added this to the August-2022 milestone on Aug 13, 2022
  11. moved this from Not Planned to Planned in F# Compiler and Toolingon Aug 13, 2022
  12. Repository owner moved this from Planned to Done in F# Compiler and Toolingon Aug 16, 2022
  13. 0x53A commented on Aug 24, 2022

    @0x53A
    ContributorAuthor

    @abelbraaksma maybe it was true instead of false, I’m not sure

  14. abelbraaksma commented on Aug 31, 2022

    @abelbraaksma
    Contributor

    Well, either way, @vzarytovskii has solved it! 🎆 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Area-Compiler-OptionsBugImpact-Medium

Type

No type

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions