Recently, I needed to update my xConnect Tutorial from 9.0 to 9.2 so I could start looking at the new data purge API (more on that another day). I figured it should be an easy enough upgrade, my tutorial wasn’t doing anything complicated. Just some basic Create Contact or Register Interaction stuff.
So, I did the usual:
- Update Target Framework from 4.6.2 to 4.7.2
- Change all the NuGet references to the 9.2 packages
- Recompile
- Squint at all the red compile errors from doing an upgrade…
CertificateWebRequestHandlerModifier is gone
The most obvious errors I hit were the with the handler modifiers. I used these classes to create connections to the end points. My code looked like this:
var options = CertificateWebRequestHandlerModifierOptions.Parse("StoreName=My;StoreLocation=LocalMachine;FindType=FindByThumbprint;FindValue=" + thumbprint); var certificateModifier = new CertificateWebRequestHandlerModifier(options);
These classes did not seem to exist anymore. Doing some digging, it seems that at some point there was a renaming that happened. These were now called (respectively):
- CertificateHttpClientHandlerModifierOptions
- CertificateHttpClientHandlerModifier
So the new code was easy enough to update:
var options = CertificateHttpClientHandlerModifierOptions.Parse("StoreName=My;StoreLocation=LocalMachine;FindType=FindByThumbprint;FindValue=" + thumbprint); var certificateModifier = new CertificateHttpClientHandlerModifier(options);
On a related note, I had an array of these being returned somewhere, and I used the interface to refer to the collection: IWebRequestHandlerModifier. This interface was also gone and now replaced by IHttpClientHandlerModifier.
No More No References
I unfortunately had to live with the fact that we no longer have the .NoReferences NuGet packages. This meant some restructuring in what I would include. I couldn’t just target the specific low level pieces anymore, so I needed to update to grab the bigger chunks. I chose to use:
- Sitecore.XConnect
- Sitecore.XConnect.Client
- Sitecore.XConnect.Collection.Model
- Sitecore.Xdb.ReferenceData.Client
It Compiles, must be working!
Unfortunately, I’ve been at this too long to celebrate success at a compilation point of an upgrade. Testing needed to happen, so I booted it up and everything blew up right away.
For some reason, it couldn’t find System.Http. I started updating all my assembly bindings to newer versions hoping that was the problem, but it just didn’t work. I finally had to remove the assembly binding for System.Net.Http to resolve the issue.
It’s alive!
All in all, not a bad upgrade. Data was inserting correctly and the tutorial flow completed all it’s tasks. Now it’s time to look into those new 9.2 API changes!