This repository was archived by the owner on Dec 19, 2018. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
src/Microsoft.AspNet.Razor/Generator/Compiler/CodeBuilder/CSharp Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -409,6 +409,11 @@ private void BuildBufferedWritingScope(IList<Chunk> chunks)
409409 // ensure we capture all content that's written, directly or indirectly.
410410 var oldWriter = _context . TargetWriterName ;
411411 _context . TargetWriterName = null ;
412+
413+ // Need to disable instrumentation inside of writing scopes, the instrumentation will not detect
414+ // content written inside writing scopes.
415+ var oldInstrumentation = _context . Host . EnableInstrumentation ;
416+ _context . Host . EnableInstrumentation = false ;
412417
413418 _writer . WriteMethodInvocation ( _tagHelperContext . StartWritingScopeMethodName ) ;
414419
@@ -417,6 +422,9 @@ private void BuildBufferedWritingScope(IList<Chunk> chunks)
417422 _writer . WriteStartAssignment ( StringValueBufferVariableName )
418423 . WriteMethodInvocation ( _tagHelperContext . EndWritingScopeMethodName ) ;
419424
425+ // Restore the instrumentation
426+ _context . Host . EnableInstrumentation = oldInstrumentation ;
427+
420428 // Reset the writer/buffer back to what it was, no longer in a writing scope.
421429 _context . TargetWriterName = oldWriter ;
422430 }
You can’t perform that action at this time.
0 commit comments