Reflexil replace all with code fail (CS1703)

8 posts, 0 answers
  1. -
    - avatar
    3 posts
    Member since:
    Dec 2013

    Posted 23 Dec 2013 Link to this post

    Whenever I try to edit something with the "Replace all with code" function I get this error:

    CS1703: An assembly with the same identity 'mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' has already been imported. Try removing one of the duplicate references.

    I'm not getting what the problem is. There is only one reference to mscorlib.
    Editing the assembly with that IL editor works flawlessly but is annoying and slow. How can I get rid of the error?
  2. Vladi
    Admin
    Vladi avatar
    167 posts

    Posted 27 Dec 2013 Link to this post

    Hello,

    Sorry for the slow reply.

    Can you please share the assembly you're trying to edit to try to reproduce or just share any other publicly available assembly with which this error can be reproduced?

    Regards,
    Vladi
    Telerik
    Tell us what you think about JustDecompile. Your opinion matters! You can use our forum, or our JustDecompile UserVoice website for feature requests.
  3. DevCraft banner
  4. -
    - avatar
    3 posts
    Member since:
    Dec 2013

    Posted 27 Dec 2013 Link to this post

    Hello,

    The error happens with any assembly compiled by Unity (or whatever the editor uses for compiling, I don't know)
    I've created an empty test project where you can see the error:

    https://dl.dropboxusercontent.com/u/143512782/Test2.rar

    The assembly is located in /Test2/Test2_Data/Managed/Assembly-CSharp.dll
    When you try editing the code in the one function it will complain about double references to mscorlib. I hope there's an easy solution!

    edit: fixed link
  5. -
    - avatar
    3 posts
    Member since:
    Dec 2013

    Posted 01 Jan 2014 Link to this post

    No answer in 4 days? :(
  6. Momchil
    Admin
    Momchil avatar
    31 posts

    Posted 02 Jan 2014 Link to this post

    Hello,

    First of all, sorry for the late reply.  Most of us were out of office and this is the reason for the delay.

    I investigated the problem a little bit with the assemblies you have provided and it seems to me that the issue is in Reflexil plugin's source itself and the fact that you are trying to manipulate a Silverlight assembly that references a normal .NET assembly.  I'm not sure how exactly is your assembly compiled (I'm not familiar with Unity) but Reflexil fails to compile such a combination of assemblies, stating that there is a duplicate reference of mscorlib.  

    As fixing the issue for this corner case in Reflexil might not be that easy and fast, I would like to suggest you two options:
    1. If you own the source code of the assembly, modify it directly there and compile it using Unity.
    2. If you don't own the source, extract the code with JustDecompile via the "Create Project" option -- it will generate you a complete Visual Studio project with the code of the assembly.  Then modify it there and use it wherever you would like to (for example, Unity).

    Thank you for your patience and sorry once again for the delay of this answer.

    Regards,
    Momchil
    Telerik
    Tell us what you think about JustDecompile. Your opinion matters! You can use our forum, or our JustDecompile UserVoice website for feature requests.
  7. Sébastien
    Sébastien avatar
    1 posts
    Member since:
    Jul 2014

    Posted 30 Jul 2014 in reply to Momchil Link to this post

    Hi,

    Sebastien Lebreton Here (Reflexil author).

    First your files seems strange:
    Assembly-CSharp.dll is referencing mscorlib 2.0.5.0 (PublicKeyToken 7cec85d7bea7798e). No problem with that because Unity is using those assemblies for web based projects.
    But Assembly-CSharp.dll is also referencing UnityEngine.dll, which is referencing mscorlib 2.0.0.0 (PublicKeyToken b77a5c561934e089)...

    Btw you can do what you want easily:
    just rename in your Managed folder mscorlib.dll to mscorlib.xxx, so that the Reflexil assembly resolver will not load the file.

    Launch Telerik+Reflexil and use Replace All with Code. 

    Reflexil will use mscorlib 2.0.0.0 for the compilation process only.

    Tested here with Reflector+Reflexil 1.8 but it should be exactly the same on Telerik+Reflexil.

    Regards
    Seb







  8. Mohamed
    Mohamed avatar
    1 posts
    Member since:
    Nov 2015

    Posted 21 Nov 2015 in reply to Sébastien Link to this post

    It doesnt work for me because i use some parameters from mscorlib 2.0.5.0
  9. Alexander
    Admin
    Alexander avatar
    80 posts

    Posted 23 Nov 2015 Link to this post

    Hello Mohamed,

    As one of my colleagues pointed out before - this seems to be problem in the Reflexil itself, not in JustDecompile. Reflexil has a GitHub repository where you can write down an issue. By doing that you can get supported by Sébastien Lebreton, the Reflexil's author. This seems to be the only way I can help you.

    Regards,
    Alexander
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top
DevCraft banner