{"action":"created","issue":{"url":"https://api.github.com/repos/dotnet/roslyn/issues/27474","repository_url":"https://api.github.com/repos/dotnet/roslyn","labels_url":"https://api.github.com/repos/dotnet/roslyn/issues/27474/labels{/name}","comments_url":"https://api.github.com/repos/dotnet/roslyn/issues/27474/comments","events_url":"https://api.github.com/repos/dotnet/roslyn/issues/27474/events","html_url":"https://github.com/dotnet/roslyn/issues/27474","id":329526782,"node_id":"MDU6SXNzdWUzMjk1MjY3ODI=","number":27474,"title":"Please clarify the implementation details of unmanaged generic constraints","user":{"login":"jkotas","id":6668460,"node_id":"MDQ6VXNlcjY2Njg0NjA=","avatar_url":"https://avatars2.githubusercontent.com/u/6668460?v=4","gravatar_id":"","url":"https://api.github.com/users/jkotas","html_url":"https://github.com/jkotas","followers_url":"https://api.github.com/users/jkotas/followers","following_url":"https://api.github.com/users/jkotas/following{/other_user}","gists_url":"https://api.github.com/users/jkotas/gists{/gist_id}","starred_url":"https://api.github.com/users/jkotas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jkotas/subscriptions","organizations_url":"https://api.github.com/users/jkotas/orgs","repos_url":"https://api.github.com/users/jkotas/repos","events_url":"https://api.github.com/users/jkotas/events{/privacy}","received_events_url":"https://api.github.com/users/jkotas/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-06-05T16:10:18Z","updated_at":"2018-06-05T16:10:37Z","closed_at":null,"author_association":"MEMBER","body":"_From @gfraiteur on June 5, 2018 15:57_\n\nGiven the following C# code:\r\n\r\n```\r\n unsafe struct MyUnmanagedStruct<T,U,V> \r\n        where T : unmanaged\r\n        where V : unmanaged\r\n```\r\n\r\nWe get the following MSIL code:\r\n\r\n```\r\n.class private sequential ansi sealed beforefieldinit TestUnmanagedConstraint.MyUnmanagedStruct`3\r\n< valuetype .ctor (class [System.Runtime]System.ValueType  modreq([System.Runtime.InteropServices]System.Runtime.InteropServices.UnmanagedType)) T,\r\n   U,\r\n   valuetype .ctor (class [System.Runtime]System.ValueType modreq([System.Runtime.InteropServices]System.Runtime.InteropServices.UnmanagedType)) V\r\n >  extends [System.Runtime]System.ValueType\r\n{\r\n  .param type T \r\n  .custom instance void System.Runtime.CompilerServices.IsUnmanagedAttribute::.ctor() = ( 01 00 00 00 ) \r\n  .param type V \r\n  .custom instance void System.Runtime.CompilerServices.IsUnmanagedAttribute::.ctor() = ( 01 00 00 00 ) \r\n} \r\n```\r\nThere are two distinctive characteristics of unmanaged constraints: the `UnmanagedType` custom modifier, and the `IsUnmanagedAttribute` custom attribute.\r\n\r\nI'm updating the generic constraint resolution logic in PostSharp and I would need to know:\r\n\r\n* Which artefact signals the presence of an unmanaged constraint? The modreq, the custom attribute, or both?\r\n\r\n* I assume that an unmanaged type is any value type (not reference type) that has only fields of unmanaged type. For fields of generic types, we would then look at the unmanaged constraint.\r\n\r\n* Are there planned breaking changes in the runtime that we should know of, so we avoid the wrong code generation patterns?\r\n\r\nThanks.\r\n\r\n\n\n_Copied from original issue: dotnet/corefx#30148_"},"comment":{"url":"https://api.github.com/repos/dotnet/roslyn/issues/comments/394768672","html_url":"https://github.com/dotnet/roslyn/issues/27474#issuecomment-394768672","issue_url":"https://api.github.com/repos/dotnet/roslyn/issues/27474","id":394768672,"node_id":"MDEyOklzc3VlQ29tbWVudDM5NDc2ODY3Mg==","user":{"login":"jkotas","id":6668460,"node_id":"MDQ6VXNlcjY2Njg0NjA=","avatar_url":"https://avatars2.githubusercontent.com/u/6668460?v=4","gravatar_id":"","url":"https://api.github.com/users/jkotas","html_url":"https://github.com/jkotas","followers_url":"https://api.github.com/users/jkotas/followers","following_url":"https://api.github.com/users/jkotas/following{/other_user}","gists_url":"https://api.github.com/users/jkotas/gists{/gist_id}","starred_url":"https://api.github.com/users/jkotas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jkotas/subscriptions","organizations_url":"https://api.github.com/users/jkotas/orgs","repos_url":"https://api.github.com/users/jkotas/repos","events_url":"https://api.github.com/users/jkotas/events{/privacy}","received_events_url":"https://api.github.com/users/jkotas/received_events","type":"User","site_admin":false},"created_at":"2018-06-05T16:10:36Z","updated_at":"2018-06-05T16:10:36Z","author_association":"MEMBER","body":"cc @OmarTawfik @jaredpar "}}
{"actor":{"display_login":"jkotas"}}