Recently, an annoying bug came up. The problem with this one isn't necessarily my code but relies on Visual Studio.
Whenever I open a .xaml file, the IDE crashed right away. Without giving any instructions.
I read a lot of "fixes" on the internet, yet, none really explained what the problem was. And they did not seem to work either.
I attached a debugger and investigated what the inner problem was. Just a side note, my program compiles perfectly. But when I view the .xaml file in Visual Studio's design manager, it crashed.
Assume we got the following code behind:
The design manager tries to apply real-time changes, and runs through the code. Checks the active thread in it's pool and sees it is occupied. Still, very strange VS can't handle with it and triggers a ProcessKill event. The following data got registered in the event log:
Where the StackTrace exactly shows the problem:
Now the fix, let the Designer decide what code to process:
Hope this helps.
Regards.
Whenever I open a .xaml file, the IDE crashed right away. Without giving any instructions.
I read a lot of "fixes" on the internet, yet, none really explained what the problem was. And they did not seem to work either.
I attached a debugger and investigated what the inner problem was. Just a side note, my program compiles perfectly. But when I view the .xaml file in Visual Studio's design manager, it crashed.
Assume we got the following code behind:
Code:
ThreadPool.QueueUserWorkItem(s => { var data = proxy.GetData( );
MyControl.Overview.Dispatcher.Invoke( DispatcherPriority.Normal, TimeSpan.FromSeconds(1),
new Action( delegate( ) {
MyControl.Set( data );
}
) );
} );
The design manager tries to apply real-time changes, and runs through the code. Checks the active thread in it's pool and sees it is occupied. Still, very strange VS can't handle with it and triggers a ProcessKill event. The following data got registered in the event log:
Code:
Application: devenv.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.InvalidOperationException
Where the StackTrace exactly shows the problem:
Code:
Stack:
at System.ServiceModel.Description.ConfigLoader.LoadChannelBehaviors(System.ServiceModel.Description.ServiceEndpoint, System.String)
at System.ServiceModel.ChannelFactory.ApplyConfiguration(System.String, System.Configuration.Configuration)
at System.ServiceModel.ChannelFactory.ApplyConfiguration(System.String)
at System.ServiceModel.ChannelFactory.InitializeEndpoint(System.String, System.ServiceModel.EndpointAddress)
at System.ServiceModel.ChannelFactory`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]..ctor(System.String, System.ServiceModel.EndpointAddress)
at System.ServiceModel.EndpointTrait`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].CreateSimplexFactory()
at System.ServiceModel.ClientBase`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].CreateChannelFactoryRef(System.ServiceModel.EndpointTrait`1<System.__Canon>)
at System.ServiceModel.ClientBase`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].InitializeChannelFactoryRef()
at System.ServiceModel.ClientBase`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]..ctor()
at MonopolyServiceClient..ctor()
at Monopoly.Connector.Gateway..ctor()
at Monopoly.Connector.Gateway.get_Instance()
at Monopoly.UserControlLibrary.LobbyPlayGame.Refresh_Callback()
at System.Threading.ThreadHelper.ThreadStart_Context(System.Object)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
at System.Threading.ThreadHelper.ThreadStart()
Now the fix, let the Designer decide what code to process:
Code:
public void Initialize( ) {
if ( DesignerProperties.GetIsInDesignMode( this ) )
return;
RunThreadPool( );
}
Hope this helps.
Regards.