prevent recursive logging csharp stackoverflow. (#59503)

* prevent recursive logging situation.

* Add changelog
This commit is contained in:
Manu Lange 2019-08-08 11:50:41 +12:00 committed by Jordan Borean
parent 2cae0739e9
commit 6a5cd9a820
2 changed files with 4 additions and 1 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- ansible.basics - fix core C# recursive call when logging fails (e.g. if insufficient permissions are held) (https://github.com/ansible/ansible/pull/59503)

View file

@ -304,7 +304,8 @@ namespace Ansible.Basic
} }
catch (System.Security.SecurityException) catch (System.Security.SecurityException)
{ {
Warn(String.Format("Access error when creating EventLog source {0}, logging to the Application source instead", logSource)); // Cannot call Warn as that calls LogEvent and we get stuck in a loop
warnings.Add(String.Format("Access error when creating EventLog source {0}, logging to the Application source instead", logSource));
logSource = "Application"; logSource = "Application";
} }
} }