rspec/rules/S3005/csharp/comments-and-links.adoc

51 lines
2.4 KiB
Plaintext
Raw Normal View History

=== On 2015-06-08T08:43:39Z Tamas Vajk Wrote:
LGTM
=== On 2015-06-15T12:39:35Z Tamas Vajk Wrote:
\[~ann.campbell.2] Based on [~dinesh.bolkensteyn]'s comments I've changed the description a bit. Also, with this wording it is more like a bug than a maintainability issue. So I've modified the severity as well. I didn't change the SQALE characteristic, do you see any better option?
=== On 2015-06-15T15:03:19Z Ann Campbell Wrote:
\[~tamas.vajk] as written, 'Critical' is not currently appropriate for this rule. If we're going to increase the severity, then the description needs to show why it's 'Critical'. What mistakes will this misunderstanding have lead the developer to make?
=== On 2015-06-16T09:15:33Z Tamas Vajk Wrote:
\[~ann.campbell.2] I've updated the description to be more bug-oriented.
=== On 2015-06-16T11:17:19Z Ann Campbell Wrote:
\[~tamas.vajk] my 5 minutes with Google did not reveal the significance of ``++ThreadLocal++``. How is it relevant here?
=== On 2015-06-17T07:16:29Z Tamas Vajk Wrote:
\[~ann.campbell.2] I can understand that you couldn't find a lot of info on ``++ThreadLocal++``. It is only part of .Net 4, and it is probably rarely used.
If you have a ``++ThreadStatic++`` non-``++static++`` field, that behaves as a normal non-``++static++`` field. So the attribute is useless on it. You should remove it (first compliant solution). But what if you want a non-``++static++`` field that can store different values based on the thread we are using it from. Then you can use the ``++ThreadLocal++`` class (second complaint solution).
Check out the below code:
----
var m1 = new MyClass();
var m2 = new MyClass();
m1.Count = 5;
m2.Count = 7;
Task.Factory.StartNew(() =>
{
m1.Count = 6;
m2.Count = 8;
Console.WriteLine(m1.Count);
Console.WriteLine(m2.Count);
}).Wait();
Console.WriteLine(m1.Count);
Console.WriteLine(m2.Count);
----
It writes to the console ``++6,8,5,7++``. We have two instances of ``++MyClass++``, we set the ``++Count++`` to different values (the field is not static). Then start a new thread, and set the ``++Count++`` again to different values. In the new thread and in the main thread the ``++Count++``s have different values even for the same objects.
=== On 2015-06-17T12:50:37Z Ann Campbell Wrote:
Okay, your turn [~tamas.vajk]. :-)
=== On 2015-06-17T13:13:58Z Tamas Vajk Wrote:
\[~ann.campbell.2] Thanks, it looks good, I'll run it through [~dinesh.bolkensteyn], and we'll see what he thinks.