You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by ni...@apache.org on 2019/08/07 22:25:57 UTC

[lucenenet] branch master updated (f3b6f01 -> 764a8a2)

This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git.


    from f3b6f01  Upgraded to ICU4N 60.1.0-alpha.52
     new 7f69810  BUG: Lucene.Net.Suggest.Suggest.FileDictionary - Fixed conversion of string to number to be culture insensitive (it caused the tests in FileDictionaryTest to fail randomly)
     new 94731f0  build.ps1: Added Publish task that publishes all test artifacts in parallel
     new 1cceecc  Lucene.Net.Tests.Index.SynchronizedList: Moved to Lucene.Net.TestFramework.Support
     new a15b391  Lucene.Net.Tests.Support.TestOldPatches.cs: Removed invalid Lucene.Net.Test using statement
     new de0209f  Broke Lucene.Net.Tests project into Lucene.Net.Tests._A-I, Lucene.Net.Tests._J-U, and Lucene.Net.Tests._U-Z to cut the time it takes to run the tests in the project by about 2/3, running in parallel
     new 9f3fb72  Created azure-pipelines.yml for Azure DevOps
     new e6dd79f  Added .NET Standard 2.0 target to projects where it was missing (fixes #216)
     new 101e594  BUG: Lucene.Net.Tests.Cli - Fixed issue with xplat root directory specification (all platforms were trying to set the directory to C:\)
     new 2803600  BUG: Lucene.Net.Benchmark.ByTask.Utils.Config: Fixed FormatException caused by converting number to string in ambient culture and parsing it back to a number in invariant culture
     new d7660ab  BUG: Lucene.Net.Analysis.Common.Analysis.Util.AbstractAnalysisFactory: Fixed parsing issue converting string to int in ambient culture
     new 245bbc4  BUG: Lucene.Net.Analysis.Common.Analysis.Miscellaneous.TruncateTokenFilterFactory - Fixed issue converting string to sbyte in ambient culture
     new 55c8ac0  BUG: Lucene.Net.Util.CommandLineUtil.AdjustDirectoryName - IndexOf comparison must be StringComparison.Ordinal (or in this case, a single char) to be compatible with all cultures/platforms.
     new 7e772c2  BUG: Lucene.Net.TestFramework.Util.LuceneTestCase.NewFSDirectory - When resolving a type, we were expecting an exception if the type does not subclass FSDirectory, however, in .NET this won't happen. We need to explicitly check whether the resolved type is assignable from FSDirectory or if the type name is nonsense.
     new 5a02e17  BUG: Lucene.Net.Util.StringHelper: - Fixed parsing issue converting string to int in ambient culture
     new 78daef7  BUG: Lucene.Net.Index.CheckIndex - Fixed issue with converting int to string using ambient context on VersionInfo comparison
     new 5481d71  Lucene.Net.TestFramework.Util.LuceneTestCase: Throw explicit exception if Directory type cannot be resolved
     new ba0ad20  Lucene.Net.Benchmark: Use AssemblyQualifiedName for StandardAnalyzer for better reliability with .NET Reflection
     new 9ad6f00  build.ps1: Added option to specify maximum number of parallel jobs to use during testing
     new aea3cc7  Lucene.Net.Expressions: Corrected casing on app.config to lower (xplat problem)
     new f69977c  Lucene.Net.Analysis.SmartCn: Corrected casing of folder paths on bigramdict.mem, coredict.mem, and package.md (xplat problem)
     new 02d9671  BUG: Lucene.Net.Tests.Support.TestTreeSet: Passing null instead of CultureInfo.InvariantCulture causes the test to randomly fail depending on the culture of the current thread (which is randomly selected by LuceneTestCase).
     new 5c75fab  Added .vscode/settings.json file to locate tests and ignore docs path in Visual Studio Code
     new 8d3636e  BUG: Lucene.Net.TestFramework.Util.TestUtil.NextLong: The result of the method was always the value of start when start == long.MinValue and end == long.MaxValue. As a result, many tests were not actually random.
     new c120519  BUG: Lucene.Net.TestFramework.Index.AlcoholicMergePolicy: The value chosen for Hour was supposed to be random, but it was setup to be a constant by a mistranslation from Java to .NET
     new 8f090ba  BUG: Lucene.Net.Tests.Index.TestTransactionRollback: Number was failing due to the fact the data that was being populated wasn't being converted from int to string in invariant culture. Switched back to original logic, using LastIndexOf(char) rather than LastIndexOf(string).
     new 4f810ba  SWEEP: Changed string.IndexOf(string) to use either string.IndexOf(char) or string.IndexOf(string, StringComparison.Ordinal) to keep ambient culture from affecting the comparison.
     new c300581  SWEEP: Added StringComparison.Ordinal to all string.Equals() calls, as per https://docs.microsoft.com/en-us/dotnet/standard/base-types/best-practices-strings#recommendations-for-string-usage
     new 5d3f293  BUG: Lucene.Net.Grouping.TopGroups - check collection equality if the generic type is a reference type (as is the default behavior in Java)
     new 4bcbe07  SWEEP: Added StringComparison.Ordinal to all of the string.StartsWith() and string.EndsWith() methods where it was missing
     new 4463f5a  Lucene.Net.Util.StringHelper: Added API note to make StartsWith and EndsWith into extension methods for BytesRef.
     new be169d7  BUG: Lucene.Net.Tests.QueryParser.Flexible.Precedence.TestPrecedenceQueryParser: Specify short date format by using DateTime.ParseExact instead of DateTime.Parse
     new 65fd44f  azure-pipelines.yml: Decreased maximum number of allowed failures to 4 per target framework/OS combo
     new 852a9bd  Lucene.Net.Support.CultureContext: Fixed minor issue with unused variable
     new 560c8cc  Bug: Lucene.Net.TestFramework.JavaCompatibility.SystemTypesHelpers: Overloads of append that take numeric types need to be converted to the invariant culture. Removed the overloads for decimal, double, and float, as those need to be dealt with on a case by case basis.
     new acd1389  BUG: Lucene.Net.Tests.Analysis.Common.Analysis.Pattern.TestPatternTokenizer.TestSplitting: int.Parse must be setup in the invariant culture to consistently recognize inputs
     new ab138b1  Lucene.Net.TestFramework.Util.LuceneTestCase: Added try catch blocks to write stack traces to the console if exceptions occur during OneTimeSetUp or OneTimeTearDown
     new 0245279  BUG: Lucene.Net.Highlighter.VectorHighlight.FieldQuery: List<T> replacement for LinkedHashSet<T> preserves insertion order, but we need to explicitly check to ensure no duplicate values are added
     new ae60215  BUG: Lucene.Net.Tests.Search.TestFieldCacheRangeFilter.TestSparseIndex: formatting value must be done in invariant culture
     new f0fb88f  BUG: Lucene.Net.Util.StringHelper - Use Time.CurrentTimeMilliseconds() instead of DateTime.Now.Millisecond. The latter is a mis-translation from Java which contains only numbers 0 to 999, the former returns a long based on Stopwatch.GetTimestamp() that has several orders of magnitude more possible values.
     new 6b4bf3f  SWEEP: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details) (as per LUCENENET-435)
     new e12cde4  SWEEP: Ensure all enumerators are disposed of properly (except in some cases where enumerators are set to field variables, see LUCENENET-611)
     new 764a8a2  BUG: Lucene.Net.TestFramework.Codecs.RAMOnly.RAMOnlyPostingsFormat - string comparison must be done using ordinal to match Java

The 42 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .vscode/settings.json                              |   7 +
 Directory.Build.props                              |  10 +
 build/NuGet.props => Directory.Build.targets       |  15 +-
 Lucene.Net.sln                                     |  71 ++--
 README.md                                          |   8 +-
 azure-pipelines.yml                                | 377 +++++++++++++++++++++
 build.bat                                          |  16 +-
 build/Dependencies.props                           |  20 ++
 build/TestReferences.Common.targets                |  20 ++
 build/azure-templates/publish-nuget-packages.yml   |  64 ++++
 .../publish-test-results-for-target-frameworks.yml |  67 ++++
 .../publish-test-results-for-test-projects.yml     | 282 +++++++++++++++
 build/azure-templates/publish-test-results.yml     |  81 +++++
 build/azure-templates/run-tests-on-os.yml          | 211 ++++++++++++
 .../show-all-environment-variables.yml             |  28 ++
 build/azure-templates/show-all-files.yml           |  26 ++
 build/build.ps1                                    | 364 ++++++++++++++++----
 .../Analysis/Br/BrazilianStemFilter.cs             |   3 +-
 .../Analysis/Br/BrazilianStemmer.cs                |   7 +-
 .../Analysis/CommonGrams/CommonGramsQueryFilter.cs |   5 +-
 .../Analysis/Compound/Hyphenation/Hyphen.cs        |   5 +-
 .../Compound/Hyphenation/HyphenationTree.cs        |   2 +-
 .../Analysis/Compound/Hyphenation/PatternParser.cs |  12 +-
 .../Analysis/De/GermanStemFilter.cs                |   3 +-
 .../Analysis/De/GermanStemmer.cs                   |  13 +-
 .../Analysis/En/KStemmer.cs                        |   2 +-
 .../Analysis/Fr/FrenchStemFilter.cs                |   2 +-
 .../Analysis/Hunspell/Dictionary.cs                |  18 +-
 .../Analysis/Miscellaneous/PatternAnalyzer.cs      |   2 +-
 .../Miscellaneous/TruncateTokenFilterFactory.cs    |   5 +-
 .../Miscellaneous/WordDelimiterFilterFactory.cs    |  12 +-
 .../Analysis/Nl/DutchAnalyzer.cs                   |  14 +-
 .../Analysis/Nl/DutchStemFilter.cs                 |   2 +-
 .../Analysis/No/NorwegianLightStemFilterFactory.cs |   7 +-
 .../No/NorwegianMinimalStemFilterFactory.cs        |   7 +-
 .../Pattern/PatternReplaceFilterFactory.cs         |   3 +-
 .../Payloads/DelimitedPayloadTokenFilterFactory.cs |   9 +-
 .../Analysis/Payloads/NumericPayloadTokenFilter.cs |   2 +-
 .../Analysis/Shingle/ShingleFilter.cs              |  36 +-
 .../Analysis/Sinks/TokenTypeSinkFilter.cs          |   3 +-
 .../Analysis/Snowball/SnowballAnalyzer.cs          |   4 +-
 .../Analysis/Synonym/FSTSynonymFilterFactory.cs    |  10 +-
 .../Analysis/Synonym/SlowSynonymFilterFactory.cs   |   4 +-
 .../Analysis/Synonym/SlowSynonymMap.cs             |  54 +--
 .../Analysis/Synonym/SynonymFilterFactory.cs       |   2 +-
 .../Analysis/Synonym/WordnetSynonymParser.cs       |   2 +-
 .../Analysis/Util/AbstractAnalysisFactory.cs       |   6 +-
 .../Analysis/Util/CharArrayMap.cs                  |  86 +++--
 .../Analysis/Util/CharArraySet.cs                  |   8 +-
 .../Lucene.Net.Analysis.Common.csproj              |   2 +-
 .../Tartarus/Snowball/SnowballProgram.cs           |   3 +-
 .../Icu/ICUNormalizer2CharFilterFactory.cs         |   2 +-
 .../Analysis/Icu/ICUNormalizer2FilterFactory.cs    |   2 +-
 .../Analysis/Icu/ICUTransformFilterFactory.cs      |   2 +-
 .../Icu/Segmentation/ICUTokenizerFactory.cs        |   2 +-
 .../GraphvizFormatter.cs                           |   3 +-
 .../Lucene.Net.Analysis.Kuromoji.csproj            |   8 +-
 .../Tools/BinaryDictionaryWriter.cs                |  12 +-
 src/Lucene.Net.Analysis.Kuromoji/Util/CSVUtil.cs   |   5 +-
 .../DoubleMetaphoneFilter.cs                       |   7 +-
 .../Language/AbstractCaverphone .cs                |   4 +-
 .../Language/Bm/Lang.cs                            |   4 +-
 .../Language/Bm/PhoneticEngine.cs                  |   2 +-
 .../Language/Bm/Rule.cs                            |  16 +-
 .../Language/ColognePhonetic.cs                    |   3 +-
 .../Language/DaitchMokotoffSoundex.cs              |   4 +-
 .../Language/DoubleMetaphone.cs                    |   6 +-
 .../Language/Metaphone.cs                          |   5 +-
 .../Lucene.Net.Analysis.Phonetic.csproj            |   8 +-
 src/Lucene.Net.Analysis.Phonetic/PhoneticFilter.cs |   2 +-
 .../{HHMM => Hhmm}/bigramdict.mem                  | Bin
 .../{HHMM => Hhmm}/coredict.mem                    | Bin
 .../{HHMM => Hhmm}/package.md                      |   0
 .../Lucene.Net.Analysis.SmartCn.csproj             |   8 +-
 .../Egothor.Stemmer/Compile.cs                     |   4 +-
 .../Egothor.Stemmer/DiffIt.cs                      |   4 +-
 .../Egothor.Stemmer/Gener.cs                       |   6 +-
 .../Egothor.Stemmer/Lift.cs                        |   4 +-
 .../Egothor.Stemmer/Optimizer.cs                   |   8 +-
 .../Egothor.Stemmer/Reduce.cs                      |  21 +-
 .../Egothor.Stemmer/Row.cs                         |  23 +-
 .../Lucene.Net.Analysis.Stempel.csproj             |   8 +-
 .../ByTask/Feeds/EnwikiContentSource.cs            |   4 +-
 .../ByTask/Feeds/FileBasedQueryMaker.cs            |   2 +-
 .../ByTask/Feeds/ReutersQueryMaker.cs              |   2 +-
 .../ByTask/Feeds/SimpleQueryMaker.cs               |   2 +-
 .../ByTask/Feeds/TrecLATimesParser.cs              |   2 +-
 src/Lucene.Net.Benchmark/ByTask/PerfRunData.cs     |   2 +-
 .../ByTask/Tasks/AnalyzerFactoryTask.cs            |   4 +-
 .../ByTask/Tasks/CreateIndexTask.cs                |   2 +-
 .../ByTask/Tasks/NewAnalyzerTask.cs                |   4 +-
 .../ByTask/Tasks/SetPropTask.cs                    |   2 +-
 .../ByTask/Tasks/TaskSequence.cs                   |   2 +-
 .../ByTask/Tasks/WriteLineDocTask.cs               |   2 +-
 src/Lucene.Net.Benchmark/ByTask/Utils/Config.cs    |  32 +-
 .../Lucene.Net.Benchmark.csproj                    |   2 +-
 .../Support/Sax/Ext/Attributes2Impl.cs             |   4 +-
 .../Support/Sax/Helpers/NamespaceSupport.cs        |  15 +-
 .../Support/TagSoup/Element.cs                     |   3 +-
 .../Support/TagSoup/ElementType.cs                 |   8 +-
 .../Support/TagSoup/PYXScanner.cs                  |   3 +-
 src/Lucene.Net.Benchmark/Support/TagSoup/Parser.cs |  48 +--
 .../Support/TagSoup/XMLWriter.cs                   |  50 +--
 src/Lucene.Net.Benchmark/Utils/ExtractReuters.cs   |   2 +-
 .../Lucene.Net.Classification.csproj               |   8 +-
 src/Lucene.Net.Codecs/Lucene.Net.Codecs.csproj     |   8 +-
 .../Memory/MemoryDocValuesConsumer.cs              |   3 +-
 .../SimpleText/SimpleTextDocValuesWriter.cs        |  69 ++--
 .../SimpleText/SimpleTextFieldInfosReader.cs       |   2 +-
 src/Lucene.Net.Codecs/SimpleText/SimpleTextUtil.cs |   5 +-
 src/Lucene.Net.Demo/IndexFiles.cs                  |   2 +-
 src/Lucene.Net.Demo/Lucene.Net.Demo.csproj         |   2 +-
 src/Lucene.Net.Demo/SearchFiles.cs                 |  14 +-
 .../Lucene.Net.Expressions.csproj                  |  10 +-
 src/Lucene.Net.Facet/FacetsConfig.cs               |   2 +-
 src/Lucene.Net.Facet/LabelAndValue.cs              |   2 +-
 src/Lucene.Net.Facet/Lucene.Net.Facet.csproj       |   8 +-
 src/Lucene.Net.Facet/Range/RangeFacetCounts.cs     |   5 +-
 .../DefaultSortedSetDocValuesReaderState.cs        |   3 +-
 src/Lucene.Net.Facet/Taxonomy/CategoryPath.cs      |   2 +-
 .../Taxonomy/Directory/DirectoryTaxonomyReader.cs  |   2 +-
 src/Lucene.Net.Facet/Taxonomy/FacetLabel.cs        |   2 +-
 .../Taxonomy/PrintTaxonomyStats.cs                 |   2 +-
 src/Lucene.Net.Facet/Taxonomy/TaxonomyFacets.cs    |   4 +-
 .../Taxonomy/WriterCache/CompactLabelToOrdinal.cs  |  11 +-
 src/Lucene.Net.Grouping/Lucene.Net.Grouping.csproj |   8 +-
 src/Lucene.Net.Grouping/TopGroups.cs               |   9 +-
 .../Highlight/QueryTermExtractor.cs                |   2 +-
 .../Highlight/WeightedSpanTermExtractor.cs         |   4 +-
 .../Lucene.Net.Highlighter.csproj                  |   8 +-
 .../PostingsHighlight/MultiTermHighlighting.cs     |   8 +-
 .../VectorHighlight/BaseFragListBuilder.cs         |  93 ++---
 .../VectorHighlight/BaseFragmentsBuilder.cs        |  54 +--
 .../VectorHighlight/FastVectorHighlighter.cs       |   5 +-
 .../VectorHighlight/FieldPhraseList.cs             | 167 +++++----
 .../VectorHighlight/FieldQuery.cs                  |  25 +-
 .../VectorHighlight/SingleFragListBuilder.cs       |  22 +-
 src/Lucene.Net.Join/Lucene.Net.Join.csproj         |   8 +-
 src/Lucene.Net.Join/TermsIncludingScoreQuery.cs    |   3 +-
 src/Lucene.Net.Memory/Lucene.Net.Memory.csproj     |   2 +-
 .../MemoryIndex.MemoryIndexReader.cs               |   2 +-
 src/Lucene.Net.Memory/MemoryIndex.cs               |   8 +-
 src/Lucene.Net.Misc/Document/LazyDocument.cs       |   2 +-
 src/Lucene.Net.Misc/Index/CompoundFileExtractor.cs |   4 +-
 src/Lucene.Net.Misc/Index/IndexSplitter.cs         |   8 +-
 .../Index/MultiPassIndexSplitter.cs                |   6 +-
 .../Index/Sorter/SortingMergePolicy.cs             |   2 +-
 src/Lucene.Net.Misc/Lucene.Net.Misc.csproj         |   8 +-
 src/Lucene.Net.Misc/Misc/HighFreqTerms.cs          |   2 +-
 .../Function/ValueSources/DocFreqValueSource.cs    |   2 +-
 .../Function/ValueSources/FieldCacheSource.cs      |   3 +-
 .../ValueSources/JoinDocFreqValueSource.cs         |   2 +-
 .../Function/ValueSources/LiteralValueSource.cs    |   3 +-
 .../Function/ValueSources/MultiFloatFunction.cs    |   3 +-
 .../Function/ValueSources/NormValueSource.cs       |   3 +-
 .../Function/ValueSources/OrdFieldSource.cs        |   3 +-
 .../Function/ValueSources/ReverseOrdFieldSource.cs |   3 +-
 .../Function/ValueSources/SingleFunction.cs        |   3 +-
 .../ValueSources/SumTotalTermFreqValueSource.cs    |   3 +-
 .../ValueSources/TotalTermFreqValueSource.cs       |   3 +-
 src/Lucene.Net.Queries/Lucene.Net.Queries.csproj   |   8 +-
 src/Lucene.Net.Queries/Mlt/MoreLikeThisQuery.cs    |   5 +-
 src/Lucene.Net.Queries/TermsFilter.cs              |   4 +-
 src/Lucene.Net.QueryParser/Classic/QueryParser.cs  |   4 +-
 .../Classic/QueryParserBase.cs                     |   4 +-
 .../ComplexPhrase/ComplexPhraseQueryParser.cs      |   6 +-
 .../Flexible/Core/Nodes/OrQueryNode.cs             |   4 +-
 .../Flexible/Core/Nodes/QueryNodeImpl.cs           |   2 +-
 .../Processors/RemoveDeletedQueryNodesProcessor.cs |   4 +-
 .../Standard/Nodes/AbstractRangeQueryNode.cs       |   4 +-
 .../Standard/Parser/StandardSyntaxParser.cs        |  25 +-
 .../Processors/MatchAllDocsQueryNodeProcessor.cs   |   5 +-
 .../Processors/OpenRangeQueryNodeProcessor.cs      |   5 +-
 .../Lucene.Net.QueryParser.csproj                  |   2 +-
 .../Surround/Query/RewriteQuery.cs                 |   2 +-
 .../Surround/Query/SrndQuery.cs                    |   2 +-
 .../Xml/Builders/BooleanQueryBuilder.cs            |   2 +-
 src/Lucene.Net.QueryParser/Xml/DOMUtils.cs         |  12 +-
 .../IndexAndTaxonomyRevision.cs                    |   4 +-
 .../IndexReplicationHandler.cs                     |   6 +-
 src/Lucene.Net.Replicator/IndexRevision.cs         |   4 +-
 .../Lucene.Net.Replicator.csproj                   |   8 +-
 src/Lucene.Net.Replicator/RevisionFile.cs          |   2 +-
 src/Lucene.Net.Sandbox/Lucene.Net.Sandbox.csproj   |   8 +-
 src/Lucene.Net.Sandbox/Queries/DuplicateFilter.cs  |   3 +-
 .../Queries/FuzzyLikeThisQuery.cs                  |   7 +-
 src/Lucene.Net.Sandbox/Queries/SlowFuzzyQuery.cs   |   2 +-
 src/Lucene.Net.Spatial/DisjointSpatialFilter.cs    |   2 +-
 src/Lucene.Net.Spatial/Lucene.Net.Spatial.csproj   |   2 +-
 .../Prefix/AbstractPrefixTreeFilter.cs             |   3 +-
 src/Lucene.Net.Spatial/Prefix/Tree/Cell.cs         |   2 +-
 .../Serialized/SerializedDVStrategy.cs             |   2 +-
 src/Lucene.Net.Suggest/Lucene.Net.Suggest.csproj   |   8 +-
 src/Lucene.Net.Suggest/Spell/SpellChecker.cs       |   2 +-
 .../Suggest/Analyzing/AnalyzingInfixSuggester.cs   |   2 +-
 src/Lucene.Net.Suggest/Suggest/FileDictionary.cs   |  21 +-
 .../Analysis/BaseTokenStreamTestCase.cs            |   4 +-
 .../Codecs/Asserting/AssertingDocValuesFormat.cs   |  97 +++---
 .../Codecs/MissingOrdRemapper.cs                   |  21 +-
 .../Codecs/RAMOnly/RAMOnlyPostingsFormat.cs        |   2 +-
 .../Index/AlcoholicMergePolicy.cs                  |  36 +-
 .../Index/AssertingAtomicReader.cs                 |   4 +-
 .../Index/BaseDocValuesFormatTestCase.cs           |   8 +-
 .../Index/FieldFilterAtomicReader.cs               |   3 +-
 .../JavaCompatibility/SystemTypesHelpers.cs        |  81 +++--
 .../Lucene.Net.TestFramework.csproj                |   2 +-
 .../Properties/AssemblyInfo.cs                     |   4 +-
 src/Lucene.Net.TestFramework/Search/CheckHits.cs   |   4 +-
 .../Store/MockDirectoryWrapper.cs                  | 163 +++++----
 .../Store/SlowOpeningMockIndexInputWrapper.cs      |   5 +-
 .../Support}/SynchronizedList.cs                   |   0
 .../Util/LuceneTestCase.cs                         |  91 +++--
 .../Util/TestRuleSetupAndRestoreClassEnv.cs        |   2 +-
 src/Lucene.Net.TestFramework/Util/TestUtil.cs      |  27 +-
 .../CharFilters/HTMLStripCharFilterTest.cs         |   4 +-
 .../Analysis/Core/TestAllAnalyzersHaveFactories.cs |   6 +-
 .../Analysis/Core/TestRandomChains.cs              |  30 +-
 .../Analysis/Core/TestStopFilter.cs                |   2 +-
 .../Analysis/Hunspell/TestAllDictionaries.cs       |   2 +-
 .../Analysis/Hunspell/TestAllDictionaries2.cs      |   2 +-
 .../Miscellaneous/TestASCIIFoldingFilter.cs        |   3 +-
 .../TestLimitTokenCountFilterFactory.cs            |   2 +-
 .../TestLimitTokenPositionFilterFactory.cs         |   2 +-
 .../TestLucene47WordDelimiterFilter.cs             |   2 +-
 .../TestTruncateTokenFilterFactory.cs              |   1 +
 .../Miscellaneous/TestWordDelimiterFilter.cs       |   2 +-
 .../Pattern/TestPatternReplaceCharFilter.cs        |   4 +-
 .../Analysis/Pattern/TestPatternTokenizer.cs       |   3 +-
 .../Payloads/NumericPayloadTokenFilterTest.cs      |   8 +-
 .../Payloads/TypeAsPayloadTokenFilterTest.cs       |   5 +-
 .../Analysis/Sinks/TestTeeSinkTokenFilter.cs       |   4 +-
 .../Analysis/Sinks/TokenTypeSinkTokenizerTest.cs   |   9 +-
 .../Analysis/Synonym/TestSynonymMap.cs             |   4 +-
 .../Analysis/Th/TestThaiAnalyzer.cs                |  42 +++
 .../Util/BaseTokenStreamFactoryTestCase.cs         |   2 +-
 .../Analysis/Util/TestBufferedCharFilter.cs        |  14 +-
 .../Collation/TestICUCollationKeyFilterFactory.cs  |   2 +-
 .../TestJapaneseTokenizer.cs                       |   2 +-
 .../Language/Bm/BeiderMorseEncoderTest.cs          |   2 +-
 .../Language/Bm/PhoneticEngineRegressionTest.cs    |   2 +-
 .../Egothor.Stemmer/TestCompile.cs                 |   2 +-
 .../ByTask/Feeds/TrecContentSourceTest.cs          |   2 +-
 .../ByTask/TestPerfTasksLogic.cs                   |  10 +-
 .../ByTask/TestPerfTasksParse.cs                   |   4 +-
 .../Range/TestRangeFacetCounts.cs                  |   2 +-
 .../SortedSet/TestSortedSetDocValuesFacets.cs      |   2 +-
 .../Directory/TestDirectoryTaxonomyWriter.cs       |   2 +-
 .../Taxonomy/TestTaxonomyCombined.cs               |   2 +-
 .../Taxonomy/TestTaxonomyFacetCounts.cs            |   2 +-
 .../Taxonomy/TestTaxonomyFacetSumValueSource.cs    |   2 +-
 src/Lucene.Net.Tests.Facet/TestDrillDownQuery.cs   |   2 +-
 src/Lucene.Net.Tests.Facet/TestDrillSideways.cs    |   6 +-
 .../Highlight/HighlighterTest.cs                   |   8 +-
 .../PostingsHighlight/TestPostingsHighlighter.cs   |   2 +-
 .../BreakIteratorBoundaryScannerTest.cs            |  18 +-
 .../VectorHighlight/IndexTimeSynonymTest.cs        |   4 +-
 .../VectorHighlight/SimpleBoundaryScannerTest.cs   |  12 +-
 .../VectorHighlight/SimpleFragmentsBuilderTest.cs  |   4 +-
 src/Lucene.Net.Tests.Join/TestBlockJoin.cs         |   2 +-
 src/Lucene.Net.Tests.Join/TestJoinUtil.cs          |   2 +-
 .../Document/TestLazyDocument.cs                   |  24 +-
 .../Index/Sorter/SorterTestBase.cs                 |   2 +-
 .../Misc/SweetSpotSimilarityTest.cs                |   8 +-
 .../CommonTermsQueryTest.cs                        |   2 +-
 .../Function/TestOrdValues.cs                      |   3 +-
 .../Function/TestValueSources.cs                   |   4 +-
 .../Classic/TestMultiAnalyzer.cs                   |   8 +-
 .../Classic/TestMultiFieldQueryParser.cs           |   2 +-
 .../Classic/TestQueryParser.cs                     |   2 +-
 .../Precedence/TestPrecedenceQueryParser.cs        |  18 +-
 .../Flexible/Spans/UniqueFieldAttributeImpl.cs     |   2 +-
 .../Flexible/Standard/TestMultiAnalyzerQPHelper.cs |   8 +-
 .../Flexible/Standard/TestMultiFieldQPHelper.cs    |   2 +-
 .../Flexible/Standard/TestNumericQueryParser.cs    |  10 +-
 .../Flexible/Standard/TestQPHelper.cs              |  18 +-
 .../Util/QueryParserTestBase.cs                    |  20 +-
 .../Xml/TestQueryTemplateManager.cs                |   4 +-
 .../IndexAndTaxonomyRevisionTest.cs                |   4 +-
 .../IndexRevisionTest.cs                           |   2 +-
 src/Lucene.Net.Tests.Spatial/TestTestFramework.cs  |   2 +-
 .../Spell/TestDirectSpellChecker.cs                |   2 +-
 .../Spell/TestLuceneDictionary.cs                  |   7 +-
 .../Spell/TestSpellChecker.cs                      |   2 +-
 .../Spell/TestWordBreakSpellChecker.cs             |  66 ++--
 .../Suggest/Analyzing/AnalyzingSuggesterTest.cs    |   2 +-
 .../Suggest/Analyzing/FuzzySuggesterTest.cs        |   2 +-
 .../Suggest/FileDictionaryTest.cs                  |  22 +-
 .../Suggest/Fst/FSTCompletionTest.cs               |   4 +-
 .../Lucene.Net.Tests._A-I.csproj}                  |  41 +--
 .../Lucene.Net.Tests._J-U.csproj}                  |  43 +--
 .../Lucene.Net.Tests._U-Z.csproj}                  |  38 +--
 .../Analysis/TestGraphTokenizers.cs                |   4 +-
 .../Analysis/TrivialLookaheadFilter.cs             |   3 +-
 .../Codecs/Lucene3x/TestSurrogates.cs              |   8 +-
 .../Codecs/PerField/TestPerFieldDocValuesFormat.cs |   2 +-
 .../Codecs/PerField/TestPerFieldPostingsFormat2.cs |  14 +-
 .../Document/TestBinaryDocument.cs                 |   8 +-
 src/Lucene.Net.Tests/Document/TestDateTools.cs     |   4 +-
 src/Lucene.Net.Tests/Document/TestDocument.cs      |  35 +-
 src/Lucene.Net.Tests/Index/Test2BTerms.cs          |   2 +-
 src/Lucene.Net.Tests/Index/TestAddIndexes.cs       |   6 +-
 .../Index/TestAllFilesHaveChecksumFooter.cs        |   2 +-
 .../Index/TestAllFilesHaveCodecHeader.cs           |   4 +-
 .../Index/TestBackwardsCompatibility.cs            |   2 +-
 .../Index/TestBackwardsCompatibility3x.cs          |   2 +-
 src/Lucene.Net.Tests/Index/TestBagOfPositions.cs   |   2 +-
 src/Lucene.Net.Tests/Index/TestBagOfPostings.cs    |   2 +-
 src/Lucene.Net.Tests/Index/TestCompoundFile.cs     |   2 +-
 .../Index/TestConcurrentMergeScheduler.cs          |   2 +-
 .../Index/TestCrashCausesCorruptIndex.cs           |   2 +-
 src/Lucene.Net.Tests/Index/TestDeletionPolicy.cs   |   8 +-
 .../Index/TestDocInverterPerFieldErrorInfo.cs      |   2 +-
 src/Lucene.Net.Tests/Index/TestDocumentWriter.cs   |  11 +-
 .../Index/TestDocumentsWriterStallControl.cs       |  12 +-
 .../Index/TestFilterAtomicReader.cs                |   2 +-
 src/Lucene.Net.Tests/Index/TestIndexFileDeleter.cs |   2 +-
 src/Lucene.Net.Tests/Index/TestIndexWriter.cs      |   8 +-
 .../Index/TestIndexWriterCommit.cs                 |   6 +-
 .../Index/TestIndexWriterConfig.cs                 |   6 +-
 .../Index/TestIndexWriterDelete.cs                 |   6 +-
 .../Index/TestIndexWriterExceptions.cs             |  14 +-
 .../Index/TestIndexWriterMerging.cs                |   2 +-
 .../Index/TestIndexWriterOnDiskFull.cs             |   2 +-
 .../Index/TestIndexWriterOnJRECrash.cs             |   2 +-
 .../Index/TestIndexWriterReader.cs                 |  21 +-
 src/Lucene.Net.Tests/Index/TestLazyProxSkipping.cs |   6 +-
 src/Lucene.Net.Tests/Index/TestLongPostings.cs     |   5 +-
 src/Lucene.Net.Tests/Index/TestNoMergePolicy.cs    |   3 +-
 src/Lucene.Net.Tests/Index/TestNorms.cs            |   2 +-
 .../Index/TestPerSegmentDeletes.cs                 |   2 +-
 .../Index/TestPersistentSnapshotDeletionPolicy.cs  |   2 +-
 src/Lucene.Net.Tests/Index/TestPostingsOffsets.cs  |   4 +-
 src/Lucene.Net.Tests/Index/TestRollingUpdates.cs   |   2 +-
 src/Lucene.Net.Tests/Index/TestSegmentMerger.cs    |   3 +-
 src/Lucene.Net.Tests/Index/TestSegmentReader.cs    |   8 +-
 src/Lucene.Net.Tests/Index/TestStressIndexing2.cs  |   8 +-
 src/Lucene.Net.Tests/Index/TestTermsEnum2.cs       |   3 +-
 .../Index/TestTransactionRollback.cs               |  15 +-
 src/Lucene.Net.Tests/Index/TestTransactions.cs     |   2 +-
 .../Search/Payloads/PayloadHelper.cs               |   4 +-
 .../Search/Payloads/TestPayloadNearQuery.cs        |   6 +-
 .../Search/Payloads/TestPayloadTermQuery.cs        |   5 +-
 .../Search/Similarities/TestSimilarityBase.cs      |   2 +-
 src/Lucene.Net.Tests/Search/TestBooleanQuery.cs    |   2 +-
 .../Search/TestDisjunctionMaxQuery.cs              |  36 +-
 .../Search/TestDocValuesScoring.cs                 |   3 +-
 src/Lucene.Net.Tests/Search/TestFieldCache.cs      |   6 +-
 .../Search/TestFieldCacheRangeFilter.cs            |   3 +-
 .../Search/TestMultiThreadTermVectors.cs           |   2 +-
 .../Search/TestPositionIncrement.cs                |   2 +-
 src/Lucene.Net.Tests/Search/TestPrefixRandom.cs    |   3 +-
 src/Lucene.Net.Tests/Search/TestRegexpQuery.cs     |   3 +-
 src/Lucene.Net.Tests/Search/TestRegexpRandom2.cs   |   2 +-
 src/Lucene.Net.Tests/Search/TestSearchAfter.cs     |   4 +-
 .../Search/TestSimilarityProvider.cs               |   3 +-
 src/Lucene.Net.Tests/Store/TestLockFactory.cs      |   2 +-
 src/Lucene.Net.Tests/Support/IO/TestByteBuffer.cs  |   9 +-
 .../Support/IO/TestStreamTokenizer.cs              |  18 +-
 .../Support/TestDictionaryExtensions.cs            |   8 +-
 src/Lucene.Net.Tests/Support/TestEquatableList.cs  |   2 +-
 src/Lucene.Net.Tests/Support/TestEquatableSet.cs   |   2 +-
 src/Lucene.Net.Tests/Support/TestOldPatches.cs     |   3 +-
 .../Support/TestStringTokenizer.cs                 |   4 +-
 src/Lucene.Net.Tests/Support/TestTreeSet.cs        |  10 +-
 src/Lucene.Net.Tests/TestExternalCodecs.cs         |   4 +-
 .../Util/Automaton/TestBasicOperations.cs          |   4 +-
 .../Util/Automaton/TestLevenshteinAutomata.cs      |   2 +-
 .../Util/Automaton/TestUTF32ToUTF8.cs              |   4 +-
 src/Lucene.Net.Tests/Util/Fst/TestFSTs.cs          |  24 +-
 src/Lucene.Net.Tests/Util/TestFilterIterator.cs    |   8 +-
 src/Lucene.Net.Tests/Util/TestQueryBuilder.cs      |   5 +-
 src/Lucene.Net/Analysis/Token.cs                   |   3 +-
 src/Lucene.Net/Index/CheckIndex.cs                 |   2 +-
 src/Lucene.Net/Index/CoalescedUpdates.cs           |   1 +
 src/Lucene.Net/Index/IndexFileDeleter.cs           |   4 +-
 src/Lucene.Net/Index/IndexWriter.cs                |  17 +-
 src/Lucene.Net/Index/SegmentInfos.cs               |   2 +-
 src/Lucene.Net/Index/UpgradeIndexMergePolicy.cs    |   2 +-
 src/Lucene.Net/Lucene.Net.csproj                   |   2 +-
 src/Lucene.Net/Properties/AssemblyInfo.cs          |   4 +-
 src/Lucene.Net/Search/BooleanQuery.cs              | 115 ++++---
 src/Lucene.Net/Search/IndexSearcher.cs             |   5 +-
 src/Lucene.Net/Search/MultiPhraseQuery.cs          |   8 +-
 src/Lucene.Net/Search/Payloads/PayloadNearQuery.cs |   4 +-
 src/Lucene.Net/Search/Payloads/PayloadSpanUtil.cs  |   5 +-
 src/Lucene.Net/Search/Spans/SpanNearQuery.cs       |   4 +-
 src/Lucene.Net/Search/Spans/SpanOrQuery.cs         |   9 +-
 .../Search/Spans/SpanPayloadCheckQuery.cs          |  18 +-
 src/Lucene.Net/Store/FileSwitchDirectory.cs        |   4 +-
 src/Lucene.Net/Store/NRTCachingDirectory.cs        |   4 +-
 src/Lucene.Net/Support/Arrays.cs                   |   2 +-
 src/Lucene.Net/Support/AssemblyExtensions.cs       |   6 +-
 src/Lucene.Net/Support/CultureContext.cs           |  15 +-
 src/Lucene.Net/Support/HashMap.cs                  |  70 ++--
 src/Lucene.Net/Support/TreeSet.cs                  | 246 +++++++-------
 src/Lucene.Net/Support/Util/NamedServiceFactory.cs |   2 +-
 src/Lucene.Net/Util/AttributeSource.cs             |  16 +-
 src/Lucene.Net/Util/Automaton/BasicOperations.cs   |   5 +-
 .../Util/Automaton/LevenshteinAutomata.cs          |  10 +-
 src/Lucene.Net/Util/Automaton/SpecialOperations.cs |   8 +-
 src/Lucene.Net/Util/CloseableThreadLocal.cs        |   3 +-
 src/Lucene.Net/Util/CommandLineUtil.cs             |   8 +-
 src/Lucene.Net/Util/MergedIterator.cs              |   5 +-
 src/Lucene.Net/Util/StringHelper.cs                |  13 +-
 src/Lucene.Net/Util/WAH8DocIdSet.cs                |   9 +-
 src/dotnet/Lucene.Net.ICU/Lucene.Net.ICU.csproj    |   8 +-
 .../Lucene.Net.Replicator.AspNetCore.csproj        |   8 +-
 .../BenchmarkFindQualityQueriesCommandTest.cs      |   4 +-
 .../Commands/CommandTestCase.cs                    |   2 +
 .../Commands/Index/IndexCheckCommandTest.cs        |   4 +-
 .../Commands/Index/IndexFixCommandTest.cs          |   4 +-
 .../Index/IndexListHighFreqTermsCommandTest.cs     |   4 +-
 .../Commands/Index/IndexListSegmentsCommandTest.cs |   4 +-
 .../Index/IndexListTaxonomyStatsCommandTest.cs     |   4 +-
 .../Commands/Index/IndexUpgradeCommandTest.cs      |   4 +-
 .../CommandLine/CommandLineApplication.cs          |   4 +-
 .../tools/lucene-cli/CommandLine/CommandOption.cs  |   6 +-
 .../tools/lucene-cli/SourceCode/ConsolePager.cs    |   2 +-
 418 files changed, 3671 insertions(+), 1914 deletions(-)
 create mode 100644 .vscode/settings.json
 copy build/NuGet.props => Directory.Build.targets (52%)
 create mode 100644 azure-pipelines.yml
 create mode 100644 build/azure-templates/publish-nuget-packages.yml
 create mode 100644 build/azure-templates/publish-test-results-for-target-frameworks.yml
 create mode 100644 build/azure-templates/publish-test-results-for-test-projects.yml
 create mode 100644 build/azure-templates/publish-test-results.yml
 create mode 100644 build/azure-templates/run-tests-on-os.yml
 create mode 100644 build/azure-templates/show-all-environment-variables.yml
 create mode 100644 build/azure-templates/show-all-files.yml
 rename src/Lucene.Net.Analysis.SmartCn/{HHMM => Hhmm}/bigramdict.mem (100%)
 rename src/Lucene.Net.Analysis.SmartCn/{HHMM => Hhmm}/coredict.mem (100%)
 rename src/Lucene.Net.Analysis.SmartCn/{HHMM => Hhmm}/package.md (100%)
 rename src/{Lucene.Net.Tests/Index => Lucene.Net.TestFramework/Support}/SynchronizedList.cs (100%)
 copy src/{Lucene.Net.Tests/Lucene.Net.Tests.csproj => Lucene.Net.Tests._A-I/Lucene.Net.Tests._A-I.csproj} (62%)
 copy src/{Lucene.Net.Tests/Lucene.Net.Tests.csproj => Lucene.Net.Tests._J-U/Lucene.Net.Tests._J-U.csproj} (63%)
 rename src/{Lucene.Net.Tests/Lucene.Net.Tests.csproj => Lucene.Net.Tests._U-Z/Lucene.Net.Tests._U-Z.csproj} (62%)


[lucenenet] 35/42: BUG: Lucene.Net.Tests.Analysis.Common.Analysis.Pattern.TestPatternTokenizer.TestSplitting: int.Parse must be setup in the invariant culture to consistently recognize inputs

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit acd138963a27e75a95e2fceb2b42fc0a1f818f80
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Tue Aug 6 05:29:40 2019 +0700

    BUG: Lucene.Net.Tests.Analysis.Common.Analysis.Pattern.TestPatternTokenizer.TestSplitting: int.Parse must be setup in the invariant culture to consistently recognize inputs
---
 .../Analysis/Pattern/TestPatternTokenizer.cs                           | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Pattern/TestPatternTokenizer.cs b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Pattern/TestPatternTokenizer.cs
index f3c0c47..f0fd263 100644
--- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Pattern/TestPatternTokenizer.cs
+++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Pattern/TestPatternTokenizer.cs
@@ -2,6 +2,7 @@
 using Lucene.Net.Analysis.TokenAttributes;
 using NUnit.Framework;
 using System.Collections.Generic;
+using System.Globalization;
 using System.IO;
 using System.Text;
 using System.Text.RegularExpressions;
@@ -45,7 +46,7 @@ namespace Lucene.Net.Analysis.Pattern
 
             foreach (string[] test in tests)
             {
-                TokenStream stream = new PatternTokenizer(new StringReader(test[2]), new Regex(test[1], RegexOptions.Compiled), int.Parse(test[0]));
+                TokenStream stream = new PatternTokenizer(new StringReader(test[2]), new Regex(test[1], RegexOptions.Compiled), int.Parse(test[0], CultureInfo.InvariantCulture));
                 string @out = tsToString(stream);
                 // System.out.println( test[2] + " ==> " + out );
 


[lucenenet] 01/42: BUG: Lucene.Net.Suggest.Suggest.FileDictionary - Fixed conversion of string to number to be culture insensitive (it caused the tests in FileDictionaryTest to fail randomly)

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit 7f69810240e32cfc73bcbf53a63b8a8fbf2ade1b
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Sun Jul 28 17:19:13 2019 +0700

    BUG: Lucene.Net.Suggest.Suggest.FileDictionary - Fixed conversion of string to number to be culture insensitive (it caused the tests in FileDictionaryTest to fail randomly)
---
 src/Lucene.Net.Suggest/Suggest/FileDictionary.cs   | 21 ++++++++++++++-------
 .../Suggest/FileDictionaryTest.cs                  | 22 ++++++++++++----------
 2 files changed, 26 insertions(+), 17 deletions(-)

diff --git a/src/Lucene.Net.Suggest/Suggest/FileDictionary.cs b/src/Lucene.Net.Suggest/Suggest/FileDictionary.cs
index 0928676..cdcb9dc 100644
--- a/src/Lucene.Net.Suggest/Suggest/FileDictionary.cs
+++ b/src/Lucene.Net.Suggest/Suggest/FileDictionary.cs
@@ -2,6 +2,7 @@
 using Lucene.Net.Util;
 using System;
 using System.Collections.Generic;
+using System.Globalization;
 using System.IO;
 using System.Text;
 
@@ -255,14 +256,20 @@ namespace Lucene.Net.Search.Suggest
 
             internal void ReadWeight(string weight)
             {
-                // keep reading floats for bw compat
-                try
+                // LUCENENET specific - don't use exception, use TryParse
+                if (!long.TryParse(weight, NumberStyles.Integer, CultureInfo.InvariantCulture, out curWeight))
                 {
-                    curWeight = Convert.ToInt64(weight);
-                }
-                catch (FormatException)
-                {
-                    curWeight = (long)Convert.ToDouble(weight);
+                    try
+                    {
+                        // keep reading floats for bw compat
+                        curWeight = (long)double.Parse(weight, NumberStyles.Float, CultureInfo.InvariantCulture);
+                    }
+                    catch (FormatException e)
+                    {
+                        // LUCENENET TODO: This is just so we can see what string and what culture was being tested when parsing failed,
+                        // to try to reproduce the conditions of the failure.
+                        throw new FormatException($"Weight '{weight}' could not be parsed to long or double in culture '{CultureInfo.CurrentCulture.Name}'.", e);
+                    }
                 }
             }
 
diff --git a/src/Lucene.Net.Tests.Suggest/Suggest/FileDictionaryTest.cs b/src/Lucene.Net.Tests.Suggest/Suggest/FileDictionaryTest.cs
index cbdf5f8..74ec357 100644
--- a/src/Lucene.Net.Tests.Suggest/Suggest/FileDictionaryTest.cs
+++ b/src/Lucene.Net.Tests.Suggest/Suggest/FileDictionaryTest.cs
@@ -32,24 +32,26 @@ namespace Lucene.Net.Search.Suggest
             List<string> entryValues = new List<string>();
             StringBuilder sb = new StringBuilder();
             string term = TestUtil.RandomSimpleString(Random(), 1, 300);
-            sb.append(term);
+            sb.Append(term);
             entryValues.Add(term);
             if (hasWeight)
             {
-                sb.append(fieldDelimiter);
+                sb.Append(fieldDelimiter);
                 long weight = TestUtil.NextLong(Random(), long.MinValue, long.MaxValue);
-                sb.append(weight);
-                entryValues.Add(weight.ToString());
+                // LUCENENET: We need to explicitly use invariant culture here,
+                // as that is what is expected in Java
+                sb.Append(weight.ToString(CultureInfo.InvariantCulture));
+                entryValues.Add(weight.ToString(CultureInfo.InvariantCulture));
             }
             if (hasPayload)
             {
-                sb.append(fieldDelimiter);
+                sb.Append(fieldDelimiter);
                 string payload = TestUtil.RandomSimpleString(Random(), 1, 300);
-                sb.append(payload);
+                sb.Append(payload);
                 entryValues.Add(payload);
             }
             sb.append("\n");
-            return new KeyValuePair<List<string>, string>(entryValues, sb.toString());
+            return new KeyValuePair<List<string>, string>(entryValues, sb.ToString());
         }
 
         private KeyValuePair<List<List<string>>, string> generateFileInput(int count, string fieldDelimiter, bool hasWeights, bool hasPayloads)
@@ -65,9 +67,9 @@ namespace Lucene.Net.Search.Suggest
                 }
                 KeyValuePair<List<string>, string> entrySet = GenerateFileEntry(fieldDelimiter, (!hasPayloads && hasWeights) ? Random().nextBoolean() : hasWeights, hasPayload);
                 entries.Add(entrySet.Key);
-                sb.append(entrySet.Value);
+                sb.Append(entrySet.Value);
             }
-            return new KeyValuePair<List<List<string>>, string>(entries, sb.toString());
+            return new KeyValuePair<List<List<string>>, string>(entries, sb.ToString());
         }
 
         [Test]
@@ -198,7 +200,7 @@ namespace Lucene.Net.Search.Suggest
                 List<string> entry = entries[count];
                 assertTrue(entry.size() >= 2); // at least term and weight
                 assertEquals(entry[0], term.Utf8ToString());
-                assertEquals(long.Parse(entry[1]), inputIter.Weight);
+                assertEquals(long.Parse(entry[1], CultureInfo.InvariantCulture), inputIter.Weight);
                 if (entry.size() == 3)
                 {
                     assertEquals(entry[2], inputIter.Payload.Utf8ToString());


[lucenenet] 20/42: Lucene.Net.Analysis.SmartCn: Corrected casing of folder paths on bigramdict.mem, coredict.mem, and package.md (xplat problem)

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit f69977cb3c672f30a3f745fee49d7b243986c38b
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Sat Aug 3 03:14:23 2019 +0700

    Lucene.Net.Analysis.SmartCn: Corrected casing of folder paths on bigramdict.mem, coredict.mem, and package.md (xplat problem)
---
 .../{HHMM => Hhmm}/bigramdict.mem                           | Bin
 src/Lucene.Net.Analysis.SmartCn/{HHMM => Hhmm}/coredict.mem | Bin
 src/Lucene.Net.Analysis.SmartCn/{HHMM => Hhmm}/package.md   |   0
 3 files changed, 0 insertions(+), 0 deletions(-)

diff --git a/src/Lucene.Net.Analysis.SmartCn/HHMM/bigramdict.mem b/src/Lucene.Net.Analysis.SmartCn/Hhmm/bigramdict.mem
similarity index 100%
rename from src/Lucene.Net.Analysis.SmartCn/HHMM/bigramdict.mem
rename to src/Lucene.Net.Analysis.SmartCn/Hhmm/bigramdict.mem
diff --git a/src/Lucene.Net.Analysis.SmartCn/HHMM/coredict.mem b/src/Lucene.Net.Analysis.SmartCn/Hhmm/coredict.mem
similarity index 100%
rename from src/Lucene.Net.Analysis.SmartCn/HHMM/coredict.mem
rename to src/Lucene.Net.Analysis.SmartCn/Hhmm/coredict.mem
diff --git a/src/Lucene.Net.Analysis.SmartCn/HHMM/package.md b/src/Lucene.Net.Analysis.SmartCn/Hhmm/package.md
similarity index 100%
rename from src/Lucene.Net.Analysis.SmartCn/HHMM/package.md
rename to src/Lucene.Net.Analysis.SmartCn/Hhmm/package.md


[lucenenet] 06/42: Created azure-pipelines.yml for Azure DevOps

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit 9f3fb72eb8678cd5e41326e4f26b6c83a928bc59
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Sun Jul 14 02:12:20 2019 +0700

    Created azure-pipelines.yml for Azure DevOps
---
 Directory.Build.props                              |  10 +
 Directory.Build.targets                            |  27 ++
 Lucene.Net.sln                                     |  10 +-
 azure-pipelines.yml                                | 377 +++++++++++++++++++++
 build/Dependencies.props                           |  20 ++
 build/TestReferences.Common.targets                |  20 ++
 build/azure-templates/publish-nuget-packages.yml   |  64 ++++
 .../publish-test-results-for-target-frameworks.yml |  67 ++++
 .../publish-test-results-for-test-projects.yml     | 282 +++++++++++++++
 build/azure-templates/publish-test-results.yml     |  81 +++++
 build/azure-templates/run-tests-on-os.yml          | 211 ++++++++++++
 .../show-all-environment-variables.yml             |  28 ++
 build/azure-templates/show-all-files.yml           |  26 ++
 build/build.ps1                                    | 314 ++++++++++++-----
 .../Analysis/Th/TestThaiAnalyzer.cs                |  42 +++
 15 files changed, 1496 insertions(+), 83 deletions(-)

diff --git a/Directory.Build.props b/Directory.Build.props
index 31f0f94..16f9c18 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -37,6 +37,9 @@
 
   <PropertyGroup Label="NuGet Package Defaults">
     <IsPackable>false</IsPackable>
+    <IncludeSymbols>true</IncludeSymbols>
+    <!-- This is the new symbols format (the only one currently supported at NuGet.org) -->
+    <SymbolPackageFormat>snupkg</SymbolPackageFormat>
   </PropertyGroup>
   
   <PropertyGroup Label="Copyright Info">
@@ -48,4 +51,11 @@
     <CopyrightYearRange Condition=" '$(BeginCopyrightYear)' == '$(CurrentYear)' ">$(CurrentYear)</CopyrightYearRange>
     <Copyright>Copyright © $(CopyrightYearRange) $(Company)</Copyright>
   </PropertyGroup>
+
+  <!-- Settings to override the above Version of Builds. These can be used to 
+      "freeze" the build number for a release, so whether building within 
+      an IDE or from the commmand line, the version is always what is 
+      in Version.props, if it exists and the PrepareForBuild argument 
+      passed into build.ps1 is 'false'. -->
+  <Import Project="Version.props" Condition="Exists('Version.props')" />
 </Project>
\ No newline at end of file
diff --git a/Directory.Build.targets b/Directory.Build.targets
new file mode 100644
index 0000000..04e1c76
--- /dev/null
+++ b/Directory.Build.targets
@@ -0,0 +1,27 @@
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<Project>
+  <PropertyGroup>
+    <!-- NuGet.org only supports portable debug symbol format: 
+         https://docs.microsoft.com/en-us/nuget/create-packages/symbol-packages-snupkg#nugetorg-symbol-package-constraints -->
+    <DebugType Condition=" '$(PortableDebugTypeOnly)' == 'true' ">portable</DebugType>
+  </PropertyGroup>
+</Project>
\ No newline at end of file
diff --git a/Lucene.Net.sln b/Lucene.Net.sln
index 904843e..bde08f5 100644
--- a/Lucene.Net.sln
+++ b/Lucene.Net.sln
@@ -1,4 +1,3 @@
-
 Microsoft Visual Studio Solution File, Format Version 12.00
 # Visual Studio 15
 
@@ -30,6 +29,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "azure-templates", "azure-te
 		build\azure-templates\run-tests-on-os.yml = build\azure-templates\run-tests-on-os.yml
 		build\azure-templates\show-all-environment-variables.yml = build\azure-templates\show-all-environment-variables.yml
 		build\azure-templates\show-all-files.yml = build\azure-templates\show-all-files.yml
+		build\azure-templates\publish-test-results.yml = build\azure-templates\publish-test-results.yml
+		build\azure-templates\publish-test-results-for-target-frameworks.yml = build\azure-templates\publish-test-results-for-target-frameworks.yml
+		build\azure-templates\publish-test-results-for-test-projects.yml = build\azure-templates\publish-test-results-for-test-projects.yml
+		build\azure-templates\run-tests-on-os.yml = build\azure-templates\run-tests-on-os.yml
+		build\azure-templates\show-all-environment-variables.yml = build\azure-templates\show-all-environment-variables.yml
+		build\azure-templates\show-all-files.yml = build\azure-templates\show-all-files.yml
 	EndProjectSection
 EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "dotnet", "dotnet", "{8CA61D33-3590-4024-A304-7B1F75B50653}"
@@ -39,6 +44,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "dotnet", "dotnet", "{8CA61D
 EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{4016BDAB-6C33-4D1E-9439-57B416EA45D5}"
 	ProjectSection(SolutionItems) = preProject
+		azure-pipelines.yml = azure-pipelines.yml
 		build.bat = build.bat
 		build\build.ps1 = build\build.ps1
 		build\Dependencies.props = build\Dependencies.props
@@ -64,6 +70,7 @@ EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{4DF0A2A1-B9C7-4EE5-BAF0-BEEF53E34220}"
 	ProjectSection(SolutionItems) = preProject
 		Directory.Build.props = Directory.Build.props
+		Directory.Build.targets = Directory.Build.targets
 	EndProjectSection
 EndProject
 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Lucene.Net", "src\Lucene.Net\Lucene.Net.csproj", "{3A0AA37E-2B7B-4416-B528-DA4E0E6A6706}"
@@ -401,6 +408,7 @@ Global
 		HideSolutionNode = FALSE
 	EndGlobalSection
 	GlobalSection(NestedProjects) = preSolution
+		{05CE3A39-40D4-452D-AFE0-E57E536A08C6} = {4016BDAB-6C33-4D1E-9439-57B416EA45D5}
 		{4DF7EACE-2B25-43F6-B558-8520BF20BD76} = {8CA61D33-3590-4024-A304-7B1F75B50653}
 		{EFB2E31A-5917-49D5-A808-FE5061A550B4} = {8CA61D33-3590-4024-A304-7B1F75B50653}
 		{119BBACD-D4DB-4E3B-922F-3DA83E0B29E2} = {4DF7EACE-2B25-43F6-B558-8520BF20BD76}
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
new file mode 100644
index 0000000..48ddfaf
--- /dev/null
+++ b/azure-pipelines.yml
@@ -0,0 +1,377 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+#   http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+name: 'vNext$(rev:.r)' # Format for build number (will be overridden)
+
+# DevOps Setup: Define the following pipeline level variables in Azure DevOps build pipeline
+#
+# ArtifactFeedID: (Optional - set to your Azure DevOps Artifact (NuGet) feed. If not provided, publish job will be skipped.)
+# BuildConfiguration: (Optional. Defaults to 'Release')
+# BuildPlatform: (Optional. Defaults to 'Any CPU')
+# IsRelease: (Optional. By default the Release job is disabled, setting this to 'true' will enable it)
+# RunTests: 'true' (Optional - set to 'false' to disable test jobs - useful for debugging. If not provided, tests will be run.)
+
+# Versioning Variables
+
+# BuildCounterSeed: (Optional - Set in conjunction with VersionSuffix, will cause the build counter to begin at this value. Note that it is set once, to reset is an API call.)
+# PackageVersion: (Optional - This can be used to explicitly set the whole version number to a specific version, i.e. 4.8.0-beta00005. It overrides all other version settings.)
+# PreReleaseCounterPattern: (Optional. Set to '0000000000' in ci pipeline or '00000' in release pipeline. The default is '0000000000'. This setting has no effect if VersionSuffix is ''.)
+# VersionSuffix: (Optional. Defaults to 'ci'. Set to 'beta' or 'rc' or '' in production pipeline.)
+
+variables:
+- name: BuildCounter
+  value: $[counter(variables['VersionSuffix'],coalesce(variables['BuildCounterSeed'], 1250))]
+- name: BinaryArtifactName
+  value: 'testbinaries'
+- name: NuGetArtifactName
+  value: 'nuget'
+- name: ReleaseArtifactName
+  value: 'release'
+- name: TestResultsArtifactName
+  value: 'testresults'
+- name: VersionArtifactName
+  value: 'version'
+- name: BuildNumberFileName
+  value: 'buildNumber.txt'
+- name: PackageVersionFileName
+  value: 'packageVersion.txt'
+- name: FileVersionFileName
+  value: 'fileVersion.txt'
+- name: BuildDirectory # Where the build scripts and configs are
+  value: '$(System.DefaultWorkingDirectory)/build'
+- name: PublishDirectory # Test binaries directory
+  value: '$(Build.ArtifactStagingDirectory)/$(BinaryArtifactName)'
+- name: NuGetArtifactDirectory # NuGet binaries directory
+  value: '$(Build.ArtifactStagingDirectory)/$(NuGetArtifactName)'
+- name: PublishedArtifactZipFileName
+  value: 'published.zip'
+
+stages:
+- stage: Build_Stage
+  displayName: 'Build Stage:'
+  jobs:
+
+  - job: Build
+    pool:
+      vmImage: 'windows-2019'
+
+    variables:
+      PublishTempDirectory: '$(Build.BinariesDirectory)/publish'
+
+    steps:
+    - powershell: |
+        $configuration = if ($env:BUILDCONFIGURATION) { $env:BUILDCONFIGURATION } else { "Release" }
+        Write-Host "##vso[task.setvariable variable=BuildConfiguration;]$configuration"
+      displayName: 'Setup Default Variable Values'
+
+    - task: DotNetCoreInstaller@0
+      displayName: 'Use .NET Core sdk 2.2.300'
+      inputs:
+        version: 2.2.300
+
+    - powershell: |
+        Import-Module "$(BuildDirectory)/psake.psm1"
+        $generateBuildBat = if ($Env:ISRELEASE -eq 'true') { 'true' } else { 'false' }
+        $parameters = @{}
+        $properties = @{
+            backup_files='false';
+            publish_directory='$(PublishTempDirectory)';
+            nuget_package_directory='$(NuGetArtifactDirectory)'
+            # Lock the build.bat so it only builds this version in the release distribution
+            generateBuildBat=$generateBuildBat
+        }
+        [string[]]$tasks = 'Pack'
+        if ($Env:RunTests -ne 'false') {
+            [string[]]$tasks = 'Pack','Publish'
+        }
+        Invoke-psake $(BuildDirectory)/build.ps1 -Task $tasks -properties $properties -parameters $parameters
+        exit !($psake.build_success)
+      displayName: 'PSake Build, Pack, and Publish'
+
+    - template: 'build/azure-templates/show-all-environment-variables.yml'
+
+    - task: ArchiveFiles@2
+      displayName: 'Zip $(PublishTempDirectory)'
+      inputs:
+        rootFolderOrFile: '$(PublishTempDirectory)'
+        includeRootFolder: false
+        archiveFile: '$(PublishDirectory)/$(PublishedArtifactZipFileName)'
+      condition: and(succeeded(), ne(variables['RunTests'], 'false'))
+
+    - powershell: |
+        $dir = '$(Build.ArtifactStagingDirectory)/$(VersionArtifactName)'
+        if (!(Test-Path $dir)) { New-Item -ItemType Directory -Path "$dir" -Force }
+        '$(PackageVersion)' | Out-File -FilePath "$dir/$(PackageVersionFileName)" -Force
+        '$(FileVersion)' | Out-File -FilePath "$dir/$(FileVersionFileName)" -Force
+        '$(Build.BuildNumber)' | Out-File -FilePath "$dir/$(BuildNumberFileName)" -Force
+      displayName: 'Write Versions to Files'
+
+    # If this is a release pipeline, copy the build.bat and Version.props files as version artifacts, which will 
+    # overwrite the build.bat and Version.props files of the release.
+    - task: CopyFiles@2
+      displayName: 'Copy build.bat and Version.props Files to: /$(VersionArtifactName)'
+      inputs:
+        SourceFolder: '$(System.DefaultWorkingDirectory)'
+        Contents: |
+          build.bat
+          Version.props
+        TargetFolder: '$(Build.ArtifactStagingDirectory)/$(VersionArtifactName)'
+      condition: and(succeeded(), eq(variables['IsRelease'], 'true'))
+
+    - task: PublishBuildArtifacts@1
+      displayName: 'Publish Artifact: $(VersionArtifactName)'
+      inputs:
+        PathtoPublish: '$(Build.ArtifactStagingDirectory)/$(VersionArtifactName)'
+        ArtifactName: '$(VersionArtifactName)'
+
+    # Copy the .pdb files as build artifacts, which will 
+    # later be used to push to the Azure Artifacts symbol server.
+    - task: CopyFiles@2
+      displayName: 'Copy .pdb Files to: /$(NuGetArtifactName)'
+      inputs:
+        SourceFolder: '$(System.DefaultWorkingDirectory)'
+        Contents: '**/bin/$(BuildConfiguration)/**/*.pdb'
+        TargetFolder: '$(Build.ArtifactStagingDirectory)/$(NuGetArtifactName)'
+
+    - task: PublishBuildArtifacts@1
+      displayName: 'Publish Artifact: $(BinaryArtifactName)'
+      inputs:
+        PathtoPublish: '$(Build.ArtifactStagingDirectory)/$(BinaryArtifactName)'
+        ArtifactName: '$(BinaryArtifactName)'
+      condition: and(succeeded(), ne(variables['RunTests'], 'false'))
+
+    - task: PublishBuildArtifacts@1
+      displayName: 'Publish Artifact: $(NuGetArtifactName)'
+      inputs:
+        PathtoPublish: '$(Build.ArtifactStagingDirectory)/$(NuGetArtifactName)'
+        ArtifactName: '$(NuGetArtifactName)'
+
+
+- stage: Test_Stage
+  displayName: 'Test Stage:'
+  jobs:
+  - job: Test_netcoreapp2_1
+    condition: and(succeeded(), ne(variables['RunTests'], 'false'))
+    strategy:
+      matrix:
+        Windows:
+          osName: 'Windows'
+          imageName: 'windows-2019'
+          maximumAllowedFailures: 4 # Maximum allowed failures for a successful build
+        Linux:
+          osName: 'Linux'
+          imageName: 'ubuntu-16.04'
+          maximumAllowedFailures: 30 # Maximum allowed failures for a successful build
+        macOS:
+          osName: 'macOS'
+          imageName: 'macOS-10.14'
+          maximumAllowedFailures: 30 # Maximum allowed failures for a successful build
+    displayName: 'Test netcoreapp2.1 on'
+    pool:
+      vmImage: $(imageName)
+    steps:
+    - template: 'build/azure-templates/run-tests-on-os.yml'
+      parameters:
+        osName: $(osName)
+        testTargetFrameworks: 'netcoreapp2.1'
+        testResultsArtifactName: '$(TestResultsArtifactName)'
+        publishedArtifactZipFileName: '$(PublishedArtifactZipFileName)'
+        maximumParallelJobs: 8
+        maximumAllowedFailures: $(maximumAllowedFailures)
+
+  - job: Test_netcoreapp1_0
+    condition: and(succeeded(), ne(variables['RunTests'], 'false'))
+    strategy:
+      matrix:
+        Windows:
+          osName: 'Windows'
+          imageName: 'windows-2019'
+          maximumAllowedFailures: 4 # Maximum allowed failures for a successful build
+        Linux:
+          osName: 'Linux'
+          imageName: 'ubuntu-16.04'
+          maximumAllowedFailures: 30 # Maximum allowed failures for a successful build
+        macOS:
+          osName: 'macOS'
+          imageName: 'macOS-10.14'
+          maximumAllowedFailures: 30 # Maximum allowed failures for a successful build
+    displayName: 'Test netcoreapp1.0 on'
+    pool:
+      vmImage: $(imageName)
+    steps:
+    - template: 'build/azure-templates/run-tests-on-os.yml'
+      parameters:
+        osName: $(osName)
+        testTargetFrameworks: 'netcoreapp1.0'
+        testResultsArtifactName: '$(TestResultsArtifactName)'
+        publishedArtifactZipFileName: '$(PublishedArtifactZipFileName)'
+        maximumParallelJobs: 8
+        maximumAllowedFailures: $(maximumAllowedFailures)
+
+  - job: Test_net451
+    condition: and(succeeded(), ne(variables['RunTests'], 'false'))
+    displayName: 'Test net451 on Windows'
+    pool:
+      vmImage: 'windows-2019'
+    steps:
+    - template: 'build/azure-templates/run-tests-on-os.yml'
+      parameters:
+        osName: 'Windows'
+        testTargetFrameworks: 'net451'
+        testResultsArtifactName: '$(TestResultsArtifactName)'
+        publishedArtifactZipFileName: '$(PublishedArtifactZipFileName)'
+        maximumParallelJobs: 8
+        maximumAllowedFailures: 4 # Maximum allowed failures for a successful build
+
+
+- stage: Publish_Stage
+  displayName: 'Publish Stage:'
+  jobs:
+
+  # Optional job to push to Azure Artifact feed. Just pass in
+  # the GUID of the artifact feed as ArtifactFeedID to enable.
+  - job: Publish_Azure_Artifacts
+    condition: and(succeeded(), ne(variables['ArtifactFeedID'], ''))
+    pool:
+      vmImage: 'windows-2019'
+
+    steps:
+    - template: 'build/azure-templates/show-all-environment-variables.yml'
+
+    - task: DownloadBuildArtifacts@0
+      displayName: 'Download Build Artifacts: $(VersionArtifactName)'
+      inputs:
+        artifactName: '$(VersionArtifactName)'
+        downloadPath: '$(Build.ArtifactStagingDirectory)'
+
+      # NOTE: We are setting Build.BuildNumber here to the NuGet package version to work around the limitation that
+      # the version cannot be passed to the Index Sources & Publish Symbols task.
+    - powershell: |
+        $version = Get-Content '$(Build.ArtifactStagingDirectory)/$(VersionArtifactName)/$(PackageVersionFileName)' -Raw
+        Write-Host "##vso[task.setvariable variable=PackageVersion;]$version"
+        Write-Host "##vso[task.setvariable variable=Build.BuildNumber;]$version"
+      displayName: 'Read PackageVersion from File to Build.BuildNumber'
+
+    - template: 'build/azure-templates/show-all-environment-variables.yml'
+
+    - template: 'build/azure-templates/publish-nuget-packages.yml'
+      parameters:
+        artifactFeedID: '$(ArtifactFeedID)'
+        nugetArtifactName: '$(NuGetArtifactName)'
+
+
+- stage: Release_Stage
+  displayName: 'Release Stage:'
+  jobs:
+  - job: Release
+    condition: and(succeeded(), eq(variables['IsRelease'], 'true'))
+    displayName: 'Build Release Artifacts for [VOTE]'
+    pool:
+      vmImage: 'windows-2019'
+
+    steps:
+    - template: 'build/azure-templates/show-all-environment-variables.yml'
+
+    - task: DownloadBuildArtifacts@0
+      displayName: 'Download Build Artifacts: $(NuGetArtifactName)'
+      inputs:
+        artifactName: '$(NuGetArtifactName)'
+        downloadPath: '$(Build.ArtifactStagingDirectory)'
+
+    - task: DownloadBuildArtifacts@0
+      displayName: 'Download Build Artifacts: $(VersionArtifactName)'
+      inputs:
+        artifactName: '$(VersionArtifactName)'
+        downloadPath: '$(Build.ArtifactStagingDirectory)'
+
+    - template: 'build/azure-templates/show-all-files.yml' # Uncomment for debugging
+
+      # NOTE: We are setting Build.BuildNumber here to the NuGet package version to work around the limitation that
+      # the version cannot be passed to the Index Sources & Publish Symbols task.
+    - powershell: |
+        $version = Get-Content '$(Build.ArtifactStagingDirectory)/$(VersionArtifactName)/$(PackageVersionFileName)' -Raw
+        $vcsLabel = 'Lucene.Net_' + $version.Replace('.', '_').Replace('-', '_')
+        Write-Host "##vso[task.setvariable variable=VCSLabel;]$vcsLabel"
+        Write-Host "##vso[task.setvariable variable=PackageVersion;]$version"
+        Write-Host "##vso[task.setvariable variable=Build.BuildNumber;]$version"
+      displayName: 'Build VCS Label and Rehydrate Version Variables'
+
+    - powershell: |
+        $files = 'build.bat','Version.props'
+        foreach ($file in $files) {
+            Copy-Item -Path "$(Build.ArtifactStagingDirectory)/$(VersionArtifactName)/$file" -Destination "$(Build.SourcesDirectory)/$file" -Force -ErrorAction Continue
+        }
+      displayName: 'Update build.bat and Version.props to build only version $(PackageVersion)'
+
+    - template: 'build/azure-templates/show-all-environment-variables.yml'
+
+    - task: CopyFiles@2
+      displayName: 'Copy Source Code Files to: $(Build.ArtifactStagingDirectory)/srctemp'
+      inputs:
+        SourceFolder: '$(Build.SourcesDirectory)'
+        Contents: |
+         **
+         !.git/**/*
+         !branding/**/*
+         !release/**/*
+         !src/**/bin/**/*
+         !src/**/obj/**/*
+        TargetFolder: '$(Build.ArtifactStagingDirectory)/srctemp'
+
+    - task: ArchiveFiles@2
+      displayName: 'Archive Source Code Files'
+      inputs:
+        rootFolderOrFile: '$(Build.ArtifactStagingDirectory)/srctemp'
+        includeRootFolder: false
+        archiveFile: '$(Build.ArtifactStagingDirectory)/$(ReleaseArtifactName)/Apache-Lucene.Net-$(PackageVersion).src.zip'
+
+    - task: CopyFiles@2
+      displayName: 'Copy License/Notice Files to: $(Build.ArtifactStagingDirectory)/$(NuGetArtifactName)'
+      inputs:
+        SourceFolder: '$(Build.SourcesDirectory)'
+        Contents: |
+         LICENSE.txt
+         NOTICE.txt
+        TargetFolder: '$(Build.ArtifactStagingDirectory)/$(NuGetArtifactName)'
+
+    - task: ArchiveFiles@2
+      displayName: 'Archive Binary Files'
+      inputs:
+        rootFolderOrFile: '$(Build.ArtifactStagingDirectory)/$(NuGetArtifactName)'
+        includeRootFolder: false
+        archiveFile: '$(Build.ArtifactStagingDirectory)/$(ReleaseArtifactName)/Apache-Lucene.Net-$(PackageVersion).bin.zip'
+
+    - powershell: |
+        $dir = '$(Build.ArtifactStagingDirectory)/$(ReleaseArtifactName)'
+        if (!(Test-Path $dir)) { New-Item -ItemType Directory -Path "$dir" -Force }
+        $nl = [Environment]::NewLine
+        "TODO: Review: http://www.apache.org/legal/release-policy.html" + $nl + `
+        "TODO: Tag Repository" + $nl + `
+        "  commit: $(Build.SourceVersion)" + $nl + `
+        "  tag: $(VCSLabel)" + $nl + `
+        "TODO: Sign release artifacts (see https://www.apache.org/dev/release-signing.html)" + $nl + `
+        "TODO: Push release artifacts to dev (https://dist.apache.org/repos/dist/dev/lucenenet/)" + $nl + `
+        "TODO: Start release [VOTE] (see https://www.apache.org/foundation/voting.html)" + $nl | Out-File -FilePath "$dir/RELEASE-TODO.txt" -Force
+      displayName: 'Write RELEASE-TODO.txt'
+
+    - task: PublishBuildArtifacts@1
+      displayName: 'Publish Artifact: $(ReleaseArtifactName)'
+      inputs:
+        PathtoPublish: '$(Build.ArtifactStagingDirectory)/$(ReleaseArtifactName)'
+        ArtifactName: '$(ReleaseArtifactName)'
+
+# LUCENENET TODO: Write VCS Label (git tag) automatically
\ No newline at end of file
diff --git a/build/Dependencies.props b/build/Dependencies.props
index 4e20f0b..b46153b 100644
--- a/build/Dependencies.props
+++ b/build/Dependencies.props
@@ -1,3 +1,23 @@
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
 <Project> 
   <PropertyGroup Label="NuGet Package Reference Versions">
     <Antlr3RuntimePackageVersion>3.5.1</Antlr3RuntimePackageVersion>
diff --git a/build/TestReferences.Common.targets b/build/TestReferences.Common.targets
index b2986a6..6411a7b 100644
--- a/build/TestReferences.Common.targets
+++ b/build/TestReferences.Common.targets
@@ -1,3 +1,23 @@
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
 <Project>
   <ItemGroup Label="Test Project Common References">
     <PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftNETTestSdkPackageVersion)" />
diff --git a/build/azure-templates/publish-nuget-packages.yml b/build/azure-templates/publish-nuget-packages.yml
new file mode 100644
index 0000000..7d5ab61
--- /dev/null
+++ b/build/azure-templates/publish-nuget-packages.yml
@@ -0,0 +1,64 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+#   http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Downloads an artifact with the specified nugetArtifactName,
+# pushes any .nupkg files to the specified artifactFeedID,
+# and pushes any debugging symbols (.pdb files) in the artifact
+# (except for those named *.Tests.pdb) to TeamServices.
+
+parameters:
+  nugetArtifactName: 'nuget' # The name of the artifact where the NuGet assets (.nupkg and .pdb files) can be downloaded
+  artifactFeedID: '' # The GUID of the Azure Artifacts NuGet feed
+  testSymbolFilesConvention: '**/*.Tests*.pdb' # The glob pattern (within the nugetArtifact) where to look for test project symbols (.pdb) files, so they can be distinguished from other project file types.
+
+steps:
+- powershell: |
+    function EnsureNotNullOrEmpty([string]$param, [string]$nameOfParam) {
+        if ([string]::IsNullOrEmpty($param)) {
+            Write-Host "##vso[task.logissue type=error;]Missing template parameter \"$nameOfParam\""
+            Write-Host "##vso[task.complete result=Failed;]"
+        }
+    }
+    EnsureNotNullOrEmpty('${{ parameters.nugetArtifactName }}', 'nugetArtifactName')
+    EnsureNotNullOrEmpty('${{ parameters.artifactFeedID }}', 'artifactFeedID')
+    EnsureNotNullOrEmpty('${{ parameters.testSymbolFilesConvention }}', 'testSymbolFilesConvention')
+  displayName: 'Validate Template Parameters'
+
+- task: DownloadBuildArtifacts@0
+  displayName: 'Download Build Artifacts: ${{ parameters.nugetArtifactName }}'
+  inputs:
+    artifactName: ${{ parameters.nugetArtifactName }}
+    downloadPath: '$(Build.ArtifactStagingDirectory)'
+
+- task: NuGetCommand@2
+  displayName: 'NuGet push'
+  inputs:
+    command: push
+    packagesToPush: '$(Build.ArtifactStagingDirectory)/${{ parameters.nugetArtifactName }}/**/*.nupkg;!$(Build.ArtifactStagingDirectory)/${{ parameters.nugetArtifactName }}/**/*.symbols.nupkg'
+    publishVstsFeed: '/${{ parameters.artifactFeedID }}'
+    allowPackageConflicts: true
+
+- task: PublishSymbols@2
+  displayName: 'Publish symbols path'
+  inputs:
+    SymbolsFolder: '$(Build.ArtifactStagingDirectory)/${{ parameters.nugetArtifactName }}'
+    SearchPattern: |
+      **/bin/**/*.pdb
+      !${{ parameters.testSymbolFilesConvention }}
+    IndexSources: true
+    PublishSymbols: true
+    SymbolServerType: TeamServices
\ No newline at end of file
diff --git a/build/azure-templates/publish-test-results-for-target-frameworks.yml b/build/azure-templates/publish-test-results-for-target-frameworks.yml
new file mode 100644
index 0000000..cc3af4f
--- /dev/null
+++ b/build/azure-templates/publish-test-results-for-target-frameworks.yml
@@ -0,0 +1,67 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+#   http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Runs Publish Test Results task for a specific framework
+
+parameters:
+  testProjectName: '' # The name of the test project
+  osName: '' # The name of the operating system for display purposes.
+  testResultsFormat: VSTest # Specify the format of the results files you want to publish. The following formats are supported: JUnit, NUnit, VSTest, XUnit, CTest
+  testResultsArtifactName: 'testresults' # The name of the Azure DevOps build artifact where the test results will be published. Default 'testresults'.
+  testResultsFileName: 'TestResults.trx' # The name of the file (not path) of the test results. Default 'TestResults.trx'.
+
+steps:
+- powershell: |
+    function EnsureNotNullOrEmpty([string]$param, [string]$nameOfParam) {
+        if ([string]::IsNullOrEmpty($param)) {
+            Write-Host "##vso[task.logissue type=error;]Missing template parameter \"$nameOfParam\""
+            Write-Host "##vso[task.complete result=Failed;]"
+        }
+    }
+    EnsureNotNullOrEmpty('${{ parameters.testProjectName }}', 'testProjectName')
+    EnsureNotNullOrEmpty('${{ parameters.osName }}', 'osName')
+    EnsureNotNullOrEmpty('${{ parameters.testResultsFormat }}', 'testResultsFormat')
+    EnsureNotNullOrEmpty('${{ parameters.testResultsArtifactName }}', 'testResultsArtifactName')
+    EnsureNotNullOrEmpty('${{ parameters.testResultsFileName }}', 'testResultsFileName')
+  displayName: 'Validate Template Parameters'
+
+- template: publish-test-results.yml
+  parameters:
+    framework: 'netcoreapp2.1'
+    testProjectName: '${{ parameters.testProjectName }}'
+    osName: '${{ parameters.osName }}'
+    testResultsFormat: '${{ parameters.testResultsFormat }}'
+    testResultsArtifactName: '${{ parameters.testResultsArtifactName }}'
+    testResultsFileName: '${{ parameters.testResultsFileName }}'
+
+- template: publish-test-results.yml
+  parameters:
+    framework: 'netcoreapp1.0'
+    testProjectName: '${{ parameters.testProjectName }}'
+    osName: '${{ parameters.osName }}'
+    testResultsFormat: '${{ parameters.testResultsFormat }}'
+    testResultsArtifactName: '${{ parameters.testResultsArtifactName }}'
+    testResultsFileName: '${{ parameters.testResultsFileName }}'
+
+- template: publish-test-results.yml
+  parameters:
+    framework: 'net451'
+    testProjectName: '${{ parameters.testProjectName }}'
+    osName: '${{ parameters.osName }}'
+    testResultsFormat: '${{ parameters.testResultsFormat }}'
+    testResultsArtifactName: '${{ parameters.testResultsArtifactName }}'
+    testResultsFileName: '${{ parameters.testResultsFileName }}'
\ No newline at end of file
diff --git a/build/azure-templates/publish-test-results-for-test-projects.yml b/build/azure-templates/publish-test-results-for-test-projects.yml
new file mode 100644
index 0000000..62db26f
--- /dev/null
+++ b/build/azure-templates/publish-test-results-for-test-projects.yml
@@ -0,0 +1,282 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+#   http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing,-with-title
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Runs Publish Test Results task for all Lucene.Net test projects
+
+# The tasks can be easily re-generated (except for any special cases) using the following powershell script
+
+#$source_directory = "F:/Projects/lucenenet" # Change to your repo location
+#
+#$testProjects = Get-ChildItem -Path "$source_directory/**/*.csproj" -Recurse | ? { $_.Directory.Name.Contains(".Tests") } | Sort-Object -Property FullName
+#
+#[string]$output = ''
+#
+#foreach ($testProject in $testProjects) {
+#    $projectName = [System.IO.Path]::GetFileNameWithoutExtension($testProject)
+#
+#    $block = `
+#        "- template: publish-test-results-for-target-frameworks.yml`n" + `
+#        "  parameters:`n" + `
+#        "    testProjectName: '$projectName'`n" + `
+#        "    osName: '$`{`{ parameters.osName `}`}'`n" + `
+#        "    testResultsFormat: '$`{`{ parameters.testResultsFormat `}`}'`n" + `
+#        "    testResultsArtifactName: '$`{`{ parameters.testResultsArtifactName `}`}'`n" + `
+#        "    testResultsFileName: '$`{`{ parameters.testResultsFileName `}`}'`n" + `
+#        "`n"
+#
+#    $output = "$output$block"
+#}
+#
+#Set-Clipboard -Value $output
+
+parameters:
+  osName: '' # The name of the operating system for display purposes.
+  testResultsFormat: VSTest # Specify the format of the results files you want to publish. The following formats are supported: JUnit, NUnit, VSTest, XUnit, CTest
+  testResultsArtifactName: 'testresults' # The name of the Azure DevOps build artifact where the test results will be published. Default 'testresults'.
+  testResultsFileName: 'TestResults.trx' # The name of the file (not path) of the test results. Default 'TestResults.trx'.
+
+steps:
+- powershell: |
+    function EnsureNotNullOrEmpty([string]$param, [string]$nameOfParam) {
+        if ([string]::IsNullOrEmpty($param)) {
+            Write-Host "##vso[task.logissue type=error;]Missing template parameter \"$nameOfParam\""
+            Write-Host "##vso[task.complete result=Failed;]"
+        }
+    }
+    EnsureNotNullOrEmpty('${{ parameters.osName }}', 'osName')
+    EnsureNotNullOrEmpty('${{ parameters.testResultsFormat }}', 'testResultsFormat')
+    EnsureNotNullOrEmpty('${{ parameters.testResultsArtifactName }}', 'testResultsArtifactName')
+    EnsureNotNullOrEmpty('${{ parameters.testResultsFileName }}', 'testResultsFileName')
+  displayName: 'Validate Template Parameters'
+
+- template: publish-test-results-for-target-frameworks.yml
+  parameters:
+    testProjectName: 'Lucene.Net.Tests.ICU'
+    osName: '${{ parameters.osName }}'
+    testResultsFormat: '${{ parameters.testResultsFormat }}'
+    testResultsArtifactName: '${{ parameters.testResultsArtifactName }}'
+    testResultsFileName: '${{ parameters.testResultsFileName }}'
+
+# Special case: Only supports .netcoreapp2.1
+- template: publish-test-results.yml
+  parameters:
+    framework: 'netcoreapp2.1'
+    testProjectName: 'Lucene.Net.Tests.Cli'
+    osName: '${{ parameters.osName }}'
+    testResultsFormat: '${{ parameters.testResultsFormat }}'
+    testResultsArtifactName: '${{ parameters.testResultsArtifactName }}'
+    testResultsFileName: '${{ parameters.testResultsFileName }}'
+
+- template: publish-test-results-for-target-frameworks.yml
+  parameters:
+    testProjectName: 'Lucene.Net.Tests._A-I'
+    osName: '${{ parameters.osName }}'
+    testResultsFormat: '${{ parameters.testResultsFormat }}'
+    testResultsArtifactName: '${{ parameters.testResultsArtifactName }}'
+    testResultsFileName: '${{ parameters.testResultsFileName }}'
+
+- template: publish-test-results-for-target-frameworks.yml
+  parameters:
+    testProjectName: 'Lucene.Net.Tests._J-U'
+    osName: '${{ parameters.osName }}'
+    testResultsFormat: '${{ parameters.testResultsFormat }}'
+    testResultsArtifactName: '${{ parameters.testResultsArtifactName }}'
+    testResultsFileName: '${{ parameters.testResultsFileName }}'
+
+- template: publish-test-results-for-target-frameworks.yml
+  parameters:
+    testProjectName: 'Lucene.Net.Tests._U-Z'
+    osName: '${{ parameters.osName }}'
+    testResultsFormat: '${{ parameters.testResultsFormat }}'
+    testResultsArtifactName: '${{ parameters.testResultsArtifactName }}'
+    testResultsFileName: '${{ parameters.testResultsFileName }}'
+
+- template: publish-test-results-for-target-frameworks.yml
+  parameters:
+    testProjectName: 'Lucene.Net.Tests.Analysis.Common'
+    osName: '${{ parameters.osName }}'
+    testResultsFormat: '${{ parameters.testResultsFormat }}'
+    testResultsArtifactName: '${{ parameters.testResultsArtifactName }}'
+    testResultsFileName: '${{ parameters.testResultsFileName }}'
+
+- template: publish-test-results-for-target-frameworks.yml
+  parameters:
+    testProjectName: 'Lucene.Net.Tests.Analysis.Kuromoji'
+    osName: '${{ parameters.osName }}'
+    testResultsFormat: '${{ parameters.testResultsFormat }}'
+    testResultsArtifactName: '${{ parameters.testResultsArtifactName }}'
+    testResultsFileName: '${{ parameters.testResultsFileName }}'
+
+- template: publish-test-results-for-target-frameworks.yml
+  parameters:
+    testProjectName: 'Lucene.Net.Tests.Analysis.Phonetic'
+    osName: '${{ parameters.osName }}'
+    testResultsFormat: '${{ parameters.testResultsFormat }}'
+    testResultsArtifactName: '${{ parameters.testResultsArtifactName }}'
+    testResultsFileName: '${{ parameters.testResultsFileName }}'
+
+- template: publish-test-results-for-target-frameworks.yml
+  parameters:
+    testProjectName: 'Lucene.Net.Tests.Analysis.SmartCn'
+    osName: '${{ parameters.osName }}'
+    testResultsFormat: '${{ parameters.testResultsFormat }}'
+    testResultsArtifactName: '${{ parameters.testResultsArtifactName }}'
+    testResultsFileName: '${{ parameters.testResultsFileName }}'
+
+- template: publish-test-results-for-target-frameworks.yml
+  parameters:
+    testProjectName: 'Lucene.Net.Tests.Analysis.Stempel'
+    osName: '${{ parameters.osName }}'
+    testResultsFormat: '${{ parameters.testResultsFormat }}'
+    testResultsArtifactName: '${{ parameters.testResultsArtifactName }}'
+    testResultsFileName: '${{ parameters.testResultsFileName }}'
+
+- template: publish-test-results-for-target-frameworks.yml
+  parameters:
+    testProjectName: 'Lucene.Net.Tests.Benchmark'
+    osName: '${{ parameters.osName }}'
+    testResultsFormat: '${{ parameters.testResultsFormat }}'
+    testResultsArtifactName: '${{ parameters.testResultsArtifactName }}'
+    testResultsFileName: '${{ parameters.testResultsFileName }}'
+
+- template: publish-test-results-for-target-frameworks.yml
+  parameters:
+    testProjectName: 'Lucene.Net.Tests.Classification'
+    osName: '${{ parameters.osName }}'
+    testResultsFormat: '${{ parameters.testResultsFormat }}'
+    testResultsArtifactName: '${{ parameters.testResultsArtifactName }}'
+    testResultsFileName: '${{ parameters.testResultsFileName }}'
+
+- template: publish-test-results-for-target-frameworks.yml
+  parameters:
+    testProjectName: 'Lucene.Net.Tests.Codecs'
+    osName: '${{ parameters.osName }}'
+    testResultsFormat: '${{ parameters.testResultsFormat }}'
+    testResultsArtifactName: '${{ parameters.testResultsArtifactName }}'
+    testResultsFileName: '${{ parameters.testResultsFileName }}'
+
+- template: publish-test-results-for-target-frameworks.yml
+  parameters:
+    testProjectName: 'Lucene.Net.Tests.Demo'
+    osName: '${{ parameters.osName }}'
+    testResultsFormat: '${{ parameters.testResultsFormat }}'
+    testResultsArtifactName: '${{ parameters.testResultsArtifactName }}'
+    testResultsFileName: '${{ parameters.testResultsFileName }}'
+
+- template: publish-test-results-for-target-frameworks.yml
+  parameters:
+    testProjectName: 'Lucene.Net.Tests.Expressions'
+    osName: '${{ parameters.osName }}'
+    testResultsFormat: '${{ parameters.testResultsFormat }}'
+    testResultsArtifactName: '${{ parameters.testResultsArtifactName }}'
+    testResultsFileName: '${{ parameters.testResultsFileName }}'
+
+- template: publish-test-results-for-target-frameworks.yml
+  parameters:
+    testProjectName: 'Lucene.Net.Tests.Facet'
+    osName: '${{ parameters.osName }}'
+    testResultsFormat: '${{ parameters.testResultsFormat }}'
+    testResultsArtifactName: '${{ parameters.testResultsArtifactName }}'
+    testResultsFileName: '${{ parameters.testResultsFileName }}'
+
+- template: publish-test-results-for-target-frameworks.yml
+  parameters:
+    testProjectName: 'Lucene.Net.Tests.Grouping'
+    osName: '${{ parameters.osName }}'
+    testResultsFormat: '${{ parameters.testResultsFormat }}'
+    testResultsArtifactName: '${{ parameters.testResultsArtifactName }}'
+    testResultsFileName: '${{ parameters.testResultsFileName }}'
+
+- template: publish-test-results-for-target-frameworks.yml
+  parameters:
+    testProjectName: 'Lucene.Net.Tests.Highlighter'
+    osName: '${{ parameters.osName }}'
+    testResultsFormat: '${{ parameters.testResultsFormat }}'
+    testResultsArtifactName: '${{ parameters.testResultsArtifactName }}'
+    testResultsFileName: '${{ parameters.testResultsFileName }}'
+
+- template: publish-test-results-for-target-frameworks.yml
+  parameters:
+    testProjectName: 'Lucene.Net.Tests.Join'
+    osName: '${{ parameters.osName }}'
+    testResultsFormat: '${{ parameters.testResultsFormat }}'
+    testResultsArtifactName: '${{ parameters.testResultsArtifactName }}'
+    testResultsFileName: '${{ parameters.testResultsFileName }}'
+
+- template: publish-test-results-for-target-frameworks.yml
+  parameters:
+    testProjectName: 'Lucene.Net.Tests.Memory'
+    osName: '${{ parameters.osName }}'
+    testResultsFormat: '${{ parameters.testResultsFormat }}'
+    testResultsArtifactName: '${{ parameters.testResultsArtifactName }}'
+    testResultsFileName: '${{ parameters.testResultsFileName }}'
+
+- template: publish-test-results-for-target-frameworks.yml
+  parameters:
+    testProjectName: 'Lucene.Net.Tests.Misc'
+    osName: '${{ parameters.osName }}'
+    testResultsFormat: '${{ parameters.testResultsFormat }}'
+    testResultsArtifactName: '${{ parameters.testResultsArtifactName }}'
+    testResultsFileName: '${{ parameters.testResultsFileName }}'
+
+- template: publish-test-results-for-target-frameworks.yml
+  parameters:
+    testProjectName: 'Lucene.Net.Tests.Queries'
+    osName: '${{ parameters.osName }}'
+    testResultsFormat: '${{ parameters.testResultsFormat }}'
+    testResultsArtifactName: '${{ parameters.testResultsArtifactName }}'
+    testResultsFileName: '${{ parameters.testResultsFileName }}'
+
+- template: publish-test-results-for-target-frameworks.yml
+  parameters:
+    testProjectName: 'Lucene.Net.Tests.QueryParser'
+    osName: '${{ parameters.osName }}'
+    testResultsFormat: '${{ parameters.testResultsFormat }}'
+    testResultsArtifactName: '${{ parameters.testResultsArtifactName }}'
+    testResultsFileName: '${{ parameters.testResultsFileName }}'
+
+- template: publish-test-results-for-target-frameworks.yml
+  parameters:
+    testProjectName: 'Lucene.Net.Tests.Replicator'
+    osName: '${{ parameters.osName }}'
+    testResultsFormat: '${{ parameters.testResultsFormat }}'
+    testResultsArtifactName: '${{ parameters.testResultsArtifactName }}'
+    testResultsFileName: '${{ parameters.testResultsFileName }}'
+
+- template: publish-test-results-for-target-frameworks.yml
+  parameters:
+    testProjectName: 'Lucene.Net.Tests.Sandbox'
+    osName: '${{ parameters.osName }}'
+    testResultsFormat: '${{ parameters.testResultsFormat }}'
+    testResultsArtifactName: '${{ parameters.testResultsArtifactName }}'
+    testResultsFileName: '${{ parameters.testResultsFileName }}'
+
+- template: publish-test-results-for-target-frameworks.yml
+  parameters:
+    testProjectName: 'Lucene.Net.Tests.Spatial'
+    osName: '${{ parameters.osName }}'
+    testResultsFormat: '${{ parameters.testResultsFormat }}'
+    testResultsArtifactName: '${{ parameters.testResultsArtifactName }}'
+    testResultsFileName: '${{ parameters.testResultsFileName }}'
+
+- template: publish-test-results-for-target-frameworks.yml
+  parameters:
+    testProjectName: 'Lucene.Net.Tests.Suggest'
+    osName: '${{ parameters.osName }}'
+    testResultsFormat: '${{ parameters.testResultsFormat }}'
+    testResultsArtifactName: '${{ parameters.testResultsArtifactName }}'
+    testResultsFileName: '${{ parameters.testResultsFileName }}'
\ No newline at end of file
diff --git a/build/azure-templates/publish-test-results.yml b/build/azure-templates/publish-test-results.yml
new file mode 100644
index 0000000..b7c9d0a
--- /dev/null
+++ b/build/azure-templates/publish-test-results.yml
@@ -0,0 +1,81 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+#   http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Runs Publish Test Results task for a specific framework
+
+parameters:
+  testProjectName: '' # The name of the test project
+  framework: '' # The target framework for display purposes.
+  osName: '' # The name of the operating system for display purposes.
+  testResultsFormat: VSTest # Specify the format of the results files you want to publish. The following formats are supported: JUnit, NUnit, VSTest, XUnit, CTest
+  testResultsArtifactName: 'testresults' # The name of the Azure DevOps build artifact where the test results will be published. Default 'testresults'.
+  testResultsFileName: 'TestResults.trx' # The name of the file (not path) of the test results. Default 'TestResults.trx'.
+
+steps:
+- powershell: |
+    function EnsureNotNullOrEmpty([string]$param, [string]$nameOfParam) {
+        if ([string]::IsNullOrEmpty($param)) {
+            Write-Host "##vso[task.logissue type=error;]Missing template parameter \"$nameOfParam\""
+            Write-Host "##vso[task.complete result=Failed;]"
+        }
+    }
+    EnsureNotNullOrEmpty('${{ parameters.testProjectName }}', 'testProjectName')
+    EnsureNotNullOrEmpty('${{ parameters.framework }}', 'framework')
+    EnsureNotNullOrEmpty('${{ parameters.osName }}', 'osName')
+    EnsureNotNullOrEmpty('${{ parameters.testResultsFormat }}', 'testResultsFormat')
+    EnsureNotNullOrEmpty('${{ parameters.testResultsArtifactName }}', 'testResultsArtifactName')
+    EnsureNotNullOrEmpty('${{ parameters.testResultsFileName }}', 'testResultsFileName')
+  displayName: 'Validate Template Parameters'
+
+#- template: 'show-all-files.yml' # Uncomment for debugging
+
+- powershell: |
+    $testResultsFileName = "$(Build.ArtifactStagingDirectory)/${{ parameters.testResultsArtifactName }}/${{ parameters.osName }}/${{ parameters.framework }}/${{ parameters.testProjectName }}/${{ parameters.testResultsFileName }}"
+    $testResultsFileExists = Test-Path $testResultsFileName
+    if ($testResultsFileExists) {
+
+        $reader = [System.Xml.XmlReader]::Create($testResultsFileName)
+        try {
+            while ($reader.Read()) {
+                if ($reader.NodeType -eq [System.Xml.XmlNodeType]::Element -and $reader.Name -eq 'Counters') {
+                    $failed = $reader.GetAttribute('failed')
+                    $passed = $reader.GetAttribute('passed')
+                    $ignored = (([int]$reader.GetAttribute('total')) - ([int]$reader.GetAttribute('executed'))).ToString()
+                    $testResults = "Tests failed: $failed, passed: $passed, ignored: $ignored"
+                    Write-Host "##vso[task.setvariable variable=TestResults;]$testResults"
+                    # Report a running total of failures
+                    $totalFailures = ([int]$Env:TOTALFAILURES + [int]$failed).ToString()
+                    Write-Host "##vso[task.setvariable variable=TotalFailures;]$totalFailures"
+                    break;
+                }
+            }
+        } finally {
+            $reader.Dispose()
+        }
+    } else {
+        Write-Host "WARNING: File not found: $testResultsFileName"
+    }
+    Write-Host "##vso[task.setvariable variable=TestResultsFileExists;]$testResultsFileExists"      
+  displayName: 'Parse Test Results File'
+
+- task: PublishTestResults@2
+  displayName: 'Publish Test Results ${{ parameters.testProjectName }},${{ parameters.framework }}'
+  inputs:
+    testResultsFormat: ${{ parameters.testResultsFormat }}
+    testResultsFiles: '$(Build.ArtifactStagingDirectory)/${{ parameters.testResultsArtifactName }}/${{ parameters.osName }}/${{ parameters.framework }}/${{ parameters.testProjectName }}/${{ parameters.testResultsFileName }}'
+    testRunTitle: '${{ parameters.testProjectName }} - ${{ parameters.framework }} - ${{ parameters.osName }} | $(TestResults)'
+  condition: and(succeeded(), eq(variables['TestResultsFileExists'], 'true'))
\ No newline at end of file
diff --git a/build/azure-templates/run-tests-on-os.yml b/build/azure-templates/run-tests-on-os.yml
new file mode 100644
index 0000000..e9e605e
--- /dev/null
+++ b/build/azure-templates/run-tests-on-os.yml
@@ -0,0 +1,211 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+#   http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Downloads test binaries and executes tests using dotnet vstest,
+# runs the tests for each project on a background job in parallel,
+# then uploads the results to Azure DevOps pipelines
+
+parameters:
+  osName: 'Windows' # The name of the operating system for display purposes.
+  testTargetFrameworks: '' # A semicolon separated list of target frameworks indicating which frameworks tests will be run on. See: https://docs.microsoft.com/en-us/dotnet/standard/frameworks.
+  binaryArtifactName: 'testbinaries' # The name of the Azure DevOps build artifact where the test assemblies will be downloaded from. Default 'testbinaries'.
+  testResultsArtifactName: 'testresults' # The name of the Azure DevOps build artifact where the test results will be published. Default 'testresults'.
+  vsTestPlatform: 'x64' # Target platform architecture used for test execution. Valid values are x86, x64, and ARM.
+  testBinaryFilesPattern: '\.*\.Tests\.?[^\\/]*?\.?[^\\/]*?.dll$' # The regex pattern (within $(System.DefaultWorkingDirectory)/**/<TargetFramework>/) where to look for test .dll files, so they can be distinguished from other .dll file types.
+  testResultsFileName: 'TestResults.trx' # The name of the file (not path) of the test results. Default 'TestResults.trx'.
+  publishedArtifactZipFileName: 'published.zip' # The name of the zip file (within the Azure DevOps build artifact binaryArtifactName) where the published test binaries can be extracted from. Default 'published.zip'.
+  maximumParallelJobs: 8
+  maximumAllowedFailures: 0
+
+steps:
+- powershell: |
+    function EnsureNotNullOrEmpty([string]$param, [string]$nameOfParam) {
+        if ([string]::IsNullOrEmpty($param)) {
+            Write-Host "##vso[task.logissue type=error;]Missing template parameter \"$nameOfParam\""
+            Write-Host "##vso[task.complete result=Failed;]"
+        }
+    }
+    EnsureNotNullOrEmpty('${{ parameters.osName }}', 'osName')
+    EnsureNotNullOrEmpty('${{ parameters.testTargetFrameworks }}', 'testTargetFrameworks')
+    EnsureNotNullOrEmpty('${{ parameters.binaryArtifactName }}', 'binaryArtifactName')
+    EnsureNotNullOrEmpty('${{ parameters.testResultsArtifactName }}', 'testResultsArtifactName')
+    EnsureNotNullOrEmpty('${{ parameters.vsTestPlatform }}', 'vsTestPlatform')
+    EnsureNotNullOrEmpty('${{ parameters.testBinaryFilesPattern }}', 'testBinaryFilesPattern')
+    EnsureNotNullOrEmpty('${{ parameters.testResultsFileName }}', 'testResultsFileName')
+    EnsureNotNullOrEmpty('${{ parameters.publishedArtifactZipFileName }}', 'publishedArtifactZipFileName')
+    EnsureNotNullOrEmpty('${{ parameters.maximumParallelJobs }}', 'maximumParallelJobs')
+    EnsureNotNullOrEmpty('${{ parameters.maximumAllowedFailures }}', 'maximumAllowedFailures')
+  displayName: 'Validate Template Parameters'
+
+- task: DownloadBuildArtifacts@0
+  displayName: 'Download Build Artifacts: ${{ parameters.binaryArtifactName }}'
+  inputs:
+    artifactName: ${{ parameters.binaryArtifactName }}
+    downloadPath: '$(System.DefaultWorkingDirectory)'
+
+#- template: 'show-all-files.yml' # Uncomment for debugging
+
+- task: ExtractFiles@1
+  displayName: 'Extract files from ${{ parameters.publishedArtifactZipFileName }}'
+  inputs:
+    archiveFilePatterns: '${{ parameters.binaryArtifactName }}/${{ parameters.publishedArtifactZipFileName }}'
+    destinationFolder: '$(System.DefaultWorkingDirectory)/${{ parameters.binaryArtifactName }}'
+    cleanDestinationFolder: false
+
+- powershell: |
+    $testTargetFrameworksString = '${{ parameters.testTargetFrameworks }}'
+    $testBinaryRootDirectory = "$(System.DefaultWorkingDirectory)"
+    $testResultsArtifactDirectory = "${{ format('$(Build.ArtifactStagingDirectory)/{0}',parameters.testResultsArtifactName) }}"
+    $testPlatform = '${{ parameters.vsTestPlatform }}'
+    $testOSName = '${{ parameters.osName }}'
+    $testBinaryFilesPattern = '${{ parameters.testBinaryFilesPattern }}'
+    $testResultsFileName = '${{ parameters.testResultsFileName }}'
+    $maximumParalellJobs = '${{ parameters.maximumParallelJobs }}'
+    $testTargetFrameworks = $testTargetFrameworksString.Split([char]',',[char]';')
+    
+    function SeparateVersionDigits([string]$digits) {
+        return (&{ for ($i = 0;$i -lt $digits.Length;$i++) { $digits.Substring($i,1) }}) -join '.'
+    }
+    
+    # Convert $framework (i.e. net461) into format for dotnet vstest (i.e. .NETFramework,Version=4.6.1)
+    function ConvertFrameworkName([string]$framework) {
+        $match = [regex]::Match($framework, '^net(\d+)$') # .NET Framework
+        if ($match.Success) {
+            $ver = SeparateVersionDigits($match.Groups[1].Value)
+            return ".NETFramework,Version=v$($ver)"
+        }
+        $match = [regex]::Match($framework, '^netcoreapp(\d+\.\d+(?:\.\d+)?)$') # .NET Core
+        if ($match.Success) {
+            $ver = $match.Groups[1].Value
+            return ".NETCoreApp,Version=v$($ver)"
+        } 
+        $match = [regex]::Match($framework, '^uap(\d+\.\d+)?$') # Universal Windows Platform
+        if ($match.Success) {
+            $ver = $match.Groups[1].Value
+            $ver = if ([string]::IsNullOrEmpty($ver)) { '10' } else { $ver.Replace('.0','').Replace('.','') }
+            return "FrameworkUap$($ver)"
+        }
+        return $framework
+    }
+    
+    function IsSupportedFramework([string]$framework) {
+        if ($IsWindows -eq $null) {
+            $IsWindows = $env:OS.StartsWith('Win')
+        }
+        if (!$IsWindows -and !$framework.StartsWith('netcoreapp')) {
+            return $false
+        }
+        return $true
+    }
+    
+    function RunTests([string]$framework, [string]$fileRegexPattern) {
+        if (!(IsSupportedFramework($framework))) { continue }
+    
+        $testBinaries = Get-ChildItem -Path "$testBinaryRootDirectory" -File -Recurse | Where-Object {$_.FullName -match "$framework"} | Where-Object {$_.FullName -match "$fileRegexPattern"} | Sort-Object -Property FullName
+        Write-Host $testBinaries
+        foreach ($testBinary in $testBinaries) {
+            $testName = [System.IO.Path]::GetFileNameWithoutExtension($testBinary.FullName)
+            $testDirectory = $testBinary.Directory.Name
+    
+            # Safety check - only run tests for the DLL that matches the directory name so we don't run the same one twice
+            if (!($testName -eq $testDirectory)) { continue }
+    
+            if ($maximumParalellJobs -gt 1) {
+                # Pause if we have queued too many parallel jobs
+                $running = @(Get-Job | Where-Object { $_.State -eq 'Running' })
+                if ($running.Count -ge $maximumParalellJobs) {
+                    Write-Host ""
+                    Write-Host "  Running tests in parallel on $($running.Count) projects." -ForegroundColor Cyan
+                    Write-Host "  Next in queue is $testName on $framework. This will take a bit, please wait..." -ForegroundColor Cyan
+                    $running | Wait-Job -Any | Out-Null
+                }
+            }
+    
+            $fwork = ConvertFrameworkName($framework)
+            $testResultDirectory = "$testResultsArtifactDirectory/$testOSName/$framework/$testName"                
+            if (!(Test-Path "$testResultDirectory")) {
+                New-Item "$testResultDirectory" -ItemType Directory -Force
+            }
+    
+            $testExpression = "dotnet vstest ""$($testBinary.FullName)"" --Framework:""$fwork"" --Platform:""$testPlatform""" + `
+                " --logger:""console;verbosity=normal"" --logger:""trx;LogFileName=$testResultsFileName""" + `
+                " --ResultsDirectory:""$testResultDirectory"" --Blame"
+    
+            Write-Host "Testing '$($testBinary.FullName)' on framework '$fwork' and outputting test results to '$testResultDirectory/$testResultsFileName'..."
+            Write-Host $testExpression -ForegroundColor Magenta
+            if ($maximumParalellJobs -le 1) {
+                Invoke-Expression $testExpression # For running in the foreground
+            } else {
+    
+                $testExpression += " > ""$testResultDirectory/dotnet-vstest.log"" 2> ""$testResultDirectory/dotnet-vstest-error.log"""
+                $scriptBlock = {
+                    param([string]$testExpression)
+                    Invoke-Expression $testExpression
+                }
+    
+                # Execute the jobs in parallel
+                Start-Job $scriptBlock -ArgumentList $testExpression
+            }
+        }
+    }
+    
+    foreach ($framework in $testTargetFrameworks) {
+        RunTests -Framework "$framework" -FileRegexPattern "$testBinaryFilesPattern"
+    }
+    
+    if ($maximumParalellJobs -gt 1) {
+        # Wait for it all to complete
+        do {
+            $running = @(Get-Job | Where-Object { $_.State -eq 'Running' })
+            if ($running.Count -gt 0) {
+                Write-Host ""
+                Write-Host "  Almost finished, only $($running.Count) projects left..." -ForegroundColor Cyan
+                $running | Wait-Job -Any
+            }
+        } until ($running.Count -eq 0)
+    }
+    
+    $global:LASTEXITCODE = 0 # Force the script to continue on error
+  displayName: 'dotnet vstest ${{ parameters.testTargetFrameworks }}'
+  ignoreLASTEXITCODE: true
+
+#- template: 'show-all-files.yml' # Uncomment for debugging
+
+- task: PublishBuildArtifacts@1
+  displayName: 'Publish Artifact: ${{ parameters.testResultsArtifactName }}'
+  inputs:
+    PathtoPublish: '$(Build.ArtifactStagingDirectory)/${{ parameters.testResultsArtifactName }}'
+    ArtifactName: '${{ parameters.testResultsArtifactName }}'
+  condition: succeededOrFailed()
+
+# Due to the fact that it is not possible to loop a task and
+# it would be a ton of work to make a replacement for the
+# Publish Test Results task or the (deprecated) TfsPublisher
+# our only other option is to make a task for every supported
+# platform and project and update it whenever a new platform 
+# is targeted or test project is created in Lucene.Net.
+
+- template: 'publish-test-results-for-test-projects.yml'
+  parameters:
+    osName: '${{ parameters.osName }}'
+
+- pwsh: |
+    $maximumAllowedFailures = '${{ parameters.maximumAllowedFailures }}'
+    if ([int]$Env:TOTALFAILURES -gt [int]$maximumAllowedFailures) {
+        Write-Host "##vso[task.logissue type=error;]Test run failed due to too many failed tests. Maximum failures allowed: $maximumAllowedFailures, total failures: $($Env:TOTALFAILURES)."
+        Write-Host "##vso[task.complete result=Failed;]"
+    }
\ No newline at end of file
diff --git a/build/azure-templates/show-all-environment-variables.yml b/build/azure-templates/show-all-environment-variables.yml
new file mode 100644
index 0000000..1815e62
--- /dev/null
+++ b/build/azure-templates/show-all-environment-variables.yml
@@ -0,0 +1,28 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+#   http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Writes all environment variables to the host (helpful for debugging)
+
+steps:
+- powershell: |
+    $environmentVars = Get-ChildItem -path env:* | sort Name
+    foreach($var in $environmentVars) {
+        $keyname = $var.Key
+        $keyvalue = $var.Value
+        Write-Output "${keyname}: $keyvalue"
+    }
+  displayName: 'Show all Environment Variables'
\ No newline at end of file
diff --git a/build/azure-templates/show-all-files.yml b/build/azure-templates/show-all-files.yml
new file mode 100644
index 0000000..9591775
--- /dev/null
+++ b/build/azure-templates/show-all-files.yml
@@ -0,0 +1,26 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+#   http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Downloads test binaries and executes tests using dotnet vstest,
+# runs the tests for each project on a background job in parallel,
+# then uploads the results to Azure DevOps pipelines
+
+# Writes all file names (from the parent directory) to the host (helpful for debugging)
+
+steps:
+- powershell: cd ..;dir -r  | Where-Object {$_.PsIsContainer -eq $false} | % { $_.FullName }
+  displayName: 'Show all Files'
\ No newline at end of file
diff --git a/build/build.ps1 b/build/build.ps1
index 6ba4106..a29d765 100644
--- a/build/build.ps1
+++ b/build/build.ps1
@@ -29,22 +29,23 @@ properties {
 	[string]$sdkPath = "$env:programfiles/dotnet/sdk"
 	[string]$sdkVersion = "2.2.300"
 	[string]$globalJsonFile = "$base_directory/global.json"
+	[string]$versionPropsFile = "$base_directory/Version.props"
+	[string]$build_bat = "$base_directory/build.bat"
 
 	[string]$buildCounter     = $(if ($buildCounter) { $buildCounter } else { $env:BuildCounter }) #NOTE: Pass in as a parameter (not a property) or environment variable to override
-	[string]$preReleaseCounterPattern = $(if ($preReleaseCounterPattern) { $preReleaseCounterPattern } else { if ($env:PreReleaseCounterPattern) { $env:PreReleaseCounterPattern } else { "00000" } })  #NOTE: Pass in as a parameter (not a property) or environment variable to override
-	[string]$versionSuffix    = $(if ($versionSuffix) { $versionSuffix } else { $env:VersionSuffix })  #NOTE: Pass in as a parameter (not a property) or environment variable to override
+	[string]$preReleaseCounterPattern = $(if ($preReleaseCounterPattern) { $preReleaseCounterPattern } else { if ($env:PreReleaseCounterPattern) { $env:PreReleaseCounterPattern } else { "0000000000" } })  #NOTE: Pass in as a parameter (not a property) or environment variable to override
+	[string]$versionSuffix    = $(if ($versionSuffix -ne $null) { $versionSuffix } else { if ($env:VersionSuffix -ne $null) { $env:VersionSuffix } else { 'ci' }}) #NOTE: Pass in as a parameter (not a property) or environment variable to override
 	[string]$packageVersion   = Get-Package-Version #NOTE: Pass in as a parameter (not a property) or environment variable to override
 	[string]$version          = Get-Version
-	[string]$configuration    = "Release"
+	[string]$configuration    = $(if ($configuration) { $configuration } else { if ($env:BuildConfiguration) { $env:BuildConfiguration } else { "Release" } })  #NOTE: Pass in as a parameter (not a property) or environment variable to override
+	[string]$platform   = $(if ($platform) { $platform } else { if ($env:BuildPlatform) { $env:BuildPlatform } else { "Any CPU" } })  #NOTE: Pass in as a parameter (not a property) or environment variable to override
 	[bool]$backup_files       = $true
 	[bool]$prepareForBuild    = $true
 	[bool]$generateBuildBat   = $false
+	[bool]$zipPublishedArtifacts = $false
+	[string]$publishedArtifactZipFileName = "artifact.zip"
 
-	[string]$build_bat = "$base_directory/build.bat"
-	[string]$copyright_year = [DateTime]::Today.Year.ToString() #Get the current year from the system
-	[string]$copyright = "Copyright " + $([char]0x00A9) + " 2006 - $copyright_year The Apache Software Foundation"
-	[string]$company_name = "The Apache Software Foundation"
-	[string]$product_name = "Lucene.Net"
+	[int]$maximumParalellJobs = 8
 	
 	#test paramters
 	[string]$frameworks_to_test = "netcoreapp2.1,netcoreapp1.0,net451"
@@ -56,11 +57,11 @@ if ($IsWindows -eq $null) {
 	$IsWindows = $Env:OS.StartsWith('Windows')
 }
 
-
 task default -depends Pack
 
 task Clean -description "This task cleans up the build directory" {
 	Write-Host "##teamcity[progressMessage 'Cleaning']"
+	Write-Host "##vso[task.setprogress]'Cleaning'"
 	Remove-Item $release_directory -Force -Recurse -ErrorAction SilentlyContinue
 	Get-ChildItem $base_directory -Include *.bak -Recurse | foreach ($_) {Remove-Item $_.FullName}
 }
@@ -74,6 +75,7 @@ task UpdateLocalSDKVersion -description "Backs up the project.json file and pins
 
 task InstallSDK -description "This task makes sure the correct SDK version is installed to build" -ContinueOnError {
 	Write-Host "##teamcity[progressMessage 'Installing SDK $sdkVersion']"
+	Write-Host "##vso[task.setprogress]'Installing SDK $sdkVersion'"
 	$installed = Is-Sdk-Version-Installed $sdkVersion
 	if (!$installed) {
 		Write-Host "Requires SDK version $sdkVersion, installing..." -ForegroundColor Red
@@ -89,9 +91,11 @@ task InstallSDK -description "This task makes sure the correct SDK version is in
 }
 
 task Init -depends InstallSDK, UpdateLocalSDKVersion -description "This task makes sure the build environment is correctly setup" {
-	#Update TeamCity or MyGet with packageVersion
+	#Update TeamCity, MyGet, or Azure Pipelines with packageVersion
 	Write-Output "##teamcity[buildNumber '$packageVersion']"
 	Write-Output "##myget[buildNumber '$packageVersion']"
+	Write-Host "##vso[task.setvariable variable=Build.BuildNumber;]$packageVersion"
+	Write-Host "##vso[build.updatebuildnumber]$packageVersion"
 
 	& dotnet.exe --version
 	& dotnet.exe --info
@@ -106,12 +110,14 @@ task Init -depends InstallSDK, UpdateLocalSDKVersion -description "This task mak
 	Write-Host "Package Version: $packageVersion"
 	Write-Host "Version: $version"
 	Write-Host "Configuration: $configuration"
+	Write-Host "Platform: $platform"
 
 	Ensure-Directory-Exists "$release_directory"
 }
 
 task Restore -description "This task restores the dependencies" {
 	Write-Host "##teamcity[progressMessage 'Restoring']"
+	Write-Host "##vso[task.setprogress]'Restoring'"
 	Exec { 
 		& dotnet.exe restore $solutionFile --no-dependencies /p:TestFrameworks=true
 	}
@@ -119,42 +125,25 @@ task Restore -description "This task restores the dependencies" {
 
 task Compile -depends Clean, Init, Restore -description "This task compiles the solution" {
 	Write-Host "##teamcity[progressMessage 'Compiling']"
+	Write-Host "##vso[task.setprogress]'Compiling'"
 	try {
 		if ($prepareForBuild -eq $true) {
 			Prepare-For-Build
 		}
 
-		#Use only the major version as the assembly version.
-		#This ensures binary compatibility unless the major version changes.
-		$version-match "(^\d+)"
-		$assemblyVersion = $Matches[0]
-		$assemblyVersion = "$assemblyVersion.0.0"
-
-		Write-Host "Assembly version set to: $assemblyVersion" -ForegroundColor Green
-
-		$pv = $packageVersion
-		#check for presense of Git
-		& where.exe git.exe
-		if ($LASTEXITCODE -eq 0) {
-			$gitCommit = ((git rev-parse --verify --short=10 head) | Out-String).Trim()
-			$pv = "$packageVersion commit:[$gitCommit]"
-		}
-
-		Write-Host "Assembly informational version set to: $pv" -ForegroundColor Green
-
-		$testFrameworks = $frameworks_to_test.Replace(',', ';')
+		$testFrameworks = [string]::Join(';', (Get-FrameworksToTest))
 
 		Write-Host "TestFrameworks set to: $testFrameworks" -ForegroundColor Green
 
 		Exec {
+			# NOTE: Version information is not passed in at the command line,
+			# instead it is output to the Version.props file. This file is then
+			# used during a release to "freeze" the build at a specific version
+			# so it is always a constant in release distributions.
 			& dotnet.exe msbuild $solutionFile /t:Build `
 				/p:Configuration=$configuration `
-				/p:AssemblyVersion=$assemblyVersion `
-				/p:FileVersion=$version `
-				/p:InformationalVersion=$pv `
-				/p:Product=$product_name `
-				/p:Company=$company_name `
-				/p:Copyright=$copyright `
+				/p:Platform=$platform `
+				/p:PortableDebugTypeOnly=true `
 				/p:TestFrameworks=true # workaround for parsing issue: https://github.com/Microsoft/msbuild/issues/471#issuecomment-181963350
 		}
 
@@ -168,18 +157,27 @@ task Compile -depends Clean, Init, Restore -description "This task compiles the
 
 task Pack -depends Compile -description "This task creates the NuGet packages" {
 	Write-Host "##teamcity[progressMessage 'Packing']"
+	Write-Host "##vso[task.setprogress]'Packing'"
 	#create the nuget package output directory
 	Ensure-Directory-Exists "$nuget_package_directory"
 
 	try {
 		Exec {
-			& dotnet.exe pack $solutionFile --configuration $Configuration --output $nuget_package_directory --no-build --include-symbols /p:PackageVersion=$packageVersion
+			# NOTE: Package version information is not passed in at the command line,
+			# instead it is output to the Version.props file. This file is then
+			# used during a release to "freeze" the build at a specific version
+			# so it is always a constant in release distributions.
+			& dotnet.exe pack $solutionFile --configuration $configuration --output $nuget_package_directory --no-build
 		}
 
 		$success = $true
 	} finally {
 		#if ($success -ne $true) {
 			Restore-Files $backedUpFiles
+			#Remove Version.props, as we don't want it to be committed to the repository
+			if ($backup_files -eq $true -and (Test-Path -Path "$versionPropsFile") -eq $true) {
+				Remove-Item -Path "$versionPropsFile" -Force
+			}
 		#}
 	}
 }
@@ -192,11 +190,23 @@ task Publish -depends Compile -description "This task uses dotnet publish to pac
 	Write-Host "##vso[task.setprogress]'Publishing'"
 
 	try {
-		$frameworksToTest = $frameworks_to_test -split "\s*?,\s*?"
+		$frameworksToTest = Get-FrameworksToTest
+
+		if ($zipPublishedArtifacts) {
+			$outDirectory = New-TemporaryDirectory
+		} else {
+			$outDirectory = $publish_directory
+		}
 		
 		foreach ($framework in $frameworksToTest) {
-			$testProjects = Get-ChildItem -Path "$source_directory/**/*.csproj" -Recurse | ? { $_.Directory.Name.Contains(".Tests") } | ForEach-Object { $_.FullName }
+			$testProjects = Get-ChildItem -Path "$source_directory/**/*.csproj" -Recurse | ? { $_.Directory.Name.Contains(".Tests") } | Select -ExpandProperty FullName
 			foreach ($testProject in $testProjects) {
+				# Pause if we have queued too many parallel jobs
+				$running = @(Get-Job | Where-Object { $_.State -eq 'Running' })
+				if ($running.Count -ge $maximumParalellJobs) {
+					$running | Wait-Job -Any | Out-Null
+				}
+
 				$projectName = [System.IO.Path]::GetFileNameWithoutExtension($testProject)
 
 				# Special case - our CLI tool only supports .NET Core 2.1
@@ -204,36 +214,43 @@ task Publish -depends Compile -description "This task uses dotnet publish to pac
 					continue
 				}
 
+				$logPath = "$outDirectory/$framework"
+				$outputPath = "$logPath/$projectName"
+
 				# Do this first so there is no conflict
-				$outputPath = "$publish_directory/$framework/$projectName"
 				Ensure-Directory-Exists $outputPath
 
 				$scriptBlock = {
-					param([string]$testProject, [string]$publish_directory, [string]$framework, [string]$configuration, [string]$projectName)
-					$logPath = "$publish_directory/$framework"
-					$outputPath = "$logPath/$projectName"
+					param([string]$testProject, [string]$outputPath, [string]$logPath, [string]$framework, [string]$configuration, [string]$projectName)
 					Write-Host "Publishing '$testProject' on '$framework' to '$outputPath'..."
 					# Note: Cannot use Psake Exec in background
-					dotnet publish "$testProject" --output "$outputPath" --framework "$framework" --configuration "$configuration" --no-build --verbosity Detailed /p:TestFrameworks=true > "$logPath/$projectName-dotnet-publish.log" 2> "$logPath/$projectName-dotnet-publish-error.log"
+					dotnet publish "$testProject" --output "$outputPath" --framework "$framework" --configuration "$configuration" --no-build --verbosity Detailed /p:TestFrameworks=true /p:Platform="$platform" > "$logPath/$projectName-dotnet-publish.log" 2> "$logPath/$projectName-dotnet-publish-error.log"
 				}
 
 				# Execute the jobs in parallel
-				Start-Job $scriptBlock -ArgumentList $testProject,$publish_directory,$framework,$configuration,$projectName
+				Start-Job $scriptBlock -ArgumentList $testProject,$outputPath,$logPath,$framework,$configuration,$projectName
 			}
 		}
 
-		Write-Host "Executing dotnet publish of all projects in parallel. This will take a bit, please wait..."
-
-		Get-Job
-
 		# Wait for it all to complete
-        While (Get-Job -State "Running") {
-			Start-Sleep 10
-		}
+		do {
+			$running = @(Get-Job | Where-Object { $_.State -eq 'Running' })
+			if ($running.Count -gt 0) {
+				Write-Host ""
+				Write-Host "  Almost finished, only $($running.Count) projects left to publish..." -ForegroundColor Cyan
+				$running | Wait-Job -Any | Out-Null
+			}
+		} until ($running.Count -eq 0)
 
 		# Getting the information back from the jobs (time consuming)
 		#Get-Job | Receive-Job
 
+		if ($zipPublishedArtifacts) {
+			Ensure-Directory-Exists $publish_directory
+			Add-Type -assembly "System.IO.Compression.Filesystem"
+			[System.IO.Compression.ZipFile]::CreateFromDirectory($outDirectory, "$publish_directory/$publishedArtifactZipFileName")
+		}
+
 		$success = $true
 	} finally {
 		#if ($success -ne $true) {
@@ -244,27 +261,48 @@ task Publish -depends Compile -description "This task uses dotnet publish to pac
 
 task Test -depends InstallSDK, UpdateLocalSDKVersion, Restore -description "This task runs the tests" {
 	Write-Host "##teamcity[progressMessage 'Testing']"
+	Write-Host "##vso[task.setprogress]'Testing'"
 	Write-Host "Running tests..." -ForegroundColor DarkCyan
 
 	pushd $base_directory
 	$testProjects = Get-ChildItem -Path "$source_directory/**/*.csproj" -Recurse | ? { $_.Directory.Name.Contains(".Tests") }
 	popd
 
-	Write-Host "frameworks_to_test: $frameworks_to_test" -ForegroundColor Yellow
+	$testProjects = $testProjects | Sort-Object -Property FullName
 
-	$frameworksToTest = $frameworks_to_test -split "\s*?,\s*?"
+	$frameworksToTest = Get-FrameworksToTest
+	
+	Write-Host "frameworksToTest: $frameworksToTest" -ForegroundColor Yellow
+
+	[int]$totalProjects = $testProjects.Length * $frameworksToTest.Length
+	[int]$remainingProjects = $totalProjects
 
-	foreach ($framework in $frameworksToTest) {
-		Write-Host "Framework: $framework" -ForegroundColor Blue
+	Ensure-Directory-Exists $test_results_directory
 
-		foreach ($testProject in $testProjects) {
+	foreach ($testProject in $testProjects) {
+
+		foreach ($framework in $frameworksToTest) {
 			$testName = $testProject.Directory.Name
 
 			# Special case - our CLI tool only supports .NET Core 2.1
 			if ($testName.Contains("Tests.Cli") -and (!$framework.StartsWith("netcoreapp2."))) {
+				$totalProjects--
+				$remainingProjects--
 				continue
 			}
 
+			Write-Host "  Next Project in Queue: $testName, Framework: $framework" -ForegroundColor Yellow
+
+			# Pause if we have queued too many parallel jobs
+			$running = @(Get-Job | Where-Object { $_.State -eq 'Running' })
+			if ($running.Count -ge $maximumParalellJobs) {
+				Write-Host ""
+				Write-Host "  Running tests in parallel on $($running.Count) projects out of approximately $totalProjects total." -ForegroundColor Cyan
+				Write-Host "  $remainingProjects projects are waiting in the queue to run. This will take a bit, please wait..." -ForegroundColor Cyan
+				$running | Wait-Job -Any | Out-Null
+			}
+			$remainingProjects -= 1
+
 			$testResultDirectory = "$test_results_directory/$framework/$testName"
 			Ensure-Directory-Exists $testResultDirectory
 
@@ -290,15 +328,33 @@ task Test -depends InstallSDK, UpdateLocalSDKVersion, Restore -description "This
 
 			Write-Host $testExpression -ForegroundColor Magenta
 
-			Invoke-Expression $testExpression
-			# fail the build on negative exit codes (NUnit errors - if positive it is a test count or, if 1, it could be a dotnet error)
-			if ($LASTEXITCODE -lt 0) {
-				throw "Test execution failed"
+			$scriptBlock = {
+				param([string]$testExpression, [string]$testResultDirectory)
+				$testExpression = "$testExpression > '$testResultDirectory/dotnet-test.log' 2> '$testResultDirectory/dotnet-test-error.log'"
+				Invoke-Expression $testExpression
 			}
+
+			# Execute the jobs in parallel
+			Start-Job $scriptBlock -ArgumentList $testExpression,$testResultDirectory
+
+			#Invoke-Expression $testExpression
+			## fail the build on negative exit codes (NUnit errors - if positive it is a test count or, if 1, it could be a dotnet error)
+			#if ($LASTEXITCODE -lt 0) {
+			#	throw "Test execution failed"
+			#}
 		}
 	}
 
-	Summarize-Test-Results
+	do {
+		$running = @(Get-Job | Where-Object { $_.State -eq 'Running' })
+		if ($running.Count -gt 0) {
+			Write-Host ""
+			Write-Host "  Almost finished, only $($running.Count) test projects left..." -ForegroundColor Cyan
+			$running | Wait-Job -Any
+		}
+	} until ($running.Count -eq 0)
+
+	Summarize-Test-Results -FrameworksToTest $frameworksToTest
 }
 
 function Get-Package-Version() {
@@ -345,6 +401,19 @@ function Get-Version() {
 	return $version
 }
 
+function Get-FrameworksToTest() {
+    $frameworksToTest = New-Object Collections.Generic.List[string]
+    $frameworks = $frameworks_to_test -split "\s*?,\s*?"
+    foreach ($framework in $frameworks) {
+        if ($IsWindows) {
+            $frameworksToTest.Add($framework)
+        } elseif ($framework.StartsWith('netcore')) {
+            $frameworksToTest.Add($framework)
+        }
+    }
+    return [System.Linq.Enumerable]::ToArray($frameworksToTest)
+}
+
 function Is-Sdk-Version-Installed([string]$sdkVersion) {
 	& where.exe dotnet.exe | Out-Null
 	if ($LASTEXITCODE -eq 0) {
@@ -375,6 +444,35 @@ function Is-Sdk-Version-Installed([string]$sdkVersion) {
 }
 
 function Prepare-For-Build() {
+	#Use only the major version as the assembly version.
+	#This ensures binary compatibility unless the major version changes.
+	$version -match "(^\d+)"
+	$assemblyVersion = $Matches[0]
+	$assemblyVersion = "$assemblyVersion.0.0"
+
+	Write-Host "Assembly version set to: $assemblyVersion" -ForegroundColor Green
+
+	$informationalVersion = $packageVersion
+	#check for presense of Git
+	& where.exe git.exe
+	if ($LASTEXITCODE -eq 0) {
+		$gitCommit = ((git rev-parse --verify --short=10 head) | Out-String).Trim()
+		$informationalVersion = "$packageVersion commit:[$gitCommit]"
+	}
+
+	Write-Host "##vso[task.setvariable variable=AssemblyVersion;]$assemblyVersion"
+	Write-Host "##vso[task.setvariable variable=FileVersion;]$version"
+	Write-Host "##vso[task.setvariable variable=InformationalVersion;]$informationalVersion"
+	Write-Host "##vso[task.setvariable variable=PackageVersion;]$packageVersion"
+
+	Write-Host "Assembly informational version set to: $informationalVersion" -ForegroundColor Green
+
+	Generate-Version-Props `
+		-AssemblyVersion $assemblyVersion `
+		-FileVersion $version `
+		-InformationalVersion $informationalVersion `
+		-PackageVersion $packageVersion `
+		-File $versionPropsFile
 	Update-Constants-Version $packageVersion
 
 	if ($generateBuildBat -eq $true) {
@@ -411,6 +509,50 @@ $fileText = "{
 	Out-File -filePath $file -encoding UTF8 -inputObject $fileText
 }
 
+function Generate-Version-Props {
+param(
+	[string]$assemblyVersion,
+	[string]$fileVersion,
+	[string]$informationalVersion,
+	[string]$packageVersion,
+	[string]$file = $(throw "file is a required parameter.")
+)
+
+$fileText = "<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ ""License""); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ ""AS IS"" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<Project>
+  <PropertyGroup Label=""Version Override Properties"">
+    <AssemblyVersion>$assemblyVersion</AssemblyVersion>
+    <FileVersion>$fileVersion</FileVersion>
+    <InformationalVersion>$informationalVersion</InformationalVersion>
+    <PackageVersion>$packageVersion</PackageVersion>
+  </PropertyGroup>
+</Project>"
+	$dir = [System.IO.Path]::GetDirectoryName($file)
+	Ensure-Directory-Exists $dir
+
+	Write-Host "Generating Version.props file: $file"
+	Out-File -filePath $file -encoding UTF8 -inputObject $fileText
+}
+
 function Generate-Build-Bat {
 param(
 	[string]$file = $(throw "file is a required parameter.")
@@ -494,9 +636,7 @@ function New-CountersObject ([string]$project, [string]$outcome, [int]$total, [i
     return $counters
 }
 
-function Summarize-Test-Results() {
-    Write-Host "frameworks_to_test: $frameworks_to_test" -ForegroundColor Gray
-    $frameworksToTest = $frameworks_to_test -split "\s*?,\s*?"
+function Summarize-Test-Results([string[]]$frameworksToTest) {
 
     foreach ($framework in $frameworksToTest) {
         pushd $base_directory
@@ -517,11 +657,11 @@ function Summarize-Test-Results() {
 
         Write-Host ""
         Write-Host ""
-        Write-Host "************************************************************************************************************" -ForegroundColor Yellow
-        Write-Host "*                                                                                                          *" -ForegroundColor Yellow
-        Write-Host "*                                        Test Summary For $framework"  -ForegroundColor Yellow
-        Write-Host "*                                                                                                          *" -ForegroundColor Yellow
-        Write-Host "************************************************************************************************************" -ForegroundColor Yellow
+        Write-Host "**********************************************************************" -ForegroundColor Yellow
+        Write-Host "*                                                                    *" -ForegroundColor Yellow
+        Write-Host "*                        Test Summary For $framework"  -ForegroundColor Yellow
+        Write-Host "*                                                                    *" -ForegroundColor Yellow
+        Write-Host "**********************************************************************" -ForegroundColor Yellow
 
         foreach ($testReport in $testReports) {
             $testName = [System.IO.Path]::GetFileName([System.IO.Path]::GetDirectoryName($testReport))
@@ -555,15 +695,17 @@ function Summarize-Test-Results() {
                         $skippedCountForFramework += $counters.Skipped
 
                         $format = @{Expression={$_.Project};Label='Project';Width=35},
-                            @{Expression={$_.Outcome};Label='Outcome';Width=9},
-                            @{Expression={$_.Total};Label='Total';Width=8},
-                            @{Expression={$_.Executed};Label='Executed';Width=10},
-                            @{Expression={$_.Passed};Label='Passed';Width=8},
-                            @{Expression={$_.Failed};Label='Failed';Width=8},
-                            @{Expression={$_.Warning};Label='Warning';Width=9},
+                            @{Expression={$_.Outcome};Label='Outcome';Width=7},
+                            @{Expression={$_.Total};Label='Total';Width=6},
+                            @{Expression={$_.Executed};Label='Executed';Width=8},
+                            @{Expression={$_.Passed};Label='Passed';Width=6},
+                            @{Expression={$_.Failed};Label='Failed';Width=6},
+                            @{Expression={$_.Warning};Label='Warning';Width=7},
                             @{Expression={$_.Inconclusive};Label='Inconclusive';Width=14}
 
-                        $Counters | Format-Table $format
+						if ($counters.Failed -gt 0) {
+							$Counters | Format-Table $format
+						}
                     }
                 }
 
@@ -575,12 +717,12 @@ function Summarize-Test-Results() {
 
         # FOOTER FOR FRAMEWORK
 
-        Write-Host "************************************************************************************************************" -ForegroundColor Magenta
-        Write-Host "*                                                                                                          *" -ForegroundColor Magenta
-        Write-Host "*                                        Totals For $framework"  -ForegroundColor Magenta
-        Write-Host "*                                                                                                          *" -ForegroundColor Magenta
-        Write-Host "************************************************************************************************************" -ForegroundColor Magenta
-        Write-Host ""
+        #Write-Host "**********************************************************************" -ForegroundColor Magenta
+        #Write-Host "*                                                                    *" -ForegroundColor Magenta
+        #Write-Host "*                           Totals For $framework"  -ForegroundColor Magenta
+        #Write-Host "*                                                                    *" -ForegroundColor Magenta
+        #Write-Host "**********************************************************************" -ForegroundColor Magenta
+        #Write-Host ""
         $foreground = if ($outcomeForFramework -eq 'Failed') { 'Red' } else { 'Green' }
         Write-Host "Result: " -NoNewline; Write-Host "$outcomeForFramework" -ForegroundColor $foreground
         Write-Host ""
@@ -594,6 +736,8 @@ function Summarize-Test-Results() {
         Write-Host "Warning: " -NoNewline; Write-Host "$warningCountForFramework" -ForegroundColor $foreground
         $foreground = if ($failedCountForFramework -gt 0) { 'Cyan' } else { (Get-Host).UI.RawUI.ForegroundColor }
         Write-Host "Inconclusive: " -NoNewline; Write-Host "$inconclusiveCountForFramework" -ForegroundColor $foreground
+		Write-Host ""
+		Write-Host "See the .trx logs in $test_results_directory/$framework for more details." -ForegroundColor DarkCyan
     }
 }
 
@@ -631,4 +775,10 @@ function Ensure-Directory-Exists([string] $path) {
 	if (!(Test-Path $path)) {
 		New-Item $path -ItemType Directory
 	}
+}
+
+function New-TemporaryDirectory {
+    $parent = [System.IO.Path]::GetTempPath()
+    [string] $name = [System.Guid]::NewGuid()
+    New-Item -ItemType Directory -Path (Join-Path $parent $name)
 }
\ No newline at end of file
diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Th/TestThaiAnalyzer.cs b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Th/TestThaiAnalyzer.cs
index c208618..4dc1c2a 100644
--- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Th/TestThaiAnalyzer.cs
+++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Th/TestThaiAnalyzer.cs
@@ -92,6 +92,48 @@ namespace Lucene.Net.Analysis.Th
             AssertAnalyzesTo(analyzer, "ประโยคว่า The quick brown fox jumped over the lazy dogs", new string[] { "ประโยค", "ว่า", "quick", "brown", "fox", "jumped", "over", "lazy", "dogs" });
         }
 
+        // Ellision character
+        private static readonly char THAI_PAIYANNOI = (char)0x0E2F;
+        // Repeat character
+        private static readonly char THAI_MAIYAMOK = (char)0x0E46;
+
+        [Test]
+        [LuceneNetSpecific]
+        public virtual void TestThaiBreakEngineInitializerCode()
+        {
+            // Initialize UnicodeSets
+            var fThaiWordSet = new ICU4N.Text.UnicodeSet();
+            var fMarkSet = new ICU4N.Text.UnicodeSet();
+            var fBeginWordSet = new ICU4N.Text.UnicodeSet();
+            var fSuffixSet = new ICU4N.Text.UnicodeSet();
+
+            fThaiWordSet.ApplyPattern("[[:Thai:]&[:LineBreak=SA:]]");
+            fThaiWordSet.Compact();
+
+            fMarkSet.ApplyPattern("[[:Thai:]&[:LineBreak=SA:]&[:M:]]");
+            fMarkSet.Add(0x0020);
+            var fEndWordSet = new ICU4N.Text.UnicodeSet(fThaiWordSet);
+            fEndWordSet.Remove(0x0E31); // MAI HAN-AKAT
+            fEndWordSet.Remove(0x0E40, 0x0E44); // SARA E through SARA AI MAIMALAI
+            fBeginWordSet.Add(0x0E01, 0x0E2E); //KO KAI through HO NOKHUK
+            fBeginWordSet.Add(0x0E40, 0x0E44); // SARA E through SARA AI MAIMALAI
+            fSuffixSet.Add(THAI_PAIYANNOI);
+            fSuffixSet.Add(THAI_MAIYAMOK);
+
+            // Compact for caching
+            fMarkSet.Compact();
+            fEndWordSet.Compact();
+            fBeginWordSet.Compact();
+            fSuffixSet.Compact();
+
+            // Freeze the static UnicodeSet
+            fThaiWordSet.Freeze();
+            fMarkSet.Freeze();
+            fEndWordSet.Freeze();
+            fBeginWordSet.Freeze();
+            fSuffixSet.Freeze();
+        }
+
         /*
          * Test that position increments are adjusted correctly for stopwords.
          */


[lucenenet] 40/42: SWEEP: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details) (as per LUCENENET-435)

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit 6b4bf3f09e2edb81b6baf0e6394920a57047bc57
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Wed Aug 7 11:38:08 2019 +0700

    SWEEP: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details) (as per LUCENENET-435)
---
 .../Analysis/Synonym/FSTSynonymFilterFactory.cs    |  6 ++--
 .../Analysis/Synonym/SlowSynonymFilterFactory.cs   |  4 +--
 .../ByTask/Feeds/EnwikiContentSource.cs            |  4 +--
 .../ByTask/Tasks/AnalyzerFactoryTask.cs            |  4 +--
 .../ByTask/Tasks/NewAnalyzerTask.cs                |  2 +-
 .../Analysis/BaseTokenStreamTestCase.cs            |  4 +--
 .../Index/AssertingAtomicReader.cs                 |  4 +--
 .../Index/BaseDocValuesFormatTestCase.cs           |  4 +--
 .../Store/SlowOpeningMockIndexInputWrapper.cs      |  5 ++--
 .../Util/LuceneTestCase.cs                         |  4 +--
 .../Util/TestRuleSetupAndRestoreClassEnv.cs        |  2 +-
 .../CharFilters/HTMLStripCharFilterTest.cs         |  2 +-
 .../Analysis/Core/TestAllAnalyzersHaveFactories.cs |  6 ++--
 .../Analysis/Core/TestRandomChains.cs              | 30 ++++++++++----------
 .../Util/BaseTokenStreamFactoryTestCase.cs         |  2 +-
 .../Collation/TestICUCollationKeyFilterFactory.cs  |  2 +-
 .../Spell/TestWordBreakSpellChecker.cs             | 24 ++++++++--------
 src/Lucene.Net.Tests/Index/TestDeletionPolicy.cs   |  8 +++---
 .../Index/TestDocumentsWriterStallControl.cs       | 12 ++++----
 src/Lucene.Net.Tests/Index/TestIndexWriter.cs      |  4 +--
 .../Index/TestIndexWriterExceptions.cs             |  2 +-
 src/Lucene.Net.Tests/Index/TestStressIndexing2.cs  |  8 +++---
 src/Lucene.Net.Tests/Index/TestTransactions.cs     |  2 +-
 .../Search/TestDisjunctionMaxQuery.cs              | 32 +++++++++++-----------
 .../Util/Automaton/TestBasicOperations.cs          |  4 +--
 .../Util/Automaton/TestUTF32ToUTF8.cs              |  4 +--
 src/Lucene.Net/Index/IndexFileDeleter.cs           |  4 +--
 src/Lucene.Net/Index/IndexWriter.cs                | 10 ++++---
 src/Lucene.Net/Index/SegmentInfos.cs               |  2 +-
 src/Lucene.Net/Search/IndexSearcher.cs             |  5 ++--
 src/Lucene.Net/Store/FileSwitchDirectory.cs        |  4 +--
 src/Lucene.Net/Store/NRTCachingDirectory.cs        |  4 +--
 32 files changed, 110 insertions(+), 104 deletions(-)

diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Synonym/FSTSynonymFilterFactory.cs b/src/Lucene.Net.Analysis.Common/Analysis/Synonym/FSTSynonymFilterFactory.cs
index 46c78a9..20ca003 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Synonym/FSTSynonymFilterFactory.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Synonym/FSTSynonymFilterFactory.cs
@@ -134,7 +134,7 @@ namespace Lucene.Net.Analysis.Synonym
             }
             catch (Exception e)
             {
-                throw e;
+                throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
             }
 
             if (File.Exists(synonyms))
@@ -166,9 +166,9 @@ namespace Lucene.Net.Analysis.Synonym
                 }
                 return tokFactory;
             }
-            catch (Exception e)
+            catch (Exception /*e*/)
             {
-                throw e;
+                throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
             }
         }
     }
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Synonym/SlowSynonymFilterFactory.cs b/src/Lucene.Net.Analysis.Common/Analysis/Synonym/SlowSynonymFilterFactory.cs
index 691b794..5c81a8e 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Synonym/SlowSynonymFilterFactory.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Synonym/SlowSynonymFilterFactory.cs
@@ -212,9 +212,9 @@ namespace Lucene.Net.Analysis.Synonym
                 }
                 return tokFactory;
             }
-            catch (Exception e)
+            catch (Exception /*e*/)
             {
-                throw e;
+                throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
             }
         }
 
diff --git a/src/Lucene.Net.Benchmark/ByTask/Feeds/EnwikiContentSource.cs b/src/Lucene.Net.Benchmark/ByTask/Feeds/EnwikiContentSource.cs
index c310c2d..bc72b18 100644
--- a/src/Lucene.Net.Benchmark/ByTask/Feeds/EnwikiContentSource.cs
+++ b/src/Lucene.Net.Benchmark/ByTask/Feeds/EnwikiContentSource.cs
@@ -209,7 +209,7 @@ namespace Lucene.Net.Benchmarks.ByTask.Feeds
                                 // To work around a bug in XERCES (XERCESJ-1257), we assume the XML is always UTF8, so we simply provide reader.
                                 reader.Parse(new InputSource(IOUtils.GetDecodingReader(localFileIS, Encoding.UTF8)));
                             }
-                            catch (IOException ioe)
+                            catch (IOException /*ioe*/)
                             {
                                 lock (outerInstance)
                                 {
@@ -219,7 +219,7 @@ namespace Lucene.Net.Benchmarks.ByTask.Feeds
                                     }
                                     else
                                         // Exception is real
-                                        throw ioe;
+                                        throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
                                 }
                             }
                         }
diff --git a/src/Lucene.Net.Benchmark/ByTask/Tasks/AnalyzerFactoryTask.cs b/src/Lucene.Net.Benchmark/ByTask/Tasks/AnalyzerFactoryTask.cs
index 3f0f60d..b428a52 100644
--- a/src/Lucene.Net.Benchmark/ByTask/Tasks/AnalyzerFactoryTask.cs
+++ b/src/Lucene.Net.Benchmark/ByTask/Tasks/AnalyzerFactoryTask.cs
@@ -348,7 +348,7 @@ namespace Lucene.Net.Benchmarks.ByTask.Tasks
             {
                 if (e.Message.StartsWith("Line #", StringComparison.Ordinal))
                 {
-                    throw e;
+                    throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
                 }
                 else
                 {
@@ -503,7 +503,7 @@ namespace Lucene.Net.Benchmarks.ByTask.Tasks
             {
                 if (e.Message.StartsWith("Line #", StringComparison.Ordinal))
                 {
-                    throw e;
+                    throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
                 }
                 else
                 {
diff --git a/src/Lucene.Net.Benchmark/ByTask/Tasks/NewAnalyzerTask.cs b/src/Lucene.Net.Benchmark/ByTask/Tasks/NewAnalyzerTask.cs
index 37263fc..0549872 100644
--- a/src/Lucene.Net.Benchmark/ByTask/Tasks/NewAnalyzerTask.cs
+++ b/src/Lucene.Net.Benchmark/ByTask/Tasks/NewAnalyzerTask.cs
@@ -171,7 +171,7 @@ namespace Lucene.Net.Benchmarks.ByTask.Tasks
             {
                 if (e.Message.StartsWith("Line #", StringComparison.Ordinal))
                 {
-                    throw e;
+                    throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
                 }
                 else
                 {
diff --git a/src/Lucene.Net.TestFramework/Analysis/BaseTokenStreamTestCase.cs b/src/Lucene.Net.TestFramework/Analysis/BaseTokenStreamTestCase.cs
index 9e5870e..7abbe04 100644
--- a/src/Lucene.Net.TestFramework/Analysis/BaseTokenStreamTestCase.cs
+++ b/src/Lucene.Net.TestFramework/Analysis/BaseTokenStreamTestCase.cs
@@ -1065,7 +1065,7 @@ namespace Lucene.Net.Analysis
                             }
                             else
                             {
-                                throw ae;
+                                throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
                             }
                         }
                         finally
@@ -1104,7 +1104,7 @@ namespace Lucene.Net.Analysis
                             }
                             else
                             {
-                                throw ae;
+                                throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
                             }
                         }
                         finally
diff --git a/src/Lucene.Net.TestFramework/Index/AssertingAtomicReader.cs b/src/Lucene.Net.TestFramework/Index/AssertingAtomicReader.cs
index 4e6d7d6..f623206 100644
--- a/src/Lucene.Net.TestFramework/Index/AssertingAtomicReader.cs
+++ b/src/Lucene.Net.TestFramework/Index/AssertingAtomicReader.cs
@@ -289,11 +289,11 @@ namespace Lucene.Net.Index
                     int docid = @in.DocID;
                     Debug.Assert(docid == -1, @in.GetType() + ": invalid initial doc id: " + docid);
                 }
-                catch (System.NotSupportedException e)
+                catch (System.NotSupportedException /*e*/)
                 {
                     if (failOnUnsupportedDocID)
                     {
-                        throw e;
+                        throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
                     }
                 }
                 Doc = -1;
diff --git a/src/Lucene.Net.TestFramework/Index/BaseDocValuesFormatTestCase.cs b/src/Lucene.Net.TestFramework/Index/BaseDocValuesFormatTestCase.cs
index 804acd7..fb60fac 100644
--- a/src/Lucene.Net.TestFramework/Index/BaseDocValuesFormatTestCase.cs
+++ b/src/Lucene.Net.TestFramework/Index/BaseDocValuesFormatTestCase.cs
@@ -3019,7 +3019,7 @@ namespace Lucene.Net.Index
                 {
                     if (iae.Message.IndexOf("is too large", StringComparison.Ordinal) == -1)
                     {
-                        throw iae;
+                        throw /*iae*/; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
                     }
                     else
                     {
@@ -3041,7 +3041,7 @@ namespace Lucene.Net.Index
             {
                 if (iae.Message.IndexOf("is too large", StringComparison.Ordinal) == -1)
                 {
-                    throw iae;
+                    throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
                 }
                 else
                 {
diff --git a/src/Lucene.Net.TestFramework/Store/SlowOpeningMockIndexInputWrapper.cs b/src/Lucene.Net.TestFramework/Store/SlowOpeningMockIndexInputWrapper.cs
index 6604404..ed674bc 100644
--- a/src/Lucene.Net.TestFramework/Store/SlowOpeningMockIndexInputWrapper.cs
+++ b/src/Lucene.Net.TestFramework/Store/SlowOpeningMockIndexInputWrapper.cs
@@ -36,7 +36,7 @@ namespace Lucene.Net.Store
                 Thread.Sleep(50);
 #if !NETSTANDARD1_6
             }
-            catch (ThreadInterruptedException ie)
+            catch (ThreadInterruptedException /*ie*/)
             {
                 try
                 {
@@ -45,7 +45,8 @@ namespace Lucene.Net.Store
                 catch (Exception)
                 {
                 }
-                throw new ThreadInterruptedException(ie.ToString(), ie);
+                //throw new ThreadInterruptedException(ie.ToString(), ie);
+                throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
             }
 #endif
         }
diff --git a/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs b/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
index 8db12de..45eb5a4 100644
--- a/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
+++ b/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
@@ -801,10 +801,10 @@ namespace Lucene.Net.Util
                 {
                     insanity = FieldCacheSanityChecker.CheckSanity(entries);
                 }
-                catch (Exception e)
+                catch (Exception /*e*/)
                 {
                     DumpArray(msg + ": FieldCache", entries, Console.Error);
-                    throw e;
+                    throw;  // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
                 }
 
                 Assert.AreEqual(0, insanity.Length, msg + ": Insane FieldCache usage(s) found");
diff --git a/src/Lucene.Net.TestFramework/Util/TestRuleSetupAndRestoreClassEnv.cs b/src/Lucene.Net.TestFramework/Util/TestRuleSetupAndRestoreClassEnv.cs
index 08e9fc8..a95307b 100644
--- a/src/Lucene.Net.TestFramework/Util/TestRuleSetupAndRestoreClassEnv.cs
+++ b/src/Lucene.Net.TestFramework/Util/TestRuleSetupAndRestoreClassEnv.cs
@@ -279,7 +279,7 @@ namespace Lucene.Net.Util
             catch (Exception e)
             {
                 Console.Error.WriteLine("NOTE: " + e.Message + " Suppressed codecs: " + Arrays.ToString(avoidCodecs.ToArray()));
-                throw e;
+                throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
             }
         }
 
diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/CharFilters/HTMLStripCharFilterTest.cs b/src/Lucene.Net.Tests.Analysis.Common/Analysis/CharFilters/HTMLStripCharFilterTest.cs
index ea10176..9a63597 100644
--- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/CharFilters/HTMLStripCharFilterTest.cs
+++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/CharFilters/HTMLStripCharFilterTest.cs
@@ -723,7 +723,7 @@ namespace Lucene.Net.Analysis.CharFilters
             {
                 if (gold.Equals(builder.ToString(), StringComparison.Ordinal))
                 {
-                    throw e;
+                    throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
                 }
                 throw new Exception("('" + builder.ToString() + "' is not equal to '" + gold + "').  " + e.Message, e);
             }
diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestAllAnalyzersHaveFactories.cs b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestAllAnalyzersHaveFactories.cs
index a58f316..d2c157f 100644
--- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestAllAnalyzersHaveFactories.cs
+++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestAllAnalyzersHaveFactories.cs
@@ -114,7 +114,7 @@ namespace Lucene.Net.Analysis.Core
                         if (e.InnerException is MissingMethodException)
                         {
                             // there is no corresponding ctor available
-                            throw e;
+                            throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
                         }
                         // TODO: For now pass because some factories have not yet a default config that always works
                     }
@@ -146,7 +146,7 @@ namespace Lucene.Net.Analysis.Core
                         if (e.InnerException is MissingMethodException)
                         {
                             // there is no corresponding ctor available
-                            throw e;
+                            throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
                         }
                         // TODO: For now pass because some factories have not yet a default config that always works
                     }
@@ -178,7 +178,7 @@ namespace Lucene.Net.Analysis.Core
                         if (e.InnerException is MissingMethodException)
                         {
                             // there is no corresponding ctor available
-                            throw e;
+                            throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
                         }
                         // TODO: For now pass because some factories have not yet a default config that always works
                     }
diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestRandomChains.cs b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestRandomChains.cs
index d9f4a54..efa857b 100644
--- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestRandomChains.cs
+++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestRandomChains.cs
@@ -525,9 +525,9 @@ namespace Lucene.Net.Analysis.Core
                         {
                             return new Dictionary(affixStream, dictStream);
                         }
-                        catch (Exception ex)
+                        catch (Exception /*ex*/)
                         {
-                            throw ex;
+                            throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
 #pragma warning disable 162
                             return null; // unreachable code
 #pragma warning restore 162
@@ -574,9 +574,9 @@ namespace Lucene.Net.Analysis.Core
                         return hyphenator;
                     }
                 }
-                catch (Exception ex)
+                catch (Exception /*ex*/)
                 {
-                    throw ex;
+                    throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
 #pragma warning disable 162
                     return null; // unreachable code
 #pragma warning restore 162
@@ -594,9 +594,9 @@ namespace Lucene.Net.Analysis.Core
                     Type clazz = Type.GetType("Lucene.Net.Tartarus.Snowball.Ext." + lang + "Stemmer, Lucene.Net.Analysis.Common");
                     return clazz.GetConstructor(new Type[0]).Invoke(new object[0]);
                 }
-                catch (Exception ex)
+                catch (Exception /*ex*/)
                 {
-                    throw ex;
+                    throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
 #pragma warning disable 162
                     return null; // unreachable code
 #pragma warning restore 162
@@ -700,9 +700,9 @@ namespace Lucene.Net.Analysis.Core
                 {
                     return builder.Build();
                 }
-                catch (Exception ex)
+                catch (Exception /*ex*/)
                 {
-                    throw ex;
+                    throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
 #pragma warning disable 162
                     return null; // unreachable code
 #pragma warning restore 162
@@ -724,9 +724,9 @@ namespace Lucene.Net.Analysis.Core
                 {
                     return b.Build();
                 }
-                catch (Exception ex)
+                catch (Exception /*ex*/)
                 {
-                    throw ex;
+                    throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
 #pragma warning disable 162
                     return null; // unreachable code
 #pragma warning restore 162
@@ -927,7 +927,7 @@ namespace Lucene.Net.Analysis.Core
                     }
                     else
                     {
-                        throw ite;
+                        throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
                     }
                 }
                 //catch (IllegalAccessException iae)
@@ -1167,10 +1167,10 @@ namespace Lucene.Net.Analysis.Core
                     CheckRandomData(random, a, 500 * RANDOM_MULTIPLIER, 20, false,
                                     false /* We already validate our own offsets... */);
                 }
-                catch (Exception e)
+                catch (Exception /*e*/)
                 {
                     Console.WriteLine("Exception from random analyzer: " + a);
-                    throw e;
+                    throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
                 }
             }
         }
@@ -1193,10 +1193,10 @@ namespace Lucene.Net.Analysis.Core
                     CheckRandomData(random, a, 50 * RANDOM_MULTIPLIER, 128, false,
                                     false /* We already validate our own offsets... */);
                 }
-                catch (Exception e)
+                catch (Exception /*e*/)
                 {
                     Console.WriteLine("Exception from random analyzer: " + a);
-                    throw e;
+                    throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
                 }
             }
         }
diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Util/BaseTokenStreamFactoryTestCase.cs b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Util/BaseTokenStreamFactoryTestCase.cs
index 7924089..b23571b 100644
--- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Util/BaseTokenStreamFactoryTestCase.cs
+++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Util/BaseTokenStreamFactoryTestCase.cs
@@ -83,7 +83,7 @@ namespace Lucene.Net.Analysis.Util
                 }
                 else
                 {
-                    throw e;
+                    throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
                 }
             }
             if (factory is IResourceLoaderAware)
diff --git a/src/Lucene.Net.Tests.Analysis.ICU/Collation/TestICUCollationKeyFilterFactory.cs b/src/Lucene.Net.Tests.Analysis.ICU/Collation/TestICUCollationKeyFilterFactory.cs
index 93c3b81..fce10cd 100644
--- a/src/Lucene.Net.Tests.Analysis.ICU/Collation/TestICUCollationKeyFilterFactory.cs
+++ b/src/Lucene.Net.Tests.Analysis.ICU/Collation/TestICUCollationKeyFilterFactory.cs
@@ -332,7 +332,7 @@ namespace Lucene.Net.Collation
                 }
                 else
                 {
-                    throw e;
+                    throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
                 }
             }
             if (factory is IResourceLoaderAware)
diff --git a/src/Lucene.Net.Tests.Suggest/Spell/TestWordBreakSpellChecker.cs b/src/Lucene.Net.Tests.Suggest/Spell/TestWordBreakSpellChecker.cs
index fd1e2e4..ede9113 100644
--- a/src/Lucene.Net.Tests.Suggest/Spell/TestWordBreakSpellChecker.cs
+++ b/src/Lucene.Net.Tests.Suggest/Spell/TestWordBreakSpellChecker.cs
@@ -151,10 +151,10 @@ namespace Lucene.Net.Search.Spell
                     assertTrue(cs[1].Suggestion.String.Equals("hundredeight", StringComparison.Ordinal));
                 }
             }
-            catch (Exception e)
-            {
-                throw e;
-            }
+            //catch (Exception e) // LUCENENET: Senseless to catch and rethrow here
+            //{
+            //    throw e;
+            //}
             finally
             {
                 try { ir.Dispose(); } catch (Exception /*e1*/) { }
@@ -263,10 +263,10 @@ namespace Lucene.Net.Search.Spell
                 }
 
             }
-            catch (Exception e)
-            {
-                throw e;
-            }
+            //catch (Exception e) // LUCENENET: Senseless to catch and rethrow here
+            //{
+            //    throw e;
+            //}
             finally
             {
                 try { ir.Dispose(); } catch (Exception /*e1*/) { }
@@ -372,10 +372,10 @@ namespace Lucene.Net.Search.Spell
                 }
 
             }
-            catch (Exception e)
-            {
-                throw e;
-            }
+            //catch (Exception e) // LUCENENET: Senseless to catch and rethrow here
+            //{
+            //    throw e;
+            //}
             finally
             {
                 try
diff --git a/src/Lucene.Net.Tests/Index/TestDeletionPolicy.cs b/src/Lucene.Net.Tests/Index/TestDeletionPolicy.cs
index b501f56..ee98482 100644
--- a/src/Lucene.Net.Tests/Index/TestDeletionPolicy.cs
+++ b/src/Lucene.Net.Tests/Index/TestDeletionPolicy.cs
@@ -645,11 +645,11 @@ namespace Lucene.Net.Index
                             Assert.Fail("should have failed on commits prior to last " + N);
                         }
                     }
-                    catch (IOException e)
+                    catch (IOException /*e*/)
                     {
                         if (i != N)
                         {
-                            throw e;
+                            throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
                         }
                     }
                     if (i < N)
@@ -765,11 +765,11 @@ namespace Lucene.Net.Index
                             Assert.Fail("should have failed on commits before last " + N);
                         }
                     }
-                    catch (IOException e)
+                    catch (IOException /*e*/)
                     {
                         if (i != N)
                         {
-                            throw e;
+                            throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
                         }
                     }
                     if (i < N)
diff --git a/src/Lucene.Net.Tests/Index/TestDocumentsWriterStallControl.cs b/src/Lucene.Net.Tests/Index/TestDocumentsWriterStallControl.cs
index ade3e46..67a0f17 100644
--- a/src/Lucene.Net.Tests/Index/TestDocumentsWriterStallControl.cs
+++ b/src/Lucene.Net.Tests/Index/TestDocumentsWriterStallControl.cs
@@ -271,10 +271,11 @@ namespace Lucene.Net.Index
                                 Assert.IsTrue(Sync.await());
 #if !NETSTANDARD1_6
                             }
-                            catch (ThreadInterruptedException e)
+                            catch (ThreadInterruptedException /*e*/)
                             {
                                 Console.WriteLine("[Waiter] got interrupted - wait count: " + Sync.Waiter.CurrentCount);
-                                throw new ThreadInterruptedException("Thread Interrupted Exception", e);
+                                //throw new ThreadInterruptedException("Thread Interrupted Exception", e);
+                                throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
                             }
 #endif
                         }
@@ -328,16 +329,17 @@ namespace Lucene.Net.Index
                                 Assert.IsTrue(Sync.await());
                             }
 #if !NETSTANDARD1_6
-                            catch (ThreadInterruptedException e)
+                            catch (ThreadInterruptedException /*e*/)
                             {
                                 Console.WriteLine("[Updater] got interrupted - wait count: " + Sync.Waiter.CurrentCount);
-                                throw new ThreadInterruptedException("Thread Interrupted Exception", e);
+                                //throw new ThreadInterruptedException("Thread Interrupted Exception", e);
+                                throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
                             }
 #endif
                             catch (Exception e)
                             {
                                 Console.Write("signal failed with : " + e);
-                                throw e;
+                                throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
                             }
 
                             Sync.LeftCheckpoint.Signal();
diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriter.cs b/src/Lucene.Net.Tests/Index/TestIndexWriter.cs
index b99a7cf..ed8f476 100644
--- a/src/Lucene.Net.Tests/Index/TestIndexWriter.cs
+++ b/src/Lucene.Net.Tests/Index/TestIndexWriter.cs
@@ -2713,14 +2713,14 @@ namespace Lucene.Net.Index
                         Assert.Fail("expected exception");
                     }
                 }
-                catch (IOException ioe)
+                catch (IOException /*ioe*/)
                 {
                     // OpenMode_e.APPEND should throw an exception since no
                     // index exists:
                     if (mode == 0)
                     {
                         // Unexpected
-                        throw ioe;
+                        throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
                     }
                 }
 
diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriterExceptions.cs b/src/Lucene.Net.Tests/Index/TestIndexWriterExceptions.cs
index d2373d5..6a0b259 100644
--- a/src/Lucene.Net.Tests/Index/TestIndexWriterExceptions.cs
+++ b/src/Lucene.Net.Tests/Index/TestIndexWriterExceptions.cs
@@ -2359,7 +2359,7 @@ namespace Lucene.Net.Index
                     }
                     else
                     {
-                        throw ioe;
+                        throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
                     }
                 }
                 shouldFail.Set(false);
diff --git a/src/Lucene.Net.Tests/Index/TestStressIndexing2.cs b/src/Lucene.Net.Tests/Index/TestStressIndexing2.cs
index 3a5b77a..b552f7a 100644
--- a/src/Lucene.Net.Tests/Index/TestStressIndexing2.cs
+++ b/src/Lucene.Net.Tests/Index/TestStressIndexing2.cs
@@ -442,12 +442,12 @@ namespace Lucene.Net.Index
                 {
                     VerifyEquals(r1.Document(id1), r2.Document(id2));
                 }
-                catch (Exception t)
+                catch (Exception /*t*/)
                 {
                     Console.WriteLine("FAILED id=" + term + " id1=" + id1 + " id2=" + id2 + " term=" + term);
                     Console.WriteLine("  d1=" + r1.Document(id1));
                     Console.WriteLine("  d2=" + r2.Document(id2));
-                    throw t;
+                    throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
                 }
 
                 try
@@ -455,7 +455,7 @@ namespace Lucene.Net.Index
                     // verify term vectors are equivalent
                     VerifyEquals(r1.GetTermVectors(id1), r2.GetTermVectors(id2));
                 }
-                catch (Exception e)
+                catch (Exception /*e*/)
                 {
                     Console.WriteLine("FAILED id=" + term + " id1=" + id1 + " id2=" + id2);
                     Fields tv1 = r1.GetTermVectors(id1);
@@ -536,7 +536,7 @@ namespace Lucene.Net.Index
                         }
                     }
 
-                    throw e;
+                    throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
                 }
             }
 
diff --git a/src/Lucene.Net.Tests/Index/TestTransactions.cs b/src/Lucene.Net.Tests/Index/TestTransactions.cs
index acefbbc..2f5b037 100644
--- a/src/Lucene.Net.Tests/Index/TestTransactions.cs
+++ b/src/Lucene.Net.Tests/Index/TestTransactions.cs
@@ -246,7 +246,7 @@ namespace Lucene.Net.Index
                     {
                         if (!e.Message.Contains("on purpose"))
                         {
-                            throw e;
+                            throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
                         }
                         if (r1 != null)
                         {
diff --git a/src/Lucene.Net.Tests/Search/TestDisjunctionMaxQuery.cs b/src/Lucene.Net.Tests/Search/TestDisjunctionMaxQuery.cs
index 77722c7..c1c8f18 100644
--- a/src/Lucene.Net.Tests/Search/TestDisjunctionMaxQuery.cs
+++ b/src/Lucene.Net.Tests/Search/TestDisjunctionMaxQuery.cs
@@ -233,10 +233,10 @@ namespace Lucene.Net.Search
                     Assert.AreEqual(score, h[i].Score, SCORE_COMP_THRESH, "score #" + i + " is not the same");
                 }
             }
-            catch (Exception e)
+            catch (Exception /*e*/)
             {
                 PrintHits("testSimpleEqualScores1", h, s);
-                throw e;
+                throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
             }
         }
 
@@ -259,10 +259,10 @@ namespace Lucene.Net.Search
                     Assert.AreEqual(score, h[i].Score, SCORE_COMP_THRESH, "score #" + i + " is not the same");
                 }
             }
-            catch (Exception e)
+            catch (Exception /*e*/)
             {
                 PrintHits("testSimpleEqualScores2", h, s);
-                throw e;
+                throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
             }
         }
 
@@ -287,10 +287,10 @@ namespace Lucene.Net.Search
                     Assert.AreEqual(score, h[i].Score, SCORE_COMP_THRESH, "score #" + i + " is not the same");
                 }
             }
-            catch (Exception e)
+            catch (Exception /*e*/)
             {
                 PrintHits("testSimpleEqualScores3", h, s);
-                throw e;
+                throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
             }
         }
 
@@ -314,10 +314,10 @@ namespace Lucene.Net.Search
                 Assert.IsTrue(score0 > score1, "d2 does not have better score then others: " + score0 + " >? " + score1);
                 Assert.AreEqual(score1, score2, SCORE_COMP_THRESH, "d4 and d1 don't have equal scores");
             }
-            catch (Exception e)
+            catch (Exception /*e*/)
             {
                 PrintHits("testSimpleTiebreaker", h, s);
-                throw e;
+                throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
             }
         }
 
@@ -353,10 +353,10 @@ namespace Lucene.Net.Search
                     Assert.AreEqual(score, h[i].Score, SCORE_COMP_THRESH, "score #" + i + " is not the same");
                 }
             }
-            catch (Exception e)
+            catch (Exception /*e*/)
             {
                 PrintHits("testBooleanRequiredEqualScores1", h, s);
-                throw e;
+                throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
             }
         }
 
@@ -392,10 +392,10 @@ namespace Lucene.Net.Search
                 float score1 = h[h.Length - 1].Score;
                 Assert.IsTrue(score > score1, "d1 does not have worse score then others: " + score + " >? " + score1);
             }
-            catch (Exception e)
+            catch (Exception /*e*/)
             {
                 PrintHits("testBooleanOptionalNoTiebreaker", h, s);
-                throw e;
+                throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
             }
         }
 
@@ -442,10 +442,10 @@ namespace Lucene.Net.Search
                 Assert.AreEqual("d1", doc3, "wrong fourth");
                 Assert.IsTrue(score2 > score3, "d1 does not have worse score then d3: " + score2 + " >? " + score3);
             }
-            catch (Exception e)
+            catch (Exception /*e*/)
             {
                 PrintHits("testBooleanOptionalWithTiebreaker", h, s);
-                throw e;
+                throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
             }
         }
 
@@ -492,10 +492,10 @@ namespace Lucene.Net.Search
                 Assert.IsTrue(score1 > score2, "d3 does not have a better score then d2: " + score1 + " >? " + score2);
                 Assert.IsTrue(score2 > score3, "d3 does not have a better score then d1: " + score2 + " >? " + score3);
             }
-            catch (Exception e)
+            catch (Exception /*e*/)
             {
                 PrintHits("TestBooleanOptionalWithTiebreakerAndBoost", h, s);
-                throw e;
+                throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
             }
         }
 
diff --git a/src/Lucene.Net.Tests/Util/Automaton/TestBasicOperations.cs b/src/Lucene.Net.Tests/Util/Automaton/TestBasicOperations.cs
index 4f1180b..295332b 100644
--- a/src/Lucene.Net.Tests/Util/Automaton/TestBasicOperations.cs
+++ b/src/Lucene.Net.Tests/Util/Automaton/TestBasicOperations.cs
@@ -161,7 +161,7 @@ namespace Lucene.Net.Util.Automaton
                         string s = UnicodeUtil.NewString(acc, 0, acc.Length);
                         Assert.IsTrue(BasicOperations.Run(a, s));
                     }
-                    catch (Exception t)
+                    catch (Exception /*t*/)
                     {
                         Console.WriteLine("regexp: " + re);
                         if (acc != null)
@@ -172,7 +172,7 @@ namespace Lucene.Net.Util.Automaton
                                 Console.WriteLine("  " + acc[k].ToString("x"));
                             }
                         }
-                        throw t;
+                        throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
                     }
                 }
             }
diff --git a/src/Lucene.Net.Tests/Util/Automaton/TestUTF32ToUTF8.cs b/src/Lucene.Net.Tests/Util/Automaton/TestUTF32ToUTF8.cs
index a8a82b1..9bcdc98 100644
--- a/src/Lucene.Net.Tests/Util/Automaton/TestUTF32ToUTF8.cs
+++ b/src/Lucene.Net.Tests/Util/Automaton/TestUTF32ToUTF8.cs
@@ -270,14 +270,14 @@ namespace Lucene.Net.Util.Automaton
                     {
                         s = UnicodeUtil.NewString(codepoints, 0, codepoints.Length);
                     }
-                    catch (Exception e)
+                    catch (Exception /*e*/)
                     {
                         Console.WriteLine(codepoints.Length + " codepoints:");
                         for (int j = 0; j < codepoints.Length; j++)
                         {
                             Console.WriteLine("  " + codepoints[j].ToString("x"));
                         }
-                        throw e;
+                        throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
                     }
                 }
                 var bytes = s.GetBytes(Encoding.UTF8);
diff --git a/src/Lucene.Net/Index/IndexFileDeleter.cs b/src/Lucene.Net/Index/IndexFileDeleter.cs
index 90d2fa1..3f1eb20 100644
--- a/src/Lucene.Net/Index/IndexFileDeleter.cs
+++ b/src/Lucene.Net/Index/IndexFileDeleter.cs
@@ -238,11 +238,11 @@ namespace Lucene.Net.Index
                                 }
                                 sis = null;
                             }
-                            catch (IOException e)
+                            catch (IOException /*e*/)
                             {
                                 if (SegmentInfos.GenerationFromSegmentsFileName(fileName) <= currentGen && directory.FileLength(fileName) > 0)
                                 {
-                                    throw e;
+                                    throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
                                 }
                                 else
                                 {
diff --git a/src/Lucene.Net/Index/IndexWriter.cs b/src/Lucene.Net/Index/IndexWriter.cs
index 53496bd..4984d97 100644
--- a/src/Lucene.Net/Index/IndexWriter.cs
+++ b/src/Lucene.Net/Index/IndexWriter.cs
@@ -594,7 +594,8 @@ namespace Lucene.Net.Index
                                 // elements we have iterated over so far
                                 // before throwing an exception.
                                 readerMap.RemoveAll(toDelete);
-                                IOUtils.ReThrow(t);
+                                //IOUtils.ReThrow(t);
+                                throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
                             }
                             else if (priorE == null)
                             {
@@ -629,7 +630,8 @@ namespace Lucene.Net.Index
                                 // elements we have iterated over so far
                                 // before throwing an exception.
                                 readerMap.RemoveAll(toDelete);
-                                IOUtils.ReThrow(t);
+                                //IOUtils.ReThrow(t);
+                                throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
                             }
                             else if (priorE == null)
                             {
@@ -3418,7 +3420,7 @@ namespace Lucene.Net.Index
             {
                 currentCodec.SegmentInfoFormat.SegmentInfoWriter.Write(trackingDir, newInfo, fis, context);
             }
-            catch (System.NotSupportedException uoe)
+            catch (System.NotSupportedException /*uoe*/)
             {
 #pragma warning disable 612, 618
                 if (currentCodec is Lucene3xCodec)
@@ -3429,7 +3431,7 @@ namespace Lucene.Net.Index
                 }
                 else
                 {
-                    throw uoe;
+                    throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
                 }
             }
 
diff --git a/src/Lucene.Net/Index/SegmentInfos.cs b/src/Lucene.Net/Index/SegmentInfos.cs
index 2ad3398..455cb09 100644
--- a/src/Lucene.Net/Index/SegmentInfos.cs
+++ b/src/Lucene.Net/Index/SegmentInfos.cs
@@ -958,7 +958,7 @@ namespace Lucene.Net.Index
                                 // rethrow any format exception
                                 if (err2 is CorruptIndexException)
                                 {
-                                    throw;
+                                    throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
                                 }
                             }
                             finally
diff --git a/src/Lucene.Net/Search/IndexSearcher.cs b/src/Lucene.Net/Search/IndexSearcher.cs
index 0da6522..8aab32c 100644
--- a/src/Lucene.Net/Search/IndexSearcher.cs
+++ b/src/Lucene.Net/Search/IndexSearcher.cs
@@ -911,9 +911,10 @@ namespace Lucene.Net.Search
                         return true;
                     }
 #if !NETSTANDARD1_6
-                    catch (ThreadInterruptedException e)
+                    catch (ThreadInterruptedException /*e*/)
                     {
-                        throw new ThreadInterruptedException(e.ToString(), e);
+                        //throw new ThreadInterruptedException(e.ToString(), e);
+                        throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
                     }
 #endif
                     catch (Exception e)
diff --git a/src/Lucene.Net/Store/FileSwitchDirectory.cs b/src/Lucene.Net/Store/FileSwitchDirectory.cs
index cceff73..29d1c9c 100644
--- a/src/Lucene.Net/Store/FileSwitchDirectory.cs
+++ b/src/Lucene.Net/Store/FileSwitchDirectory.cs
@@ -113,7 +113,7 @@ namespace Lucene.Net.Store
                     files.Add(f);
                 }
             }
-            catch (DirectoryNotFoundException e)
+            catch (DirectoryNotFoundException /*e*/)
             {
                 // we got NoSuchDirectoryException from both dirs
                 // rethrow the first.
@@ -125,7 +125,7 @@ namespace Lucene.Net.Store
                 // and the primary is empty.
                 if (files.Count == 0)
                 {
-                    throw e;
+                    throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
                 }
             }
             // we got NoSuchDirectoryException from the primary,
diff --git a/src/Lucene.Net/Store/NRTCachingDirectory.cs b/src/Lucene.Net/Store/NRTCachingDirectory.cs
index 4c1fba3..1626c83 100644
--- a/src/Lucene.Net/Store/NRTCachingDirectory.cs
+++ b/src/Lucene.Net/Store/NRTCachingDirectory.cs
@@ -150,13 +150,13 @@ namespace Lucene.Net.Store
                         files.Add(f);
                     }
                 }
-                catch (DirectoryNotFoundException ex)
+                catch (DirectoryNotFoundException /*ex*/)
                 {
                     // however, if there are no cached files, then the directory truly
                     // does not "exist"
                     if (files.Count == 0)
                     {
-                        throw ex;
+                        throw; // LUCENENET: CA2200: Rethrow to preserve stack details (https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2200-rethrow-to-preserve-stack-details)
                     }
                 }
                 return files.ToArray();


[lucenenet] 37/42: BUG: Lucene.Net.Highlighter.VectorHighlight.FieldQuery: List replacement for LinkedHashSet preserves insertion order, but we need to explicitly check to ensure no duplicate values are added

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit 0245279c420bef7e14be4e3cb241726cbb180dab
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Wed Aug 7 08:43:45 2019 +0700

    BUG: Lucene.Net.Highlighter.VectorHighlight.FieldQuery: List<T> replacement for LinkedHashSet<T> preserves insertion order, but we need to explicitly check to ensure no duplicate values are added
---
 .../VectorHighlight/FieldQuery.cs                   | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/src/Lucene.Net.Highlighter/VectorHighlight/FieldQuery.cs b/src/Lucene.Net.Highlighter/VectorHighlight/FieldQuery.cs
index 369c4b7..8c2676b 100644
--- a/src/Lucene.Net.Highlighter/VectorHighlight/FieldQuery.cs
+++ b/src/Lucene.Net.Highlighter/VectorHighlight/FieldQuery.cs
@@ -110,7 +110,7 @@ namespace Lucene.Net.Search.VectorHighlight
             }
             else if (sourceQuery is PhraseQuery)
             {
-                if (!flatQueries.Contains(sourceQuery))
+                if (!flatQueries.Contains(sourceQuery)) // LUCENENET - set semantics, but this is a list. The original logic was already correct.
                 {
                     PhraseQuery pq = (PhraseQuery)sourceQuery;
                     if (pq.GetTerms().Length > 1)
@@ -119,7 +119,8 @@ namespace Lucene.Net.Search.VectorHighlight
                     {
                         Query flat = new TermQuery(pq.GetTerms()[0]);
                         flat.Boost = pq.Boost;
-                        flatQueries.Add(flat);
+                        if (!flatQueries.Contains(flat)) // LUCENENET specific - set semantics, but this is a list
+                            flatQueries.Add(flat);
                     }
                 }
             }
@@ -202,13 +203,17 @@ namespace Lucene.Net.Search.VectorHighlight
                 {
                     i++;
                 }
-                expandQueries.Add(query);
+                if (!expandQueries.Contains(query)) // LUCENENET specific - set semantics, but this is a list
+                    expandQueries.Add(query);
                 if (!(query is PhraseQuery)) continue;
-                for (IEnumerator<Query> j = flatQueries.GetEnumerator(); j.MoveNext();)
+                using (IEnumerator<Query> j = flatQueries.GetEnumerator())
                 {
-                    Query qj = j.Current;
-                    if (!(qj is PhraseQuery)) continue;
-                    CheckOverlap(expandQueries, (PhraseQuery)query, (PhraseQuery)qj);
+                    while (j.MoveNext())
+                    {
+                        Query qj = j.Current;
+                        if (!(qj is PhraseQuery)) continue;
+                        CheckOverlap(expandQueries, (PhraseQuery)query, (PhraseQuery)qj);
+                    }
                 }
             }
 
@@ -289,7 +294,7 @@ namespace Lucene.Net.Search.VectorHighlight
                     }
                     pq.Slop = slop;
                     pq.Boost = boost;
-                    if (!expandQueries.Contains(pq))
+                    if (!expandQueries.Contains(pq)) // LUCENENET specific - set semantics, but this is a list
                         expandQueries.Add(pq);
                 }
             }


[lucenenet] 38/42: BUG: Lucene.Net.Tests.Search.TestFieldCacheRangeFilter.TestSparseIndex: formatting value must be done in invariant culture

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit ae60215ee62641e1196e8587fdd84b33f2e31718
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Wed Aug 7 09:30:44 2019 +0700

    BUG: Lucene.Net.Tests.Search.TestFieldCacheRangeFilter.TestSparseIndex: formatting value must be done in invariant culture
---
 src/Lucene.Net.Tests/Search/TestFieldCacheRangeFilter.cs | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/Lucene.Net.Tests/Search/TestFieldCacheRangeFilter.cs b/src/Lucene.Net.Tests/Search/TestFieldCacheRangeFilter.cs
index 63f77d9..97e5e1d 100644
--- a/src/Lucene.Net.Tests/Search/TestFieldCacheRangeFilter.cs
+++ b/src/Lucene.Net.Tests/Search/TestFieldCacheRangeFilter.cs
@@ -1,6 +1,7 @@
 using Lucene.Net.Documents;
 using NUnit.Framework;
 using System;
+using System.Globalization;
 using System.IO;
 
 namespace Lucene.Net.Search
@@ -559,7 +560,7 @@ namespace Lucene.Net.Search
             for (int d = -20; d <= 20; d++)
             {
                 Document doc = new Document();
-                doc.Add(NewStringField("id", Convert.ToString(d), Field.Store.NO));
+                doc.Add(NewStringField("id", Convert.ToString(d, CultureInfo.InvariantCulture), Field.Store.NO));
                 doc.Add(NewStringField("body", "body", Field.Store.NO));
                 writer.AddDocument(doc);
             }


[lucenenet] 11/42: BUG: Lucene.Net.Analysis.Common.Analysis.Miscellaneous.TruncateTokenFilterFactory - Fixed issue converting string to sbyte in ambient culture

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit 245bbc471516a0bccce2948ca35765810227a2c3
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Wed Jul 31 07:15:18 2019 +0700

    BUG: Lucene.Net.Analysis.Common.Analysis.Miscellaneous.TruncateTokenFilterFactory - Fixed issue converting string to sbyte in ambient culture
---
 .../Analysis/Miscellaneous/TruncateTokenFilterFactory.cs             | 5 +++--
 .../Analysis/Miscellaneous/TestTruncateTokenFilterFactory.cs         | 1 +
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/TruncateTokenFilterFactory.cs b/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/TruncateTokenFilterFactory.cs
index 1aeb5d3..a1c4cec 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/TruncateTokenFilterFactory.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/TruncateTokenFilterFactory.cs
@@ -1,5 +1,6 @@
 using Lucene.Net.Analysis.Util;
 using System.Collections.Generic;
+using System.Globalization;
 
 namespace Lucene.Net.Analysis.Miscellaneous
 {
@@ -45,10 +46,10 @@ namespace Lucene.Net.Analysis.Miscellaneous
         public TruncateTokenFilterFactory(IDictionary<string, string> args) 
             : base(args)
         {
-            prefixLength = sbyte.Parse(Get(args, PREFIX_LENGTH_KEY, "5"));
+            prefixLength = sbyte.Parse(Get(args, PREFIX_LENGTH_KEY, "5"), NumberStyles.Integer, CultureInfo.InvariantCulture);
             if (prefixLength < 1)
             {
-                throw new System.ArgumentException(PREFIX_LENGTH_KEY + " parameter must be a positive number: " + prefixLength);
+                throw new System.ArgumentException(PREFIX_LENGTH_KEY + " parameter must be a positive number: " + prefixLength.ToString(CultureInfo.InvariantCulture));
             }
             if (args.Count > 0)
             {
diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Miscellaneous/TestTruncateTokenFilterFactory.cs b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Miscellaneous/TestTruncateTokenFilterFactory.cs
index e7c95c2..32d62cf 100644
--- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Miscellaneous/TestTruncateTokenFilterFactory.cs
+++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Miscellaneous/TestTruncateTokenFilterFactory.cs
@@ -1,4 +1,5 @@
 using NUnit.Framework;
+using System;
 using System.IO;
 using BaseTokenStreamFactoryTestCase = Lucene.Net.Analysis.Util.BaseTokenStreamFactoryTestCase;
 


[lucenenet] 19/42: Lucene.Net.Expressions: Corrected casing on app.config to lower (xplat problem)

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit aea3cc7371baa8a5524beebaccb679b8148c2cb5
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Sat Aug 3 02:39:34 2019 +0700

    Lucene.Net.Expressions: Corrected casing on app.config to lower (xplat problem)
---
 src/Lucene.Net.Expressions/Lucene.Net.Expressions.csproj | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/Lucene.Net.Expressions/Lucene.Net.Expressions.csproj b/src/Lucene.Net.Expressions/Lucene.Net.Expressions.csproj
index 5f2c880..975a057 100644
--- a/src/Lucene.Net.Expressions/Lucene.Net.Expressions.csproj
+++ b/src/Lucene.Net.Expressions/Lucene.Net.Expressions.csproj
@@ -36,7 +36,7 @@
   </PropertyGroup>
 
   <ItemGroup>
-    <None Include="App.config" />
+    <None Include="app.config" />
   </ItemGroup>
 
   <ItemGroup>


[lucenenet] 18/42: build.ps1: Added option to specify maximum number of parallel jobs to use during testing

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit 9ad6f005cdf63142ff8b8f8564f982bb48828018
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Fri Aug 2 21:54:30 2019 +0700

    build.ps1: Added option to specify maximum number of parallel jobs to use during testing
---
 README.md       |  8 +++++++-
 build.bat       | 16 +++++++++++++++-
 build/build.ps1 | 17 ++++++++++++++++-
 3 files changed, 38 insertions(+), 3 deletions(-)

diff --git a/README.md b/README.md
index 3b83d5e..4ce4667 100644
--- a/README.md
+++ b/README.md
@@ -180,6 +180,12 @@ To build the source, clone or download and unzip the repository. From the reposi
 		<td>build&nbsp;&#8209;&#8209;Configuration:Debug</td>
 	</tr>
 	<tr>
+		<td>&#8209;mp</td>
+		<td>&#8209;&#8209;MaximumParallelJobs</td>
+		<td>The maximum number of parallel jobs to run during testing. If not supplied, the default is 8.</td>
+		<td>build&nbsp;&#8209;mp:10</td>
+	</tr>
+	<tr>
 		<td>&#8209;pv</td>
 		<td>&#8209;&#8209;PackageVersion</td>
 		<td>The NuGet package version. If not supplied, will use the version from the Version.proj file.</td>
@@ -188,7 +194,7 @@ To build the source, clone or download and unzip the repository. From the reposi
 	<tr>
 		<td>&#8209;t</td>
 		<td>&#8209;&#8209;Test</td>
-		<td>Runs the tests after building. Note that testing typically takes upwards of 2 hours.</td>
+		<td>Runs the tests after building. Note that testing typically takes around 40 minutes with 8 parallel jobs.</td>
 		<td>build&nbsp;&#8209;t</td>
 	</tr>
 	<tr>
diff --git a/build.bat b/build.bat
index c4375e4..4fb317e 100644
--- a/build.bat
+++ b/build.bat
@@ -39,6 +39,9 @@ GOTO endcommentblock
 ::   --Test
 ::   -t - Run the tests.
 ::
+::   --MaximumParallelJobs
+::   -mp - Set the maxumum number of parallel jobs to run during testing. If not supplied, the default is 8.
+::
 ::   All options are case insensitive.
 ::
 ::   To escape any of the options, put double quotes around the entire value, like this:
@@ -63,6 +66,7 @@ IF NOT "%config%" == "" (
  	set configuration=%config%
 )
 set runtests=false
+set maximumParallelJobs=8
 
 FOR %%a IN (%*) DO (
 	FOR /f "useback tokens=*" %%a in ('%%a') do (
@@ -107,6 +111,16 @@ FOR %%a IN (%*) DO (
 		IF /I !test!==--test (
 			set runtests=true
 		)
+
+		set test=!value:~0,4!
+		IF /I !test!==-mp: (
+			set maximumParallelJobs=!value:~4!
+		)
+
+		set test=!value:~0,22!
+		IF /I !test!==--maximumparalleljobs: (
+			set maximumParallelJobs=!value:~22!
+		)
 	)
 )
 
@@ -115,6 +129,6 @@ if "!runtests!"=="true" (
 	set tasks="Default,Test"
 )
 
-powershell -ExecutionPolicy Bypass -Command "& { Import-Module .\build\psake.psm1; Invoke-Psake .\build\build.ps1 %tasks% -properties @{configuration='%configuration%'} -parameters @{ packageVersion='%PackageVersion%';version='%version%' } }"
+powershell -ExecutionPolicy Bypass -Command "& { Import-Module .\build\psake.psm1; Invoke-Psake .\build\build.ps1 %tasks% -properties @{configuration='%configuration%';maximumParalellJobs=%maximumParallelJobs%} -parameters @{ packageVersion='%PackageVersion%';version='%version%' } }"
 
 endlocal
diff --git a/build/build.ps1 b/build/build.ps1
index a29d765..9693969 100644
--- a/build/build.ps1
+++ b/build/build.ps1
@@ -111,6 +111,7 @@ task Init -depends InstallSDK, UpdateLocalSDKVersion -description "This task mak
 	Write-Host "Version: $version"
 	Write-Host "Configuration: $configuration"
 	Write-Host "Platform: $platform"
+	Write-Host "MaximumParallelJobs: $($maximumParalellJobs.ToString())"
 
 	Ensure-Directory-Exists "$release_directory"
 }
@@ -589,11 +590,15 @@ GOTO endcommentblock
 ::   --Test
 ::   -t - Run the tests.
 ::
+::   --MaximumParallelJobs
+::   -mp - Set the maxumum number of parallel jobs to run during testing. If not supplied, the default is 8.
+::
 :: -----------------------------------------------------------------------------------
 :endcommentblock
 setlocal enabledelayedexpansion enableextensions
 
 set runtests=false
+set maximumParallelJobs=8
 
 FOR %%a IN (%*) DO (
 	FOR /f ""useback tokens=*"" %%a in ('%%a') do (
@@ -608,6 +613,16 @@ FOR %%a IN (%*) DO (
 		IF /I !test!==--test (
 			set runtests=true
 		)
+
+		set test=!value:~0,4!
+		IF /I !test!==-mp: (
+			set maximumParallelJobs=!value:~4!
+		)
+
+		set test=!value:~0,22!
+		IF /I !test!==--maximumparalleljobs: (
+			set maximumParallelJobs=!value:~22!
+		)
 	)
 )
 
@@ -616,7 +631,7 @@ if ""!runtests!""==""true"" (
 	set tasks=""Default,Test""
 )
 
-powershell -ExecutionPolicy Bypass -Command ""& { Import-Module .\build\psake.psm1; Invoke-Psake .\build\build.ps1 -Task %tasks% -properties @{prepareForBuild='false';backup_files='false'} }""
+powershell -ExecutionPolicy Bypass -Command ""& { Import-Module .\build\psake.psm1; Invoke-Psake .\build\build.ps1 -Task %tasks% -properties @{prepareForBuild='false';backup_files='false';maximumParalellJobs=%maximumParallelJobs%} }""
 
 endlocal
 "


[lucenenet] 31/42: BUG: Lucene.Net.Tests.QueryParser.Flexible.Precedence.TestPrecedenceQueryParser: Specify short date format by using DateTime.ParseExact instead of DateTime.Parse

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit be169d7c7101b2165a4f0ff7645c1d9e8ecdda5f
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Mon Aug 5 10:09:34 2019 +0700

    BUG: Lucene.Net.Tests.QueryParser.Flexible.Precedence.TestPrecedenceQueryParser: Specify short date format by using DateTime.ParseExact instead of DateTime.Parse
---
 .../Flexible/Precedence/TestPrecedenceQueryParser.cs                  | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/Lucene.Net.Tests.QueryParser/Flexible/Precedence/TestPrecedenceQueryParser.cs b/src/Lucene.Net.Tests.QueryParser/Flexible/Precedence/TestPrecedenceQueryParser.cs
index 296076b..d60cfb4 100644
--- a/src/Lucene.Net.Tests.QueryParser/Flexible/Precedence/TestPrecedenceQueryParser.cs
+++ b/src/Lucene.Net.Tests.QueryParser/Flexible/Precedence/TestPrecedenceQueryParser.cs
@@ -414,7 +414,7 @@ namespace Lucene.Net.QueryParsers.Flexible.Precedence
 
         private String escapeDateString(String s)
         {
-            if (s.Contains(" "))
+            if (s.IndexOf(' ') > -1)
             {
                 return "\"" + s + "\"";
             }
@@ -517,7 +517,7 @@ namespace Lucene.Net.QueryParsers.Flexible.Precedence
             // we use the default Locale since LuceneTestCase randomizes it
             //DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT, Locale.getDefault());
             //return getDate(df.parse(s), resolution);
-            return getDate(DateTime.Parse(s), resolution);
+            return getDate(DateTime.ParseExact(s, "d", CultureInfo.CurrentCulture), resolution);
         }
 
         /** for testing DateTools support */


[lucenenet] 13/42: BUG: Lucene.Net.TestFramework.Util.LuceneTestCase.NewFSDirectory - When resolving a type, we were expecting an exception if the type does not subclass FSDirectory, however, in .NET this won't happen. We need to explicitly check whether the resolved type is assignable from FSDirectory or if the type name is nonsense.

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit 7e772c2c8a3834e4fbf122835fea8c3b3fc5a941
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Wed Jul 31 15:23:48 2019 +0700

    BUG: Lucene.Net.TestFramework.Util.LuceneTestCase.NewFSDirectory - When resolving a type, we were expecting an exception if the type does not subclass FSDirectory, however, in .NET this won't happen. We need to explicitly check whether the resolved type is assignable from FSDirectory or if the type name is nonsense.
---
 src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs b/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
index 54d08ec..a2a2b67 100644
--- a/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
+++ b/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
@@ -1261,14 +1261,13 @@ namespace Lucene.Net.Util
                 fsdirClass = RandomInts.RandomFrom(Random(), FS_DIRECTORIES);
             }
 
-            Type clazz;
-            try
-            {
-                clazz = CommandLineUtil.LoadFSDirectoryClass(fsdirClass);
-            }
-#pragma warning disable 168
-            catch (System.InvalidCastException e)
-#pragma warning restore 168
+            // LUCENENET specific - .NET will not throw an exception if the
+            // class does not inherit FSDirectory. We get a null if the name
+            // cannot be resolved, not an exception.
+            // We need to do an explicit check to determine if this type
+            // is not a subclass of FSDirectory.
+            Type clazz = CommandLineUtil.LoadFSDirectoryClass(fsdirClass);
+            if (clazz == null || !(typeof(FSDirectory).IsAssignableFrom(clazz)))
             {
                 // TEST_DIRECTORY is not a sub-class of FSDirectory, so draw one at random
                 fsdirClass = RandomInts.RandomFrom(Random(), FS_DIRECTORIES);


[lucenenet] 34/42: Bug: Lucene.Net.TestFramework.JavaCompatibility.SystemTypesHelpers: Overloads of append that take numeric types need to be converted to the invariant culture. Removed the overloads for decimal, double, and float, as those need to be dealt with on a case by case basis.

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit 560c8ccae5af9d070537a3f1f66309c5b0ad1f24
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Tue Aug 6 03:43:12 2019 +0700

    Bug: Lucene.Net.TestFramework.JavaCompatibility.SystemTypesHelpers: Overloads of append that take numeric types need to be converted to the invariant culture. Removed the overloads for decimal, double, and float, as those need to be dealt with on a case by case basis.
---
 .../JavaCompatibility/SystemTypesHelpers.cs        | 71 ++++++++++++++--------
 1 file changed, 46 insertions(+), 25 deletions(-)

diff --git a/src/Lucene.Net.TestFramework/JavaCompatibility/SystemTypesHelpers.cs b/src/Lucene.Net.TestFramework/JavaCompatibility/SystemTypesHelpers.cs
index 62f50d9..0cf1daf 100644
--- a/src/Lucene.Net.TestFramework/JavaCompatibility/SystemTypesHelpers.cs
+++ b/src/Lucene.Net.TestFramework/JavaCompatibility/SystemTypesHelpers.cs
@@ -23,6 +23,7 @@ using Lucene.Net.Support;
 using System;
 using System.Collections;
 using System.Collections.Generic;
+using System.Globalization;
 using System.IO;
 using System.Linq;
 using System.Reflection;
@@ -91,7 +92,9 @@ namespace Lucene.Net
 
         public static StringBuilder append(this StringBuilder sb, byte value)
         {
-            sb.Append(value);
+            // LUCENENET NOTE: .NET uses the current culture by default, and any
+            // Java code that calls this is expecting invariant culture
+            sb.Append(value.ToString(CultureInfo.InvariantCulture));
             return sb;
         }
 
@@ -107,33 +110,41 @@ namespace Lucene.Net
             return sb;
         }
 
-        public static StringBuilder append(this StringBuilder sb, decimal value)
-        {
-            sb.Append(value);
-            return sb;
-        }
-
-        public static StringBuilder append(this StringBuilder sb, double value)
-        {
-            sb.Append(value);
-            return sb;
-        }
-
-        public static StringBuilder append(this StringBuilder sb, float value)
-        {
-            sb.Append(value);
-            return sb;
-        }
+        // LUCENENET: These would only work if we copied the format from Java,
+        // which is probably not something we want to do anyway.
+        // Instead of calling a centralized method, we should be converting the
+        // code on a case by case basis.
+        //public static StringBuilder append(this StringBuilder sb, decimal value)
+        //{
+        //    sb.Append(value);
+        //    return sb;
+        //}
+
+        //public static StringBuilder append(this StringBuilder sb, double value)
+        //{
+        //    sb.Append(value);
+        //    return sb;
+        //}
+
+        //public static StringBuilder append(this StringBuilder sb, float value)
+        //{
+        //    sb.Append(value);
+        //    return sb;
+        //}
 
         public static StringBuilder append(this StringBuilder sb, int value)
         {
-            sb.Append(value);
+            // LUCENENET NOTE: .NET uses the current culture by default, and any
+            // Java code that calls this is expecting invariant culture
+            sb.Append(value.ToString(CultureInfo.InvariantCulture));
             return sb;
         }
 
         public static StringBuilder append(this StringBuilder sb, long value)
         {
-            sb.Append(value);
+            // LUCENENET NOTE: .NET uses the current culture by default, and any
+            // Java code that calls this is expecting invariant culture
+            sb.Append(value.ToString(CultureInfo.InvariantCulture));
             return sb;
         }
 
@@ -145,13 +156,17 @@ namespace Lucene.Net
 
         public static StringBuilder append(this StringBuilder sb, sbyte value)
         {
-            sb.Append(value);
+            // LUCENENET NOTE: .NET uses the current culture by default, and any
+            // Java code that calls this is expecting invariant culture
+            sb.Append(value.ToString(CultureInfo.InvariantCulture));
             return sb;
         }
 
         public static StringBuilder append(this StringBuilder sb, short value)
         {
-            sb.Append(value);
+            // LUCENENET NOTE: .NET uses the current culture by default, and any
+            // Java code that calls this is expecting invariant culture
+            sb.Append(value.ToString(CultureInfo.InvariantCulture));
             return sb;
         }
 
@@ -163,19 +178,25 @@ namespace Lucene.Net
 
         public static StringBuilder append(this StringBuilder sb, uint value)
         {
-            sb.Append(value);
+            // LUCENENET NOTE: .NET uses the current culture by default, and any
+            // Java code that calls this is expecting invariant culture
+            sb.Append(value.ToString(CultureInfo.InvariantCulture));
             return sb;
         }
 
         public static StringBuilder append(this StringBuilder sb, ulong value)
         {
-            sb.Append(value);
+            // LUCENENET NOTE: .NET uses the current culture by default, and any
+            // Java code that calls this is expecting invariant culture
+            sb.Append(value.ToString(CultureInfo.InvariantCulture));
             return sb;
         }
 
         public static StringBuilder append(this StringBuilder sb, ushort value)
         {
-            sb.Append(value);
+            // LUCENENET NOTE: .NET uses the current culture by default, and any
+            // Java code that calls this is expecting invariant culture
+            sb.Append(value.ToString(CultureInfo.InvariantCulture));
             return sb;
         }
 


[lucenenet] 29/42: SWEEP: Added StringComparison.Ordinal to all of the string.StartsWith() and string.EndsWith() methods where it was missing

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit 4bcbe07719d6c77150be8b00cc0e50b95850f297
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Mon Aug 5 08:49:01 2019 +0700

    SWEEP: Added StringComparison.Ordinal to all of the string.StartsWith() and string.EndsWith() methods where it was missing
---
 .../Analysis/Compound/Hyphenation/HyphenationTree.cs              | 2 +-
 src/Lucene.Net.Analysis.Phonetic/Language/Bm/Rule.cs              | 8 ++++----
 src/Lucene.Net.Replicator/IndexReplicationHandler.cs              | 4 ++--
 src/Lucene.Net.Tests.QueryParser/Xml/TestQueryTemplateManager.cs  | 4 ++--
 src/Lucene.Net.Tests/Index/TestCompoundFile.cs                    | 2 +-
 src/dotnet/tools/lucene-cli/CommandLine/CommandLineApplication.cs | 4 ++--
 src/dotnet/tools/lucene-cli/CommandLine/CommandOption.cs          | 6 +++---
 7 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Compound/Hyphenation/HyphenationTree.cs b/src/Lucene.Net.Analysis.Common/Analysis/Compound/Hyphenation/HyphenationTree.cs
index 5f65b54..1a87cb0 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Compound/Hyphenation/HyphenationTree.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Compound/Hyphenation/HyphenationTree.cs
@@ -281,7 +281,7 @@ namespace Lucene.Net.Analysis.Compound.Hyphenation
         /// <code>
         /// for (i=0; i&lt;patterns.Length; i++) 
         /// {
-        ///     if (word.Substring(index).StartsWith(patterns[i]))
+        ///     if (word.Substring(index).StartsWith(patterns[i], StringComparison.Ordinal))
         ///         update_interletter_values(patterns[i]);
         /// }
         /// </code>
diff --git a/src/Lucene.Net.Analysis.Phonetic/Language/Bm/Rule.cs b/src/Lucene.Net.Analysis.Phonetic/Language/Bm/Rule.cs
index 8f0567d..e08e8a3 100644
--- a/src/Lucene.Net.Analysis.Phonetic/Language/Bm/Rule.cs
+++ b/src/Lucene.Net.Analysis.Phonetic/Language/Bm/Rule.cs
@@ -432,14 +432,14 @@ namespace Lucene.Net.Analysis.Phonetic.Language.Bm
 
                     if (inMultilineComment)
                     {
-                        if (line.EndsWith(ResourceConstants.EXT_CMT_END))
+                        if (line.EndsWith(ResourceConstants.EXT_CMT_END, StringComparison.Ordinal))
                         {
                             inMultilineComment = false;
                         }
                     }
                     else
                     {
-                        if (line.StartsWith(ResourceConstants.EXT_CMT_START))
+                        if (line.StartsWith(ResourceConstants.EXT_CMT_START, StringComparison.Ordinal))
                         {
                             inMultilineComment = true;
                         }
@@ -558,8 +558,8 @@ namespace Lucene.Net.Analysis.Phonetic.Language.Bm
         /// <returns>An RPattern that will match this regex.</returns>
         private static IRPattern GetPattern(string regex)
         {
-            bool startsWith = regex.StartsWith("^");
-            bool endsWith = regex.EndsWith("$");
+            bool startsWith = regex.StartsWith("^", StringComparison.Ordinal);
+            bool endsWith = regex.EndsWith("$", StringComparison.Ordinal);
             string content = regex.Substring(startsWith ? 1 : 0, (endsWith ? regex.Length - 1 : regex.Length) - (startsWith ? 1 : 0));
             bool boxes = content.Contains("[");
 
diff --git a/src/Lucene.Net.Replicator/IndexReplicationHandler.cs b/src/Lucene.Net.Replicator/IndexReplicationHandler.cs
index 93274a1..d941527 100644
--- a/src/Lucene.Net.Replicator/IndexReplicationHandler.cs
+++ b/src/Lucene.Net.Replicator/IndexReplicationHandler.cs
@@ -115,7 +115,7 @@ namespace Lucene.Net.Replicator
             string segmentsFile = files.Last();
             //NOTE: Relying on side-effects outside?
             files.RemoveAt(files.Count - 1);
-            if (!segmentsFile.StartsWith(IndexFileNames.SEGMENTS) || segmentsFile.Equals(IndexFileNames.SEGMENTS_GEN, StringComparison.Ordinal))
+            if (!segmentsFile.StartsWith(IndexFileNames.SEGMENTS, StringComparison.Ordinal) || segmentsFile.Equals(IndexFileNames.SEGMENTS_GEN, StringComparison.Ordinal))
             {
                 throw new InvalidOperationException(
                     string.Format("last file to copy+sync must be segments_N but got {0}; check your Revision implementation!", segmentsFile));
@@ -170,7 +170,7 @@ namespace Lucene.Net.Replicator
 
                     Regex matcher = IndexFileNames.CODEC_FILE_PATTERN;
                     foreach (string file in directory.ListAll()
-                        .Where(file => !commitFiles.Contains(file) && (matcher.IsMatch(file) || file.StartsWith(IndexFileNames.SEGMENTS))))
+                        .Where(file => !commitFiles.Contains(file) && (matcher.IsMatch(file) || file.StartsWith(IndexFileNames.SEGMENTS, StringComparison.Ordinal))))
                     {
                         try
                         {
diff --git a/src/Lucene.Net.Tests.QueryParser/Xml/TestQueryTemplateManager.cs b/src/Lucene.Net.Tests.QueryParser/Xml/TestQueryTemplateManager.cs
index 06b7924..b3dc872 100644
--- a/src/Lucene.Net.Tests.QueryParser/Xml/TestQueryTemplateManager.cs
+++ b/src/Lucene.Net.Tests.QueryParser/Xml/TestQueryTemplateManager.cs
@@ -74,9 +74,9 @@ namespace Lucene.Net.QueryParsers.Xml
         public void TestFormTransforms()
         {
             //// Sun 1.5 suffers from http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6240963
-            //if (Constants.JAVA_VENDOR.StartsWith("Sun") && Constants.JAVA_VERSION.StartsWith("1.5")) {
+            //if (Constants.JAVA_VENDOR.StartsWith("Sun", StringComparison.Ordinal) && Constants.JAVA_VERSION.StartsWith("1.5", StringComparison.Ordinal)) {
             //  String defLang = Locale.getDefault().getLanguage();
-            //  assumeFalse("Sun JRE 1.5 suffers from http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6240963 under Turkish locale", defLang.equals("tr") || defLang.equals("az"));
+            //  assumeFalse("Sun JRE 1.5 suffers from http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6240963 under Turkish locale", defLang.equals("tr", StringComparison.Ordinal) || defLang.equals("az", StringComparison.Ordinal));
             //}
             //Cache all the query templates we will be referring to.
             QueryTemplateManager qtm = new QueryTemplateManager();
diff --git a/src/Lucene.Net.Tests/Index/TestCompoundFile.cs b/src/Lucene.Net.Tests/Index/TestCompoundFile.cs
index 5386ab4..7960a79 100644
--- a/src/Lucene.Net.Tests/Index/TestCompoundFile.cs
+++ b/src/Lucene.Net.Tests/Index/TestCompoundFile.cs
@@ -887,7 +887,7 @@ namespace Lucene.Net.Index
         {
             foreach (string file in dir.ListAll())
             {
-                if (file.EndsWith(IndexFileNames.COMPOUND_FILE_EXTENSION))
+                if (file.EndsWith(IndexFileNames.COMPOUND_FILE_EXTENSION, StringComparison.Ordinal))
                 {
                     CompoundFileDirectory cfsDir = new CompoundFileDirectory(dir, file, NewIOContext(Random()), false);
                     CheckFiles(cfsDir); // recurse into cfs
diff --git a/src/dotnet/tools/lucene-cli/CommandLine/CommandLineApplication.cs b/src/dotnet/tools/lucene-cli/CommandLine/CommandLineApplication.cs
index 7ac7a9c..e3e5a3a 100644
--- a/src/dotnet/tools/lucene-cli/CommandLine/CommandLineApplication.cs
+++ b/src/dotnet/tools/lucene-cli/CommandLine/CommandLineApplication.cs
@@ -155,11 +155,11 @@ namespace Lucene.Net.Cli.CommandLine
                     string[] longOption = null;
                     string[] shortOption = null;
 
-                    if (arg.StartsWith("--"))
+                    if (arg.StartsWith("--", StringComparison.Ordinal))
                     {
                         longOption = arg.Substring(2).Split(new[] { ':', '=' }, 2);
                     }
-                    else if (arg.StartsWith("-"))
+                    else if (arg.StartsWith("-", StringComparison.Ordinal))
                     {
                         shortOption = arg.Substring(1).Split(new[] { ':', '=' }, 2);
                     }
diff --git a/src/dotnet/tools/lucene-cli/CommandLine/CommandOption.cs b/src/dotnet/tools/lucene-cli/CommandLine/CommandOption.cs
index 27c5f00..784c9f5 100644
--- a/src/dotnet/tools/lucene-cli/CommandLine/CommandOption.cs
+++ b/src/dotnet/tools/lucene-cli/CommandLine/CommandOption.cs
@@ -34,11 +34,11 @@ namespace Lucene.Net.Cli.CommandLine
 
             foreach (var part in Template.Split(new[] { ' ', '|' }, StringSplitOptions.RemoveEmptyEntries))
             {
-                if (part.StartsWith("--"))
+                if (part.StartsWith("--", StringComparison.Ordinal))
                 {
                     LongName = part.Substring(2);
                 }
-                else if (part.StartsWith("-"))
+                else if (part.StartsWith("-", StringComparison.Ordinal))
                 {
                     var optName = part.Substring(1);
 
@@ -52,7 +52,7 @@ namespace Lucene.Net.Cli.CommandLine
                         ShortName = optName;
                     }
                 }
-                else if (part.StartsWith("<") && part.EndsWith(">"))
+                else if (part.StartsWith("<", StringComparison.Ordinal) && part.EndsWith(">", StringComparison.Ordinal))
                 {
                     ValueName = part.Substring(1, part.Length - 2);
                 }


[lucenenet] 05/42: Broke Lucene.Net.Tests project into Lucene.Net.Tests._A-I, Lucene.Net.Tests._J-U, and Lucene.Net.Tests._U-Z to cut the time it takes to run the tests in the project by about 2/3, running in parallel

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit de0209fe206bca879584d698eee622aeb5e59ab3
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Mon Jul 29 21:14:28 2019 +0700

    Broke Lucene.Net.Tests project into Lucene.Net.Tests._A-I, Lucene.Net.Tests._J-U, and Lucene.Net.Tests._U-Z to cut the time it takes to run the tests in the project by about 2/3, running in parallel
---
 Lucene.Net.sln                                     | 61 +++++++++++++++-------
 .../Properties/AssemblyInfo.cs                     |  4 +-
 .../Lucene.Net.Tests._A-I.csproj}                  | 41 ++++++++-------
 .../Lucene.Net.Tests._J-U.csproj}                  | 43 ++++++++-------
 .../Lucene.Net.Tests._U-Z.csproj}                  | 38 +++++++-------
 .../Index/TestIndexWriterReader.cs                 |  7 +++
 src/Lucene.Net/Properties/AssemblyInfo.cs          |  4 +-
 7 files changed, 119 insertions(+), 79 deletions(-)

diff --git a/Lucene.Net.sln b/Lucene.Net.sln
index e450451..904843e 100644
--- a/Lucene.Net.sln
+++ b/Lucene.Net.sln
@@ -21,6 +21,17 @@ Microsoft Visual Studio Solution File, Format Version 12.00
 
 VisualStudioVersion = 15.0.26730.8
 MinimumVisualStudioVersion = 15.0.26730.8
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "azure-templates", "azure-templates", "{05CE3A39-40D4-452D-AFE0-E57E536A08C6}"
+	ProjectSection(SolutionItems) = preProject
+		build\azure-templates\publish-nuget-packages.yml = build\azure-templates\publish-nuget-packages.yml
+		build\azure-templates\publish-test-results-for-target-frameworks.yml = build\azure-templates\publish-test-results-for-target-frameworks.yml
+		build\azure-templates\publish-test-results-for-test-projects.yml = build\azure-templates\publish-test-results-for-test-projects.yml
+		build\azure-templates\publish-test-results.yml = build\azure-templates\publish-test-results.yml
+		build\azure-templates\run-tests-on-os.yml = build\azure-templates\run-tests-on-os.yml
+		build\azure-templates\show-all-environment-variables.yml = build\azure-templates\show-all-environment-variables.yml
+		build\azure-templates\show-all-files.yml = build\azure-templates\show-all-files.yml
+	EndProjectSection
+EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "dotnet", "dotnet", "{8CA61D33-3590-4024-A304-7B1F75B50653}"
 	ProjectSection(SolutionItems) = preProject
 		src\dotnet\Directory.Build.props = src\dotnet\Directory.Build.props
@@ -41,6 +52,20 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools", "tools", "{4DF7EACE
 		src\dotnet\tools\Directory.Build.props = src\dotnet\tools\Directory.Build.props
 	EndProjectSection
 EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "apidocs", "apidocs", "{58FD6E39-F30F-4566-90E5-B7C9D6BC0660}"
+	ProjectSection(SolutionItems) = preProject
+		apidocs\docfx.filter.yml = apidocs\docfx.filter.yml
+		apidocs\docfx.json = apidocs\docfx.json
+		apidocs\docs.ps1 = apidocs\docs.ps1
+		apidocs\index.md = apidocs\index.md
+		apidocs\toc.yml = apidocs\toc.yml
+	EndProjectSection
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{4DF0A2A1-B9C7-4EE5-BAF0-BEEF53E34220}"
+	ProjectSection(SolutionItems) = preProject
+		Directory.Build.props = Directory.Build.props
+	EndProjectSection
+EndProject
 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Lucene.Net", "src\Lucene.Net\Lucene.Net.csproj", "{3A0AA37E-2B7B-4416-B528-DA4E0E6A6706}"
 EndProject
 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Lucene.Net.Analysis.Common", "src\Lucene.Net.Analysis.Common\Lucene.Net.Analysis.Common.csproj", "{3D0366A8-515D-44F0-835F-4118853CFA14}"
@@ -87,8 +112,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Lucene.Net.Suggest", "src\L
 EndProject
 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Lucene.Net.TestFramework", "src\Lucene.Net.TestFramework\Lucene.Net.TestFramework.csproj", "{AA0B6851-A597-47B5-A2F8-2A3E28C2B5A2}"
 EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Lucene.Net.Tests", "src\Lucene.Net.Tests\Lucene.Net.Tests.csproj", "{0922288F-57EE-43D2-B8E9-2692289D6DBC}"
-EndProject
 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Lucene.Net.Tests.Analysis.Common", "src\Lucene.Net.Tests.Analysis.Common\Lucene.Net.Tests.Analysis.Common.csproj", "{258BB6A8-A23A-42CE-A3C2-2B577CEC3F5A}"
 EndProject
 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Lucene.Net.Tests.Analysis.Kuromoji", "src\Lucene.Net.Tests.Analysis.Kuromoji\Lucene.Net.Tests.Analysis.Kuromoji.csproj", "{8DA818F6-1E5E-4DCF-B152-A0E0A817A42C}"
@@ -119,15 +142,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Lucene.Net.Tests.Join", "sr
 EndProject
 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Lucene.Net.Tests.Memory", "src\Lucene.Net.Tests.Memory\Lucene.Net.Tests.Memory.csproj", "{3BE7B6EA-8DBC-45E2-947C-1CA7E63B5603}"
 EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "apidocs", "apidocs", "{58FD6E39-F30F-4566-90E5-B7C9D6BC0660}"
-	ProjectSection(SolutionItems) = preProject
-		apidocs\docfx.filter.yml = apidocs\docfx.filter.yml
-		apidocs\docfx.json = apidocs\docfx.json
-		apidocs\docs.ps1 = apidocs\docs.ps1
-		apidocs\index.md = apidocs\index.md
-		apidocs\toc.yml = apidocs\toc.yml
-	EndProjectSection
-EndProject
 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Lucene.Net.Tests.Misc", "src\Lucene.Net.Tests.Misc\Lucene.Net.Tests.Misc.csproj", "{F8DDC5B7-A621-4B67-AB4B-BBE083C05BB8}"
 EndProject
 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Lucene.Net.Tests.Queries", "src\Lucene.Net.Tests.Queries\Lucene.Net.Tests.Queries.csproj", "{AC750DC0-05A3-4F96-8CC5-CFC8FD01D4CF}"
@@ -154,10 +168,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Lucene.Net.Tests.ICU", "src
 EndProject
 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Lucene.Net.Tests.Cli", "src\dotnet\tools\Lucene.Net.Tests.Cli\Lucene.Net.Tests.Cli.csproj", "{1F5574FE-19F7-4F10-9B88-76A938621F5B}"
 EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{4DF0A2A1-B9C7-4EE5-BAF0-BEEF53E34220}"
-	ProjectSection(SolutionItems) = preProject
-		Directory.Build.props = Directory.Build.props
-	EndProjectSection
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Lucene.Net.Tests._A-I", "src\Lucene.Net.Tests._A-I\Lucene.Net.Tests._A-I.csproj", "{86FADACC-57EC-4AA3-8BBE-C6ED526EE596}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Lucene.Net.Tests._J-S", "src\Lucene.Net.Tests._J-U\Lucene.Net.Tests._J-U.csproj", "{5BE1EBA7-876C-4E9D-A78C-46A0D6F588C9}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Lucene.Net.Tests._U-Z", "src\Lucene.Net.Tests._U-Z\Lucene.Net.Tests._U-Z.csproj", "{083EEC05-D092-4F84-8004-41F0C7192ABD}"
 EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -257,10 +272,6 @@ Global
 		{AA0B6851-A597-47B5-A2F8-2A3E28C2B5A2}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{AA0B6851-A597-47B5-A2F8-2A3E28C2B5A2}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{AA0B6851-A597-47B5-A2F8-2A3E28C2B5A2}.Release|Any CPU.Build.0 = Release|Any CPU
-		{0922288F-57EE-43D2-B8E9-2692289D6DBC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{0922288F-57EE-43D2-B8E9-2692289D6DBC}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{0922288F-57EE-43D2-B8E9-2692289D6DBC}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{0922288F-57EE-43D2-B8E9-2692289D6DBC}.Release|Any CPU.Build.0 = Release|Any CPU
 		{258BB6A8-A23A-42CE-A3C2-2B577CEC3F5A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
 		{258BB6A8-A23A-42CE-A3C2-2B577CEC3F5A}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{258BB6A8-A23A-42CE-A3C2-2B577CEC3F5A}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -373,6 +384,18 @@ Global
 		{1F5574FE-19F7-4F10-9B88-76A938621F5B}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{1F5574FE-19F7-4F10-9B88-76A938621F5B}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{1F5574FE-19F7-4F10-9B88-76A938621F5B}.Release|Any CPU.Build.0 = Release|Any CPU
+		{86FADACC-57EC-4AA3-8BBE-C6ED526EE596}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{86FADACC-57EC-4AA3-8BBE-C6ED526EE596}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{86FADACC-57EC-4AA3-8BBE-C6ED526EE596}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{86FADACC-57EC-4AA3-8BBE-C6ED526EE596}.Release|Any CPU.Build.0 = Release|Any CPU
+		{5BE1EBA7-876C-4E9D-A78C-46A0D6F588C9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{5BE1EBA7-876C-4E9D-A78C-46A0D6F588C9}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{5BE1EBA7-876C-4E9D-A78C-46A0D6F588C9}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{5BE1EBA7-876C-4E9D-A78C-46A0D6F588C9}.Release|Any CPU.Build.0 = Release|Any CPU
+		{083EEC05-D092-4F84-8004-41F0C7192ABD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{083EEC05-D092-4F84-8004-41F0C7192ABD}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{083EEC05-D092-4F84-8004-41F0C7192ABD}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{083EEC05-D092-4F84-8004-41F0C7192ABD}.Release|Any CPU.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
diff --git a/src/Lucene.Net.TestFramework/Properties/AssemblyInfo.cs b/src/Lucene.Net.TestFramework/Properties/AssemblyInfo.cs
index 030a905..059d12a 100644
--- a/src/Lucene.Net.TestFramework/Properties/AssemblyInfo.cs
+++ b/src/Lucene.Net.TestFramework/Properties/AssemblyInfo.cs
@@ -41,7 +41,9 @@ using System.Runtime.InteropServices;
 // We need InternalsVisibleTo in order to prevent making everything public just for the sake of testing.
 // This has broad implications, though because many methods are marked "protected internal", which means other assemblies
 // must update overridden methods to match.
-[assembly: InternalsVisibleTo("Lucene.Net.Tests, PublicKey=" + AssemblyKeys.PublicKey)]
+[assembly: InternalsVisibleTo("Lucene.Net.Tests._A-I, PublicKey=" + AssemblyKeys.PublicKey)]
+[assembly: InternalsVisibleTo("Lucene.Net.Tests._J-U, PublicKey=" + AssemblyKeys.PublicKey)]
+[assembly: InternalsVisibleTo("Lucene.Net.Tests._U-Z, PublicKey=" + AssemblyKeys.PublicKey)]
 [assembly: InternalsVisibleTo("Lucene.Net.Tests.Misc, PublicKey=" + AssemblyKeys.PublicKey)]
 
 
diff --git a/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj b/src/Lucene.Net.Tests._A-I/Lucene.Net.Tests._A-I.csproj
similarity index 62%
copy from src/Lucene.Net.Tests/Lucene.Net.Tests.csproj
copy to src/Lucene.Net.Tests._A-I/Lucene.Net.Tests._A-I.csproj
index fa3504d..4d99dab 100644
--- a/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj
+++ b/src/Lucene.Net.Tests._A-I/Lucene.Net.Tests._A-I.csproj
@@ -22,22 +22,24 @@
 <Project Sdk="Microsoft.NET.Sdk">
 
   <Import Project="$(SolutionDir)TestTargetFramework.props" />
-
+  
   <PropertyGroup>
     <PackageTargetFallback Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">$(PackageTargetFallback);dnxcore50</PackageTargetFallback>
-    
-    <AssemblyTitle>Lucene.Net.Tests</AssemblyTitle>
+
+    <AssemblyTitle>Lucene.Net.Tests._A-I</AssemblyTitle>
     <GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
     <RuntimeIdentifiers>win7-x86;win7-x64</RuntimeIdentifiers>
   </PropertyGroup>
-
+  
   <ItemGroup>
-    <Compile Remove="Util\JunitCompat\**\*;Util\TestMaxFailuresRule.cs" />
-    <!--<Compile Exclude="Util\TestMaxFailuresRule.cs" />-->
-    <EmbeddedResource Include="Index\bogus24.upgraded.to.36.zip;Index\index.30.cfs.zip;Index\index.30.nocfs.zip;Index\index.31.cfs.zip;Index\index.31.nocfs.zip;Index\index.31.optimized.cfs.zip;Index\index.31.optimized.nocfs.zip;Index\index.32.cfs.zip;Index\index.32.nocfs.zip;Index\index.34.cfs.zip;Index\index.34.nocfs.zip;Index\index.36.surrogates.zip;Index\index.40.cfs.zip;Index\index.40.nocfs.zip;Index\index.40.optimized.cfs.zip;Index\index.40.optimized.nocfs.zip;Index\index.41.cfs.zip [...]
-    <None Include="App.config" />
+    <Compile Include="..\Lucene.Net.Tests\*.cs" />
+    <Compile Include="..\Lucene.Net.Tests\Analysis\**\*.cs" LinkBase="Analysis" />
+    <Compile Include="..\Lucene.Net.Tests\Codecs\**\*.cs" LinkBase="Codecs" />
+    <Compile Include="..\Lucene.Net.Tests\Document\**\*.cs" LinkBase="Document" />
+    <Compile Include="..\Lucene.Net.Tests\Index\**\*.cs" LinkBase="Index" />
+    <EmbeddedResource Include="..\Lucene.Net.Tests\Index\*.zip" LinkBase="Index" />
   </ItemGroup>
-
+  
   <ItemGroup>
     <ProjectReference Include="..\Lucene.Net.Codecs\Lucene.Net.Codecs.csproj" />
     <ProjectReference Include="..\Lucene.Net.Facet\Lucene.Net.Facet.csproj" />
@@ -45,9 +47,13 @@
     <ProjectReference Include="..\Lucene.Net.QueryParser\Lucene.Net.QueryParser.csproj" />
     <ProjectReference Include="..\Lucene.Net.TestFramework\Lucene.Net.TestFramework.csproj" />
   </ItemGroup>
-
+  
   <Import Project="$(SolutionDir)build/TestReferences.Common.targets" />
-
+  
+  <PropertyGroup>
+    <DefineConstants>$(DefineConstants);FEATURE_INDEXWRITER_TESTS</DefineConstants>
+  </PropertyGroup>
+  
   <PropertyGroup Condition=" '$(TargetFramework)' == 'netcoreapp2.1' ">
     <DefineConstants>$(DefineConstants);NETSTANDARD;FEATURE_CONCURRENTMERGESCHEDULER;FEATURE_SERIALIZABLE</DefineConstants>
     <DebugType>portable</DebugType>
@@ -57,23 +63,18 @@
     <DefineConstants>$(DefineConstants);NETSTANDARD;NETSTANDARD1_6</DefineConstants>
     <DebugType>portable</DebugType>
   </PropertyGroup>
-
-  <ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">
-    <Compile Remove="Util\JunitCompat\**\*;Support\TestCase.cs;Util\TestMaxFailuresRule.cs" />
-  </ItemGroup>
-
+  
   <PropertyGroup Condition=" '$(TargetFramework)' == 'net451' ">
     <DefineConstants>$(DefineConstants);FEATURE_CONCURRENTMERGESCHEDULER;FEATURE_SERIALIZABLE;FEATURE_SERIALIZABLE_EXCEPTIONS</DefineConstants>
     <DebugType>full</DebugType>
   </PropertyGroup>
-
+  
   <ItemGroup Condition=" '$(TargetFramework)' == 'net451' ">
     <Reference Include="System" />
     <Reference Include="Microsoft.CSharp" />
   </ItemGroup>
-
+  
   <ItemGroup>
     <Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
   </ItemGroup>
-
-</Project>
+</Project>
\ No newline at end of file
diff --git a/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj b/src/Lucene.Net.Tests._J-U/Lucene.Net.Tests._J-U.csproj
similarity index 63%
copy from src/Lucene.Net.Tests/Lucene.Net.Tests.csproj
copy to src/Lucene.Net.Tests._J-U/Lucene.Net.Tests._J-U.csproj
index fa3504d..d16ad7f 100644
--- a/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj
+++ b/src/Lucene.Net.Tests._J-U/Lucene.Net.Tests._J-U.csproj
@@ -22,22 +22,28 @@
 <Project Sdk="Microsoft.NET.Sdk">
 
   <Import Project="$(SolutionDir)TestTargetFramework.props" />
-
+  
   <PropertyGroup>
     <PackageTargetFallback Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">$(PackageTargetFallback);dnxcore50</PackageTargetFallback>
-    
-    <AssemblyTitle>Lucene.Net.Tests</AssemblyTitle>
+
+    <AssemblyTitle>Lucene.Net.Tests._J-U</AssemblyTitle>
     <GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
     <RuntimeIdentifiers>win7-x86;win7-x64</RuntimeIdentifiers>
   </PropertyGroup>
-
+  
   <ItemGroup>
-    <Compile Remove="Util\JunitCompat\**\*;Util\TestMaxFailuresRule.cs" />
-    <!--<Compile Exclude="Util\TestMaxFailuresRule.cs" />-->
-    <EmbeddedResource Include="Index\bogus24.upgraded.to.36.zip;Index\index.30.cfs.zip;Index\index.30.nocfs.zip;Index\index.31.cfs.zip;Index\index.31.nocfs.zip;Index\index.31.optimized.cfs.zip;Index\index.31.optimized.nocfs.zip;Index\index.32.cfs.zip;Index\index.32.nocfs.zip;Index\index.34.cfs.zip;Index\index.34.nocfs.zip;Index\index.36.surrogates.zip;Index\index.40.cfs.zip;Index\index.40.nocfs.zip;Index\index.40.optimized.cfs.zip;Index\index.40.optimized.nocfs.zip;Index\index.41.cfs.zip [...]
-    <None Include="App.config" />
+    <Compile Include="..\Lucene.Net.Tests\Index\TestIndexWriterReader.cs" Link="Index\TestIndexWriterReader.cs" />
+    <Compile Include="..\Lucene.Net.Tests\Search\**\*.cs" LinkBase="Search" />
+    <Compile Include="..\Lucene.Net.Tests\Store\**\*.cs" LinkBase="Store" />
+    <Compile Include="..\Lucene.Net.Tests\Support\**\*.cs" LinkBase="Support" />
+    <Compile Include="..\Lucene.Net.Tests\Util\*.cs" LinkBase="Util" />
+    <Compile Remove="..\Lucene.Net.Tests\Util\TestOfflineSorter.cs" Link="Util\TestOfflineSorter.cs" />
+    <Compile Remove="..\Lucene.Net.Tests\Util\JunitCompat\**\*;..\Lucene.Net.Tests\Util\TestMaxFailuresRule.cs" />
+    <EmbeddedResource Include="..\Lucene.Net.Tests\Store\LUCENENET521.zip" Link="Store\LUCENENET521.zip" />
+    <EmbeddedResource Include="..\Lucene.Net.Tests\Support\IO\ReadFully.txt" Link="Support\IO\ReadFully.txt" />
+    <EmbeddedResource Include="..\Lucene.Net.Tests\Support\hyts_PropertiesTest.properties" Link="Support\hyts_PropertiesTest.properties" />
   </ItemGroup>
-
+  
   <ItemGroup>
     <ProjectReference Include="..\Lucene.Net.Codecs\Lucene.Net.Codecs.csproj" />
     <ProjectReference Include="..\Lucene.Net.Facet\Lucene.Net.Facet.csproj" />
@@ -45,9 +51,9 @@
     <ProjectReference Include="..\Lucene.Net.QueryParser\Lucene.Net.QueryParser.csproj" />
     <ProjectReference Include="..\Lucene.Net.TestFramework\Lucene.Net.TestFramework.csproj" />
   </ItemGroup>
-
+  
   <Import Project="$(SolutionDir)build/TestReferences.Common.targets" />
-
+  
   <PropertyGroup Condition=" '$(TargetFramework)' == 'netcoreapp2.1' ">
     <DefineConstants>$(DefineConstants);NETSTANDARD;FEATURE_CONCURRENTMERGESCHEDULER;FEATURE_SERIALIZABLE</DefineConstants>
     <DebugType>portable</DebugType>
@@ -57,23 +63,22 @@
     <DefineConstants>$(DefineConstants);NETSTANDARD;NETSTANDARD1_6</DefineConstants>
     <DebugType>portable</DebugType>
   </PropertyGroup>
-
-  <ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">
-    <Compile Remove="Util\JunitCompat\**\*;Support\TestCase.cs;Util\TestMaxFailuresRule.cs" />
-  </ItemGroup>
-
+  
   <PropertyGroup Condition=" '$(TargetFramework)' == 'net451' ">
     <DefineConstants>$(DefineConstants);FEATURE_CONCURRENTMERGESCHEDULER;FEATURE_SERIALIZABLE;FEATURE_SERIALIZABLE_EXCEPTIONS</DefineConstants>
     <DebugType>full</DebugType>
   </PropertyGroup>
 
+  <ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">
+    <Compile Remove="..\Lucene.Net.Tests\Support\TestCase.cs" />
+  </ItemGroup>
+  
   <ItemGroup Condition=" '$(TargetFramework)' == 'net451' ">
     <Reference Include="System" />
     <Reference Include="Microsoft.CSharp" />
   </ItemGroup>
-
+  
   <ItemGroup>
     <Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
   </ItemGroup>
-
-</Project>
+</Project>
\ No newline at end of file
diff --git a/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj b/src/Lucene.Net.Tests._U-Z/Lucene.Net.Tests._U-Z.csproj
similarity index 62%
rename from src/Lucene.Net.Tests/Lucene.Net.Tests.csproj
rename to src/Lucene.Net.Tests._U-Z/Lucene.Net.Tests._U-Z.csproj
index fa3504d..3f87e3c 100644
--- a/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj
+++ b/src/Lucene.Net.Tests._U-Z/Lucene.Net.Tests._U-Z.csproj
@@ -22,22 +22,23 @@
 <Project Sdk="Microsoft.NET.Sdk">
 
   <Import Project="$(SolutionDir)TestTargetFramework.props" />
-
+  
   <PropertyGroup>
     <PackageTargetFallback Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">$(PackageTargetFallback);dnxcore50</PackageTargetFallback>
-    
-    <AssemblyTitle>Lucene.Net.Tests</AssemblyTitle>
+
+    <AssemblyTitle>Lucene.Net.Tests._U-Z</AssemblyTitle>
     <GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
     <RuntimeIdentifiers>win7-x86;win7-x64</RuntimeIdentifiers>
   </PropertyGroup>
-
+  
   <ItemGroup>
-    <Compile Remove="Util\JunitCompat\**\*;Util\TestMaxFailuresRule.cs" />
-    <!--<Compile Exclude="Util\TestMaxFailuresRule.cs" />-->
-    <EmbeddedResource Include="Index\bogus24.upgraded.to.36.zip;Index\index.30.cfs.zip;Index\index.30.nocfs.zip;Index\index.31.cfs.zip;Index\index.31.nocfs.zip;Index\index.31.optimized.cfs.zip;Index\index.31.optimized.nocfs.zip;Index\index.32.cfs.zip;Index\index.32.nocfs.zip;Index\index.34.cfs.zip;Index\index.34.nocfs.zip;Index\index.36.surrogates.zip;Index\index.40.cfs.zip;Index\index.40.nocfs.zip;Index\index.40.optimized.cfs.zip;Index\index.40.optimized.nocfs.zip;Index\index.41.cfs.zip [...]
-    <None Include="App.config" />
+    <Compile Include="..\Lucene.Net.Tests\Util\TestOfflineSorter.cs" Link="Util\TestOfflineSorter.cs" />
+    <Compile Include="..\Lucene.Net.Tests\Util\Automaton\**\*.cs" LinkBase="Util\Automaton" />
+    <Compile Include="..\Lucene.Net.Tests\Util\Fst\**\*.cs" LinkBase="Util\Fst" />
+    <Compile Include="..\Lucene.Net.Tests\Util\Packed\**\*.cs" LinkBase="Util\Packed" />
+    <Compile Remove="..\Lucene.Net.Tests\Util\JunitCompat\**\*;..\Lucene.Net.Tests\Util\TestMaxFailuresRule.cs" />
   </ItemGroup>
-
+  
   <ItemGroup>
     <ProjectReference Include="..\Lucene.Net.Codecs\Lucene.Net.Codecs.csproj" />
     <ProjectReference Include="..\Lucene.Net.Facet\Lucene.Net.Facet.csproj" />
@@ -45,9 +46,13 @@
     <ProjectReference Include="..\Lucene.Net.QueryParser\Lucene.Net.QueryParser.csproj" />
     <ProjectReference Include="..\Lucene.Net.TestFramework\Lucene.Net.TestFramework.csproj" />
   </ItemGroup>
-
+  
   <Import Project="$(SolutionDir)build/TestReferences.Common.targets" />
 
+  <PropertyGroup>
+    <DefineConstants>$(DefineConstants);FEATURE_UTIL_TESTS</DefineConstants>
+  </PropertyGroup>
+  
   <PropertyGroup Condition=" '$(TargetFramework)' == 'netcoreapp2.1' ">
     <DefineConstants>$(DefineConstants);NETSTANDARD;FEATURE_CONCURRENTMERGESCHEDULER;FEATURE_SERIALIZABLE</DefineConstants>
     <DebugType>portable</DebugType>
@@ -57,23 +62,18 @@
     <DefineConstants>$(DefineConstants);NETSTANDARD;NETSTANDARD1_6</DefineConstants>
     <DebugType>portable</DebugType>
   </PropertyGroup>
-
-  <ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">
-    <Compile Remove="Util\JunitCompat\**\*;Support\TestCase.cs;Util\TestMaxFailuresRule.cs" />
-  </ItemGroup>
-
+  
   <PropertyGroup Condition=" '$(TargetFramework)' == 'net451' ">
     <DefineConstants>$(DefineConstants);FEATURE_CONCURRENTMERGESCHEDULER;FEATURE_SERIALIZABLE;FEATURE_SERIALIZABLE_EXCEPTIONS</DefineConstants>
     <DebugType>full</DebugType>
   </PropertyGroup>
-
+  
   <ItemGroup Condition=" '$(TargetFramework)' == 'net451' ">
     <Reference Include="System" />
     <Reference Include="Microsoft.CSharp" />
   </ItemGroup>
-
+  
   <ItemGroup>
     <Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
   </ItemGroup>
-
-</Project>
+</Project>
\ No newline at end of file
diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriterReader.cs b/src/Lucene.Net.Tests/Index/TestIndexWriterReader.cs
index c99c487..5d1177b 100644
--- a/src/Lucene.Net.Tests/Index/TestIndexWriterReader.cs
+++ b/src/Lucene.Net.Tests/Index/TestIndexWriterReader.cs
@@ -72,6 +72,8 @@ namespace Lucene.Net.Index
             return count;
         }
 
+#if FEATURE_INDEXWRITER_TESTS
+
         [Test]
         public virtual void TestAddCloseOpen()
         {
@@ -697,6 +699,8 @@ namespace Lucene.Net.Index
             dir1.Dispose();
         }
 
+#endif
+
         /*
          * Delete a document by term and return the doc id
          *
@@ -732,6 +736,8 @@ namespace Lucene.Net.Index
             }
         }
 
+#if FEATURE_INDEXWRITER_TESTS
+
         private class MyWarmer : IndexWriter.IndexReaderWarmer
         {
             internal int WarmCount;
@@ -1422,5 +1428,6 @@ namespace Lucene.Net.Index
             w.Dispose();
             dir.Dispose();
         }
+#endif
     }
 }
\ No newline at end of file
diff --git a/src/Lucene.Net/Properties/AssemblyInfo.cs b/src/Lucene.Net/Properties/AssemblyInfo.cs
index 23ff800..a67a512 100644
--- a/src/Lucene.Net/Properties/AssemblyInfo.cs
+++ b/src/Lucene.Net/Properties/AssemblyInfo.cs
@@ -33,7 +33,9 @@ using System.Runtime.CompilerServices;
 // We need InternalsVisibleTo in order to prevent making everything public just for the sake of testing.
 // This has broad implications because many methods are marked "protected internal", which means other assemblies
 // must update overridden methods to match.
-[assembly: InternalsVisibleTo("Lucene.Net.Tests, PublicKey=" + AssemblyKeys.PublicKey)]
+[assembly: InternalsVisibleTo("Lucene.Net.Tests._A-I, PublicKey=" + AssemblyKeys.PublicKey)]
+[assembly: InternalsVisibleTo("Lucene.Net.Tests._J-U, PublicKey=" + AssemblyKeys.PublicKey)]
+[assembly: InternalsVisibleTo("Lucene.Net.Tests._U-Z, PublicKey=" + AssemblyKeys.PublicKey)]
 [assembly: InternalsVisibleTo("Lucene.Net.TestFramework, PublicKey=" + AssemblyKeys.PublicKey)]
 [assembly: InternalsVisibleTo("Lucene.Net.Misc, PublicKey=" + AssemblyKeys.PublicKey)]
 [assembly: InternalsVisibleTo("Lucene.Net.Tests.ICU, PublicKey=" + AssemblyKeys.PublicKey)] // For Analysis.Util.TestSegmentingTokenizerBase


[lucenenet] 07/42: Added .NET Standard 2.0 target to projects where it was missing (fixes #216)

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit e6dd79f054bac0a3c78a4aaee9475b62fb7f9c9d
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Sun Jul 14 04:45:39 2019 +0700

    Added .NET Standard 2.0 target to projects where it was missing (fixes #216)
---
 src/Lucene.Net.Analysis.Common/Lucene.Net.Analysis.Common.csproj  | 2 +-
 .../Lucene.Net.Analysis.Kuromoji.csproj                           | 8 ++++----
 .../Lucene.Net.Analysis.Phonetic.csproj                           | 8 ++++----
 .../Lucene.Net.Analysis.SmartCn.csproj                            | 8 ++++----
 .../Lucene.Net.Analysis.Stempel.csproj                            | 8 ++++----
 src/Lucene.Net.Benchmark/Lucene.Net.Benchmark.csproj              | 2 +-
 src/Lucene.Net.Classification/Lucene.Net.Classification.csproj    | 8 ++++----
 src/Lucene.Net.Codecs/Lucene.Net.Codecs.csproj                    | 8 ++++----
 src/Lucene.Net.Demo/Lucene.Net.Demo.csproj                        | 2 +-
 src/Lucene.Net.Expressions/Lucene.Net.Expressions.csproj          | 8 ++++----
 src/Lucene.Net.Facet/Lucene.Net.Facet.csproj                      | 8 ++++----
 src/Lucene.Net.Grouping/Lucene.Net.Grouping.csproj                | 8 ++++----
 src/Lucene.Net.Highlighter/Lucene.Net.Highlighter.csproj          | 8 ++++----
 src/Lucene.Net.Join/Lucene.Net.Join.csproj                        | 8 ++++----
 src/Lucene.Net.Memory/Lucene.Net.Memory.csproj                    | 2 +-
 src/Lucene.Net.Misc/Lucene.Net.Misc.csproj                        | 8 ++++----
 src/Lucene.Net.Queries/Lucene.Net.Queries.csproj                  | 8 ++++----
 src/Lucene.Net.QueryParser/Lucene.Net.QueryParser.csproj          | 2 +-
 src/Lucene.Net.Replicator/Lucene.Net.Replicator.csproj            | 8 ++++----
 src/Lucene.Net.Sandbox/Lucene.Net.Sandbox.csproj                  | 8 ++++----
 src/Lucene.Net.Spatial/Lucene.Net.Spatial.csproj                  | 2 +-
 src/Lucene.Net.Suggest/Lucene.Net.Suggest.csproj                  | 8 ++++----
 src/Lucene.Net.TestFramework/Lucene.Net.TestFramework.csproj      | 2 +-
 src/Lucene.Net/Lucene.Net.csproj                                  | 2 +-
 src/dotnet/Lucene.Net.ICU/Lucene.Net.ICU.csproj                   | 8 ++++----
 .../Lucene.Net.Replicator.AspNetCore.csproj                       | 8 ++++----
 26 files changed, 80 insertions(+), 80 deletions(-)

diff --git a/src/Lucene.Net.Analysis.Common/Lucene.Net.Analysis.Common.csproj b/src/Lucene.Net.Analysis.Common/Lucene.Net.Analysis.Common.csproj
index 4a83c67..780f3bd 100644
--- a/src/Lucene.Net.Analysis.Common/Lucene.Net.Analysis.Common.csproj
+++ b/src/Lucene.Net.Analysis.Common/Lucene.Net.Analysis.Common.csproj
@@ -25,7 +25,7 @@
   
   <PropertyGroup>
     <TargetFrameworks>netstandard2.0;netstandard1.6</TargetFrameworks>
-	<TargetFrameworks Condition="$([MSBuild]::IsOsPlatform('Windows'))">$(TargetFrameworks);net45</TargetFrameworks>
+    <TargetFrameworks Condition="$([MSBuild]::IsOsPlatform('Windows'))">$(TargetFrameworks);net45</TargetFrameworks>
     <PackageTargetFallback Condition=" '$(TargetFramework)' == 'netstandard1.6' ">$(PackageTargetFallback);dnxcore50</PackageTargetFallback>
 
     <AssemblyTitle>Lucene.Net.Analysis.Common</AssemblyTitle>
diff --git a/src/Lucene.Net.Analysis.Kuromoji/Lucene.Net.Analysis.Kuromoji.csproj b/src/Lucene.Net.Analysis.Kuromoji/Lucene.Net.Analysis.Kuromoji.csproj
index 1d027e2..80539b1 100644
--- a/src/Lucene.Net.Analysis.Kuromoji/Lucene.Net.Analysis.Kuromoji.csproj
+++ b/src/Lucene.Net.Analysis.Kuromoji/Lucene.Net.Analysis.Kuromoji.csproj
@@ -24,8 +24,8 @@
   <Import Project="$(SolutionDir)build/NuGet.props" />
   
   <PropertyGroup>
-    <TargetFrameworks>netstandard1.6</TargetFrameworks>
-	<TargetFrameworks Condition="$([MSBuild]::IsOsPlatform('Windows'))">$(TargetFrameworks);net45</TargetFrameworks>
+    <TargetFrameworks>netstandard2.0;netstandard1.6</TargetFrameworks>
+    <TargetFrameworks Condition="$([MSBuild]::IsOsPlatform('Windows'))">$(TargetFrameworks);net45</TargetFrameworks>
     <PackageTargetFallback Condition=" '$(TargetFramework)' == 'netstandard1.6' ">$(PackageTargetFallback);dnxcore50</PackageTargetFallback>
 
     <AssemblyTitle>Lucene.Net.Analysis.Kuromoji</AssemblyTitle>
@@ -46,14 +46,14 @@
   </ItemGroup>
 
   <!-- NOTE: Microsoft's recommendation is not to use the ICloneable interface. We put in a FEATURE_CLONEABLE constant in case anyone wants to add it to the build -->
-  <!--<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0' ">
+  <ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0' ">
     <PackageReference Include="System.Text.Encoding.CodePages" Version="$(SystemTextEncodingCodePagesPackageVersion)" />
   </ItemGroup>
   
   <PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
     <DefineConstants>$(DefineConstants);NETSTANDARD</DefineConstants>
     <DebugType>portable</DebugType>
-  </PropertyGroup>-->
+  </PropertyGroup>
 
   <ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.6' ">
     <PackageReference Include="System.Globalization.Extensions" Version="$(SystemGlobalizationExtensionsPackageVersion)" />
diff --git a/src/Lucene.Net.Analysis.Phonetic/Lucene.Net.Analysis.Phonetic.csproj b/src/Lucene.Net.Analysis.Phonetic/Lucene.Net.Analysis.Phonetic.csproj
index 33e5b57..dc0e7b9 100644
--- a/src/Lucene.Net.Analysis.Phonetic/Lucene.Net.Analysis.Phonetic.csproj
+++ b/src/Lucene.Net.Analysis.Phonetic/Lucene.Net.Analysis.Phonetic.csproj
@@ -24,8 +24,8 @@
   <Import Project="$(SolutionDir)build/NuGet.props" />
 
   <PropertyGroup>
-    <TargetFrameworks>netstandard1.6</TargetFrameworks>
-	<TargetFrameworks Condition="$([MSBuild]::IsOsPlatform('Windows'))">$(TargetFrameworks);net45</TargetFrameworks>
+    <TargetFrameworks>netstandard2.0;netstandard1.6</TargetFrameworks>
+    <TargetFrameworks Condition="$([MSBuild]::IsOsPlatform('Windows'))">$(TargetFrameworks);net45</TargetFrameworks>
     <PackageTargetFallback Condition=" '$(TargetFramework)' == 'netstandard1.6' ">$(PackageTargetFallback);dnxcore50</PackageTargetFallback>
 
     <AssemblyTitle>Lucene.Net.Analysis.Phonetic</AssemblyTitle>
@@ -46,9 +46,9 @@
     <ProjectReference Include="..\Lucene.Net.Analysis.Common\Lucene.Net.Analysis.Common.csproj" />
   </ItemGroup>
 
-  <!--<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
+  <PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
     <DebugType>portable</DebugType>
-  </PropertyGroup>-->
+  </PropertyGroup>
 
   <PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard1.6' ">
     <DebugType>portable</DebugType>
diff --git a/src/Lucene.Net.Analysis.SmartCn/Lucene.Net.Analysis.SmartCn.csproj b/src/Lucene.Net.Analysis.SmartCn/Lucene.Net.Analysis.SmartCn.csproj
index 7dcbd6c..62bc605 100644
--- a/src/Lucene.Net.Analysis.SmartCn/Lucene.Net.Analysis.SmartCn.csproj
+++ b/src/Lucene.Net.Analysis.SmartCn/Lucene.Net.Analysis.SmartCn.csproj
@@ -24,8 +24,8 @@
   <Import Project="$(SolutionDir)build/NuGet.props" />
   
   <PropertyGroup>
-    <TargetFrameworks>netstandard1.6</TargetFrameworks>
-	<TargetFrameworks Condition="$([MSBuild]::IsOsPlatform('Windows'))">$(TargetFrameworks);net45</TargetFrameworks>
+    <TargetFrameworks>netstandard2.0;netstandard1.6</TargetFrameworks>
+    <TargetFrameworks Condition="$([MSBuild]::IsOsPlatform('Windows'))">$(TargetFrameworks);net45</TargetFrameworks>
     <PackageTargetFallback Condition=" '$(TargetFramework)' == 'netstandard1.6' ">$(PackageTargetFallback);dnxcore50</PackageTargetFallback>
 
     <AssemblyTitle>Lucene.Net.Analysis.SmartCn</AssemblyTitle>
@@ -53,14 +53,14 @@
     <PackageReference Include="ICU4N" Version="$(ICU4NPackageVersion)" />
   </ItemGroup>
 
-  <!--<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
+  <ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
     <PackageReference Include="System.Text.Encoding.CodePages" Version="$(SystemTextEncodingCodePagesPackageVersion)" />
   </ItemGroup>
 
   <PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
     <DefineConstants>$(DefineConstants);NETSTANDARD</DefineConstants>
     <DebugType>portable</DebugType>
-  </PropertyGroup>-->
+  </PropertyGroup>
 
   <ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.6' ">
     <PackageReference Include="System.Text.Encoding.CodePages" Version="$(SystemTextEncodingCodePagesPackageVersion)" />
diff --git a/src/Lucene.Net.Analysis.Stempel/Lucene.Net.Analysis.Stempel.csproj b/src/Lucene.Net.Analysis.Stempel/Lucene.Net.Analysis.Stempel.csproj
index 869f298..1125e00 100644
--- a/src/Lucene.Net.Analysis.Stempel/Lucene.Net.Analysis.Stempel.csproj
+++ b/src/Lucene.Net.Analysis.Stempel/Lucene.Net.Analysis.Stempel.csproj
@@ -24,8 +24,8 @@
   <Import Project="$(SolutionDir)build/NuGet.props" />
   
   <PropertyGroup>
-    <TargetFrameworks>netstandard1.6</TargetFrameworks>
-	<TargetFrameworks Condition="$([MSBuild]::IsOsPlatform('Windows'))">$(TargetFrameworks);net45</TargetFrameworks>
+    <TargetFrameworks>netstandard2.0;netstandard1.6</TargetFrameworks>
+    <TargetFrameworks Condition="$([MSBuild]::IsOsPlatform('Windows'))">$(TargetFrameworks);net45</TargetFrameworks>
     <PackageTargetFallback Condition=" '$(TargetFramework)' == 'netstandard1.6' ">$(PackageTargetFallback);dnxcore50</PackageTargetFallback>
 
     <AssemblyTitle>Lucene.Net.Analysis.Stempel</AssemblyTitle>
@@ -44,9 +44,9 @@
     <ProjectReference Include="..\Lucene.Net.Analysis.Common\Lucene.Net.Analysis.Common.csproj" />
   </ItemGroup>
 
-  <!--<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
+  <PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
     <DebugType>portable</DebugType>
-  </PropertyGroup>-->
+  </PropertyGroup>
 
   <PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard1.6' ">
     <DebugType>portable</DebugType>
diff --git a/src/Lucene.Net.Benchmark/Lucene.Net.Benchmark.csproj b/src/Lucene.Net.Benchmark/Lucene.Net.Benchmark.csproj
index b5fbd7d..f1d5b73 100644
--- a/src/Lucene.Net.Benchmark/Lucene.Net.Benchmark.csproj
+++ b/src/Lucene.Net.Benchmark/Lucene.Net.Benchmark.csproj
@@ -25,7 +25,7 @@
 
   <PropertyGroup>
     <TargetFrameworks>netstandard2.0;netstandard1.6</TargetFrameworks>
-	<TargetFrameworks Condition="$([MSBuild]::IsOsPlatform('Windows'))">$(TargetFrameworks);net45</TargetFrameworks>
+    <TargetFrameworks Condition="$([MSBuild]::IsOsPlatform('Windows'))">$(TargetFrameworks);net45</TargetFrameworks>
     <PackageTargetFallback Condition=" '$(TargetFramework)' == 'netstandard1.6' ">$(PackageTargetFallback);dnxcore50</PackageTargetFallback>
 
     <AssemblyTitle>Lucene.Net.Benchmark</AssemblyTitle>
diff --git a/src/Lucene.Net.Classification/Lucene.Net.Classification.csproj b/src/Lucene.Net.Classification/Lucene.Net.Classification.csproj
index 7e80480..fa3997f 100644
--- a/src/Lucene.Net.Classification/Lucene.Net.Classification.csproj
+++ b/src/Lucene.Net.Classification/Lucene.Net.Classification.csproj
@@ -24,8 +24,8 @@
   <Import Project="$(SolutionDir)build/NuGet.props" />
   
   <PropertyGroup>
-    <TargetFrameworks>netstandard1.6</TargetFrameworks>
-	<TargetFrameworks Condition="$([MSBuild]::IsOsPlatform('Windows'))">$(TargetFrameworks);net45</TargetFrameworks>
+    <TargetFrameworks>netstandard2.0;netstandard1.6</TargetFrameworks>
+    <TargetFrameworks Condition="$([MSBuild]::IsOsPlatform('Windows'))">$(TargetFrameworks);net45</TargetFrameworks>
     <PackageTargetFallback Condition=" '$(TargetFramework)' == 'netstandard1.6' ">$(PackageTargetFallback);dnxcore50</PackageTargetFallback>
 
     <AssemblyTitle>Lucene.Net.Classification</AssemblyTitle>
@@ -40,9 +40,9 @@
     <ProjectReference Include="..\Lucene.Net.Queries\Lucene.Net.Queries.csproj" />
   </ItemGroup>
   
-  <!--<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
+  <PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
     <DebugType>portable</DebugType>
-  </PropertyGroup>-->
+  </PropertyGroup>
 
   <PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard1.6' ">
     <DebugType>portable</DebugType>
diff --git a/src/Lucene.Net.Codecs/Lucene.Net.Codecs.csproj b/src/Lucene.Net.Codecs/Lucene.Net.Codecs.csproj
index c37d2b1..0fb6086 100644
--- a/src/Lucene.Net.Codecs/Lucene.Net.Codecs.csproj
+++ b/src/Lucene.Net.Codecs/Lucene.Net.Codecs.csproj
@@ -24,8 +24,8 @@
   <Import Project="$(SolutionDir)build/NuGet.props" />
   
   <PropertyGroup>
-    <TargetFrameworks>netstandard1.6</TargetFrameworks>
-	<TargetFrameworks Condition="$([MSBuild]::IsOsPlatform('Windows'))">$(TargetFrameworks);net45</TargetFrameworks>
+    <TargetFrameworks>netstandard2.0;netstandard1.6</TargetFrameworks>
+    <TargetFrameworks Condition="$([MSBuild]::IsOsPlatform('Windows'))">$(TargetFrameworks);net45</TargetFrameworks>
     <PackageTargetFallback Condition=" '$(TargetFramework)' == 'netstandard1.6' ">$(PackageTargetFallback);dnxcore50</PackageTargetFallback>
 
     <AssemblyTitle>Lucene.Net.Codecs</AssemblyTitle>
@@ -39,9 +39,9 @@
     <ProjectReference Include="..\Lucene.Net\Lucene.Net.csproj" />
   </ItemGroup>
 
-  <!--<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
+  <PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
     <DebugType>portable</DebugType>
-  </PropertyGroup>-->
+  </PropertyGroup>
 
   <ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.6' ">
     <PackageReference Include="Microsoft.CSharp" Version="$(MicrosoftCSharpPackageVersion)" />
diff --git a/src/Lucene.Net.Demo/Lucene.Net.Demo.csproj b/src/Lucene.Net.Demo/Lucene.Net.Demo.csproj
index 88f5210..7d6bf28 100644
--- a/src/Lucene.Net.Demo/Lucene.Net.Demo.csproj
+++ b/src/Lucene.Net.Demo/Lucene.Net.Demo.csproj
@@ -25,7 +25,7 @@
   
   <PropertyGroup>
     <TargetFrameworks>netstandard2.0;netstandard1.6</TargetFrameworks>
-	<TargetFrameworks Condition="$([MSBuild]::IsOsPlatform('Windows'))">$(TargetFrameworks);net45</TargetFrameworks>
+    <TargetFrameworks Condition="$([MSBuild]::IsOsPlatform('Windows'))">$(TargetFrameworks);net45</TargetFrameworks>
     <PackageTargetFallback Condition=" '$(TargetFramework)' == 'netstandard1.6' ">$(PackageTargetFallback);dnxcore50</PackageTargetFallback>
 
     <AssemblyTitle>Lucene.Net.Demo</AssemblyTitle>
diff --git a/src/Lucene.Net.Expressions/Lucene.Net.Expressions.csproj b/src/Lucene.Net.Expressions/Lucene.Net.Expressions.csproj
index 68ed9af..5f2c880 100644
--- a/src/Lucene.Net.Expressions/Lucene.Net.Expressions.csproj
+++ b/src/Lucene.Net.Expressions/Lucene.Net.Expressions.csproj
@@ -24,8 +24,8 @@
   <Import Project="$(SolutionDir)build/NuGet.props" />
   
   <PropertyGroup>
-    <TargetFrameworks>netstandard1.6</TargetFrameworks>
-	<TargetFrameworks Condition="$([MSBuild]::IsOsPlatform('Windows'))">$(TargetFrameworks);net45</TargetFrameworks>
+    <TargetFrameworks>netstandard2.0;netstandard1.6</TargetFrameworks>
+    <TargetFrameworks Condition="$([MSBuild]::IsOsPlatform('Windows'))">$(TargetFrameworks);net45</TargetFrameworks>
     <PackageTargetFallback Condition=" '$(TargetFramework)' == 'netstandard1.6' ">$(PackageTargetFallback);dnxcore50</PackageTargetFallback>
 
     <AssemblyTitle>Lucene.Net.Expressions</AssemblyTitle>
@@ -47,7 +47,7 @@
     <PackageReference Include="Antlr3.Runtime" Version="$(Antlr3RuntimePackageVersion)" />
   </ItemGroup>
   
-  <!--<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
+  <ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
     <PackageReference Include="System.Reflection.Emit" Version="$(SystemReflectionEmitPackageVersion)" />
     <PackageReference Include="System.Reflection.Emit.ILGeneration" Version="$(SystemReflectionEmitILGenerationPackageVersion)" />
     <PackageReference Include="System.Reflection.TypeExtensions" Version="$(SystemReflectionTypeExtensionsPackageVersion)" />
@@ -56,7 +56,7 @@
   <PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
     <DefineConstants>$(DefineConstants);NETSTANDARD</DefineConstants>
     <DebugType>portable</DebugType>
-  </PropertyGroup>-->
+  </PropertyGroup>
 
   <ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.6' ">
     <PackageReference Include="System.Reflection.Emit" Version="$(SystemReflectionEmitPackageVersion)" />
diff --git a/src/Lucene.Net.Facet/Lucene.Net.Facet.csproj b/src/Lucene.Net.Facet/Lucene.Net.Facet.csproj
index bc1c6b2..6409055 100644
--- a/src/Lucene.Net.Facet/Lucene.Net.Facet.csproj
+++ b/src/Lucene.Net.Facet/Lucene.Net.Facet.csproj
@@ -24,8 +24,8 @@
   <Import Project="$(SolutionDir)build/NuGet.props" />
   
   <PropertyGroup>
-    <TargetFrameworks>netstandard1.6</TargetFrameworks>
-	<TargetFrameworks Condition="$([MSBuild]::IsOsPlatform('Windows'))">$(TargetFrameworks);net45</TargetFrameworks>
+    <TargetFrameworks>netstandard2.0;netstandard1.6</TargetFrameworks>
+    <TargetFrameworks Condition="$([MSBuild]::IsOsPlatform('Windows'))">$(TargetFrameworks);net45</TargetFrameworks>
     <PackageTargetFallback Condition=" '$(TargetFramework)' == 'netstandard1.6' ">$(PackageTargetFallback);dnxcore50</PackageTargetFallback>
 
     <AssemblyTitle>Lucene.Net.Facet</AssemblyTitle>
@@ -45,9 +45,9 @@
   </ItemGroup>
 
   <!-- NOTE: Microsoft's recommendation is not to use the ICloneable interface. We put in a FEATURE_CLONEABLE constant in case anyone wants to add it to the build -->
-  <!--<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
+  <PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
     <DebugType>portable</DebugType>
-  </PropertyGroup>-->
+  </PropertyGroup>
   
   <ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.6' ">
     <PackageReference Include="System.Threading.Thread" Version="$(SystemThreadingThreadPackageVersion)" />
diff --git a/src/Lucene.Net.Grouping/Lucene.Net.Grouping.csproj b/src/Lucene.Net.Grouping/Lucene.Net.Grouping.csproj
index 2e2f5aa..34c3fe5 100644
--- a/src/Lucene.Net.Grouping/Lucene.Net.Grouping.csproj
+++ b/src/Lucene.Net.Grouping/Lucene.Net.Grouping.csproj
@@ -24,8 +24,8 @@
   <Import Project="$(SolutionDir)build/NuGet.props" />
   
   <PropertyGroup>
-    <TargetFrameworks>netstandard1.6</TargetFrameworks>
-	<TargetFrameworks Condition="$([MSBuild]::IsOsPlatform('Windows'))">$(TargetFrameworks);net45</TargetFrameworks>
+    <TargetFrameworks>netstandard2.0;netstandard1.6</TargetFrameworks>
+    <TargetFrameworks Condition="$([MSBuild]::IsOsPlatform('Windows'))">$(TargetFrameworks);net45</TargetFrameworks>
     <PackageTargetFallback Condition=" '$(TargetFramework)' == 'netstandard1.6' ">$(PackageTargetFallback);dnxcore50</PackageTargetFallback>
 
     <AssemblyTitle>Lucene.Net.Grouping</AssemblyTitle>
@@ -40,9 +40,9 @@
     <ProjectReference Include="..\Lucene.Net.Queries\Lucene.Net.Queries.csproj" />
   </ItemGroup>
 
-  <!--<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
+  <PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
     <DebugType>portable</DebugType>
-  </PropertyGroup>-->
+  </PropertyGroup>
 
   <PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard1.6' ">
     <DebugType>portable</DebugType>
diff --git a/src/Lucene.Net.Highlighter/Lucene.Net.Highlighter.csproj b/src/Lucene.Net.Highlighter/Lucene.Net.Highlighter.csproj
index 9eed3b2..642b6f2 100644
--- a/src/Lucene.Net.Highlighter/Lucene.Net.Highlighter.csproj
+++ b/src/Lucene.Net.Highlighter/Lucene.Net.Highlighter.csproj
@@ -24,8 +24,8 @@
   <Import Project="$(SolutionDir)build/NuGet.props" />
   
   <PropertyGroup>
-    <TargetFrameworks>netstandard1.6</TargetFrameworks>
-	<TargetFrameworks Condition="$([MSBuild]::IsOsPlatform('Windows'))">$(TargetFrameworks);net45</TargetFrameworks>
+    <TargetFrameworks>netstandard2.0;netstandard1.6</TargetFrameworks>
+    <TargetFrameworks Condition="$([MSBuild]::IsOsPlatform('Windows'))">$(TargetFrameworks);net45</TargetFrameworks>
     <PackageTargetFallback Condition=" '$(TargetFramework)' == 'netstandard1.6' ">$(PackageTargetFallback);dnxcore50</PackageTargetFallback>
 
     <AssemblyTitle>Lucene.Net.Highlighter</AssemblyTitle>
@@ -44,9 +44,9 @@
     <ProjectReference Include="..\Lucene.Net.Queries\Lucene.Net.Queries.csproj" />
   </ItemGroup>
 
-  <!--<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
+  <PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
     <DebugType>portable</DebugType>
-  </PropertyGroup>-->
+  </PropertyGroup>
 
   <ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.6' ">
     <PackageReference Include="System.Net.Primitives" Version="$(SystemNetPrimitivesPackageVersion)" />
diff --git a/src/Lucene.Net.Join/Lucene.Net.Join.csproj b/src/Lucene.Net.Join/Lucene.Net.Join.csproj
index dd282c8..425ea9b 100644
--- a/src/Lucene.Net.Join/Lucene.Net.Join.csproj
+++ b/src/Lucene.Net.Join/Lucene.Net.Join.csproj
@@ -24,8 +24,8 @@
   <Import Project="$(SolutionDir)build/NuGet.props" />
   
   <PropertyGroup>
-    <TargetFrameworks>netstandard1.6</TargetFrameworks>
-	<TargetFrameworks Condition="$([MSBuild]::IsOsPlatform('Windows'))">$(TargetFrameworks);net45</TargetFrameworks>
+    <TargetFrameworks>netstandard2.0;netstandard1.6</TargetFrameworks>
+    <TargetFrameworks Condition="$([MSBuild]::IsOsPlatform('Windows'))">$(TargetFrameworks);net45</TargetFrameworks>
     <PackageTargetFallback Condition=" '$(TargetFramework)' == 'netstandard1.6' ">$(PackageTargetFallback);dnxcore50</PackageTargetFallback>
 
     <AssemblyTitle>Lucene.Net.Join</AssemblyTitle>
@@ -43,9 +43,9 @@
     <ProjectReference Include="..\Lucene.Net.Grouping\Lucene.Net.Grouping.csproj" />
   </ItemGroup>
   
-  <!--<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
+  <PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
     <DebugType>portable</DebugType>
-  </PropertyGroup>-->
+  </PropertyGroup>
 
   <PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard1.6' ">
     <DebugType>portable</DebugType>
diff --git a/src/Lucene.Net.Memory/Lucene.Net.Memory.csproj b/src/Lucene.Net.Memory/Lucene.Net.Memory.csproj
index 5bcb143..d24a383 100644
--- a/src/Lucene.Net.Memory/Lucene.Net.Memory.csproj
+++ b/src/Lucene.Net.Memory/Lucene.Net.Memory.csproj
@@ -25,7 +25,7 @@
   
   <PropertyGroup>
     <TargetFrameworks>netstandard2.0;netstandard1.6</TargetFrameworks>
-	<TargetFrameworks Condition="$([MSBuild]::IsOsPlatform('Windows'))">$(TargetFrameworks);net45</TargetFrameworks>
+    <TargetFrameworks Condition="$([MSBuild]::IsOsPlatform('Windows'))">$(TargetFrameworks);net45</TargetFrameworks>
     <PackageTargetFallback Condition=" '$(TargetFramework)' == 'netstandard1.6' ">$(PackageTargetFallback);dnxcore50</PackageTargetFallback>
     
     <AssemblyTitle>Lucene.Net.Memory</AssemblyTitle>
diff --git a/src/Lucene.Net.Misc/Lucene.Net.Misc.csproj b/src/Lucene.Net.Misc/Lucene.Net.Misc.csproj
index fbdc51b..372359d 100644
--- a/src/Lucene.Net.Misc/Lucene.Net.Misc.csproj
+++ b/src/Lucene.Net.Misc/Lucene.Net.Misc.csproj
@@ -24,8 +24,8 @@
   <Import Project="$(SolutionDir)build/NuGet.props" />
   
   <PropertyGroup>
-    <TargetFrameworks>netstandard1.6</TargetFrameworks>
-	<TargetFrameworks Condition="$([MSBuild]::IsOsPlatform('Windows'))">$(TargetFrameworks);net45</TargetFrameworks>
+    <TargetFrameworks>netstandard2.0;netstandard1.6</TargetFrameworks>
+    <TargetFrameworks Condition="$([MSBuild]::IsOsPlatform('Windows'))">$(TargetFrameworks);net45</TargetFrameworks>
     <PackageTargetFallback Condition=" '$(TargetFramework)' == 'netstandard1.6' ">$(PackageTargetFallback);dnxcore50</PackageTargetFallback>
 
     <AssemblyTitle>Lucene.Net.Misc</AssemblyTitle>
@@ -43,9 +43,9 @@
     <ProjectReference Include="..\Lucene.Net\Lucene.Net.csproj" />
   </ItemGroup>
 
-  <!--<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
+  <PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
     <DebugType>portable</DebugType>
-  </PropertyGroup>-->
+  </PropertyGroup>
 
   <PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard1.6' ">
     <DebugType>portable</DebugType>
diff --git a/src/Lucene.Net.Queries/Lucene.Net.Queries.csproj b/src/Lucene.Net.Queries/Lucene.Net.Queries.csproj
index cdcb187..b49a13c 100644
--- a/src/Lucene.Net.Queries/Lucene.Net.Queries.csproj
+++ b/src/Lucene.Net.Queries/Lucene.Net.Queries.csproj
@@ -24,8 +24,8 @@
   <Import Project="$(SolutionDir)build/NuGet.props" />
   
   <PropertyGroup>
-    <TargetFrameworks>netstandard1.6</TargetFrameworks>
-	<TargetFrameworks Condition="$([MSBuild]::IsOsPlatform('Windows'))">$(TargetFrameworks);net45</TargetFrameworks>
+    <TargetFrameworks>netstandard2.0;netstandard1.6</TargetFrameworks>
+    <TargetFrameworks Condition="$([MSBuild]::IsOsPlatform('Windows'))">$(TargetFrameworks);net45</TargetFrameworks>
     <PackageTargetFallback Condition=" '$(TargetFramework)' == 'netstandard1.6' ">$(PackageTargetFallback);dnxcore50</PackageTargetFallback>
 
     <AssemblyTitle>Lucene.Net.Queries</AssemblyTitle>
@@ -39,9 +39,9 @@
     <ProjectReference Include="..\Lucene.Net\Lucene.Net.csproj" />
   </ItemGroup>
 
-  <!--<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
+  <PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
     <DebugType>portable</DebugType>
-  </PropertyGroup>-->
+  </PropertyGroup>
 
   <PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard1.6' ">
     <DebugType>portable</DebugType>
diff --git a/src/Lucene.Net.QueryParser/Lucene.Net.QueryParser.csproj b/src/Lucene.Net.QueryParser/Lucene.Net.QueryParser.csproj
index b331207..c2ceb39 100644
--- a/src/Lucene.Net.QueryParser/Lucene.Net.QueryParser.csproj
+++ b/src/Lucene.Net.QueryParser/Lucene.Net.QueryParser.csproj
@@ -25,7 +25,7 @@
   
   <PropertyGroup>
     <TargetFrameworks>netstandard2.0;netstandard1.6</TargetFrameworks>
-	<TargetFrameworks Condition="$([MSBuild]::IsOsPlatform('Windows'))">$(TargetFrameworks);net45</TargetFrameworks>
+    <TargetFrameworks Condition="$([MSBuild]::IsOsPlatform('Windows'))">$(TargetFrameworks);net45</TargetFrameworks>
     <PackageTargetFallback Condition=" '$(TargetFramework)' == 'netstandard1.6' ">$(PackageTargetFallback);dnxcore50</PackageTargetFallback>
 
     <AssemblyTitle>Lucene.Net.QueryParser</AssemblyTitle>
diff --git a/src/Lucene.Net.Replicator/Lucene.Net.Replicator.csproj b/src/Lucene.Net.Replicator/Lucene.Net.Replicator.csproj
index cd59401..a7e2473 100644
--- a/src/Lucene.Net.Replicator/Lucene.Net.Replicator.csproj
+++ b/src/Lucene.Net.Replicator/Lucene.Net.Replicator.csproj
@@ -24,8 +24,8 @@
   <Import Project="$(SolutionDir)build/NuGet.props" />
   
   <PropertyGroup>
-    <TargetFrameworks>netstandard1.6</TargetFrameworks>
-	<TargetFrameworks Condition="$([MSBuild]::IsOsPlatform('Windows'))">$(TargetFrameworks);net45</TargetFrameworks>
+    <TargetFrameworks>netstandard2.0;netstandard1.6</TargetFrameworks>
+    <TargetFrameworks Condition="$([MSBuild]::IsOsPlatform('Windows'))">$(TargetFrameworks);net45</TargetFrameworks>
     <PackageTargetFallback Condition=" '$(TargetFramework)' == 'netstandard1.6' ">$(PackageTargetFallback);dnxcore50</PackageTargetFallback>
 
     <AssemblyTitle>Lucene.Net.Replicator</AssemblyTitle>
@@ -44,9 +44,9 @@
     <PackageReference Include="Newtonsoft.Json" Version="$(NewtonsoftJsonPackageVersion)" />
   </ItemGroup>
 
-  <!--<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
+  <PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
     <DebugType>portable</DebugType>
-  </PropertyGroup>-->
+  </PropertyGroup>
 
   <PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard1.6' ">
     <DebugType>portable</DebugType>
diff --git a/src/Lucene.Net.Sandbox/Lucene.Net.Sandbox.csproj b/src/Lucene.Net.Sandbox/Lucene.Net.Sandbox.csproj
index 77abfff..2735c79 100644
--- a/src/Lucene.Net.Sandbox/Lucene.Net.Sandbox.csproj
+++ b/src/Lucene.Net.Sandbox/Lucene.Net.Sandbox.csproj
@@ -24,8 +24,8 @@
   <Import Project="$(SolutionDir)build/NuGet.props" />
   
   <PropertyGroup>
-    <TargetFrameworks>netstandard1.6</TargetFrameworks>
-	<TargetFrameworks Condition="$([MSBuild]::IsOsPlatform('Windows'))">$(TargetFrameworks);net45</TargetFrameworks>
+    <TargetFrameworks>netstandard2.0;netstandard1.6</TargetFrameworks>
+    <TargetFrameworks Condition="$([MSBuild]::IsOsPlatform('Windows'))">$(TargetFrameworks);net45</TargetFrameworks>
     <PackageTargetFallback Condition=" '$(TargetFramework)' == 'netstandard1.6' ">$(PackageTargetFallback);dnxcore50</PackageTargetFallback>
 
     <AssemblyTitle>Lucene.Net.Sandbox</AssemblyTitle>
@@ -39,9 +39,9 @@
     <ProjectReference Include="..\Lucene.Net\Lucene.Net.csproj" />
   </ItemGroup>
 
-  <!--<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
+  <PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
     <DebugType>portable</DebugType>
-  </PropertyGroup>-->
+  </PropertyGroup>
 
   <PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard1.6' ">
     <DebugType>portable</DebugType>
diff --git a/src/Lucene.Net.Spatial/Lucene.Net.Spatial.csproj b/src/Lucene.Net.Spatial/Lucene.Net.Spatial.csproj
index c23ed96..89e895a 100644
--- a/src/Lucene.Net.Spatial/Lucene.Net.Spatial.csproj
+++ b/src/Lucene.Net.Spatial/Lucene.Net.Spatial.csproj
@@ -25,7 +25,7 @@
   
   <PropertyGroup>
     <TargetFrameworks>netstandard2.0;netstandard1.6</TargetFrameworks>
-	<TargetFrameworks Condition="$([MSBuild]::IsOsPlatform('Windows'))">$(TargetFrameworks);net45</TargetFrameworks>
+    <TargetFrameworks Condition="$([MSBuild]::IsOsPlatform('Windows'))">$(TargetFrameworks);net45</TargetFrameworks>
     <PackageTargetFallback Condition=" '$(TargetFramework)' == 'netstandard1.6' ">$(PackageTargetFallback);dnxcore50</PackageTargetFallback>
 
     <AssemblyTitle>Lucene.Net.Spatial</AssemblyTitle>
diff --git a/src/Lucene.Net.Suggest/Lucene.Net.Suggest.csproj b/src/Lucene.Net.Suggest/Lucene.Net.Suggest.csproj
index 245ff95..4018c0c 100644
--- a/src/Lucene.Net.Suggest/Lucene.Net.Suggest.csproj
+++ b/src/Lucene.Net.Suggest/Lucene.Net.Suggest.csproj
@@ -24,8 +24,8 @@
   <Import Project="$(SolutionDir)build/NuGet.props" />
   
   <PropertyGroup>
-    <TargetFrameworks>netstandard1.6</TargetFrameworks>
-	<TargetFrameworks Condition="$([MSBuild]::IsOsPlatform('Windows'))">$(TargetFrameworks);net45</TargetFrameworks>
+    <TargetFrameworks>netstandard2.0;netstandard1.6</TargetFrameworks>
+    <TargetFrameworks Condition="$([MSBuild]::IsOsPlatform('Windows'))">$(TargetFrameworks);net45</TargetFrameworks>
     <PackageTargetFallback Condition=" '$(TargetFramework)' == 'netstandard1.6' ">$(PackageTargetFallback);dnxcore50</PackageTargetFallback>
 
     <AssemblyTitle>Lucene.Net.Suggest</AssemblyTitle>
@@ -45,9 +45,9 @@
     <ProjectReference Include="..\Lucene.Net.Queries\Lucene.Net.Queries.csproj" />
   </ItemGroup>
 
-  <!--<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
+  <PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
     <DebugType>portable</DebugType>
-  </PropertyGroup>-->
+  </PropertyGroup>
 
   <PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard1.6' ">
     <DebugType>portable</DebugType>
diff --git a/src/Lucene.Net.TestFramework/Lucene.Net.TestFramework.csproj b/src/Lucene.Net.TestFramework/Lucene.Net.TestFramework.csproj
index 86dea98..8557b51 100644
--- a/src/Lucene.Net.TestFramework/Lucene.Net.TestFramework.csproj
+++ b/src/Lucene.Net.TestFramework/Lucene.Net.TestFramework.csproj
@@ -26,7 +26,7 @@
   
   <PropertyGroup>
     <TargetFrameworks>netstandard2.0;netstandard1.6</TargetFrameworks>
-	<TargetFrameworks Condition="$([MSBuild]::IsOsPlatform('Windows'))">$(TargetFrameworks);net45</TargetFrameworks>
+    <TargetFrameworks Condition="$([MSBuild]::IsOsPlatform('Windows'))">$(TargetFrameworks);net45</TargetFrameworks>
     <PackageTargetFallback Condition=" '$(TargetFramework)' == 'netstandard1.6' ">$(PackageTargetFallback);dnxcore50</PackageTargetFallback>
 
     <AssemblyTitle>Lucene.Net.TestFramework</AssemblyTitle>
diff --git a/src/Lucene.Net/Lucene.Net.csproj b/src/Lucene.Net/Lucene.Net.csproj
index 55a85cd..a0bd3c2 100644
--- a/src/Lucene.Net/Lucene.Net.csproj
+++ b/src/Lucene.Net/Lucene.Net.csproj
@@ -25,7 +25,7 @@
   
   <PropertyGroup>
     <TargetFrameworks>netstandard2.0;netstandard1.6</TargetFrameworks>
-	<TargetFrameworks Condition="$([MSBuild]::IsOsPlatform('Windows'))">$(TargetFrameworks);net45</TargetFrameworks>
+    <TargetFrameworks Condition="$([MSBuild]::IsOsPlatform('Windows'))">$(TargetFrameworks);net45</TargetFrameworks>
     <PackageTargetFallback Condition=" '$(TargetFramework)' == 'netstandard1.6' ">$(PackageTargetFallback);dnxcore50</PackageTargetFallback>
 
     <AssemblyTitle>Lucene.Net</AssemblyTitle>
diff --git a/src/dotnet/Lucene.Net.ICU/Lucene.Net.ICU.csproj b/src/dotnet/Lucene.Net.ICU/Lucene.Net.ICU.csproj
index 1bb0ade..f59941b 100644
--- a/src/dotnet/Lucene.Net.ICU/Lucene.Net.ICU.csproj
+++ b/src/dotnet/Lucene.Net.ICU/Lucene.Net.ICU.csproj
@@ -24,8 +24,8 @@
   <Import Project="$(SolutionDir)build/NuGet.props" />
 
   <PropertyGroup>
-    <TargetFrameworks>netstandard1.6</TargetFrameworks>
-	<TargetFrameworks Condition="$([MSBuild]::IsOsPlatform('Windows'))">$(TargetFrameworks);net45</TargetFrameworks>
+    <TargetFrameworks>netstandard2.0;netstandard1.6</TargetFrameworks>
+    <TargetFrameworks Condition="$([MSBuild]::IsOsPlatform('Windows'))">$(TargetFrameworks);net45</TargetFrameworks>
     <PackageTargetFallback Condition=" '$(TargetFramework)' == 'netstandard1.6' ">$(PackageTargetFallback);dnxcore50</PackageTargetFallback>
 
     <AssemblyTitle>Lucene.Net.ICU</AssemblyTitle>
@@ -69,10 +69,10 @@
   </ItemGroup>
 
   <!-- NOTE: Microsoft's recommendation is not to use the ICloneable interface. We put in a FEATURE_CLONEABLE constant in case anyone wants to add it to the build -->
-  <!--<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
+  <PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
     <DefineConstants>$(DefineConstants);NETSTANDARD</DefineConstants>
     <DebugType>portable</DebugType>
-  </PropertyGroup>-->
+  </PropertyGroup>
 
   <ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.6' ">
     <PackageReference Include="System.Globalization" Version="$(SystemGlobalizationPackageVersion)" />
diff --git a/src/dotnet/Lucene.Net.Replicator.AspNetCore/Lucene.Net.Replicator.AspNetCore.csproj b/src/dotnet/Lucene.Net.Replicator.AspNetCore/Lucene.Net.Replicator.AspNetCore.csproj
index c8a4a1b..d97b993 100644
--- a/src/dotnet/Lucene.Net.Replicator.AspNetCore/Lucene.Net.Replicator.AspNetCore.csproj
+++ b/src/dotnet/Lucene.Net.Replicator.AspNetCore/Lucene.Net.Replicator.AspNetCore.csproj
@@ -25,8 +25,8 @@
   <!--<Import Project="$(SolutionDir)build/NuGet.props" />-->
   
   <PropertyGroup>
-    <TargetFrameworks>netstandard1.6</TargetFrameworks>
-	<TargetFrameworks Condition="$([MSBuild]::IsOsPlatform('Windows'))">$(TargetFrameworks);net451</TargetFrameworks>
+    <TargetFrameworks>netstandard2.0;netstandard1.6</TargetFrameworks>
+    <TargetFrameworks Condition="$([MSBuild]::IsOsPlatform('Windows'))">$(TargetFrameworks);net451</TargetFrameworks>
     <PackageTargetFallback Condition=" '$(TargetFramework)' == 'netstandard1.6' ">$(PackageTargetFallback);dnxcore50</PackageTargetFallback>
 
     <AssemblyTitle>Lucene.Net.Replicator.AspNetCore</AssemblyTitle>
@@ -44,9 +44,9 @@
     <PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="$(MicrosoftAspNetCoreHttpAbstractionsPackageVersion)" />
   </ItemGroup>
 
-  <!--<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
+  <PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
     <DebugType>portable</DebugType>
-  </PropertyGroup>-->
+  </PropertyGroup>
 
   <PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard1.6' ">
     <DebugType>portable</DebugType>


[lucenenet] 26/42: SWEEP: Changed string.IndexOf(string) to use either string.IndexOf(char) or string.IndexOf(string, StringComparison.Ordinal) to keep ambient culture from affecting the comparison.

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit 4f810bac9c02de02e70658f1ead6566017dea17b
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Mon Aug 5 01:56:36 2019 +0700

    SWEEP: Changed string.IndexOf(string) to use either string.IndexOf(char) or string.IndexOf(string, StringComparison.Ordinal) to keep ambient culture from affecting the comparison.
---
 .../Icu/Segmentation/ICUTokenizerFactory.cs        |  2 +-
 src/Lucene.Net.Analysis.Kuromoji/Util/CSVUtil.cs   |  5 +++--
 .../Language/Bm/Lang.cs                            |  2 +-
 .../Language/Bm/Rule.cs                            |  4 ++--
 .../Language/DaitchMokotoffSoundex.cs              |  2 +-
 .../Language/DoubleMetaphone.cs                    |  2 +-
 .../ByTask/Feeds/TrecLATimesParser.cs              |  2 +-
 .../ByTask/Tasks/SetPropTask.cs                    |  2 +-
 .../ByTask/Tasks/TaskSequence.cs                   |  2 +-
 src/Lucene.Net.Benchmark/ByTask/Utils/Config.cs    | 26 +++++++++++-----------
 src/Lucene.Net.Benchmark/Utils/ExtractReuters.cs   |  2 +-
 .../Index/BaseDocValuesFormatTestCase.cs           |  4 ++--
 src/Lucene.Net.TestFramework/Search/CheckHits.cs   |  4 ++--
 .../TestLimitTokenCountFilterFactory.cs            |  2 +-
 .../TestLimitTokenPositionFilterFactory.cs         |  2 +-
 .../TestJapaneseTokenizer.cs                       |  2 +-
 .../ByTask/Feeds/TrecContentSourceTest.cs          |  2 +-
 .../ByTask/TestPerfTasksParse.cs                   |  4 ++--
 .../BreakIteratorBoundaryScannerTest.cs            | 18 +++++++--------
 .../VectorHighlight/IndexTimeSynonymTest.cs        |  4 ++--
 .../VectorHighlight/SimpleBoundaryScannerTest.cs   | 12 +++++-----
 .../Util/QueryParserTestBase.cs                    |  2 +-
 .../Analysis/TestGraphTokenizers.cs                |  2 +-
 .../Index/TestBackwardsCompatibility.cs            |  2 +-
 .../Index/TestBackwardsCompatibility3x.cs          |  2 +-
 .../Index/TestIndexWriterConfig.cs                 |  2 +-
 src/Lucene.Net.Tests/Index/TestSegmentMerger.cs    |  3 ++-
 src/Lucene.Net.Tests/Index/TestSegmentReader.cs    |  4 ++--
 .../Search/Payloads/TestPayloadNearQuery.cs        |  6 ++---
 src/Lucene.Net.Tests/Search/TestBooleanQuery.cs    |  2 +-
 src/Lucene.Net.Tests/Search/TestFieldCache.cs      |  2 +-
 src/Lucene.Net.Tests/Store/TestLockFactory.cs      |  2 +-
 src/Lucene.Net.Tests/Support/IO/TestByteBuffer.cs  |  9 ++++----
 src/Lucene.Net.Tests/Support/TestOldPatches.cs     |  2 +-
 src/Lucene.Net.Tests/Util/Fst/TestFSTs.cs          |  6 ++---
 src/Lucene.Net/Support/Util/NamedServiceFactory.cs |  2 +-
 36 files changed, 78 insertions(+), 75 deletions(-)

diff --git a/src/Lucene.Net.Analysis.ICU/Analysis/Icu/Segmentation/ICUTokenizerFactory.cs b/src/Lucene.Net.Analysis.ICU/Analysis/Icu/Segmentation/ICUTokenizerFactory.cs
index ac2dce0..ea93354 100644
--- a/src/Lucene.Net.Analysis.ICU/Analysis/Icu/Segmentation/ICUTokenizerFactory.cs
+++ b/src/Lucene.Net.Analysis.ICU/Analysis/Icu/Segmentation/ICUTokenizerFactory.cs
@@ -85,7 +85,7 @@ namespace Lucene.Net.Analysis.Icu.Segmentation
                 IList<string> scriptAndResourcePaths = SplitFileNames(rulefilesArg);
                 foreach (string scriptAndResourcePath in scriptAndResourcePaths)
                 {
-                    int colonPos = scriptAndResourcePath.IndexOf(":");
+                    int colonPos = scriptAndResourcePath.IndexOf(':');
                     string scriptCode = scriptAndResourcePath.Substring(0, colonPos - 0).Trim();
                     string resourcePath = scriptAndResourcePath.Substring(colonPos + 1).Trim();
                     tailored[UChar.GetPropertyValueEnum(UProperty.Script, scriptCode)] = resourcePath;
diff --git a/src/Lucene.Net.Analysis.Kuromoji/Util/CSVUtil.cs b/src/Lucene.Net.Analysis.Kuromoji/Util/CSVUtil.cs
index 9d86aed..05858f4 100644
--- a/src/Lucene.Net.Analysis.Kuromoji/Util/CSVUtil.cs
+++ b/src/Lucene.Net.Analysis.Kuromoji/Util/CSVUtil.cs
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
 using System.Text;
 using System.Text.RegularExpressions;
 
@@ -94,7 +95,7 @@ namespace Lucene.Net.Analysis.Ja.Util
                 }
 
                 // Unescape
-                if (result.IndexOf(ESCAPED_QUOTE) >= 0)
+                if (result.IndexOf(ESCAPED_QUOTE, StringComparison.Ordinal) >= 0)
                 {
                     result = result.Replace(ESCAPED_QUOTE, "\"");
                 }
diff --git a/src/Lucene.Net.Analysis.Phonetic/Language/Bm/Lang.cs b/src/Lucene.Net.Analysis.Phonetic/Language/Bm/Lang.cs
index 63faf7c..4e3dcd4 100644
--- a/src/Lucene.Net.Analysis.Phonetic/Language/Bm/Lang.cs
+++ b/src/Lucene.Net.Analysis.Phonetic/Language/Bm/Lang.cs
@@ -175,7 +175,7 @@ namespace Lucene.Net.Analysis.Phonetic.Language.Bm
                         else
                         {
                             // discard comments
-                            int cmtI = line.IndexOf(ResourceConstants.CMT);
+                            int cmtI = line.IndexOf(ResourceConstants.CMT, StringComparison.Ordinal);
                             if (cmtI >= 0)
                             {
                                 line = line.Substring(0, cmtI - 0);
diff --git a/src/Lucene.Net.Analysis.Phonetic/Language/Bm/Rule.cs b/src/Lucene.Net.Analysis.Phonetic/Language/Bm/Rule.cs
index 55e2d17..9e6e637 100644
--- a/src/Lucene.Net.Analysis.Phonetic/Language/Bm/Rule.cs
+++ b/src/Lucene.Net.Analysis.Phonetic/Language/Bm/Rule.cs
@@ -346,7 +346,7 @@ namespace Lucene.Net.Analysis.Phonetic.Language.Bm
 
         private static Phoneme ParsePhoneme(string ph)
         {
-            int open = ph.IndexOf("[");
+            int open = ph.IndexOf('[');
             if (open >= 0)
             {
                 if (!ph.EndsWith("]", StringComparison.Ordinal))
@@ -446,7 +446,7 @@ namespace Lucene.Net.Analysis.Phonetic.Language.Bm
                         else
                         {
                             // discard comments
-                            int cmtI = line.IndexOf(ResourceConstants.CMT);
+                            int cmtI = line.IndexOf(ResourceConstants.CMT, StringComparison.Ordinal);
                             if (cmtI >= 0)
                             {
                                 line = line.Substring(0, cmtI);
diff --git a/src/Lucene.Net.Analysis.Phonetic/Language/DaitchMokotoffSoundex.cs b/src/Lucene.Net.Analysis.Phonetic/Language/DaitchMokotoffSoundex.cs
index d6bdfcb..cf26e19 100644
--- a/src/Lucene.Net.Analysis.Phonetic/Language/DaitchMokotoffSoundex.cs
+++ b/src/Lucene.Net.Analysis.Phonetic/Language/DaitchMokotoffSoundex.cs
@@ -299,7 +299,7 @@ namespace Lucene.Net.Analysis.Phonetic.Language
                 else
                 {
                     // discard comments
-                    int cmtI = line.IndexOf(COMMENT);
+                    int cmtI = line.IndexOf(COMMENT, StringComparison.Ordinal);
                     if (cmtI >= 0)
                     {
                         line = line.Substring(0, cmtI - 0);
diff --git a/src/Lucene.Net.Analysis.Phonetic/Language/DoubleMetaphone.cs b/src/Lucene.Net.Analysis.Phonetic/Language/DoubleMetaphone.cs
index d54968d..2d239be 100644
--- a/src/Lucene.Net.Analysis.Phonetic/Language/DoubleMetaphone.cs
+++ b/src/Lucene.Net.Analysis.Phonetic/Language/DoubleMetaphone.cs
@@ -1088,7 +1088,7 @@ namespace Lucene.Net.Analysis.Phonetic.Language
         private bool IsSlavoGermanic(string value)
         {
             return value.IndexOf('W') > -1 || value.IndexOf('K') > -1 ||
-                value.IndexOf("CZ") > -1 || value.IndexOf("WITZ") > -1;
+                value.IndexOf("CZ", StringComparison.Ordinal) > -1 || value.IndexOf("WITZ", StringComparison.Ordinal) > -1;
         }
 
         /// <summary>
diff --git a/src/Lucene.Net.Benchmark/ByTask/Feeds/TrecLATimesParser.cs b/src/Lucene.Net.Benchmark/ByTask/Feeds/TrecLATimesParser.cs
index e54f635..c5611e2 100644
--- a/src/Lucene.Net.Benchmark/ByTask/Feeds/TrecLATimesParser.cs
+++ b/src/Lucene.Net.Benchmark/ByTask/Feeds/TrecLATimesParser.cs
@@ -44,7 +44,7 @@ namespace Lucene.Net.Benchmarks.ByTask.Feeds
             string dateStr = Extract(docBuf, DATE, DATE_END, -1, null);
             if (dateStr != null)
             {
-                int d2a = dateStr.IndexOf(DATE_NOISE);
+                int d2a = dateStr.IndexOf(DATE_NOISE, StringComparison.Ordinal);
                 if (d2a > 0)
                 {
                     dateStr = dateStr.Substring(0, (d2a + 3) - 0); // we need the "day" part
diff --git a/src/Lucene.Net.Benchmark/ByTask/Tasks/SetPropTask.cs b/src/Lucene.Net.Benchmark/ByTask/Tasks/SetPropTask.cs
index abb66d2..a0ce0ec 100644
--- a/src/Lucene.Net.Benchmark/ByTask/Tasks/SetPropTask.cs
+++ b/src/Lucene.Net.Benchmark/ByTask/Tasks/SetPropTask.cs
@@ -57,7 +57,7 @@ namespace Lucene.Net.Benchmarks.ByTask.Tasks
         public override void SetParams(string @params)
         {
             base.SetParams(@params);
-            int k = @params.IndexOf(",");
+            int k = @params.IndexOf(',');
             name = @params.Substring(0, k - 0).Trim();
             value = @params.Substring(k + 1).Trim();
         }
diff --git a/src/Lucene.Net.Benchmark/ByTask/Tasks/TaskSequence.cs b/src/Lucene.Net.Benchmark/ByTask/Tasks/TaskSequence.cs
index b28a530..7bbadfd 100644
--- a/src/Lucene.Net.Benchmark/ByTask/Tasks/TaskSequence.cs
+++ b/src/Lucene.Net.Benchmark/ByTask/Tasks/TaskSequence.cs
@@ -622,7 +622,7 @@ namespace Lucene.Net.Benchmarks.ByTask.Tasks
             {
                 seqName += "_" + rate + (perMin ? "/min" : "/sec");
             }
-            if (parallel && seqName.ToLowerInvariant().IndexOf("par") < 0)
+            if (parallel && seqName.ToLowerInvariant().IndexOf("par", StringComparison.Ordinal) < 0)
             {
                 seqName += "_Par";
             }
diff --git a/src/Lucene.Net.Benchmark/ByTask/Utils/Config.cs b/src/Lucene.Net.Benchmark/ByTask/Utils/Config.cs
index 4f11292..9f5839c 100644
--- a/src/Lucene.Net.Benchmark/ByTask/Utils/Config.cs
+++ b/src/Lucene.Net.Benchmark/ByTask/Utils/Config.cs
@@ -173,18 +173,18 @@ namespace Lucene.Net.Benchmarks.ByTask.Utils
             {
                 return null;
             }
-            if (sval.IndexOf(":") < 0)
+            if (sval.IndexOf(':') < 0)
             {
                 return sval;
             }
-            else if (sval.IndexOf(":\\") >= 0 || sval.IndexOf(":/") >= 0)
+            else if (sval.IndexOf(":\\", StringComparison.Ordinal) >= 0 || sval.IndexOf(":/", StringComparison.Ordinal) >= 0)
             {
                 // this previously messed up absolute path names on Windows. Assuming
                 // there is no real value that starts with \ or /
                 return sval;
             }
             // first time this prop is extracted by round
-            int k = sval.IndexOf(":");
+            int k = sval.IndexOf(':');
             string colName = sval.Substring(0, k - 0);
             sval = sval.Substring(k + 1);
             colForValByRound[name] = colName;
@@ -236,12 +236,12 @@ namespace Lucene.Net.Benchmarks.ByTask.Utils
             {
                 sval = dflt.ToString(CultureInfo.InvariantCulture);
             }
-            if (sval.IndexOf(":") < 0)
+            if (sval.IndexOf(':') < 0)
             {
                 return int.Parse(sval, CultureInfo.InvariantCulture);
             }
             // first time this prop is extracted by round
-            int k = sval.IndexOf(":");
+            int k = sval.IndexOf(':');
             string colName = sval.Substring(0, k - 0);
             sval = sval.Substring(k + 1);
             colForValByRound[name] = colName;
@@ -276,12 +276,12 @@ namespace Lucene.Net.Benchmarks.ByTask.Utils
             {
                 sval = dflt.ToString(CultureInfo.InvariantCulture);
             }
-            if (sval.IndexOf(":") < 0)
+            if (sval.IndexOf(':') < 0)
             {
                 return double.Parse(sval, CultureInfo.InvariantCulture);
             }
             // first time this prop is extracted by round
-            int k = sval.IndexOf(":");
+            int k = sval.IndexOf(':');
             string colName = sval.Substring(0, k - 0);
             sval = sval.Substring(k + 1);
             colForValByRound[name] = colName;
@@ -315,12 +315,12 @@ namespace Lucene.Net.Benchmarks.ByTask.Utils
             {
                 sval = dflt.ToString(); // LUCENENET NOTE: bool ignores the IFormatProvider argument, it returns the values of constants
             }
-            if (sval.IndexOf(":") < 0)
+            if (sval.IndexOf(':') < 0)
             {
                 return bool.Parse(sval);
             }
             // first time this prop is extracted by round 
-            int k = sval.IndexOf(":");
+            int k = sval.IndexOf(':');
             string colName = sval.Substring(0, k - 0);
             sval = sval.Substring(k + 1);
             colForValByRound[name] = colName;
@@ -386,7 +386,7 @@ namespace Lucene.Net.Benchmarks.ByTask.Utils
 
         private string[] PropToStringArray(string s)
         {
-            if (s.IndexOf(":") < 0)
+            if (s.IndexOf(':') < 0)
             {
                 return new string[] { s };
             }
@@ -404,7 +404,7 @@ namespace Lucene.Net.Benchmarks.ByTask.Utils
         // extract properties to array, e.g. for "10:100:5" return int[]{10,100,5}. 
         private int[] PropToInt32Array(string s)
         {
-            if (s.IndexOf(":") < 0)
+            if (s.IndexOf(':') < 0)
             {
                 return new int[] { int.Parse(s, CultureInfo.InvariantCulture) };
             }
@@ -427,7 +427,7 @@ namespace Lucene.Net.Benchmarks.ByTask.Utils
         // extract properties to array, e.g. for "10.7:100.4:-2.3" return int[]{10.7,100.4,-2.3}. 
         private double[] PropToDoubleArray(string s)
         {
-            if (s.IndexOf(":") < 0)
+            if (s.IndexOf(':') < 0)
             {
                 return new double[] { double.Parse(s, CultureInfo.InvariantCulture) };
             }
@@ -450,7 +450,7 @@ namespace Lucene.Net.Benchmarks.ByTask.Utils
         // extract properties to array, e.g. for "true:true:false" return boolean[]{true,false,false}. 
         private bool[] PropToBooleanArray(string s)
         {
-            if (s.IndexOf(":") < 0)
+            if (s.IndexOf(':') < 0)
             {
                 return new bool[] { bool.Parse(s) };
             }
diff --git a/src/Lucene.Net.Benchmark/Utils/ExtractReuters.cs b/src/Lucene.Net.Benchmark/Utils/ExtractReuters.cs
index 83b2cb4..a9e06b9 100644
--- a/src/Lucene.Net.Benchmark/Utils/ExtractReuters.cs
+++ b/src/Lucene.Net.Benchmark/Utils/ExtractReuters.cs
@@ -84,7 +84,7 @@ namespace Lucene.Net.Benchmarks.Utils
                     {
                         // when we see a closing reuters tag, flush the file
 
-                        if (line.IndexOf("</REUTERS") == -1)
+                        if (line.IndexOf("</REUTERS", StringComparison.Ordinal) == -1)
                         {
                             // Replace the SGM escape sequences
 
diff --git a/src/Lucene.Net.TestFramework/Index/BaseDocValuesFormatTestCase.cs b/src/Lucene.Net.TestFramework/Index/BaseDocValuesFormatTestCase.cs
index ecb2119..804acd7 100644
--- a/src/Lucene.Net.TestFramework/Index/BaseDocValuesFormatTestCase.cs
+++ b/src/Lucene.Net.TestFramework/Index/BaseDocValuesFormatTestCase.cs
@@ -3017,7 +3017,7 @@ namespace Lucene.Net.Index
                 }
                 catch (System.ArgumentException iae)
                 {
-                    if (iae.Message.IndexOf("is too large") == -1)
+                    if (iae.Message.IndexOf("is too large", StringComparison.Ordinal) == -1)
                     {
                         throw iae;
                     }
@@ -3039,7 +3039,7 @@ namespace Lucene.Net.Index
             }
             catch (System.ArgumentException iae)
             {
-                if (iae.Message.IndexOf("is too large") == -1)
+                if (iae.Message.IndexOf("is too large", StringComparison.Ordinal) == -1)
                 {
                     throw iae;
                 }
diff --git a/src/Lucene.Net.TestFramework/Search/CheckHits.cs b/src/Lucene.Net.TestFramework/Search/CheckHits.cs
index ab9ee60..e7fbf69 100644
--- a/src/Lucene.Net.TestFramework/Search/CheckHits.cs
+++ b/src/Lucene.Net.TestFramework/Search/CheckHits.cs
@@ -386,11 +386,11 @@ namespace Lucene.Net.Search
                     if (!(productOf || sumOf || maxOf))
                     {
                         // maybe 'max plus x times others'
-                        int k1 = descr.IndexOf("max plus ");
+                        int k1 = descr.IndexOf("max plus ", StringComparison.Ordinal);
                         if (k1 >= 0)
                         {
                             k1 += "max plus ".Length;
-                            int k2 = descr.IndexOf(" ", k1);
+                            int k2 = descr.IndexOf(" ", k1, StringComparison.Ordinal);
                             try
                             {
                                 // LUCENENET NOTE: Using current culture here is intentional because
diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Miscellaneous/TestLimitTokenCountFilterFactory.cs b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Miscellaneous/TestLimitTokenCountFilterFactory.cs
index ba7f6ee..c5785ca 100644
--- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Miscellaneous/TestLimitTokenCountFilterFactory.cs
+++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Miscellaneous/TestLimitTokenCountFilterFactory.cs
@@ -50,7 +50,7 @@ namespace Lucene.Net.Analysis.Miscellaneous
             }
             catch (System.ArgumentException e)
             {
-                assertTrue("exception doesn't mention param: " + e.Message, 0 < e.Message.IndexOf(LimitTokenCountFilterFactory.MAX_TOKEN_COUNT_KEY));
+                assertTrue("exception doesn't mention param: " + e.Message, 0 < e.Message.IndexOf(LimitTokenCountFilterFactory.MAX_TOKEN_COUNT_KEY, StringComparison.Ordinal));
             }
         }
 
diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Miscellaneous/TestLimitTokenPositionFilterFactory.cs b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Miscellaneous/TestLimitTokenPositionFilterFactory.cs
index 0cef7e6..56bbf5b 100644
--- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Miscellaneous/TestLimitTokenPositionFilterFactory.cs
+++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Miscellaneous/TestLimitTokenPositionFilterFactory.cs
@@ -50,7 +50,7 @@ namespace Lucene.Net.Analysis.Miscellaneous
             }
             catch (System.ArgumentException e)
             {
-                assertTrue("exception doesn't mention param: " + e.Message, 0 < e.Message.IndexOf(LimitTokenPositionFilterFactory.MAX_TOKEN_POSITION_KEY));
+                assertTrue("exception doesn't mention param: " + e.Message, 0 < e.Message.IndexOf(LimitTokenPositionFilterFactory.MAX_TOKEN_POSITION_KEY, StringComparison.Ordinal));
             }
         }
 
diff --git a/src/Lucene.Net.Tests.Analysis.Kuromoji/TestJapaneseTokenizer.cs b/src/Lucene.Net.Tests.Analysis.Kuromoji/TestJapaneseTokenizer.cs
index 7f832c7..41d9f28 100644
--- a/src/Lucene.Net.Tests.Analysis.Kuromoji/TestJapaneseTokenizer.cs
+++ b/src/Lucene.Net.Tests.Analysis.Kuromoji/TestJapaneseTokenizer.cs
@@ -439,7 +439,7 @@ namespace Lucene.Net.Analysis.Ja
                              surfaceForms);
 
 
-            assertTrue(gv2.Finish().IndexOf("22.0") != -1);
+            assertTrue(gv2.Finish().IndexOf("22.0", StringComparison.Ordinal) != -1);
         }
 
         private void assertReadings(String input, params String[] readings)
diff --git a/src/Lucene.Net.Tests.Benchmark/ByTask/Feeds/TrecContentSourceTest.cs b/src/Lucene.Net.Tests.Benchmark/ByTask/Feeds/TrecContentSourceTest.cs
index 2ae8d68..da676c0 100644
--- a/src/Lucene.Net.Tests.Benchmark/ByTask/Feeds/TrecContentSourceTest.cs
+++ b/src/Lucene.Net.Tests.Benchmark/ByTask/Feeds/TrecContentSourceTest.cs
@@ -69,7 +69,7 @@ namespace Lucene.Net.Benchmarks.ByTask.Feeds
             assertNotNull(dd);
             assertEquals(expName, dd.Name);
             assertEquals(expTitle, dd.Title);
-            assertTrue(dd.Body.IndexOf(expBody) != -1);
+            assertTrue(dd.Body.IndexOf(expBody, StringComparison.Ordinal) != -1);
             DateTime? date = dd.Date != null ? DateTools.StringToDate(dd.Date) : (DateTime?)null;
             assertEquals(expDate, date);
         }
diff --git a/src/Lucene.Net.Tests.Benchmark/ByTask/TestPerfTasksParse.cs b/src/Lucene.Net.Tests.Benchmark/ByTask/TestPerfTasksParse.cs
index e604cef..3d3afae 100644
--- a/src/Lucene.Net.Tests.Benchmark/ByTask/TestPerfTasksParse.cs
+++ b/src/Lucene.Net.Tests.Benchmark/ByTask/TestPerfTasksParse.cs
@@ -55,7 +55,7 @@ namespace Lucene.Net.Benchmarks.ByTask
             bool foundAdd = false;
             foreach (PerfTask task in algTasks)
             {
-                if (task.toString().IndexOf(taskStr) >= 0)
+                if (task.toString().IndexOf(taskStr, StringComparison.Ordinal) >= 0)
                 {
                     foundAdd = true;
                 }
@@ -80,7 +80,7 @@ namespace Lucene.Net.Benchmarks.ByTask
             bool foundAdd = false;
             foreach (PerfTask task in algTasks)
             {
-                if (task.toString().IndexOf(taskStr) >= 0)
+                if (task.toString().IndexOf(taskStr, StringComparison.Ordinal) >= 0)
                 {
                     foundAdd = true;
                 }
diff --git a/src/Lucene.Net.Tests.Highlighter/VectorHighlight/BreakIteratorBoundaryScannerTest.cs b/src/Lucene.Net.Tests.Highlighter/VectorHighlight/BreakIteratorBoundaryScannerTest.cs
index f16898d..6210fa8 100644
--- a/src/Lucene.Net.Tests.Highlighter/VectorHighlight/BreakIteratorBoundaryScannerTest.cs
+++ b/src/Lucene.Net.Tests.Highlighter/VectorHighlight/BreakIteratorBoundaryScannerTest.cs
@@ -57,11 +57,11 @@ namespace Lucene.Net.Search.VectorHighlight
             BreakIterator bi = JdkBreakIterator.GetWordInstance(CultureInfo.InvariantCulture);
             IBoundaryScanner scanner = new BreakIteratorBoundaryScanner(bi);
 
-            int start = TEXT.IndexOf("formance");
-            int expected = TEXT.IndexOf("high-performance");
+            int start = TEXT.IndexOf("formance", StringComparison.Ordinal);
+            int expected = TEXT.IndexOf("high-performance", StringComparison.Ordinal);
             TestFindStartOffset(text, start, expected, scanner);
 
-            expected = TEXT.IndexOf(", full");
+            expected = TEXT.IndexOf(", full", StringComparison.Ordinal);
             TestFindEndOffset(text, start, expected, scanner);
         }
 
@@ -73,11 +73,11 @@ namespace Lucene.Net.Search.VectorHighlight
             BreakIterator bi = JdkBreakIterator.GetSentenceInstance(CultureInfo.CurrentCulture);
             IBoundaryScanner scanner = new BreakIteratorBoundaryScanner(bi);
 
-            int start = TEXT.IndexOf("any application");
-            int expected = TEXT.IndexOf("It is a");
+            int start = TEXT.IndexOf("any application", StringComparison.Ordinal);
+            int expected = TEXT.IndexOf("It is a", StringComparison.Ordinal);
             TestFindStartOffset(text, start, expected, scanner);
 
-            expected = TEXT.IndexOf("Apache Lucene is an open source");
+            expected = TEXT.IndexOf("Apache Lucene is an open source", StringComparison.Ordinal);
             TestFindEndOffset(text, start, expected, scanner);
         }
 
@@ -89,11 +89,11 @@ namespace Lucene.Net.Search.VectorHighlight
             BreakIterator bi = BreakIterator.GetLineInstance(CultureInfo.CurrentCulture);
             IBoundaryScanner scanner = new BreakIteratorBoundaryScanner(bi);
 
-            int start = TEXT.IndexOf("any application");
-            int expected = TEXT.IndexOf("nearly");
+            int start = TEXT.IndexOf("any application", StringComparison.Ordinal);
+            int expected = TEXT.IndexOf("nearly", StringComparison.Ordinal);
             TestFindStartOffset(text, start, expected, scanner);
 
-            expected = TEXT.IndexOf("application that requires");
+            expected = TEXT.IndexOf("application that requires", StringComparison.Ordinal);
             TestFindEndOffset(text, start, expected, scanner);
         }
 
diff --git a/src/Lucene.Net.Tests.Highlighter/VectorHighlight/IndexTimeSynonymTest.cs b/src/Lucene.Net.Tests.Highlighter/VectorHighlight/IndexTimeSynonymTest.cs
index 029fd3d..7620a60 100644
--- a/src/Lucene.Net.Tests.Highlighter/VectorHighlight/IndexTimeSynonymTest.cs
+++ b/src/Lucene.Net.Tests.Highlighter/VectorHighlight/IndexTimeSynonymTest.cs
@@ -204,7 +204,7 @@ namespace Lucene.Net.Search.VectorHighlight
             FieldTermStack stack = new FieldTermStack(reader, 0, F, fq);
             FieldPhraseList fpl = new FieldPhraseList(stack, fq);
             assertEquals(1, fpl.PhraseList.size());
-            assertTrue(fpl.PhraseList[0].toString().IndexOf("(1.0)((3,5))") > 0);
+            assertTrue(fpl.PhraseList[0].toString().IndexOf("(1.0)((3,5))", StringComparison.Ordinal) > 0);
             assertEquals(3, fpl.PhraseList[0].StartOffset);
             assertEquals(5, fpl.PhraseList[0].EndOffset);
         }
@@ -263,7 +263,7 @@ namespace Lucene.Net.Search.VectorHighlight
             FieldTermStack stack = new FieldTermStack(reader, 0, F, fq);
             FieldPhraseList fpl = new FieldPhraseList(stack, fq);
             assertEquals(1, fpl.PhraseList.size());
-            assertTrue(fpl.PhraseList[0].toString().IndexOf("(1.0)((3,20))") > 0);
+            assertTrue(fpl.PhraseList[0].toString().IndexOf("(1.0)((3,20))", StringComparison.Ordinal) > 0);
             assertEquals(3, fpl.PhraseList[0].StartOffset);
             assertEquals(20, fpl.PhraseList[0].EndOffset);
         }
diff --git a/src/Lucene.Net.Tests.Highlighter/VectorHighlight/SimpleBoundaryScannerTest.cs b/src/Lucene.Net.Tests.Highlighter/VectorHighlight/SimpleBoundaryScannerTest.cs
index 74314ef..39ca4c1 100644
--- a/src/Lucene.Net.Tests.Highlighter/VectorHighlight/SimpleBoundaryScannerTest.cs
+++ b/src/Lucene.Net.Tests.Highlighter/VectorHighlight/SimpleBoundaryScannerTest.cs
@@ -39,12 +39,12 @@ namespace Lucene.Net.Search.VectorHighlight
             start = 0;
             assertEquals(start, scanner.FindStartOffset(text, start));
 
-            start = TEXT.IndexOf("formance");
-            int expected = TEXT.IndexOf("high-performance");
+            start = TEXT.IndexOf("formance", StringComparison.Ordinal);
+            int expected = TEXT.IndexOf("high-performance", StringComparison.Ordinal);
             assertEquals(expected, scanner.FindStartOffset(text, start));
 
-            start = TEXT.IndexOf("che");
-            expected = TEXT.IndexOf("Apache");
+            start = TEXT.IndexOf("che", StringComparison.Ordinal);
+            expected = TEXT.IndexOf("Apache", StringComparison.Ordinal);
             assertEquals(expected, scanner.FindStartOffset(text, start));
         }
 
@@ -60,8 +60,8 @@ namespace Lucene.Net.Search.VectorHighlight
             start = -1;
             assertEquals(start, scanner.FindEndOffset(text, start));
 
-            start = TEXT.IndexOf("full-");
-            int expected = TEXT.IndexOf("\ntext");
+            start = TEXT.IndexOf("full-", StringComparison.Ordinal);
+            int expected = TEXT.IndexOf("\ntext", StringComparison.Ordinal);
             assertEquals(expected, scanner.FindEndOffset(text, start));
         }
     }
diff --git a/src/Lucene.Net.Tests.QueryParser/Util/QueryParserTestBase.cs b/src/Lucene.Net.Tests.QueryParser/Util/QueryParserTestBase.cs
index 0064166..dee6193 100644
--- a/src/Lucene.Net.Tests.QueryParser/Util/QueryParserTestBase.cs
+++ b/src/Lucene.Net.Tests.QueryParser/Util/QueryParserTestBase.cs
@@ -656,7 +656,7 @@ namespace Lucene.Net.QueryParsers.Util
 
         private string EscapeDateString(string s)
         {
-            if (s.IndexOf(" ") > -1)
+            if (s.IndexOf(' ') > -1)
             {
                 return "\"" + s + "\"";
             }
diff --git a/src/Lucene.Net.Tests/Analysis/TestGraphTokenizers.cs b/src/Lucene.Net.Tests/Analysis/TestGraphTokenizers.cs
index ff98a11..de3a32e 100644
--- a/src/Lucene.Net.Tests/Analysis/TestGraphTokenizers.cs
+++ b/src/Lucene.Net.Tests/Analysis/TestGraphTokenizers.cs
@@ -702,7 +702,7 @@ namespace Lucene.Net.Analysis
             TokenStream ts = new CannedTokenStream(new Token[] { Token("abc", 1, 1, 0, 4) });
             StringWriter w = new StringWriter();
             (new TokenStreamToDot("abcd", ts, (TextWriter)(w))).ToDot();
-            Assert.IsTrue(w.ToString().IndexOf("abc / abcd") != -1);
+            Assert.IsTrue(w.ToString().IndexOf("abc / abcd", StringComparison.Ordinal) != -1);
         }
 
         [Test]
diff --git a/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility.cs b/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility.cs
index eb4c0d1..cbe0126 100644
--- a/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility.cs
+++ b/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility.cs
@@ -287,7 +287,7 @@ namespace Lucene.Net.Index
                         Console.WriteLine(e.StackTrace);
                     }
                     // Make sure exc message includes a path=
-                    Assert.IsTrue(e.Message.IndexOf("path=\"") != -1, "got exc message: " + e.Message);
+                    Assert.IsTrue(e.Message.IndexOf("path=\"", StringComparison.Ordinal) != -1, "got exc message: " + e.Message);
                 }
                 finally
                 {
diff --git a/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility3x.cs b/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility3x.cs
index e0160ef..1c7c3f7 100644
--- a/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility3x.cs
+++ b/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility3x.cs
@@ -218,7 +218,7 @@ namespace Lucene.Net.Index
                         Console.WriteLine(e.StackTrace);
                     }
                     // Make sure exc message includes a path=
-                    Assert.IsTrue(e.Message.IndexOf("path=\"") != -1, "got exc message: " + e.Message);
+                    Assert.IsTrue(e.Message.IndexOf("path=\"", StringComparison.Ordinal) != -1, "got exc message: " + e.Message);
                 }
                 finally
                 {
diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriterConfig.cs b/src/Lucene.Net.Tests/Index/TestIndexWriterConfig.cs
index bd92c66..c7ddaed 100644
--- a/src/Lucene.Net.Tests/Index/TestIndexWriterConfig.cs
+++ b/src/Lucene.Net.Tests/Index/TestIndexWriterConfig.cs
@@ -264,7 +264,7 @@ namespace Lucene.Net.Index
                 {
                     continue;
                 }
-                Assert.IsTrue(str.IndexOf(f.Name) != -1, f.Name + " not found in toString");
+                Assert.IsTrue(str.IndexOf(f.Name, StringComparison.Ordinal) != -1, f.Name + " not found in toString");
             }
         }
 
diff --git a/src/Lucene.Net.Tests/Index/TestSegmentMerger.cs b/src/Lucene.Net.Tests/Index/TestSegmentMerger.cs
index 30786b5..1bfe964 100644
--- a/src/Lucene.Net.Tests/Index/TestSegmentMerger.cs
+++ b/src/Lucene.Net.Tests/Index/TestSegmentMerger.cs
@@ -3,6 +3,7 @@ using Lucene.Net.Support;
 namespace Lucene.Net.Index
 {
     using NUnit.Framework;
+    using System;
     using BytesRef = Lucene.Net.Util.BytesRef;
 
     /*
@@ -139,7 +140,7 @@ namespace Lucene.Net.Index
                 string term = termsEnum.Term.Utf8ToString();
                 int freq = (int)termsEnum.TotalTermFreq;
                 //System.out.println("Term: " + term + " Freq: " + freq);
-                Assert.IsTrue(DocHelper.FIELD_2_TEXT.IndexOf(term) != -1);
+                Assert.IsTrue(DocHelper.FIELD_2_TEXT.IndexOf(term, StringComparison.Ordinal) != -1);
                 Assert.IsTrue(DocHelper.FIELD_2_FREQS[i] == freq);
                 i++;
             }
diff --git a/src/Lucene.Net.Tests/Index/TestSegmentReader.cs b/src/Lucene.Net.Tests/Index/TestSegmentReader.cs
index d96376a..95da6b6 100644
--- a/src/Lucene.Net.Tests/Index/TestSegmentReader.cs
+++ b/src/Lucene.Net.Tests/Index/TestSegmentReader.cs
@@ -148,7 +148,7 @@ namespace Lucene.Net.Index
                     BytesRef term = termsEnum.Term;
                     Assert.IsTrue(term != null);
                     string fieldValue = (string)DocHelper.NameValues[field];
-                    Assert.IsTrue(fieldValue.IndexOf(term.Utf8ToString()) != -1);
+                    Assert.IsTrue(fieldValue.IndexOf(term.Utf8ToString(), StringComparison.Ordinal) != -1);
                 }
             }
 
@@ -216,7 +216,7 @@ namespace Lucene.Net.Index
             {
                 string term = termsEnum.Term.Utf8ToString();
                 int freq = (int)termsEnum.TotalTermFreq;
-                Assert.IsTrue(DocHelper.FIELD_2_TEXT.IndexOf(term) != -1);
+                Assert.IsTrue(DocHelper.FIELD_2_TEXT.IndexOf(term, StringComparison.Ordinal) != -1);
                 Assert.IsTrue(freq > 0);
             }
 
diff --git a/src/Lucene.Net.Tests/Search/Payloads/TestPayloadNearQuery.cs b/src/Lucene.Net.Tests/Search/Payloads/TestPayloadNearQuery.cs
index 261ac15..02ff70c 100644
--- a/src/Lucene.Net.Tests/Search/Payloads/TestPayloadNearQuery.cs
+++ b/src/Lucene.Net.Tests/Search/Payloads/TestPayloadNearQuery.cs
@@ -234,7 +234,7 @@ namespace Lucene.Net.Search.Payloads
                 Assert.AreEqual(3, doc.Score, doc.Score + " does not equal: " + 3);
                 Explanation explain = Searcher.Explain(query, hits.ScoreDocs[j].Doc);
                 string exp = explain.ToString();
-                Assert.IsTrue(exp.IndexOf("AveragePayloadFunction") > -1, exp);
+                Assert.IsTrue(exp.IndexOf("AveragePayloadFunction", StringComparison.Ordinal) > -1, exp);
                 Assert.AreEqual(3f, explain.Value, hits.ScoreDocs[j].Score + " explain value does not equal: " + 3);
             }
         }
@@ -257,7 +257,7 @@ namespace Lucene.Net.Search.Payloads
                 Assert.AreEqual(4, doc.Score, doc.Score + " does not equal: " + 4);
                 Explanation explain = Searcher.Explain(query, hits.ScoreDocs[j].Doc);
                 string exp = explain.ToString();
-                Assert.IsTrue(exp.IndexOf("MaxPayloadFunction") > -1, exp);
+                Assert.IsTrue(exp.IndexOf("MaxPayloadFunction", StringComparison.Ordinal) > -1, exp);
                 Assert.AreEqual(4f, explain.Value, hits.ScoreDocs[j].Score + " explain value does not equal: " + 4);
             }
         }
@@ -280,7 +280,7 @@ namespace Lucene.Net.Search.Payloads
                 Assert.AreEqual(2, doc.Score, doc.Score + " does not equal: " + 2);
                 Explanation explain = Searcher.Explain(query, hits.ScoreDocs[j].Doc);
                 string exp = explain.ToString();
-                Assert.IsTrue(exp.IndexOf("MinPayloadFunction") > -1, exp);
+                Assert.IsTrue(exp.IndexOf("MinPayloadFunction", StringComparison.Ordinal) > -1, exp);
                 Assert.AreEqual(2f, explain.Value, hits.ScoreDocs[j].Score + " explain value does not equal: " + 2);
             }
         }
diff --git a/src/Lucene.Net.Tests/Search/TestBooleanQuery.cs b/src/Lucene.Net.Tests/Search/TestBooleanQuery.cs
index 096ff51..6b07118 100644
--- a/src/Lucene.Net.Tests/Search/TestBooleanQuery.cs
+++ b/src/Lucene.Net.Tests/Search/TestBooleanQuery.cs
@@ -404,7 +404,7 @@ namespace Lucene.Net.Search
 
             protected override void Search(IList<AtomicReaderContext> leaves, Weight weight, ICollector collector)
             {
-                Assert.AreEqual(-1, collector.GetType().Name.IndexOf("OutOfOrder"));
+                Assert.AreEqual(-1, collector.GetType().Name.IndexOf("OutOfOrder", StringComparison.Ordinal));
                 base.Search(leaves, weight, collector);
             }
         }
diff --git a/src/Lucene.Net.Tests/Search/TestFieldCache.cs b/src/Lucene.Net.Tests/Search/TestFieldCache.cs
index 926f426..e36c6a6 100644
--- a/src/Lucene.Net.Tests/Search/TestFieldCache.cs
+++ b/src/Lucene.Net.Tests/Search/TestFieldCache.cs
@@ -194,7 +194,7 @@ namespace Lucene.Net.Search
                     cache.GetDoubles(Reader, "theDouble", false);
                     cache.GetSingles(Reader, "theDouble", false);
                 }
-                Assert.IsTrue(sb.ToString(/*IOUtils.UTF_8*/).IndexOf("WARNING") != -1);
+                Assert.IsTrue(sb.ToString(/*IOUtils.UTF_8*/).IndexOf("WARNING", StringComparison.Ordinal) != -1);
             }
             finally
             {
diff --git a/src/Lucene.Net.Tests/Store/TestLockFactory.cs b/src/Lucene.Net.Tests/Store/TestLockFactory.cs
index 4b7ec9b..46e6655 100644
--- a/src/Lucene.Net.Tests/Store/TestLockFactory.cs
+++ b/src/Lucene.Net.Tests/Store/TestLockFactory.cs
@@ -315,7 +315,7 @@ namespace Lucene.Net.Store
                     }
                     catch (IOException e)
                     {
-                        if (e.ToString().IndexOf(" timed out:") == -1)
+                        if (e.ToString().IndexOf(" timed out:", StringComparison.Ordinal) == -1)
                         {
                             HitException = true;
                             Console.WriteLine("Stress Test Index Writer: creation hit unexpected IOException: " + e.ToString());
diff --git a/src/Lucene.Net.Tests/Support/IO/TestByteBuffer.cs b/src/Lucene.Net.Tests/Support/IO/TestByteBuffer.cs
index b08b343..9a8467b 100644
--- a/src/Lucene.Net.Tests/Support/IO/TestByteBuffer.cs
+++ b/src/Lucene.Net.Tests/Support/IO/TestByteBuffer.cs
@@ -4,6 +4,7 @@
 using Lucene.Net.Attributes;
 using NUnit.Framework;
 using System;
+using System.Globalization;
 
 namespace Lucene.Net.Support.IO
 {
@@ -1087,10 +1088,10 @@ namespace Lucene.Net.Support.IO
         public virtual void TestToString()
         {
             String str = buf.toString();
-            assertTrue(str.IndexOf("Byte") >= 0 || str.IndexOf("byte") >= 0);
-            assertTrue(str.IndexOf("" + buf.Position) >= 0);
-            assertTrue(str.IndexOf("" + buf.Limit) >= 0);
-            assertTrue(str.IndexOf("" + buf.Capacity) >= 0);
+            assertTrue(str.IndexOf("Byte", StringComparison.Ordinal) >= 0 || str.IndexOf("byte", StringComparison.Ordinal) >= 0);
+            assertTrue(str.IndexOf("" + buf.Position.ToString(CultureInfo.InvariantCulture), StringComparison.Ordinal) >= 0);
+            assertTrue(str.IndexOf("" + buf.Limit.ToString(CultureInfo.InvariantCulture), StringComparison.Ordinal) >= 0);
+            assertTrue(str.IndexOf("" + buf.Capacity.ToString(CultureInfo.InvariantCulture), StringComparison.Ordinal) >= 0);
         }
 
         // LUCENENET NOTE: Not supported
diff --git a/src/Lucene.Net.Tests/Support/TestOldPatches.cs b/src/Lucene.Net.Tests/Support/TestOldPatches.cs
index d4f36c5..bc781cd 100644
--- a/src/Lucene.Net.Tests/Support/TestOldPatches.cs
+++ b/src/Lucene.Net.Tests/Support/TestOldPatches.cs
@@ -53,7 +53,7 @@ namespace Lucene.Net.Support
         //    Lucene.Net.Index.IndexReader reader = writer.GetReader();
         //    Lucene.Net.Index.TermPositionVector tpv = reader.GetTermFreqVector(0, "contents") as Lucene.Net.Index.TermPositionVector;
         //    //Console.WriteLine("tpv: " + tpv);
-        //    int index = tpv.IndexOf("a_");
+        //    int index = tpv.IndexOf("a_", StringComparison.Ordinal);
         //    Assert.AreEqual(index, 1, "See the issue: LUCENENET-183");
         //}
 
diff --git a/src/Lucene.Net.Tests/Util/Fst/TestFSTs.cs b/src/Lucene.Net.Tests/Util/Fst/TestFSTs.cs
index 2ffa46c..842297e 100644
--- a/src/Lucene.Net.Tests/Util/Fst/TestFSTs.cs
+++ b/src/Lucene.Net.Tests/Util/Fst/TestFSTs.cs
@@ -1354,7 +1354,7 @@ namespace Lucene.Net.Util.Fst
             Util.ToDot(fst, w, false, false);
             w.Dispose();
             //System.out.println(w.toString());
-            Assert.IsTrue(w.ToString().IndexOf("label=\"t/[7]\"") != -1);
+            Assert.IsTrue(w.ToString().IndexOf("label=\"t/[7]\"", StringComparison.Ordinal) != -1);
         }
 
         [Test]
@@ -1373,9 +1373,9 @@ namespace Lucene.Net.Util.Fst
             //System.out.println(w.toString());
 
             // check for accept state at label t
-            Assert.IsTrue(w.ToString().IndexOf("[label=\"t\" style=\"bold\"") != -1);
+            Assert.IsTrue(w.ToString().IndexOf("[label=\"t\" style=\"bold\"", StringComparison.Ordinal) != -1);
             // check for accept state at label n
-            Assert.IsTrue(w.ToString().IndexOf("[label=\"n\" style=\"bold\"") != -1);
+            Assert.IsTrue(w.ToString().IndexOf("[label=\"n\" style=\"bold\"", StringComparison.Ordinal) != -1);
         }
 
         // Make sure raw FST can differentiate between final vs
diff --git a/src/Lucene.Net/Support/Util/NamedServiceFactory.cs b/src/Lucene.Net/Support/Util/NamedServiceFactory.cs
index 03ac82c..4756206 100644
--- a/src/Lucene.Net/Support/Util/NamedServiceFactory.cs
+++ b/src/Lucene.Net/Support/Util/NamedServiceFactory.cs
@@ -125,7 +125,7 @@ namespace Lucene.Net.Util
         {
             string name = type.Name;
             string genericSuffix = string.Empty;
-            int genericIndex = name.IndexOf("`");
+            int genericIndex = name.IndexOf('`');
             if (genericIndex > -1)
             {
                 genericSuffix = "Generic" + name.Substring(genericIndex + 1);


[lucenenet] 25/42: BUG: Lucene.Net.Tests.Index.TestTransactionRollback: Number was failing due to the fact the data that was being populated wasn't being converted from int to string in invariant culture. Switched back to original logic, using LastIndexOf(char) rather than LastIndexOf(string).

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit 8f090ba813edd5cca489968a1ae3c21c811f6139
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Mon Aug 5 01:48:04 2019 +0700

    BUG: Lucene.Net.Tests.Index.TestTransactionRollback: Number was failing due to the fact the data that was being populated wasn't being converted from int to string in invariant culture. Switched back to original logic, using LastIndexOf(char) rather than LastIndexOf(string).
---
 src/Lucene.Net.Tests/Index/TestTransactionRollback.cs | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/src/Lucene.Net.Tests/Index/TestTransactionRollback.cs b/src/Lucene.Net.Tests/Index/TestTransactionRollback.cs
index 8a162de..ca58e05 100644
--- a/src/Lucene.Net.Tests/Index/TestTransactionRollback.cs
+++ b/src/Lucene.Net.Tests/Index/TestTransactionRollback.cs
@@ -1,6 +1,7 @@
 using System;
 using System.Collections;
 using System.Collections.Generic;
+using System.Globalization;
 using Lucene.Net.Documents;
 
 namespace Lucene.Net.Index
@@ -72,7 +73,7 @@ namespace Lucene.Net.Index
 
             IndexWriter w = new IndexWriter(Dir, NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random())).SetIndexDeletionPolicy(new RollbackDeletionPolicy(this, id)).SetIndexCommit(last));
             IDictionary<string, string> data = new Dictionary<string, string>();
-            data["index"] = "Rolled back to 1-" + id;
+            data["index"] = "Rolled back to 1-" + id.ToString(CultureInfo.InvariantCulture);
             w.SetCommitData(data);
             w.Dispose();
         }
@@ -145,13 +146,13 @@ namespace Lucene.Net.Index
             for (int currentRecordId = 1; currentRecordId <= 100; currentRecordId++)
             {
                 Document doc = new Document();
-                doc.Add(NewTextField(FIELD_RECORD_ID, "" + currentRecordId, Field.Store.YES));
+                doc.Add(NewTextField(FIELD_RECORD_ID, currentRecordId.ToString(CultureInfo.InvariantCulture), Field.Store.YES));
                 w.AddDocument(doc);
 
                 if (currentRecordId % 10 == 0)
                 {
                     IDictionary<string, string> data = new Dictionary<string, string>();
-                    data["index"] = "records 1-" + currentRecordId;
+                    data["index"] = "records 1-" + currentRecordId.ToString(CultureInfo.InvariantCulture);
                     w.SetCommitData(data);
                     w.Commit();
                 }
@@ -195,12 +196,8 @@ namespace Lucene.Net.Index
                         // this code reads the last id ("30" in this example) and deletes it
                         // if it is after the desired rollback point
                         string x = userData["index"];
-
-                        // LUCENENET specific - Bug in the original when "-" is the last character in
-                        // the string, it tries to match one larger than what is available.
-                        int lastIndex = x.LastIndexOf("-");
-                        string lastVal = x.Substring(lastIndex + 1 == x.Length ? lastIndex : lastIndex + 1);
-                        int last = Convert.ToInt32(lastVal);
+                        string lastVal = x.Substring(x.LastIndexOf('-') + 1);
+                        int last = Convert.ToInt32(lastVal, CultureInfo.InvariantCulture);
                         if (last > RollbackPoint)
                         {
                             /*


[lucenenet] 12/42: BUG: Lucene.Net.Util.CommandLineUtil.AdjustDirectoryName - IndexOf comparison must be StringComparison.Ordinal (or in this case, a single char) to be compatible with all cultures/platforms.

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit 55c8ac0f32a7a7e2bd4619819d4f21eb6f2d145c
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Wed Jul 31 14:52:58 2019 +0700

    BUG: Lucene.Net.Util.CommandLineUtil.AdjustDirectoryName - IndexOf comparison must be StringComparison.Ordinal (or in this case, a single char) to be compatible with all cultures/platforms.
---
 src/Lucene.Net/Util/CommandLineUtil.cs | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/Lucene.Net/Util/CommandLineUtil.cs b/src/Lucene.Net/Util/CommandLineUtil.cs
index 2d04e65..cf0020b 100644
--- a/src/Lucene.Net/Util/CommandLineUtil.cs
+++ b/src/Lucene.Net/Util/CommandLineUtil.cs
@@ -89,9 +89,13 @@ namespace Lucene.Net.Util
                 throw new System.ArgumentException("The " + typeof(FSDirectory).Name + " implementation cannot be null or empty");
             }
 
-            if (clazzName.IndexOf(".") == -1) // if not fully qualified, assume .store
+            // LUCENENET specific: Changed to use char rather than string so we get StringComparison.Ordinal,
+            // otherwise this could fail on some operating systems in certain cultures.
+            if (clazzName.IndexOf('.') == -1) // if not fully qualified, assume .store
             {
-                clazzName = typeof(Directory).Namespace + "." + clazzName;
+                // LUCENENET NOTE: .NET expects the type to be in the currently executing assembly or mscorlib
+                // if not fully qualified. This fails on macOS if called from LuceneTestCase.NewFSDirectory() without the AssemblyQualifiedName.
+                clazzName = typeof(Directory).AssemblyQualifiedName.Replace(nameof(Directory), clazzName);
             }
             return clazzName;
         }


[lucenenet] 09/42: BUG: Lucene.Net.Benchmark.ByTask.Utils.Config: Fixed FormatException caused by converting number to string in ambient culture and parsing it back to a number in invariant culture

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit 2803600a8b69b45a103c440e4dcaceb6b409ae06
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Wed Jul 31 06:56:59 2019 +0700

    BUG: Lucene.Net.Benchmark.ByTask.Utils.Config: Fixed FormatException caused by converting number to string in ambient culture and parsing it back to a number in invariant culture
---
 src/Lucene.Net.Benchmark/ByTask/Utils/Config.cs | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/Lucene.Net.Benchmark/ByTask/Utils/Config.cs b/src/Lucene.Net.Benchmark/ByTask/Utils/Config.cs
index 53e8afd..4f11292 100644
--- a/src/Lucene.Net.Benchmark/ByTask/Utils/Config.cs
+++ b/src/Lucene.Net.Benchmark/ByTask/Utils/Config.cs
@@ -234,7 +234,7 @@ namespace Lucene.Net.Benchmarks.ByTask.Utils
             string sval;
             if (!props.TryGetValue(name, out sval))
             {
-                sval = "" + dflt;
+                sval = dflt.ToString(CultureInfo.InvariantCulture);
             }
             if (sval.IndexOf(":") < 0)
             {
@@ -274,7 +274,7 @@ namespace Lucene.Net.Benchmarks.ByTask.Utils
             string sval;
             if (!props.TryGetValue(name, out sval))
             {
-                sval = "" + dflt;
+                sval = dflt.ToString(CultureInfo.InvariantCulture);
             }
             if (sval.IndexOf(":") < 0)
             {
@@ -313,7 +313,7 @@ namespace Lucene.Net.Benchmarks.ByTask.Utils
             string sval;
             if (!props.TryGetValue(name, out sval))
             {
-                sval = "" + dflt;
+                sval = dflt.ToString(); // LUCENENET NOTE: bool ignores the IFormatProvider argument, it returns the values of constants
             }
             if (sval.IndexOf(":") < 0)
             {


[lucenenet] 42/42: BUG: Lucene.Net.TestFramework.Codecs.RAMOnly.RAMOnlyPostingsFormat - string comparison must be done using ordinal to match Java

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit 764a8a246d4c8364520ea53392aa346f14c6c1df
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Wed Aug 7 23:14:36 2019 +0700

    BUG: Lucene.Net.TestFramework.Codecs.RAMOnly.RAMOnlyPostingsFormat - string comparison must be done using ordinal to match Java
---
 src/Lucene.Net.TestFramework/Codecs/RAMOnly/RAMOnlyPostingsFormat.cs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/Lucene.Net.TestFramework/Codecs/RAMOnly/RAMOnlyPostingsFormat.cs b/src/Lucene.Net.TestFramework/Codecs/RAMOnly/RAMOnlyPostingsFormat.cs
index 62cb78d..ed48cf0 100644
--- a/src/Lucene.Net.TestFramework/Codecs/RAMOnly/RAMOnlyPostingsFormat.cs
+++ b/src/Lucene.Net.TestFramework/Codecs/RAMOnly/RAMOnlyPostingsFormat.cs
@@ -437,7 +437,7 @@ namespace Lucene.Net.Codecs.RAMOnly
                     else
                     {
                         //It = RamField.TermToDocs.tailMap(Current).Keys.GetEnumerator();
-                        It = RamField.TermToDocs.Where(kvpair => String.Compare(kvpair.Key, Current) >= 0).ToDictionary(kvpair => kvpair.Key, kvpair => kvpair.Value).Keys.GetEnumerator();
+                        It = RamField.TermToDocs.Where(kvpair => String.CompareOrdinal(kvpair.Key, Current) >= 0).ToDictionary(kvpair => kvpair.Key, kvpair => kvpair.Value).Keys.GetEnumerator();
                     }
                 }
                 if (It.MoveNext())


[lucenenet] 32/42: azure-pipelines.yml: Decreased maximum number of allowed failures to 4 per target framework/OS combo

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit 65fd44f1b066f34fb1b88ad08658eabbf2c94815
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Mon Aug 5 18:38:59 2019 +0700

    azure-pipelines.yml: Decreased maximum number of allowed failures to 4 per target framework/OS combo
---
 azure-pipelines.yml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/azure-pipelines.yml b/azure-pipelines.yml
index 48ddfaf..f3aea1c 100644
--- a/azure-pipelines.yml
+++ b/azure-pipelines.yml
@@ -175,11 +175,11 @@ stages:
         Linux:
           osName: 'Linux'
           imageName: 'ubuntu-16.04'
-          maximumAllowedFailures: 30 # Maximum allowed failures for a successful build
+          maximumAllowedFailures: 4 # Maximum allowed failures for a successful build
         macOS:
           osName: 'macOS'
           imageName: 'macOS-10.14'
-          maximumAllowedFailures: 30 # Maximum allowed failures for a successful build
+          maximumAllowedFailures: 4 # Maximum allowed failures for a successful build
     displayName: 'Test netcoreapp2.1 on'
     pool:
       vmImage: $(imageName)
@@ -204,11 +204,11 @@ stages:
         Linux:
           osName: 'Linux'
           imageName: 'ubuntu-16.04'
-          maximumAllowedFailures: 30 # Maximum allowed failures for a successful build
+          maximumAllowedFailures: 4 # Maximum allowed failures for a successful build
         macOS:
           osName: 'macOS'
           imageName: 'macOS-10.14'
-          maximumAllowedFailures: 30 # Maximum allowed failures for a successful build
+          maximumAllowedFailures: 4 # Maximum allowed failures for a successful build
     displayName: 'Test netcoreapp1.0 on'
     pool:
       vmImage: $(imageName)


[lucenenet] 23/42: BUG: Lucene.Net.TestFramework.Util.TestUtil.NextLong: The result of the method was always the value of start when start == long.MinValue and end == long.MaxValue. As a result, many tests were not actually random.

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit 8d3636e1da707b34fbb1fad05fee217ae0e335ea
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Sun Aug 4 02:43:30 2019 +0700

    BUG: Lucene.Net.TestFramework.Util.TestUtil.NextLong: The result of the method was always the value of start when start == long.MinValue and end == long.MaxValue. As a result, many tests were not actually random.
---
 src/Lucene.Net.TestFramework/Util/TestUtil.cs | 27 +++++++++++++++++++++++++--
 1 file changed, 25 insertions(+), 2 deletions(-)

diff --git a/src/Lucene.Net.TestFramework/Util/TestUtil.cs b/src/Lucene.Net.TestFramework/Util/TestUtil.cs
index 011e6c9..5a804d5 100644
--- a/src/Lucene.Net.TestFramework/Util/TestUtil.cs
+++ b/src/Lucene.Net.TestFramework/Util/TestUtil.cs
@@ -288,8 +288,31 @@ namespace Lucene.Net.Util
             else
             {
                 // probably not evenly distributed when range is large, but OK for tests
-                BigInteger augend = new BigInteger(end + 1 - start) * (BigInteger)(r.NextDouble());
-                long result = start + (long)augend;
+                //BigInteger augend = BigInteger.Multiply(range,  new BigInteger(r.NextDouble()));
+                //long result = start + (long)augend;
+
+                // LUCENENET NOTE: Using BigInteger/Decimal doesn't work because r.NextDouble() is always
+                // rounded down to 0, which makes the result always the same as start. This alternative solution was
+                // snagged from https://stackoverflow.com/a/13095144. All we really care about here is that we get
+                // a pretty good random distribution of values between start and end.
+
+                //Working with ulong so that modulo works correctly with values > long.MaxValue
+                ulong uRange = (ulong)unchecked(end - start);
+
+                //Prevent a modolo bias; see https://stackoverflow.com/a/10984975/238419
+                //for more information.
+                //In the worst case, the expected number of calls is 2 (though usually it's
+                //much closer to 1) so this loop doesn't really hurt performance at all.
+                ulong ulongRand;
+                do
+                {
+                    byte[] buf = new byte[8];
+                    r.NextBytes(buf);
+                    ulongRand = (ulong)BitConverter.ToInt64(buf, 0);
+                } while (ulongRand > ulong.MaxValue - ((ulong.MaxValue % uRange) + 1) % uRange);
+
+                long result = (long)(ulongRand % uRange) + start + r.Next(0, 1); // Randomly decide whether to increment by 1 to make the second parameter "inclusive"
+
                 Assert.True(result >= start);
                 Assert.True(result <= end);
                 return result;


[lucenenet] 14/42: BUG: Lucene.Net.Util.StringHelper: - Fixed parsing issue converting string to int in ambient culture

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit 5a02e176c6b297fdeaaad10cedda425cbe7c2bbd
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Wed Jul 31 16:15:10 2019 +0700

    BUG: Lucene.Net.Util.StringHelper: - Fixed parsing issue converting string to int in ambient culture
---
 src/Lucene.Net/Util/StringHelper.cs | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/Lucene.Net/Util/StringHelper.cs b/src/Lucene.Net/Util/StringHelper.cs
index fe2f12d..03bdca4 100644
--- a/src/Lucene.Net/Util/StringHelper.cs
+++ b/src/Lucene.Net/Util/StringHelper.cs
@@ -1,6 +1,7 @@
 using Lucene.Net.Support;
 using System;
 using System.Collections.Generic;
+using System.Globalization;
 
 namespace Lucene.Net.Util
 {
@@ -114,10 +115,10 @@ namespace Lucene.Net.Util
 
                 while (aTokens.HasMoreTokens())
                 {
-                    int aToken = Convert.ToInt32(aTokens.NextToken());
+                    int aToken = Convert.ToInt32(aTokens.NextToken(), CultureInfo.InvariantCulture);
                     if (bTokens.HasMoreTokens())
                     {
-                        int bToken = Convert.ToInt32(bTokens.NextToken());
+                        int bToken = Convert.ToInt32(bTokens.NextToken(), CultureInfo.InvariantCulture);
                         if (aToken != bToken)
                         {
                             return aToken < bToken ? -1 : 1;
@@ -136,7 +137,7 @@ namespace Lucene.Net.Util
                 // b has some extra trailing tokens. if these are all zeroes, thats ok.
                 while (bTokens.HasMoreTokens())
                 {
-                    if (Convert.ToInt32(bTokens.NextToken()) != 0)
+                    if (Convert.ToInt32(bTokens.NextToken(), CultureInfo.InvariantCulture) != 0)
                     {
                         return -1;
                     }


[lucenenet] 03/42: Lucene.Net.Tests.Index.SynchronizedList: Moved to Lucene.Net.TestFramework.Support

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit 1cceecc7561050d3c14ccf93169d3889fcaddd90
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Mon Jul 29 15:45:52 2019 +0700

    Lucene.Net.Tests.Index.SynchronizedList: Moved to Lucene.Net.TestFramework.Support
---
 .../Index => Lucene.Net.TestFramework/Support}/SynchronizedList.cs        | 0
 1 file changed, 0 insertions(+), 0 deletions(-)

diff --git a/src/Lucene.Net.Tests/Index/SynchronizedList.cs b/src/Lucene.Net.TestFramework/Support/SynchronizedList.cs
similarity index 100%
rename from src/Lucene.Net.Tests/Index/SynchronizedList.cs
rename to src/Lucene.Net.TestFramework/Support/SynchronizedList.cs


[lucenenet] 33/42: Lucene.Net.Support.CultureContext: Fixed minor issue with unused variable

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit 852a9bd5994e8c62b12153dc4294fa3e3e54e7cf
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Mon Aug 5 19:05:24 2019 +0700

    Lucene.Net.Support.CultureContext: Fixed minor issue with unused variable
---
 src/Lucene.Net/Support/CultureContext.cs | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/Lucene.Net/Support/CultureContext.cs b/src/Lucene.Net/Support/CultureContext.cs
index 4a26a14..623f44a 100644
--- a/src/Lucene.Net/Support/CultureContext.cs
+++ b/src/Lucene.Net/Support/CultureContext.cs
@@ -25,7 +25,7 @@ namespace Lucene.Net.Support
     /// Allows switching the current thread to a new culture in a using block that will automatically 
     /// return the culture to its previous state upon completion.
     /// </summary>
-    public class CultureContext : IDisposable
+    public sealed class CultureContext : IDisposable
     {
 #if !NETSTANDARD
         public CultureContext(int culture)
@@ -61,23 +61,24 @@ namespace Lucene.Net.Support
             if (uiCulture == null)
                 throw new ArgumentNullException("uiCulture");
 
-            this.currentThread = Thread.CurrentThread;
-
             // Record the current culture settings so they can be restored later.
             this.originalCulture = CultureInfo.CurrentCulture;
             this.originalUICulture = CultureInfo.CurrentUICulture;
 
             // Set both the culture and UI culture for this context.
 #if !NETSTANDARD
-            Thread.CurrentThread.CurrentCulture = culture;
-            Thread.CurrentThread.CurrentUICulture = uiCulture;
+            this.currentThread = Thread.CurrentThread;
+            currentThread.CurrentCulture = culture;
+            currentThread.CurrentUICulture = uiCulture;
 #else
             CultureInfo.CurrentCulture = culture;
             CultureInfo.CurrentUICulture = uiCulture;
 #endif
         }
 
+#if !NETSTANDARD
         private readonly Thread currentThread;
+#endif
         private readonly CultureInfo originalCulture;
         private readonly CultureInfo originalUICulture;
 
@@ -95,8 +96,8 @@ namespace Lucene.Net.Support
         {
             // Restore the culture to the way it was before the constructor was called.
 #if !NETSTANDARD
-            Thread.CurrentThread.CurrentCulture = originalCulture;
-            Thread.CurrentThread.CurrentUICulture = originalUICulture;
+            currentThread.CurrentCulture = originalCulture;
+            currentThread.CurrentUICulture = originalUICulture;
 #else
             CultureInfo.CurrentCulture = originalCulture;
             CultureInfo.CurrentUICulture = originalUICulture;


[lucenenet] 08/42: BUG: Lucene.Net.Tests.Cli - Fixed issue with xplat root directory specification (all platforms were trying to set the directory to C:\)

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit 101e594b7bbe68ddeb29919c8b9b16ef24f2097e
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Wed Jul 31 06:47:14 2019 +0700

    BUG: Lucene.Net.Tests.Cli - Fixed issue with xplat root directory specification (all platforms were trying to set the directory to C:\)
---
 .../Commands/Benchmark/BenchmarkFindQualityQueriesCommandTest.cs      | 4 ++--
 src/dotnet/tools/Lucene.Net.Tests.Cli/Commands/CommandTestCase.cs     | 2 ++
 .../Lucene.Net.Tests.Cli/Commands/Index/IndexCheckCommandTest.cs      | 4 ++--
 .../tools/Lucene.Net.Tests.Cli/Commands/Index/IndexFixCommandTest.cs  | 4 ++--
 .../Commands/Index/IndexListHighFreqTermsCommandTest.cs               | 4 ++--
 .../Commands/Index/IndexListSegmentsCommandTest.cs                    | 4 ++--
 .../Commands/Index/IndexListTaxonomyStatsCommandTest.cs               | 4 ++--
 .../Lucene.Net.Tests.Cli/Commands/Index/IndexUpgradeCommandTest.cs    | 4 ++--
 8 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/src/dotnet/tools/Lucene.Net.Tests.Cli/Commands/Benchmark/BenchmarkFindQualityQueriesCommandTest.cs b/src/dotnet/tools/Lucene.Net.Tests.Cli/Commands/Benchmark/BenchmarkFindQualityQueriesCommandTest.cs
index 738040e..f8baa45 100644
--- a/src/dotnet/tools/Lucene.Net.Tests.Cli/Commands/Benchmark/BenchmarkFindQualityQueriesCommandTest.cs
+++ b/src/dotnet/tools/Lucene.Net.Tests.Cli/Commands/Benchmark/BenchmarkFindQualityQueriesCommandTest.cs
@@ -51,8 +51,8 @@ namespace Lucene.Net.Cli.Commands
         [LuceneNetSpecific]
         public virtual void TestNoArguments()
         {
-            System.IO.Directory.SetCurrentDirectory(@"C:\");
-            AssertCommandTranslation("", new string[] { @"C:\" });
+            System.IO.Directory.SetCurrentDirectory(RootDirectory);
+            AssertCommandTranslation("", new string[] { RootDirectory });
         }
 
         [Test]
diff --git a/src/dotnet/tools/Lucene.Net.Tests.Cli/Commands/CommandTestCase.cs b/src/dotnet/tools/Lucene.Net.Tests.Cli/Commands/CommandTestCase.cs
index 92b1694..65fc14b 100644
--- a/src/dotnet/tools/Lucene.Net.Tests.Cli/Commands/CommandTestCase.cs
+++ b/src/dotnet/tools/Lucene.Net.Tests.Cli/Commands/CommandTestCase.cs
@@ -26,6 +26,8 @@ namespace Lucene.Net.Cli.Commands
 
     public abstract class CommandTestCase : LuceneTestCase
     {
+        protected readonly string RootDirectory = Util.Constants.WINDOWS ? @"C:\" : (Constants.LINUX ? "/home" : /*macOS*/ "/");
+
         protected abstract ConfigurationBase CreateConfiguration(MockConsoleApp app);
 
         protected abstract IList<Arg[]> GetRequiredArgs();
diff --git a/src/dotnet/tools/Lucene.Net.Tests.Cli/Commands/Index/IndexCheckCommandTest.cs b/src/dotnet/tools/Lucene.Net.Tests.Cli/Commands/Index/IndexCheckCommandTest.cs
index 33d9d41..143f545 100644
--- a/src/dotnet/tools/Lucene.Net.Tests.Cli/Commands/Index/IndexCheckCommandTest.cs
+++ b/src/dotnet/tools/Lucene.Net.Tests.Cli/Commands/Index/IndexCheckCommandTest.cs
@@ -59,8 +59,8 @@ namespace Lucene.Net.Cli.Commands
         [LuceneNetSpecific]
         public virtual void TestNoArguments()
         {
-            System.IO.Directory.SetCurrentDirectory(@"C:\");
-            AssertCommandTranslation("", new string[] { @"C:\" });
+            System.IO.Directory.SetCurrentDirectory(RootDirectory);
+            AssertCommandTranslation("", new string[] { RootDirectory });
         }
     }
 }
diff --git a/src/dotnet/tools/Lucene.Net.Tests.Cli/Commands/Index/IndexFixCommandTest.cs b/src/dotnet/tools/Lucene.Net.Tests.Cli/Commands/Index/IndexFixCommandTest.cs
index 6406137..ee84856 100644
--- a/src/dotnet/tools/Lucene.Net.Tests.Cli/Commands/Index/IndexFixCommandTest.cs
+++ b/src/dotnet/tools/Lucene.Net.Tests.Cli/Commands/Index/IndexFixCommandTest.cs
@@ -88,8 +88,8 @@ namespace Lucene.Net.Cli.Commands
         [LuceneNetSpecific]
         public virtual void TestNoArguments()
         {
-            System.IO.Directory.SetCurrentDirectory(@"C:\");
-            AssertCommandTranslation("", new string[] { @"C:\", "-fix" });
+            System.IO.Directory.SetCurrentDirectory(RootDirectory);
+            AssertCommandTranslation("", new string[] { RootDirectory, "-fix" });
         }
 
         [Test]
diff --git a/src/dotnet/tools/Lucene.Net.Tests.Cli/Commands/Index/IndexListHighFreqTermsCommandTest.cs b/src/dotnet/tools/Lucene.Net.Tests.Cli/Commands/Index/IndexListHighFreqTermsCommandTest.cs
index 42ab9c6..1a74cee 100644
--- a/src/dotnet/tools/Lucene.Net.Tests.Cli/Commands/Index/IndexListHighFreqTermsCommandTest.cs
+++ b/src/dotnet/tools/Lucene.Net.Tests.Cli/Commands/Index/IndexListHighFreqTermsCommandTest.cs
@@ -56,8 +56,8 @@ namespace Lucene.Net.Cli.Commands
         [LuceneNetSpecific]
         public virtual void TestNoArguments()
         {
-            System.IO.Directory.SetCurrentDirectory(@"C:\");
-            AssertCommandTranslation("", new string[] { @"C:\" });
+            System.IO.Directory.SetCurrentDirectory(RootDirectory);
+            AssertCommandTranslation("", new string[] { RootDirectory });
         }
 
         [Test]
diff --git a/src/dotnet/tools/Lucene.Net.Tests.Cli/Commands/Index/IndexListSegmentsCommandTest.cs b/src/dotnet/tools/Lucene.Net.Tests.Cli/Commands/Index/IndexListSegmentsCommandTest.cs
index 341df92..351acd3 100644
--- a/src/dotnet/tools/Lucene.Net.Tests.Cli/Commands/Index/IndexListSegmentsCommandTest.cs
+++ b/src/dotnet/tools/Lucene.Net.Tests.Cli/Commands/Index/IndexListSegmentsCommandTest.cs
@@ -52,8 +52,8 @@ namespace Lucene.Net.Cli.Commands
         [LuceneNetSpecific]
         public virtual void TestNoArguments()
         {
-            System.IO.Directory.SetCurrentDirectory(@"C:\");
-            AssertCommandTranslation("", new string[] { @"C:\", "-l" });
+            System.IO.Directory.SetCurrentDirectory(RootDirectory);
+            AssertCommandTranslation("", new string[] { RootDirectory, "-l" });
         }
 
         [Test]
diff --git a/src/dotnet/tools/Lucene.Net.Tests.Cli/Commands/Index/IndexListTaxonomyStatsCommandTest.cs b/src/dotnet/tools/Lucene.Net.Tests.Cli/Commands/Index/IndexListTaxonomyStatsCommandTest.cs
index 0fc7994..1a579d7 100644
--- a/src/dotnet/tools/Lucene.Net.Tests.Cli/Commands/Index/IndexListTaxonomyStatsCommandTest.cs
+++ b/src/dotnet/tools/Lucene.Net.Tests.Cli/Commands/Index/IndexListTaxonomyStatsCommandTest.cs
@@ -54,8 +54,8 @@ namespace Lucene.Net.Cli.Commands
         [LuceneNetSpecific]
         public virtual void TestNoArguments()
         {
-            System.IO.Directory.SetCurrentDirectory(@"C:\");
-            AssertCommandTranslation("", new string[] { @"C:\" });
+            System.IO.Directory.SetCurrentDirectory(RootDirectory);
+            AssertCommandTranslation("", new string[] { RootDirectory });
         }
 
         [Test]
diff --git a/src/dotnet/tools/Lucene.Net.Tests.Cli/Commands/Index/IndexUpgradeCommandTest.cs b/src/dotnet/tools/Lucene.Net.Tests.Cli/Commands/Index/IndexUpgradeCommandTest.cs
index 1568c35..6a442d7 100644
--- a/src/dotnet/tools/Lucene.Net.Tests.Cli/Commands/Index/IndexUpgradeCommandTest.cs
+++ b/src/dotnet/tools/Lucene.Net.Tests.Cli/Commands/Index/IndexUpgradeCommandTest.cs
@@ -58,8 +58,8 @@ namespace Lucene.Net.Cli.Commands
         [LuceneNetSpecific]
         public virtual void TestNoArguments()
         {
-            System.IO.Directory.SetCurrentDirectory(@"C:\");
-            AssertCommandTranslation("", new string[] { @"C:\" });
+            System.IO.Directory.SetCurrentDirectory(RootDirectory);
+            AssertCommandTranslation("", new string[] { RootDirectory });
         }
 
         [Test]


[lucenenet] 10/42: BUG: Lucene.Net.Analysis.Common.Analysis.Util.AbstractAnalysisFactory: Fixed parsing issue converting string to int in ambient culture

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit d7660abdb8c186f5e47016576e2ae4b160c057a6
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Wed Jul 31 07:13:30 2019 +0700

    BUG: Lucene.Net.Analysis.Common.Analysis.Util.AbstractAnalysisFactory: Fixed parsing issue converting string to int in ambient culture
---
 .../Analysis/Util/AbstractAnalysisFactory.cs                          | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Util/AbstractAnalysisFactory.cs b/src/Lucene.Net.Analysis.Common/Analysis/Util/AbstractAnalysisFactory.cs
index ec93dc4..a0e4911 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Util/AbstractAnalysisFactory.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Util/AbstractAnalysisFactory.cs
@@ -198,7 +198,7 @@ namespace Lucene.Net.Analysis.Util
         /// </summary>
         protected int RequireInt32(IDictionary<string, string> args, string name)
         {
-            return int.Parse(Require(args, name));
+            return int.Parse(Require(args, name), CultureInfo.InvariantCulture);
         }
 
         /// <summary>
@@ -210,7 +210,7 @@ namespace Lucene.Net.Analysis.Util
             if (args.TryGetValue(name, out s))
             {
                 args.Remove(name);
-                return int.Parse(s);
+                return int.Parse(s, CultureInfo.InvariantCulture);
             }
             return defaultVal;
         }


[lucenenet] 04/42: Lucene.Net.Tests.Support.TestOldPatches.cs: Removed invalid Lucene.Net.Test using statement

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit a15b391386b012ff42ce45ac0e5e44c6c9796658
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Mon Jul 29 15:48:27 2019 +0700

    Lucene.Net.Tests.Support.TestOldPatches.cs: Removed invalid Lucene.Net.Test using statement
---
 src/Lucene.Net.Tests/Support/TestOldPatches.cs | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/Lucene.Net.Tests/Support/TestOldPatches.cs b/src/Lucene.Net.Tests/Support/TestOldPatches.cs
index b6df6dd..d4f36c5 100644
--- a/src/Lucene.Net.Tests/Support/TestOldPatches.cs
+++ b/src/Lucene.Net.Tests/Support/TestOldPatches.cs
@@ -26,7 +26,6 @@ using Lucene.Net.Documents;
 using Lucene.Net.Index;
 using Lucene.Net.Search;
 using Lucene.Net.Store;
-using Lucene.Net.Test;
 using NUnit.Framework;
 using Version = Lucene.Net.Util.LuceneVersion;
 using Lucene.Net.Codecs;


[lucenenet] 24/42: BUG: Lucene.Net.TestFramework.Index.AlcoholicMergePolicy: The value chosen for Hour was supposed to be random, but it was setup to be a constant by a mistranslation from Java to .NET

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit c120519f51f663febf8268491a38360fada6c27d
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Sun Aug 4 02:50:57 2019 +0700

    BUG: Lucene.Net.TestFramework.Index.AlcoholicMergePolicy: The value chosen for Hour was supposed to be random, but it was setup to be a constant by a mistranslation from Java to .NET
---
 .../Index/AlcoholicMergePolicy.cs                  | 36 ++++++++++------------
 1 file changed, 16 insertions(+), 20 deletions(-)

diff --git a/src/Lucene.Net.TestFramework/Index/AlcoholicMergePolicy.cs b/src/Lucene.Net.TestFramework/Index/AlcoholicMergePolicy.cs
index 07089f4..60b3b3a 100644
--- a/src/Lucene.Net.TestFramework/Index/AlcoholicMergePolicy.cs
+++ b/src/Lucene.Net.TestFramework/Index/AlcoholicMergePolicy.cs
@@ -1,5 +1,4 @@
 using System;
-using System.Globalization;
 using System.Linq;
 
 namespace Lucene.Net.Index
@@ -39,43 +38,40 @@ namespace Lucene.Net.Index
     /// </summary>
     public class AlcoholicMergePolicy : LogMergePolicy
     {
-        private readonly Random Random;
-        private readonly DateTime Calendar;
+        private readonly Random random;
+        private readonly DateTime calendar;
 
         public AlcoholicMergePolicy(Random random)
         {
-            this.Calendar = new GregorianCalendar().ToDateTime(1970, 1, 1, 0, 0, 0, (int)TestUtil.NextLong(random, 0, long.MaxValue));
-            this.Random = random;
+            // LUCENENET NOTE: All we care about here is that we have a random distribution of "Hour", picking any valid
+            // date at random achives this. We have no actual need to create a Calendar object in .NET.
+            this.calendar = new DateTime(TestUtil.NextLong(random, DateTime.MinValue.Ticks, DateTime.MaxValue.Ticks));
+            this.random = random;
             m_maxMergeSize = TestUtil.NextInt(random, 1024 * 1024, int.MaxValue);
         }
 
         protected override long Size(SegmentCommitInfo info)
         {
-            int hourOfDay = Calendar.Hour;
-            if (hourOfDay < 6 || hourOfDay > 20 || Random.Next(23) == 5)
+            int hourOfDay = calendar.Hour;
+            if (hourOfDay < 6 || hourOfDay > 20 || random.Next(23) == 5)
             // its 5 o'clock somewhere
             {
-                Drink.Drink_e[] values = Enum.GetValues(typeof(Drink.Drink_e)).Cast<Drink.Drink_e>().ToArray();
+                Drink[] values = Enum.GetValues(typeof(Drink)).Cast<Drink>().ToArray();
                 // pick a random drink during the day
-                Drink.Drink_e drink = values[Random.Next(values.Length - 1)];
+                Drink drink = values[random.Next(values.Length - 1)];
                 return (long)drink * info.GetSizeInBytes();
             }
 
             return info.GetSizeInBytes();
         }
 
-        private class Drink
+        private enum Drink
         {
-            private const int NumDrinks = 5;
-
-            internal enum Drink_e
-            {
-                Beer = 15,
-                Wine = 17,
-                Champagne = 21,
-                WhiteRussian = 22,
-                SingleMalt = 30
-            }
+            Beer = 15,
+            Wine = 17,
+            Champagne = 21,
+            WhiteRussian = 22,
+            SingleMalt = 30
         }
     }
 }
\ No newline at end of file


[lucenenet] 17/42: Lucene.Net.Benchmark: Use AssemblyQualifiedName for StandardAnalyzer for better reliability with .NET Reflection

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit ba0ad2002be60674046c237cf7a2047d20c90563
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Fri Aug 2 17:53:54 2019 +0700

    Lucene.Net.Benchmark: Use AssemblyQualifiedName for StandardAnalyzer for better reliability with .NET Reflection
---
 src/Lucene.Net.Benchmark/ByTask/Feeds/FileBasedQueryMaker.cs | 2 +-
 src/Lucene.Net.Benchmark/ByTask/Feeds/ReutersQueryMaker.cs   | 2 +-
 src/Lucene.Net.Benchmark/ByTask/Feeds/SimpleQueryMaker.cs    | 2 +-
 src/Lucene.Net.Benchmark/ByTask/PerfRunData.cs               | 2 +-
 src/Lucene.Net.Benchmark/ByTask/Tasks/NewAnalyzerTask.cs     | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/Lucene.Net.Benchmark/ByTask/Feeds/FileBasedQueryMaker.cs b/src/Lucene.Net.Benchmark/ByTask/Feeds/FileBasedQueryMaker.cs
index 3a49c96..350870d 100644
--- a/src/Lucene.Net.Benchmark/ByTask/Feeds/FileBasedQueryMaker.cs
+++ b/src/Lucene.Net.Benchmark/ByTask/Feeds/FileBasedQueryMaker.cs
@@ -53,7 +53,7 @@ namespace Lucene.Net.Benchmarks.ByTask.Feeds
         protected override Query[] PrepareQueries()
         {
             Analyzer anlzr = NewAnalyzerTask.CreateAnalyzer(m_config.Get("analyzer",
-            "Lucene.Net.Analysis.Standard.StandardAnalyzer, Lucene.Net.Analysis.Common"));
+            typeof(Lucene.Net.Analysis.Standard.StandardAnalyzer).AssemblyQualifiedName));
             string defaultField = m_config.Get("file.query.maker.default.field", DocMaker.BODY_FIELD);
             QueryParser qp = new QueryParser(
 #pragma warning disable 612, 618
diff --git a/src/Lucene.Net.Benchmark/ByTask/Feeds/ReutersQueryMaker.cs b/src/Lucene.Net.Benchmark/ByTask/Feeds/ReutersQueryMaker.cs
index 4d6ab5f..c833b88 100644
--- a/src/Lucene.Net.Benchmark/ByTask/Feeds/ReutersQueryMaker.cs
+++ b/src/Lucene.Net.Benchmark/ByTask/Feeds/ReutersQueryMaker.cs
@@ -116,7 +116,7 @@ namespace Lucene.Net.Benchmarks.ByTask.Feeds
         {
             // analyzer (default is standard analyzer)
             Analyzer anlzr = NewAnalyzerTask.CreateAnalyzer(m_config.Get("analyzer",
-                "Lucene.Net.Analysis.Standard.StandardAnalyzer, Lucene.Net.Analysis.Common"));
+                typeof(Lucene.Net.Analysis.Standard.StandardAnalyzer).AssemblyQualifiedName));
 
             List<object> queryList = new List<object>(20);
             queryList.AddRange(STANDARD_QUERIES);
diff --git a/src/Lucene.Net.Benchmark/ByTask/Feeds/SimpleQueryMaker.cs b/src/Lucene.Net.Benchmark/ByTask/Feeds/SimpleQueryMaker.cs
index 4ba2fe3..1e88a00 100644
--- a/src/Lucene.Net.Benchmark/ByTask/Feeds/SimpleQueryMaker.cs
+++ b/src/Lucene.Net.Benchmark/ByTask/Feeds/SimpleQueryMaker.cs
@@ -41,7 +41,7 @@ namespace Lucene.Net.Benchmarks.ByTask.Feeds
         {
             // analyzer (default is standard analyzer)
             Analyzer anlzr = NewAnalyzerTask.CreateAnalyzer(m_config.Get("analyzer",
-                "Lucene.Net.Analysis.Standard.StandardAnalyzer, Lucene.Net.Analysis.Common"));
+                typeof(Lucene.Net.Analysis.Standard.StandardAnalyzer).AssemblyQualifiedName));
 
             QueryParser qp = new QueryParser(
 #pragma warning disable 612, 618
diff --git a/src/Lucene.Net.Benchmark/ByTask/PerfRunData.cs b/src/Lucene.Net.Benchmark/ByTask/PerfRunData.cs
index 8a25b03..136f968 100644
--- a/src/Lucene.Net.Benchmark/ByTask/PerfRunData.cs
+++ b/src/Lucene.Net.Benchmark/ByTask/PerfRunData.cs
@@ -97,7 +97,7 @@ namespace Lucene.Net.Benchmarks.ByTask
             this.config = config;
             // analyzer (default is standard analyzer)
             analyzer = NewAnalyzerTask.CreateAnalyzer(config.Get("analyzer",
-                "Lucene.Net.Analysis.Standard.StandardAnalyzer, Lucene.Net.Analysis.Common"));
+                typeof(Lucene.Net.Analysis.Standard.StandardAnalyzer).AssemblyQualifiedName));
 
             // content source
             string sourceClass = config.Get("content.source", typeof(SingleDocSource).AssemblyQualifiedName);
diff --git a/src/Lucene.Net.Benchmark/ByTask/Tasks/NewAnalyzerTask.cs b/src/Lucene.Net.Benchmark/ByTask/Tasks/NewAnalyzerTask.cs
index aae5abb..37263fc 100644
--- a/src/Lucene.Net.Benchmark/ByTask/Tasks/NewAnalyzerTask.cs
+++ b/src/Lucene.Net.Benchmark/ByTask/Tasks/NewAnalyzerTask.cs
@@ -70,7 +70,7 @@ namespace Lucene.Net.Benchmarks.ByTask.Tasks
                 Analyzer analyzer = null;
                 if (null == analyzerName || 0 == analyzerName.Length)
                 {
-                    analyzerName = "Lucene.Net.Analysis.Standard.StandardAnalyzer, Lucene.Net.Analysis.Common";
+                    analyzerName = typeof(Lucene.Net.Analysis.Standard.StandardAnalyzer).AssemblyQualifiedName;
                 }
                 // First, lookup analyzerName as a named analyzer factory
                 AnalyzerFactory factory;


[lucenenet] 28/42: BUG: Lucene.Net.Grouping.TopGroups - check collection equality if the generic type is a reference type (as is the default behavior in Java)

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit 5d3f29371c5a96620a364396664bc7424a4c6a39
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Mon Aug 5 08:00:45 2019 +0700

    BUG: Lucene.Net.Grouping.TopGroups - check collection equality if the generic type is a reference type (as is the default behavior in Java)
---
 src/Lucene.Net.Grouping/TopGroups.cs | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/Lucene.Net.Grouping/TopGroups.cs b/src/Lucene.Net.Grouping/TopGroups.cs
index 132957c..7a7e522 100644
--- a/src/Lucene.Net.Grouping/TopGroups.cs
+++ b/src/Lucene.Net.Grouping/TopGroups.cs
@@ -1,6 +1,7 @@
 using Lucene.Net.Support;
 using System;
 using System.Diagnostics.CodeAnalysis;
+using System.Reflection;
 
 namespace Lucene.Net.Search.Grouping
 {
@@ -144,6 +145,10 @@ namespace Lucene.Net.Search.Grouping
                 return null;
             }
 
+            // LUCENENET specific - store whether T is value type
+            // for optimization of GetHashCode() and Equals()
+            bool shardGroupsIsValueType = typeof(T).GetTypeInfo().IsValueType;
+
             int totalHitCount = 0;
             int totalGroupedHitCount = 0;
             // Optionally merge the totalGroupCount.
@@ -193,7 +198,9 @@ namespace Lucene.Net.Search.Grouping
                             throw new ArgumentException("group values differ across shards; you must pass same top groups to all shards' second-pass collector");
                         }
                     }
-                    else if (!groupValue.Equals(shardGroupDocs.GroupValue))
+                    // LUCENENET specific - use Collections.Equals() if we have a reference type
+                    // to ensure if it is a collection its contents are compared
+                    else if (!(shardGroupsIsValueType ? groupValue.Equals(shardGroupDocs.GroupValue) : Collections.Equals(groupValue, shardGroupDocs.GroupValue)))
                     {
                         throw new ArgumentException("group values differ across shards; you must pass same top groups to all shards' second-pass collector");
                     }


[lucenenet] 41/42: SWEEP: Ensure all enumerators are disposed of properly (except in some cases where enumerators are set to field variables, see LUCENENET-611)

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit e12cde4c49bf5665540f29322f70631491133569
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Wed Aug 7 14:21:23 2019 +0700

    SWEEP: Ensure all enumerators are disposed of properly (except in some cases where enumerators are set to field variables, see LUCENENET-611)
---
 .../Analysis/Nl/DutchAnalyzer.cs                   |  14 +-
 .../Analysis/Shingle/ShingleFilter.cs              |  36 +--
 .../Analysis/Synonym/SlowSynonymMap.cs             |  54 ++---
 .../Analysis/Util/CharArrayMap.cs                  |  86 +++----
 .../Analysis/Util/CharArraySet.cs                  |   8 +-
 .../Egothor.Stemmer/Gener.cs                       |   6 +-
 .../Egothor.Stemmer/Lift.cs                        |   4 +-
 .../Egothor.Stemmer/Optimizer.cs                   |   8 +-
 .../Egothor.Stemmer/Reduce.cs                      |  21 +-
 .../Egothor.Stemmer/Row.cs                         |  23 +-
 .../Support/Sax/Helpers/NamespaceSupport.cs        |   1 +
 .../Memory/MemoryDocValuesConsumer.cs              |   3 +-
 .../SimpleText/SimpleTextDocValuesWriter.cs        |  69 +++---
 .../Taxonomy/WriterCache/CompactLabelToOrdinal.cs  |  11 +-
 .../VectorHighlight/BaseFragListBuilder.cs         |  93 ++++----
 .../VectorHighlight/BaseFragmentsBuilder.cs        |  54 ++---
 .../VectorHighlight/FastVectorHighlighter.cs       |   5 +-
 .../VectorHighlight/FieldPhraseList.cs             | 167 ++++++++------
 .../VectorHighlight/SingleFragListBuilder.cs       |  22 +-
 src/Lucene.Net.Memory/MemoryIndex.cs               |   8 +-
 .../Flexible/Core/Nodes/OrQueryNode.cs             |   4 +-
 .../Processors/RemoveDeletedQueryNodesProcessor.cs |   4 +-
 .../Standard/Parser/StandardSyntaxParser.cs        |  25 ++-
 .../Queries/FuzzyLikeThisQuery.cs                  |   7 +-
 .../Codecs/Asserting/AssertingDocValuesFormat.cs   |  97 ++++----
 .../Codecs/MissingOrdRemapper.cs                   |  21 +-
 .../Index/FieldFilterAtomicReader.cs               |   3 +-
 .../JavaCompatibility/SystemTypesHelpers.cs        |  10 +-
 .../Store/MockDirectoryWrapper.cs                  | 163 +++++++-------
 .../Util/LuceneTestCase.cs                         |  33 +--
 src/Lucene.Net/Index/CoalescedUpdates.cs           |   1 +
 src/Lucene.Net/Index/IndexWriter.cs                |   7 +-
 src/Lucene.Net/Search/BooleanQuery.cs              | 115 +++++-----
 src/Lucene.Net/Search/MultiPhraseQuery.cs          |   8 +-
 src/Lucene.Net/Search/Payloads/PayloadNearQuery.cs |   4 +-
 src/Lucene.Net/Search/Payloads/PayloadSpanUtil.cs  |   5 +-
 src/Lucene.Net/Search/Spans/SpanNearQuery.cs       |   4 +-
 src/Lucene.Net/Search/Spans/SpanOrQuery.cs         |   9 +-
 .../Search/Spans/SpanPayloadCheckQuery.cs          |  18 +-
 src/Lucene.Net/Support/HashMap.cs                  |  70 +++---
 src/Lucene.Net/Support/TreeSet.cs                  | 246 +++++++++++----------
 src/Lucene.Net/Util/AttributeSource.cs             |  16 +-
 src/Lucene.Net/Util/Automaton/BasicOperations.cs   |   5 +-
 .../Util/Automaton/LevenshteinAutomata.cs          |  10 +-
 src/Lucene.Net/Util/Automaton/SpecialOperations.cs |   8 +-
 src/Lucene.Net/Util/CloseableThreadLocal.cs        |   3 +-
 src/Lucene.Net/Util/MergedIterator.cs              |   5 +-
 src/Lucene.Net/Util/WAH8DocIdSet.cs                |   9 +-
 .../tools/lucene-cli/SourceCode/ConsolePager.cs    |   2 +-
 49 files changed, 835 insertions(+), 770 deletions(-)

diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Nl/DutchAnalyzer.cs b/src/Lucene.Net.Analysis.Common/Analysis/Nl/DutchAnalyzer.cs
index 07ce34a..7352d2c 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Nl/DutchAnalyzer.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Nl/DutchAnalyzer.cs
@@ -168,13 +168,15 @@ namespace Lucene.Net.Analysis.Nl
                 this.origStemdict = null;
                 // we don't need to ignore case here since we lowercase in this analyzer anyway
                 StemmerOverrideFilter.Builder builder = new StemmerOverrideFilter.Builder(false);
-                CharArrayMap<string>.EntryIterator iter = (CharArrayMap<string>.EntryIterator)stemOverrideDict.EntrySet().GetEnumerator();
-                CharsRef spare = new CharsRef();
-                while (iter.HasNext)
+                using (CharArrayMap<string>.EntryIterator iter = (CharArrayMap<string>.EntryIterator)stemOverrideDict.EntrySet().GetEnumerator())
                 {
-                    char[] nextKey = iter.NextKey();
-                    spare.CopyChars(nextKey, 0, nextKey.Length);
-                    builder.Add(new string(spare.Chars), iter.CurrentValue);
+                    CharsRef spare = new CharsRef();
+                    while (iter.HasNext)
+                    {
+                        char[] nextKey = iter.NextKey();
+                        spare.CopyChars(nextKey, 0, nextKey.Length);
+                        builder.Add(new string(spare.Chars), iter.CurrentValue);
+                    }
                 }
                 try
                 {
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Shingle/ShingleFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/Shingle/ShingleFilter.cs
index 609a50b..709474e 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Shingle/ShingleFilter.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Shingle/ShingleFilter.cs
@@ -326,29 +326,31 @@ namespace Lucene.Net.Analysis.Shingle
             {
                 bool isAllFiller = true;
                 InputWindowToken nextToken = null;
-                IEnumerator<InputWindowToken> iter = inputWindow.GetEnumerator();
-                for (int gramNum = 1; iter.MoveNext() && builtGramSize < gramSize.Value; ++gramNum)
+                using (IEnumerator<InputWindowToken> iter = inputWindow.GetEnumerator())
                 {
-                    nextToken = iter.Current;
-                    if (builtGramSize < gramNum)
+                    for (int gramNum = 1; iter.MoveNext() && builtGramSize < gramSize.Value; ++gramNum)
                     {
-                        if (builtGramSize > 0)
+                        nextToken = iter.Current;
+                        if (builtGramSize < gramNum)
                         {
-                            gramBuilder.Append(tokenSeparator);
+                            if (builtGramSize > 0)
+                            {
+                                gramBuilder.Append(tokenSeparator);
+                            }
+                            gramBuilder.Append(nextToken.termAtt.Buffer, 0, nextToken.termAtt.Length);
+                            ++builtGramSize;
                         }
-                        gramBuilder.Append(nextToken.termAtt.Buffer, 0, nextToken.termAtt.Length);
-                        ++builtGramSize;
-                    }
-                    if (isAllFiller && nextToken.isFiller)
-                    {
-                        if (gramNum == gramSize.Value)
+                        if (isAllFiller && nextToken.isFiller)
                         {
-                            gramSize.Advance();
+                            if (gramNum == gramSize.Value)
+                            {
+                                gramSize.Advance();
+                            }
+                        }
+                        else
+                        {
+                            isAllFiller = false;
                         }
-                    }
-                    else
-                    {
-                        isAllFiller = false;
                     }
                 }
                 if (!isAllFiller && builtGramSize == gramSize.Value)
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Synonym/SlowSynonymMap.cs b/src/Lucene.Net.Analysis.Common/Analysis/Synonym/SlowSynonymMap.cs
index 7a6f259..20a8169 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Synonym/SlowSynonymMap.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Synonym/SlowSynonymMap.cs
@@ -189,36 +189,38 @@ namespace Lucene.Net.Analysis.Synonym
             }
 
             int pos = 0;
-            var iter1 = lst1.GetEnumerator();
-            var iter2 = lst2.GetEnumerator();
-            var tok1 = iter1.MoveNext() ? iter1.Current : null;
-            var tok2 = iter2.MoveNext() ? iter2.Current : null;
-            int pos1 = tok1 != null ? tok1.PositionIncrement : 0;
-            int pos2 = tok2 != null ? tok2.PositionIncrement : 0;
-            while (tok1 != null || tok2 != null)
+            using (var iter1 = lst1.GetEnumerator())
+            using (var iter2 = lst2.GetEnumerator())
             {
-                while (tok1 != null && (pos1 <= pos2 || tok2 == null))
+                var tok1 = iter1.MoveNext() ? iter1.Current : null;
+                var tok2 = iter2.MoveNext() ? iter2.Current : null;
+                int pos1 = tok1 != null ? tok1.PositionIncrement : 0;
+                int pos2 = tok2 != null ? tok2.PositionIncrement : 0;
+                while (tok1 != null || tok2 != null)
                 {
-                    var tok = new Token(tok1.StartOffset, tok1.EndOffset, tok1.Type);
-                    tok.CopyBuffer(tok1.Buffer, 0, tok1.Length);
-                    tok.PositionIncrement = pos1 - pos;
-                    result.Add(tok);
-                    pos = pos1;
-                    tok1 = iter1.MoveNext() ? iter1.Current : null;
-                    pos1 += tok1 != null ? tok1.PositionIncrement : 0;
-                }
-                while (tok2 != null && (pos2 <= pos1 || tok1 == null))
-                {
-                    var tok = new Token(tok2.StartOffset, tok2.EndOffset, tok2.Type);
-                    tok.CopyBuffer(tok2.Buffer, 0, tok2.Length);
-                    tok.PositionIncrement = pos2 - pos;
-                    result.Add(tok);
-                    pos = pos2;
-                    tok2 = iter2.MoveNext() ? iter2.Current : null;
-                    pos2 += tok2 != null ? tok2.PositionIncrement : 0;
+                    while (tok1 != null && (pos1 <= pos2 || tok2 == null))
+                    {
+                        var tok = new Token(tok1.StartOffset, tok1.EndOffset, tok1.Type);
+                        tok.CopyBuffer(tok1.Buffer, 0, tok1.Length);
+                        tok.PositionIncrement = pos1 - pos;
+                        result.Add(tok);
+                        pos = pos1;
+                        tok1 = iter1.MoveNext() ? iter1.Current : null;
+                        pos1 += tok1 != null ? tok1.PositionIncrement : 0;
+                    }
+                    while (tok2 != null && (pos2 <= pos1 || tok1 == null))
+                    {
+                        var tok = new Token(tok2.StartOffset, tok2.EndOffset, tok2.Type);
+                        tok.CopyBuffer(tok2.Buffer, 0, tok2.Length);
+                        tok.PositionIncrement = pos2 - pos;
+                        result.Add(tok);
+                        pos = pos2;
+                        tok2 = iter2.MoveNext() ? iter2.Current : null;
+                        pos2 += tok2 != null ? tok2.PositionIncrement : 0;
+                    }
                 }
+                return result;
             }
-            return result;
         }
     }
 }
\ No newline at end of file
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Util/CharArrayMap.cs b/src/Lucene.Net.Analysis.Common/Analysis/Util/CharArrayMap.cs
index cfe5625..480c4d6 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Util/CharArrayMap.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Util/CharArrayMap.cs
@@ -214,10 +214,12 @@ namespace Lucene.Net.Analysis.Util
         /// <param name="arrayIndex">A 32-bit integer that represents the index in <paramref name="array"/> at which copying begins.</param>
         public virtual void CopyTo(KeyValuePair<string, TValue>[] array, int arrayIndex)
         {
-            var iter = (EntryIterator)EntrySet().GetEnumerator();
-            for (int i = arrayIndex; iter.MoveNext(); i++)
+            using (var iter = (EntryIterator)EntrySet().GetEnumerator())
             {
-                array[i] = new KeyValuePair<string, TValue>(iter.Current.Key, iter.CurrentValue);
+                for (int i = arrayIndex; iter.MoveNext(); i++)
+                {
+                    array[i] = new KeyValuePair<string, TValue>(iter.Current.Key, iter.CurrentValue);
+                }
             }
         }
 
@@ -228,10 +230,12 @@ namespace Lucene.Net.Analysis.Util
         /// <param name="map"></param>
         public virtual void CopyTo(CharArrayMap<TValue> map)
         {
-            var iter = (EntryIterator)EntrySet().GetEnumerator();
-            while(iter.MoveNext())
+            using (var iter = (EntryIterator)EntrySet().GetEnumerator())
             {
-                map.Put(iter.Current.Key, iter.CurrentValue);
+                while (iter.MoveNext())
+                {
+                    map.Put(iter.Current.Key, iter.CurrentValue);
+                }
             }
         }
 
@@ -758,14 +762,16 @@ namespace Lucene.Net.Analysis.Util
             if (this.Count != other.Count)
                 return false;
 
-            var iter = other.GetEnumerator();
-            while (iter.MoveNext())
+            using (var iter = other.GetEnumerator())
             {
-                if (!this.ContainsKey(iter.Current.Key))
-                    return false;
+                while (iter.MoveNext())
+                {
+                    if (!this.ContainsKey(iter.Current.Key))
+                        return false;
 
-                if (!EqualityComparer<TValue>.Default.Equals(this[iter.Current.Key], iter.Current.Value))
-                    return false;
+                    if (!EqualityComparer<TValue>.Default.Equals(this[iter.Current.Key], iter.Current.Value))
+                        return false;
+                }
             }
 
             return true;
@@ -1155,10 +1161,12 @@ namespace Lucene.Net.Analysis.Util
 
             public void CopyTo(string[] array, int arrayIndex)
             {
-                var iter = GetEnumerator();
-                for (int i = arrayIndex; iter.MoveNext(); i++)
+                using (var iter = GetEnumerator())
                 {
-                    array[i] = iter.Current;
+                    for (int i = arrayIndex; iter.MoveNext(); i++)
+                    {
+                        array[i] = iter.Current;
+                    }
                 }
             }
 
@@ -1289,23 +1297,25 @@ namespace Lucene.Net.Analysis.Util
 
             public override string ToString()
             {
-                var i = (ValueEnumerator)GetEnumerator();
-                if (!i.HasNext)
-                    return "[]";
-
-                StringBuilder sb = new StringBuilder();
-                sb.Append('[');
-                while(i.MoveNext())
+                using (var i = (ValueEnumerator)GetEnumerator())
                 {
-                    TValue value = i.Current;
-                    if (sb.Length > 1)
+                    if (!i.HasNext)
+                        return "[]";
+
+                    StringBuilder sb = new StringBuilder();
+                    sb.Append('[');
+                    while (i.MoveNext())
                     {
-                        sb.Append(',').Append(' ');
+                        TValue value = i.Current;
+                        if (sb.Length > 1)
+                        {
+                            sb.Append(',').Append(' ');
+                        }
+                        sb.Append(value.ToString());
                     }
-                    sb.Append(value.ToString());
-                }
 
-                return sb.Append(']').ToString();
+                    return sb.Append(']').ToString();
+                }
             }
 
             /// <summary>
@@ -1340,7 +1350,7 @@ namespace Lucene.Net.Analysis.Util
 
                 public void Dispose()
                 {
-                    // nothing to do
+                    entryIterator.Dispose();
                 }
 
                 public bool MoveNext()
@@ -1414,17 +1424,19 @@ namespace Lucene.Net.Analysis.Util
         {
             var sb = new StringBuilder("{");
 
-            IEnumerator<KeyValuePair<string, TValue>> iter1 = DictionaryExtensions.EntrySet(this).GetEnumerator();
-            while (iter1.MoveNext())
+            using (IEnumerator<KeyValuePair<string, TValue>> iter1 = DictionaryExtensions.EntrySet(this).GetEnumerator())
             {
-                KeyValuePair<string, TValue> entry = iter1.Current;
-                if (sb.Length > 1)
+                while (iter1.MoveNext())
                 {
-                    sb.Append(", ");
+                    KeyValuePair<string, TValue> entry = iter1.Current;
+                    if (sb.Length > 1)
+                    {
+                        sb.Append(", ");
+                    }
+                    sb.Append(entry.Key);
+                    sb.Append("=");
+                    sb.Append(entry.Value);
                 }
-                sb.Append(entry.Key);
-                sb.Append("=");
-                sb.Append(entry.Value);
             }
 
             return sb.Append('}').ToString();
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Util/CharArraySet.cs b/src/Lucene.Net.Analysis.Common/Analysis/Util/CharArraySet.cs
index 3b39cee..445ef59 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Util/CharArraySet.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Util/CharArraySet.cs
@@ -366,10 +366,12 @@ namespace Lucene.Net.Analysis.Util
         /// <param name="arrayIndex">The zero-based index in array at which copying begins.</param>
         public void CopyTo(string[] array, int arrayIndex)
         {
-            var iter = map.OriginalKeySet.GetEnumerator();
-            for (int i = arrayIndex; iter.MoveNext(); i++)
+            using (var iter = map.OriginalKeySet.GetEnumerator())
             {
-                array[i] = iter.Current;
+                for (int i = arrayIndex; iter.MoveNext(); i++)
+                {
+                    array[i] = iter.Current;
+                }
             }
         }
 
diff --git a/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/Gener.cs b/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/Gener.cs
index bacfc68..b8defb9 100644
--- a/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/Gener.cs
+++ b/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/Gener.cs
@@ -106,9 +106,8 @@ namespace Egothor.Stemmer
         public bool Eat(Row @in, int[] remap)
         {
             int sum = 0;
-            for (IEnumerator<Cell> i = @in.cells.Values.GetEnumerator(); i.MoveNext();)
+            foreach (Cell c in @in.cells.Values)
             {
-                Cell c = i.Current;
                 sum += c.cnt;
                 if (c.@ref >= 0)
                 {
@@ -120,9 +119,8 @@ namespace Egothor.Stemmer
             }
             int frame = sum / 10;
             bool live = false;
-            for (IEnumerator<Cell> i = @in.cells.Values.GetEnumerator(); i.MoveNext();)
+            foreach (Cell c in @in.cells.Values)
             {
-                Cell c = i.Current;
                 if (c.cnt < frame && c.cmd >= 0)
                 {
                     c.cnt = 0;
diff --git a/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/Lift.cs b/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/Lift.cs
index 43a4602..d14a45c 100644
--- a/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/Lift.cs
+++ b/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/Lift.cs
@@ -116,10 +116,8 @@ namespace Egothor.Stemmer
         /// <param name="nodes">contains the patch commands</param>
         public void LiftUp(Row @in, IList<Row> nodes)
         {
-            IEnumerator<Cell> i = @in.cells.Values.GetEnumerator();
-            for (; i.MoveNext();)
+            foreach (Cell c in @in.cells.Values)
             {
-                Cell c = i.Current;
                 if (c.@ref >= 0)
                 {
                     Row to = nodes[c.@ref];
diff --git a/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/Optimizer.cs b/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/Optimizer.cs
index e299452..ed97f98 100644
--- a/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/Optimizer.cs
+++ b/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/Optimizer.cs
@@ -124,11 +124,9 @@ namespace Egothor.Stemmer
         /// <returns>the resulting <see cref="Row"/>, or <c>null</c> if the operation cannot be realized</returns>
         public Row Merge(Row master, Row existing)
         {
-            var i = master.cells.Keys.GetEnumerator();
             Row n = new Row();
-            for (; i.MoveNext();)
+            foreach (char ch in master.cells.Keys)
             {
-                char ch = i.Current;
                 // XXX also must handle Cnt and Skip !!
                 Cell a = master.cells.ContainsKey(ch) ? master.cells[ch] : null;
                 Cell b = existing.cells.ContainsKey(ch) ? existing.cells[ch] : null;
@@ -140,10 +138,8 @@ namespace Egothor.Stemmer
                 }
                 n.cells[ch] = s;
             }
-            i = existing.cells.Keys.GetEnumerator();
-            for (; i.MoveNext();)
+            foreach (char ch in existing.cells.Keys)
             {
-                char ch = i.Current;
                 if (master.At(ch) != null)
                 {
                     continue;
diff --git a/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/Reduce.cs b/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/Reduce.cs
index 61a1c3f..3b95735 100644
--- a/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/Reduce.cs
+++ b/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/Reduce.cs
@@ -93,10 +93,8 @@ namespace Egothor.Stemmer
 
             Row now = old[ind];
             to.Add(now);
-            IEnumerator<Cell> i = now.cells.Values.GetEnumerator();
-            for (; i.MoveNext();)
+            foreach (Cell c in now.cells.Values)
             {
-                Cell c = i.Current;
                 if (c.@ref >= 0 && remap[c.@ref] < 0)
                 {
                     RemoveGaps(c.@ref, old, to, remap);
@@ -111,19 +109,16 @@ namespace Egothor.Stemmer
         /// </summary>
         internal class Remap : Row
         {
-            /**
-             * Constructor for the <see cref="Remap"/> object
-             * 
-             * @param old Description of the Parameter
-             * @param remap Description of the Parameter
-             */
+            /// <summary>
+            /// Constructor for the <see cref="Remap"/> object
+            /// </summary>
+            /// <param name="old">Description of the Parameter</param>
+            /// <param name="remap">Description of the Parameter</param>
             public Remap(Row old, int[] remap)
-                        : base()
+                : base()
             {
-                var i = old.cells.Keys.GetEnumerator();
-                for (; i.MoveNext();)
+                foreach (char ch in old.cells.Keys)
                 {
-                    char ch = i.Current;
                     Cell c = old.At(ch);
                     Cell nc;
                     if (c.@ref >= 0)
diff --git a/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/Row.cs b/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/Row.cs
index 149b8e2..250972b 100644
--- a/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/Row.cs
+++ b/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/Row.cs
@@ -151,11 +151,9 @@ namespace Egothor.Stemmer
         /// <returns>the number of cells in use</returns>
         public int GetCells()
         {
-            IEnumerator<char> i = cells.Keys.GetEnumerator();
             int size = 0;
-            for (; i.MoveNext();)
+            foreach (char c in cells.Keys)
             {
-                char c = i.Current;
                 Cell e = At(c);
                 if (e.cmd >= 0 || e.@ref >= 0)
                 {
@@ -171,11 +169,9 @@ namespace Egothor.Stemmer
         /// <returns>the number of references</returns>
         public int GetCellsPnt()
         {
-            IEnumerator<char> i = cells.Keys.GetEnumerator();
             int size = 0;
-            for (; i.MoveNext();)
+            foreach (char c in cells.Keys)
             {
-                char c = i.Current;
                 Cell e = At(c);
                 if (e.@ref >= 0)
                 {
@@ -191,11 +187,9 @@ namespace Egothor.Stemmer
         /// <returns>the number of patch commands</returns>
         public int GetCellsVal()
         {
-            IEnumerator<char> i = cells.Keys.GetEnumerator();
             int size = 0;
-            for (; i.MoveNext();)
+            foreach (char c in cells.Keys)
             {
-                char c = i.Current;
                 Cell e = At(c);
                 if (e.cmd >= 0)
                 {
@@ -248,10 +242,8 @@ namespace Egothor.Stemmer
         public virtual void Store(IDataOutput os)
         {
             os.WriteInt32(cells.Count);
-            IEnumerator<char> i = cells.Keys.GetEnumerator();
-            for (; i.MoveNext();)
+            foreach (char c in cells.Keys)
             {
-                char c = i.Current;
                 Cell e = At(c);
                 if (e.cmd < 0 && e.@ref < 0)
                 {
@@ -274,13 +266,11 @@ namespace Egothor.Stemmer
         /// <returns>the number of identical <see cref="Cell"/>s, or -1 if there are (at least) two different <see cref="Cell"/>s</returns>
         public int UniformCmd(bool eqSkip)
         {
-            IEnumerator<Cell> i = cells.Values.GetEnumerator();
             int ret = -1;
             uniformCnt = 1;
             uniformSkip = 0;
-            for (; i.MoveNext();)
+            foreach (Cell c in cells.Values)
             {
-                Cell c = i.Current;
                 if (c.@ref >= 0)
                 {
                     return -1;
@@ -325,9 +315,8 @@ namespace Egothor.Stemmer
         /// <param name="out"></param>
         public virtual void Print(TextWriter @out)
         {
-            for (IEnumerator<char> i = cells.Keys.GetEnumerator(); i.MoveNext();)
+            foreach (char ch in cells.Keys)
             {
-                char ch = i.Current;
                 Cell c = At(ch);
                 @out.Write("[" + ch + ":" + c + "]");
             }
diff --git a/src/Lucene.Net.Benchmark/Support/Sax/Helpers/NamespaceSupport.cs b/src/Lucene.Net.Benchmark/Support/Sax/Helpers/NamespaceSupport.cs
index c4014a0..ac79d0a 100644
--- a/src/Lucene.Net.Benchmark/Support/Sax/Helpers/NamespaceSupport.cs
+++ b/src/Lucene.Net.Benchmark/Support/Sax/Helpers/NamespaceSupport.cs
@@ -424,6 +424,7 @@ namespace Sax.Helpers
         public IEnumerable GetPrefixes(string uri)
         {
             var prefixes = new ArrayList();
+            // LUCENENET NOTE: IEnumerator is not disposable
             IEnumerator allPrefixes = GetPrefixes().GetEnumerator();
             while (allPrefixes.MoveNext())
             {
diff --git a/src/Lucene.Net.Codecs/Memory/MemoryDocValuesConsumer.cs b/src/Lucene.Net.Codecs/Memory/MemoryDocValuesConsumer.cs
index 8bbb765..447d7f3 100644
--- a/src/Lucene.Net.Codecs/Memory/MemoryDocValuesConsumer.cs
+++ b/src/Lucene.Net.Codecs/Memory/MemoryDocValuesConsumer.cs
@@ -506,7 +506,8 @@ namespace Lucene.Net.Codecs.Memory
 
             public void Dispose()
             {
-                // nothing to do
+                this.counts.Dispose();
+                this.ords.Dispose();
             }
 
             public void Reset()
diff --git a/src/Lucene.Net.Codecs/SimpleText/SimpleTextDocValuesWriter.cs b/src/Lucene.Net.Codecs/SimpleText/SimpleTextDocValuesWriter.cs
index 3598d6a..fdb30ea 100644
--- a/src/Lucene.Net.Codecs/SimpleText/SimpleTextDocValuesWriter.cs
+++ b/src/Lucene.Net.Codecs/SimpleText/SimpleTextDocValuesWriter.cs
@@ -323,23 +323,25 @@ namespace Lucene.Net.Codecs.SimpleText
             // compute ord pattern: this is funny, we encode all values for all docs to find the maximum length
             var maxOrdListLength = 0;
             var sb2 = new StringBuilder();
-            var ordStream = ords.GetEnumerator();
-            foreach (var n in docToOrdCount)
+            using (var ordStream = ords.GetEnumerator())
             {
-                sb2.Length = 0;
-                var count = (int) n;
-                for (int i = 0; i < count; i++)
+                foreach (var n in docToOrdCount)
                 {
-                    ordStream.MoveNext();
-
-                    var ord = ordStream.Current;
-                    if (sb2.Length > 0)
+                    sb2.Length = 0;
+                    var count = (int)n;
+                    for (int i = 0; i < count; i++)
                     {
-                        sb2.Append(",");
+                        ordStream.MoveNext();
+
+                        var ord = ordStream.Current;
+                        if (sb2.Length > 0)
+                        {
+                            sb2.Append(",");
+                        }
+                        sb2.Append(ord.GetValueOrDefault().ToString(CultureInfo.InvariantCulture));
                     }
-                    sb2.Append(ord.GetValueOrDefault().ToString(CultureInfo.InvariantCulture));
+                    maxOrdListLength = Math.Max(maxOrdListLength, sb2.Length);
                 }
-                maxOrdListLength = Math.Max(maxOrdListLength, sb2.Length);
             }
 
             sb2.Length = 0;
@@ -379,30 +381,31 @@ namespace Lucene.Net.Codecs.SimpleText
 
             Debug.Assert(valuesSeen == valueCount);
 
-            ordStream = ords.GetEnumerator();
-
-            // write the ords for each doc comma-separated
-            foreach (var n in docToOrdCount)
+            using (var ordStream = ords.GetEnumerator())
             {
-                sb2.Length = 0;
-                var count = (int) n;
-                for (var i = 0; i < count; i++)
+                // write the ords for each doc comma-separated
+                foreach (var n in docToOrdCount)
                 {
-                    ordStream.MoveNext();
-                    var ord = ordStream.Current;
-                    if (sb2.Length > 0)
-                        sb2.Append(",");
-                    
-                    sb2.Append(ord);
-                }
-                // now pad to fit: these are numbers so spaces work well. reader calls trim()
-                var numPadding = maxOrdListLength - sb2.Length;
-                for (var i = 0; i < numPadding; i++)
-                {
-                    sb2.Append(' ');
+                    sb2.Length = 0;
+                    var count = (int)n;
+                    for (var i = 0; i < count; i++)
+                    {
+                        ordStream.MoveNext();
+                        var ord = ordStream.Current;
+                        if (sb2.Length > 0)
+                            sb2.Append(",");
+
+                        sb2.Append(ord);
+                    }
+                    // now pad to fit: these are numbers so spaces work well. reader calls trim()
+                    var numPadding = maxOrdListLength - sb2.Length;
+                    for (var i = 0; i < numPadding; i++)
+                    {
+                        sb2.Append(' ');
+                    }
+                    SimpleTextUtil.Write(data, sb2.ToString(), scratch);
+                    SimpleTextUtil.WriteNewline(data);
                 }
-                SimpleTextUtil.Write(data, sb2.ToString(), scratch);
-                SimpleTextUtil.WriteNewline(data);
             }
         }
 
diff --git a/src/Lucene.Net.Facet/Taxonomy/WriterCache/CompactLabelToOrdinal.cs b/src/Lucene.Net.Facet/Taxonomy/WriterCache/CompactLabelToOrdinal.cs
index dd68485..b71f3aa 100644
--- a/src/Lucene.Net.Facet/Taxonomy/WriterCache/CompactLabelToOrdinal.cs
+++ b/src/Lucene.Net.Facet/Taxonomy/WriterCache/CompactLabelToOrdinal.cs
@@ -212,12 +212,13 @@ namespace Lucene.Net.Facet.Taxonomy.WriterCache
             this.collisionMap = new CollisionMap(oldCollisionMap.Capacity, this.labelRepository);
             this.threshold = (int)(this.capacity * this.loadFactor);
 
-            var it = oldCollisionMap.GetEnumerator();
-
-            while (it.MoveNext())
+            using (var it = oldCollisionMap.GetEnumerator())
             {
-                var e = it.Current;
-                AddLabelOffset(StringHashCode(this.labelRepository, e.offset), e.cid, e.offset);
+                while (it.MoveNext())
+                {
+                    var e = it.Current;
+                    AddLabelOffset(StringHashCode(this.labelRepository, e.offset), e.cid, e.offset);
+                }
             }
         }
 
diff --git a/src/Lucene.Net.Highlighter/VectorHighlight/BaseFragListBuilder.cs b/src/Lucene.Net.Highlighter/VectorHighlight/BaseFragListBuilder.cs
index 96f1900..842956e 100644
--- a/src/Lucene.Net.Highlighter/VectorHighlight/BaseFragListBuilder.cs
+++ b/src/Lucene.Net.Highlighter/VectorHighlight/BaseFragListBuilder.cs
@@ -58,59 +58,61 @@ namespace Lucene.Net.Search.VectorHighlight
                 throw new ArgumentException("fragCharSize(" + fragCharSize + ") is too small. It must be " + minFragCharSize + " or higher.");
 
             List<WeightedPhraseInfo> wpil = new List<WeightedPhraseInfo>();
-            IteratorQueue<WeightedPhraseInfo> queue = new IteratorQueue<WeightedPhraseInfo>(fieldPhraseList.PhraseList.GetEnumerator());
-            WeightedPhraseInfo phraseInfo = null;
-            int startOffset = 0;
-            while ((phraseInfo = queue.Top()) != null)
+            using (IteratorQueue<WeightedPhraseInfo> queue = new IteratorQueue<WeightedPhraseInfo>(fieldPhraseList.PhraseList.GetEnumerator()))
             {
-                // if the phrase violates the border of previous fragment, discard it and try next phrase
-                if (phraseInfo.StartOffset < startOffset)
+                WeightedPhraseInfo phraseInfo = null;
+                int startOffset = 0;
+                while ((phraseInfo = queue.Top()) != null)
                 {
-                    queue.RemoveTop();
-                    continue;
-                }
+                    // if the phrase violates the border of previous fragment, discard it and try next phrase
+                    if (phraseInfo.StartOffset < startOffset)
+                    {
+                        queue.RemoveTop();
+                        continue;
+                    }
 
-                wpil.Clear();
-                int currentPhraseStartOffset = phraseInfo.StartOffset;
-                int currentPhraseEndOffset = phraseInfo.EndOffset;
-                int spanStart = Math.Max(currentPhraseStartOffset - margin, startOffset);
-                int spanEnd = Math.Max(currentPhraseEndOffset, spanStart + fragCharSize);
-                if (AcceptPhrase(queue.RemoveTop(), currentPhraseEndOffset - currentPhraseStartOffset, fragCharSize))
-                {
-                    wpil.Add(phraseInfo);
-                }
-                while ((phraseInfo = queue.Top()) != null)
-                { // pull until we crossed the current spanEnd
-                    if (phraseInfo.EndOffset <= spanEnd)
+                    wpil.Clear();
+                    int currentPhraseStartOffset = phraseInfo.StartOffset;
+                    int currentPhraseEndOffset = phraseInfo.EndOffset;
+                    int spanStart = Math.Max(currentPhraseStartOffset - margin, startOffset);
+                    int spanEnd = Math.Max(currentPhraseEndOffset, spanStart + fragCharSize);
+                    if (AcceptPhrase(queue.RemoveTop(), currentPhraseEndOffset - currentPhraseStartOffset, fragCharSize))
                     {
-                        currentPhraseEndOffset = phraseInfo.EndOffset;
-                        if (AcceptPhrase(queue.RemoveTop(), currentPhraseEndOffset - currentPhraseStartOffset, fragCharSize))
+                        wpil.Add(phraseInfo);
+                    }
+                    while ((phraseInfo = queue.Top()) != null)
+                    { // pull until we crossed the current spanEnd
+                        if (phraseInfo.EndOffset <= spanEnd)
+                        {
+                            currentPhraseEndOffset = phraseInfo.EndOffset;
+                            if (AcceptPhrase(queue.RemoveTop(), currentPhraseEndOffset - currentPhraseStartOffset, fragCharSize))
+                            {
+                                wpil.Add(phraseInfo);
+                            }
+                        }
+                        else
                         {
-                            wpil.Add(phraseInfo);
+                            break;
                         }
                     }
-                    else
+                    if (!wpil.Any())
                     {
-                        break;
+                        continue;
                     }
-                }
-                if (!wpil.Any())
-                {
-                    continue;
-                }
 
-                int matchLen = currentPhraseEndOffset - currentPhraseStartOffset;
-                // now recalculate the start and end position to "center" the result
-                int newMargin = Math.Max(0, (fragCharSize - matchLen) / 2); // matchLen can be > fragCharSize prevent IAOOB here
-                spanStart = currentPhraseStartOffset - newMargin;
-                if (spanStart < startOffset)
-                {
-                    spanStart = startOffset;
+                    int matchLen = currentPhraseEndOffset - currentPhraseStartOffset;
+                    // now recalculate the start and end position to "center" the result
+                    int newMargin = Math.Max(0, (fragCharSize - matchLen) / 2); // matchLen can be > fragCharSize prevent IAOOB here
+                    spanStart = currentPhraseStartOffset - newMargin;
+                    if (spanStart < startOffset)
+                    {
+                        spanStart = startOffset;
+                    }
+                    // whatever is bigger here we grow this out
+                    spanEnd = spanStart + Math.Max(matchLen, fragCharSize);
+                    startOffset = spanEnd;
+                    fieldFragList.Add(spanStart, spanEnd, wpil);
                 }
-                // whatever is bigger here we grow this out
-                spanEnd = spanStart + Math.Max(matchLen, fragCharSize);
-                startOffset = spanEnd;
-                fieldFragList.Add(spanStart, spanEnd, wpil);
             }
             return fieldFragList;
         }
@@ -131,7 +133,7 @@ namespace Lucene.Net.Search.VectorHighlight
             return info.TermsOffsets.Count <= 1 || matchLength <= fragCharSize;
         }
 
-        private sealed class IteratorQueue<T>
+        private sealed class IteratorQueue<T> : IDisposable // LUCENENET specific - implemented IDisposable to dispose the IEnumerator<T>
         {
             private readonly IEnumerator<T> iter;
             private T top;
@@ -161,6 +163,11 @@ namespace Lucene.Net.Search.VectorHighlight
                 }
                 return currentTop;
             }
+
+            public void Dispose()
+            {
+                iter.Dispose();
+            }
         }
     }
 }
diff --git a/src/Lucene.Net.Highlighter/VectorHighlight/BaseFragmentsBuilder.cs b/src/Lucene.Net.Highlighter/VectorHighlight/BaseFragmentsBuilder.cs
index 6f77027..29adb50 100644
--- a/src/Lucene.Net.Highlighter/VectorHighlight/BaseFragmentsBuilder.cs
+++ b/src/Lucene.Net.Highlighter/VectorHighlight/BaseFragmentsBuilder.cs
@@ -293,39 +293,43 @@ namespace Lucene.Net.Search.VectorHighlight
                     List<SubInfo> fragInfo_SubInfos_ToDelete = new List<SubInfo>();
 
                     List<SubInfo> subInfos = new List<SubInfo>();
-                    IEnumerator<SubInfo> subInfoIterator = fragInfo.SubInfos.GetEnumerator();
                     float boost = 0.0f;  //  The boost of the new info will be the sum of the boosts of its SubInfos
-                    while (subInfoIterator.MoveNext())
+                    using (IEnumerator<SubInfo> subInfoIterator = fragInfo.SubInfos.GetEnumerator())
                     {
-                        SubInfo subInfo = subInfoIterator.Current;
-                        List<Toffs> toffsList = new List<Toffs>();
+                        while (subInfoIterator.MoveNext())
+                        {
+                            SubInfo subInfo = subInfoIterator.Current;
+                            List<Toffs> toffsList = new List<Toffs>();
 
 
-                        IEnumerator<Toffs> toffsIterator = subInfo.TermsOffsets.GetEnumerator();
-                        while (toffsIterator.MoveNext())
-                        {
-                            Toffs toffs = toffsIterator.Current;
-                            if (toffs.StartOffset >= fieldStart && toffs.EndOffset <= fieldEnd)
+                            using (IEnumerator<Toffs> toffsIterator = subInfo.TermsOffsets.GetEnumerator())
                             {
-
-                                toffsList.Add(toffs);
-                                //toffsIterator.Remove();
+                                while (toffsIterator.MoveNext())
+                                {
+                                    Toffs toffs = toffsIterator.Current;
+                                    if (toffs.StartOffset >= fieldStart && toffs.EndOffset <= fieldEnd)
+                                    {
+
+                                        toffsList.Add(toffs);
+                                        //toffsIterator.Remove();
+                                    }
+                                }
                             }
-                        }
-                        if (toffsList.Any())
-                        {
-                            // LUCENENET NOTE: Instead of removing during iteration (which isn't allowed in .NET when using an IEnumerator), 
-                            // we just remove the items at this point. We only get here if there are items to remove.
-                            subInfo.TermsOffsets.RemoveAll(toffsList);
+                            if (toffsList.Any())
+                            {
+                                // LUCENENET NOTE: Instead of removing during iteration (which isn't allowed in .NET when using an IEnumerator), 
+                                // we just remove the items at this point. We only get here if there are items to remove.
+                                subInfo.TermsOffsets.RemoveAll(toffsList);
 
-                            subInfos.Add(new SubInfo(subInfo.Text, toffsList, subInfo.Seqnum, subInfo.Boost));
-                            boost += subInfo.Boost;
-                        }
+                                subInfos.Add(new SubInfo(subInfo.Text, toffsList, subInfo.Seqnum, subInfo.Boost));
+                                boost += subInfo.Boost;
+                            }
 
-                        if (!subInfo.TermsOffsets.Any())
-                        {
-                            //subInfoIterator.Remove();
-                            fragInfo_SubInfos_ToDelete.Add(subInfo);
+                            if (!subInfo.TermsOffsets.Any())
+                            {
+                                //subInfoIterator.Remove();
+                                fragInfo_SubInfos_ToDelete.Add(subInfo);
+                            }
                         }
                     }
 
diff --git a/src/Lucene.Net.Highlighter/VectorHighlight/FastVectorHighlighter.cs b/src/Lucene.Net.Highlighter/VectorHighlight/FastVectorHighlighter.cs
index 4a37bd8..a78b3ac 100644
--- a/src/Lucene.Net.Highlighter/VectorHighlight/FastVectorHighlighter.cs
+++ b/src/Lucene.Net.Highlighter/VectorHighlight/FastVectorHighlighter.cs
@@ -250,7 +250,6 @@ namespace Lucene.Net.Search.VectorHighlight
             FieldQuery fieldQuery, IndexReader reader, int docId,
             ISet<string> matchedFields, int fragCharSize)
         {
-            IEnumerator<string> matchedFieldsItr = matchedFields.GetEnumerator();
             if (!matchedFields.Any())
             {
                 throw new ArgumentException("matchedFields must contain at least on field name.");
@@ -258,9 +257,9 @@ namespace Lucene.Net.Search.VectorHighlight
             FieldPhraseList[]
             toMerge = new FieldPhraseList[matchedFields.Count];
             int i = 0;
-            while (matchedFieldsItr.MoveNext())
+            foreach (var matchedField in matchedFields)
             {
-                FieldTermStack stack = new FieldTermStack(reader, docId, matchedFieldsItr.Current, fieldQuery);
+                FieldTermStack stack = new FieldTermStack(reader, docId, matchedField, fieldQuery);
                 toMerge[i++] = new FieldPhraseList(stack, fieldQuery, phraseLimit);
             }
             return fragListBuilder.CreateFieldFragList(new FieldPhraseList(toMerge), fragCharSize);
diff --git a/src/Lucene.Net.Highlighter/VectorHighlight/FieldPhraseList.cs b/src/Lucene.Net.Highlighter/VectorHighlight/FieldPhraseList.cs
index 136cb82..93a2e3a 100644
--- a/src/Lucene.Net.Highlighter/VectorHighlight/FieldPhraseList.cs
+++ b/src/Lucene.Net.Highlighter/VectorHighlight/FieldPhraseList.cs
@@ -149,54 +149,66 @@ namespace Lucene.Net.Search.VectorHighlight
             // Step 1.  Sort by startOffset, endOffset, and boost, in that order.
 
             IEnumerator<WeightedPhraseInfo>[] allInfos = new IEnumerator<WeightedPhraseInfo>[toMerge.Length];
-            int index = 0;
-            foreach (FieldPhraseList fplToMerge in toMerge)
+            try
             {
-                allInfos[index++] = fplToMerge.phraseList.GetEnumerator();
-            }
-            MergedIterator<WeightedPhraseInfo> itr = new MergedIterator<WeightedPhraseInfo>(false, allInfos);
-            // Step 2.  Walk the sorted list merging infos that overlap
-            phraseList = new List<WeightedPhraseInfo>();
-            if (!itr.MoveNext())
-            {
-                return;
-            }
-            List<WeightedPhraseInfo> work = new List<WeightedPhraseInfo>();
-            WeightedPhraseInfo first = itr.Current;
-            work.Add(first);
-            int workEndOffset = first.EndOffset;
-            while (itr.MoveNext())
-            {
-                WeightedPhraseInfo current = itr.Current;
-                if (current.StartOffset <= workEndOffset)
+                int index = 0;
+                foreach (FieldPhraseList fplToMerge in toMerge)
                 {
-                    workEndOffset = Math.Max(workEndOffset, current.EndOffset);
-                    work.Add(current);
+                    allInfos[index++] = fplToMerge.phraseList.GetEnumerator();
                 }
-                else
+                using (MergedIterator<WeightedPhraseInfo> itr = new MergedIterator<WeightedPhraseInfo>(false, allInfos))
                 {
+                    // Step 2.  Walk the sorted list merging infos that overlap
+                    phraseList = new List<WeightedPhraseInfo>();
+                    if (!itr.MoveNext())
+                    {
+                        return;
+                    }
+                    List<WeightedPhraseInfo> work = new List<WeightedPhraseInfo>();
+                    WeightedPhraseInfo first = itr.Current;
+                    work.Add(first);
+                    int workEndOffset = first.EndOffset;
+                    while (itr.MoveNext())
+                    {
+                        WeightedPhraseInfo current = itr.Current;
+                        if (current.StartOffset <= workEndOffset)
+                        {
+                            workEndOffset = Math.Max(workEndOffset, current.EndOffset);
+                            work.Add(current);
+                        }
+                        else
+                        {
+                            if (work.Count == 1)
+                            {
+                                phraseList.Add(work[0]);
+                                work[0] = current;
+                            }
+                            else
+                            {
+                                phraseList.Add(new WeightedPhraseInfo(work));
+                                work.Clear();
+                                work.Add(current);
+                            }
+                            workEndOffset = current.EndOffset;
+                        }
+                    }
                     if (work.Count == 1)
                     {
                         phraseList.Add(work[0]);
-                        work[0] = current;
                     }
                     else
                     {
                         phraseList.Add(new WeightedPhraseInfo(work));
                         work.Clear();
-                        work.Add(current);
                     }
-                    workEndOffset = current.EndOffset;
                 }
             }
-            if (work.Count == 1)
-            {
-                phraseList.Add(work[0]);
-            }
-            else
+            finally
             {
-                phraseList.Add(new WeightedPhraseInfo(work));
-                work.Clear();
+                foreach (var allInfo in allInfos)
+                {
+                    allInfo.Dispose();
+                }
             }
         }
 
@@ -307,50 +319,67 @@ namespace Lucene.Net.Search.VectorHighlight
             /// </summary>
             public WeightedPhraseInfo(ICollection<WeightedPhraseInfo> toMerge)
             {
-                // Pretty much the same idea as merging FieldPhraseLists:
-                // Step 1.  Sort by startOffset, endOffset
-                //          While we are here merge the boosts and termInfos
-                IEnumerator<WeightedPhraseInfo> toMergeItr = toMerge.GetEnumerator();
-                if (!toMergeItr.MoveNext())
-                {
-                    throw new ArgumentException("toMerge must contain at least one WeightedPhraseInfo.");
-                }
-                WeightedPhraseInfo first = toMergeItr.Current;
                 IEnumerator<Toffs>[] allToffs = new IEnumerator<Toffs>[toMerge.Count];
-                termsInfos = new List<TermInfo>();
-                seqnum = first.seqnum;
-                boost = first.boost;
-                allToffs[0] = first.termsOffsets.GetEnumerator();
-                int index = 1;
-                while (toMergeItr.MoveNext())
+                try
                 {
-                    WeightedPhraseInfo info = toMergeItr.Current;
-                    boost += info.boost;
-                    termsInfos.AddAll(info.termsInfos);
-                    allToffs[index++] = info.termsOffsets.GetEnumerator();
-                }
-                // Step 2.  Walk the sorted list merging overlaps
-                MergedIterator<Toffs> itr = new MergedIterator<Toffs>(false, allToffs);
-                termsOffsets = new List<Toffs>();
-                if (!itr.MoveNext())
-                {
-                    return;
-                }
-                Toffs work = itr.Current;
-                while (itr.MoveNext())
-                {
-                    Toffs current = itr.Current;
-                    if (current.StartOffset <= work.EndOffset)
+
+                    // Pretty much the same idea as merging FieldPhraseLists:
+                    // Step 1.  Sort by startOffset, endOffset
+                    //          While we are here merge the boosts and termInfos
+                    using (IEnumerator<WeightedPhraseInfo> toMergeItr = toMerge.GetEnumerator())
                     {
-                        work.EndOffset = Math.Max(work.EndOffset, current.EndOffset);
+                        if (!toMergeItr.MoveNext())
+                        {
+                            throw new ArgumentException("toMerge must contain at least one WeightedPhraseInfo.");
+                        }
+                        WeightedPhraseInfo first = toMergeItr.Current;
+
+                        termsInfos = new List<TermInfo>();
+                        seqnum = first.seqnum;
+                        boost = first.boost;
+                        allToffs[0] = first.termsOffsets.GetEnumerator();
+                        int index = 1;
+                        while (toMergeItr.MoveNext())
+                        {
+                            WeightedPhraseInfo info = toMergeItr.Current;
+                            boost += info.boost;
+                            termsInfos.AddAll(info.termsInfos);
+                            allToffs[index++] = info.termsOffsets.GetEnumerator();
+                        }
+
+                        // Step 2.  Walk the sorted list merging overlaps
+                        using (MergedIterator<Toffs> itr = new MergedIterator<Toffs>(false, allToffs))
+                        {
+                            termsOffsets = new List<Toffs>();
+                            if (!itr.MoveNext())
+                            {
+                                return;
+                            }
+                            Toffs work = itr.Current;
+                            while (itr.MoveNext())
+                            {
+                                Toffs current = itr.Current;
+                                if (current.StartOffset <= work.EndOffset)
+                                {
+                                    work.EndOffset = Math.Max(work.EndOffset, current.EndOffset);
+                                }
+                                else
+                                {
+                                    termsOffsets.Add(work);
+                                    work = current;
+                                }
+                            }
+                            termsOffsets.Add(work);
+                        }
                     }
-                    else
+                }
+                finally
+                {
+                    foreach (var allToff in allToffs)
                     {
-                        termsOffsets.Add(work);
-                        work = current;
+                        allToff.Dispose();
                     }
                 }
-                termsOffsets.Add(work);
             }
 
             public virtual int StartOffset
diff --git a/src/Lucene.Net.Highlighter/VectorHighlight/SingleFragListBuilder.cs b/src/Lucene.Net.Highlighter/VectorHighlight/SingleFragListBuilder.cs
index 37a3947..cd843d6 100644
--- a/src/Lucene.Net.Highlighter/VectorHighlight/SingleFragListBuilder.cs
+++ b/src/Lucene.Net.Highlighter/VectorHighlight/SingleFragListBuilder.cs
@@ -38,19 +38,21 @@ namespace Lucene.Net.Search.VectorHighlight
             FieldFragList ffl = new SimpleFieldFragList(fragCharSize);
 
             List<WeightedPhraseInfo> wpil = new List<WeightedPhraseInfo>();
-            IEnumerator<WeightedPhraseInfo> ite = fieldPhraseList.PhraseList.GetEnumerator();
-            WeightedPhraseInfo phraseInfo = null;
-            while (true)
+            using (IEnumerator<WeightedPhraseInfo> ite = fieldPhraseList.PhraseList.GetEnumerator())
             {
-                if (!ite.MoveNext()) break;
-                phraseInfo = ite.Current;
-                if (phraseInfo == null) break;
+                WeightedPhraseInfo phraseInfo = null;
+                while (true)
+                {
+                    if (!ite.MoveNext()) break;
+                    phraseInfo = ite.Current;
+                    if (phraseInfo == null) break;
 
-                wpil.Add(phraseInfo);
+                    wpil.Add(phraseInfo);
+                }
+                if (wpil.Count > 0)
+                    ffl.Add(0, int.MaxValue, wpil);
+                return ffl;
             }
-            if (wpil.Count > 0)
-                ffl.Add(0, int.MaxValue, wpil);
-            return ffl;
         }
     }
 }
diff --git a/src/Lucene.Net.Memory/MemoryIndex.cs b/src/Lucene.Net.Memory/MemoryIndex.cs
index d278ab9..2b951f8 100644
--- a/src/Lucene.Net.Memory/MemoryIndex.cs
+++ b/src/Lucene.Net.Memory/MemoryIndex.cs
@@ -629,10 +629,12 @@ namespace Lucene.Net.Index.Memory
             int size = map.Count;
             KeyValuePair<K, V>[] entries = new KeyValuePair<K, V>[size];
 
-            IEnumerator<KeyValuePair<K, V>> iter = map.GetEnumerator();
-            for (int i = 0; i < size && iter.MoveNext(); i++)
+            using (IEnumerator<KeyValuePair<K, V>> iter = map.GetEnumerator())
             {
-                entries[i] = iter.Current;
+                for (int i = 0; i < size && iter.MoveNext(); i++)
+                {
+                    entries[i] = iter.Current;
+                }
             }
 
             if (size > 1)
diff --git a/src/Lucene.Net.QueryParser/Flexible/Core/Nodes/OrQueryNode.cs b/src/Lucene.Net.QueryParser/Flexible/Core/Nodes/OrQueryNode.cs
index 0a9b9e0..e310e62 100644
--- a/src/Lucene.Net.QueryParser/Flexible/Core/Nodes/OrQueryNode.cs
+++ b/src/Lucene.Net.QueryParser/Flexible/Core/Nodes/OrQueryNode.cs
@@ -67,9 +67,9 @@ namespace Lucene.Net.QueryParsers.Flexible.Core.Nodes
 
             StringBuilder sb = new StringBuilder();
             string filler = "";
-            for (IEnumerator<IQueryNode> it = children.GetEnumerator(); it.MoveNext();)
+            foreach (var child in children)
             {
-                sb.Append(filler).Append(it.Current.ToQueryString(escapeSyntaxParser));
+                sb.Append(filler).Append(child.ToQueryString(escapeSyntaxParser));
                 filler = " OR ";
             }
 
diff --git a/src/Lucene.Net.QueryParser/Flexible/Core/Processors/RemoveDeletedQueryNodesProcessor.cs b/src/Lucene.Net.QueryParser/Flexible/Core/Processors/RemoveDeletedQueryNodesProcessor.cs
index 0a54974..87a8b19 100644
--- a/src/Lucene.Net.QueryParser/Flexible/Core/Processors/RemoveDeletedQueryNodesProcessor.cs
+++ b/src/Lucene.Net.QueryParser/Flexible/Core/Processors/RemoveDeletedQueryNodesProcessor.cs
@@ -60,10 +60,10 @@ namespace Lucene.Net.QueryParsers.Flexible.Core.Processors
                 {
                     removeBoolean = true;
 
-                    for (IEnumerator<IQueryNode> it = children.GetEnumerator(); it.MoveNext();)
+                    foreach (var child in children)
                     {
 
-                        if (!(it.Current is DeletedQueryNode))
+                        if (!(child is DeletedQueryNode))
                         {
                             removeBoolean = false;
                             break;
diff --git a/src/Lucene.Net.QueryParser/Flexible/Standard/Parser/StandardSyntaxParser.cs b/src/Lucene.Net.QueryParser/Flexible/Standard/Parser/StandardSyntaxParser.cs
index 0cc249d..f69e99d 100644
--- a/src/Lucene.Net.QueryParser/Flexible/Standard/Parser/StandardSyntaxParser.cs
+++ b/src/Lucene.Net.QueryParser/Flexible/Standard/Parser/StandardSyntaxParser.cs
@@ -1180,25 +1180,28 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Parser
                 {
                     jj_expentry[i] = jj_lasttokens[i];
                 }
-                 for (var it = jj_expentries.GetEnumerator(); it.MoveNext();)
+                using (var it = jj_expentries.GetEnumerator())
                 {
-                    int[] oldentry = (int[])(it.Current);
-                    if (oldentry.Length == jj_expentry.Length)
+                    while (it.MoveNext())
                     {
-                        for (int i = 0; i < jj_expentry.Length; i++)
+                        int[] oldentry = (int[])(it.Current);
+                        if (oldentry.Length == jj_expentry.Length)
                         {
-                            if (oldentry[i] != jj_expentry[i])
+                            for (int i = 0; i < jj_expentry.Length; i++)
                             {
-                                goto jj_entries_loop_continue;
+                                if (oldentry[i] != jj_expentry[i])
+                                {
+                                    goto jj_entries_loop_continue;
+                                }
                             }
+                            jj_expentries.Add(jj_expentry);
+                            goto jj_entries_loop_break;
                         }
-                        jj_expentries.Add(jj_expentry);
-                        goto jj_entries_loop_break;
+                        jj_entries_loop_continue: { }
                     }
-                    jj_entries_loop_continue: { }
+                    jj_entries_loop_break:
+                        if (pos != 0) jj_lasttokens[(jj_endpos = pos) - 1] = kind;
                 }
-                jj_entries_loop_break:
-                if (pos != 0) jj_lasttokens[(jj_endpos = pos) - 1] = kind;
             }
         }
 
diff --git a/src/Lucene.Net.Sandbox/Queries/FuzzyLikeThisQuery.cs b/src/Lucene.Net.Sandbox/Queries/FuzzyLikeThisQuery.cs
index 3cc7e2c..9ed11b4 100644
--- a/src/Lucene.Net.Sandbox/Queries/FuzzyLikeThisQuery.cs
+++ b/src/Lucene.Net.Sandbox/Queries/FuzzyLikeThisQuery.cs
@@ -305,9 +305,8 @@ namespace Lucene.Net.Sandbox.Queries
                 l.Add(st);
             }
             //Step 2: Organize the sorted termqueries into zero-coord scoring boolean queries
-            for (var iter = variantQueries.Values.GetEnumerator(); iter.MoveNext();)
+            foreach (List<ScoreTerm> variants in variantQueries.Values)
             {
-                List<ScoreTerm> variants = iter.Current;
                 if (variants.Count == 1)
                 {
                     //optimize where only one selected variant
@@ -319,10 +318,8 @@ namespace Lucene.Net.Sandbox.Queries
                 else
                 {
                     BooleanQuery termVariants = new BooleanQuery(true); //disable coord and IDF for these term variants
-                    for (IEnumerator<ScoreTerm> iterator2 = variants.GetEnumerator(); iterator2
-                            .MoveNext();)
+                    foreach (ScoreTerm st in variants)
                     {
-                        ScoreTerm st = iterator2.Current;
                         // found a match
                         Query tq = ignoreTF ? (Query)new ConstantScoreQuery(new TermQuery(st.Term)) : new TermQuery(st.Term, 1);
                         tq.Boost = st.Score; // set the boost using the ScoreTerm's score
diff --git a/src/Lucene.Net.TestFramework/Codecs/Asserting/AssertingDocValuesFormat.cs b/src/Lucene.Net.TestFramework/Codecs/Asserting/AssertingDocValuesFormat.cs
index 564efd2..37419f7 100644
--- a/src/Lucene.Net.TestFramework/Codecs/Asserting/AssertingDocValuesFormat.cs
+++ b/src/Lucene.Net.TestFramework/Codecs/Asserting/AssertingDocValuesFormat.cs
@@ -159,36 +159,38 @@ namespace Lucene.Net.Codecs.Asserting
                 int docCount = 0;
                 long ordCount = 0;
                 Int64BitSet seenOrds = new Int64BitSet(valueCount);
-                IEnumerator<long?> ordIterator = ords.GetEnumerator();
-                foreach (long? v in docToOrdCount)
+                using (IEnumerator<long?> ordIterator = ords.GetEnumerator())
                 {
-                    Debug.Assert(v != null);
-                    int count = (int)v.Value;
-                    Debug.Assert(count >= 0);
-                    docCount++;
-                    ordCount += count;
-
-                    long lastOrd = -1;
-                    for (int i = 0; i < count; i++)
+                    foreach (long? v in docToOrdCount)
                     {
-                        ordIterator.MoveNext();
-                        long? o = ordIterator.Current;
-                        Debug.Assert(o != null);
-                        long ord = o.Value;
-                        Debug.Assert(ord >= 0 && ord < valueCount);
-                        Debug.Assert(ord > lastOrd, "ord=" + ord + ",lastOrd=" + lastOrd);
-                        seenOrds.Set(ord);
-                        lastOrd = ord;
+                        Debug.Assert(v != null);
+                        int count = (int)v.Value;
+                        Debug.Assert(count >= 0);
+                        docCount++;
+                        ordCount += count;
+
+                        long lastOrd = -1;
+                        for (int i = 0; i < count; i++)
+                        {
+                            ordIterator.MoveNext();
+                            long? o = ordIterator.Current;
+                            Debug.Assert(o != null);
+                            long ord = o.Value;
+                            Debug.Assert(ord >= 0 && ord < valueCount);
+                            Debug.Assert(ord > lastOrd, "ord=" + ord + ",lastOrd=" + lastOrd);
+                            seenOrds.Set(ord);
+                            lastOrd = ord;
+                        }
                     }
+                    Debug.Assert(ordIterator.MoveNext() == false);
+
+                    Debug.Assert(docCount == MaxDoc);
+                    Debug.Assert(seenOrds.Cardinality() == valueCount);
+                    CheckIterator(values.GetEnumerator(), valueCount, false);
+                    CheckIterator(docToOrdCount.GetEnumerator(), MaxDoc, false);
+                    CheckIterator(ords.GetEnumerator(), ordCount, false);
+                    @in.AddSortedSetField(field, values, docToOrdCount, ords);
                 }
-                Debug.Assert(ordIterator.MoveNext() == false);
-
-                Debug.Assert(docCount == MaxDoc);
-                Debug.Assert(seenOrds.Cardinality() == valueCount);
-                CheckIterator(values.GetEnumerator(), valueCount, false);
-                CheckIterator(docToOrdCount.GetEnumerator(), MaxDoc, false);
-                CheckIterator(ords.GetEnumerator(), ordCount, false);
-                @in.AddSortedSetField(field, values, docToOrdCount, ords);
             }
 
             protected override void Dispose(bool disposing)
@@ -246,32 +248,39 @@ namespace Lucene.Net.Codecs.Asserting
 
         private static void CheckIterator<T>(IEnumerator<T> iterator, long expectedSize, bool allowNull)
         {
-            for (long i = 0; i < expectedSize; i++)
+            try
             {
-                bool hasNext = iterator.MoveNext();
-                Debug.Assert(hasNext);
-                T v = iterator.Current;
-                Debug.Assert(allowNull || v != null);
-                try
+                for (long i = 0; i < expectedSize; i++)
                 {
-                    iterator.Reset();
-                    throw new InvalidOperationException("broken iterator (supports remove): " + iterator);
+                    bool hasNext = iterator.MoveNext();
+                    Debug.Assert(hasNext);
+                    T v = iterator.Current;
+                    Debug.Assert(allowNull || v != null);
+                    try
+                    {
+                        iterator.Reset();
+                        throw new InvalidOperationException("broken iterator (supports remove): " + iterator);
+                    }
+                    catch (System.NotSupportedException)
+                    {
+                        // ok
+                    }
                 }
-                catch (System.NotSupportedException)
+                Debug.Assert(!iterator.MoveNext());
+                /*try
                 {
-                    // ok
+                  //iterator.next();
+                  throw new InvalidOperationException("broken iterator (allows next() when hasNext==false) " + iterator);
                 }
+                catch (Exception)
+                {
+                  // ok
+                }*/
             }
-            Debug.Assert(!iterator.MoveNext());
-            /*try
+            finally
             {
-              //iterator.next();
-              throw new InvalidOperationException("broken iterator (allows next() when hasNext==false) " + iterator);
+                iterator.Dispose();
             }
-            catch (Exception)
-            {
-              // ok
-            }*/
         }
 
         internal class AssertingDocValuesProducer : DocValuesProducer
diff --git a/src/Lucene.Net.TestFramework/Codecs/MissingOrdRemapper.cs b/src/Lucene.Net.TestFramework/Codecs/MissingOrdRemapper.cs
index 87c3afe..3b0c253 100644
--- a/src/Lucene.Net.TestFramework/Codecs/MissingOrdRemapper.cs
+++ b/src/Lucene.Net.TestFramework/Codecs/MissingOrdRemapper.cs
@@ -56,17 +56,17 @@ namespace Lucene.Net.Codecs
 
             private class IteratorAnonymousInnerClassHelper : IEnumerator<BytesRef>
             {
-                private readonly IterableAnonymousInnerClassHelper OuterInstance;
+                private readonly IterableAnonymousInnerClassHelper outerInstance;
 
                 public IteratorAnonymousInnerClassHelper(IterableAnonymousInnerClassHelper outerInstance)
                 {
-                    this.OuterInstance = outerInstance;
+                    this.outerInstance = outerInstance;
                     seenEmpty = false;
                     @in = outerInstance.Iterable.GetEnumerator();
                 }
 
                 private bool seenEmpty;
-                private IEnumerator<BytesRef> @in;
+                private readonly IEnumerator<BytesRef> @in;
                 private BytesRef current;
 
                 public bool MoveNext()
@@ -104,6 +104,7 @@ namespace Lucene.Net.Codecs
 
                 public void Dispose()
                 {
+                    @in.Dispose();
                 }
             }
         }
@@ -136,15 +137,15 @@ namespace Lucene.Net.Codecs
 
             private class IteratorAnonymousInnerClassHelper2 : IEnumerator<long?>
             {
-                private readonly IterableAnonymousInnerClassHelper2 OuterInstance;
+                private readonly IterableAnonymousInnerClassHelper2 outerInstance;
 
                 public IteratorAnonymousInnerClassHelper2(IterableAnonymousInnerClassHelper2 outerInstance)
                 {
-                    this.OuterInstance = outerInstance;
+                    this.outerInstance = outerInstance;
                     @in = outerInstance.Iterable.GetEnumerator();
                 }
 
-                private IEnumerator<long?> @in;
+                private readonly IEnumerator<long?> @in;
                 private long current;
 
                 public bool MoveNext()
@@ -178,6 +179,7 @@ namespace Lucene.Net.Codecs
 
                 public void Dispose()
                 {
+                    @in.Dispose();
                 }
             }
         }
@@ -210,15 +212,15 @@ namespace Lucene.Net.Codecs
 
             private class IteratorAnonymousInnerClassHelper3 : IEnumerator<long?>
             {
-                private readonly IterableAnonymousInnerClassHelper3 OuterInstance;
+                private readonly IterableAnonymousInnerClassHelper3 outerInstance;
 
                 public IteratorAnonymousInnerClassHelper3(IterableAnonymousInnerClassHelper3 outerInstance)
                 {
-                    this.OuterInstance = outerInstance;
+                    this.outerInstance = outerInstance;
                     @in = outerInstance.Iterable.GetEnumerator();
                 }
 
-                private IEnumerator<long?> @in;
+                private readonly IEnumerator<long?> @in;
                 private long current;
 
                 public bool MoveNext()
@@ -251,6 +253,7 @@ namespace Lucene.Net.Codecs
 
                 public void Dispose()
                 {
+                    @in.Dispose();
                 }
             }
         }
diff --git a/src/Lucene.Net.TestFramework/Index/FieldFilterAtomicReader.cs b/src/Lucene.Net.TestFramework/Index/FieldFilterAtomicReader.cs
index e3e66dc..5fa7296 100644
--- a/src/Lucene.Net.TestFramework/Index/FieldFilterAtomicReader.cs
+++ b/src/Lucene.Net.TestFramework/Index/FieldFilterAtomicReader.cs
@@ -74,7 +74,8 @@ namespace Lucene.Net.Index
             f = new FieldFilterFields(this, f);
             // we need to check for emptyness, so we can return
             // null:
-            return f.GetEnumerator().MoveNext() ? f : null;
+            using (var iter = f.GetEnumerator())
+                return iter.MoveNext() ? f : null;
         }
 
         public override void Document(int docID, StoredFieldVisitor visitor)
diff --git a/src/Lucene.Net.TestFramework/JavaCompatibility/SystemTypesHelpers.cs b/src/Lucene.Net.TestFramework/JavaCompatibility/SystemTypesHelpers.cs
index 0cf1daf..af700cc 100644
--- a/src/Lucene.Net.TestFramework/JavaCompatibility/SystemTypesHelpers.cs
+++ b/src/Lucene.Net.TestFramework/JavaCompatibility/SystemTypesHelpers.cs
@@ -251,18 +251,18 @@ namespace Lucene.Net
 
             if (s.Count > list.Count())
             {
-                for (var i = list.GetEnumerator(); i.MoveNext();)
-                    modified |= s.Remove(i.Current);
+                foreach (var item in list)
+                    modified |= s.Remove(item);
             }
             else
             {
                 List<T> toRemove = new List<T>();
 
-                for (var i = s.GetEnumerator(); i.MoveNext();)
+                foreach (var item in s)
                 {
-                    if (list.Contains(i.Current))
+                    if (list.Contains(item))
                     {
-                        toRemove.Add(i.Current);
+                        toRemove.Add(item);
                     }
                 }
 
diff --git a/src/Lucene.Net.TestFramework/Store/MockDirectoryWrapper.cs b/src/Lucene.Net.TestFramework/Store/MockDirectoryWrapper.cs
index c8063a6..25af9f3 100644
--- a/src/Lucene.Net.TestFramework/Store/MockDirectoryWrapper.cs
+++ b/src/Lucene.Net.TestFramework/Store/MockDirectoryWrapper.cs
@@ -292,108 +292,110 @@ namespace Lucene.Net.Store
                 OpenFiles = new Dictionary<string, int>();
                 OpenFilesForWrite = new HashSet<string>();
                 OpenFilesDeleted = new HashSet<string>();
-                IEnumerator<string> it = UnSyncedFiles.GetEnumerator();
-                UnSyncedFiles = new HashSet<string>();
-                // first force-close all files, so we can corrupt on windows etc.
-                // clone the file map, as these guys want to remove themselves on close.
-                var m = new IdentityHashMap<IDisposable, Exception>(OpenFileHandles);
-                foreach (IDisposable f in m.Keys)
+                using (IEnumerator<string> it = UnSyncedFiles.GetEnumerator())
                 {
-                    try
+                    UnSyncedFiles = new HashSet<string>();
+                    // first force-close all files, so we can corrupt on windows etc.
+                    // clone the file map, as these guys want to remove themselves on close.
+                    var m = new IdentityHashMap<IDisposable, Exception>(OpenFileHandles);
+                    foreach (IDisposable f in m.Keys)
                     {
-                        f.Dispose();
-                    }
+                        try
+                        {
+                            f.Dispose();
+                        }
 #pragma warning disable 168
-                    catch (Exception ignored)
+                        catch (Exception ignored)
 #pragma warning restore 168
-                    {
-                        //Debug.WriteLine("Crash(): f.Dispose() FAILED for {0}:\n{1}", f.ToString(), ignored.ToString());
-                    }
-                }
-
-                while (it.MoveNext())
-                {
-                    string name = it.Current;
-                    int damage = RandomState.Next(5);
-                    string action = null;
-
-                    if (damage == 0)
-                    {
-                        action = "deleted";
-                        DeleteFile(name, true);
-                    }
-                    else if (damage == 1)
-                    {
-                        action = "zeroed";
-                        // Zero out file entirely
-                        long length = FileLength(name);
-                        var zeroes = new byte[256];
-                        long upto = 0;
-                        using (IndexOutput @out = m_input.CreateOutput(name, LuceneTestCase.NewIOContext(RandomState)))
                         {
-                            while (upto < length)
-                            {
-                                var limit = (int)Math.Min(length - upto, zeroes.Length);
-                                @out.WriteBytes(zeroes, 0, limit);
-                                upto += limit;
-                            }
+                            //Debug.WriteLine("Crash(): f.Dispose() FAILED for {0}:\n{1}", f.ToString(), ignored.ToString());
                         }
                     }
-                    else if (damage == 2)
+
+                    while (it.MoveNext())
                     {
-                        action = "partially truncated";
-                        // Partially Truncate the file:
+                        string name = it.Current;
+                        int damage = RandomState.Next(5);
+                        string action = null;
 
-                        // First, make temp file and copy only half this
-                        // file over:
-                        string tempFileName;
-                        while (true)
+                        if (damage == 0)
+                        {
+                            action = "deleted";
+                            DeleteFile(name, true);
+                        }
+                        else if (damage == 1)
                         {
-                            tempFileName = "" + RandomState.Next();
-                            if (!LuceneTestCase.SlowFileExists(m_input, tempFileName))
+                            action = "zeroed";
+                            // Zero out file entirely
+                            long length = FileLength(name);
+                            var zeroes = new byte[256];
+                            long upto = 0;
+                            using (IndexOutput @out = m_input.CreateOutput(name, LuceneTestCase.NewIOContext(RandomState)))
                             {
-                                break;
+                                while (upto < length)
+                                {
+                                    var limit = (int)Math.Min(length - upto, zeroes.Length);
+                                    @out.WriteBytes(zeroes, 0, limit);
+                                    upto += limit;
+                                }
                             }
                         }
-                        using (IndexOutput tempOut = m_input.CreateOutput(tempFileName, LuceneTestCase.NewIOContext(RandomState)))
+                        else if (damage == 2)
                         {
-                            using (IndexInput ii = m_input.OpenInput(name, LuceneTestCase.NewIOContext(RandomState)))
+                            action = "partially truncated";
+                            // Partially Truncate the file:
+
+                            // First, make temp file and copy only half this
+                            // file over:
+                            string tempFileName;
+                            while (true)
                             {
-                                tempOut.CopyBytes(ii, ii.Length / 2);
+                                tempFileName = "" + RandomState.Next();
+                                if (!LuceneTestCase.SlowFileExists(m_input, tempFileName))
+                                {
+                                    break;
+                                }
+                            }
+                            using (IndexOutput tempOut = m_input.CreateOutput(tempFileName, LuceneTestCase.NewIOContext(RandomState)))
+                            {
+                                using (IndexInput ii = m_input.OpenInput(name, LuceneTestCase.NewIOContext(RandomState)))
+                                {
+                                    tempOut.CopyBytes(ii, ii.Length / 2);
+                                }
                             }
-                        }
 
-                        // Delete original and copy bytes back:
-                        DeleteFile(name, true);
+                            // Delete original and copy bytes back:
+                            DeleteFile(name, true);
 
-                        using (IndexOutput @out = m_input.CreateOutput(name, LuceneTestCase.NewIOContext(RandomState)))
+                            using (IndexOutput @out = m_input.CreateOutput(name, LuceneTestCase.NewIOContext(RandomState)))
+                            {
+                                using (IndexInput ii = m_input.OpenInput(tempFileName, LuceneTestCase.NewIOContext(RandomState)))
+                                {
+                                    @out.CopyBytes(ii, ii.Length);
+                                }
+                            }
+                            DeleteFile(tempFileName, true);
+                        }
+                        else if (damage == 3)
                         {
-                            using (IndexInput ii = m_input.OpenInput(tempFileName, LuceneTestCase.NewIOContext(RandomState)))
+                            // The file survived intact:
+                            action = "didn't change";
+                        }
+                        else
+                        {
+                            action = "fully truncated";
+                            // Totally truncate the file to zero bytes
+                            DeleteFile(name, true);
+                            using (IndexOutput @out = m_input.CreateOutput(name, LuceneTestCase.NewIOContext(RandomState)))
                             {
-                                @out.CopyBytes(ii, ii.Length);
+                                @out.Length = 0;
                             }
                         }
-                        DeleteFile(tempFileName, true);
-                    }
-                    else if (damage == 3)
-                    {
-                        // The file survived intact:
-                        action = "didn't change";
-                    }
-                    else
-                    {
-                        action = "fully truncated";
-                        // Totally truncate the file to zero bytes
-                        DeleteFile(name, true);
-                        using (IndexOutput @out = m_input.CreateOutput(name, LuceneTestCase.NewIOContext(RandomState)))
+                        if (LuceneTestCase.VERBOSE)
                         {
-                            @out.Length = 0;
+                            Console.WriteLine("MockDirectoryWrapper: " + action + " unsynced file: " + name);
                         }
                     }
-                    if (LuceneTestCase.VERBOSE)
-                    {
-                        Console.WriteLine("MockDirectoryWrapper: " + action + " unsynced file: " + name);
-                    }
                 }
             }
         }
@@ -928,12 +930,7 @@ namespace Lucene.Net.Store
                     if (OpenFiles.Count > 0)
                     {
                         // print the first one as its very verbose otherwise
-                        Exception cause = null;
-                        IEnumerator<Exception> stacktraces = OpenFileHandles.Values.GetEnumerator();
-                        if (stacktraces.MoveNext())
-                        {
-                            cause = stacktraces.Current;
-                        }
+                        Exception cause = OpenFileHandles.Values.FirstOrDefault();
 
                         // RuntimeException instead ofSystem.IO.IOException because
                         // super() does not throwSystem.IO.IOException currently:
diff --git a/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs b/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
index 45eb5a4..eff930c 100644
--- a/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
+++ b/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
@@ -1946,17 +1946,18 @@ namespace Lucene.Net.Util
             }
             AssertFieldStatisticsEquals(info, leftFields, rightFields);
 
-            IEnumerator<string> leftEnum = leftFields.GetEnumerator();
-            IEnumerator<string> rightEnum = rightFields.GetEnumerator();
-
-            while (leftEnum.MoveNext())
+            using (IEnumerator<string> leftEnum = leftFields.GetEnumerator())
+            using (IEnumerator<string> rightEnum = rightFields.GetEnumerator())
             {
-                string field = leftEnum.Current;
-                rightEnum.MoveNext();
-                Assert.AreEqual(field, rightEnum.Current, info);
-                AssertTermsEquals(info, leftReader, leftFields.GetTerms(field), rightFields.GetTerms(field), deep);
+                while (leftEnum.MoveNext())
+                {
+                    string field = leftEnum.Current;
+                    rightEnum.MoveNext();
+                    Assert.AreEqual(field, rightEnum.Current, info);
+                    AssertTermsEquals(info, leftReader, leftFields.GetTerms(field), rightFields.GetTerms(field), deep);
+                }
+                Assert.IsFalse(rightEnum.MoveNext());
             }
-            Assert.IsFalse(rightEnum.MoveNext());
         }
 
         /// <summary>
@@ -2410,14 +2411,16 @@ namespace Lucene.Net.Util
                 leftDoc.Fields.Sort(comp);
                 rightDoc.Fields.Sort(comp);
 
-                var leftIterator = leftDoc.GetEnumerator();
-                var rightIterator = rightDoc.GetEnumerator();
-                while (leftIterator.MoveNext())
+                using (var leftIterator = leftDoc.GetEnumerator())
+                using (var rightIterator = rightDoc.GetEnumerator())
                 {
-                    Assert.IsTrue(rightIterator.MoveNext(), info);
-                    AssertStoredFieldEquals(info, leftIterator.Current, rightIterator.Current);
+                    while (leftIterator.MoveNext())
+                    {
+                        Assert.IsTrue(rightIterator.MoveNext(), info);
+                        AssertStoredFieldEquals(info, leftIterator.Current, rightIterator.Current);
+                    }
+                    Assert.IsFalse(rightIterator.MoveNext(), info);
                 }
-                Assert.IsFalse(rightIterator.MoveNext(), info);
             }
         }
 
diff --git a/src/Lucene.Net/Index/CoalescedUpdates.cs b/src/Lucene.Net/Index/CoalescedUpdates.cs
index 5ce47a9..7b0e21b 100644
--- a/src/Lucene.Net/Index/CoalescedUpdates.cs
+++ b/src/Lucene.Net/Index/CoalescedUpdates.cs
@@ -134,6 +134,7 @@ namespace Lucene.Net.Index
 
                 public void Dispose()
                 {
+                    iter.Dispose();
                 }
 
                 public bool MoveNext()
diff --git a/src/Lucene.Net/Index/IndexWriter.cs b/src/Lucene.Net/Index/IndexWriter.cs
index 4984d97..7009d45 100644
--- a/src/Lucene.Net/Index/IndexWriter.cs
+++ b/src/Lucene.Net/Index/IndexWriter.cs
@@ -558,7 +558,6 @@ namespace Lucene.Net.Index
                 lock (this)
                 {
                     Exception priorE = null;
-                    IEnumerator<KeyValuePair<SegmentCommitInfo, ReadersAndUpdates>> it = readerMap.GetEnumerator();
 
                     // LUCENENET specific - Since an enumerator doesn't allow you to delete 
                     // immediately, keep track of which elements we have iterated over so
@@ -566,9 +565,9 @@ namespace Lucene.Net.Index
                     // end of the block.
                     IList<KeyValuePair<SegmentCommitInfo, ReadersAndUpdates>> toDelete = new List<KeyValuePair<SegmentCommitInfo, ReadersAndUpdates>>();
 
-                    while (it.MoveNext())
+                    foreach (var pair in readerMap)
                     {
-                        ReadersAndUpdates rld = it.Current.Value;
+                        ReadersAndUpdates rld = pair.Value;
 
                         try
                         {
@@ -612,7 +611,7 @@ namespace Lucene.Net.Index
                         // so we store the elements that are iterated over and
                         // delete as soon as we are done iterating (whether
                         // that is because of an exception or not).
-                        toDelete.Add(it.Current);
+                        toDelete.Add(pair);
 
                         // NOTE: it is allowed that these decRefs do not
                         // actually close the SRs; this happens when a
diff --git a/src/Lucene.Net/Search/BooleanQuery.cs b/src/Lucene.Net/Search/BooleanQuery.cs
index 80ae085..8f7404c 100644
--- a/src/Lucene.Net/Search/BooleanQuery.cs
+++ b/src/Lucene.Net/Search/BooleanQuery.cs
@@ -341,49 +341,50 @@ namespace Lucene.Net.Search
                 float sum = 0.0f;
                 bool fail = false;
                 int shouldMatchCount = 0;
-                IEnumerator<BooleanClause> cIter = outerInstance.clauses.GetEnumerator();
-                for (IEnumerator<Weight> wIter = m_weights.GetEnumerator(); wIter.MoveNext(); )
+                using (IEnumerator<BooleanClause> cIter = outerInstance.clauses.GetEnumerator())
                 {
-                    Weight w = wIter.Current;
-                    cIter.MoveNext();
-                    BooleanClause c = cIter.Current;
-                    if (w.GetScorer(context, context.AtomicReader.LiveDocs) == null)
+                    foreach (Weight w in m_weights)
                     {
-                        if (c.IsRequired)
+                        cIter.MoveNext();
+                        BooleanClause c = cIter.Current;
+                        if (w.GetScorer(context, context.AtomicReader.LiveDocs) == null)
                         {
-                            fail = true;
-                            Explanation r = new Explanation(0.0f, "no match on required clause (" + c.Query.ToString() + ")");
-                            sumExpl.AddDetail(r);
+                            if (c.IsRequired)
+                            {
+                                fail = true;
+                                Explanation r = new Explanation(0.0f, "no match on required clause (" + c.Query.ToString() + ")");
+                                sumExpl.AddDetail(r);
+                            }
+                            continue;
                         }
-                        continue;
-                    }
-                    Explanation e = w.Explain(context, doc);
-                    if (e.IsMatch)
-                    {
-                        if (!c.IsProhibited)
+                        Explanation e = w.Explain(context, doc);
+                        if (e.IsMatch)
                         {
-                            sumExpl.AddDetail(e);
-                            sum += e.Value;
-                            coord++;
+                            if (!c.IsProhibited)
+                            {
+                                sumExpl.AddDetail(e);
+                                sum += e.Value;
+                                coord++;
+                            }
+                            else
+                            {
+                                Explanation r = new Explanation(0.0f, "match on prohibited clause (" + c.Query.ToString() + ")");
+                                r.AddDetail(e);
+                                sumExpl.AddDetail(r);
+                                fail = true;
+                            }
+                            if (c.Occur == Occur_e.SHOULD)
+                            {
+                                shouldMatchCount++;
+                            }
                         }
-                        else
+                        else if (c.IsRequired)
                         {
-                            Explanation r = new Explanation(0.0f, "match on prohibited clause (" + c.Query.ToString() + ")");
+                            Explanation r = new Explanation(0.0f, "no match on required clause (" + c.Query.ToString() + ")");
                             r.AddDetail(e);
                             sumExpl.AddDetail(r);
                             fail = true;
                         }
-                        if (c.Occur == Occur_e.SHOULD)
-                        {
-                            shouldMatchCount++;
-                        }
-                    }
-                    else if (c.IsRequired)
-                    {
-                        Explanation r = new Explanation(0.0f, "no match on required clause (" + c.Query.ToString() + ")");
-                        r.AddDetail(e);
-                        sumExpl.AddDetail(r);
-                        fail = true;
                     }
                 }
                 if (fail)
@@ -429,33 +430,35 @@ namespace Lucene.Net.Search
 
                 IList<BulkScorer> prohibited = new List<BulkScorer>();
                 IList<BulkScorer> optional = new List<BulkScorer>();
-                IEnumerator<BooleanClause> cIter = outerInstance.clauses.GetEnumerator();
-                foreach (Weight w in m_weights)
-                {
-                    cIter.MoveNext();
-                    BooleanClause c = cIter.Current;
-                    BulkScorer subScorer = w.GetBulkScorer(context, false, acceptDocs);
-                    if (subScorer == null)
+                using (IEnumerator<BooleanClause> cIter = outerInstance.clauses.GetEnumerator())
+                { 
+                    foreach (Weight w in m_weights)
                     {
-                        if (c.IsRequired)
+                        cIter.MoveNext();
+                        BooleanClause c = cIter.Current;
+                        BulkScorer subScorer = w.GetBulkScorer(context, false, acceptDocs);
+                        if (subScorer == null)
                         {
-                            return null;
+                            if (c.IsRequired)
+                            {
+                                return null;
+                            }
+                        }
+                        else if (c.IsRequired)
+                        {
+                            // TODO: there are some cases where BooleanScorer
+                            // would handle conjunctions faster than
+                            // BooleanScorer2...
+                            return base.GetBulkScorer(context, scoreDocsInOrder, acceptDocs);
+                        }
+                        else if (c.IsProhibited)
+                        {
+                            prohibited.Add(subScorer);
+                        }
+                        else
+                        {
+                            optional.Add(subScorer);
                         }
-                    }
-                    else if (c.IsRequired)
-                    {
-                        // TODO: there are some cases where BooleanScorer
-                        // would handle conjunctions faster than
-                        // BooleanScorer2...
-                        return base.GetBulkScorer(context, scoreDocsInOrder, acceptDocs);
-                    }
-                    else if (c.IsProhibited)
-                    {
-                        prohibited.Add(subScorer);
-                    }
-                    else
-                    {
-                        optional.Add(subScorer);
                     }
                 }
 
diff --git a/src/Lucene.Net/Search/MultiPhraseQuery.cs b/src/Lucene.Net/Search/MultiPhraseQuery.cs
index 0a68b64..5e36a95 100644
--- a/src/Lucene.Net/Search/MultiPhraseQuery.cs
+++ b/src/Lucene.Net/Search/MultiPhraseQuery.cs
@@ -396,12 +396,10 @@ namespace Lucene.Net.Search
 
             buffer.Append("\"");
             int k = 0;
-            IEnumerator<Term[]> i = termArrays.GetEnumerator();
             int? lastPos = -1;
             bool first = true;
-            while (i.MoveNext())
+            foreach (Term[] terms in termArrays)
             {
-                Term[] terms = i.Current;
                 int? position = positions[k];
                 if (first)
                 {
@@ -546,10 +544,8 @@ namespace Lucene.Net.Search
             internal DocsQueue(ICollection<DocsAndPositionsEnum> docsEnums)
                 : base(docsEnums.Count)
             {
-                IEnumerator<DocsAndPositionsEnum> i = docsEnums.GetEnumerator();
-                while (i.MoveNext())
+                foreach (DocsAndPositionsEnum postings in docsEnums)
                 {
-                    DocsAndPositionsEnum postings = i.Current;
                     if (postings.NextDoc() != DocIdSetIterator.NO_MORE_DOCS)
                     {
                         Add(postings);
diff --git a/src/Lucene.Net/Search/Payloads/PayloadNearQuery.cs b/src/Lucene.Net/Search/Payloads/PayloadNearQuery.cs
index 60fcba0..f4dc779 100644
--- a/src/Lucene.Net/Search/Payloads/PayloadNearQuery.cs
+++ b/src/Lucene.Net/Search/Payloads/PayloadNearQuery.cs
@@ -87,11 +87,9 @@ namespace Lucene.Net.Search.Payloads
         {
             StringBuilder buffer = new StringBuilder();
             buffer.Append("payloadNear([");
-            IEnumerator<SpanQuery> i = m_clauses.GetEnumerator();
             bool hasCommaSpace = false;
-            while (i.MoveNext())
+            foreach (SpanQuery clause in m_clauses)
             {
-                SpanQuery clause = i.Current;
                 buffer.Append(clause.ToString(field));
                 buffer.Append(", ");
                 hasCommaSpace = true;
diff --git a/src/Lucene.Net/Search/Payloads/PayloadSpanUtil.cs b/src/Lucene.Net/Search/Payloads/PayloadSpanUtil.cs
index db74e74..57281e9 100644
--- a/src/Lucene.Net/Search/Payloads/PayloadSpanUtil.cs
+++ b/src/Lucene.Net/Search/Payloads/PayloadSpanUtil.cs
@@ -114,10 +114,9 @@ namespace Lucene.Net.Search.Payloads
             }
             else if (query is DisjunctionMaxQuery)
             {
-                IEnumerator<Query> enumerator = ((DisjunctionMaxQuery)query).GetEnumerator();
-                while (enumerator.MoveNext())
+                foreach (var q in ((DisjunctionMaxQuery)query))
                 {
-                    QueryToSpanQuery(enumerator.Current, payloads);
+                    QueryToSpanQuery(q, payloads);
                 }
             }
             else if (query is MultiPhraseQuery)
diff --git a/src/Lucene.Net/Search/Spans/SpanNearQuery.cs b/src/Lucene.Net/Search/Spans/SpanNearQuery.cs
index 9b6449e..5ea2a87 100644
--- a/src/Lucene.Net/Search/Spans/SpanNearQuery.cs
+++ b/src/Lucene.Net/Search/Spans/SpanNearQuery.cs
@@ -129,11 +129,9 @@ namespace Lucene.Net.Search.Spans
         {
             StringBuilder buffer = new StringBuilder();
             buffer.Append("SpanNear([");
-            IEnumerator<SpanQuery> i = m_clauses.GetEnumerator();
             bool isFirst = true;
-            while (i.MoveNext())
+            foreach (SpanQuery clause in m_clauses)
             {
-                SpanQuery clause = i.Current;
                 if (!isFirst)
                 {
                     buffer.Append(", ");
diff --git a/src/Lucene.Net/Search/Spans/SpanOrQuery.cs b/src/Lucene.Net/Search/Spans/SpanOrQuery.cs
index 0893ca9..f55f8aa 100644
--- a/src/Lucene.Net/Search/Spans/SpanOrQuery.cs
+++ b/src/Lucene.Net/Search/Spans/SpanOrQuery.cs
@@ -134,11 +134,9 @@ namespace Lucene.Net.Search.Spans
         {
             StringBuilder buffer = new StringBuilder();
             buffer.Append("spanOr([");
-            IEnumerator<SpanQuery> i = clauses.GetEnumerator();
             bool first = true;
-            while (i.MoveNext())
+            foreach (SpanQuery clause in clauses)
             {
-                SpanQuery clause = i.Current;
                 if (!first) buffer.Append(", ");
                 buffer.Append(clause.ToString(field));
                 first = false;
@@ -241,10 +239,9 @@ namespace Lucene.Net.Search.Spans
             private bool InitSpanQueue(int target)
             {
                 queue = new SpanQueue(outerInstance, outerInstance.clauses.Count);
-                IEnumerator<SpanQuery> i = outerInstance.clauses.GetEnumerator();
-                while (i.MoveNext())
+                foreach (var clause in outerInstance.clauses)
                 {
-                    Spans spans = i.Current.GetSpans(context, acceptDocs, termContexts);
+                    Spans spans = clause.GetSpans(context, acceptDocs, termContexts);
                     cost += spans.GetCost();
                     if (((target == -1) && spans.Next()) || ((target != -1) && spans.SkipTo(target)))
                     {
diff --git a/src/Lucene.Net/Search/Spans/SpanPayloadCheckQuery.cs b/src/Lucene.Net/Search/Spans/SpanPayloadCheckQuery.cs
index c9928ad..53b1487 100644
--- a/src/Lucene.Net/Search/Spans/SpanPayloadCheckQuery.cs
+++ b/src/Lucene.Net/Search/Spans/SpanPayloadCheckQuery.cs
@@ -62,16 +62,18 @@ namespace Lucene.Net.Search.Spans
                 if (candidate.Count == m_payloadToMatch.Count)
                 {
                     //TODO: check the byte arrays are the same
-                    var toMatchIter = m_payloadToMatch.GetEnumerator();
-                    //check each of the byte arrays, in order
-                    //hmm, can't rely on order here
-                    foreach (var candBytes in candidate)
+                    using (var toMatchIter = m_payloadToMatch.GetEnumerator())
                     {
-                        toMatchIter.MoveNext();
-                        //if one is a mismatch, then return false
-                        if (Arrays.Equals(candBytes, toMatchIter.Current) == false)
+                        //check each of the byte arrays, in order
+                        //hmm, can't rely on order here
+                        foreach (var candBytes in candidate)
                         {
-                            return AcceptStatus.NO;
+                            toMatchIter.MoveNext();
+                            //if one is a mismatch, then return false
+                            if (Arrays.Equals(candBytes, toMatchIter.Current) == false)
+                            {
+                                return AcceptStatus.NO;
+                            }
                         }
                     }
                     //we've verified all the bytes
diff --git a/src/Lucene.Net/Support/HashMap.cs b/src/Lucene.Net/Support/HashMap.cs
index db8723e..f01b6ee 100644
--- a/src/Lucene.Net/Support/HashMap.cs
+++ b/src/Lucene.Net/Support/HashMap.cs
@@ -166,21 +166,23 @@ namespace Lucene.Net.Support
 
             try
             {
-                var i = GetEnumerator();
-                while (i.MoveNext())
+                using (var i = GetEnumerator())
                 {
-                    KeyValuePair<TKey, TValue> e = i.Current;
-                    TKey key = e.Key;
-                    TValue value = e.Value;
-                    if (value == null)
+                    while (i.MoveNext())
                     {
-                        if (!(m[key] == null && m.ContainsKey(key)))
-                            return false;
-                    }
-                    else
-                    {
-                        if (!value.Equals(m[key]))
-                            return false;
+                        KeyValuePair<TKey, TValue> e = i.Current;
+                        TKey key = e.Key;
+                        TValue value = e.Value;
+                        if (value == null)
+                        {
+                            if (!(m[key] == null && m.ContainsKey(key)))
+                                return false;
+                        }
+                        else
+                        {
+                            if (!value.Equals(m[key]))
+                                return false;
+                        }
                     }
                 }
             }
@@ -199,31 +201,35 @@ namespace Lucene.Net.Support
         public override int GetHashCode()
         {
             int h = 0;
-            var i = GetEnumerator();
-            while (i.MoveNext())
-                h += i.Current.GetHashCode();
+            using (var i = GetEnumerator())
+            {
+                while (i.MoveNext())
+                    h += i.Current.GetHashCode();
+            }
             return h;
         }
 
         public override string ToString()
         {
-            var i = GetEnumerator();
-            if (!i.MoveNext())
-                return "{}";
-
-            StringBuilder sb = new StringBuilder();
-            sb.Append('{');
-            for (;;)
-            {
-                var e = i.Current;
-                TKey key = e.Key;
-                TValue value = e.Value;
-                sb.Append(key);
-                sb.Append('=');
-                sb.Append(value);
+            using (var i = GetEnumerator())
+            {
                 if (!i.MoveNext())
-                    return sb.Append('}').ToString();
-                sb.Append(',').Append(' ');
+                    return "{}";
+
+                StringBuilder sb = new StringBuilder();
+                sb.Append('{');
+                for (; ; )
+                {
+                    var e = i.Current;
+                    TKey key = e.Key;
+                    TValue value = e.Value;
+                    sb.Append(key);
+                    sb.Append('=');
+                    sb.Append(value);
+                    if (!i.MoveNext())
+                        return sb.Append('}').ToString();
+                    sb.Append(',').Append(' ');
+                }
             }
         }
 
diff --git a/src/Lucene.Net/Support/TreeSet.cs b/src/Lucene.Net/Support/TreeSet.cs
index f0d78c7..c1532f3 100644
--- a/src/Lucene.Net/Support/TreeSet.cs
+++ b/src/Lucene.Net/Support/TreeSet.cs
@@ -1150,65 +1150,68 @@ namespace Lucene.Net.Support
 
         void addSorted(SCG.IEnumerable<T> items, bool safe, bool raise)
         {
-            SCG.IEnumerator<T> e = items.GetEnumerator(); ;
-            if (size > 0)
-                throw new InternalException("This can't happen");
-
-            if (!e.MoveNext())
-                return;
+            using (SCG.IEnumerator<T> e = items.GetEnumerator())
+            {
+                if (size > 0)
+                    throw new InternalException("This can't happen");
 
-            //To count theCollect 
-            Node head = new Node(), tail = head;
-            int z = 1;
-            T lastitem = tail.item = e.Current;
+                if (!e.MoveNext())
+                    return;
 
+                //To count theCollect 
+                Node head = new Node(), tail = head;
+                int z = 1;
+                T lastitem = tail.item = e.Current;
 
-            while (e.MoveNext())
-            {
 
-                z++;
-                tail.right = new Node();
-                tail = tail.right;
-                tail.item = e.Current;
-                if (safe)
+                while (e.MoveNext())
                 {
-                    if (comparer.Compare(lastitem, tail.item) >= 0)
-                        throw new ArgumentException("Argument not sorted");
 
-                    lastitem = tail.item;
+                    z++;
+                    tail.right = new Node();
+                    tail = tail.right;
+                    tail.item = e.Current;
+                    if (safe)
+                    {
+                        if (comparer.Compare(lastitem, tail.item) >= 0)
+                            throw new ArgumentException("Argument not sorted");
+
+                        lastitem = tail.item;
+                    }
+                    tail.generation = generation;
+
                 }
-                tail.generation = generation;
 
-            }
 
-            int blackheight = 0, red = z, maxred = 1;
+                int blackheight = 0, red = z, maxred = 1;
 
-            while (maxred <= red)
-            {
-                red -= maxred;
-                maxred <<= 1;
-                blackheight++;
-            }
+                while (maxred <= red)
+                {
+                    red -= maxred;
+                    maxred <<= 1;
+                    blackheight++;
+                }
 
-            root = TreeSet<T>.maketreer(ref head, blackheight, maxred, red);
-            blackdepth = blackheight;
-            size = z;
+                root = TreeSet<T>.maketreer(ref head, blackheight, maxred, red);
+                blackdepth = blackheight;
+                size = z;
 
 
-            if (raise)
-            {
-                if ((ActiveEvents & EventTypeEnum.Added) != 0)
+                if (raise)
                 {
-                    CircularQueue<T> wasAdded = new CircularQueue<T>();
-                    foreach (T item in this)
-                        wasAdded.Enqueue(item);
-                    foreach (T item in wasAdded)
-                        raiseItemsAdded(item, 1);
+                    if ((ActiveEvents & EventTypeEnum.Added) != 0)
+                    {
+                        CircularQueue<T> wasAdded = new CircularQueue<T>();
+                        foreach (T item in this)
+                            wasAdded.Enqueue(item);
+                        foreach (T item in wasAdded)
+                            raiseItemsAdded(item, 1);
+                    }
+                    if ((ActiveEvents & EventTypeEnum.Changed) != 0)
+                        raiseCollectionChanged();
                 }
-                if ((ActiveEvents & EventTypeEnum.Changed) != 0)
-                    raiseCollectionChanged();
+                return;
             }
-            return;
         }
 
         #endregion
@@ -1909,23 +1912,25 @@ namespace Lucene.Net.Support
             if ((ActiveEvents & EventTypeEnum.Removed) != 0)
             {
                 wasRemoved = new CircularQueue<KeyValuePair<T, int>>();
-                SCG.IEnumerator<KeyValuePair<T, int>> ie = ItemMultiplicities().GetEnumerator();
-                foreach (KeyValuePair<T, int> p in t.ItemMultiplicities())
+                using (SCG.IEnumerator<KeyValuePair<T, int>> ie = ItemMultiplicities().GetEnumerator())
                 {
-                    //We know p.Key is in this!
-                    while (ie.MoveNext())
+                    foreach (KeyValuePair<T, int> p in t.ItemMultiplicities())
                     {
-                        if (comparer.Compare(ie.Current.Key, p.Key) == 0)
+                        //We know p.Key is in this!
+                        while (ie.MoveNext())
                         {
+                            if (comparer.Compare(ie.Current.Key, p.Key) == 0)
+                            {
 
-                            break;
+                                break;
+                            }
+                            else
+                                wasRemoved.Enqueue(ie.Current);
                         }
-                        else
-                            wasRemoved.Enqueue(ie.Current);
                     }
+                    while (ie.MoveNext())
+                        wasRemoved.Enqueue(ie.Current);
                 }
-                while (ie.MoveNext())
-                    wasRemoved.Enqueue(ie.Current);
             }
 
             root = t.root;
@@ -1971,50 +1976,52 @@ namespace Lucene.Net.Support
             if (!isValid)
                 throw new ViewDisposedException("Snapshot has been disposed");
             TreeSet<T> res = new TreeSet<T>(comparer);
-            SCG.IEnumerator<T> e = GetEnumerator();
-            Node head = null, tail = null;
-            int z = 0;
-
-            while (e.MoveNext())
+            using (SCG.IEnumerator<T> e = GetEnumerator())
             {
-                T thisitem = e.Current;
+                Node head = null, tail = null;
+                int z = 0;
 
-                if (filter(thisitem))
+                while (e.MoveNext())
                 {
-                    if (head == null)
-                    {
-                        head = tail = new Node();
-                    }
-                    else
+                    T thisitem = e.Current;
+
+                    if (filter(thisitem))
                     {
+                        if (head == null)
+                        {
+                            head = tail = new Node();
+                        }
+                        else
+                        {
 
-                        tail.right = new Node();
-                        tail = tail.right;
-                    }
+                            tail.right = new Node();
+                            tail = tail.right;
+                        }
 
-                    tail.item = thisitem;
-                    z++;
+                        tail.item = thisitem;
+                        z++;
+                    }
                 }
-            }
 
 
-            if (z == 0)
-                return res;
+                if (z == 0)
+                    return res;
 
-            int blackheight = 0, red = z, maxred = 1;
+                int blackheight = 0, red = z, maxred = 1;
 
-            while (maxred <= red)
-            {
-                red -= maxred;
-                maxred <<= 1;
-                blackheight++;
-            }
+                while (maxred <= red)
+                {
+                    red -= maxred;
+                    maxred <<= 1;
+                    blackheight++;
+                }
 
-            res.root = TreeSet<T>.maketreer(ref head, blackheight, maxred, red);
-            res.blackdepth = blackheight;
-            res.size = z;
+                res.root = TreeSet<T>.maketreer(ref head, blackheight, maxred, red);
+                res.blackdepth = blackheight;
+                res.size = z;
 
-            return res;
+                return res;
+            }
         }
 
 
@@ -2037,52 +2044,55 @@ namespace Lucene.Net.Support
             if (size == 0)
                 return res;
 
-            SCG.IEnumerator<T> e = GetEnumerator();
-            TreeSet<V>.Node head = null, tail = null;
-            V oldv = default(V);
-            int z = 0;
-
-            while (e.MoveNext())
+            using (SCG.IEnumerator<T> e = GetEnumerator())
             {
-                T thisitem = e.Current;
+                TreeSet<V>.Node head = null, tail = null;
+                V oldv = default(V);
+                int z = 0;
 
-                V newv = mapper(thisitem);
-
-                if (head == null)
+                while (e.MoveNext())
                 {
-                    head = tail = new TreeSet<V>.Node();
-                    z++;
-                }
-                else
-                {
-                    int comp = c.Compare(oldv, newv);
+                    T thisitem = e.Current;
+
+                    V newv = mapper(thisitem);
 
-                    if (comp >= 0)
+                    if (head == null)
+                    {
+                        head = tail = new TreeSet<V>.Node();
+                        z++;
+                    }
+                    else
+                    {
+                        int comp = c.Compare(oldv, newv);
 
-                        throw new ArgumentException("mapper not monotonic");
+                        if (comp >= 0)
 
-                    tail.right = new TreeSet<V>.Node();
-                    tail = tail.right;
-                    z++;
+                            throw new ArgumentException("mapper not monotonic");
+
+                        tail.right = new TreeSet<V>.Node();
+                        tail = tail.right;
+                        z++;
+                    }
+
+                    tail.item = oldv = newv;
                 }
 
-                tail.item = oldv = newv;
-            }
 
 
-            int blackheight = 0, red = z, maxred = 1;
+                int blackheight = 0, red = z, maxred = 1;
 
-            while (maxred <= red)
-            {
-                red -= maxred;
-                maxred <<= 1;
-                blackheight++;
-            }
+                while (maxred <= red)
+                {
+                    red -= maxred;
+                    maxred <<= 1;
+                    blackheight++;
+                }
 
-            res.root = TreeSet<V>.maketreer(ref head, blackheight, maxred, red);
-            res.blackdepth = blackheight;
-            res.size = size;
-            return res;
+                res.root = TreeSet<V>.maketreer(ref head, blackheight, maxred, red);
+                res.blackdepth = blackheight;
+                res.size = size;
+                return res;
+            }
         }
 
 
diff --git a/src/Lucene.Net/Util/AttributeSource.cs b/src/Lucene.Net/Util/AttributeSource.cs
index b46386a..f3b8b66 100644
--- a/src/Lucene.Net/Util/AttributeSource.cs
+++ b/src/Lucene.Net/Util/AttributeSource.cs
@@ -407,16 +407,18 @@ namespace Lucene.Net.Util
                 return s;
             }
             var c = s = currentState[0] = new State();
-            var it = attributeImpls.Values().GetEnumerator();
-            it.MoveNext();
-            c.attribute = it.Current.Value;
-            while (it.MoveNext())
+            using (var it = attributeImpls.Values().GetEnumerator())
             {
-                c.next = new State();
-                c = c.next;
+                it.MoveNext();
                 c.attribute = it.Current.Value;
+                while (it.MoveNext())
+                {
+                    c.next = new State();
+                    c = c.next;
+                    c.attribute = it.Current.Value;
+                }
+                return s;
             }
-            return s;
         }
 
         /// <summary>
diff --git a/src/Lucene.Net/Util/Automaton/BasicOperations.cs b/src/Lucene.Net/Util/Automaton/BasicOperations.cs
index d6efcb9..6169edc 100644
--- a/src/Lucene.Net/Util/Automaton/BasicOperations.cs
+++ b/src/Lucene.Net/Util/Automaton/BasicOperations.cs
@@ -3,6 +3,7 @@ using System;
 using System.Collections;
 using System.Collections.Generic;
 using System.Diagnostics;
+using System.Linq;
 using System.Text;
 
 /*
@@ -1034,9 +1035,7 @@ namespace Lucene.Net.Util.Automaton
             }
             if (a.initial.accept && a.initial.NumTransitions == 1)
             {
-                var iter = a.initial.GetTransitions().GetEnumerator();
-                iter.MoveNext();
-                Transition t = iter.Current; ;
+                Transition t = a.initial.GetTransitions().First();
                 return t.to == a.initial && t.min == Character.MIN_CODE_POINT && t.max == Character.MAX_CODE_POINT;
             }
             return false;
diff --git a/src/Lucene.Net/Util/Automaton/LevenshteinAutomata.cs b/src/Lucene.Net/Util/Automaton/LevenshteinAutomata.cs
index f6e82f7..94ce273 100644
--- a/src/Lucene.Net/Util/Automaton/LevenshteinAutomata.cs
+++ b/src/Lucene.Net/Util/Automaton/LevenshteinAutomata.cs
@@ -80,11 +80,13 @@ namespace Lucene.Net.Util.Automaton
                 set.Add(v);
             }
             alphabet = new int[set.Count];
-            IEnumerator<int> iterator = set.GetEnumerator();
-            for (int i = 0; i < alphabet.Length; i++)
+            using (IEnumerator<int> iterator = set.GetEnumerator())
             {
-                iterator.MoveNext();
-                alphabet[i] = iterator.Current;
+                for (int i = 0; i < alphabet.Length; i++)
+                {
+                    iterator.MoveNext();
+                    alphabet[i] = iterator.Current;
+                }
             }
 
             rangeLower = new int[alphabet.Length + 2];
diff --git a/src/Lucene.Net/Util/Automaton/SpecialOperations.cs b/src/Lucene.Net/Util/Automaton/SpecialOperations.cs
index b312fb9..17b83cf 100644
--- a/src/Lucene.Net/Util/Automaton/SpecialOperations.cs
+++ b/src/Lucene.Net/Util/Automaton/SpecialOperations.cs
@@ -124,9 +124,7 @@ namespace Lucene.Net.Util.Automaton
                 visited.Add(s);
                 if (!s.accept && s.NumTransitions == 1)
                 {
-                    var iter = s.GetTransitions().GetEnumerator();
-                    iter.MoveNext();
-                    Transition t = iter.Current;
+                    Transition t = s.GetTransitions().First();
                     if (t.min == t.max && !visited.Contains(t.to))
                     {
                         b.AppendCodePoint(t.min);
@@ -157,9 +155,7 @@ namespace Lucene.Net.Util.Automaton
                 visited.Add(s);
                 if (!s.accept && s.NumTransitions == 1)
                 {
-                    var iter = s.GetTransitions().GetEnumerator();
-                    iter.MoveNext();
-                    Transition t = iter.Current;
+                    Transition t = s.GetTransitions().First();
 
                     if (t.min == t.max && !visited.Contains(t.to))
                     {
diff --git a/src/Lucene.Net/Util/CloseableThreadLocal.cs b/src/Lucene.Net/Util/CloseableThreadLocal.cs
index 0328a4a..706334d 100644
--- a/src/Lucene.Net/Util/CloseableThreadLocal.cs
+++ b/src/Lucene.Net/Util/CloseableThreadLocal.cs
@@ -122,9 +122,8 @@ namespace Lucene.Net.Util
                 List<Thread> Removed = new List<Thread>();
                 try
                 {
-                    for (IEnumerator<Thread> it = hardRefs.Keys.GetEnumerator(); it.MoveNext(); )
+                    foreach (Thread t in hardRefs.Keys)
                     {
-                        Thread t = it.Current;
                         if (!t.IsAlive)
                         {
                             Removed.Add(t);
diff --git a/src/Lucene.Net/Util/MergedIterator.cs b/src/Lucene.Net/Util/MergedIterator.cs
index 668bfdf..7ee721c 100644
--- a/src/Lucene.Net/Util/MergedIterator.cs
+++ b/src/Lucene.Net/Util/MergedIterator.cs
@@ -43,9 +43,12 @@ namespace Lucene.Net.Util
     ///       are returned isn't defined.</description></item>
     /// </list>
     /// <para/>
+    /// The caller is responsible for disposing the <see cref="IEnumerator{T}"/> instances that are passed
+    /// into the constructor, <see cref="MergedIterator{T}"/> doesn't do it automatically.
+    /// <para/>
     /// @lucene.internal
     /// </summary>
-    public sealed class MergedIterator<T> : IEnumerator<T>
+    public sealed class MergedIterator<T> : IEnumerator<T> // LUCENENET TODO: API - rename MergedEnumerator
         where T : IComparable<T>
     {
         private readonly TermMergeQueue<T> queue;
diff --git a/src/Lucene.Net/Util/WAH8DocIdSet.cs b/src/Lucene.Net/Util/WAH8DocIdSet.cs
index b5abda8..c1470e0 100644
--- a/src/Lucene.Net/Util/WAH8DocIdSet.cs
+++ b/src/Lucene.Net/Util/WAH8DocIdSet.cs
@@ -2,6 +2,7 @@ using Lucene.Net.Support;
 using System;
 using System.Collections.Generic;
 using System.Diagnostics;
+using System.Linq;
 
 namespace Lucene.Net.Util
 {
@@ -127,9 +128,7 @@ namespace Lucene.Net.Util
                 case 0:
                     throw new System.ArgumentException("There must be at least one set to intersect");
                 case 1:
-                    var iter = docIdSets.GetEnumerator();
-                    iter.MoveNext();
-                    return iter.Current;
+                    return docIdSets.First();
             }
             // The logic below is similar to ConjunctionScorer
             int numSets = docIdSets.Count;
@@ -202,9 +201,7 @@ namespace Lucene.Net.Util
                     return EMPTY;
 
                 case 1:
-                    var iter = docIdSets.GetEnumerator();
-                    iter.MoveNext();
-                    return iter.Current;
+                    return docIdSets.First();
             }
             // The logic below is very similar to DisjunctionScorer
             int numSets = docIdSets.Count;
diff --git a/src/dotnet/tools/lucene-cli/SourceCode/ConsolePager.cs b/src/dotnet/tools/lucene-cli/SourceCode/ConsolePager.cs
index ef17101..71d3f16 100644
--- a/src/dotnet/tools/lucene-cli/SourceCode/ConsolePager.cs
+++ b/src/dotnet/tools/lucene-cli/SourceCode/ConsolePager.cs
@@ -51,7 +51,7 @@ namespace Lucene.Net.Cli.SourceCode
     ///     </item>
     /// </list>
     /// </summary>
-    public class ConsolePager : IDisposable
+    public sealed class ConsolePager : IDisposable
     {
         private readonly MultipleFileLineEnumerator enumerator;
 


[lucenenet] 15/42: BUG: Lucene.Net.Index.CheckIndex - Fixed issue with converting int to string using ambient context on VersionInfo comparison

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit 78daef78c64e3be095b5d02b7a5764d4e9208e93
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Wed Jul 31 18:29:31 2019 +0700

    BUG: Lucene.Net.Index.CheckIndex - Fixed issue with converting int to string using ambient context on VersionInfo comparison
---
 src/Lucene.Net/Index/CheckIndex.cs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/Lucene.Net/Index/CheckIndex.cs b/src/Lucene.Net/Index/CheckIndex.cs
index 67ad0ec..a562df6 100644
--- a/src/Lucene.Net/Index/CheckIndex.cs
+++ b/src/Lucene.Net/Index/CheckIndex.cs
@@ -543,7 +543,7 @@ namespace Lucene.Net.Index
             }
 
             // find the oldest and newest segment versions
-            string oldest = Convert.ToString(int.MaxValue), newest = Convert.ToString(int.MinValue);
+            string oldest = Convert.ToString(int.MaxValue, CultureInfo.InvariantCulture), newest = Convert.ToString(int.MinValue, CultureInfo.InvariantCulture);
             string oldSegs = null;
             bool foundNonNullVersion = false;
             IComparer<string> versionComparer = StringHelper.VersionComparer;


[lucenenet] 36/42: Lucene.Net.TestFramework.Util.LuceneTestCase: Added try catch blocks to write stack traces to the console if exceptions occur during OneTimeSetUp or OneTimeTearDown

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit ab138b130862ea3c697fb9666284f62dec793b43
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Tue Aug 6 08:33:05 2019 +0700

    Lucene.Net.TestFramework.Util.LuceneTestCase: Added try catch blocks to write stack traces to the console if exceptions occur during OneTimeSetUp or OneTimeTearDown
---
 .../Util/LuceneTestCase.cs                         | 35 +++++++++++++++++-----
 1 file changed, 28 insertions(+), 7 deletions(-)

diff --git a/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs b/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
index ad36742..8db12de 100644
--- a/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
+++ b/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
@@ -630,19 +630,40 @@ namespace Lucene.Net.Util
         [OneTimeSetUp]
         public virtual void BeforeClass()
         {
-            // Setup the factories
-            Codec.SetCodecFactory(TEST_CODEC_FACTORY);
-            DocValuesFormat.SetDocValuesFormatFactory(TEST_DOCVALUES_FORMAT_FACTORY);
-            PostingsFormat.SetPostingsFormatFactory(TEST_POSTINGS_FORMAT_FACTORY);
+            
+            try
+            {
+                // Setup the factories
+                Codec.SetCodecFactory(TEST_CODEC_FACTORY);
+                DocValuesFormat.SetDocValuesFormatFactory(TEST_DOCVALUES_FORMAT_FACTORY);
+                PostingsFormat.SetPostingsFormatFactory(TEST_POSTINGS_FORMAT_FACTORY);
 
-            ClassEnvRule.Before(this);
+                ClassEnvRule.Before(this);
+            }
+            catch (Exception ex)
+            {
+                // Print the stack trace so we have something to go on if an error occurs here.
+                Console.Write("An exception occurred during BeforeClass: ");
+                Console.WriteLine(ex.ToString());
+                throw;
+            }
         }
 
         [OneTimeTearDown]
         public virtual void AfterClass()
         {
-            ClassEnvRule.After(this);
-            CleanupTemporaryFiles();
+            try
+            {
+                ClassEnvRule.After(this);
+                CleanupTemporaryFiles();
+            }
+            catch (Exception ex)
+            {
+                // Print the stack trace so we have something to go on if an error occurs here.
+                Console.Write("An exception occurred during AfterClass: ");
+                Console.WriteLine(ex.ToString());
+                throw;
+            }
         }
 
         // -----------------------------------------------------------------


[lucenenet] 27/42: SWEEP: Added StringComparison.Ordinal to all string.Equals() calls, as per https://docs.microsoft.com/en-us/dotnet/standard/base-types/best-practices-strings#recommendations-for-string-usage

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit c300581a499700ff621eb1ae6825a63d5c26c983
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Mon Aug 5 07:58:56 2019 +0700

    SWEEP: Added StringComparison.Ordinal to all string.Equals() calls, as per https://docs.microsoft.com/en-us/dotnet/standard/base-types/best-practices-strings#recommendations-for-string-usage
---
 .../Analysis/Br/BrazilianStemFilter.cs             |  3 +-
 .../Analysis/Br/BrazilianStemmer.cs                |  7 +--
 .../Analysis/CommonGrams/CommonGramsQueryFilter.cs |  5 ++-
 .../Analysis/Compound/Hyphenation/Hyphen.cs        |  5 ++-
 .../Analysis/Compound/Hyphenation/PatternParser.cs | 12 +++---
 .../Analysis/De/GermanStemFilter.cs                |  3 +-
 .../Analysis/De/GermanStemmer.cs                   | 13 +++---
 .../Analysis/En/KStemmer.cs                        |  2 +-
 .../Analysis/Fr/FrenchStemFilter.cs                |  2 +-
 .../Analysis/Hunspell/Dictionary.cs                | 18 ++++----
 .../Analysis/Miscellaneous/PatternAnalyzer.cs      |  2 +-
 .../Miscellaneous/WordDelimiterFilterFactory.cs    | 12 +++---
 .../Analysis/Nl/DutchStemFilter.cs                 |  2 +-
 .../Analysis/No/NorwegianLightStemFilterFactory.cs |  7 +--
 .../No/NorwegianMinimalStemFilterFactory.cs        |  7 +--
 .../Pattern/PatternReplaceFilterFactory.cs         |  3 +-
 .../Payloads/DelimitedPayloadTokenFilterFactory.cs |  9 ++--
 .../Analysis/Payloads/NumericPayloadTokenFilter.cs |  2 +-
 .../Analysis/Sinks/TokenTypeSinkFilter.cs          |  3 +-
 .../Analysis/Snowball/SnowballAnalyzer.cs          |  4 +-
 .../Analysis/Synonym/FSTSynonymFilterFactory.cs    |  4 +-
 .../Analysis/Synonym/SynonymFilterFactory.cs       |  2 +-
 .../Analysis/Synonym/WordnetSynonymParser.cs       |  2 +-
 .../Analysis/Util/AbstractAnalysisFactory.cs       |  2 +-
 .../Tartarus/Snowball/SnowballProgram.cs           |  3 +-
 .../Icu/ICUNormalizer2CharFilterFactory.cs         |  2 +-
 .../Analysis/Icu/ICUNormalizer2FilterFactory.cs    |  2 +-
 .../Analysis/Icu/ICUTransformFilterFactory.cs      |  2 +-
 .../GraphvizFormatter.cs                           |  3 +-
 .../Tools/BinaryDictionaryWriter.cs                | 12 +++---
 .../DoubleMetaphoneFilter.cs                       |  7 +--
 .../Language/AbstractCaverphone .cs                |  4 +-
 .../Language/Bm/Lang.cs                            |  2 +-
 .../Language/Bm/PhoneticEngine.cs                  |  2 +-
 .../Language/Bm/Rule.cs                            |  4 +-
 .../Language/ColognePhonetic.cs                    |  3 +-
 .../Language/DaitchMokotoffSoundex.cs              |  2 +-
 .../Language/DoubleMetaphone.cs                    |  4 +-
 .../Language/Metaphone.cs                          |  5 ++-
 src/Lucene.Net.Analysis.Phonetic/PhoneticFilter.cs |  2 +-
 .../Egothor.Stemmer/Compile.cs                     |  4 +-
 .../Egothor.Stemmer/DiffIt.cs                      |  4 +-
 .../ByTask/Tasks/CreateIndexTask.cs                |  2 +-
 .../ByTask/Tasks/WriteLineDocTask.cs               |  2 +-
 .../Support/Sax/Ext/Attributes2Impl.cs             |  4 +-
 .../Support/Sax/Helpers/NamespaceSupport.cs        | 14 +++---
 .../Support/TagSoup/Element.cs                     |  3 +-
 .../Support/TagSoup/ElementType.cs                 |  8 ++--
 .../Support/TagSoup/PYXScanner.cs                  |  3 +-
 src/Lucene.Net.Benchmark/Support/TagSoup/Parser.cs | 48 ++++++++++-----------
 .../Support/TagSoup/XMLWriter.cs                   | 50 +++++++++++-----------
 .../SimpleText/SimpleTextFieldInfosReader.cs       |  2 +-
 src/Lucene.Net.Codecs/SimpleText/SimpleTextUtil.cs |  5 ++-
 src/Lucene.Net.Demo/IndexFiles.cs                  |  2 +-
 src/Lucene.Net.Demo/SearchFiles.cs                 | 14 +++---
 src/Lucene.Net.Facet/FacetsConfig.cs               |  2 +-
 src/Lucene.Net.Facet/LabelAndValue.cs              |  2 +-
 src/Lucene.Net.Facet/Range/RangeFacetCounts.cs     |  5 ++-
 .../DefaultSortedSetDocValuesReaderState.cs        |  3 +-
 src/Lucene.Net.Facet/Taxonomy/CategoryPath.cs      |  2 +-
 .../Taxonomy/Directory/DirectoryTaxonomyReader.cs  |  2 +-
 src/Lucene.Net.Facet/Taxonomy/FacetLabel.cs        |  2 +-
 .../Taxonomy/PrintTaxonomyStats.cs                 |  2 +-
 src/Lucene.Net.Facet/Taxonomy/TaxonomyFacets.cs    |  4 +-
 .../Highlight/QueryTermExtractor.cs                |  2 +-
 .../Highlight/WeightedSpanTermExtractor.cs         |  4 +-
 .../PostingsHighlight/MultiTermHighlighting.cs     |  8 ++--
 .../VectorHighlight/FieldQuery.cs                  |  4 +-
 src/Lucene.Net.Join/TermsIncludingScoreQuery.cs    |  3 +-
 .../MemoryIndex.MemoryIndexReader.cs               |  2 +-
 src/Lucene.Net.Misc/Document/LazyDocument.cs       |  2 +-
 src/Lucene.Net.Misc/Index/CompoundFileExtractor.cs |  4 +-
 src/Lucene.Net.Misc/Index/IndexSplitter.cs         |  8 ++--
 .../Index/MultiPassIndexSplitter.cs                |  6 +--
 .../Index/Sorter/SortingMergePolicy.cs             |  2 +-
 src/Lucene.Net.Misc/Misc/HighFreqTerms.cs          |  2 +-
 .../Function/ValueSources/DocFreqValueSource.cs    |  2 +-
 .../Function/ValueSources/FieldCacheSource.cs      |  3 +-
 .../ValueSources/JoinDocFreqValueSource.cs         |  2 +-
 .../Function/ValueSources/LiteralValueSource.cs    |  3 +-
 .../Function/ValueSources/MultiFloatFunction.cs    |  3 +-
 .../Function/ValueSources/NormValueSource.cs       |  3 +-
 .../Function/ValueSources/OrdFieldSource.cs        |  3 +-
 .../Function/ValueSources/ReverseOrdFieldSource.cs |  3 +-
 .../Function/ValueSources/SingleFunction.cs        |  3 +-
 .../ValueSources/SumTotalTermFreqValueSource.cs    |  3 +-
 .../ValueSources/TotalTermFreqValueSource.cs       |  3 +-
 src/Lucene.Net.Queries/Mlt/MoreLikeThisQuery.cs    |  5 ++-
 src/Lucene.Net.Queries/TermsFilter.cs              |  4 +-
 src/Lucene.Net.QueryParser/Classic/QueryParser.cs  |  4 +-
 .../Classic/QueryParserBase.cs                     |  4 +-
 .../ComplexPhrase/ComplexPhraseQueryParser.cs      |  6 +--
 .../Flexible/Core/Nodes/QueryNodeImpl.cs           |  2 +-
 .../Standard/Nodes/AbstractRangeQueryNode.cs       |  4 +-
 .../Processors/MatchAllDocsQueryNodeProcessor.cs   |  5 ++-
 .../Processors/OpenRangeQueryNodeProcessor.cs      |  5 ++-
 .../Surround/Query/RewriteQuery.cs                 |  2 +-
 .../Surround/Query/SrndQuery.cs                    |  2 +-
 .../Xml/Builders/BooleanQueryBuilder.cs            |  2 +-
 src/Lucene.Net.QueryParser/Xml/DOMUtils.cs         | 12 +++---
 .../IndexAndTaxonomyRevision.cs                    |  4 +-
 .../IndexReplicationHandler.cs                     |  4 +-
 src/Lucene.Net.Replicator/IndexRevision.cs         |  4 +-
 src/Lucene.Net.Replicator/RevisionFile.cs          |  2 +-
 src/Lucene.Net.Sandbox/Queries/DuplicateFilter.cs  |  3 +-
 src/Lucene.Net.Sandbox/Queries/SlowFuzzyQuery.cs   |  2 +-
 src/Lucene.Net.Spatial/DisjointSpatialFilter.cs    |  2 +-
 .../Prefix/AbstractPrefixTreeFilter.cs             |  3 +-
 src/Lucene.Net.Spatial/Prefix/Tree/Cell.cs         |  2 +-
 .../Serialized/SerializedDVStrategy.cs             |  2 +-
 src/Lucene.Net.Suggest/Spell/SpellChecker.cs       |  2 +-
 .../Suggest/Analyzing/AnalyzingInfixSuggester.cs   |  2 +-
 .../CharFilters/HTMLStripCharFilterTest.cs         |  2 +-
 .../Analysis/Core/TestStopFilter.cs                |  2 +-
 .../Analysis/Hunspell/TestAllDictionaries.cs       |  2 +-
 .../Analysis/Hunspell/TestAllDictionaries2.cs      |  2 +-
 .../Miscellaneous/TestASCIIFoldingFilter.cs        |  3 +-
 .../TestLucene47WordDelimiterFilter.cs             |  2 +-
 .../Miscellaneous/TestWordDelimiterFilter.cs       |  2 +-
 .../Pattern/TestPatternReplaceCharFilter.cs        |  4 +-
 .../Payloads/NumericPayloadTokenFilterTest.cs      |  8 ++--
 .../Payloads/TypeAsPayloadTokenFilterTest.cs       |  5 ++-
 .../Analysis/Sinks/TestTeeSinkTokenFilter.cs       |  4 +-
 .../Analysis/Sinks/TokenTypeSinkTokenizerTest.cs   |  9 ++--
 .../Analysis/Synonym/TestSynonymMap.cs             |  4 +-
 .../Analysis/Util/TestBufferedCharFilter.cs        | 14 +++---
 .../Language/Bm/BeiderMorseEncoderTest.cs          |  2 +-
 .../Language/Bm/PhoneticEngineRegressionTest.cs    |  2 +-
 .../Egothor.Stemmer/TestCompile.cs                 |  2 +-
 .../ByTask/TestPerfTasksLogic.cs                   | 10 ++---
 .../Range/TestRangeFacetCounts.cs                  |  2 +-
 .../SortedSet/TestSortedSetDocValuesFacets.cs      |  2 +-
 .../Directory/TestDirectoryTaxonomyWriter.cs       |  2 +-
 .../Taxonomy/TestTaxonomyCombined.cs               |  2 +-
 .../Taxonomy/TestTaxonomyFacetCounts.cs            |  2 +-
 .../Taxonomy/TestTaxonomyFacetSumValueSource.cs    |  2 +-
 src/Lucene.Net.Tests.Facet/TestDrillDownQuery.cs   |  2 +-
 src/Lucene.Net.Tests.Facet/TestDrillSideways.cs    |  6 +--
 .../Highlight/HighlighterTest.cs                   |  8 ++--
 .../PostingsHighlight/TestPostingsHighlighter.cs   |  2 +-
 .../VectorHighlight/SimpleFragmentsBuilderTest.cs  |  4 +-
 src/Lucene.Net.Tests.Join/TestBlockJoin.cs         |  2 +-
 src/Lucene.Net.Tests.Join/TestJoinUtil.cs          |  2 +-
 .../Document/TestLazyDocument.cs                   | 24 +++++------
 .../Index/Sorter/SorterTestBase.cs                 |  2 +-
 .../Misc/SweetSpotSimilarityTest.cs                |  8 ++--
 .../CommonTermsQueryTest.cs                        |  2 +-
 .../Function/TestOrdValues.cs                      |  3 +-
 .../Function/TestValueSources.cs                   |  4 +-
 .../Classic/TestMultiAnalyzer.cs                   |  8 ++--
 .../Classic/TestMultiFieldQueryParser.cs           |  2 +-
 .../Classic/TestQueryParser.cs                     |  2 +-
 .../Precedence/TestPrecedenceQueryParser.cs        | 14 +++---
 .../Flexible/Spans/UniqueFieldAttributeImpl.cs     |  2 +-
 .../Flexible/Standard/TestMultiAnalyzerQPHelper.cs |  8 ++--
 .../Flexible/Standard/TestMultiFieldQPHelper.cs    |  2 +-
 .../Flexible/Standard/TestNumericQueryParser.cs    | 10 ++---
 .../Flexible/Standard/TestQPHelper.cs              | 18 ++++----
 .../Util/QueryParserTestBase.cs                    | 18 ++++----
 .../IndexAndTaxonomyRevisionTest.cs                |  4 +-
 .../IndexRevisionTest.cs                           |  2 +-
 src/Lucene.Net.Tests.Spatial/TestTestFramework.cs  |  2 +-
 .../Spell/TestDirectSpellChecker.cs                |  2 +-
 .../Spell/TestLuceneDictionary.cs                  |  7 +--
 .../Spell/TestSpellChecker.cs                      |  2 +-
 .../Spell/TestWordBreakSpellChecker.cs             | 42 +++++++++---------
 .../Suggest/Analyzing/AnalyzingSuggesterTest.cs    |  2 +-
 .../Suggest/Analyzing/FuzzySuggesterTest.cs        |  2 +-
 .../Suggest/Fst/FSTCompletionTest.cs               |  4 +-
 .../Analysis/TestGraphTokenizers.cs                |  2 +-
 .../Analysis/TrivialLookaheadFilter.cs             |  3 +-
 .../Codecs/Lucene3x/TestSurrogates.cs              |  8 ++--
 .../Codecs/PerField/TestPerFieldDocValuesFormat.cs |  2 +-
 .../Codecs/PerField/TestPerFieldPostingsFormat2.cs | 14 +++---
 .../Document/TestBinaryDocument.cs                 |  8 ++--
 src/Lucene.Net.Tests/Document/TestDateTools.cs     |  4 +-
 src/Lucene.Net.Tests/Document/TestDocument.cs      | 35 +++++++--------
 src/Lucene.Net.Tests/Index/Test2BTerms.cs          |  2 +-
 src/Lucene.Net.Tests/Index/TestAddIndexes.cs       |  6 +--
 .../Index/TestAllFilesHaveChecksumFooter.cs        |  2 +-
 .../Index/TestAllFilesHaveCodecHeader.cs           |  4 +-
 src/Lucene.Net.Tests/Index/TestBagOfPositions.cs   |  2 +-
 src/Lucene.Net.Tests/Index/TestBagOfPostings.cs    |  2 +-
 .../Index/TestConcurrentMergeScheduler.cs          |  2 +-
 .../Index/TestCrashCausesCorruptIndex.cs           |  2 +-
 .../Index/TestDocInverterPerFieldErrorInfo.cs      |  2 +-
 src/Lucene.Net.Tests/Index/TestDocumentWriter.cs   | 11 ++---
 .../Index/TestFilterAtomicReader.cs                |  2 +-
 src/Lucene.Net.Tests/Index/TestIndexFileDeleter.cs |  2 +-
 src/Lucene.Net.Tests/Index/TestIndexWriter.cs      |  4 +-
 .../Index/TestIndexWriterCommit.cs                 |  6 +--
 .../Index/TestIndexWriterConfig.cs                 |  4 +-
 .../Index/TestIndexWriterDelete.cs                 |  6 +--
 .../Index/TestIndexWriterExceptions.cs             | 12 +++---
 .../Index/TestIndexWriterMerging.cs                |  2 +-
 .../Index/TestIndexWriterOnDiskFull.cs             |  2 +-
 .../Index/TestIndexWriterOnJRECrash.cs             |  2 +-
 .../Index/TestIndexWriterReader.cs                 | 14 ++++--
 src/Lucene.Net.Tests/Index/TestLazyProxSkipping.cs |  6 +--
 src/Lucene.Net.Tests/Index/TestLongPostings.cs     |  5 ++-
 src/Lucene.Net.Tests/Index/TestNoMergePolicy.cs    |  3 +-
 src/Lucene.Net.Tests/Index/TestNorms.cs            |  2 +-
 .../Index/TestPerSegmentDeletes.cs                 |  2 +-
 .../Index/TestPersistentSnapshotDeletionPolicy.cs  |  2 +-
 src/Lucene.Net.Tests/Index/TestPostingsOffsets.cs  |  4 +-
 src/Lucene.Net.Tests/Index/TestRollingUpdates.cs   |  2 +-
 src/Lucene.Net.Tests/Index/TestSegmentReader.cs    |  4 +-
 src/Lucene.Net.Tests/Index/TestTermsEnum2.cs       |  3 +-
 .../Search/Payloads/PayloadHelper.cs               |  4 +-
 .../Search/Payloads/TestPayloadTermQuery.cs        |  5 ++-
 .../Search/Similarities/TestSimilarityBase.cs      |  2 +-
 .../Search/TestDisjunctionMaxQuery.cs              |  4 +-
 .../Search/TestDocValuesScoring.cs                 |  3 +-
 src/Lucene.Net.Tests/Search/TestFieldCache.cs      |  4 +-
 .../Search/TestMultiThreadTermVectors.cs           |  2 +-
 .../Search/TestPositionIncrement.cs                |  2 +-
 src/Lucene.Net.Tests/Search/TestPrefixRandom.cs    |  3 +-
 src/Lucene.Net.Tests/Search/TestRegexpQuery.cs     |  3 +-
 src/Lucene.Net.Tests/Search/TestRegexpRandom2.cs   |  2 +-
 src/Lucene.Net.Tests/Search/TestSearchAfter.cs     |  4 +-
 .../Search/TestSimilarityProvider.cs               |  3 +-
 .../Support/IO/TestStreamTokenizer.cs              | 18 ++++----
 .../Support/TestDictionaryExtensions.cs            |  8 ++--
 src/Lucene.Net.Tests/Support/TestEquatableList.cs  |  2 +-
 src/Lucene.Net.Tests/Support/TestEquatableSet.cs   |  2 +-
 .../Support/TestStringTokenizer.cs                 |  4 +-
 src/Lucene.Net.Tests/TestExternalCodecs.cs         |  4 +-
 .../Util/Automaton/TestLevenshteinAutomata.cs      |  2 +-
 src/Lucene.Net.Tests/Util/Fst/TestFSTs.cs          | 18 ++++----
 src/Lucene.Net.Tests/Util/TestFilterIterator.cs    |  8 ++--
 src/Lucene.Net.Tests/Util/TestQueryBuilder.cs      |  5 ++-
 src/Lucene.Net/Analysis/Token.cs                   |  3 +-
 src/Lucene.Net/Index/UpgradeIndexMergePolicy.cs    |  2 +-
 src/Lucene.Net/Support/Arrays.cs                   |  2 +-
 src/Lucene.Net/Support/AssemblyExtensions.cs       |  6 +--
 235 files changed, 624 insertions(+), 560 deletions(-)

diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Br/BrazilianStemFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/Br/BrazilianStemFilter.cs
index 0b94e4c..f26e496 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Br/BrazilianStemFilter.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Br/BrazilianStemFilter.cs
@@ -1,4 +1,5 @@
 using Lucene.Net.Analysis.TokenAttributes;
+using System;
 using System.Collections.Generic;
 
 namespace Lucene.Net.Analysis.Br
@@ -61,7 +62,7 @@ namespace Lucene.Net.Analysis.Br
                 {
                     string s = stemmer.Stem(term);
                     // If not stemmed, don't waste the time adjusting the token.
-                    if ((s != null) && !s.Equals(term))
+                    if ((s != null) && !s.Equals(term, StringComparison.Ordinal))
                     {
                         termAtt.SetEmpty().Append(s);
                     }
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Br/BrazilianStemmer.cs b/src/Lucene.Net.Analysis.Common/Analysis/Br/BrazilianStemmer.cs
index 3d35ee5..95c7ad2 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Br/BrazilianStemmer.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Br/BrazilianStemmer.cs
@@ -1,4 +1,5 @@
-using System.Globalization;
+using System;
+using System.Globalization;
 
 namespace Lucene.Net.Analysis.Br
 {
@@ -331,7 +332,7 @@ namespace Lucene.Net.Analysis.Br
                 return false;
             }
 
-            return value.Substring(value.Length - suffix.Length).Equals(suffix);
+            return value.Substring(value.Length - suffix.Length).Equals(suffix, StringComparison.Ordinal);
         }
 
         /// <summary>
@@ -350,7 +351,7 @@ namespace Lucene.Net.Analysis.Br
 
             vvalue = RemoveSuffix(value, toReplace);
 
-            if (value.Equals(vvalue))
+            if (value.Equals(vvalue, StringComparison.Ordinal))
             {
                 return value;
             }
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/CommonGrams/CommonGramsQueryFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/CommonGrams/CommonGramsQueryFilter.cs
index 2b59887..878a7c9 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/CommonGrams/CommonGramsQueryFilter.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/CommonGrams/CommonGramsQueryFilter.cs
@@ -1,4 +1,5 @@
 using Lucene.Net.Analysis.TokenAttributes;
+using System;
 
 namespace Lucene.Net.Analysis.CommonGrams
 {
@@ -112,7 +113,7 @@ namespace Lucene.Net.Analysis.CommonGrams
 
             exhausted = true;
 
-            if (previous == null || CommonGramsFilter.GRAM_TYPE.Equals(previousType))
+            if (previous == null || CommonGramsFilter.GRAM_TYPE.Equals(previousType, StringComparison.Ordinal))
             {
                 return false;
             }
@@ -137,7 +138,7 @@ namespace Lucene.Net.Analysis.CommonGrams
         {
             get
             {
-                return CommonGramsFilter.GRAM_TYPE.Equals(typeAttribute.Type);
+                return CommonGramsFilter.GRAM_TYPE.Equals(typeAttribute.Type, StringComparison.Ordinal);
             }
         }
     }
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Compound/Hyphenation/Hyphen.cs b/src/Lucene.Net.Analysis.Common/Analysis/Compound/Hyphenation/Hyphen.cs
index 0fb57d9..8fc13cf 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Compound/Hyphenation/Hyphen.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Compound/Hyphenation/Hyphen.cs
@@ -1,4 +1,5 @@
-using System.Text;
+using System;
+using System.Text;
 
 namespace Lucene.Net.Analysis.Compound.Hyphenation
 {
@@ -55,7 +56,7 @@ namespace Lucene.Net.Analysis.Compound.Hyphenation
 
         public override string ToString()
         {
-            if (NoBreak == null && PostBreak == null && PreBreak != null && PreBreak.Equals("-"))
+            if (NoBreak == null && PostBreak == null && PreBreak != null && PreBreak.Equals("-", StringComparison.Ordinal))
             {
                 return "-";
             }
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Compound/Hyphenation/PatternParser.cs b/src/Lucene.Net.Analysis.Common/Analysis/Compound/Hyphenation/PatternParser.cs
index 57617be..f73d675 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Compound/Hyphenation/PatternParser.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Compound/Hyphenation/PatternParser.cs
@@ -402,7 +402,7 @@ namespace Lucene.Net.Analysis.Compound.Hyphenation
             public override object GetEntity(Uri absoluteUri, string role, Type ofObjectToReturn)
             {
                 string dtdFilename = "hyphenation.dtd";
-                if (dtdFilename.Equals(absoluteUri.Segments.LastOrDefault()))
+                if (dtdFilename.Equals(absoluteUri.Segments.LastOrDefault(), StringComparison.Ordinal))
                 {
                     return GetType().GetTypeInfo().Assembly.FindAndGetManifestResourceStream(typeof(PatternParser), dtdFilename);
                 }
@@ -430,7 +430,7 @@ namespace Lucene.Net.Analysis.Compound.Hyphenation
         /// <param name="attrs"> the attributes attached to the element. If there are no attributes, it shall be an empty Attributes object. The value of this object after startElement returns is undefined</param>
         public virtual void StartElement(string uri, string local, string raw, IDictionary<string, string> attrs)
         {
-            if (local.Equals("hyphen-char"))
+            if (local.Equals("hyphen-char", StringComparison.Ordinal))
             {
                 string h = attrs.ContainsKey("value") ? attrs["value"] : null;
                 if (h != null && h.Length == 1)
@@ -438,20 +438,20 @@ namespace Lucene.Net.Analysis.Compound.Hyphenation
                     hyphenChar = h[0];
                 }
             }
-            else if (local.Equals("classes"))
+            else if (local.Equals("classes", StringComparison.Ordinal))
             {
                 currElement = ELEM_CLASSES;
             }
-            else if (local.Equals("patterns"))
+            else if (local.Equals("patterns", StringComparison.Ordinal))
             {
                 currElement = ELEM_PATTERNS;
             }
-            else if (local.Equals("exceptions"))
+            else if (local.Equals("exceptions", StringComparison.Ordinal))
             {
                 currElement = ELEM_EXCEPTIONS;
                 exception = new List<object>();
             }
-            else if (local.Equals("hyphen"))
+            else if (local.Equals("hyphen", StringComparison.Ordinal))
             {
                 if (token.Length > 0)
                 {
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/De/GermanStemFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/De/GermanStemFilter.cs
index cd4291c..1f6240c 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/De/GermanStemFilter.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/De/GermanStemFilter.cs
@@ -1,4 +1,5 @@
 using Lucene.Net.Analysis.TokenAttributes;
+using System;
 
 namespace Lucene.Net.Analysis.De
 {
@@ -63,7 +64,7 @@ namespace Lucene.Net.Analysis.De
                 {
                     string s = stemmer.Stem(term);
                     // If not stemmed, don't waste the time adjusting the token.
-                    if ((s != null) && !s.Equals(term))
+                    if ((s != null) && !s.Equals(term, StringComparison.Ordinal))
                     {
                         termAtt.SetEmpty().Append(s);
                     }
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/De/GermanStemmer.cs b/src/Lucene.Net.Analysis.Common/Analysis/De/GermanStemmer.cs
index 47e9074..4fdd1da 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/De/GermanStemmer.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/De/GermanStemmer.cs
@@ -1,4 +1,5 @@
-using System.Globalization;
+using System;
+using System.Globalization;
 using System.Text;
 
 namespace Lucene.Net.Analysis.De
@@ -98,15 +99,15 @@ namespace Lucene.Net.Analysis.De
             bool doMore = true;
             while (doMore && buffer.Length > 3)
             {
-                if ((buffer.Length + substCount > 5) && buffer.ToString(buffer.Length - 2, buffer.Length - (buffer.Length - 2)).Equals("nd"))
+                if ((buffer.Length + substCount > 5) && buffer.ToString(buffer.Length - 2, buffer.Length - (buffer.Length - 2)).Equals("nd", StringComparison.Ordinal))
                 {
                     buffer.Remove(buffer.Length - 2, buffer.Length - (buffer.Length - 2));
                 }
-                else if ((buffer.Length + substCount > 4) && buffer.ToString(buffer.Length - 2, buffer.Length - (buffer.Length - 2)).Equals("em"))
+                else if ((buffer.Length + substCount > 4) && buffer.ToString(buffer.Length - 2, buffer.Length - (buffer.Length - 2)).Equals("em", StringComparison.Ordinal))
                 {
                     buffer.Remove(buffer.Length - 2, buffer.Length - (buffer.Length - 2));
                 }
-                else if ((buffer.Length + substCount > 4) && buffer.ToString(buffer.Length - 2, buffer.Length - (buffer.Length - 2)).Equals("er"))
+                else if ((buffer.Length + substCount > 4) && buffer.ToString(buffer.Length - 2, buffer.Length - (buffer.Length - 2)).Equals("er", StringComparison.Ordinal))
                 {
                     buffer.Remove(buffer.Length - 2, buffer.Length - (buffer.Length - 2));
                 }
@@ -141,7 +142,7 @@ namespace Lucene.Net.Analysis.De
         private void Optimize(StringBuilder buffer)
         {
             // Additional step for female plurals of professions and inhabitants.
-            if (buffer.Length > 5 && buffer.ToString(buffer.Length - 5, buffer.Length - (buffer.Length - 5)).Equals("erin*"))
+            if (buffer.Length > 5 && buffer.ToString(buffer.Length - 5, buffer.Length - (buffer.Length - 5)).Equals("erin*", StringComparison.Ordinal))
             {
                 buffer.Remove(buffer.Length - 1, 1);
                 Strip(buffer);
@@ -163,7 +164,7 @@ namespace Lucene.Net.Analysis.De
             {
                 for (int c = 0; c < buffer.Length - 3; c++)
                 {
-                    if (buffer.ToString(c, 4).Equals("gege"))
+                    if (buffer.ToString(c, 4).Equals("gege", StringComparison.Ordinal))
                     {
                         buffer.Remove(c, (c + 2) - c);
                         return;
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/En/KStemmer.cs b/src/Lucene.Net.Analysis.Common/Analysis/En/KStemmer.cs
index c446532..3647dd8 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/En/KStemmer.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/En/KStemmer.cs
@@ -2059,7 +2059,7 @@ namespace Lucene.Net.Analysis.En
             // **
 
             //*
-            // if (entry == null) { if (!word.toString().equals(new String(term,0,len)))
+            // if (entry == null) { if (!word.toString().equals(new String(term,0,len), StringComparison.Ordinal))
             // { System.out.println("CASE:" + word.toString() + "," + new
             // String(term,0,len));
             // 
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Fr/FrenchStemFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/Fr/FrenchStemFilter.cs
index b14365b..2c08775 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Fr/FrenchStemFilter.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Fr/FrenchStemFilter.cs
@@ -65,7 +65,7 @@ namespace Lucene.Net.Analysis.Fr
                 {
                     string s = stemmer.Stem(term);
                     // If not stemmed, don't waste the time  adjusting the token.
-                    if ((s != null) && !s.Equals(term))
+                    if ((s != null) && !s.Equals(term, StringComparison.Ordinal))
                     {
                         termAtt.SetEmpty().Append(s);
                     }
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Hunspell/Dictionary.cs b/src/Lucene.Net.Analysis.Common/Analysis/Hunspell/Dictionary.cs
index 55037ff..ba7efaa 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Hunspell/Dictionary.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Hunspell/Dictionary.cs
@@ -303,7 +303,7 @@ namespace Lucene.Net.Analysis.Hunspell
                     // Store the strategy so it can be used when parsing the dic file
                     flagParsingStrategy = GetFlagParsingStrategy(line);
                 }
-                else if (line.Equals(COMPLEXPREFIXES_KEY))
+                else if (line.Equals(COMPLEXPREFIXES_KEY, StringComparison.Ordinal))
                 {
                     complexPrefixes = true; // 2-stage prefix+1-stage suffix instead of 2-stage suffix+1-stage prefix
                 }
@@ -337,7 +337,7 @@ namespace Lucene.Net.Analysis.Hunspell
                     }
                     int num = int.Parse(parts[1], CultureInfo.InvariantCulture);
                     FST<CharsRef> res = ParseConversions(reader, num);
-                    if (type.Equals("ICONV"))
+                    if (type.Equals("ICONV", StringComparison.Ordinal))
                     {
                         iconv = res;
                         needsInputCleaning |= iconv != null;
@@ -409,7 +409,7 @@ namespace Lucene.Net.Analysis.Hunspell
             StringBuilder sb = new StringBuilder();
             string[] args = whitespacePattern.Split(header).TrimEnd();
 
-            bool crossProduct = args[2].Equals("Y");
+            bool crossProduct = args[2].Equals("Y", StringComparison.Ordinal);
 
             int numLines = int.Parse(args[3], CultureInfo.InvariantCulture);
             affixData = ArrayUtil.Grow(affixData, (currentAffix << 3) + (numLines << 3));
@@ -429,7 +429,7 @@ namespace Lucene.Net.Analysis.Hunspell
                 }
 
                 char flag = flagParsingStrategy.ParseFlag(ruleArgs[1]);
-                string strip = ruleArgs[2].Equals("0") ? "" : ruleArgs[2];
+                string strip = ruleArgs[2].Equals("0", StringComparison.Ordinal) ? "" : ruleArgs[2];
                 string affixArg = ruleArgs[3];
                 char[] appendFlags = null;
 
@@ -464,11 +464,11 @@ namespace Lucene.Net.Analysis.Hunspell
                 }
 
                 string regex;
-                if (".".Equals(condition))
+                if (".".Equals(condition, StringComparison.Ordinal))
                 {
                     regex = ".*"; // Zero condition is indicated by dot
                 }
-                else if (condition.Equals(strip))
+                else if (condition.Equals(strip, StringComparison.Ordinal))
                 {
                     regex = ".*"; // TODO: optimize this better:
                                   // if we remove 'strip' from condition, we don't have to append 'strip' to check it...!
@@ -690,15 +690,15 @@ namespace Lucene.Net.Analysis.Hunspell
             }
             string flagType = parts[1];
 
-            if (NUM_FLAG_TYPE.Equals(flagType))
+            if (NUM_FLAG_TYPE.Equals(flagType, StringComparison.Ordinal))
             {
                 return new NumFlagParsingStrategy();
             }
-            else if (UTF8_FLAG_TYPE.Equals(flagType))
+            else if (UTF8_FLAG_TYPE.Equals(flagType, StringComparison.Ordinal))
             {
                 return new SimpleFlagParsingStrategy();
             }
-            else if (LONG_FLAG_TYPE.Equals(flagType))
+            else if (LONG_FLAG_TYPE.Equals(flagType, StringComparison.Ordinal))
             {
                 return new DoubleASCIIFlagParsingStrategy();
             }
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/PatternAnalyzer.cs b/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/PatternAnalyzer.cs
index bc596e2..70e7ce2 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/PatternAnalyzer.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/PatternAnalyzer.cs
@@ -295,7 +295,7 @@ namespace Lucene.Net.Analysis.Miscellaneous
         /// assumes p1 and p2 are not null </summary>
         private static bool EqPattern(Regex p1, Regex p2)
         {
-            return p1 == p2 || (p1.Options == p2.Options && p1.ToString().Equals(p2.ToString()));
+            return p1 == p2 || (p1.Options == p2.Options && p1.ToString().Equals(p2.ToString(), StringComparison.Ordinal));
         }
 
         /// <summary>
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/WordDelimiterFilterFactory.cs b/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/WordDelimiterFilterFactory.cs
index 32600b0..bbf1eed 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/WordDelimiterFilterFactory.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/WordDelimiterFilterFactory.cs
@@ -179,27 +179,27 @@ namespace Lucene.Net.Analysis.Miscellaneous
 
         private byte ParseType(string s)
         {
-            if (s.Equals("LOWER"))
+            if (s.Equals("LOWER", StringComparison.Ordinal))
             {
                 return WordDelimiterFilter.LOWER;
             }
-            else if (s.Equals("UPPER"))
+            else if (s.Equals("UPPER", StringComparison.Ordinal))
             {
                 return WordDelimiterFilter.UPPER;
             }
-            else if (s.Equals("ALPHA"))
+            else if (s.Equals("ALPHA", StringComparison.Ordinal))
             {
                 return WordDelimiterFilter.ALPHA;
             }
-            else if (s.Equals("DIGIT"))
+            else if (s.Equals("DIGIT", StringComparison.Ordinal))
             {
                 return WordDelimiterFilter.DIGIT;
             }
-            else if (s.Equals("ALPHANUM"))
+            else if (s.Equals("ALPHANUM", StringComparison.Ordinal))
             {
                 return WordDelimiterFilter.ALPHANUM;
             }
-            else if (s.Equals("SUBWORD_DELIM"))
+            else if (s.Equals("SUBWORD_DELIM", StringComparison.Ordinal))
             {
                 return WordDelimiterFilter.SUBWORD_DELIM;
             }
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Nl/DutchStemFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/Nl/DutchStemFilter.cs
index 8fd66ac..afb50a2 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Nl/DutchStemFilter.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Nl/DutchStemFilter.cs
@@ -80,7 +80,7 @@ namespace Lucene.Net.Analysis.Nl
                 {
                     string s = stemmer.Stem(term);
                     // If not stemmed, don't waste the time adjusting the token.
-                    if ((s != null) && !s.Equals(term))
+                    if ((s != null) && !s.Equals(term, StringComparison.Ordinal))
                     {
                         termAtt.SetEmpty().Append(s);
                     }
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/No/NorwegianLightStemFilterFactory.cs b/src/Lucene.Net.Analysis.Common/Analysis/No/NorwegianLightStemFilterFactory.cs
index c32716f..b4dfcf9 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/No/NorwegianLightStemFilterFactory.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/No/NorwegianLightStemFilterFactory.cs
@@ -1,4 +1,5 @@
 using Lucene.Net.Analysis.Util;
+using System;
 using System.Collections.Generic;
 
 namespace Lucene.Net.Analysis.No
@@ -41,15 +42,15 @@ namespace Lucene.Net.Analysis.No
               : base(args)
         {
             string variant = Get(args, "variant");
-            if (variant == null || "nb".Equals(variant))
+            if (variant == null || "nb".Equals(variant, StringComparison.Ordinal))
             {
                 flags = NorwegianStandard.BOKMAAL;
             }
-            else if ("nn".Equals(variant))
+            else if ("nn".Equals(variant, StringComparison.Ordinal))
             {
                 flags = NorwegianStandard.NYNORSK;
             }
-            else if ("no".Equals(variant))
+            else if ("no".Equals(variant, StringComparison.Ordinal))
             {
                 flags = NorwegianStandard.BOKMAAL | NorwegianStandard.NYNORSK;
             }
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/No/NorwegianMinimalStemFilterFactory.cs b/src/Lucene.Net.Analysis.Common/Analysis/No/NorwegianMinimalStemFilterFactory.cs
index ac1e68c..42f3dc2 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/No/NorwegianMinimalStemFilterFactory.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/No/NorwegianMinimalStemFilterFactory.cs
@@ -1,4 +1,5 @@
 using Lucene.Net.Analysis.Util;
+using System;
 using System.Collections.Generic;
 
 namespace Lucene.Net.Analysis.No
@@ -41,15 +42,15 @@ namespace Lucene.Net.Analysis.No
             : base(args)
         {
             string variant = Get(args, "variant");
-            if (variant == null || "nb".Equals(variant))
+            if (variant == null || "nb".Equals(variant, StringComparison.Ordinal))
             {
                 flags = NorwegianStandard.BOKMAAL;
             }
-            else if ("nn".Equals(variant))
+            else if ("nn".Equals(variant, StringComparison.Ordinal))
             {
                 flags = NorwegianStandard.NYNORSK;
             }
-            else if ("no".Equals(variant))
+            else if ("no".Equals(variant, StringComparison.Ordinal))
             {
                 flags = NorwegianStandard.BOKMAAL | NorwegianStandard.NYNORSK;
             }
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Pattern/PatternReplaceFilterFactory.cs b/src/Lucene.Net.Analysis.Common/Analysis/Pattern/PatternReplaceFilterFactory.cs
index ec5a4ab..2ee4727 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Pattern/PatternReplaceFilterFactory.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Pattern/PatternReplaceFilterFactory.cs
@@ -1,5 +1,6 @@
 using Lucene.Net.Analysis.Util;
 using Lucene.Net.Support;
+using System;
 using System.Collections.Generic;
 using System.Text.RegularExpressions;
 
@@ -46,7 +47,7 @@ namespace Lucene.Net.Analysis.Pattern
         {
             pattern = GetPattern(args, "pattern");
             replacement = Get(args, "replacement");
-            replaceAll = "all".Equals(Get(args, "replace", Arrays.AsList("all", "first"), "all"));
+            replaceAll = "all".Equals(Get(args, "replace", Arrays.AsList("all", "first"), "all"), StringComparison.Ordinal);
             if (args.Count > 0)
             {
                 throw new System.ArgumentException("Unknown parameters: " + args);
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Payloads/DelimitedPayloadTokenFilterFactory.cs b/src/Lucene.Net.Analysis.Common/Analysis/Payloads/DelimitedPayloadTokenFilterFactory.cs
index 20a85ea..cf51cad 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Payloads/DelimitedPayloadTokenFilterFactory.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Payloads/DelimitedPayloadTokenFilterFactory.cs
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
 using Lucene.Net.Analysis.Util;
 
 namespace Lucene.Net.Analysis.Payloads
@@ -60,15 +61,15 @@ namespace Lucene.Net.Analysis.Payloads
 
         public virtual void Inform(IResourceLoader loader)
         {
-            if (encoderClass.Equals("float"))
+            if (encoderClass.Equals("float", StringComparison.Ordinal))
             {
                 encoder = new SingleEncoder();
             }
-            else if (encoderClass.Equals("integer"))
+            else if (encoderClass.Equals("integer", StringComparison.Ordinal))
             {
                 encoder = new IntegerEncoder();
             }
-            else if (encoderClass.Equals("identity"))
+            else if (encoderClass.Equals("identity", StringComparison.Ordinal))
             {
                 encoder = new IdentityEncoder();
             }
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Payloads/NumericPayloadTokenFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/Payloads/NumericPayloadTokenFilter.cs
index bd730aa..0e4f713 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Payloads/NumericPayloadTokenFilter.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Payloads/NumericPayloadTokenFilter.cs
@@ -50,7 +50,7 @@ namespace Lucene.Net.Analysis.Payloads
         {
             if (m_input.IncrementToken())
             {
-                if (typeAtt.Type.Equals(typeMatch))
+                if (typeAtt.Type.Equals(typeMatch, StringComparison.Ordinal))
                 {
                     payloadAtt.Payload = thePayload;
                 }
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Sinks/TokenTypeSinkFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/Sinks/TokenTypeSinkFilter.cs
index 31e29ae..f473bdc 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Sinks/TokenTypeSinkFilter.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Sinks/TokenTypeSinkFilter.cs
@@ -1,5 +1,6 @@
 using Lucene.Net.Analysis.TokenAttributes;
 using Lucene.Net.Util;
+using System;
 
 namespace Lucene.Net.Analysis.Sinks
 {
@@ -41,7 +42,7 @@ namespace Lucene.Net.Analysis.Sinks
             }
 
             //check to see if this is a Category
-            return (typeToMatch.Equals(typeAtt.Type));
+            return (typeToMatch.Equals(typeAtt.Type, StringComparison.Ordinal));
         }
     }
 }
\ No newline at end of file
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Snowball/SnowballAnalyzer.cs b/src/Lucene.Net.Analysis.Common/Analysis/Snowball/SnowballAnalyzer.cs
index a6d2be2..24e9be9 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Snowball/SnowballAnalyzer.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Snowball/SnowballAnalyzer.cs
@@ -74,12 +74,12 @@ namespace Lucene.Net.Analysis.Snowball
             Tokenizer tokenizer = new StandardTokenizer(matchVersion, reader);
             TokenStream result = new StandardFilter(matchVersion, tokenizer);
             // remove the possessive 's for english stemmers
-            if (matchVersion.OnOrAfter(LuceneVersion.LUCENE_31) && (name.Equals("English") || name.Equals("Porter") || name.Equals("Lovins")))
+            if (matchVersion.OnOrAfter(LuceneVersion.LUCENE_31) && (name.Equals("English", StringComparison.Ordinal) || name.Equals("Porter", StringComparison.Ordinal) || name.Equals("Lovins", StringComparison.Ordinal)))
             {
                 result = new EnglishPossessiveFilter(result);
             }
             // Use a special lowercase filter for turkish, the stemmer expects it.
-            if (matchVersion.OnOrAfter(LuceneVersion.LUCENE_31) && name.Equals("Turkish"))
+            if (matchVersion.OnOrAfter(LuceneVersion.LUCENE_31) && name.Equals("Turkish", StringComparison.Ordinal))
             {
                 result = new TurkishLowerCaseFilter(result);
             }
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Synonym/FSTSynonymFilterFactory.cs b/src/Lucene.Net.Analysis.Common/Analysis/Synonym/FSTSynonymFilterFactory.cs
index 725e498..46c78a9 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Synonym/FSTSynonymFilterFactory.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Synonym/FSTSynonymFilterFactory.cs
@@ -80,11 +80,11 @@ namespace Lucene.Net.Analysis.Synonym
             try
             {
                 string formatClass = format;
-                if (format == null || format.Equals("solr"))
+                if (format == null || format.Equals("solr", StringComparison.Ordinal))
                 {
                     formatClass = typeof(SolrSynonymParser).AssemblyQualifiedName;
                 }
-                else if (format.Equals("wordnet"))
+                else if (format.Equals("wordnet", StringComparison.Ordinal))
                 {
                     formatClass = typeof(WordnetSynonymParser).AssemblyQualifiedName;
                 }
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Synonym/SynonymFilterFactory.cs b/src/Lucene.Net.Analysis.Common/Analysis/Synonym/SynonymFilterFactory.cs
index d08941c..457b729 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Synonym/SynonymFilterFactory.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Synonym/SynonymFilterFactory.cs
@@ -73,7 +73,7 @@ namespace Lucene.Net.Analysis.Synonym
             {
                 // check if you use the new optional arg "format". this makes no sense for the old one, 
                 // as its wired to solr's synonyms format only.
-                if (args.ContainsKey("format") && !args["format"].Equals("solr"))
+                if (args.ContainsKey("format") && !args["format"].Equals("solr", StringComparison.Ordinal))
                 {
                     throw new System.ArgumentException("You must specify luceneMatchVersion >= 3.4 to use alternate synonyms formats");
                 }
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Synonym/WordnetSynonymParser.cs b/src/Lucene.Net.Analysis.Common/Analysis/Synonym/WordnetSynonymParser.cs
index 604cbb8..76ebc5a 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Synonym/WordnetSynonymParser.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Synonym/WordnetSynonymParser.cs
@@ -56,7 +56,7 @@ namespace Lucene.Net.Analysis.Synonym
                     lineNumber++;
                     string synSetID = line.Substring(2, 9);
 
-                    if (!synSetID.Equals(lastSynSetID))
+                    if (!synSetID.Equals(lastSynSetID, StringComparison.Ordinal))
                     {
                         AddInternal(synset, synsetSize);
                         synsetSize = 0;
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Util/AbstractAnalysisFactory.cs b/src/Lucene.Net.Analysis.Common/Analysis/Util/AbstractAnalysisFactory.cs
index a0e4911..0b76dc5 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Util/AbstractAnalysisFactory.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Util/AbstractAnalysisFactory.cs
@@ -334,7 +334,7 @@ namespace Lucene.Net.Analysis.Util
                 args.Remove(name);
                 try
                 {
-                    if (culture.Equals("invariant"))
+                    if (culture.Equals("invariant", StringComparison.Ordinal))
                     {
                         return CultureInfo.InvariantCulture;
                     }
diff --git a/src/Lucene.Net.Analysis.Common/Tartarus/Snowball/SnowballProgram.cs b/src/Lucene.Net.Analysis.Common/Tartarus/Snowball/SnowballProgram.cs
index 2dd5cd4..f2a66a0 100644
--- a/src/Lucene.Net.Analysis.Common/Tartarus/Snowball/SnowballProgram.cs
+++ b/src/Lucene.Net.Analysis.Common/Tartarus/Snowball/SnowballProgram.cs
@@ -417,7 +417,8 @@ namespace Lucene.Net.Tartarus.Snowball
                     try
                     {
                         object resobj = w.Method.Invoke(w.MethodObject, EMPTY_ARGS);
-                        res = resobj.ToString().Equals("true");
+                        // LUCENENET-542: Fixed case-sensitivity problem
+                        res = resobj.ToString().Equals("true", StringComparison.OrdinalIgnoreCase);
                     }
                     catch (TargetInvocationException /*e*/)
                     {
diff --git a/src/Lucene.Net.Analysis.ICU/Analysis/Icu/ICUNormalizer2CharFilterFactory.cs b/src/Lucene.Net.Analysis.ICU/Analysis/Icu/ICUNormalizer2CharFilterFactory.cs
index f6c9531..993ddf2 100644
--- a/src/Lucene.Net.Analysis.ICU/Analysis/Icu/ICUNormalizer2CharFilterFactory.cs
+++ b/src/Lucene.Net.Analysis.ICU/Analysis/Icu/ICUNormalizer2CharFilterFactory.cs
@@ -67,7 +67,7 @@ namespace Lucene.Net.Analysis.Icu
             string name = Get(args, "name", "nfkc_cf");
             string mode = Get(args, "mode", new string[] { "compose", "decompose" }, "compose");
             Normalizer2 normalizer = Normalizer2.GetInstance
-                (null, name, "compose".Equals(mode) ? Normalizer2Mode.Compose : Normalizer2Mode.Decompose);
+                (null, name, "compose".Equals(mode, StringComparison.Ordinal) ? Normalizer2Mode.Compose : Normalizer2Mode.Decompose);
 
             string filter = Get(args, "filter");
             if (filter != null)
diff --git a/src/Lucene.Net.Analysis.ICU/Analysis/Icu/ICUNormalizer2FilterFactory.cs b/src/Lucene.Net.Analysis.ICU/Analysis/Icu/ICUNormalizer2FilterFactory.cs
index 4c3af3d..cf11e70 100644
--- a/src/Lucene.Net.Analysis.ICU/Analysis/Icu/ICUNormalizer2FilterFactory.cs
+++ b/src/Lucene.Net.Analysis.ICU/Analysis/Icu/ICUNormalizer2FilterFactory.cs
@@ -69,7 +69,7 @@ namespace Lucene.Net.Analysis.Icu
             string mode = Get(args, "mode", new string[] { "compose", "decompose" }, "compose");
 
             Normalizer2 normalizer = Normalizer2.GetInstance
-                (null, name, "compose".Equals(mode) ? Normalizer2Mode.Compose : Normalizer2Mode.Decompose);
+                (null, name, "compose".Equals(mode, StringComparison.Ordinal) ? Normalizer2Mode.Compose : Normalizer2Mode.Decompose);
 
             string filter = Get(args, "filter");
             if (filter != null)
diff --git a/src/Lucene.Net.Analysis.ICU/Analysis/Icu/ICUTransformFilterFactory.cs b/src/Lucene.Net.Analysis.ICU/Analysis/Icu/ICUTransformFilterFactory.cs
index 5eb4dd0..9627804 100644
--- a/src/Lucene.Net.Analysis.ICU/Analysis/Icu/ICUTransformFilterFactory.cs
+++ b/src/Lucene.Net.Analysis.ICU/Analysis/Icu/ICUTransformFilterFactory.cs
@@ -47,7 +47,7 @@ namespace Lucene.Net.Analysis.Icu
         {
             string id = Require(args, "id");
             string direction = Get(args, "direction", new string[] { "forward", "reverse" }, "forward", false);
-            TransliterationDirection dir = "forward".Equals(direction) ? Transliterator.Forward : Transliterator.Reverse;
+            TransliterationDirection dir = "forward".Equals(direction, StringComparison.Ordinal) ? Transliterator.Forward : Transliterator.Reverse;
             transliterator = Transliterator.GetInstance(id, dir);
             if (args.Count != 0)
             {
diff --git a/src/Lucene.Net.Analysis.Kuromoji/GraphvizFormatter.cs b/src/Lucene.Net.Analysis.Kuromoji/GraphvizFormatter.cs
index bd5233b..bcbc81d 100644
--- a/src/Lucene.Net.Analysis.Kuromoji/GraphvizFormatter.cs
+++ b/src/Lucene.Net.Analysis.Kuromoji/GraphvizFormatter.cs
@@ -1,4 +1,5 @@
 using Lucene.Net.Analysis.Ja.Dict;
+using System;
 using System.Collections.Generic;
 using System.Diagnostics;
 using System.Text;
@@ -133,7 +134,7 @@ namespace Lucene.Net.Analysis.Ja
                     string attrs;
                     string path;
                     bestPathMap.TryGetValue(fromNodeID, out path);
-                    if (toNodeID.Equals(path))
+                    if (toNodeID.Equals(path, StringComparison.Ordinal))
                     {
                         // This arc is on best path
                         attrs = " color=\"#40e050\" fontcolor=\"#40a050\" penwidth=3 fontsize=20";
diff --git a/src/Lucene.Net.Analysis.Kuromoji/Tools/BinaryDictionaryWriter.cs b/src/Lucene.Net.Analysis.Kuromoji/Tools/BinaryDictionaryWriter.cs
index c83b13d..4a81b34 100644
--- a/src/Lucene.Net.Analysis.Kuromoji/Tools/BinaryDictionaryWriter.cs
+++ b/src/Lucene.Net.Analysis.Kuromoji/Tools/BinaryDictionaryWriter.cs
@@ -77,12 +77,12 @@ namespace Lucene.Net.Analysis.Ja.Util
             sb.Length = 0;
             sb.Append(CSVUtil.QuoteEscape(posData));
             sb.Append(',');
-            if (!"*".Equals(entry[8]))
+            if (!"*".Equals(entry[8], StringComparison.Ordinal))
             {
                 sb.Append(CSVUtil.QuoteEscape(entry[8]));
             }
             sb.Append(',');
-            if (!"*".Equals(entry[9]))
+            if (!"*".Equals(entry[9], StringComparison.Ordinal))
             {
                 sb.Append(CSVUtil.QuoteEscape(entry[9]));
             }
@@ -105,15 +105,15 @@ namespace Lucene.Net.Analysis.Ja.Util
             }
 
             int flags = 0;
-            if (!("*".Equals(baseForm) || baseForm.Equals(entry[0])))
+            if (!("*".Equals(baseForm, StringComparison.Ordinal) || baseForm.Equals(entry[0], StringComparison.Ordinal)))
             {
                 flags |= BinaryDictionary.HAS_BASEFORM;
             }
-            if (!reading.Equals(ToKatakana(entry[0])))
+            if (!reading.Equals(ToKatakana(entry[0]), StringComparison.Ordinal))
             {
                 flags |= BinaryDictionary.HAS_READING;
             }
-            if (!pronunciation.Equals(reading))
+            if (!pronunciation.Equals(reading, StringComparison.Ordinal))
             {
                 flags |= BinaryDictionary.HAS_PRONUNCIATION;
             }
@@ -128,7 +128,7 @@ namespace Lucene.Net.Analysis.Ja.Util
             }
 
             string existing = posDict[leftId];
-            Debug.Assert(existing == null || existing.Equals(fullPOSData));
+            Debug.Assert(existing == null || existing.Equals(fullPOSData, StringComparison.Ordinal));
             posDict[leftId] = fullPOSData;
 
             m_buffer.PutInt16((short)(leftId << 3 | flags));
diff --git a/src/Lucene.Net.Analysis.Phonetic/DoubleMetaphoneFilter.cs b/src/Lucene.Net.Analysis.Phonetic/DoubleMetaphoneFilter.cs
index 8ee37fa..0c3615a 100644
--- a/src/Lucene.Net.Analysis.Phonetic/DoubleMetaphoneFilter.cs
+++ b/src/Lucene.Net.Analysis.Phonetic/DoubleMetaphoneFilter.cs
@@ -1,6 +1,7 @@
 // lucene version compatibility level: 4.8.1
 using Lucene.Net.Analysis.Phonetic.Language;
 using Lucene.Net.Analysis.TokenAttributes;
+using System;
 using System.Collections.Generic;
 
 namespace Lucene.Net.Analysis.Phonetic
@@ -77,7 +78,7 @@ namespace Lucene.Net.Analysis.Phonetic
                 // one token will be generated.
                 bool saveState = inject;
 
-                if (primaryPhoneticValue != null && primaryPhoneticValue.Length > 0 && !primaryPhoneticValue.Equals(v))
+                if (primaryPhoneticValue != null && primaryPhoneticValue.Length > 0 && !primaryPhoneticValue.Equals(v, StringComparison.Ordinal))
                 {
                     if (saveState)
                     {
@@ -90,8 +91,8 @@ namespace Lucene.Net.Analysis.Phonetic
                 }
 
                 if (alternatePhoneticValue != null && alternatePhoneticValue.Length > 0
-                        && !alternatePhoneticValue.Equals(primaryPhoneticValue)
-                        && !primaryPhoneticValue.Equals(v))
+                        && !alternatePhoneticValue.Equals(primaryPhoneticValue, StringComparison.Ordinal)
+                        && !primaryPhoneticValue.Equals(v, StringComparison.Ordinal))
                 {
                     if (saveState)
                     {
diff --git a/src/Lucene.Net.Analysis.Phonetic/Language/AbstractCaverphone .cs b/src/Lucene.Net.Analysis.Phonetic/Language/AbstractCaverphone .cs
index b1db7fa..4510d6f 100644
--- a/src/Lucene.Net.Analysis.Phonetic/Language/AbstractCaverphone .cs	
+++ b/src/Lucene.Net.Analysis.Phonetic/Language/AbstractCaverphone .cs	
@@ -1,4 +1,6 @@
 // commons-codec version compatibility level: 1.9
+using System;
+
 namespace Lucene.Net.Analysis.Phonetic.Language
 {
     /*
@@ -72,7 +74,7 @@ namespace Lucene.Net.Analysis.Phonetic.Language
         /// <returns><c>true</c> if the encodings of these strings are identical, <c>false</c> otherwise.</returns>
         public virtual bool IsEncodeEqual(string str1, string str2) 
         {
-            return this.Encode(str1).Equals(this.Encode(str2));
+            return this.Encode(str1).Equals(this.Encode(str2), StringComparison.Ordinal);
         }
     }
 }
diff --git a/src/Lucene.Net.Analysis.Phonetic/Language/Bm/Lang.cs b/src/Lucene.Net.Analysis.Phonetic/Language/Bm/Lang.cs
index 4e3dcd4..3e31d7b 100644
--- a/src/Lucene.Net.Analysis.Phonetic/Language/Bm/Lang.cs
+++ b/src/Lucene.Net.Analysis.Phonetic/Language/Bm/Lang.cs
@@ -200,7 +200,7 @@ namespace Lucene.Net.Analysis.Phonetic.Language.Bm
 
                             Regex pattern = new Regex(parts[0], RegexOptions.Compiled);
                             string[] langs = TOKEN.Split(parts[1]).TrimEnd();
-                            bool accept = parts[2].Equals("true");
+                            bool accept = parts[2].Equals("true", StringComparison.Ordinal);
 
                             rules.Add(new LangRule(pattern, new HashSet<string>(langs), accept));
                         }
diff --git a/src/Lucene.Net.Analysis.Phonetic/Language/Bm/PhoneticEngine.cs b/src/Lucene.Net.Analysis.Phonetic/Language/Bm/PhoneticEngine.cs
index 1288f6b..e79f024 100644
--- a/src/Lucene.Net.Analysis.Phonetic/Language/Bm/PhoneticEngine.cs
+++ b/src/Lucene.Net.Analysis.Phonetic/Language/Bm/PhoneticEngine.cs
@@ -445,7 +445,7 @@ namespace Lucene.Net.Analysis.Phonetic.Language.Bm
 
             if (this.nameType == NameType.GENERIC)
             {
-                if (input.Length >= 2 && input.Substring(0, 2 - 0).Equals("d'"))
+                if (input.Length >= 2 && input.Substring(0, 2 - 0).Equals("d'", StringComparison.Ordinal))
                 { // check for d'
                     string remainder = input.Substring(2);
                     string combined = "d" + remainder;
diff --git a/src/Lucene.Net.Analysis.Phonetic/Language/Bm/Rule.cs b/src/Lucene.Net.Analysis.Phonetic/Language/Bm/Rule.cs
index 9e6e637..8f0567d 100644
--- a/src/Lucene.Net.Analysis.Phonetic/Language/Bm/Rule.cs
+++ b/src/Lucene.Net.Analysis.Phonetic/Language/Bm/Rule.cs
@@ -895,7 +895,7 @@ namespace Lucene.Net.Analysis.Phonetic.Language.Bm
 
             // evaluate the pattern, left context and right context
             // fail early if any of the evaluations is not successful
-            if (!input.Substring(i, (ipl - i)).Equals(this.pattern))
+            if (!input.Substring(i, (ipl - i)).Equals(this.pattern, StringComparison.Ordinal))
             {
                 return false;
             }
@@ -933,7 +933,7 @@ namespace Lucene.Net.Analysis.Phonetic.Language.Bm
 
             // evaluate the pattern, left context and right context
             // fail early if any of the evaluations is not successful
-            if (!input.ToString(i, (ipl - i)).Equals(this.pattern))
+            if (!input.ToString(i, (ipl - i)).Equals(this.pattern, StringComparison.Ordinal))
             {
                 return false;
             }
diff --git a/src/Lucene.Net.Analysis.Phonetic/Language/ColognePhonetic.cs b/src/Lucene.Net.Analysis.Phonetic/Language/ColognePhonetic.cs
index 944267d..d2cf78e 100644
--- a/src/Lucene.Net.Analysis.Phonetic/Language/ColognePhonetic.cs
+++ b/src/Lucene.Net.Analysis.Phonetic/Language/ColognePhonetic.cs
@@ -1,4 +1,5 @@
 // commons-codec version compatibility level: 1.9
+using System;
 using System.Globalization;
 
 namespace Lucene.Net.Analysis.Phonetic.Language
@@ -469,7 +470,7 @@ namespace Lucene.Net.Analysis.Phonetic.Language
 
         public virtual bool IsEncodeEqual(string text1, string text2)
         {
-            return GetColognePhonetic(text1).Equals(GetColognePhonetic(text2));
+            return GetColognePhonetic(text1).Equals(GetColognePhonetic(text2), StringComparison.Ordinal);
         }
 
         /// <summary>
diff --git a/src/Lucene.Net.Analysis.Phonetic/Language/DaitchMokotoffSoundex.cs b/src/Lucene.Net.Analysis.Phonetic/Language/DaitchMokotoffSoundex.cs
index cf26e19..c0de1eb 100644
--- a/src/Lucene.Net.Analysis.Phonetic/Language/DaitchMokotoffSoundex.cs
+++ b/src/Lucene.Net.Analysis.Phonetic/Language/DaitchMokotoffSoundex.cs
@@ -101,7 +101,7 @@ namespace Lucene.Net.Analysis.Phonetic.Language
                     return false;
                 }
 
-                return ToString().Equals(((Branch)other).ToString());
+                return ToString().Equals(((Branch)other).ToString(), StringComparison.Ordinal);
             }
 
             /// <summary>
diff --git a/src/Lucene.Net.Analysis.Phonetic/Language/DoubleMetaphone.cs b/src/Lucene.Net.Analysis.Phonetic/Language/DoubleMetaphone.cs
index 2d239be..8f023de 100644
--- a/src/Lucene.Net.Analysis.Phonetic/Language/DoubleMetaphone.cs
+++ b/src/Lucene.Net.Analysis.Phonetic/Language/DoubleMetaphone.cs
@@ -244,7 +244,7 @@ namespace Lucene.Net.Analysis.Phonetic.Language
         /// <returns><c>true</c> if the encoded <see cref="string"/>s are equal; <c>false</c> otherwise.</returns>
         public virtual bool IsDoubleMetaphoneEqual(string value1, string value2, bool alternate)
         {
-            return GetDoubleMetaphone(value1, alternate).Equals(GetDoubleMetaphone(value2, alternate));
+            return GetDoubleMetaphone(value1, alternate).Equals(GetDoubleMetaphone(value2, alternate), StringComparison.Ordinal);
         }
 
         /// <summary>
@@ -1163,7 +1163,7 @@ namespace Lucene.Net.Analysis.Phonetic.Language
 
                 foreach (string element in criteria)
                 {
-                    if (target.Equals(element))
+                    if (target.Equals(element, StringComparison.Ordinal))
                     {
                         result = true;
                         break;
diff --git a/src/Lucene.Net.Analysis.Phonetic/Language/Metaphone.cs b/src/Lucene.Net.Analysis.Phonetic/Language/Metaphone.cs
index dd3038f..31cb297 100644
--- a/src/Lucene.Net.Analysis.Phonetic/Language/Metaphone.cs
+++ b/src/Lucene.Net.Analysis.Phonetic/Language/Metaphone.cs
@@ -1,4 +1,5 @@
 // commons-codec version compatibility level: 1.9
+using System;
 using System.Globalization;
 using System.Text;
 
@@ -429,7 +430,7 @@ namespace Lucene.Net.Analysis.Phonetic.Language
                 index + test.Length - 1 < sb.Length)
             {
                 string substring = sb.ToString(index, test.Length);
-                matches = substring.Equals(test);
+                matches = substring.Equals(test, StringComparison.Ordinal);
             }
             return matches;
         }
@@ -479,7 +480,7 @@ namespace Lucene.Net.Analysis.Phonetic.Language
         /// <returns><c>true</c> if the metaphones of these strings are identical, <c>false</c> otherwise.</returns>
         public virtual bool IsMetaphoneEqual(string str1, string str2)
         {
-            return GetMetaphone(str1).Equals(GetMetaphone(str2));
+            return GetMetaphone(str1).Equals(GetMetaphone(str2), StringComparison.Ordinal);
         }
 
         /// <summary>
diff --git a/src/Lucene.Net.Analysis.Phonetic/PhoneticFilter.cs b/src/Lucene.Net.Analysis.Phonetic/PhoneticFilter.cs
index c5d2886..bffc0e5 100644
--- a/src/Lucene.Net.Analysis.Phonetic/PhoneticFilter.cs
+++ b/src/Lucene.Net.Analysis.Phonetic/PhoneticFilter.cs
@@ -71,7 +71,7 @@ namespace Lucene.Net.Analysis.Phonetic
             try
             {
                 string v = encoder.Encode(value);
-                if (v.Length > 0 && !value.Equals(v))
+                if (v.Length > 0 && !value.Equals(v, StringComparison.Ordinal))
                 {
                     phonetic = v;
                 }
diff --git a/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/Compile.cs b/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/Compile.cs
index 0665b3f..9dd95ed 100644
--- a/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/Compile.cs
+++ b/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/Compile.cs
@@ -120,7 +120,7 @@ namespace Egothor.Stemmer
             // command line argument overrides environment variable or default, if supplied
             for (int i = 1; i < args.Length; i++)
             {
-                if ("-e".Equals(args[i]) || "--encoding".Equals(args[i]))
+                if ("-e".Equals(args[i], StringComparison.Ordinal) || "--encoding".Equals(args[i], StringComparison.Ordinal))
                 {
                     charset = args[i];
                 }
@@ -166,7 +166,7 @@ namespace Egothor.Stemmer
                             while (st.HasMoreTokens())
                             {
                                 string token = st.NextToken();
-                                if (token.Equals(stem) == false)
+                                if (token.Equals(stem, StringComparison.Ordinal) == false)
                                 {
                                     trie.Add(token, diff.Exec(token, stem));
                                     words++;
diff --git a/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/DiffIt.cs b/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/DiffIt.cs
index 54218dc..85a66c6 100644
--- a/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/DiffIt.cs
+++ b/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/DiffIt.cs
@@ -107,7 +107,7 @@ namespace Egothor.Stemmer
             // command line argument overrides environment variable or default, if supplied
             for (int i = 1; i < args.Length; i++)
             {
-                if ("-e".Equals(args[i]) || "--encoding".Equals(args[i]))
+                if ("-e".Equals(args[i], StringComparison.Ordinal) || "--encoding".Equals(args[i], StringComparison.Ordinal))
                 {
                     charset = args[i];
                 }
@@ -136,7 +136,7 @@ namespace Egothor.Stemmer
                             while (st.HasMoreTokens())
                             {
                                 string token = st.NextToken();
-                                if (token.Equals(stem) == false)
+                                if (token.Equals(stem, StringComparison.Ordinal) == false)
                                 {
                                     Console.WriteLine(stem + " " + diff.Exec(token, stem));
                                 }
diff --git a/src/Lucene.Net.Benchmark/ByTask/Tasks/CreateIndexTask.cs b/src/Lucene.Net.Benchmark/ByTask/Tasks/CreateIndexTask.cs
index a8efda0..9d62e47 100644
--- a/src/Lucene.Net.Benchmark/ByTask/Tasks/CreateIndexTask.cs
+++ b/src/Lucene.Net.Benchmark/ByTask/Tasks/CreateIndexTask.cs
@@ -139,7 +139,7 @@ namespace Lucene.Net.Benchmarks.ByTask.Tasks
                     throw new Exception("unable to instantiate class '" + mergeScheduler + "' as merge scheduler", e);
                 }
 
-                if (mergeScheduler.Equals("Lucene.Net.Index.ConcurrentMergeScheduler"))
+                if (mergeScheduler.Equals("Lucene.Net.Index.ConcurrentMergeScheduler", StringComparison.Ordinal))
                 {
 #if FEATURE_CONCURRENTMERGESCHEDULER
                     ConcurrentMergeScheduler cms = (ConcurrentMergeScheduler)iwConf.MergeScheduler;
diff --git a/src/Lucene.Net.Benchmark/ByTask/Tasks/WriteLineDocTask.cs b/src/Lucene.Net.Benchmark/ByTask/Tasks/WriteLineDocTask.cs
index d31a481..8e3fccf 100644
--- a/src/Lucene.Net.Benchmark/ByTask/Tasks/WriteLineDocTask.cs
+++ b/src/Lucene.Net.Benchmark/ByTask/Tasks/WriteLineDocTask.cs
@@ -120,7 +120,7 @@ namespace Lucene.Net.Benchmarks.ByTask.Tasks
             // init sufficient fields
             sufficientFields = new bool[fieldsToWrite.Length];
             string suff = config.Get("sufficient.fields", DEFAULT_SUFFICIENT_FIELDS);
-            if (",".Equals(suff))
+            if (",".Equals(suff, StringComparison.Ordinal))
             {
                 checkSufficientFields = false;
             }
diff --git a/src/Lucene.Net.Benchmark/Support/Sax/Ext/Attributes2Impl.cs b/src/Lucene.Net.Benchmark/Support/Sax/Ext/Attributes2Impl.cs
index 062e3fd..8c32a04 100644
--- a/src/Lucene.Net.Benchmark/Support/Sax/Ext/Attributes2Impl.cs
+++ b/src/Lucene.Net.Benchmark/Support/Sax/Ext/Attributes2Impl.cs
@@ -188,7 +188,7 @@ namespace Sax.Ext
             } else {
                 for (int i = 0; i < length; i++)
                 {
-                    declared[i] = !"CDATA".Equals(atts.GetType(i));
+                    declared[i] = !"CDATA".Equals(atts.GetType(i), StringComparison.Ordinal);
                     specified[i] = true;
                 }
             }
@@ -225,7 +225,7 @@ namespace Sax.Ext
             }
 
             specified[length - 1] = true;
-            declared[length - 1] = !"CDATA".Equals(type);
+            declared[length - 1] = !"CDATA".Equals(type, StringComparison.Ordinal);
         }
 
         // javadoc entirely from superclass
diff --git a/src/Lucene.Net.Benchmark/Support/Sax/Helpers/NamespaceSupport.cs b/src/Lucene.Net.Benchmark/Support/Sax/Helpers/NamespaceSupport.cs
index 3651a2d..c4014a0 100644
--- a/src/Lucene.Net.Benchmark/Support/Sax/Helpers/NamespaceSupport.cs
+++ b/src/Lucene.Net.Benchmark/Support/Sax/Helpers/NamespaceSupport.cs
@@ -251,7 +251,7 @@ namespace Sax.Helpers
         /// <seealso cref="GetPrefix(string)" />
         public bool DeclarePrefix(string prefix, string uri)
         {
-            if (prefix.Equals("xml") || prefix.Equals("xmlns"))
+            if (prefix.Equals("xml", StringComparison.Ordinal) || prefix.Equals("xmlns", StringComparison.Ordinal))
             {
                 return false;
             }
@@ -428,7 +428,7 @@ namespace Sax.Helpers
             while (allPrefixes.MoveNext())
             {
                 var prefix = (string)allPrefixes.Current;
-                if (uri.Equals(GetUri(prefix)))
+                if (uri.Equals(GetUri(prefix), StringComparison.Ordinal))
                 {
                     prefixes.Add(prefix);
                 }
@@ -593,9 +593,9 @@ namespace Sax.Helpers
 
                 prefix = prefix.Intern();
                 uri = uri.Intern();
-                if ("".Equals(prefix))
+                if ("".Equals(prefix, StringComparison.Ordinal))
                 {
-                    if ("".Equals(uri))
+                    if ("".Equals(uri, StringComparison.Ordinal))
                     {
                         defaultNs = null;
                     }
@@ -687,7 +687,7 @@ namespace Sax.Helpers
                     string prefix = qName.Substring(0, index);
                     string local = qName.Substring(index + 1);
                     string uri = null;
-                    if ("".Equals(prefix))
+                    if ("".Equals(prefix, StringComparison.Ordinal))
                     {
                         uri = defaultNs;
                     }
@@ -695,7 +695,7 @@ namespace Sax.Helpers
                     {
                         uri = (string)prefixTable[prefix];
                     }
-                    if (uri == null || (!isAttribute && "xmlns".Equals(prefix)))
+                    if (uri == null || (!isAttribute && "xmlns".Equals(prefix, StringComparison.Ordinal)))
                     {
                         return null;
                     }
@@ -717,7 +717,7 @@ namespace Sax.Helpers
             /// <seealso cref="NamespaceSupport.GetUri(string)"/>
             internal string GetURI(string prefix)
             {
-                if ("".Equals(prefix))
+                if ("".Equals(prefix, StringComparison.Ordinal))
                 {
                     return defaultNs;
                 }
diff --git a/src/Lucene.Net.Benchmark/Support/TagSoup/Element.cs b/src/Lucene.Net.Benchmark/Support/TagSoup/Element.cs
index 30aeb0b..edd3452 100644
--- a/src/Lucene.Net.Benchmark/Support/TagSoup/Element.cs
+++ b/src/Lucene.Net.Benchmark/Support/TagSoup/Element.cs
@@ -12,6 +12,7 @@
 // of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
 using Sax.Helpers;
+using System;
 
 namespace TagSoup
 {
@@ -178,7 +179,7 @@ namespace TagSoup
         {
             for (int i = _atts.Length - 1; i >= 0; i--)
             {
-                if (_atts.GetType(i).Equals("ID") || _atts.GetQName(i).Equals("name"))
+                if (_atts.GetType(i).Equals("ID", StringComparison.Ordinal) || _atts.GetQName(i).Equals("name", StringComparison.Ordinal))
                 {
                     _atts.RemoveAttribute(i);
                 }
diff --git a/src/Lucene.Net.Benchmark/Support/TagSoup/ElementType.cs b/src/Lucene.Net.Benchmark/Support/TagSoup/ElementType.cs
index 0827ad6..92bb5a1 100644
--- a/src/Lucene.Net.Benchmark/Support/TagSoup/ElementType.cs
+++ b/src/Lucene.Net.Benchmark/Support/TagSoup/ElementType.cs
@@ -140,7 +140,7 @@ namespace TagSoup
                 return attribute ? "" : schema.Uri;
             }
             string prefix = name.Substring(0, colon);
-            if (prefix.Equals("xml"))
+            if (prefix.Equals("xml", StringComparison.Ordinal))
             {
                 return "http://www.w3.org/XML/1998/namespace";
             }
@@ -184,7 +184,7 @@ namespace TagSoup
         /// <param name="value">The value of the attribute</param>
         public virtual void SetAttribute(Attributes atts, string name, string type, string value)
         {
-            if (name.Equals("xmlns") || name.StartsWith("xmlns:"))
+            if (name.Equals("xmlns", StringComparison.Ordinal) || name.StartsWith("xmlns:", StringComparison.Ordinal))
             {
                 return;
             }
@@ -199,7 +199,7 @@ namespace TagSoup
                 {
                     type = "CDATA";
                 }
-                if (!type.Equals("CDATA"))
+                if (!type.Equals("CDATA", StringComparison.Ordinal))
                 {
                     value = Normalize(value);
                 }
@@ -211,7 +211,7 @@ namespace TagSoup
                 {
                     type = atts.GetType(i);
                 }
-                if (!type.Equals("CDATA"))
+                if (!type.Equals("CDATA", StringComparison.Ordinal))
                 {
                     value = Normalize(value);
                 }
diff --git a/src/Lucene.Net.Benchmark/Support/TagSoup/PYXScanner.cs b/src/Lucene.Net.Benchmark/Support/TagSoup/PYXScanner.cs
index 711d46a..18f6d5e 100644
--- a/src/Lucene.Net.Benchmark/Support/TagSoup/PYXScanner.cs
+++ b/src/Lucene.Net.Benchmark/Support/TagSoup/PYXScanner.cs
@@ -27,6 +27,7 @@
 // 
 // PYX Scanner
 
+using System;
 using System.IO;
 
 namespace TagSoup
@@ -94,7 +95,7 @@ namespace TagSoup
                             h.STagC(buff, 0, 0);
                             instag = false;
                         }
-                        if (s.Equals("-\\n"))
+                        if (s.Equals("-\\n", StringComparison.Ordinal))
                         {
                             buff[0] = '\n';
                             h.PCDATA(buff, 0, 1);
diff --git a/src/Lucene.Net.Benchmark/Support/TagSoup/Parser.cs b/src/Lucene.Net.Benchmark/Support/TagSoup/Parser.cs
index f18990f..2f74cbd 100644
--- a/src/Lucene.Net.Benchmark/Support/TagSoup/Parser.cs
+++ b/src/Lucene.Net.Benchmark/Support/TagSoup/Parser.cs
@@ -296,39 +296,39 @@ namespace TagSoup
             }
             features[name] = value;
 
-            if (name.Equals(NAMESPACES_FEATURE))
+            if (name.Equals(NAMESPACES_FEATURE, StringComparison.Ordinal))
             {
                 namespaces = value;
             }
-            else if (name.Equals(IGNORE_BOGONS_FEATURE))
+            else if (name.Equals(IGNORE_BOGONS_FEATURE, StringComparison.Ordinal))
             {
                 ignoreBogons = value;
             }
-            else if (name.Equals(BOGONS_EMPTY_FEATURE))
+            else if (name.Equals(BOGONS_EMPTY_FEATURE, StringComparison.Ordinal))
             {
                 bogonsEmpty = value;
             }
-            else if (name.Equals(ROOT_BOGONS_FEATURE))
+            else if (name.Equals(ROOT_BOGONS_FEATURE, StringComparison.Ordinal))
             {
                 rootBogons = value;
             }
-            else if (name.Equals(DEFAULT_ATTRIBUTES_FEATURE))
+            else if (name.Equals(DEFAULT_ATTRIBUTES_FEATURE, StringComparison.Ordinal))
             {
                 defaultAttributes = value;
             }
-            else if (name.Equals(TRANSLATE_COLONS_FEATURE))
+            else if (name.Equals(TRANSLATE_COLONS_FEATURE, StringComparison.Ordinal))
             {
                 translateColons = value;
             }
-            else if (name.Equals(RESTART_ELEMENTS_FEATURE))
+            else if (name.Equals(RESTART_ELEMENTS_FEATURE, StringComparison.Ordinal))
             {
                 restartElements = value;
             }
-            else if (name.Equals(IGNORABLE_WHITESPACE_FEATURE))
+            else if (name.Equals(IGNORABLE_WHITESPACE_FEATURE, StringComparison.Ordinal))
             {
                 ignorableWhitespace = value;
             }
-            else if (name.Equals(CDATA_ELEMENTS_FEATURE))
+            else if (name.Equals(CDATA_ELEMENTS_FEATURE, StringComparison.Ordinal))
             {
                 cDataElements = value;
             }
@@ -336,19 +336,19 @@ namespace TagSoup
 
         public virtual object GetProperty(string name)
         {
-            if (name.Equals(LEXICAL_HANDLER_PROPERTY))
+            if (name.Equals(LEXICAL_HANDLER_PROPERTY, StringComparison.Ordinal))
             {
                 return theLexicalHandler == this ? null : theLexicalHandler;
             }
-            if (name.Equals(SCANNER_PROPERTY))
+            if (name.Equals(SCANNER_PROPERTY, StringComparison.Ordinal))
             {
                 return theScanner;
             }
-            if (name.Equals(SCHEMA_PROPERTY))
+            if (name.Equals(SCHEMA_PROPERTY, StringComparison.Ordinal))
             {
                 return theSchema;
             }
-            if (name.Equals(AUTO_DETECTOR_PROPERTY))
+            if (name.Equals(AUTO_DETECTOR_PROPERTY, StringComparison.Ordinal))
             {
                 return theAutoDetector;
             }
@@ -357,7 +357,7 @@ namespace TagSoup
 
         public virtual void SetProperty(string name, object value)
         {
-            if (name.Equals(LEXICAL_HANDLER_PROPERTY))
+            if (name.Equals(LEXICAL_HANDLER_PROPERTY, StringComparison.Ordinal))
             {
                 if (value == null)
                 {
@@ -376,7 +376,7 @@ namespace TagSoup
                     }
                 }
             }
-            else if (name.Equals(SCANNER_PROPERTY))
+            else if (name.Equals(SCANNER_PROPERTY, StringComparison.Ordinal))
             {
                 var scanner = value as IScanner;
                 if (scanner != null)
@@ -388,7 +388,7 @@ namespace TagSoup
                     throw new SAXNotSupportedException("Your scanner is not a IScanner");
                 }
             }
-            else if (name.Equals(SCHEMA_PROPERTY))
+            else if (name.Equals(SCHEMA_PROPERTY, StringComparison.Ordinal))
             {
                 var schema = value as Schema;
                 if (schema != null)
@@ -400,7 +400,7 @@ namespace TagSoup
                     throw new SAXNotSupportedException("Your schema is not a Schema");
                 }
             }
-            else if (name.Equals(AUTO_DETECTOR_PROPERTY))
+            else if (name.Equals(AUTO_DETECTOR_PROPERTY, StringComparison.Ordinal))
             {
                 var detector = value as IAutoDetector;
                 if (detector != null)
@@ -453,7 +453,7 @@ namespace TagSoup
             {
                 theContentHandler.SetDocumentLocator(locator);
             }
-            if (!(theSchema.Uri.Equals("")))
+            if (!(theSchema.Uri.Equals("", StringComparison.Ordinal)))
             {
                 theContentHandler.StartPrefixMapping(theSchema.Prefix, theSchema.Uri);
             }
@@ -719,7 +719,7 @@ namespace TagSoup
             {
                 Pop();
             }
-            if (!(theSchema.Uri.Equals("")))
+            if (!(theSchema.Uri.Equals("", StringComparison.Ordinal)))
             {
                 theContentHandler.EndPrefixMapping(theSchema.Prefix);
             }
@@ -794,7 +794,7 @@ namespace TagSoup
             bool inNoforce = false;
             for (sp = theStack; sp != null; sp = sp.Next)
             {
-                if (sp.Name.Equals(name))
+                if (sp.Name.Equals(name, StringComparison.Ordinal))
                 {
                     break;
                 }
@@ -981,7 +981,7 @@ namespace TagSoup
         private bool Foreign(string prefix, string ns)
         {
             //		System.err.print("%% Testing " + prefix + " and " + namespace + " for foreignness -- ");
-            bool foreign = !(prefix.Equals("") || ns.Equals("") || ns.Equals(theSchema.Uri));
+            bool foreign = !(prefix.Equals("", StringComparison.Ordinal) || ns.Equals("", StringComparison.Ordinal) || ns.Equals(theSchema.Uri, StringComparison.Ordinal));
             //		System.err.println(foreign);
             return foreign;
         }
@@ -1015,11 +1015,11 @@ namespace TagSoup
                 if (v.Length > 1)
                 {
                     name = v[1];
-                    if (v.Length > 3 && "SYSTEM".Equals(v[2]))
+                    if (v.Length > 3 && "SYSTEM".Equals(v[2], StringComparison.Ordinal))
                     {
                         systemid = v[3];
                     }
-                    else if (v.Length > 3 && "PUBLIC".Equals(v[2]))
+                    else if (v.Length > 3 && "PUBLIC".Equals(v[2], StringComparison.Ordinal))
                     {
                         publicid = v[3];
                         if (v.Length > 4)
@@ -1356,7 +1356,7 @@ namespace TagSoup
             while (e != null)
             {
                 Element nexte = e.Next;
-                if (!e.Name.Equals("<pcdata>"))
+                if (!e.Name.Equals("<pcdata>", StringComparison.Ordinal))
                 {
                     Push(e);
                 }
diff --git a/src/Lucene.Net.Benchmark/Support/TagSoup/XMLWriter.cs b/src/Lucene.Net.Benchmark/Support/TagSoup/XMLWriter.cs
index 09d3edd..f1f20fd 100644
--- a/src/Lucene.Net.Benchmark/Support/TagSoup/XMLWriter.cs
+++ b/src/Lucene.Net.Benchmark/Support/TagSoup/XMLWriter.cs
@@ -324,7 +324,7 @@ namespace TagSoup
             {
                 publicid = overridePublic;
             }
-            if (!(publicid == null || "".Equals(publicid)))
+            if (!(publicid == null || "".Equals(publicid, StringComparison.Ordinal)))
             {
                 char pubquote = (publicid.IndexOf('"') != -1) ? '\'' : '"';
                 Write(" PUBLIC ");
@@ -530,7 +530,7 @@ namespace TagSoup
         public override void StartDocument()
         {
             Reset();
-            if (!("yes".Equals(outputProperties[OMIT_XML_DECLARATION] ?? "no")))
+            if (!("yes".Equals(outputProperties[OMIT_XML_DECLARATION] ?? "no", StringComparison.Ordinal)))
             {
                 Write("<?xml");
                 if (version == null)
@@ -632,7 +632,7 @@ namespace TagSoup
             WriteNSDecls();
             Write('>');
             //	System.out.println("%%%% startElement [" + qName + "] htmlMode = " + htmlMode);
-            if (htmlMode && (qName.Equals("script") || qName.Equals("style")))
+            if (htmlMode && (qName.Equals("script", StringComparison.Ordinal) || qName.Equals("style", StringComparison.Ordinal)))
             {
                 cdataElement = true;
                 //		System.out.println("%%%% CDATA element");
@@ -667,11 +667,11 @@ namespace TagSoup
         public override void EndElement(string uri, string localName, string qName)
         {
             if (
-              !(htmlMode && (uri.Equals("http://www.w3.org/1999/xhtml") || uri.Equals(""))
-                && (qName.Equals("area") || qName.Equals("base") || qName.Equals("basefont") || qName.Equals("br")
-                    || qName.Equals("col") || qName.Equals("frame") || qName.Equals("hr") || qName.Equals("img")
-                    || qName.Equals("input") || qName.Equals("isindex") || qName.Equals("link") || qName.Equals("meta")
-                    || qName.Equals("param"))))
+              !(htmlMode && (uri.Equals("http://www.w3.org/1999/xhtml", StringComparison.Ordinal) || uri.Equals("", StringComparison.Ordinal))
+                && (qName.Equals("area", StringComparison.Ordinal) || qName.Equals("base", StringComparison.Ordinal) || qName.Equals("basefont", StringComparison.Ordinal) || qName.Equals("br", StringComparison.Ordinal)
+                    || qName.Equals("col", StringComparison.Ordinal) || qName.Equals("frame", StringComparison.Ordinal) || qName.Equals("hr", StringComparison.Ordinal) || qName.Equals("img", StringComparison.Ordinal)
+                    || qName.Equals("input", StringComparison.Ordinal) || qName.Equals("isindex", StringComparison.Ordinal) || qName.Equals("link", StringComparison.Ordinal) || qName.Equals("meta", StringComparison.Ordinal)
+                    || qName.Equals("param", StringComparison.Ordinal))))
             {
                 Write("</");
                 WriteName(uri, localName, qName, true);
@@ -1152,7 +1152,7 @@ namespace TagSoup
         private string DoPrefix(string uri, string qName, bool isElement)
         {
             string defaultNS = nsSupport.GetUri("");
-            if ("".Equals(uri))
+            if ("".Equals(uri, StringComparison.Ordinal))
             {
                 if (isElement && defaultNS != null)
                 {
@@ -1161,7 +1161,7 @@ namespace TagSoup
                 return null;
             }
             string prefix;
-            if (isElement && defaultNS != null && uri.Equals(defaultNS))
+            if (isElement && defaultNS != null && uri.Equals(defaultNS, StringComparison.Ordinal))
             {
                 prefix = "";
             }
@@ -1175,7 +1175,7 @@ namespace TagSoup
             }
             bool containsPrefix = doneDeclTable.ContainsKey(uri);
             prefix = (string)(containsPrefix ? doneDeclTable[uri] : null);
-            if (containsPrefix && ((!isElement || defaultNS != null) && "".Equals(prefix) || nsSupport.GetUri(prefix) != null))
+            if (containsPrefix && ((!isElement || defaultNS != null) && "".Equals(prefix, StringComparison.Ordinal) || nsSupport.GetUri(prefix) != null))
             {
                 prefix = null;
             }
@@ -1184,12 +1184,12 @@ namespace TagSoup
                 containsPrefix = prefixTable.ContainsKey(uri);
                 prefix = (string)(containsPrefix ? prefixTable[uri] : null);
                 if (containsPrefix
-                    && ((!isElement || defaultNS != null) && "".Equals(prefix) || nsSupport.GetUri(prefix) != null))
+                    && ((!isElement || defaultNS != null) && "".Equals(prefix, StringComparison.Ordinal) || nsSupport.GetUri(prefix) != null))
                 {
                     prefix = null;
                 }
             }
-            if (prefix == null && qName != null && !"".Equals(qName))
+            if (prefix == null && qName != null && !"".Equals(qName, StringComparison.Ordinal))
             {
                 int i = qName.IndexOf(':');
                 if (i == -1)
@@ -1297,13 +1297,13 @@ namespace TagSoup
                     name = qName.Substring(i + 1, qName.Length);
                 }
             }
-            if (!name.Equals(value))
+            if (!name.Equals(value, StringComparison.Ordinal))
             {
                 return false;
             }
             for (int j = 0; j < _bools.Length; j++)
             {
-                if (name.Equals(_bools[j]))
+                if (name.Equals(_bools[j], StringComparison.Ordinal))
                 {
                     return true;
                 }
@@ -1393,7 +1393,7 @@ namespace TagSoup
                 }
                 char[] ch = uri.ToCharArray();
                 Write(' ');
-                if ("".Equals(prefix))
+                if ("".Equals(prefix, StringComparison.Ordinal))
                 {
                     Write("xmlns=\"");
                 }
@@ -1432,12 +1432,12 @@ namespace TagSoup
         private void WriteName(string uri, string localName, string qName, bool isElement)
         {
             string prefix = DoPrefix(uri, qName, isElement);
-            if (prefix != null && !"".Equals(prefix))
+            if (prefix != null && !"".Equals(prefix, StringComparison.Ordinal))
             {
                 Write(prefix);
                 Write(':');
             }
-            if (localName != null && !"".Equals(localName))
+            if (localName != null && !"".Equals(localName, StringComparison.Ordinal))
             {
                 Write(localName);
             }
@@ -1480,31 +1480,31 @@ namespace TagSoup
         {
             outputProperties[key] = value;
             //	System.out.println("%%%% key = [" + key + "] value = [" + value +"]");
-            if (key.Equals(ENCODING))
+            if (key.Equals(ENCODING, StringComparison.Ordinal))
             {
                 outputEncoding = value;
                 unicodeMode = value.Substring(0, 3).Equals("utf", StringComparison.OrdinalIgnoreCase);
                 //                System.out.println("%%%% unicodeMode = " + unicodeMode);
             }
-            else if (key.Equals(METHOD))
+            else if (key.Equals(METHOD, StringComparison.Ordinal))
             {
-                htmlMode = value.Equals("html");
+                htmlMode = value.Equals("html", StringComparison.Ordinal);
             }
-            else if (key.Equals(DOCTYPE_PUBLIC))
+            else if (key.Equals(DOCTYPE_PUBLIC, StringComparison.Ordinal))
             {
                 overridePublic = value;
                 forceDTD = true;
             }
-            else if (key.Equals(DOCTYPE_SYSTEM))
+            else if (key.Equals(DOCTYPE_SYSTEM, StringComparison.Ordinal))
             {
                 overrideSystem = value;
                 forceDTD = true;
             }
-            else if (key.Equals(VERSION))
+            else if (key.Equals(VERSION, StringComparison.Ordinal))
             {
                 version = value;
             }
-            else if (key.Equals(STANDALONE))
+            else if (key.Equals(STANDALONE, StringComparison.Ordinal))
             {
                 standalone = value;
             }
diff --git a/src/Lucene.Net.Codecs/SimpleText/SimpleTextFieldInfosReader.cs b/src/Lucene.Net.Codecs/SimpleText/SimpleTextFieldInfosReader.cs
index dc74dbf..ea658b0 100644
--- a/src/Lucene.Net.Codecs/SimpleText/SimpleTextFieldInfosReader.cs
+++ b/src/Lucene.Net.Codecs/SimpleText/SimpleTextFieldInfosReader.cs
@@ -160,7 +160,7 @@ namespace Lucene.Net.Codecs.SimpleText
 
         public virtual Index.DocValuesType DocValuesType(string dvType)
         {
-            return "false".Equals(dvType) ? Index.DocValuesType.NONE : (Index.DocValuesType)Enum.Parse(typeof(Index.DocValuesType), dvType, true);
+            return "false".Equals(dvType, StringComparison.Ordinal) ? Index.DocValuesType.NONE : (Index.DocValuesType)Enum.Parse(typeof(Index.DocValuesType), dvType, true);
         }
 
         private string ReadString(int offset, BytesRef scratch)
diff --git a/src/Lucene.Net.Codecs/SimpleText/SimpleTextUtil.cs b/src/Lucene.Net.Codecs/SimpleText/SimpleTextUtil.cs
index 43ab450..e98a5a6 100644
--- a/src/Lucene.Net.Codecs/SimpleText/SimpleTextUtil.cs
+++ b/src/Lucene.Net.Codecs/SimpleText/SimpleTextUtil.cs
@@ -1,4 +1,5 @@
-using System.Globalization;
+using System;
+using System.Globalization;
 
 namespace Lucene.Net.Codecs.SimpleText
 {
@@ -110,7 +111,7 @@ namespace Lucene.Net.Codecs.SimpleText
             }
             var actualChecksum =
                 (new BytesRef(scratch.Bytes, CHECKSUM.Length, scratch.Length - CHECKSUM.Length)).Utf8ToString();
-            if (!expectedChecksum.Equals(actualChecksum))
+            if (!expectedChecksum.Equals(actualChecksum, StringComparison.Ordinal))
             {
                 throw new CorruptIndexException("SimpleText checksum failure: " + actualChecksum + " != " +
                                                 expectedChecksum + " (resource=" + input + ")");
diff --git a/src/Lucene.Net.Demo/IndexFiles.cs b/src/Lucene.Net.Demo/IndexFiles.cs
index 048821d..1abf35c 100644
--- a/src/Lucene.Net.Demo/IndexFiles.cs
+++ b/src/Lucene.Net.Demo/IndexFiles.cs
@@ -67,7 +67,7 @@ namespace Lucene.Net.Demo
 
             for (int i = 0; i < args.Length; i++)
             {
-                if ("-u".Equals(args[i]) || "--update".Equals(args[i]))
+                if ("-u".Equals(args[i], StringComparison.Ordinal) || "--update".Equals(args[i], StringComparison.Ordinal))
                 {
                     create = false;
                 }
diff --git a/src/Lucene.Net.Demo/SearchFiles.cs b/src/Lucene.Net.Demo/SearchFiles.cs
index 412a744..29106ba 100644
--- a/src/Lucene.Net.Demo/SearchFiles.cs
+++ b/src/Lucene.Net.Demo/SearchFiles.cs
@@ -56,7 +56,7 @@ namespace Lucene.Net.Demo
                 "Use no --query or --queries-file option for interactive mode.\n\n" +
                 "See http://lucene.apache.org/core/4_8_0/demo/ for details.";
             if (args.Length < 1 || args.Length > 0 && 
-                ("?".Equals(args[0]) || "-h".Equals(args[0]) || "--help".Equals(args[0])))
+                ("?".Equals(args[0], StringComparison.Ordinal) || "-h".Equals(args[0], StringComparison.Ordinal) || "--help".Equals(args[0], StringComparison.Ordinal)))
             {
                 Console.WriteLine(usage);
                 Environment.Exit(0);
@@ -72,31 +72,31 @@ namespace Lucene.Net.Demo
 
             for (int i = 0; i < args.Length; i++)
             {
-                if ("-f".Equals(args[i]) || "-field".Equals(args[i]))
+                if ("-f".Equals(args[i], StringComparison.Ordinal) || "-field".Equals(args[i], StringComparison.Ordinal))
                 {
                     field = args[i + 1];
                     i++;
                 }
-                else if ("-qf".Equals(args[i]) || "--queries-file".Equals(args[i]))
+                else if ("-qf".Equals(args[i], StringComparison.Ordinal) || "--queries-file".Equals(args[i], StringComparison.Ordinal))
                 {
                     queries = args[i + 1];
                     i++;
                 }
-                else if ("-q".Equals(args[i]) || "--query".Equals(args[i]))
+                else if ("-q".Equals(args[i], StringComparison.Ordinal) || "--query".Equals(args[i], StringComparison.Ordinal))
                 {
                     queryString = args[i + 1];
                     i++;
                 }
-                else if ("-r".Equals(args[i]) || "--repeat".Equals(args[i]))
+                else if ("-r".Equals(args[i], StringComparison.Ordinal) || "--repeat".Equals(args[i], StringComparison.Ordinal))
                 {
                     repeat = int.Parse(args[i + 1], CultureInfo.InvariantCulture);
                     i++;
                 }
-                else if ("--raw".Equals(args[i]))
+                else if ("--raw".Equals(args[i], StringComparison.Ordinal))
                 {
                     raw = true;
                 }
-                else if ("-p".Equals(args[i]) || "--paging".Equals(args[i]))
+                else if ("-p".Equals(args[i], StringComparison.Ordinal) || "--paging".Equals(args[i], StringComparison.Ordinal))
                 {
                     hitsPerPage = int.Parse(args[i + 1], CultureInfo.InvariantCulture);
                     if (hitsPerPage <= 0)
diff --git a/src/Lucene.Net.Facet/FacetsConfig.cs b/src/Lucene.Net.Facet/FacetsConfig.cs
index abbaf4b..d800319 100644
--- a/src/Lucene.Net.Facet/FacetsConfig.cs
+++ b/src/Lucene.Net.Facet/FacetsConfig.cs
@@ -375,7 +375,7 @@ namespace Lucene.Net.Facet
                     {
                         assocDimTypes[indexFieldName] = type;
                     }
-                    else if (!curType.Equals(type))
+                    else if (!curType.Equals(type, StringComparison.Ordinal))
                     {
                         throw new System.ArgumentException("mixing incompatible types of AssocationFacetField (" + curType + " and " + type + ") in indexed field \"" + indexFieldName + "\"; use FacetsConfig to change the indexFieldName for each dimension");
                     }
diff --git a/src/Lucene.Net.Facet/LabelAndValue.cs b/src/Lucene.Net.Facet/LabelAndValue.cs
index b5719bf..8c7eb4c 100644
--- a/src/Lucene.Net.Facet/LabelAndValue.cs
+++ b/src/Lucene.Net.Facet/LabelAndValue.cs
@@ -76,7 +76,7 @@ namespace Lucene.Net.Facet
                 return false;
             }
             LabelAndValue _other = (LabelAndValue)other;
-            return Label.Equals(_other.Label) && Value.Equals(_other.Value);
+            return Label.Equals(_other.Label, StringComparison.Ordinal) && Value.Equals(_other.Value);
         }
 
         public override int GetHashCode()
diff --git a/src/Lucene.Net.Facet/Range/RangeFacetCounts.cs b/src/Lucene.Net.Facet/Range/RangeFacetCounts.cs
index b10591c..02b08c0 100644
--- a/src/Lucene.Net.Facet/Range/RangeFacetCounts.cs
+++ b/src/Lucene.Net.Facet/Range/RangeFacetCounts.cs
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
 
 namespace Lucene.Net.Facet.Range
 {
@@ -64,7 +65,7 @@ namespace Lucene.Net.Facet.Range
 
         public override FacetResult GetTopChildren(int topN, string dim, params string[] path)
         {
-            if (dim.Equals(m_field) == false)
+            if (dim.Equals(m_field, StringComparison.Ordinal) == false)
             {
                 throw new System.ArgumentException("invalid dim \"" + dim + "\"; should be \"" + m_field + "\"");
             }
diff --git a/src/Lucene.Net.Facet/SortedSet/DefaultSortedSetDocValuesReaderState.cs b/src/Lucene.Net.Facet/SortedSet/DefaultSortedSetDocValuesReaderState.cs
index fcd545b..a183e00 100644
--- a/src/Lucene.Net.Facet/SortedSet/DefaultSortedSetDocValuesReaderState.cs
+++ b/src/Lucene.Net.Facet/SortedSet/DefaultSortedSetDocValuesReaderState.cs
@@ -1,6 +1,7 @@
 using Lucene.Net.Index;
 using Lucene.Net.Support;
 using Lucene.Net.Util;
+using System;
 using System.Collections.Generic;
 
 namespace Lucene.Net.Facet.SortedSet
@@ -79,7 +80,7 @@ namespace Lucene.Net.Facet.SortedSet
                 {
                     throw new System.ArgumentException("this class can only handle 2 level hierarchy (dim/value); got: " + Arrays.ToString(components) + " " + term.Utf8ToString());
                 }
-                if (!components[0].Equals(lastDim))
+                if (!components[0].Equals(lastDim, StringComparison.Ordinal))
                 {
                     if (lastDim != null)
                     {
diff --git a/src/Lucene.Net.Facet/Taxonomy/CategoryPath.cs b/src/Lucene.Net.Facet/Taxonomy/CategoryPath.cs
index 6d811db..549cef6 100644
--- a/src/Lucene.Net.Facet/Taxonomy/CategoryPath.cs
+++ b/src/Lucene.Net.Facet/Taxonomy/CategoryPath.cs
@@ -223,7 +223,7 @@ namespace Lucene.Net.Facet.Taxonomy
             // from last-first
             for (int i = Length - 1; i >= 0; i--)
             {
-                if (!Components[i].Equals(other.Components[i]))
+                if (!Components[i].Equals(other.Components[i], StringComparison.Ordinal))
                 {
                     return false;
                 }
diff --git a/src/Lucene.Net.Facet/Taxonomy/Directory/DirectoryTaxonomyReader.cs b/src/Lucene.Net.Facet/Taxonomy/Directory/DirectoryTaxonomyReader.cs
index 34dc7d0..9b6bd7e 100644
--- a/src/Lucene.Net.Facet/Taxonomy/Directory/DirectoryTaxonomyReader.cs
+++ b/src/Lucene.Net.Facet/Taxonomy/Directory/DirectoryTaxonomyReader.cs
@@ -192,7 +192,7 @@ namespace Lucene.Net.Facet.Taxonomy.Directory
                             recreated = true;
                         }
                     }
-                    else if (!t1.Equals(t2))
+                    else if (!t1.Equals(t2, StringComparison.Ordinal))
                     {
                         // t1 != null and t2 cannot be null b/c DirTaxoWriter always puts the commit data.
                         // it's ok to use String.equals because we require the two epoch values to be the same.
diff --git a/src/Lucene.Net.Facet/Taxonomy/FacetLabel.cs b/src/Lucene.Net.Facet/Taxonomy/FacetLabel.cs
index 4904eec..5ee5632 100644
--- a/src/Lucene.Net.Facet/Taxonomy/FacetLabel.cs
+++ b/src/Lucene.Net.Facet/Taxonomy/FacetLabel.cs
@@ -152,7 +152,7 @@ namespace Lucene.Net.Facet.Taxonomy
             // from last-first
             for (int i = Length - 1; i >= 0; i--)
             {
-                if (!string.Equals(Components[i], other.Components[i]))
+                if (!Components[i].Equals(other.Components[i], StringComparison.Ordinal))
                 {
                     return false;
                 }
diff --git a/src/Lucene.Net.Facet/Taxonomy/PrintTaxonomyStats.cs b/src/Lucene.Net.Facet/Taxonomy/PrintTaxonomyStats.cs
index b8ce155..c79776e 100644
--- a/src/Lucene.Net.Facet/Taxonomy/PrintTaxonomyStats.cs
+++ b/src/Lucene.Net.Facet/Taxonomy/PrintTaxonomyStats.cs
@@ -48,7 +48,7 @@ namespace Lucene.Net.Facet.Taxonomy
             string path = null;
             for (int i = 0; i < args.Length; i++)
             {
-                if (args[i].Equals("-printTree"))
+                if (args[i].Equals("-printTree", StringComparison.Ordinal))
                 {
                     printTree = true;
                 }
diff --git a/src/Lucene.Net.Facet/Taxonomy/TaxonomyFacets.cs b/src/Lucene.Net.Facet/Taxonomy/TaxonomyFacets.cs
index ec30ce1..ac71f7a 100644
--- a/src/Lucene.Net.Facet/Taxonomy/TaxonomyFacets.cs
+++ b/src/Lucene.Net.Facet/Taxonomy/TaxonomyFacets.cs
@@ -102,7 +102,7 @@ namespace Lucene.Net.Facet.Taxonomy
         protected virtual DimConfig VerifyDim(string dim)
         {
             DimConfig dimConfig = m_config.GetDimConfig(dim);
-            if (!dimConfig.IndexFieldName.Equals(m_indexFieldName))
+            if (!dimConfig.IndexFieldName.Equals(m_indexFieldName, StringComparison.Ordinal))
             {
                 throw new System.ArgumentException("dimension \"" + dim + "\" was not indexed into field \"" + m_indexFieldName);
             }
@@ -117,7 +117,7 @@ namespace Lucene.Net.Facet.Taxonomy
             {
                 string dim = m_taxoReader.GetPath(ord).Components[0];
                 DimConfig dimConfig = m_config.GetDimConfig(dim);
-                if (dimConfig.IndexFieldName.Equals(m_indexFieldName))
+                if (dimConfig.IndexFieldName.Equals(m_indexFieldName, StringComparison.Ordinal))
                 {
                     FacetResult result = GetTopChildren(topN, dim);
                     if (result != null)
diff --git a/src/Lucene.Net.Highlighter/Highlight/QueryTermExtractor.cs b/src/Lucene.Net.Highlighter/Highlight/QueryTermExtractor.cs
index ec8de66..b19ba22 100644
--- a/src/Lucene.Net.Highlighter/Highlight/QueryTermExtractor.cs
+++ b/src/Lucene.Net.Highlighter/Highlight/QueryTermExtractor.cs
@@ -114,7 +114,7 @@ namespace Lucene.Net.Search.Highlight
                     query.ExtractTerms(nonWeightedTerms);
                     foreach (var term in nonWeightedTerms)
                     {
-                        if ((fieldName == null) || (term.Field.Equals(fieldName)))
+                        if ((fieldName == null) || (term.Field.Equals(fieldName, StringComparison.Ordinal)))
                         {
                             terms.Add(new WeightedTerm(query.Boost, term.Text()));
                         }
diff --git a/src/Lucene.Net.Highlighter/Highlight/WeightedSpanTermExtractor.cs b/src/Lucene.Net.Highlighter/Highlight/WeightedSpanTermExtractor.cs
index 01a21ae..04f2124 100644
--- a/src/Lucene.Net.Highlighter/Highlight/WeightedSpanTermExtractor.cs
+++ b/src/Lucene.Net.Highlighter/Highlight/WeightedSpanTermExtractor.cs
@@ -362,8 +362,8 @@ namespace Lucene.Net.Search.Highlight
         /// </summary>
         protected virtual bool FieldNameComparer(string fieldNameToCheck)
         {
-            bool rv = fieldName == null || fieldName.Equals(fieldNameToCheck)
-                      || fieldNameToCheck.Equals(defaultField);
+            bool rv = fieldName == null || fieldName.Equals(fieldNameToCheck, StringComparison.Ordinal)
+                      || fieldNameToCheck.Equals(defaultField, StringComparison.Ordinal);
             return rv;
         }
 
diff --git a/src/Lucene.Net.Highlighter/PostingsHighlight/MultiTermHighlighting.cs b/src/Lucene.Net.Highlighter/PostingsHighlight/MultiTermHighlighting.cs
index bd79c80..482716c 100644
--- a/src/Lucene.Net.Highlighter/PostingsHighlight/MultiTermHighlighting.cs
+++ b/src/Lucene.Net.Highlighter/PostingsHighlight/MultiTermHighlighting.cs
@@ -88,7 +88,7 @@ namespace Lucene.Net.Search.PostingsHighlight
             else if (query is AutomatonQuery)
             {
                 AutomatonQuery aq = (AutomatonQuery)query;
-                if (aq.Field.Equals(field))
+                if (aq.Field.Equals(field, StringComparison.Ordinal))
                 {
                     list.Add(new CharacterRunAutomatonToStringAnonymousHelper(aq.Automaton, () => aq.ToString()));
                 }
@@ -97,7 +97,7 @@ namespace Lucene.Net.Search.PostingsHighlight
             {
                 PrefixQuery pq = (PrefixQuery)query;
                 Term prefix = pq.Prefix;
-                if (prefix.Field.Equals(field))
+                if (prefix.Field.Equals(field, StringComparison.Ordinal))
                 {
                     list.Add(new CharacterRunAutomatonToStringAnonymousHelper(
                         BasicOperations.Concatenate(BasicAutomata.MakeString(prefix.Text()), BasicAutomata.MakeAnyString()), 
@@ -107,7 +107,7 @@ namespace Lucene.Net.Search.PostingsHighlight
             else if (query is FuzzyQuery)
             {
                 FuzzyQuery fq = (FuzzyQuery)query;
-                if (fq.Field.Equals(field))
+                if (fq.Field.Equals(field, StringComparison.Ordinal))
                 {
                     string utf16 = fq.Term.Text();
                     int[] termText = new int[utf16.CodePointCount(0, utf16.Length)];
@@ -131,7 +131,7 @@ namespace Lucene.Net.Search.PostingsHighlight
             else if (query is TermRangeQuery)
             {
                 TermRangeQuery tq = (TermRangeQuery)query;
-                if (tq.Field.Equals(field))
+                if (tq.Field.Equals(field, StringComparison.Ordinal))
                 {
                     // this is *not* an automaton, but its very simple
                     list.Add(new SimpleCharacterRunAutomatonAnonymousHelper(BasicAutomata.MakeEmpty(), tq));
diff --git a/src/Lucene.Net.Highlighter/VectorHighlight/FieldQuery.cs b/src/Lucene.Net.Highlighter/VectorHighlight/FieldQuery.cs
index 93af641..369c4b7 100644
--- a/src/Lucene.Net.Highlighter/VectorHighlight/FieldQuery.cs
+++ b/src/Lucene.Net.Highlighter/VectorHighlight/FieldQuery.cs
@@ -242,7 +242,7 @@ namespace Lucene.Net.Search.VectorHighlight
             if (a.Slop != b.Slop) return;
             Term[] ats = a.GetTerms();
             Term[] bts = b.GetTerms();
-            if (fieldMatch && !ats[0].Field.Equals(bts[0].Field)) return;
+            if (fieldMatch && !ats[0].Field.Equals(bts[0].Field, StringComparison.Ordinal)) return;
             CheckOverlap(expandQueries, ats, bts, a.Slop, a.Boost);
             CheckOverlap(expandQueries, bts, ats, b.Slop, b.Boost);
         }
@@ -272,7 +272,7 @@ namespace Lucene.Net.Search.VectorHighlight
                 bool overlap = true;
                 for (int j = i; j < src.Length; j++)
                 {
-                    if ((j - i) < dest.Length && !src[j].Text().Equals(dest[j - i].Text()))
+                    if ((j - i) < dest.Length && !src[j].Text().Equals(dest[j - i].Text(), StringComparison.Ordinal))
                     {
                         overlap = false;
                         break;
diff --git a/src/Lucene.Net.Join/TermsIncludingScoreQuery.cs b/src/Lucene.Net.Join/TermsIncludingScoreQuery.cs
index 8991e72..e1876d6 100644
--- a/src/Lucene.Net.Join/TermsIncludingScoreQuery.cs
+++ b/src/Lucene.Net.Join/TermsIncludingScoreQuery.cs
@@ -1,6 +1,7 @@
 using Lucene.Net.Index;
 using Lucene.Net.Search;
 using Lucene.Net.Util;
+using System;
 using System.Collections.Generic;
 
 namespace Lucene.Net.Join
@@ -89,7 +90,7 @@ namespace Lucene.Net.Join
             if (obj.GetType() != GetType()) return false;
 
             var other = (TermsIncludingScoreQuery)obj;
-            if (!_field.Equals(other._field))
+            if (!_field.Equals(other._field, StringComparison.Ordinal))
             {
                 return false;
             }
diff --git a/src/Lucene.Net.Memory/MemoryIndex.MemoryIndexReader.cs b/src/Lucene.Net.Memory/MemoryIndex.MemoryIndexReader.cs
index a06fbfc..1728387 100644
--- a/src/Lucene.Net.Memory/MemoryIndex.MemoryIndexReader.cs
+++ b/src/Lucene.Net.Memory/MemoryIndex.MemoryIndexReader.cs
@@ -673,7 +673,7 @@ namespace Lucene.Net.Index.Memory
                 }
                 NumericDocValues norms = cachedNormValues;
                 Similarity sim = Similarity;
-                if (!field.Equals(cachedFieldName) || sim != cachedSimilarity) // not cached?
+                if (!field.Equals(cachedFieldName, StringComparison.Ordinal) || sim != cachedSimilarity) // not cached?
                 {
                     Info info = GetInfo(field);
                     int numTokens = info != null ? info.numTokens : 0;
diff --git a/src/Lucene.Net.Misc/Document/LazyDocument.cs b/src/Lucene.Net.Misc/Document/LazyDocument.cs
index a8b54f0..5b94e37 100644
--- a/src/Lucene.Net.Misc/Document/LazyDocument.cs
+++ b/src/Lucene.Net.Misc/Document/LazyDocument.cs
@@ -166,7 +166,7 @@ namespace Lucene.Net.Documents
                     outerInstance.FetchRealValues(name, fieldNum);
                 }
                 Debug.Assert(HasBeenLoaded, "field value was not lazy loaded");
-                Debug.Assert(realValue.Name.Equals(Name), "realvalue name != name: " + realValue.Name + " != " + Name);
+                Debug.Assert(realValue.Name.Equals(Name, StringComparison.Ordinal), "realvalue name != name: " + realValue.Name + " != " + Name);
 
                 return realValue;
             }
diff --git a/src/Lucene.Net.Misc/Index/CompoundFileExtractor.cs b/src/Lucene.Net.Misc/Index/CompoundFileExtractor.cs
index a6e4da5..7905791 100644
--- a/src/Lucene.Net.Misc/Index/CompoundFileExtractor.cs
+++ b/src/Lucene.Net.Misc/Index/CompoundFileExtractor.cs
@@ -44,11 +44,11 @@ namespace Lucene.Net.Index
             while (j < args.Length)
             {
                 string arg = args[j];
-                if ("-extract".Equals(arg))
+                if ("-extract".Equals(arg, StringComparison.Ordinal))
                 {
                     extract = true;
                 }
-                else if ("-dir-impl".Equals(arg))
+                else if ("-dir-impl".Equals(arg, StringComparison.Ordinal))
                 {
                     if (j == args.Length - 1)
                     {
diff --git a/src/Lucene.Net.Misc/Index/IndexSplitter.cs b/src/Lucene.Net.Misc/Index/IndexSplitter.cs
index 62adab3..ecb8842 100644
--- a/src/Lucene.Net.Misc/Index/IndexSplitter.cs
+++ b/src/Lucene.Net.Misc/Index/IndexSplitter.cs
@@ -67,11 +67,11 @@ namespace Lucene.Net.Index
             {
                 throw new Exception("srcdir:" + srcDir.FullName + " doesn't exist");
             }
-            if (args[1].Equals("-l"))
+            if (args[1].Equals("-l", StringComparison.Ordinal))
             {
                 @is.ListSegments();
             }
-            else if (args[1].Equals("-d"))
+            else if (args[1].Equals("-d", StringComparison.Ordinal))
             {
                 IList<string> segs = new List<string>();
                 for (int x = 2; x < args.Length; x++)
@@ -114,7 +114,7 @@ namespace Lucene.Net.Index
         {
             for (int x = 0; x < Infos.Count; x++)
             {
-                if (name.Equals(Infos.Info(x).Info.Name))
+                if (name.Equals(Infos.Info(x).Info.Name, StringComparison.Ordinal))
                 {
                     return x;
                 }
@@ -126,7 +126,7 @@ namespace Lucene.Net.Index
         {
             for (int x = 0; x < Infos.Count; x++)
             {
-                if (name.Equals(Infos.Info(x).Info.Name))
+                if (name.Equals(Infos.Info(x).Info.Name, StringComparison.Ordinal))
                 {
                     return Infos.Info(x);
                 }
diff --git a/src/Lucene.Net.Misc/Index/MultiPassIndexSplitter.cs b/src/Lucene.Net.Misc/Index/MultiPassIndexSplitter.cs
index 79a4bcd..47d61fe 100644
--- a/src/Lucene.Net.Misc/Index/MultiPassIndexSplitter.cs
+++ b/src/Lucene.Net.Misc/Index/MultiPassIndexSplitter.cs
@@ -141,15 +141,15 @@ namespace Lucene.Net.Index
                 bool seq = false;
                 for (int i = 0; i < args.Length; i++)
                 {
-                    if (args[i].Equals("-out"))
+                    if (args[i].Equals("-out", StringComparison.Ordinal))
                     {
                         outDir = args[++i];
                     }
-                    else if (args[i].Equals("-num"))
+                    else if (args[i].Equals("-num", StringComparison.Ordinal))
                     {
                         numParts = Convert.ToInt32(args[++i]);
                     }
-                    else if (args[i].Equals("-seq"))
+                    else if (args[i].Equals("-seq", StringComparison.Ordinal))
                     {
                         seq = true;
                     }
diff --git a/src/Lucene.Net.Misc/Index/Sorter/SortingMergePolicy.cs b/src/Lucene.Net.Misc/Index/Sorter/SortingMergePolicy.cs
index 24fa56f..9d77177 100644
--- a/src/Lucene.Net.Misc/Index/Sorter/SortingMergePolicy.cs
+++ b/src/Lucene.Net.Misc/Index/Sorter/SortingMergePolicy.cs
@@ -199,7 +199,7 @@ namespace Lucene.Net.Index.Sorter
                 string diagnosticsSort;
                 if (diagnostics != null 
                     && diagnostics.TryGetValue(SORTER_ID_PROP, out diagnosticsSort)
-                    && sort.ToString().Equals(diagnosticsSort))
+                    && sort.ToString().Equals(diagnosticsSort, StringComparison.Ordinal))
                 {
                     return true;
                 }
diff --git a/src/Lucene.Net.Misc/Misc/HighFreqTerms.cs b/src/Lucene.Net.Misc/Misc/HighFreqTerms.cs
index 2803be0..fe409f6 100644
--- a/src/Lucene.Net.Misc/Misc/HighFreqTerms.cs
+++ b/src/Lucene.Net.Misc/Misc/HighFreqTerms.cs
@@ -61,7 +61,7 @@ namespace Lucene.Net.Misc
 
             for (int i = 1; i < args.Length; i++)
             {
-                if (args[i].Equals("-t"))
+                if (args[i].Equals("-t", StringComparison.Ordinal))
                 {
                     comparer = new TotalTermFreqComparer();
                 }
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/DocFreqValueSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/DocFreqValueSource.cs
index 9bab31f..be51be6 100644
--- a/src/Lucene.Net.Queries/Function/ValueSources/DocFreqValueSource.cs
+++ b/src/Lucene.Net.Queries/Function/ValueSources/DocFreqValueSource.cs
@@ -195,7 +195,7 @@ namespace Lucene.Net.Queries.Function.ValueSources
                 return false;
             }
             var other = (DocFreqValueSource)o;
-            return this.m_indexedField.Equals(other.m_indexedField) && this.m_indexedBytes.Equals(other.m_indexedBytes);
+            return this.m_indexedField.Equals(other.m_indexedField, StringComparison.Ordinal) && this.m_indexedBytes.Equals(other.m_indexedBytes);
         }
     }
 }
\ No newline at end of file
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/FieldCacheSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/FieldCacheSource.cs
index cc05c64..28c5944 100644
--- a/src/Lucene.Net.Queries/Function/ValueSources/FieldCacheSource.cs
+++ b/src/Lucene.Net.Queries/Function/ValueSources/FieldCacheSource.cs
@@ -1,4 +1,5 @@
 using Lucene.Net.Search;
+using System;
 
 namespace Lucene.Net.Queries.Function.ValueSources
 {
@@ -61,7 +62,7 @@ namespace Lucene.Net.Queries.Function.ValueSources
             {
                 return false;
             }
-            return m_field.Equals(other.m_field) && m_cache == other.m_cache;
+            return m_field.Equals(other.m_field, StringComparison.Ordinal) && m_cache == other.m_cache;
         }
 
         public override int GetHashCode()
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/JoinDocFreqValueSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/JoinDocFreqValueSource.cs
index bca06eb..4363675 100644
--- a/src/Lucene.Net.Queries/Function/ValueSources/JoinDocFreqValueSource.cs
+++ b/src/Lucene.Net.Queries/Function/ValueSources/JoinDocFreqValueSource.cs
@@ -106,7 +106,7 @@ namespace Lucene.Net.Queries.Function.ValueSources
                 return false;
             }
             var other = (JoinDocFreqValueSource)o;
-            if (!m_qfield.Equals(other.m_qfield))
+            if (!m_qfield.Equals(other.m_qfield, StringComparison.Ordinal))
             {
                 return false;
             }
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/LiteralValueSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/LiteralValueSource.cs
index f6ca6ff..a3b0e17 100644
--- a/src/Lucene.Net.Queries/Function/ValueSources/LiteralValueSource.cs
+++ b/src/Lucene.Net.Queries/Function/ValueSources/LiteralValueSource.cs
@@ -1,6 +1,7 @@
 using Lucene.Net.Index;
 using Lucene.Net.Queries.Function.DocValues;
 using Lucene.Net.Util;
+using System;
 using System.Collections;
 
 namespace Lucene.Net.Queries.Function.ValueSources
@@ -93,7 +94,7 @@ namespace Lucene.Net.Queries.Function.ValueSources
             var that = o as LiteralValueSource;
             if (that == null)
                 return false;
-            return m_str.Equals(that.m_str);
+            return m_str.Equals(that.m_str, StringComparison.Ordinal);
 
         }
 
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/MultiFloatFunction.cs b/src/Lucene.Net.Queries/Function/ValueSources/MultiFloatFunction.cs
index 3815796..da7b356 100644
--- a/src/Lucene.Net.Queries/Function/ValueSources/MultiFloatFunction.cs
+++ b/src/Lucene.Net.Queries/Function/ValueSources/MultiFloatFunction.cs
@@ -2,6 +2,7 @@
 using Lucene.Net.Queries.Function.DocValues;
 using Lucene.Net.Search;
 using Lucene.Net.Support;
+using System;
 using System.Collections;
 using System.Text;
 
@@ -139,7 +140,7 @@ namespace Lucene.Net.Queries.Function.ValueSources
             var other = o as MultiSingleFunction;
             if (other == null)
                 return false;
-            return Name.Equals(other.Name) && Arrays.Equals(this.m_sources, other.m_sources);
+            return Name.Equals(other.Name, StringComparison.Ordinal) && Arrays.Equals(this.m_sources, other.m_sources);
         }
     }
 }
\ No newline at end of file
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/NormValueSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/NormValueSource.cs
index 7d06ab8..19ffc4c 100644
--- a/src/Lucene.Net.Queries/Function/ValueSources/NormValueSource.cs
+++ b/src/Lucene.Net.Queries/Function/ValueSources/NormValueSource.cs
@@ -2,6 +2,7 @@
 using Lucene.Net.Queries.Function.DocValues;
 using Lucene.Net.Search;
 using Lucene.Net.Search.Similarities;
+using System;
 using System.Collections;
 
 namespace Lucene.Net.Queries.Function.ValueSources
@@ -103,7 +104,7 @@ namespace Lucene.Net.Queries.Function.ValueSources
             {
                 return false;
             }
-            return this.m_field.Equals(((NormValueSource)o).m_field);
+            return this.m_field.Equals(((NormValueSource)o).m_field, StringComparison.Ordinal);
         }
 
         public override int GetHashCode()
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/OrdFieldSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/OrdFieldSource.cs
index 9bb3ab8..c8a0c09 100644
--- a/src/Lucene.Net.Queries/Function/ValueSources/OrdFieldSource.cs
+++ b/src/Lucene.Net.Queries/Function/ValueSources/OrdFieldSource.cs
@@ -2,6 +2,7 @@
 using Lucene.Net.Queries.Function.DocValues;
 using Lucene.Net.Search;
 using Lucene.Net.Util.Mutable;
+using System;
 using System.Collections;
 
 namespace Lucene.Net.Queries.Function.ValueSources
@@ -144,7 +145,7 @@ namespace Lucene.Net.Queries.Function.ValueSources
 
         public override bool Equals(object o)
         {
-            return o != null && o.GetType() == typeof(OrdFieldSource) && this.m_field.Equals(((OrdFieldSource)o).m_field);
+            return o != null && o.GetType() == typeof(OrdFieldSource) && this.m_field.Equals(((OrdFieldSource)o).m_field, StringComparison.Ordinal);
         }
 
         private static readonly int hcode = typeof(OrdFieldSource).GetHashCode();
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/ReverseOrdFieldSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/ReverseOrdFieldSource.cs
index e212dec..ff315bc 100644
--- a/src/Lucene.Net.Queries/Function/ValueSources/ReverseOrdFieldSource.cs
+++ b/src/Lucene.Net.Queries/Function/ValueSources/ReverseOrdFieldSource.cs
@@ -1,6 +1,7 @@
 using Lucene.Net.Index;
 using Lucene.Net.Queries.Function.DocValues;
 using Lucene.Net.Search;
+using System;
 using System.Collections;
 
 namespace Lucene.Net.Queries.Function.ValueSources
@@ -109,7 +110,7 @@ namespace Lucene.Net.Queries.Function.ValueSources
             var other = o as ReverseOrdFieldSource;
             if (other == null)
                 return false;
-            return this.field.Equals(other.field);
+            return this.field.Equals(other.field, StringComparison.Ordinal);
         }
 
         private static readonly int hcode = typeof(ReverseOrdFieldSource).GetHashCode();
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/SingleFunction.cs b/src/Lucene.Net.Queries/Function/ValueSources/SingleFunction.cs
index 89c225f..a241af3 100644
--- a/src/Lucene.Net.Queries/Function/ValueSources/SingleFunction.cs
+++ b/src/Lucene.Net.Queries/Function/ValueSources/SingleFunction.cs
@@ -1,4 +1,5 @@
 using Lucene.Net.Search;
+using System;
 using System.Collections;
 
 namespace Lucene.Net.Queries.Function.ValueSources
@@ -51,7 +52,7 @@ namespace Lucene.Net.Queries.Function.ValueSources
             var other = o as SingularFunction;
             if (other == null)
                 return false;
-            return Name.Equals(other.Name) 
+            return Name.Equals(other.Name, StringComparison.Ordinal) 
                 && m_source.Equals(other.m_source);
         }
 
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/SumTotalTermFreqValueSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/SumTotalTermFreqValueSource.cs
index 9b9e183..ec03a69 100644
--- a/src/Lucene.Net.Queries/Function/ValueSources/SumTotalTermFreqValueSource.cs
+++ b/src/Lucene.Net.Queries/Function/ValueSources/SumTotalTermFreqValueSource.cs
@@ -1,6 +1,7 @@
 using Lucene.Net.Index;
 using Lucene.Net.Queries.Function.DocValues;
 using Lucene.Net.Search;
+using System;
 using System.Collections;
 
 namespace Lucene.Net.Queries.Function.ValueSources
@@ -115,7 +116,7 @@ namespace Lucene.Net.Queries.Function.ValueSources
             var other = o as SumTotalTermFreqValueSource;
             if (other == null)
                 return false;
-            return this.m_indexedField.Equals(other.m_indexedField);
+            return this.m_indexedField.Equals(other.m_indexedField, StringComparison.Ordinal);
         }
     }
 }
\ No newline at end of file
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/TotalTermFreqValueSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/TotalTermFreqValueSource.cs
index e008090..69eb234 100644
--- a/src/Lucene.Net.Queries/Function/ValueSources/TotalTermFreqValueSource.cs
+++ b/src/Lucene.Net.Queries/Function/ValueSources/TotalTermFreqValueSource.cs
@@ -2,6 +2,7 @@
 using Lucene.Net.Queries.Function.DocValues;
 using Lucene.Net.Search;
 using Lucene.Net.Util;
+using System;
 using System.Collections;
 
 namespace Lucene.Net.Queries.Function.ValueSources
@@ -114,7 +115,7 @@ namespace Lucene.Net.Queries.Function.ValueSources
                 return false;
             }
             var other = (TotalTermFreqValueSource)o;
-            return this.m_indexedField.Equals(other.m_indexedField) && this.m_indexedBytes.Equals(other.m_indexedBytes);
+            return this.m_indexedField.Equals(other.m_indexedField, StringComparison.Ordinal) && this.m_indexedBytes.Equals(other.m_indexedBytes);
         }
     }
 }
\ No newline at end of file
diff --git a/src/Lucene.Net.Queries/Mlt/MoreLikeThisQuery.cs b/src/Lucene.Net.Queries/Mlt/MoreLikeThisQuery.cs
index 999cc7a..4920e63 100644
--- a/src/Lucene.Net.Queries/Mlt/MoreLikeThisQuery.cs
+++ b/src/Lucene.Net.Queries/Mlt/MoreLikeThisQuery.cs
@@ -5,6 +5,7 @@ using Lucene.Net.Analysis;
 using Lucene.Net.Index;
 using Lucene.Net.Search;
 using Lucene.Net.Support;
+using System;
 using System.Collections.Generic;
 using System.Diagnostics.CodeAnalysis;
 using System.IO;
@@ -184,7 +185,7 @@ namespace Lucene.Net.Queries.Mlt
                     return false;
                 }
             }
-            else if (!fieldName.Equals(other.fieldName))
+            else if (!fieldName.Equals(other.fieldName, StringComparison.Ordinal))
             {
                 return false;
             }
@@ -195,7 +196,7 @@ namespace Lucene.Net.Queries.Mlt
                     return false;
                 }
             }
-            else if (!likeText.Equals(other.likeText))
+            else if (!likeText.Equals(other.likeText, StringComparison.Ordinal))
             {
                 return false;
             }
diff --git a/src/Lucene.Net.Queries/TermsFilter.cs b/src/Lucene.Net.Queries/TermsFilter.cs
index 705e441..6d728ba 100644
--- a/src/Lucene.Net.Queries/TermsFilter.cs
+++ b/src/Lucene.Net.Queries/TermsFilter.cs
@@ -181,7 +181,7 @@ namespace Lucene.Net.Queries
                 if (previousField != null)
                 {
                     // deduplicate
-                    if (previousField.Equals(currentField))
+                    if (previousField.Equals(currentField, StringComparison.Ordinal))
                     {
                         if (previousTerm.BytesEquals(currentTerm))
                         {
@@ -365,7 +365,7 @@ namespace Lucene.Net.Queries
                         return false;
                     }
                 }
-                else if (!field.Equals(other.field))
+                else if (!field.Equals(other.field, StringComparison.Ordinal))
                 {
                     return false;
                 }
diff --git a/src/Lucene.Net.QueryParser/Classic/QueryParser.cs b/src/Lucene.Net.QueryParser/Classic/QueryParser.cs
index a525a98..4eee7fd 100644
--- a/src/Lucene.Net.QueryParser/Classic/QueryParser.cs
+++ b/src/Lucene.Net.QueryParser/Classic/QueryParser.cs
@@ -494,7 +494,7 @@ namespace Lucene.Net.QueryParsers.Classic
                     {
                         goop1.Image = goop1.Image.Substring(1, goop1.Image.Length - 2);
                     }
-                    else if ("*".Equals(goop1.Image))
+                    else if ("*".Equals(goop1.Image, StringComparison.Ordinal))
                     {
                         startOpen = true;
                     }
@@ -502,7 +502,7 @@ namespace Lucene.Net.QueryParsers.Classic
                     {
                         goop2.Image = goop2.Image.Substring(1, goop2.Image.Length - 2);
                     }
-                    else if ("*".Equals(goop2.Image))
+                    else if ("*".Equals(goop2.Image, StringComparison.Ordinal))
                     {
                         endOpen = true;
                     }
diff --git a/src/Lucene.Net.QueryParser/Classic/QueryParserBase.cs b/src/Lucene.Net.QueryParser/Classic/QueryParserBase.cs
index 65634bc..67e56b8 100644
--- a/src/Lucene.Net.QueryParser/Classic/QueryParserBase.cs
+++ b/src/Lucene.Net.QueryParser/Classic/QueryParserBase.cs
@@ -751,9 +751,9 @@ namespace Lucene.Net.QueryParsers.Classic
         /// <returns>Resulting <see cref="Query"/> built for the term</returns>
         protected internal virtual Query GetWildcardQuery(string field, string termStr)
         {
-            if ("*".Equals(field))
+            if ("*".Equals(field, StringComparison.Ordinal))
             {
-                if ("*".Equals(termStr)) return NewMatchAllDocsQuery();
+                if ("*".Equals(termStr, StringComparison.Ordinal)) return NewMatchAllDocsQuery();
             }
             if (!AllowLeadingWildcard && (termStr.StartsWith("*", StringComparison.Ordinal) || termStr.StartsWith("?", StringComparison.Ordinal)))
                 throw new ParseException("'*' or '?' not allowed as first character in WildcardQuery");
diff --git a/src/Lucene.Net.QueryParser/ComplexPhrase/ComplexPhraseQueryParser.cs b/src/Lucene.Net.QueryParser/ComplexPhrase/ComplexPhraseQueryParser.cs
index 02c6d2b..af198b6 100644
--- a/src/Lucene.Net.QueryParser/ComplexPhrase/ComplexPhraseQueryParser.cs
+++ b/src/Lucene.Net.QueryParser/ComplexPhrase/ComplexPhraseQueryParser.cs
@@ -152,7 +152,7 @@ namespace Lucene.Net.QueryParsers.ComplexPhrase
         // Helper method used to report on any clauses that appear in query syntax
         private void CheckPhraseClauseIsForSameField(string field)
         {
-            if (!field.Equals(currentPhraseQuery.Field))
+            if (!field.Equals(currentPhraseQuery.Field, StringComparison.Ordinal))
             {
                 throw new ParseException("Cannot have clause for field \"" + field
                     + "\" nested in phrase " + " for field \"" + currentPhraseQuery.Field
@@ -449,7 +449,7 @@ namespace Lucene.Net.QueryParsers.ComplexPhrase
                     if (other.field != null)
                         return false;
                 }
-                else if (!field.Equals(other.field))
+                else if (!field.Equals(other.field, StringComparison.Ordinal))
                     return false;
                 if (phrasedQueryStringContents == null)
                 {
@@ -457,7 +457,7 @@ namespace Lucene.Net.QueryParsers.ComplexPhrase
                         return false;
                 }
                 else if (!phrasedQueryStringContents
-                  .Equals(other.phrasedQueryStringContents))
+                  .Equals(other.phrasedQueryStringContents, StringComparison.Ordinal))
                     return false;
                 if (slopFactor != other.slopFactor)
                     return false;
diff --git a/src/Lucene.Net.QueryParser/Flexible/Core/Nodes/QueryNodeImpl.cs b/src/Lucene.Net.QueryParser/Flexible/Core/Nodes/QueryNodeImpl.cs
index a1d56c0..b779f9a 100644
--- a/src/Lucene.Net.QueryParser/Flexible/Core/Nodes/QueryNodeImpl.cs
+++ b/src/Lucene.Net.QueryParser/Flexible/Core/Nodes/QueryNodeImpl.cs
@@ -236,7 +236,7 @@ namespace Lucene.Net.QueryParsers.Flexible.Core.Nodes
                 return true;
             if (fld == null)
                 return true;
-            if (QueryNode.PLAINTEXT_FIELD_NAME.Equals(StringUtils.ToString(fld)))
+            if (QueryNode.PLAINTEXT_FIELD_NAME.Equals(StringUtils.ToString(fld), StringComparison.Ordinal))
                 return true;
             return false;
         }
diff --git a/src/Lucene.Net.QueryParser/Flexible/Standard/Nodes/AbstractRangeQueryNode.cs b/src/Lucene.Net.QueryParser/Flexible/Standard/Nodes/AbstractRangeQueryNode.cs
index 5c44a1c..f7e9eb2 100644
--- a/src/Lucene.Net.QueryParser/Flexible/Standard/Nodes/AbstractRangeQueryNode.cs
+++ b/src/Lucene.Net.QueryParser/Flexible/Standard/Nodes/AbstractRangeQueryNode.cs
@@ -142,8 +142,8 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Nodes
                 string upperField = StringUtils.ToString(upper.Field);
 
                 if ((upperField != null || lowerField != null)
-                    && ((upperField != null && !upperField.Equals(lowerField)) || !lowerField
-                        .Equals(upperField)))
+                    && ((upperField != null && !upperField.Equals(lowerField, StringComparison.Ordinal)) || !lowerField
+                        .Equals(upperField, StringComparison.Ordinal)))
                 {
                     throw new ArgumentException(
                         "lower and upper bounds should have the same field name!");
diff --git a/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/MatchAllDocsQueryNodeProcessor.cs b/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/MatchAllDocsQueryNodeProcessor.cs
index 16dad85..d7a1298 100644
--- a/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/MatchAllDocsQueryNodeProcessor.cs
+++ b/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/MatchAllDocsQueryNodeProcessor.cs
@@ -1,5 +1,6 @@
 using Lucene.Net.QueryParsers.Flexible.Core.Nodes;
 using Lucene.Net.QueryParsers.Flexible.Core.Processors;
+using System;
 using System.Collections.Generic;
 
 namespace Lucene.Net.QueryParsers.Flexible.Standard.Processors
@@ -40,8 +41,8 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Processors
             {
                 FieldQueryNode fqn = (FieldQueryNode)node;
 
-                if (fqn.Field.ToString().Equals("*")
-                    && fqn.Text.ToString().Equals("*"))
+                if (fqn.Field.ToString().Equals("*", StringComparison.Ordinal)
+                    && fqn.Text.ToString().Equals("*", StringComparison.Ordinal))
                 {
                     return new MatchAllDocsQueryNode();
                 }
diff --git a/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/OpenRangeQueryNodeProcessor.cs b/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/OpenRangeQueryNodeProcessor.cs
index 3f4932d..9eded07 100644
--- a/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/OpenRangeQueryNodeProcessor.cs
+++ b/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/OpenRangeQueryNodeProcessor.cs
@@ -3,6 +3,7 @@ using Lucene.Net.QueryParsers.Flexible.Core.Processors;
 using Lucene.Net.QueryParsers.Flexible.Core.Util;
 using Lucene.Net.QueryParsers.Flexible.Standard.Nodes;
 using Lucene.Net.Support;
+using System;
 using System.Collections.Generic;
 
 namespace Lucene.Net.QueryParsers.Flexible.Standard.Processors
@@ -43,14 +44,14 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Processors
                 ICharSequence lowerText = lowerNode.Text;
                 ICharSequence upperText = upperNode.Text;
 
-                if (OPEN_RANGE_TOKEN.Equals(upperNode.GetTextAsString())
+                if (OPEN_RANGE_TOKEN.Equals(upperNode.GetTextAsString(), StringComparison.Ordinal)
                     && (!(upperText is UnescapedCharSequence) || !((UnescapedCharSequence)upperText)
                         .WasEscaped(0)))
                 {
                     upperText = "".ToCharSequence();
                 }
 
-                if (OPEN_RANGE_TOKEN.Equals(lowerNode.GetTextAsString())
+                if (OPEN_RANGE_TOKEN.Equals(lowerNode.GetTextAsString(), StringComparison.Ordinal)
                     && (!(lowerText is UnescapedCharSequence) || !((UnescapedCharSequence)lowerText)
                         .WasEscaped(0)))
                 {
diff --git a/src/Lucene.Net.QueryParser/Surround/Query/RewriteQuery.cs b/src/Lucene.Net.QueryParser/Surround/Query/RewriteQuery.cs
index b2d3c5b..c9857f5 100644
--- a/src/Lucene.Net.QueryParser/Surround/Query/RewriteQuery.cs
+++ b/src/Lucene.Net.QueryParser/Surround/Query/RewriteQuery.cs
@@ -68,7 +68,7 @@ namespace Lucene.Net.QueryParsers.Surround.Query
             if (!GetType().Equals(obj.GetType()))
                 return false;
             RewriteQuery<SQ> other = (RewriteQuery<SQ>)obj;
-            return m_fieldName.Equals(other.m_fieldName)
+            return m_fieldName.Equals(other.m_fieldName, StringComparison.Ordinal)
                 && m_qf.Equals(other.m_qf)
                 && m_srndQuery.Equals(other.m_srndQuery);
         }
diff --git a/src/Lucene.Net.QueryParser/Surround/Query/SrndQuery.cs b/src/Lucene.Net.QueryParser/Surround/Query/SrndQuery.cs
index 93272e1..2b8a486 100644
--- a/src/Lucene.Net.QueryParser/Surround/Query/SrndQuery.cs
+++ b/src/Lucene.Net.QueryParser/Surround/Query/SrndQuery.cs
@@ -119,7 +119,7 @@ namespace Lucene.Net.QueryParsers.Surround.Query
                 return false;
             if (!GetType().Equals(obj.GetType()))
                 return false;
-            return ToString().Equals(obj.ToString());
+            return ToString().Equals(obj.ToString(), StringComparison.Ordinal);
         }
 
         /// <summary> An empty Lucene query  </summary>
diff --git a/src/Lucene.Net.QueryParser/Xml/Builders/BooleanQueryBuilder.cs b/src/Lucene.Net.QueryParser/Xml/Builders/BooleanQueryBuilder.cs
index c2d7600..c7a2eb1 100644
--- a/src/Lucene.Net.QueryParser/Xml/Builders/BooleanQueryBuilder.cs
+++ b/src/Lucene.Net.QueryParser/Xml/Builders/BooleanQueryBuilder.cs
@@ -79,7 +79,7 @@ namespace Lucene.Net.QueryParsers.Xml.Builders
                 }
                 else
                 {
-                    if (("should".Equals(occs, StringComparison.OrdinalIgnoreCase)) || ("".Equals(occs)))
+                    if (("should".Equals(occs, StringComparison.OrdinalIgnoreCase)) || ("".Equals(occs, StringComparison.Ordinal)))
                     {
                         occurs = Occur.SHOULD;
                     }
diff --git a/src/Lucene.Net.QueryParser/Xml/DOMUtils.cs b/src/Lucene.Net.QueryParser/Xml/DOMUtils.cs
index 72f99d8..364f61d 100644
--- a/src/Lucene.Net.QueryParser/Xml/DOMUtils.cs
+++ b/src/Lucene.Net.QueryParser/Xml/DOMUtils.cs
@@ -89,7 +89,7 @@ namespace Lucene.Net.QueryParsers.Xml
         {
             for (XmlNode kid = e.FirstChild; kid != null; kid = kid.NextSibling)
             {
-                if ((kid.NodeType == XmlNodeType.Element) && (name.Equals(kid.Name)))
+                if ((kid.NodeType == XmlNodeType.Element) && (name.Equals(kid.Name, StringComparison.Ordinal)))
                 {
                     return (XmlElement)kid;
                 }
@@ -106,7 +106,7 @@ namespace Lucene.Net.QueryParsers.Xml
         public static string GetAttributeWithInheritance(XmlElement element, string attributeName)
         {
             string result = element.GetAttribute(attributeName);
-            if ((result == null) || ("".Equals(result)))
+            if ((result == null) || ("".Equals(result, StringComparison.Ordinal)))
             {
                 XmlNode n = element.ParentNode;
                 if ((n == element) || (n == null))
@@ -146,26 +146,26 @@ namespace Lucene.Net.QueryParsers.Xml
         public static string GetAttribute(XmlElement element, string attributeName, string deflt)
         {
             string result = element.GetAttribute(attributeName);
-            return (result == null) || ("".Equals(result)) ? deflt : result;
+            return (result == null) || ("".Equals(result, StringComparison.Ordinal)) ? deflt : result;
         }
 
         public static float GetAttribute(XmlElement element, string attributeName, float deflt)
         {
             string result = element.GetAttribute(attributeName);
-            return (result == null) || ("".Equals(result)) ? deflt : Convert.ToSingle(result, CultureInfo.InvariantCulture);
+            return (result == null) || ("".Equals(result, StringComparison.Ordinal)) ? deflt : Convert.ToSingle(result, CultureInfo.InvariantCulture);
         }
 
         public static int GetAttribute(XmlElement element, string attributeName, int deflt)
         {
             string result = element.GetAttribute(attributeName);
-            return (result == null) || ("".Equals(result)) ? deflt : Convert.ToInt32(result, CultureInfo.InvariantCulture);
+            return (result == null) || ("".Equals(result, StringComparison.Ordinal)) ? deflt : Convert.ToInt32(result, CultureInfo.InvariantCulture);
         }
 
         public static bool GetAttribute(XmlElement element, string attributeName,
                                            bool deflt)
         {
             string result = element.GetAttribute(attributeName);
-            return (result == null) || ("".Equals(result)) ? deflt : Convert.ToBoolean(result, CultureInfo.InvariantCulture);
+            return (result == null) || ("".Equals(result, StringComparison.Ordinal)) ? deflt : Convert.ToBoolean(result, CultureInfo.InvariantCulture);
         }
 
         /* Returns text of node and all child nodes - without markup */
diff --git a/src/Lucene.Net.Replicator/IndexAndTaxonomyRevision.cs b/src/Lucene.Net.Replicator/IndexAndTaxonomyRevision.cs
index de1ed16..ba6e90e 100644
--- a/src/Lucene.Net.Replicator/IndexAndTaxonomyRevision.cs
+++ b/src/Lucene.Net.Replicator/IndexAndTaxonomyRevision.cs
@@ -186,8 +186,8 @@ namespace Lucene.Net.Replicator
         /// <exception cref="IOException"></exception>
         public virtual Stream Open(string source, string fileName)
         {
-            Debug.Assert(source.Equals(INDEX_SOURCE) || source.Equals(TAXONOMY_SOURCE), string.Format("invalid source; expected=({0} or {1}) got={2}", INDEX_SOURCE, TAXONOMY_SOURCE, source));
-            IndexCommit commit = source.Equals(INDEX_SOURCE) ? indexCommit : taxonomyCommit;
+            Debug.Assert(source.Equals(INDEX_SOURCE, StringComparison.Ordinal) || source.Equals(TAXONOMY_SOURCE, StringComparison.Ordinal), string.Format("invalid source; expected=({0} or {1}) got={2}", INDEX_SOURCE, TAXONOMY_SOURCE, source));
+            IndexCommit commit = source.Equals(INDEX_SOURCE, StringComparison.Ordinal) ? indexCommit : taxonomyCommit;
             return new IndexInputStream(commit.Directory.OpenInput(fileName, IOContext.READ_ONCE));
         }
 
diff --git a/src/Lucene.Net.Replicator/IndexReplicationHandler.cs b/src/Lucene.Net.Replicator/IndexReplicationHandler.cs
index 99d3445..93274a1 100644
--- a/src/Lucene.Net.Replicator/IndexReplicationHandler.cs
+++ b/src/Lucene.Net.Replicator/IndexReplicationHandler.cs
@@ -115,7 +115,7 @@ namespace Lucene.Net.Replicator
             string segmentsFile = files.Last();
             //NOTE: Relying on side-effects outside?
             files.RemoveAt(files.Count - 1);
-            if (!segmentsFile.StartsWith(IndexFileNames.SEGMENTS) || segmentsFile.Equals(IndexFileNames.SEGMENTS_GEN))
+            if (!segmentsFile.StartsWith(IndexFileNames.SEGMENTS) || segmentsFile.Equals(IndexFileNames.SEGMENTS_GEN, StringComparison.Ordinal))
             {
                 throw new InvalidOperationException(
                     string.Format("last file to copy+sync must be segments_N but got {0}; check your Revision implementation!", segmentsFile));
@@ -163,7 +163,7 @@ namespace Lucene.Net.Replicator
                 // if there were any IO errors reading the expected commit point (i.e.
                 // segments files mismatch), then ignore that commit either.
 
-                if (commit != null && commit.SegmentsFileName.Equals(segmentsFile))
+                if (commit != null && commit.SegmentsFileName.Equals(segmentsFile, StringComparison.Ordinal))
                 {
                     HashSet<string> commitFiles = new HashSet<string>( commit.FileNames
                         .Union(new[] {IndexFileNames.SEGMENTS_GEN}));
diff --git a/src/Lucene.Net.Replicator/IndexRevision.cs b/src/Lucene.Net.Replicator/IndexRevision.cs
index 092fc3e..e35939c 100644
--- a/src/Lucene.Net.Replicator/IndexRevision.cs
+++ b/src/Lucene.Net.Replicator/IndexRevision.cs
@@ -65,7 +65,7 @@ namespace Lucene.Net.Replicator
         public static IDictionary<string, IList<RevisionFile>> RevisionFiles(IndexCommit commit)
         {
             List<RevisionFile> revisionFiles = commit.FileNames
-                .Where(file => !string.Equals(file, commit.SegmentsFileName))
+                .Where(file => !string.Equals(file, commit.SegmentsFileName, StringComparison.Ordinal))
                 .Select(file => CreateRevisionFile(file, commit.Directory))
                 //Note: segments_N must be last
                 .Union(new[] {CreateRevisionFile(commit.SegmentsFileName, commit.Directory)})
@@ -125,7 +125,7 @@ namespace Lucene.Net.Replicator
 
         public virtual Stream Open(string source, string fileName)
         {
-            Debug.Assert(source.Equals(SOURCE), string.Format("invalid source; expected={0} got={1}", SOURCE, source));
+            Debug.Assert(source.Equals(SOURCE, StringComparison.Ordinal), string.Format("invalid source; expected={0} got={1}", SOURCE, source));
             return new IndexInputStream(commit.Directory.OpenInput(fileName, IOContext.READ_ONCE));
         }
 
diff --git a/src/Lucene.Net.Replicator/RevisionFile.cs b/src/Lucene.Net.Replicator/RevisionFile.cs
index 139ac23..3273a14 100644
--- a/src/Lucene.Net.Replicator/RevisionFile.cs
+++ b/src/Lucene.Net.Replicator/RevisionFile.cs
@@ -64,7 +64,7 @@ namespace Lucene.Net.Replicator
         {
             if (ReferenceEquals(null, other)) return false;
             if (ReferenceEquals(this, other)) return true;
-            return string.Equals(FileName, other.FileName) && Length == other.Length;
+            return string.Equals(FileName, other.FileName, StringComparison.Ordinal) && Length == other.Length;
         }
 
         public override int GetHashCode()
diff --git a/src/Lucene.Net.Sandbox/Queries/DuplicateFilter.cs b/src/Lucene.Net.Sandbox/Queries/DuplicateFilter.cs
index 9d716f9..769822a 100644
--- a/src/Lucene.Net.Sandbox/Queries/DuplicateFilter.cs
+++ b/src/Lucene.Net.Sandbox/Queries/DuplicateFilter.cs
@@ -1,6 +1,7 @@
 using Lucene.Net.Index;
 using Lucene.Net.Search;
 using Lucene.Net.Util;
+using System;
 
 namespace Lucene.Net.Sandbox.Queries
 {
@@ -204,7 +205,7 @@ namespace Lucene.Net.Sandbox.Queries
             DuplicateFilter other = (DuplicateFilter)obj;
             return keepMode == other.keepMode &&
                 processingMode == other.processingMode &&
-                fieldName != null && fieldName.Equals(other.fieldName);
+                fieldName != null && fieldName.Equals(other.fieldName, StringComparison.Ordinal);
         }
 
 
diff --git a/src/Lucene.Net.Sandbox/Queries/SlowFuzzyQuery.cs b/src/Lucene.Net.Sandbox/Queries/SlowFuzzyQuery.cs
index 9a068f1..2701b2c 100644
--- a/src/Lucene.Net.Sandbox/Queries/SlowFuzzyQuery.cs
+++ b/src/Lucene.Net.Sandbox/Queries/SlowFuzzyQuery.cs
@@ -166,7 +166,7 @@ namespace Lucene.Net.Sandbox.Queries
         public override string ToString(string field)
         {
             StringBuilder buffer = new StringBuilder();
-            if (!m_term.Field.Equals(field))
+            if (!m_term.Field.Equals(field, StringComparison.Ordinal))
             {
                 buffer.Append(m_term.Field);
                 buffer.Append(":");
diff --git a/src/Lucene.Net.Spatial/DisjointSpatialFilter.cs b/src/Lucene.Net.Spatial/DisjointSpatialFilter.cs
index 13512c8..d9c5a72 100644
--- a/src/Lucene.Net.Spatial/DisjointSpatialFilter.cs
+++ b/src/Lucene.Net.Spatial/DisjointSpatialFilter.cs
@@ -69,7 +69,7 @@ namespace Lucene.Net.Spatial
                 return false;
             }
             var that = (DisjointSpatialFilter)o;
-            if (field != null ? !field.Equals(that.field) : that.field != null)
+            if (field != null ? !field.Equals(that.field, StringComparison.Ordinal) : that.field != null)
             {
                 return false;
             }
diff --git a/src/Lucene.Net.Spatial/Prefix/AbstractPrefixTreeFilter.cs b/src/Lucene.Net.Spatial/Prefix/AbstractPrefixTreeFilter.cs
index 5491a54..a9230cf 100644
--- a/src/Lucene.Net.Spatial/Prefix/AbstractPrefixTreeFilter.cs
+++ b/src/Lucene.Net.Spatial/Prefix/AbstractPrefixTreeFilter.cs
@@ -3,6 +3,7 @@ using Lucene.Net.Search;
 using Lucene.Net.Spatial.Prefix.Tree;
 using Lucene.Net.Util;
 using Spatial4n.Core.Shapes;
+using System;
 using System.Diagnostics;
 
 namespace Lucene.Net.Spatial.Prefix
@@ -58,7 +59,7 @@ namespace Lucene.Net.Spatial.Prefix
             {
                 return false;
             }
-            if (!m_fieldName.Equals(that.m_fieldName))
+            if (!m_fieldName.Equals(that.m_fieldName, StringComparison.Ordinal))
             {
                 return false;
             }
diff --git a/src/Lucene.Net.Spatial/Prefix/Tree/Cell.cs b/src/Lucene.Net.Spatial/Prefix/Tree/Cell.cs
index 3182a93..86fb3ab 100644
--- a/src/Lucene.Net.Spatial/Prefix/Tree/Cell.cs
+++ b/src/Lucene.Net.Spatial/Prefix/Tree/Cell.cs
@@ -288,7 +288,7 @@ namespace Lucene.Net.Spatial.Prefix.Tree
         public override bool Equals(object obj)
         {
             return !(obj == null || !(obj is Cell)) &&
-                   TokenString.Equals(((Cell)obj).TokenString);
+                   TokenString.Equals(((Cell)obj).TokenString, StringComparison.Ordinal);
         }
 
         public override int GetHashCode()
diff --git a/src/Lucene.Net.Spatial/Serialized/SerializedDVStrategy.cs b/src/Lucene.Net.Spatial/Serialized/SerializedDVStrategy.cs
index 247cc8f..e18669b 100644
--- a/src/Lucene.Net.Spatial/Serialized/SerializedDVStrategy.cs
+++ b/src/Lucene.Net.Spatial/Serialized/SerializedDVStrategy.cs
@@ -330,7 +330,7 @@ namespace Lucene.Net.Spatial.Serialized
 
                 ShapeDocValueSource that = (ShapeDocValueSource)o;
 
-                if (!fieldName.Equals(that.fieldName)) return false;
+                if (!fieldName.Equals(that.fieldName, StringComparison.Ordinal)) return false;
 
                 return true;
             }
diff --git a/src/Lucene.Net.Suggest/Spell/SpellChecker.cs b/src/Lucene.Net.Suggest/Spell/SpellChecker.cs
index 10aee12..5cebc1a 100644
--- a/src/Lucene.Net.Suggest/Spell/SpellChecker.cs
+++ b/src/Lucene.Net.Suggest/Spell/SpellChecker.cs
@@ -375,7 +375,7 @@ namespace Lucene.Net.Search.Spell
                     sugWord.String = indexSearcher.Doc(hits[i].Doc).Get(F_WORD); // get orig word
 
                     // don't suggest a word for itself, that would be silly
-                    if (sugWord.String.Equals(word))
+                    if (sugWord.String.Equals(word, StringComparison.Ordinal))
                     {
                         continue;
                     }
diff --git a/src/Lucene.Net.Suggest/Suggest/Analyzing/AnalyzingInfixSuggester.cs b/src/Lucene.Net.Suggest/Suggest/Analyzing/AnalyzingInfixSuggester.cs
index bbe19fb..22f2dd6 100644
--- a/src/Lucene.Net.Suggest/Suggest/Analyzing/AnalyzingInfixSuggester.cs
+++ b/src/Lucene.Net.Suggest/Suggest/Analyzing/AnalyzingInfixSuggester.cs
@@ -271,7 +271,7 @@ namespace Lucene.Net.Search.Suggest.Analyzing
 
             protected override TokenStreamComponents WrapComponents(string fieldName, TokenStreamComponents components)
             {
-                if (fieldName.Equals("textgrams") && outerInstance.minPrefixChars > 0)
+                if (fieldName.Equals("textgrams", StringComparison.Ordinal) && outerInstance.minPrefixChars > 0)
                 {
                     return new TokenStreamComponents(components.Tokenizer, 
                         new EdgeNGramTokenFilter(
diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/CharFilters/HTMLStripCharFilterTest.cs b/src/Lucene.Net.Tests.Analysis.Common/Analysis/CharFilters/HTMLStripCharFilterTest.cs
index e81038c..ea10176 100644
--- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/CharFilters/HTMLStripCharFilterTest.cs
+++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/CharFilters/HTMLStripCharFilterTest.cs
@@ -721,7 +721,7 @@ namespace Lucene.Net.Analysis.CharFilters
             }
             catch (Exception e)
             {
-                if (gold.Equals(builder.ToString()))
+                if (gold.Equals(builder.ToString(), StringComparison.Ordinal))
                 {
                     throw e;
                 }
diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestStopFilter.cs b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestStopFilter.cs
index 95c7247..a516a8b 100644
--- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestStopFilter.cs
+++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestStopFilter.cs
@@ -190,7 +190,7 @@ namespace Lucene.Net.Analysis.Core
                 }
                 else if (m_input.IncrementToken())
                 {
-                    if (termAtt.ToString().Equals("the"))
+                    if (termAtt.ToString().Equals("the", StringComparison.Ordinal))
                     {
                         bufferedState = CaptureState();
                     }
diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Hunspell/TestAllDictionaries.cs b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Hunspell/TestAllDictionaries.cs
index c7b45ea..c1a1b97 100644
--- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Hunspell/TestAllDictionaries.cs
+++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Hunspell/TestAllDictionaries.cs
@@ -206,7 +206,7 @@ namespace Lucene.Net.Analysis.Hunspell
             string toTest = "hu_HU.zip";
             for (int i = 0; i < tests.Length; i++)
             {
-                if (tests[i].Equals(toTest))
+                if (tests[i].Equals(toTest, StringComparison.Ordinal))
                 {
                     FileInfo f = new FileInfo(System.IO.Path.Combine(DICTIONARY_HOME.FullName, tests[i]));
                     Debug.Assert(f.Exists);
diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Hunspell/TestAllDictionaries2.cs b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Hunspell/TestAllDictionaries2.cs
index 58938e3..018dc7a 100644
--- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Hunspell/TestAllDictionaries2.cs
+++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Hunspell/TestAllDictionaries2.cs
@@ -224,7 +224,7 @@ namespace Lucene.Net.Analysis.Hunspell
             string toTest = "lithuanian_spelling_check_dictionary-1.3-fx+tb+sm+fn.xpi";
             for (int i = 0; i < tests.Length; i++)
             {
-                if (tests[i].Equals(toTest))
+                if (tests[i].Equals(toTest, StringComparison.Ordinal))
                 {
                     FileInfo f = new FileInfo(System.IO.Path.Combine(DICTIONARY_HOME.FullName, tests[i]));
                     Debug.Assert(f.Exists);
diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Miscellaneous/TestASCIIFoldingFilter.cs b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Miscellaneous/TestASCIIFoldingFilter.cs
index d4d246f..450fcd6 100644
--- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Miscellaneous/TestASCIIFoldingFilter.cs
+++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Miscellaneous/TestASCIIFoldingFilter.cs
@@ -1,6 +1,7 @@
 using Lucene.Net.Analysis.Core;
 using Lucene.Net.Analysis.TokenAttributes;
 using NUnit.Framework;
+using System;
 using System.Collections.Generic;
 using System.IO;
 using System.Text;
@@ -33,7 +34,7 @@ namespace Lucene.Net.Analysis.Miscellaneous
         {
             assertTrue(filter.IncrementToken());
             assertEquals(expectedFolded, termAtt.ToString());
-            if (filter.PreserveOriginal && !expectedUnfolded.Equals(expectedFolded))
+            if (filter.PreserveOriginal && !expectedUnfolded.Equals(expectedFolded, StringComparison.Ordinal))
             {
                 assertTrue(filter.IncrementToken());
                 assertEquals(expectedUnfolded, termAtt.ToString());
diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Miscellaneous/TestLucene47WordDelimiterFilter.cs b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Miscellaneous/TestLucene47WordDelimiterFilter.cs
index 48d76d7..218a0a5 100644
--- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Miscellaneous/TestLucene47WordDelimiterFilter.cs
+++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Miscellaneous/TestLucene47WordDelimiterFilter.cs
@@ -222,7 +222,7 @@ namespace Lucene.Net.Analysis.Miscellaneous
             {
                 if (m_input.IncrementToken())
                 {
-                    if (termAtt.ToString().Equals("largegap") || termAtt.ToString().Equals("/"))
+                    if (termAtt.ToString().Equals("largegap", StringComparison.Ordinal) || termAtt.ToString().Equals("/", StringComparison.Ordinal))
                     {
                         posIncAtt.PositionIncrement = 10;
                     }
diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Miscellaneous/TestWordDelimiterFilter.cs b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Miscellaneous/TestWordDelimiterFilter.cs
index 0e9bf46..d1c14b6 100644
--- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Miscellaneous/TestWordDelimiterFilter.cs
+++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Miscellaneous/TestWordDelimiterFilter.cs
@@ -216,7 +216,7 @@ namespace Lucene.Net.Analysis.Miscellaneous
             {
                 if (m_input.IncrementToken())
                 {
-                    if (termAtt.ToString().Equals("largegap") || termAtt.ToString().Equals("/"))
+                    if (termAtt.ToString().Equals("largegap", StringComparison.Ordinal) || termAtt.ToString().Equals("/", StringComparison.Ordinal))
                     {
                         posIncAtt.PositionIncrement = 10;
                     }
diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Pattern/TestPatternReplaceCharFilter.cs b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Pattern/TestPatternReplaceCharFilter.cs
index 2fdec2b..5f07f96 100644
--- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Pattern/TestPatternReplaceCharFilter.cs
+++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Pattern/TestPatternReplaceCharFilter.cs
@@ -79,8 +79,8 @@ namespace Lucene.Net.Analysis.Pattern
                 }
             }
 
-            bool outputGood = expectedOutput.Equals(output.ToString());
-            bool indexMatchedGood = expectedIndexMatchedOutput.Equals(indexMatched.ToString());
+            bool outputGood = expectedOutput.Equals(output.ToString(), StringComparison.Ordinal);
+            bool indexMatchedGood = expectedIndexMatchedOutput.Equals(indexMatched.ToString(), StringComparison.Ordinal);
 
             if (!outputGood || !indexMatchedGood || false)
             {
diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Payloads/NumericPayloadTokenFilterTest.cs b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Payloads/NumericPayloadTokenFilterTest.cs
index bbb5acb..f261749 100644
--- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Payloads/NumericPayloadTokenFilterTest.cs
+++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Payloads/NumericPayloadTokenFilterTest.cs
@@ -38,10 +38,10 @@ namespace Lucene.Net.Analysis.Payloads
             nptf.Reset();
             while (nptf.IncrementToken())
             {
-                if (termAtt.ToString().Equals("dogs"))
+                if (termAtt.ToString().Equals("dogs", StringComparison.Ordinal))
                 {
                     seenDogs = true;
-                    assertTrue(typeAtt.Type + " is not equal to " + "D", typeAtt.Type.Equals("D") == true);
+                    assertTrue(typeAtt.Type + " is not equal to " + "D", typeAtt.Type.Equals("D", StringComparison.Ordinal) == true);
                     assertTrue("payloadAtt.getPayload() is null and it shouldn't be", payloadAtt.Payload != null);
                     byte[] bytes = payloadAtt.Payload.Bytes; //safe here to just use the bytes, otherwise we should use offset, length
                     assertTrue(bytes.Length + " does not equal: " + payloadAtt.Payload.Length, bytes.Length == payloadAtt.Payload.Length);
@@ -51,7 +51,7 @@ namespace Lucene.Net.Analysis.Payloads
                 }
                 else
                 {
-                    assertTrue(typeAtt.Type + " is not null and it should be", typeAtt.Type.Equals("word"));
+                    assertTrue(typeAtt.Type + " is not null and it should be", typeAtt.Type.Equals("word", StringComparison.Ordinal));
                 }
             }
             assertTrue(seenDogs + " does not equal: " + true, seenDogs == true);
@@ -75,7 +75,7 @@ namespace Lucene.Net.Analysis.Payloads
             {
                 if (m_input.IncrementToken())
                 {
-                    if (termAtt.ToString().Equals("dogs"))
+                    if (termAtt.ToString().Equals("dogs", StringComparison.Ordinal))
                     {
                         typeAtt.Type = "D";
                     }
diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Payloads/TypeAsPayloadTokenFilterTest.cs b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Payloads/TypeAsPayloadTokenFilterTest.cs
index 5a3a62f..68161e6 100644
--- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Payloads/TypeAsPayloadTokenFilterTest.cs
+++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Payloads/TypeAsPayloadTokenFilterTest.cs
@@ -1,5 +1,6 @@
 using Lucene.Net.Analysis.TokenAttributes;
 using NUnit.Framework;
+using System;
 using System.IO;
 
 namespace Lucene.Net.Analysis.Payloads
@@ -38,10 +39,10 @@ namespace Lucene.Net.Analysis.Payloads
             nptf.Reset();
             while (nptf.IncrementToken())
             {
-                assertTrue(typeAtt.Type + " is not null and it should be", typeAtt.Type.Equals(char.ToUpper(termAtt.Buffer[0]).ToString()));
+                assertTrue(typeAtt.Type + " is not null and it should be", typeAtt.Type.Equals(char.ToUpper(termAtt.Buffer[0]).ToString(), StringComparison.Ordinal));
                 assertTrue("nextToken.getPayload() is null and it shouldn't be", payloadAtt.Payload != null);
                 string type = payloadAtt.Payload.Utf8ToString();
-                assertTrue(type + " is not equal to " + typeAtt.Type, type.Equals(typeAtt.Type));
+                assertTrue(type + " is not equal to " + typeAtt.Type, type.Equals(typeAtt.Type, StringComparison.Ordinal));
                 count++;
             }
 
diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Sinks/TestTeeSinkTokenFilter.cs b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Sinks/TestTeeSinkTokenFilter.cs
index e140d2e..835103b 100644
--- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Sinks/TestTeeSinkTokenFilter.cs
+++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Sinks/TestTeeSinkTokenFilter.cs
@@ -71,7 +71,7 @@ namespace Lucene.Net.Analysis.Sinks
             public override bool Accept(AttributeSource a)
             {
                 ICharTermAttribute termAtt = a.GetAttribute<ICharTermAttribute>();
-                return termAtt.ToString().Equals("The", StringComparison.CurrentCultureIgnoreCase);
+                return termAtt.ToString().Equals("The", StringComparison.OrdinalIgnoreCase);
             }
         }
 
@@ -86,7 +86,7 @@ namespace Lucene.Net.Analysis.Sinks
             public override bool Accept(AttributeSource a)
             {
                 ICharTermAttribute termAtt = a.GetAttribute<ICharTermAttribute>();
-                return termAtt.ToString().Equals("Dogs", StringComparison.CurrentCultureIgnoreCase);
+                return termAtt.ToString().Equals("Dogs", StringComparison.OrdinalIgnoreCase);
             }
         }
 
diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Sinks/TokenTypeSinkTokenizerTest.cs b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Sinks/TokenTypeSinkTokenizerTest.cs
index ab11b89..6c5bf8b 100644
--- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Sinks/TokenTypeSinkTokenizerTest.cs
+++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Sinks/TokenTypeSinkTokenizerTest.cs
@@ -1,5 +1,6 @@
 using Lucene.Net.Analysis.TokenAttributes;
 using NUnit.Framework;
+using System;
 using System.IO;
 
 namespace Lucene.Net.Analysis.Sinks
@@ -40,14 +41,14 @@ namespace Lucene.Net.Analysis.Sinks
             ttf.Reset();
             while (ttf.IncrementToken())
             {
-                if (termAtt.ToString().Equals("dogs"))
+                if (termAtt.ToString().Equals("dogs", StringComparison.Ordinal))
                 {
                     seenDogs = true;
-                    assertTrue(typeAtt.Type + " is not equal to " + "D", typeAtt.Type.Equals("D") == true);
+                    assertTrue(typeAtt.Type + " is not equal to " + "D", typeAtt.Type.Equals("D", StringComparison.Ordinal) == true);
                 }
                 else
                 {
-                    assertTrue(typeAtt.Type + " is not null and it should be", typeAtt.Type.Equals("word"));
+                    assertTrue(typeAtt.Type + " is not null and it should be", typeAtt.Type.Equals("word", StringComparison.Ordinal));
                 }
             }
             assertTrue(seenDogs + " does not equal: " + true, seenDogs == true);
@@ -83,7 +84,7 @@ namespace Lucene.Net.Analysis.Sinks
                     return false;
                 }
 
-                if (termAtt.ToString().Equals("dogs"))
+                if (termAtt.ToString().Equals("dogs", StringComparison.Ordinal))
                 {
                     typeAtt.Type = "D";
                 }
diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Synonym/TestSynonymMap.cs b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Synonym/TestSynonymMap.cs
index d339b4e..da9b243 100644
--- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Synonym/TestSynonymMap.cs
+++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Synonym/TestSynonymMap.cs
@@ -304,7 +304,7 @@ namespace Lucene.Net.Analysis.Synonym
 
             public Stream OpenResource(string resource)
             {
-                if (!"something.txt".Equals(resource))
+                if (!"something.txt".Equals(resource, StringComparison.Ordinal))
                 {
                     throw new Exception("should not get a differnt resource");
                 }
@@ -321,7 +321,7 @@ namespace Lucene.Net.Analysis.Synonym
             bool inc = false;
             foreach (Token token in tokens)
             {
-                if (exp.Equals(new string(token.Buffer, 0, token.Length)))
+                if (exp.Equals(new string(token.Buffer, 0, token.Length), StringComparison.Ordinal))
                 {
                     inc = true;
                 }
diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Util/TestBufferedCharFilter.cs b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Util/TestBufferedCharFilter.cs
index 029c7d2..dc0d9fd 100644
--- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Util/TestBufferedCharFilter.cs
+++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Util/TestBufferedCharFilter.cs
@@ -129,7 +129,7 @@ namespace Lucene.Net.Analysis.Util
             br.Read(buf, 0, 500);
 
             assertTrue("Failed to set mark properly", testString.Substring(500,
-                    1000 - 500).equals(new string(buf, 0, 500)));
+                    1000 - 500).Equals(new string(buf, 0, 500), StringComparison.Ordinal));
 
             try
             {
@@ -246,8 +246,8 @@ namespace Lucene.Net.Analysis.Util
                 char[] buf = new char[14];
                 @in.Read(buf, 0, 14); // Read greater than the buffer
 
-                assertTrue("Wrong block read data", new String(buf)
-                        .equals(new String(chars, 1, 14)));
+                assertTrue("Wrong block read data", new string(buf)
+                        .Equals(new string(chars, 1, 14), StringComparison.Ordinal));
 
                 assertEquals("Wrong chars", 15, @in.Read()); // Check next byte
             }
@@ -424,8 +424,8 @@ namespace Lucene.Net.Analysis.Util
                 br = new BufferedCharFilter(new StringReader(testString));
                 br.Read(buf, 50, 500);
 
-                assertTrue("Chars read improperly", new String(buf, 50, 500)
-                        .equals(testString.Substring(0, 500 - 0)));
+                assertTrue("Chars read improperly", new string(buf, 50, 500)
+                        .Equals(testString.Substring(0, 500 - 0), StringComparison.Ordinal));
             }
 #pragma warning disable 168
             catch (IOException e)
@@ -768,7 +768,7 @@ namespace Lucene.Net.Analysis.Util
                 char[] buf = new char[testString.Length];
                 br.Read(buf, 0, 500);
                 assertTrue("Failed to reset properly", testString.Substring(500,
-                        1000 - 500).equals(new String(buf, 0, 500)));
+                        1000 - 500).Equals(new string(buf, 0, 500), StringComparison.Ordinal));
             }
 #pragma warning disable 168
             catch (IOException e)
@@ -847,7 +847,7 @@ namespace Lucene.Net.Analysis.Util
                 char[] buf = new char[testString.Length];
                 br.Read(buf, 0, 500);
                 assertTrue("Failed to set skip properly", testString.Substring(500,
-                        1000 - 500).equals(new String(buf, 0, 500)));
+                        1000 - 500).Equals(new string(buf, 0, 500), StringComparison.Ordinal));
             }
 #pragma warning disable 168
             catch (IOException e)
diff --git a/src/Lucene.Net.Tests.Analysis.Phonetic/Language/Bm/BeiderMorseEncoderTest.cs b/src/Lucene.Net.Tests.Analysis.Phonetic/Language/Bm/BeiderMorseEncoderTest.cs
index f85c95c..c0a3ad7 100644
--- a/src/Lucene.Net.Tests.Analysis.Phonetic/Language/Bm/BeiderMorseEncoderTest.cs
+++ b/src/Lucene.Net.Tests.Analysis.Phonetic/Language/Bm/BeiderMorseEncoderTest.cs
@@ -33,7 +33,7 @@ namespace Lucene.Net.Analysis.Phonetic.Language.Bm
 
         private void AssertNotEmpty(BeiderMorseEncoder bmpm, string value)
         {
-            Assert.False(bmpm.Encode(value).Equals(""), value);
+            Assert.False(bmpm.Encode(value).Equals("", StringComparison.Ordinal), value);
         }
 
         private BeiderMorseEncoder CreateGenericApproxEncoder()
diff --git a/src/Lucene.Net.Tests.Analysis.Phonetic/Language/Bm/PhoneticEngineRegressionTest.cs b/src/Lucene.Net.Tests.Analysis.Phonetic/Language/Bm/PhoneticEngineRegressionTest.cs
index 3f89405..f018d45 100644
--- a/src/Lucene.Net.Tests.Analysis.Phonetic/Language/Bm/PhoneticEngineRegressionTest.cs
+++ b/src/Lucene.Net.Tests.Analysis.Phonetic/Language/Bm/PhoneticEngineRegressionTest.cs
@@ -203,7 +203,7 @@ namespace Lucene.Net.Analysis.Phonetic.Language.Bm
             // LanguageSet: defaults to automagic, otherwise a comma-separated list.
             String languageSetArg;
             args.TryGetValue("languageSet", out languageSetArg);
-            if (languageSetArg == null || languageSetArg.equals("auto"))
+            if (languageSetArg == null || languageSetArg.Equals("auto", StringComparison.Ordinal))
             {
                 languageSet = null;
             }
diff --git a/src/Lucene.Net.Tests.Analysis.Stempel/Egothor.Stemmer/TestCompile.cs b/src/Lucene.Net.Tests.Analysis.Stempel/Egothor.Stemmer/TestCompile.cs
index 52ac16f..af3d42b 100644
--- a/src/Lucene.Net.Tests.Analysis.Stempel/Egothor.Stemmer/TestCompile.cs
+++ b/src/Lucene.Net.Tests.Analysis.Stempel/Egothor.Stemmer/TestCompile.cs
@@ -192,7 +192,7 @@ namespace Egothor.Stemmer
                         while (st.HasMoreTokens())
                         {
                             string token = st.NextToken();
-                            if (token.Equals(stem))
+                            if (token.Equals(stem, StringComparison.Ordinal))
                             {
                                 continue;
                             }
diff --git a/src/Lucene.Net.Tests.Benchmark/ByTask/TestPerfTasksLogic.cs b/src/Lucene.Net.Tests.Benchmark/ByTask/TestPerfTasksLogic.cs
index 61d4e83..0ae4480 100644
--- a/src/Lucene.Net.Tests.Benchmark/ByTask/TestPerfTasksLogic.cs
+++ b/src/Lucene.Net.Tests.Benchmark/ByTask/TestPerfTasksLogic.cs
@@ -495,7 +495,7 @@ namespace Lucene.Net.Benchmarks.ByTask
             int totalTokenCount1 = 0;
             foreach (TaskStats stat in stats)
             {
-                if (stat.Task.GetName().Equals("ReadTokens"))
+                if (stat.Task.GetName().Equals("ReadTokens", StringComparison.Ordinal))
                 {
                     totalTokenCount1 += stat.Count;
                 }
@@ -511,7 +511,7 @@ namespace Lucene.Net.Benchmarks.ByTask
 
             foreach (String fieldName in fields)
             {
-                if (fieldName.Equals(DocMaker.ID_FIELD) || fieldName.Equals(DocMaker.DATE_MSEC_FIELD) || fieldName.Equals(DocMaker.TIME_SEC_FIELD))
+                if (fieldName.Equals(DocMaker.ID_FIELD, StringComparison.Ordinal) || fieldName.Equals(DocMaker.DATE_MSEC_FIELD, StringComparison.Ordinal) || fieldName.Equals(DocMaker.TIME_SEC_FIELD, StringComparison.Ordinal))
                 {
                     continue;
                 }
@@ -908,17 +908,17 @@ namespace Lucene.Net.Benchmarks.ByTask
             foreach (TaskStats stats in benchmark.RunData.Points.TaskStats)
             {
                 String taskName = stats.Task.GetName();
-                if (taskName.equals("Rounds"))
+                if (taskName.Equals("Rounds", StringComparison.Ordinal))
                 {
                     assertEquals("Wrong total count!", 20 + 2 * n, stats.Count);
                     nChecked++;
                 }
-                else if (taskName.equals("CreateIndex"))
+                else if (taskName.Equals("CreateIndex", StringComparison.Ordinal))
                 {
                     assertEquals("Wrong count for CreateIndex!", n, stats.Count);
                     nChecked++;
                 }
-                else if (taskName.equals("CloseIndex"))
+                else if (taskName.Equals("CloseIndex", StringComparison.Ordinal))
                 {
                     assertEquals("Wrong count for CloseIndex!", n, stats.Count);
                     nChecked++;
diff --git a/src/Lucene.Net.Tests.Facet/Range/TestRangeFacetCounts.cs b/src/Lucene.Net.Tests.Facet/Range/TestRangeFacetCounts.cs
index 5495ecb..01448f0 100644
--- a/src/Lucene.Net.Tests.Facet/Range/TestRangeFacetCounts.cs
+++ b/src/Lucene.Net.Tests.Facet/Range/TestRangeFacetCounts.cs
@@ -303,7 +303,7 @@ namespace Lucene.Net.Facet.Range
                     for (int i = 0; i < drillSideways.Length; i++)
                     {
                         string dim = drillSidewaysDims[i];
-                        if (dim.Equals("field"))
+                        if (dim.Equals("field", StringComparison.Ordinal))
                         {
                             fieldFC = drillSideways[i];
                         }
diff --git a/src/Lucene.Net.Tests.Facet/SortedSet/TestSortedSetDocValuesFacets.cs b/src/Lucene.Net.Tests.Facet/SortedSet/TestSortedSetDocValuesFacets.cs
index 69a2e35..ed41702 100644
--- a/src/Lucene.Net.Tests.Facet/SortedSet/TestSortedSetDocValuesFacets.cs
+++ b/src/Lucene.Net.Tests.Facet/SortedSet/TestSortedSetDocValuesFacets.cs
@@ -339,7 +339,7 @@ namespace Lucene.Net.Facet.SortedSet
 
                 foreach (TestDoc doc in testDocs)
                 {
-                    if (doc.content.Equals(searchToken))
+                    if (doc.content.Equals(searchToken, StringComparison.Ordinal))
                     {
                         for (int j = 0; j < numDims; j++)
                         {
diff --git a/src/Lucene.Net.Tests.Facet/Taxonomy/Directory/TestDirectoryTaxonomyWriter.cs b/src/Lucene.Net.Tests.Facet/Taxonomy/Directory/TestDirectoryTaxonomyWriter.cs
index 5500b84..21a793a 100644
--- a/src/Lucene.Net.Tests.Facet/Taxonomy/Directory/TestDirectoryTaxonomyWriter.cs
+++ b/src/Lucene.Net.Tests.Facet/Taxonomy/Directory/TestDirectoryTaxonomyWriter.cs
@@ -112,7 +112,7 @@ namespace Lucene.Net.Facet.Taxonomy.Directory
             var r = DirectoryReader.Open(dir);
             Assert.AreEqual(3, r.NumDocs, "2 categories plus root should have been committed to the underlying directory");
             var readUserCommitData = r.IndexCommit.UserData;
-            Assert.True("1 2 3".Equals(readUserCommitData["testing"]), "wrong value extracted from commit data");
+            Assert.True("1 2 3".Equals(readUserCommitData["testing"], StringComparison.Ordinal), "wrong value extracted from commit data");
             Assert.NotNull(DirectoryTaxonomyWriter.INDEX_EPOCH + " not found in commitData", readUserCommitData[DirectoryTaxonomyWriter.INDEX_EPOCH]);
             r.Dispose();
 
diff --git a/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyCombined.cs b/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyCombined.cs
index 81d5da3..9e6d9df 100644
--- a/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyCombined.cs
+++ b/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyCombined.cs
@@ -576,7 +576,7 @@ namespace Lucene.Net.Facet.Taxonomy
                     bool ischild = true;
                     for (int k = 0; k < ExpectedCategories[i].Length; k++)
                     {
-                        if (!ExpectedCategories[j][k].Equals(ExpectedCategories[i][k]))
+                        if (!ExpectedCategories[j][k].Equals(ExpectedCategories[i][k], StringComparison.Ordinal))
                         {
                             ischild = false;
                             break;
diff --git a/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyFacetCounts.cs b/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyFacetCounts.cs
index eae9248..8156182 100644
--- a/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyFacetCounts.cs
+++ b/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyFacetCounts.cs
@@ -807,7 +807,7 @@ namespace Lucene.Net.Facet.Taxonomy
 
                 foreach (TestDoc doc in testDocs)
                 {
-                    if (doc.content.Equals(searchToken))
+                    if (doc.content.Equals(searchToken, StringComparison.Ordinal))
                     {
                         for (int j = 0; j < numDims; j++)
                         {
diff --git a/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyFacetSumValueSource.cs b/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyFacetSumValueSource.cs
index d935658..e908143 100644
--- a/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyFacetSumValueSource.cs
+++ b/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyFacetSumValueSource.cs
@@ -547,7 +547,7 @@ namespace Lucene.Net.Facet.Taxonomy
 
                 foreach (TestDoc doc in testDocs)
                 {
-                    if (doc.content.Equals(searchToken))
+                    if (doc.content.Equals(searchToken, StringComparison.Ordinal))
                     {
                         for (int j = 0; j < numDims; j++)
                         {
diff --git a/src/Lucene.Net.Tests.Facet/TestDrillDownQuery.cs b/src/Lucene.Net.Tests.Facet/TestDrillDownQuery.cs
index 221f815..5e3cf01 100644
--- a/src/Lucene.Net.Tests.Facet/TestDrillDownQuery.cs
+++ b/src/Lucene.Net.Tests.Facet/TestDrillDownQuery.cs
@@ -270,7 +270,7 @@ namespace Lucene.Net.Facet
             var clone = q.Clone() as DrillDownQuery;
             Assert.NotNull(clone);
             clone.Add("b");
-            Assert.False(q.ToString().Equals(clone.ToString()), "query wasn't cloned: source=" + q + " clone=" + clone);
+            Assert.False(q.ToString().Equals(clone.ToString(), StringComparison.Ordinal), "query wasn't cloned: source=" + q + " clone=" + clone);
         }
 
         [Test]
diff --git a/src/Lucene.Net.Tests.Facet/TestDrillSideways.cs b/src/Lucene.Net.Tests.Facet/TestDrillSideways.cs
index 068f62b..e7d7c09 100644
--- a/src/Lucene.Net.Tests.Facet/TestDrillSideways.cs
+++ b/src/Lucene.Net.Tests.Facet/TestDrillSideways.cs
@@ -682,7 +682,7 @@ namespace Lucene.Net.Facet
                                     string value = dimValues[dim][Random().Next(dimValues[dim].Length)];
                                     for (int j = 0; j < i; j++)
                                     {
-                                        if (value.Equals(drillDowns[dim][j]))
+                                        if (value.Equals(drillDowns[dim][j], StringComparison.Ordinal))
                                         {
                                             value = null;
                                             break;
@@ -1072,7 +1072,7 @@ namespace Lucene.Net.Facet
                 {
                     continue;
                 }
-                if (contentToken == null || doc.contentToken.Equals(contentToken))
+                if (contentToken == null || doc.contentToken.Equals(contentToken, StringComparison.Ordinal))
                 {
                     int failDim = -1;
                     for (int dim = 0; dim < numDims; dim++)
@@ -1084,7 +1084,7 @@ namespace Lucene.Net.Facet
                             bool matches = false;
                             foreach (string value in drillDowns[dim])
                             {
-                                if (value.Equals(docValue) || value.Equals(docValue2))
+                                if (value.Equals(docValue, StringComparison.Ordinal) || value.Equals(docValue2, StringComparison.Ordinal))
                                 {
                                     matches = true;
                                     break;
diff --git a/src/Lucene.Net.Tests.Highlighter/Highlight/HighlighterTest.cs b/src/Lucene.Net.Tests.Highlighter/Highlight/HighlighterTest.cs
index d240cdb..7452c7c 100644
--- a/src/Lucene.Net.Tests.Highlighter/Highlight/HighlighterTest.cs
+++ b/src/Lucene.Net.Tests.Highlighter/Highlight/HighlighterTest.cs
@@ -1216,7 +1216,7 @@ namespace Lucene.Net.Search.Highlight
 
                 String result = highlighter.GetBestFragment(tokenStream, texts[0]).Trim();
                 assertTrue("Failed to find best section using weighted terms. Found: [" + result + "]",
-                    "<B>Hello</B>".equals(result));
+                    "<B>Hello</B>".Equals(result, StringComparison.Ordinal));
 
                 // readjust weights
                 wTerms[1].Weight = (50f);
@@ -1226,7 +1226,7 @@ namespace Lucene.Net.Search.Highlight
 
                 result = highlighter.GetBestFragment(tokenStream, texts[0]).Trim();
                 assertTrue("Failed to find best section using weighted terms. Found: " + result,
-                    "<B>kennedy</B>".equals(result));
+                    "<B>kennedy</B>".Equals(result, StringComparison.Ordinal));
             });
 
             helper.Start();
@@ -1259,7 +1259,7 @@ namespace Lucene.Net.Search.Highlight
                 String result = highlighter.GetBestFragments(tokenStream, s, 3, "...");
                 String expectedResult = "<B>football</B>-<B>soccer</B> in the euro 2004 <B>footie</B> competition";
                 assertTrue("overlapping analyzer should handle highlights OK, expected:" + expectedResult
-                    + " actual:" + result, expectedResult.equals(result));
+                    + " actual:" + result, expectedResult.Equals(result, StringComparison.Ordinal));
             });
 
             helper.Start();
@@ -1319,7 +1319,7 @@ namespace Lucene.Net.Search.Highlight
                     {
                         if (VERBOSE) Console.WriteLine(fragmentResults[j]);
                         assertTrue("Failed to find same text Fragments: " + fragmentResults[j] + " found",
-                            fragmentResults[j].toString().equals(stringResults[j]));
+                            fragmentResults[j].toString().Equals(stringResults[j], StringComparison.Ordinal));
 
                     }
                 }
diff --git a/src/Lucene.Net.Tests.Highlighter/PostingsHighlight/TestPostingsHighlighter.cs b/src/Lucene.Net.Tests.Highlighter/PostingsHighlight/TestPostingsHighlighter.cs
index 0a3d97d..b96efea 100644
--- a/src/Lucene.Net.Tests.Highlighter/PostingsHighlight/TestPostingsHighlighter.cs
+++ b/src/Lucene.Net.Tests.Highlighter/PostingsHighlight/TestPostingsHighlighter.cs
@@ -1150,7 +1150,7 @@ namespace Lucene.Net.Search.PostingsHighlight
         {
             protected override char GetMultiValuedSeparator(string field)
             {
-                Debug.Assert( field.equals("body"));
+                Debug.Assert( field.Equals("body", StringComparison.Ordinal));
                 return '\u2029';
             }
         }
diff --git a/src/Lucene.Net.Tests.Highlighter/VectorHighlight/SimpleFragmentsBuilderTest.cs b/src/Lucene.Net.Tests.Highlighter/VectorHighlight/SimpleFragmentsBuilderTest.cs
index c197693..9a6ccc5 100644
--- a/src/Lucene.Net.Tests.Highlighter/VectorHighlight/SimpleFragmentsBuilderTest.cs
+++ b/src/Lucene.Net.Tests.Highlighter/VectorHighlight/SimpleFragmentsBuilderTest.cs
@@ -244,7 +244,7 @@ namespace Lucene.Net.Search.VectorHighlight
                 do
                 {
                     randomValue = TestUtil.RandomSimpleString(Random());
-                } while ("".equals(randomValue));
+                } while ("".Equals(randomValue, StringComparison.Ordinal));
                 randomValues[i] = randomValue;
             }
 
@@ -306,7 +306,7 @@ namespace Lucene.Net.Search.VectorHighlight
                         bool hit = false;
                         for (int i = 0; i < fieldValues.Length; i++)
                         {
-                            if (queryTerm.equals(fieldValues[i]))
+                            if (queryTerm.Equals(fieldValues[i], StringComparison.Ordinal))
                             {
                                 builder.append("<b>").append(queryTerm).append("</b>");
                                 hit = true;
diff --git a/src/Lucene.Net.Tests.Join/TestBlockJoin.cs b/src/Lucene.Net.Tests.Join/TestBlockJoin.cs
index 6ba15f9..bb15c35 100644
--- a/src/Lucene.Net.Tests.Join/TestBlockJoin.cs
+++ b/src/Lucene.Net.Tests.Join/TestBlockJoin.cs
@@ -1112,7 +1112,7 @@ namespace Lucene.Net.Tests.Join
                     while (true)
                     {
                         assertTrue(resultUpto < hits.Length);
-                        if (!parentID.Equals(r.Document(hits[resultUpto].Doc).Get("parentID")))
+                        if (!parentID.Equals(r.Document(hits[resultUpto].Doc).Get("parentID"), StringComparison.Ordinal))
                         {
                             break;
                         }
diff --git a/src/Lucene.Net.Tests.Join/TestJoinUtil.cs b/src/Lucene.Net.Tests.Join/TestJoinUtil.cs
index 82057a7..dc7aef4 100644
--- a/src/Lucene.Net.Tests.Join/TestJoinUtil.cs
+++ b/src/Lucene.Net.Tests.Join/TestJoinUtil.cs
@@ -591,7 +591,7 @@ namespace Lucene.Net.Tests.Join
                 {
                     uniqueRandomValue = TestUtil.RandomRealisticUnicodeString(Random());
                     //        uniqueRandomValue = TestUtil.randomSimpleString(random);
-                } while ("".Equals(uniqueRandomValue) || trackSet.Contains(uniqueRandomValue));
+                } while ("".Equals(uniqueRandomValue, StringComparison.Ordinal) || trackSet.Contains(uniqueRandomValue));
                 // Generate unique values and empty strings aren't allowed.
                 trackSet.Add(uniqueRandomValue);
                 context.RandomFrom[i] = Random().NextBoolean();
diff --git a/src/Lucene.Net.Tests.Misc/Document/TestLazyDocument.cs b/src/Lucene.Net.Tests.Misc/Document/TestLazyDocument.cs
index 06c74de..b71e345 100644
--- a/src/Lucene.Net.Tests.Misc/Document/TestLazyDocument.cs
+++ b/src/Lucene.Net.Tests.Misc/Document/TestLazyDocument.cs
@@ -114,15 +114,15 @@ namespace Lucene.Net.Documents
                 foreach (IIndexableField f in d)
                 {
                     numFieldValues++;
-                    if (f.Name.equals("never_load"))
+                    if (f.Name.Equals("never_load", StringComparison.Ordinal))
                     {
                         fail("never_load was loaded");
                     }
-                    if (f.Name.equals("load_later"))
+                    if (f.Name.Equals("load_later", StringComparison.Ordinal))
                     {
                         fail("load_later was loaded on first pass");
                     }
-                    if (f.Name.equals("docid"))
+                    if (f.Name.Equals("docid", StringComparison.Ordinal))
                     {
                         assertFalse(f.Name, f is LazyDocument.LazyField);
                     }
@@ -160,15 +160,15 @@ namespace Lucene.Net.Documents
                 // now every value of fieldName should be loaded
                 foreach (IIndexableField f in d)
                 {
-                    if (f.Name.equals("never_load"))
+                    if (f.Name.Equals("never_load", StringComparison.Ordinal))
                     {
                         fail("never_load was loaded");
                     }
-                    if (f.Name.equals("load_later"))
+                    if (f.Name.Equals("load_later", StringComparison.Ordinal))
                     {
                         fail("load_later was loaded too soon");
                     }
-                    if (f.Name.equals("docid"))
+                    if (f.Name.Equals("docid", StringComparison.Ordinal))
                     {
                         assertFalse(f.Name, f is LazyDocument.LazyField);
                     }
@@ -178,7 +178,7 @@ namespace Lucene.Net.Documents
                                    f is LazyDocument.LazyField);
                         LazyDocument.LazyField lf = (LazyDocument.LazyField)f;
                         assertEquals(f.Name + " is loaded?",
-                                     lf.Name.equals(fieldName), lf.HasBeenLoaded);
+                                     lf.Name.Equals(fieldName, StringComparison.Ordinal), lf.HasBeenLoaded);
                     }
                 }
 
@@ -193,11 +193,11 @@ namespace Lucene.Net.Documents
                 // we already loaded.
                 foreach (IIndexableField f in d)
                 {
-                    if (f.Name.equals("never_load"))
+                    if (f.Name.Equals("never_load", StringComparison.Ordinal))
                     {
                         fail("never_load was loaded");
                     }
-                    if (f.Name.equals("docid"))
+                    if (f.Name.Equals("docid", StringComparison.Ordinal))
                     {
                         assertFalse(f.Name, f is LazyDocument.LazyField);
                     }
@@ -207,7 +207,7 @@ namespace Lucene.Net.Documents
                                    f is LazyDocument.LazyField);
                         LazyDocument.LazyField lf = (LazyDocument.LazyField)f;
                         assertEquals(f.Name + " is loaded?",
-                                     lf.Name.equals(fieldName), lf.HasBeenLoaded);
+                                     lf.Name.Equals(fieldName, StringComparison.Ordinal), lf.HasBeenLoaded);
                     }
                 }
 
@@ -237,11 +237,11 @@ namespace Lucene.Net.Documents
 
             public override Status NeedsField(FieldInfo fieldInfo)
             {
-                if (fieldInfo.Name.equals("docid"))
+                if (fieldInfo.Name.Equals("docid", StringComparison.Ordinal))
                 {
                     return Status.YES;
                 }
-                else if (fieldInfo.Name.equals("never_load"))
+                else if (fieldInfo.Name.Equals("never_load", StringComparison.Ordinal))
                 {
                     return Status.NO;
                 }
diff --git a/src/Lucene.Net.Tests.Misc/Index/Sorter/SorterTestBase.cs b/src/Lucene.Net.Tests.Misc/Index/Sorter/SorterTestBase.cs
index ce9e862..5e8c043 100644
--- a/src/Lucene.Net.Tests.Misc/Index/Sorter/SorterTestBase.cs
+++ b/src/Lucene.Net.Tests.Misc/Index/Sorter/SorterTestBase.cs
@@ -49,7 +49,7 @@ namespace Lucene.Net.Index.Sorter
 
             public override long ComputeNorm(FieldInvertState state)
             {
-                if (state.Name.Equals(NORMS_FIELD))
+                if (state.Name.Equals(NORMS_FIELD, StringComparison.Ordinal))
                 {
                     return Number.SingleToInt32Bits(state.Boost);
                 }
diff --git a/src/Lucene.Net.Tests.Misc/Misc/SweetSpotSimilarityTest.cs b/src/Lucene.Net.Tests.Misc/Misc/SweetSpotSimilarityTest.cs
index f74274d..76e66db 100644
--- a/src/Lucene.Net.Tests.Misc/Misc/SweetSpotSimilarityTest.cs
+++ b/src/Lucene.Net.Tests.Misc/Misc/SweetSpotSimilarityTest.cs
@@ -216,13 +216,13 @@ namespace Lucene.Net.Misc
 
             public override Similarity Get(string field)
             {
-                if (field.Equals("bar"))
+                if (field.Equals("bar", StringComparison.Ordinal))
                     return ssBar;
-                else if (field.Equals("yak"))
+                else if (field.Equals("yak", StringComparison.Ordinal))
                     return ssYak;
-                else if (field.Equals("a"))
+                else if (field.Equals("a", StringComparison.Ordinal))
                     return ssA;
-                else if (field.Equals("b"))
+                else if (field.Equals("b", StringComparison.Ordinal))
                     return ssB;
                 else
                     return ss;
diff --git a/src/Lucene.Net.Tests.Queries/CommonTermsQueryTest.cs b/src/Lucene.Net.Tests.Queries/CommonTermsQueryTest.cs
index fc80980..6ff04c2 100644
--- a/src/Lucene.Net.Tests.Queries/CommonTermsQueryTest.cs
+++ b/src/Lucene.Net.Tests.Queries/CommonTermsQueryTest.cs
@@ -556,7 +556,7 @@ namespace Lucene.Net.Tests.Queries
             protected override Query NewTermQuery(Term term, TermContext context)
             {
                 Query query = base.NewTermQuery(term, context);
-                if (term.Text().Equals(@"universe"))
+                if (term.Text().Equals(@"universe", StringComparison.Ordinal))
                 {
                     query.Boost = 100F;
                 }
diff --git a/src/Lucene.Net.Tests.Queries/Function/TestOrdValues.cs b/src/Lucene.Net.Tests.Queries/Function/TestOrdValues.cs
index d980ffa..05be2f0 100644
--- a/src/Lucene.Net.Tests.Queries/Function/TestOrdValues.cs
+++ b/src/Lucene.Net.Tests.Queries/Function/TestOrdValues.cs
@@ -25,6 +25,7 @@ using Lucene.Net.Queries.Function.ValueSources;
 using Lucene.Net.Search;
 using Lucene.Net.Support;
 using NUnit.Framework;
+using System;
 
 namespace Lucene.Net.Tests.Queries.Function
 {
@@ -160,7 +161,7 @@ namespace Lucene.Net.Tests.Queries.Function
                 float expectedScore = N_DOCS - i - 1;
                 assertEquals("score of result " + i + " shuould be " + expectedScore + " != " + score, expectedScore, score, TEST_SCORE_TOLERANCE_DELTA);
                 string expectedId = inOrder ? Id2String(N_DOCS - i) : Id2String(i + 1); // reverse  ==> smaller values first -  in-order ==> larger  values first
-                assertTrue("id of result " + i + " shuould be " + expectedId + " != " + score, expectedId.Equals(id));
+                assertTrue("id of result " + i + " shuould be " + expectedId + " != " + score, expectedId.Equals(id, StringComparison.Ordinal));
             }
             r.Dispose();
         }
diff --git a/src/Lucene.Net.Tests.Queries/Function/TestValueSources.cs b/src/Lucene.Net.Tests.Queries/Function/TestValueSources.cs
index f01635d..82ba132 100644
--- a/src/Lucene.Net.Tests.Queries/Function/TestValueSources.cs
+++ b/src/Lucene.Net.Tests.Queries/Function/TestValueSources.cs
@@ -299,7 +299,7 @@ namespace Lucene.Net.Tests.Queries.Function
         [Test]
         public void TestSumTotalTermFreq()
         {
-            if (Codec.Default.Name.Equals("Lucene3x"))
+            if (Codec.Default.Name.Equals("Lucene3x", StringComparison.Ordinal))
             {
                 AssertHits(new FunctionQuery(new SumTotalTermFreqValueSource("text")), new[] { -1f, -1f });
             }
@@ -336,7 +336,7 @@ namespace Lucene.Net.Tests.Queries.Function
         [Test]
         public void TestTotalTermFreq()
         {
-            if (Codec.Default.Name.Equals("Lucene3x"))
+            if (Codec.Default.Name.Equals("Lucene3x", StringComparison.Ordinal))
             {
                 AssertHits(new FunctionQuery(new TotalTermFreqValueSource("bogus", "bogus", "text", new BytesRef("test"))), new[] { -1f, -1f });
             }
diff --git a/src/Lucene.Net.Tests.QueryParser/Classic/TestMultiAnalyzer.cs b/src/Lucene.Net.Tests.QueryParser/Classic/TestMultiAnalyzer.cs
index 48d86aa..a9d5c55 100644
--- a/src/Lucene.Net.Tests.QueryParser/Classic/TestMultiAnalyzer.cs
+++ b/src/Lucene.Net.Tests.QueryParser/Classic/TestMultiAnalyzer.cs
@@ -182,12 +182,12 @@ namespace Lucene.Net.QueryParsers.Classic
                     prevStartOffset = offsetAtt.StartOffset;
                     prevEndOffset = offsetAtt.EndOffset;
                     string text = termAtt.toString();
-                    if (text.equals("triplemulti"))
+                    if (text.Equals("triplemulti", StringComparison.Ordinal))
                     {
                         multiToken = 2;
                         return true;
                     }
-                    else if (text.equals("multi"))
+                    else if (text.Equals("multi", StringComparison.Ordinal))
                     {
                         multiToken = 1;
                         return true;
@@ -237,11 +237,11 @@ namespace Lucene.Net.QueryParsers.Classic
             {
                 while (m_input.IncrementToken())
                 {
-                    if (termAtt.toString().equals("the"))
+                    if (termAtt.toString().Equals("the", StringComparison.Ordinal))
                     {
                         // stopword, do nothing
                     }
-                    else if (termAtt.toString().equals("quick"))
+                    else if (termAtt.toString().Equals("quick", StringComparison.Ordinal))
                     {
                         posIncrAtt.PositionIncrement = (2);
                         return true;
diff --git a/src/Lucene.Net.Tests.QueryParser/Classic/TestMultiFieldQueryParser.cs b/src/Lucene.Net.Tests.QueryParser/Classic/TestMultiFieldQueryParser.cs
index a48ea0b..f7dc3c7 100644
--- a/src/Lucene.Net.Tests.QueryParser/Classic/TestMultiFieldQueryParser.cs
+++ b/src/Lucene.Net.Tests.QueryParser/Classic/TestMultiFieldQueryParser.cs
@@ -342,7 +342,7 @@ namespace Lucene.Net.QueryParsers.Classic
 
             protected internal override System.IO.TextReader InitReader(string fieldName, TextReader reader)
             {
-                if ("f1".equals(fieldName))
+                if ("f1".Equals(fieldName, StringComparison.Ordinal))
                 {
                     // we don't use the reader, so close it:
                     IOUtils.DisposeWhileHandlingException(reader);
diff --git a/src/Lucene.Net.Tests.QueryParser/Classic/TestQueryParser.cs b/src/Lucene.Net.Tests.QueryParser/Classic/TestQueryParser.cs
index 5fc0517..97bff7c 100644
--- a/src/Lucene.Net.Tests.QueryParser/Classic/TestQueryParser.cs
+++ b/src/Lucene.Net.Tests.QueryParser/Classic/TestQueryParser.cs
@@ -420,7 +420,7 @@ namespace Lucene.Net.QueryParsers.Classic
 
                 if (m_input.IncrementToken())
                 {
-                    AddSynonym = TermAtt.ToString().Equals("国");
+                    AddSynonym = TermAtt.ToString().Equals("国", StringComparison.Ordinal);
                     return true;
                 }
                 else
diff --git a/src/Lucene.Net.Tests.QueryParser/Flexible/Precedence/TestPrecedenceQueryParser.cs b/src/Lucene.Net.Tests.QueryParser/Flexible/Precedence/TestPrecedenceQueryParser.cs
index 5b50ec5..296076b 100644
--- a/src/Lucene.Net.Tests.QueryParser/Flexible/Precedence/TestPrecedenceQueryParser.cs
+++ b/src/Lucene.Net.Tests.QueryParser/Flexible/Precedence/TestPrecedenceQueryParser.cs
@@ -94,7 +94,7 @@ namespace Lucene.Net.QueryParsers.Flexible.Precedence
                 }
                 else
                     while (m_input.IncrementToken())
-                        if (termAtt.toString().equals("phrase"))
+                        if (termAtt.toString().Equals("phrase", StringComparison.Ordinal))
                         {
                             inPhrase = true;
                             savedStart = offsetAtt.StartOffset;
@@ -103,7 +103,7 @@ namespace Lucene.Net.QueryParsers.Flexible.Precedence
                             offsetAtt.SetOffset(savedStart, savedEnd);
                             return true;
                         }
-                        else if (!termAtt.toString().equals("stop"))
+                        else if (!termAtt.toString().Equals("stop", StringComparison.Ordinal))
                             return true;
                 return false;
             }
@@ -158,7 +158,7 @@ namespace Lucene.Net.QueryParsers.Flexible.Precedence
         {
             Query q = GetQuery(query, a);
             String s = q.ToString("field");
-            if (!s.equals(result))
+            if (!s.Equals(result, StringComparison.Ordinal))
             {
                 fail("Query /" + query + "/ yielded /" + s + "/, expecting /" + result
                     + "/");
@@ -172,7 +172,7 @@ namespace Lucene.Net.QueryParsers.Flexible.Precedence
             qp.LowercaseExpandedTerms = (lowercase);
             Query q = qp.Parse(query, "field");
             String s = q.ToString("field");
-            if (!s.equals(result))
+            if (!s.Equals(result, StringComparison.Ordinal))
             {
                 fail("WildcardQuery /" + query + "/ yielded /" + s + "/, expecting /"
                     + result + "/");
@@ -184,7 +184,7 @@ namespace Lucene.Net.QueryParsers.Flexible.Precedence
             PrecedenceQueryParser qp = GetParser(null);
             Query q = qp.Parse(query, "field");
             String s = q.ToString("field");
-            if (!s.equals(result))
+            if (!s.Equals(result, StringComparison.Ordinal))
             {
                 fail("WildcardQuery /" + query + "/ yielded /" + s + "/, expecting /"
                     + result + "/");
@@ -205,7 +205,7 @@ namespace Lucene.Net.QueryParsers.Flexible.Precedence
         {
             Query q = getQueryDOA(query, a);
             String s = q.ToString("field");
-            if (!s.equals(result))
+            if (!s.Equals(result, StringComparison.Ordinal))
             {
                 fail("Query /" + query + "/ yielded /" + s + "/, expecting /" + result
                     + "/");
@@ -531,7 +531,7 @@ namespace Lucene.Net.QueryParsers.Flexible.Precedence
         {
             Query q = qp.Parse(query, field);
             String s = q.ToString(field);
-            if (!s.equals(result))
+            if (!s.Equals(result, StringComparison.Ordinal))
             {
                 fail("Query /" + query + "/ yielded /" + s + "/, expecting /" + result
                     + "/");
diff --git a/src/Lucene.Net.Tests.QueryParser/Flexible/Spans/UniqueFieldAttributeImpl.cs b/src/Lucene.Net.Tests.QueryParser/Flexible/Spans/UniqueFieldAttributeImpl.cs
index 5a4c3d7..d33b44d 100644
--- a/src/Lucene.Net.Tests.QueryParser/Flexible/Spans/UniqueFieldAttributeImpl.cs
+++ b/src/Lucene.Net.Tests.QueryParser/Flexible/Spans/UniqueFieldAttributeImpl.cs
@@ -65,7 +65,7 @@ namespace Lucene.Net.QueryParsers.Flexible.Spans
             {
 
                 return ((UniqueFieldAttribute)other).uniqueField
-                    .equals(this.uniqueField);
+                    .Equals(this.uniqueField, System.StringComparison.Ordinal);
             }
 
             return false;
diff --git a/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestMultiAnalyzerQPHelper.cs b/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestMultiAnalyzerQPHelper.cs
index 72d4cd3..7487944 100644
--- a/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestMultiAnalyzerQPHelper.cs
+++ b/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestMultiAnalyzerQPHelper.cs
@@ -201,12 +201,12 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard
                     prevStartOffset = offsetAtt.StartOffset;
                     prevEndOffset = offsetAtt.EndOffset;
                     String text = termAtt.toString();
-                    if (text.equals("triplemulti"))
+                    if (text.Equals("triplemulti", StringComparison.Ordinal))
                     {
                         multiToken = 2;
                         return true;
                     }
-                    else if (text.equals("multi"))
+                    else if (text.Equals("multi", StringComparison.Ordinal))
                     {
                         multiToken = 1;
                         return true;
@@ -261,11 +261,11 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard
             {
                 while (m_input.IncrementToken())
                 {
-                    if (termAtt.toString().equals("the"))
+                    if (termAtt.toString().Equals("the", StringComparison.Ordinal))
                     {
                         // stopword, do nothing
                     }
-                    else if (termAtt.toString().equals("quick"))
+                    else if (termAtt.toString().Equals("quick", StringComparison.Ordinal))
                     {
                         posIncrAtt.PositionIncrement = (2);
                         return true;
diff --git a/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestMultiFieldQPHelper.cs b/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestMultiFieldQPHelper.cs
index 030678b..0bd8282 100644
--- a/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestMultiFieldQPHelper.cs
+++ b/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestMultiFieldQPHelper.cs
@@ -409,7 +409,7 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard
 
             protected internal override TextReader InitReader(String fieldName, TextReader reader)
             {
-                if ("f1".equals(fieldName))
+                if ("f1".Equals(fieldName, StringComparison.Ordinal))
                 {
                     // we don't use the reader, so close it:
                     IOUtils.DisposeWhileHandlingException(reader);
diff --git a/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestNumericQueryParser.cs b/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestNumericQueryParser.cs
index 0b27cd6..103db56 100644
--- a/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestNumericQueryParser.cs
+++ b/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestNumericQueryParser.cs
@@ -276,23 +276,23 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard
                     /*Number*/
                     object number = RANDOM_NUMBER_MAP[fieldName];
 
-                    if (NumericType.INT64.ToString().equals(fieldName)
-                        || DATE_FIELD_NAME.equals(fieldName))
+                    if (NumericType.INT64.ToString().Equals(fieldName, StringComparison.Ordinal)
+                        || DATE_FIELD_NAME.Equals(fieldName, StringComparison.Ordinal))
                     {
                         number = -Convert.ToInt64(number);
 
                     }
-                    else if (NumericType.DOUBLE.ToString().equals(fieldName))
+                    else if (NumericType.DOUBLE.ToString().Equals(fieldName, StringComparison.Ordinal))
                     {
                         number = -Convert.ToDouble(number);
 
                     }
-                    else if (NumericType.SINGLE.ToString().equals(fieldName))
+                    else if (NumericType.SINGLE.ToString().Equals(fieldName, StringComparison.Ordinal))
                     {
                         number = -Convert.ToSingle(number);
 
                     }
-                    else if (NumericType.INT32.ToString().equals(fieldName))
+                    else if (NumericType.INT32.ToString().Equals(fieldName, StringComparison.Ordinal))
                     {
                         number = -Convert.ToInt32(number);
 
diff --git a/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestQPHelper.cs b/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestQPHelper.cs
index 3fb4953..bdbbb61 100644
--- a/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestQPHelper.cs
+++ b/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestQPHelper.cs
@@ -98,7 +98,7 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard
                 else
                     while (m_input.IncrementToken())
                     {
-                        if (termAtt.toString().equals("phrase"))
+                        if (termAtt.toString().Equals("phrase", StringComparison.Ordinal))
                         {
                             inPhrase = true;
                             savedStart = offsetAtt.StartOffset;
@@ -107,7 +107,7 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard
                             offsetAtt.SetOffset(savedStart, savedEnd);
                             return true;
                         }
-                        else if (!termAtt.toString().equals("stop"))
+                        else if (!termAtt.toString().Equals("stop", StringComparison.Ordinal))
                             return true;
                     }
                 return false;
@@ -223,7 +223,7 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard
         {
             Query q = GetQuery(query, a);
             String s = q.ToString("field");
-            if (!s.equals(result))
+            if (!s.Equals(result, StringComparison.Ordinal))
             {
                 fail("Query /" + query + "/ yielded /" + s + "/, expecting /" + result
                     + "/");
@@ -234,7 +234,7 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard
         {
             Query q = GetQueryAllowLeadingWildcard(query, a);
             String s = q.ToString("field");
-            if (!s.equals(result))
+            if (!s.Equals(result, StringComparison.Ordinal))
             {
                 fail("Query /" + query + "/ yielded /" + s + "/, expecting /" + result
                     + "/");
@@ -246,7 +246,7 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard
         {
             Query q = qp.Parse(query, field);
             String s = q.ToString(field);
-            if (!s.equals(result))
+            if (!s.Equals(result, StringComparison.Ordinal))
             {
                 fail("Query /" + query + "/ yielded /" + s + "/, expecting /" + result
                     + "/");
@@ -256,7 +256,7 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard
         public void AssertEscapedQueryEquals(String query, Analyzer a, String result)
         {
             String escapedQuery = QueryParserUtil.Escape(query);
-            if (!escapedQuery.equals(result))
+            if (!escapedQuery.Equals(result, StringComparison.Ordinal))
             {
                 fail("Query /" + query + "/ yielded /" + escapedQuery + "/, expecting /"
                     + result + "/");
@@ -271,7 +271,7 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard
             qp.AllowLeadingWildcard = (allowLeadingWildcard);
             Query q = qp.Parse(query, "field");
             String s = q.ToString("field");
-            if (!s.equals(result))
+            if (!s.Equals(result, StringComparison.Ordinal))
             {
                 fail("WildcardQuery /" + query + "/ yielded /" + s + "/, expecting /"
                     + result + "/");
@@ -289,7 +289,7 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard
             StandardQueryParser qp = GetParser(null);
             Query q = qp.Parse(query, "field");
             String s = q.ToString("field");
-            if (!s.equals(result))
+            if (!s.Equals(result, StringComparison.Ordinal))
             {
                 fail("WildcardQuery /" + query + "/ yielded /" + s + "/, expecting /"
                     + result + "/");
@@ -312,7 +312,7 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard
         {
             Query q = GetQueryDOA(query, a);
             String s = q.ToString("field");
-            if (!s.equals(result))
+            if (!s.Equals(result, StringComparison.Ordinal))
             {
                 fail("Query /" + query + "/ yielded /" + s + "/, expecting /" + result
                     + "/");
diff --git a/src/Lucene.Net.Tests.QueryParser/Util/QueryParserTestBase.cs b/src/Lucene.Net.Tests.QueryParser/Util/QueryParserTestBase.cs
index dee6193..bafc6a1 100644
--- a/src/Lucene.Net.Tests.QueryParser/Util/QueryParserTestBase.cs
+++ b/src/Lucene.Net.Tests.QueryParser/Util/QueryParserTestBase.cs
@@ -93,7 +93,7 @@ namespace Lucene.Net.QueryParsers.Util
                 else
                     while (m_input.IncrementToken())
                     {
-                        if (termAtt.toString().Equals("phrase"))
+                        if (termAtt.toString().Equals("phrase", StringComparison.Ordinal))
                         {
                             inPhrase = true;
                             savedStart = offsetAtt.StartOffset;
@@ -102,7 +102,7 @@ namespace Lucene.Net.QueryParsers.Util
                             offsetAtt.SetOffset(savedStart, savedEnd);
                             return true;
                         }
-                        else if (!termAtt.toString().equals("stop"))
+                        else if (!termAtt.toString().Equals("stop", StringComparison.Ordinal))
                             return true;
                     }
                 return false;
@@ -159,7 +159,7 @@ namespace Lucene.Net.QueryParsers.Util
         {
             Query q = GetQuery(query, a);
             string s = q.ToString("field");
-            if (!s.equals(result))
+            if (!s.Equals(result, StringComparison.Ordinal))
             {
                 fail("Query /" + query + "/ yielded /" + s
                      + "/, expecting /" + result + "/");
@@ -170,7 +170,7 @@ namespace Lucene.Net.QueryParsers.Util
         {
             Query q = GetQuery(query, cqpC);
             string s = q.ToString(field);
-            if (!s.Equals(result))
+            if (!s.Equals(result, StringComparison.Ordinal))
             {
                 fail("Query /" + query + "/ yielded /" + s
                      + "/, expecting /" + result + "/");
@@ -180,7 +180,7 @@ namespace Lucene.Net.QueryParsers.Util
         public void AssertEscapedQueryEquals(string query, Analyzer a, string result)
         {
             string escapedQuery = QueryParserBase.Escape(query);
-            if (!escapedQuery.Equals(result))
+            if (!escapedQuery.Equals(result, StringComparison.Ordinal))
             {
                 fail("Query /" + query + "/ yielded /" + escapedQuery
                     + "/, expecting /" + result + "/");
@@ -194,7 +194,7 @@ namespace Lucene.Net.QueryParsers.Util
             cqpC.AllowLeadingWildcard = allowLeadingWildcard;
             Query q = GetQuery(query, cqpC);
             string s = q.ToString("field");
-            if (!s.equals(result))
+            if (!s.Equals(result, StringComparison.Ordinal))
             {
                 fail("WildcardQuery /" + query + "/ yielded /" + s
                      + "/, expecting /" + result + "/");
@@ -210,7 +210,7 @@ namespace Lucene.Net.QueryParsers.Util
         {
             Query q = GetQuery(query);
             string s = q.ToString("field");
-            if (!s.Equals(result))
+            if (!s.Equals(result, StringComparison.Ordinal))
             {
                 fail("WildcardQuery /" + query + "/ yielded /" + s + "/, expecting /"
                     + result + "/");
@@ -230,7 +230,7 @@ namespace Lucene.Net.QueryParsers.Util
         {
             Query q = GetQueryDOA(query, a);
             string s = q.ToString("field");
-            if (!s.Equals(result))
+            if (!s.Equals(result, StringComparison.Ordinal))
             {
                 fail("Query /" + query + "/ yielded /" + s
                      + "/, expecting /" + result + "/");
@@ -1235,7 +1235,7 @@ namespace Lucene.Net.QueryParsers.Util
 
                 if (m_input.IncrementToken())
                 {
-                    addSynonym = termAtt.toString().equals("dogs");
+                    addSynonym = termAtt.toString().Equals("dogs", StringComparison.Ordinal);
                     return true;
                 }
                 else
diff --git a/src/Lucene.Net.Tests.Replicator/IndexAndTaxonomyRevisionTest.cs b/src/Lucene.Net.Tests.Replicator/IndexAndTaxonomyRevisionTest.cs
index 9290a5c..46d8d73 100644
--- a/src/Lucene.Net.Tests.Replicator/IndexAndTaxonomyRevisionTest.cs
+++ b/src/Lucene.Net.Tests.Replicator/IndexAndTaxonomyRevisionTest.cs
@@ -120,7 +120,7 @@ namespace Lucene.Net.Replicator
                 foreach (var files in sourceFiles.Values)
                 {
                     string lastFile = files.Last().FileName;
-                    assertTrue(lastFile.StartsWith(IndexFileNames.SEGMENTS, StringComparison.Ordinal) && !lastFile.Equals(IndexFileNames.SEGMENTS_GEN));
+                    assertTrue(lastFile.StartsWith(IndexFileNames.SEGMENTS, StringComparison.Ordinal) && !lastFile.Equals(IndexFileNames.SEGMENTS_GEN, StringComparison.Ordinal));
                 }
             }
             finally
@@ -148,7 +148,7 @@ namespace Lucene.Net.Replicator
                 foreach (var e in rev.SourceFiles)
                 {
                     string source = e.Key;
-                    Directory dir = source.Equals(IndexAndTaxonomyRevision.INDEX_SOURCE) ? indexDir : taxoDir;
+                    Directory dir = source.Equals(IndexAndTaxonomyRevision.INDEX_SOURCE, StringComparison.Ordinal) ? indexDir : taxoDir;
                     foreach (RevisionFile file in e.Value)
                     {
                         IndexInput src = dir.OpenInput(file.FileName, IOContext.READ_ONCE);
diff --git a/src/Lucene.Net.Tests.Replicator/IndexRevisionTest.cs b/src/Lucene.Net.Tests.Replicator/IndexRevisionTest.cs
index cea6e51..a639e59 100644
--- a/src/Lucene.Net.Tests.Replicator/IndexRevisionTest.cs
+++ b/src/Lucene.Net.Tests.Replicator/IndexRevisionTest.cs
@@ -118,7 +118,7 @@ namespace Lucene.Net.Replicator
                 assertEquals(1, sourceFiles.Count);
                 var files = sourceFiles.Values.First();
                 string lastFile = files.Last().FileName;
-                assertTrue(lastFile.StartsWith(IndexFileNames.SEGMENTS, StringComparison.Ordinal) && !lastFile.Equals(IndexFileNames.SEGMENTS_GEN));
+                assertTrue(lastFile.StartsWith(IndexFileNames.SEGMENTS, StringComparison.Ordinal) && !lastFile.Equals(IndexFileNames.SEGMENTS_GEN, StringComparison.Ordinal));
             }
             finally
             {
diff --git a/src/Lucene.Net.Tests.Spatial/TestTestFramework.cs b/src/Lucene.Net.Tests.Spatial/TestTestFramework.cs
index 6c36de0..67a4242 100644
--- a/src/Lucene.Net.Tests.Spatial/TestTestFramework.cs
+++ b/src/Lucene.Net.Tests.Spatial/TestTestFramework.cs
@@ -48,7 +48,7 @@ namespace Lucene.Net.Spatial
             SpatialTestQuery sf = tests[0];
             // assert
             assertEquals(1, sf.ids.size());
-            assertTrue(sf.ids[0].equals("G5391959"));
+            assertTrue(sf.ids[0].Equals("G5391959", StringComparison.Ordinal));
             assertTrue(sf.args.Shape is IRectangle);
             assertEquals(SpatialOperation.Intersects, sf.args.Operation);
         }
diff --git a/src/Lucene.Net.Tests.Suggest/Spell/TestDirectSpellChecker.cs b/src/Lucene.Net.Tests.Suggest/Spell/TestDirectSpellChecker.cs
index b1ecae0..5f0619d 100644
--- a/src/Lucene.Net.Tests.Suggest/Spell/TestDirectSpellChecker.cs
+++ b/src/Lucene.Net.Tests.Suggest/Spell/TestDirectSpellChecker.cs
@@ -87,7 +87,7 @@ namespace Lucene.Net.Search.Spell
                     SuggestMode.SUGGEST_WHEN_NOT_IN_INDEX);
             if (similar.Length > 0)
             {
-                assertFalse(similar[0].String.equals("five")); // don't suggest a word for itself
+                assertFalse(similar[0].String.Equals("five", StringComparison.Ordinal)); // don't suggest a word for itself
             }
 
             similar = spellChecker.SuggestSimilar(new Term("numbers", "fvie"), 2, ir,
diff --git a/src/Lucene.Net.Tests.Suggest/Spell/TestLuceneDictionary.cs b/src/Lucene.Net.Tests.Suggest/Spell/TestLuceneDictionary.cs
index d86bbdb..2d3e75b 100644
--- a/src/Lucene.Net.Tests.Suggest/Spell/TestLuceneDictionary.cs
+++ b/src/Lucene.Net.Tests.Suggest/Spell/TestLuceneDictionary.cs
@@ -4,6 +4,7 @@ using Lucene.Net.Index;
 using Lucene.Net.Store;
 using Lucene.Net.Util;
 using NUnit.Framework;
+using System;
 
 namespace Lucene.Net.Search.Spell
 {
@@ -107,7 +108,7 @@ namespace Lucene.Net.Search.Spell
                 ld = new LuceneDictionary(indexReader, "aaa");
                 it = ld.GetEntryIterator();
                 assertNotNull("First element doesn't exist.", spare = it.Next());
-                assertTrue("First element isn't correct", spare.Utf8ToString().equals("foo"));
+                assertTrue("First element isn't correct", spare.Utf8ToString().Equals("foo", StringComparison.Ordinal));
                 assertNull("More elements than expected", it.Next());
             }
             finally
@@ -127,9 +128,9 @@ namespace Lucene.Net.Search.Spell
                 it = ld.GetEntryIterator();
 
                 assertNotNull("First element doesn't exist.", spare = it.Next());
-                assertTrue("First element isn't correct", spare.Utf8ToString().equals("Jerry"));
+                assertTrue("First element isn't correct", spare.Utf8ToString().Equals("Jerry", StringComparison.Ordinal));
                 assertNotNull("Second element doesn't exist.", spare = it.Next());
-                assertTrue("Second element isn't correct", spare.Utf8ToString().equals("Tom"));
+                assertTrue("Second element isn't correct", spare.Utf8ToString().Equals("Tom", StringComparison.Ordinal));
                 assertNull("More elements than expected", it.Next());
 
                 ld = new LuceneDictionary(indexReader, "contents");
diff --git a/src/Lucene.Net.Tests.Suggest/Spell/TestSpellChecker.cs b/src/Lucene.Net.Tests.Suggest/Spell/TestSpellChecker.cs
index 624690f..8b96137 100644
--- a/src/Lucene.Net.Tests.Suggest/Spell/TestSpellChecker.cs
+++ b/src/Lucene.Net.Tests.Suggest/Spell/TestSpellChecker.cs
@@ -268,7 +268,7 @@ namespace Lucene.Net.Search.Spell
             similar = spellChecker.SuggestSimilar("five", 2);
             if (similar.Length > 0)
             {
-                assertFalse(similar[0].equals("five")); // don't suggest a word for itself
+                assertFalse(similar[0].Equals("five", StringComparison.Ordinal)); // don't suggest a word for itself
             }
 
             similar = spellChecker.SuggestSimilar("fiv", 2);
diff --git a/src/Lucene.Net.Tests.Suggest/Spell/TestWordBreakSpellChecker.cs b/src/Lucene.Net.Tests.Suggest/Spell/TestWordBreakSpellChecker.cs
index f7bc90e..fd1e2e4 100644
--- a/src/Lucene.Net.Tests.Suggest/Spell/TestWordBreakSpellChecker.cs
+++ b/src/Lucene.Net.Tests.Suggest/Spell/TestWordBreakSpellChecker.cs
@@ -103,19 +103,19 @@ namespace Lucene.Net.Search.Spell
                     assertTrue(cs[0].OriginalTermIndexes.Length == 2);
                     assertTrue(cs[0].OriginalTermIndexes[0] == 1);
                     assertTrue(cs[0].OriginalTermIndexes[1] == 2);
-                    assertTrue(cs[0].Suggestion.String.equals("hundred"));
+                    assertTrue(cs[0].Suggestion.String.Equals("hundred", StringComparison.Ordinal));
                     assertTrue(cs[0].Suggestion.Score == 1);
 
                     assertTrue(cs[1].OriginalTermIndexes.Length == 2);
                     assertTrue(cs[1].OriginalTermIndexes[0] == 3);
                     assertTrue(cs[1].OriginalTermIndexes[1] == 4);
-                    assertTrue(cs[1].Suggestion.String.equals("eighty"));
+                    assertTrue(cs[1].Suggestion.String.Equals("eighty", StringComparison.Ordinal));
                     assertTrue(cs[1].Suggestion.Score == 1);
 
                     assertTrue(cs[2].OriginalTermIndexes.Length == 2);
                     assertTrue(cs[2].OriginalTermIndexes[0] == 4);
                     assertTrue(cs[2].OriginalTermIndexes[1] == 5);
-                    assertTrue(cs[2].Suggestion.String.equals("yeight"));
+                    assertTrue(cs[2].Suggestion.String.Equals("yeight", StringComparison.Ordinal));
                     assertTrue(cs[2].Suggestion.Score == 1);
 
                     for (int i = 3; i < 5; i++)
@@ -126,11 +126,11 @@ namespace Lucene.Net.Search.Spell
                             (cs[i].OriginalTermIndexes[0] == 1 &&
                              cs[i].OriginalTermIndexes[1] == 2 &&
                              cs[i].OriginalTermIndexes[2] == 3 &&
-                             cs[i].Suggestion.String.equals("hundredeight")) ||
+                             cs[i].Suggestion.String.Equals("hundredeight", StringComparison.Ordinal)) ||
                             (cs[i].OriginalTermIndexes[0] == 3 &&
                              cs[i].OriginalTermIndexes[1] == 4 &&
                              cs[i].OriginalTermIndexes[2] == 5 &&
-                             cs[i].Suggestion.String.equals("eightyeight"))
+                             cs[i].Suggestion.String.Equals("eightyeight", StringComparison.Ordinal))
                  );
                     }
 
@@ -140,7 +140,7 @@ namespace Lucene.Net.Search.Spell
                     assertTrue(cs[0].Suggestion.Score == 1);
                     assertTrue(cs[0].OriginalTermIndexes[0] == 1);
                     assertTrue(cs[0].OriginalTermIndexes[1] == 2);
-                    assertTrue(cs[0].Suggestion.String.equals("hundred"));
+                    assertTrue(cs[0].Suggestion.String.Equals("hundred", StringComparison.Ordinal));
                     assertTrue(cs[0].Suggestion.Score == 1);
 
                     assertTrue(cs[1].OriginalTermIndexes.Length == 3);
@@ -148,7 +148,7 @@ namespace Lucene.Net.Search.Spell
                     assertTrue(cs[1].OriginalTermIndexes[0] == 1);
                     assertTrue(cs[1].OriginalTermIndexes[1] == 2);
                     assertTrue(cs[1].OriginalTermIndexes[2] == 3);
-                    assertTrue(cs[1].Suggestion.String.equals("hundredeight"));
+                    assertTrue(cs[1].Suggestion.String.Equals("hundredeight", StringComparison.Ordinal));
                 }
             }
             catch (Exception e)
@@ -178,8 +178,8 @@ namespace Lucene.Net.Search.Spell
                     SuggestWord[][] sw = wbsp.SuggestWordBreaks(term, 5, ir, SuggestMode.SUGGEST_WHEN_NOT_IN_INDEX, WordBreakSpellChecker.BreakSuggestionSortMethod.NUM_CHANGES_THEN_MAX_FREQUENCY);
                     assertTrue(sw.Length == 1);
                     assertTrue(sw[0].Length == 2);
-                    assertTrue(sw[0][0].String.equals("ninety"));
-                    assertTrue(sw[0][1].String.equals("nine"));
+                    assertTrue(sw[0][0].String.Equals("ninety", StringComparison.Ordinal));
+                    assertTrue(sw[0][1].String.Equals("nine", StringComparison.Ordinal));
                     assertTrue(sw[0][0].Score == 1);
                     assertTrue(sw[0][1].Score == 1);
                 }
@@ -191,8 +191,8 @@ namespace Lucene.Net.Search.Spell
                     SuggestWord[][] sw = wbsp.SuggestWordBreaks(term, 2, ir, SuggestMode.SUGGEST_WHEN_NOT_IN_INDEX, WordBreakSpellChecker.BreakSuggestionSortMethod.NUM_CHANGES_THEN_MAX_FREQUENCY);
                     assertTrue(sw.Length == 1);
                     assertTrue(sw[0].Length == 2);
-                    assertTrue(sw[0][0].String.equals("one"));
-                    assertTrue(sw[0][1].String.equals("thousand"));
+                    assertTrue(sw[0][0].String.Equals("one", StringComparison.Ordinal));
+                    assertTrue(sw[0][1].String.Equals("thousand", StringComparison.Ordinal));
                     assertTrue(sw[0][0].Score == 1);
                     assertTrue(sw[0][1].Score == 1);
 
@@ -213,16 +213,16 @@ namespace Lucene.Net.Search.Spell
                     sw = wbsp.SuggestWordBreaks(term, 2, ir, SuggestMode.SUGGEST_WHEN_NOT_IN_INDEX, WordBreakSpellChecker.BreakSuggestionSortMethod.NUM_CHANGES_THEN_MAX_FREQUENCY);
                     assertTrue(sw.Length == 2);
                     assertTrue(sw[0].Length == 2);
-                    assertTrue(sw[0][0].String.equals("one"));
-                    assertTrue(sw[0][1].String.equals("thousand"));
+                    assertTrue(sw[0][0].String.Equals("one", StringComparison.Ordinal));
+                    assertTrue(sw[0][1].String.Equals("thousand", StringComparison.Ordinal));
                     assertTrue(sw[0][0].Score == 1);
                     assertTrue(sw[0][1].Score == 1);
                     assertTrue(sw[0][1].Freq > 1);
                     assertTrue(sw[0][0].Freq > sw[0][1].Freq);
                     assertTrue(sw[1].Length == 3);
-                    assertTrue(sw[1][0].String.equals("one"));
-                    assertTrue(sw[1][1].String.equals("thou"));
-                    assertTrue(sw[1][2].String.equals("sand"));
+                    assertTrue(sw[1][0].String.Equals("one", StringComparison.Ordinal));
+                    assertTrue(sw[1][1].String.Equals("thou", StringComparison.Ordinal));
+                    assertTrue(sw[1][2].String.Equals("sand", StringComparison.Ordinal));
                     assertTrue(sw[1][0].Score == 2);
                     assertTrue(sw[1][1].Score == 2);
                     assertTrue(sw[1][2].Score == 2);
@@ -247,10 +247,10 @@ namespace Lucene.Net.Search.Spell
                     sw = wbsp.SuggestWordBreaks(term, 5, ir, SuggestMode.SUGGEST_WHEN_NOT_IN_INDEX, WordBreakSpellChecker.BreakSuggestionSortMethod.NUM_CHANGES_THEN_MAX_FREQUENCY);
                     assertTrue(sw.Length == 2);
                     assertTrue(sw[0].Length == 5);
-                    assertTrue(sw[0][1].String.equals("thousand"));
+                    assertTrue(sw[0][1].String.Equals("thousand", StringComparison.Ordinal));
                     assertTrue(sw[1].Length == 6);
-                    assertTrue(sw[1][1].String.equals("thou"));
-                    assertTrue(sw[1][2].String.equals("sand"));
+                    assertTrue(sw[1][1].String.Equals("thou", StringComparison.Ordinal));
+                    assertTrue(sw[1][2].String.Equals("sand", StringComparison.Ordinal));
                 }
                 {
                     //make sure we can handle 2-char codepoints
@@ -344,7 +344,7 @@ namespace Lucene.Net.Search.Spell
                         foreach (SuggestWord[] sw1 in sw)
                         {
                             assertTrue(sw1.Length == 2);
-                            if (sw1[0].String.equals(left) && sw1[1].String.equals(right))
+                            if (sw1[0].String.Equals(left, StringComparison.Ordinal) && sw1[1].String.Equals(right, StringComparison.Ordinal))
                             {
                                 failed = false;
                             }
@@ -361,7 +361,7 @@ namespace Lucene.Net.Search.Spell
                         foreach (CombineSuggestion cs1 in cs)
                         {
                             assertTrue(cs1.OriginalTermIndexes.Length == 2);
-                            if (cs1.Suggestion.String.equals(left + right))
+                            if (cs1.Suggestion.String.Equals(left + right, StringComparison.Ordinal))
                             {
                                 failed = false;
                             }
diff --git a/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/AnalyzingSuggesterTest.cs b/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/AnalyzingSuggesterTest.cs
index 3d75293..29b886d 100644
--- a/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/AnalyzingSuggesterTest.cs
+++ b/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/AnalyzingSuggesterTest.cs
@@ -962,7 +962,7 @@ namespace Lucene.Net.Search.Suggest.Analyzing
                 while (true)
                 {
                     string s = Regex.Replace(analyzedKey, SEP + "$", "");
-                    if (s.equals(analyzedKey))
+                    if (s.Equals(analyzedKey, StringComparison.Ordinal))
                     {
                         break;
                     }
diff --git a/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/FuzzySuggesterTest.cs b/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/FuzzySuggesterTest.cs
index a3ed037..0900c86 100644
--- a/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/FuzzySuggesterTest.cs
+++ b/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/FuzzySuggesterTest.cs
@@ -877,7 +877,7 @@ namespace Lucene.Net.Search.Suggest.Analyzing
                 {
                     string s = Regex.Replace(analyzedKey, "(^| )\u0000$", "");
                     s = Regex.Replace(s, "\\s+$", "");
-                    if (s.Equals(analyzedKey))
+                    if (s.Equals(analyzedKey, StringComparison.Ordinal))
                     {
                         break;
                     }
diff --git a/src/Lucene.Net.Tests.Suggest/Suggest/Fst/FSTCompletionTest.cs b/src/Lucene.Net.Tests.Suggest/Suggest/Fst/FSTCompletionTest.cs
index c85c079..035db0a 100644
--- a/src/Lucene.Net.Tests.Suggest/Suggest/Fst/FSTCompletionTest.cs
+++ b/src/Lucene.Net.Tests.Suggest/Suggest/Fst/FSTCompletionTest.cs
@@ -220,8 +220,8 @@ namespace Lucene.Net.Search.Suggest.Fst
 
             IList<Lookup.LookupResult> result = lookup.DoLookup(StringToCharSequence("wit").ToString(), true, 5);
             assertEquals(5, result.size());
-            assertTrue(result[0].Key.toString().equals("wit"));  // exact match.
-            assertTrue(result[1].Key.toString().equals("with")); // highest count.
+            assertTrue(result[0].Key.toString().Equals("wit", StringComparison.Ordinal));  // exact match.
+            assertTrue(result[1].Key.toString().Equals("with", StringComparison.Ordinal)); // highest count.
         }
 
         [Test]
diff --git a/src/Lucene.Net.Tests/Analysis/TestGraphTokenizers.cs b/src/Lucene.Net.Tests/Analysis/TestGraphTokenizers.cs
index de3a32e..e18a208 100644
--- a/src/Lucene.Net.Tests/Analysis/TestGraphTokenizers.cs
+++ b/src/Lucene.Net.Tests/Analysis/TestGraphTokenizers.cs
@@ -286,7 +286,7 @@ namespace Lucene.Net.Analysis
                     {
                         return false;
                     }
-                    else if (TermAtt.ToString().Equals("a"))
+                    else if (TermAtt.ToString().Equals("a", StringComparison.Ordinal))
                     {
                         PendingPosInc += PosIncAtt.PositionIncrement;
                     }
diff --git a/src/Lucene.Net.Tests/Analysis/TrivialLookaheadFilter.cs b/src/Lucene.Net.Tests/Analysis/TrivialLookaheadFilter.cs
index b422026..523c308 100644
--- a/src/Lucene.Net.Tests/Analysis/TrivialLookaheadFilter.cs
+++ b/src/Lucene.Net.Tests/Analysis/TrivialLookaheadFilter.cs
@@ -1,4 +1,5 @@
 using Lucene.Net.Analysis.TokenAttributes;
+using System;
 using System.Collections.Generic;
 
 namespace Lucene.Net.Analysis
@@ -87,7 +88,7 @@ namespace Lucene.Net.Analysis
                 {
                     string term = new string(TermAtt.Buffer, 0, TermAtt.Length);
                     facts.Add(term + "-huh?");
-                    if (".".Equals(term))
+                    if (".".Equals(term, StringComparison.Ordinal))
                     {
                         haveSentence = true;
                     }
diff --git a/src/Lucene.Net.Tests/Codecs/Lucene3x/TestSurrogates.cs b/src/Lucene.Net.Tests/Codecs/Lucene3x/TestSurrogates.cs
index f056674..731ef64 100644
--- a/src/Lucene.Net.Tests/Codecs/Lucene3x/TestSurrogates.cs
+++ b/src/Lucene.Net.Tests/Codecs/Lucene3x/TestSurrogates.cs
@@ -109,7 +109,7 @@ namespace Lucene.Net.Codecs.Lucene3x
 
             public int Compare(Term term1, Term term2)
             {
-                if (term1.Field.Equals(term2.Field))
+                if (term1.Field.Equals(term2.Field, StringComparison.Ordinal))
                 {
                     return LegacyComparer.Compare(term1.Bytes, term2.Bytes);
                 }
@@ -225,7 +225,7 @@ namespace Lucene.Net.Codecs.Lucene3x
                         break;
                     }
                     term = fieldTerms[1 + spot + i];
-                    if (!term.Field.Equals(field))
+                    if (!term.Field.Equals(field, StringComparison.Ordinal))
                     {
                         Assert.IsNull(te.Next());
                         break;
@@ -287,7 +287,7 @@ namespace Lucene.Net.Codecs.Lucene3x
 
                         spot = -spot - 1;
 
-                        if (spot == fieldTerms.Count || !fieldTerms[spot].Field.Equals(field))
+                        if (spot == fieldTerms.Count || !fieldTerms[spot].Field.Equals(field, StringComparison.Ordinal))
                         {
                             Assert.AreEqual(TermsEnum.SeekStatus.END, te.SeekCeil(tx.Bytes));
                         }
@@ -316,7 +316,7 @@ namespace Lucene.Net.Codecs.Lucene3x
                                     break;
                                 }
                                 Term term = fieldTerms[1 + spot + i];
-                                if (!term.Field.Equals(field))
+                                if (!term.Field.Equals(field, StringComparison.Ordinal))
                                 {
                                     Assert.IsNull(te.Next());
                                     break;
diff --git a/src/Lucene.Net.Tests/Codecs/PerField/TestPerFieldDocValuesFormat.cs b/src/Lucene.Net.Tests/Codecs/PerField/TestPerFieldDocValuesFormat.cs
index 573becd..7b2fa70 100644
--- a/src/Lucene.Net.Tests/Codecs/PerField/TestPerFieldDocValuesFormat.cs
+++ b/src/Lucene.Net.Tests/Codecs/PerField/TestPerFieldDocValuesFormat.cs
@@ -144,7 +144,7 @@ namespace Lucene.Net.Codecs.PerField
 
             public override DocValuesFormat GetDocValuesFormatForField(string field)
             {
-                if ("dv1".Equals(field))
+                if ("dv1".Equals(field, StringComparison.Ordinal))
                 {
                     return Fast;
                 }
diff --git a/src/Lucene.Net.Tests/Codecs/PerField/TestPerFieldPostingsFormat2.cs b/src/Lucene.Net.Tests/Codecs/PerField/TestPerFieldPostingsFormat2.cs
index 8360578..5201c7b 100644
--- a/src/Lucene.Net.Tests/Codecs/PerField/TestPerFieldPostingsFormat2.cs
+++ b/src/Lucene.Net.Tests/Codecs/PerField/TestPerFieldPostingsFormat2.cs
@@ -207,11 +207,11 @@ namespace Lucene.Net.Codecs.PerField
 
             public override PostingsFormat GetPostingsFormatForField(string field)
             {
-                if (field.Equals("id"))
+                if (field.Equals("id", StringComparison.Ordinal))
                 {
                     return SimpleText;
                 }
-                else if (field.Equals("content"))
+                else if (field.Equals("content", StringComparison.Ordinal))
                 {
                     return MockSep;
                 }
@@ -229,7 +229,7 @@ namespace Lucene.Net.Codecs.PerField
 
             public override PostingsFormat GetPostingsFormatForField(string field)
             {
-                if (field.Equals("id"))
+                if (field.Equals("id", StringComparison.Ordinal))
                 {
                     return SimpleText;
                 }
@@ -297,11 +297,11 @@ namespace Lucene.Net.Codecs.PerField
 
             public override PostingsFormat GetPostingsFormatForField(string field)
             {
-                if ("id".Equals(field))
+                if ("id".Equals(field, StringComparison.Ordinal))
                 {
                     return new Pulsing41PostingsFormat(1);
                 }
-                else if ("date".Equals(field))
+                else if ("date".Equals(field, StringComparison.Ordinal))
                 {
                     return new Pulsing41PostingsFormat(1);
                 }
@@ -330,11 +330,11 @@ namespace Lucene.Net.Codecs.PerField
 
             public override PostingsFormat GetPostingsFormatForField(string field)
             {
-                if ("id".Equals(field))
+                if ("id".Equals(field, StringComparison.Ordinal))
                 {
                     return new Pulsing41PostingsFormat(1);
                 }
-                else if ("date".Equals(field))
+                else if ("date".Equals(field, StringComparison.Ordinal))
                 {
                     return new Pulsing41PostingsFormat(2);
                 }
diff --git a/src/Lucene.Net.Tests/Document/TestBinaryDocument.cs b/src/Lucene.Net.Tests/Document/TestBinaryDocument.cs
index 0fd7d90..264386f 100644
--- a/src/Lucene.Net.Tests/Document/TestBinaryDocument.cs
+++ b/src/Lucene.Net.Tests/Document/TestBinaryDocument.cs
@@ -76,12 +76,12 @@ namespace Lucene.Net.Documents
 
             string binaryFldStoredTest = Encoding.UTF8.GetString(bytes.Bytes).Substring(bytes.Offset, bytes.Length);
             //new string(bytes.Bytes, bytes.Offset, bytes.Length, IOUtils.CHARSET_UTF_8);
-            Assert.IsTrue(binaryFldStoredTest.Equals(BinaryValStored));
+            Assert.IsTrue(binaryFldStoredTest.Equals(BinaryValStored, StringComparison.Ordinal));
 
             /// <summary>
             /// fetch the string field and compare it's content with the original one </summary>
             string stringFldStoredTest = docFromReader.Get("stringStored");
-            Assert.IsTrue(stringFldStoredTest.Equals(BinaryValStored));
+            Assert.IsTrue(stringFldStoredTest.Equals(BinaryValStored, StringComparison.Ordinal));
 
             writer.Dispose();
             reader.Dispose();
@@ -110,10 +110,10 @@ namespace Lucene.Net.Documents
                         Encoding.UTF8.GetString(
                             CompressionTools.Decompress(docFromReader.GetBinaryValue("binaryCompressed")));
                     //new string(CompressionTools.Decompress(docFromReader.GetBinaryValue("binaryCompressed")), IOUtils.CHARSET_UTF_8);
-                    Assert.IsTrue(binaryFldCompressedTest.Equals(BinaryValCompressed));
+                    Assert.IsTrue(binaryFldCompressedTest.Equals(BinaryValCompressed, StringComparison.Ordinal));
                     Assert.IsTrue(
                         CompressionTools.DecompressString(docFromReader.GetBinaryValue("stringCompressed"))
-                            .Equals(BinaryValCompressed));
+                            .Equals(BinaryValCompressed, StringComparison.Ordinal));
                 }
 
             }
diff --git a/src/Lucene.Net.Tests/Document/TestDateTools.cs b/src/Lucene.Net.Tests/Document/TestDateTools.cs
index 8a4d823..664c936 100644
--- a/src/Lucene.Net.Tests/Document/TestDateTools.cs
+++ b/src/Lucene.Net.Tests/Document/TestDateTools.cs
@@ -211,7 +211,7 @@ namespace Lucene.Net.Documents
                 TimeZone.Default = TimeZone.getTimeZone("Europe/London"); // "GMT"
                 string d1 = DateTools.DateToString(new DateTime(time * 1000), DateTools.Resolution.MINUTE);
                 string d2 = DateTools.DateToString(new DateTime((time+3600) * 1000), DateTools.Resolution.MINUTE);
-                Assert.IsFalse(d1.Equals(d2), "different times");
+                Assert.IsFalse(d1.Equals(d2, StringComparison.Ordinal), "different times");
                 Assert.AreEqual(DateTools.StringToTime(d1), time * 1000, "midnight");
                 Assert.AreEqual(DateTools.StringToTime(d2), (time+3600) * 1000, "later");
             }
@@ -231,7 +231,7 @@ namespace Lucene.Net.Documents
                 System.String d1 = DateTools.DateToString(tempAux, DateTools.Resolution.MINUTE);
                 System.DateTime tempAux2 = time2;
                 System.String d2 = DateTools.DateToString(tempAux2, DateTools.Resolution.MINUTE);
-                Assert.IsFalse(d1.Equals(d2), "different times");
+                Assert.IsFalse(d1.Equals(d2, StringComparison.Ordinal), "different times");
                 Assert.AreEqual(DateTools.StringToTime(d1), time1.Ticks, "midnight");
                 Assert.AreEqual(DateTools.StringToTime(d2), time2.Ticks, "later");
             }
diff --git a/src/Lucene.Net.Tests/Document/TestDocument.cs b/src/Lucene.Net.Tests/Document/TestDocument.cs
index 040690d..54f1b1d 100644
--- a/src/Lucene.Net.Tests/Document/TestDocument.cs
+++ b/src/Lucene.Net.Tests/Document/TestDocument.cs
@@ -1,5 +1,6 @@
 using Lucene.Net.Support;
 using NUnit.Framework;
+using System;
 using System.IO;
 using System.Text;
 
@@ -71,10 +72,10 @@ namespace Lucene.Net.Documents
             Assert.IsFalse(binaryFld.IndexableFieldType.IsIndexed);
 
             string binaryTest = doc.GetBinaryValue("binary").Utf8ToString();
-            Assert.IsTrue(binaryTest.Equals(BinaryVal));
+            Assert.IsTrue(binaryTest.Equals(BinaryVal, StringComparison.Ordinal));
 
             string stringTest = doc.Get("string");
-            Assert.IsTrue(binaryTest.Equals(stringTest));
+            Assert.IsTrue(binaryTest.Equals(stringTest, StringComparison.Ordinal));
 
             doc.Add(binaryFld2);
 
@@ -87,10 +88,10 @@ namespace Lucene.Net.Documents
             binaryTest = binaryTests[0].Utf8ToString();
             string binaryTest2 = binaryTests[1].Utf8ToString();
 
-            Assert.IsFalse(binaryTest.Equals(binaryTest2));
+            Assert.IsFalse(binaryTest.Equals(binaryTest2, StringComparison.Ordinal));
 
-            Assert.IsTrue(binaryTest.Equals(BinaryVal));
-            Assert.IsTrue(binaryTest2.Equals(BinaryVal2));
+            Assert.IsTrue(binaryTest.Equals(BinaryVal, StringComparison.Ordinal));
+            Assert.IsTrue(binaryTest2.Equals(BinaryVal2, StringComparison.Ordinal));
 
             doc.RemoveField("string");
             Assert.AreEqual(2, doc.Fields.Count);
@@ -281,18 +282,18 @@ namespace Lucene.Net.Documents
                 Assert.IsTrue(unstoredFieldValues.Length == 2);
             }
 
-            Assert.IsTrue(keywordFieldValues[0].GetStringValue().Equals("test1"));
-            Assert.IsTrue(keywordFieldValues[1].GetStringValue().Equals("test2"));
-            Assert.IsTrue(textFieldValues[0].GetStringValue().Equals("test1"));
-            Assert.IsTrue(textFieldValues[1].GetStringValue().Equals("test2"));
-            Assert.IsTrue(unindexedFieldValues[0].GetStringValue().Equals("test1"));
-            Assert.IsTrue(unindexedFieldValues[1].GetStringValue().Equals("test2"));
+            Assert.IsTrue(keywordFieldValues[0].GetStringValue().Equals("test1", StringComparison.Ordinal));
+            Assert.IsTrue(keywordFieldValues[1].GetStringValue().Equals("test2", StringComparison.Ordinal));
+            Assert.IsTrue(textFieldValues[0].GetStringValue().Equals("test1", StringComparison.Ordinal));
+            Assert.IsTrue(textFieldValues[1].GetStringValue().Equals("test2", StringComparison.Ordinal));
+            Assert.IsTrue(unindexedFieldValues[0].GetStringValue().Equals("test1", StringComparison.Ordinal));
+            Assert.IsTrue(unindexedFieldValues[1].GetStringValue().Equals("test2", StringComparison.Ordinal));
             // this test cannot work for documents retrieved from the index
             // since unstored fields will obviously not be returned
             if (!fromIndex)
             {
-                Assert.IsTrue(unstoredFieldValues[0].GetStringValue().Equals("test1"));
-                Assert.IsTrue(unstoredFieldValues[1].GetStringValue().Equals("test2"));
+                Assert.IsTrue(unstoredFieldValues[0].GetStringValue().Equals("test1", StringComparison.Ordinal));
+                Assert.IsTrue(unstoredFieldValues[1].GetStringValue().Equals("test2", StringComparison.Ordinal));
             }
         }
 
@@ -325,15 +326,15 @@ namespace Lucene.Net.Documents
             {
                 Documents.Document doc2 = searcher.Doc(hits[i].Doc);
                 Field f = (Field)doc2.GetField("id");
-                if (f.GetStringValue().Equals("id1"))
+                if (f.GetStringValue().Equals("id1", StringComparison.Ordinal))
                 {
                     result |= 1;
                 }
-                else if (f.GetStringValue().Equals("id2"))
+                else if (f.GetStringValue().Equals("id2", StringComparison.Ordinal))
                 {
                     result |= 2;
                 }
-                else if (f.GetStringValue().Equals("id3"))
+                else if (f.GetStringValue().Equals("id3", StringComparison.Ordinal))
                 {
                     result |= 4;
                 }
@@ -412,7 +413,7 @@ namespace Lucene.Net.Documents
                 TermsEnum tvsEnum = tvs.GetIterator(null);
                 Assert.AreEqual(new BytesRef("abc"), tvsEnum.Next());
                 DocsAndPositionsEnum dpEnum = tvsEnum.DocsAndPositions(null, null);
-                if (field.Equals("tv"))
+                if (field.Equals("tv", StringComparison.Ordinal))
                 {
                     Assert.IsNull(dpEnum);
                 }
diff --git a/src/Lucene.Net.Tests/Index/Test2BTerms.cs b/src/Lucene.Net.Tests/Index/Test2BTerms.cs
index 540f89f..1dd7672 100644
--- a/src/Lucene.Net.Tests/Index/Test2BTerms.cs
+++ b/src/Lucene.Net.Tests/Index/Test2BTerms.cs
@@ -172,7 +172,7 @@ namespace Lucene.Net.Index
         [Test]
         public virtual void Test2BTerms_Mem([ValueSource(typeof(ConcurrentMergeSchedulerFactories), "Values")]Func<IConcurrentMergeScheduler> newScheduler)
         {
-            if ("Lucene3x".Equals(Codec.Default.Name))
+            if ("Lucene3x".Equals(Codec.Default.Name, StringComparison.Ordinal))
             {
                 throw new Exception("this test cannot run with PreFlex codec");
             }
diff --git a/src/Lucene.Net.Tests/Index/TestAddIndexes.cs b/src/Lucene.Net.Tests/Index/TestAddIndexes.cs
index b55556c..2b976bf 100644
--- a/src/Lucene.Net.Tests/Index/TestAddIndexes.cs
+++ b/src/Lucene.Net.Tests/Index/TestAddIndexes.cs
@@ -1147,11 +1147,11 @@ namespace Lucene.Net.Index
 
             public override PostingsFormat GetPostingsFormatForField(string field)
             {
-                if (field.Equals("id"))
+                if (field.Equals("id", StringComparison.Ordinal))
                 {
                     return SimpleTextFormat;
                 }
-                else if (field.Equals("content"))
+                else if (field.Equals("content", StringComparison.Ordinal))
                 {
                     return MockSepFormat;
                 }
@@ -1306,7 +1306,7 @@ namespace Lucene.Net.Index
             for (int docID = 0; docID < 2; docID++)
             {
                 Document d = r3.Document(docID);
-                if (d.Get("id").Equals("1"))
+                if (d.Get("id").Equals("1", StringComparison.Ordinal))
                 {
                     Assert.AreEqual("doc1 field1", d.Get("f1"));
                 }
diff --git a/src/Lucene.Net.Tests/Index/TestAllFilesHaveChecksumFooter.cs b/src/Lucene.Net.Tests/Index/TestAllFilesHaveChecksumFooter.cs
index 2779dd5..948e2e1 100644
--- a/src/Lucene.Net.Tests/Index/TestAllFilesHaveChecksumFooter.cs
+++ b/src/Lucene.Net.Tests/Index/TestAllFilesHaveChecksumFooter.cs
@@ -80,7 +80,7 @@ namespace Lucene.Net.Index
         {
             foreach (string file in dir.ListAll())
             {
-                if (file.Equals(IndexWriter.WRITE_LOCK_NAME))
+                if (file.Equals(IndexWriter.WRITE_LOCK_NAME, StringComparison.Ordinal))
                 {
                     continue; // write.lock has no footer, thats ok
                 }
diff --git a/src/Lucene.Net.Tests/Index/TestAllFilesHaveCodecHeader.cs b/src/Lucene.Net.Tests/Index/TestAllFilesHaveCodecHeader.cs
index 0b6d28c..282f586 100644
--- a/src/Lucene.Net.Tests/Index/TestAllFilesHaveCodecHeader.cs
+++ b/src/Lucene.Net.Tests/Index/TestAllFilesHaveCodecHeader.cs
@@ -80,11 +80,11 @@ namespace Lucene.Net.Index
         {
             foreach (string file in dir.ListAll())
             {
-                if (file.Equals(IndexWriter.WRITE_LOCK_NAME))
+                if (file.Equals(IndexWriter.WRITE_LOCK_NAME, StringComparison.Ordinal))
                 {
                     continue; // write.lock has no header, thats ok
                 }
-                if (file.Equals(IndexFileNames.SEGMENTS_GEN))
+                if (file.Equals(IndexFileNames.SEGMENTS_GEN, StringComparison.Ordinal))
                 {
                     continue; // segments.gen has no header, thats ok
                 }
diff --git a/src/Lucene.Net.Tests/Index/TestBagOfPositions.cs b/src/Lucene.Net.Tests/Index/TestBagOfPositions.cs
index b8ef0c0..53c8b03 100644
--- a/src/Lucene.Net.Tests/Index/TestBagOfPositions.cs
+++ b/src/Lucene.Net.Tests/Index/TestBagOfPositions.cs
@@ -56,7 +56,7 @@ namespace Lucene.Net.Index
             IList<string> postingsList = new List<string>();
             int numTerms = AtLeast(300);
             int maxTermsPerDoc = TestUtil.NextInt(Random(), 10, 20);
-            bool isSimpleText = "SimpleText".Equals(TestUtil.GetPostingsFormat("field"));
+            bool isSimpleText = "SimpleText".Equals(TestUtil.GetPostingsFormat("field"), StringComparison.Ordinal);
 
             IndexWriterConfig iwc = NewIndexWriterConfig(Random(), TEST_VERSION_CURRENT, new MockAnalyzer(Random()));
 
diff --git a/src/Lucene.Net.Tests/Index/TestBagOfPostings.cs b/src/Lucene.Net.Tests/Index/TestBagOfPostings.cs
index 6bee4a6..21e8e3e 100644
--- a/src/Lucene.Net.Tests/Index/TestBagOfPostings.cs
+++ b/src/Lucene.Net.Tests/Index/TestBagOfPostings.cs
@@ -53,7 +53,7 @@ namespace Lucene.Net.Index
             int numTerms = AtLeast(300);
             int maxTermsPerDoc = TestUtil.NextInt(Random(), 10, 20);
 
-            bool isSimpleText = "SimpleText".Equals(TestUtil.GetPostingsFormat("field"));
+            bool isSimpleText = "SimpleText".Equals(TestUtil.GetPostingsFormat("field"), StringComparison.Ordinal);
 
             IndexWriterConfig iwc = NewIndexWriterConfig(Random(), TEST_VERSION_CURRENT, new MockAnalyzer(Random()));
 
diff --git a/src/Lucene.Net.Tests/Index/TestConcurrentMergeScheduler.cs b/src/Lucene.Net.Tests/Index/TestConcurrentMergeScheduler.cs
index 5920f38..7d0c958 100644
--- a/src/Lucene.Net.Tests/Index/TestConcurrentMergeScheduler.cs
+++ b/src/Lucene.Net.Tests/Index/TestConcurrentMergeScheduler.cs
@@ -410,7 +410,7 @@ namespace Lucene.Net.Index
             IndexWriterConfig iwc = NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random()));
             iwc.SetMaxBufferedDocs(5);
             iwc.SetMergeScheduler(new TrackingCMS());
-            if (TestUtil.GetPostingsFormat("id").Equals("SimpleText"))
+            if (TestUtil.GetPostingsFormat("id").Equals("SimpleText", StringComparison.Ordinal))
             {
                 // no
                 iwc.SetCodec(TestUtil.AlwaysPostingsFormat(new Lucene41PostingsFormat()));
diff --git a/src/Lucene.Net.Tests/Index/TestCrashCausesCorruptIndex.cs b/src/Lucene.Net.Tests/Index/TestCrashCausesCorruptIndex.cs
index f3945ee..a12ff40 100644
--- a/src/Lucene.Net.Tests/Index/TestCrashCausesCorruptIndex.cs
+++ b/src/Lucene.Net.Tests/Index/TestCrashCausesCorruptIndex.cs
@@ -184,7 +184,7 @@ namespace Lucene.Net.Index
             public override IndexOutput CreateOutput(string name, IOContext cxt)
             {
                 IndexOutput indexOutput = m_input.CreateOutput(name, cxt);
-                if (null != CrashAfterCreateOutput_Renamed && name.Equals(CrashAfterCreateOutput_Renamed))
+                if (null != CrashAfterCreateOutput_Renamed && name.Equals(CrashAfterCreateOutput_Renamed, StringComparison.Ordinal))
                 {
                     // CRASH!
                     indexOutput.Dispose();
diff --git a/src/Lucene.Net.Tests/Index/TestDocInverterPerFieldErrorInfo.cs b/src/Lucene.Net.Tests/Index/TestDocInverterPerFieldErrorInfo.cs
index a01074d..d015652 100644
--- a/src/Lucene.Net.Tests/Index/TestDocInverterPerFieldErrorInfo.cs
+++ b/src/Lucene.Net.Tests/Index/TestDocInverterPerFieldErrorInfo.cs
@@ -57,7 +57,7 @@ namespace Lucene.Net.Index
             protected internal override TokenStreamComponents CreateComponents(string fieldName, TextReader input)
             {
                 Tokenizer tokenizer = new MockTokenizer(input);
-                if (fieldName.Equals("distinctiveFieldName"))
+                if (fieldName.Equals("distinctiveFieldName", StringComparison.Ordinal))
                 {
                     TokenFilter tosser = new TokenFilterAnonymousInnerClassHelper(this, tokenizer);
                     return new TokenStreamComponents(tokenizer, tosser);
diff --git a/src/Lucene.Net.Tests/Index/TestDocumentWriter.cs b/src/Lucene.Net.Tests/Index/TestDocumentWriter.cs
index 81a27c6..9409b46 100644
--- a/src/Lucene.Net.Tests/Index/TestDocumentWriter.cs
+++ b/src/Lucene.Net.Tests/Index/TestDocumentWriter.cs
@@ -22,6 +22,7 @@ namespace Lucene.Net.Index
 
     using Lucene.Net.Analysis;
     using NUnit.Framework;
+    using System;
     using System.IO;
     using AttributeSource = Lucene.Net.Util.AttributeSource;
     using BytesRef = Lucene.Net.Util.BytesRef;
@@ -79,25 +80,25 @@ namespace Lucene.Net.Index
             //System.out.println("Document: " + doc);
             IIndexableField[] fields = doc.GetFields("textField2");
             Assert.IsTrue(fields != null && fields.Length == 1);
-            Assert.IsTrue(fields[0].GetStringValue().Equals(DocHelper.FIELD_2_TEXT));
+            Assert.IsTrue(fields[0].GetStringValue().Equals(DocHelper.FIELD_2_TEXT, StringComparison.Ordinal));
             Assert.IsTrue(fields[0].IndexableFieldType.StoreTermVectors);
 
             fields = doc.GetFields("textField1");
             Assert.IsTrue(fields != null && fields.Length == 1);
-            Assert.IsTrue(fields[0].GetStringValue().Equals(DocHelper.FIELD_1_TEXT));
+            Assert.IsTrue(fields[0].GetStringValue().Equals(DocHelper.FIELD_1_TEXT, StringComparison.Ordinal));
             Assert.IsFalse(fields[0].IndexableFieldType.StoreTermVectors);
 
             fields = doc.GetFields("keyField");
             Assert.IsTrue(fields != null && fields.Length == 1);
-            Assert.IsTrue(fields[0].GetStringValue().Equals(DocHelper.KEYWORD_TEXT));
+            Assert.IsTrue(fields[0].GetStringValue().Equals(DocHelper.KEYWORD_TEXT, StringComparison.Ordinal));
 
             fields = doc.GetFields(DocHelper.NO_NORMS_KEY);
             Assert.IsTrue(fields != null && fields.Length == 1);
-            Assert.IsTrue(fields[0].GetStringValue().Equals(DocHelper.NO_NORMS_TEXT));
+            Assert.IsTrue(fields[0].GetStringValue().Equals(DocHelper.NO_NORMS_TEXT, StringComparison.Ordinal));
 
             fields = doc.GetFields(DocHelper.TEXT_FIELD_3_KEY);
             Assert.IsTrue(fields != null && fields.Length == 1);
-            Assert.IsTrue(fields[0].GetStringValue().Equals(DocHelper.FIELD_3_TEXT));
+            Assert.IsTrue(fields[0].GetStringValue().Equals(DocHelper.FIELD_3_TEXT, StringComparison.Ordinal));
 
             // test that the norms are not present in the segment if
             // omitNorms is true
diff --git a/src/Lucene.Net.Tests/Index/TestFilterAtomicReader.cs b/src/Lucene.Net.Tests/Index/TestFilterAtomicReader.cs
index 3cb8531..bb051e1 100644
--- a/src/Lucene.Net.Tests/Index/TestFilterAtomicReader.cs
+++ b/src/Lucene.Net.Tests/Index/TestFilterAtomicReader.cs
@@ -193,7 +193,7 @@ namespace Lucene.Net.Index
             {
                 // LUCENENET specific - since we changed to using a property for Attributes rather than a method,
                 // we need to reflect that as get_Attributes here.
-                if (m.IsStatic || m.IsAbstract || m.IsFinal || /*m.Synthetic ||*/ m.Name.Equals("get_Attributes"))
+                if (m.IsStatic || m.IsAbstract || m.IsFinal || /*m.Synthetic ||*/ m.Name.Equals("get_Attributes", StringComparison.Ordinal))
                 {
                     continue;
                 }
diff --git a/src/Lucene.Net.Tests/Index/TestIndexFileDeleter.cs b/src/Lucene.Net.Tests/Index/TestIndexFileDeleter.cs
index 7b83e68..25428e9 100644
--- a/src/Lucene.Net.Tests/Index/TestIndexFileDeleter.cs
+++ b/src/Lucene.Net.Tests/Index/TestIndexFileDeleter.cs
@@ -89,7 +89,7 @@ namespace Lucene.Net.Index
             */
 
             // TODO: fix this test better
-            string ext = Codec.Default.Name.Equals("SimpleText") ? ".liv" : ".del";
+            string ext = Codec.Default.Name.Equals("SimpleText", StringComparison.Ordinal) ? ".liv" : ".del";
 
             // Create a bogus separate del file for a
             // segment that already has a separate del file:
diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriter.cs b/src/Lucene.Net.Tests/Index/TestIndexWriter.cs
index 077bf05..b99a7cf 100644
--- a/src/Lucene.Net.Tests/Index/TestIndexWriter.cs
+++ b/src/Lucene.Net.Tests/Index/TestIndexWriter.cs
@@ -2825,11 +2825,11 @@ namespace Lucene.Net.Index
 
             public void Apply(string message)
             {
-                if ("startCommitMerge".Equals(message))
+                if ("startCommitMerge".Equals(message, StringComparison.Ordinal))
                 {
                     IwRef.Get().KeepFullyDeletedSegments = false;
                 }
-                else if ("startMergeInit".Equals(message))
+                else if ("startMergeInit".Equals(message, StringComparison.Ordinal))
                 {
                     IwRef.Get().KeepFullyDeletedSegments = true;
                 }
diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriterCommit.cs b/src/Lucene.Net.Tests/Index/TestIndexWriterCommit.cs
index 103c0b3..0a5f2ae 100644
--- a/src/Lucene.Net.Tests/Index/TestIndexWriterCommit.cs
+++ b/src/Lucene.Net.Tests/Index/TestIndexWriterCommit.cs
@@ -202,7 +202,7 @@ namespace Lucene.Net.Index
 
             string idFormat = TestUtil.GetPostingsFormat("id");
             string contentFormat = TestUtil.GetPostingsFormat("content");
-            AssumeFalse("this test cannot run with Memory codec", idFormat.Equals("Memory") || contentFormat.Equals("Memory"));
+            AssumeFalse("this test cannot run with Memory codec", idFormat.Equals("Memory", StringComparison.Ordinal) || contentFormat.Equals("Memory", StringComparison.Ordinal));
             MockDirectoryWrapper dir = NewMockDirectory();
             Analyzer analyzer;
             if (Random().NextBoolean())
@@ -514,7 +514,7 @@ namespace Lucene.Net.Index
             IndexCommit commit = null;
             foreach (IndexCommit c in DirectoryReader.ListCommits(dir))
             {
-                if (c.UserData["tag"].Equals("first"))
+                if (c.UserData["tag"].Equals("first", StringComparison.Ordinal))
                 {
                     commit = c;
                     break;
@@ -537,7 +537,7 @@ namespace Lucene.Net.Index
             commit = null;
             foreach (IndexCommit c in DirectoryReader.ListCommits(dir))
             {
-                if (c.UserData["tag"].Equals("second"))
+                if (c.UserData["tag"].Equals("second", StringComparison.Ordinal))
                 {
                     commit = c;
                     break;
diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriterConfig.cs b/src/Lucene.Net.Tests/Index/TestIndexWriterConfig.cs
index c7ddaed..622027c 100644
--- a/src/Lucene.Net.Tests/Index/TestIndexWriterConfig.cs
+++ b/src/Lucene.Net.Tests/Index/TestIndexWriterConfig.cs
@@ -254,13 +254,13 @@ namespace Lucene.Net.Index
                     // Skip static final fields, they are only constants
                     continue;
                 }
-                else if ("indexingChain".Equals(f.Name))
+                else if ("indexingChain".Equals(f.Name, StringComparison.Ordinal))
                 {
                     // indexingChain is a package-private setting and thus is not output by
                     // toString.
                     continue;
                 }
-                if (f.Name.Equals("inUseByIndexWriter"))
+                if (f.Name.Equals("inUseByIndexWriter", StringComparison.Ordinal))
                 {
                     continue;
                 }
diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriterDelete.cs b/src/Lucene.Net.Tests/Index/TestIndexWriterDelete.cs
index 2a93606..2ba58cf 100644
--- a/src/Lucene.Net.Tests/Index/TestIndexWriterDelete.cs
+++ b/src/Lucene.Net.Tests/Index/TestIndexWriterDelete.cs
@@ -1145,9 +1145,9 @@ namespace Lucene.Net.Index
             // TODO: move this test to its own class and just @SuppressCodecs?
             // TODO: is it enough to just use newFSDirectory?
             string fieldFormat = TestUtil.GetPostingsFormat("field");
-            AssumeFalse("this test cannot run with Memory codec", fieldFormat.Equals("Memory"));
-            AssumeFalse("this test cannot run with SimpleText codec", fieldFormat.Equals("SimpleText"));
-            AssumeFalse("this test cannot run with Direct codec", fieldFormat.Equals("Direct"));
+            AssumeFalse("this test cannot run with Memory codec", fieldFormat.Equals("Memory", StringComparison.Ordinal));
+            AssumeFalse("this test cannot run with SimpleText codec", fieldFormat.Equals("SimpleText", StringComparison.Ordinal));
+            AssumeFalse("this test cannot run with Direct codec", fieldFormat.Equals("Direct", StringComparison.Ordinal));
             Random r = Random();
             Directory dir = NewDirectory();
             // note this test explicitly disables payloads
diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriterExceptions.cs b/src/Lucene.Net.Tests/Index/TestIndexWriterExceptions.cs
index 3823b57..d2373d5 100644
--- a/src/Lucene.Net.Tests/Index/TestIndexWriterExceptions.cs
+++ b/src/Lucene.Net.Tests/Index/TestIndexWriterExceptions.cs
@@ -293,7 +293,7 @@ namespace Lucene.Net.Index
 
             public void Apply(string name)
             {
-                if (OuterInstance.DoFail.Value != null && !name.Equals("startDoFlush") && r.Next(40) == 17)
+                if (OuterInstance.DoFail.Value != null && !name.Equals("startDoFlush", StringComparison.Ordinal) && r.Next(40) == 17)
                 {
                     if (VERBOSE)
                     {
@@ -453,7 +453,7 @@ namespace Lucene.Net.Index
 
             public void Apply(string name)
             {
-                if (DoFail && name.Equals("DocumentsWriterPerThread addDocument start"))
+                if (DoFail && name.Equals("DocumentsWriterPerThread addDocument start", StringComparison.Ordinal))
                 {
                     throw new Exception("intentionally failing");
                 }
@@ -478,7 +478,7 @@ namespace Lucene.Net.Index
 
             public sealed override bool IncrementToken()
             {
-                if (this.FieldName.Equals("crash") && Count++ >= 4)
+                if (this.FieldName.Equals("crash", StringComparison.Ordinal) && Count++ >= 4)
                 {
                     throw new IOException(CRASH_FAIL_MESSAGE);
                 }
@@ -572,7 +572,7 @@ namespace Lucene.Net.Index
 
             public void Apply(string name)
             {
-                if (DoFail && name.Equals("startMergeInit"))
+                if (DoFail && name.Equals("startMergeInit", StringComparison.Ordinal))
                 {
                     Failed = true;
                     throw new Exception("intentionally failing");
@@ -1340,7 +1340,7 @@ namespace Lucene.Net.Index
 
             public void Apply(string name)
             {
-                if (DoFail && name.Equals("rollback before checkpoint"))
+                if (DoFail && name.Equals("rollback before checkpoint", StringComparison.Ordinal))
                 {
                     throw new Exception("intentionally failing");
                 }
@@ -2583,7 +2583,7 @@ namespace Lucene.Net.Index
 
             public override void Message(string component, string message)
             {
-                if (MessageToFailOn.Equals(message))
+                if (MessageToFailOn.Equals(message, StringComparison.Ordinal))
                 {
                     throw new Exception("BOOM!");
                 }
diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriterMerging.cs b/src/Lucene.Net.Tests/Index/TestIndexWriterMerging.cs
index e373fea..d690690 100644
--- a/src/Lucene.Net.Tests/Index/TestIndexWriterMerging.cs
+++ b/src/Lucene.Net.Tests/Index/TestIndexWriterMerging.cs
@@ -91,7 +91,7 @@ namespace Lucene.Net.Index
                 Document temp = reader.Document(i);
                 //System.out.println("doc "+i+"="+temp.GetField("count").StringValue);
                 //compare the index doc number to the value that it should be
-                if (!temp.GetField("count").GetStringValue().Equals((i + startAt) + ""))
+                if (!temp.GetField("count").GetStringValue().Equals((i + startAt) + "", StringComparison.Ordinal))
                 {
                     fail = true;
                     Console.WriteLine("Document " + (i + startAt) + " is returning document " + temp.GetField("count").GetStringValue());
diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriterOnDiskFull.cs b/src/Lucene.Net.Tests/Index/TestIndexWriterOnDiskFull.cs
index 4625a1c..20d4cd9 100644
--- a/src/Lucene.Net.Tests/Index/TestIndexWriterOnDiskFull.cs
+++ b/src/Lucene.Net.Tests/Index/TestIndexWriterOnDiskFull.cs
@@ -192,7 +192,7 @@ namespace Lucene.Net.Index
 
             string idFormat = TestUtil.GetPostingsFormat("id");
             string contentFormat = TestUtil.GetPostingsFormat("content");
-            AssumeFalse("this test cannot run with Memory codec", idFormat.Equals("Memory") || contentFormat.Equals("Memory"));
+            AssumeFalse("this test cannot run with Memory codec", idFormat.Equals("Memory", StringComparison.Ordinal) || contentFormat.Equals("Memory", StringComparison.Ordinal));
 
             int START_COUNT = 57;
             int NUM_DIR = TEST_NIGHTLY ? 50 : 5;
diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriterOnJRECrash.cs b/src/Lucene.Net.Tests/Index/TestIndexWriterOnJRECrash.cs
index 968b24e..0212d3c 100644
--- a/src/Lucene.Net.Tests/Index/TestIndexWriterOnJRECrash.cs
+++ b/src/Lucene.Net.Tests/Index/TestIndexWriterOnJRECrash.cs
@@ -76,7 +76,7 @@
 //            else
 //            {
 //                // TODO: the non-fork code could simply enable impersonation?
-//                AssumeFalse("does not support PreFlex, see LUCENE-3992", Codec.Default.Name.Equals("Lucene3x"));
+//                AssumeFalse("does not support PreFlex, see LUCENE-3992", Codec.Default.Name.Equals("Lucene3x", StringComparison.Ordinal));
 //                // we are the fork, setup a crashing thread
 //                int crashTime = TestUtil.NextInt(Random(), 3000, 4000);
 //                ThreadClass t = new ThreadAnonymousInnerClassHelper(this, crashTime);
diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriterReader.cs b/src/Lucene.Net.Tests/Index/TestIndexWriterReader.cs
index 5d1177b..9fd3402 100644
--- a/src/Lucene.Net.Tests/Index/TestIndexWriterReader.cs
+++ b/src/Lucene.Net.Tests/Index/TestIndexWriterReader.cs
@@ -1244,7 +1244,7 @@ namespace Lucene.Net.Index
 
             public override void Message(string component, string message)
             {
-                if ("SMSW".Equals(component))
+                if ("SMSW".Equals(component, StringComparison.Ordinal))
                 {
                     DidWarm.Set(true);
                 }
@@ -1261,13 +1261,21 @@ namespace Lucene.Net.Index
         {
             // Some Codecs don't honor the ReaderTermsIndexDivisor, so skip the test if
             // they're picked.
-            AssumeFalse("PreFlex codec does not support ReaderTermsIndexDivisor!", "Lucene3x".Equals(Codec.Default.Name));
+            AssumeFalse("PreFlex codec does not support ReaderTermsIndexDivisor!", "Lucene3x".Equals(Codec.Default.Name, StringComparison.Ordinal));
 
             IndexWriterConfig conf = (IndexWriterConfig)NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random())).SetReaderTermsIndexDivisor(-1);
 
             // Don't proceed if picked Codec is in the list of illegal ones.
             string format = TestUtil.GetPostingsFormat("f");
-            AssumeFalse("Format: " + format + " does not support ReaderTermsIndexDivisor!", (format.Equals("FSTPulsing41") || format.Equals("FSTOrdPulsing41") || format.Equals("FST41") || format.Equals("FSTOrd41") || format.Equals("SimpleText") || format.Equals("Memory") || format.Equals("MockRandom") || format.Equals("Direct")));
+            AssumeFalse("Format: " + format + " does not support ReaderTermsIndexDivisor!", 
+                (format.Equals("FSTPulsing41", StringComparison.Ordinal) || 
+                format.Equals("FSTOrdPulsing41", StringComparison.Ordinal) || 
+                format.Equals("FST41", StringComparison.Ordinal) || 
+                format.Equals("FSTOrd41", StringComparison.Ordinal) || 
+                format.Equals("SimpleText", StringComparison.Ordinal) || 
+                format.Equals("Memory", StringComparison.Ordinal) || 
+                format.Equals("MockRandom", StringComparison.Ordinal) || 
+                format.Equals("Direct", StringComparison.Ordinal)));
 
             Directory dir = NewDirectory();
             IndexWriter w = new IndexWriter(dir, conf);
diff --git a/src/Lucene.Net.Tests/Index/TestLazyProxSkipping.cs b/src/Lucene.Net.Tests/Index/TestLazyProxSkipping.cs
index 2553cf1..6100ea3 100644
--- a/src/Lucene.Net.Tests/Index/TestLazyProxSkipping.cs
+++ b/src/Lucene.Net.Tests/Index/TestLazyProxSkipping.cs
@@ -157,9 +157,9 @@ namespace Lucene.Net.Index
         public virtual void TestLazySkipping()
         {
             string fieldFormat = TestUtil.GetPostingsFormat(this.Field);
-            AssumeFalse("this test cannot run with Memory postings format", fieldFormat.Equals("Memory"));
-            AssumeFalse("this test cannot run with Direct postings format", fieldFormat.Equals("Direct"));
-            AssumeFalse("this test cannot run with SimpleText postings format", fieldFormat.Equals("SimpleText"));
+            AssumeFalse("this test cannot run with Memory postings format", fieldFormat.Equals("Memory", StringComparison.Ordinal));
+            AssumeFalse("this test cannot run with Direct postings format", fieldFormat.Equals("Direct", StringComparison.Ordinal));
+            AssumeFalse("this test cannot run with SimpleText postings format", fieldFormat.Equals("SimpleText", StringComparison.Ordinal));
 
             // test whether only the minimum amount of seeks()
             // are performed
diff --git a/src/Lucene.Net.Tests/Index/TestLongPostings.cs b/src/Lucene.Net.Tests/Index/TestLongPostings.cs
index e7247c5..b180d72 100644
--- a/src/Lucene.Net.Tests/Index/TestLongPostings.cs
+++ b/src/Lucene.Net.Tests/Index/TestLongPostings.cs
@@ -3,6 +3,7 @@ using Lucene.Net.Documents;
 using Lucene.Net.Randomized.Generators;
 using Lucene.Net.Support;
 using NUnit.Framework;
+using System;
 using System.Diagnostics;
 using System.IO;
 using Console = Lucene.Net.Support.SystemConsole;
@@ -53,7 +54,7 @@ namespace Lucene.Net.Index
             while (true)
             {
                 string s = TestUtil.RandomRealisticUnicodeString(Random());
-                if (other != null && s.Equals(other))
+                if (other != null && s.Equals(other, StringComparison.Ordinal))
                 {
                     continue;
                 }
@@ -71,7 +72,7 @@ namespace Lucene.Net.Index
                     while (ts.IncrementToken())
                     {
                         termAtt.FillBytesRef();
-                        if (count == 0 && !termBytes.Utf8ToString().Equals(s))
+                        if (count == 0 && !termBytes.Utf8ToString().Equals(s, StringComparison.Ordinal))
                         {
                             // The value was changed during analysis.  Keep iterating so the
                             // tokenStream is exhausted.
diff --git a/src/Lucene.Net.Tests/Index/TestNoMergePolicy.cs b/src/Lucene.Net.Tests/Index/TestNoMergePolicy.cs
index 98b9b4f..2c0a8c8 100644
--- a/src/Lucene.Net.Tests/Index/TestNoMergePolicy.cs
+++ b/src/Lucene.Net.Tests/Index/TestNoMergePolicy.cs
@@ -1,5 +1,6 @@
 using Lucene.Net.Support;
 using NUnit.Framework;
+using System;
 using System.Reflection;
 
 namespace Lucene.Net.Index
@@ -69,7 +70,7 @@ namespace Lucene.Net.Index
                 // context, including ones from Object. So just filter out Object. If in
                 // the future MergePolicy will extend a different class than Object, this
                 // will need to change.
-                if (m.Name.Equals("Clone"))
+                if (m.Name.Equals("Clone", StringComparison.Ordinal))
                 {
                     continue;
                 }
diff --git a/src/Lucene.Net.Tests/Index/TestNorms.cs b/src/Lucene.Net.Tests/Index/TestNorms.cs
index c0469b6..738edbc 100644
--- a/src/Lucene.Net.Tests/Index/TestNorms.cs
+++ b/src/Lucene.Net.Tests/Index/TestNorms.cs
@@ -215,7 +215,7 @@ namespace Lucene.Net.Index
 
             public override Similarity Get(string field)
             {
-                if (OuterInstance.ByteTestField.Equals(field))
+                if (OuterInstance.ByteTestField.Equals(field, StringComparison.Ordinal))
                 {
                     return new ByteEncodingBoostSimilarity();
                 }
diff --git a/src/Lucene.Net.Tests/Index/TestPerSegmentDeletes.cs b/src/Lucene.Net.Tests/Index/TestPerSegmentDeletes.cs
index 3c3e1a5..5190be5 100644
--- a/src/Lucene.Net.Tests/Index/TestPerSegmentDeletes.cs
+++ b/src/Lucene.Net.Tests/Index/TestPerSegmentDeletes.cs
@@ -223,7 +223,7 @@ namespace Lucene.Net.Index
         {
             foreach (SegmentCommitInfo si in infos.Segments)
             {
-                if (si.Info.Name.Equals(info.Info.Name))
+                if (si.Info.Name.Equals(info.Info.Name, StringComparison.Ordinal))
                 {
                     return true;
                 }
diff --git a/src/Lucene.Net.Tests/Index/TestPersistentSnapshotDeletionPolicy.cs b/src/Lucene.Net.Tests/Index/TestPersistentSnapshotDeletionPolicy.cs
index 09587f3..f77f3cc 100644
--- a/src/Lucene.Net.Tests/Index/TestPersistentSnapshotDeletionPolicy.cs
+++ b/src/Lucene.Net.Tests/Index/TestPersistentSnapshotDeletionPolicy.cs
@@ -138,7 +138,7 @@ namespace Lucene.Net.Index
             }
             catch (IOException ioe)
             {
-                if (ioe.Message.Equals("now fail on purpose"))
+                if (ioe.Message.Equals("now fail on purpose", StringComparison.Ordinal))
                 {
                     // ok
                 }
diff --git a/src/Lucene.Net.Tests/Index/TestPostingsOffsets.cs b/src/Lucene.Net.Tests/Index/TestPostingsOffsets.cs
index 4fc5676..f5ec413 100644
--- a/src/Lucene.Net.Tests/Index/TestPostingsOffsets.cs
+++ b/src/Lucene.Net.Tests/Index/TestPostingsOffsets.cs
@@ -181,7 +181,7 @@ namespace Lucene.Net.Index
                         int end = dp.EndOffset;
                         Debug.Assert(end >= 0 && end >= start);
                         // check that the offsets correspond to the term in the src text
-                        Assert.IsTrue(storedNumbers.Substring(start, end - start).Equals(term));
+                        Assert.IsTrue(storedNumbers.Substring(start, end - start).Equals(term, StringComparison.Ordinal));
                         if (withPayloads)
                         {
                             // check that we have a payload and it starts with "pos"
@@ -212,7 +212,7 @@ namespace Lucene.Net.Index
                     int end = dp.EndOffset;
                     Debug.Assert(end >= 0 && end >= start);
                     // check that the offsets correspond to the term in the src text
-                    Assert.IsTrue(storedNumbers.Substring(start, end - start).Equals("hundred"));
+                    Assert.IsTrue(storedNumbers.Substring(start, end - start).Equals("hundred", StringComparison.Ordinal));
                     if (withPayloads)
                     {
                         // check that we have a payload and it starts with "pos"
diff --git a/src/Lucene.Net.Tests/Index/TestRollingUpdates.cs b/src/Lucene.Net.Tests/Index/TestRollingUpdates.cs
index 7f3a360..f7b5a03 100644
--- a/src/Lucene.Net.Tests/Index/TestRollingUpdates.cs
+++ b/src/Lucene.Net.Tests/Index/TestRollingUpdates.cs
@@ -50,7 +50,7 @@ namespace Lucene.Net.Index
             LineFileDocs docs = new LineFileDocs(random, DefaultCodecSupportsDocValues());
 
             //provider.register(new MemoryCodec());
-            if ((!"Lucene3x".Equals(Codec.Default.Name)) && Random().NextBoolean())
+            if ((!"Lucene3x".Equals(Codec.Default.Name, StringComparison.Ordinal)) && Random().NextBoolean())
             {
                 Codec.Default =
                     TestUtil.AlwaysPostingsFormat(new MemoryPostingsFormat(Random().nextBoolean(), random.NextFloat()));
diff --git a/src/Lucene.Net.Tests/Index/TestSegmentReader.cs b/src/Lucene.Net.Tests/Index/TestSegmentReader.cs
index 95da6b6..119e8bb 100644
--- a/src/Lucene.Net.Tests/Index/TestSegmentReader.cs
+++ b/src/Lucene.Net.Tests/Index/TestSegmentReader.cs
@@ -118,13 +118,13 @@ namespace Lucene.Net.Index
             Assert.IsTrue(allFieldNames.Count == DocHelper.All.Count);
             foreach (string s in allFieldNames)
             {
-                Assert.IsTrue(DocHelper.NameValues.ContainsKey(s) == true || s.Equals(""));
+                Assert.IsTrue(DocHelper.NameValues.ContainsKey(s) == true || s.Equals("", StringComparison.Ordinal));
             }
 
             Assert.IsTrue(indexedFieldNames.Count == DocHelper.Indexed.Count);
             foreach (string s in indexedFieldNames)
             {
-                Assert.IsTrue(DocHelper.Indexed.ContainsKey(s) == true || s.Equals(""));
+                Assert.IsTrue(DocHelper.Indexed.ContainsKey(s) == true || s.Equals("", StringComparison.Ordinal));
             }
 
             Assert.IsTrue(notIndexedFieldNames.Count == DocHelper.Unindexed.Count);
diff --git a/src/Lucene.Net.Tests/Index/TestTermsEnum2.cs b/src/Lucene.Net.Tests/Index/TestTermsEnum2.cs
index 4e9034c..30b112f 100644
--- a/src/Lucene.Net.Tests/Index/TestTermsEnum2.cs
+++ b/src/Lucene.Net.Tests/Index/TestTermsEnum2.cs
@@ -7,6 +7,7 @@ namespace Lucene.Net.Index
     using Lucene.Net.Support;
     using Lucene.Net.Util.Automaton;
     using NUnit.Framework;
+    using System;
     using AutomatonQuery = Lucene.Net.Search.AutomatonQuery;
     using BytesRef = Lucene.Net.Util.BytesRef;
     using CheckHits = Lucene.Net.Search.CheckHits;
@@ -55,7 +56,7 @@ namespace Lucene.Net.Index
             base.SetUp();
             // we generate aweful regexps: good for testing.
             // but for preflex codec, the test can be very slow, so use less iterations.
-            NumIterations = Codec.Default.Name.Equals("Lucene3x") ? 10 * RANDOM_MULTIPLIER : AtLeast(50);
+            NumIterations = Codec.Default.Name.Equals("Lucene3x", StringComparison.Ordinal) ? 10 * RANDOM_MULTIPLIER : AtLeast(50);
             Dir = NewDirectory();
             RandomIndexWriter writer = new RandomIndexWriter(Random(), Dir, (IndexWriterConfig)NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random(), MockTokenizer.KEYWORD, false)).SetMaxBufferedDocs(TestUtil.NextInt(Random(), 50, 1000)));
             Document doc = new Document();
diff --git a/src/Lucene.Net.Tests/Search/Payloads/PayloadHelper.cs b/src/Lucene.Net.Tests/Search/Payloads/PayloadHelper.cs
index 406c402..a7eb7b2 100644
--- a/src/Lucene.Net.Tests/Search/Payloads/PayloadHelper.cs
+++ b/src/Lucene.Net.Tests/Search/Payloads/PayloadHelper.cs
@@ -91,11 +91,11 @@ namespace Lucene.Net.Search.Payloads
             {
                 if (m_input.IncrementToken())
                 {
-                    if (FieldName.Equals(FIELD))
+                    if (FieldName.Equals(FIELD, StringComparison.Ordinal))
                     {
                         PayloadAtt.Payload = new BytesRef(OuterInstance.PayloadField);
                     }
-                    else if (FieldName.Equals(MULTI_FIELD))
+                    else if (FieldName.Equals(MULTI_FIELD, StringComparison.Ordinal))
                     {
                         if (NumSeen % 2 == 0)
                         {
diff --git a/src/Lucene.Net.Tests/Search/Payloads/TestPayloadTermQuery.cs b/src/Lucene.Net.Tests/Search/Payloads/TestPayloadTermQuery.cs
index 4291df3..4809167 100644
--- a/src/Lucene.Net.Tests/Search/Payloads/TestPayloadTermQuery.cs
+++ b/src/Lucene.Net.Tests/Search/Payloads/TestPayloadTermQuery.cs
@@ -23,6 +23,7 @@ namespace Lucene.Net.Search.Payloads
 
     using Lucene.Net.Analysis;
     using NUnit.Framework;
+    using System;
     using System.IO;
     using BytesRef = Lucene.Net.Util.BytesRef;
     using DefaultSimilarity = Lucene.Net.Search.Similarities.DefaultSimilarity;
@@ -85,11 +86,11 @@ namespace Lucene.Net.Search.Payloads
                 bool hasNext = m_input.IncrementToken();
                 if (hasNext)
                 {
-                    if (FieldName.Equals("field"))
+                    if (FieldName.Equals("field", StringComparison.Ordinal))
                     {
                         PayloadAtt.Payload = new BytesRef(PayloadField);
                     }
-                    else if (FieldName.Equals("multiField"))
+                    else if (FieldName.Equals("multiField", StringComparison.Ordinal))
                     {
                         if (NumSeen % 2 == 0)
                         {
diff --git a/src/Lucene.Net.Tests/Search/Similarities/TestSimilarityBase.cs b/src/Lucene.Net.Tests/Search/Similarities/TestSimilarityBase.cs
index 1fd532c..b2d596b 100644
--- a/src/Lucene.Net.Tests/Search/Similarities/TestSimilarityBase.cs
+++ b/src/Lucene.Net.Tests/Search/Similarities/TestSimilarityBase.cs
@@ -610,7 +610,7 @@ namespace Lucene.Net.Search.Similarities
         [Test]
         public virtual void TestHeartRanking()
         {
-            AssumeFalse("PreFlex codec does not support the stats necessary for this test!", "Lucene3x".Equals(Codec.Default.Name));
+            AssumeFalse("PreFlex codec does not support the stats necessary for this test!", "Lucene3x".Equals(Codec.Default.Name, StringComparison.Ordinal));
 
             Query q = new TermQuery(new Term(FIELD_BODY, "heart"));
 
diff --git a/src/Lucene.Net.Tests/Search/TestDisjunctionMaxQuery.cs b/src/Lucene.Net.Tests/Search/TestDisjunctionMaxQuery.cs
index e43d2e8..77722c7 100644
--- a/src/Lucene.Net.Tests/Search/TestDisjunctionMaxQuery.cs
+++ b/src/Lucene.Net.Tests/Search/TestDisjunctionMaxQuery.cs
@@ -433,8 +433,8 @@ namespace Lucene.Net.Search
                 string doc2 = s.Doc(h[2].Doc).Get("id");
                 string doc3 = s.Doc(h[3].Doc).Get("id");
 
-                Assert.IsTrue(doc0.Equals("d2") || doc0.Equals("d4"), "doc0 should be d2 or d4: " + doc0);
-                Assert.IsTrue(doc1.Equals("d2") || doc1.Equals("d4"), "doc1 should be d2 or d4: " + doc0);
+                Assert.IsTrue(doc0.Equals("d2", StringComparison.Ordinal) || doc0.Equals("d4", StringComparison.Ordinal), "doc0 should be d2 or d4: " + doc0);
+                Assert.IsTrue(doc1.Equals("d2", StringComparison.Ordinal) || doc1.Equals("d4", StringComparison.Ordinal), "doc1 should be d2 or d4: " + doc0);
                 Assert.AreEqual(score0, score1, SCORE_COMP_THRESH, "score0 and score1 should match");
                 Assert.AreEqual("d3", doc2, "wrong third");
                 Assert.IsTrue(score1 > score2, "d3 does not have worse score then d2 and d4: " + score1 + " >? " + score2);
diff --git a/src/Lucene.Net.Tests/Search/TestDocValuesScoring.cs b/src/Lucene.Net.Tests/Search/TestDocValuesScoring.cs
index ebd3e72..99c031e 100644
--- a/src/Lucene.Net.Tests/Search/TestDocValuesScoring.cs
+++ b/src/Lucene.Net.Tests/Search/TestDocValuesScoring.cs
@@ -35,6 +35,7 @@ namespace Lucene.Net.Search
     using RandomIndexWriter = Lucene.Net.Index.RandomIndexWriter;
     using Similarity = Lucene.Net.Search.Similarities.Similarity;
     using Term = Lucene.Net.Index.Term;
+    using System;
 
     /// <summary>
     /// Tests the use of indexdocvalues in scoring.
@@ -140,7 +141,7 @@ namespace Lucene.Net.Search
 
             public override Similarity Get(string field)
             {
-                return "foo".Equals(field) ? fooSim : @base;
+                return "foo".Equals(field, StringComparison.Ordinal) ? fooSim : @base;
             }
 
             public override float Coord(int overlap, int maxOverlap)
diff --git a/src/Lucene.Net.Tests/Search/TestFieldCache.cs b/src/Lucene.Net.Tests/Search/TestFieldCache.cs
index e36c6a6..199fb41 100644
--- a/src/Lucene.Net.Tests/Search/TestFieldCache.cs
+++ b/src/Lucene.Net.Tests/Search/TestFieldCache.cs
@@ -292,7 +292,7 @@ namespace Lucene.Net.Search
                     term = br;
                 }
                 string s = term == null ? null : term.Utf8ToString();
-                Assert.IsTrue(UnicodeStrings[i] == null || UnicodeStrings[i].Equals(s), "for doc " + i + ": " + s + " does not equal: " + UnicodeStrings[i]);
+                Assert.IsTrue(UnicodeStrings[i] == null || UnicodeStrings[i].Equals(s, StringComparison.Ordinal), "for doc " + i + ": " + s + " does not equal: " + UnicodeStrings[i]);
             }
 
             int nTerms = termsIndex.ValueCount;
@@ -344,7 +344,7 @@ namespace Lucene.Net.Search
                     term = br;
                 }
                 string s = term == null ? null : term.Utf8ToString();
-                Assert.IsTrue(UnicodeStrings[i] == null || UnicodeStrings[i].Equals(s), "for doc " + i + ": " + s + " does not equal: " + UnicodeStrings[i]);
+                Assert.IsTrue(UnicodeStrings[i] == null || UnicodeStrings[i].Equals(s, StringComparison.Ordinal), "for doc " + i + ": " + s + " does not equal: " + UnicodeStrings[i]);
             }
 
             // test bad field
diff --git a/src/Lucene.Net.Tests/Search/TestMultiThreadTermVectors.cs b/src/Lucene.Net.Tests/Search/TestMultiThreadTermVectors.cs
index e07a5f6..c34f38c 100644
--- a/src/Lucene.Net.Tests/Search/TestMultiThreadTermVectors.cs
+++ b/src/Lucene.Net.Tests/Search/TestMultiThreadTermVectors.cs
@@ -237,7 +237,7 @@ namespace Lucene.Net.Search
             {
                 temp.Append(vector.Term.Utf8ToString());
             }
-            if (!English.IntToEnglish(num).Trim().Equals(temp.ToString().Trim()))
+            if (!English.IntToEnglish(num).Trim().Equals(temp.ToString().Trim(), StringComparison.Ordinal))
             {
                 Console.WriteLine("wrong term result");
             }
diff --git a/src/Lucene.Net.Tests/Search/TestPositionIncrement.cs b/src/Lucene.Net.Tests/Search/TestPositionIncrement.cs
index e96c125..56f370a 100644
--- a/src/Lucene.Net.Tests/Search/TestPositionIncrement.cs
+++ b/src/Lucene.Net.Tests/Search/TestPositionIncrement.cs
@@ -312,7 +312,7 @@ namespace Lucene.Net.Search
             {
                 string s = Encoding.UTF8.GetString(bytes);
                 //System.out.println(s);
-                sawZero |= s.Equals("pos: 0");
+                sawZero |= s.Equals("pos: 0", StringComparison.Ordinal);
             }
             Assert.AreEqual(5, count);
             Assert.IsTrue(sawZero);
diff --git a/src/Lucene.Net.Tests/Search/TestPrefixRandom.cs b/src/Lucene.Net.Tests/Search/TestPrefixRandom.cs
index eb579a6..8501078 100644
--- a/src/Lucene.Net.Tests/Search/TestPrefixRandom.cs
+++ b/src/Lucene.Net.Tests/Search/TestPrefixRandom.cs
@@ -1,6 +1,7 @@
 using Lucene.Net.Documents;
 using Lucene.Net.Support;
 using NUnit.Framework;
+using System;
 
 namespace Lucene.Net.Search
 {
@@ -65,7 +66,7 @@ namespace Lucene.Net.Search
             // we generate aweful prefixes: good for testing.
             // but for preflex codec, the test can be very slow, so use less iterations.
             string codec = Codec.Default.Name;
-            int num = codec.Equals("Lucene3x") ? 200 * RANDOM_MULTIPLIER : AtLeast(1000);
+            int num = codec.Equals("Lucene3x", StringComparison.Ordinal) ? 200 * RANDOM_MULTIPLIER : AtLeast(1000);
             for (int i = 0; i < num; i++)
             {
                 field.SetStringValue(TestUtil.RandomUnicodeString(Random(), 10));
diff --git a/src/Lucene.Net.Tests/Search/TestRegexpQuery.cs b/src/Lucene.Net.Tests/Search/TestRegexpQuery.cs
index fc8afbc..be262e0 100644
--- a/src/Lucene.Net.Tests/Search/TestRegexpQuery.cs
+++ b/src/Lucene.Net.Tests/Search/TestRegexpQuery.cs
@@ -2,6 +2,7 @@ using Lucene.Net.Util.Automaton;
 using Lucene.Net.Documents;
 using Lucene.Net.Support;
 using NUnit.Framework;
+using System;
 
 namespace Lucene.Net.Search
 {
@@ -136,7 +137,7 @@ namespace Lucene.Net.Search
 
             public Automaton GetAutomaton(string name)
             {
-                if (name.Equals("quickBrown"))
+                if (name.Equals("quickBrown", StringComparison.Ordinal))
                 {
                     return quickBrownAutomaton;
                 }
diff --git a/src/Lucene.Net.Tests/Search/TestRegexpRandom2.cs b/src/Lucene.Net.Tests/Search/TestRegexpRandom2.cs
index 3ccbbb1..afb27d9 100644
--- a/src/Lucene.Net.Tests/Search/TestRegexpRandom2.cs
+++ b/src/Lucene.Net.Tests/Search/TestRegexpRandom2.cs
@@ -167,7 +167,7 @@ namespace Lucene.Net.Search
         {
             // we generate aweful regexps: good for testing.
             // but for preflex codec, the test can be very slow, so use less iterations.
-            int num = Codec.Default.Name.Equals("Lucene3x") ? 100 * RANDOM_MULTIPLIER : AtLeast(1000);
+            int num = Codec.Default.Name.Equals("Lucene3x", StringComparison.Ordinal) ? 100 * RANDOM_MULTIPLIER : AtLeast(1000);
             for (int i = 0; i < num; i++)
             {
                 string reg = AutomatonTestUtil.RandomRegexp(Random());
diff --git a/src/Lucene.Net.Tests/Search/TestSearchAfter.cs b/src/Lucene.Net.Tests/Search/TestSearchAfter.cs
index 1f32b6c..3221aa2 100644
--- a/src/Lucene.Net.Tests/Search/TestSearchAfter.cs
+++ b/src/Lucene.Net.Tests/Search/TestSearchAfter.cs
@@ -62,7 +62,7 @@ namespace Lucene.Net.Search
         private IndexSearcher Searcher;
 
         // LUCENENET specific - need to execute this AFTER the base setup, or it won't be right
-        //internal bool supportsDocValues = Codec.Default.Name.Equals("Lucene3x") == false;
+        //internal bool supportsDocValues = Codec.Default.Name.Equals("Lucene3x", StringComparison.Ordinal) == false;
         private int Iter;
         private IList<SortField> AllSortFields;
 
@@ -73,7 +73,7 @@ namespace Lucene.Net.Search
 
             // LUCENENET specific: Moved this logic here to ensure that it is executed
             // after the class is setup - a field is way to early to execute this.
-            bool supportsDocValues = Codec.Default.Name.Equals("Lucene3x") == false;
+            bool supportsDocValues = Codec.Default.Name.Equals("Lucene3x", StringComparison.Ordinal) == false;
 
             AllSortFields = new List<SortField>(Arrays.AsList(new SortField[] {
 #pragma warning disable 612,618
diff --git a/src/Lucene.Net.Tests/Search/TestSimilarityProvider.cs b/src/Lucene.Net.Tests/Search/TestSimilarityProvider.cs
index 67d95d6..f9db0e8 100644
--- a/src/Lucene.Net.Tests/Search/TestSimilarityProvider.cs
+++ b/src/Lucene.Net.Tests/Search/TestSimilarityProvider.cs
@@ -1,6 +1,7 @@
 using Lucene.Net.Documents;
 using Lucene.Net.Support;
 using NUnit.Framework;
+using System;
 
 namespace Lucene.Net.Search
 {
@@ -118,7 +119,7 @@ namespace Lucene.Net.Search
 
             public override Similarity Get(string field)
             {
-                if (field.Equals("foo"))
+                if (field.Equals("foo", StringComparison.Ordinal))
                 {
                     return Sim1;
                 }
diff --git a/src/Lucene.Net.Tests/Support/IO/TestStreamTokenizer.cs b/src/Lucene.Net.Tests/Support/IO/TestStreamTokenizer.cs
index 5e50163..a3e1454 100644
--- a/src/Lucene.Net.Tests/Support/IO/TestStreamTokenizer.cs
+++ b/src/Lucene.Net.Tests/Support/IO/TestStreamTokenizer.cs
@@ -106,7 +106,7 @@ namespace Lucene.Net.Support.IO
                    .NextToken() == StreamTokenizer.TT_NUMBER
                    && st.NumberValue == 8.0);
             assertTrue("the next token returned should be the quote character",
-                   st.NextToken() == 39 && st.StringValue.equals("h"));
+                   st.NextToken() == 39 && st.StringValue.Equals("h", StringComparison.Ordinal));
         }
 
         /**
@@ -119,7 +119,7 @@ namespace Lucene.Net.Support.IO
             // by default end of line characters are not significant
             assertTrue("nextToken did not return d",
                    st.NextToken() == StreamTokenizer.TT_WORD
-                   && st.StringValue.equals("d"));
+                   && st.StringValue.Equals("d", StringComparison.Ordinal));
             assertTrue("nextToken did not return 8",
                    st.NextToken() == StreamTokenizer.TT_NUMBER
                    && st.NumberValue == 8.0);
@@ -130,7 +130,7 @@ namespace Lucene.Net.Support.IO
             // end of line characters are significant
             assertTrue("nextToken did not return d",
                    st.NextToken() == StreamTokenizer.TT_WORD
-                   && st.StringValue.equals("d"));
+                   && st.StringValue.Equals("d", StringComparison.Ordinal));
             assertTrue("nextToken is the end of line",
                    st.NextToken() == StreamTokenizer.TT_EOL);
         }
@@ -199,7 +199,7 @@ namespace Lucene.Net.Support.IO
             st.NextToken();
             assertTrue("Wrong Token type6: " + st.TokenType, st.TokenType == '\'');
             assertTrue("Wrong Token type7: " + st.TokenType, st.StringValue
-                   .equals("Hello World"));
+                   .Equals("Hello World", StringComparison.Ordinal));
             st.NextToken();
             assertTrue("Wrong Token type8: " + st.TokenType, st.TokenType == -1);
 
@@ -212,7 +212,7 @@ namespace Lucene.Net.Support.IO
 
                 assertTrue("Wrong token 1,1",
                        s.NextToken() == StreamTokenizer.TT_WORD
-                       && s.StringValue.equals("hello"));
+                       && s.StringValue.Equals("hello", StringComparison.Ordinal));
 
                 assertTrue("Wrong token 1,2", s.NextToken() == '\n');
 
@@ -445,8 +445,8 @@ namespace Lucene.Net.Support.IO
             setTest("ABC Hello World");
             st.NextToken();
             assertTrue("toString failed." + st.toString(),
-                       st.toString().equals(
-                                "Token[ABC], line 1"));
+                       st.toString().Equals(
+                                "Token[ABC], line 1", StringComparison.Ordinal));
 
             // Regression test for HARMONY-4070
             byte[] data = new byte[] { (byte)'-' };
@@ -498,10 +498,10 @@ namespace Lucene.Net.Support.IO
             st.WordChars('\'', '\'');
             st.NextToken();
             assertTrue("WordChars failed for whitespace: " + st.StringValue, st.StringValue
-                       .equals("Hello World"));
+                       .Equals("Hello World", StringComparison.Ordinal));
             st.NextToken();
             assertTrue("WordChars failed for quote1: " + st.StringValue, st.StringValue
-                       .equals("\'Hello World\' Hello\' World"));
+                       .Equals("\'Hello World\' Hello\' World", StringComparison.Ordinal));
         }
 
         private void setTest(string s)
diff --git a/src/Lucene.Net.Tests/Support/TestDictionaryExtensions.cs b/src/Lucene.Net.Tests/Support/TestDictionaryExtensions.cs
index 7a8a258..839497d 100644
--- a/src/Lucene.Net.Tests/Support/TestDictionaryExtensions.cs
+++ b/src/Lucene.Net.Tests/Support/TestDictionaryExtensions.cs
@@ -153,15 +153,15 @@ namespace Lucene.Net.Tests.Support
             Dictionary<string, string> prop = null;
             prop = new Dictionary<string, string>();
             prop.Load(new MemoryStream("=".getBytes()));
-            assertTrue("Failed to add empty key", prop.get("").equals(""));
+            assertTrue("Failed to add empty key", prop.get("").Equals("", StringComparison.Ordinal));
 
             prop = new Dictionary<string, string>();
             prop.Load(new MemoryStream("=\r\n".getBytes()));
-            assertTrue("Failed to add empty key", prop.get("").equals(""));
+            assertTrue("Failed to add empty key", prop.get("").Equals("", StringComparison.Ordinal));
 
             prop = new Dictionary<string, string>();
             prop.Load(new MemoryStream("=\n\r".getBytes()));
-            assertTrue("Failed to add empty key", prop.get("").equals(""));
+            assertTrue("Failed to add empty key", prop.get("").Equals("", StringComparison.Ordinal));
         }
 
         /**
@@ -216,7 +216,7 @@ namespace Lucene.Net.Tests.Support
                 {
                     nextKey = e.Current;
                     assertTrue("Stored property list not equal to original", myProps2
-                        .getProperty(nextKey).equals(myProps.getProperty(nextKey)));
+                        .getProperty(nextKey).Equals(myProps.getProperty(nextKey), StringComparison.Ordinal));
                 }
             }
         }
diff --git a/src/Lucene.Net.Tests/Support/TestEquatableList.cs b/src/Lucene.Net.Tests/Support/TestEquatableList.cs
index a4d2b97..30079d0 100644
--- a/src/Lucene.Net.Tests/Support/TestEquatableList.cs
+++ b/src/Lucene.Net.Tests/Support/TestEquatableList.cs
@@ -108,7 +108,7 @@ namespace Lucene.Net.Support
             var val1 = "\uA0A2\uA0A2";
             var val2 = string.Empty;
 
-            Assert.IsFalse(val1.Equals(val2));
+            Assert.IsFalse(val1.Equals(val2, StringComparison.Ordinal));
 
             var hash1 = val1.GetHashCode();
             var hash2 = val2.GetHashCode();
diff --git a/src/Lucene.Net.Tests/Support/TestEquatableSet.cs b/src/Lucene.Net.Tests/Support/TestEquatableSet.cs
index 2ac0798..5157466 100644
--- a/src/Lucene.Net.Tests/Support/TestEquatableSet.cs
+++ b/src/Lucene.Net.Tests/Support/TestEquatableSet.cs
@@ -108,7 +108,7 @@ namespace Lucene.Net.Support
             var val1 = "\uA0A2\uA0A2";
             var val2 = string.Empty;
 
-            Assert.IsFalse(val1.Equals(val2));
+            Assert.IsFalse(val1.Equals(val2, StringComparison.Ordinal));
 
             var hash1 = val1.GetHashCode();
             var hash2 = val2.GetHashCode();
diff --git a/src/Lucene.Net.Tests/Support/TestStringTokenizer.cs b/src/Lucene.Net.Tests/Support/TestStringTokenizer.cs
index 5de8588..e04d066 100644
--- a/src/Lucene.Net.Tests/Support/TestStringTokenizer.cs
+++ b/src/Lucene.Net.Tests/Support/TestStringTokenizer.cs
@@ -48,7 +48,7 @@ namespace Lucene.Net.Support
             // java.lang.String)
             StringTokenizer st = new StringTokenizer("This:is:a:test:String", ":");
             assertTrue("Created incorrect tokenizer", st.CountTokens() == 5
-                    && (st.NextToken().equals("This")));
+                    && (st.NextToken().Equals("This", StringComparison.Ordinal)));
         }
 
         /**
@@ -64,7 +64,7 @@ namespace Lucene.Net.Support
                     true);
             st.NextToken();
             assertTrue("Created incorrect tokenizer", st.CountTokens() == 8
-                    && (st.NextToken().equals(":")));
+                    && (st.NextToken().Equals(":", StringComparison.Ordinal)));
         }
 
         /**
diff --git a/src/Lucene.Net.Tests/TestExternalCodecs.cs b/src/Lucene.Net.Tests/TestExternalCodecs.cs
index 1b72ea3..ffcef56 100644
--- a/src/Lucene.Net.Tests/TestExternalCodecs.cs
+++ b/src/Lucene.Net.Tests/TestExternalCodecs.cs
@@ -52,11 +52,11 @@ namespace Lucene.Net
 
             public override PostingsFormat GetPostingsFormatForField(string field)
             {
-                if (field.Equals("field2") || field.Equals("id"))
+                if (field.Equals("field2", StringComparison.Ordinal) || field.Equals("id", StringComparison.Ordinal))
                 {
                     return PulsingFormat;
                 }
-                else if (field.Equals("field1"))
+                else if (field.Equals("field1", StringComparison.Ordinal))
                 {
                     return DefaultFormat;
                 }
diff --git a/src/Lucene.Net.Tests/Util/Automaton/TestLevenshteinAutomata.cs b/src/Lucene.Net.Tests/Util/Automaton/TestLevenshteinAutomata.cs
index f23d2a2..1365170 100644
--- a/src/Lucene.Net.Tests/Util/Automaton/TestLevenshteinAutomata.cs
+++ b/src/Lucene.Net.Tests/Util/Automaton/TestLevenshteinAutomata.cs
@@ -238,7 +238,7 @@ namespace Lucene.Net.Util.Automaton
                 sb.Append(s[i]);
                 sb.Append(s.Substring(i + 2, s.Length - (i + 2)));
                 string st = sb.ToString();
-                if (!st.Equals(s))
+                if (!st.Equals(s, StringComparison.Ordinal))
                 {
                     list.Add(BasicAutomata.MakeString(st));
                 }
diff --git a/src/Lucene.Net.Tests/Util/Fst/TestFSTs.cs b/src/Lucene.Net.Tests/Util/Fst/TestFSTs.cs
index 842297e..8b58b93 100644
--- a/src/Lucene.Net.Tests/Util/Fst/TestFSTs.cs
+++ b/src/Lucene.Net.Tests/Util/Fst/TestFSTs.cs
@@ -721,41 +721,41 @@ namespace Lucene.Net.Util.Fst
             int idx = 0;
             while (idx < args.Length)
             {
-                if (args[idx].Equals("-prune"))
+                if (args[idx].Equals("-prune", StringComparison.Ordinal))
                 {
                     prune = Convert.ToInt32(args[1 + idx]);
                     idx++;
                 }
-                else if (args[idx].Equals("-limit"))
+                else if (args[idx].Equals("-limit", StringComparison.Ordinal))
                 {
                     limit = Convert.ToInt32(args[1 + idx]);
                     idx++;
                 }
-                else if (args[idx].Equals("-utf8"))
+                else if (args[idx].Equals("-utf8", StringComparison.Ordinal))
                 {
                     inputMode = 0;
                 }
-                else if (args[idx].Equals("-utf32"))
+                else if (args[idx].Equals("-utf32", StringComparison.Ordinal))
                 {
                     inputMode = 1;
                 }
-                else if (args[idx].Equals("-docFreq"))
+                else if (args[idx].Equals("-docFreq", StringComparison.Ordinal))
                 {
                     storeDocFreqs = true;
                 }
-                else if (args[idx].Equals("-noArcArrays"))
+                else if (args[idx].Equals("-noArcArrays", StringComparison.Ordinal))
                 {
                     noArcArrays = true;
                 }
-                else if (args[idx].Equals("-ords"))
+                else if (args[idx].Equals("-ords", StringComparison.Ordinal))
                 {
                     storeOrds = true;
                 }
-                else if (args[idx].Equals("-noverify"))
+                else if (args[idx].Equals("-noverify", StringComparison.Ordinal))
                 {
                     verify = false;
                 }
-                else if (args[idx].Equals("-pack"))
+                else if (args[idx].Equals("-pack", StringComparison.Ordinal))
                 {
                     doPack = true;
                 }
diff --git a/src/Lucene.Net.Tests/Util/TestFilterIterator.cs b/src/Lucene.Net.Tests/Util/TestFilterIterator.cs
index 19a6f1e..7cd8728 100644
--- a/src/Lucene.Net.Tests/Util/TestFilterIterator.cs
+++ b/src/Lucene.Net.Tests/Util/TestFilterIterator.cs
@@ -77,7 +77,7 @@ namespace Lucene.Net.Util
 
             protected override bool PredicateFunction(string s)
             {
-                return "a".Equals(s);
+                return "a".Equals(s, StringComparison.Ordinal);
             }
         }
 
@@ -103,7 +103,7 @@ namespace Lucene.Net.Util
 
             protected override bool PredicateFunction(string s)
             {
-                return "a".Equals(s);
+                return "a".Equals(s, StringComparison.Ordinal);
             }
         }
 
@@ -128,7 +128,7 @@ namespace Lucene.Net.Util
 
             protected override bool PredicateFunction(string s)
             {
-                return "b".Equals(s);
+                return "b".Equals(s, StringComparison.Ordinal);
             }
         }
 
@@ -154,7 +154,7 @@ namespace Lucene.Net.Util
 
             protected override bool PredicateFunction(string s)
             {
-                return "b".Equals(s);
+                return "b".Equals(s, StringComparison.Ordinal);
             }
         }
 
diff --git a/src/Lucene.Net.Tests/Util/TestQueryBuilder.cs b/src/Lucene.Net.Tests/Util/TestQueryBuilder.cs
index e61526b..ddfaefc 100644
--- a/src/Lucene.Net.Tests/Util/TestQueryBuilder.cs
+++ b/src/Lucene.Net.Tests/Util/TestQueryBuilder.cs
@@ -1,6 +1,7 @@
 using Lucene.Net.Analysis;
 using Lucene.Net.Analysis.TokenAttributes;
 using NUnit.Framework;
+using System;
 using System.IO;
 
 namespace Lucene.Net.Util
@@ -173,7 +174,7 @@ namespace Lucene.Net.Util
 
                 if (m_input.IncrementToken())
                 {
-                    AddSynonym = TermAtt.ToString().Equals("dogs");
+                    AddSynonym = TermAtt.ToString().Equals("dogs", StringComparison.Ordinal);
                     return true;
                 }
                 else
@@ -320,7 +321,7 @@ namespace Lucene.Net.Util
 
                 if (m_input.IncrementToken())
                 {
-                    AddSynonym = TermAtt.ToString().Equals("国");
+                    AddSynonym = TermAtt.ToString().Equals("国", StringComparison.Ordinal);
                     return true;
                 }
                 else
diff --git a/src/Lucene.Net/Analysis/Token.cs b/src/Lucene.Net/Analysis/Token.cs
index d913196..199d300 100644
--- a/src/Lucene.Net/Analysis/Token.cs
+++ b/src/Lucene.Net/Analysis/Token.cs
@@ -1,4 +1,5 @@
 using Lucene.Net.Analysis.TokenAttributes;
+using System;
 using System.Reflection;
 using Attribute = Lucene.Net.Util.Attribute;
 using AttributeSource = Lucene.Net.Util.AttributeSource;
@@ -432,7 +433,7 @@ namespace Lucene.Net.Analysis
                     endOffset == other.endOffset && 
                     flags == other.flags && 
                     positionIncrement == other.positionIncrement && 
-                    (type == null ? other.type == null : type.Equals(other.type, System.StringComparison.Ordinal)) && 
+                    (type == null ? other.type == null : type.Equals(other.type, StringComparison.Ordinal)) && 
                     (payload == null ? other.payload == null : payload.Equals(other.payload)) && 
                     base.Equals(obj)
                 );
diff --git a/src/Lucene.Net/Index/UpgradeIndexMergePolicy.cs b/src/Lucene.Net/Index/UpgradeIndexMergePolicy.cs
index b75fffa..9ff1396 100644
--- a/src/Lucene.Net/Index/UpgradeIndexMergePolicy.cs
+++ b/src/Lucene.Net/Index/UpgradeIndexMergePolicy.cs
@@ -65,7 +65,7 @@ namespace Lucene.Net.Index
 
         /// <summary>
         /// Returns <c>true</c> if the given segment should be upgraded. The default implementation
-        /// will return <c>!Constants.LUCENE_MAIN_VERSION.Equals(si.Version)</c>,
+        /// will return <c>!Constants.LUCENE_MAIN_VERSION.Equals(si.Info.Version, StringComparison.Ordinal)</c>,
         /// so all segments created with a different version number than this Lucene version will
         /// get upgraded.
         /// </summary>
diff --git a/src/Lucene.Net/Support/Arrays.cs b/src/Lucene.Net/Support/Arrays.cs
index 1d7a6c7..10ad3c0 100644
--- a/src/Lucene.Net/Support/Arrays.cs
+++ b/src/Lucene.Net/Support/Arrays.cs
@@ -102,7 +102,7 @@ namespace Lucene.Net.Support
         /// to one another. The two arrays are considered equal if both arrays
         /// contain the same number of elements, and all corresponding pairs of
         /// elements in the two arrays are equal. Two objects e1 and e2 are
-        /// considered equal if (e1==null ? e2==null : e1.equals(e2)). In other
+        /// considered equal if (e1==null ? e2==null : e1.Equals(e2)). In other
         /// words, the two arrays are equal if they contain the same elements in
         /// the same order. Also, two array references are considered equal if
         /// both are null.
diff --git a/src/Lucene.Net/Support/AssemblyExtensions.cs b/src/Lucene.Net/Support/AssemblyExtensions.cs
index 5236d14..7b6f9e0 100644
--- a/src/Lucene.Net/Support/AssemblyExtensions.cs
+++ b/src/Lucene.Net/Support/AssemblyExtensions.cs
@@ -60,7 +60,7 @@ namespace Lucene.Net.Support
             if (!resourceCache.TryGetValue(key, out resourceName))
             {
                 string[] resourceNames = assembly.GetManifestResourceNames();
-                resourceName = resourceNames.Where(x => x.Equals(name)).FirstOrDefault();
+                resourceName = resourceNames.Where(x => x.Equals(name, StringComparison.Ordinal)).FirstOrDefault();
 
                 // If resourceName is not null, we have an exact match, don't search
                 if (resourceName == null)
@@ -101,7 +101,7 @@ namespace Lucene.Net.Support
             if (!resourceNames.Contains(resourceName))
             {
                 string nameToFind = null;
-                while (resourceName.Length > 0 && resourceName.Contains('.') && (!(string.IsNullOrEmpty(prefix)) || resourceName.Equals(exactResourceName)))
+                while (resourceName.Length > 0 && resourceName.Contains('.') && (!(string.IsNullOrEmpty(prefix)) || resourceName.Equals(exactResourceName, StringComparison.Ordinal)))
                 {
                     nameToFind = string.IsNullOrEmpty(prefix)
                         ? resourceName
@@ -148,7 +148,7 @@ namespace Lucene.Net.Support
 
                 var other = obj as TypeAndResource;
                 return this.type.Equals(other.type)
-                    && this.name.Equals(other.name);
+                    && this.name.Equals(other.name, StringComparison.Ordinal);
             }
 
             public override int GetHashCode()


[lucenenet] 21/42: BUG: Lucene.Net.Tests.Support.TestTreeSet: Passing null instead of CultureInfo.InvariantCulture causes the test to randomly fail depending on the culture of the current thread (which is randomly selected by LuceneTestCase).

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit 02d9671794b4cf1cdb5bed06be24f929f9a573c5
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Sat Aug 3 20:08:48 2019 +0700

    BUG: Lucene.Net.Tests.Support.TestTreeSet: Passing null instead of CultureInfo.InvariantCulture causes the test to randomly fail depending on the culture of the current thread (which is randomly selected by LuceneTestCase).
---
 src/Lucene.Net.Tests/Support/TestTreeSet.cs | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/Lucene.Net.Tests/Support/TestTreeSet.cs b/src/Lucene.Net.Tests/Support/TestTreeSet.cs
index 448e27c..156343e 100644
--- a/src/Lucene.Net.Tests/Support/TestTreeSet.cs
+++ b/src/Lucene.Net.Tests/Support/TestTreeSet.cs
@@ -20,6 +20,7 @@
 */
 
 using System;
+using System.Globalization;
 using Lucene.Net.Attributes;
 using Lucene.Net.Support.C5;
 using NUnit.Framework;
@@ -67,9 +68,14 @@ namespace Lucene.Net.Support.RBTreeSet
         {
             Assert.AreEqual("{  }", coll.ToString());
             coll.AddAll(new int[] { -4, 28, 129, 65530 });
-            Assert.AreEqual("{ -4, 28, 129, 65530 }", coll.ToString());
+            // LUCENENET specific - LuceneTestCase swaps cultures at random, therefore
+            // we require the IFormatProvider to be passed to make this test stable.
+            Assert.AreEqual("{ -4, 28, 129, 65530 }", coll.ToString(null, CultureInfo.InvariantCulture));
             Assert.AreEqual("{ -4, 1C, 81, FFFA }", coll.ToString(null, rad16));
-            Assert.AreEqual("{ -4, 28, 129... }", coll.ToString("L14", null));
+            // LUCENENET specific - LuceneTestCase swaps cultures at random, therefore
+            // passing a null here will have random results, making the comparison fail under
+            // certain cultures. We fix this by passing CultureInfo.InvariantCulture instead of null.
+            Assert.AreEqual("{ -4, 28, 129... }", coll.ToString("L14", CultureInfo.InvariantCulture));
             Assert.AreEqual("{ -4, 1C, 81... }", coll.ToString("L14", rad16));
         }
     }


[lucenenet] 30/42: Lucene.Net.Util.StringHelper: Added API note to make StartsWith and EndsWith into extension methods for BytesRef.

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit 4463f5a71ad162328a54d46359f7f45441797f0e
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Mon Aug 5 08:51:50 2019 +0700

    Lucene.Net.Util.StringHelper: Added API note to make StartsWith and EndsWith into extension methods for BytesRef.
---
 src/Lucene.Net/Util/StringHelper.cs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/Lucene.Net/Util/StringHelper.cs b/src/Lucene.Net/Util/StringHelper.cs
index 03bdca4..0dcbac2 100644
--- a/src/Lucene.Net/Util/StringHelper.cs
+++ b/src/Lucene.Net/Util/StringHelper.cs
@@ -169,7 +169,7 @@ namespace Lucene.Net.Util
         ///          The expected prefix </param>
         /// <returns> Returns <c>true</c> if the <paramref name="ref"/> starts with the given <paramref name="prefix"/>.
         ///         Otherwise <c>false</c>. </returns>
-        public static bool StartsWith(BytesRef @ref, BytesRef prefix)
+        public static bool StartsWith(BytesRef @ref, BytesRef prefix) // LUCENENET TODO: API - convert to extension method
         {
             return SliceEquals(@ref, prefix, 0);
         }
@@ -184,7 +184,7 @@ namespace Lucene.Net.Util
         ///          The expected suffix </param>
         /// <returns> Returns <c>true</c> if the <paramref name="ref"/> ends with the given <paramref name="suffix"/>.
         ///         Otherwise <c>false</c>. </returns>
-        public static bool EndsWith(BytesRef @ref, BytesRef suffix)
+        public static bool EndsWith(BytesRef @ref, BytesRef suffix) // LUCENENET TODO: API - convert to extension method
         {
             return SliceEquals(@ref, suffix, @ref.Length - suffix.Length);
         }


[lucenenet] 39/42: BUG: Lucene.Net.Util.StringHelper - Use Time.CurrentTimeMilliseconds() instead of DateTime.Now.Millisecond. The latter is a mis-translation from Java which contains only numbers 0 to 999, the former returns a long based on Stopwatch.GetTimestamp() that has several orders of magnitude more possible values.

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit f0fb88fac6571f4c0a8fdf37803e6937d0f6c845
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Wed Aug 7 11:12:09 2019 +0700

    BUG: Lucene.Net.Util.StringHelper - Use Time.CurrentTimeMilliseconds() instead of DateTime.Now.Millisecond. The latter is a mis-translation from Java which contains only numbers 0 to 999, the former returns a long based on Stopwatch.GetTimestamp() that has several orders of magnitude more possible values.
---
 src/Lucene.Net/Util/StringHelper.cs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/Lucene.Net/Util/StringHelper.cs b/src/Lucene.Net/Util/StringHelper.cs
index 0dcbac2..459ee71 100644
--- a/src/Lucene.Net/Util/StringHelper.cs
+++ b/src/Lucene.Net/Util/StringHelper.cs
@@ -56,7 +56,7 @@ namespace Lucene.Net.Util
             }
             else
             {
-                return DateTime.Now.Millisecond;
+                return (int)Time.CurrentTimeMilliseconds();
             }
         }
 


[lucenenet] 16/42: Lucene.Net.TestFramework.Util.LuceneTestCase: Throw explicit exception if Directory type cannot be resolved

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit 5481d71be0219a80564e85e749b7d749ca80e17f
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Wed Jul 31 21:41:50 2019 +0700

    Lucene.Net.TestFramework.Util.LuceneTestCase: Throw explicit exception if Directory type cannot be resolved
---
 src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs b/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
index a2a2b67..ad36742 100644
--- a/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
+++ b/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
@@ -1515,8 +1515,10 @@ namespace Lucene.Net.Util
             }
 
             Type clazz = CommandLineUtil.LoadDirectoryClass(clazzName);
+            if (clazz == null)
+                throw new InvalidOperationException($"Type '{clazzName}' could not be instantiated.");
             // If it is a FSDirectory type, try its ctor(File)
-            if (clazz.GetTypeInfo().IsSubclassOf(typeof(FSDirectory)))
+            if (typeof(FSDirectory).IsAssignableFrom(clazz))
             {
                 DirectoryInfo dir = CreateTempDir("index-" + clazzName);
                 dir.Create(); // ensure it's created so we 'have' it.


[lucenenet] 22/42: Added .vscode/settings.json file to locate tests and ignore docs path in Visual Studio Code

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit 5c75fabaf276afc4e895ff7a2b59999476f1db27
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Sat Aug 3 20:56:36 2019 +0700

    Added .vscode/settings.json file to locate tests and ignore docs path in Visual Studio Code
---
 .vscode/settings.json | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 0000000..d47ddde
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,7 @@
+{
+    "files.exclude": {
+        "**/.git": true,
+        "**/docs": true
+    },
+    "dotnet-test-explorer.testProjectPath": "src/**/*.Tests.*.csproj"
+}
\ No newline at end of file


[lucenenet] 02/42: build.ps1: Added Publish task that publishes all test artifacts in parallel

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit 94731f0f20e6b135e288e406a4f5ffba8325ef8c
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Sun Jul 14 07:13:19 2019 +0700

    build.ps1: Added Publish task that publishes all test artifacts in parallel
---
 build/build.ps1 | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 62 insertions(+), 1 deletion(-)

diff --git a/build/build.ps1 b/build/build.ps1
index 899434b..6ba4106 100644
--- a/build/build.ps1
+++ b/build/build.ps1
@@ -52,6 +52,9 @@ properties {
 }
 
 $backedUpFiles = New-Object System.Collections.ArrayList
+if ($IsWindows -eq $null) {
+	$IsWindows = $Env:OS.StartsWith('Windows')
+}
 
 
 task default -depends Pack
@@ -181,6 +184,64 @@ task Pack -depends Compile -description "This task creates the NuGet packages" {
 	}
 }
 
+# Loops through each framework in the TestTargetFrameworks variable and
+# publishes the project in the artifact staging directory with the framework
+# and project name as part of the folder structure.
+task Publish -depends Compile -description "This task uses dotnet publish to package the binaries with all of their dependencies so they can be run xplat" {
+	Write-Host "##teamcity[progressMessage 'Publishing']"
+	Write-Host "##vso[task.setprogress]'Publishing'"
+
+	try {
+		$frameworksToTest = $frameworks_to_test -split "\s*?,\s*?"
+		
+		foreach ($framework in $frameworksToTest) {
+			$testProjects = Get-ChildItem -Path "$source_directory/**/*.csproj" -Recurse | ? { $_.Directory.Name.Contains(".Tests") } | ForEach-Object { $_.FullName }
+			foreach ($testProject in $testProjects) {
+				$projectName = [System.IO.Path]::GetFileNameWithoutExtension($testProject)
+
+				# Special case - our CLI tool only supports .NET Core 2.1
+				if ($projectName.Contains("Tests.Cli") -and (!$framework.StartsWith("netcoreapp2."))) {
+					continue
+				}
+
+				# Do this first so there is no conflict
+				$outputPath = "$publish_directory/$framework/$projectName"
+				Ensure-Directory-Exists $outputPath
+
+				$scriptBlock = {
+					param([string]$testProject, [string]$publish_directory, [string]$framework, [string]$configuration, [string]$projectName)
+					$logPath = "$publish_directory/$framework"
+					$outputPath = "$logPath/$projectName"
+					Write-Host "Publishing '$testProject' on '$framework' to '$outputPath'..."
+					# Note: Cannot use Psake Exec in background
+					dotnet publish "$testProject" --output "$outputPath" --framework "$framework" --configuration "$configuration" --no-build --verbosity Detailed /p:TestFrameworks=true > "$logPath/$projectName-dotnet-publish.log" 2> "$logPath/$projectName-dotnet-publish-error.log"
+				}
+
+				# Execute the jobs in parallel
+				Start-Job $scriptBlock -ArgumentList $testProject,$publish_directory,$framework,$configuration,$projectName
+			}
+		}
+
+		Write-Host "Executing dotnet publish of all projects in parallel. This will take a bit, please wait..."
+
+		Get-Job
+
+		# Wait for it all to complete
+        While (Get-Job -State "Running") {
+			Start-Sleep 10
+		}
+
+		# Getting the information back from the jobs (time consuming)
+		#Get-Job | Receive-Job
+
+		$success = $true
+	} finally {
+		#if ($success -ne $true) {
+			Restore-Files $backedUpFiles
+		#}
+	}
+}
+
 task Test -depends InstallSDK, UpdateLocalSDKVersion, Restore -description "This task runs the tests" {
 	Write-Host "##teamcity[progressMessage 'Testing']"
 	Write-Host "Running tests..." -ForegroundColor DarkCyan
@@ -199,7 +260,7 @@ task Test -depends InstallSDK, UpdateLocalSDKVersion, Restore -description "This
 		foreach ($testProject in $testProjects) {
 			$testName = $testProject.Directory.Name
 
-			# Special case - our CLI tool only supports .NET Core 2.0
+			# Special case - our CLI tool only supports .NET Core 2.1
 			if ($testName.Contains("Tests.Cli") -and (!$framework.StartsWith("netcoreapp2."))) {
 				continue
 			}