| This post was migrated from an older system. Some links may point to content that no longer exists. Comments were not migrated.
Last week in the closing thoughts on the Binding Redirection post, I mentioned there was a bug within the new 2010 functionality. Here's the scoop...
This bug won't affect every deployment. However, if you run across it, a couple of things will happen:
- Redirection will not work
- You're going to leave garbage in web.config - making admins unhappy with you
The bug is completely related to your public key token (PKT) and how SharePoint creates the value that is punched into the web.config.
Let's take a brief look at the problem, then I'll describe the problem in detail...
Let's assume that your public key token is
d614fd19520471d5
If you use the BindingRedirect element in your solution, the resulting output within web.config will be...
<dependentAssembly> <assemblyIdentity name="VisualWebPartProject1" publicKeyToken="d614fd1952471d5" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-1.0.0.0" newVersion="2.0.0.0" /> </dependentAssembly>
Do you see the problem?
Split the PKT into 8 pairs - d6, 14, fd, 19, 52, 04, 71, d5
Notice that the 6th pair is 04 in the known, proper PKT.
However, the value in the publicKeyToken is written without the leading 0.
Yup, it's a simple little padding error. "04" is the same "4" if you are just looking at the single value; however, in order for the entire string to be correct, there needs to be 16 characters.
SPBug.
What is the effect?
-
The first and most apparent effect is that redirection simply does not work. The .NET framework will read the info and subsequently NOT find a match for your assembly.
-
The next problem is less visible. When you retract the solution, SharePoint will not clean up the bindingRedirect it inserted during deployment. Net result: you'll leave a lot of junk dependentAssembly tags in your web.config. admins will be unhappy (or more appropriately - more unhappy than normal!)
Details...
When you add a BindingRedirect to your solution, your solution manifest would like...
<Assemblies> <Assembly Location="Bluedoglimited.Demo.dll" DeploymentTarget="GlobalAssemblyCache"> <BindingRedirects> <BindingRedirect OldVersion="0.0.0.0-1.0.0.0"/> </BindingRedirects> </Assembly> </Assemblies>
There are two things worth paying attention to here...
- The BindingRedirect element only requires the OldVersion attribute. Even though you know the PKT, you haven't specified it anywhere within the solution package.
- Hence, publicKeyToken and newVersion are calculated based on the actual assembly values once it has been loaded.
The calculation routine that generates the PKT produces the wrong value. If any pair is less than 0x0F (15), the resulting PKT string will be invalid.
Workaround...
There are two options worth considering:
-
If you want to use the new 2010 built-in functionality to deploy BindingRedirect instructions, your only recourse is to use a new public key that does not contain a paired value that is less than 0x0F.
-
If you can't change your key (because of company policy or legacy requirements), then SharePoint 2010's new functionality is not usable. You will need make accommodations to write your own bindingRedirect information - programmatically or, worse yet, manually. Either way, this is a probably not a good option for a number of reasons.
Finally, it's worth calling out this problem was reported shortly before RTM. I've received confirmation that problem has been located and may be addressed in a future update.
-Maurice
|
View in Web Browser
/SharePointThoughts/_layouts/VisioWebAccess/VisioWebAccess.aspx?listguid={ListId}&itemid={ItemId}&DefaultItemOpen=1
0x0
0x1
FileType
vdw
255
Manage Subscriptions
/_layouts/images/ReportServer/Manage_Subscription.gif
/SharePointThoughts/_layouts/ReportServer/ManageSubscriptions.aspx?list={ListId}&ID={ItemId}
0x80
0x0
FileType
rdl
350
Manage Data Sources
/SharePointThoughts/_layouts/ReportServer/DataSourceList.aspx?list={ListId}&ID={ItemId}
0x0
0x20
FileType
rdl
351
Manage Shared Datasets
/SharePointThoughts/_layouts/ReportServer/DatasetList.aspx?list={ListId}&ID={ItemId}
0x0
0x20
FileType
rdl
352
Manage Parameters
/SharePointThoughts/_layouts/ReportServer/ParameterList.aspx?list={ListId}&ID={ItemId}
0x0
0x4
FileType
rdl
353
Manage Processing Options
/SharePointThoughts/_layouts/ReportServer/ReportExecution.aspx?list={ListId}&ID={ItemId}
0x0
0x4
FileType
rdl
354
Manage Cache Refresh Plans
/SharePointThoughts/_layouts/ReportServer/CacheRefreshPlanList.aspx?list={ListId}&ID={ItemId}
0x0
0x4
FileType
rdl
355
View Report History
/SharePointThoughts/_layouts/ReportServer/ReportHistory.aspx?list={ListId}&ID={ItemId}
0x0
0x40
FileType
rdl
356
View Dependent Items
/SharePointThoughts/_layouts/ReportServer/DependentItems.aspx?list={ListId}&ID={ItemId}
0x0
0x4
FileType
rsds
350
Edit Data Source Definition
/SharePointThoughts/_layouts/ReportServer/SharedDataSource.aspx?list={ListId}&ID={ItemId}
0x0
0x4
FileType
rsds
351
View Dependent Items
/SharePointThoughts/_layouts/ReportServer/DependentItems.aspx?list={ListId}&ID={ItemId}
0x0
0x4
FileType
smdl
350
Manage Clickthrough Reports
/SharePointThoughts/_layouts/ReportServer/ModelClickThrough.aspx?list={ListId}&ID={ItemId}
0x0
0x4
FileType
smdl
352
Manage Model Item Security
/SharePointThoughts/_layouts/ReportServer/ModelItemSecurity.aspx?list={ListId}&ID={ItemId}
0x0
0x2000000
FileType
smdl
353
Regenerate Model
/SharePointThoughts/_layouts/ReportServer/GenerateModel.aspx?list={ListId}&ID={ItemId}
0x0
0x4
FileType
smdl
354
Manage Data Sources
/SharePointThoughts/_layouts/ReportServer/DataSourceList.aspx?list={ListId}&ID={ItemId}
0x0
0x20
FileType
smdl
351
Load in Report Builder
/SharePointThoughts/_layouts/ReportServer/RSAction.aspx?RSAction=ReportBuilderModelContext&list={ListId}&ID={ItemId}
0x0
0x2
FileType
smdl
250
Edit in Report Builder
/_layouts/images/ReportServer/EditReport.gif
/SharePointThoughts/_layouts/ReportServer/RSAction.aspx?RSAction=ReportBuilderReportContext&list={ListId}&ID={ItemId}
0x0
0x4
FileType
rdl
250
Edit in Report Builder
/SharePointThoughts/_layouts/ReportServer/RSAction.aspx?RSAction=ReportBuilderDatasetContext&list={ListId}&ID={ItemId}
0x0
0x4
FileType
rsd
250
Manage Caching Options
/SharePointThoughts/_layouts/ReportServer/DatasetCachingOptions.aspx?list={ListId}&ID={ItemId}
0x0
0x4
FileType
rsd
350
Manage Cache Refresh Plans
/SharePointThoughts/_layouts/ReportServer/CacheRefreshPlanList.aspx?list={ListId}&ID={ItemId}&IsDataset=true
0x0
0x4
FileType
rsd
351
Manage Data Sources
/SharePointThoughts/_layouts/ReportServer/DataSourceList.aspx?list={ListId}&ID={ItemId}
0x0
0x20
FileType
rsd
352
View Dependent Items
/SharePointThoughts/_layouts/ReportServer/DependentItems.aspx?list={ListId}&ID={ItemId}
0x0
0x4
FileType
rsd
353
Compliance Details
javascript:commonShowModalDialog('{SiteUrl}/_layouts/itemexpiration.aspx?ID={ItemId}&List={ListId}', 'center:1;dialogHeight:500px;dialogWidth:500px;resizable:yes;status:no;location:no;menubar:no;help:no', function GotoPageAfterClose(pageid){if(pageid == 'hold') {STSNavigate(unescape(decodeURI('{SiteUrl}'))+'/_layouts/hold.aspx?ID={ItemId}&List={ListId}'); return false;} if(pageid == 'audit') {STSNavigate(unescape(decodeURI('{SiteUrl}'))+'/_layouts/Reporting.aspx?Category=Auditing&backtype=item&ID={ItemId}&List={ListId}'); return false;} if(pageid == 'config') {STSNavigate(unescape(decodeURI('{SiteUrl}'))+'/_layouts/expirationconfig.aspx?ID={ItemId}&List={ListId}'); return false;}}, null); return false;
0x0
0x1
ContentType
0x01
898
Edit in Browser
/_layouts/images/icxddoc.gif
/SharePointThoughts/_layouts/formserver.aspx?XsnLocation={ItemUrl}&OpenIn=Browser&Source={Source}
0x0
0x1
FileType
xsn
255
Edit in Browser
/_layouts/images/icxddoc.gif
/SharePointThoughts/_layouts/formserver.aspx?XmlLocation={ItemUrl}&OpenIn=Browser&Source={Source}
0x0
0x1
ProgId
InfoPath.Document
255
Edit in Browser
/_layouts/images/icxddoc.gif
/SharePointThoughts/_layouts/formserver.aspx?XmlLocation={ItemUrl}&OpenIn=Browser&Source={Source}
0x0
0x1
ProgId
InfoPath.Document.2
255
Edit in Browser
/_layouts/images/icxddoc.gif
/SharePointThoughts/_layouts/formserver.aspx?XmlLocation={ItemUrl}&OpenIn=Browser&Source={Source}
0x0
0x1
ProgId
InfoPath.Document.3
255
Edit in Browser
/_layouts/images/icxddoc.gif
/SharePointThoughts/_layouts/formserver.aspx?XmlLocation={ItemUrl}&OpenIn=Browser&Source={Source}
0x0
0x1
ProgId
InfoPath.Document.4
255
View in Browser
/SharePointThoughts/_layouts/xlviewer.aspx?id={ItemUrl}&DefaultItemOpen=1
0x0
0x1
FileType
xlsx
255
View in Browser
/SharePointThoughts/_layouts/xlviewer.aspx?id={ItemUrl}&DefaultItemOpen=1
0x0
0x1
FileType
xlsm
255
View in Browser
/SharePointThoughts/_layouts/xlviewer.aspx?id={ItemUrl}&DefaultItemOpen=1
0x0
0x1
FileType
xlsb
255
View in Browser
/SharePointThoughts/_layouts/xlviewer.aspx?id={ItemUrl}&DefaultItemOpen=1
0x0
0x1
FileType
ods
255