fsharp icon indicating copy to clipboard operation
fsharp copied to clipboard

F# Intellisense is not initialized for net8.0-windows10.0.xxxxx

Open vsfeedback opened this issue 1 year ago • 1 comments

This issue has been moved from a ticket on Developer Community.


Having F# project like this

<Project Sdk="Uno.Sdk">
  <PropertyGroup>
    <TargetFrameworks>$(DotNetVersion);$(DotNetVersion)-windows10.0.22621</TargetFrameworks>
    <TargetFrameworks Condition=" '$(OverrideTargetFramework)' != '' ">$(OverrideTargetFramework)</TargetFrameworks>

    <UnoSingleProject>true</UnoSingleProject>
    <OutputType>Library</OutputType>
    <GenerateDocumentationFile>true</GenerateDocumentationFile>

    <!-- Ensures the .xr.xml files are generated in a proper layout folder -->
    <GenerateLibraryLayout>true</GenerateLibraryLayout>
    <!--
      If you encounter this error message:

        error NETSDK1148: A referenced assembly was compiled using a newer version of Microsoft.Windows.SDK.NET.dll.
        Please update to a newer .NET SDK in order to reference this assembly.

      This means that the two packages below must be aligned with the "build" version number of
      the "Microsoft.Windows.SDK.BuildTools" package above, and the "revision" version number
      must be the highest found in https://www.nuget.org/packages/Microsoft.Windows.SDK.NET.Ref.
    -->
    <!-- <WindowsSdkPackageVersion>10.0.22621.31</WindowsSdkPackageVersion> -->

  </PropertyGroup>
  <Target Name="XamlPreCompile" Condition="$(TargetFramework.Contains('windows10'))" />
</Project>

global.json

{
  "msbuild-sdks": {
    "Uno.Sdk": "5.2.175"
  }
}

solution-config.props

<Project>
  <!--
        This file is used to control the platforms compiled by Visual Studio, and allow for a faster
        build when testing for a single platform. This will also result in better intellisense, as
        the compiler will only load the assemblies for the platform that is being built. You do not
        need to use this when compiling from Visual Studio Code, the command line or other IDEs.

        Instructions:
        1) Copy this file and remove the ".sample" name
        2) Uncomment the single property below for the target you want to build
        3) Make sure to do a Rebuild, so that nuget restores the proper packages for the new target

        Notes:
        - You may optionally close the solution before making changes and reload the solution afterwards. This will avoid Visual Studio
          asking you to reload any projects, it will also ensure that the changes are picked up by Visual Studio, and trigger a restore of
          the packages.
        - You may want to unload the platform heads that you are not going to build for. This will ensure that Visual Studio does not
          try to build them, and will speed up the build process.
    -->

  <PropertyGroup>
    <!-- Uncomment each line for each platform that you want to build: -->

    <OverrideTargetFramework Condition="''!='hint: Windows App Sdk (WinUI)'">$(DotNetVersion)-windows10.0.22621</OverrideTargetFramework>
    <!--<OverrideTargetFramework Condition="''!='hint: Windows App Sdk (WinUI)' AND '$(MSBuildProjectExtension)'=='.csproj'">$(DotNetVersion)-browserwasm;$(DotNetVersion)-windows10.0.22621</OverrideTargetFramework>
    <OverrideTargetFramework Condition="''!='hint: Windows App Sdk (WinUI)' AND '$(MSBuildProjectExtension)'=='.fsproj'">$(DotNetVersion);$(DotNetVersion)-windows10.0.22621</OverrideTargetFramework>-->
    <!-- <OverrideTargetFramework Condition="''!='hint: Webassembly' AND '$(MSBuildProjectExtension)'=='.csproj'">$(DotNetVersion)-browserwasm</OverrideTargetFramework> -->
    <!-- <OverrideTargetFramework Condition="''!='hint: Webassembly' AND '$(MSBuildProjectExtension)'=='.fsproj'">$(DotNetVersion)</OverrideTargetFramework> -->
    <!-- <OverrideTargetFramework Condition="''!='hint: Desktop'">$(DotNetVersion)-desktop</OverrideTargetFramework> -->
    <!-- <OverrideTargetFramework Condition="''!='hint: iOS'">$(DotNetVersion)-ios</OverrideTargetFramework> -->
     <!--<OverrideTargetFramework Condition="''!='hint: Android'">$(DotNetVersion)-android</OverrideTargetFramework>-->
    <!-- <OverrideTargetFramework Condition="''!='hint: MacCatalyst'">$(DotNetVersion)-maccatalyst</OverrideTargetFramework> -->
  </PropertyGroup>
</Project>

Original Comments

Feedback Bot on 7/10/2024, 03:35 AM:

(private comment, text removed)


Original Solutions

(no solutions)

vsfeedback avatar Jul 24 '24 10:07 vsfeedback

Nothing unusual in prism, session looks ok (unless it's reported from separate session).

vzarytovskii avatar Jul 24 '24 10:07 vzarytovskii

You can try cloning this repo https://github.com/Ecierge/Elmish.Uno/tree/Ecierge And opening either Elmish.Uno.sln or Samples.sln

But in order to experience the problem immediately it is better to replace this line https://github.com/Ecierge/Elmish.Uno/blob/3c09b43ee22297151ee09ae1c463f864adcb6721/src/Elmish.Uno/Elmish.Uno.fsproj#L3 with <TargetFrameworks>$(DotNetVersion)-windows10.0.22621</TargetFrameworks> Use windows10.0.22621 whatever Windows SDK you have installed, it does not matter for the issue to appear

xperiandri avatar Sep 06 '24 09:09 xperiandri

https://github.com/user-attachments/assets/e9009693-404a-4ab3-a616-78b770e13a40

xperiandri avatar Sep 06 '24 09:09 xperiandri

@abonie can I help you somehow? This issue affects our team's performance very-very much ☹️☹️☹️

xperiandri avatar Jan 08 '25 01:01 xperiandri

I unassigned myself - didn't have time to even look into the issue yet :/

abonie avatar Jan 08 '25 08:01 abonie

You can try cloning this repo https://github.com/Ecierge/Elmish.Uno/tree/Ecierge And opening either Elmish.Uno.sln or Samples.sln

But in order to experience the problem immediately it is better to replace this line https://github.com/Ecierge/Elmish.Uno/blob/3c09b43ee22297151ee09ae1c463f864adcb6721/src/Elmish.Uno/Elmish.Uno.fsproj#L3 with <TargetFrameworks>$(DotNetVersion)-windows10.0.22621</TargetFrameworks> Use windows10.0.22621 whatever Windows SDK you have installed, it does not matter for the issue to appear

I tried out of curiosity, but these repro steps don't do it for me. There are other errors but typechecking seems fine: Image

majocha avatar Jan 08 '25 08:01 majocha

@majocha what if you have 2 target frameworks? Windows and Desktop or a Windows and plain .NET

xperiandri avatar Jan 08 '25 12:01 xperiandri

@xperiandri I tested with this: <TargetFrameworks>$(DotNetVersion)-windows10.0.22621;$(DotNetVersion)</TargetFrameworks>

F# analysis worked fine from the start. Curiously I had some yellow bars in VS indicating Roslyn (C#) exceptions. Those disappeared after I built the solution properly.

However I did 2 changes, to make it build:

ETA: VS 17.12.3

majocha avatar Jan 08 '25 12:01 majocha

Do you have 1 or 2 frameworks in this combobox (highlighted yellow)?

Image

xperiandri avatar Jan 08 '25 17:01 xperiandri

You need to have both to be present for the issue to happen

xperiandri avatar Jan 08 '25 17:01 xperiandri

Yep: Image

majocha avatar Jan 08 '25 17:01 majocha

Interestingly, this happens for me only when I change a branch in Git

xperiandri avatar Jan 08 '25 17:01 xperiandri

Interestingly, this happens for me only when I change a branch in Git

Do you happen to have Transparent Compiler enabled? Image

majocha avatar Jan 08 '25 17:01 majocha

I enabled only snapshots

xperiandri avatar Jan 09 '25 00:01 xperiandri

Ok I can repro this now with Samples.sln from Elmish.

Edit: Let me look deeper into it, but basically for some projects we never get an item cached in commandLineOptions.

majocha avatar Jul 23 '25 08:07 majocha

Just noticed the full config above - is the OverrideTargetFramework needed here? Also, there is a commented line specific to .fsproj, is that intentional?

T-Gro avatar Jul 23 '25 09:07 T-Gro

Ok I can repro this now with Samples.sln from Elmish.

Edit: Let me look deeper into it, but basically for some projects we never get an item cached in commandLineOptions.

And after git clean it works again. It seems some combination of built / restored / partially built with some errors puts the solution into a state where CPS just does not report options for Elmish.Uno.fsproj net8.0-windows10.0 but it's intermittent.

majocha avatar Jul 23 '25 09:07 majocha

Framework override used if you want to filter some targets locally. I.e. You want to work with Windows and Android only instead of loading and building all Windows, Android, iOS, MacCatalyst, Wasm, Desktop Uno targets

xperiandri avatar Jul 23 '25 09:07 xperiandri

@T-Gro, wich commented line?

xperiandri avatar Jul 23 '25 09:07 xperiandri

@majocha Yep, it works after clean but breaks then

xperiandri avatar Jul 23 '25 09:07 xperiandri

This is when it works ok:

Image

When it's broken, commandLineOptions has Count = 6 and the Elmish.Uno windows target is missing from it.

majocha avatar Jul 23 '25 09:07 majocha

@T-Gro, wich commented line?

This: <OverrideTargetFramework Condition="''!='hint: Windows App Sdk (WinUI)' AND '$(MSBuildProjectExtension)'=='.fsproj'">$(DotNetVersion);$(DotNetVersion)-windows10.0.22621</OverrideTargetFramework>-->

T-Gro avatar Jul 23 '25 10:07 T-Gro

Ah, at that time, I tried another set of frameworks for F# projects. Not all (Windows, Android, iOS, MacCatalyst, Wasm, Desktop Uno targets), but only Windows and generic (net8.0-windows10.x.x.x;net8.0). But I no longer do that, as the generic target is not suitable for other platforms

xperiandri avatar Jul 23 '25 14:07 xperiandri

Now I do only

<Project Sdk="Uno.Sdk">
  <PropertyGroup>
    <TargetFrameworks>
      $(DotNetVersion)-android;
      $(DotNetVersion)-ios;
      $(DotNetVersion)-maccatalyst;
      $(DotNetVersion)-windows10.0.26100;
      $(DotNetVersion)
    </TargetFrameworks>
    <TargetFrameworks Condition=" '$(OverrideTargetFramework)' != '' ">$(OverrideTargetFramework)</TargetFrameworks>
<Project>
  <PropertyGroup>
    <!-- Uncomment each line for each platform that you want to build: -->

    <!--<OverrideTargetFramework Condition="''!='hint: Windows App Sdk (WinUI)' OR ''!='hint: Webassembly'">$(DotNetVersion)-windows10.0.26100;$(DotNetVersion)-browserwasm;$(DotNetVersion)</OverrideTargetFramework>-->
    <!--<OverrideTargetFramework Condition="''!='hint: Windows App Sdk (WinUI)' OR ''!='hint: Desktop'">$(DotNetVersion)-windows10.0.26100;$(DotNetVersion)-desktop;$(DotNetVersion)</OverrideTargetFramework>-->
    <OverrideTargetFramework Condition="''!='hint: Windows App Sdk (WinUI)'">$(DotNetVersion)-windows10.0.26100;$(DotNetVersion)</OverrideTargetFramework>
    <!--<OverrideTargetFramework Condition="''!='hint: Windows App Sdk (WinUI)' AND '$(MSBuildProjectExtension)'=='.csproj'">$(DotNetVersion)-browserwasm;$(DotNetVersion)-windows10.0.22621</OverrideTargetFramework>
    <OverrideTargetFramework Condition="''!='hint: Windows App Sdk (WinUI)' AND '$(MSBuildProjectExtension)'=='.fsproj'">$(DotNetVersion);$(DotNetVersion)-windows10.0.22621</OverrideTargetFramework>-->
     <!--<OverrideTargetFramework Condition="''!='hint: Webassembly'">$(DotNetVersion)-browserwasm;$(DotNetVersion)</OverrideTargetFramework>-->
     <!--<OverrideTargetFramework Condition="''!='hint: Webassembly' AND '$(MSBuildProjectExtension)'=='.csproj'">$(DotNetVersion)-browserwasm</OverrideTargetFramework>
     <OverrideTargetFramework Condition="''!='hint: Webassembly' AND '$(MSBuildProjectExtension)'=='.fsproj'">$(DotNetVersion)</OverrideTargetFramework>-->
    <!--<OverrideTargetFramework Condition="''!='hint: Desktop'">$(DotNetVersion)-desktop</OverrideTargetFramework>-->
    <!--<OverrideTargetFramework Condition="''!='hint: iOS'">$(DotNetVersion)-ios</OverrideTargetFramework>-->
    <!--<OverrideTargetFramework Condition="''!='hint: Android'">$(DotNetVersion)-android</OverrideTargetFramework>-->
    <!--<OverrideTargetFramework Condition="''!='hint: MacCatalyst'">$(DotNetVersion)-maccatalyst</OverrideTargetFramework>-->
  </PropertyGroup>
</Project>

xperiandri avatar Jul 23 '25 14:07 xperiandri