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

Design Time CodeGen for DirectiveTokenKind.Type doesn't handle value types #1176

Closed
rynowak opened this issue Apr 4, 2017 · 2 comments
Closed

Comments

@rynowak
Copy link
Member

rynowak commented Apr 4, 2017

This code in DesignTimeCSharpRenderer doesn't handle the case where a type used in the directive is a value type:

                    case DirectiveTokenKind.Type:

                        Context.AddLineMappingFor(node);
                        Context.Writer
                            .Write(node.Content)
                            .Write(" ")
                            .WriteStartAssignment(TypeHelper)
                            .WriteLine("null;");
                        break;

This will generate code like:

int __typeHelper = null;

We should use default(node.Content) here.

@rynowak
Copy link
Member Author

rynowak commented May 16, 2017

Consider this part of the 15.3 release

NTaylorMullen added a commit that referenced this issue May 17, 2017
- Instead of rendering a null assigning statement for a type token we now render a `default(TTypeToken)`. With this approach type tokens can be value types without creating a design time error.
- Re-generated baseline files to reflect new directive token code generation.

#1176
NTaylorMullen added a commit that referenced this issue May 17, 2017
- Instead of rendering a null assigning statement for a type token we now render a `default(TTypeToken)`. With this approach type tokens can be value types without creating a design time error.
- Re-generated baseline files to reflect new directive token code generation.

#1176
NTaylorMullen added a commit that referenced this issue May 17, 2017
- Instead of rendering a null assigning statement for a type token we now render a `default(TTypeToken)`. With this approach type tokens can be value types without creating a design time error.
- Re-generated baseline files to reflect new directive token code generation.

#1176
@NTaylorMullen
Copy link
Member

b8ea008

@NTaylorMullen NTaylorMullen moved this from Working to Done in Razor 2.0.0 Preview 2 May 17, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
No open projects
Development

No branches or pull requests

3 participants