Skip to content

Error searching Word documents #1463

Closed
Closed

Description

@doug24

У большого количества работниц почему-то перестает работать поиск во всех файлах обрабатываемых плагинами с выводом описания проблемы:
"Value cannot be null. (Parameter 'oldValue')"

Image

При этом помогает только заново распаковать архив с портативным DnGrep...
Сам повторить такой результат не могу, но почти каждый день у пары-тройки юзеров появляется эта проблема. С чем может быть проблема?

Image

Сейчас проверял что не так у себя на ПК с их портативками... У меня они работают.
Что-то винда или антивирус делают с ними похоже...
Также на одном ПК "само" прошло без выгрузки из архива заново...
Что происходит?

Originally posted by @VladTester255 in #1448

Activity

  1. doug24 commented on Apr 16, 2026

    @doug24
    ContributorAuthor

    @VladTester255 The dnGrep error log should have more context of where the problem is occurring. Can you look at the error log and post the full error message or copy the log file here?

    Maybe it's the translation, but I don't understand what these lines mean:
    "At the same time, it only helps to recompress the archive with a portable DnGrep..."
    "Also, on one PC, "itself" went without unloading from the archive again..."

    I don't understand what is being recompressed or unloaded from the archive.

  2. VladTester255 commented on Apr 17, 2026

    @VladTester255
    Contributor

    This page contains the following errors:
    error on line 15 at column 1: Extra content at the end of the document
    Below is a rendering of the page up to the first error.
    Error searching file: 'd:\files.pdf' System.ArgumentNullException: Value cannot be null. (Parameter 'oldValue') at System.ArgumentNullException.Throw(String paramName) at System.ArgumentNullException.ThrowIfNull(Object argument, String paramName) at System.ArgumentException.ThrowNullOrEmptyException(String argument, String paramName) at System.String.Replace(String oldValue, String newValue) at System.String.Replace(String oldValue, String newValue, StringComparison comparisonType) at dnGREP.Common.StringMap.ReplaceAllKeys(String text) in C:\projects\dngrep\dnGREP.Common\StringMap.cs:line 59 at dnGREP.Engines.Pdf.GrepEnginePdf.ReadCacheFile(String cacheFilePath, Encoding encoding, Boolean applyStringMap) in C:\projects\dngrep\dnGREP.PdfEngine\GrepEnginePdf.cs:line 366 at dnGREP.Engines.Pdf.GrepEnginePdf.ExtractText(String pdfFilePath, String cacheFilePath, Encoding encoding, String password, PauseCancelToken pauseCancelToken) in C:\projects\dngrep\dnGREP.PdfEngine\GrepEnginePdf.cs:line 321 at dnGREP.Engines.Pdf.GrepEnginePdf.Search(String pdfFile, String searchPattern, SearchType searchType, GrepSearchOption searchOptions, Encoding encoding, PauseCancelToken pauseCancelToken) in C:\projects\dngrep\dnGREP.PdfEngine\GrepEnginePdf.cs:line 75 at dnGREP.Common.GrepCore.Search(String file, SearchType searchType, String searchPattern, GrepSearchOption searchOptions, Int32 codePage, Int32& counter, Int32& highWater, PauseCancelToken pauseCancelToken) in C:\projects\dngrep\dnGREP.Engines\GrepCore.cs:line 407

  3. VladTester255 commented on Apr 17, 2026

    @VladTester255
    Contributor

    It helps re-unpack the software files over the existing ones, replacing them, and the software works again.
    However, in one case, I was able to restore functionality by simply restarting the software...
    I managed to reproduce the issue once, but I'm not sure what exactly caused it...

  4. doug24 commented on Apr 17, 2026

    @doug24
    ContributorAuthor

    Thank you for the log message, that is very helpful.
    For the error "Value cannot be null. (Parameter 'oldValue')" this is the code being run

                foreach (var item in map)
                {
                    text = text.Replace(item.Key, item.Value, StringComparison.Ordinal);
                }
    

    This is doing replacements from the string substitution mapping. The 'oldValue' is the map key - the character being replaced, and the 'newValue' is the map value - the replacement character.

    So, something is wrong your string mapping configuration. The key should never be null - it has to be a valid character.

    I will add a check to verify both the oldValue and newValues are not null and skip the replacement if they are. This will avoid the error, but the string replacement may not be doing what you think it is going to do.

    As for having to overwrite the installation files - I cannot imagine any scenario where this should be necessary. For the zip file installation, move the configuration and log files to another directory by setting the paths in the Options dialog. Everything else in the application directory is read-only and I don't see how any of these files could change without someone intentionally changing them.

  5. doug24 commented on May 12, 2026

    @doug24
    ContributorAuthor

    Fixed in v4.7.54

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions