New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Weaver Proposal: Fixing duplicate mscorlib references #43
Comments
The first issue as raised here, http://visualstudiogallery.msdn.microsoft.com/b0e0b5e9-e138-410b-ad10-00cb3caf4981, is caused by the C# compiler outputting a reference to the wrong mscorlib ("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089") when outputting (what we call) an old-style portable assembly. There should only be one reference in this particular case, and that's to "mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes". The second issue, as raised here, https://oxyplot.codeplex.com/discussions/431821, is a completely different issue. It is completely normal that there will be two mscorlib's (or even System.Core, System, etc) when a .NET Framework project consumes a portable library. This is normally a no-op as the runtime will automatically resolve them to the same assembly. What is likely happening, is that the WPF designer is not handling portable libraries in this particular context. Usually most applications and libraries don't need to handle portable libraries any differently as the runtime will automatically handle it - but in this case, the designer is calling LoadFile - in which case it is telling the runtime that its signing up to handle them. We fixed a bunch of these issues before we shipped, but it looks like one slipped through the cracks. I've filed a bug internally to track this. |
So do you want me to fix the 1st or 2nd or both? Would it be possible to get some binaries that have each of these problems? attached to this issue is fine And what do i name the weaver? "DavToldMeToBuildIt"? |
What about "IThoughtDotNetWouldSolveDllHellButInsteadItJustMadeItWorseSoHereIsAFixForTheStupidity"? |
Yeah I know. But if I can help them out without too much effort it seems On 18/02/2013, at 6:18 PM, Cameron MacFarland notifications@github.com What about — |
You can only fix just the first one. Removing references in the second case won't help it. If you changed to remove unused references (which I suggested on Twitter), then you call it just that. RemoveUnusedReferences. If you are going to make it just remove the mscorlib, 4.0.0.0 reference, then you need to make sure that you only do it when the TargetFrameworkAttribute has an identifier of ".NETPortable" and (exactly) Version=v4.0. Otherwise, you will break a lot more. |
so can i get an assembly that need to be fixed? the simpler the assembly the better. |
I only have an assembly for the second issue, not the first one. |
Can't work out how to attach files here. To create a module that exhibits the problem, do the following:
Looking at the output, this is going to be harder than I thought:
Therefore any such rule, must be very careful that it is only turned on in the specific case above. Let me repeat what I said, the second issue will not be fixed by removing one of the duplicated mscorlibs. These duplicated mscorlibs are to be expected in this case, and the second issue is not related to them. |
@davkean ok I am going to have a try at replicating/fixing this tonight (8 hours time) I will let you know how I go |
@davkean how do i look inside a netmodule with a decompiler? |
no response so closing |
I would also like to have this feature. Unfortunately, this issue has since been closed without a resolution, so I am just trying to continue the discussion. You should be able to reproduce the issue without having to change the OutputType to module, just leave it as Library. You can open the assembly in Telerik's JustDecompile and then expand the references node and you will see:
Thank you. |
@icnocop sounds great. do you want to start a fody addin that performs this clean up? |
@SimonCropp, I will try. I've used NotifyPropertyWeaver in the past, but am new to Fody, so this may be a good starting point. :) Thank you. |
@icnocop well the hardest part is picking a cool name and icon. the rest is easy. |
What about RedundantRedundantizR.Fody? |
deduplicator :) |
I created RemoveReference.Fody here: https://github.com/icnocop/RemoveReference.Fody There are still several more things to do:
Thank you. |
No description provided.
The text was updated successfully, but these errors were encountered: