none
Cross thread operation detected. To suppress this exception hatası RRS feed

  • Soru

  • Merhaba arkadaşlar,

    C#, faturaları listeledeğim ekran çok donduğu için task kullanmak istedim fakat aşağıdaki hatayı almaya başladım ne yapabilirim acaba.

     private async void buttonUpdate_ItemClick(object sender, ItemClickEventArgs e)
            {
                    await Task.Run(() => LoadOrder());
            }

    private void LoadOrder()
            {

    // code

    }

       Hata Kaynağı =DevExpress.Data.v18.1
       Hata Mesajı = Cross thread operation detected. To suppress this exception, set DevExpress.Data.CurrencyDataController.DisableThreadingProblemsDetection = true
    ManagedThreadId: 4; ThreadName: ''
    StackTrace:
       konum: System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)
       konum: System.Environment.get_StackTrace()
       konum: DevExpress.Data.BaseGridController.ThrowCrossThreadExceptionToTheUIThreadIfPossible()
       konum: DevExpress.Data.BaseGridController.CheckCrossThread(Action`1 method, Boolean ignoreThreadWarning)
       konum: DevExpress.Data.CurrencyDataController.RaiseOnBindingListChanged(ListChangedEventArgs e)
       konum: DevExpress.Data.Helpers.ListDataControllerHelper.OnBindingListChanged(ListChangedEventArgs e)
       konum: DevExpress.Data.Helpers.BaseDataViewControllerHelper.OnBindingListChanged(ListChangedEventArgs e)
       konum: DevExpress.Data.DataControllerBase.OnBindingListChanged(Object sender, ListChangedEventArgs e)
       konum: System.ComponentModel.ListChangedEventHandler.Invoke(Object sender, ListChangedEventArgs e)
       konum: System.Windows.Forms.BindingSource.OnListChanged(ListChangedEventArgs e)
       konum: System.Windows.Forms.BindingSource.ResetBindings(Boolean metadataChanged)
       konum: System.Windows.Forms.BindingSource.SetList(IList list, Boolean metaDataChanged, Boolean applySortAndFilter)
       konum: System.Windows.Forms.BindingSource.ResetList()
       konum: System.Windows.Forms.BindingSource.set_DataSource(Object value)
       konum: DevExpress.XtraGrid.Views.Base.ColumnView.RaiseFocusedRowChanged(Int32 prevFocused, Int32 focusedRowHandle)
       konum: DevExpress.XtraGrid.Views.Base.ColumnView.DoChangeFocusedRowInternal(Int32 newRowHandle, Boolean updateCurrentRow)
       konum: DevExpress.XtraGrid.Views.Grid.GridView.OnCurrentControllerRowChanged(CurrentRowEventArgs e)
       konum: DevExpress.XtraGrid.Views.Base.ColumnView.DevExpress.Data.IDataControllerCurrentSupport.OnCurrentControllerRowChanged(CurrentRowEventArgs e)
       konum: DevExpress.Data.BaseGridController.OnCurrentControllerRowChanged()
       konum: DevExpress.Data.BaseGridController.OnCurrentControllerRowChanging(Int32 oldControllerRow, Int32 newControllerRow)
       konum: DevExpress.Data.BaseGridController.set_CurrentControllerRow(Int32 value)
       konum: DevExpress.Data.BaseGridController.ResetCurrentPosition()
       konum: DevExpress.Data.CurrencyDataController.OnDataSourceChanged()
       konum: DevExpress.Data.CurrencyDataController.SetDataSource(BindingContext context, Object dataSource, String dataMember)
       konum: DevExpress.XtraGrid.Views.Base.BaseView.SetDataSource(BindingContext context, Object dataSource, String dataMember)
       konum: DevExpress.XtraGrid.Views.Grid.GridView.SetDataSource(BindingContext context, Object dataSource, String dataMember)
       konum: DevExpress.XtraGrid.GridControl.ActivateDataSource()
       konum: DevExpress.XtraGrid.GridControl.set_DataSource(Object value)
       konum: System.Threading.Tasks.Task.InnerInvoke()
       konum: System.Threading.Tasks.Task.Execute()
       konum: System.Threading.Tasks.Task.ExecutionContextCallback(Object obj)
       konum: System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       konum: System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       konum: System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)
       konum: System.Threading.Tasks.Task.ExecuteEntry(Boolean bPreventDoubleExecution)
       konum: System.Threading.Tasks.Task.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
       konum: System.Threading.ThreadPoolWorkQueue.Dispatch()
       konum: System.Threading._ThreadPoolWaitCallback.PerformWaitCallback(),
        Hata Detayı =   konum: DevExpress.Data.BaseGridController.<>c__DisplayClass8b.<ThrowCrossThreadExceptionToTheUIThreadIfPossible>b__8a()   Hata Linki = 

    5 Ağustos 2019 Pazartesi 09:11

Tüm Yanıtlar

  • Cevap soruda gizli sanki : Hata Kaynağı =DevExpress.Data.v18.1
       Hata Mesajı = Cross thread operation detected. To suppress this exception, set DevExpress.Data.CurrencyDataController.DisableThreadingProblemsDetection = true
    ManagedThreadId: 4; ThreadName: ''

    DevExpress.Data.CurrencyDataController.DisableThreadingProblemsDetection = true olarak ayarlamayı deneyin.

    Grafik Arayüzüne ait nesnelere farklı bir threadden ulaşmaya veya kullanmaya çalışıyorsunuz oda diyor ki bu ulaşmaya çalıştığın nesneleri başka bir thread zaten kullanıyor.


    5 Ağustos 2019 Pazartesi 09:40