{"action":"created","issue":{"url":"https://api.github.com/repos/aspnet/Mvc/issues/1986","labels_url":"https://api.github.com/repos/aspnet/Mvc/issues/1986/labels{/name}","comments_url":"https://api.github.com/repos/aspnet/Mvc/issues/1986/comments","events_url":"https://api.github.com/repos/aspnet/Mvc/issues/1986/events","html_url":"https://github.com/aspnet/Mvc/issues/1986","id":57159245,"number":1986,"title":"Cannot easily use IHtmlHelper<T> in a tag helper","user":{"login":"Tragetaschen","id":1947968,"avatar_url":"https://avatars.githubusercontent.com/u/1947968?v=3","gravatar_id":"","url":"https://api.github.com/users/Tragetaschen","html_url":"https://github.com/Tragetaschen","followers_url":"https://api.github.com/users/Tragetaschen/followers","following_url":"https://api.github.com/users/Tragetaschen/following{/other_user}","gists_url":"https://api.github.com/users/Tragetaschen/gists{/gist_id}","starred_url":"https://api.github.com/users/Tragetaschen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tragetaschen/subscriptions","organizations_url":"https://api.github.com/users/Tragetaschen/orgs","repos_url":"https://api.github.com/users/Tragetaschen/repos","events_url":"https://api.github.com/users/Tragetaschen/events{/privacy}","received_events_url":"https://api.github.com/users/Tragetaschen/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-02-10T10:57:17Z","updated_at":"2015-02-10T16:02:00Z","closed_at":null,"body":"In a tag helper, I want to call the `IHtmlHelper<T>.EditorFor` extension method. The main reason is that I get the EditorTemplates infrastructure to work with. My problem is that there isn't a `ViewContext` available where the `.ViewData` matches the T of the `IHtmlHelper<T>` (only in the special case). When `[Activate]`ing the helper the [`Conextualize` call](https://github.com/aspnet/Mvc/blob/dev/src/Microsoft.AspNet.Mvc.Razor/DefaultTagHelperActivator.cs#L59) throws due to a type mismatch.\r\n\r\nRight now, I expect a `ViewDataDictionary<T>` and then create a new `ViewContext` and `HtmlHelper<T>` and call Contextualize manually, but that requires more dependencies like `IModelMedatadaProvider` and `IHtmlGenerator`. Newing this up manually also makes unit testing harder than necessary.\r\n\r\nDid I miss something? Is there an easier way?\r\n"},"comment":{"url":"https://api.github.com/repos/aspnet/Mvc/issues/comments/73725518","html_url":"https://github.com/aspnet/Mvc/issues/1986#issuecomment-73725518","issue_url":"https://api.github.com/repos/aspnet/Mvc/issues/1986","id":73725518,"user":{"login":"dougbu","id":6431421,"avatar_url":"https://avatars.githubusercontent.com/u/6431421?v=3","gravatar_id":"","url":"https://api.github.com/users/dougbu","html_url":"https://github.com/dougbu","followers_url":"https://api.github.com/users/dougbu/followers","following_url":"https://api.github.com/users/dougbu/following{/other_user}","gists_url":"https://api.github.com/users/dougbu/gists{/gist_id}","starred_url":"https://api.github.com/users/dougbu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dougbu/subscriptions","organizations_url":"https://api.github.com/users/dougbu/orgs","repos_url":"https://api.github.com/users/dougbu/repos","events_url":"https://api.github.com/users/dougbu/events{/privacy}","received_events_url":"https://api.github.com/users/dougbu/received_events","type":"User","site_admin":false},"created_at":"2015-02-10T16:02:00Z","updated_at":"2015-02-10T16:02:00Z","body":"recommend using `HtmlHelper.Editor()` instead e.g. pass a `ModelExpression` instance's `Name` to that method.  or just call `EditorFor()` from a view directly."}}