.NET 7 to .NET 8 migration throws error: System.InvalidOperationException: Enumeration has not started. Call MoveNext

I am using latest version of Aspose.Email version 24.6.0.

Following code works in .NET 7 but fails in .NET 8.

var client = GetExchangeEwsClient();
ExchangeMailboxInfo mailboxInfo = client.GetMailboxInfo(_exchangeConfig.MailBoxAddress);
ExchangeQueryBuilder builder = new ExchangeQueryBuilder();
var lastRunDateTime = LastRunDateTime();
builder.InternalDate.Since(lastRunDateTime, DateComparisonType.ByDateTime);
var directoryName = _exchangeConfig.DownloadFolder;
var query = builder.GetQuery();
// Following line throws error: 
**var msgCollection = client.ListMessages(mailboxInfo.InboxUri, query, false);**
//System.InvalidOperationException: Enumeration has not started. Call MoveNext

Any help would be appreciated.

Hello @mxasim,

Welcome to our support forum!
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): EMAILNET-41388

You can obtain Paid Support Services if you need support on a priority basis, along with direct access to our Paid Support management team.