XML Method comments are not being displayed by intellisense for methods of classes other than those in the same project.
Any referenced DLL must have the XML file which contains the comments in the same directory as the DLL itself.
This blog is a record of some development issues I have faced. There may be something of use!
XML Method comments are not being displayed by intellisense for methods of classes other than those in the same project.
Any referenced DLL must have the XML file which contains the comments in the same directory as the DLL itself.
Had a problem where I was creating a partial mock then calling a method of the partial mock which was returning 0 (zero).
The base method was not being called even though no expectations had been setup.
The reason for this was that the ReplayAll (and VerifyAll) methods of Rhino Mocks was not being called.
Original code:
_interestBiz = _mocks.PartialMock<InterestBiz>();
int baseDay = _interestBiz.GetBaseDaysFromAccount(account);
Assert.AreEqual(365, baseDay, "Incorrect base days");
Fixed code:
_interestBiz = _mocks.PartialMock<InterestBiz>();
using (_mocks.Record())
{
}
using (_mocks.Playback())
{
int baseDay = _interestBiz.GetBaseDaysFromAccount(account);
Assert.AreEqual(365, baseDay, "Incorrect base days");
So even though no expectations were set Rhino Mocks needs to no this.
Using ThreadSafeQueue class as list of items to process.
Class used as a worker, takes list as parameter, creates a thread to run in.
public class MyWorker
{
private Thread _myThread;
public Thread WorkerThread
{
get { return _myThread; }
set { _myThread = value; }
}
ThreadSafeQueue<int> _listOfNumbers;
public string NumbersProcess = string.Empty;
int total=0;
public MyWorker(ThreadSafeQueue<int> listOfNumbers)
{
_listOfNumbers = listOfNumbers;
_myThread = new Thread(new ThreadStart(this.DoProcess));
}
public void DoProcess()
{
int _localInt=0;
do
{
if (_listOfNumbers.TryDequeue(out _localInt))
{
total = total + _localInt;
NumbersProcess = NumbersProcess + _localInt.ToString() + ", ";
}
} while ((!_listOfNumbers.NoMoreItems) ||
(_listOfNumbers.NoMoreItems) && (_listOfNumbers.Count > 0));
}
}
Calling process creates 5 workers then populates list, then waits for workers to finish processing:
//Queue to hold numbers to process
ThreadSafeQueue<int> listOfInts = new ThreadSafeQueue<int>();
//5 worker objects (threads)
MyWorker[] workers = new MyWorker[5];
for (int i = 0; i < workers.Length; i++)
{
workers[i] = new MyWorker(listOfInts);
workers[i].WorkerThread.Start();
}
//Populate list to process
for (int i = 0; i < 1000; i++)
{
listOfInts.Enqueue(i);
}
//Flag that no more items will be added to queue
listOfInts.NoMoreItems = true;
//Wait for workers to finish then display details
foreach (MyWorker worker in workers)
{
worker.WorkerThread.Join(); //Wait for worker to finish processing.
tbxDetail.Text=tbxDetail.Text+string.Format("Numbers processsed {0} \n",worker.NumbersProcess);
}
tbxDetail.Text = tbxDetail.Text + string.Format("\n\n");
See full discussion here
public myClass() : base()
class myClass
{
public myClass()
{
//No parameters
}
public myClass(string param1) : this()
{
//No parameters will be called before me!
}
}
has a SelectedValue which is invalid because it does not exist in the list of item