stride3d / stride3d/stride

Problematic use of shared projects and code files

Open
#1,422 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C#
Stars
7.8k
Forks
1.2k
Avg merge
2d 17h
Merged PRs (30d)
49

Description

Release Type: GitHub

Version: master

Describe the bug
The way in which multiple assemblies are reusing the same code files and shared projects within the same application leads to multiple duplicated symbols resulting in compiler warnings, slower compilation times and marginally larger assemblies.

In the case of shared projects (ex. Stride.NuGetResolver), some are not being used in the way .shproj were intended. Shared projects are for code and assets being reused across different applications, typically targeting different native platforms. More on that from Microsoft. A reasonable use in the codebase is Stride.Core.Assets.Yaml.shproj which is used by Stride.GameStudio and Stride.Launcher apps. Though a common assembly would have worked as well and avoided a recompile of the same code when building both apps.
The code within the existing shared projects consumed in the same application should stand alone in their own assemblies or get rolled into one or more existing assemblies to eliminate the duplication issue.

Similarly, there are instances of individual .cs files being compiled into different assemblies which interact with each other in the same application. The largest offender is the SharedAssemblyInfo, which anyone who has compiled Stride.sln will have seen the many duplicate symbol warnings.

To Reproduce
Compile Stride.sln and observe many warnings of these type (the assemblies in the warnings will differ per build):

warning CS0436: The type 'StrideVersion' in 'H:\src\jrinker03\stride\sources\editor\Stride.GameStudio\..\..\shared\SharedAssemblyInfo.cs' conflicts with the imported type 'StrideVersion' in 'Stride.Core.Assets.Editor, Version=4.1.0.1, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'H:\src\jrinker03\stride\sources\editor\Stride.GameStudio\..\..\shared\SharedAssemblyInfo.cs'.

warning CS0436: The type 'PublicKeys' in 'H:\src\jrinker03\stride\sources\editor\Stride.Editor\..\..\shared\SharedAssemblyInfo.cs' conflicts with the imported type 'PublicKeys' in 'Stride.Engine, Version=4.1.0.1, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'H:\src\jrinker03\stride\sources\editor\Stride.Editor\..\..\shared\SharedAssemblyInfo.cs'.

warning CS0436: The type 'SplashScreenWindow' in 'H:\src\jrinker03\stride\sources\shared\Stride.NuGetResolver\SplashScreenWindow.xaml.cs' conflicts with the imported type 'SplashScreenWindow' in 'Stride.ConnectionRouter, Version=4.1.0.1, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'H:\src\jrinker03\stride\sources\shared\Stride.NuGetResolver\SplashScreenWindow.xaml.cs'.

Expected behavior
If architected correctly, the code should have no duplicated code or compiler warnings.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by compiling Stride.sln and reviewing the reported CS0436 warnings, especially those involving shared/SharedAssemblyInfo.cs and the shared projects Stride.NuGetResolver and Stride.Core.Assets.Yaml. Trace which assemblies compile the duplicated files or projects. Done means the affected code is no longer duplicated across interacting assemblies and the compiler warnings are gone.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
build-system, tooling
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.