Иногда получение исключения было вызвано целью вызова.
Код отлично работает в Visual Studio.
public HubActionMapping GetActionMappingByActionIdUniversityId(Int64 actionId, Int64 universityId) { using (var ctx = new AdmissionEntities()) { HubActionMapping actionMapping = (from tblActionMapping in ctx.HubActionMappings where tblActionMapping.ApiActionId == actionId && tblActionMapping.UniversityId == universityId select tblActionMapping).FirstOrDefault(); return actionMapping; } }
01/16/2017 07:12:32 | Error | Thread_85396_1 - Exception has been thrown by the target of an invocation. at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) 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 System.Data.Common.Internal.Materialization.Translator.Compile(Type resultType, Expression body) at System.Data.Common.Internal.Materialization.CoordinatorScratchpad.ReplacementExpressionVisitor.Visit(Expression expression) at System.Linq.Expressions.EntityExpressionVisitor.VisitExpressionList(ReadOnlyCollection`1 original) at System.Linq.Expressions.EntityExpressionVisitor.VisitMethodCall(MethodCallExpression m) at System.Data.Common.Internal.Materialization.CoordinatorScratchpad.ReplacementExpressionVisitor.Visit(Expression expression) at System.Linq.Expressions.EntityExpressionVisitor.VisitConditional(ConditionalExpression c) at System.Data.Common.Internal.Materialization.CoordinatorScratchpad.ReplacementExpressionVisitor.Visit(Expression expression) at System.Data.Common.Internal.Materialization.CoordinatorScratchpad.Compile() at System.Data.Common.Internal.Materialization.Translator.TranslateColumnMap[TRequestedType](QueryCacheManager queryCacheManager, ColumnMap columnMap, MetadataWorkspace workspace, SpanIndex spanIndex, MergeOption mergeOption, Boolean valueLayer) at System.Data.Common.Internal.Materialization.ShaperFactory.TypedShaperFactoryCreator`1.TypedCreate(QueryCacheManager cacheManager, ColumnMap columnMap, MetadataWorkspace metadata, SpanIndex spanInfo, MergeOption mergeOption, Boolean valueLayer) at System.Data.Common.Internal.Materialization.ShaperFactory.Create(Type elementType, QueryCacheManager cacheManager, ColumnMap columnMap, MetadataWorkspace metadata, SpanIndex spanInfo, MergeOption mergeOption, Boolean valueLayer) at System.Data.Objects.Internal.ObjectQueryExecutionPlan.Prepare(ObjectContext context, DbQueryCommandTree tree, Type elementType, MergeOption mergeOption, Span span, ReadOnlyCollection`1 compiledQueryParameters, AliasGenerator aliasGenerator) at System.Data.Objects.ELinq.ELinqQueryState.GetExecutionPlan(Nullable`1 forMergeOption) at System.Data.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption) at System.Data.Objects.ObjectQuery`1.System.Collections.Generic.IEnumerable<T>.GetEnumerator() at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source) at System.Linq.Queryable.FirstOrDefault[TSource](IQueryable`1 source) at ADMISION.Data.ActionMappingDataAccess.GetActionMappingByActionIdUniversityId(Int64 actionId, Int64 universityId) at ADMISION.Task.TaskCS.DataProcessor.Filter(List`1 rows, TaskObject taskObject, HubApiTask apiTask) at ADMISION.Task.TaskCS.Processor.ProcessTask(TaskObject taskObject, HubApiTask apiTask, HubTaskHistory hubTaskHistory, String& returndata)
Что я уже пробовал:
Это случайное исключение. Любые идеи были бы полезны