Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failing Asserts on .NET Standard 2.x (fixes #267, fixes #301) #299

Merged
merged 9 commits into from
Jun 30, 2020

Conversation

NightOwl888
Copy link
Contributor

This fixes #267 by converting these asserts that were intended for control flow during testing into InvalidOperationExceptions. In the test framework, we are still throwing Lucene.Net.Diagnostics.AssertionException in order to differentiate an "assert" from other cases that are throwing InvalidOperationException.

This is similar to how Lucene 8.x behaves, and only affects legacy codecs for Lucene3x and Lucene40.

As for BlockTreeTermsWriter, its assert was failing due to lack of validation on the Prefix to ensure it is valid UTF-8. Since the problem is only when building the string in the assert, a private method was added to generate the string by catching exceptions due to invalid UTF-8 and falling back to just writing out the display of bytes in BytesRef.

@NightOwl888 NightOwl888 modified the milestone: 4.8.0-beta00009 Jun 29, 2020
@NightOwl888 NightOwl888 marked this pull request as ready for review June 30, 2020 14:21
@NightOwl888 NightOwl888 changed the title Failing Asserts on .NET Standard 2.x (fixes #267) Failing Asserts on .NET Standard 2.x (fixes #267, fixes #301) Jun 30, 2020
…estCase on TermVectorsReaders by throwing InvalidOperationException (fixes apache#267)
…apter to 3.16.1, Microsoft.NET.Test.Sdk to 16.6.1 (apache#301)
…ors(): Reflection doesn't throw exceptions when it cannot find a constructor in .NET, we need to test for null instead. (apache#301)
…ently only support assemblies that are referenced by the calling project.
…ntsWriterInit(): Fixed issue with swallowing NUnit's AssertionException by using Assert.Throws.
… property that can be used to toggle "asserts" on and off in the release build, similar to how it works in Java. The setting can be injected by end users with the "assert" system property (which is a boolean). (apache#301)
… rather than our stock one, that is only meant as a logical default.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant