About the author
After upgrading to Community Server 2008.5 (Windows 2008 64-bit, SQL 2008 64-bit) from Community Server 2007 (Windows 2003 32-bit, SQL 2000 32-bit), some of the media files, specifically, photos, were missing on one of the blogs.
When attempting to edit those media using the Media Gallery, I encountered the following error:
Exception Details: System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
Searching Telligent's site for a few hours showed no solution. Eventually, I decided to troubleshoot the issue on my own.
I looked at the filestorage/CommunityServer.Components.PostAttachments and it seemed to me all the files were there.
Troubleshooting using RedGate's .NET Reflector, Microsoft's Process Monitor, and reading various logs (web server, SQL Server) showed that the files are being located. Finally, I decided to insert a new image to the Media Gallery, and looked at the SQL output on the cs_PostAttachments table, which showed the following:
And it dawned on me. I needed to try setting the SectionID to 16 and see if it works. It did!
So, here's the SQL statement you need to run to fix the media missing issue:
UPDATE dbo.cs_PostAttachments SET SectionID=16 where UserID=nnnnnn.
Continued discussion of undocumented Delphi 8 Property Access Specifiers, and other ways of adding and removing delegates / events handlers, including clearing the list of all the delegates / event handlers.