1

我收到了 Visual Studio 即时调试器错误一个未处理的异常(“Silverlight 应用程序代码中的未处理错误:4004 类别:MangedRuntimeError 消息:System.ServiceMode.DomainServices.Client.DomainOperationException:

一旦我将一行代码加载为

Public Sub New()
InitializeComponent()
Dim context As New OrganizationContext()
context.Load(context.GetTimeTablesQuery(), AddressOf LoadMonday, Nothing)

End Sub

Private Sub LoadMonday(ByVal obj As LoadOperation(Of TimeTable))

Dim btnMonday(20) As Button
For a As Integer = 0 To 19
            btnMonday(a) = New Button()
            btnMonday(a).Height = 23
            btnMonday(a).Width = 107
            btnMonday(a).Content = timeslot(a)
            btnMonday(a).Background = New SolidColorBrush(Colors.Magenta)

            ' Sets dependency properties
            btnMonday(a).SetValue(Grid.ColumnProperty, 1)
            btnMonday(a).SetValue(Grid.RowProperty, a + 1)
            LayoutRoot.Children.Add(btnMonday(a))
        Next
End Sub

任何的想法 ?

4

1 回答 1

0

您可以通过检查它的HasError属性来检查您的 obj 是否有错误。如果 LoadOperation HasError 为真,您可以调用MarkErrorAsHandled

示例代码:

' if there is an error, mark is as handled.
If (obj.HasError) Then
    obj.MarkErrorAsHandled()
End If
于 2011-11-13T10:02:55.723 回答