{"action":"opened","issue":{"url":"https://api.github.com/repos/Microsoft/visualfsharp/issues/3172","repository_url":"https://api.github.com/repos/Microsoft/visualfsharp","labels_url":"https://api.github.com/repos/Microsoft/visualfsharp/issues/3172/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/visualfsharp/issues/3172/comments","events_url":"https://api.github.com/repos/Microsoft/visualfsharp/issues/3172/events","html_url":"https://github.com/Microsoft/visualfsharp/issues/3172","id":233003432,"number":3172,"title":"Access protected const from base class in attribute","user":{"login":"gh3x78E","id":992469,"avatar_url":"https://avatars3.githubusercontent.com/u/992469?v=3","gravatar_id":"","url":"https://api.github.com/users/gh3x78E","html_url":"https://github.com/gh3x78E","followers_url":"https://api.github.com/users/gh3x78E/followers","following_url":"https://api.github.com/users/gh3x78E/following{/other_user}","gists_url":"https://api.github.com/users/gh3x78E/gists{/gist_id}","starred_url":"https://api.github.com/users/gh3x78E/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gh3x78E/subscriptions","organizations_url":"https://api.github.com/users/gh3x78E/orgs","repos_url":"https://api.github.com/users/gh3x78E/repos","events_url":"https://api.github.com/users/gh3x78E/events{/privacy}","received_events_url":"https://api.github.com/users/gh3x78E/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-06-01T20:39:20Z","updated_at":"2017-06-01T20:39:20Z","closed_at":null,"body":"Environment: I am using .Net Framework 4.6.1 together with the target F# runtime 4.1 (FSharp.Core, 4.4.1.0) in a F# class library which references XUnit (2.2.0, obtained via NuGet) in Visual Studio 2017 Community.\r\n\r\nI have a C# base class with a constant\r\n\r\n```cs\r\npublic class TestClassBase\r\n{\r\n  protected const string Foo = \"Bar\";\r\n}\r\n```\r\n\r\nwhich I can consume in C# as follows\r\n\r\n```cs\r\n[Trait(Foo, \"\")]\r\npublic class MyCSharpTestClass : TestClassBase\r\n{\r\n}\r\n```\r\n\r\nHow do I consume it in a F# class? `Foo` is not recognized by the compiler.\r\n\r\n```fs\r\n[<Trait(Foo, \"\")>]\r\ntype MyFSharpTestClass() =\r\n  inherit TestClassBase()\r\n```\r\n\r\nThe error I get is: FS0267 This is not a valid constant expression or custom attribute value.\r\n\r\n`[<Trait(Foo, \"\")>]` yields: FS0039 The value or constructor 'Foo' is not defined. Maybe you want one of the following: floor.\r\n\r\n`[<Trait(this.Foo, \"\")>]` yields FS0039 The value, namespace, type or module 'this' is not defined. Maybe you want one of the following: ThisAssembly.\r\n\r\n`[<Trait(base.Foo, \"\")>]` yields FS0039 The value, namespace, type or module 'base' is not defined. Maybe you want one of the following: Base.\r\n\r\n`[<Trait(TestClassBase.Foo, \"\")>]` yields FS0039 The field, constructor or member 'Foo' is not defined."}}
{"actor":{"display_login":"gh3x78E"}}