{"action":"created","issue":{"url":"https://api.github.com/repos/dotnet/roslyn/issues/9852","repository_url":"https://api.github.com/repos/dotnet/roslyn","labels_url":"https://api.github.com/repos/dotnet/roslyn/issues/9852/labels{/name}","comments_url":"https://api.github.com/repos/dotnet/roslyn/issues/9852/comments","events_url":"https://api.github.com/repos/dotnet/roslyn/issues/9852/events","html_url":"https://github.com/dotnet/roslyn/issues/9852","id":141686734,"number":9852,"title":"Breaking change: Limit the total size of all user strings within an assembly to 2^24B","user":{"login":"tmat","id":41759,"avatar_url":"https://avatars.githubusercontent.com/u/41759?v=3","gravatar_id":"","url":"https://api.github.com/users/tmat","html_url":"https://github.com/tmat","followers_url":"https://api.github.com/users/tmat/followers","following_url":"https://api.github.com/users/tmat/following{/other_user}","gists_url":"https://api.github.com/users/tmat/gists{/gist_id}","starred_url":"https://api.github.com/users/tmat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tmat/subscriptions","organizations_url":"https://api.github.com/users/tmat/orgs","repos_url":"https://api.github.com/users/tmat/repos","events_url":"https://api.github.com/users/tmat/events{/privacy}","received_events_url":"https://api.github.com/users/tmat/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-03-17T19:39:38Z","updated_at":"2016-03-17T19:40:52Z","closed_at":null,"body":"The ```#UserStrings``` metadata heap is addressable by 24bit index. That means that all user strings   (i.e. an argument to an ldstr instruction) in the assembly have to fit into 2^24 bytes after they are serialized to the heap, except for the last string which has to start below 2^24 but can span further. \r\n\r\nThe order of strings is pretty much determined by the location of the string constant in source and the ordering of source files. In extreme cases, when a user project has a lot of strings and they happen to be ordered such that the last string is quite long, one may just switch the order of method definitions and get a compilation error since the heap index of the string that's now last doesn't fit into 24 bits.\r\n\r\nThe native compiler is using native IMetaDataEmit metadata writer. Experiments show that the writer has a rather arbitrary limit on the total size of encoded #UserStrings (something around 0x0E000000). Seems like an implementation detail.\r\n\r\nI propose we cap the _total_ encoded length of all user strings emitted into an assembly to 2^24 bytes to avoid surprises. It would be a breaking change, however it would only affect projects that are already on the very edge of what we can compile today and are very fragile.\r\n"},"comment":{"url":"https://api.github.com/repos/dotnet/roslyn/issues/comments/198051372","html_url":"https://github.com/dotnet/roslyn/issues/9852#issuecomment-198051372","issue_url":"https://api.github.com/repos/dotnet/roslyn/issues/9852","id":198051372,"user":{"login":"tmat","id":41759,"avatar_url":"https://avatars.githubusercontent.com/u/41759?v=3","gravatar_id":"","url":"https://api.github.com/users/tmat","html_url":"https://github.com/tmat","followers_url":"https://api.github.com/users/tmat/followers","following_url":"https://api.github.com/users/tmat/following{/other_user}","gists_url":"https://api.github.com/users/tmat/gists{/gist_id}","starred_url":"https://api.github.com/users/tmat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tmat/subscriptions","organizations_url":"https://api.github.com/users/tmat/orgs","repos_url":"https://api.github.com/users/tmat/repos","events_url":"https://api.github.com/users/tmat/events{/privacy}","received_events_url":"https://api.github.com/users/tmat/received_events","type":"User","site_admin":false},"created_at":"2016-03-17T19:40:51Z","updated_at":"2016-03-17T19:40:51Z","body":"@AlekseyTs @nguerrera @gafter @dotnet/roslyn-compiler "}}