dotnet / Open-XML-SDK

Open XML SDK by Microsoft
https://www.nuget.org/packages/DocumentFormat.OpenXml/
MIT License
3.99k stars 545 forks source link

OpenXML-Dll defines System.Collections.Generic.IReadonlyList in conflict with mscorlib #426

Closed marcus-sonestedt closed 6 years ago

marcus-sonestedt commented 6 years ago

Description

System.Collections.IReadonlyList added in #400 conflicts with mscorlib

Information

Repro

Observed

Unhandled Exception: Aras.Tools.SolutionUpgrade.CItemException: Failed login to Innovator; original error: Line number -35, Error Number: CS1685, Warning as Error: The predefined type 'System.Collections.Generic.IReadOnlyList' is defined in multiple assemblies in the global alias; using definition from 'c:\Windows\Microsoft.NET\Framework64\v4.0.30319\mscorlib.dll' Line number -35, Error Number: CS1685, Warning as Error: The predefined type 'System.Collections.Generic.IReadOnlyCollection' is defined in multiple assemblies in the global alias; using definition from 'c:\Windows\Microsoft.NET\Framework64\v4.0.30319\mscorlib.dll'

Expected

System.Collections.Generic.IReadOnlyList should not be defined in this assembly under the same name

marcus-sonestedt commented 6 years ago

Backing to 2.7.2 fixed the issue, btw.

twsouthwick commented 6 years ago

@marcusl Can you include a repro? This type is internal and I'm surprised it's showing up anywhere. I'll switch the namespace to something internal regardless, but I'm interested in what's causing this

marcus-sonestedt commented 6 years ago

Not easily, as it showed up when I included the DLL on some customizations on the Aras Innovator PLM web application, so nothing small and local. Easy to repro for me, not easy to export for someone else. (200 MB of web app).

Maybe the dynamic assembly loading done by the PLM web app circumvents the internal modifier somehow. I'm not sure, as that is a bit above my current .NET competence level, but I can investigate and see if it is possible to create something small and reproducible. Will take a few weeks though.

Nevertheless, using the same names as system classes sounds like begging for trouble?

twsouthwick commented 6 years ago

Ok. If you find anything, let me know. I've submitted a fix for this, and it'll be available in the CI shortly after building. We probably won't have a stable 2.9.0 release until after .NET Core 2.1 comes out (there's a fix in System.IO.Packaging that we want to incorporate), so you can stay on 2.7.2, use the prerelease version, or we can create a 2.8.2 release with this fix. Since you're targeting .NET Framework 4.0, you shouldn't be missing too much staying on 2.7.2.

marcus-sonestedt commented 6 years ago

Will do. 2.7.2 is fine for quite some time.

twsouthwick commented 6 years ago

I'm not familiar with the Aras Innovator PLM web application, but it may be good to see if you can log an issue there that they are trying to load internal types.

marcus-sonestedt commented 6 years ago

I'll do that! https://twitter.com/mlyar/status/971501942227775489

marcus-sonestedt commented 6 years ago

Just following up that a better place for a link is probably their community forum, as the official (paid) support does not have an open issue tracker, AFAIK.

http://community.aras.com/en/forums/topic/dlls-in-method-config-are-loaded-with-internals/

len5417 commented 6 years ago

I just updated to OpenXML.DLL version 2.8.1 and am getting this warning. I was using version 2.5 previously and made no other dependency changes, so I'm operating under the assumption that the OpenXML.DLL upgrade is where my issue started. I see this is closed, is there somewhere I can go for more information?

twsouthwick commented 6 years ago

The fix is in, but hasn't been released yet. We're in the process of doing so. Are you also using the aras tools?

twsouthwick commented 6 years ago

Just to clarify, this is a bug with Aras (or whatever you are using to host the app) as it is incorrectly not honoring visibility rules. You can use the latest CI build of 2.9.0 stable (we haven't pushed it to NuGet but it is supported as a stable release) which has this fix, but also please contact the developers of the hosting framework to notify them they have a potentially serious bug. Not honoring visibility should be fixed on their ends ASAP.

musabmjafri commented 5 years ago

Anyone has any idea when will this be pushed to NuGet?

twsouthwick commented 5 years ago

Please see #512. Feel free to add the myget feed to get 2.9.0 - it is a supported release and supported mechanism to retrieve the package.

There was a policy change to NuGet for Microsoft products to be authenticode signed by Microsoft, while we have been signing with the .NET Foundation. Due to this, we haven't been able to update the nuget feed. It is being worked on, but requiring a lot of background work to get approvals/ci setup/etc. Thanks for your patience.