dotnet / fsharp

The F# compiler, F# core library, F# language service, and F# tooling integration for Visual Studio
https://dotnet.microsoft.com/languages/fsharp
MIT License
3.87k stars 781 forks source link

[Attributes] Regression, F# 9 compiler cannot find constructor for attribute #17731

Closed xperiandri closed 2 days ago

xperiandri commented 3 days ago

FS1133 No constructors are available for the type 'ApplicationTenantJsonDerivedTypeAttribute'

Repro steps

Use the attached reproduction project DerivedAttributeRepro.zip

Expected behavior

Code builds successfully

Actual behavior

Compile time error

Related information

Microsoft Visual Studio Enterprise 2022
Version 17.12.0 Preview 2.0
VisualStudio.17.Preview/17.12.0-pre.2.0+35309.182
Microsoft .NET Framework
Version 4.8.09032

Installed Version: Enterprise

Architecture Diagrams and Analysis Tools   00482-20500-48083-AA121
Microsoft Architecture Diagrams and Analysis Tools

Visual C++ 2022   00482-20500-48083-AA121
Microsoft Visual C++ 2022

ASP.NET and Web Tools   17.12.81.12767
ASP.NET and Web Tools

Azure App Service Tools v3.0.0   17.12.81.12767
Azure App Service Tools v3.0.0

Azure Functions and Web Jobs Tools   17.12.81.12767
Azure Functions and Web Jobs Tools

C# Tools   4.12.0-2.24428.7+ba23fe4622b76d84e78777f64e71cf7ff71ffc53
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

CleanRun   1.5
CleanRun allows you to clean, build and run a project with 1 button

Clear MEF Component Cache   1.4
Clears the Visual Studio MEF component cache to fix issues with cache corruption.

CodeRush for Roslyn   24.1.4.0
DevExpress CodeRush for Roslyn package.

CodeRush for Roslyn Tool Windows   24.1.4.0
DevExpress CodeRush for Roslyn Tool Windows package.

Color Preview   1.0.27
Shows a color preview in front of all named colors, hex, rgb and hsl values in CSS files.

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

Const Visualizer   2.3
View the value of constants inline when they're used in code.

Extension Manager 2022   1.3.5
Import/export extensions as well as associate extensions with individual solutions

F# Formatting   1.0
F# source code formatting using Fantomas.

File Icons   2.7
Adds icons for files that are not recognized by Solution Explorer

GitHub Actions   0.1.100
A window that provides a view of GitHub Actions for the current repo of the opened solution in Visual Studio. Provided by @timheuer

GitHub Copilot   0.2.1980.20739
GitHub Copilot is an AI pair programmer that helps you write code faster and with less work.

GuidFac   1.0
Insert Guids in your C# code.

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

Markdown Editor v2   2.0.168
A full featured Markdown editor with live preview and syntax highlighting. Supports GitHub flavored Markdown.

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

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

Open Command Line   2.5.238
2.5.238

Project System Tools   1.0
Tools for working with C#, VisualBasic, and F# projects.

Razor (ASP.NET Core)   17.12.2.2442803+5eb9d0c25ab1416ccfea03d44eda2633541c89da
Provides languages services for ASP.NET Core Razor.

Solution Colors   1.1.67
Allows you to associate a color with a solution and display it in various locations within Visual Studio. Inspired by the Peacock extension for VS Code.

SQL Server Data Tools   17.12.19.0
Microsoft SQL Server Data Tools

Surface Dial Tools for Visual Studio   0.8
Adds features to Visual Studio specific to the Surface Dial. You don't need a Surface Book or Surface Studio to take advantage of the Surface Dial.

SVG Viewer   1.0.16
Makes it much easier to work with SVG files by showing a live preview in the bottom-right corner of the code window

TabPath Extension   1.3.0
Shows file paths in tab titles.

ToastNotifier   1.0
Show Toast Notification when Bulid completed.

Tweaks 2022   1.1.143
A collection of minor fixes and tweaks for Visual Studio to reduce the paper cuts and make you a happier developer

TypeScript Tools   17.0.30828.2001
TypeScript Tools for Microsoft Visual Studio

Uno Platform Extension   1.0
Uno Platform Extension to create cross-platform apps using iOS, Android, mac Catalyst, Skia and WebAssembly.

Visual Basic Tools   4.12.0-2.24428.7+ba23fe4622b76d84e78777f64e71cf7ff71ffc53
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.12.0-beta.24427.4+a5feb419073e74562fde38768898988334f379a1
Microsoft Visual F# Tools

Visual Studio IntelliCode   2.2
AI-assisted development for Visual Studio.
edgarfgp commented 3 days ago

Extracted code from the repro.

namespace Foo

open System.Text.Json.Serialization

type internal ApplicationTenantJsonDerivedTypeAttribute() =
    inherit JsonDerivedTypeAttribute (typeof<ApplicationTenant>, "a")

// --------------------------------------------------------------------------
// IMPORTANT: Read ReadMe before modifying this сlass and any referenced types
// --------------------------------------------------------------------------
and [<ApplicationTenantJsonDerivedType>] ApplicationTenant [<JsonConstructor>] (id, name, loginProvider, allowedDomains, authorizedTenants, properties) =
    member _.Id = ""

At first glance I thought it could be related to the AttributeTargets changes but I did a quick test and even disabling the checks still reproduces. So not sure as of now.

vzarytovskii commented 3 days ago

Switching to 8 fixes it, so it's one of the options, just matter of bisecting them