| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297 |
- commit 2414db256f32a047770326d14d8b0e2afd49ba49
- Author: Ben Adams <[email protected]>
- Date: Tue Aug 28 14:05:49 2018 -0700
- Zero cost(ish) diagnositcs when disabled
-
- Inlinable fast-path check if Diagnositcs is enabled
- diff --git a/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/ControllerActionInvoker.cs b/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/ControllerActionInvoker.cs
- index 448f6b41912..099797fbe84 100644
- --- a/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/ControllerActionInvoker.cs
- +++ b/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/ControllerActionInvoker.cs
- @@ -26,12 +26,12 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure
-
- internal ControllerActionInvoker(
- ILogger logger,
- - DiagnosticSource diagnosticSource,
- + DiagnosticListener diagnosticListener,
- IActionResultTypeMapper mapper,
- ControllerContext controllerContext,
- ControllerActionInvokerCacheEntry cacheEntry,
- IFilterMetadata[] filters)
- - : base(diagnosticSource, logger, mapper, controllerContext, filters, controllerContext.ValueProviderFactories)
- + : base(diagnosticListener, logger, mapper, controllerContext, filters, controllerContext.ValueProviderFactories)
- {
- if (cacheEntry == null)
- {
- @@ -114,7 +114,7 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure
- var filter = (IAsyncActionFilter)state;
- var actionExecutingContext = _actionExecutingContext;
-
- - _diagnosticSource.BeforeOnActionExecution(actionExecutingContext, filter);
- + _diagnosticListener.BeforeOnActionExecution(actionExecutingContext, filter);
- _logger.BeforeExecutingMethodOnFilter(
- MvcCoreLoggerExtensions.ActionFilter,
- nameof(IAsyncActionFilter.OnActionExecutionAsync),
- @@ -152,7 +152,7 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure
- };
- }
-
- - _diagnosticSource.AfterOnActionExecution(_actionExecutedContext, filter);
- + _diagnosticListener.AfterOnActionExecution(_actionExecutedContext, filter);
- _logger.AfterExecutingMethodOnFilter(
- MvcCoreLoggerExtensions.ActionFilter,
- nameof(IAsyncActionFilter.OnActionExecutionAsync),
- @@ -169,7 +169,7 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure
- var filter = (IActionFilter)state;
- var actionExecutingContext = _actionExecutingContext;
-
- - _diagnosticSource.BeforeOnActionExecuting(actionExecutingContext, filter);
- + _diagnosticListener.BeforeOnActionExecuting(actionExecutingContext, filter);
- _logger.BeforeExecutingMethodOnFilter(
- MvcCoreLoggerExtensions.ActionFilter,
- nameof(IActionFilter.OnActionExecuting),
- @@ -177,7 +177,7 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure
-
- filter.OnActionExecuting(actionExecutingContext);
-
- - _diagnosticSource.AfterOnActionExecuting(actionExecutingContext, filter);
- + _diagnosticListener.AfterOnActionExecuting(actionExecutingContext, filter);
- _logger.AfterExecutingMethodOnFilter(
- MvcCoreLoggerExtensions.ActionFilter,
- nameof(IActionFilter.OnActionExecuting),
- @@ -219,7 +219,7 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure
- var filter = (IActionFilter)state;
- var actionExecutedContext = _actionExecutedContext;
-
- - _diagnosticSource.BeforeOnActionExecuted(actionExecutedContext, filter);
- + _diagnosticListener.BeforeOnActionExecuted(actionExecutedContext, filter);
- _logger.BeforeExecutingMethodOnFilter(
- MvcCoreLoggerExtensions.ActionFilter,
- nameof(IActionFilter.OnActionExecuted),
- @@ -227,7 +227,7 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure
-
- filter.OnActionExecuted(actionExecutedContext);
-
- - _diagnosticSource.AfterOnActionExecuted(actionExecutedContext, filter);
- + _diagnosticListener.AfterOnActionExecuted(actionExecutedContext, filter);
- _logger.AfterExecutingMethodOnFilter(
- MvcCoreLoggerExtensions.ActionFilter,
- nameof(IActionFilter.OnActionExecuted),
- @@ -335,13 +335,13 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure
- var actionMethodExecutor = _cacheEntry.ActionMethodExecutor;
- var orderedArguments = PrepareArguments(arguments, objectMethodExecutor);
-
- - var diagnosticSource = _diagnosticSource;
- + var diagnosticListener = _diagnosticListener;
- var logger = _logger;
-
- IActionResult result = null;
- try
- {
- - diagnosticSource.BeforeActionMethod(
- + diagnosticListener.BeforeActionMethod(
- controllerContext,
- arguments,
- controller);
- @@ -362,7 +362,7 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure
- }
- finally
- {
- - diagnosticSource.AfterActionMethod(
- + diagnosticListener.AfterActionMethod(
- controllerContext,
- arguments,
- controllerContext,
- diff --git a/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/ControllerActionInvokerProvider.cs b/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/ControllerActionInvokerProvider.cs
- index 26862696df6..b05bd104dd2 100644
- --- a/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/ControllerActionInvokerProvider.cs
- +++ b/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/ControllerActionInvokerProvider.cs
- @@ -19,21 +19,21 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure
- private readonly IReadOnlyList<IValueProviderFactory> _valueProviderFactories;
- private readonly int _maxModelValidationErrors;
- private readonly ILogger _logger;
- - private readonly DiagnosticSource _diagnosticSource;
- + private readonly DiagnosticListener _diagnosticListener;
- private readonly IActionResultTypeMapper _mapper;
-
- public ControllerActionInvokerProvider(
- ControllerActionInvokerCache controllerActionInvokerCache,
- IOptions<MvcOptions> optionsAccessor,
- ILoggerFactory loggerFactory,
- - DiagnosticSource diagnosticSource,
- + DiagnosticListener diagnosticListener,
- IActionResultTypeMapper mapper)
- {
- _controllerActionInvokerCache = controllerActionInvokerCache;
- _valueProviderFactories = optionsAccessor.Value.ValueProviderFactories.ToArray();
- _maxModelValidationErrors = optionsAccessor.Value.MaxModelValidationErrors;
- _logger = loggerFactory.CreateLogger<ControllerActionInvoker>();
- - _diagnosticSource = diagnosticSource;
- + _diagnosticListener = diagnosticListener;
- _mapper = mapper;
- }
-
- @@ -58,7 +58,7 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure
-
- var invoker = new ControllerActionInvoker(
- _logger,
- - _diagnosticSource,
- + _diagnosticListener,
- _mapper,
- controllerContext,
- cacheResult.cacheEntry,
- diff --git a/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/ResourceInvoker.cs b/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/ResourceInvoker.cs
- index 92a80ef42a2..ff969d90b0b 100644
- --- a/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/ResourceInvoker.cs
- +++ b/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/ResourceInvoker.cs
- @@ -16,7 +16,7 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure
- {
- internal abstract class ResourceInvoker
- {
- - protected readonly DiagnosticSource _diagnosticSource;
- + protected readonly DiagnosticListener _diagnosticListener;
- protected readonly ILogger _logger;
- protected readonly IActionResultTypeMapper _mapper;
- protected readonly ActionContext _actionContext;
- @@ -37,14 +37,14 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure
- protected object _instance;
-
- public ResourceInvoker(
- - DiagnosticSource diagnosticSource,
- + DiagnosticListener diagnosticListener,
- ILogger logger,
- IActionResultTypeMapper mapper,
- ActionContext actionContext,
- IFilterMetadata[] filters,
- IList<IValueProviderFactory> valueProviderFactories)
- {
- - _diagnosticSource = diagnosticSource ?? throw new ArgumentNullException(nameof(diagnosticSource));
- + _diagnosticListener = diagnosticListener ?? throw new ArgumentNullException(nameof(diagnosticListener));
- _logger = logger ?? throw new ArgumentNullException(nameof(logger));
- _mapper = mapper ?? throw new ArgumentNullException(nameof(mapper));
- _actionContext = actionContext ?? throw new ArgumentNullException(nameof(actionContext));
- @@ -58,7 +58,7 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure
- {
- try
- {
- - _diagnosticSource.BeforeAction(
- + _diagnosticListener.BeforeAction(
- _actionContext.ActionDescriptor,
- _actionContext.HttpContext,
- _actionContext.RouteData);
- @@ -88,7 +88,7 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure
- }
- finally
- {
- - _diagnosticSource.AfterAction(
- + _diagnosticListener.AfterAction(
- _actionContext.ActionDescriptor,
- _actionContext.HttpContext,
- _actionContext.RouteData);
- @@ -129,7 +129,7 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure
- {
- var actionContext = _actionContext;
-
- - _diagnosticSource.BeforeActionResult(actionContext, result);
- + _diagnosticListener.BeforeActionResult(actionContext, result);
- _logger.BeforeExecutingActionResult(result);
-
- try
- @@ -138,7 +138,7 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure
- }
- finally
- {
- - _diagnosticSource.AfterActionResult(actionContext, result);
- + _diagnosticListener.AfterActionResult(actionContext, result);
- _logger.AfterExecutingActionResult(result);
- }
- }
- @@ -195,7 +195,7 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure
- var filter = (IAsyncAuthorizationFilter)state;
- var authorizationContext = _authorizationContext;
-
- - _diagnosticSource.BeforeOnAuthorizationAsync(authorizationContext, filter);
- + _diagnosticListener.BeforeOnAuthorizationAsync(authorizationContext, filter);
- _logger.BeforeExecutingMethodOnFilter(
- FilterTypeConstants.AuthorizationFilter,
- nameof(IAsyncAuthorizationFilter.OnAuthorizationAsync),
- @@ -219,7 +219,7 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure
- var filter = (IAsyncAuthorizationFilter)state;
- var authorizationContext = _authorizationContext;
-
- - _diagnosticSource.AfterOnAuthorizationAsync(authorizationContext, filter);
- + _diagnosticListener.AfterOnAuthorizationAsync(authorizationContext, filter);
- _logger.AfterExecutingMethodOnFilter(
- FilterTypeConstants.AuthorizationFilter,
- nameof(IAsyncAuthorizationFilter.OnAuthorizationAsync),
- @@ -241,7 +241,7 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure
- var filter = (IAuthorizationFilter)state;
- var authorizationContext = _authorizationContext;
-
- - _diagnosticSource.BeforeOnAuthorization(authorizationContext, filter);
- + _diagnosticListener.BeforeOnAuthorization(authorizationContext, filter);
- _logger.BeforeExecutingMethodOnFilter(
- FilterTypeConstants.AuthorizationFilter,
- nameof(IAuthorizationFilter.OnAuthorization),
- @@ -249,7 +249,7 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure
-
- filter.OnAuthorization(authorizationContext);
-
- - _diagnosticSource.AfterOnAuthorization(authorizationContext, filter);
- + _diagnosticListener.AfterOnAuthorization(authorizationContext, filter);
- _logger.AfterExecutingMethodOnFilter(
- FilterTypeConstants.AuthorizationFilter,
- nameof(IAuthorizationFilter.OnAuthorization),
- @@ -332,7 +332,7 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure
- var filter = (IAsyncResourceFilter)state;
- var resourceExecutingContext = _resourceExecutingContext;
-
- - _diagnosticSource.BeforeOnResourceExecution(resourceExecutingContext, filter);
- + _diagnosticListener.BeforeOnResourceExecution(resourceExecutingContext, filter);
- _logger.BeforeExecutingMethodOnFilter(
- FilterTypeConstants.ResourceFilter,
- nameof(IAsyncResourceFilter.OnResourceExecutionAsync),
- @@ -363,7 +363,7 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure
- Result = _resourceExecutingContext.Result,
- };
-
- - _diagnosticSource.AfterOnResourceExecution(_resourceExecutedContext, filter);
- + _diagnosticListener.AfterOnResourceExecution(_resourceExecutedContext, filter);
- _logger.AfterExecutingMethodOnFilter(
- FilterTypeConstants.ResourceFilter,
- nameof(IAsyncResourceFilter.OnResourceExecutionAsync),
- @@ -387,7 +387,7 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure
- var filter = (IResourceFilter)state;
- var resourceExecutingContext = _resourceExecutingContext;
-
- - _diagnosticSource.BeforeOnResourceExecuting(resourceExecutingContext, filter);
- + _diagnosticListener.BeforeOnResourceExecuting(resourceExecutingContext, filter);
- _logger.BeforeExecutingMethodOnFilter(
- FilterTypeConstants.ResourceFilter,
- nameof(IResourceFilter.OnResourceExecuting),
- @@ -395,7 +395,7 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure
-
- filter.OnResourceExecuting(resourceExecutingContext);
-
- - _diagnosticSource.AfterOnResourceExecuting(resourceExecutingContext, filter);
- + _diagnosticListener.AfterOnResourceExecuting(resourceExecutingContext, filter);
- _logger.AfterExecutingMethodOnFilter(
- FilterTypeConstants.ResourceFilter,
- nameof(IResourceFilter.OnResourceExecuting),
- @@ -431,7 +431,7 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure
- var filter = (IResourceFilter)state;
- var resourceExecutedContext = _resourceExecutedContext;
-
- - _diagnosticSource.BeforeOnResourceExecuted(resourceExecutedContext, filter);
- + _diagnosticListener.BeforeOnResourceExecuted(resourceExecutedContext, filter);
- _logger.BeforeExecutingMethodOnFilter(
- FilterTypeConstants.ResourceFilter,
- nameof(IResourceFilter.OnResourceExecuted),
- @@ -439,7 +439,7 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure
-
- filter.OnResourceExecuted(resourceExecutedContext);
-
- - _diagnosticSource.AfterOnResourceExecuted(resourceExecutedContext, filter);
- + _diagnosticListener.AfterOnResourceExecuted(resourceExecutedContext, filter);
- _logger.AfterExecutingMethodOnFilter(
- FilterTypeConstants.ResourceFilter,
- nameof(IResourceFilter.OnResourceExecuted),
- @@ -527,7 +527,7 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure
- // we'll call the filter. Otherwise there's nothing to do.
- if (exceptionContext?.Exception != null && !exceptionContext.ExceptionHandled)
- {
- - _diagnosticSource.BeforeOnExceptionAsync(exceptionContext, filter);
- + _diagnosticListener.BeforeOnExceptionAsync(exceptionContext, filter);
- _logger.BeforeExecutingMethodOnFilter(
- FilterTypeConstants.ExceptionFilter,
- nameof(IAsyncExceptionFilter.OnExceptionAsync),
- @@ -554,7 +554,7 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure
- var filter = (IAsyncExceptionFilter)state;
- var exceptionContext = _exceptionContext;
-
- - _diagnosticSource.AfterOnExceptionAsync(exceptionContext, filter);
- + _diagnosticListener.AfterOnExceptionAsync(exceptionContext, filter);
- _logger.AfterExecutingMethodOnFilter(
- FilterTypeConstants.ExceptionFilter,
- nameof(IAsyncExceptionFilter.OnExceptionAsync),
- @@ -594,7 +594,7 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure
- // we'll call the filter. Otherwise there's nothing to do.
- if (exceptionContext?.Exception != null && !exceptionContext.ExceptionHandled)
- {
- - _diagnosticSource.BeforeOnException(exceptionContext, filter);
- + _diagnosticListener.BeforeOnException(exceptionContext, filter);
- _logger.BeforeExecutingMethodOnFilter(
- FilterTypeConstants.ExceptionFilter,
- nameof(IExceptionFilter.OnException),
- @@ -602,7 +602,7 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure
-
- filter.OnException(exceptionContext);
-
- - _diagnosticSource.AfterOnException(exceptionContext, filter);
- + _diagnosticListener.AfterOnException(exceptionContext, filter);
- _logger.AfterExecutingMethodOnFilter(
- FilterTypeConstants.ExceptionFilter,
- nameof(IExceptionFilter.OnException),
- @@ -904,7 +904,7 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure
- var filter = (TFilterAsync)state;
- var resultExecutingContext = _resultExecutingContext;
-
- - _diagnosticSource.BeforeOnResultExecution(resultExecutingContext, filter);
- + _diagnosticListener.BeforeOnResultExecution(resultExecutingContext, filter);
- _logger.BeforeExecutingMethodOnFilter(
- resultFilterKind,
- nameof(IAsyncResultFilter.OnResultExecutionAsync),
- @@ -944,7 +944,7 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure
- };
- }
-
- - _diagnosticSource.AfterOnResultExecution(_resultExecutedContext, filter);
- + _diagnosticListener.AfterOnResultExecution(_resultExecutedContext, filter);
- _logger.AfterExecutingMethodOnFilter(
- resultFilterKind,
- nameof(IAsyncResultFilter.OnResultExecutionAsync),
- @@ -961,7 +961,7 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure
- var filter = (TFilter)state;
- var resultExecutingContext = _resultExecutingContext;
-
- - _diagnosticSource.BeforeOnResultExecuting(resultExecutingContext, filter);
- + _diagnosticListener.BeforeOnResultExecuting(resultExecutingContext, filter);
- _logger.BeforeExecutingMethodOnFilter(
- resultFilterKind,
- nameof(IResultFilter.OnResultExecuting),
- @@ -969,7 +969,7 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure
-
- filter.OnResultExecuting(resultExecutingContext);
-
- - _diagnosticSource.AfterOnResultExecuting(resultExecutingContext, filter);
- + _diagnosticListener.AfterOnResultExecuting(resultExecutingContext, filter);
- _logger.AfterExecutingMethodOnFilter(
- resultFilterKind,
- nameof(IResultFilter.OnResultExecuting),
- @@ -1011,7 +1011,7 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure
- var filter = (TFilter)state;
- var resultExecutedContext = _resultExecutedContext;
-
- - _diagnosticSource.BeforeOnResultExecuted(resultExecutedContext, filter);
- + _diagnosticListener.BeforeOnResultExecuted(resultExecutedContext, filter);
- _logger.BeforeExecutingMethodOnFilter(
- resultFilterKind,
- nameof(IResultFilter.OnResultExecuted),
- @@ -1019,7 +1019,7 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure
-
- filter.OnResultExecuted(resultExecutedContext);
-
- - _diagnosticSource.AfterOnResultExecuted(resultExecutedContext, filter);
- + _diagnosticListener.AfterOnResultExecuted(resultExecutedContext, filter);
- _logger.AfterExecutingMethodOnFilter(
- resultFilterKind,
- nameof(IResultFilter.OnResultExecuted),
- diff --git a/src/Microsoft.AspNetCore.Mvc.Core/MvcCoreDiagnosticSourceExtensions.cs b/src/Microsoft.AspNetCore.Mvc.Core/MvcCoreDiagnosticSourceExtensions.cs
- index 0d67d5eda7e..32085e7da86 100644
- --- a/src/Microsoft.AspNetCore.Mvc.Core/MvcCoreDiagnosticSourceExtensions.cs
- +++ b/src/Microsoft.AspNetCore.Mvc.Core/MvcCoreDiagnosticSourceExtensions.cs
- @@ -16,55 +16,82 @@ namespace Microsoft.AspNetCore.Mvc
- internal static class MvcCoreDiagnosticSourceExtensions
- {
- public static void BeforeAction(
- - this DiagnosticSource diagnosticSource,
- + this DiagnosticListener diagnosticListener,
- ActionDescriptor actionDescriptor,
- HttpContext httpContext,
- RouteData routeData)
- {
- - Debug.Assert(diagnosticSource != null);
- + Debug.Assert(diagnosticListener != null);
- Debug.Assert(actionDescriptor != null);
- Debug.Assert(httpContext != null);
- Debug.Assert(routeData != null);
-
- - if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeAction"))
- + // Inlinable fast-path check if Diagnositcs is enabled
- + if (diagnosticListener.IsEnabled())
- {
- - diagnosticSource.Write(
- + BeforeActionImpl(diagnosticListener, actionDescriptor, httpContext, routeData);
- + }
- + }
- +
- + private static void BeforeActionImpl(DiagnosticListener diagnosticListener, ActionDescriptor actionDescriptor, HttpContext httpContext, RouteData routeData)
- + {
- + if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeAction"))
- + {
- + diagnosticListener.Write(
- "Microsoft.AspNetCore.Mvc.BeforeAction",
- new { actionDescriptor, httpContext = httpContext, routeData = routeData });
- }
- }
-
- public static void AfterAction(
- - this DiagnosticSource diagnosticSource,
- + this DiagnosticListener diagnosticListener,
- ActionDescriptor actionDescriptor,
- HttpContext httpContext,
- RouteData routeData)
- {
- - Debug.Assert(diagnosticSource != null);
- + Debug.Assert(diagnosticListener != null);
- Debug.Assert(actionDescriptor != null);
- Debug.Assert(httpContext != null);
- Debug.Assert(routeData != null);
-
- - if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterAction"))
- + // Inlinable fast-path check if Diagnositcs is enabled
- + if (diagnosticListener.IsEnabled())
- + {
- + AfterActionImpl(diagnosticListener, actionDescriptor, httpContext, routeData);
- + }
- + }
- +
- + private static void AfterActionImpl(DiagnosticListener diagnosticListener, ActionDescriptor actionDescriptor, HttpContext httpContext, RouteData routeData)
- + {
- + if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.AfterAction"))
- {
- - diagnosticSource.Write(
- + diagnosticListener.Write(
- "Microsoft.AspNetCore.Mvc.AfterAction",
- new { actionDescriptor, httpContext = httpContext, routeData = routeData });
- }
- }
-
- public static void BeforeOnAuthorizationAsync(
- - this DiagnosticSource diagnosticSource,
- + this DiagnosticListener diagnosticListener,
- AuthorizationFilterContext authorizationContext,
- IAsyncAuthorizationFilter filter)
- {
- - Debug.Assert(diagnosticSource != null);
- + Debug.Assert(diagnosticListener != null);
- Debug.Assert(authorizationContext != null);
- Debug.Assert(filter != null);
-
- - if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnAuthorization"))
- + // Inlinable fast-path check if Diagnositcs is enabled
- + if (diagnosticListener.IsEnabled())
- {
- - diagnosticSource.Write(
- + BeforeOnAuthorizationAsyncImpl(diagnosticListener, authorizationContext, filter);
- + }
- + }
- +
- + private static void BeforeOnAuthorizationAsyncImpl(DiagnosticListener diagnosticListener, AuthorizationFilterContext authorizationContext, IAsyncAuthorizationFilter filter)
- + {
- + if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnAuthorization"))
- + {
- + diagnosticListener.Write(
- "Microsoft.AspNetCore.Mvc.BeforeOnAuthorization",
- new
- {
- @@ -76,17 +103,26 @@ namespace Microsoft.AspNetCore.Mvc
- }
-
- public static void AfterOnAuthorizationAsync(
- - this DiagnosticSource diagnosticSource,
- + this DiagnosticListener diagnosticListener,
- AuthorizationFilterContext authorizationContext,
- IAsyncAuthorizationFilter filter)
- {
- - Debug.Assert(diagnosticSource != null);
- + Debug.Assert(diagnosticListener != null);
- Debug.Assert(authorizationContext != null);
- Debug.Assert(filter != null);
-
- - if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnAuthorization"))
- + // Inlinable fast-path check if Diagnositcs is enabled
- + if (diagnosticListener.IsEnabled())
- + {
- + AfterOnAuthorizationAsyncImpl(diagnosticListener, authorizationContext, filter);
- + }
- + }
- +
- + private static void AfterOnAuthorizationAsyncImpl(DiagnosticListener diagnosticListener, AuthorizationFilterContext authorizationContext, IAsyncAuthorizationFilter filter)
- + {
- + if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnAuthorization"))
- {
- - diagnosticSource.Write(
- + diagnosticListener.Write(
- "Microsoft.AspNetCore.Mvc.AfterOnAuthorization",
- new
- {
- @@ -98,17 +134,26 @@ namespace Microsoft.AspNetCore.Mvc
- }
-
- public static void BeforeOnAuthorization(
- - this DiagnosticSource diagnosticSource,
- + this DiagnosticListener diagnosticListener,
- AuthorizationFilterContext authorizationContext,
- IAuthorizationFilter filter)
- {
- - Debug.Assert(diagnosticSource != null);
- + Debug.Assert(diagnosticListener != null);
- Debug.Assert(authorizationContext != null);
- Debug.Assert(filter != null);
-
- - if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnAuthorization"))
- + // Inlinable fast-path check if Diagnositcs is enabled
- + if (diagnosticListener.IsEnabled())
- {
- - diagnosticSource.Write(
- + BeforeOnAuthorizationImpl(diagnosticListener, authorizationContext, filter);
- + }
- + }
- +
- + private static void BeforeOnAuthorizationImpl(DiagnosticListener diagnosticListener, AuthorizationFilterContext authorizationContext, IAuthorizationFilter filter)
- + {
- + if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnAuthorization"))
- + {
- + diagnosticListener.Write(
- "Microsoft.AspNetCore.Mvc.BeforeOnAuthorization",
- new
- {
- @@ -120,17 +165,26 @@ namespace Microsoft.AspNetCore.Mvc
- }
-
- public static void AfterOnAuthorization(
- - this DiagnosticSource diagnosticSource,
- + this DiagnosticListener diagnosticListener,
- AuthorizationFilterContext authorizationContext,
- IAuthorizationFilter filter)
- {
- - Debug.Assert(diagnosticSource != null);
- + Debug.Assert(diagnosticListener != null);
- Debug.Assert(authorizationContext != null);
- Debug.Assert(filter != null);
-
- - if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnAuthorization"))
- + // Inlinable fast-path check if Diagnositcs is enabled
- + if (diagnosticListener.IsEnabled())
- + {
- + AfterOnAuthorizationImpl(diagnosticListener, authorizationContext, filter);
- + }
- + }
- +
- + private static void AfterOnAuthorizationImpl(DiagnosticListener diagnosticListener, AuthorizationFilterContext authorizationContext, IAuthorizationFilter filter)
- + {
- + if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnAuthorization"))
- {
- - diagnosticSource.Write(
- + diagnosticListener.Write(
- "Microsoft.AspNetCore.Mvc.AfterOnAuthorization",
- new
- {
- @@ -142,17 +196,26 @@ namespace Microsoft.AspNetCore.Mvc
- }
-
- public static void BeforeOnResourceExecution(
- - this DiagnosticSource diagnosticSource,
- + this DiagnosticListener diagnosticListener,
- ResourceExecutingContext resourceExecutingContext,
- IAsyncResourceFilter filter)
- {
- - Debug.Assert(diagnosticSource != null);
- + Debug.Assert(diagnosticListener != null);
- Debug.Assert(resourceExecutingContext != null);
- Debug.Assert(filter != null);
-
- - if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnResourceExecution"))
- + // Inlinable fast-path check if Diagnositcs is enabled
- + if (diagnosticListener.IsEnabled())
- {
- - diagnosticSource.Write(
- + BeforeOnResourceExecutionImpl(diagnosticListener, resourceExecutingContext, filter);
- + }
- + }
- +
- + private static void BeforeOnResourceExecutionImpl(DiagnosticListener diagnosticListener, ResourceExecutingContext resourceExecutingContext, IAsyncResourceFilter filter)
- + {
- + if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnResourceExecution"))
- + {
- + diagnosticListener.Write(
- "Microsoft.AspNetCore.Mvc.BeforeOnResourceExecution",
- new
- {
- @@ -164,17 +227,26 @@ namespace Microsoft.AspNetCore.Mvc
- }
-
- public static void AfterOnResourceExecution(
- - this DiagnosticSource diagnosticSource,
- + this DiagnosticListener diagnosticListener,
- ResourceExecutedContext resourceExecutedContext,
- IAsyncResourceFilter filter)
- {
- - Debug.Assert(diagnosticSource != null);
- + Debug.Assert(diagnosticListener != null);
- Debug.Assert(resourceExecutedContext != null);
- Debug.Assert(filter != null);
-
- - if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnResourceExecution"))
- + // Inlinable fast-path check if Diagnositcs is enabled
- + if (diagnosticListener.IsEnabled())
- + {
- + AfterOnResourceExecutionImpl(diagnosticListener, resourceExecutedContext, filter);
- + }
- + }
- +
- + private static void AfterOnResourceExecutionImpl(DiagnosticListener diagnosticListener, ResourceExecutedContext resourceExecutedContext, IAsyncResourceFilter filter)
- + {
- + if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnResourceExecution"))
- {
- - diagnosticSource.Write(
- + diagnosticListener.Write(
- "Microsoft.AspNetCore.Mvc.AfterOnResourceExecution",
- new
- {
- @@ -186,17 +258,26 @@ namespace Microsoft.AspNetCore.Mvc
- }
-
- public static void BeforeOnResourceExecuting(
- - this DiagnosticSource diagnosticSource,
- + this DiagnosticListener diagnosticListener,
- ResourceExecutingContext resourceExecutingContext,
- IResourceFilter filter)
- {
- - Debug.Assert(diagnosticSource != null);
- + Debug.Assert(diagnosticListener != null);
- Debug.Assert(resourceExecutingContext != null);
- Debug.Assert(filter != null);
-
- - if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnResourceExecuting"))
- + // Inlinable fast-path check if Diagnositcs is enabled
- + if (diagnosticListener.IsEnabled())
- {
- - diagnosticSource.Write(
- + BeforeOnResourceExecutingImpl(diagnosticListener, resourceExecutingContext, filter);
- + }
- + }
- +
- + private static void BeforeOnResourceExecutingImpl(DiagnosticListener diagnosticListener, ResourceExecutingContext resourceExecutingContext, IResourceFilter filter)
- + {
- + if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnResourceExecuting"))
- + {
- + diagnosticListener.Write(
- "Microsoft.AspNetCore.Mvc.BeforeOnResourceExecuting",
- new
- {
- @@ -208,17 +289,26 @@ namespace Microsoft.AspNetCore.Mvc
- }
-
- public static void AfterOnResourceExecuting(
- - this DiagnosticSource diagnosticSource,
- + this DiagnosticListener diagnosticListener,
- ResourceExecutingContext resourceExecutingContext,
- IResourceFilter filter)
- {
- - Debug.Assert(diagnosticSource != null);
- + Debug.Assert(diagnosticListener != null);
- Debug.Assert(resourceExecutingContext != null);
- Debug.Assert(filter != null);
-
- - if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnResourceExecuting"))
- + // Inlinable fast-path check if Diagnositcs is enabled
- + if (diagnosticListener.IsEnabled())
- + {
- + AfterOnResourceExecutingImpl(diagnosticListener, resourceExecutingContext, filter);
- + }
- + }
- +
- + private static void AfterOnResourceExecutingImpl(DiagnosticListener diagnosticListener, ResourceExecutingContext resourceExecutingContext, IResourceFilter filter)
- + {
- + if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnResourceExecuting"))
- {
- - diagnosticSource.Write(
- + diagnosticListener.Write(
- "Microsoft.AspNetCore.Mvc.AfterOnResourceExecuting",
- new
- {
- @@ -230,17 +320,26 @@ namespace Microsoft.AspNetCore.Mvc
- }
-
- public static void BeforeOnResourceExecuted(
- - this DiagnosticSource diagnosticSource,
- + this DiagnosticListener diagnosticListener,
- ResourceExecutedContext resourceExecutedContext,
- IResourceFilter filter)
- {
- - Debug.Assert(diagnosticSource != null);
- + Debug.Assert(diagnosticListener != null);
- Debug.Assert(resourceExecutedContext != null);
- Debug.Assert(filter != null);
-
- - if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnResourceExecuted"))
- + // Inlinable fast-path check if Diagnositcs is enabled
- + if (diagnosticListener.IsEnabled())
- {
- - diagnosticSource.Write(
- + BeforeOnResourceExecutedImpl(diagnosticListener, resourceExecutedContext, filter);
- + }
- + }
- +
- + private static void BeforeOnResourceExecutedImpl(DiagnosticListener diagnosticListener, ResourceExecutedContext resourceExecutedContext, IResourceFilter filter)
- + {
- + if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnResourceExecuted"))
- + {
- + diagnosticListener.Write(
- "Microsoft.AspNetCore.Mvc.BeforeOnResourceExecuted",
- new
- {
- @@ -252,17 +351,26 @@ namespace Microsoft.AspNetCore.Mvc
- }
-
- public static void AfterOnResourceExecuted(
- - this DiagnosticSource diagnosticSource,
- + this DiagnosticListener diagnosticListener,
- ResourceExecutedContext resourceExecutedContext,
- IResourceFilter filter)
- {
- - Debug.Assert(diagnosticSource != null);
- + Debug.Assert(diagnosticListener != null);
- Debug.Assert(resourceExecutedContext != null);
- Debug.Assert(filter != null);
-
- - if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnResourceExecuted"))
- + // Inlinable fast-path check if Diagnositcs is enabled
- + if (diagnosticListener.IsEnabled())
- + {
- + AfterOnResourceExecutedImpl(diagnosticListener, resourceExecutedContext, filter);
- + }
- + }
- +
- + private static void AfterOnResourceExecutedImpl(DiagnosticListener diagnosticListener, ResourceExecutedContext resourceExecutedContext, IResourceFilter filter)
- + {
- + if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnResourceExecuted"))
- {
- - diagnosticSource.Write(
- + diagnosticListener.Write(
- "Microsoft.AspNetCore.Mvc.AfterOnResourceExecuted",
- new
- {
- @@ -274,17 +382,26 @@ namespace Microsoft.AspNetCore.Mvc
- }
-
- public static void BeforeOnExceptionAsync(
- - this DiagnosticSource diagnosticSource,
- + this DiagnosticListener diagnosticListener,
- ExceptionContext exceptionContext,
- IAsyncExceptionFilter filter)
- {
- - Debug.Assert(diagnosticSource != null);
- + Debug.Assert(diagnosticListener != null);
- Debug.Assert(exceptionContext != null);
- Debug.Assert(filter != null);
-
- - if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnException"))
- + // Inlinable fast-path check if Diagnositcs is enabled
- + if (diagnosticListener.IsEnabled())
- {
- - diagnosticSource.Write(
- + BeforeOnExceptionAsyncImpl(diagnosticListener, exceptionContext, filter);
- + }
- + }
- +
- + private static void BeforeOnExceptionAsyncImpl(DiagnosticListener diagnosticListener, ExceptionContext exceptionContext, IAsyncExceptionFilter filter)
- + {
- + if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnException"))
- + {
- + diagnosticListener.Write(
- "Microsoft.AspNetCore.Mvc.BeforeOnException",
- new
- {
- @@ -296,17 +413,26 @@ namespace Microsoft.AspNetCore.Mvc
- }
-
- public static void AfterOnExceptionAsync(
- - this DiagnosticSource diagnosticSource,
- + this DiagnosticListener diagnosticListener,
- ExceptionContext exceptionContext,
- IAsyncExceptionFilter filter)
- {
- - Debug.Assert(diagnosticSource != null);
- + Debug.Assert(diagnosticListener != null);
- Debug.Assert(exceptionContext != null);
- Debug.Assert(filter != null);
-
- - if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnException"))
- + // Inlinable fast-path check if Diagnositcs is enabled
- + if (diagnosticListener.IsEnabled())
- + {
- + AfterOnExceptionAsyncImpl(diagnosticListener, exceptionContext, filter);
- + }
- + }
- +
- + private static void AfterOnExceptionAsyncImpl(DiagnosticListener diagnosticListener, ExceptionContext exceptionContext, IAsyncExceptionFilter filter)
- + {
- + if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnException"))
- {
- - diagnosticSource.Write(
- + diagnosticListener.Write(
- "Microsoft.AspNetCore.Mvc.AfterOnException",
- new
- {
- @@ -318,17 +444,26 @@ namespace Microsoft.AspNetCore.Mvc
- }
-
- public static void BeforeOnException(
- - this DiagnosticSource diagnosticSource,
- + this DiagnosticListener diagnosticListener,
- ExceptionContext exceptionContext,
- IExceptionFilter filter)
- {
- - Debug.Assert(diagnosticSource != null);
- + Debug.Assert(diagnosticListener != null);
- Debug.Assert(exceptionContext != null);
- Debug.Assert(filter != null);
-
- - if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnException"))
- + // Inlinable fast-path check if Diagnositcs is enabled
- + if (diagnosticListener.IsEnabled())
- {
- - diagnosticSource.Write(
- + BeforeOnExceptionImpl(diagnosticListener, exceptionContext, filter);
- + }
- + }
- +
- + private static void BeforeOnExceptionImpl(DiagnosticListener diagnosticListener, ExceptionContext exceptionContext, IExceptionFilter filter)
- + {
- + if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnException"))
- + {
- + diagnosticListener.Write(
- "Microsoft.AspNetCore.Mvc.BeforeOnException",
- new
- {
- @@ -340,17 +475,26 @@ namespace Microsoft.AspNetCore.Mvc
- }
-
- public static void AfterOnException(
- - this DiagnosticSource diagnosticSource,
- + this DiagnosticListener diagnosticListener,
- ExceptionContext exceptionContext,
- IExceptionFilter filter)
- {
- - Debug.Assert(diagnosticSource != null);
- + Debug.Assert(diagnosticListener != null);
- Debug.Assert(exceptionContext != null);
- Debug.Assert(filter != null);
-
- - if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnException"))
- + // Inlinable fast-path check if Diagnositcs is enabled
- + if (diagnosticListener.IsEnabled())
- + {
- + AfterOnExceptionImpl(diagnosticListener, exceptionContext, filter);
- + }
- + }
- +
- + private static void AfterOnExceptionImpl(DiagnosticListener diagnosticListener, ExceptionContext exceptionContext, IExceptionFilter filter)
- + {
- + if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnException"))
- {
- - diagnosticSource.Write(
- + diagnosticListener.Write(
- "Microsoft.AspNetCore.Mvc.AfterOnException",
- new
- {
- @@ -362,17 +506,26 @@ namespace Microsoft.AspNetCore.Mvc
- }
-
- public static void BeforeOnActionExecution(
- - this DiagnosticSource diagnosticSource,
- + this DiagnosticListener diagnosticListener,
- ActionExecutingContext actionExecutingContext,
- IAsyncActionFilter filter)
- {
- - Debug.Assert(diagnosticSource != null);
- + Debug.Assert(diagnosticListener != null);
- Debug.Assert(actionExecutingContext != null);
- Debug.Assert(filter != null);
-
- - if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnActionExecution"))
- + // Inlinable fast-path check if Diagnositcs is enabled
- + if (diagnosticListener.IsEnabled())
- {
- - diagnosticSource.Write(
- + BeforeOnActionExecutionImpl(diagnosticListener, actionExecutingContext, filter);
- + }
- + }
- +
- + private static void BeforeOnActionExecutionImpl(DiagnosticListener diagnosticListener, ActionExecutingContext actionExecutingContext, IAsyncActionFilter filter)
- + {
- + if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnActionExecution"))
- + {
- + diagnosticListener.Write(
- "Microsoft.AspNetCore.Mvc.BeforeOnActionExecution",
- new
- {
- @@ -384,17 +537,26 @@ namespace Microsoft.AspNetCore.Mvc
- }
-
- public static void AfterOnActionExecution(
- - this DiagnosticSource diagnosticSource,
- + this DiagnosticListener diagnosticListener,
- ActionExecutedContext actionExecutedContext,
- IAsyncActionFilter filter)
- {
- - Debug.Assert(diagnosticSource != null);
- + Debug.Assert(diagnosticListener != null);
- Debug.Assert(actionExecutedContext != null);
- Debug.Assert(filter != null);
-
- - if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnActionExecution"))
- + // Inlinable fast-path check if Diagnositcs is enabled
- + if (diagnosticListener.IsEnabled())
- + {
- + AfterOnActionExecutionImpl(diagnosticListener, actionExecutedContext, filter);
- + }
- + }
- +
- + private static void AfterOnActionExecutionImpl(DiagnosticListener diagnosticListener, ActionExecutedContext actionExecutedContext, IAsyncActionFilter filter)
- + {
- + if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnActionExecution"))
- {
- - diagnosticSource.Write(
- + diagnosticListener.Write(
- "Microsoft.AspNetCore.Mvc.AfterOnActionExecution",
- new
- {
- @@ -406,17 +568,26 @@ namespace Microsoft.AspNetCore.Mvc
- }
-
- public static void BeforeOnActionExecuting(
- - this DiagnosticSource diagnosticSource,
- + this DiagnosticListener diagnosticListener,
- ActionExecutingContext actionExecutingContext,
- IActionFilter filter)
- {
- - Debug.Assert(diagnosticSource != null);
- + Debug.Assert(diagnosticListener != null);
- Debug.Assert(actionExecutingContext != null);
- Debug.Assert(filter != null);
-
- - if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnActionExecuting"))
- + // Inlinable fast-path check if Diagnositcs is enabled
- + if (diagnosticListener.IsEnabled())
- {
- - diagnosticSource.Write(
- + BeforeOnActionExecutingImpl(diagnosticListener, actionExecutingContext, filter);
- + }
- + }
- +
- + private static void BeforeOnActionExecutingImpl(DiagnosticListener diagnosticListener, ActionExecutingContext actionExecutingContext, IActionFilter filter)
- + {
- + if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnActionExecuting"))
- + {
- + diagnosticListener.Write(
- "Microsoft.AspNetCore.Mvc.BeforeOnActionExecuting",
- new
- {
- @@ -428,17 +599,26 @@ namespace Microsoft.AspNetCore.Mvc
- }
-
- public static void AfterOnActionExecuting(
- - this DiagnosticSource diagnosticSource,
- + this DiagnosticListener diagnosticListener,
- ActionExecutingContext actionExecutingContext,
- IActionFilter filter)
- {
- - Debug.Assert(diagnosticSource != null);
- + Debug.Assert(diagnosticListener != null);
- Debug.Assert(actionExecutingContext != null);
- Debug.Assert(filter != null);
-
- - if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnActionExecuting"))
- + // Inlinable fast-path check if Diagnositcs is enabled
- + if (diagnosticListener.IsEnabled())
- + {
- + AfterOnActionExecutingImpl(diagnosticListener, actionExecutingContext, filter);
- + }
- + }
- +
- + private static void AfterOnActionExecutingImpl(DiagnosticListener diagnosticListener, ActionExecutingContext actionExecutingContext, IActionFilter filter)
- + {
- + if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnActionExecuting"))
- {
- - diagnosticSource.Write(
- + diagnosticListener.Write(
- "Microsoft.AspNetCore.Mvc.AfterOnActionExecuting",
- new
- {
- @@ -450,17 +630,26 @@ namespace Microsoft.AspNetCore.Mvc
- }
-
- public static void BeforeOnActionExecuted(
- - this DiagnosticSource diagnosticSource,
- + this DiagnosticListener diagnosticListener,
- ActionExecutedContext actionExecutedContext,
- IActionFilter filter)
- {
- - Debug.Assert(diagnosticSource != null);
- + Debug.Assert(diagnosticListener != null);
- Debug.Assert(actionExecutedContext != null);
- Debug.Assert(filter != null);
-
- - if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnActionExecuted"))
- + // Inlinable fast-path check if Diagnositcs is enabled
- + if (diagnosticListener.IsEnabled())
- {
- - diagnosticSource.Write(
- + BeforeOnActionExecutedImpl(diagnosticListener, actionExecutedContext, filter);
- + }
- + }
- +
- + private static void BeforeOnActionExecutedImpl(DiagnosticListener diagnosticListener, ActionExecutedContext actionExecutedContext, IActionFilter filter)
- + {
- + if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnActionExecuted"))
- + {
- + diagnosticListener.Write(
- "Microsoft.AspNetCore.Mvc.BeforeOnActionExecuted",
- new
- {
- @@ -472,17 +661,26 @@ namespace Microsoft.AspNetCore.Mvc
- }
-
- public static void AfterOnActionExecuted(
- - this DiagnosticSource diagnosticSource,
- + this DiagnosticListener diagnosticListener,
- ActionExecutedContext actionExecutedContext,
- IActionFilter filter)
- {
- - Debug.Assert(diagnosticSource != null);
- + Debug.Assert(diagnosticListener != null);
- Debug.Assert(actionExecutedContext != null);
- Debug.Assert(filter != null);
-
- - if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnActionExecuted"))
- + // Inlinable fast-path check if Diagnositcs is enabled
- + if (diagnosticListener.IsEnabled())
- + {
- + AfterOnActionExecutedImpl(diagnosticListener, actionExecutedContext, filter);
- + }
- + }
- +
- + private static void AfterOnActionExecutedImpl(DiagnosticListener diagnosticListener, ActionExecutedContext actionExecutedContext, IActionFilter filter)
- + {
- + if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnActionExecuted"))
- {
- - diagnosticSource.Write(
- + diagnosticListener.Write(
- "Microsoft.AspNetCore.Mvc.AfterOnActionExecuted",
- new
- {
- @@ -494,19 +692,28 @@ namespace Microsoft.AspNetCore.Mvc
- }
-
- public static void BeforeActionMethod(
- - this DiagnosticSource diagnosticSource,
- + this DiagnosticListener diagnosticListener,
- ActionContext actionContext,
- IDictionary<string, object> actionArguments,
- object controller)
- {
- - Debug.Assert(diagnosticSource != null);
- + Debug.Assert(diagnosticListener != null);
- Debug.Assert(actionContext != null);
- Debug.Assert(actionArguments != null);
- Debug.Assert(controller != null);
-
- - if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeActionMethod"))
- + // Inlinable fast-path check if Diagnositcs is enabled
- + if (diagnosticListener.IsEnabled())
- {
- - diagnosticSource.Write(
- + BeforeActionMethodImpl(diagnosticListener, actionContext, actionArguments, controller);
- + }
- + }
- +
- + private static void BeforeActionMethodImpl(DiagnosticListener diagnosticListener, ActionContext actionContext, IDictionary<string, object> actionArguments, object controller)
- + {
- + if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeActionMethod"))
- + {
- + diagnosticListener.Write(
- "Microsoft.AspNetCore.Mvc.BeforeActionMethod",
- new
- {
- @@ -518,20 +725,29 @@ namespace Microsoft.AspNetCore.Mvc
- }
-
- public static void AfterActionMethod(
- - this DiagnosticSource diagnosticSource,
- + this DiagnosticListener diagnosticListener,
- ActionContext actionContext,
- IDictionary<string, object> actionArguments,
- object controller,
- IActionResult result)
- {
- - Debug.Assert(diagnosticSource != null);
- + Debug.Assert(diagnosticListener != null);
- Debug.Assert(actionContext != null);
- Debug.Assert(actionArguments != null);
- Debug.Assert(controller != null);
-
- - if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterActionMethod"))
- + // Inlinable fast-path check if Diagnositcs is enabled
- + if (diagnosticListener.IsEnabled())
- + {
- + AfterActionMethodImpl(diagnosticListener, actionContext, actionArguments, controller, result);
- + }
- + }
- +
- + private static void AfterActionMethodImpl(DiagnosticListener diagnosticListener, ActionContext actionContext, IDictionary<string, object> actionArguments, object controller, IActionResult result)
- + {
- + if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.AfterActionMethod"))
- {
- - diagnosticSource.Write(
- + diagnosticListener.Write(
- "Microsoft.AspNetCore.Mvc.AfterActionMethod",
- new
- {
- @@ -544,17 +760,26 @@ namespace Microsoft.AspNetCore.Mvc
- }
-
- public static void BeforeOnResultExecution(
- - this DiagnosticSource diagnosticSource,
- + this DiagnosticListener diagnosticListener,
- ResultExecutingContext resultExecutingContext,
- IAsyncResultFilter filter)
- {
- - Debug.Assert(diagnosticSource != null);
- + Debug.Assert(diagnosticListener != null);
- Debug.Assert(resultExecutingContext != null);
- Debug.Assert(filter != null);
-
- - if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnResultExecution"))
- + // Inlinable fast-path check if Diagnositcs is enabled
- + if (diagnosticListener.IsEnabled())
- {
- - diagnosticSource.Write(
- + BeforeOnResultExecutionImpl(diagnosticListener, resultExecutingContext, filter);
- + }
- + }
- +
- + private static void BeforeOnResultExecutionImpl(DiagnosticListener diagnosticListener, ResultExecutingContext resultExecutingContext, IAsyncResultFilter filter)
- + {
- + if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnResultExecution"))
- + {
- + diagnosticListener.Write(
- "Microsoft.AspNetCore.Mvc.BeforeOnResultExecution",
- new
- {
- @@ -566,17 +791,26 @@ namespace Microsoft.AspNetCore.Mvc
- }
-
- public static void AfterOnResultExecution(
- - this DiagnosticSource diagnosticSource,
- + this DiagnosticListener diagnosticListener,
- ResultExecutedContext resultExecutedContext,
- IAsyncResultFilter filter)
- {
- - Debug.Assert(diagnosticSource != null);
- + Debug.Assert(diagnosticListener != null);
- Debug.Assert(resultExecutedContext != null);
- Debug.Assert(filter != null);
-
- - if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnResultExecution"))
- + // Inlinable fast-path check if Diagnositcs is enabled
- + if (diagnosticListener.IsEnabled())
- + {
- + AfterOnResultExecutionImpl(diagnosticListener, resultExecutedContext, filter);
- + }
- + }
- +
- + private static void AfterOnResultExecutionImpl(DiagnosticListener diagnosticListener, ResultExecutedContext resultExecutedContext, IAsyncResultFilter filter)
- + {
- + if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnResultExecution"))
- {
- - diagnosticSource.Write(
- + diagnosticListener.Write(
- "Microsoft.AspNetCore.Mvc.AfterOnResultExecution",
- new
- {
- @@ -588,17 +822,26 @@ namespace Microsoft.AspNetCore.Mvc
- }
-
- public static void BeforeOnResultExecuting(
- - this DiagnosticSource diagnosticSource,
- + this DiagnosticListener diagnosticListener,
- ResultExecutingContext resultExecutingContext,
- IResultFilter filter)
- {
- - Debug.Assert(diagnosticSource != null);
- + Debug.Assert(diagnosticListener != null);
- Debug.Assert(resultExecutingContext != null);
- Debug.Assert(filter != null);
-
- - if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnResultExecuting"))
- + // Inlinable fast-path check if Diagnositcs is enabled
- + if (diagnosticListener.IsEnabled())
- {
- - diagnosticSource.Write(
- + BeforeOnResultExecutingImpl(diagnosticListener, resultExecutingContext, filter);
- + }
- + }
- +
- + private static void BeforeOnResultExecutingImpl(DiagnosticListener diagnosticListener, ResultExecutingContext resultExecutingContext, IResultFilter filter)
- + {
- + if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnResultExecuting"))
- + {
- + diagnosticListener.Write(
- "Microsoft.AspNetCore.Mvc.BeforeOnResultExecuting",
- new
- {
- @@ -610,17 +853,26 @@ namespace Microsoft.AspNetCore.Mvc
- }
-
- public static void AfterOnResultExecuting(
- - this DiagnosticSource diagnosticSource,
- + this DiagnosticListener diagnosticListener,
- ResultExecutingContext resultExecutingContext,
- IResultFilter filter)
- {
- - Debug.Assert(diagnosticSource != null);
- + Debug.Assert(diagnosticListener != null);
- Debug.Assert(resultExecutingContext != null);
- Debug.Assert(filter != null);
-
- - if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnResultExecuting"))
- + // Inlinable fast-path check if Diagnositcs is enabled
- + if (diagnosticListener.IsEnabled())
- + {
- + AfterOnResultExecutingImpl(diagnosticListener, resultExecutingContext, filter);
- + }
- + }
- +
- + private static void AfterOnResultExecutingImpl(DiagnosticListener diagnosticListener, ResultExecutingContext resultExecutingContext, IResultFilter filter)
- + {
- + if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnResultExecuting"))
- {
- - diagnosticSource.Write(
- + diagnosticListener.Write(
- "Microsoft.AspNetCore.Mvc.AfterOnResultExecuting",
- new
- {
- @@ -632,17 +884,26 @@ namespace Microsoft.AspNetCore.Mvc
- }
-
- public static void BeforeOnResultExecuted(
- - this DiagnosticSource diagnosticSource,
- + this DiagnosticListener diagnosticListener,
- ResultExecutedContext resultExecutedContext,
- IResultFilter filter)
- {
- - Debug.Assert(diagnosticSource != null);
- + Debug.Assert(diagnosticListener != null);
- Debug.Assert(resultExecutedContext != null);
- Debug.Assert(filter != null);
-
- - if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnResultExecuted"))
- + // Inlinable fast-path check if Diagnositcs is enabled
- + if (diagnosticListener.IsEnabled())
- {
- - diagnosticSource.Write(
- + BeforeOnResultExecutedImpl(diagnosticListener, resultExecutedContext, filter);
- + }
- + }
- +
- + private static void BeforeOnResultExecutedImpl(DiagnosticListener diagnosticListener, ResultExecutedContext resultExecutedContext, IResultFilter filter)
- + {
- + if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnResultExecuted"))
- + {
- + diagnosticListener.Write(
- "Microsoft.AspNetCore.Mvc.BeforeOnResultExecuted",
- new
- {
- @@ -654,17 +915,26 @@ namespace Microsoft.AspNetCore.Mvc
- }
-
- public static void AfterOnResultExecuted(
- - this DiagnosticSource diagnosticSource,
- + this DiagnosticListener diagnosticListener,
- ResultExecutedContext resultExecutedContext,
- IResultFilter filter)
- {
- - Debug.Assert(diagnosticSource != null);
- + Debug.Assert(diagnosticListener != null);
- Debug.Assert(resultExecutedContext != null);
- Debug.Assert(filter != null);
-
- - if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnResultExecuted"))
- + // Inlinable fast-path check if Diagnositcs is enabled
- + if (diagnosticListener.IsEnabled())
- + {
- + AfterOnResultExecutedImpl(diagnosticListener, resultExecutedContext, filter);
- + }
- + }
- +
- + private static void AfterOnResultExecutedImpl(DiagnosticListener diagnosticListener, ResultExecutedContext resultExecutedContext, IResultFilter filter)
- + {
- + if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnResultExecuted"))
- {
- - diagnosticSource.Write(
- + diagnosticListener.Write(
- "Microsoft.AspNetCore.Mvc.AfterOnResultExecuted",
- new
- {
- @@ -676,34 +946,52 @@ namespace Microsoft.AspNetCore.Mvc
- }
-
- public static void BeforeActionResult(
- - this DiagnosticSource diagnosticSource,
- + this DiagnosticListener diagnosticListener,
- ActionContext actionContext,
- IActionResult result)
- {
- - Debug.Assert(diagnosticSource != null);
- + Debug.Assert(diagnosticListener != null);
- Debug.Assert(actionContext != null);
- Debug.Assert(result != null);
-
- - if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeActionResult"))
- + // Inlinable fast-path check if Diagnositcs is enabled
- + if (diagnosticListener.IsEnabled())
- {
- - diagnosticSource.Write(
- + BeforeActionResultImpl(diagnosticListener, actionContext, result);
- + }
- + }
- +
- + private static void BeforeActionResultImpl(DiagnosticListener diagnosticListener, ActionContext actionContext, IActionResult result)
- + {
- + if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeActionResult"))
- + {
- + diagnosticListener.Write(
- "Microsoft.AspNetCore.Mvc.BeforeActionResult",
- new { actionContext = actionContext, result = result });
- }
- }
-
- public static void AfterActionResult(
- - this DiagnosticSource diagnosticSource,
- + this DiagnosticListener diagnosticListener,
- ActionContext actionContext,
- IActionResult result)
- {
- - Debug.Assert(diagnosticSource != null);
- + Debug.Assert(diagnosticListener != null);
- Debug.Assert(actionContext != null);
- Debug.Assert(result != null);
-
- - if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterActionResult"))
- + // Inlinable fast-path check if Diagnositcs is enabled
- + if (diagnosticListener.IsEnabled())
- + {
- + AfterActionResultImpl(diagnosticListener, actionContext, result);
- + }
- + }
- +
- + private static void AfterActionResultImpl(DiagnosticListener diagnosticListener, ActionContext actionContext, IActionResult result)
- + {
- + if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.AfterActionResult"))
- {
- - diagnosticSource.Write(
- + diagnosticListener.Write(
- "Microsoft.AspNetCore.Mvc.AfterActionResult",
- new { actionContext = actionContext, result = result });
- }
- diff --git a/src/Microsoft.AspNetCore.Mvc.Core/Routing/MvcAttributeRouteHandler.cs b/src/Microsoft.AspNetCore.Mvc.Core/Routing/MvcAttributeRouteHandler.cs
- index ffc91d11d11..f32032f7604 100644
- --- a/src/Microsoft.AspNetCore.Mvc.Core/Routing/MvcAttributeRouteHandler.cs
- +++ b/src/Microsoft.AspNetCore.Mvc.Core/Routing/MvcAttributeRouteHandler.cs
- @@ -18,21 +18,21 @@ namespace Microsoft.AspNetCore.Mvc.Routing
- private readonly IActionInvokerFactory _actionInvokerFactory;
- private readonly IActionSelector _actionSelector;
- private readonly ILogger _logger;
- - private DiagnosticSource _diagnosticSource;
- + private DiagnosticListener _diagnosticListener;
-
- public MvcAttributeRouteHandler(
- IActionInvokerFactory actionInvokerFactory,
- IActionSelector actionSelector,
- - DiagnosticSource diagnosticSource,
- + DiagnosticListener diagnosticListener,
- ILoggerFactory loggerFactory)
- - : this(actionInvokerFactory, actionSelector, diagnosticSource, loggerFactory, actionContextAccessor: null)
- + : this(actionInvokerFactory, actionSelector, diagnosticListener, loggerFactory, actionContextAccessor: null)
- {
- }
-
- public MvcAttributeRouteHandler(
- IActionInvokerFactory actionInvokerFactory,
- IActionSelector actionSelector,
- - DiagnosticSource diagnosticSource,
- + DiagnosticListener diagnosticListener,
- ILoggerFactory loggerFactory,
- IActionContextAccessor actionContextAccessor)
- {
- @@ -42,7 +42,7 @@ namespace Microsoft.AspNetCore.Mvc.Routing
-
- _actionInvokerFactory = actionInvokerFactory;
- _actionSelector = actionSelector;
- - _diagnosticSource = diagnosticSource;
- + _diagnosticListener = diagnosticListener;
- _logger = loggerFactory.CreateLogger<MvcAttributeRouteHandler>();
- }
-
- diff --git a/src/Microsoft.AspNetCore.Mvc.Core/Routing/MvcRouteHandler.cs b/src/Microsoft.AspNetCore.Mvc.Core/Routing/MvcRouteHandler.cs
- index a4c31e78c8f..3d7e1add1ee 100644
- --- a/src/Microsoft.AspNetCore.Mvc.Core/Routing/MvcRouteHandler.cs
- +++ b/src/Microsoft.AspNetCore.Mvc.Core/Routing/MvcRouteHandler.cs
- @@ -17,21 +17,21 @@ namespace Microsoft.AspNetCore.Mvc.Routing
- private readonly IActionInvokerFactory _actionInvokerFactory;
- private readonly IActionSelector _actionSelector;
- private readonly ILogger _logger;
- - private readonly DiagnosticSource _diagnosticSource;
- + private readonly DiagnosticListener _diagnosticListener;
-
- public MvcRouteHandler(
- IActionInvokerFactory actionInvokerFactory,
- IActionSelector actionSelector,
- - DiagnosticSource diagnosticSource,
- + DiagnosticListener diagnosticListener,
- ILoggerFactory loggerFactory)
- - : this(actionInvokerFactory, actionSelector, diagnosticSource, loggerFactory, actionContextAccessor: null)
- + : this(actionInvokerFactory, actionSelector, diagnosticListener, loggerFactory, actionContextAccessor: null)
- {
- }
-
- public MvcRouteHandler(
- IActionInvokerFactory actionInvokerFactory,
- IActionSelector actionSelector,
- - DiagnosticSource diagnosticSource,
- + DiagnosticListener diagnosticListener,
- ILoggerFactory loggerFactory,
- IActionContextAccessor actionContextAccessor)
- {
- @@ -41,7 +41,7 @@ namespace Microsoft.AspNetCore.Mvc.Routing
-
- _actionInvokerFactory = actionInvokerFactory;
- _actionSelector = actionSelector;
- - _diagnosticSource = diagnosticSource;
- + _diagnosticListener = diagnosticListener;
- _logger = loggerFactory.CreateLogger<MvcRouteHandler>();
- }
-
- diff --git a/src/Microsoft.AspNetCore.Mvc.Razor/DependencyInjection/MvcRazorMvcCoreBuilderExtensions.cs b/src/Microsoft.AspNetCore.Mvc.Razor/DependencyInjection/MvcRazorMvcCoreBuilderExtensions.cs
- index 64c4b4d3a97..c3f6388252e 100644
- --- a/src/Microsoft.AspNetCore.Mvc.Razor/DependencyInjection/MvcRazorMvcCoreBuilderExtensions.cs
- +++ b/src/Microsoft.AspNetCore.Mvc.Razor/DependencyInjection/MvcRazorMvcCoreBuilderExtensions.cs
- @@ -174,9 +174,9 @@ namespace Microsoft.Extensions.DependencyInjection
- var optionsAccessor = s.GetRequiredService<IOptions<RazorViewEngineOptions>>();
- var razorFileSystem = s.GetRequiredService<RazorProjectFileSystem>();
- var loggerFactory = s.GetRequiredService<ILoggerFactory>();
- - var diagnosticSource = s.GetRequiredService<DiagnosticSource>();
- + var diagnosticListener = s.GetRequiredService<DiagnosticListener>();
-
- - var viewEngine = new RazorViewEngine(pageFactory, pageActivator, htmlEncoder, optionsAccessor, razorFileSystem, loggerFactory, diagnosticSource);
- + var viewEngine = new RazorViewEngine(pageFactory, pageActivator, htmlEncoder, optionsAccessor, razorFileSystem, loggerFactory, diagnosticListener);
- return viewEngine;
- });
- services.TryAddSingleton<IViewCompilerProvider, RazorViewCompilerProvider>();
- diff --git a/src/Microsoft.AspNetCore.Mvc.Razor/MvcRazorDiagnosticSourceExtensions.cs b/src/Microsoft.AspNetCore.Mvc.Razor/MvcRazorDiagnosticSourceExtensions.cs
- index d6706ed56df..f0479ef1430 100644
- --- a/src/Microsoft.AspNetCore.Mvc.Razor/MvcRazorDiagnosticSourceExtensions.cs
- +++ b/src/Microsoft.AspNetCore.Mvc.Razor/MvcRazorDiagnosticSourceExtensions.cs
- @@ -9,13 +9,25 @@ namespace Microsoft.AspNetCore.Mvc.Razor
- internal static class MvcRazorDiagnosticSourceExtensions
- {
- public static void BeforeViewPage(
- - this DiagnosticSource diagnosticSource,
- + this DiagnosticListener diagnosticListener,
- IRazorPage page,
- ViewContext viewContext)
- {
- - if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.Razor.BeforeViewPage"))
- + // Inlinable fast-path check if Diagnositcs is enabled
- + if (diagnosticListener.IsEnabled())
- {
- - diagnosticSource.Write(
- + BeforeViewPageImpl(diagnosticListener, page, viewContext);
- + }
- + }
- +
- + private static void BeforeViewPageImpl(
- + this DiagnosticListener diagnosticListener,
- + IRazorPage page,
- + ViewContext viewContext)
- + {
- + if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.Razor.BeforeViewPage"))
- + {
- + diagnosticListener.Write(
- "Microsoft.AspNetCore.Mvc.Razor.BeforeViewPage",
- new
- {
- @@ -28,13 +40,25 @@ namespace Microsoft.AspNetCore.Mvc.Razor
- }
-
- public static void AfterViewPage(
- - this DiagnosticSource diagnosticSource,
- + this DiagnosticListener diagnosticListener,
- + IRazorPage page,
- + ViewContext viewContext)
- + {
- + // Inlinable fast-path check if Diagnositcs is enabled
- + if (diagnosticListener.IsEnabled())
- + {
- + AfterViewPageImpl(diagnosticListener, page, viewContext);
- + }
- + }
- +
- + private static void AfterViewPageImpl(
- + this DiagnosticListener diagnosticListener,
- IRazorPage page,
- ViewContext viewContext)
- {
- - if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.Razor.AfterViewPage"))
- + if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.Razor.AfterViewPage"))
- {
- - diagnosticSource.Write(
- + diagnosticListener.Write(
- "Microsoft.AspNetCore.Mvc.Razor.AfterViewPage",
- new
- {
- diff --git a/src/Microsoft.AspNetCore.Mvc.Razor/RazorView.cs b/src/Microsoft.AspNetCore.Mvc.Razor/RazorView.cs
- index e6e75ce12d8..8b5b3ebe901 100644
- --- a/src/Microsoft.AspNetCore.Mvc.Razor/RazorView.cs
- +++ b/src/Microsoft.AspNetCore.Mvc.Razor/RazorView.cs
- @@ -23,7 +23,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor
- private readonly IRazorViewEngine _viewEngine;
- private readonly IRazorPageActivator _pageActivator;
- private readonly HtmlEncoder _htmlEncoder;
- - private readonly DiagnosticSource _diagnosticSource;
- + private readonly DiagnosticListener _diagnosticListener;
- private IViewBufferScope _bufferScope;
-
- /// <summary>
- @@ -35,14 +35,14 @@ namespace Microsoft.AspNetCore.Mvc.Razor
- /// </param>
- /// <param name="razorPage">The <see cref="IRazorPage"/> instance to execute.</param>
- /// <param name="htmlEncoder">The HTML encoder.</param>
- - /// <param name="diagnosticSource">The <see cref="DiagnosticSource"/>.</param>
- + /// <param name="diagnosticListener">The <see cref="DiagnosticListener"/>.</param>
- public RazorView(
- IRazorViewEngine viewEngine,
- IRazorPageActivator pageActivator,
- IReadOnlyList<IRazorPage> viewStartPages,
- IRazorPage razorPage,
- HtmlEncoder htmlEncoder,
- - DiagnosticSource diagnosticSource)
- + DiagnosticListener diagnosticListener)
- {
- if (viewEngine == null)
- {
- @@ -69,9 +69,9 @@ namespace Microsoft.AspNetCore.Mvc.Razor
- throw new ArgumentNullException(nameof(htmlEncoder));
- }
-
- - if (diagnosticSource == null)
- + if (diagnosticListener == null)
- {
- - throw new ArgumentNullException(nameof(diagnosticSource));
- + throw new ArgumentNullException(nameof(diagnosticListener));
- }
-
- _viewEngine = viewEngine;
- @@ -79,7 +79,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor
- ViewStartPages = viewStartPages;
- RazorPage = razorPage;
- _htmlEncoder = htmlEncoder;
- - _diagnosticSource = diagnosticSource;
- + _diagnosticListener = diagnosticListener;
- }
-
- /// <inheritdoc />
- @@ -170,7 +170,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor
-
- OnAfterPageActivated?.Invoke(page, context);
-
- - _diagnosticSource.BeforeViewPage(page, context);
- + _diagnosticListener.BeforeViewPage(page, context);
-
- try
- {
- @@ -178,7 +178,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor
- }
- finally
- {
- - _diagnosticSource.AfterViewPage(page, context);
- + _diagnosticListener.AfterViewPage(page, context);
- }
- }
-
- diff --git a/src/Microsoft.AspNetCore.Mvc.Razor/RazorViewEngine.cs b/src/Microsoft.AspNetCore.Mvc.Razor/RazorViewEngine.cs
- index 9bbe9cfb135..026d8c88aea 100644
- --- a/src/Microsoft.AspNetCore.Mvc.Razor/RazorViewEngine.cs
- +++ b/src/Microsoft.AspNetCore.Mvc.Razor/RazorViewEngine.cs
- @@ -43,7 +43,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor
- private readonly ILogger _logger;
- private readonly RazorViewEngineOptions _options;
- private readonly RazorProject _razorFileSystem;
- - private readonly DiagnosticSource _diagnosticSource;
- + private readonly DiagnosticListener _diagnosticListener;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="RazorViewEngine" />.
- @@ -56,7 +56,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor
- IOptions<RazorViewEngineOptions> optionsAccessor,
- RazorProject razorProject,
- ILoggerFactory loggerFactory,
- - DiagnosticSource diagnosticSource)
- + DiagnosticListener diagnosticListener)
- {
- _options = optionsAccessor.Value;
-
- @@ -79,7 +79,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor
- _htmlEncoder = htmlEncoder;
- _logger = loggerFactory.CreateLogger<RazorViewEngine>();
- _razorFileSystem = razorProject;
- - _diagnosticSource = diagnosticSource;
- + _diagnosticListener = diagnosticListener;
- ViewLookupCache = new MemoryCache(new MemoryCacheOptions());
- }
-
- @@ -93,9 +93,9 @@ namespace Microsoft.AspNetCore.Mvc.Razor
- IOptions<RazorViewEngineOptions> optionsAccessor,
- RazorProjectFileSystem razorFileSystem,
- ILoggerFactory loggerFactory,
- - DiagnosticSource diagnosticSource)
- + DiagnosticListener diagnosticListener)
- #pragma warning disable CS0618 // Type or member is obsolete
- - : this (pageFactory, pageActivator, htmlEncoder, optionsAccessor, (RazorProject)razorFileSystem, loggerFactory, diagnosticSource)
- + : this (pageFactory, pageActivator, htmlEncoder, optionsAccessor, (RazorProject)razorFileSystem, loggerFactory, diagnosticListener)
- #pragma warning restore CS0618 // Type or member is obsolete
- {
- }
- @@ -498,7 +498,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor
- viewStarts[i] = viewStartItem.PageFactory();
- }
-
- - var view = new RazorView(this, _pageActivator, viewStarts, page, _htmlEncoder, _diagnosticSource);
- + var view = new RazorView(this, _pageActivator, viewStarts, page, _htmlEncoder, _diagnosticListener);
- return ViewEngineResult.Found(viewName, view);
- }
-
- diff --git a/src/Microsoft.AspNetCore.Mvc.Razor/breakingchanges.netcore.json b/src/Microsoft.AspNetCore.Mvc.Razor/breakingchanges.netcore.json
- new file mode 100644
- index 00000000000..ee5093114a7
- --- /dev/null
- +++ b/src/Microsoft.AspNetCore.Mvc.Razor/breakingchanges.netcore.json
- @@ -0,0 +1,17 @@
- +[
- + {
- + "TypeId": "public class Microsoft.AspNetCore.Mvc.Razor.RazorViewEngine : Microsoft.AspNetCore.Mvc.Razor.IRazorViewEngine",
- + "MemberId": "public .ctor(Microsoft.AspNetCore.Mvc.Razor.IRazorPageFactoryProvider pageFactory, Microsoft.AspNetCore.Mvc.Razor.IRazorPageActivator pageActivator, System.Text.Encodings.Web.HtmlEncoder htmlEncoder, Microsoft.Extensions.Options.IOptions<Microsoft.AspNetCore.Mvc.Razor.RazorViewEngineOptions> optionsAccessor, Microsoft.AspNetCore.Razor.Language.RazorProject razorProject, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory, System.Diagnostics.DiagnosticSource diagnosticSource)",
- + "Kind": "Removal"
- + },
- + {
- + "TypeId": "public class Microsoft.AspNetCore.Mvc.Razor.RazorViewEngine : Microsoft.AspNetCore.Mvc.Razor.IRazorViewEngine",
- + "MemberId": "public .ctor(Microsoft.AspNetCore.Mvc.Razor.IRazorPageFactoryProvider pageFactory, Microsoft.AspNetCore.Mvc.Razor.IRazorPageActivator pageActivator, System.Text.Encodings.Web.HtmlEncoder htmlEncoder, Microsoft.Extensions.Options.IOptions<Microsoft.AspNetCore.Mvc.Razor.RazorViewEngineOptions> optionsAccessor, Microsoft.AspNetCore.Razor.Language.RazorProjectFileSystem razorFileSystem, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory, System.Diagnostics.DiagnosticSource diagnosticSource)",
- + "Kind": "Removal"
- + },
- + {
- + "TypeId": "public class Microsoft.AspNetCore.Mvc.Razor.RazorView : Microsoft.AspNetCore.Mvc.ViewEngines.IView",
- + "MemberId": "public .ctor(Microsoft.AspNetCore.Mvc.Razor.IRazorViewEngine viewEngine, Microsoft.AspNetCore.Mvc.Razor.IRazorPageActivator pageActivator, System.Collections.Generic.IReadOnlyList<Microsoft.AspNetCore.Mvc.Razor.IRazorPage> viewStartPages, Microsoft.AspNetCore.Mvc.Razor.IRazorPage razorPage, System.Text.Encodings.Web.HtmlEncoder htmlEncoder, System.Diagnostics.DiagnosticSource diagnosticSource)",
- + "Kind": "Removal"
- + }
- +]
- diff --git a/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/DefaultPageFactoryProvider.cs b/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/DefaultPageFactoryProvider.cs
- index 899175d215f..a5adaa11c37 100644
- --- a/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/DefaultPageFactoryProvider.cs
- +++ b/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/DefaultPageFactoryProvider.cs
- @@ -24,7 +24,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure
- IModelMetadataProvider metadataProvider,
- IUrlHelperFactory urlHelperFactory,
- IJsonHelper jsonHelper,
- - DiagnosticSource diagnosticSource,
- + DiagnosticListener diagnosticListener,
- HtmlEncoder htmlEncoder,
- IModelExpressionProvider modelExpressionProvider)
- {
- @@ -34,7 +34,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure
- {
- UrlHelperAccessor = context => urlHelperFactory.GetUrlHelper(context),
- JsonHelperAccessor = context => jsonHelper,
- - DiagnosticSourceAccessor = context => diagnosticSource,
- + DiagnosticSourceAccessor = context => diagnosticListener,
- HtmlEncoderAccessor = context => htmlEncoder,
- ModelExpressionProviderAccessor = context => modelExpressionProvider,
- };
- diff --git a/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/PageActionInvoker.cs b/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/PageActionInvoker.cs
- index 1fa0739e1bc..8bcdad905b7 100644
- --- a/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/PageActionInvoker.cs
- +++ b/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/PageActionInvoker.cs
- @@ -39,7 +39,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure
-
- public PageActionInvoker(
- IPageHandlerMethodSelector handlerMethodSelector,
- - DiagnosticSource diagnosticSource,
- + DiagnosticListener diagnosticListener,
- ILogger logger,
- IActionResultTypeMapper mapper,
- PageContext pageContext,
- @@ -49,7 +49,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure
- ITempDataDictionaryFactory tempDataFactory,
- HtmlHelperOptions htmlHelperOptions)
- : base(
- - diagnosticSource,
- + diagnosticListener,
- logger,
- mapper,
- pageContext,
- @@ -255,7 +255,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure
-
- Debug.Assert(executor != null, "We should always find a executor for a handler");
-
- - _diagnosticSource.BeforeHandlerMethod(_pageContext, handler, _arguments, _instance);
- + _diagnosticListener.BeforeHandlerMethod(_pageContext, handler, _arguments, _instance);
- _logger.ExecutingHandlerMethod(_pageContext, handler, arguments);
-
- try
- @@ -265,7 +265,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure
- }
- finally
- {
- - _diagnosticSource.AfterHandlerMethod(_pageContext, handler, _arguments, _instance, _result);
- + _diagnosticListener.AfterHandlerMethod(_pageContext, handler, _arguments, _instance, _result);
- }
- }
-
- @@ -347,7 +347,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure
- var filter = (IAsyncPageFilter)state;
- var handlerSelectedContext = _handlerSelectedContext;
-
- - _diagnosticSource.BeforeOnPageHandlerSelection(handlerSelectedContext, filter);
- + _diagnosticListener.BeforeOnPageHandlerSelection(handlerSelectedContext, filter);
- _logger.BeforeExecutingMethodOnFilter(
- PageLoggerExtensions.PageFilter,
- nameof(IAsyncPageFilter.OnPageHandlerSelectionAsync),
- @@ -370,7 +370,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure
-
- var filter = (IAsyncPageFilter)state;
-
- - _diagnosticSource.AfterOnPageHandlerSelection(_handlerSelectedContext, filter);
- + _diagnosticListener.AfterOnPageHandlerSelection(_handlerSelectedContext, filter);
- _logger.AfterExecutingMethodOnFilter(
- PageLoggerExtensions.PageFilter,
- nameof(IAsyncPageFilter.OnPageHandlerSelectionAsync),
- @@ -387,7 +387,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure
- var filter = (IPageFilter)state;
- var handlerSelectedContext = _handlerSelectedContext;
-
- - _diagnosticSource.BeforeOnPageHandlerSelected(handlerSelectedContext, filter);
- + _diagnosticListener.BeforeOnPageHandlerSelected(handlerSelectedContext, filter);
- _logger.BeforeExecutingMethodOnFilter(
- PageLoggerExtensions.PageFilter,
- nameof(IPageFilter.OnPageHandlerSelected),
- @@ -395,7 +395,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure
-
- filter.OnPageHandlerSelected(handlerSelectedContext);
-
- - _diagnosticSource.AfterOnPageHandlerSelected(handlerSelectedContext, filter);
- + _diagnosticListener.AfterOnPageHandlerSelected(handlerSelectedContext, filter);
-
- goto case State.PageSelectHandlerNext;
- }
- @@ -458,7 +458,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure
- var filter = (IAsyncPageFilter)state;
- var handlerExecutingContext = _handlerExecutingContext;
-
- - _diagnosticSource.BeforeOnPageHandlerExecution(handlerExecutingContext, filter);
- + _diagnosticListener.BeforeOnPageHandlerExecution(handlerExecutingContext, filter);
- _logger.BeforeExecutingMethodOnFilter(
- PageLoggerExtensions.PageFilter,
- nameof(IAsyncPageFilter.OnPageHandlerExecutionAsync),
- @@ -497,7 +497,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure
- };
- }
-
- - _diagnosticSource.AfterOnPageHandlerExecution(_handlerExecutedContext, filter);
- + _diagnosticListener.AfterOnPageHandlerExecution(_handlerExecutedContext, filter);
- _logger.AfterExecutingMethodOnFilter(
- PageLoggerExtensions.PageFilter,
- nameof(IAsyncPageFilter.OnPageHandlerExecutionAsync),
- @@ -514,7 +514,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure
- var filter = (IPageFilter)state;
- var handlerExecutingContext = _handlerExecutingContext;
-
- - _diagnosticSource.BeforeOnPageHandlerExecuting(handlerExecutingContext, filter);
- + _diagnosticListener.BeforeOnPageHandlerExecuting(handlerExecutingContext, filter);
- _logger.BeforeExecutingMethodOnFilter(
- PageLoggerExtensions.PageFilter,
- nameof(IPageFilter.OnPageHandlerExecuting),
- @@ -522,7 +522,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure
-
- filter.OnPageHandlerExecuting(handlerExecutingContext);
-
- - _diagnosticSource.AfterOnPageHandlerExecuting(handlerExecutingContext, filter);
- + _diagnosticListener.AfterOnPageHandlerExecuting(handlerExecutingContext, filter);
- _logger.AfterExecutingMethodOnFilter(
- PageLoggerExtensions.PageFilter,
- nameof(IPageFilter.OnPageHandlerExecuting),
- @@ -565,7 +565,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure
- var filter = (IPageFilter)state;
- var handlerExecutedContext = _handlerExecutedContext;
-
- - _diagnosticSource.BeforeOnPageHandlerExecuted(handlerExecutedContext, filter);
- + _diagnosticListener.BeforeOnPageHandlerExecuted(handlerExecutedContext, filter);
- _logger.BeforeExecutingMethodOnFilter(
- PageLoggerExtensions.PageFilter,
- nameof(IPageFilter.OnPageHandlerExecuted),
- @@ -573,7 +573,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure
-
- filter.OnPageHandlerExecuted(handlerExecutedContext);
-
- - _diagnosticSource.AfterOnPageHandlerExecuted(handlerExecutedContext, filter);
- + _diagnosticListener.AfterOnPageHandlerExecuted(handlerExecutedContext, filter);
- _logger.AfterExecutingMethodOnFilter(
- PageLoggerExtensions.PageFilter,
- nameof(IPageFilter.OnPageHandlerExecuted),
- diff --git a/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/PageActionInvokerProvider.cs b/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/PageActionInvokerProvider.cs
- index f1a54850d34..e5fd4e97c9c 100644
- --- a/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/PageActionInvokerProvider.cs
- +++ b/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/PageActionInvokerProvider.cs
- @@ -37,7 +37,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure
- private readonly HtmlHelperOptions _htmlHelperOptions;
- private readonly IPageHandlerMethodSelector _selector;
- private readonly RazorProjectFileSystem _razorFileSystem;
- - private readonly DiagnosticSource _diagnosticSource;
- + private readonly DiagnosticListener _diagnosticListener;
- private readonly ILogger<PageActionInvoker> _logger;
- private readonly IActionResultTypeMapper _mapper;
- private volatile InnerCache _currentCache;
- @@ -57,7 +57,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure
- IOptions<HtmlHelperOptions> htmlHelperOptions,
- IPageHandlerMethodSelector selector,
- RazorProjectFileSystem razorFileSystem,
- - DiagnosticSource diagnosticSource,
- + DiagnosticListener diagnosticListener,
- ILoggerFactory loggerFactory,
- IActionResultTypeMapper mapper)
- {
- @@ -76,7 +76,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure
- _htmlHelperOptions = htmlHelperOptions.Value;
- _selector = selector;
- _razorFileSystem = razorFileSystem;
- - _diagnosticSource = diagnosticSource;
- + _diagnosticListener = diagnosticListener;
- _logger = loggerFactory.CreateLogger<PageActionInvoker>();
- _mapper = mapper;
- }
- @@ -156,7 +156,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure
-
- return new PageActionInvoker(
- _selector,
- - _diagnosticSource,
- + _diagnosticListener,
- _logger,
- _mapper,
- pageContext,
- diff --git a/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/PageResultExecutor.cs b/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/PageResultExecutor.cs
- index 17a5c8e68ba..9ce8e7d6a97 100644
- --- a/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/PageResultExecutor.cs
- +++ b/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/PageResultExecutor.cs
- @@ -20,7 +20,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure
- {
- private readonly IRazorViewEngine _razorViewEngine;
- private readonly IRazorPageActivator _razorPageActivator;
- - private readonly DiagnosticSource _diagnosticSource;
- + private readonly DiagnosticListener _diagnosticListener;
- private readonly HtmlEncoder _htmlEncoder;
-
- /// <summary>
- @@ -30,21 +30,21 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure
- /// <param name="compositeViewEngine">The <see cref="ICompositeViewEngine"/>.</param>
- /// <param name="razorViewEngine">The <see cref="IRazorViewEngine"/>.</param>
- /// <param name="razorPageActivator">The <see cref="IRazorPageActivator"/>.</param>
- - /// <param name="diagnosticSource">The <see cref="DiagnosticSource"/>.</param>
- + /// <param name="diagnosticListener">The <see cref="DiagnosticListener"/>.</param>
- /// <param name="htmlEncoder">The <see cref="HtmlEncoder"/>.</param>
- public PageResultExecutor(
- IHttpResponseStreamWriterFactory writerFactory,
- ICompositeViewEngine compositeViewEngine,
- IRazorViewEngine razorViewEngine,
- IRazorPageActivator razorPageActivator,
- - DiagnosticSource diagnosticSource,
- + DiagnosticListener diagnosticListener,
- HtmlEncoder htmlEncoder)
- - : base(writerFactory, compositeViewEngine, diagnosticSource)
- + : base(writerFactory, compositeViewEngine, diagnosticListener)
- {
- _razorViewEngine = razorViewEngine;
- _htmlEncoder = htmlEncoder;
- _razorPageActivator = razorPageActivator;
- - _diagnosticSource = diagnosticSource;
- + _diagnosticListener = diagnosticListener;
- }
-
- /// <summary>
- @@ -84,7 +84,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure
- viewStarts,
- pageAdapter,
- _htmlEncoder,
- - _diagnosticSource)
- + _diagnosticListener)
- {
- OnAfterPageActivated = (page, currentViewContext) =>
- {
- diff --git a/src/Microsoft.AspNetCore.Mvc.RazorPages/MvcRazorPagesDiagnosticSourceExtensions.cs b/src/Microsoft.AspNetCore.Mvc.RazorPages/MvcRazorPagesDiagnosticSourceExtensions.cs
- index 54dd75df95a..5747c9828fb 100644
- --- a/src/Microsoft.AspNetCore.Mvc.RazorPages/MvcRazorPagesDiagnosticSourceExtensions.cs
- +++ b/src/Microsoft.AspNetCore.Mvc.RazorPages/MvcRazorPagesDiagnosticSourceExtensions.cs
- @@ -11,21 +11,30 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages
- internal static class MvcRazorPagesDiagnosticSourceExtensions
- {
- public static void BeforeHandlerMethod(
- - this DiagnosticSource diagnosticSource,
- + this DiagnosticListener diagnosticListener,
- ActionContext actionContext,
- HandlerMethodDescriptor handlerMethodDescriptor,
- IDictionary<string, object> arguments,
- object instance)
- {
- - Debug.Assert(diagnosticSource != null);
- + Debug.Assert(diagnosticListener != null);
- Debug.Assert(actionContext != null);
- Debug.Assert(handlerMethodDescriptor != null);
- Debug.Assert(arguments != null);
- Debug.Assert(instance != null);
-
- - if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeHandlerMethod"))
- + // Inlinable fast-path check if Diagnositcs is enabled
- + if (diagnosticListener.IsEnabled())
- {
- - diagnosticSource.Write(
- + BeforeHandlerMethodImpl(diagnosticListener, actionContext, handlerMethodDescriptor, arguments, instance);
- + }
- + }
- +
- + private static void BeforeHandlerMethodImpl(DiagnosticListener diagnosticListener, ActionContext actionContext, HandlerMethodDescriptor handlerMethodDescriptor, IDictionary<string, object> arguments, object instance)
- + {
- + if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeHandlerMethod"))
- + {
- + diagnosticListener.Write(
- "Microsoft.AspNetCore.Mvc.BeforeHandlerMethod",
- new
- {
- @@ -38,22 +47,31 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages
- }
-
- public static void AfterHandlerMethod(
- - this DiagnosticSource diagnosticSource,
- + this DiagnosticListener diagnosticListener,
- ActionContext actionContext,
- HandlerMethodDescriptor handlerMethodDescriptor,
- IDictionary<string, object> arguments,
- object instance,
- IActionResult result)
- {
- - Debug.Assert(diagnosticSource != null);
- + Debug.Assert(diagnosticListener != null);
- Debug.Assert(actionContext != null);
- Debug.Assert(handlerMethodDescriptor != null);
- Debug.Assert(arguments != null);
- Debug.Assert(instance != null);
-
- - if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterHandlerMethod"))
- + // Inlinable fast-path check if Diagnositcs is enabled
- + if (diagnosticListener.IsEnabled())
- + {
- + AfterHandlerMethodImpl(diagnosticListener, actionContext, handlerMethodDescriptor, arguments, instance, result);
- + }
- + }
- +
- + private static void AfterHandlerMethodImpl(DiagnosticListener diagnosticListener, ActionContext actionContext, HandlerMethodDescriptor handlerMethodDescriptor, IDictionary<string, object> arguments, object instance, IActionResult result)
- + {
- + if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.AfterHandlerMethod"))
- {
- - diagnosticSource.Write(
- + diagnosticListener.Write(
- "Microsoft.AspNetCore.Mvc.AfterHandlerMethod",
- new
- {
- @@ -65,19 +83,28 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages
- });
- }
- }
- -
- +
- public static void BeforeOnPageHandlerExecution(
- - this DiagnosticSource diagnosticSource,
- + this DiagnosticListener diagnosticListener,
- PageHandlerExecutingContext handlerExecutionContext,
- IAsyncPageFilter filter)
- {
- - Debug.Assert(diagnosticSource != null);
- + Debug.Assert(diagnosticListener != null);
- Debug.Assert(handlerExecutionContext != null);
- Debug.Assert(filter != null);
-
- - if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnPageHandlerExecution"))
- + // Inlinable fast-path check if Diagnositcs is enabled
- + if (diagnosticListener.IsEnabled())
- + {
- + BeforeOnPageHandlerExecutionImpl(diagnosticListener, handlerExecutionContext, filter);
- + }
- + }
- +
- + private static void BeforeOnPageHandlerExecutionImpl(DiagnosticListener diagnosticListener, PageHandlerExecutingContext handlerExecutionContext, IAsyncPageFilter filter)
- + {
- + if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnPageHandlerExecution"))
- {
- - diagnosticSource.Write(
- + diagnosticListener.Write(
- "Microsoft.AspNetCore.Mvc.BeforeOnPageHandlerExecution",
- new
- {
- @@ -89,17 +116,26 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages
- }
-
- public static void AfterOnPageHandlerExecution(
- - this DiagnosticSource diagnosticSource,
- + this DiagnosticListener diagnosticListener,
- PageHandlerExecutedContext handlerExecutedContext,
- IAsyncPageFilter filter)
- {
- - Debug.Assert(diagnosticSource != null);
- + Debug.Assert(diagnosticListener != null);
- Debug.Assert(handlerExecutedContext != null);
- Debug.Assert(filter != null);
-
- - if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnPageHandlerExecution"))
- + // Inlinable fast-path check if Diagnositcs is enabled
- + if (diagnosticListener.IsEnabled())
- {
- - diagnosticSource.Write(
- + AfterOnPageHandlerExecutionImpl(diagnosticListener, handlerExecutedContext, filter);
- + }
- + }
- +
- + private static void AfterOnPageHandlerExecutionImpl(DiagnosticListener diagnosticListener, PageHandlerExecutedContext handlerExecutedContext, IAsyncPageFilter filter)
- + {
- + if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnPageHandlerExecution"))
- + {
- + diagnosticListener.Write(
- "Microsoft.AspNetCore.Mvc.AfterOnPageHandlerExecution",
- new
- {
- @@ -111,17 +147,26 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages
- }
-
- public static void BeforeOnPageHandlerExecuting(
- - this DiagnosticSource diagnosticSource,
- + this DiagnosticListener diagnosticListener,
- PageHandlerExecutingContext handlerExecutingContext,
- IPageFilter filter)
- {
- - Debug.Assert(diagnosticSource != null);
- + Debug.Assert(diagnosticListener != null);
- Debug.Assert(handlerExecutingContext != null);
- Debug.Assert(filter != null);
-
- - if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnPageHandlerExecuting"))
- + // Inlinable fast-path check if Diagnositcs is enabled
- + if (diagnosticListener.IsEnabled())
- {
- - diagnosticSource.Write(
- + BeforeOnPageHandlerExecutingImpl(diagnosticListener, handlerExecutingContext, filter);
- + }
- + }
- +
- + private static void BeforeOnPageHandlerExecutingImpl(DiagnosticListener diagnosticListener, PageHandlerExecutingContext handlerExecutingContext, IPageFilter filter)
- + {
- + if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnPageHandlerExecuting"))
- + {
- + diagnosticListener.Write(
- "Microsoft.AspNetCore.Mvc.BeforeOnPageHandlerExecuting",
- new
- {
- @@ -133,17 +178,26 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages
- }
-
- public static void AfterOnPageHandlerExecuting(
- - this DiagnosticSource diagnosticSource,
- + this DiagnosticListener diagnosticListener,
- PageHandlerExecutingContext handlerExecutingContext,
- IPageFilter filter)
- {
- - Debug.Assert(diagnosticSource != null);
- + Debug.Assert(diagnosticListener != null);
- Debug.Assert(handlerExecutingContext != null);
- Debug.Assert(filter != null);
-
- - if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnPageHandlerExecuting"))
- + // Inlinable fast-path check if Diagnositcs is enabled
- + if (diagnosticListener.IsEnabled())
- + {
- + AfterOnPageHandlerExecutingImpl(diagnosticListener, handlerExecutingContext, filter);
- + }
- + }
- +
- + private static void AfterOnPageHandlerExecutingImpl(DiagnosticListener diagnosticListener, PageHandlerExecutingContext handlerExecutingContext, IPageFilter filter)
- + {
- + if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnPageHandlerExecuting"))
- {
- - diagnosticSource.Write(
- + diagnosticListener.Write(
- "Microsoft.AspNetCore.Mvc.AfterOnPageHandlerExecuting",
- new
- {
- @@ -155,17 +209,26 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages
- }
-
- public static void BeforeOnPageHandlerExecuted(
- - this DiagnosticSource diagnosticSource,
- + this DiagnosticListener diagnosticListener,
- PageHandlerExecutedContext handlerExecutedContext,
- IPageFilter filter)
- {
- - Debug.Assert(diagnosticSource != null);
- + Debug.Assert(diagnosticListener != null);
- Debug.Assert(handlerExecutedContext != null);
- Debug.Assert(filter != null);
-
- - if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnPageHandlerExecuted"))
- + // Inlinable fast-path check if Diagnositcs is enabled
- + if (diagnosticListener.IsEnabled())
- {
- - diagnosticSource.Write(
- + BeforeOnPageHandlerExecutedImpl(diagnosticListener, handlerExecutedContext, filter);
- + }
- + }
- +
- + private static void BeforeOnPageHandlerExecutedImpl(DiagnosticListener diagnosticListener, PageHandlerExecutedContext handlerExecutedContext, IPageFilter filter)
- + {
- + if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnPageHandlerExecuted"))
- + {
- + diagnosticListener.Write(
- "Microsoft.AspNetCore.Mvc.BeforeOnPageHandlerExecuted",
- new
- {
- @@ -177,17 +240,26 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages
- }
-
- public static void AfterOnPageHandlerExecuted(
- - this DiagnosticSource diagnosticSource,
- + this DiagnosticListener diagnosticListener,
- PageHandlerExecutedContext handlerExecutedContext,
- IPageFilter filter)
- {
- - Debug.Assert(diagnosticSource != null);
- + Debug.Assert(diagnosticListener != null);
- Debug.Assert(handlerExecutedContext != null);
- Debug.Assert(filter != null);
-
- - if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnPageHandlerExecuted"))
- + // Inlinable fast-path check if Diagnositcs is enabled
- + if (diagnosticListener.IsEnabled())
- {
- - diagnosticSource.Write(
- + AfterOnPageHandlerExecutedImpl(diagnosticListener, handlerExecutedContext, filter);
- + }
- + }
- +
- + private static void AfterOnPageHandlerExecutedImpl(DiagnosticListener diagnosticListener, PageHandlerExecutedContext handlerExecutedContext, IPageFilter filter)
- + {
- + if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnPageHandlerExecuted"))
- + {
- + diagnosticListener.Write(
- "Microsoft.AspNetCore.Mvc.AfterOnPageHandlerExecuted",
- new
- {
- @@ -199,17 +271,26 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages
- }
-
- public static void BeforeOnPageHandlerSelection(
- - this DiagnosticSource diagnosticSource,
- + this DiagnosticListener diagnosticListener,
- PageHandlerSelectedContext handlerSelectedContext,
- IAsyncPageFilter filter)
- {
- - Debug.Assert(diagnosticSource != null);
- + Debug.Assert(diagnosticListener != null);
- Debug.Assert(handlerSelectedContext != null);
- Debug.Assert(filter != null);
-
- - if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnPageHandlerSelection"))
- + // Inlinable fast-path check if Diagnositcs is enabled
- + if (diagnosticListener.IsEnabled())
- + {
- + BeforeOnPageHandlerSelectionImpl(diagnosticListener, handlerSelectedContext, filter);
- + }
- + }
- +
- + private static void BeforeOnPageHandlerSelectionImpl(DiagnosticListener diagnosticListener, PageHandlerSelectedContext handlerSelectedContext, IAsyncPageFilter filter)
- + {
- + if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnPageHandlerSelection"))
- {
- - diagnosticSource.Write(
- + diagnosticListener.Write(
- "Microsoft.AspNetCore.Mvc.BeforeOnPageHandlerSelection",
- new
- {
- @@ -221,17 +302,26 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages
- }
-
- public static void AfterOnPageHandlerSelection(
- - this DiagnosticSource diagnosticSource,
- + this DiagnosticListener diagnosticListener,
- PageHandlerSelectedContext handlerSelectedContext,
- IAsyncPageFilter filter)
- {
- - Debug.Assert(diagnosticSource != null);
- + Debug.Assert(diagnosticListener != null);
- Debug.Assert(handlerSelectedContext != null);
- Debug.Assert(filter != null);
-
- - if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnPageHandlerSelection"))
- + // Inlinable fast-path check if Diagnositcs is enabled
- + if (diagnosticListener.IsEnabled())
- {
- - diagnosticSource.Write(
- + AfterOnPageHandlerSelectionImpl(diagnosticListener, handlerSelectedContext, filter);
- + }
- + }
- +
- + private static void AfterOnPageHandlerSelectionImpl(DiagnosticListener diagnosticListener, PageHandlerSelectedContext handlerSelectedContext, IAsyncPageFilter filter)
- + {
- + if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnPageHandlerSelection"))
- + {
- + diagnosticListener.Write(
- "Microsoft.AspNetCore.Mvc.AfterOnPageHandlerSelection",
- new
- {
- @@ -243,17 +333,26 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages
- }
-
- public static void BeforeOnPageHandlerSelected(
- - this DiagnosticSource diagnosticSource,
- + this DiagnosticListener diagnosticListener,
- PageHandlerSelectedContext handlerSelectedContext,
- IPageFilter filter)
- {
- - Debug.Assert(diagnosticSource != null);
- + Debug.Assert(diagnosticListener != null);
- Debug.Assert(handlerSelectedContext != null);
- Debug.Assert(filter != null);
-
- - if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnPageHandlerSelected"))
- + // Inlinable fast-path check if Diagnositcs is enabled
- + if (diagnosticListener.IsEnabled())
- {
- - diagnosticSource.Write(
- + BeforeOnPageHandlerSelectedImpl(diagnosticListener, handlerSelectedContext, filter);
- + }
- + }
- +
- + private static void BeforeOnPageHandlerSelectedImpl(DiagnosticListener diagnosticListener, PageHandlerSelectedContext handlerSelectedContext, IPageFilter filter)
- + {
- + if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnPageHandlerSelected"))
- + {
- + diagnosticListener.Write(
- "Microsoft.AspNetCore.Mvc.BeforeOnPageHandlerSelected",
- new
- {
- @@ -265,17 +364,26 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages
- }
-
- public static void AfterOnPageHandlerSelected(
- - this DiagnosticSource diagnosticSource,
- + this DiagnosticListener diagnosticListener,
- PageHandlerSelectedContext handlerSelectedContext,
- IPageFilter filter)
- {
- - Debug.Assert(diagnosticSource != null);
- + Debug.Assert(diagnosticListener != null);
- Debug.Assert(handlerSelectedContext != null);
- Debug.Assert(filter != null);
-
- - if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnPageHandlerSelected"))
- + // Inlinable fast-path check if Diagnositcs is enabled
- + if (diagnosticListener.IsEnabled())
- + {
- + AfterOnPageHandlerSelectedImpl(diagnosticListener, handlerSelectedContext, filter);
- + }
- + }
- +
- + private static void AfterOnPageHandlerSelectedImpl(DiagnosticListener diagnosticListener, PageHandlerSelectedContext handlerSelectedContext, IPageFilter filter)
- + {
- + if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnPageHandlerSelected"))
- {
- - diagnosticSource.Write(
- + diagnosticListener.Write(
- "Microsoft.AspNetCore.Mvc.AfterOnPageHandlerSelected",
- new
- {
- diff --git a/src/Microsoft.AspNetCore.Mvc.RazorPages/breakingchanges.netcore.json b/src/Microsoft.AspNetCore.Mvc.RazorPages/breakingchanges.netcore.json
- new file mode 100644
- index 00000000000..d7ad92ec73a
- --- /dev/null
- +++ b/src/Microsoft.AspNetCore.Mvc.RazorPages/breakingchanges.netcore.json
- @@ -0,0 +1,12 @@
- +[
- + {
- + "TypeId": "public class Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageResultExecutor : Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor",
- + "MemberId": "public .ctor(Microsoft.AspNetCore.Mvc.Infrastructure.IHttpResponseStreamWriterFactory writerFactory, Microsoft.AspNetCore.Mvc.ViewEngines.ICompositeViewEngine compositeViewEngine, Microsoft.AspNetCore.Mvc.Razor.IRazorViewEngine razorViewEngine, Microsoft.AspNetCore.Mvc.Razor.IRazorPageActivator razorPageActivator, System.Diagnostics.DiagnosticSource diagnosticSource, System.Text.Encodings.Web.HtmlEncoder htmlEncoder)",
- + "Kind": "Removal"
- + },
- + {
- + "TypeId": "public class Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.DefaultPageFactoryProvider : Microsoft.AspNetCore.Mvc.RazorPages.IPageFactoryProvider",
- + "MemberId": "public .ctor(Microsoft.AspNetCore.Mvc.RazorPages.IPageActivatorProvider pageActivator, Microsoft.AspNetCore.Mvc.ModelBinding.IModelMetadataProvider metadataProvider, Microsoft.AspNetCore.Mvc.Routing.IUrlHelperFactory urlHelperFactory, Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper jsonHelper, System.Diagnostics.DiagnosticSource diagnosticSource, System.Text.Encodings.Web.HtmlEncoder htmlEncoder, Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider modelExpressionProvider)",
- + "Kind": "Removal"
- + }
- +]
- diff --git a/src/Microsoft.AspNetCore.Mvc.ViewFeatures/MvcViewFeaturesDiagnosticSourceExtensions.cs b/src/Microsoft.AspNetCore.Mvc.ViewFeatures/MvcViewFeaturesDiagnosticSourceExtensions.cs
- index d62d6d40288..fa237a7d5dc 100644
- --- a/src/Microsoft.AspNetCore.Mvc.ViewFeatures/MvcViewFeaturesDiagnosticSourceExtensions.cs
- +++ b/src/Microsoft.AspNetCore.Mvc.ViewFeatures/MvcViewFeaturesDiagnosticSourceExtensions.cs
- @@ -12,13 +12,22 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
- internal static class MvcViewFeaturesDiagnosticSourceExtensions
- {
- public static void BeforeViewComponent(
- - this DiagnosticSource diagnosticSource,
- + this DiagnosticListener diagnosticListener,
- ViewComponentContext context,
- object viewComponent)
- {
- - if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeViewComponent"))
- + // Inlinable fast-path check if Diagnositcs is enabled
- + if (diagnosticListener.IsEnabled())
- {
- - diagnosticSource.Write(
- + BeforeViewComponentImpl(diagnosticListener, context, viewComponent);
- + }
- + }
- +
- + private static void BeforeViewComponentImpl(DiagnosticListener diagnosticListener, ViewComponentContext context, object viewComponent)
- + {
- + if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeViewComponent"))
- + {
- + diagnosticListener.Write(
- "Microsoft.AspNetCore.Mvc.BeforeViewComponent",
- new
- {
- @@ -30,14 +39,23 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
- }
-
- public static void AfterViewComponent(
- - this DiagnosticSource diagnosticSource,
- + this DiagnosticListener diagnosticListener,
- ViewComponentContext context,
- IViewComponentResult result,
- object viewComponent)
- {
- - if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterViewComponent"))
- + // Inlinable fast-path check if Diagnositcs is enabled
- + if (diagnosticListener.IsEnabled())
- + {
- + AfterViewComponentImpl(diagnosticListener, context, result, viewComponent);
- + }
- + }
- +
- + private static void AfterViewComponentImpl(DiagnosticListener diagnosticListener, ViewComponentContext context, IViewComponentResult result, object viewComponent)
- + {
- + if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.AfterViewComponent"))
- {
- - diagnosticSource.Write(
- + diagnosticListener.Write(
- "Microsoft.AspNetCore.Mvc.AfterViewComponent",
- new
- {
- @@ -50,13 +68,22 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
- }
-
- public static void ViewComponentBeforeViewExecute(
- - this DiagnosticSource diagnosticSource,
- + this DiagnosticListener diagnosticListener,
- ViewComponentContext context,
- IView view)
- {
- - if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.ViewComponentBeforeViewExecute"))
- + // Inlinable fast-path check if Diagnositcs is enabled
- + if (diagnosticListener.IsEnabled())
- {
- - diagnosticSource.Write(
- + ViewComponentBeforeViewExecuteImpl(diagnosticListener, context, view);
- + }
- + }
- +
- + private static void ViewComponentBeforeViewExecuteImpl(DiagnosticListener diagnosticListener, ViewComponentContext context, IView view)
- + {
- + if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.ViewComponentBeforeViewExecute"))
- + {
- + diagnosticListener.Write(
- "Microsoft.AspNetCore.Mvc.ViewComponentBeforeViewExecute",
- new
- {
- @@ -68,13 +95,22 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
- }
-
- public static void ViewComponentAfterViewExecute(
- - this DiagnosticSource diagnosticSource,
- + this DiagnosticListener diagnosticListener,
- ViewComponentContext context,
- IView view)
- {
- - if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.ViewComponentAfterViewExecute"))
- + // Inlinable fast-path check if Diagnositcs is enabled
- + if (diagnosticListener.IsEnabled())
- + {
- + ViewComponentAfterViewExecuteImpl(diagnosticListener, context, view);
- + }
- + }
- +
- + private static void ViewComponentAfterViewExecuteImpl(DiagnosticListener diagnosticListener, ViewComponentContext context, IView view)
- + {
- + if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.ViewComponentAfterViewExecute"))
- {
- - diagnosticSource.Write(
- + diagnosticListener.Write(
- "Microsoft.AspNetCore.Mvc.ViewComponentAfterViewExecute",
- new
- {
- @@ -86,42 +122,69 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
- }
-
- public static void BeforeView(
- - this DiagnosticSource diagnosticSource,
- + this DiagnosticListener diagnosticListener,
- IView view,
- ViewContext viewContext)
- {
- - if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeView"))
- + // Inlinable fast-path check if Diagnositcs is enabled
- + if (diagnosticListener.IsEnabled())
- {
- - diagnosticSource.Write(
- + BeforeViewImpl(diagnosticListener, view, viewContext);
- + }
- + }
- +
- + private static void BeforeViewImpl(DiagnosticListener diagnosticListener, IView view, ViewContext viewContext)
- + {
- + if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeView"))
- + {
- + diagnosticListener.Write(
- "Microsoft.AspNetCore.Mvc.BeforeView",
- new { view = view, viewContext = viewContext, });
- }
- }
-
- public static void AfterView(
- - this DiagnosticSource diagnosticSource,
- + this DiagnosticListener diagnosticListener,
- IView view,
- ViewContext viewContext)
- {
- - if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterView"))
- + // Inlinable fast-path check if Diagnositcs is enabled
- + if (diagnosticListener.IsEnabled())
- + {
- + AfterViewImpl(diagnosticListener, view, viewContext);
- + }
- + }
- +
- + private static void AfterViewImpl(DiagnosticListener diagnosticListener, IView view, ViewContext viewContext)
- + {
- + if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.AfterView"))
- {
- - diagnosticSource.Write(
- + diagnosticListener.Write(
- "Microsoft.AspNetCore.Mvc.AfterView",
- new { view = view, viewContext = viewContext, });
- }
- }
-
- public static void ViewFound(
- - this DiagnosticSource diagnosticSource,
- + this DiagnosticListener diagnosticListener,
- ActionContext actionContext,
- bool isMainPage,
- PartialViewResult viewResult,
- string viewName,
- IView view)
- {
- - if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.ViewFound"))
- + // Inlinable fast-path check if Diagnositcs is enabled
- + if (diagnosticListener.IsEnabled())
- {
- - diagnosticSource.Write(
- + ViewFoundImpl(diagnosticListener, actionContext, isMainPage, viewResult, viewName, view);
- + }
- + }
- +
- + private static void ViewFoundImpl(DiagnosticListener diagnosticListener, ActionContext actionContext, bool isMainPage, PartialViewResult viewResult, string viewName, IView view)
- + {
- + if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.ViewFound"))
- + {
- + diagnosticListener.Write(
- "Microsoft.AspNetCore.Mvc.ViewFound",
- new
- {
- @@ -135,16 +198,25 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
- }
-
- public static void ViewNotFound(
- - this DiagnosticSource diagnosticSource,
- + this DiagnosticListener diagnosticListener,
- ActionContext actionContext,
- bool isMainPage,
- PartialViewResult viewResult,
- string viewName,
- IEnumerable<string> searchedLocations)
- {
- - if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.ViewNotFound"))
- + // Inlinable fast-path check if Diagnositcs is enabled
- + if (diagnosticListener.IsEnabled())
- + {
- + ViewNotFoundImpl(diagnosticListener, actionContext, isMainPage, viewResult, viewName, searchedLocations);
- + }
- + }
- +
- + private static void ViewNotFoundImpl(DiagnosticListener diagnosticListener, ActionContext actionContext, bool isMainPage, PartialViewResult viewResult, string viewName, IEnumerable<string> searchedLocations)
- + {
- + if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.ViewNotFound"))
- {
- - diagnosticSource.Write(
- + diagnosticListener.Write(
- "Microsoft.AspNetCore.Mvc.ViewNotFound",
- new
- {
- diff --git a/src/Microsoft.AspNetCore.Mvc.ViewFeatures/PartialViewResultExecutor.cs b/src/Microsoft.AspNetCore.Mvc.ViewFeatures/PartialViewResultExecutor.cs
- index 39bcf58369f..18476d70086 100644
- --- a/src/Microsoft.AspNetCore.Mvc.ViewFeatures/PartialViewResultExecutor.cs
- +++ b/src/Microsoft.AspNetCore.Mvc.ViewFeatures/PartialViewResultExecutor.cs
- @@ -30,7 +30,7 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
- /// <param name="writerFactory">The <see cref="IHttpResponseStreamWriterFactory"/>.</param>
- /// <param name="viewEngine">The <see cref="ICompositeViewEngine"/>.</param>
- /// <param name="tempDataFactory">The <see cref="ITempDataDictionaryFactory"/>.</param>
- - /// <param name="diagnosticSource">The <see cref="DiagnosticSource"/>.</param>
- + /// <param name="diagnosticListener">The <see cref="DiagnosticListener"/>.</param>
- /// <param name="loggerFactory">The <see cref="ILoggerFactory"/>.</param>
- /// <param name="modelMetadataProvider">The <see cref="IModelMetadataProvider"/>.</param>
- public PartialViewResultExecutor(
- @@ -38,10 +38,10 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
- IHttpResponseStreamWriterFactory writerFactory,
- ICompositeViewEngine viewEngine,
- ITempDataDictionaryFactory tempDataFactory,
- - DiagnosticSource diagnosticSource,
- + DiagnosticListener diagnosticListener,
- ILoggerFactory loggerFactory,
- IModelMetadataProvider modelMetadataProvider)
- - : base(viewOptions, writerFactory, viewEngine, tempDataFactory, diagnosticSource, modelMetadataProvider)
- + : base(viewOptions, writerFactory, viewEngine, tempDataFactory, diagnosticListener, modelMetadataProvider)
- {
- if (loggerFactory == null)
- {
- diff --git a/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewComponents/DefaultViewComponentInvoker.cs b/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewComponents/DefaultViewComponentInvoker.cs
- index 5fdb90b505f..15d0018ec10 100644
- --- a/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewComponents/DefaultViewComponentInvoker.cs
- +++ b/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewComponents/DefaultViewComponentInvoker.cs
- @@ -19,7 +19,7 @@ namespace Microsoft.AspNetCore.Mvc.ViewComponents
- {
- private readonly IViewComponentFactory _viewComponentFactory;
- private readonly ViewComponentInvokerCache _viewComponentInvokerCache;
- - private readonly DiagnosticSource _diagnosticSource;
- + private readonly DiagnosticListener _diagnosticListener;
- private readonly ILogger _logger;
-
- /// <summary>
- @@ -27,12 +27,12 @@ namespace Microsoft.AspNetCore.Mvc.ViewComponents
- /// </summary>
- /// <param name="viewComponentFactory">The <see cref="IViewComponentFactory"/>.</param>
- /// <param name="viewComponentInvokerCache">The <see cref="ViewComponentInvokerCache"/>.</param>
- - /// <param name="diagnosticSource">The <see cref="DiagnosticSource"/>.</param>
- + /// <param name="diagnosticListener">The <see cref="DiagnosticListener"/>.</param>
- /// <param name="logger">The <see cref="ILogger"/>.</param>
- public DefaultViewComponentInvoker(
- IViewComponentFactory viewComponentFactory,
- ViewComponentInvokerCache viewComponentInvokerCache,
- - DiagnosticSource diagnosticSource,
- + DiagnosticListener diagnosticListener,
- ILogger logger)
- {
- if (viewComponentFactory == null)
- @@ -45,9 +45,9 @@ namespace Microsoft.AspNetCore.Mvc.ViewComponents
- throw new ArgumentNullException(nameof(viewComponentInvokerCache));
- }
-
- - if (diagnosticSource == null)
- + if (diagnosticListener == null)
- {
- - throw new ArgumentNullException(nameof(diagnosticSource));
- + throw new ArgumentNullException(nameof(diagnosticListener));
- }
-
- if (logger == null)
- @@ -57,7 +57,7 @@ namespace Microsoft.AspNetCore.Mvc.ViewComponents
-
- _viewComponentFactory = viewComponentFactory;
- _viewComponentInvokerCache = viewComponentInvokerCache;
- - _diagnosticSource = diagnosticSource;
- + _diagnosticListener = diagnosticListener;
- _logger = logger;
- }
-
- @@ -101,7 +101,7 @@ namespace Microsoft.AspNetCore.Mvc.ViewComponents
- {
- var arguments = PrepareArguments(context.Arguments, executor);
-
- - _diagnosticSource.BeforeViewComponent(context, component);
- + _diagnosticListener.BeforeViewComponent(context, component);
- _logger.ViewComponentExecuting(context, arguments);
-
- var stopwatch = ValueStopwatch.StartNew();
- @@ -128,7 +128,7 @@ namespace Microsoft.AspNetCore.Mvc.ViewComponents
-
- var viewComponentResult = CoerceToViewComponentResult(resultAsObject);
- _logger.ViewComponentExecuted(context, stopwatch.GetElapsedTime(), viewComponentResult);
- - _diagnosticSource.AfterViewComponent(context, viewComponentResult, component);
- + _diagnosticListener.AfterViewComponent(context, viewComponentResult, component);
-
- _viewComponentFactory.ReleaseViewComponent(context, component);
-
- @@ -144,7 +144,7 @@ namespace Microsoft.AspNetCore.Mvc.ViewComponents
- {
- var arguments = PrepareArguments(context.Arguments, executor);
-
- - _diagnosticSource.BeforeViewComponent(context, component);
- + _diagnosticListener.BeforeViewComponent(context, component);
- _logger.ViewComponentExecuting(context, arguments);
-
- var stopwatch = ValueStopwatch.StartNew();
- @@ -161,7 +161,7 @@ namespace Microsoft.AspNetCore.Mvc.ViewComponents
-
- var viewComponentResult = CoerceToViewComponentResult(result);
- _logger.ViewComponentExecuted(context, stopwatch.GetElapsedTime(), viewComponentResult);
- - _diagnosticSource.AfterViewComponent(context, viewComponentResult, component);
- + _diagnosticListener.AfterViewComponent(context, viewComponentResult, component);
-
- _viewComponentFactory.ReleaseViewComponent(context, component);
-
- diff --git a/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewComponents/DefaultViewComponentInvokerFactory.cs b/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewComponents/DefaultViewComponentInvokerFactory.cs
- index de1740f21c6..d620357be20 100644
- --- a/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewComponents/DefaultViewComponentInvokerFactory.cs
- +++ b/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewComponents/DefaultViewComponentInvokerFactory.cs
- @@ -12,12 +12,12 @@ namespace Microsoft.AspNetCore.Mvc.ViewComponents
- private readonly IViewComponentFactory _viewComponentFactory;
- private readonly ViewComponentInvokerCache _viewComponentInvokerCache;
- private readonly ILogger _logger;
- - private readonly DiagnosticSource _diagnosticSource;
- + private readonly DiagnosticListener _diagnosticListener;
-
- public DefaultViewComponentInvokerFactory(
- IViewComponentFactory viewComponentFactory,
- ViewComponentInvokerCache viewComponentInvokerCache,
- - DiagnosticSource diagnosticSource,
- + DiagnosticListener diagnosticListener,
- ILoggerFactory loggerFactory)
- {
- if (viewComponentFactory == null)
- @@ -30,9 +30,9 @@ namespace Microsoft.AspNetCore.Mvc.ViewComponents
- throw new ArgumentNullException(nameof(viewComponentInvokerCache));
- }
-
- - if (diagnosticSource == null)
- + if (diagnosticListener == null)
- {
- - throw new ArgumentNullException(nameof(diagnosticSource));
- + throw new ArgumentNullException(nameof(diagnosticListener));
- }
-
- if (loggerFactory == null)
- @@ -41,7 +41,7 @@ namespace Microsoft.AspNetCore.Mvc.ViewComponents
- }
-
- _viewComponentFactory = viewComponentFactory;
- - _diagnosticSource = diagnosticSource;
- + _diagnosticListener = diagnosticListener;
- _viewComponentInvokerCache = viewComponentInvokerCache;
-
- _logger = loggerFactory.CreateLogger<DefaultViewComponentInvoker>();
- @@ -61,7 +61,7 @@ namespace Microsoft.AspNetCore.Mvc.ViewComponents
- return new DefaultViewComponentInvoker(
- _viewComponentFactory,
- _viewComponentInvokerCache,
- - _diagnosticSource,
- + _diagnosticListener,
- _logger);
- }
- }
- diff --git a/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewComponents/ViewViewComponentResult.cs b/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewComponents/ViewViewComponentResult.cs
- index bf7ff1f7f35..e9196c5a183 100644
- --- a/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewComponents/ViewViewComponentResult.cs
- +++ b/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewComponents/ViewViewComponentResult.cs
- @@ -22,7 +22,7 @@ namespace Microsoft.AspNetCore.Mvc.ViewComponents
- private const string ViewPathFormat = "Components/{0}/{1}";
- private const string DefaultViewName = "Default";
-
- - private DiagnosticSource _diagnosticSource;
- + private DiagnosticListener _diagnosticListener;
-
- /// <summary>
- /// Gets or sets the view name.
- @@ -115,12 +115,12 @@ namespace Microsoft.AspNetCore.Mvc.ViewComponents
- var view = result.EnsureSuccessful(originalLocations).View;
- using (view as IDisposable)
- {
- - if (_diagnosticSource == null)
- + if (_diagnosticListener == null)
- {
- - _diagnosticSource = viewContext.HttpContext.RequestServices.GetRequiredService<DiagnosticSource>();
- + _diagnosticListener = viewContext.HttpContext.RequestServices.GetRequiredService<DiagnosticListener>();
- }
-
- - _diagnosticSource.ViewComponentBeforeViewExecute(context, view);
- + _diagnosticListener.ViewComponentBeforeViewExecute(context, view);
-
- var childViewContext = new ViewContext(
- viewContext,
- @@ -129,7 +129,7 @@ namespace Microsoft.AspNetCore.Mvc.ViewComponents
- context.Writer);
- await view.RenderAsync(childViewContext);
-
- - _diagnosticSource.ViewComponentAfterViewExecute(context, view);
- + _diagnosticListener.ViewComponentAfterViewExecute(context, view);
- }
- }
-
- diff --git a/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewExecutor.cs b/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewExecutor.cs
- index e815f386d8e..5ac1031f560 100644
- --- a/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewExecutor.cs
- +++ b/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewExecutor.cs
- @@ -32,16 +32,16 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
- /// <param name="writerFactory">The <see cref="IHttpResponseStreamWriterFactory"/>.</param>
- /// <param name="viewEngine">The <see cref="ICompositeViewEngine"/>.</param>
- /// <param name="tempDataFactory">The <see cref="ITempDataDictionaryFactory"/>.</param>
- - /// <param name="diagnosticSource">The <see cref="DiagnosticSource"/>.</param>
- + /// <param name="diagnosticListener">The <see cref="DiagnosticSource"/>.</param>
- /// <param name="modelMetadataProvider">The <see cref="IModelMetadataProvider" />.</param>
- public ViewExecutor(
- IOptions<MvcViewOptions> viewOptions,
- IHttpResponseStreamWriterFactory writerFactory,
- ICompositeViewEngine viewEngine,
- ITempDataDictionaryFactory tempDataFactory,
- - DiagnosticSource diagnosticSource,
- + DiagnosticListener diagnosticListener,
- IModelMetadataProvider modelMetadataProvider)
- - : this(writerFactory, viewEngine, diagnosticSource)
- + : this(writerFactory, viewEngine, diagnosticListener)
- {
- if (viewOptions == null)
- {
- @@ -53,9 +53,9 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
- throw new ArgumentNullException(nameof(tempDataFactory));
- }
-
- - if (diagnosticSource == null)
- + if (diagnosticListener == null)
- {
- - throw new ArgumentNullException(nameof(diagnosticSource));
- + throw new ArgumentNullException(nameof(diagnosticListener));
- }
-
- ViewOptions = viewOptions.Value;
- @@ -68,11 +68,11 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
- /// </summary>
- /// <param name="writerFactory">The <see cref="IHttpResponseStreamWriterFactory"/>.</param>
- /// <param name="viewEngine">The <see cref="ICompositeViewEngine"/>.</param>
- - /// <param name="diagnosticSource">The <see cref="System.Diagnostics.DiagnosticSource"/>.</param>
- + /// <param name="diagnosticListener">The <see cref="System.Diagnostics.DiagnosticListener"/>.</param>
- protected ViewExecutor(
- IHttpResponseStreamWriterFactory writerFactory,
- ICompositeViewEngine viewEngine,
- - DiagnosticSource diagnosticSource)
- + DiagnosticListener diagnosticListener)
- {
- if (writerFactory == null)
- {
- @@ -84,20 +84,20 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
- throw new ArgumentNullException(nameof(viewEngine));
- }
-
- - if (diagnosticSource == null)
- + if (diagnosticListener == null)
- {
- - throw new ArgumentNullException(nameof(diagnosticSource));
- + throw new ArgumentNullException(nameof(diagnosticListener));
- }
-
- WriterFactory = writerFactory;
- ViewEngine = viewEngine;
- - DiagnosticSource = diagnosticSource;
- + DiagnosticSource = diagnosticListener;
- }
-
- /// <summary>
- /// Gets the <see cref="DiagnosticSource"/>.
- /// </summary>
- - protected DiagnosticSource DiagnosticSource { get; }
- + protected DiagnosticListener DiagnosticSource { get; }
-
- /// <summary>
- /// Gets the <see cref="ITempDataDictionaryFactory"/>.
- diff --git a/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewResultExecutor.cs b/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewResultExecutor.cs
- index f23451992bb..8cc09aac3c7 100644
- --- a/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewResultExecutor.cs
- +++ b/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewResultExecutor.cs
- @@ -30,7 +30,7 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
- /// <param name="writerFactory">The <see cref="IHttpResponseStreamWriterFactory"/>.</param>
- /// <param name="viewEngine">The <see cref="ICompositeViewEngine"/>.</param>
- /// <param name="tempDataFactory">The <see cref="ITempDataDictionaryFactory"/>.</param>
- - /// <param name="diagnosticSource">The <see cref="DiagnosticSource"/>.</param>
- + /// <param name="diagnosticListener">The <see cref="DiagnosticListener"/>.</param>
- /// <param name="loggerFactory">The <see cref="ILoggerFactory"/>.</param>
- /// <param name="modelMetadataProvider">The <see cref="IModelMetadataProvider"/>.</param>
- public ViewResultExecutor(
- @@ -38,10 +38,10 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
- IHttpResponseStreamWriterFactory writerFactory,
- ICompositeViewEngine viewEngine,
- ITempDataDictionaryFactory tempDataFactory,
- - DiagnosticSource diagnosticSource,
- + DiagnosticListener diagnosticListener,
- ILoggerFactory loggerFactory,
- IModelMetadataProvider modelMetadataProvider)
- - : base(viewOptions, writerFactory, viewEngine, tempDataFactory, diagnosticSource, modelMetadataProvider)
- + : base(viewOptions, writerFactory, viewEngine, tempDataFactory, diagnosticListener, modelMetadataProvider)
- {
- if (loggerFactory == null)
- {
- @@ -107,6 +107,25 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
- }
- }
-
- + if (DiagnosticSource.IsEnabled())
- + {
- + OutputDiagnostics(actionContext, viewResult, viewName, stopwatch, result);
- + }
- +
- + if (result.Success)
- + {
- + Logger.ViewFound(result.View, stopwatch.GetElapsedTime());
- + }
- + else
- + {
- + Logger.ViewNotFound(viewName, result.SearchedLocations);
- + }
- +
- + return result;
- + }
- +
- + private void OutputDiagnostics(ActionContext actionContext, ViewResult viewResult, string viewName, ValueStopwatch stopwatch, ViewEngineResult result)
- + {
- if (result.Success)
- {
- if (DiagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.ViewFound"))
- @@ -122,8 +141,6 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
- view = result.View,
- });
- }
- -
- - Logger.ViewFound(result.View, stopwatch.GetElapsedTime());
- }
- else
- {
- @@ -140,10 +157,7 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
- searchedLocations = result.SearchedLocations
- });
- }
- - Logger.ViewNotFound(viewName, result.SearchedLocations);
- }
- -
- - return result;
- }
-
- /// <inheritdoc />
- diff --git a/src/Microsoft.AspNetCore.Mvc.ViewFeatures/breakingchanges.netcore.json b/src/Microsoft.AspNetCore.Mvc.ViewFeatures/breakingchanges.netcore.json
- index 638cfe4f77f..0cbd0490d65 100644
- --- a/src/Microsoft.AspNetCore.Mvc.ViewFeatures/breakingchanges.netcore.json
- +++ b/src/Microsoft.AspNetCore.Mvc.ViewFeatures/breakingchanges.netcore.json
- @@ -1,16 +1,30 @@
- [
- + {
- + "TypeId": "public class Microsoft.AspNetCore.Mvc.RemoteAttribute : System.ComponentModel.DataAnnotations.ValidationAttribute, Microsoft.AspNetCore.Mvc.ModelBinding.Validation.IClientModelValidator",
- + "Kind": "Removal"
- + },
- {
- "TypeId": "public class Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionaryControllerPropertyActivator : Microsoft.AspNetCore.Mvc.Internal.IControllerPropertyActivator",
- "Kind": "Removal"
- },
- {
- - "TypeId": "public class Microsoft.AspNetCore.Mvc.ViewComponents.DefaultViewComponentActivator : Microsoft.AspNetCore.Mvc.ViewComponents.IViewComponentActivator",
- - "MemberId": "public .ctor(Microsoft.AspNetCore.Mvc.Internal.ITypeActivatorCache typeActivatorCache)",
- + "TypeId": "public class Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor",
- + "MemberId": "protected .ctor(Microsoft.AspNetCore.Mvc.Infrastructure.IHttpResponseStreamWriterFactory writerFactory, Microsoft.AspNetCore.Mvc.ViewEngines.ICompositeViewEngine viewEngine, System.Diagnostics.DiagnosticSource diagnosticSource)",
- "Kind": "Removal"
- },
- {
- - "TypeId": "public class Microsoft.AspNetCore.Mvc.ViewFeatures.DefaultValidationHtmlAttributeProvider : Microsoft.AspNetCore.Mvc.ViewFeatures.ValidationHtmlAttributeProvider",
- - "MemberId": "public .ctor(Microsoft.Extensions.Options.IOptions<Microsoft.AspNetCore.Mvc.MvcViewOptions> optionsAccessor, Microsoft.AspNetCore.Mvc.ModelBinding.IModelMetadataProvider metadataProvider, Microsoft.AspNetCore.Mvc.Internal.ClientValidatorCache clientValidatorCache)",
- + "TypeId": "public class Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor",
- + "MemberId": "protected System.Diagnostics.DiagnosticSource get_DiagnosticSource()",
- + "Kind": "Removal"
- + },
- + {
- + "TypeId": "public class Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor",
- + "MemberId": "public .ctor(Microsoft.Extensions.Options.IOptions<Microsoft.AspNetCore.Mvc.MvcViewOptions> viewOptions, Microsoft.AspNetCore.Mvc.Infrastructure.IHttpResponseStreamWriterFactory writerFactory, Microsoft.AspNetCore.Mvc.ViewEngines.ICompositeViewEngine viewEngine, Microsoft.AspNetCore.Mvc.ViewFeatures.ITempDataDictionaryFactory tempDataFactory, System.Diagnostics.DiagnosticSource diagnosticSource, Microsoft.AspNetCore.Mvc.ModelBinding.IModelMetadataProvider modelMetadataProvider)",
- + "Kind": "Removal"
- + },
- + {
- + "TypeId": "public class Microsoft.AspNetCore.Mvc.ViewComponents.DefaultViewComponentActivator : Microsoft.AspNetCore.Mvc.ViewComponents.IViewComponentActivator",
- + "MemberId": "public .ctor(Microsoft.AspNetCore.Mvc.Internal.ITypeActivatorCache typeActivatorCache)",
- "Kind": "Removal"
- },
- {
- @@ -44,7 +58,18 @@
- "Kind": "Removal"
- },
- {
- - "TypeId": "public class Microsoft.AspNetCore.Mvc.RemoteAttribute : System.ComponentModel.DataAnnotations.ValidationAttribute, Microsoft.AspNetCore.Mvc.ModelBinding.Validation.IClientModelValidator",
- - "Kind": "Removal"
- + "TypeId": "public class Microsoft.AspNetCore.Mvc.ViewFeatures.DefaultValidationHtmlAttributeProvider : Microsoft.AspNetCore.Mvc.ViewFeatures.ValidationHtmlAttributeProvider",
- + "MemberId": "public .ctor(Microsoft.Extensions.Options.IOptions<Microsoft.AspNetCore.Mvc.MvcViewOptions> optionsAccessor, Microsoft.AspNetCore.Mvc.ModelBinding.IModelMetadataProvider metadataProvider, Microsoft.AspNetCore.Mvc.Internal.ClientValidatorCache clientValidatorCache)",
- + "Kind": "Removal"
- + },
- + {
- + "TypeId": "public class Microsoft.AspNetCore.Mvc.ViewFeatures.PartialViewResultExecutor : Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor, Microsoft.AspNetCore.Mvc.Infrastructure.IActionResultExecutor<Microsoft.AspNetCore.Mvc.PartialViewResult>",
- + "MemberId": "public .ctor(Microsoft.Extensions.Options.IOptions<Microsoft.AspNetCore.Mvc.MvcViewOptions> viewOptions, Microsoft.AspNetCore.Mvc.Infrastructure.IHttpResponseStreamWriterFactory writerFactory, Microsoft.AspNetCore.Mvc.ViewEngines.ICompositeViewEngine viewEngine, Microsoft.AspNetCore.Mvc.ViewFeatures.ITempDataDictionaryFactory tempDataFactory, System.Diagnostics.DiagnosticSource diagnosticSource, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory, Microsoft.AspNetCore.Mvc.ModelBinding.IModelMetadataProvider modelMetadataProvider)",
- + "Kind": "Removal"
- + },
- + {
- + "TypeId": "public class Microsoft.AspNetCore.Mvc.ViewFeatures.ViewResultExecutor : Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor, Microsoft.AspNetCore.Mvc.Infrastructure.IActionResultExecutor<Microsoft.AspNetCore.Mvc.ViewResult>",
- + "MemberId": "public .ctor(Microsoft.Extensions.Options.IOptions<Microsoft.AspNetCore.Mvc.MvcViewOptions> viewOptions, Microsoft.AspNetCore.Mvc.Infrastructure.IHttpResponseStreamWriterFactory writerFactory, Microsoft.AspNetCore.Mvc.ViewEngines.ICompositeViewEngine viewEngine, Microsoft.AspNetCore.Mvc.ViewFeatures.ITempDataDictionaryFactory tempDataFactory, System.Diagnostics.DiagnosticSource diagnosticSource, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory, Microsoft.AspNetCore.Mvc.ModelBinding.IModelMetadataProvider modelMetadataProvider)",
- + "Kind": "Removal"
- }
- -]
- \ No newline at end of file
- +]
- diff --git a/test/Microsoft.AspNetCore.Mvc.Core.Test/Builder/MvcApplicationBuilderExtensionsTest.cs b/test/Microsoft.AspNetCore.Mvc.Core.Test/Builder/MvcApplicationBuilderExtensionsTest.cs
- index 6bceeb51d0f..11e786561b3 100644
- --- a/test/Microsoft.AspNetCore.Mvc.Core.Test/Builder/MvcApplicationBuilderExtensionsTest.cs
- +++ b/test/Microsoft.AspNetCore.Mvc.Core.Test/Builder/MvcApplicationBuilderExtensionsTest.cs
- @@ -43,7 +43,7 @@ namespace Microsoft.AspNetCore.Mvc.Core.Builder
- {
- // Arrange
- var services = new ServiceCollection();
- - services.AddSingleton<DiagnosticSource>(new DiagnosticListener("Microsoft.AspNetCore"));
- + services.AddSingleton<DiagnosticListener>(new DiagnosticListener("Microsoft.AspNetCore"));
- services.AddLogging();
- services.AddMvcCore(o => o.EnableEndpointRouting = false);
- var serviceProvider = services.BuildServiceProvider();
- @@ -68,7 +68,7 @@ namespace Microsoft.AspNetCore.Mvc.Core.Builder
- {
- // Arrange
- var services = new ServiceCollection();
- - services.AddSingleton<DiagnosticSource>(new DiagnosticListener("Microsoft.AspNetCore"));
- + services.AddSingleton<DiagnosticListener>(new DiagnosticListener("Microsoft.AspNetCore"));
- services.AddLogging();
- services.AddMvcCore(o => o.EnableEndpointRouting = true);
- var serviceProvider = services.BuildServiceProvider();
- diff --git a/test/Microsoft.AspNetCore.Mvc.Core.Test/Filters/MiddlewareFilterTest.cs b/test/Microsoft.AspNetCore.Mvc.Core.Test/Filters/MiddlewareFilterTest.cs
- index 813c23fe384..8d72ce9a364 100644
- --- a/test/Microsoft.AspNetCore.Mvc.Core.Test/Filters/MiddlewareFilterTest.cs
- +++ b/test/Microsoft.AspNetCore.Mvc.Core.Test/Filters/MiddlewareFilterTest.cs
- @@ -276,14 +276,14 @@ namespace Microsoft.AspNetCore.Mvc.Filters
-
- var actionContext = new ActionContext(httpContext, new RouteData(), actionDescriptor);
-
- - var diagnosticSource = new DiagnosticListener("Microsoft.AspNetCore");
- - diagnosticSource.SubscribeWithAdapter(new TestDiagnosticListener());
- + var diagnosticListener = new DiagnosticListener("Microsoft.AspNetCore");
- + diagnosticListener.SubscribeWithAdapter(new TestDiagnosticListener());
-
- var invoker = new TestControllerActionInvoker(
- filters,
- new MockControllerFactory(controller ?? this),
- new NullLoggerFactory().CreateLogger<ControllerActionInvoker>(),
- - diagnosticSource,
- + diagnosticListener,
- new ActionResultTypeMapper(),
- actionContext,
- new List<IValueProviderFactory>(),
- @@ -388,14 +388,14 @@ namespace Microsoft.AspNetCore.Mvc.Filters
- IFilterMetadata[] filters,
- MockControllerFactory controllerFactory,
- ILogger logger,
- - DiagnosticSource diagnosticSource,
- + DiagnosticListener diagnosticListener,
- IActionResultTypeMapper mapper,
- ActionContext actionContext,
- IReadOnlyList<IValueProviderFactory> valueProviderFactories,
- int maxAllowedErrorsInModelState)
- : base(
- logger,
- - diagnosticSource,
- + diagnosticListener,
- mapper,
- CreateControllerContext(actionContext, valueProviderFactories, maxAllowedErrorsInModelState),
- CreateCacheEntry((ControllerActionDescriptor)actionContext.ActionDescriptor, controllerFactory),
- diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Test/RazorViewTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Test/RazorViewTest.cs
- index 991b1de1b7b..82d010e9cad 100644
- --- a/test/Microsoft.AspNetCore.Mvc.Razor.Test/RazorViewTest.cs
- +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Test/RazorViewTest.cs
- @@ -111,8 +111,8 @@ namespace Microsoft.AspNetCore.Mvc.Razor
- var activator = new Mock<IRazorPageActivator>();
-
- var adapter = new TestDiagnosticListener();
- - var diagnosticSource = new DiagnosticListener("Microsoft.AspNetCore.Mvc.Razor");
- - diagnosticSource.SubscribeWithAdapter(adapter);
- + var diagnosticListener = new DiagnosticListener("Microsoft.AspNetCore.Mvc.Razor");
- + diagnosticListener.SubscribeWithAdapter(adapter);
-
- var view = new RazorView(
- Mock.Of<IRazorViewEngine>(),
- @@ -120,7 +120,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor
- new IRazorPage[0],
- page,
- new HtmlTestEncoder(),
- - diagnosticSource);
- + diagnosticListener);
-
- var viewContext = CreateViewContext(view);
- var expectedWriter = viewContext.Writer;
- diff --git a/test/Microsoft.AspNetCore.Mvc.RazorPages.Test/Infrastructure/DefaultPageFactoryProviderTest.cs b/test/Microsoft.AspNetCore.Mvc.RazorPages.Test/Infrastructure/DefaultPageFactoryProviderTest.cs
- index 6b337a93ebe..9e2871d62ac 100644
- --- a/test/Microsoft.AspNetCore.Mvc.RazorPages.Test/Infrastructure/DefaultPageFactoryProviderTest.cs
- +++ b/test/Microsoft.AspNetCore.Mvc.RazorPages.Test/Infrastructure/DefaultPageFactoryProviderTest.cs
- @@ -294,7 +294,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure
- IModelMetadataProvider provider = null,
- IUrlHelperFactory urlHelperFactory = null,
- IJsonHelper jsonHelper = null,
- - DiagnosticSource diagnosticSource = null,
- + DiagnosticListener diagnosticListener = null,
- HtmlEncoder htmlEncoder = null,
- IModelExpressionProvider modelExpressionProvider = null)
- {
- @@ -303,7 +303,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure
- provider ?? Mock.Of<IModelMetadataProvider>(),
- urlHelperFactory ?? Mock.Of<IUrlHelperFactory>(),
- jsonHelper ?? Mock.Of<IJsonHelper>(),
- - diagnosticSource ?? new DiagnosticListener("Microsoft.AspNetCore.Mvc.RazorPages"),
- + diagnosticListener ?? new DiagnosticListener("Microsoft.AspNetCore.Mvc.RazorPages"),
- htmlEncoder ?? HtmlEncoder.Default,
- modelExpressionProvider ?? Mock.Of<IModelExpressionProvider>());
- }
- diff --git a/test/Microsoft.AspNetCore.Mvc.Test/MvcOptionsSetupTest.cs b/test/Microsoft.AspNetCore.Mvc.Test/MvcOptionsSetupTest.cs
- index 1607c35ad1b..29176f09894 100644
- --- a/test/Microsoft.AspNetCore.Mvc.Test/MvcOptionsSetupTest.cs
- +++ b/test/Microsoft.AspNetCore.Mvc.Test/MvcOptionsSetupTest.cs
- @@ -264,7 +264,9 @@ namespace Microsoft.AspNetCore.Mvc
- {
- var serviceCollection = new ServiceCollection();
- serviceCollection.AddSingleton(new ApplicationPartManager());
- - serviceCollection.AddSingleton<DiagnosticSource>(new DiagnosticListener("Microsoft.AspNetCore.Mvc"));
- + var diagnosticListener = new DiagnosticListener("Microsoft.AspNetCore.Mvc");
- + serviceCollection.AddSingleton<DiagnosticSource>(diagnosticListener);
- + serviceCollection.AddSingleton<DiagnosticListener>(diagnosticListener);
- serviceCollection.AddMvc();
- serviceCollection
- .AddSingleton<ObjectPoolProvider, DefaultObjectPoolProvider>()
- diff --git a/test/Microsoft.AspNetCore.Mvc.Test/MvcServiceCollectionExtensionsTest.cs b/test/Microsoft.AspNetCore.Mvc.Test/MvcServiceCollectionExtensionsTest.cs
- index 9aecad709cd..498275a1b8a 100644
- --- a/test/Microsoft.AspNetCore.Mvc.Test/MvcServiceCollectionExtensionsTest.cs
- +++ b/test/Microsoft.AspNetCore.Mvc.Test/MvcServiceCollectionExtensionsTest.cs
- @@ -261,7 +261,10 @@ namespace Microsoft.AspNetCore.Mvc
-
- services.AddSingleton<IHostingEnvironment>(GetHostingEnvironment());
- services.AddSingleton<ObjectPoolProvider, DefaultObjectPoolProvider>();
- - services.AddSingleton<DiagnosticSource>(new DiagnosticListener("Microsoft.AspNet"));
- +
- + var diagnosticListener = new DiagnosticListener("Microsoft.AspNet");
- + services.AddSingleton<DiagnosticSource>(diagnosticListener);
- + services.AddSingleton<DiagnosticListener>(diagnosticListener);
- services.AddSingleton<IConfiguration>(new ConfigurationBuilder().Build());
- services.AddLogging();
- services.AddOptions();
- diff --git a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/PartialViewResultExecutorTest.cs b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/PartialViewResultExecutorTest.cs
- index 3a34cc25d20..d3b74704df1 100644
- --- a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/PartialViewResultExecutorTest.cs
- +++ b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/PartialViewResultExecutorTest.cs
- @@ -210,12 +210,12 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
- public void FindView_WritesDiagnostic_ViewFound()
- {
- // Arrange
- - var diagnosticSource = new DiagnosticListener("Test");
- + var diagnosticListener = new DiagnosticListener("Test");
- var listener = new TestDiagnosticListener();
- - diagnosticSource.SubscribeWithAdapter(listener);
- + diagnosticListener.SubscribeWithAdapter(listener);
-
- var context = GetActionContext();
- - var executor = GetViewExecutor(diagnosticSource);
- + var executor = GetViewExecutor(diagnosticListener);
-
- var viewName = "myview";
- var viewResult = new PartialViewResult
- @@ -243,12 +243,12 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
- public void FindView_WritesDiagnostic_ViewNotFound()
- {
- // Arrange
- - var diagnosticSource = new DiagnosticListener("Test");
- + var diagnosticListener = new DiagnosticListener("Test");
- var listener = new TestDiagnosticListener();
- - diagnosticSource.SubscribeWithAdapter(listener);
- + diagnosticListener.SubscribeWithAdapter(listener);
-
- var context = GetActionContext();
- - var executor = GetViewExecutor(diagnosticSource);
- + var executor = GetViewExecutor(diagnosticListener);
-
- var viewName = "myview";
- var viewEngine = new Mock<IViewEngine>(MockBehavior.Strict);
- @@ -342,11 +342,11 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
- return new ActionContext(new DefaultHttpContext(), routeData, new ControllerActionDescriptor() { ActionName = actionName });
- }
-
- - private PartialViewResultExecutor GetViewExecutor(DiagnosticSource diagnosticSource = null)
- + private PartialViewResultExecutor GetViewExecutor(DiagnosticListener diagnosticListener = null)
- {
- - if (diagnosticSource == null)
- + if (diagnosticListener == null)
- {
- - diagnosticSource = new DiagnosticListener("Test");
- + diagnosticListener = new DiagnosticListener("Test");
- }
-
- var viewEngine = new Mock<IViewEngine>(MockBehavior.Strict);
- @@ -367,7 +367,7 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
- new TestHttpResponseStreamWriterFactory(),
- new CompositeViewEngine(options),
- new TempDataDictionaryFactory(new SessionStateTempDataProvider()),
- - diagnosticSource,
- + diagnosticListener,
- NullLoggerFactory.Instance,
- new EmptyModelMetadataProvider());
-
- diff --git a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/ViewComponentResultTest.cs b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/ViewComponentResultTest.cs
- index 5a94dc65464..4650edd55ed 100644
- --- a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/ViewComponentResultTest.cs
- +++ b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/ViewComponentResultTest.cs
- @@ -560,7 +560,7 @@ namespace Microsoft.AspNetCore.Mvc
- }
-
- var services = new ServiceCollection();
- - services.AddSingleton<DiagnosticSource>(diagnosticSource);
- + services.AddSingleton<DiagnosticListener>(diagnosticSource);
- services.AddSingleton<ViewComponentInvokerCache>();
- services.AddSingleton<ExpressionTextCache>();
- services.AddSingleton(Options.Create(new MvcViewOptions()));
- diff --git a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/ViewComponents/ViewViewComponentResultTest.cs b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/ViewComponents/ViewViewComponentResultTest.cs
- index 022c3d72bfd..989afc52ab9 100644
- --- a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/ViewComponents/ViewViewComponentResultTest.cs
- +++ b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/ViewComponents/ViewViewComponentResultTest.cs
- @@ -355,7 +355,7 @@ namespace Microsoft.AspNetCore.Mvc
- var serviceProvider = new Mock<IServiceProvider>();
- serviceProvider.Setup(p => p.GetService(typeof(ICompositeViewEngine)))
- .Returns(viewEngine.Object);
- - serviceProvider.Setup(p => p.GetService(typeof(DiagnosticSource)))
- + serviceProvider.Setup(p => p.GetService(typeof(DiagnosticListener)))
- .Returns(new DiagnosticListener("Test"));
-
- var viewData = new ViewDataDictionary(new EmptyModelMetadataProvider());
- @@ -519,7 +519,7 @@ namespace Microsoft.AspNetCore.Mvc
- diagnosticSource.SubscribeWithAdapter(diagnosticListener);
-
- var serviceProvider = new Mock<IServiceProvider>();
- - serviceProvider.Setup(s => s.GetService(typeof(DiagnosticSource))).Returns(diagnosticSource);
- + serviceProvider.Setup(s => s.GetService(typeof(DiagnosticListener))).Returns(diagnosticSource);
-
- var httpContext = new DefaultHttpContext();
- httpContext.RequestServices = serviceProvider.Object;
- diff --git a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/ViewExecutorTest.cs b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/ViewExecutorTest.cs
- index 7fc8949fa34..2729b86e998 100644
- --- a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/ViewExecutorTest.cs
- +++ b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/ViewExecutorTest.cs
- @@ -235,10 +235,10 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
-
- var adapter = new TestDiagnosticListener();
-
- - var diagnosticSource = new DiagnosticListener("Test");
- - diagnosticSource.SubscribeWithAdapter(adapter);
- + var diagnosticListener = new DiagnosticListener("Test");
- + diagnosticListener.SubscribeWithAdapter(adapter);
-
- - var viewExecutor = CreateViewExecutor(diagnosticSource);
- + var viewExecutor = CreateViewExecutor(diagnosticListener);
-
- // Act
- await viewExecutor.ExecuteAsync(
- @@ -351,11 +351,11 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
- return view.Object;
- }
-
- - private ViewExecutor CreateViewExecutor(DiagnosticListener diagnosticSource = null)
- + private ViewExecutor CreateViewExecutor(DiagnosticListener diagnosticListener = null)
- {
- - if (diagnosticSource == null)
- + if (diagnosticListener == null)
- {
- - diagnosticSource = new DiagnosticListener("Test");
- + diagnosticListener = new DiagnosticListener("Test");
- }
-
- return new ViewExecutor(
- @@ -363,7 +363,7 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
- new TestHttpResponseStreamWriterFactory(),
- new Mock<ICompositeViewEngine>(MockBehavior.Strict).Object,
- new TempDataDictionaryFactory(new SessionStateTempDataProvider()),
- - diagnosticSource,
- + diagnosticListener,
- new EmptyModelMetadataProvider());
- }
- }
- diff --git a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/ViewResultExecutorTest.cs b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/ViewResultExecutorTest.cs
- index f8a8ae87456..11d34a3d182 100644
- --- a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/ViewResultExecutorTest.cs
- +++ b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/ViewResultExecutorTest.cs
- @@ -206,12 +206,12 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
- public void FindView_WritesDiagnostic_ViewFound()
- {
- // Arrange
- - var diagnosticSource = new DiagnosticListener("Test");
- + var diagnosticListener = new DiagnosticListener("Test");
- var listener = new TestDiagnosticListener();
- - diagnosticSource.SubscribeWithAdapter(listener);
- + diagnosticListener.SubscribeWithAdapter(listener);
-
- var context = GetActionContext();
- - var executor = GetViewExecutor(diagnosticSource);
- + var executor = GetViewExecutor(diagnosticListener);
-
- var viewName = "myview";
- var viewResult = new ViewResult
- @@ -239,12 +239,12 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
- public void FindView_WritesDiagnostic_ViewNotFound()
- {
- // Arrange
- - var diagnosticSource = new DiagnosticListener("Test");
- + var diagnosticListener = new DiagnosticListener("Test");
- var listener = new TestDiagnosticListener();
- - diagnosticSource.SubscribeWithAdapter(listener);
- + diagnosticListener.SubscribeWithAdapter(listener);
-
- var context = GetActionContext();
- - var executor = GetViewExecutor(diagnosticSource);
- + var executor = GetViewExecutor(diagnosticListener);
-
- var viewName = "myview";
- var viewEngine = new Mock<IViewEngine>(MockBehavior.Strict);
- @@ -332,11 +332,11 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
- return new ActionContext(new DefaultHttpContext(), routeData, new ControllerActionDescriptor() { ActionName = actionName });
- }
-
- - private ViewResultExecutor GetViewExecutor(DiagnosticListener diagnosticSource = null)
- + private ViewResultExecutor GetViewExecutor(DiagnosticListener diagnosticListener = null)
- {
- - if (diagnosticSource == null)
- + if (diagnosticListener == null)
- {
- - diagnosticSource = new DiagnosticListener("Test");
- + diagnosticListener = new DiagnosticListener("Test");
- }
-
- var viewEngine = new Mock<IViewEngine>(MockBehavior.Strict);
- @@ -357,7 +357,7 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
- new TestHttpResponseStreamWriterFactory(),
- new CompositeViewEngine(options),
- new TempDataDictionaryFactory(new SessionStateTempDataProvider()),
- - diagnosticSource,
- + diagnosticListener,
- NullLoggerFactory.Instance,
- new EmptyModelMetadataProvider());
-
|