Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / June 2006

Tip: Looking for answers? Try searching our database.

Possible binding issue

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Trent Rossiter - 26 Jun 2006 19:00 GMT
I am using reflection to create an assembly (Assembly A) and invoke a method.
Assembly A has its own config file, which is set at run time. To read this
config file I had to set some binding flags in the code, now this seems to
work fine, Assembly A can read its config file. However Assembly A references
another assembly (Assembly B), which in turn references some Application
Blocks to interact with Authorization Manager.

The error I get says :
System.Configuration.ConfigurationException: Could not create
Microsoft.ApplicationBlocks.Common.ProviderConfigHandler,
Microsoft.ApplicationBlocks.Common,
Version=1.0.0.0,Culture=neutral,PublicKeyToken=efeb39a96c5c847f

Since “ProviderConfigHandler” shows up in the configuration files (XML
files) for the Application Blocks, it leads me to believe that I am having
further binding issues, perhaps farther down the call stack, and that perhaps
these config files cannot be read.

Note: If I make a references to Assembly A directly, i.e. without using
reflection, everything works fine. In fact, I didn’t even need to adjust my
BindingFlags at run time until I started creating the assembly using
reflection.
The binding flags were set to the following:
BindingFlags.NonPublic|BindingFlags.Static

Any ideas?
Trent Rossiter - 28 Jun 2006 21:39 GMT
I spoke with Microsoft Support and found the answer. The application blocks
are using relative addressing to locate things, probably configuration
information. Since I was creating assemblies that reside a different
directory, they could not find their configuration files and were throwing an
exception.

There are two ways to solve the problem:
1. Put all the assemblies in the same directory. This is a very simple
solution, but it was not appealing to me because I wanted the assemblies that
were to be loaded at run-time to be in their own special directory.
2. Add an AppDomain.CurrentDomain.AppendPrivatePath(directory) statement
just before I tried to load the assembly. This fixed my problem and allowed
me to put my assemblies in any directory that I wanted.

Hopefully this will help someone at some point.

Trent
Signature

Trent Rossiter

> I am using reflection to create an assembly (Assembly A) and invoke a method.
> Assembly A has its own config file, which is set at run time. To read this
[quoted text clipped - 22 lines]
>
> Any ideas?

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.