This project is read-only.

Specified cast is not valid

Topics: Writing modules
Jun 10, 2011 at 12:44 PM


When I run this code line:

var taskPart = contentManager.New<TaskPart>("Task");

I get "specified cast is not valid" exception

my migration.cs contains following lines:

ContentDefinitionManager.AlterPartDefinition(typeof(TaskPart).Name, cfg => cfg.Attachable()

ContentDefinitionManager.AlterTypeDefinition("Task", cfg => cfg.WithPart("TaskPart").Creatable());

Do you know what that means?

Thanks in advance,

Jun 10, 2011 at 1:38 PM

Can you create your Task item from the "New" menu in Dashboard, and is TaskPart working correctly when you do so?

It might be that you haven't implemented a driver.