Match assemblies and PDB files

pdb_filePart of our build process is to save the PDB files to a file share. This way we can debug the assemblies when needed. Without the correct PDB this is not possible, even with the sources available.

Visual Studio matches the assembly to the PDB with a GUID embedded in the files. Using dumpbin the GUID can be found for the assembly. Reading the GUID from the PDB file with a HEX editor is not so easy.

The CHKMATCH tool from debuginfo.com does the heavy lifting when checking for a match. Simply provide the assembly and the pdb file. The result is Matched or Unmatched (and the reason)

chkmatch

References

Dumpbin usage
PDB format visible with HEX editor
CHKMATCH tool

Posted in Tooling | Tagged , | Leave a comment

Week roundup

Last week recap and links:
Image courtesy of kanate / FreeDigitalPhotos.net

Image courtesy of kanate / FreeDigitalPhotos.net

What are your best reads this week? Leave them in the comments below.

Posted in Uncategorized | Tagged , , , | Leave a comment

Swapping SSD between Windows 8.1 and Mavericks

The diskspace on my MacBook was running out. I decided that my HP would had the give up his bigger SSD in favor of the MacBook. But now I was swapping disks from different size, different formatting and different OS. In Windows I booted from VHD on MacOSX I just used the out-of-the-box way. Here’s how I managed to get it all done within an afternoon.

works-on-my-machineDo this at your own risk! I have a copy of my HP on an extra external HDD and a timemachine backup of my MacBook just in case.

Move HP to spinning disk

I booted the HP from the Windows 8.1 bootable installation usb stick. The spinning disk in the external USB3 case was attached during boot. The internal disk got drive letter C (as expected) and the spinning disk drive letter E.

Using robocopy I copied everything from my internal disk to the (clean formatted) spinning disk. This took about 20 minutes for 109 Gb. After robocopy completed the task I swapped the disks, putting the SSD into the USB3 case and the spinning disk in the HP.

robocopy_cursial_m4

Again I booted HP from the Windows 8.1 usb stick. This time I made the VHDX bootable again by using the bcdboot command explained in step 4 of Boot to VHD on Microsoft technet library.

Now I have a HP booting to a VHD on a spinning disk. Very slow, but it works. I can proceed to the next step without worrying about not being able to do my work on monday.

Move MacBook to bigger SSD

With the bigger SSD from the HP in the USB3 case I booted the MacBook with the ALT (Option) key pressed. In the menu I selected the recovery boot option and started the Disk Utility. I tried to do the restore while being booted into MacOSX, but that is not supported.

In the Disk Utility I repartitioned the bigger SSD with one partition and set the GUID Partition Scheme to make it bootable. After the partition was created I started the restore from the internal SSD to the bigger SSD in the USB3 case. Unfortunately my MacBook (Early 2009) only has USB2 ports and the restore took about 2 hours for 112 Gb. After the restore completed I left everything in its place.

disk_utility_intel_ssd

Again I booted with the ALT key pressed. Now I started the bigger SSD in the USB3 case to make sure everything was working. I was pleased to see all is well. Then I swapped the SSD with the bigger SSD.

Now I have a MacBook booting from a bigger SSD with all my stuff on it.

Move HP to SSD

The final step was to put the SSD in the HP and the spinning disk back into the USB3 case. Again I booted from the Windows 8.1 bootable installation usb disk with the USB3 case attached during boot, the SSD was already inside the HP.

First I had to format the SSD and make it bootable. This was handled by diskpart from step 3 of Boot to VHD on Microsoft technet library. Then another robocopy job to get the files from the spinning disk onto the SSD. Again this took about 20 minutes, since my HP has USB3 ports.

robocopy_cursial_m4

With all files in place I only had to make the VHD bootable and I booted the HP from the Windows 8.1 usb stick again. Like before with the spinning disk I followed step 4 of Boot to VHD on Microsoft technet library. Once booted into Windows 8.1 I cleaned up the boot item list with bcdedit and another successful weekend project was completed.

Caveats

  • Robocopy tripped over my encrypted files. I excluded the encrypted directories with /XD. After that I manually copied the directories from within Windows.
  • Robocopy also tripped over my onedrive files. I didn’t even realize I had those, but apparently Windows 8.1 cannot live without this. The files cannot be accessed by the system? I also excluded the onedrive with /XD, but didn’t manually copy them.
  • When I made the VHD bootable with the USB3 case attached everything failed. I learned to only have the Windows 8.1 bootable installation usb stick attached during this phase.

Details

SSD – Cursial M4 120 Gb
Bigger SSD – Intel 330 180 Gb
Spinning disk – 320 Gb 7200 rpm
Windows 8.1 bootable installation usb stick – Imation usb2 8Gb
USB3 case – Icy Box

References

Boot to VHD on Microsoft technet library.
Restore on apple discussion.

Posted in Tooling | Tagged , , , , | Leave a comment

WCF over net.tcp with server certificate: Identity check failing

We support using net.tcp and require our users to supply the certificate to use. The service works as long as the address and the DNS name of the certificate match. When using an other name (localhost, ip address) an MessageSecurityException is thrown:

Identity check failed for outgoing message. The expected DNS identity of the remote endpoint was ‘NAME_IN_ADDRESS’ but the remote endpoint provided DNS claim ‘NAME_IN_CERTIFICATE’. If this is a legitimate remote endpoint, you can fix the problem by explicitly specifying DNS identity ‘NAME_IN_CERTIFICATE’ as the Identity property of EndpointAddress when creating channel proxy.

Reading the message I assumed that this would require a change at the service, but the client/proxy needs to be updated. Since we program the proxy in stead of generating we are in full control. The changed constructor of our CustomProxy in the code below

static EndpointIdentity Identity {
    get { return new DnsEndpointIdentity("NAME_IN_CERTIFICATE"); }
}
public CustomProxy(Binding binding, string address) :
    base(binding, new EndpointAddress(new Uri(address), Identity)) {
   // other constructor code
}

Now the service is accessible from the dns name, localhost, ip address and other mapped names.

Posted in Development | Tagged | 2 Comments

Week roundup

Last week recap and links:
Image courtesy of kanate / FreeDigitalPhotos.net

Image courtesy of kanate / FreeDigitalPhotos.net

What are your best reads this week? Leave them in the comments below.

Posted in Uncategorized | Tagged , , , , | Leave a comment