@@ -696,7 +696,10 @@ public override void Eval(MockDirectoryWrapper dir)
696
696
{
697
697
// LUCENENET specific: for these to work in release mode, we have added [MethodImpl(MethodImplOptions.NoInlining)]
698
698
// to each possible target of the StackTraceHelper. If these change, so must the attribute on the target methods.
699
- bool sawAppend = StackTraceHelper . DoesStackTraceContainMethod ( nameof ( FreqProxTermsWriterPerField ) , "Flush" ) ;
699
+ // LUCENENET NOTE: This code seems incorrect in Lucene, as it checks for "Flush" regardless of type in the sawFlush case,
700
+ // which will always be true if the first case is true. The name of the variable implies it checking for "Append"
701
+ // but that is not a method on FreqProxTermsWriterPerField.
702
+ bool sawAppend = StackTraceHelper . DoesStackTraceContainMethod ( nameof ( FreqProxTermsWriterPerField ) , nameof ( FreqProxTermsWriterPerField . Flush ) ) ;
700
703
bool sawFlush = StackTraceHelper . DoesStackTraceContainMethod ( "Flush" ) ;
701
704
702
705
if ( sawAppend && sawFlush && count ++ >= 30 )
@@ -1017,7 +1020,7 @@ public override void Eval(MockDirectoryWrapper dir)
1017
1020
{
1018
1021
// LUCENENET specific: for these to work in release mode, we have added [MethodImpl(MethodImplOptions.NoInlining)]
1019
1022
// to each possible target of the StackTraceHelper. If these change, so must the attribute on the target methods.
1020
- bool foundMethod = StackTraceHelper . DoesStackTraceContainMethod ( nameof ( MockDirectoryWrapper ) , " Sync" ) ;
1023
+ bool foundMethod = StackTraceHelper . DoesStackTraceContainMethod ( nameof ( MockDirectoryWrapper ) , nameof ( MockDirectoryWrapper . Sync ) ) ;
1021
1024
1022
1025
if ( m_doFail && foundMethod )
1023
1026
{
@@ -1088,8 +1091,8 @@ private class FailOnlyInCommit : Failure
1088
1091
{
1089
1092
internal bool failOnCommit , failOnDeleteFile ;
1090
1093
internal readonly bool dontFailDuringGlobalFieldMap ;
1091
- internal const string PREPARE_STAGE = " PrepareCommit" ;
1092
- internal const string FINISH_STAGE = " FinishCommit" ;
1094
+ internal const string PREPARE_STAGE = nameof ( SegmentInfos . PrepareCommit ) ;
1095
+ internal const string FINISH_STAGE = nameof ( SegmentInfos . FinishCommit ) ;
1093
1096
internal readonly string stage ;
1094
1097
1095
1098
public FailOnlyInCommit ( bool dontFailDuringGlobalFieldMap , string stage )
@@ -1103,7 +1106,8 @@ public override void Eval(MockDirectoryWrapper dir)
1103
1106
// LUCENENET specific: for these to work in release mode, we have added [MethodImpl(MethodImplOptions.NoInlining)]
1104
1107
// to each possible target of the StackTraceHelper. If these change, so must the attribute on the target methods.
1105
1108
bool isCommit = StackTraceHelper . DoesStackTraceContainMethod ( nameof ( SegmentInfos ) , stage ) ;
1106
- bool isDelete = StackTraceHelper . DoesStackTraceContainMethod ( nameof ( MockDirectoryWrapper ) , "DeleteFile" ) ;
1109
+ bool isDelete = StackTraceHelper . DoesStackTraceContainMethod ( nameof ( MockDirectoryWrapper ) , nameof ( MockDirectoryWrapper . DeleteFile ) ) ;
1110
+ // LUCENENET NOTE: this method does not appear to exist anywhere, and is likely always false. It certainly doesn't exist on SegmentInfos.
1107
1111
bool isInGlobalFieldMap = StackTraceHelper . DoesStackTraceContainMethod ( nameof ( SegmentInfos ) , "WriteGlobalFieldMap" ) ;
1108
1112
1109
1113
if ( isInGlobalFieldMap && dontFailDuringGlobalFieldMap )
@@ -1618,8 +1622,8 @@ public virtual void TestTermVectorExceptions()
1618
1622
1619
1623
private class FailOnTermVectors : Failure
1620
1624
{
1621
- internal const string INIT_STAGE = " InitTermVectorsWriter" ;
1622
- internal const string AFTER_INIT_STAGE = " FinishDocument" ;
1625
+ internal const string INIT_STAGE = nameof ( TermVectorsConsumer . InitTermVectorsWriter ) ;
1626
+ internal const string AFTER_INIT_STAGE = nameof ( TermVectorsConsumer . FinishDocument ) ;
1623
1627
internal const string EXC_MSG = "FOTV" ;
1624
1628
internal readonly string stage ;
1625
1629
0 commit comments