JetBrains/resharper-fsharp

Support for <WarnOn> MSBuild property

NinoFloris opened this issue · 5 comments

F# 6.0 SDK released with support for specifying warnings via a new MSBuild property which isn't picked up by Rider yet.
dotnet/fsharp#10885

I'm assuming to light this up, support needs to be added over here? https://github.com/JetBrains/resharper-fsharp/blob/b3bdd454313fb4b32e924ad5b72238245f020f7c/ReSharper.FSharp/src/FSharp.Psi.Daemon/src/Stages/FSharpCompilerWarningProcessor.fs

@NinoFloris Could you please share a small repro solution showing where Rider doesn't show a warning while the console build does?

The example from dotnet/fsharp#13437 doesn't produce any additional warning during build for me.

I've also checked it with FS3180 and got no warnings produced by FCS inside neither Rider nor Visual Studio, so it'd be better to report it to FCS.

The FS3180 case is now reported to FCS: dotnet/fsharp#13442.

I see, I've changed the repro in the F# issue, there is apparently more broken in the compiler around 3395.

You should now see a warning appear under StringValues("1") when 3395 is specified via OtherFlags, but none via WarnOn

For complete reference:

repro

open System

// Minimized copy for demonstration of Microsoft.Extensions.Primitives.StringValues
type StringValues(v: string) =
    static member op_Implicit(values: StringValues): string = ""
    
type Foo(_v: Nullable<int>) =
    member val Test: Nullable<int> = 0 with get,set // Warning for 3391 as I would have interpreted it.
    member val StringValue: string = "" with get,set
    
    static member Create() =
      let value = 1
      let instance = Foo(value, Test = value) // No warning on either the argument or the property setter?
      instance.Test <- value // No warning for 3395 and 3391?
      instance.StringValue <- StringValues("1") // Warning for 3395
      
      let mutable test: Nullable<int> = value // Warning for 3391 as I would have interpreted it.
      
      // Warning for 3391 but it's syntactically identical to the line that had no warning and one that had 3395???
      test <- 1 

fsproj

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

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net7.0</TargetFramework>
<!--  Warning when uncommented  -->
<!--    <OtherFlags>$(OtherFlags) &#45;&#45;warnon:3395</OtherFlags>-->

<!--  No warning when uncommented  -->
    <WarnOn>$(WarnOn); 3395</WarnOn>
  </PropertyGroup>

  <ItemGroup>
    <Compile Include="Program.fs" />
  </ItemGroup>
</Project>

@auduchinok can you confirm the example repros?

@NinoFloris Yes, I can repro the OtherFlags vs WarnOn difference, thank you!