Validating C# base class constructor parameter

After running Code Analysis in VS2010 beta (FxCop for previous versions) I’m getting the following warning: In externally visible method ‘Identity.Identity(WindowsIdentity)’, validate parameter ‘windowsIdentity’ before using it. The constructor is: public Identity(WindowsIdentity windowsIdentity) : base(windowsIdentity.Token) { init(); } for a class defined as: public class Identity : WindowsIdentity My question is, how do I validate … Read more

Eclipse & C/C++ – do I need to install a compiler separately?

I’m starting to learn C, and installed the eclipse plugin for C/C++ development (the CDT plugin). I’m testing the setup with a hello world program, but it looks like the eclipse C plugin (CDT) doesn’t have a compiler built in. I thought eclipse plugins were usually self-sufficient? Do I need to install a compiler separately … Read more

How can I create NUnit tests with ReSharper?

I’m trying to get into unit testing with C#. Various people told me to go with NUnit since it’s better than MSTest (apparently, I have no idea) and it also has very good support in ReSharper which I’m using. Now I’ve never written a unit test before in my life (bear with me, I’m a … Read more

Why do I get the following error? Invalid variance modifier. Only interface and delegate type parameters can be specified as variant

using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Variance { class A { } class B : A { } class C<out T> { } class Program { static void Main(string[] args) { var v = new C<B>(); CA(v); } static void CA(C<A> v) { } } } Answer This is the offending line: … Read more

what is the best way to synchronize container access between multiple threads in real-time application

I have std::list<Info> infoList in my application that is shared between two threads. These 2 threads are accessing this list as follows: Thread 1: uses push_back(), pop_front() or clear() on the list (Depending on the situation) Thread 2: uses an iterator to iterate through the items in the list and do some actions. Thread 2 … Read more

HTTP 407 proxy authentication error when calling a web service

I’m working on a .NET app that calls 3rd party web services over the internet. The services do not use SOAP, so we manually construct an XML request document, send it to the service via HTTP, and retrieve an XML response. Our code is a Windows service that is run in the context of a … Read more