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

Commit 39ab9ba

Browse files
Alxandrpranavkm
authored andcommitted
Make sure references are readable multiple times
1 parent c631d53 commit 39ab9ba

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/Microsoft.AspNet.Mvc.Razor/Precompilation/RazorPreCompiler.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,9 @@ protected virtual RazorFileInfoCollection GeneratePrecompiledAssembly(
164164
else
165165
{
166166
assemblyStream.Position = 0;
167+
var assemblyBytes = assemblyStream.ToArray();
167168
var assemblyResource = new ResourceDescription(assemblyResourceName,
168-
() => assemblyStream,
169+
() => new MemoryStream(assemblyBytes),
169170
isPublic: true);
170171
CompileContext.Resources.Add(assemblyResource);
171172

@@ -174,9 +175,10 @@ protected virtual RazorFileInfoCollection GeneratePrecompiledAssembly(
174175
{
175176
symbolsResourceName = resourcePrefix + ".pdb";
176177
pdbStream.Position = 0;
178+
var pdbBytes = pdbStream.ToArray();
177179

178180
var pdbResource = new ResourceDescription(symbolsResourceName,
179-
() => pdbStream,
181+
() => new MemoryStream(pdbBytes),
180182
isPublic: true);
181183

182184
CompileContext.Resources.Add(pdbResource);

0 commit comments

Comments
 (0)