how to fix System.TypeInitializationException : Инициализатор типа "FlaUI.Core.Tools.SystemInfo" выдал исключение. ----> System.InvalidOperationException : Не удается загрузить данные имени счетчика, поскольку в реестре обнаружен недопустимый индекс "

_cnehle 0 Reputation points
2024-02-25T19:29:17.4566667+00:00

In university we started to work with Windows Forms и WPF. For each work we're given a pre-work with all files and tests. But when I try to start test, they fall with the same Exception: System.TypeInitializationException : Инициализатор типа "FlaUI.Core.Tools.SystemInfo" выдал исключение. ----> System.InvalidOperationException : Не удается загрузить данные имени счетчика, поскольку в реестре обнаружен недопустимый индекс "". Maybe someone can help me with it? My prof said he don't know what is this....

Windows Forms
Windows Forms
A set of .NET Framework managed libraries for developing graphical user interfaces.
1,870 questions
Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,708 questions
Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,850 questions
Visual Studio Testing
Visual Studio Testing
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Testing: The act or process of applying tests as a means of analysis or diagnosis.
337 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Hui Liu-MSFT 47,256 Reputation points Microsoft Vendor
    2024-02-26T03:14:01.2+00:00

    Hi,@_cnehle. Welcome to Microsoft Q&A. The exception you're encountering is related to the FlaUI library. This exception occurs when the library attempts to access performance counter data from the Windows registry but encounters an invalid index.

    Here are some steps you could try to resolve or diagnose the issue:

    Check Registry Permissions: Ensure that the account running the tests has the necessary permissions to read from the registry. You may need to adjust registry permissions to allow access.

    Update FlaUI Library: Make sure you are using the latest version of the FlaUI library. Updates to the library may include fixes for known issues, including issues related to performance counters.

    Disable Performance Counters: If performance counters are not essential for your testing, you can try disabling them. This can be done by setting the UsePerformanceCounters property of the AutomationBase class to false before initializing FlaUI.

    Check System Environment: Ensure that your system environment is set up correctly. Sometimes, issues with environment variables or system configurations can lead to unexpected behavior.

    If none of the above solutions work, you may need to consult the documentation or seek assistance from the maintainers of the third-party library FlaUI for further troubleshooting and support.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments