Skip to content
This repository has been archived by the owner on Dec 19, 2018. It is now read-only.

Razor runtime generates potentially conflicting using statements for TagHelper infrastructure. #580

Closed
NTaylorMullen opened this issue Oct 20, 2015 · 3 comments
Assignees
Milestone

Comments

@NTaylorMullen
Copy link
Member

Today a Razor page will generate the following boiler plate infrastructure at runtime:

#pragma warning disable 0414
private TagHelperContent __tagHelperStringValueBuffer = null;
#pragma warning restore 0414
private TagHelperExecutionContext __tagHelperExecutionContext = null;
private TagHelperRunner __tagHelperRunner = null;
private TagHelperScopeManager __tagHelperScopeManager = new TagHelperScopeManager();

Which then requires the following two using statements:

using Microsoft.AspNet.Razor.TagHelpers;
using Microsoft.AspNet.Razor.Runtime.TagHelpers;

This can be troublesome when writing your Razor page's and then magically having them explode if you have a conflicting type in the page at runtime. We should transition the infrastructure pieces to use fully qualified names.

@NTaylorMullen NTaylorMullen changed the title Razor runtime generates using statements for TagHelper infrastructure. Razor runtime generates potentially conflicting using statements for TagHelper infrastructure. Oct 20, 2015
@Eilon
Copy link
Member

Eilon commented Oct 22, 2015

You mean if they happen to have a type called TagHelperRunner? But yeah we should always code-gen global::Microsoft.AspNet.Foo.Bar.Quz no matter what.

@NTaylorMullen
Copy link
Member Author

Yup 😄

@Eilon Eilon added this to the 4.0.0-rc2 milestone Oct 27, 2015
NTaylorMullen added a commit to aspnet/Mvc that referenced this issue Oct 28, 2015
- Updated `MvcRazorHost` to configure `Type` full names.
- Updated code generation tests.
NTaylorMullen added a commit that referenced this issue Oct 28, 2015
- The using statements had a chance to conflict with user code. Removed them and changed the default configured type names to be full name based.

#580
NTaylorMullen added a commit that referenced this issue Oct 29, 2015
- The using statements had a chance to conflict with user code. Removed them and changed the default configured type names to be full name based.

#580
NTaylorMullen added a commit to aspnet/Mvc that referenced this issue Oct 29, 2015
- Updated `MvcRazorHost` to configure `Type` full names.
- Updated code generation tests.
NTaylorMullen added a commit that referenced this issue Oct 29, 2015
- The using statements had a chance to conflict with user code. Removed them and changed the default configured type names to be `global::` full name based.

#580
NTaylorMullen added a commit that referenced this issue Oct 29, 2015
- The using statements had a chance to conflict with user code. Removed them and changed the default configured type names to be `global::` full name based.

#580
NTaylorMullen added a commit to aspnet/Mvc that referenced this issue Oct 29, 2015
- Updated `MvcRazorHost` to configure `Type` full names.
- Updated code generation tests.
NTaylorMullen added a commit that referenced this issue Oct 29, 2015
- The using statements had a chance to conflict with user code. Removed them and changed the default configured type names to be `global::` full name based.
- Updated test file `TagHelperDescriptor.TypeName`s to have namespaces to make them easier to read.

#580
NTaylorMullen added a commit to aspnet/Mvc that referenced this issue Oct 29, 2015
- Updated `MvcRazorHost` to configure `Type` full names.
- Updated code generation tests.
@NTaylorMullen
Copy link
Member Author

a76f16c
aspnet/Mvc@5ad1a27

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants