C# project used from X# opens metadata

This forum is meant for questions and discussions about the X# language and tools
Post Reply
ic2
Posts: 1858
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

C# project used from X# opens metadata

Post by ic2 »

In X# we have this code:

Code: Select all

Local oiConC As IC2CSMethods.iConnectC
	oiConC := IC2CSMethods.iConnectC{}
        oiConC:DoSomething()
Now when I use Goto Definition it opens a locked file saying // Metadata taken from assembly and then the DLL.
Of course this is wrong. It should go to the C# method DoSomething which is in a separate project but the same solution.

I see multiple posts over the years what the problem usually is and of course it has never been fixed:

The problem begins when you added the reference to the DLL and not to the project... In this case VS will remember forever that and will always open 'from metadata' even you changed the reference from DLL to project... The only way I now of, is manually editing the project file and remove the DLL reference...


However, I removed the below XML from the project file and on re-opening the solution it was back and nothing changed. Plus that I would say that it is the correct reference, to the actual C# project. But that does not seems to be used. Even if I unload the C# project in the solution, the X# program using the C# method(s) still compiles without error (and keeps showing the metadata).

How can I solve this?

Dick

<ItemGroup>
<ProjectReference Include="IC2CSMethodsIC2CSMethods.csproj">
<Name>IC2CSMethods</Name>
<Project>{f6d8ba6c-be7e-4846-bbd0-f9a5dd176302}</Project>
<Private>True</Private>
</ProjectReference>
</ItemGroup>
User avatar
Chris
Posts: 4907
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

C# project used from X# opens metadata

Post by Chris »

Hi Dick,

I think you can't solve this yourself, instead we need to make the X# project system "smarter" and open the c# source code. I don't know how easy or difficult it is to do this, but will open a report for Robert to look into it.
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
User avatar
robert
Posts: 4520
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

C# project used from X# opens metadata

Post by robert »

Dick,
ic2 post=23803 userid=455 wrote:In X# we have this code:

Code: Select all

Local oiConC As IC2CSMethods.iConnectC
	oiConC := IC2CSMethods.iConnectC{}
        oiConC:DoSomething()
Now when I use Goto Definition it opens a locked file saying // Metadata taken from assembly and then the DLL.
Of course this is wrong. It should go to the C# method DoSomething which is in a separate project but the same solution.
As consumer of the C# project we have no idea in which source file the class / method is defined.
There might be a way to detect this and open the right source file (by reading the PDB file and getting the line number information from there), but for now I would like to focus on our own VS integration.

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
ic2
Posts: 1858
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

C# project used from X# opens metadata

Post by ic2 »

Hello Robert,
robert post=23807 userid=253 wrote: As consumer of the C# project we have no idea in which source file the class / method is defined.
There might be a way to detect this and open the right source file (by reading the PDB file and getting the line number information from there), but for now I would like to focus on our own VS integration.
Ah, ok, I thought it was some problem in the project file as I saw it in several posts.

It's not a big deal. I was afraid that it wouldn't use changes in my C# either as the metadata is pointing to some DLL but that does seem to be working.

Would be nice if it would work some day but I fully agree that the other Goto/Peek & tooltip issues within X# projects have priority.

Dick
Post Reply