Giter Site home page Giter Site logo

Comments (5)

stevemonaco avatar stevemonaco commented on September 27, 2024

AttachDevTools is part of the DevTools package (ie. Avalonia.Diagnostics). Most people don't want to add extra debugging dependencies at runtime, so the conditional compilation is there to ensure it doesn't make it into release mode. DevTools is also incompatible with NativeAOT. So this is a reasonable default, IMO.

attachDevTools is maybe a bit poorly described for a parameter that's only intended to work in debug builds, but renaming this would be a breaking change.

The easiest workaround for both debug+release configs is probably to handle attaching yourself:

public MainWindow()
{
	InitializeComponent(attachDevTools: false);
	this.AttachDevTools();
}

from avalonia.

Rekkonnect avatar Rekkonnect commented on September 27, 2024

I think you've completely missed the point. The parameter name can stay as is, all I'm asking for is to also add it in Release builds. No behavior change, just allowing me to refer to that parameter in Release mode because currently the parameter is unavailable.

from avalonia.

stevemonaco avatar stevemonaco commented on September 27, 2024

attachDevTools is only available if Avalonia.Diagnostics is available. The source generator checks for this and generates different code based on its availability:

https://github.com/AvaloniaUI/Avalonia/blob/master/src/tools/Avalonia.Generators/NameGenerator/InitializeComponentCodeGenerator.cs#L27

The default project templates exclude DevTools in Release builds, so your project probably has something like:

<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" />

When it should be like this if you always want it:

<PackageReference Include="Avalonia.Diagnostics" />

from avalonia.

Rekkonnect avatar Rekkonnect commented on September 27, 2024

Huh, I didn't know that. Then, wouldn't it be convenient to still add the parameter, regardless of whether the package is included?

from avalonia.

stevemonaco avatar stevemonaco commented on September 27, 2024

Maybe it was done to restrict devs from using the parameter when DevTools isn't available and silently doing nothing (or throwing?). I originally thought it was always available, too, until I checked the source.

from avalonia.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.