If you are encountering this issue with your CI process and using NCover here is a fix:
http://ncover.org/SITE/forums/thread/43.aspx
Details:
After playing around with NCover 1.5.1 beta 2 I was seeing the "Profiled process terminated. Profiler connection not established." error when running under a limited user account. The account was a member of Debugger Users, but that was all. There was no Coverage.log file being produced, and after a minute or so NCover would fail with the "Profiler Connection not established" error message. In order to get NCover to work under this account I had to do the following:
Set account's registry permissions
Key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment
Permissions:
Query Value
Set Value
Create Subkey
Enum Subkeys
Notify
Read Control
Re-register the CoverLib COM component
Run "regsvr32 coverlib.dll" from the directory where NCover is installed. This will need to be run from an administrator account.
I tried re-registering coverlib.dll since the COM registry entries seemed to only exist in HKCU for the Administrator's account rather than in HKLM.
I'm guessing that the installer only installs NCover for the current user (i.e. Administrator) rather than for all users, but I could be totally wrong.
Here is a block in my tasks section of my ccnet.config file. When searching around I couldnt find out the exact markup anywhere so I thought I would share it.
<exec>
<executable>C:\Program Files\NCover\NCover.Console.exe</executable>
<baseDirectory>c:\working\SampleApp</baseDirectory>
<buildArgs>c:\nunit\bin\nunit-console.exe SampleApp.nunit /xml:nunit.xml //x NCoverSampleApp.xml //w c:\working\SampleApp</buildArgs>
<buildTimeoutSeconds>360</buildTimeoutSeconds>
</exec>
Scott Stauffer with the local SQL Pass group managed to get Donald Farmer up to Vancouver for the meeting last night. If you don’t know Donald, he is the PGM at Microsoft for the Sql Server Business Intelligence Platform.
I have to say Donald is one of the more entertaining presenters I have had the opportunity to listen to live. His insights into the product drawing from real-world examples really help clear up the subject matter. This guy really knows his stuff!
The group hit record attendance last night as well, just under 100 people. Nice to see so many SQL junkies in my area.
There were two folks there (forgive me if I don’t get your names correct), Sergio and Michael that worked on a side project which they wanted to get more exposure into the community. I guess they have an ecommerce application ready to go. If one of you are reading this, use the Contact link to get ahold of me and we can talk about getting you guys a slot of time for the Vancouver Code Camp.
I also have been contemplating creating a SQL Track for the Vancouver Code Camp as well. The only problem is that I do not have enough SQL Presenters. I would need to find 6 people that are willing to give a session in that track. If you are interested please contact me ASAP. I’m going to hit up Donald and see if he can pass this request off to anyone/everyone in the SQL group at Microsoft. If not, there is always next year!
I will post pictures once Scott gets around to sending them.
EDIT: New Pictures Added
It seems to me that one of the most underused, but very useful classes is the System.IO.Path class. It has a bunch of static methods which are extremely valueable when dealing with file system paths. Use it instead of doing some string parsing hack jobs!
Here is a list of methods:
ChangeExtension : Changes the extension of a path string.
***Combine : Combines two path strings.
***GetDirectoryName : Returns the directory information for the specified path string.
GetExtension : Returns the extension of the specified path string.
***GetFileName : Returns the file name and extension of the specified path string.
GetFileNameWithoutExtension : Returns the file name of the specified path string without the extension.
GetFullPath : Returns the absolute path for the specified path string.
GetPathRoot : Gets the root directory information of the specified path.
***GetTempFileName : Returns a uniquely named zero-byte temporary file on disk and returns the full path to that file.
GetTempPath : Returns the path of the current system's temporary folder.
HasExtension : Determines whether a path includes a file name extension.
IsPathRooted : Gets a value indicating whether the specified path string contains absolute or relative path information.
More information here:
http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemIOPathClassTopic.asp
The instructor covered more of bare bones C# stuff. To tell you the truth, this is how I taught myself C# as well. I opened up notepad and started typing. Copied examples from online sources (the few that was available back then), and use the csc.exe compiler to start compiling down my code. I think this process is great for everyone to understand. It really shows them the background of what VS.NET hides from you, and what options that may not be so visible in that IDE.
Allot of the OOP specific keywords were covered. sealed, inheritance, override, virtual, new, abstract, base, this, interfaces, the is operator, const vs readonly, arrays, switch (cascading rules), break, documentation generation, commenting, foreach, System.Convert, try/catch/finally, looping constructs, string class, tryparse(), using “@” with string literals, System.IO, MapPath(), reading and writing text files, close, dispose, file uploading; The “Main” entry point in a console application. A simple windows form application, which shows a basic MesageBox.
Next they got an introduction to some of the more common .NET Namespaces, and what the heck namespaces are in the first place! (think java packages). Oh and how to import the assemblies with the “using” keyword and the /r switch on the compiler.
More information I felt could benefit the students
ref vs out : http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-334.pdf (Section 8.3)
Here are portions of that section:
A reference parameter is used for “by reference” parameter passing, in which the parameter acts as an alias for a
caller-provided argument. A reference parameter does not itself define a variable, but rather refers to the variable of
the corresponding argument. Modifications of a reference parameter impact the corresponding argument. A
reference parameter is declared with a ref modifier.
The ref keyword shall be used in both the declaration of the formal parameter and in uses of it. The use of ref at the
call site calls special attention to the parameter, so that a developer reading the code will understand that the value of
the argument could change as a result of the call.
An output parameter is similar to a reference parameter, except that the initial value of the caller-provided
argument is unimportant. An output parameter is declared with an out modifier.
For value, reference, and output parameters, there is a one-to-one correspondence between caller-provided
arguments and the parameters used to represent them.
params keyword:
Also in Section 8.3 of the ECMA Specification
A parameter array enables a many-to-one relationship: many arguments can be represented by a single parameter
array. In other words, parameter arrays enable variable length argument lists. A parameter array is declared with a
params modifier. There can be only one parameter array for a given method, and it shall always be the last
parameter specified. The type of a parameter array is always a single dimensional array type. A caller can either pass
a single argument of this array type, or any number of arguments of the element type of this array type.
You can also find more on all three of these (out, ref, params),in more detail, in Section 17.5.1 of the spec.
When to call Dispose()
The easiest way to find out this answer is to go a quick google search: http://www.google.com/search?q=when+to+call+dispose The recommended best practice is to ALWAYS call dispose. So be careful and start watching out for the Dispose() method and call it!
aspnet_regiis
During the session we were shown a demo which the IIS Application was set to use v1.1 of the .NET Framework. This class is focusing on v2, using Visual Studio 2005, so there was a big bad error on the overheard. The instructor intentionally did this in order to show the students exactly what the error meant, and how to fix it. He actually had to login as admin to modify IIS. I wanted to add that the students could have simply used aspnet_regiis to fix the issue. Dump to a DOS command prompt. Make sure that the SDK binaries are in your path, or just use the “SDK Command Prompt” which should be in your start menu. Type in “aspnet_regiis /?” to get a complete listing of all switch’s.