Subject: Bounce Inspector, NET 5 and "Object reference not set to an instance of an object." Date: 2021-03-22 16:23:19 From: bolk Source: bounce-inspector-net-5-object-reference-not-set-instance-object ---------------------------------------------------------------------- Hello, I'm trying the library on a .NET 5 project. I have some bounced emails in the inbox (from different servers) but when checking with the library, I see that it doesn't get Identified as bounced. When inspectng in debug, I see that the BounceResultCollection has an error: {ComponentPro.Net.Mail.BounceResult} Addresses: null BounceCategory: null BounceType: null Delete: false Dsn: null Error: {"Object reference not set to an instance of an object."} FileDeleted: false FilePath: null Identified: false InboxDelete: false InboxDeleted: false MailMessage: null SequenceNumber: 0 SignatureId: -1 Skipped: false Tag: null UniqueId: null specifically the result error is: {"Object reference not set to an instance of an object."} Data: {System.Collections.ListDictionaryInternal} HResult: -2147467261 HelpLink: null InnerException: null Message: "Object reference not set to an instance of an object." Source: "ComponentPro.BounceInspector.NetCore" StackTrace: " at ComponentPro.Net.Mail.BounceInspector.c_e8156728(String )\r\n at ComponentPro.Net.Mail.BounceInspector.c_ce871252(Imap , String , ImapMessageCollection , String , AsyncOperation )" TargetSite: {System.String c_e8156728(System.String)} Any clue of what I'm missing? The code is pretty straightforward from the documentation: filter.Processed = MessageProcessed; ImapMessageCollection list = client.ListMessages(ImapEnvelopeParts.MessageInboxIndex | ImapEnvelopeParts.Size, ImapCriterion.DontHaveFlags(ImapMessageFlags.Seen)); // Process all messages. BounceResultCollection result = await filter.ProcessMessagesAsync(client, config["bounce"]["workingFolder"].ToString(), list, mailsPath); // Display processed emails. foreach (BounceResult r in result) { // If this is a detected bounce. if (r.Identified) { logger.Info("FileName: {0}\nSubject: {1}\nAddress: {2}\nBounce Category: {3}\nBounce Type: {4}\nDeleted: {5}\nDSN Action: {6}\nDSN Diagnostic Code: {7}\n\n", System.IO.Path.GetFileName(r.FilePath), r.MailMessage.Subject, r.Addresses[0], r.BounceCategory.Name, r.BounceType.Name, r.FileDeleted, r.Dsn.Action, r.Dsn.DiagnosticCode); } } ---------------------------------------------------------------------- Note: This question has been asked on the Q&A forum of Thang Dang's fraudulent ComponentPro brand If you purchased anything from ComponentPro, you have been scammed. Contact the payment processor who sold you the license and ask for your money back. Back to ComponentPro Q&A Forum Index