Yogesh Jagota's Personal Blog
small c# code snippets and free code libraries

Debugging: Setting breakpoint options

Tuesday, 26 February 2008 01:50 by Yogesh Jagota

I have came across many people who are programming using Visual Studio but still do not know that there are many debugging options exist. Mostly these people are new to programming, but I have also seen veterans who are uninformed about this life saving feature of Visual Studio. So I thought I should write about the feature.

You can set a breakpoint by clicking at the extreme left strip of your text editor or press the shortcut F9 key. After a breakpoint is se, you just right click the breakpoint marker of the strip and you are presented with many options, which are:

Location shows the point where the current breakpoint is set. It shows current file, line number and character position. The option "Allow the source code..." allows you keep stepping even if you make changes to the source code.

 

Condition allows you to make the breakpoint hit only if a certain condition is hit. In this example, we can make the breakpoint hit when i is equal to 9 making the breakpoint skip the first 8 times when it is reached.

 

Hit Count allows you to make the breakpoint hit only at a given reached count or after a number of times it has been reached.

Filter allows you to make the breakpoint hit only when it is reached inside a particular process or thread.

When Breakpoint Is Hit option can be described as a post-breakpoint-hit-action type of option. It allows you to set one or more actions to execute when a breakpoint is hit.

Although I assume most people will know this, if even some people learn anything from this I am happy that I shared this because when I myself started programming using Visual Studio, I did not knew about this option for a long time, almost two months and I wondered how to stop the execution only when the value of x is y. Glad that I did found about it sooner than later.

Del.icio.usDigg It!DZone It!kick it on DotNetKicks.com
Tags:  
Categories:   Visual Studio
Actions:   E-mail | Permalink | Comments (1) | Comment RSSRSS comment feed

Excel Xml Library 2.45 released

Wednesday, 20 February 2008 01:49 by Yogesh Jagota

Excel Xml Library version 2.45 is released.

Fixes from 2.43

  • 2.45: Fixed a error where GetValue<T>() was not accepting string and DateTime types. Thanks to Karl for pointing this out.
  • 2.44: Fixed a error where assigning 0 to a Cell caused a exception. Thanks to Ralf for pointing this out.

New Features

  1. Complete Import of Excel Xml files are supported. All the formulae are parsed to Formula instances and all formula parameters which are ranges or formulae are parsed to their respective instances. If a formula cannot be parsed, it is not lost. It is saved as a unresolved value and is exported as it was previously stored, with no error at all.

  2. Modification of a book is now possible using many Insert, Delete and Addition functions available in ExcelXmlWorkbook, Worksheet and Row classes.

  3. If any modification is done, all the ranges in the book (stored as formula parameters or stored as direct cell references in others cells) automatically update their respected cell references. If a range contains a cell which is deleted, the range returns #N/A.

  4. Empty cells are not written to the file. ss:Index attribute is used instead to bypass empty cell references.

  5. Cell now contain a ContentType readonly field which can be used to check what value type the cell contains. Available values are String, Number, Boolean, DateTime, Formula, UnresolvedValue. UnresolvedValue can be retrieved by using GetValue<string>(). Look below to learn about GetValue<T>.

  6. Worksheets can be accessed via Worksheet names.

  7. Rows can also be hidden now just as cells.

  8. The library is divided into two parts. A Yogesh.ExcelXml library and a Yogesh.Extensions library. The later contains a multitude of extension and helper functions for strings, enums, files etc. More on this very library very soon. Although you only need to make a reference of Yogesh.ExcelXml library to work, the other library i.e. Yogesh.Extensions needs to be present in the same directory.

For a full brief list of features, look here. For a detailed feature set, download the documentation from the page mentioned.

Breaking Changes

Changes which will break previous code when used with this new version are: 

  1. Output file or stream is not passed when the ExcelXmlWorkbook instance is created. It is passed with Export instead.

  2. Export method now only takes the output file or stream. If any error occurs, the function simply returns false and there is no way to find out what error occurred. No retry message box is displayed as was displayed previously. So the preferred way of export is to pass a stream because it gives you more control with error management.

  3. Cell's Value property is now a write only property.

  4. LogicalValue, NumericValue and DateTimeValue are no longer available. A new readonly property GetValue<T> is added which returns the cell value converted to the type supplied. You can use ContentType with GetValue<T> to retrieve the exact value of a cell. GetValue<T> enables strict type checking when retrieving a cell value. Further, if the type supplied with GetValue<T> does not matches the type of the cell type, default(T) is returned instead. For example: if a cell's ContentType == ContentType.Numeric, the only way to retrieve value of the cell is to supply byte, sbyte, int, uint, ... etc. If a cell's ContentType == ContentType.String, the only way to retrieve value of the cell is to supply string. You got the idea!!

  5. DataSetToWorkbook takes only DataSet as a parameter now.

  6. External book references are now not allowed. Previously you could write code like this:

    <
       1:  ExcelXmlWorkbook book1 = new ExcelXmlWorkbook();
       2:      ExcelXmlWorkbook book2 = new ExcelXmlWorkbook();
       3:      book1[0][0,0] = book2[0][0,0];

    Now you cannot.

See the updated library usage page for more information on how to use the library.

Downloads

Del.icio.usDigg It!DZone It!kick it on DotNetKicks.com
Tags:  
Categories:   Excel Xml Library
Actions:   E-mail | Permalink | Comments (9) | Comment RSSRSS comment feed

Solution level Auto build increment Add-In

Sunday, 10 February 2008 00:18 by Yogesh Jagota

AutoBuildIncrement's updated version's (1.11) details and download is available from details page (source also available on the same page).

You can also directly download the visual studio installer via this link: AutoBuildIncrement.vsi (15.20 kb), if you know what is the add-in all about.

Del.icio.usDigg It!DZone It!kick it on DotNetKicks.com
Tags:  
Categories:   C# | Open Source | Visual Studio
Actions:   E-mail | Permalink | Comments (14) | Comment RSSRSS comment feed