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

feat: Allow Name Generator to disable attach to DevTools #14425

Conversation

workgroupengineering
Copy link
Contributor

What does the pull request do?

Add property AvaloniaNameGeneratorAttachDevTools to Name Generaator that allow it to disable attach to DevTools

What is the current behavior?

Name Generaator if the target is Window, the DEBUG constant is defined and the project references Avalonia.Diagnostics, always generate code for Attach to DevTools. This behavior does not allow you to easily customize DevTools options. To do this you need to modify each window constructor to invoke InitializeComponent(attachDevTools: false); instead of InitializeComponent();.

What is the updated/expected behavior with this PR?

When add following to .csproj does not generate code to Attach to DevTools

<PropertyGroup>
  <AvaloniaNameGeneratorAttachDevTools>false</AvaloniaNameGeneratorAttachDevTools>
</PropertyGroup>

How was the solution implemented (if it's not obvious)?

Checklist

Breaking changes

Obsoletions / Deprecations

Fixed issues

@avaloniaui-bot
Copy link

You can test this PR using the following package version. 11.1.999-cibuild0044202-beta. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@@ -50,7 +50,7 @@
<BoolProperty Name="AvaloniaNameGeneratorIsEnabled"
DisplayName="Use Name Generator"
Description="Enable/Disable Avalonia Name Source Generator"
HelpUrl="https://github.com/AvaloniaUI/Avalonia/blob/master/src/tools/Avalonia.Generators/README.md"
HelpUrl="https://github.com/AvaloniaUI/Avalonia/blob/master/src/tools/Avalonia.Generators/README.md#advanced-usage"
Copy link
Member

Choose a reason for hiding this comment

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

Side note: it should be moved to the docs page.

Copy link
Member

Choose a reason for hiding this comment

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

@maxkatz6 maxkatz6 added this pull request to the merge queue Jan 31, 2024
Merged via the queue into AvaloniaUI:master with commit 55432bd Jan 31, 2024
6 checks passed
@workgroupengineering workgroupengineering deleted the features/Tools/Generators/AvaloniaName/Allow-disable-attach-to-DevTools branch February 1, 2024 00:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants