GithubHelp home page GithubHelp logo

Comments (16)

gluck avatar gluck commented on July 24, 2024

Both your assemblies are already ILMerg'ed with Newtonsoft.Json (meaning they both define the types, as internal, you can see them using ildasm or reflector or ilspy...).
If you're lucky enough that the same version was used in both cases, try IL Repack with /union.

Let me know if it works.

from il-repack.

thejuan avatar thejuan commented on July 24, 2024

I'm using union already. :(
I hadn't noticed Magnum was using Newton as well.
Is there any way around it?

-----Original Message-----
From: Francois Valdy [mailto:[email protected]]
Sent: 09 July 2012 14:31
To: Adam
Subject: Re: [il-repack] Exception when merging Magnum and MassTransit into a new assembly (#10)

Both your assemblies are already ILMerg'ed with Newtonsoft.Json (meaning they both define the types, as internal, you can see them using ildasm or reflector or ilspy...).
If you're lucky enough that the same version was used in both cases, try IL Repack with /union.

Let me know if it works.


Reply to this email directly or view it on GitHub:
#10 (comment)

from il-repack.

thejuan avatar thejuan commented on July 24, 2024

The should both be the same version

-----Original Message-----
From: Francois Valdy [mailto:[email protected]]
Sent: 09 July 2012 14:31
To: Adam
Subject: Re: [il-repack] Exception when merging Magnum and MassTransit into a new assembly (#10)

Both your assemblies are already ILMerg'ed with Newtonsoft.Json (meaning they both define the types, as internal, you can see them using ildasm or reflector or ilspy...).
If you're lucky enough that the same version was used in both cases, try IL Repack with /union.

Let me know if it works.


Reply to this email directly or view it on GitHub:
#10 (comment)

from il-repack.

gluck avatar gluck commented on July 24, 2024

I checked the code and /union is ignored if the types are internal, it prefers renaming the types (may not be the best choice).
If you feel adventurous, you may try hacking around ILRepack.cs:1370 to change that.

Otherwise I'll try the merge and see:

  1. why the renaming doesn't work (likely some reference was missed during the rename process)
  2. if we could check /union and/or dupTypes BEFORE renaming, even for internal types

Thx.

from il-repack.

thejuan avatar thejuan commented on July 24, 2024

Thanks, I changed that line to read

else if (type.FullName != "" && !type.IsPublic && !UnionMerge)

and it is working.

Adam

-----Original Message-----
From: Francois Valdy [mailto:[email protected]]
Sent: 09 July 2012 15:15
To: Adam
Subject: Re: [il-repack] Exception when merging Magnum and MassTransit into a new assembly (#10)

I checked the code and /union is ignored if the types are internal, it prefers renaming the types (may not be the best choice).
If you feel adventurous, you may try hacking around ILRepack.cs:1370 to change that.

Otherwise I'll try the merge and see:

  1. why the renaming doesn't work (likely some reference was missed during the rename process) 2. if we could check /union and/or dupTypes BEFORE renaming, even for internal types

Thx.


Reply to this email directly or view it on GitHub:
#10 (comment)

from il-repack.

thejuan avatar thejuan commented on July 24, 2024

The latest code base (or the way I am building) is causing Reference Resolution errors when I run it. It can't find my assemblies that are not being merged but are in the path specified for lib.
I'm just running the default debug build, should I be doing something different?
I was running 1.0.9 previously.

-----Original Message-----
From: Francois Valdy [mailto:[email protected]]
Sent: 09 July 2012 15:15
To: Adam
Subject: Re: [il-repack] Exception when merging Magnum and MassTransit into a new assembly (#10)

I checked the code and /union is ignored if the types are internal, it prefers renaming the types (may not be the best choice).
If you feel adventurous, you may try hacking around ILRepack.cs:1370 to change that.

Otherwise I'll try the merge and see:

  1. why the renaming doesn't work (likely some reference was missed during the rename process) 2. if we could check /union and/or dupTypes BEFORE renaming, even for internal types

Thx.


Reply to this email directly or view it on GitHub:
#10 (comment)

from il-repack.

thejuan avatar thejuan commented on July 24, 2024

It does work if I run it in the same directory as the lib dll's

-----Original Message-----
From: Francois Valdy [mailto:[email protected]]
Sent: 09 July 2012 15:15
To: Adam
Subject: Re: [il-repack] Exception when merging Magnum and MassTransit into a new assembly (#10)

I checked the code and /union is ignored if the types are internal, it prefers renaming the types (may not be the best choice).
If you feel adventurous, you may try hacking around ILRepack.cs:1370 to change that.

Otherwise I'll try the merge and see:

  1. why the renaming doesn't work (likely some reference was missed during the rename process) 2. if we could check /union and/or dupTypes BEFORE renaming, even for internal types

Thx.


Reply to this email directly or view it on GitHub:
#10 (comment)

from il-repack.

gluck avatar gluck commented on July 24, 2024

Migration to latest Cecil may be causing this, I'll try to have a look as well.

from il-repack.

thejuan avatar thejuan commented on July 24, 2024

That change is also affecting anonymous types, it seems to be reusing the one anonymous type across all methods (so the properties don’t match)

-----Original Message-----
From: Francois Valdy [mailto:[email protected]]
Sent: 10 July 2012 03:36
To: Adam
Subject: Re: [il-repack] Exception when merging Magnum and MassTransit into a new assembly (#10)

Migration to latest Cecil may be causing this, I'll try to have a look as well.


Reply to this email directly or view it on GitHub:
#10 (comment)

from il-repack.

thejuan avatar thejuan commented on July 24, 2024

Ok round 2.
I have removed the old change.
And changed line 93 of ReferenceFixator to
return ((TypeDefinition)type.DeclaringType).NestedTypes.First(x => x.FullName == type.FullName || x.FullName.EndsWith(">" + type.Name));

Not very elegant.
The nested type has a guid it's name but the type.FullName doesn't so it was not being found.

i.e.
ParentType/NestedTypeName vs ParentType/NestedTypeName

-----Original Message-----
From: Francois Valdy [mailto:[email protected]]
Sent: 10 July 2012 03:36
To: Adam
Subject: Re: [il-repack] Exception when merging Magnum and MassTransit into a new assembly (#10)

Migration to latest Cecil may be causing this, I'll try to have a look as well.


Reply to this email directly or view it on GitHub:
#10 (comment)

from il-repack.

gluck avatar gluck commented on July 24, 2024

You can try the latest sources, they should work properly, with either:

/allowdup:Newtonsoft.Json.* (to merge both versions of these types, can be used if they're known to be identical to reduce assembly size)

or no option at all (/union not required, as the conflicting types are internal, they'll be renamed automatically).

Cheers.

from il-repack.

thejuan avatar thejuan commented on July 24, 2024

Without the /allowdup (haven't tried it yet)
I get duplicate types in the assembly

Newtonsoft.Json.522512.<>f__Anonymouse Type0'2

-----Original Message-----
From: Francois Valdy [mailto:[email protected]]
Sent: 11 July 2012 13:59
To: Adam
Subject: Re: [il-repack] Exception when merging Magnum and MassTransit into a new assembly (#10)

You can try the latest sources, they should work properly, with either:

/allowdup:Newtonsoft.Json.* (to merge both versions of these types, can be used if they're known to be identical to reduce assembly size)

or no option at all (/union not required, as the conflicting types are internal, they'll be renamed automatically).

Cheers.


Reply to this email directly or view it on GitHub:
#10 (comment)

from il-repack.

gluck avatar gluck commented on July 24, 2024

That was the purpose indeed.
Without merging, Newtonsoft types from Magnum & MassTransit are seen as different types (different assemblies).
By renaming the types, we keep this coherence, and we have them duplicated in the merged assembly (which should still work properly).

If you're certain they're identical and want to avoid those duplicates, /allowdup is what you need.

from il-repack.

thejuan avatar thejuan commented on July 24, 2024

But without deduping I thought the renaming would prevent clashes?
I currently have clashes, I cant reflect the new the dll and I get errors about the duplicates when I open the dll in DotPeek (decompiler)

-----Original Message-----
From: Francois Valdy [mailto:[email protected]]
Sent: 13 July 2012 17:11
To: Adam
Subject: Re: [il-repack] Exception when merging Magnum and MassTransit into a new assembly (#10)

That was the purpose indeed.
Without merging, Newtonsoft types from Magnum & MassTransit are seen as different types (different assemblies).
By renaming the types, we keep this coherence, and we have them duplicated in the merged assembly (which should still work properly).

If you're certain they're identical and want to avoid those duplicates, /allowdup is what you need.


Reply to this email directly or view it on GitHub:
#10 (comment)

from il-repack.

gluck avatar gluck commented on July 24, 2024

And you thought right.
I tested with the latest binary drop of MassTransit and it seemed ok, but maybe I messed up somewhere, will try again.

from il-repack.

gluck avatar gluck commented on July 24, 2024

The .Net 3.5 version of Magnum gave me a hard time, but it should be good now.
Beware to either use the binary drop of 1.13, or update Cecil fork as well (as some generics-related fixes were there).

from il-repack.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.