Live semantic errors

by Juan 15. August 2008 10:11

One of the new features that came with Visual Studio .NET 2008 SP1, is the real-time compiler errors (feature I read VB developers have had for a long time).

So if you type something wrong, you see it without having to compile

image

I've been working with it for two days, and I definitely don't like it, it distracts me to have errors appearing and disappearing all the time, it doesn't even let you finish writing the line, it shows an error when there isn't one (I just need to finish the line please!). I found myself trying to type faster to avoid seeing the "error".

I'm sure they had good intentions.

Luckily, almost anything can be turned off, you just need to find it.

If you go to Tools > Options > Text Editor > C# > Advanced, and uncheck "Show live semantic errors", it works like before, only showing hints

image

I will go back to the old ways with this one...

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , ,

Programming | Tips

Creating template projects with visual studio

by Juan 16. July 2008 10:48

As part of the development framework we are creating here in Iceberg I wanted to create a base web site that developers could use as a starting point, with themes, master pages, and some default properties set in the web.config file to use our database and membership engines.

My initial thought was to create it, and then have them copy/paste it to start a new web site, until I came across the "Export template..." feature in visual studio.

Basically what it does is package a project or item so it can be reused, exactly what I wanted.

Let's test it... first I create a project

image 

And I added a few items, just to not let it the same as the default project

image

Then I go to File, Export template

image 

You are presented with this self-explanatory dialog box

image

You click next, then finish, and that's it... you can add a new project and select this template as many times as you want (You can set a custom Icon and a Description if you want, play a little with this options if you like)

image

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , , , ,

Programming | Tips

Friend Assemblies

by Juan 27. June 2008 17:08

Today I was designing some unit tests for a project here at work, and needed to access some helper methods (mostly constants) to check the output of a few methods, and was happy to discover this attribute.

With InternalsVisibleTo you can specify which assembly, if any, other than the current one, can "see" information marked as internal.

As I said, it's very useful when designing tests, or for example if you want some component to be accessed only by another (the same use you give to internal, but expanding across several assemblies)

You can use it at assembly level like this

[assembly: InternalsVisibleTo("JMF.Tests")]

Where JMF.Tests is the Assembly Friendly Name

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , , ,

Programming | Tips

yield "I love CSharp"

by Juan 11. June 2008 10:19

I found a nice and clear post about the c# yield keyword, I know a lot of you know about its existence, but a lot also don't as it's a little hidden from everyday programming practices.

It's here since .NET 2.0 (and I don't know if even before), and basically it's useful to return values you can iterate through, without the need to create a collection or array and returning it instead...

This is not really supported by the .NET runtime, it's a c# specific keyword, it gets translated to IL the same way it would if you return a collection and iterate through it

Check it out!

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , , ,

Programming | Tips

Debugging in Design-Time with VS.NET 2008

by Juan 9. June 2008 15:38

When you are working with control designers (or, for any reason) you sometimes have the need to debug class libraries in design time, and doing it is very easy.

To show you how easy it is, I created a sample solution consisting of a class library and a windows forms project.

The class library only has a custom Button, with only one property, like this

The Windows forms project contains a form, with my button

All you need to do is set the class library as the startup project, and set it to start with another instance of Visual Studio.NET.

Right click on the class library project à properties à debug à Start External Program

The default install directory for Visual Studio.NET 2008 is C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe

Press F5, and open your test solution when VS.NET loads.

And that's it! To test it, set a breakpoint in the property setter in the original instance of VS.NET and open the form containing the button from the second instance, it will stop when the designer tries to set the property

I originally did it with ASP.NET (I wanted to see how exceptions were handled in design time, to catch them, and show them formatted in red in the control designer of my controls), so it works perfectly with it too.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , , ,

Programming | Tips

Powered by BlogEngine.NET 1.4.5.7
Theme by Mads Kristensen Modified by Juan Manuel Formoso

About the Author

Juan Manuel
Networking
View my LinkedIn profile View my Technorati profile View my Facebook profile View my bookshelf
View my Plaxo profile View my digg profile

Juan Manuel Formoso
There is a theory which states that if ever anyone discovers exactly what the Universe is for and why it is here, it will instantly disappear and be replaced by something more bizarrely inexplicable.

There is another theory which states that this has already happened.

E-mail me Send mail

Ads

Most comments

Cristian Pereyra Cristian Pereyra
3 comments
ar Argentina
Miguel Miguel
2 comments
us United States
Ariel Ariel
1 comments
ar Argentina
Mauro Mauro
1 comments
ar Argentina
Daniel Daniel
1 comments
mx Mexico

Google Reader Picks

Calendar

<<  August 2008  >>
MoTuWeThFrSaSu
28293031123
45678910
11121314151617
18192021222324
25262728293031
1234567

View posts in large calendar

Recent posts

Recent comments

Comment RSS

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in  anyway.

© Copyright 2008
XFN Friendly