@@ -13,31 +13,62 @@ namespace Rubberduck.CodeAnalysis.Inspections.Concrete
1313    /// This inspection warns about references to the default instance of a class, inside that class. 
1414    /// </summary> 
1515    /// <why> 
16-     /// While a stateful default instance might be intentional, it is a common  source of bugs and should be avoided . 
16+     /// While a stateful default instance might be intentional, when  it isn't it's easily a  source of bugs. 
1717    /// Use the Me qualifier to explicitly refer to the current instance and eliminate any ambiguity. 
18+     /// Global state accidentally stored in a class' default instance is not shared by all other instances of that class. 
1819    /// </why> 
1920    /// <example hasResult="true"> 
21+     /// <module name="Module1" type="Standard Module"> 
22+     /// <![CDATA[ 
23+     /// Option Explicit 
24+     ///  
25+     /// Public Sub Test1() 
26+     ///     UserForm1.Show ' the default instance is being shown 
27+     /// End Sub 
28+     ///  
29+     /// Public Sub Test2() 
30+     ///     With New UserForm1 
31+     ///         .Show ' a new instance is being shown 
32+     ///     End With 
33+     /// End Sub 
34+     /// ]]> 
35+     /// </module> 
2036    /// <module name="UserForm1" type="UserForm Module"> 
2137    /// <![CDATA[ 
2238    /// Option Explicit 
2339    /// Private ClickCount As Long 
2440    ///  
2541    /// Private Sub CommandButton1_Click() 
2642    ///     ClickCount = ClickCount + 1 
27-     ///     UserForm1.TextBox1.Text = ClickCount 
43+     ///     UserForm1.TextBox1.Text = ClickCount ' only TextBox1 on the default instance is affected  
2844    /// End Sub 
2945    /// ]]> 
3046    /// </module> 
3147    /// </example> 
3248    /// <example hasResult="false"> 
49+     /// <module name="Module1" type="Standard Module"> 
50+     /// <![CDATA[ 
51+     /// Option Explicit 
52+     ///  
53+     /// Public Sub Test1() 
54+     ///     UserForm1.Show ' the default instance is being shown 
55+     /// End Sub 
56+     ///  
57+     /// Public Sub Test2() 
58+     ///     With New UserForm1 
59+     ///         .Show ' a new instance is being shown 
60+     ///     End With 
61+     /// End Sub 
62+     /// ]]> 
63+     /// </module> 
3364    /// <module name="UserForm1" type="UserForm Module"> 
3465    /// <![CDATA[ 
3566    /// Option Explicit 
3667    /// Private ClickCount As Long 
3768    ///  
3869    /// Private Sub CommandButton1_Click() 
3970    ///     ClickCount = ClickCount + 1 
40-     ///     Me.TextBox1.Text = ClickCount 
71+     ///     Me.TextBox1.Text = ClickCount ' always works as expected  
4172    /// End Sub 
4273    /// ]]> 
4374    /// </module> 
0 commit comments