sergey-visual-studio/dpack

File Browser results in double

thsauve opened this issue · 31 comments

When using DPack Rx 2022 File Browser in VS 2022, language C#, the results are in double.
image.

I've searched in Windows Explorer : no double.

A few more follow up questions. What's your VS version number? What's the target .NET framework on projects in question? Do you have any shared type projects in solution? Thanks.

Hello.
My VS version : 17.5.4 Enterprise
The target framework on the two projects listed above : .NET Standard 2.0
Shared type projects : I don't understand the question. Do you mean "do I have references between projects in the solution" ? If so : Yes.

Shared type projects : I don't understand the question. Do you mean "do I have references between projects in the solution" ?

Not that. Here's a link that describes use of Shared Project type in VS. It describes it used for Xamarin but it's technically applicable to any solution.
https://learn.microsoft.com/en-us/xamarin/cross-platform/app-fundamentals/shared-projects?tabs=windows

i have same issue.
results in double.

a.cpp
a.cpp
b.cpp
b.cpp

i have same issue.

Could either one of you provide me with a test project?

i'm sorry, i can't give you the project, my project is private, so...
by the way, if i make new another project, it works fine.
and if i open the project having problem on other pc, it works fine too.

danikf commented

Hi,

the problem happens when you have the same (the same path) file twice in the solution (usually once as item in *.csproj and once as solution item - directly referenced from *.sln).

(My configuration: *.sln with a.sql referenced as solution item PLUS C# *.csproj - .NET 4.8 => the old csproj with files listed with the same a.sql referenced). (the reason are unittests)

Thanx for the add-in - I am the happy user use it since the first DPack version :-)

D

Hi,

the problem happens when you have the same (the same path) file twice in the solution (usually once as item in *.csproj and once as solution item - directly referenced from *.sln).

I'd appreciate if you put together a repro solution. Otherwise, if I can't reproduce I can't fix it.

danikf commented

Not only this case, but at this is the simplest one :-)
(Latest VS2022 Comunity, Latest official release of DPack)

image
DPackDuplicity.zip

And another one (assigned into project twice):
image
DPackDuplicity2.zip

Thanks,
D

Thanks for the repro case. Once I got your test case I realized why I wasn't able to reproduce it in the first place. Got it now.

Give this new beta a try to see if it fixes that issue. Thanks.

DPackRxBeta.zip

danikf commented

Better :-)

But still has small problem (not 100% sure about exact reason) when referencing file outside of csproj dir (test project):

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
...
  <ItemGroup>
    <EmbeddedResource Include="..\..\..\Sql\TestScripts\DuplicatedFile.sql">
      <Link>DatabaseAccess\Scripts\DuplicatedFile.sql</Link>
    </EmbeddedResource>
  </ItemGroup>

But still has small problem (not 100% sure about exact reason) when referencing file outside of csproj dir (test project):

Thanks. As far as DPack is concerned, files outside of project structure have distinct paths and thus don't match. Whereas in your previous test case they do match and thus the subject to file grouping. I think it's a corner case tbhwy. It's gonna continue working that way for now I'm afraid.

Updated to 4.5.5 and still have the same issue. Any workaround?

See my earlier reply. It's not being looked at or considered at this point I'm afraid.

Quick update. I was finally able to reproduce it. Currently investigating.

Was able to come up with a workaround. Looks like VS 2022 extensibility broke it either from the get-go or in one of the updates. I still have 1 more issue to wrap up so it might a little while before the new beta's available.

Please take a look at the new beta that hopefully fixes this issue. Thanks.

DPackRxBeta.zip

igitur commented

Hi, I managed a small repro, but it's actually simple to explain. Files in projects within a solution folder are double-counted. Something in the project enumeration treats solution folders as valid projects. I agree that loose-standing files in solution folders should be included, but they shouldn't be double-counted if they are within a real project already. Repro attached.

DPackRx_Duplicates.zip

igitur commented

Also, I could reproduce the problem using a fresh git checkout.

igitur commented

Sorry, I see your FileBrowserDups branch only now. This branch fixes the problem for me.

Please take a look at the new beta that hopefully fixes this issue. Thanks.

DPackRxBeta.zip

Thanks. I can confirm that problem is solved when using attached zip

Great, thanks for letting me know.

@sergey-visual-studio just found out that .xaml files still have the issue .

Do you mean that .xaml files are shown as doubles in File Browser?

Yes correct

Thanks. Could you post a repro project for me? I was able to reproduce it once but can't anymore.

N/m, reproduced it. Have a fix in mind, just need to run more regression tests. As far as underlying cause, MS appears to have changed the project file model, and in this case specifically on how nested files are handled.

Thanks. by the way I get an error

image

There is no update in vs extension manager

I'll post another beta today/tomorrow. Thanks.

This should be in the newly posted release version.