Tuesday, December 23, 2008

Visual Studio 2008 unable to build due to corrupted XML documentation file in referenced DLL

Just resolved a vexing problem that does not seem to be described elsewhere. I have a Visual Basic application which references a DLL built by another VB project. A couple months ago the DLL generated an XML documentation file during one of the first build attempts on Visual Studio 2008. I only wanted to verify I could build so I didn't notice or care about the XML file.

When I later tried to build again the XML file could not be overwritten. I could not delete or rename the file as Administrator or any other user. I finally de-selected the XML documentation checkbox in the Project in order to generate new builds of the DLL

Today I was blocked from building a project that references that DLL. Each time I tried it would fail while trying to copy the XML documentation file.

I finally booted to safe mode and let the OS do a low-level disk scan (CHKDISK?). The system found and removed the corrupted XML document file.

I guess I should have tried looking at the disk earlier, I've never had a situation where even Administrator could not alter or delete a file (other than malware).

Can not recall how the XML file could have been corrupted, but I'd guess it was an aborted build. I found threads that mentioned the XML file gets renamed during the build process, and can get "sticky" if you abort a build, so maybe this was a manifestation of that.

Bottom line is if you ever get an error saying something like "access denied" when trying to copy, rename, overwrite, or change settings on the XML documentation file consider running CHKDISK or the like before dynamiting your computer.

Thursday, December 18, 2008

Word Mail Merge "Not Responding"

I ran into an issue doing a mail merge today that, while it falls into the user-generated DOH! category, is still worth documenting. The symptom was a totally non-responsive instance of Word when I tried to do the last step "Edit Individual Items".

I have about 140 items in the merge. I selected the "ALL" button to fixup some labels manually and save the file, but Word would never come back and I'd have to kill everything and start over.

The DOH! moment came when I finally tried selecting items 1 through 150 instead of ALL. Word came back quickly with the correct data. In hindsight it's obvious Word was reading too many records from Excel. I had applied formatting to a column (not just the cells with data), and I think that was what caused Word to read all 65,555 rows from the Excel file when I told it to merge ALL.

You can confirm this by scrolling down the items in the window that pops-up when you select a data source. You can apply a Filter (e.g. Company - not equal to - blank) at this stage to eliminate the ghost rows.


Wednesday, December 17, 2008

Ctrl+Alt+End to reboot over Remote Desktop

To reboot the remote PC in a Remote Desktop session use Ctrl-Alt-End rather than Ctrl-Alt-Del. On XP systems select "Shutdown" and you will get a choice whether to restart or go cold

Monday, December 15, 2008

"Toner Low" on Brother HL 4040 printer

Okay, it's not a VB note, but it's worth sharing. My Brother 4040 printer was refusing to print due to "Toner Low" on multiple cartridges. There was plenty of toner in the cartridge, of course, but blocking the sensor holes with electrical tape did not reset the alarm. After some hunting found this article that describes how to reset the internal page count for the cartridge. The specific instructions for the 4040 were buried in the article, so here they are:

(1) open front door
(2) hold down Cancel button
(3) press Reprint button

The Devices Reset menu appears. Arrow up/down to find your cartridge. I reset both H and S settings for both M and C cartridges

After closing the front door a "Drum Error" appeared. Rather than hunting down the cause I manually reseated both the M and C cartridges and the error disappeared.

Thursday, December 11, 2008

Located assembly's manifest definition does not match the assembly reference

I wanted to test a fix to a DLL referenced in a Visual Studio 2.0 web application project on Framework 2.0. I created a new DLL (v2.5.6) and copied it into the BIN folder of my web app, but kept a copy of the old DLL (v2.5.1) in place under a different name. I did this in case the fix didn't work, so I could easily revert.

I was surprised that Visual Studio failed, it found the renamed version 2.5.1 and threw a "located assembly's manifest definition does not match the assembly reference" error

Even though My Project, Refernces showed the correct version number for this DLL I tried removing the reference to the DLL and recreating it pointing to v2.5.6. VS threw the same error again

Simple fix was to delete the renamed older version from the BIN directory. DOH! I assumed the new DLL assembly would have a new GUID due to the new version, but apparently not.

Posting this because the most promising reference I found by searching on the error proposed a very technical solution, and this simple fix may help someone else quickly resolve this same type of error.

Access Denied error when building DLL - unable to set permissions on XML documentation file

Trying to build a Visual Basic DLL in Visual Studio 2008 was throwing an "access denied" error every time because the XML documentation file in the OBJ\Release directory could not be overwritten.

Ran into a brick wall trying to change owner of the XML file. I can't change the permissions on my own file as Administrator, WTF? Thanks MSFT for wasting more of my time with Vista!

Finally found a clue here that all I had to do was de-select the XML documentation option for the project, on the Project settings, Compile window.

I would like to know how that XML documentation got selected in the first place, possibly some auto-setting during the upgrade from VS 2005. Mystifying because the DLL built fine after the upgrade, but a couple months later when I edit the code and try to rebuild it fails.

Monday, December 8, 2008

Changing default browser in Visual Studio 2008

The command to reset the default browser in VS2008 is obvious once found, but not the easiest to find when you need it. This article explains where to find it (right-click on ASPX file, select "browse with") but did not mention that you need an ASPX file in a website project. ASPX files in my web application project did not show the browse menu. If your upgrading web projects from VS2003 you typically will choose a web application type project rather than a website project, and you may miss this.

Friday, November 14, 2008

Flickering cursor when viewing help

Symptom: when you hit F1 to access help the cursor on the doc explorer window flickers continuously.

MSFT says it's a bug.

A workaround is suggested here, you switch options from "online only" to "Local first, then online", and remove the "Codezone" and "Questions" online targets. I found it works at first, but fails on subsequent searches.

Clicking on the scroll bar seems to work better, it stops the flicker in VS2008 Pro on my Vista box

VS2008 does not allow multiple select

TOTALLY INCOMPREHENSIBLE decision by VS2008 product management, but you cannot select more than one control on a web form in Visual Studio 2008.

Microsoft confirms this in a couple places, like here (scroll to bottom, note the correction to the documentation) and here

WTF? Can you release an IDE that doesn't support multiselect? I guess so.

Maybe it's the same product managers who added UAC to Vista? Who else could release "enhanced" security that you disable to make the operating system usable.

Wednesday, October 22, 2008

IIS 7 - virtual directory on Framework 1.1 can fail if Default Website on 2.0

I have seen a couple of failures in IIS 7 on Vista when running a virtual directory on Framework 1.1 under the Default Website, when the default site is on Framework 2.0.

The most recent failure occured after upgrading the source for the virtual directory. Yesterday the same site worked fine, after today's upgrade the mappings for Framework 1.1 were lost. Did not delete the directory, just an in-place upgrade of a few ASPX files.

Restored the 1.1 mappings by running aspnet_regiis from the 1.1 directory. To be safe I put the default directory on 1.1 as well.

Maybe this is documented somewhere? I have not run into anything mentioning this yet, but in hindsight it seems prudent to have both on 1.1.

Monday, October 20, 2008

Visual Studio 2008 - what's in what version

At this point in time Microsoft has contradictory information posted about what features are included in the Standard versus Professional editions of Visual Studio 2008. The main page says one thing, and the downloadable 35 page PDF comparison of features says another.

The 35 page comparison where 98% of the items agree is virtually useless. Is MSFT trying to bury us in useless info so we just throw up our hands and buy the more expensive edition? Certainly looks like it.

Two things I could not clarify: are the menus redacted in Standard? Are you limited to a single (ClickOnce) deployment method in Standard?

The template for web unit testing is NOT included in Pro, for that you need Test Edition.

Friday, October 17, 2008

Windows service recovery - enable actions for stops with errors checkbox

I'm baffled by the meaning of the check-box on the windows service recovery tab with the text "Enable actions for stops with errors"

The only Microsoft documentation I can find on it says "Select Enable actions for stops with errors in order to trigger the recovery actions that the service stopped with an error". What a great example of Ambiguish, a sub-type of English

The requirement is to have the service restart every time. A nightly anti-virus scan seems to be conflicting with the service occasionally, perhaps while accessing the DB or the logfile. Given the recurring but temporary nature of this conflict we need to be sure there's nothing blocking the service from restarting.

I ran some tests where I blocked access to the log file to trigger service failure. Bottom line, the service recovers the same whether or not the checkbox is selected. Maybe I need to reboot the PC to see the effects? At this point I'm just happy to confirm that the service restarts as many times as needed, and will move on.

Configuration Manager: the specified device instance handle does not correspond to a present device

Working with a service created in Visual Studio 2008 I started getting this cryptic error message. Can't recall exactly when it first appeared but it was probably after manual edits to the registry to add a dependency or to recreate the service. No loss of functionality so I put off fixing it for a couple days.

The solution is very simple, in the registry delete the "Enum" subkey for the service, then close and re-open the services console and the message should be gone.

Saturday, October 11, 2008

Visual Studio 2008 setup project says it requires .NET Framework 3.5

Just did my first setup project on visual studio 2008 from scratch rather than upgrade. The msi on the target machine said "this setup requires the .NET Framework version 3.5", even though the solution targets 2.0 exclusively.

Solved by right-clicking on the setup project, View, Launch Conditions. Then edit the properties of the Requirements on Target Machine=>Launch Conditions=>.NET Framework node. Default is 3.5

Upgraded setup projects defaulted to 2.0 after I selected that as the default general behavior for upgrading projects targeting 1.1

Tuesday, September 30, 2008

Cut and paste is disabled in Remote Desktop session

A quick reminder of the counter-intuitive setting to enable cut and paste functionality on a remote PC during a Remote Desktop Connection sessions.

Open the RDC window to start a connection. Before connecting, cick on Options, select Local Resources tab, and DE-select the "clipboard" checkbox under the heading "select resources you want to use in your remote session".

Now you will be able to use normal cut/paste functionality on the remote PC.

Thursday, September 25, 2008

Timer on a new thread attached to a windows service disappears after 10 minutes

I created a visual basic windows service application in Visual Studio 2005 which needed a timer to fire every 10 seconds. I found an example showing how to attach a timer in a new thread to the service which worked fine during development.

Then I installed on a test system and the timer would fire for 10 minutes and then disappear and the service would stop working. Stopping consistently at ten minutes was a clue.

There was no succinct explanation, but Garbage Collection came up in reference to unattended threads. The timer on a new thread was eligible for GC if it was not referenced periodically. The solution was simple, make the timer handle a global variable, and referencing the handle each time the timer handler invokes.

Public Class My_Scheduler_Service

Dim tDelegate As Threading.TimerCallback
Dim oTimer As System.Threading.Timer

Protected Overrides Sub OnStart(ByVal args() As String)
tDelegate = AddressOf TimerFireEvent ' my timer handler
oTimer = New System.Threading.Timer(tDelegate, Me, 0, iTIME_INTERVAL)

end sub

Public Sub TimerFireEvent(ByVal sender As Object)

'reference timer to avoid Garbage Collection
If (oTimer Is Nothing) Then
System.IO.File.AppendAllText("C:\Log.txt", Now.ToString() & ": oTimer = nothing" & vbCrLf)
System.IO.File.AppendAllText("C:\Log.txt", Now.ToString() & ": oTimer OK" & vbCrLf)
End If

Posting this because Garbage collection impact on a new timer thread was not something I saw clearly in documentation or examples.

Thursday, September 11, 2008

Visual Studio 2005 MSI install fails on Vista - "Installation Incomplete"

Built an MSI on the Web Setup Project template in Visual Studio 2005 on my Vista dev machine and tried to install to a Vista Home Premium machine. The MSI quickly stops and says "Installation Incomplete", without any useful feedback.

I created a log file, the fatal error code was 1603 but that didn't lead to much help.

Tried Windows Installer Cleanup Tool, no help. Tried upgrading to Installer 4.5, no help. Finally I remembered a post that mentioned IIS 6 compatibility being required for some MSI packages (http://forums.karamasoft.com/ShowPost.aspx?PostID=6495). I had ignored it since I was building on Vista with IIS7, and installing to Vista with IIS7, but of course....

Went to Control Panel, Programs & Features, Add/Remove Windows Component - turned on all the IIS6 compatibility options and retried the MSI. Installs clean now.

Lesson? I believe since Visual Studio 2005 was released at the time of IIS6 it still relies on the old API, so keep this in mind when installing web setup projects to Vista boxes.

How to create a log file for an MSI install

I built an MSI using a Visual Studio 2005 web setup project. This type of project is a simpler install than a web application project, but there is no way to pick the target folder for the install.

An article explains how to modify an MSI (http://www.codeproject.com/KB/install/ChangeVDirWebSetupProject.aspx), but at the end of the process the new MSI is generating errors trying to install on a Vista Home Premium machine.

I had a bit of trouble generating a log file, so here is the working example:

c:Installs>msiexec /i MyPackage.msi /l* MyLog.txt

this generates a local file log in MyLog.txt

Wednesday, September 10, 2008

Parser Error Message: Could not load type 'WebApplication1.Login'

This type of error popped up when porting a Visual Basic 2003 web project to become a Visual Studio 2005 web application project.

This was due to Webapplication1.dll being installed in wrong folder. Quick fix was to move Webapplication1.DLL from application folder into bin. Refresh the browser and it loads fine.

The longer term fix is in the setup project, right-click, View, File System - then move the DLL from the web app folder into the bin folder