{"action":"created","issue":{"url":"https://api.github.com/repos/dotnet/coreclr/issues/8583","repository_url":"https://api.github.com/repos/dotnet/coreclr","labels_url":"https://api.github.com/repos/dotnet/coreclr/issues/8583/labels{/name}","comments_url":"https://api.github.com/repos/dotnet/coreclr/issues/8583/comments","events_url":"https://api.github.com/repos/dotnet/coreclr/issues/8583/events","html_url":"https://github.com/dotnet/coreclr/pull/8583","id":194798685,"number":8583,"title":"Span<T> api update","user":{"login":"mattwarren","id":157298,"avatar_url":"https://avatars.githubusercontent.com/u/157298?v=3","gravatar_id":"","url":"https://api.github.com/users/mattwarren","html_url":"https://github.com/mattwarren","followers_url":"https://api.github.com/users/mattwarren/followers","following_url":"https://api.github.com/users/mattwarren/following{/other_user}","gists_url":"https://api.github.com/users/mattwarren/gists{/gist_id}","starred_url":"https://api.github.com/users/mattwarren/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattwarren/subscriptions","organizations_url":"https://api.github.com/users/mattwarren/orgs","repos_url":"https://api.github.com/users/mattwarren/repos","events_url":"https://api.github.com/users/mattwarren/events{/privacy}","received_events_url":"https://api.github.com/users/mattwarren/received_events","type":"User","site_admin":false},"labels":[{"id":197462704,"url":"https://api.github.com/repos/dotnet/coreclr/labels/cla-already-signed","name":"cla-already-signed","color":"009800","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2016-12-10T22:45:43Z","updated_at":"2016-12-11T22:28:24Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/dotnet/coreclr/pulls/8583","html_url":"https://github.com/dotnet/coreclr/pull/8583","diff_url":"https://github.com/dotnet/coreclr/pull/8583.diff","patch_url":"https://github.com/dotnet/coreclr/pull/8583.patch"},"body":"Changing method/property order to match CoreFX impl (to make diffs easier)\r\n\r\nAdded other missing methods (to match CoreFX impl):\r\n- `public void CopyTo(Span<T> destination)`\r\n- `public static bool operator ==(Span<T> left, Span<T> right)`\r\n- `public static bool operator !=(Span<T> left, Span<T> right)`\r\n- `public override bool Equals(object obj)`\r\n- `public override int GetHashCode()`\r\n\r\nAlso removed `public void Set(ReadOnlySpan<T> values)` as it's no longer part of the [Span<T> public API](https://github.com/dotnet/apireviews/tree/master/2016/11-04-SpanOfT#spantset)"},"comment":{"url":"https://api.github.com/repos/dotnet/coreclr/issues/comments/266313144","html_url":"https://github.com/dotnet/coreclr/pull/8583#issuecomment-266313144","issue_url":"https://api.github.com/repos/dotnet/coreclr/issues/8583","id":266313144,"user":{"login":"mattwarren","id":157298,"avatar_url":"https://avatars.githubusercontent.com/u/157298?v=3","gravatar_id":"","url":"https://api.github.com/users/mattwarren","html_url":"https://github.com/mattwarren","followers_url":"https://api.github.com/users/mattwarren/followers","following_url":"https://api.github.com/users/mattwarren/following{/other_user}","gists_url":"https://api.github.com/users/mattwarren/gists{/gist_id}","starred_url":"https://api.github.com/users/mattwarren/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattwarren/subscriptions","organizations_url":"https://api.github.com/users/mattwarren/orgs","repos_url":"https://api.github.com/users/mattwarren/repos","events_url":"https://api.github.com/users/mattwarren/events{/privacy}","received_events_url":"https://api.github.com/users/mattwarren/received_events","type":"User","site_admin":false},"created_at":"2016-12-11T22:28:24Z","updated_at":"2016-12-11T22:28:24Z","body":"@jkotas Mostly for my own interest, if you have code like this:\r\n\r\n```\r\nstatic void TestMethod()\r\n{\r\n  try {\r\n    var data = new char[50];\r\n    var slice = new Span<char>(data);\r\n    Console.WriteLine(\"Before cast to object\");\r\n    Object sliceObj = (object)slice;\r\n  }\r\n  catch (Exception ex) {\r\n    Console.WriteLine(ex.ToString());\r\n  }\r\n}\r\n```\r\n\r\nit currently throws `System.InvalidProgramException: Common Language Runtime detected an invalid program.`, because of the cast from `Span<T>` to `object. It seemingly happens at the point the method is JITted, because 'Before cast to object' is not printed.\r\n\r\nIn the future is the plan for the compiler to catch this, the CLR/Runtime or both? Also is it related to #8516?"}}
{"actor":{"display_login":"mattwarren"}}