Uh-oh- something went wrong! Failed to query annotations entity

We are getting Something went wrong error when trying to add a collaborator. The main error states Failed to query Annotations entity. Below is the code we are using for the code behind. We have our own “cache” folder where the files are stored. What am I missing?



Jim



string sFileandPath = Request[“folder”] + “/” + Request[“doc”];



var svc = ObjectFactory.GetInstance();

svc.AddCollaborator(sFileandPath, "groupdocs@groupdocs.com", “Anonym”, “A.”, null);

Hello Jim,

We are sorry to hear that you have such issue.
The error that you have described occurs when there is a mismatch between data from “file-sessions.json”, data from the database and other data.

In order to fix it do the next:
1. Remove file “file-sessions.json” from “App_Data” folder.
2. Open the database (no matter is this SQL Server or SQL Server Compact) and remove content from all GroupDocs.Annotation-related tables: AnnotationCollaborators, AnnotationReplies, Annotations, AnnotationSessions, Users.
3. Make sure that document name on code-front and code-behind is the same. In particular, you need to use “sFileandPath” value on the code-front (<%= new WidgetFactory().Annotation().FilePath()…)
4. Remove “temp” folder with cached content.
5. Clean your browser cookie which are related to the website where GroupDocs.Annotation is used. GroupDocs.Annotation stores info about current user in cookie, and it can lead to the data mismatch.
6. Restart the web-site.

Hope this will help. If you will have more questions please feel free to contact us.

Not clear how annotations work. Looks like the filenames in the Jason file is used to pull the associated annotations for the document. Also, looks like this file has to be in the app_data folder. We are using a separate folder Cache for our files. Is this ok or do they have to be in the ap_data folder? Moved a file to the app_data and used everything in that folder but still getting the errors. I am getting that it failed to query annotation and also The given key was not present in the dictionary. I have switched to using the sql server database. I see the records in the database. Do I have a configuration issue?



Thanks,



Jim

Hello Jim,

Thanks for coming back.

1. You can move “base directory” to any folder you want. The only thing that “file-sessions.json” file stays in the “App_Data” in any case, even if you specified another folder. Please note a section “Changing a base directory” in the article “How to use GroupDocs.Annotation for .NET in an ASP.NET MVC 5 Project”. Despite the fact that this article is outdated and is not about WebForms project, this section is still topical and can give you the most precise answer.
2. “The given key was not present in the dictionary” is another error. It occurs in several reasons:
2.1. The database that you are using can be outdated. We release the updates for GroupDocs.Annotation and some of these updates “brings” new database structure. I don’t know what database structure you have at this moment, but you can check this out by downloading “GroupDocs.Annotation for .NET 1.3.0 (DLLs only)” ZIP package. It contains empty database (“DB.sdf” file) so you can compare its structure with yours.
2.2. If you see records in the Annotation-related tables within your database then there are no connection-related problems.

2.3. Another reason may occur when you use not the Annotation server widget (<%= new WidgetFactory().Annotation().ElementId…) but the JavaScript code on the code-front where Annotation should be placed. In such case, when JavaScript code is obsolete, it can cause such errors. If you use JavaScript code, please use the next syntax:

var annotationWidget = $(‘#annotation-widget’).groupdocsAnnotation({
width: 600,
height: 800,
fileId: ‘Quick_Start_Guide_To_Using_GroupDocs.pdf’,
docViewerId: ‘annotation-widget-doc-viewer’,
quality: 90,
enableRightClickMenu: true,
showHeader: true,
showZoom: true,
showPaging: true,
showPrint: true,
showFileExplorer: false,
showThumbnails: true,
showToolbar: true,
openThumbnails: false,
zoomToFitWidth: false,
TextFieldBackgroundColor: 255255255,
zoomToFitHeight: false,
initialZoom: 100,
preloadPagesCount: 0,
enableSidePanel: true,
scrollOnFocus: true,
strikeOutColor: ‘’,
enabledTools: 1023,
connectorPosition: 0,
saveReplyOnFocusLoss: false,
clickableAnnotations: false,
disconnectUncommented: false,
strikeoutMode: 0,
sideboarContainerSelector: ‘div.comments_sidebar_wrapper’,
usePageNumberInUrlHash: false,
textSelectionSynchronousCalculation: true,
variableHeightPageSupport: true,
useJavaScriptDocumentDescription: true,
isRightPanelEnabled: true,
createMarkup: true,
use_pdf: ‘true’,
_mode: ‘annotatedDocument’,
selectionContainerSelector: “[name=‘selection-content’]”,
graphicsContainerSelector: ‘.annotationsContainer’,
userName: userName,
userId: userId,
});


Please notify us if you will have any issues or questions, we will be glad to help you.

Database is different. Can you send me sql for creating the correct database structures in sql server?



Thanks,



Jim

I switched to the db.sdf file from the GroupDocs.Annotation_1.3.0.zip and I am not getting the query error. However, I am getting the given key is not present in the dictionary. It seems like this db is also not current.



Jim









Here is the code I am using to call annotations. I am not using a javascript call. Forgot to add this in my last post.



Jim




.Annotation()

.ElementId(“documentViewer”)

.FilePath( Request[“folder”] + “/” + Request[“doc”])

.Width(0)

.Height(Convert.ToInt16(Request[“height”]))

.ShowPrint(true)

.ShowFileExplorer(false)

.ZoomToFitHeight(true)

.ZoomToFitWidth(false)

.Zoom(70)

.ClickableAnnotations(true)

.EnableRightClickMenu(true)

.ToHtmlString()

%>



I decided to grab the dll and the db.sdf database from the sample. Now I am getting the javascript error below. I also get this error if I use the dll and db.sdf from GroupDocs.Annotation_1.3.0.zip. The document loads but I do not see the annotation toolbar. Not sure what to try next. Can you all be sure to send me the correct version I should use?



Thanks,



Jim



JavaScript runtime error: Unable to get property ‘client’ of undefined or null reference

One last post. We need to use our SQL Server to store the annotation data, so please send us the latest schema and dll we should use with it. I compared the one to latest db.sdf I could find and the annotation table is very different. Also, a list of steps that the annotation process takes when someone opens and clicks on the annotation toolbar would be very helpful. Not sure if you all already have such a document.



Thanks,



Jim

Hello Jim,

Thanks for providing us the additional details.
1. Please take a look at the article “How to use GroupDocs Annotation for .NET with MSSQL Server”. It contains the most up-to-date database structure (schema) - you can use a Transact-SQL script from this article for creating required structure in your database.
2. I’ll send you an email with a link to the latest version of GroupDocs.Annotation for .NET version 1.3.60.10052 - this version has a lot of fixes and improvements. Please use it.
3. You requested a some sort of explanation about how GroupDocs.Annotation works. We have prepared for you an updated version of the article “How to use GroupDocs.Annotation for .NET in an ASP.NET MVC 5 Project”. Despite the fact that this article is about using GroupDocs.Annotation in the ASP.NET MVC projects the basic principles of GroupDocs.Annotation stay the same.
4. So, please, use this version of library and database, remove old “file-sessions.json” file, clean your browser cookie which are related to the website where GroupDocs.Annotation is used, and then rebuild and restart a project.

If this will not help please provide us a screenshot of occurred error.

Great. Seems to be working without errors. How do I turn off annotations. Some of our clients will not have annotation rights. I want to either turn off the annotations for these clients or hide that annotation toolbar.



Thanks,



Jim

I tried to export without comments and with comments and I get the error ‘’, hexadecimal value 0x1F, is an invalid character. It is one of the Uh-Oh errors.



Thanks,



Jim

This may be related to the adobe version. I tried other files and it worked fine. For instance worked for word and one of the other pdf files. Do you not support specific versions of adobe pdf files?



Thanks,



Jim

Hello Jim,

We are happy that it helped you. Here are answers:

1. You can disable annotation toolbar in two ways. 1) ShowToolbar(false) 2) AccessRights(AnnotationReviewerRights.CanView | AnnotationReviewerRights.CanExport)

2. It’s hard to say without having a “problematic” document in the hands. We will be very pleased if you will send this file to us. Our developer will review it and will do all possible to support it in the GroupDocs.Annotation.

If you will have more questions please feel free to contact us.

Things are working much better now. Any way to speed up the viewer. For instance, can we lower the quality size or change any of the other parameters for the viewer? We have some very large pdf files.



Thanks,



Jim

Hello Jim,

We are happy that all works fine. Here are a list of recommendations for increasing performance of GroupDocs.Annotation for .NET:
1. Use “PreloadPageCount(1)” method. When using this method GroupDocs.Annotation begins to load document pages to the client-side when first page of the document will be converted. When this method is not used, GroupDocs.Annotation converts all pages of a document and only then sends them to the client-side.
2. Use “MinimumImageWidth(value)” method. If set, the GroupDocs.Annotation will load page images with the specified width from the server when starting. It will not load page images from the server again after zooming if the current page image size is smaller than the value specified and if the original (not scaled) page image size is smaller than the value specified. It means that in most cases the GroupDocs.Annotation will load page images only once and will not reload them after zooming in/out.
3. If this is possible for your business-logic, disable thumbnails by using “ShowThumbnails(false)” method.
4. GroupDocs.Annotation rasterizes document pages and sends them to the client-side as images. If you want to decrease these images size for the client-side (if you are using GroupDocs.Annotation on mobile devices where RAM is limited, for example), you can use “Quality(Byte)” method. The lesser values correspond to worst image quality but lesser image size.

Please notify us if you will have any issues or questions, we will be glad to help you.


Best regards
Denis Gvardionov

http://groupdocs.com
Your Document Collaboration APIs
Follow us on LinkedIn, Twitter, Facebook and Google+
Our Other Venture – Banckle – Your Customer Service APIs | Aspose – Your File Format APIs