Visual Studio 2008 toolbox loads slowly on large projects…

I am working on a very large project that has 70+ assemblies and dozens of different user controls. Every time I open up the Forms designer to work on a Form, it takes a ridiculously long time to do so. I just assumed this was my machine being underweight for the project.

So fast forward to today. I happen to have reset my workspace so my toolbox wasn’t set to auto-hide. As I opened up my Form to work on it,  I notice the Toolbox start flickering and loading all the controls in the project. Hmmm….Looks like we found why the Form load is so slow. Why on earth it takes up to minutes to read all the controls in the application is mind boggling, but now I know it does it sets me on the path to fix it.

After researching the settings in Visual Studio, I find this little hidden gem.

Tools->Options->Windows Forms Designer->General->AutoToolboxPopulate

Set this bad boy to False and you get rid of the annoying lag.  You will not get the controls to appear automatically in your toolbox now though, so be aware of that. You will need to add them manually. Oh, the horror. The horror……. Ha.

Enjoy the savings of time and hair pulling.

Autopopulate option

Windows 7, Cassini and Firefox run slow as molasses together…..

I have been developing on Windows 7 64-bit for a couple of weeks now and really like the Windows 7, but wow have my web applications run slow. I figured I would debug the issue later as maybe it was my data layer running slow. Each time I would execute a page refresh, load, navigate, whatever, it would take 2 seconds. Doesn’t seem like much, but when you click a button on a page 2 seconds is a very long time to watch it hang.

So, after getting sufficiently annoyed and impatient I was able to find that it was my app but was Firefox. Apparently Firefox has some sort of issue with IPv6.

The fix is amazingly simple.

  • In the address bar type ‘about:config’
  • Filter by ‘v6’
  • Disable ipv6 support.
Screenshot of option to disable/enable
Screenshot of option to disable/enable

Thanks to Peter Gregory for the help.

Value is not valid for OracleType when setting to 0 in .NET…..

So you thought you could do a an easy new OracleParameter(“p_id”, 0) and have it work, right? Well, that would be too easy.

If you do that, you get a nice nastygram from the class:.

'new OracleParameter("p_id", 0)' threw an exception of type 'System.ArgumentOutOfRangeException'
 base {System.ArgumentException}: {"Value is not valid for OracleType: 0.rnParameter name: oracleType"}
 ActualValue: null
Message: "Value is not valid for OracleType: 0.rnParameter name: oracleType"

So, how do you fix this? Easy enough, but goofy.

int zero = 0;
var param= new OracleParameter("p_ID",zero);

This works quite well. Oh yeah, casting 0 to int doesn’t work either. I know you were thinking about it. (int)0.

WCF Service failing with “The server has rejected the client credentials”. Why doesn’t the server like me?

I spent the past couple of days dealing with faultexceptions being thrown by our WCF service that was being consumed by our Indian team. It worked for all the US teams, but for some reason the Indian team kept getting faultexceptions on the service. The proxy seemed to disguise the error and was throwing an error about the channel being in a faulted state.

So down the rabbit hole I go. I created all sorts of test rigs; to no avail. I finally get a developer to build a debug version so we can drop right into the code. He is able to find an inner exception saying, hey, I don’t like your credentials. The service didn’t have any authentication on, so I thought.

Well, lesson to be learned is the TCP services seem to default to windows security mode. Yes, surprising as it is, if you don’t set the security configuration you get windows authentication. What does this mean? As soon as a person outside of your domain tries to invoke the service, they get their butts handed to them. No service for you!

So, how  do you fix this? Easy, simple config change. Not one piece of source code needs to change.
Remember, you must change the binding on the SERVER and the CLIENT.

<system.serviceModel>

    <client>

      <endpoint address               = "net.tcp://localhost/MyService"

                binding               = "netTcpBinding"

                name                  = "MyService"

                bindingConfiguration  = "myBinding"

                contract              = "IMyContract" />

    </client>

    <bindings>

      <netTcpBinding>

        <binding name="tcp_ myBinding ">

          <security mode="None"></security>

        </binding>

      </netTcpBinding>

    </bindings>

  </system.serviceModel>

So if you look at the config above, the key is the Security Mode tag. You need to go to your client and server bindings and set this to None.

<security mode="None"></security>

Once you have that set, ON BOTH SIDES, your non-domain users can actually start calling your WCF service. Remember to restart the service after you make the configuration file changes!

ASP.NET State server won’t start on Windows 7 64 bit. File is missing?

I went to launch my state server for ASP.NET to handle my local sites state information, in preparation for production, and the service just wouldn’t play nice. I tried to start it and it says the file doesn’t even exist.

Good times, right? So I went into the registry to see where it was pointing..%SystemRoot%Microsoft.NETFrameworkv2.0.50727aspnet_state.exe  (Yes, the path is visible on the service control properties as well)

I checked the disk and surprise surprise, it actually wasn’t there. However, there is this suspiciously obvious looking folder called Framework64. AHAH! You look in there and voila! It is in there.

Looks like the framework installer sucks. So I fixed the key and it magically started working. Amazing how when you point to the actual file it works,eh?

The fix is to change this:
HKEY_LOCAL_MACHINESYSTEMCurrentControlSetservicesaspnet_state
key: ImagePath
%SystemRoot%Microsoft.NETFrameworkv2.0.50727aspnet_state.exe
to this:
%SystemRoot%Microsoft.NETFramework64v2.0.50727aspnet_state.exe

Happy coding!

Windows 7 is officially bad ass…………

I got a virus on my Windows Vista machine that caused it to run slower than all holy hell. I decided, well, now must be the time to upgrade my OS. No one ever wants to go through the new OS nightmare of having to reinstall every program they use. Especially not a guy in the IT field that uses a whole lot more than just Office.

So, I went full out and put on Windows 7 64-bit. Oh yeah. I finally get all 4 gigs of my ram. I expected the OS to be pretty much Vista with a new name.

Luckily, its not. I have only had it installed for about a day now but I see all sorts of little changes that make my experience SOOOO much better.

The themes are really cool. The desktop background rotates a nice image  every hour or so. I definitely like the variety, but thats not my big happy change.

The UAC is a lot more friendly than it used to be. I like the prompts as it make me feel a bit in control, but in Vista I disabled UAC altogether because nothing worked when it was on. Windows 7, not a problem. I run Visual Studio 2008 and don’t have any of the Vista issues I had.

The biggest thing I found I like so far is the taskbar. I am not only able to “pin” my programs to it, which is a great timesaver, but I can pin my documents to the program as well. I open and close the same 4 documents all the time. Now, its easy to pop into the word icon and go right to my document. Great time saver.

The other major timesaver I use is the ability to see all the windows for a process when I click on the taskbar icon. It is so much easier to figure out what IE window I want to go to or explorer folder when I can see the image of it at a glance. 

Windows 7 gets my vote as a great new OS for productivity. Vista is a smelly pile of crap once you get used to the new Windows.

EntityDataSource and Relationships, why oh why did you not bring along my relationship?

I spent about 3 hours cursing up a storm over some data binding I was doing using the EntityDataSource against my Entity Framework context. I was feeling lazy and using the declarative data sources to bind against my grid for some automatic operations.  So, should be easy right? Slap on the data source, bind to the grid, add the other data source for the lookups and bind that to the column.

So why was my column always showing the wrong value? Hmm….It was always the first value in the list? hmm…So I thought my grid was defective and went down the route of beating it up. The kicker was I could edit the record, and the newly set value would go into the database. It would never reflect on the grid though. This was rediculously annoying.

I finally gave up and created a new data source and ran my own Linq on the context to pull the objects. Thats when the Ah HA! moment came. I typed my INCLUDE off the context to pull the relationships in.

WAIT! You tell me. Wasn’t that on the data source setup wizard screen when you said pick all the properties? NO. No it isn’t. All the relationships are missing as selectable items on that screen. I guess the EntityDataSource is not usable in these scenarios then, right?

Wrong. After banging your head on the wall a few more times, you gingerly go to the properties window of the EntityDataSource object you created. You delicately go to the Include property and type in the name of the property.

What a pile of crap! I spend 3 hours and multiple rewrites to figure out I could have typed the 8 characters in on the property window and been good to go.

Well, it all works now. I just wish that option would have been in the wizard. If I am going the lazy route with declarative bindings, I want to be able to go full lazy.

Crazy day of travel..

I hopped on my ridiculously early flight to Colorado Spring this morning and was happy to get an exit row seat. About 5 minutes before departure from the Tampa airport(TIA) two security guards board the plane. Routine check, right?
Nope. They begin talking with a passenger in the back of the plane and then escort him off.

Freaky, right? So we are all left with the though of wtf? Why was this guy escorted off the plane.

We take off and land at Houston then I board this plane called the Continental Express for Colorado Springs. What a tiny piece of crap. My head hit the ceiling and the seats were so small I had to disengage my arm rest to fit my legs. Anyway, I arrive safe and sound at the Colorado Springs airport.

I checked in at the Broadmoor hotel. This is an amazing hotel by the way. Fast forward to the me having drinks at the bar at midnight. I talk with a few people and find out that General Petraeus is staying here. I thought that was pretty interesting.

But wait…..Whats more interesting?

I met a lady who was sitting by the fire outside who said she was a famous author that was going on Opera and the Jay Leno show. She was smashed out of her mind and said she was marrying the gentleman with her because he had saved her from a racoon. Can’t make this up folks. She had met him that night and decided they must be married.

Suffice it to say, plastered plastered plastered. So, I will be watching Leno to see if she really is as much a crackpot as I think or if I get proven wrong.

Its 3am in my time zone, so good night.