Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected error when refencing an F# project from a C# project #16359

Closed
francotiveron opened this issue Nov 22, 2023 · 37 comments · Fixed by #16363
Closed

Unexpected error when refencing an F# project from a C# project #16359

francotiveron opened this issue Nov 22, 2023 · 37 comments · Fixed by #16363
Milestone

Comments

@francotiveron
Copy link

francotiveron commented Nov 22, 2023

Version Used:

Microsoft Visual Studio Professional 2022
Version 17.8.2
VisualStudio.17.Release/17.8.2+34322.80
Microsoft .NET Framework
Version 4.8.09037

Installed Version: Professional

ADL Tools Service Provider 1.0
This package contains services used by Data Lake tools

ASA Service Provider 1.0

ASP.NET and Web Tools 17.8.358.6298
ASP.NET and Web Tools

Azure App Service Tools v3.0.0 17.8.358.6298
Azure App Service Tools v3.0.0

Azure Data Lake Tools for Visual Studio 2.6.5000.0
Microsoft Azure Data Lake Tools for Visual Studio

Azure Functions and Web Jobs Tools 17.8.358.6298
Azure Functions and Web Jobs Tools

Azure Stream Analytics Tools for Visual Studio 2.6.5000.0
Microsoft Azure Stream Analytics Tools for Visual Studio

C# Tools 4.8.0-7.23572.1+7b75981cf3bd520b86ec4ed00ec156c8bc48e4eb
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Common Azure Tools 1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

Cookiecutter 17.0.23262.1
Provides tools for finding, instantiating and customizing templates in cookiecutter format.

Extensibility Message Bus 1.4.39 (main@e8108eb)
Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.

File Differ 3.0.49
The easiest way to diff two files directly in Solution Explorer

ILSpy.AddIn 1.0
Integration of the ILSpy Decompiler into Visual Studio.

Microsoft Azure Hive Query Language Service 2.6.5000.0
Language service for Hive query

Microsoft Azure Stream Analytics Language Service 2.6.5000.0
Language service for Azure Stream Analytics

Microsoft Azure Tools for Visual Studio 2.9
Support for Azure Cloud Services projects

Microsoft JVM Debugger 1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Mono Debugging for Visual Studio 17.8.17 (957fbed)
Support for debugging Mono processes with Visual Studio.

NuGet Package Manager 6.8.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/

Office Developer Tools for Visual Studio 17.6.34024.01
Microsoft Office Developer Tools for Visual Studio

Python - Django support 17.0.23262.1
Provides templates and integration for the Django web framework.

Python - Profiling support 17.0.23262.1
Profiling support for Python projects.

Python with Pylance 17.0.23262.1
Provides IntelliSense, projects, templates, debugging, interactive windows, and other support for Python developers.

Razor (ASP.NET Core) 17.8.3.2353105+f0a326f3e15b2370371693a76fd379635387c74d
Provides languages services for ASP.NET Core Razor.

SQL Server Data Tools 17.8.119.0
Microsoft SQL Server Data Tools

Text Macros for Visual Studio 2012-2022 1.18
Brings back text-editing macro support in Visual Studio 2012-2022

ToolWindowHostedEditor 1.0
Hosting json editor into a tool window

TypeScript Tools 17.0.20920.2001
TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools 4.8.0-7.23572.1+7b75981cf3bd520b86ec4ed00ec156c8bc48e4eb
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual F# Tools 17.8.0-beta.23475.2+10f956e631a1efc0f7f5e49c626c494cd32b1f50
Microsoft Visual F# Tools

Visual Studio IntelliCode 2.2
AI-assisted development for Visual Studio.

VisualStudio.DeviceLog 1.0
Information about my package

VisualStudio.Mac 1.0
Mac Extension for Visual Studio

VSPackage Extension 1.0
VSPackage Visual Studio Extension Detailed Info

Workflow Manager Tools 1.0 1.0
This package contains the necessary Visual Studio integration components for Workflow Manager.

Xamarin 17.8.0.155 (d17-8@7042beb)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin Designer 17.8.3.6 (remotes/origin/d17-8@eccf46a291)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.

Xamarin Templates 17.8.16 (830b56a)
Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.

Xamarin.Android SDK 13.2.2.0 (d17-5/45b0e14)
Xamarin.Android Reference Assemblies and MSBuild support.
Mono: d9a6e87
Java.Interop: xamarin/java.interop/d17-5@149d70fe
SQLite: xamarin/sqlite@68c69d8
Xamarin.Android Tools: xamarin/xamarin-android-tools/d17-5@ca1552d

Xamarin.iOS and Xamarin.Mac SDK 16.4.0.23 (9defd91b3)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.
Steps to Reproduce:
1.
Create solution with 3 projects

P2.fsproj

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

  <PropertyGroup>
      <TargetFramework>net4.8</TargetFramework>
      <GenerateDocumentationFile>true</GenerateDocumentationFile>
  </PropertyGroup>

  <ItemGroup>
    <Compile Include="Class2.fs" />
  </ItemGroup>

  <ItemGroup>
    <Reference Include="NinjaTrader.Core">
        <HintPath>..\..\..\..\..\Program Files\NinjaTrader 8\bin\NinjaTrader.Core.dll</HintPath>
    </Reference>
  </ItemGroup>

  <ItemGroup>
    <PackageReference Update="FSharp.Core" Version="7.0.400-beta.23251.2" />
  </ItemGroup>

</Project>

P3.csproj

<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
	  <Platforms>x64</Platforms>
	  <TargetFramework>net4.8</TargetFramework>
	  <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
	  <UseWPF>true</UseWPF>
	  <LangVersion>Latest</LangVersion>
	  <RootNamespace>HF</RootNamespace>
  </PropertyGroup>
	<ItemGroup>
    <Reference Include="NinjaTrader.Core">
	    <HintPath>..\..\..\..\..\Program Files\NinjaTrader 8\bin\NinjaTrader.Core.dll</HintPath>
    </Reference>
  </ItemGroup>
</Project>

P1.csproj

<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>Library</OutputType>
    <Platforms>x64</Platforms>
    <TargetFramework>net4.8</TargetFramework>
  </PropertyGroup>
	<ItemGroup>
    <Reference Include="NinjaTrader.Core">
	    <HintPath>..\..\..\..\..\Program Files\NinjaTrader 8\bin\NinjaTrader.Core.dll</HintPath>
    </Reference>
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\P2\P2.fsproj" />
    <ProjectReference Include="..\P3\P3.csproj" />
  </ItemGroup>
</Project>
  1. Add the single source code file, respectively

Class2.fs

namespace P2

open NinjaTrader.NinjaScript

type Class2(host: IndicatorBase) = class end

Class3.cs

using NinjaTrader.NinjaScript;

namespace P3 {
    public class Class3 {
        IndicatorBase _host;

        public Class3(IndicatorBase host)
        {
            _host = host;
        }
    }
}

Class1.cs

using NinjaTrader.NinjaScript;

namespace P1 {
    internal class Class1 : IndicatorBase {
        P2.Class2 _c2;
        P3.Class3 _c3;

        public Class1()
        {
            _c2 = new P2.Class2(this);
            _c3 = new P3.Class3(this);
        }
    }
}

Note:

  • All the 3 projects reference a local DLL NinjaTrader.Core.dll (where the type IndicatorBase is defined)
  • That DLL is installed as part of the application NinjaTrader, not sure if this occurs with others DLLs
  • P2 and P3 both define a single class with identical shape (different names and language)
  • P1 references both P2 and P3

Expected Behavior:
Code should compile without errors

Actual Behavior:
Visual studio complains on the instantiation of Class2 in Class1, but not on Class3; the error is

Error CS0012 The type 'IndicatorBase' is defined in an assembly that
is not referenced. You must add a reference to assembly
'NinjaTrader.Core, Version=8.1.2.0, Culture=neutral,
PublicKeyToken=0907d8af90186095'. P1 C:\Temp\Ninja\Test1\Solution1\P1\Class1.cs

image

@jasonmalinowski
Copy link
Member

@francotiveron If you try to build the solution, does it still build with the build gesture? Or does that fail too?

@francotiveron
Copy link
Author

@jasonmalinowski It fails with the same error

@jasonmalinowski
Copy link
Member

Then can you do a command line build and pass the /bl switch? That'll produce a binary log file that we can investigate further with. That file can potentially contain private info, so if you want to email me the file directly my email is on my GitHub profile.

@francotiveron
Copy link
Author

msbuild.binlog (481K) sent to your email

@jasonmalinowski
Copy link
Member

Thanks for sending over the binlog. I see that The NinjaTrader.Core from "C:\Program Files\NinjaTrader 8\bin\NinjaTrader.Core.dll" " is being passed to the compiler. But when P1 was being built the underlying assembly resolution logic did say this:

Considered "C:\Temp\Ninja\Test1\Solution1\P2\bin\Debug\net4.8\NinjaTrader.Core.dll",
			but its name "NinjaTrader.Core, Version=8.1.2.0, Culture=neutral, PublicKeyToken=null"
			didn't match the expected name "NinjaTrader.Core, Version=8.1.2.0, Culture=neutral, PublicKeyToken=0907d8af90186095".

This makes me think the problem here is there are two versions of NinjaTrader.Core floating around: one has a strong name (PublicKeyToken = 0907d8af90186095) and one does not have a strong name, and those are considered different per assembly resolution logic. The follow up question then is "where did the two copies come from?" Unfortunately your binlog doesn't show a build for P2 or P3 (just that they're up to date), but if you do a clean and build again, does the problem go away? Otherwise we might need a new binlog where not only passing /bl you are also passing /t:Rebuild to force a rebuild.

@jasonmalinowski
Copy link
Member

(and marking this as Area-Compilers rather than Area-IDE since it's definitely not an IDE problem. I suspect this is still a build going funny in some way though and not really a compiler issue either.)

@francotiveron
Copy link
Author

Solution Cleaned
msbuild /bl /t:Rebuild
log file sent

@jasonmalinowski
Copy link
Member

@dotnet/fsharp-team-msft do you think you can take a look at this as a next step of investigation? It seems that the F# assembly is being recorded as having a reference to an assembly with a public key token, but the build shows it's getting the same input as the C# compiler. I don't see where the public key token for the reference is coming from anywhere else, so it almost feels like this is an F# compiler bug (although I don't know how!)

@jasonmalinowski
Copy link
Member

The invocation of Fsc is this. The FusionName that's tacked on by RAR implies it's PublicKeyToken=null:

image

But RAR when it's processing the consuming C# project:

image

@francotiveron
Copy link
Author

So how do I fix it? Or is it a bug?

@jasonmalinowski
Copy link
Member

@francotiveron Don't know yet, but at this point I'm not sure it's a Roslyn issue. We're getting the F# team to take a look.

@vzarytovskii
Copy link
Member

vzarytovskii commented Nov 29, 2023

@dotnet/fsharp-team-msft do you think you can take a look at this as a next step of investigation? It seems that the F# assembly is being recorded as having a reference to an assembly with a public key token, but the build shows it's getting the same input as the C# compiler. I don't see where the public key token for the reference is coming from anywhere else, so it almost feels like this is an F# compiler bug (although I don't know how!)

I'm not entirely sure how can that happen, but 17.7 ships with quite old compiler, we've had a bunch of fixes since.

Does the same issue show with 17.8/17.9?

@jasonmalinowski also - isn't Fsc task in binlog showing what was passed to it as reference when msbuild is invoking it?

@jasonmalinowski
Copy link
Member

@jasonmalinowski also - isn't Fsc task in binlog showing what was passed to it as reference when msbuild is invoking it?

Yeah that's why I'm confused. I see the reference going in that looks like it doesn't have a public key token. But later when we try processing the output of it, it seems like output did have one. And to be very clear, I can't explain how the compiler could make a mistake like that, but I'm not seeing any alternative either. :-/

Actually @francotiveron that might be one more thing to ask: can you upload the P2.dll file that gets built? You can upload that here, no reason to email.

@KevinRansom
Copy link
Member

@francotiveron , could I get the binary log file to look at.

@jasonmalinowski
Copy link
Member

I've shared the logs internally.

@KevinRansom
Copy link
Member

KevinRansom commented Nov 30, 2023

@francotiveron , So ... from the error message it looks as if the F# compiler is writing out the reference to NinjaTrader.Core incorrectly. When compiling P2.dll

C:\Temp\Ninja\Test1\Solution1\P1\Class1.cs(10,23): error CS0012: 
The type 'IndicatorBase' is defined in an assembly that is not referenced. You must add a reference to assembly 
'NinjaTrader.Core, Version=8.1.2.0, Culture=neutral, PublicKeyToken=0907d8af90186095'.

[C:\Temp\Ninja\Test1\Solution1\P1\P1.csproj]

Would it be possible for you to provide p1.dll and p2.dll so that I can look at them locally, You can put them in a zip and add them as an attachment to this conversation.

It would also be very useful to be able to examine ninjatrader.core.dll, but their terms of use specifically prohibit decompilation

So perhaps if you could run these commands on the assembly and provide the output:

     sn -vf NinjaTrader.Core.dll
     sn -Tp NinjaTrader.Core.dll

and:

    dumpbin /clrheader NinjaTrader.Core.dll
    dumpbin /headers NinjaTrader.Core.dll

It's interesting to me, that the particular public key, has appeared in several issues on the internet, so I harbor the suspicion that whatever we are doing, is a bit more subtle than I outlined above.

thanks

Kevin Ransom.

@KevinRansom KevinRansom transferred this issue from dotnet/roslyn Nov 30, 2023
@github-actions github-actions bot added this to the Backlog milestone Nov 30, 2023
@francotiveron
Copy link
Author

francotiveron commented Nov 30, 2023

PS C:\Program Files\NinjaTrader 8\bin> sn -vf NinjaTrader.Core.dll

Microsoft (R) .NET Framework Strong Name Utility  Version 4.0.30319.0
Copyright (c) Microsoft Corporation.  All rights reserved.

NinjaTrader.Core.dll does not represent a strongly named assembly
PS C:\Program Files\NinjaTrader 8\bin> sn -Tp NinjaTrader.Core.dll

Microsoft (R) .NET Framework Strong Name Utility  Version 4.0.30319.0
Copyright (c) Microsoft Corporation.  All rights reserved.

NinjaTrader.Core.dll does not represent a strongly named assembly
PS C:\Program Files\NinjaTrader 8\bin> dumpbin /clrheader NinjaTrader.Core.dll
Microsoft (R) COFF/PE Dumper Version 14.38.33130.0
Copyright (C) Microsoft Corporation.  All rights reserved.


Dump of file NinjaTrader.Core.dll

File Type: DLL

  clr Header:

              48 cb
            2.05 runtime version
           54970 [  252AE0] RVA [size] of MetaData Directory
               1 flags
                   IL Only
               0 entry point token
          4BB98C [   48FE0] RVA [size] of Resources Directory
               0 [       0] RVA [size] of StrongNameSignature Directory
               0 [       0] RVA [size] of CodeManagerTable Directory
               0 [       0] RVA [size] of VTableFixups Directory
               0 [       0] RVA [size] of ExportAddressTableJumps Directory
               0 [       0] RVA [size] of ManagedNativeHeader Directory


  Summary

        2000 .reloc
        2000 .rsrc
      504000 .text
PS C:\Program Files\NinjaTrader 8\bin> dumpbin /headers NinjaTrader.Core.dll
Microsoft (R) COFF/PE Dumper Version 14.38.33130.0
Copyright (C) Microsoft Corporation.  All rights reserved.


Dump of file NinjaTrader.Core.dll

PE signature found

File Type: DLL

FILE HEADER VALUES
            8664 machine (x64)
               3 number of sections
        6536447A time date stamp Mon Oct 23 21:01:30 2023
               0 file pointer to symbol table
               0 number of symbols
              F0 size of optional header
            2022 characteristics
                   Executable
                   Application can handle large (>2GB) addresses
                   DLL

OPTIONAL HEADER VALUES
             20B magic # (PE32+)
           48.00 linker version
          502C00 size of code
          503000 size of initialized data
               0 size of uninitialized data
          5049DA entry point (00000000009049DA)
            2000 base of code
          400000 image base (0000000000400000 to 0000000000909FFF)
            2000 section alignment
             200 file alignment
            4.00 operating system version
            0.00 image version
            6.00 subsystem version
               0 Win32 version
          50A000 size of image
             200 size of headers
               0 checksum
               3 subsystem (Windows CUI)
            8560 DLL characteristics
                   High Entropy Virtual Addresses
                   Dynamic base
                   NX compatible
                   No structured exception handler
                   Terminal Server Aware
          100000 size of stack reserve
            1000 size of stack commit
          100000 size of heap reserve
            1000 size of heap commit
               0 loader flags
              10 number of directories
               0 [       0] RVA [size] of Export Directory
          50496C [      57] RVA [size] of Import Directory
          506000 [     3E8] RVA [size] of Resource Directory
               0 [       0] RVA [size] of Exception Directory
               0 [       0] RVA [size] of Certificates Directory
          508000 [       C] RVA [size] of Base Relocation Directory
          5049EC [      1C] RVA [size] of Debug Directory
               0 [       0] RVA [size] of Architecture Directory
               0 [       0] RVA [size] of Global Pointer Directory
               0 [       0] RVA [size] of Thread Storage Directory
               0 [       0] RVA [size] of Load Configuration Directory
               0 [       0] RVA [size] of Bound Import Directory
            2000 [      10] RVA [size] of Import Address Table Directory
               0 [       0] RVA [size] of Delay Import Directory
            2010 [      48] RVA [size] of COM Descriptor Directory
               0 [       0] RVA [size] of Reserved Directory


SECTION HEADER #1
   .text name
  502A98 virtual size
    2000 virtual address (0000000000402000 to 0000000000904A97)
  502C00 size of raw data
     200 file pointer to raw data (00000200 to 00502DFF)
       0 file pointer to relocation table
       0 file pointer to line numbers
       0 number of relocations
       0 number of line numbers
60000020 flags
         Code
         Execute Read

  Debug Directories

        Time Type        Size      RVA  Pointer
    -------- ------- -------- -------- --------
    91AF9D82 cv            8F 00504A08   502C08    Format: RSDS, {75486FF0-67CD-4456-B436-4A5B86D8DFA7}, 1, C:\Users\Administrator\Documents\JenkinsAgentLocal\workspace\NT8\NinjaTrader.Core\obj\x64\Release\NinjaTrader.Core.pdb

SECTION HEADER #2
   .rsrc name
     3E8 virtual size
  506000 virtual address (0000000000906000 to 00000000009063E7)
     400 size of raw data
  502E00 file pointer to raw data (00502E00 to 005031FF)
       0 file pointer to relocation table
       0 file pointer to line numbers
       0 number of relocations
       0 number of line numbers
40000040 flags
         Initialized Data
         Read Only

SECTION HEADER #3
  .reloc name
       C virtual size
  508000 virtual address (0000000000908000 to 000000000090800B)
     200 size of raw data
  503200 file pointer to raw data (00503200 to 005033FF)
       0 file pointer to relocation table
       0 file pointer to line numbers
       0 number of relocations
       0 number of line numbers
42000040 flags
         Initialized Data
         Discardable
         Read Only

  Summary

        2000 .reloc
        2000 .rsrc
      504000 .text

P2.dll attached. P1.dll is not generated because of the error we are dealing with
P2.zip

Slight edit ....

@francotiveron
Copy link
Author

francotiveron commented Nov 30, 2023

I'm not entirely sure how can that happen, but 17.7 ships with quite old compiler, we've had a bunch of fixes since.

Does the same issue show with 17.8/17.9?

@vzarytovskii now using VS 17.8,2 - error persists

@KevinRansom
Copy link
Member

@francotiveron

Okay, I think I understand what is going on here.

I believe the ninjatrader.core.dll has been obfuscated, when we import it we think it is a strong signed assembly, even though the dumpbin shows that it is clearly not. I'm guessing the obfuscator zero's out the strong signed flag, and the public key record as well as the KeyFile attribute filename. So the resulting assembly doesn't look quite the same as if it was originally unsigned.

When we write out the reference because we thought it was signed when we imported it, we write the assembly reference into P2.dll with the public key set to the bytes we thought represented the public key on import.

I don't think this is a regression, it's probably worked this way for a long time. l will try to work on a fix tomorrow, it shouldn't be too tricky.

Thanks for persevering with the issue

Kevin

/cc @vzarytovskii @jasonmalinowski @francotiveron

@francotiveron
Copy link
Author

How do I install this version without waiting for an update of Visual Studio?

@smoothdeveloper
Copy link
Contributor

@francotiveron, IMO the easiest for you ("works on your machine") only:

  • git clone this repository
  • build from a command prompt in the repository location (it will most likely be green, matter of few minutes)
  • open visualfsharp.sln, and run the VisualFSharpDebug target without debugger attached (ctrl+f5 in my case, not sure if it is default)
    image

After this, if it is all fine:

  • there is need to locate the vsix and install it, I'm not sure about this process or alternatives
  • you can also do the same with debugger attached and changing all the F# codebase to make it fancier if you have time to spare :)

@francotiveron
Copy link
Author

build fails

FSC : error FS0225: Source file 'C:\Root\Work\github\dotnet\fsharp\artifacts\obj\FSharp.Compiler.Interactive.Settings\D
ebug\netstandard2.0\FSInteractiveSettings.fsi' could not be found [C:\Root\Work\github\dotnet\fsharp\src\FSharp.Compile
r.Interactive.Settings\FSharp.Compiler.Interactive.Settings.fsproj::TargetFramework=netstandard2.0]
FSC : error FS0225: Source file 'C:\Root\Work\github\dotnet\fsharp\artifacts\obj\FSharp.Build\Debug\netstandard2.0\FSBu
ild.fsi' could not be found [C:\Root\Work\github\dotnet\fsharp\src\FSharp.Build\FSharp.Build.fsproj]
FSC : error FS0225: Source file 'C:\Root\Work\github\dotnet\fsharp\artifacts\obj\FSharp.DependencyManager.Nuget\Debug\n
etstandard2.0\FSDependencyManager.fsi' could not be found [C:\Root\Work\github\dotnet\fsharp\src\FSharp.DependencyManag
er.Nuget\FSharp.DependencyManager.Nuget.fsproj::TargetFramework=netstandard2.0]
  EmptyAssembly -> C:\Root\Work\github\dotnet\fsharp\artifacts\bin\EmptyAssembly\Debug\net472\EmptyAssembly.dll
  TaskPerf -> C:\Root\Work\github\dotnet\fsharp\artifacts\bin\TaskPerf\Debug\net8.0\TaskPerf.dll
  DummyProviderForLanguageServiceTesting -> C:\Root\Work\github\dotnet\fsharp\artifacts\bin\DummyProviderForLanguageSer
  viceTesting\Debug\net472\DummyProviderForLanguageServiceTesting.dll
  TestTP -> C:\Root\Work\github\dotnet\fsharp\artifacts\bin\TestTP\Debug\netstandard2.0\TestTP.dll

Build FAILED.

FSC : error FS0225: Source file 'C:\Root\Work\github\dotnet\fsharp\artifacts\obj\FSharp.Compiler.Interactive.Settings\D
ebug\netstandard2.0\FSInteractiveSettings.fsi' could not be found [C:\Root\Work\github\dotnet\fsharp\src\FSharp.Compile
r.Interactive.Settings\FSharp.Compiler.Interactive.Settings.fsproj::TargetFramework=netstandard2.0]
FSC : error FS0225: Source file 'C:\Root\Work\github\dotnet\fsharp\artifacts\obj\FSharp.Build\Debug\netstandard2.0\FSBu
ild.fsi' could not be found [C:\Root\Work\github\dotnet\fsharp\src\FSharp.Build\FSharp.Build.fsproj]
FSC : error FS0225: Source file 'C:\Root\Work\github\dotnet\fsharp\artifacts\obj\FSharp.DependencyManager.Nuget\Debug\n
etstandard2.0\FSDependencyManager.fsi' could not be found [C:\Root\Work\github\dotnet\fsharp\src\FSharp.DependencyManag
er.Nuget\FSharp.DependencyManager.Nuget.fsproj::TargetFramework=netstandard2.0]
    0 Warning(s)
    3 Error(s)

Time Elapsed 00:02:19.01
Build failed with exit code 1. Check errors above.

@smoothdeveloper
Copy link
Contributor

@francotiveron, sorry you are facing issues, I just made a clean build and it comes green:

image

Could you share which VS version you have installed?

I ran the command from VS 2022 command prompt and I'm having 17.8 and 17.9 (preview) installed on the machine, just as a disclaimer, this repository generally needs pretty recent version of VS 2022, I sometimes have to update but don't remember if the error is explicit.

Your version in this ticket seems rather old, could you try updating your VS 2022 installation and try again, from a VS 2022 developer command prompt so we are on same page?

@francotiveron
Copy link
Author

francotiveron commented Dec 3, 2023

@smoothdeveloper I am using VS 17.8.2, the latest non-preview. I have updated the initial post to reflect this.

@KevinRansom KevinRansom mentioned this issue Jul 3, 2024
3 tasks
vzarytovskii added a commit that referenced this issue Jul 17, 2024
* squash

* squash

* move adhoc tests and clean errors

* fix up constraint solving and adhoc testing

* remove tests

* fantomas

* skip fails

* fix tests

* fix up test baselines for change in order in checking

* update tests

* don't overwrite baselines

* fix some test failures

* skip warnings

* skip warnings

* fix warning logic

* fix tests

* fix sizes

* fix build

* fantomas and validation update

* corrections to self-use

* [WIP] [RFC FS-1060] Nullness checking (applied to codebase) (#15265)

* enablement

* enablement

* fix build

* fix build

* fantomas

* selective adoption

* Revert "[WIP] [RFC FS-1060] Nullness checking (applied to codebase) (#15265)" (#15309)

This reverts commit 559c058.

* Fixes

* Feature/nullness - parsing of constraints (#15753)

* Feature/nullness - parsing of constraints for:
'T: not null ....  syntax in Type argument specification
appType | NULL ...  for specifying types

* applying changed syntax

* positive.fs updated

* positive.fs paranthesis

* fixing "parse warning Remove spaces between the type name and type parameter, e.g. "C<'T>", not "C <'T>". Type parameters must be placed directly adjacent to the type name."

* positive .bsl updated

* Please mighty fantomas

* Feature nullness metadata export (#15981)

* fix merge mistake

* fix build

* fantomas

* bsl fix

* il tests update

* fix test

* tests fixed

* fantomas

* fix tests

* trim test

* trimming test

* trim check

* now?

* IL tests

* il tests

* trim test

* trim

* one more time

* Merge main to feature/nullness (#16366)

* Fixes #16359 - correctly handle imports with 0 length public key tokens (#16363)

* Parser: recover on unfinished record decls, fix field ranges (#16357)

* Parser: recover on unfinished record decls, fix field ranges

* Fantomas

* Better diagnostic ranges for fields

* More parser tests

* Update surface area

* Fix xml doc test

* Update baselines

* Update src/Compiler/SyntaxTree/SyntaxTree.fsi

Co-authored-by: Edgar Gonzalez <edgargonzalez.info@gmail.com>

* Add MutableKeyword to SynFieldTrivia. (#11)

* Simplify

* Fantomas

---------

Co-authored-by: Edgar Gonzalez <edgargonzalez.info@gmail.com>
Co-authored-by: Florian Verdonck <florian.verdonck@outlook.com>

---------

Co-authored-by: Kevin Ransom (msft) <codecutter@hotmail.com>
Co-authored-by: Eugene Auduchinok <eugene.auduchinok@jetbrains.com>
Co-authored-by: Edgar Gonzalez <edgargonzalez.info@gmail.com>
Co-authored-by: Florian Verdonck <florian.verdonck@outlook.com>
Co-authored-by: Tomas Grosup <tomasgrosup@microsoft.com>

* syntax tree layout

* Nullness-related aggressive trimming of FSharp.Core (#16387)

* Merge main to feature/nullness (#16397)

* [main] Update dependencies from dnceng/internal/dotnet-optimization (#16150)

* Update dependencies from https://dev.azure.com/dnceng/internal/_git/dotnet-optimization build 20231019.5

optimization.linux-arm64.MIBC.Runtime , optimization.linux-x64.MIBC.Runtime , optimization.windows_nt-arm64.MIBC.Runtime , optimization.windows_nt-x64.MIBC.Runtime , optimization.windows_nt-x86.MIBC.Runtime
 From Version 1.0.0-prerelease.23515.2 -> To Version 1.0.0-prerelease.23519.5

* Update dependencies from https://dev.azure.com/dnceng/internal/_git/dotnet-optimization build 20231019.5

optimization.linux-arm64.MIBC.Runtime , optimization.linux-x64.MIBC.Runtime , optimization.windows_nt-arm64.MIBC.Runtime , optimization.windows_nt-x64.MIBC.Runtime , optimization.windows_nt-x86.MIBC.Runtime
 From Version 1.0.0-prerelease.23515.2 -> To Version 1.0.0-prerelease.23519.5

* Update dependencies from https://dev.azure.com/dnceng/internal/_git/dotnet-optimization build 20231021.3

optimization.linux-arm64.MIBC.Runtime , optimization.linux-x64.MIBC.Runtime , optimization.windows_nt-arm64.MIBC.Runtime , optimization.windows_nt-x64.MIBC.Runtime , optimization.windows_nt-x86.MIBC.Runtime
 From Version 1.0.0-prerelease.23515.2 -> To Version 1.0.0-prerelease.23521.3

* Update dependencies from https://dev.azure.com/dnceng/internal/_git/dotnet-optimization build 20231021.3

optimization.linux-arm64.MIBC.Runtime , optimization.linux-x64.MIBC.Runtime , optimization.windows_nt-arm64.MIBC.Runtime , optimization.windows_nt-x64.MIBC.Runtime , optimization.windows_nt-x86.MIBC.Runtime
 From Version 1.0.0-prerelease.23515.2 -> To Version 1.0.0-prerelease.23521.3

---------

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>

* [main] Update dependencies from dotnet/arcade (#16241)

* Update dependencies from https://github.com/dotnet/arcade build 20231106.5

Microsoft.DotNet.Arcade.Sdk
 From Version 8.0.0-beta.23463.1 -> To Version 8.0.0-beta.23556.5

Dependency coherency updates

Microsoft.DotNet.XliffTasks
 From Version 1.0.0-beta.23426.1 -> To Version 1.0.0-beta.23475.1 (parent: Microsoft.DotNet.Arcade.Sdk

* Update dependencies from https://github.com/dotnet/arcade build 20231106.5

Microsoft.DotNet.Arcade.Sdk
 From Version 8.0.0-beta.23463.1 -> To Version 8.0.0-beta.23556.5

Dependency coherency updates

Microsoft.DotNet.XliffTasks
 From Version 1.0.0-beta.23426.1 -> To Version 1.0.0-beta.23475.1 (parent: Microsoft.DotNet.Arcade.Sdk

* Update dependencies from https://github.com/dotnet/arcade build 20231106.5

Microsoft.DotNet.Arcade.Sdk
 From Version 8.0.0-beta.23463.1 -> To Version 8.0.0-beta.23556.5

Dependency coherency updates

Microsoft.DotNet.XliffTasks
 From Version 1.0.0-beta.23426.1 -> To Version 1.0.0-beta.23475.1 (parent: Microsoft.DotNet.Arcade.Sdk

* Update dependencies from https://github.com/dotnet/arcade build 20231106.5

Microsoft.DotNet.Arcade.Sdk
 From Version 8.0.0-beta.23463.1 -> To Version 8.0.0-beta.23556.5

Dependency coherency updates

Microsoft.DotNet.XliffTasks
 From Version 1.0.0-beta.23426.1 -> To Version 1.0.0-beta.23475.1 (parent: Microsoft.DotNet.Arcade.Sdk

* Update dependencies from https://github.com/dotnet/arcade build 20231106.5

Microsoft.DotNet.Arcade.Sdk
 From Version 8.0.0-beta.23463.1 -> To Version 8.0.0-beta.23556.5

Dependency coherency updates

Microsoft.DotNet.XliffTasks
 From Version 1.0.0-beta.23426.1 -> To Version 1.0.0-beta.23475.1 (parent: Microsoft.DotNet.Arcade.Sdk

* Update dependencies from https://github.com/dotnet/arcade build 20231106.5

Microsoft.DotNet.Arcade.Sdk
 From Version 8.0.0-beta.23463.1 -> To Version 8.0.0-beta.23556.5

Dependency coherency updates

Microsoft.DotNet.XliffTasks
 From Version 1.0.0-beta.23426.1 -> To Version 1.0.0-beta.23475.1 (parent: Microsoft.DotNet.Arcade.Sdk

* Update dependencies from https://github.com/dotnet/arcade build 20231106.5

Microsoft.DotNet.Arcade.Sdk
 From Version 8.0.0-beta.23463.1 -> To Version 8.0.0-beta.23556.5

Dependency coherency updates

Microsoft.DotNet.XliffTasks
 From Version 1.0.0-beta.23426.1 -> To Version 1.0.0-beta.23475.1 (parent: Microsoft.DotNet.Arcade.Sdk

* Update dependencies from https://github.com/dotnet/arcade build 20231114.4

Microsoft.DotNet.Arcade.Sdk
 From Version 8.0.0-beta.23463.1 -> To Version 8.0.0-beta.23564.4

Dependency coherency updates

Microsoft.DotNet.XliffTasks
 From Version 1.0.0-beta.23426.1 -> To Version 1.0.0-beta.23475.1 (parent: Microsoft.DotNet.Arcade.Sdk

* Update dependencies from https://github.com/dotnet/arcade build 20231114.4

Microsoft.DotNet.Arcade.Sdk
 From Version 8.0.0-beta.23463.1 -> To Version 8.0.0-beta.23564.4

Dependency coherency updates

Microsoft.DotNet.XliffTasks
 From Version 1.0.0-beta.23426.1 -> To Version 1.0.0-beta.23475.1 (parent: Microsoft.DotNet.Arcade.Sdk

* Update dependencies from https://github.com/dotnet/arcade build 20231114.4

Microsoft.DotNet.Arcade.Sdk
 From Version 8.0.0-beta.23463.1 -> To Version 8.0.0-beta.23564.4

Dependency coherency updates

Microsoft.DotNet.XliffTasks
 From Version 1.0.0-beta.23426.1 -> To Version 1.0.0-beta.23475.1 (parent: Microsoft.DotNet.Arcade.Sdk

* Update dependencies from https://github.com/dotnet/arcade build 20231114.4

Microsoft.DotNet.Arcade.Sdk
 From Version 8.0.0-beta.23463.1 -> To Version 8.0.0-beta.23564.4

Dependency coherency updates

Microsoft.DotNet.XliffTasks
 From Version 1.0.0-beta.23426.1 -> To Version 1.0.0-beta.23475.1 (parent: Microsoft.DotNet.Arcade.Sdk

* Update dependencies from https://github.com/dotnet/arcade build 20231114.4

Microsoft.DotNet.Arcade.Sdk
 From Version 8.0.0-beta.23463.1 -> To Version 8.0.0-beta.23564.4

Dependency coherency updates

Microsoft.DotNet.XliffTasks
 From Version 1.0.0-beta.23426.1 -> To Version 1.0.0-beta.23475.1 (parent: Microsoft.DotNet.Arcade.Sdk

* Update dependencies from https://github.com/dotnet/arcade build 20231114.4

Microsoft.DotNet.Arcade.Sdk
 From Version 8.0.0-beta.23463.1 -> To Version 8.0.0-beta.23564.4

Dependency coherency updates

Microsoft.DotNet.XliffTasks
 From Version 1.0.0-beta.23426.1 -> To Version 1.0.0-beta.23475.1 (parent: Microsoft.DotNet.Arcade.Sdk

* Update dependencies from https://github.com/dotnet/arcade build 20231114.4

Microsoft.DotNet.Arcade.Sdk
 From Version 8.0.0-beta.23463.1 -> To Version 8.0.0-beta.23564.4

Dependency coherency updates

Microsoft.DotNet.XliffTasks
 From Version 1.0.0-beta.23426.1 -> To Version 1.0.0-beta.23475.1 (parent: Microsoft.DotNet.Arcade.Sdk

* Update dependencies from https://github.com/dotnet/arcade build 20231114.4

Microsoft.DotNet.Arcade.Sdk
 From Version 8.0.0-beta.23463.1 -> To Version 8.0.0-beta.23564.4

Dependency coherency updates

Microsoft.DotNet.XliffTasks
 From Version 1.0.0-beta.23426.1 -> To Version 1.0.0-beta.23475.1 (parent: Microsoft.DotNet.Arcade.Sdk

* Update dependencies from https://github.com/dotnet/arcade build 20231114.4

Microsoft.DotNet.Arcade.Sdk
 From Version 8.0.0-beta.23463.1 -> To Version 8.0.0-beta.23564.4

Dependency coherency updates

Microsoft.DotNet.XliffTasks
 From Version 1.0.0-beta.23426.1 -> To Version 1.0.0-beta.23475.1 (parent: Microsoft.DotNet.Arcade.Sdk

* Update dependencies from https://github.com/dotnet/arcade build 20231114.4

Microsoft.DotNet.Arcade.Sdk
 From Version 8.0.0-beta.23463.1 -> To Version 8.0.0-beta.23564.4

Dependency coherency updates

Microsoft.DotNet.XliffTasks
 From Version 1.0.0-beta.23426.1 -> To Version 1.0.0-beta.23475.1 (parent: Microsoft.DotNet.Arcade.Sdk

* Update dependencies from https://github.com/dotnet/arcade build 20231114.4

Microsoft.DotNet.Arcade.Sdk
 From Version 8.0.0-beta.23463.1 -> To Version 8.0.0-beta.23564.4

Dependency coherency updates

Microsoft.DotNet.XliffTasks
 From Version 1.0.0-beta.23426.1 -> To Version 1.0.0-beta.23475.1 (parent: Microsoft.DotNet.Arcade.Sdk

* Update dependencies from https://github.com/dotnet/arcade build 20231114.4

Microsoft.DotNet.Arcade.Sdk
 From Version 8.0.0-beta.23463.1 -> To Version 8.0.0-beta.23564.4

Dependency coherency updates

Microsoft.DotNet.XliffTasks
 From Version 1.0.0-beta.23426.1 -> To Version 1.0.0-beta.23475.1 (parent: Microsoft.DotNet.Arcade.Sdk

* Update dependencies from https://github.com/dotnet/arcade build 20231114.4

Microsoft.DotNet.Arcade.Sdk
 From Version 8.0.0-beta.23463.1 -> To Version 8.0.0-beta.23564.4

Dependency coherency updates

Microsoft.DotNet.XliffTasks
 From Version 1.0.0-beta.23426.1 -> To Version 1.0.0-beta.23475.1 (parent: Microsoft.DotNet.Arcade.Sdk

* Update dependencies from https://github.com/dotnet/arcade build 20231114.4

Microsoft.DotNet.Arcade.Sdk
 From Version 8.0.0-beta.23463.1 -> To Version 8.0.0-beta.23564.4

Dependency coherency updates

Microsoft.DotNet.XliffTasks
 From Version 1.0.0-beta.23426.1 -> To Version 1.0.0-beta.23475.1 (parent: Microsoft.DotNet.Arcade.Sdk

* Update dependencies from https://github.com/dotnet/arcade build 20231114.4

Microsoft.DotNet.Arcade.Sdk
 From Version 8.0.0-beta.23463.1 -> To Version 8.0.0-beta.23564.4

Dependency coherency updates

Microsoft.DotNet.XliffTasks
 From Version 1.0.0-beta.23426.1 -> To Version 1.0.0-beta.23475.1 (parent: Microsoft.DotNet.Arcade.Sdk

* Update dependencies from https://github.com/dotnet/arcade build 20231114.4

Microsoft.DotNet.Arcade.Sdk
 From Version 8.0.0-beta.23463.1 -> To Version 8.0.0-beta.23564.4

Dependency coherency updates

Microsoft.DotNet.XliffTasks
 From Version 1.0.0-beta.23426.1 -> To Version 1.0.0-beta.23475.1 (parent: Microsoft.DotNet.Arcade.Sdk

* Update dependencies from https://github.com/dotnet/arcade build 20231114.4

Microsoft.DotNet.Arcade.Sdk
 From Version 8.0.0-beta.23463.1 -> To Version 8.0.0-beta.23564.4

Dependency coherency updates

Microsoft.DotNet.XliffTasks
 From Version 1.0.0-beta.23426.1 -> To Version 1.0.0-beta.23475.1 (parent: Microsoft.DotNet.Arcade.Sdk

* Update dependencies from https://github.com/dotnet/arcade build 20231130.1

Microsoft.DotNet.Arcade.Sdk
 From Version 8.0.0-beta.23463.1 -> To Version 8.0.0-beta.23580.1

Dependency coherency updates

Microsoft.DotNet.XliffTasks
 From Version 1.0.0-beta.23426.1 -> To Version 1.0.0-beta.23475.1 (parent: Microsoft.DotNet.Arcade.Sdk

* Update dependencies from https://github.com/dotnet/arcade build 20231130.1

Microsoft.DotNet.Arcade.Sdk
 From Version 8.0.0-beta.23463.1 -> To Version 8.0.0-beta.23580.1

Dependency coherency updates

Microsoft.DotNet.XliffTasks
 From Version 1.0.0-beta.23426.1 -> To Version 1.0.0-beta.23475.1 (parent: Microsoft.DotNet.Arcade.Sdk

* Update dependencies from https://github.com/dotnet/arcade build 20231130.1

Microsoft.DotNet.Arcade.Sdk
 From Version 8.0.0-beta.23463.1 -> To Version 8.0.0-beta.23580.1

Dependency coherency updates

Microsoft.DotNet.XliffTasks
 From Version 1.0.0-beta.23426.1 -> To Version 1.0.0-beta.23475.1 (parent: Microsoft.DotNet.Arcade.Sdk

* Update dependencies from https://github.com/dotnet/arcade build 20231130.1

Microsoft.DotNet.Arcade.Sdk
 From Version 8.0.0-beta.23463.1 -> To Version 8.0.0-beta.23580.1

Dependency coherency updates

Microsoft.DotNet.XliffTasks
 From Version 1.0.0-beta.23426.1 -> To Version 1.0.0-beta.23475.1 (parent: Microsoft.DotNet.Arcade.Sdk

* Update dependencies from https://github.com/dotnet/arcade build 20231130.1

Microsoft.DotNet.Arcade.Sdk
 From Version 8.0.0-beta.23463.1 -> To Version 8.0.0-beta.23580.1

Dependency coherency updates

Microsoft.DotNet.XliffTasks
 From Version 1.0.0-beta.23426.1 -> To Version 1.0.0-beta.23475.1 (parent: Microsoft.DotNet.Arcade.Sdk

---------

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: Vlad Zarytovskii <vzaritovsky@hotmail.com>
Co-authored-by: Tomas Grosup <tomasgrosup@microsoft.com>

* Name resolution: don't search extension members in type abbreviations (#16390)

* Name resolution: don't search extension members in type abbreviations

* Add test

* Revert "[main] Update dependencies from dotnet/arcade (#16241)" (#16396)

This reverts commit f219a99.

* trimmed size updated

---------

Co-authored-by: dotnet-maestro[bot] <42748379+dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: Vlad Zarytovskii <vzaritovsky@hotmail.com>
Co-authored-by: Tomas Grosup <tomasgrosup@microsoft.com>
Co-authored-by: Eugene Auduchinok <eugene.auduchinok@jetbrains.com>

* Nullness interop - import of C#-emitted metadata (#16423)

* Nullness - include in QuickInfo and in general in "typeEnc" (string representation of a type) (#16555)

* failing test

* todo for IL import

* explanation added

* il meta parsing

* flags evaluation

* you shall passs

* evaluateFirstOrderNullnessAndAdvance

* import il type with nullness

* type import

* IL nullness import

fields, props, events, method args, method return types - nullness imported from IL

* test rename

* fantomas

* get stack trace on error

* split ilmethod's type

* fix crashes for Csharp style extensions

* solve coexistance of nullness and Is* properties of DUs

* updating tests

* clean tests

* fantomas

* fantomas one more time

* importing nullness for generic typars

* print failing ivals, let's see

* write even more!

* isolated failing test - combo of module rec, signature file, IVT

* another attempt

* format

* test

* hide tests

* Remove 'specialname' for DU case tester

* format

* warning as error

* update baseline netcore

* nullable errors not in desktop framework

* surface area, trimming

* surface area

* cosmetic cleanup & annotations

* Rename to ILMethParentTypeInfo

* making vMapFold tail recursive

* physical nullnessEquiv

* format

* Commenting SkipNullness usages

* Nullness work - activity module

* Remove strict generic 'T:null' import

* Null|NonNull pattern also for regular compilation

* Backported Null|NonNull active pattern

* one more time

* revert

* Show nullness in quickinfo and in general in type representations

* Merge main to feature/nullness (#16539)

Merge of main + syntax conflict resolution + semantic conflict resolution

* release notes

* Fix ILType.Array import (#16585)

* Nullness - reading+writing metadata for  'inherits' and interface implementations (#16597)

* ILGenerator test case

* Nullness :: Format string %s should allow nullable string (#16656)

* Nullness::  Unchecked.nonNull for FSharp.Core (#16654)

* Nullness :: Pattern matching with null should mark input for subsequent clauses as without null + support for matching nulls in tuples (#16659)

* Feature nullness - support overrides of nullness annotation in the imported object hierarchy (#16711)

* Improve type inference w.r.t. nullness in printing (#16681)

* Update tests/AheadOfTime/Trimming/check.ps1

* Fix merge errors

* il tests reflecting visibility change

* Nullness feature :: New warning for functions insisting on a (WithNull) argument + typar equality fix (#16853)

Null-handling functions now have the option to raise a warning when they are called with a known-to-be-withoutNull argument.
That way, API authors (incl. Fsharp.Core) can help with cleaning code from superflous null checks.

While doing it, a strange error kept coming when using Option.ofObj and other functions with a (T | null) typar.
It turned out that nullness info had been striped from nullable typars on stripTyparEqnsAux calls in some occasions, leading to treating all typars as 'KnownWithoutNull' even when that was not true.

* Feature nullness - propper guards against ` | null ` on unsupported types (#16907)

TODOs resolved:
* mkAppTy resolved
* mkFunTyWithNullness
* delayed checks of post-infered values for nullness-carrying capabilities

* Feature nullness :: warn also for 'obj' type (since it can be infered for null literal) (#16962)

* Nullness feature :: various bugfixes (#17080)

* Bugfix - matching aliased nullable should strip nullness

Eliminating nullness after pattern matching null (that is , for subsequent patterns) must visit contents of abbreviations as well. Otherwise it does not work with the Maybe<T> type whcih we use in the compiler.

* Making 'obj' work with new 'not null' constraints in fslib functions

Bugfix: obj cannot be passed to generic typars which require T: not null, such as the NonNull active pattern.

This commit fixes it.

* Bugfix - false 'useless null' warning in nested applications

Error fixed:
Error on useless null checkwith nullness constraint propagation in code like this:let meTry = Option.ofObj (Path.GetDirectoryName "")`. The warning about 'useless Option.ofObj' points to the string literal, ignoring the string literal is first passed to an API which may return null

* Fix import for C# extension methods

Bugfix for:
C# extension methods which put "?" on the this argument are wrongly interpreted by moving the nullability elsewhere. See AsMemory<T> from System.Memory.dll , this treats byteArray.ToMemory() as resulting in a Memory<byte | null> which is clearly wrong.

Also, this now allows to call C# extension methods with ?this to be invoked on a nullable value.

* LinkedList First,Last bugfix

There was a bug of LinkedList .First and .Last properties not returning nullable nodes.
This was fixed by improved byte import in previous commit, adding a regression test for guarding this.


* Bugfix: Solve nullness for typars

This fixes a bug where `not null` generic constraint was incorrectly passed between two typars:`T1 | null` with not null constraint on T1, and T2 without constraints.

This occured when calling Option.ofObj(..) when the inner expression caused solving of generic type arguments, e.g. after (|>) or (id) function.

This uses additional inference variable to unify them.

* updating IL tests

* One more try

* surface area

* trimmed size

* trimmed size

* fix issues for plain 'dotnet build Fsharp.Compiler.Service.sln`

* update FSharpCoreShippedPackageVersionValue

* Wkraround attributetargets issue by using 'obj'. This removes 3x box and adds 1x unbox.

* Feature nullness :: Bugfixes (#17102)

* Ignore Nullness applied on structs (C# allows T? when when T is a struct)
* Bigfix: Working with CLI events in Fsharp
* Bugfix: Mutable binding initially assigned to null should not need type annotation
* Solving `let mutable cache = null` via type inference
* Enforcing TyparConstraint.IsReferenceType when WithNull type is used
* Nullness-related constraint consistency
* Bugfix for emitting Nullable attrs for C#

* Automated command ran: fantomas

  Co-authored-by: T-Gro <46543583+T-Gro@users.noreply.github.com>

* Feature nullness ::  Try infer without null even when function/method arg is marked as nullable (#17269)

* Feature nullness :: apply nullness annotations to usages of 'obj' in Fsharp.Core (#17284)

* resolve build error from auto-merge

* Feature nullness :: Cleanups, Test reorg, fix incrementalbuild cache behavior (#17309)


* Fix TransparentCompiler - it should report PostInference errors if it only encountered a warning (reported as an error due to confiig)

* fix build issues

* resolve semantic merge error

* Nullness subsumption when used for contravariant typars

* fix nullness plain build (#17404)

* Update docs/release-notes/.FSharp.Compiler.Service/8.0.300.md

* Update release notes

* Update check.ps1

* Update check.ps1

---------

Co-authored-by: Vlad Zarytovskii <vzaritovsky@hotmail.com>
Co-authored-by: Tomas Grosup <tomasgrosup@microsoft.com>
Co-authored-by: dotnet bot <dotnet-bot@dotnetfoundation.org>
Co-authored-by: Kevin Ransom (msft) <codecutter@hotmail.com>
Co-authored-by: Eugene Auduchinok <eugene.auduchinok@jetbrains.com>
Co-authored-by: Edgar Gonzalez <edgargonzalez.info@gmail.com>
Co-authored-by: Florian Verdonck <florian.verdonck@outlook.com>
Co-authored-by: dotnet-maestro[bot] <42748379+dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: psfinaki <psfinaki@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants