{"action":"opened","issue":{"url":"https://api.github.com/repos/aspnet/AspNetCore/issues/5473","repository_url":"https://api.github.com/repos/aspnet/AspNetCore","labels_url":"https://api.github.com/repos/aspnet/AspNetCore/issues/5473/labels{/name}","comments_url":"https://api.github.com/repos/aspnet/AspNetCore/issues/5473/comments","events_url":"https://api.github.com/repos/aspnet/AspNetCore/issues/5473/events","html_url":"https://github.com/aspnet/AspNetCore/issues/5473","id":391898882,"node_id":"MDU6SXNzdWUzOTE4OTg4ODI=","number":5473,"title":"Handle scenario where an event handler was specified as the wrong type","user":{"login":"SteveSandersonMS","id":1101362,"node_id":"MDQ6VXNlcjExMDEzNjI=","avatar_url":"https://avatars3.githubusercontent.com/u/1101362?v=4","gravatar_id":"","url":"https://api.github.com/users/SteveSandersonMS","html_url":"https://github.com/SteveSandersonMS","followers_url":"https://api.github.com/users/SteveSandersonMS/followers","following_url":"https://api.github.com/users/SteveSandersonMS/following{/other_user}","gists_url":"https://api.github.com/users/SteveSandersonMS/gists{/gist_id}","starred_url":"https://api.github.com/users/SteveSandersonMS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SteveSandersonMS/subscriptions","organizations_url":"https://api.github.com/users/SteveSandersonMS/orgs","repos_url":"https://api.github.com/users/SteveSandersonMS/repos","events_url":"https://api.github.com/users/SteveSandersonMS/events{/privacy}","received_events_url":"https://api.github.com/users/SteveSandersonMS/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-12-17T21:34:14Z","updated_at":"2018-12-17T21:34:14Z","closed_at":null,"author_association":"MEMBER","body":"Originally reported in #135 \r\n\r\nCurrently if you declare an event handler with `onsomeevent=@something`, and `@something` isn't a `UIEventHandler`, then at runtime when the event is triggered, you will get `There is no event handler with ID 0`. This is because we only assign event handler IDs when the attribute value is the type we recognize (`UIEventHandler`).\r\n\r\nOptions:\r\n\r\n* Handle it at compile time. Helpers like `@onclick(...)` cover this already, because they are defined to accept a `UIEventHandler`, and the compiler will automatically create one of those for you if you try to pass a compatible `Action<UIEventArgs>` or similar. Or we could have tag helper-type infrastructure that limits what values you can give for all attributes whose names correspond to known HTML events.\r\n* Handle it better at runtime. If you try to raise an event and the corresponding handler attribute didn't have an event handler ID, report something like `Cannot trigger event handler for {eventname} because is not of the correct type. Event handlers must be of type UIEventHandler; you supplied {othertype}.`"}}
{"actor":{"display_login":"SteveSandersonMS"}}