Hola Enrique
El código que ejecuta al momento de asignar el valor Dirty, cambió de ev1 a ev2. El cambio que se hizo fue justamente actualizar el icono del objeto cuando cambia de estado (de dirty a no dirty, o viceversa) para reflejar mejor cambios internos que podían afectar el icono que se muestra.
Hasta el momento el cambio de estado se venía ejecutando en el propio thread de UI, por lo que no había saltado este problema. El problema ocurre cuando el cambio de estado se hace desde un thread en background. Lo vamos a corregir, pero mientras tanto, para evitar el problema, puede hacer lo siguiente:
Development & Research
Estoy procesando objetos con una extension y hago:Artech.Architecture.UI.Framework.Objects.IGxDocument document;
if (UIServices.DocumentManager.IsOpenDocument(obj, out document))
{
document.Object.AddCategory(catUnreachables);
document.Dirty = true;
UIServices.TrackSelection.OnSelectChange(document.Object, null);
}para marcar los objetos abiertos como cambiados. Esto funcionaba en versiones anteriores, pero ahora da el error:System.InvalidOperationException was unhandledMessage=Cross-thread operation not valid: Control 'DocumentMdiView' accessed from a thread other than the thread it was created on.Source=System.Windows.FormsStackTrace:at System.Windows.Forms.Control.get_Handle()at System.Windows.Forms.Control.SendMessage(Int32 msg, Int32 wparam, IntPtr lparam)at System.Windows.Forms.Form.UpdateWindowIcon(Boolean redrawFrame)at System.Windows.Forms.Form.set_Icon(Icon value)at Artech.Core.UI.Documents.DocumentMdiView.Document_DocumentDirtyChanged(Object sender, DocumentEventArgs args)at Artech.Core.UI.Documents.GxDocument.OnDocumentStatusChanged()at Artech.Core.UI.Documents.GxDocument.set_Dirty(Boolean value)at Concepto.Packages.KBDoctor.ObjectsHelper.Unreachables() in C:\Models\vs2010\GXExtensions\gxextensions\trunk\KBDoctor\ObjectsHelper.cs:line 82at System.Threading.ThreadHelper.ThreadStart_Context(Object state)at System.Threading.ExecutionContext.runTryCode(Object userData)at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)at System.Threading.ThreadHelper.ThreadStart()InnerException:Como evito este error?
--
0 Response to "Re: [genexusextensions] Cross-thread operation not valid: Control 'DocumentMdiView' accessed from a thread other than the thread it was created on."
Publicar un comentario