+1-888-365-2779
Try Now
More in this section

Forums / Bugs & Issues / Deleting image - Exception has been thrown by ther target of an invocation

Deleting image - Exception has been thrown by ther target of an invocation

7 posts, 1 answered
  1. Markus
    Markus avatar
    2763 posts
    Registered:
    25 Nov 2005
    17 Aug 2012
    Link to this post
    I have a 5.1 sp1 installattion When I try to delete an image from an library I get the attached error. Anyone with an idea?

    Markus
  2. Markus
    Markus avatar
    2763 posts
    Registered:
    25 Nov 2005
    22 Aug 2012
    Link to this post
    @Telerik

    I did find out that it seems the problem is related to tags. 

    I deleted all images from a library by selecting them and deleting them. Some could be deleted and some threw the exeption.

    I could delete all but those with two certain tags given. I tried to delete the tags but would get the same exception.

    I can change the tag but not delete them.

    Any idea why deletint a tag could couse this error?

    Markus
  3. Markus
    Markus avatar
    2763 posts
    Registered:
    25 Nov 2005
    22 Aug 2012
    Link to this post
    @ Telerik

    I can unpublish images that throw the exception when I try to delete them. However, when I try to publish them again I get the same exception again.

    See here www.marktold.com/screencast/sf_images_tags.swf

    Markus
  4. Boyan Barnev
    Boyan Barnev avatar
    1429 posts
    Registered:
    06 Dec 2016
    27 Aug 2012
    Link to this post
    Hi Markus,

    The problem looks similar to an issue we've been trying to reproduce locally, but without any luck.

    Would you mind running the below script on your database, and let us know if the problems persist?

    The problem we have in mind relates to miscalculated taxonomy statistics, where duplicate statistic entries exist for the same content type and taxonID. The script uopdates the records in the database, removing any duplicate entries and combining them into one statistic with the correct number of marked items.

    declare @T table(
          taxon_id uniqueidentifier,
          statistic_type int,
          data_item_type varchar(255),
          item_provider_name varchar(255),
          marked_count bigint,
          id uniqueidentifier,
          duplicated_count int
          )
           
    insert into @T
    SELECT
          [taxon_id]
          ,[statistic_type]
          ,[data_item_type]
          ,item_provider_name
          ,sum(marked_items_count) as marked_count
          ,CAST(MIN(CAST(id AS BINARY(16))) AS UNIQUEIDENTIFIER)
          ,count(*)
    FROM [sf_taxonomy_statistic]
    group by taxon_id, data_item_type, statistic_type, item_provider_name
    having count(taxon_id) > 1
     
    select count(*) from @T
     
    delete [sf_taxonomy_statistic]
    from
          [sf_taxonomy_statistic] as stat
    inner join 
          @T as temp
    on
          stat.taxon_id = temp.taxon_id
          and stat.data_item_type = temp.data_item_type
          and stat.statistic_type = temp.statistic_type
          and stat.item_provider_name = temp.item_provider_name
          and stat.id <> temp.id
           
     
    update stat
    set
          marked_items_count = temp.marked_count
    from
          [sf_taxonomy_statistic] stat
    inner join 
          @T as temp
    on
          stat.id = temp.id


    Looking forwards to your reply.

    Regards,
    Boyan Barnev
    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
    Answered
  5. Markus
    Markus avatar
    2763 posts
    Registered:
    25 Nov 2005
    27 Aug 2012
    Link to this post
    Dear Boyan

    I did run the script on the DB and was afterwards able to delete the tags and therefor the library with the images. 

    Don't know how I got to that point so not much help in telling you how to reproduce it. But you solved the case .

    Markus


  6. Eric
    Eric avatar
    60 posts
    Registered:
    24 Feb 2011
    05 Nov 2012
    Link to this post
    Any chance this is fixed in 5.2? I had this exception after I made a blog post with tags and categories and got this exception. Why does this happen after just adding a couple tags and categories?
  7. Steven Harrap
    Steven Harrap avatar
    13 posts
    Registered:
    26 Sep 2012
    07 Nov 2012
    Link to this post
    Using this SQL also worked for me. I was having this problem in the event module. Trying to edit or delete a specifc event would result in this message. I duplicated the event (be viewing it and copying the details) and noted that the addition of a specific Tag resulted in the event not saving (and displaying the error message). Running the script and forcing the Events module page to refresh fixed it.

    I can supplied a log of the .net error by email (cannot attach zips or text to this reply)

    Cheers,
    Steven.
7 posts, 1 answered