Friday, November 27, 2009

Syncfusion GridDataControl and referencing other columns

I was using the Syncfusion GridDataControl in WPF and needed to reference a different column from within the column I was in, so that different attributes could be set based on other columns.  Found out from the SyncFusion Form support center that it's pretty easy.  Just set the Binding Path as follows:
 
Binding Path=Record.Data.OtherColumnName

WPF form and debugging data

I never realized just how painful it can be to debug data that should (or should not) display on a XAML form.  I bound a XAML form to a DataSet.  There was a problem with one of the columns in the dataset that caused problems with the XAML form.  But since there is no way to step through the debugger on the XAML, there was no way to figure out what the specific data was that was giving me problems.
 
The problem was solved through a Converter.  I discovered you can put a breakpoint on a converter, then view your data.  In my case, I had no need of a converter, so couldn't set up a breakpoint.
 
The solution was to add a special converter.  This one did not do any actual conversion--it simply returned the passed value.  But it gave me a simple way to put a breakpoint.
 
Below is the converter code:

class LogObjectDataConverter : IValueConverter
{
#region IValueConverter Members
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
   
return value;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
return value;
}

Thursday, November 19, 2009

0x8007001f from ClickOnce install/upgrade

 This has got to be the most painful thing to come across on a ClickOnce install.  Error messages are almost meaningless and Google searches produce nothing useful.  I'm documenting my torment in finding a solution in the event someone else comes across the same thing.
 
The problem was first encountered when we updated one third-party dll.  The error produced during install or upgrade was :
 
System.Deployment.Application.InvalidDeploymentException (ManifestLoad)
  - Exception occurred loading manifest from file <dllfilename>.dll: the manifest may not be valid or the file could not be opened.
 
Further down the log was:
 
 
System.Deployment.Application.InvalidDeploymentException (ManifestParse)
  - Parsing and DOM creation of the manifest resulted in error. Following parsing errors were noticed:
 
 
And finally:
 
 
System.Runtime.InteropServices.COMException
  - A device attached to the system is not functioning. (Exception from HRESULT: 0x8007001F)
 
I sent an email to the third-party vendor's support department for help, and they gave me a checklist of things to try.  Unfortunately, they were of the "if all else fails, blow it away and restart from scratch" nature--if the pc had other ClickOnce applications installed, they would also be blown away in following their instructions, and neither I nor they weren't even sure any of their suggestions would work.  So I tried their suggestions in a much more controlled and refined approach--choosing to be more surgical in fixing the issues.  I used a PC that had the old version of the application installed at one point that I didn't care about any other Click Once application it had (just in case).
 
Their tips:
1. Try uninstalling and reinstalling.  No good--I already had the application uninstalled to start with.  bogus tip.
2. Try running:   mage -cc.
 
This clears the Application Cache.  Sounds promising, but no good--same problem.
 
3. Delete the ClickOnce application store. 
 
This just sounds bad--I'm certain it'll blow away all Click Once applications.  I just want to clear out one ClickOnce application.  Better yet--just clear out any references to the DLL I'm updating.  Well, they gave these steps:
 
    a. Make sure DFSVC.EXE process is not running.  Check.  It was running.  They say to killing out right (from Task manager).  Bummer--this might mean a reboot when done, unless I can find the Services to run to restart it.
    b. Delete the application store folder %userprofile%\Local Settings\Apps.  Okay, this is where I'm going to try to be a bit surgical.  If being surgical fails, I'll use the nukes.  I found the folders that contained copies of my old version dll and made sure the folder was for my application (even though the application was not installed), deleting the entire folder (it's not installed anyhow, so it shouldn't matter).  That failed because one of the files was in use.  I was able to delete the old-version dll I cared about, so that was good enough.
    c. Delete folder %userprofile%\Local Settings\Apps.  I don't know, but that sounds a lot like "b" above.  okay--I'm moving on.
    d. Delete HKCU\Software\Classes\Software\Microsoft\Windows\CurrentVersion\Deployment.  That's Regedit, and looking into it, there's a lot there.  Being surgical, I went further down to \SideBySide\2.0\Components\ and found the folder for my DLL, deleting the whole folder.
 
I did all this and tried to install again--dfsvc did start on its own so a reboot wasn't necessary--but the install still failed.  Okay, let's try bigger guns.  I searched the registry for my dll underneath the Deployment key and found a few other copies (after stopping that DFSVC process).  Same  thing.  Okay--time for the "deployment" key to be deleted.  Also removing the "Apps" folder.
 
NOTHING WORKS!!!!
 
Finally gave up entirely.  We determined that the third-party vendor had to be installed in the GAC anyhow to work--so we just removed the file from the project and made sure the reference was set up to use the GAC version.  Problem solved.
 
I spent most of the day Googling and Binging for help on this--even Microsoft either didn't respond with answers on the few forums that encountered the problem, or if Microsoft did respond it was with an answer that didn't make sense--or didn't explain how you would accomplish the recommended task.
 
I just hope I never see this one again.  But if I do--I hope the answer gets found.