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

Forums / Bugs & Issues / An exception of type 'System.Reflection.TargetInvocationException' occurred and was caught

An exception of type 'System.Reflection.TargetInvocationException' occurred and was caught

1 posts, 0 answered
  1. John
    John avatar
    14 posts
    Registered:
    23 Aug 2012
    08 Jul 2013
    Link to this post
    I created a mvc widget in which I get a category. That widget runs well in my local, however, when I deployed to testing environment. It throws exception:
    07/08/2013 09:32:28
    Type : System.Reflection.TargetInvocationException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
    Message : Exception has been thrown by the target of an invocation.
    Source : mscorlib
    Help link : 
    Data : System.Collections.ListDictionaryInternal
    TargetSite : System.Object _InvokeMethodFast(System.IRuntimeMethodInfo, System.Object, System.Object[], System.SignatureStruct ByRef, System.Reflection.MethodAttributes, System.RuntimeType)
    Stack Trace :    at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
       at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
       at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
       at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
       at Telerik.Sitefinity.Data.Linq.OpenAccess.OpenAccessQueryProvider`2.Execute(Expression expression)
       at Telerik.Sitefinity.Data.Linq.OpenAccess.OpenAccessQueryProvider`2.System.Linq.IQueryProvider.Execute[TResult](Expression expression)
       at System.Linq.Queryable.Single[TSource](IQueryable`1 source, Expression`1 predicate)
       at SitefinityWebApp.Mvc.Models.TipsViewModel.GetTipCategory(Guid categoryId) in d:\Project\BwB\src\BwB.WebPresence\SitefinityWebApp\Mvc\Models\TipsViewModel.cs:line 35
       at SitefinityWebApp.Mvc.Models.TipsViewModel..ctor(DynamicContent tipItem) in d:\Project\BwB\src\BwB.WebPresence\SitefinityWebApp\Mvc\Models\TipsViewModel.cs:line 29
       at SitefinityWebApp.Mvc.Controllers.TipsController.GetAllTips() in d:\Project\BwB\src\BwB.WebPresence\SitefinityWebApp\Mvc\Controllers\TipsController.cs:line 40
       at SitefinityWebApp.Mvc.Controllers.TipsController.Index() in d:\Project\BwB\src\BwB.WebPresence\SitefinityWebApp\Mvc\Controllers\TipsController.cs:line 28
       at lambda_method(Closure , ControllerBase , Object[] )
       at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters)
       at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
       at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass15.<InvokeActionMethodWithFilters>b__12()
       at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation)
       at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
       at System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName)
       at Telerik.Sitefinity.Mvc.ControllerWrapper.Execute()
       at Telerik.Sitefinity.Mvc.Proxy.MvcControllerProxy.ExecuteController()
       at System.Web.UI.Control.PreRenderRecursiveInternal()
       at System.Web.UI.Control.PreRenderRecursiveInternal()
       at System.Web.UI.Control.PreRenderRecursiveInternal()
       at System.Web.UI.Control.PreRenderRecursiveInternal()
       at System.Web.UI.Control.PreRenderRecursiveInternal()
       at System.Web.UI.Control.PreRenderRecursiveInternal()
       at System.Web.UI.Control.PreRenderRecursiveInternal()
       at System.Web.UI.Control.PreRenderRecursiveInternal()
       at System.Web.UI.Control.PreRenderRecursiveInternal()
       at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

    Additional Info:

    MachineName : BWB-WEB-VD02
    TimeStamp : 7/8/2013 4:32:28 PM
    FullName : Telerik.Sitefinity.Utilities, Version=5.1.3450.0, Culture=neutral, PublicKeyToken=b28c218413bdf563
    AppDomainName : /LM/W3SVC/3/ROOT-2-130177742368293817
    ThreadIdentity : Jane
    WindowsIdentity : IIS APPPOOL\WebPresence
    Requested URL : http://bwb-web-vd02:8081/tips-and-calculators/tips/Action/Preview
    Inner Exception
    ---------------
    Type : System.InvalidOperationException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
    Message : Query execution did not find a matching element.
    Source : Telerik.OpenAccess.35.Extensions
    Help link : 
    Data : System.Collections.ListDictionaryInternal
    TargetSite : TResult PerformQuerySingle[T,TResult](Telerik.OpenAccess.Query.QueryableCategory, System.Linq.Expressions.Expression, Boolean, Telerik.OpenAccess.Query.ChainedContext)
    Stack Trace :    at Telerik.OpenAccess.Query.ExpressionExecution.PerformQuerySingle[T,TResult](QueryableCategory before, Expression expression, Boolean tryGetObjectById, ChainedContext piece)
      at Telerik.OpenAccess.Query.Piece`1.ExecuteSingle[TResult](Expression expression)



    Category: ErrorLog

    Priority: 0

    EventId: 90000

    Severity: Error

    Title:Enterprise Library Exception Handling

    Machine: BWB-WEB-VD02

    App Domain: /LM/W3SVC/3/ROOT-2-130177742368293817

    ProcessId: 4088

    Process Name: c:\windows\system32\inetsrv\w3wp.exe

    Thread Name: 

    Win32 ThreadId:4748

    Extended Properties: 
    ----------------------------------------

    my code is  public TipsViewModel(DynamicContent tipItem)
            {
                Id = tipItem.Id;
                TipTitle = tipItem.GetValue<string>("Title");
                TipDescription = tipItem.GetValue<string>("Description");
                YesClickCount = Convert.ToInt32(tipItem.GetValue("YesClickCount"));
                var categoryId = tipItem.GetValue<TrackedList<Guid>>("Category").FirstOrDefault();
                TipCategory = GetTipCategory(categoryId); //line 29 throw exception
            }

            private string GetTipCategory(Guid categoryId)
            {
                var manager = TaxonomyManager.GetManager();
                var category =  manager.GetTaxa<HierarchicalTaxon>().Single(t => t.Id == categoryId);   //line 35 throw exception
                if (category == null) return string.Empty;
                return category.Name;
            }
1 posts, 0 answered