1

My program was developed in .Net 7 (VS 2022) and running on non-English Windows 10 (x64). Most of the time my program works normally. However, the following error (in Event Viewer) was thrown sometimes, then it will show a dialog and my program quits.

How can I solve the issue? It seems that it is a problem related to .Net...

Thanks.

Application: XXX.EXE
CoreCLR Version: 7.0.1323.51816
.NET Version: 7.0.13

Description: The application requested process termination through
System.Environment.FailFast.

Message: Encountered infinite recursion while looking up 
resource 'Arg_NullReferenceException' in System.Private.CoreLib.

Verify the installation of .NET is complete and does not need
repairing, and that the state of the process has not become corrupted.

Stack:
   at System.Environment.FailFast(System.String)
   at System.SR.InternalGetResourceString(System.String)
   at System.SR.GetResourceString(System.String)
   at System.NullReferenceException..ctor()
   at System.Globalization.CultureInfo.get_CurrentUICulture()
   at System.Resources.ResourceManager.GetString(System.String, System.Globalization.CultureInfo)
   at System.SR.InternalGetResourceString(System.String)
   at System.SR.GetResourceString(System.String)
   at System.NullReferenceException..ctor()
   at xxx (related to my code)
5
  • Is your app setting CultureInfo.CurrentUICulture at all? Commented Nov 3, 2023 at 4:23
  • No. I haven't set that. Can it solve the problem? I have just try to set it as InvariantCulture at the beginning of my program and test again. It is strange if I must set this in all my programs every time. Commented Nov 3, 2023 at 4:29
  • I have run these 2 lines in the beginning of my program but the problem still exists: Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; Thread.CurrentThread.CurrentUICulture = CultureInfo.InvariantCulture; How can I solve it? Commented Nov 3, 2023 at 9:48
  • It is crashing over and over again on trying to retrieve the exception string from the current UI culture. Admirable that they can detect this mishap without crashing the program with a StackOverflowException. Probably inspired by bug reports from some very confounded programmers. Easy fix: don't change the CurrentUICulture to InvariantCulture, it is only suitable for formatting. Your user is always particular about the language they speak and read. Commented Nov 3, 2023 at 10:14
  • From github.com/dotnet/runtime/issues/72381 - "The "infinite recursion during resource lookup" is generic symptom of the things going wrong and the process state being corrupted. If you see this error message, it is unlikely to be a duplicate of the problem tracked by this issue" Commented Nov 3, 2023 at 13:01

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.