StackOverflowException using logger on a command line

Using msbuild.exe, version 2.0.50215.44, I'm attempting to build a .sln from the command prompt. If I let the generated output go to the console, the project builds fine. I then try to attach a logger, at which point msbuild fails. The info on the command line states "Process is terminated due to a StackOverflowException."

After building the logger, I drop the file under c:. The program call looks like this:

msbuild.exe <solution_name> /logger:SimpleLogger2,c:\SampleLogger2.dll

My logger code looks like this:

using System;
using System.Collections.Generic;
using System.Text;

namespace SampleLogger2
{
public class SampleLogger2 : Microsoft.Build.Framework.ILogger
{
public string Parameters
{
get { return Parameters; }
set { Parameters = value; }
}

public Microsoft.Build.Framework.LoggerVerbosity Verbosity
{
get { return Verbosity; }
set { Verbosity = value; }
}

public void Initialize(Microsoft.Build.Framework.IEventSource eventSource)
{
}

public void Shutdown()
{
}

}
}

Am I perhaps calling msbuild incorrectly? Or maybe something isn't quite right with the logger? (I had more stuff in the logger, but pulled it when I began having problems.) Any thoughts would be appreciated.

[1746 byte] By [Plitog] at [2008-3-7]
# 1

Nevermind. I was trying to use the ILogger class based on an earlier MSBuild error message I was receiving. I instead used Microsoft.Build.Utilities.Logger and it is working correctly. My new code (which appears to be working)

using System;
using System.Collections.Generic;
using System.Text;

using Microsoft.Build.Utilities;

namespace SampleLogger2
{
public class SampleLogger2 : Logger
{

public override void Initialize(Microsoft.Build.Framework.IEventSource eventSource)
{
}

}
}

Plitog at 2007-9-9 > top of Msdn Tech,Visual Studio,Visual Studio MSBuild...
# 2

Plitog,
Your stack overflow is not because you were implementing ILogger directly. It was because your verbosity and parameters properties are calling themselves:

public Microsoft.Build.Framework.LoggerVerbosity Verbosity
{
get { return Verbosity; }
set { Verbosity = value; }
}

Did you get this logger from one of our samples or documentation? If so please let us know so we can fix it!

Dan

DanMoseley at 2007-9-9 > top of Msdn Tech,Visual Studio,Visual Studio MSBuild...
# 3

Don't recall what code I started with, but it wasn't from MS samples or docs. It was likely a stupid copy/paste error on my part. Thanks for the info.

Plitog at 2007-9-9 > top of Msdn Tech,Visual Studio,Visual Studio MSBuild...

Visual Studio

Site Classified