473,406 Members | 2,698 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Accessing a C# delegate used in a C# interface....

Hello,

I'm currently developing on a large project where several assemblies
build into DLLs that support the final .NET EXE. The original plan was
to implement the project in VB.NET, so the EXE project is a VB WinForms
App. Later on we got approval to not stick to that requirement so I
started writing library code in C# (which I much prefer).

Of interest in my problem are two C# DLL projects aside from the main
EXE project. The first, we'll call it 'A', contains a code file with a
few general no-arg delegate declarations. Then, an interface in the
other C# project, which we'll call 'B', contains declarations of events
using this delegate-type.

Finally, one of the Forms in the VB EXE implements this interface and
thus implements the events from the C# interface in assembly B. This
seemed to work okay earlier and not give any errors, but perhaps other
errors that I have since resolved were blocking the notification of
these errors, so the problem could have been there all along since I
started using the delegates/interfaces. I'm not entirely sure on that.

If I build assembly A or B separately, I get no problems. They compile
entirely. Remember that the interface in B, uses the delegate in A, so
it can see it and use it fine according to the C# compiler. Then I try
building the VB EXE and it complains, saying

C:\MyPath\MainForm.vb(16707566): Type 'A.EventHandler' is not defined.

Obviously my code is not that long. The vb compiler made up that line
number, presumably as some default abstract designation. I'm not for
sure.

Yet I am not getting an error that says I am failing to implement the
interface. This is curious because the only way it can know that I am
correctly implementing the interface is if it knows about that
delegate-type. Before I fixed other problems, I was getting a compiler
error that told me I wasn't yet implementing the interface when I was
mismatching on some of the declarations between VB and C#. Once I fixed
those, those went away. So that error was accurately reflecting that
issue. So what could have occurred that it suddenly doesn't find a
declaration that had to have been used to help resolve another error
message?

All dependency references are project references (as opposed to
explicit DLL path references) and yes I've tried deleted all bin/obj
folders and then rebuilding.

Thanks.

/S

Nov 21 '05 #1
4 1558
Just an off the wall comment. What is the versioning in the
AssemblyInfo.vb set to? Is it set to auto increment the version?
Could this be related to your problem?

Nov 21 '05 #2
If by "auto increment" you mean that the version ends with a wildcard,
then yes. In AssemblyInfo.vb I have:

<Assembly: AssemblyVersion("0.4.0.*")>

Does it matter that I've pushed the wild-card to the fourth component,
instead of the default third often used? I do this so I can explicitely
specify major-minor-micro versions and just let that final
auto-component be my IDE-generated "build-number".

How would this cause the problem I describe above though? Thanks.

/S

Nov 21 '05 #3
My idea is that perhaps the error you are getting is caused by a
mismatched version. I have read in Jeffrey Richter's book, "Applied
Microsoft .Net Framework Programming" that using the wildcard to
specify the version can cause dependency problems and that you should
always specify all four values.

I don't know if this is your problem, but it may be worth looking at.

Chris

Nov 21 '05 #4
Unfortunately this is not it. I deleted all build output again, removed
all wildcards from versions, specifying all parts explicitely, and the
result hasn't changed. Thanks for the suggestion though, I would agree
it was worth trying, seeing as how I can make little more sense of what
I'm experience.

So I'm open to other possibilities again. Thanks.

/S

Nov 21 '05 #5

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

Similar topics

1
by: serge calderara | last post by:
Dear all, I have a VB.NET application which is able to identify and load dynamically other dll's. created for my application. Those dll's are working as plugins for my main application. I...
3
by: Phill | last post by:
When should you use an interface over a delegate? Like if you have a class that needs to sort various types of objects. Should it use a delegate to do the sorting or require that the objects...
2
by: Ruediger Klaehn | last post by:
I have written an arithmetic expression compiler. Now that it is finished I would like to give it a nice interface. Currently I have this interface: delegate double Function(double x); class...
0
by: Wavemaker | last post by:
One of the things I've struggled with from time to time is handling events raised on different threads. For example, an object could be listening to events from one or more objects running in...
8
by: Mike Caputo | last post by:
In VB.NET, need to be able to access certain properties on my main form from other forms. These are properties that may be changed by the user, so I have to be able to get to them throughout the...
4
by: ^MisterJingo^ | last post by:
Hi all, I've been trying to get my head around delegates. The book i'm using had a single example, not much explaination, and didn't show how to set up a delegate and pass variables in and out...
5
by: atwomey | last post by:
When I try and place a delegate in an interface, like this : public interface ITest { double foo(); delegate void bar(); } I get an error "delegates cannot declare types". What is it about a...
5
by: RP | last post by:
I have a function to fill combo box items. I pass SQL query and combo box name as arguments. This function is located in another class. In my Form, I have declared a delegate to this function...
0
by: Roger Stoller | last post by:
Hello. I have developed a COM object using ATL. It seems to work fine when accessing it from VB.NET most of the time. However, I want to use a delegate in VB to asynchronously run a method in...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...
0
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...

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.