Skip to content

Missing assembly reference for type used in attributes #7861

@auduchinok

Description

@auduchinok

Consider an attribute having a public property with a type from System.Drawing assembly defined in a net461 class library project:

namespace AttributeAssemblyReferenceRepro

open System
open System.Drawingtype FooAttribute() =
    inherit Attribute()

    member val Prop: FontStyle = Unchecked.defaultof<_> with get, set

When used in another net461 project, it doesn't make the compiler generate a reference to System.Drawing assembly in the output assembly.

module Module

open System.Drawing
open AttributeAssemblyReferenceRepro

[<Foo(Prop = FontStyle.Bold)>]
do ()

A workaround is to use any type from System.Drawing somehow else, so the missing reference is added:

type T(p: FontStyle) =
    class end

The following .NET Core SDK is used:

$ dotnet --version
3.0.100

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    Status

    New

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions