I have the following code which is unable to authenticate with Microsoft Graph:

<C#>


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Microsoft.Graph;
using Outlook = Microsoft.Office.Interop.Outlook;
using Microsoft.Graph.Models;
using Azure.Identity;
using System.Security.Policy;
using Microsoft.Office.Tools;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.ListView;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.StartPanel;
using System.Globalization;

namespace Outage_Helper
{
    public partial class OutageCalendarPane : UserControl
    {
        private const string ClientId = "APP-ID";
        private const string TenantId = "TENANT-ID";
        private const string UtilityAccountUsername = "outage-helper@ct4.com";
        private const string UtilityAccountPassword = "CLIENT-SECRET";
private GraphServiceClient _graphClient;
        private Outlook.MailItem _selectedMailItem;

        public OutageCalendarPane(Outlook.MailItem selectedMailItem)
        {
            InitializeComponent();
            _selectedMailItem = selectedMailItem;
            emailContentTextBox.Text = selectedMailItem.Body;
            // Make sure to wait for the Task to complete
            AuthenticateAndInitializeGraphClient().GetAwaiter().GetResult(); // This will block until the task is completed
        }

        private async Task AuthenticateAndInitializeGraphClient()
        {
            var credential = new ClientSecretCredential(TenantId, ClientId, UtilityAccountPassword);
            _graphClient = new GraphServiceClient(credential);
        }



        private async void submitBtn_Click(object sender, EventArgs e)
        {
            if (_graphClient != null)
            {
                string calendarId = "CALENDAR-ID";
                var newEvent = new Event
                {
                    Subject = eventNameTextBox.Text,
                    Start = new DateTimeTimeZone { DateTime = startDateTimePicker.Value.ToString("o"), TimeZone = "UTC" },
                    End = new DateTimeTimeZone { DateTime = endDateTimePicker.Value.ToString("o"), TimeZone = "UTC" },
                    Body = new ItemBody
                    {
                        ContentType = BodyType.Text,
                        Content = $"Username: { _selectedMailItem.Sender.Name}\nNote: { eventNoteTextBox.Text}\n\nEmail Text: { emailContentTextBox.Text}"
}
        };

        await _graphClient.Users[UtilityAccountUsername].Calendars[calendarId].Events.PostAsync(newEvent).ConfigureAwait(false);
        MessageBox.Show("Outage event has been added to the shared calendar.");
((Form)this.TopLevelControl).Close();
}
else
{
MessageBox.Show("Error: Unable to add the outage event. Please try again.");
    }
}

private void cancelBtn_Click(object sender, EventArgs e)
{
    ((Form)this.TopLevelControl).Close();
}
}
}


</C#>

When I run it, it causes the following exception: "FileLoadException: Could not load file or assembly 'System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)". The details are:
System.TypeInitializationException
  HResult=0x80131534
  Message=The type initializer for 'Azure.Core.ClientOptions' threw an exception.
  Source=Azure.Identity
  StackTrace:
   at Azure.Identity.CredentialPipeline.<>c.<.cctor>b__16_0()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at Azure.Identity.ClientSecretCredential..ctor(String tenantId, String clientId, String clientSecret, TokenCredentialOptions options, CredentialPipeline pipeline, MsalConfidentialClient client)
   at Azure.Identity.ClientSecretCredential..ctor(String tenantId, String clientId, String clientSecret)
   at Outage_Helper.OutageCalendarPane.<AuthenticateAndInitializeGraphClient>d__7.MoveNext() in C:\_DEV\Visual Studio\Outage Helper\Outage Helper\OutageCalendarPane.cs:line 42
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
   at Outage_Helper.OutageCalendarPane..ctor(MailItem selectedMailItem) in C:\_DEV\Visual Studio\Outage Helper\Outage Helper\OutageCalendarPane.cs:line 37
   at Outage_Helper.Ribbon1.OnOutageButton(IRibbonControl control) in C:\_DEV\Visual Studio\Outage Helper\Outage Helper\Ribbon1.cs:line 95

  This exception was originally thrown at this call stack:
    [External Code]

Inner Exception 1:
FileLoadException: Could not load file or assembly 'System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)


The NuGet package System.Memory is not available to install in Version 4.0.1.1, please adjust the code accordingly.