summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Clay <matt@mystile.com>2023-02-02 16:24:20 -0800
committerGitHub <noreply@github.com>2023-02-02 16:24:20 -0800
commitc6984944d11c45ee2cf19873cab97c9a01bc67c6 (patch)
treea30c5556f235bd18c74aaee2ffb369591538aed1
parent4ad346c2faaa95e3392615e7a9124ac9746daebe (diff)
downloadansible-c6984944d11c45ee2cf19873cab97c9a01bc67c6.tar.gz
[stable-2.12] Ansible.Basic.cs - Fix compile error on PS 7.3.x (#79848) (#79852)
(cherry picked from commit 83fe75db07cb55dc2efeb437ce20b9d4462860c3)
-rw-r--r--changelogs/fragments/powershell-7.3-fix.yml2
-rw-r--r--lib/ansible/module_utils/csharp/Ansible.Basic.cs4
2 files changed, 6 insertions, 0 deletions
diff --git a/changelogs/fragments/powershell-7.3-fix.yml b/changelogs/fragments/powershell-7.3-fix.yml
new file mode 100644
index 0000000000..1a9b8d31ac
--- /dev/null
+++ b/changelogs/fragments/powershell-7.3-fix.yml
@@ -0,0 +1,2 @@
+bugfixes:
+ - Ansible.Basic.cs - Ignore compiler warning (reported as an error) when running under PowerShell 7.3.x.
diff --git a/lib/ansible/module_utils/csharp/Ansible.Basic.cs b/lib/ansible/module_utils/csharp/Ansible.Basic.cs
index 51a543bc13..13c7f4ecbe 100644
--- a/lib/ansible/module_utils/csharp/Ansible.Basic.cs
+++ b/lib/ansible/module_utils/csharp/Ansible.Basic.cs
@@ -16,6 +16,10 @@ using Newtonsoft.Json;
using System.Web.Script.Serialization;
#endif
+// Newtonsoft.Json may reference a different System.Runtime version (6.x) than loaded by PowerShell 7.3 (7.x).
+// Ignore CS1701 so the code can be compiled when warnings are reported as errors.
+//NoWarn -Name CS1701 -CLR Core
+
// System.Diagnostics.EventLog.dll reference different versioned dlls that are
// loaded in PSCore, ignore CS1702 so the code will ignore this warning
//NoWarn -Name CS1702 -CLR Core