Unresolved symbol, but still compiles?!??!

Hi,

I have a C++ .NET DLL which I am referencing from a C# Windows application. There is an event called FrameStarted in one of the classes. When I create an instance of the class and attempt to add a handler to the event, ReSharper complains that it cannot resolve then event, but when I compile there are no problems.

I have also noticed that no events from the C++ DLL show up in the ReSharper intellisense. When I switch back to the Visual Studio Intellisense, the events appear, but obviously ReSharper still complains.

Has anyone else had this problem? Can someone suggest a solution? I am using the latest 2.5 ReSharper version.

Kind Regards


Sid

4 comments
Comment actions Permalink

Hello Sid,

so do I understand correctly that the FrameStarted event is declared in a
C++ library and its usages in C# code
are marked unresolved? Thanks.


Dmitry Shaporenkov
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"


Hi,

I have a C++ .NET DLL which I am referencing from a C# Windows
application. There is an event called FrameStarted in one of the
classes. When I create an instance of the class and attempt to add a
handler to the event, ReSharper complains that it cannot resolve then
event, but when I compile there are no problems.

I have also noticed that no events from the C++ DLL show up in the
ReSharper intellisense. When I switch back to the Visual Studio
Intellisense, the events appear, but obviously ReSharper still
complains.

Has anyone else had this problem? Can someone suggest a solution? I am
using the latest 2.5 ReSharper version.

Kind Regards

Sid



0
Comment actions Permalink

Hi Dmitry,

That is correct. The event is defined in a C++ .NET class which is then being used a C# Windows Forms application.

Sid

0
Comment actions Permalink

Hello Sid,

I've tried to repeat this problem but had no success. A couple of questions:

1) How the unresolved events are declared in C++ code?
2) Are other symbols (i.e. not events) declared in the problematic C++ project
resolved by ReSharper in C# code?

Thanks.


Dmitry Shaporenkov
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"


Hi Dmitry,

That is correct. The event is defined in a C++ .NET class which is
then being used a C# Windows Forms application.

Sid



0
Comment actions Permalink

Hi Dmitry,

Here is the C++ .NET code for the event:

Declaration:

Mogre::FrameListener::FrameStartedHandler^ _frameStarted;

Definition:

event Mogre::FrameListener::FrameStartedHandler^ FrameStarted
{
void add(Mogre::FrameListener::FrameStartedHandler^ hnd)
{
if (_frameStarted == CLR_NULL)
{
if (_frameListener == 0)
{
frameListener = new FrameListenerDirector(this);
static_cast<Ogre::Root*>(_native)->addFrameListener(_frameListener);
}
_frameListener->doCallForFrameStarted = true;
}
_frameStarted += hnd;
_frameStartedDelegates = _frameStarted->GetInvocationList();
}
void remove(Mogre::FrameListener::FrameStartedHandler^ hnd)
{
_frameStarted -= hnd;
if (_frameStarted == CLR_NULL) _frameListener->doCallForFrameStarted = false;
if (_frameStarted == CLR_NULL) _frameStartedDelegates = nullptr; else _frameStartedDelegates = _frameStarted->GetInvocationList();
}
private:
bool raise( Mogre::FrameEvent evt )
{
if (_frameStarted)
{
bool mp_return;
for (int i=0; i < _frameStartedDelegates->Length; i++)
{
mp_return = static_cast<Mogre::FrameListener::FrameStartedHandler^>(_frameStartedDelegates+)( evt );
if (mp_return == false) break;
}
return mp_return;
}
}
}


2) I have not noticed anything else causing problems. But, I will double check and let you know.

Regards

Sid

0

Please sign in to leave a comment.