Error: System.InvalidCastException: Unable to cast object of type 'Blackbaud.Web.Content.Core.DynamicDataProvider' - when sending email

When sending an email message in NetCommunity, it results in an Exception. When viewing the details of the status log, you see the following error:

System.InvalidCastException: Unable to cast object of type 'Blackbaud.Web.Content.Core.DynamicDataProvider' to type 'Blackbaud.Web.Content.Core.Data.ShelbyConstituent'.
   at Blackbaud.Web.Content.Core.EmailJob.PopulateRecipient2(IDataProvider oRecipient, String sKey, String sSourceKey, Int32 constituentId)
   at Blackbaud.Web.Content.Core.EmailJob.ProcessImportedList(String sSourceKey, IDataSource oDS, EmailList oList)
   at Blackbaud.Web.Content.Core.EmailJob.ProcessList(Int32 iListID)
   at Blackbaud.Web.Content.Core.EmailJob.ProcessAddressees()
   at Blackbaud.Web.Content.Core.EmailJob.DoProcessMailBlast()
   at Blackbaud.Web.Content.Core.EmailJob.ProcessMailBlast()
   at Blackbaud.AppFx.ContentManagement.Platform.Email.Catalog.LegacyListProcessorWrapper.PrepareForProcessing()
   at Blackbaud.AppFx.ContentManagement.Platform.Email.Catalog.BasicEmailDataProcessor.BuildSelectionSQL()
   at Blackbaud.AppFx.ContentManagement.Platform.Email.Catalog.BasicEmailDataProcessor.BuildRecipientsSelectionSQL()
   at Blackbaud.AppFx.ContentManagement.Platform.Email.Catalog.EmailProcessor.ProcessEmail()
   at Blackbaud.AppFx.ContentManagement.Platform.Email.Catalog.ProcessCMSEmailBusinessProcess.StartBusinessProcess()

This can also occur with anonymous newsletter subscriptions being sent out as well.  You may see the below error when sending out an anonymous newsletter. 

System.InvalidCastException: Unable to cast object of type 'Blackbaud.Web.Content.Core.AnonymousNewsletterSubscriber' to type 'Blackbaud.Web.Content.Core.Data.ShelbyConstituent'.
   at Blackbaud.Web.Content.Core.EmailJob.PopulateRecipient2(IDataProvider oRecipient, String sKey, String sSourceKey, Int32 constituentId)
   at Blackbaud.Web.Content.Core.EmailJob.PopulateNeedsDataPageOfRecipients(Int32[] iIDs, String sDataSourceKey)
   at Blackbaud.Web.Content.Core.EmailJob.ProcessNeedsDataDataSource(ArrayList IDs, String sDataSourceKey)
   at Blackbaud.Web.Content.Core.EmailJob.ProcessNeedsDataDataSources()
   at Blackbaud.Web.Content.Core.EmailJob.PopulateNeedsData()
   at Blackbaud.Web.Content.Core.EmailJob.ProcessAddressees()
   at Blackbaud.Web.Content.Core.EmailJob.DoProcessMailBlast()
   at Blackbaud.Web.Content.Core.EmailJob.ProcessMailBlast()
   at Blackbaud.AppFx.ContentManagement.Platform.Email.Catalog.LegacyListProcessorWrapper.PrepareForProcessing()
   at Blackbaud.AppFx.ContentManagement.Platform.Email.Catalog.LegacyDataProcessor.BuildRecipientsSelectionSQL()
   at Blackbaud.AppFx.ContentManagement.Platform.Email.Catalog.EmailProcessor.ProcessEmail()
   at Blackbaud.AppFx.ContentManagement.Platform.Email.Catalog.ProcessCMSEmailBusinessProcess.StartBusinessProcess()


 
This may occur when sending to a data source of None and using multiple list types. It may also occur for Newsletters.

This issue was resolved in the latest version of Blackbaud NetCommunity

Environment

 Blackbaud NetCommunity
 7.1.167.0

Was this article helpful?