maandag 14 december 2009
VS 2008 performance update
Hacking Visual Studio to Use More Than 2Gigabytes of Memory: "editbin /LARGEADDRESSAWARE devenv.exe" (Eerst DEVENV.exe backuppen!!)
Een andere optie is om MSBuild te gebruiken. Via de onsupported optie /m kunnen meerdere processoren gebruikt worden.
(Bron). Je moet dan wel een custom tool hiervoor aanmaken.
woensdag 17 juni 2009
How to: Disable and Enable Unit Tests Visual Studio
Your product build contains a bug that causes a crash. This bug is located in code that one of your tests exercises. This test is one of many that are run in sequence. Because of the crash that this test indirectly triggers, your test run cannot move past that test in the sequence. The solution is to file a bug on the code that crashes, and disable the test until the bug is fixed. Then, the test sequence can progress beyond that one test.
A specific test in a test run uncovers a bug, which you file. To keep from repeatedly finding the same known failure every time that you run the test selection, disable the test.
Note:
Remember to re-enable a test when its associated bug is fixed.
If you run a test list that contains disabled tests, only the enabled tests within that test list, if any, will be run. If a test list does not contain any enabled tests, the test list itself is disabled.
Using the Ignore Attribute with Unit Tests
Using the Ignore Attribute describes how to mark a unit test method with the IgnoreAttribute attribute. Using this attribute changes the availability of the test, but it differs in the following ways from the other way to disable and enable tests:
As described in Disabling Tests and Enabling Tests, you can use the Test List Editor to disable and enable tests of any type. But the Ignore attribute can be applied only to a test method. This means that you can apply the Ignore attribute only to unit tests.
The flag for enabling and disabling tests is stored in the test metadata file.
The Ignore attribute for a unit test resides in the source file of the unit test, together with the other attributes and source code of the test. This means that, if you disable a unit test in the Test List Editor, and later run the test by using the MSTest.exe command-line utility, the test still runs. But if you mark a unit test with the Ignore attribute, compile the assembly, and then run the test by using MSTest.exe, the test does not run. It does not run because the Ignore attribute has become part of the test.
These two approaches are used in different scenarios:
Ignore attribute. You are a developer who authors both production code and test code. You are in the middle of making a large set of changes, and you know that one of your unit tests will be broken for a while. Therefore, when you check in the test, you mark it with the Ignore attribute to indicate that you do not expect it to work.
Disable and enable. You work in a build lab and you do not have access to the source code of the tests you are running. In this case, you can use only the enable and disable capabilities of the Test List Editor.
Disabling Tests
To disable tests
To disable one test, in the Test List Editor, right-click an enabled test and then click Disable. To disable multiple tests, highlight the enabled tests you want to disable, by pressing CTRL or SHIFT when clicking the tests' rows. Next, right-click the selected rows and then click Disable.
- or -
Select the test in the Test List Editor or the Test View window and press F4 to display the Properties window. Then, set the value of the Test Enabled property to False.
Enabling Tests
To enable tests
To enable one test, in the Test List Editor, right-click a disabled test and then click Enable. To enable multiple tests, highlight the disabled tests you want to enable by pressing CTRL or SHIFT when clicking the tests' rows. Next, right-click the selected rows and then click Enable.
- or -
Select the test in the Test List Editor or the Test View window and press F4 to display the Properties window. Then, set the value of the Test Enabled property to True.
Using the Ignore Attribute
To use the Ignore attribute
Open the unit test to edit its source code. To do this, in the Test List Editor, double-click the unit test.
The source code file that contains the unit test opens.
Add the IgnoreAttribute attribute to the unit test.
The test is disabled. In the Properties window, the Test Enabled property is automatically set to False. To learn more about the scope of this action, see the previous section "Using the Ignore Attribute with Unit Tests."
To re-enable the test, delete or comment out the Ignore attribute.
Reference: msdn
woensdag 7 januari 2009
Visual designer Inheritance
I've got quite a few problems with the visual designer (WinForms) in Visual Studio. First of all there is the limitation that forms/user controls cannot be inherited & edited when using Generics. The workaround of making a subclass of that form/usercontrol without generics and inherite again from it works fine.
My abstract form with generics:
public abstract partial class UO_Lijst<T> : UserControl where T: BusinessObject, new() |
Directly deriving from it like this:
public partial class UO_User : UO_Lijst<User> |
has the problem that it cannot be visual edited. A workaround is to put (in a seperate file) the next code:
public class __UO_User : UO_Lijst<User> {} |
After that you can derive from this class and you can edit visually.
public partial class UO_User : UO_Lijst<__UO_User> |
Secondly the inheritance of forms is only used at the time of creating the inherited form. Changes that are made later on in the parent aren't automatically put in the descendents. This can be a problem that only exists in case of the workaround described above. The workaround for this is after the InitializeComponent() call the base.InitializeComponent(), open the design mode. The visual is changed an the base.InitializeComponent() can be removed.