Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 12830 multi target demo console #12996

Draft
wants to merge 17 commits into
base: main
Choose a base branch
from

Conversation

ricardobossan
Copy link
Member

@ricardobossan ricardobossan commented Feb 21, 2025

Fixes #12830

Proposed changes

  • Updated DemoConsole.csproj and DesignSurfaceExt.csproj to support multiple target frameworks ($(NetCurrent)-windows;net481).
  • Adjusted TargetFramework property to avoid over-building.
  • Enabled SignAssembly and GenerateAssemblyInfo properties in the project files.
  • Updated resource and reference handling in DemoConsole.csproj and DesignSurfaceExt.csproj to improve compatibility.
  • Fixed Controls.AddRange usage to use the correct syntax in MainForm.MyUserControl.cs.
  • Corrected Controls.AddRange call in MainForm.cs to Controls.Add.
  • Suppressed IDE0057 warning and reverted to Substring method for compatibility in NameCreationServiceImp.cs.
  • Changed StartsWith('_') check by directly accessing the first character in NameCreationServiceImp.cs for compatibility.
  • Disabled error CA1824 for projects DemoConsole and DesignSurficeExt, because it would be triggered even though properly configured in those projects, according to the fix provided by the documentation.

Customer Impact

  • None

Regression?

  • No

Risk

  • Minimal

Screenshots

Before

  • DemoConsole would not run on net481.

After

image

Test methodology

  • Manual

Test environment(s)

  • 10.0.100-alpha.1.25077.2

@ricardobossan ricardobossan self-assigned this Feb 21, 2025
@ricardobossan
Copy link
Member Author

Drafted because:

  • Need to address nullability warnings
  • net481 compiles without errors but doesn't launch

@ricardobossan
Copy link
Member Author

ricardobossan commented Feb 21, 2025

@Tanya-Solyanik @LeafShi1 @Epica3055 I was able to get the DemoConsole project to compile for multiple targets ($(NetCurrent)-windows and net481), but it doesn't launch on net481. There's no error message explaining why. It just fails silently. Do you have any idea what might be causing this?

I’m aware of the nullability warnings that I still need to address, but could they be related to this issue?

@dotnet-policy-service dotnet-policy-service bot added the draft draft PR label Feb 21, 2025
Copy link
Member

@Tanya-Solyanik Tanya-Solyanik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Enable all CLR exceptions before starting to debug this project as 4.8.1. I guess immutable collection reference is not discovered.

@ricardobossan ricardobossan force-pushed the Issue_12830_Multi-Target_DemoConsole branch from e1471f3 to 78c0cbd Compare February 21, 2025 18:03
@Tanya-Solyanik
Copy link
Member

@ricardobossan - the reason the NET481 version does not run is that the dll is not strong-name signed, we should delay-sign it. Arcade should have tools for that. Maybe like this <SignAssembly>true</SignAssembly> https://github.com/dotnet/arcade/blob/ecdb2f499cb5f5c99b58fba1a14fdf977c56e1ac/Documentation/ArcadeSdk.md?plain=1#L953
Search arcade docs to see if they recommend any signing test keys to use. We should not use a production key.

Copy link

codecov bot commented Feb 24, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 61.78789%. Comparing base (5e9dab6) to head (0b2e117).
Report is 56 commits behind head on main.

Additional details and impacted files
@@                 Coverage Diff                 @@
##                main      #12996         +/-   ##
===================================================
+ Coverage   61.35513%   61.78789%   +0.43275%     
===================================================
  Files           1547        1552          +5     
  Lines         158479      158947        +468     
  Branches       14751       14802         +51     
===================================================
+ Hits           97235       98210        +975     
+ Misses         60542       60022        -520     
- Partials         702         715         +13     
Flag Coverage Δ
Debug 61.78789% <ø> (+0.43275%) ⬆️
integration 10.72343% <ø> (-0.00946%) ⬇️
production 39.80644% <ø> (+0.58044%) ⬆️
test 95.67018% <ø> (-0.00929%) ⬇️
unit 37.24949% <ø> (+0.59206%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ricardobossan ricardobossan marked this pull request as ready for review February 24, 2025 20:00
@ricardobossan ricardobossan requested a review from a team as a code owner February 24, 2025 20:00
@ricardobossan ricardobossan added waiting-review This item is waiting on review by one or more members of team and removed draft draft PR labels Feb 24, 2025
@LeafShi1
Copy link
Member

When using only net481 in the DemoConsole project, TabPage6 does not display properly. When enabling all CLR exceptions before starting to debug this project, I receive the following error

image

@ricardobossan
Copy link
Member Author

@LeafShi1 I was able to run the project and navigate through the tabs on net481 with all CLR exceptions enabled, as shown in the GIF below:

clr exceptions enabled net481 works

Here’s how I set up and ran the project:

# From the runtime repo root folder:
gh pr checkout 12996
msbuild /t:Clean .\Winforms.sln
.\Restore.cmd
.\build.cmd
.\start-vs.cmd

Could you share the exact steps you're using to run the project? That might help pinpoint any differences that could explain the discrepancy in our results.

@LeafShi1
Copy link
Member

Could you share the exact steps you're using to run the project? That might help pinpoint any differences that could explain the discrepancy in our results.

When using <TargetFrameworks>$(NetCurrent)-windows;net481</TargetFrameworks>, it shows up fine on my end。
I just tried changing the TargetFramework to net481, like this
image

But it doesn't seem to work, because it causes compilation to fail

So please ignore my comment

@Tanya-Solyanik Tanya-Solyanik added waiting-author-feedback The team requires more information from the author and removed waiting-review This item is waiting on review by one or more members of team labels Feb 26, 2025
ricardobossan pushed a commit to ricardobossan/winforms that referenced this pull request Feb 28, 2025
…e everything visible in the surface designer.

Related dotnet#12996

- Resizes `DemoConsole` project's `MainForm` for convenience and to make everything visible in the surface designer.

- None

- No

- Minimal

- Manual

- 10.0.100-preview.3.25125.5
@ricardobossan ricardobossan added waiting-review This item is waiting on review by one or more members of team and removed waiting-author-feedback The team requires more information from the author labels Mar 3, 2025
@Tanya-Solyanik
Copy link
Member

Consider adding a readme.md file to explain how to run the NETFX version of demo console.

@ricardobossan ricardobossan force-pushed the Issue_12830_Multi-Target_DemoConsole branch from 0ad244e to edaa752 Compare April 4, 2025 21:24
@ricardobossan
Copy link
Member Author

ricardobossan commented Apr 4, 2025

Consider adding a readme.md file to explain how to run the NETFX version of demo console.

@Tanya-Solyanik I added a README in this commit.

@ricardobossan ricardobossan force-pushed the Issue_12830_Multi-Target_DemoConsole branch from 1120a36 to 7c0c448 Compare April 9, 2025 00:06
Ricardo Bossan (BEYONDSOFT CONSULTING INC) (from Dev Box) added 14 commits April 10, 2025 20:44
…t multiple target frameworks (`$(NetCurrent)-windows;net481`).

    Fixes dotnet#12830

    - Updated `DemoConsole.csproj` and `DesignSurfaceExt.csproj` to support multiple target frameworks (`$(NetCurrent)-windows;net481`).
    - Adjusted `TargetFramework` property to avoid over-building.
    - Enabled `SignAssembly` and `GenerateAssemblyInfo` properties in the project files.
    - Updated resource and reference handling in `DemoConsole.csproj` and `DesignSurfaceExt.csproj` to improve compatibility.
    - Fixed `Controls.AddRange` usage to use the correct syntax in `MainForm.MyUserControl.cs`.
    - Corrected `Controls.AddRange` call in `MainForm.cs` to `Controls.Add`.
    - Suppressed `IDE0057` warning and reverted to `Substring` method for compatibility in `NameCreationServiceImp.cs`.
    - Changed `StartsWith('_')` check by directly accessing the first character in `NameCreationServiceImp.cs` for compatibility.
    - Disabled error `CA1824` for projects `DemoConsole` and `DesignSurficeExt`, because it would be triggered even though properly configured in those projects, according to the fix provided by the [documentation](https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1824#fix-violations).

    - None

    - No

    - Minimal

    - `DemoConsole` would not run on `net481`.

    - Manual

    - 10.0.100-preview.3.25125.5
…'s lauchSettings.json's nativeDebugging to false
@ricardobossan ricardobossan force-pushed the Issue_12830_Multi-Target_DemoConsole branch from 7c0c448 to 13bbc41 Compare April 10, 2025 23:47
Ricardo Bossan (BEYONDSOFT CONSULTING INC) added 2 commits April 10, 2025 21:06
@ricardobossan ricardobossan force-pushed the Issue_12830_Multi-Target_DemoConsole branch from b147ad9 to 642ebcf Compare April 11, 2025 00:49
@ricardobossan
Copy link
Member Author

@Tanya-Solyanik @LeafShi1 @Epica3055 Changing from net481 to net472 works fine locally, but on CI it generates the following error:

error NU1103: Unable to find a stable package System.Runtime.CompilerServices.Unsafe with version (>= 6.0.0)

It seems like the assemblies available for net472 are more restrictive, and locally I’m probably able to resolve them because of NuGet cache or fallback sources.

Do you have any suggestions on how I should handle this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
draft draft PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make the DemoConsole application multi-targeted to both .NET and .NET Framework
4 participants