混淆后,查询执行会抛出异常 [英] Query execution throws exception after obfuscation

查看:64
本文介绍了混淆后,查询执行会抛出异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在混淆包含实体类型的程序集后,执行查询会抛出ArgumentOutOfRangeException(消息和堆栈跟踪见下文)。属性的名称与混淆之前保持一致。有没有人有一个想法,什么是
错了?

当混淆与实体框架有关的程序集时需要考虑什么?

After obfuscating an assembly containing entitytypes execution of a query throws an ArgumentOutOfRangeException (message and stack trace see below). The names of the properties remained the same as before the obfuscation. Does anyone have an ides, what went wrong?
What has to be considered when obfuscating assemblies in connection with entity framework?

System.ArgumentOutOfRangeException:startIndex不能大于字符串的长度。

参数名称:startIndex

at System.String.InternalSubStringWithChecks(Int32 startIndex,Int32 length ,Boolean fAlwaysCopy)
$
在System.Data.Common.Internal.Materialization.Translator.CreatePropertyBindings(StructuredColumnMap columnMap,Type clrType,ReadOnlyMetadataCollection`1 properties)

at System.Data .Common.Internal.Materialization.Translator.Visit(EntityColumnMap columnMap,TranslatorArg arg)

at System.Data.Query.InternalTrees.EntityColumnMap.Accept [TResultType,TArgType](ColumnMapVisitorWithResults`2 visitor,TArgType arg )System $ Data.Common.Internal.Materialization.Translator.ProcessCollectionColumnMap(CollectionColumnMap columnMap,TranslatorArg arg,Colum)的
nMap discriminatorColumnMap,Object discriminatorValue)

在System.Data.Common.Internal.Materialization.Translator.Visit(DiscriminatedCollectionColumnMap columnMap,TranslatorArg arg)

在System.Data.Query。 InternalTrees.DiscriminatedCollectionColumnMap.Accept [TResultType,TArgType](ColumnMapVisitorWithResults`2 visitor,TArgType arg)

at System.Data.Common.Internal.Materialization.Translator.AcceptWithMappedType(Translator translator,ColumnMap columnMap,ColumnMap parent )在System.Data.Common.Internal.Materialization.Translator.HandleSpandexRecord(RecordColumnMap columnMap,TranslatorArg arg,RowType spanRowType)的$
。在System.Data.Common.Internal的
。 Materialization.Translator.Visit(RecordColumnMap columnMap,TranslatorArg arg)
$
at System.Data.Query.InternalTrees.RecordColumnMap.Accept [TResultType,TArgType](ColumnMapVisitorWithResults`2 visitor,TArgType arg)
System.Data.Common.Internal.Materialization.Translator.ProcessCol上的
lectionColumnMap(CollectionColumnMap columnMap,TranslatorArg arg,ColumnMap discriminatorColumnMap,Object discriminatorValue)

at System.Data.Common.Internal.Materialization.Translator.Visit(SimpleCollectionColumnMap columnMap,TranslatorArg arg)

at System.Data.Query.InternalTrees.SimpleCollectionColumnMap.Accept [TResultType,TArgType](ColumnMapVisitorWithResults`2 visitor,TArgType arg)

at System.Data.Common.Internal.Materialization.Translator.TranslateColumnMap [ TRequestedType](QueryCacheManager queryCacheManager,ColumnMap columnMap,MetadataWorkspace工作空间,SpanIndex spanIndex,MergeOption mergeOption,Boolean valueLayer)

at System.Data.Common.Internal.Materialization.ShaperFactory.TypedShaperFactoryCreator`1.TypedCreate(QueryCacheManager cacheManager ,ColumnMap columnMap,MetadataWorkspace元数据,SpanIndex spanInfo,MergeOption mergeOption,Boolean valueLayer)

at System.Data.Common.Internal.Materialization.ShaperFactory.Creat e(TypeTypeType,QueryCacheManager cacheManager,ColumnMap columnMap,MetadataWorkspace metadata,SpanIndex spanInfo,MergeOption mergeOption,Boolean valueLayer)

at System.Data.Objects.Internal.ObjectQueryExecutionPlan.Prepare(ObjectContext context,DbQueryCommandTree tree,在System.Data.Objects.ELinq.ELinqQueryState.GetExecutionPlan(Nullable`1 forMergeOption)中键入elementType,MergeOption mergeOption,Span span,ReadOnlyCollection`1 compiledQueryParameters)$
.Data.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption)

at System.Data.Objects.ObjectQuery`1.System.Collections.Generic.IEnumerable< T> .GetEnumerator()< System.Linq.Buffer`1..ctor(IEnumerable`1 source)的
在System.Linq.Enumerable.ToArray [TSource](IEnumerable`1 source)<
/ span>

System.ArgumentOutOfRangeException: startIndex cannot be larger than length of string.
Parameter name: startIndex
at System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy)
at System.Data.Common.Internal.Materialization.Translator.CreatePropertyBindings(StructuredColumnMap columnMap, Type clrType, ReadOnlyMetadataCollection`1 properties)
at System.Data.Common.Internal.Materialization.Translator.Visit(EntityColumnMap columnMap, TranslatorArg arg)
at System.Data.Query.InternalTrees.EntityColumnMap.Accept[TResultType,TArgType](ColumnMapVisitorWithResults`2 visitor, TArgType arg)
at System.Data.Common.Internal.Materialization.Translator.ProcessCollectionColumnMap(CollectionColumnMap columnMap, TranslatorArg arg, ColumnMap discriminatorColumnMap, Object discriminatorValue)
at System.Data.Common.Internal.Materialization.Translator.Visit(DiscriminatedCollectionColumnMap columnMap, TranslatorArg arg)
at System.Data.Query.InternalTrees.DiscriminatedCollectionColumnMap.Accept[TResultType,TArgType](ColumnMapVisitorWithResults`2 visitor, TArgType arg)
at System.Data.Common.Internal.Materialization.Translator.AcceptWithMappedType(Translator translator, ColumnMap columnMap, ColumnMap parent)
at System.Data.Common.Internal.Materialization.Translator.HandleSpandexRecord(RecordColumnMap columnMap, TranslatorArg arg, RowType spanRowType)
at System.Data.Common.Internal.Materialization.Translator.Visit(RecordColumnMap columnMap, TranslatorArg arg)
at System.Data.Query.InternalTrees.RecordColumnMap.Accept[TResultType,TArgType](ColumnMapVisitorWithResults`2 visitor, TArgType arg)
at System.Data.Common.Internal.Materialization.Translator.ProcessCollectionColumnMap(CollectionColumnMap columnMap, TranslatorArg arg, ColumnMap discriminatorColumnMap, Object discriminatorValue)
at System.Data.Common.Internal.Materialization.Translator.Visit(SimpleCollectionColumnMap columnMap, TranslatorArg arg)
at System.Data.Query.InternalTrees.SimpleCollectionColumnMap.Accept[TResultType,TArgType](ColumnMapVisitorWithResults`2 visitor, TArgType arg)
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)
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.Buffer`1..ctor(IEnumerable`1 source)
at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)

推荐答案

你是如何进行混淆的? 您是否修改了元数据文件以匹配? 你使用了什么混淆器?

How did you go about the obfuscation?  Did you modify your metadata files to match?  What obfuscator did you use?

我以前没见过这样的东西,所以我真的不确定发生了什么,但我有点惊讶它到目前为止&NBSP;我不知道我们用混淆器做过任何测试。 你有没有机会与我们分享一个相对较小的repro
? 您是否尝试连接调试器并在出现问题时查看字符串和索引?

I've not seen anything like this before, so I'm really not sure what's going on, but I'm sort of surprised that it got this far.  I don't know that we've done any tests with an obfuscator.  Is there any chance that you have a relatively small repro you could share with us?  Have you tried attaching the debugger and looking at the string and the index at the point where there's the problem?

- Danny

- Danny


这篇关于混淆后,查询执行会抛出异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆