Open Tanya-Solyanik opened 5 years ago
Hmmm - i'm a bit surprised because there shouldn't be any async stuff interfering with this
Possibly related: a failure in DesignSurface_View_GetWithInvalidSupportedTechnologies_ThrowsNotSupportedException
in # 1508
Error message Assert.Throws() Failure\r\nExpected: typeof(System.NotSupportedException)\r\nActual: typeof(System.InvalidOperationException): The CurrentContext property of the LicenseManager is currently locked and cannot be changed.\r\n---- System.InvalidOperationException : The CurrentContext property of the LicenseManager is currently locked and cannot be changed.\r\n-------- System.InvalidOperationException : The CurrentContext property of the LicenseManager is currently locked and cannot be changed.
Stack trace at System.ComponentModel.Design.DesignSurface.get_View() in F:\workspace_work\1\s\src\System.Windows.Forms.Design\src\System\ComponentModel\Design\DesignSurface.cs:line 161 at System.ComponentModel.Design.Tests.DesignSurfaceTests.<>cDisplayClass23_0.
b 0() in F:\workspace_work\1\s\src\System.Windows.Forms.Design\tests\UnitTests\System\ComponentModel\Design\DesignSurfaceTests.cs:line 340 ----- Inner Stack Trace ----- at System.ComponentModel.Design.DesignSurface.get_View() in F:\workspace_work\1\s\src\System.Windows.Forms.Design\src\System\ComponentModel\Design\DesignSurface.cs:line 161 at System.ComponentModel.Design.Tests.DesignSurfaceTests.<>cDisplayClass23_0.b 0() in F:\workspace_work\1\s\src\System.Windows.Forms.Design\tests\UnitTests\System\ComponentModel\Design\DesignSurfaceTests.cs:line 340 ----- Inner Stack Trace ----- at System.ComponentModel.LicenseManager.set_CurrentContext(LicenseContext value) at System.ComponentModel.Design.DesignerHost.System.ComponentModel.Design.IDesignerHost.CreateComponent(Type componentType, String name) in F:\workspace_work\1\s\src\System.Windows.Forms.Design\src\System\ComponentModel\Design\DesignerHost.cs:line 1034 at System.ComponentModel.Design.DesignerHost.System.ComponentModel.Design.IDesignerHost.CreateComponent(Type componentType) in F:\workspace_work\1\s\src\System.Windows.Forms.Design\src\System\ComponentModel\Design\DesignerHost.cs:line 1016 at System.ComponentModel.Design.DesignSurface.DefaultDesignerLoader.BeginLoad(IDesignerLoaderHost loaderHost) in F:\workspace_work\1\s\src\System.Windows.Forms.Design\src\System\ComponentModel\Design\DesignSurface.cs:line 592 at System.ComponentModel.Design.DesignerHost.BeginLoad(DesignerLoader loader) in F:\workspace_work\1\s\src\System.Windows.Forms.Design\src\System\ComponentModel\Design\DesignerHost.cs:line 328
Another possibly related failure in https://github.com/dotnet/winforms/pull/1527
System.ComponentModel.Design.Tests.DesignerHostTests.DesignerHost_Add_DuringUnload_ThrowsException [FAIL]
System.Exception : There is no designer for the class System.ComponentModel.Design.Tests.DesignerHostTests+DesignerComponent. Stack Trace: //src/System.Windows.Forms.Design/src/System/ComponentModel/Design/DesignerHost.cs(244,0): at System.ComponentModel.Design.DesignerHost.AddToContainerPostProcess(IComponent component, String name, IContainer containerToAddTo) //src/System.Windows.Forms.Design/src/System/ComponentModel/Design/DesignerHost.cs(151,0): at System.ComponentModel.Design.DesignerHost.PerformAdd(IComponent component, String name) //src/System.Windows.Forms.Design/src/System/ComponentModel/Design/DesignerHost.cs(141,0): at System.ComponentModel.Design.DesignerHost.Add(IComponent component, String name) at System.ComponentModel.Container.Add(IComponent component) //src/System.Windows.Forms.Design/tests/UnitTests/System/ComponentModel/Design/DesignerHostTests.cs(874,0): at System.ComponentModel.Design.Tests.DesignerHostTests.DesignerHost_Add_DuringUnload_ThrowsException()
Looking at the stack trace, we must be returning from DesignSurface.CreateDesigner
.
protected internal virtual IDesigner CreateDesigner(IComponent component, bool rootDesigner)
{
if (component == null)
{
throw new ArgumentNullException(nameof(component));
}
if (_host == null)
{
throw new ObjectDisposedException(GetType().FullName);
}
IDesigner designer;
if (rootDesigner)
{
designer = TypeDescriptor.CreateDesigner(component, typeof(IRootDesigner)) as IRootDesigner;
}
else
{
designer = TypeDescriptor.CreateDesigner(component, typeof(IDesigner));
}
return designer;
}
but i'm not sure how TypeDescriptor.CreateDesigner
could return null!
DesignerHost_Add_ComponentDisposeThrowsDuringUnloadingDispose_ThrowsInvalidOperationException might have a race condition
https://github.com/dotnet/winforms/blob/774bd34a750016e596808bc6106d63b79dff2462/src/System.Windows.Forms.Design/tests/UnitTests/System/ComponentModel/Design/DesignerHostTests.cs#L1801-#1814