@@ -1493,11 +1493,12 @@ public void ProbeExpressionParser_InstanceOf_LazyLoadedType_CanSucceedWithoutRec
14931493
14941494 Action firstLookup = ( ) => InstanceOfHelper . ResolveType ( "LazyLoaded.TypeForInstanceOf" ) ;
14951495 firstLookup . Should ( ) . Throw < Exception > ( ) . WithMessage ( "*unknown type*" ) ;
1496+ var callsAfterFirstLookup = calls ;
14961497
14971498 includeSecondAssembly = true ;
14981499 InstanceOfHelper . IncrementAssemblyLoadGenerationForTests ( ) ;
14991500 InstanceOfHelper . IsInstanceOf ( instance , "LazyLoaded.TypeForInstanceOf" ) . Should ( ) . BeTrue ( ) ;
1500- calls . Should ( ) . BeGreaterThan ( 1 ) ;
1501+ calls . Should ( ) . BeGreaterThan ( callsAfterFirstLookup ) ;
15011502 }
15021503 finally
15031504 {
@@ -1591,13 +1592,18 @@ public void ProbeExpressionParser_InstanceOf_MissScansOnlyNewAssemblies()
15911592
15921593 Action firstLookup = ( ) => InstanceOfHelper . ResolveType ( "Missing.TypeForInstanceOf" ) ;
15931594 firstLookup . Should ( ) . Throw < Exception > ( ) . WithMessage ( "*unknown type*" ) ;
1595+ var callsAfterFirstLookup = calls ;
15941596
15951597 includeSecondAssembly = true ;
15961598 InstanceOfHelper . IncrementAssemblyLoadGenerationForTests ( ) ;
15971599 Action secondLookup = ( ) => InstanceOfHelper . ResolveType ( "Missing.TypeForInstanceOf" ) ;
15981600 secondLookup . Should ( ) . Throw < Exception > ( ) . WithMessage ( "*unknown type*" ) ;
15991601
1600- calls . Should ( ) . BeGreaterThan ( 1 ) ;
1602+ // Assert the delta rather than an absolute count: the second lookup must rescan
1603+ // (re-invoke the provider) after the new assembly appears rather than serve the cached
1604+ // miss. Both lookups throw *unknown type*, so an unrelated retry inflating the first
1605+ // lookup's count must not be able to satisfy this on its own.
1606+ calls . Should ( ) . BeGreaterThan ( callsAfterFirstLookup ) ;
16011607 }
16021608 finally
16031609 {
@@ -1635,12 +1641,13 @@ public void ProbeExpressionParser_InstanceOf_LargeMissCacheScansOnlyNewAssemblie
16351641
16361642 Action firstLookup = ( ) => InstanceOfHelper . ResolveType ( "LargeMissCache.ResolvedType" ) ;
16371643 firstLookup . Should ( ) . Throw < Exception > ( ) . WithMessage ( "*unknown type*" ) ;
1644+ var callsAfterFirstLookup = calls ;
16381645
16391646 includeResolvedAssembly = true ;
16401647 InstanceOfHelper . IncrementAssemblyLoadGenerationForTests ( ) ;
16411648 InstanceOfHelper . ResolveType ( "LargeMissCache.ResolvedType" ) . Should ( ) . Be ( resolvedAssembly . GetType ( "LargeMissCache.ResolvedType" ) ) ;
16421649
1643- calls . Should ( ) . BeGreaterThan ( 1 ) ;
1650+ calls . Should ( ) . BeGreaterThan ( callsAfterFirstLookup ) ;
16441651 }
16451652 finally
16461653 {
0 commit comments