Showing posts with label Visual Studio. Show all posts
Showing posts with label Visual Studio. Show all posts

Wednesday, January 11, 2012

Define Catastrophic

Got this error in Visual Studio 2010 today:

Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))

In reality, I just tried to open a really big file, too big for memory apparently. Hardly a catastrophe. A simple Out of Memory error would have been good.

Saturday, December 31, 2011

ILSpy

I recently made the switch from .NET Reflector to ILSpy. As of this writing, ILSpy is at v1.0. The biggest drawback to me is the lack of Visual Studio integration and the lack of being able to specify an assembly on the command line. They have good plans for v2.0 so I'm anxious to see that release.

The download for ILSpy 1.0 is just a zip file with the binaries in it. You will have to copy them where you want them to be installed and create your own menu shortcut to it.

To install it as a tool in Visual Studio 2010, select the Tools / External Tools... menu item.

On the External Tools dialog box that opens, press the Add button to create a new tool.

Give it whatever title you want it to have in VS, and tell VS where it is located.
Now ILSpy will be on the Tools menu.

Friday, November 12, 2010

.NET Reflector Won't Integrate with VS 2008

I'm trying to integrate Red Gate's .NET Reflector v6.5.0.135 into my VS 2008 installation. It's supposed to work but it doesn't allow me to select my VS. Don't know what is up with that yet. When I figure this out I'll post about it. If you have figured this out please leave a comment.

Sunday, May 23, 2010

Ctrl+Click to Follow Link in Visual Studio

Yesterday, I had an accident on my mountain bike and ended up in the ER. Besides cuts and road rash, I also sprained my left shoulder, which is now in a sling. The sprain causes unbearable pain whenever I try to move my left arm. So, I am typing this with only my right hand, a new experience in itself.


I have dusted off an old Visual studio project to play with today. In one of the C# source files, I have a comment with a web link in it to refer to a website with more information.



In order to follow the link, you have to hold the Ctrl key down, then click on the link with your mouse. Go ahead and give that a try, using only your right hand! In all the years I've used VS, I've never considered this a usability issue before.

Someday, I will be healed up. But I won't forget this lesson in usability. Perhaps all software developers should go through an exercise where they are temporarily handicapped in some way and be forced to use their software. Could be enlightening.

Friday, September 18, 2009

Posting Code Snippets to Blogger

I want to be able to post code snippets and I found a little utility that integrates with Visual Studio 2008 called CopySourceAsHtml. This utility lets you select source code in a code window and copy it verbatim to the clipboard, which can then be pasted into the blog.

In this shot, I selected some source code, and right-clicked. I then chose Copy As HTML...



When you do this, the utility's dialog box appears allowing you to choose options. I have set options on two of the tabs.




On the File Style tab, I have added some more style settings for the  <div>  that it creates for the snippet.  The  overflow:auto  setting will add scroll bars as needed, the  white-space:nowrap  setting will turn off word-wrapping, the  height:500px  setting sets the box height to 500 pixels, and the  border:inset silver  sets the box's border style to inset with silver color.

When you press OK the HTML is placed on the clipboard and is ready to paste into the blog post.



For this to work, I also had to make a change to my Blogger template, otherwise the word-wrapping setting was ignored and was always on.



This is the final result:

  296                 else if (path.EndsWith(":"))
  297                 {
  298                     path += @".\";
  299                 }
  300                 else if (!path.EndsWith(@"\"))
  301                 {
  302                     path += @"\";
  303                 }
  304 
  305                 path = System.IO.Path.GetFullPath(path);
  306                 if (path == null)
  307                 {
  308                     throw new System.ApplicationException("GetFullPath() returned NULL unexpectedly.");
  309                 }
  310 
  311                 if (fileType == FileTypes.File)
  312                 {
  313                     // Special cases for when x.txt is truly a FileInfo, this code
  314                     // must come after the GetFullPath() call above:
  315                     //      c:\x.txt\
  316                     //          Path: c:\x.txt\
  317                     //          File: 
  318                     //      c:\x.txt\.
  319                     //          Path: c:\x.txt\
  320                     //          File: .
  321                     //      c:\x.txt\.\.\.\\\.\.\..\x.txt\\\\\.\.\.\..\x.txt\.\
  322                     //          Path: c:\x.txt\
  323                     //          File: 
  324                     //      c:\x.txt\.\.\.\\\.\.\..\x.txt\\\\\.\.\.\..\x.txt\.\.
  325                     //          Path: c:\x.txt\
  326                     //          File: .
  327                     //      c:\x.txt\.\.\.\\\.\.\..\x.txt\\\\\.\.\.\..\x.txt\.\.\\\
  328                     //          Path: c:\x.txt\
  329                     //          File: .
  330                     if (((fileName == string.Empty) || (fileName == ".")) &&
  331                         path.EndsWith(@"\"))
  332                     {
  333                         fileSpec = path.Substring(0, path.Length - 1);  // Make the new filespec be the earlier resolved Path minus the trailing \
  334                         path = System.IO.Path.GetDirectoryName(fileSpec);
  335 
  336                         if (path == null)
  337                         {

One thing I note is that you cannot easily copy text out of this window, because it doesn't have normal line ends. I am looking into how to remedy that. I do plan to post downloadable code when I post snippets. The other thing is that this is displaying with a Courier font, rather than Consolas as in Visual Studio.

Wednesday, September 16, 2009

I Have Perforce Source Control Now

I had been wanting to get source control for my home hobby projects for the last couple of months. I am most familiar with Visual SourceSafe since I first used it 14 years ago (We use Team System now at work). I've been following eBay auctions to try to get VSS cheap, like say $50, but I hadn't had any takers for this price. Thankfully, I gave up on the stupid VSS idea, and after some research decided to give Perforce a try. It is free for up to two users, which is exactly the price I wanted to pay. It also integrates with Visual Studio 2008. Of all of the components on their download page, I only downloaded and installed these three 64-bit ones:
  • P4D: Server
  • P4V: Visual Client
  • P4SCC: SCC Plug-in

The installs went smoothly. It wanted me to reboot, which I did. After rebooting, I went into the Perforce Visual Client P4V utility, then on the Tools / Administration menu I set myself up as a superuser. I accepted all of the defaults for everything, including the Workspace, which ended up being a problem later. I fired up Visual Studio and opened a solution that I wanted to add to source control. After opening the solution, I enabled the Source Control toolbar and selected Change Source Control.



This is where I ran into the only problem I had. When I tried to bind the solution to source control I got this error:

Path 'd:\Source\XLStoCSV/*' is not under client's root 'C:/Users/Alan/Perforce/EMACHINEST6520_1666/Alan_eMachinesT6520'.



I have a root folder where all of my programming projects are and figured that the problem was that I needed to make this be the root in source control. It was a little unclear how to do that though, but after some snooping around in P4V I found that I could edit the Workspace.



Earlier, I had accepted all of the defaults when setting Perforce up. I should have specified d:\source for my root.



After making this change, I went back to Visual Studio and retried binding the solution to source control. This time it worked just fine.



One more dialog came up to ask what to do if the files were already in source control. They weren't, of course, and I just took the default.



At this point, the icons on the project items were marked with the familiar yellow plus signs and could be checked in. Here's a screenshot of everything checked in. Elapsed time from download: 20 min. Very cool!

Wednesday, July 22, 2009

Micosoft Newsfeeds for Visual Studio

After I installed Visual Studio Standard Edition, I noticed that the installer left the newsfeed set to the Visual C# Express newsfeed. I looked around for the proper feed for the regular Visual Studio C# and found this:

MSDN: Visual C#

Other good feeds

MSDN: Visual Studio
MSDN: Visual C# Headlines

Visual C# Express feed

MSDN: Visual C# Express Edition

You can set the feed on the Start Page in Visual Studio by going to Options / Environment / Startup

Tuesday, July 21, 2009

Installed Visual Studio

Now that my computer is somewhat stable, I went ahead and installed the Visual Studio 2008 SP1 Standard Edition that I got on eBay a couple of weeks ago. It runs great so far. I have StyleCop installed and have been using it on a project. I have saved out the default settings that you can get if you ever need them, and have installed my own custom settings. I have used this color scheme for over a decade and it is similar to colors I used in VB 4.0 and Visual C++ 1.0 way way long ago. (Somewhere, I've still got the legendary Visual C++ 1.52c CD).



This setup uses the Consolas font, which is designed for programming environments. You can get it by following the link. It is also included in the ClearType Font Collection. You already have all of these if you have Vista or Office 2007.

Sunday, June 28, 2009

Got VS.NET on eBay

I just won an auction on eBay for Visual Studio 2008 Standard Edition, got it for $61, and I also redeemed an eBay 8% off promo coupon, so the final price was $56.12, with free shipping. Very cool.

I Want to Buy Visual Studio

Well, I have been using Visual Studio Express at home for a couple of years now, but I think it is time to buy it. The reason is because the Express versions do not support tools. The three main tools I am interested in right now are Resharper, StyleCop, and NUnit. I went to Microsoft's comparison page to compare pricing. Cheap that I am, I will go with the Standard edition, which is listed at $299. But I see that I qualify for the Renew option, at $199. From the page,
To qualify for upgrade pricing, you must be a licensed user of an earlier version of Microsoft Visual Studio or any other developer tool (including free developer tools, such as Visual Studio Express Editions or Eclipse).
Well, I'm using Visual Studio Express, so I guess I qualify.