ILMerge Error

Posts   
 
    
JeffN825
User
Posts: 33
Joined: 04-Jun-2008
# Posted on: 04-May-2010 17:12:37   

Hi,

I'm trying to use ILMerge to create a merged assembly, including both generic and DBSpecific projects, as well as the SD dlls, but get the following error trying to run a LINQ query.

MyProj.All is the merged assembly and is the only assembly referenced by my console application.

All the individual projects getting merged into MyProj.All have non-strong-name references to the SD dlls.

I've verified the same query works fine when referencing all dlls individually.

Any ideas before I go stepping through the source code?

Thanks!

Exception:


System.Reflection.TargetInvocationException occurred
  Message="Exception has been thrown by the target of an invocation."
  Source="mscorlib"
  StackTrace:
       at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
       at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
       at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
       at System.Delegate.DynamicInvokeImpl(Object[] args)
       at System.Delegate.DynamicInvoke(Object[] args)
       at MyProj.Data.Infrastructure.Queries.QueryRunner.RunQuery(IQueryable query) in C:\Development\MyProj\Source\Main\MyProj.Data.Infrastructure\Queries\QueryRunner.cs:line 53
  InnerException: System.NullReferenceException
       Message="Object reference not set to an instance of an object."
       Source="MyProj.All"
       StackTrace:
            at SD.LLBLGen.Pro.LinqSupportClasses.LinqUtils.GetEntityNameFromType(Type entityType, IElementCreatorCore generatedCodeElementCreator)
            at SD.LLBLGen.Pro.LinqSupportClasses.LinqUtils.GetEntityName(Object value, IElementCreatorCore generatedCodeElementCreator)
            at SD.LLBLGen.Pro.LinqSupportClasses.ExpressionHandlers.QueryExpressionBuilder.CreateDynamicRelation(Object left, Object right, JoinHint joinType, String aliasLeft, String aliasRight, IPredicate onClause)
            at SD.LLBLGen.Pro.LinqSupportClasses.ExpressionHandlers.QueryExpressionBuilder.HandleJoinExpression(JoinExpression expressionToHandle)
            at SD.LLBLGen.Pro.LinqSupportClasses.ExpressionHandlers.GenericExpressionHandler.HandleExpression(Expression expressionToHandle)
            at SD.LLBLGen.Pro.LinqSupportClasses.ExpressionHandlers.QueryExpressionBuilder.HandleExpression(Expression expressionToHandle)
            at SD.LLBLGen.Pro.LinqSupportClasses.ExpressionHandlers.GenericExpressionHandler.HandleSelectExpression(SelectExpression expressionToHandle, SelectExpression newInstance)
            at SD.LLBLGen.Pro.LinqSupportClasses.ExpressionHandlers.GenericExpressionHandler.HandleSelectExpression(SelectExpression expressionToHandle)
            at SD.LLBLGen.Pro.LinqSupportClasses.ExpressionHandlers.QueryExpressionBuilder.HandleSelectExpression(SelectExpression expressionToHandle)
            at SD.LLBLGen.Pro.LinqSupportClasses.ExpressionHandlers.QueryExpressionBuilder.HandleWhereExpression(WhereExpression expressionToHandle)
            at SD.LLBLGen.Pro.LinqSupportClasses.ExpressionHandlers.GenericExpressionHandler.HandleExpression(Expression expressionToHandle)
            at SD.LLBLGen.Pro.LinqSupportClasses.ExpressionHandlers.QueryExpressionBuilder.HandleExpression(Expression expressionToHandle)
            at SD.LLBLGen.Pro.LinqSupportClasses.ExpressionHandlers.GenericExpressionHandler.HandleSelectExpression(SelectExpression expressionToHandle, SelectExpression newInstance)
            at SD.LLBLGen.Pro.LinqSupportClasses.ExpressionHandlers.GenericExpressionHandler.HandleSelectExpression(SelectExpression expressionToHandle)
            at SD.LLBLGen.Pro.LinqSupportClasses.ExpressionHandlers.QueryExpressionBuilder.HandleSelectExpression(SelectExpression expressionToHandle)
            at SD.LLBLGen.Pro.LinqSupportClasses.ExpressionHandlers.GenericExpressionHandler.HandleExpression(Expression expressionToHandle)
            at SD.LLBLGen.Pro.LinqSupportClasses.ExpressionHandlers.QueryExpressionBuilder.HandleExpression(Expression expressionToHandle)
            at SD.LLBLGen.Pro.LinqSupportClasses.ExpressionHandlers.GenericExpressionHandler.HandleSelectExpression(SelectExpression expressionToHandle, SelectExpression newInstance)
            at SD.LLBLGen.Pro.LinqSupportClasses.ExpressionHandlers.GenericExpressionHandler.HandleSelectExpression(SelectExpression expressionToHandle)
            at SD.LLBLGen.Pro.LinqSupportClasses.ExpressionHandlers.QueryExpressionBuilder.HandleSelectExpression(SelectExpression expressionToHandle)
            at SD.LLBLGen.Pro.LinqSupportClasses.ExpressionHandlers.GenericExpressionHandler.HandleExpression(Expression expressionToHandle)
            at SD.LLBLGen.Pro.LinqSupportClasses.ExpressionHandlers.QueryExpressionBuilder.HandleExpression(Expression expressionToHandle)
            at SD.LLBLGen.Pro.LinqSupportClasses.ExpressionHandlers.GenericExpressionHandler.HandleSelectExpression(SelectExpression expressionToHandle, SelectExpression newInstance)
            at SD.LLBLGen.Pro.LinqSupportClasses.ExpressionHandlers.GenericExpressionHandler.HandleSelectExpression(SelectExpression expressionToHandle)
            at SD.LLBLGen.Pro.LinqSupportClasses.ExpressionHandlers.QueryExpressionBuilder.HandleSelectExpression(SelectExpression expressionToHandle)
            at SD.LLBLGen.Pro.LinqSupportClasses.ExpressionHandlers.GenericExpressionHandler.HandleExpression(Expression expressionToHandle)
            at SD.LLBLGen.Pro.LinqSupportClasses.ExpressionHandlers.QueryExpressionBuilder.HandleExpression(Expression expressionToHandle)
            at SD.LLBLGen.Pro.LinqSupportClasses.LLBLGenProProviderBase.HandleExpressionTree(Expression expression)
            at SD.LLBLGen.Pro.LinqSupportClasses.LLBLGenProProviderBase.Execute(Expression expression)
            at SD.LLBLGen.Pro.LinqSupportClasses.LLBLGenProProviderBase.System.Linq.IQueryProvider.Execute[TResult](Expression expression)
            at System.Linq.Queryable.SingleOrDefault[TSource](IQueryable`1 source)
            at lambda_method(ExecutionScope )
       InnerException: 


Expression:

value(SD.LLBLGen.Pro.LinqSupportClasses.DataSource2`1[DataModel.EntityClasses.CredentialEntity]). Join(value(SD.LLBLGen.Pro.LinqSupportClasses.DataSource2`1[DataModel.EntityClasses.ApplicationEntity]), credential => credential.ApplicationId, application => application.ApplicationId, (credential, application) => new Services.1955.<>f__AnonymousType0`2(credential = credential, application = application)).Join(value(SD.LLBLGen.Pro.LinqSupportClasses.DataSource2`1[DataModel.EntityClasses.PersonEntity]), <>h__TransparentIdentifier5 => <>h__TransparentIdentifier5.credential.PersonId, person => person.PersonId, (<>h__TransparentIdentifier5, person) => new Services1955.<>f__AnonymousType1`2(<>h__TransparentIdentifier5 = <>h__TransparentIdentifier5, person = person)).Where(<>h__TransparentIdentifier6 => (((<>h__TransparentIdentifier6.<>h__TransparentIdentifier5.credential.UserName = "System") && (<>h__TransparentIdentifier6.<>h__TransparentIdentifier5.application.ShortName = "MyApp")) && (<>h__TransparentIdentifier6.<>h__TransparentIdentifier5.credential.AuthenticationStateId = 1))).Select(<>h__TransparentIdentifier6 => <>h__TransparentIdentifier6.<>h__TransparentIdentifier5.credential).WithPath(value(SD.LLBLGen.Pro.LinqSupportClasses.IPathEdge[])).SingleOrDefault()

Query:

      var credentialInfo =
                (from credential in context.CredentialEntity
                 join application in context.ApplicationEntity on credential.ApplicationId equals application.ApplicationId
                 join person in context.PersonEntity on credential.PersonId equals person.PersonId
                 where credential.UserName == credentialToValidate.UserName
                       && application.ShortName == credentialToValidate.ApplicationShortName
                       && credential.AuthenticationStateId == (int)AuthenticationState.Active
                 select credential).WithPath(new IPathEdge[]
                                                 {
                                                     new PathEdge<ApplicationEntity>(CredentialEntity.PrefetchPathApplication),
                                                     new PathEdge<PersonEntity>(CredentialEntity.PrefetchPathPerson)
                                                 }).SingleOrDefault();

MTrinder
User
Posts: 1461
Joined: 08-Oct-2008
# Posted on: 04-May-2010 21:26:49   

Sorry, there is only one other reference to ILMerge on the forums, and it's not particularly relevant to your problem.

I've never used so can't really offer a lot of help - it's not something we recommend.

Can I ask WHY you want to do this ? I've never come across the need to munge all my dlls into one enormous one simple_smile

Matt

JeffN825
User
Posts: 33
Joined: 04-Jun-2008
# Posted on: 04-May-2010 22:53:00   

Specifically, we want to do this because we redistribute our code as a component, referenced by other projects in our organization. To request these projects deploy all 15 or so dlls of our dlls is a huge deployment hassle. It's much easier to hand over a single dll and say "Here, reference this."

I also tried merging only the DBGeneric and DBSpecific dlls, but leaving the SD dlls unmerged and I experienced the same exception from my original post...so it seems to have something to do with those assemblies...

Thanks.

MTrinder
User
Posts: 1461
Joined: 08-Oct-2008
# Posted on: 05-May-2010 00:01:23   

If you can live with just the DBGeneric and DB Specific in one dll, this can be accomplished by just adding all the files to one project, and building that.

Matt