{"action":"created","issue":{"url":"https://api.github.com/repos/dotnet/corefx/issues/32861","repository_url":"https://api.github.com/repos/dotnet/corefx","labels_url":"https://api.github.com/repos/dotnet/corefx/issues/32861/labels{/name}","comments_url":"https://api.github.com/repos/dotnet/corefx/issues/32861/comments","events_url":"https://api.github.com/repos/dotnet/corefx/issues/32861/events","html_url":"https://github.com/dotnet/corefx/issues/32861","id":370882177,"node_id":"MDU6SXNzdWUzNzA4ODIxNzc=","number":32861,"title":"Decoder.Convert overloads that take pointers should accept null if count is 0","user":{"login":"jazzdelightsme","id":771085,"node_id":"MDQ6VXNlcjc3MTA4NQ==","avatar_url":"https://avatars0.githubusercontent.com/u/771085?v=4","gravatar_id":"","url":"https://api.github.com/users/jazzdelightsme","html_url":"https://github.com/jazzdelightsme","followers_url":"https://api.github.com/users/jazzdelightsme/followers","following_url":"https://api.github.com/users/jazzdelightsme/following{/other_user}","gists_url":"https://api.github.com/users/jazzdelightsme/gists{/gist_id}","starred_url":"https://api.github.com/users/jazzdelightsme/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jazzdelightsme/subscriptions","organizations_url":"https://api.github.com/users/jazzdelightsme/orgs","repos_url":"https://api.github.com/users/jazzdelightsme/repos","events_url":"https://api.github.com/users/jazzdelightsme/events{/privacy}","received_events_url":"https://api.github.com/users/jazzdelightsme/received_events","type":"User","site_admin":false},"labels":[{"id":167013730,"node_id":"MDU6TGFiZWwxNjcwMTM3MzA=","url":"https://api.github.com/repos/dotnet/corefx/labels/area-System.Text.Encoding","name":"area-System.Text.Encoding","color":"d4c5f9","default":false},{"id":145399957,"node_id":"MDU6TGFiZWwxNDUzOTk5NTc=","url":"https://api.github.com/repos/dotnet/corefx/labels/enhancement","name":"enhancement","color":"207de5","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/dotnet/corefx/milestones/21","html_url":"https://github.com/dotnet/corefx/milestone/21","labels_url":"https://api.github.com/repos/dotnet/corefx/milestones/21/labels","id":3242632,"node_id":"MDk6TWlsZXN0b25lMzI0MjYzMg==","number":21,"title":"3.0","description":".NET Core 3.0, next major release after 2.1. See [official release dates](https://github.com/dotnet/core/blob/master/roadmap.md) for details.\r\n\r\nWe will move important issues from Future to 3.0 as the priorities and dates for next release become more clear.","creator":{"login":"karelz","id":5776068,"node_id":"MDQ6VXNlcjU3NzYwNjg=","avatar_url":"https://avatars2.githubusercontent.com/u/5776068?v=4","gravatar_id":"","url":"https://api.github.com/users/karelz","html_url":"https://github.com/karelz","followers_url":"https://api.github.com/users/karelz/followers","following_url":"https://api.github.com/users/karelz/following{/other_user}","gists_url":"https://api.github.com/users/karelz/gists{/gist_id}","starred_url":"https://api.github.com/users/karelz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/karelz/subscriptions","organizations_url":"https://api.github.com/users/karelz/orgs","repos_url":"https://api.github.com/users/karelz/repos","events_url":"https://api.github.com/users/karelz/events{/privacy}","received_events_url":"https://api.github.com/users/karelz/received_events","type":"User","site_admin":false},"open_issues":291,"closed_issues":2430,"state":"open","created_at":"2018-04-04T16:40:10Z","updated_at":"2018-10-19T17:55:14Z","due_on":null,"closed_at":null},"comments":9,"created_at":"2018-10-17T03:20:46Z","updated_at":"2018-10-19T18:28:28Z","closed_at":null,"author_association":"NONE","body":"I tried to use the `fixed` keyword to get a pointer to a `char[]`, and then I passed that pointer to `Decoder.Convert`. I found that sometimes I'd get an `ArgumentNullException`, which baffled me, because I had just barely allocated the `char[]`.\r\n\r\nIt turns out that `fixed` will give you a `null` pointer for a 0-length array, so that's where the null came from. I complained about that (the different behavior depending on length of the array), and one response I got was \"Seems the bug comes from whatever underlying API decided to give special meaning to nullptr even in a counted range\".\r\n\r\nIdeally I'd be able to pass a null pointer to `Decoder.Convert`, and as long as `charCount` is also zero, it should be treated the same as a 0-length buffer.\r\n\r\nC.f.: https://github.com/dotnet/corefx/blob/a10890f4ffe0fadf090c922578ba0e606ebdd16c/src/Common/src/CoreLib/System/Text/Decoder.cs#L306"},"comment":{"url":"https://api.github.com/repos/dotnet/corefx/issues/comments/431455768","html_url":"https://github.com/dotnet/corefx/issues/32861#issuecomment-431455768","issue_url":"https://api.github.com/repos/dotnet/corefx/issues/32861","id":431455768,"node_id":"MDEyOklzc3VlQ29tbWVudDQzMTQ1NTc2OA==","user":{"login":"tarekgh","id":10833894,"node_id":"MDQ6VXNlcjEwODMzODk0","avatar_url":"https://avatars2.githubusercontent.com/u/10833894?v=4","gravatar_id":"","url":"https://api.github.com/users/tarekgh","html_url":"https://github.com/tarekgh","followers_url":"https://api.github.com/users/tarekgh/followers","following_url":"https://api.github.com/users/tarekgh/following{/other_user}","gists_url":"https://api.github.com/users/tarekgh/gists{/gist_id}","starred_url":"https://api.github.com/users/tarekgh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tarekgh/subscriptions","organizations_url":"https://api.github.com/users/tarekgh/orgs","repos_url":"https://api.github.com/users/tarekgh/repos","events_url":"https://api.github.com/users/tarekgh/events{/privacy}","received_events_url":"https://api.github.com/users/tarekgh/received_events","type":"User","site_admin":false},"created_at":"2018-10-19T18:28:28Z","updated_at":"2018-10-19T18:28:28Z","author_association":"MEMBER","body":"I have looked at the code and I am seeing it is not difficult to handle the 0 length with null pointer but in same time the change wouldn't be that trivial either for the following reasons:\r\n\r\n- If we need to go with this change  we'll have to fix all APIs in all our Encoders and Decoders that accept a native pointers and length. We'll have to do it in GetChars, GetBytes, GetCharCount, GetByteCount and convert in all encoders/decoders we have.\r\n-  Also Encoders and Decoders has states and   the APIs has multiples out parameters reporting the state. if we need to go with the change we'll have to ensure the state is correct as we used to work before and also we have to initialize the out parameters and ensure those initialize match the expectation. \r\n\r\nConsidering that, I am inclining to say this is not worth to do it. just to handle this corner case which the callers should be able easily to do it. \r\n\r\n@jkotas what you think? "}}
{"actor":{"display_login":"tarekgh"}}