How to fix IncompleteMigrationExpressionException?
Hello everybody,
It's Friday but feels like Monday...
I forgot (!) to add .Do() in my custom migration and now I'm getting an IncompleteMigrationExpressionException "Cannot create a new expression: the previous expression has not run."
It's only in dev, but I can't move on. I tried to start from the beginning by deleteing migration from umbracoKeyValue, but that didn't helped.
One possible reason you're getting the "Cannot create a new expression: the previous expression has not run" error is that several of the property getters in the MigrationBase class call the BeginBuild() method. They do this every time they are accessed (no caching of the value). This method will set the BuildingExpression flag to true, and it's this flag being true which leads to the exception being thrown.
So, if you have a breakpoint in your code, and you have a watch on one of these properties, display the property in the Locals or Auto panels, or hover the mouse over the property, then the flag will be set to true, and when you try to step or continue the run, the exception will be thrown. For example, if you have the following code:
How to fix IncompleteMigrationExpressionException?
Hello everybody,
It's Friday but feels like Monday...
I forgot (!) to add .Do() in my custom migration and now I'm getting an IncompleteMigrationExpressionException "Cannot create a new expression: the previous expression has not run."
It's only in dev, but I can't move on. I tried to start from the beginning by deleteing migration from umbracoKeyValue, but that didn't helped.
Any suggestions?
Kind regards
Tomasz
Hi Tomasz,
I have the same problem. Did you find a solution?
Best regards,
iNETZO
Hi iNETZO,
The problem just disappeared one day, så I didn't think of it more.
But it rings a bell, when you mention "dbo." prefix.
Regards
Tomasz
One possible reason you're getting the "Cannot create a new expression: the previous expression has not run" error is that several of the property getters in the MigrationBase class call the BeginBuild() method. They do this every time they are accessed (no caching of the value). This method will set the BuildingExpression flag to true, and it's this flag being true which leads to the exception being thrown.
So, if you have a breakpoint in your code, and you have a watch on one of these properties, display the property in the Locals or Auto panels, or hover the mouse over the property, then the flag will be set to true, and when you try to step or continue the run, the exception will be thrown. For example, if you have the following code:
and you set a breakpoint inside this method, then once there, if you hover the mouse over the Create property, then you're doomed.
is working on a reply...