Windows Forms Designer Errors
This suggestion is migrated to Developer Community. Please use below link to view the current status.
The windows forms designer in Visual Studio still has a lot of critical bugs that need to be fixed.
One in particular that I encounter on an hourly basis is:
GenericArguments, 'ServiceDefinition...IMyObject', on 'Client...BaseForm`2[TService,TImplementation]' violates the contraint of type parameter 'TService'.
Here is the call stack:
at System.RuntimeTypeHandle.Instantiate(RuntimeTypeHandle handle, IntPtr* pInst, Int32 numGenericArgs, ObjectHandleOnStack type)
at System.RuntimeTypeHandle.Instantiate(Type inst)
at System.RuntimeType.MakeGenericType(Type instantiation)
The error occurs whenever I change something on the base forms and recompile the project. The only way to get the designer running again is to restart the whole project which takes between 2 and 5 minutes currently. It's just tedious.
The forms themself have a rather "big" inheritance structure: MyForm -> BaseDetailsForm<TService, TImplementation> -> BaseDetailsForm -> BaseSubForm -> (and from here on it goes into library territory).
I know that the designer itself can't handle generic classes very well that's why I have the generic and the non generic BaseDetailsForm as a workaround.
In the year 2018 with generics beeing around for quiet some time, is it really too much asked to get a designer which can handle that?