VS.Net 2005 Uses Wrong DLL For Reference

I just came across another bug in VS.Net 2005.

When I went to upgrade some of my projects from 2003 to 2005 I copied them to a new folder.  So for the sake of simplicity lets say that my projects were in C:Projects and the 2005 versions are in C:Projects2005.

Some of the projects had a reference to a DLL located in C:ProjectsMyDLL, so when you run the upgrade wizard, it adds C:ProjectsMyDLL as a reference path for your new project located in C:Projects2005.

Now here is what ticked me off.

I had already taken the code from MyDLL and upgraded it to 2005, built the DLL, and put the DLL in C:Projects2005MyDLL.

So if you convert a project, it doesn’t know about that new 2005 version of MyDLL, so I was nice enough to go in, remove the 2003 reference, and repoint it to the 2005 version.

However, at this point it says “Oh I see you want me to use this DLL, but it looks like there is one with the same (whatever criteria it uses, maybe just the name?) in my reference path (C:ProjectsMyDLL), so I’ll just throw out whatever you were asking me to do and reference that one” which is EXACTLY what I didn’t want it to do.

VS 2005: Remove Project=Lose Reference

I had been really bugged by the way VS.Net 2005 seemed to treate project references.

As I mentioned in a previous post, if you remove a project from a solution, all references to that project are also removed from their respective project.

The result is that lots of project suddenly lose reference to a needed dll or project, and you have to go back and manually add the reference back in.  Big pain.

Thankfully, Mikhail Arkhipov from Microsoft has reassured me that 1) I am not going crazy, 2) this is not by design as in fact a bug, and 3) it will be fixed in a (hopefully soon to be released) service pack. 

Strike 1 issue with VS.Net 2005.  Only like 10 more to go.

SEO

Search engine optmization is the efforts to increase a website’s ranking in the various search engines.

One site that I have been using, mostly for fun, is http://www.googlerankings.com which, unlike other sites that just tell you the page rank of your site, will allow you to provide a search term, and it will try to find your site on the google, msn, and yahoo. 

You just need to provide your Google API key:

Of course, finding that your site is number 836 for some search doesn’t really help you in any meaningful way, other than to know that no one is ever going to find your site through that search engine.

I was trying to see who my site is listed number 2 at MSN for “Chris May” but not even in the top 1000 at google or yahoo.  

Which Is Worse

Which is worse?

The fact that I spend so much time working at Borders, that when they hire a new barista I notice, or the fact that I spend so much time working at Borders that the new barista notices that I used to have a beard.

Ticketmaster Sucks!!!

OMG TicketMaster Sucks!!!

I just went to buy some tickets for The Secret Machines, and the tickets were 15 bucks each. 

I picked the FREE delivery option, and my order came to $72.30.  WHAT???  3 tickts @ $15 << $72.30.

So for a 15 dollar ticket, they add on a “facility charge” of another buck, then there is the “Convenience Charge” WTF is that BS?  Tax is only 1.50 but then they throw on a “Order Processing Fee” charge of 4.80?? What the hell is the difference between their Order processing fee, and their Convenience charge?  This is totally gay.

In the end my “tickets” cost 60% more than the cost of the “tickets”!!

Ticketmaster really sucks ass.  I hate them with a passion.

And how come I keep signing up to be notified when some bands go on tour and they never email me, those ass hats.

Item Charge
 
Full Price Tickets US $15.00 x 3
Facility Charge US $1.00 x 3
Convenience Charge US $6.25 x 3

Additional Taxes US $0.75
   
Delivery (Standard Mail) No Charge
Order Processing Fee US $4.80
Additional Taxes US $0.75
   
Total Charges US $72.30

Upgrading to 2005 Continuing To Be A Pain

I decided to go with Scott Gu’s suggestion to use Web Application Projects to help ease the conversion for 2003.

I will agree that this is a much better way to convert your project than to turn it into a Web Site Project, but there are still lingering problems.

In one of my projects the web page and code behind have somehow become lost.  The code behind pages can’t see their controls, which are placed in some mystery file thanks to the new Partial Class feature.

I tried ranaming the files, I tried cutting and then replacing the HTML that defines the controls, the only thing I found that works is to totally delete the file and recreate it exactly the same way.  What a pain.

The “What a pain” concept is the only constant in this process.

I am still not sure what is going on with project references. 

As far as I see, if there is a DLL in the bin directory, you don’t need a reference to that DLL.  But as soon as you clean out your bin, your project will break with error messages that are nothing like “Are you missing a reference?” because, of course you are, VS.Net just removes them all the time w/o asking you! 

There must be some new paradigm with how you are supposed to work with references, projects, and solutions, because trying to do it like you would in vs.net 2003 is causing a ton of problems.

Update: Almost as if VS was getting back at me, as soon as I posted this it took a crap and crashed.  🙂

University of Chicago First Grades

I just got my first set of grades from University of Chicago.  I got an A in OO Architecture and Design Patterns, and a B in Software Construction.

I think I couldn’t have done any better than a B in Software Construction.  The work was very challenging, in a good way, but the time requirement was so great that week after week I wasn’t able to complete the weeks assignment, or if I was able to complete it, my code wasn’t as strong as it could have been.

I am taking this quater off to focus on work, and I am not sure if I will be taking anything in the summer as they usually do the really basic classes then.  We will see. 

I probably still need to take some kind of discrete math class, but I don’t want to pay the $3600 bucks to take it at UofC if I can take it elsewhere for less.

Bret Martin and Katie Kniss Are Getting Married

Bret Martin and Katie Kniss

Bret Martin and Katie Kniss are getting married

I am going to see if I can get a googlewhack on Bret Martin and Katie Kniss, linking to this page.  Technically a googlewhack is 2 words that are in the dictionary, but I am expanding on this to include names.

Putting their names in some H1 and H2 tags at the top here should help with the Googlebot.

Bret Martin and Katie Kniss are getting married.

Actually, Katie is probably getting the raw end of this deal, she is going to have to put up with Bret for years to come. 

Same goes for Kathleen.  Sometimes I wonder if knew what she was getting herself into.  :-). 

The wedding is this summer in St. Louis, and I hear they are spending their honeymoon in Peoria.  Well not just Peoria… East Peoria. 

Update: Well I got my home page number 1 on the major 3 search engines:
Google
Yahoo
MSN

But they are only indexing my homepage right now, not the actual article link (Bret Martin and Katie Kniss).

VB.Net: Passing Reference and Value Objects ByRef and ByVal

Here is a little example of how vb.net deals with passing of objects ByRef and ByVal.  The short answer is that when you pass a reference type object (not a value type) byval, the object is copied back when the method if finished.  You never really have handle on the original object, which is evident by the fact that you can’t set it = nothing.  However, if you pass ByRef then you can indeed set the object = nothing and it will remain null when you return to the calling function.

If you try the same thing, except using a value type structure, you will see almost the same behavior, except for the major differenct that if you pass a structure byval and then make a change to it, those changes will not be copied back to the calling function.

To see an example of this check out the code by clicking on the “More” button to read the full article. 

You can take this code and run it as a console app to see the results, which should be:

SetNothingByVal: Object was not cleared
SetNothingByRef: Object was cleared
ChangeFieldByVal: Object WAS modified
ChangeFieldByRef: Object WAS modified
SetStructToNothingByVal was NOT able to null out the structure
SetStructToNothingByRef was able to null out the structure
SetStructToNothingByVal was NOT able to change the structure
SetStructToNothingByRef was able to null change structure

 

Imports Microsoft.VisualBasic
Imports System
Imports System.Collections

Public Class SomeObject
Public MyField As String
End Class

Public Structure SomeValueType
Public MyField As Integer
End Structure

Public Module MyModule

Sub Main()
RL()
TryToNullAnObject()

TryToModifyObject()

TryToNullStructure()

TryToModifyStructure()
RL()
End Sub

#Region "TryToModifyStructure"
Private Sub TryToModifyStructure()
Dim s As SomeValueType
s.MyField = 1
Call ChangeStructByVal(s)
If s.MyField <> 1 Then
WL("SetStructToNothingByVal was able to change the structure")
Else
WL("SetStructToNothingByVal was NOT able to change the structure")
End If
Call ChangeStructByRef(s)
If s.MyField <> 1 Then
WL("SetStructToNothingByRef was able to null change structure")
Else
WL("SetStructToNothingByRef was NOT able to null change structure")
End If
End Sub
#End Region


#Region "TryToNullStructure"
Private Sub TryToNullStructure()
Dim s As SomeValueType
s.MyField = 1

If s.MyField = Nothing Then
WL("before we even start, we are at nothing")
End If
Call SetStructToNothingByVal(s)
If s.MyField = Nothing Then
WL("SetStructToNothingByVal was able to null out the structure")
Else
WL("SetStructToNothingByVal was NOT able to null out the structure")
End If
Call SetStructToNothingByRef(s)
If s.MyField = Nothing Then
WL("SetStructToNothingByRef was able to null out the structure")
Else
WL("SetStructToNothingByRef was NOT able to null out the structure")
End If

End Sub
#End Region


#Region "TryToNullAnObject"
Public Sub TryToNullAnObject()
Dim o As New SomeObject

o.MyField = "test"
Call SetNothingByVal(o)
If o Is Nothing Then
WL("SetNothingByVal: Object was cleared")
Else
WL("SetNothingByVal: Object was not cleared")
End If
Call SetNothingByRef(o)
If o Is Nothing Then
WL("SetNothingByRef: Object was cleared")
Else
WL("SetNothingByRef: Object was not cleared")
End If
End Sub
#End Region


#Region "TryToModifyObject"
Private Sub TryToModifyObject()
Dim o As New SomeObject
o.MyField = "test"
Call ChangeFieldByVal(o)
If o.MyField = "test" Then
WL("ChangeFieldByVal: Object was not modified")
Else
WL("ChangeFieldByVal: Object WAS modified")
End If
Call ChangeFieldByRef(o)
If o.MyField = "test" Then
WL("ChangeFieldByRef: Object was not modified")
Else
WL("ChangeFieldByRef: Object WAS modified")
End If
End Sub
#End Region


#Region "Functions to do all the testing"
Public Sub SetNothingByRef(ByRef o As SomeObject)
o = Nothing
End Sub
Public Sub SetNothingByVal(ByVal o As SomeObject)
o = Nothing
End Sub

Public Sub ChangeFieldByRef(ByRef o As SomeObject)
o.MyField = "changed"
End Sub
Public Sub ChangeFieldByVal(ByVal o As SomeObject)
o.MyField = "changed"
End Sub

Public Sub SetStructToNothingByRef(ByRef o As SomeValueType)
o = Nothing
End Sub
Public Sub SetStructToNothingByVal(ByVal o As SomeValueType)
o = Nothing
End Sub

Public Sub ChangeStructByRef(ByRef o As SomeValueType)
o.MyField = 123
End Sub

Public Sub ChangeStructByVal(ByVal o As SomeValueType)
o.MyField = 123
End Sub
#End Region


#Region "Helper methods"

Sub WL(ByVal text As Object)
Console.WriteLine(text)
End Sub

Sub WL(ByVal text As Object, ByVal ParamArray args As Object())
Console.WriteLine(text.ToString(), args)
End Sub

Sub RL()
Console.ReadLine()
End Sub

Sub Break()
System.Diagnostics.Debugger.Break()
End Sub

#End Region

End Module