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

Commit 184ab74

Browse files
author
N. Taylor Mullen
committed
Don't render view attributes when in design time.
- This is a temporary work around that's needed until we have multi-targeting support in #1535.
1 parent 006b465 commit 184ab74

File tree

53 files changed

+50
-104
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+50
-104
lines changed

src/Microsoft.AspNetCore.Mvc.Razor.Extensions/RazorExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ public static void Register(IRazorEngineBuilder builder)
2929
builder.Features.Add(new ViewComponentTagHelperPass());
3030
builder.Features.Add(new RazorPageDocumentClassifierPass());
3131
builder.Features.Add(new MvcViewDocumentClassifierPass());
32-
builder.Features.Add(new AssemblyAttributeInjectionPass());
3332

3433
if (!builder.DesignTime)
3534
{
35+
builder.Features.Add(new AssemblyAttributeInjectionPass());
3636
builder.Features.Add(new InstrumentationPass());
3737
}
3838
}

test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.codegen.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// <auto-generated/>
22
#pragma warning disable 1591
3-
[assembly:global::Microsoft.AspNetCore.Mvc.Razor.Compilation.RazorViewAttribute(null, typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Basic_cshtml))]
43
namespace AspNetCore
54
{
65
#line hidden

test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.ir.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
Document -
2-
CSharpCode -
3-
IntermediateToken - - CSharp - [assembly:global::Microsoft.AspNetCore.Mvc.Razor.Compilation.RazorViewAttribute(null, typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Basic_cshtml))]
42
NamespaceDeclaration - - AspNetCore
53
UsingDirective - - TModel = global::System.Object
64
UsingDirective - (1:0,1 [12] ) - System
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
11
Source Location: (13:0,13 [15] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml)
22
|this.ToString()|
3-
Generated Location: (1215:27,13 [15] )
3+
Generated Location: (1037:26,13 [15] )
44
|this.ToString()|
55

66
Source Location: (54:2,5 [29] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml)
77
|string.Format("{0}", "Hello")|
8-
Generated Location: (1351:32,6 [29] )
8+
Generated Location: (1173:31,6 [29] )
99
|string.Format("{0}", "Hello")|
1010

1111
Source Location: (95:4,2 [25] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml)
1212
|
1313
var cls = "foo";
1414
|
15-
Generated Location: (1497:37,2 [25] )
15+
Generated Location: (1319:36,2 [25] )
1616
|
1717
var cls = "foo";
1818
|
1919

2020
Source Location: (134:7,11 [18] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml)
2121
|if(cls != null) { |
22-
Generated Location: (1645:43,11 [18] )
22+
Generated Location: (1467:42,11 [18] )
2323
|if(cls != null) { |
2424

2525
Source Location: (153:7,30 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml)
2626
|cls|
27-
Generated Location: (1807:48,30 [3] )
27+
Generated Location: (1629:47,30 [3] )
2828
|cls|
2929

3030
Source Location: (156:7,33 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml)
3131
| }|
32-
Generated Location: (1958:53,33 [2] )
32+
Generated Location: (1780:52,33 [2] )
3333
| }|
3434

test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.codegen.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// <auto-generated/>
22
#pragma warning disable 1591
3-
[assembly:global::Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.RazorPageAttribute(null, typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteDirectives_cshtml), null)]
43
namespace AspNetCore
54
{
65
#line hidden

test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.ir.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
Document -
2-
CSharpCode -
3-
IntermediateToken - - CSharp - [assembly:global::Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.RazorPageAttribute(null, typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteDirectives_cshtml), null)]
42
NamespaceDeclaration - - AspNetCore
53
UsingDirective - - TModel = global::System.Object
64
UsingDirective - (1:0,1 [12] ) - System
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Source Location: (159:11,8 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml)
22
|MyService<TModel>|
3-
Generated Location: (885:19,0 [17] )
3+
Generated Location: (678:18,0 [17] )
44
|MyService<TModel>|
55

test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_DesignTime.codegen.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// <auto-generated/>
22
#pragma warning disable 1591
3-
[assembly:global::Microsoft.AspNetCore.Mvc.Razor.Compilation.RazorViewAttribute(null, typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InheritsViewModel_cshtml))]
43
namespace AspNetCore
54
{
65
#line hidden

test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_DesignTime.ir.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
Document -
2-
CSharpCode -
3-
IntermediateToken - - CSharp - [assembly:global::Microsoft.AspNetCore.Mvc.Razor.Compilation.RazorViewAttribute(null, typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InheritsViewModel_cshtml))]
42
NamespaceDeclaration - - AspNetCore
53
UsingDirective - - TModel = global::System.Object
64
UsingDirective - (1:0,1 [12] ) - System
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
Source Location: (10:0,10 [26] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel.cshtml)
22
|MyBasePageForViews<TModel>|
3-
Generated Location: (844:19,0 [26] )
3+
Generated Location: (654:18,0 [26] )
44
|MyBasePageForViews<TModel>|
55

66
Source Location: (45:1,7 [7] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel.cshtml)
77
|MyModel|
8-
Generated Location: (984:23,0 [7] )
8+
Generated Location: (794:22,0 [7] )
99
|MyModel|
1010

0 commit comments

Comments
 (0)