问题
There is a problem with my developer machine when I created a project on Silverlight. At the moment I add a control on the grid it shows an exception and the layout is destroyed.
Here are the steps to replicate the problem.
- Create New Silverlight Application
- Uncheck Host the Silverlight application in a new Web site
- Choose Silverlight Version: Silverlight 5
and it successfully creates blank project file

When I tried to add this code inside Grid
<Button Content="Button"
HorizontalAlignment="Left"
Margin="67,125,0,0"
VerticalAlignment="Top" Width="75"/>
It generates an exception: see below

>> Click here to see FULL SCREEN Image <<
The two StackTraces Generated:
at MS.Internal.XcpImports.MethodEx(IntPtr ptr, String name, CValue[] cvData)
at MS.Internal.XcpImports.MethodEx(DependencyObject obj, String name)
at MS.Internal.XcpImports.UIElement_UpdateLayout(UIElement element)
and
at MS.Internal.XcpImports.CheckHResult(UInt32 hr)
at MS.Internal.XcpImports.FrameworkElement_MeasureOverride(FrameworkElement element, Size availableSize)
at System.Windows.FrameworkElement.MeasureOverride(Size availableSize)
at System.Windows.FrameworkElement.MeasureOverride(IntPtr nativeTarget, Single inWidth, Single inHeight, Single& outWidth, Single& outHeight)
I have already rebuilt the project but it seems not working. It stills show the exception. But at the moment I remove the Button
inside the Grid
it returns on the previous blank project. I just can't add any controls inside the Grid
. What did I missed here? I'm new with this one. It's my first time to create silverlight project file.
Did anybody here experienced the same error message?
If this question has been asked before kindly help me redirect on that page because I can't find it.
By the way, here's what inside my development machine:
- Windows 7 Ultimate (x64)
- Microsoft Visual Studio 2012 V 11.0.50.727.1 RTMREL
- Silverlight Developer Runtime 5.1.20125.0 (x64)
- Silverlight SDK 5.0.61118.0
UPDATE 1
I tried doing it in Blend
but still the same error was thrown,

来源:https://stackoverflow.com/questions/16372057/cannot-add-any-control-on-the-workspace-catastrophic-failure