c# - Instantiating a class produces ReflectionTypeLoadException at Assembly.GetTypes() -


I found that after making your application Telerik report

  result on = new ReportProcessor () .RenderReport ("PDF", New instance report Sorsa {report document = new mitric report (data)}, blank); Var stream = new memorystream (result. Documents bytes); Return CreateHttpFileResponse ("MyReport.pdf", stream, "Application / PDF");  

I'm not able to get all the types of inside CurrentDomain

  on typesWithAttribute = (AppDomain.CurrentDomain.GetAssemblies In / from (from) A.GetTypes () appears in / / error from T / / select some filtering log t) .Oolist ();  

I'm getting the error

system. reflection. Reflection Type Lip Exception: Unable to load one or more requested types. Recover the LoaderExceptions property for more information

LoaderExceptions. System.IO.FileNotFoundException: The file or assembly could not load DocumentFormat.OpenXml, version = 2.0.5022.0, culture = neutral, public key token = 31bf3856ad364e35 'or one of its dependencies specified system Unable to locate the file. File name: Telerik: 'DocumentFormat.OpenXml, version = 2.0.5022.0, culture = neutral, publicKeyToken = 31bf3856ad364e35'

After some investigation I think that the assembly load Found to fail Reporting.OpenXmlRendering, Version = 8.0.14.311, Culture = Neutral, PublicKeyToken = a9d7983dfcc261be and that assembly AppDomain.CurrentDomain.GetAssemblies () Before I generate report (I think in Dynamic Load Telerik.Reporting, Version = 8.0.14.311, Culture = Neutral, PublicKeyToken = a9d7983dfcc261be ) by the Assembly does not exist.

I think that the assembly can be filtered as I do not need any of it, but I am concerned about the fact that there is assembly in the domain which is not loaded Can be done - I find something wrong.

Can anyone explain what happens? Is this my problem or is the mistake of a third party library which does not load all the necessary assemblies?

This issue is not an assembly, but the type is coming from the dependent assembly Which has not been loaded.

If the GetTypes method is called in an assembly and in a way that the assembly is dependent on a type of assembly that has not been loaded (for example, if it is the second assembly In one way), then a ReflectionTypeLoadException is thrown.


Comments