Reputation: 39
I am learning write my own user controls , and i find that when i throw exception during designer view, Visual studio 2017 will stop working.
I created a user control called "ColoredProgressBar" .
When AnimationStyle was set to ProgressBarAnimationStyle.Instantly and TextStyle was set ProgressBarTextStyle.AnimationPercentage then the class will throw a
InvalidStyleCombinationException(this is my custom exception).
Here is my code :
private void Timer_Tick(object sender, EventArgs e)
{
try
{
// . . .
if (this.AnimationStyle == SUPEXFunction.UI.ProgressBarAnimationStyle.Instantly && this.TextStyle == SUPEXFunction.UI.ProgressBarTextStyle.AnimationPercentage)
{
this.AnimationReachedValue = 0;
InvalidStyleCombinationException a = new InvalidStyleCombinationException("ProgressBarAnimationStyle.Instantly and ProgressBarTextStyle.AnimationPercentage can't exist in same time .");
throw a;
}
// . . .
}
catch (Exception ex)
{
throw;
}
}
public ColoredProgressBar()
{
this.First = true;
this.SetStyle(ControlStyles.UserPaint, true);
this.timer.Interval = 1;
this.timer.Start();
this.timer.Tick += new EventHandler(Timer_Tick);
}
Is this a bug of VS 2017 ? How can i fix this without remove the exception ?
Upvotes: 1
Views: 391
Reputation: 51
Your code has nothing to make VS 2017 to crash , No infinite loops nothing as I can see. Try updating your VS2017 with the latest update 2 days ago. It will work just fine.
Upvotes: 0