These are chat archives for AvaloniaUI/Avalonia

22nd
Aug 2017
Matthijs ter Woord
@mterwoord
Aug 22 2017 05:56
with the new xaml parser, are unrecognized properties just ignored?
Steven Kirk
@grokys
Aug 22 2017 08:04
@mterwoord seems like a portable.xaml bug: cwensley/Portable.Xaml#66
we really need to get that fixed...
Eli Arbel
@aelij
Aug 22 2017 09:31
I just tried out something from a hunch and it turned out I was right! It seems like the built-in VS XAML language service can work with any XAML, provided the expected attributes are used. It's enough to declare them in the same namespace as WPF's and it just works: intellisense, quick actions, etc.
I just changed the namespace of XmlnsDefinitionAttribute to System.Windows.Markup, and added the ContentPropertyAttribute to Avalonia classes (again in that namespace).
I personally don't like working with a designer so this could be perfect for me. No need for a special extension to work on Avalonia projects. This could lower the adoption barrier for many.
Matthijs ter Woord
@mterwoord
Aug 22 2017 09:35
not really, as StyleResource is not supported then, as are other avalonia-only things
Eli Arbel
@aelij
Aug 22 2017 09:35
I can do without StyleResource completion
WPF didn't have them for a very long time
Wiesław Šoltés
@wieslawsoltes
Aug 22 2017 12:00
Just tested Core2D running as netcoreapp2.0with Avalonia and it works without any problems so far.
The only issue is size, the publish size of my app went from 62,8 MB to 82,8 MB.
Johan Larsson
@JohanLarsson
Aug 22 2017 12:02
Is there something for pruning dependencies?
Eric Mellino
@mellinoe
Aug 22 2017 13:06
@JohanLarsson There is, although I don't recall the exact properties you need to set for it
Johan Larsson
@JohanLarsson
Aug 22 2017 13:07
Ok, was just curious, not sure I would use it as so much around core/standard is broken and breaks
Matthijs ter Woord
@mterwoord
Aug 22 2017 13:08
well, you could use version control: first commit, then cleanup and try, and if it works, commit, if not rollback
@JohanLarsson What is broken for you? Mainly VS problems?
Matthijs ter Woord
@mterwoord
Aug 22 2017 13:09
@wieslawsoltes increased size, does it have to do with native stuff being added to the publish path? (ie, arm linux, etc, etc)
Johan Larsson
@JohanLarsson
Aug 22 2017 13:09
Thanks!
@mellinoe yes but I'm no power user of netstandard so my opinion is not worth much :)
Eric Mellino
@mellinoe
Aug 22 2017 13:09
.NET Core 2.0 is a lot bigger than .NET Core 1.1 in general, because it has tons of new functionality. But the extra stuff can be trimmed out if it's not used.
Matthijs ter Woord
@mterwoord
Aug 22 2017 13:10
i use it a lot lately: it seems that the new project system by ms is still buggy
buggy, as in , easy to crash vs :)
Eric Mellino
@mellinoe
Aug 22 2017 13:10
Yes... I have heard quite a lot of feedback regarding VS stability :disappointed: . I know they are certainly tuned into it and working hard to fix that stuff
Nikita Tsukanov
@kekekeks
Aug 22 2017 13:11
@mellinoe are linker attributes from xamarin platforms supported?
Matthijs ter Woord
@mterwoord
Aug 22 2017 13:11
sure, but my main complaint is, it this is supposed to be the new standard quality level of RTM, we're back at the "wait for the first big servicepack before jumping"
Nikita Tsukanov
@kekekeks
Aug 22 2017 13:11
i. e. is there something like Xamarin.iOS.Foundation.PreserveAttribute?
Eric Mellino
@mellinoe
Aug 22 2017 13:13
@kekekeks I don't think so, but I'm not positive. I believe you need to pass in things that you want to be force-preserved, as in this section
If that is a feature that would be desirable, I think we would most likely add it
The functionality is in its own nuget package so we could easily add to it
Nikita Tsukanov
@kekekeks
Aug 22 2017 13:13
Yeah, but the thing about Xamarin tooling, is that it allows self-descriptive assemblies
Eric Mellino
@mellinoe
Aug 22 2017 13:13
I know that the underlying technology was taken from the mono linker, though, so it's possible that part was preserved
Nikita Tsukanov
@kekekeks
Aug 22 2017 13:14
That contain the information about types that can be safely linked away
Eric Mellino
@mellinoe
Aug 22 2017 13:14
Yeah
Wiesław Šoltés
@wieslawsoltes
Aug 22 2017 13:14
@mterwoord no just .net core stuff for specific platform
Nikita Tsukanov
@kekekeks
Aug 22 2017 13:15
@mterwoord if it's ILLink
Eric Mellino
@mellinoe
Aug 22 2017 13:15
There is also a very similar notion in .NET Native, which communicates which metadata to preserve for reflection. There was some talk about how we could consolidate those different specs so that it was less fragmented
Nikita Tsukanov
@kekekeks
Aug 22 2017 13:15
Then it has been used in production for years already
Matthijs ter Woord
@mterwoord
Aug 22 2017 13:16
@kekekeks huh? illink? that's to my "standard of rtm" message?
Nikita Tsukanov
@kekekeks
Aug 22 2017 13:16
Since ILLink is basically ported from Mono
yep
Matthijs ter Woord
@mterwoord
Aug 22 2017 13:16
that was in general, vs new project system is still buggy
not the publish size
Wiesław Šoltés
@wieslawsoltes
Aug 22 2017 13:16
@mterwoord I only publish for specific platform like
win7-x64
Matthijs ter Woord
@mterwoord
Aug 22 2017 13:17
@wieslawsoltes was just asking :)
Wiesław Šoltés
@wieslawsoltes
Aug 22 2017 13:18
@mellinoe how you can trim publish size?
Are there settings for publish command or you need set some flags in csproj
Matthijs ter Woord
@mterwoord
Aug 22 2017 13:20
it's a /p:TrimUnusedDependencies=true argment to dotnet publish
but you need to install the package first
Wiesław Šoltés
@wieslawsoltes
Aug 22 2017 13:35
Thanks!
Matthijs ter Woord
@mterwoord
Aug 22 2017 13:36
let me know how that works out, also perf wise..:)
Wiesław Šoltés
@wieslawsoltes
Aug 22 2017 13:36
sure, just added to my project, waiting for results
What about linker dotnet/core#878
[00:02:54] C:\Users\appveyor\.nuget\packages\microsoft.packaging.tools.trimming\1.0.0-preview2-25401-01\build\Microsoft.Packaging.Tools.Trimming.targets(55,5): error MSB4018: The "TrimFiles" task failed unexpectedly. [C:\projects\core2d\apps\Core2D.Avalonia.NetCore\Core2D.Avalonia.NetCore.csproj]
[00:02:54] C:\Users\appveyor\.nuget\packages\microsoft.packaging.tools.trimming\1.0.0-preview2-25401-01\build\Microsoft.Packaging.Tools.Trimming.targets(55,5): error MSB4018: System.ArgumentException: An item with the same key has already been added. Key: libSkiaSharp.dll [C:\projects\core2d\apps\Core2D.Avalonia.NetCore\Core2D.Avalonia.NetCore.csproj]
[00:02:54] C:\Users\appveyor\.nuget\packages\microsoft.packaging.tools.trimming\1.0.0-preview2-25401-01\build\Microsoft.Packaging.Tools.Trimming.targets(55,5): error MSB4018:    at System.ThrowHelper.ThrowAddingDuplicateWithKeyArgumentException(Object key) [C:\projects\core2d\apps\Core2D.Avalonia.NetCore\Core2D.Avalonia.NetCore.csproj]
[00:02:54] C:\Users\appveyor\.nuget\packages\microsoft.packaging.tools.trimming\1.0.0-preview2-25401-01\build\Microsoft.Packaging.Tools.Trimming.targets(55,5): error MSB4018:    at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior) [C:\projects\core2d\apps\Core2D.Avalonia.NetCore\Core2D.Avalonia.NetCore.csproj]
[00:02:54] C:\Users\appveyor\.nuget\packages\microsoft.packaging.tools.trimming\1.0.0-preview2-25401-01\build\Microsoft.Packaging.Tools.Trimming.targets(55,5): error MSB4018:    at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value) [C:\projects\core2d\apps\Core2D.Avalonia.NetCore\Core2D.Avalonia.NetCore.csproj]
[00:02:54] C:\Users\appveyor\.nuget\packages\microsoft.packaging.tools.trimming\1.0.0-preview2-25401-01\build\Microsoft.Packaging.Tools.Trimming.targets(55,5): error MSB4018:    at Microsoft.DotNet.Build.Tasks.TrimFiles.GetFiles(IDictionary`2 packages) [C:\projects\core2d\apps\Core2D.Avalonia.NetCore\Core2D.Avalonia.NetCore.csproj]
[00:02:54] C:\Users\appveyor\.nuget\packages\microsoft.packaging.tools.trimming\1.0.0-preview2-25401-01\build\Microsoft.Packaging.Tools.Trimming.targets(55,5): error MSB4018:    at Microsoft.DotNet.Build.Tasks.TrimFiles.Execute() [C:\projects\core2d\apps\Core2D.Avalonia.NetCore\Core2D.Avalonia.NetCore.csproj]
[00:02:54] C:\Users\appveyor\.nuget\packages\microsoft.packaging.tools.trimming\1.0.0-preview2-25401-01\build\Microsoft.Packaging.Tools.Trimming.targets(55,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() [C:\projects\core2d\apps\Core2D.Avalonia.NetCore\Core2D.Avalonia.NetCore.csproj]
[00:02:54] C:\Users\appveyor\.nuget\packages\microsoft.packaging.tools.trimming\1.0.0-preview2-25401-01\build\Microsoft.Packaging.Tools.Trimming.targets(55,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__25.MoveNext() [C:\projects\core2d\apps\Core2D.Avalonia.NetCore\Core2D.Avalonia.NetCore.csproj]
Wiesław Šoltés
@wieslawsoltes
Aug 22 2017 13:41
Not good
Wiesław Šoltés
@wieslawsoltes
Aug 22 2017 13:52
dotnet/standard#378
Hmmm
I guess it's time to give it a try
And see how far we can get with Avalonia there
this is nice
                                                             Before linking (B)   After linking (B)    Size decrease
-----------                                                  -----------          -----------          -----------
Total size of assemblies                                     60,405,136           29,815,688           50.64 %
Nikita Tsukanov
@kekekeks
Aug 22 2017 14:23
wow
Wiesław Šoltés
@wieslawsoltes
Aug 22 2017 14:23
@danwalmsley You can use this to trim AvalonStudio publish size
Unfortunately the app iss crashing after linker is used :worried:
Nikita Tsukanov
@kekekeks
Aug 22 2017 14:27
Add additional roots
Wiesław Šoltés
@wieslawsoltes
Aug 22 2017 14:31
Not sure what is missing
danwalmsley
@danwalmsley
Aug 22 2017 15:10
@wieslawsoltes does this give you a single executable at the end?
or do you still have multiple files?
Wiesław Šoltés
@wieslawsoltes
Aug 22 2017 15:10
no
Wiesław Šoltés
@wieslawsoltes
Aug 22 2017 16:21
@kekekeks This is why linked exe crushed:
   at Portable.Xaml.XamlMember.LookupRequiresChildNode()
   at Portable.Xaml.XamlMember.get_RequiresChildNode()
   at Portable.Xaml.TypeExtensionMethods.CompareMembers(XamlMember m1, XamlMember m2)
   at System.Collections.Generic.ArraySortHelper`1.InsertionSort(T[] keys, Int32 lo, Int32 hi, Comparison`1 comparer)
   at System.Collections.Generic.ArraySortHelper`1.IntrospectiveSort(T[] keys, Int32 left, Int32 length, Comparison`1 comparer)
   at System.Collections.Generic.ArraySortHelper`1.Sort(T[] keys, Int32 index, Int32 length, IComparer`1 comparer)
   --- End of inner exception stack trace ---
   at System.Collections.Generic.ArraySortHelper`1.Sort(T[] keys, Int32 index, Int32 length, IComparer`1 comparer)
   at System.Collections.Generic.List`1.Sort(Int32 index, Int32 count, IComparer`1 comparer)
   at Portable.Xaml.XamlType.GetAllMembers()
   at Portable.Xaml.XamlType.LookupMember(String name, Boolean skipReadOnlyCheck)
   at Portable.Xaml.XamlType.GetMember(String name)
   at Portable.Xaml.XamlXmlParser.<ReadMemberElement>d__27.MoveNext()
   at Portable.Xaml.XamlXmlParser.<ReadMembers>d__17.MoveNext()
   at Portable.Xaml.XamlXmlParser.<ReadObjectElement>d__14.MoveNext()
   at Portable.Xaml.XamlXmlParser.<Parse>d__12.MoveNext()
   at Portable.Xaml.XamlXmlReader.Read()
   at Portable.Xaml.XamlServices.Transform(XamlReader xamlReader, XamlWriter xamlWriter, Boolean closeWriter)
   at Avalonia.Markup.Xaml.AvaloniaXamlLoaderPortableXaml.LoadFromReader(XamlReader reader, AvaloniaXamlContext context)
   at Avalonia.Markup.Xaml.AvaloniaXamlLoaderPortableXaml.Load(Stream stream, Object rootInstance, Uri uri)
   at Avalonia.Markup.Xaml.AvaloniaXamlLoaderPortableXaml.Load(Type type, Object rootInstance)
   at Avalonia.Markup.Xaml.AvaloniaXamlLoaderPortableXaml.Load(Object obj)
   at Avalonia.Controls.AppBuilderBase`1.Setup()
   at Core2D.Avalonia.NetCore.Program.Main(String[] args)
Matthijs ter Woord
@mterwoord
Aug 22 2017 16:22
reflection?
Wiesław Šoltés
@wieslawsoltes
Aug 22 2017 16:24
Failed to compare two elements in the array.
   at System.Collections.Generic.ArraySortHelper`1.Sort(T[] keys, Int32 index, Int32 length, IComparer`1 comparer)
   at System.Collections.Generic.List`1.Sort(Int32 index, Int32 count, IComparer`1 comparer)
   at Portable.Xaml.XamlType.GetAllMembers()
   at Portable.Xaml.XamlType.LookupMember(String name, Boolean skipReadOnlyCheck)
   at Portable.Xaml.XamlType.GetMember(String name)
   at Portable.Xaml.XamlXmlParser.<ReadMemberElement>d__27.MoveNext()
   at Portable.Xaml.XamlXmlParser.<ReadMembers>d__17.MoveNext()
   at Portable.Xaml.XamlXmlParser.<ReadObjectElement>d__14.MoveNext()
   at Portable.Xaml.XamlXmlParser.<Parse>d__12.MoveNext()
   at Portable.Xaml.XamlXmlReader.Read()
   at Portable.Xaml.XamlServices.Transform(XamlReader xamlReader, XamlWriter xamlWriter, Boolean closeWriter)
   at Avalonia.Markup.Xaml.AvaloniaXamlLoaderPortableXaml.LoadFromReader(XamlReader reader, AvaloniaXamlContext context)   at Avalonia.Markup.Xaml.AvaloniaXamlLoaderPortableXaml.Load(Stream stream, Object rootInstance, Uri uri)
   at Avalonia.Markup.Xaml.AvaloniaXamlLoaderPortableXaml.Load(Type type, Object rootInstance)
   at Avalonia.Markup.Xaml.AvaloniaXamlLoaderPortableXaml.Load(Object obj)
   at Avalonia.Controls.AppBuilderBase`1.Setup()
   at Core2D.Avalonia.NetCore.Program.Main(String[] args)
Jeremy Koritzinsky
@jkoritzinsky
Aug 22 2017 17:03
If you're comparing two structs without overriding Equals, it compares the fields via reflection, so that's probably the issue
Nikita Tsukanov
@kekekeks
Aug 22 2017 17:09
I guess linker has removed Equals or something
@wieslawsoltes You probably need to check InnerException
chris hawley
@chris-hawley
Aug 22 2017 18:56
Does Avalonia support projects in pure c#?
ie...without xaml
Nikita Tsukanov
@kekekeks
Aug 22 2017 19:08
You can use old binding syntax if you want
It's not fancy though
See "Binding in initialization lists" section here https://grokys.github.io/perspex/perspex-properties/
You can still use it, the infrastructure won't be removed
But you will still have a dependency on XAML parser, since we are using XAML for themes internally
chris hawley
@chris-hawley
Aug 22 2017 19:44
i'm currently just using the xaml to initialize the application and then doing the rest in c#
Steven Kirk
@grokys
Aug 22 2017 20:33
@chris-hawley yes that is something that you can do, you can even write the themes without xaml if you want
i've tried to make the syntax for creating UI in code as close to markup as possible
chris hawley
@chris-hawley
Aug 22 2017 20:41
also, is Avalonia going to be retargeted for .net Standard 2.0?
chris hawley
@chris-hawley
Aug 22 2017 20:56
and .net core 2.0 and .net 4.7?
danwalmsley
@danwalmsley
Aug 22 2017 21:30
@chris-hawley it is already supported by those platforms
Steven Kirk
@grokys
Aug 22 2017 22:08
i believe we're going to target netstandard2.0 instead of 1.3 though soon