kuiperzone / avantgarde Goto Github PK
View Code? Open in Web Editor NEWAvalonia XAML Preview for Linux and Windows
License: GNU General Public License v3.0
Avalonia XAML Preview for Linux and Windows
License: GNU General Public License v3.0
Hello,
I tried using AvantGarde for my project and the UI froze a lot...
My setup:
Windows 11 x64
Intel Core i5
16GB RAM
A possible change in Avalonia?
Avant Garde blocks project from building for me.
It seems that to reproduce this issue you need to open solution in Avant Garde, open a view to preview and then make some change to xaml code. After that C# project is no longer buildable giving this error message.
The process cannot access
the file 'C:\Users\Kacper\RiderProjects\MyApp\MyApp\bin\Debug\net7.0\MyApp.dll' because it is being used by another pro
cess.
OS: Windows 11
It would really be nice if I could compile my project without closing Avant Garde.
I have a project with a class library which seemed to cause issues for the editor when I opened it and set my App project. I managed to find a workaround but I think I narrowed down the issue.
The class library includes avalonia and everything else needed to run things properly but the .client.desktop project doesn't include Avalonia itself which the previewer complained about saying "Version cannot be 'null'". I managed to fix this by including Avalonia in the client.desktop project file but it would be cool if the previewer was able to find the Avalonia version the class library used.
It didn't seem able to resolve $(AvaloniaVersion)
(to be fair I don't have any idea where this is defined either) in the project file, but I've just set the specific version.
It'd be cool if the desktop project would use the Avalonia version of the class library, and maybe also resolve the version somehow.
Thanks for the awesome project though โค
I cloned the source code and build for MacOSX-Arm64 (using the m2 macbook pro).
The issue is as appears in the photo, every preview shows this error message, it is independent of the location of the executable of AvantGarde, and the project location.
There is also no way that I've found to configure location of the dotnet cli.
This isn't an actual issue but I wanted to let you know that I cloned the code and built on MacOS (Intel CPU) and so far, it seems to be working! I haven't tried anything too advanced, but it previews a newly created Avalonia project fine.
This is pretty awesome. I didn't want to buy Rider to have axaml previews while developing on my Mac and this looks like it will solve that problem!
Already merged.
I think adding "*.fsproj" to the supported types list will do the trick? I've got a fork here that seemingly works: https://github.com/mimoguz/AvantGarde/tree/fsproj
Thanks.
Note to self. To fix in next release.
Hello! both browsers I have reported the .exe to contain some virus
Windows Defender says that, also.
The link is https://github.com/kuiperzone/AvantGarde/releases/download/v1.0.0/AvantGarde-win-x64.exe
Just to let you know.
I hope you could fix that soon.
Congratulations for the great work!
First off, this project is awesome. I mean seriously, I can't believe it isn't listed in the awesome avalonia directory. I tried Rider and didn't like it nor the price tag, and this works wonderfully with VS Code. Seriously, thank you for such an awesome application.
With that said, I have encountered one thing that I want to run by you and see if this is expected or not. I am developing what is currently a very basic UI and it works great, but the CPU usage seems to be much higher than I would expect it to be. See below for screenshot and system specs. Is this sort of CPU usage expected?
Thanks in advance!
CPU: AMD Ryzen 5 3600 (6 core)
RAM: 16 GB DDR4
OS: Linux Mint 21
flip@magneto:~$ dotnet --info
.NET SDK:
Version: 7.0.100
Commit: e12b7af219
Runtime Environment:
OS Name: linuxmint
OS Version: 21
OS Platform: Linux
RID: linux-x64
Base Path: /usr/share/dotnet/sdk/7.0.100/
Host:
Version: 7.0.0
Architecture: x64
Commit: d099f075e4
.NET SDKs installed:
7.0.100 [/usr/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 7.0.0 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 7.0.0 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Other architectures found:
None
Environment variables:
DOTNET_ROOT [/usr/share/dotnet]
global.json file:
Not found
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download
Last but definitely not least, is there somewhere I can donate as a "thank you" for the work you've already put into this? I checked the README and open collective and didn't find anything.
Preview fails if the dimensions of the control cannot be directly obtain from the XML by converting the attribute value to a number (e.g. when the value is bound to a data model variable).
If the preview-able control has Width
/ MinWidth
/ MaxWidth
and / or Height
/ MinHeight
/ MaxHeight
bound to a data model variable, not just simple numbers in the XML, the preview fails with the error The input string '{Binding Path=ViewWidth}' was not in a correct format
.
The following patch fixes the issue for me:
diff --git a/AvantGarde/Loading/PreviewFactory.cs b/AvantGarde/Loading/PreviewFactory.cs
index 898068a..afdbeb7 100644
--- a/AvantGarde/Loading/PreviewFactory.cs
+++ b/AvantGarde/Loading/PreviewFactory.cs
@@ -73,8 +73,16 @@ namespace AvantGarde.Loading
var root = doc.Root ?? throw new XmlException("No root element");
_source.DesignWidth = ParseOrNaN(GetLocalAttribute(root, "DesignWidth")?.Value, "DesignWidth");
_source.DesignHeight = ParseOrNaN(GetLocalAttribute(root, "DesignHeight")?.Value, "DesignHeight");
- _source.Width = GetDimension(root, "Width", "MinWidth", "MaxWidth");
- _source.Height = GetDimension(root, "Height", "MinHeight", "MaxHeight");
+
+ try {
+ _source.Width = GetDimension(root, "Width", "MinWidth", "MaxWidth");
+ _source.Height = GetDimension(root, "Height", "MinHeight", "MaxHeight");
+ }
+ catch(Exception e) {
+ _source.Width = ControlDimension.Empty;
+ _source.Height = ControlDimension.Empty;
+ Debug.WriteLine("Cannot get view dimensions (width and / or height); " + e.Message);
+ }
Debug.WriteLine("Root Name: " + root.Name.LocalName);
Note: If the above patch looks technically offending :-) please take into consideration I don't have any previous experience with the AvantGarde source code, and I only spent about 5 minutes investigating the problem.
Please allow me to take this opportunity to thank you and express my infinite gratitude for developing this indispensable tool.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.