Developer forum

Forum » Development » RE: System.Reflection.ReflectionTypeLoadException

RE: System.Reflection.ReflectionTypeLoadException

Dmitrij Jazel
Reply

Hey Guys,

 

Just updated 8.5 application to newest 8.6.1.5

When In /Admin, no issues what's so ever.

As soon as I press Management center, getting this error:

Any idea what can cause this?

http://screencast.com/t/teT7Plwge

 

/Dmitrij

 


Replies

 
Nicolai Høeg Pedersen
Reply
This post has been marked as an answer

Hi Dmitrij

You have not updated correctly. There are missing dlls in your bin or you have some ugly ones. Copy from the application/bin into your solution.

It is the repository causing the problem.

Votes for this answer: 1
 
Dmitrij Jazel
Reply

hei Nicolai,

yes, it looks like one of the stopped working properly. Not sure why would it ever do that, but still thanks for info.

It was a dll from side project that was done on that server some time ago.

I guess I take it from here :) Thanks allot so far :)

 

/Dmitrij

 
Dmitrij Jazel
Reply

By the way, in that side project I am using Drawing class, and here are my using statements.

using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Text;

 

Anything particular that could cause this exception?

 

 
Nicolai Høeg Pedersen
Reply

Not that I know of. The error comes from MEF which do not like unmanaged assemblies - maybe that could be the issue?

 
Dmitrij Jazel
Reply

Well... that is really weared.

As that library actually is tidy, and nicly written.

It has it's own namespace, and it worked perfectly on 8.5.

So now we have a bit of an issue, We can't use management center with that dll, and we can't use site without that dll :-)

Any suggestions?

 
Dmitrij Jazel
Reply

According to this:

https://msdn.microsoft.com/en-us/library/ms973872.aspx

This might happen if I am making calls to other API like Excel, and other, etc... (as far as I understood), to be honest, first time dealing with "Unmanaged library issue".

What I am doing there, is basically locating Application Root folder through Path class.

Than I locate the folder within DW app.

Than I am grabbing a JPG file in it, and than I draw a barcode on it. And save it save it with a new name.

... Done.

But what is so "unmanaged about it"...

 

Downgraded application, management center works back as normal.

 
Jeppe Eriksson Agger Dynamicweb Employee
Jeppe Eriksson Agger
Reply

Hi all,

First of all, that MSDN article is from 2003 and might out-dated.

Secondly, where is the unmanaged code you refer to? All I see in the using statements above are references to .NET Framework namespaces.

Thirdly, have you identified the side project as the culprit? I mean, does the error go away on 8.6.1 when you remove that assembly? In that case, I'd look at the references of that assembly, as there's probably something in there that shouldn't be there or a reference to an assembly that does not exist in the bin folder. By the way, it does not matter how simple the code is inside the assembly, if it references a missing resource it will fail no matter what.

- Jeppe

 
Jeppe Eriksson Agger Dynamicweb Employee
Jeppe Eriksson Agger
Reply

Also, you can look at the full stack trace as it tell you exactly which referenced resource it was trying to load but couldn't. It won't tell you which assembly was trying to load it, but it might help you identify the problematic assembly.

It's in the section called "ActivationException".

Once you identify the missing resource, you have two options. Remove/rewrite the referencing assembly or add the missing resource.

- Jeppe

 
Dmitrij Jazel
Reply

Hey Jeppe,

Agree with the way of thought you suggested. 

, it does not matter how simple the code is inside the assembly, if it references a missing resource it will fail no matter what.

Totally agree.

I think I found where the issue was here. Back when I compiled the solution, it was coded in .net 4.5 THAN I converted it to 4.5.1 while DW was working on 8.5 it was allright.

But as soon as I upgraded it, it started to complaining.

 

What I did was:

Just started fresh project (class library as prior one).

Set project to compile 4.5.1

Copy/pasted code, and tryed to compile - Result, I got a message that 

System.Drawing; 
System.Drawing.Imaging;

Are not present. This means they are obsolete. 

So, basically I just removed this function from the shop, and will have to solve it in some other way.

 

 
Jeppe Eriksson Agger Dynamicweb Employee
Jeppe Eriksson Agger
Reply

Well, System.Drawing and System.Drawing.Imaging are not obsoleted. The reason you can't use them is because you haven't referenced them in the project. Right click your project and select "Add -> Reference...". Click Assemblies -> Framework on the left side and scroll down the list to find the System.Drawing element. Check this and click OK. Now you should be able to use both namespaces.

- Jeppe

 
Dmitrij Jazel
Reply

Hi Jeppe :)

Well this made the trick :)

Thanks allot for the tip, but it works perfectly now.

 

/Dmitrij

 

You must be logged in to post in the forum