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

Commit f33eec4

Browse files
committed
Updating MvcRazorHost to use overload that generates pragma checksum
Fixes #1152
1 parent f82516d commit f33eec4

File tree

5 files changed

+21
-11
lines changed

5 files changed

+21
-11
lines changed

src/Microsoft.AspNet.Mvc.Razor.Host/MvcRazorHost.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,8 @@ public GeneratorResults GenerateCode(string rootRelativePath, Stream inputStream
128128
{
129129
// Adding a prefix so that the main view class can be easily identified.
130130
var className = MainClassNamePrefix + ParserHelpers.SanitizeClassName(rootRelativePath);
131-
using (var reader = new StreamReader(inputStream))
132-
{
133-
var engine = new RazorTemplateEngine(this);
134-
return engine.GenerateCode(reader, className, DefaultNamespace, rootRelativePath);
135-
}
131+
var engine = new RazorTemplateEngine(this);
132+
return engine.GenerateCode(inputStream, className, DefaultNamespace, rootRelativePath);
136133
}
137134

138135
/// <inheritdoc />

test/Microsoft.AspNet.Mvc.Razor.Host.Test/TestFiles/Output/Runtime/Basic.cs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
namespace Asp
1+
#pragma checksum "TestFiles/Input/Basic.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "63d2634be31f68aa89a0c1561d67c73cc446f3d4"
2+
namespace Asp
23
{
34
using System;
45
using System.Linq;
@@ -28,13 +29,22 @@ public override async Task ExecuteAsync()
2829
{
2930
WriteLiteral("<div");
3031
WriteAttribute("class", Tuple.Create(" class=\"", 4), Tuple.Create("\"", 17),
31-
Tuple.Create(Tuple.Create("", 12), Tuple.Create<System.Object, System.Int32>(logo, 12), false));
32+
Tuple.Create(Tuple.Create("", 12), Tuple.Create<System.Object, System.Int32>(
33+
#line 1 "TestFiles/Input/Basic.cshtml"
34+
logo
35+
36+
#line default
37+
#line hidden
38+
, 12), false));
3239
WriteLiteral(">\r\n Hello world\r\n ");
40+
Write(
3341
#line 3 "TestFiles/Input/Basic.cshtml"
34-
Write(Html.Input("SomeKey"));
42+
Html.Input("SomeKey")
3543

3644
#line default
3745
#line hidden
46+
);
47+
3848
WriteLiteral("\r\n</div>");
3949
}
4050
#pragma warning restore 1998

test/Microsoft.AspNet.Mvc.Razor.Host.Test/TestFiles/Output/Runtime/Inject.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
namespace Asp
1+
#pragma checksum "TestFiles/Input/Inject.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "424b7fe9f12352c59210b5fa8c74ca8c9c67de81"
2+
namespace Asp
23
{
34
#line 1 "TestFiles/Input/Inject.cshtml"
45
using MyNamespace

test/Microsoft.AspNet.Mvc.Razor.Host.Test/TestFiles/Output/Runtime/InjectWithModel.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
namespace Asp
1+
#pragma checksum "TestFiles/Input/InjectWithModel.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "0c0e10d3fd8f5bf30eabc22ca0ee91355a13426d"
2+
namespace Asp
23
{
34
using System;
45
using System.Linq;

test/Microsoft.AspNet.Mvc.Razor.Host.Test/TestFiles/Output/Runtime/Model.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
namespace Asp
1+
#pragma checksum "TestFiles/Input/Model.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "2c1e88396568d309c236020e59bf2abacfadd612"
2+
namespace Asp
23
{
34
using System;
45
using System.Linq;

0 commit comments

Comments
 (0)