Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Public function in public class unrecognized in a project it is referenced

Posted on 2007-08-01
9
Medium Priority
?
395 Views
Last Modified: 2008-01-09
I have a utility dll that I have created.  The classes are set to public as well as the functions.  I can access them in one project but not in another.  Both projects are included in the same solution and both have references to the same utility dll.  However, one of them recognizes a class with some public functions in the public class while another one the intellisense doesn't even pickup the class name.  Any thoughts on why it works in one but not the other?
0
Comment
Question by:vb9666
  • 4
  • 2
  • 2
  • +1
9 Comments
 
LVL 53

Expert Comment

by:Dhaest
ID: 19608771
Do they have the same namespace ?
0
 
LVL 6

Expert Comment

by:gjutras
ID: 19608777
there might just be a syntax error in the project that you're working on that needs to be fixed first.  Sometimes simple syntax errors keep intellisense on referenced projects from working.
0
 

Author Comment

by:vb9666
ID: 19608901
Dhaest,

I believe they have the same namespace.  They're called the same thing under the imported namespaces.  How would I check this??



0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:vb9666
ID: 19608903
gjutras,
I do have some warnings but no errors in the project.  The warnings are a bit odd and don't even reference a certain file, line and column.  Could this be the issue?

Example of one of the warnings is: "At least one of the arguments for 'OLE.get_Value' cannot be marshaled by the runtime marshaler.  Such arguments will therefore be passed as a pointer and may require unsafe code to manipulate."
0
 
LVL 34

Expert Comment

by:Sancler
ID: 19609657
Do both projects begin with

Imports myUtility

or just one of them?

Roger
0
 

Author Comment

by:vb9666
ID: 19609737
Roger,

On the one that is working, I have it is

Imports myUtility.myClass

On the other one, it doesn't even recognize 'myClass'

When I type this it gives me the following warning:
Namespace or type specified in the Imports 'myUtility.myClass' doesn't contain any public member or cannot be found.  Make sure the namespace or the type is defined and contains at least one public member.  Make sure the imported element doesn't use any aliases.
0
 
LVL 34

Accepted Solution

by:
Sancler earned 1000 total points
ID: 19612146
I've tried to reproduce this on my system, but not had any success.

From the various bits of description scattered through the posts, the most likely thing looks to me to be a corruption (or, as gjutras suggested, maybe a syntax error) somewhere.  Given that it is working okay when referenced from one of the projects, I would tend to delete the reference from the other project then Save.  Then close out Visual Studio and delete the bin and obj folders for the project concerned: they will be regenerated on re-opening and re-filled on a build.  That approach should wipe out any corruption in the project files themselves and, given that the reference works OK in the other project, that seems the most likely source.

Then re-open, put the reference into the offending project again, and see whether that then allows a proper Imports statement in that project.  When doing that you want to check that the reference in the offending project is identical to that in the one that works.  You can do this - a bit tediously - by clicking on the references in the two projects and checking in the properties window under each entry.  Most of the entries will be greyed out, but you can still read them.  That should cover the point made by Dhaest.

Roger
0
 
LVL 53

Expert Comment

by:Dhaest
ID: 19614616
If you take a look at the class-view of your project, do you see one or more main-entries ?
Does every class start with namespace samenameeverywhere ?
0
 

Author Comment

by:vb9666
ID: 19616716
Roger,

Thanks.  Your solution worked!!
0

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

572 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question