5.3 Custom classifications causing user controls to throw er

Posted by Community Admin on 04-Aug-2018 17:54

5.3 Custom classifications causing user controls to throw errors.

All Replies

Posted by Community Admin on 29-Jan-2013 00:00

Hi everyone, 
   I created two custom classifications that I added to the existing blog posts module, as well as to my own custom module (Resources). I have multiple user controls that grab blog posts and resources and filter them according to these custom classifications. I have no issues with these controls locally, but when I publish my solution to our staging environment, and add any new content, my controls throw an error of "ID cannot be an empty guid." This is the code I am using to get my custom classifications:


     private string GetBlogTopic(IDynamicFieldsContainer blogPost)
       
            string resourceType = null;
            var propDesc = (TaxonomyPropertyDescriptor)OrganizerBase.GetProperty(blogPost.GetType(), "ResourceTopic");
            if (propDesc != null)
           
                var taxonIds = (IList<Guid>)propDesc.GetValue(blogPost);
                resourceType = _taxonomyManager.GetTaxon(taxonIds.FirstOrDefault()).Title;
           
            return resourceType;
       

If I remove this method the controls do not throw exceptions on our staging environment, but they also don't do what I need anymore. If anyone has any idea why custom classifications would break between environments I would greatly appreciate a response. 


Thanks,
Gianluca Balzano

Posted by Community Admin on 29-Jan-2013 00:00

Hey all,
     Slowly but surely making sense of this issue, albeit not much. Now when I try to even load a content item to edit it's content, I'm receiving an error in my console:
     'Failed to load resource: the server responded with a status of 404 (Not Found)

This was the resource it was attempting to access:
     'mydomain.com/Sitefinity/Services/Taxonomies/FlatTaxon.svc/?skip=0&take=0&sortExpressions=Title%20ASC&mode=Simple&filter=Id%20==%207aa9964d-7e37-6d65-9fe2-ff6400465a7b&unv_tstmp_prm=1359485808058'

I'm guessing that this is also causing my code to crash when it is attempting to grab the taxonomy id of the blog post it loads dynamically. Just figured I'd update my findings on the issue. Again if anyone has any insight I would greatly appreciate it. Thanks again everyone.

Gianluca Balzano

Posted by Community Admin on 01-Feb-2013 00:00

Hello Gianluca,

Could it be possible that you haven't uploaded all files to your staging environment. Please make sure that your project has access to the following service under the Sitefinity folder on the root of the project. 

/Sitefinity/Services/Taxonomies/FlatTaxon.svc

Also,  check if you have entered the correct domain in the WorkflowbasedUrl under Administration -> Settings -> ServicesPaths.

Kind regards,
Jen Peleva
the Telerik team
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 01-Feb-2013 00:00

Hi Jen,

   Thank you for your reply. I'm not exactly sure how I fixed the second issue, but I did in fact resolve it. As far as the code goes, it was a dumb mistake on my part, not checking to see if the taxonIds variable had any child elements in it. So when a post didn't have one of my custom classifications set, it would throw the "Id cannot be an empty Guid" error. That makes perfect sense. 

   As far as the issue I had loading the content item itself to edit it's contents, I'm really not sure why that went away. I made sure every dll had copy to local set to true and redeployed my code, recycled the app pool in IIS, and it seemed to fix the issue. Will keep an eye out if it happens again. Thanks again Jen.


Gianluca Balzano

This thread is closed