Error loading assembly with EntlibConfig for EntLib 5.0

Topics: Exception Handling Application Block, General discussion
Mar 31, 2010 at 10:41 AM
Hi, I am trying to use to add a Custom Exception Handling with the EntLibConfig but when I try to use the option 'Add from File' from the 'Select type' Dialog I receive the following error: Error loading assembly: Could not load file or assembly 'file///...\AppData\Local\Temp\tmp9E7.tmp' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.. What should I do to solve it?
Mar 31, 2010 at 11:23 AM

Hi chezinho,

Are you using Beta2 here? Does the same error prompt when Visual Studio Configurator is used? Also, can you post your Custom Exception Handler here? Thanks


Mar 31, 2010 at 11:33 AM
Edited Mar 31, 2010 at 11:45 AM

Hi ginkapitan,

Yes I am using Beta2 and I don't have the same problem when I use Visual Studio Configurator.

Problem is that I am using VS 2010 RC, and I don't know if it is already possible to use VS Configurator with it.

This is the Custom Exception Handler that I am using (it is the same from the examples in the documentation):


public class AppMessageExceptionHandler : IExceptionHandler


public AppMessageExceptionHandler(NameValueCollection ignore)



public Exception HandleException(Exception exception, Guid handlingInstanceId)


this.ShowThreadExceptionDialog(exception, handlingInstanceId);

return exception;


private void ShowThreadExceptionDialog(Exception ex, Guid handlingInstanceId)


string errorMsg = "The following exception was caught by the QuickStart Global Exception Handler:"

+ Environment.NewLine + Environment.NewLine;

StringBuilder sb = new StringBuilder();

StringWriter writer = new StringWriter(sb);

AppTextExceptionFormatter formatter = new AppTextExceptionFormatter(writer, ex, handlingInstanceId);


errorMsg += sb.ToString();

Console.WriteLine("Application Error: " + errorMsg);



and this is the textFormatter:

public class AppTextExceptionFormatter : TextExceptionFormatter


public AppTextExceptionFormatter(TextWriter writer, Exception exception, Guid handlingInstanceID)

: base(writer, exception, handlingInstanceID)



protected override void WriteStackTrace(string stackTrace)



protected override void WriteExceptionType(Type exceptionType)



base.Writer.WriteLine("Type: {0}", exceptionType.FullName);




Mar 31, 2010 at 12:08 PM

I haven't tried it in VS2010 RC too.

Your custom handler works fine on my end.

Though, I just have some more questions;

   What EntLibConfig tool are you using? Is it the one in the "Microsoft Enterprise Library 5.0 Beta 2 - March 2010" folder or the one that is found in the EntLib50Beta2Src?

   Also, what entlib assembly are you using compiling your custom handler with? Is it the signed or unsigned one?



Mar 31, 2010 at 1:05 PM

Hello ginkapitan,

So I tried to use both the EntLibConfigs with the handler compiled with the respective assembly (signed and unsigned) and I had the same result in both cases.

Also now I also tested compiling the handler with VS 2008 and it didn't show the message error, but no loaded assembly appeared...

When I did the same using the Visual Studio Configurator and the handler compiled in VS 2008 it worked fine...

Mar 31, 2010 at 1:41 PM


I've also tried doing the same thing you did (using both EntLibConfig).

Though, in my observation a compiled handler with an unsigned assembly can only be open with the EntLibConfig found in the  "EntLib50Beta2Src" and for the signed it only open with the one on the "Microsoft Enterprise Library 5.0 Beta 2 - March 2010". And if I try to open the handler with a EntLibConfig tool that is not compatible with it I am getting the "no loaded assembly appeared".

Have you try if this is also the case on your part?


Mar 31, 2010 at 1:59 PM

Yep I reproduced the same thing here, but only when I compiled under VS 2008.

When I tried to use VS 2010 RC It never works, doesn't matter which EntLibConfig or assemblies you use.

Think I am just gonna have to wait for the final release, hope it works with 2010

Thanks ginkapitan!

Mar 31, 2010 at 2:12 PM’s a pleasure for me to help...And I hope I did :-)

Hmmm...I think that makes VS 2010 seems interesting...



Mar 10, 2011 at 1:14 PM
Edited Mar 10, 2011 at 1:14 PM


I am new to EntLib 5.0 , i am also facing the same issue When i want to use custom exception handler in Exception handling block it is not showing any assemblies, I saw ur discussion, May i know what is meant by Visual Studio Configurator I couldn't find any thing in google. I am using VS 2008 Professional edition.


Thank you in advance



Mar 11, 2011 at 1:05 AM

I think they meant the EntLib configuration tool that is integrated with Visual Studio.  What is the specific error message you're getting?


Sarah Urmeneta
Global Technologies and Solutions
Avanade, Inc.

Mar 11, 2011 at 3:50 AM

I am using the Entlib Configuration tool integrated with Visaul Studio 2008 no  error message

, but no loaded assembly appeared... when i am selecting custom exception handler

-thank u


Mar 11, 2011 at 4:07 AM
Edited Mar 11, 2011 at 5:52 AM

Did you reference the assembly which has your custom exception handler?

 One more thing, if that assembly was already loaded previously in the config tool when the custom exception handler doesn't exist yet, you need to restart Visual Studio.  This is because newer version of assemblies doesn't get reloaded once it has been loaded into an AppDomain.  Thus, the tool still can't find your custom exception handler.


Sarah Urmeneta
Global Technologies and Solutions
Avanade, Inc.