Bug in template/designer interaction in Visual Studio 2013
Posted: Mon 07 Jul 2014 15:37
System:
Visual Studio 2013.2
Entity Developer 5.7.387
Steps to reproduce bug:
0. Open solution in Visual Studio 2013 which has a model with DbContext template
1. Open the EDML designer
2. Open the associated DbContext template, which has been copied to model for editing
3. In the GenerateRelationProperty() method, add a reference to a non-existent property, example:
var badProperty = relationProperty.GetProperty("BadProperty");
4. Save the template and ask ED to generate. Get the expected error that BadProperty is unknown.
5. Switch back to the designer. In ModelSettings, Extended Properties, for Property, add BadProperty. I added it as a boolean.
6. Save the designer, which will cause the template to be executed.
Errors:
1. You will still get the error that BadProperty is unknown.
2. At this point, the template has become 'disconnected' from the model. Editing the template so that it can force a code generation again will always say BadProperty is unknown.
3. If I close the template and reopen it, same problem. Also, in some cases, I *cannot* reopen it. Visual Studio gets into a state where neither a double-click on the template or context menu "Open" will open the template. Closing and re-opening the solution does not help when it gets in this state. I must completely shut down Visual Studio to recover.
Visual Studio 2013.2
Entity Developer 5.7.387
Steps to reproduce bug:
0. Open solution in Visual Studio 2013 which has a model with DbContext template
1. Open the EDML designer
2. Open the associated DbContext template, which has been copied to model for editing
3. In the GenerateRelationProperty() method, add a reference to a non-existent property, example:
var badProperty = relationProperty.GetProperty("BadProperty");
4. Save the template and ask ED to generate. Get the expected error that BadProperty is unknown.
5. Switch back to the designer. In ModelSettings, Extended Properties, for Property, add BadProperty. I added it as a boolean.
6. Save the designer, which will cause the template to be executed.
Errors:
1. You will still get the error that BadProperty is unknown.
2. At this point, the template has become 'disconnected' from the model. Editing the template so that it can force a code generation again will always say BadProperty is unknown.
3. If I close the template and reopen it, same problem. Also, in some cases, I *cannot* reopen it. Visual Studio gets into a state where neither a double-click on the template or context menu "Open" will open the template. Closing and re-opening the solution does not help when it gets in this state. I must completely shut down Visual Studio to recover.