question

babukumarasamy-5694 avatar image
0 Votes"
babukumarasamy-5694 asked ·

Insufficient memory to continue the execution of the program.

When calling the below function. We are getting the exception "Insufficient memory to continue the execution of the program."

     public static string GetOSVersionAndCaption()
     {
         try
         {
             ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT Caption, Version FROM Win32_OperatingSystem");
             foreach (var os in searcher.Get())
             {
                 return $"{os["Caption"]}; Version: {os["Version"]}";
             }
         }
         catch (Exception ex)
         {
                
         }

         return string.Empty;
     }


dotnet-standard
· 1
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @babukumarasamy-5694 ,

Try to run the program with administrator privileges.
If this doesn't help. Please provide more details about which of the line throw the exception.

0 Votes 0 ·

0 Answers