473,785 Members | 2,794 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

MissingFieldExc eption in inherited class

I'll try to keep my explanation as simple as I can but leave in the relevant
details.

We're developing in c#.

Our main application can dynamically load assemblies ( plugins) that
support a certain interface (to do "extra" functions). Our intent is that
these assemblies won't be updated once fielded, and should be ok, as long as
the interface they're built upon doesn't change. Actually it can change, you
just only add things, not modify/deleted previous ones.

In addition to the interface, we've developed a base class that does a lot
of boiler plate things that all of our plugins will need to do. Our plugins
are built on our base class.

This was going well until some of our plugins (compiled a couple of versions
back) started failing. Both our interface and base have been recompiled, and
version number updated - but not actually changed.

We've narrowed the failure to those that access a protected property in the
base class. It is indicated as the "field not found". But it hasn't
changed, does exist, and is populated. If the derived class uses a base
class function (also protected) that uses the property, it works fine. But
if the derived class accesses the property, it gives the error.

A couple of other factors.
1) If the plugin is recompiled against the latest version of the
base/interface dlls, it works fine. (even tho no change).
2) The error occurs when the derived FUNCTION that uses the protected field
fails..not on its actual use. I verified this a couple of different ways.

I'm confused because I build a simple test case to try it out and it doesn't
fail (unless I really do alter the base class or interface so the protected
property isn't there or its type is changed).

I also disassembled both version of the base class and interface and can't
find any substantial differences. A couple of sizes changed.

So I'm looking for any clues or things to try. I plan on eliminating all
base member access (no more protected member variables) and I think that
will solve it, but I'd feel better if I could more definatively say why it
failed, duplicate it in my test cases, etc.

***
Restating more simply
A is an interface.
B is base class implementing A.
B has a protected member q. B has a protected function p.
C is a class dereived from B.

C (dynamically loaded into my app)is build against version 1.0 of A and B
and can use p and q fine.

If the app is updated (along with A and B) to version 2.0, and C isn't..any
function of c using q fails with "field not found: q" error. Functions using
p work fine.
A and B didn't change source, other than to update version #.
***
Any thoughts at all are welcome,

Thanks
Roger
Aug 25 '06 #1
1 2233
I have finally returned from my great journey of discovery and solved my
problem.

First bread crumb was that the MissingFieldExc eption was due to the fact my
protected field was of a type defined in my interface. Through some testing
this boiled down to a type mismatch error. My derived plugin thought the
base class was talking about a different type.

This was confusing because the types appeared to be..and were
logically..exac tly the same. Looking at AssemblyQualifi edName property name
I could see they referenced different versions. If I recompiled against
another version #, it worked. However, that's not the end of the story. I
ran another test, where both referenced the same version number and it still
mismatched types.

Finally, I discovered that I was loading the same interface definition DLL
twice. Even if both versions were exactly the same (I copied them to make
sure), I would get the type mismatch.

What I gather from this is that
- Two interface DLL were loaded (v49 and V60) accidentally. My plugin was
built against another version (58). Since neither matched, it bound to V49
which was considered not compatible with my base class (which was compiled
against and bound to V60).

-In another scenario, I loaded the interface DLL twice, but the same
versions ( both
60). My plugin was build against (58). It happened that my base class
bound against one instance, and the plugin bound against the other. These
were considered incompatible.

I'm still reading and figuring out how the plugin figures out which one to
bind to, but in my case, having multiple interface's loaded was the mistake.

But if you have similar issues, I hope this is helpful.

Roger
Aug 31 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
3081
by: TS | last post by:
I am trying to get set a property of a control on the inherited class from base class. I imagine i have to use reflection, so could someone give me the code to do it? something like this? this.GetType().GetMember("panel1").SetValue(xx).Left = 44;
0
1199
by: Mark | last post by:
Hi... I have an asp.Net application set up on one server with a collection of dlls in /bin. My boss simply did an xcopy of the whole file tree to his server so he could work with it at home over the weekend, and on *his* box, the application is throwing a MissingFieldException over a field that one dll is referencing in another. Now, the files are the same on both systems. The .pdb files are the same on both systems, yet the asp.Net...
1
8957
by: Jo Yoshida | last post by:
http://groups.google.com/groups?hl=en&lr=&threadm=F9A88B8F-6DDD-405C-9559-B2379ABE8CA7%40microsoft.com&rnum=1&prev=/groups%3Fq%3DSystem.MissingFieldException:%2BField%2Bnot%2Bfound%26hl%3Den%26lr%3D%26selm%3DF9A88B8F-6DDD-405C-9559-B2379ABE8CA7%2540microsoft.com%26rnum%3D1%26filter%3D0 The above thread is old but has anyone come up with a solution to this issue? The intermittent problem started after I added a UserControl that contains a...
3
2042
by: Lee Chapman | last post by:
Hi, I have a problem where my ASP.NET application occasionally generates a MissingFieldException exception. This unexpectedly happened on my development box, and so I was able to extract some information from the debugger: The field that is "missing" is called 'logger'. Here's it's description taken from ildasm.exe: ..field public static class log4net.ILog logger
8
6715
by: Spam Trap | last post by:
I am getting strange resizing problems when using an inherited form. Controls are moving themselves seemingly randomly, but reproducibly. "frmBase" is my base class (a windows form), and contains a few controls anchored to the sides of the form. "frmChild" inherits from "frmBase"... and the controls appear on the inherited form as expected. However things start going wrong when I place addition controls on the "frmChild" form. When I...
3
5483
by: Wayne Brantley | last post by:
VS2005 RTM Create a web user control to use as a base class for other web user controls. Now, create a new web user control, change the class it inherits from to your base class and compile. (You must have a <% Register %> so it will see it) You will get TWO warnings per class like:
14
2644
by: lovecreatesbea... | last post by:
Could you tell me how many class members the C++ language synthesizes for a class type? Which members in a class aren't derived from parent classes? I have read the book The C++ Programming Language, but there isn't a detail and complete description on all the class members, aren't they important to class composing? Could you explain the special class behavior in detail? Thank you very much.
12
2095
by: Janaka Perera | last post by:
Hi All, We have done a object oriented design for a system which will create a class multiply inherited by around 1000 small and medium sized classes. I would be greatful if you can help me with the following: Can this create any problems with GNU g++ compilation, linking etc? What would be the impact to the performance of the system? Anything else we have to consider?
19
2236
by: jan.loucka | last post by:
Hi, We're building a mapping application and inside we're using open source dll called MapServer. This dll uses object model that has quite a few classes. In our app we however need to little bit modify come of the classes so they match our purpose better - mostly add a few methods etc. Example: Open source lib has classes Map and Layer defined. The relationship between them is one to many. We created our own versions (inherited) of Map...
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10329
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10152
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10092
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8974
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7500
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3650
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2880
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.