fsharp icon indicating copy to clipboard operation
fsharp copied to clipboard

Project system displays the C# warning levels mechanism for F# project

Open vsfeedback opened this issue 3 years ago • 9 comments

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


[severity:It bothers me. A fix would be nice] I have an project for fsharp, it is Microsoft.NET.Sdk with targetframework net6.0-windows. When I right click the project in the solution explorer, and click properties, I can scroll down to the "Errors and warnings". The Warning level is default set to 3. From the dropdown menu, it gives the option to set it to "7 - Warnings from C# 11". When I select this option, and build the project, it wails with an error: Severity Code Description Project File Line Suppression State Error FS1050 Invalid warning level '7' ProjectName C:\Users\username\foldername\Documents\foldername\Products\projectname\src\solutionname\projectnamei\FSC 1 Active


Original Comments

Feedback Bot on 6/10/2022, 10:26 AM:

(private comment, text removed)


Original Solutions

(no solutions)

vsfeedback avatar Aug 17 '22 15:08 vsfeedback

@vzarytovskii The project system displays the C# warning levels mechanism for F# project, we should look at this.

image

KevinRansom avatar Aug 27 '22 23:08 KevinRansom

I originally reported this bug because we noticed that the builderver using Build tools MSBuild reported more warnings then visual studio on the local machine. When I stated investigating this issue, I noticed that the C# warning level is being used for f# projects and I was hoping that this could be cause solution of my problem.

Is there any known workaround or fix available to see all the warnings for my f# solution in visual studio?

MatthijsPrent avatar Jan 03 '23 07:01 MatthijsPrent

@vzarytovskii I'd love to tackle this. Do you happen to know off-hand where this is located? Otherwise, I'll search around a bit.

abelbraaksma avatar May 14 '24 14:05 abelbraaksma

@vzarytovskii I'd love to tackle this. Do you happen to know off-hand where this is located? Otherwise, I'll search around a bit.

I don't think it's part of this repository. Probably it's in dotnet/proj-info

vzarytovskii avatar May 14 '24 14:05 vzarytovskii

Found it, and reported: https://github.com/dotnet/project-system/issues/9469.

This changed was introduced in 2022 without any mention of F# in https://github.com/dotnet/project-system/pull/7982 and https://github.com/dotnet/project-system/pull/8004.

abelbraaksma avatar May 15 '24 16:05 abelbraaksma

Is there any known workaround or fix available to see all the warnings for my f# solution in visual studio?

Yes @MatthijsPrent. Set the warning level to 5 (you can ignore the description of that level).

abelbraaksma avatar May 15 '24 16:05 abelbraaksma

A fix is in PR here: https://github.com/dotnet/project-system/pull/9511

drewnoakes avatar Jul 24 '24 10:07 drewnoakes

@vzarytovskii @abelbraaksma @KevinRansom are there other properties in the VS Project Properties UI that don't work, or are missing? It's very easy to adjust these properties now, so let me know if changes are needed. At least, keep it in mind for future.

drewnoakes avatar Jul 24 '24 12:07 drewnoakes

@vzarytovskii @abelbraaksma @KevinRansom are there other properties in the VS Project Properties UI that don't work, or are missing? It's very easy to adjust these properties now, so let me know if changes are needed.

Not from the top of my head now. We will probably update them later to support nullable references. Thanks for fixing it!

vzarytovskii avatar Jul 24 '24 12:07 vzarytovskii