These are chat archives for AvaloniaUI/Avalonia

16th
Oct 2017
tluyben
@tluyben
Oct 16 2017 07:14
@kekekeks Ok, this was a default Visual Studio 2017 Preview install, so anyone using it that way will just get that error. How do I prevent it? I wasn't aware it's 'old' and it seems VS '17 isn't aware either?
Matthijs ter Woord
@mterwoord
Oct 16 2017 07:17
awesome, i got avalonia working on a yocto-built beaglebone black image :)
(rpi should work as well)
Nikita Tsukanov
@kekekeks
Oct 16 2017 07:32
@tluyben use application templates from our VS extension
It creates projects with correct nuget references format
tluyben
@tluyben
Oct 16 2017 07:47
@kekekeks ok! thanks, will do that. When I compiled my self (until I tried that) It did just work so I thought something was going on ! :) Thanks for that; i'll go and do that right now.
danwalmsley
@danwalmsley
Oct 16 2017 08:51
uhhhohh! one of the recent changes has done this...
image.png
its probably template lookup
any idea of recent changes that might have affected it
Steven Kirk
@grokys
Oct 16 2017 08:54
hmm, no, possibly the update to portable.xaml?
danwalmsley
@danwalmsley
Oct 16 2017 08:55
I'm just rolling back to version before that to see
2 secs
yeah if I roll back portable.xaml it comes back
Nikita Tsukanov
@kekekeks
Oct 16 2017 09:02
should we roll back or try to fix it?
danwalmsley
@danwalmsley
Oct 16 2017 09:03
try to fix it I guess
Nikita Tsukanov
@kekekeks
Oct 16 2017 09:03
we need a simple repro then
danwalmsley
@danwalmsley
Oct 16 2017 09:03
data templates work in other places
hmmm
easier said than done most of the time
i'll try to move the document tab control out on its own
and see if it happens
ok give me an hour or so I will try and have one
danwalmsley
@danwalmsley
Oct 16 2017 10:25
@grokys @kekekeks I saw a while back that data validation was implemented, is there any example of how to use validation
i basically want to check if a value is not an empty string or something like
that, is validation done in viewmodel or is it a control thing?
ah is it simply you throw an exception on the vm setter?
nice couldn't be simpler
Nikita Tsukanov
@kekekeks
Oct 16 2017 10:30
We should limit it to particular set of exceptions, I think
danwalmsley
@danwalmsley
Oct 16 2017 10:31
hmmm it doesn't work for me
Matthijs ter Woord
@mterwoord
Oct 16 2017 10:32
With WPF, ValidateNotifyError needs to be set on the binding
same applies to avalonia i guess?
Wiesław Šoltés
@wieslawsoltes
Oct 16 2017 10:33
@danwalmsley I have used ReactiveProperty MVVM framework, not sure how it works under the hood
danwalmsley
@danwalmsley
Oct 16 2017 10:34
here in my vm I do this.
public override string Title
        {
            get => Model.Name;
            set
            {
                if(Model.CanRename && Title != value)
                {
                    if (!string.IsNullOrEmpty(value))
                    {
                        Model.Name = value;
                    }
                    else
                    {
                        throw new InvalidOperationException("Name must have a length of at least 1.");
                    }
                }
            }
        }
just as a down to basics example
but in my control it just raises
image.png
hmm will try the reactive example
@wieslawsoltes thanks
danwalmsley
@danwalmsley
Oct 16 2017 11:13
ok I'm fairly convinced there is some kind of validation bug
hopefully it is clear from this gif of me debugging
validation-bug.gif
@kekekeks @grokys it shows calling _property.SetValue, which works, and an exception is thrown in the viewmodel, but for some reason, the exception doesn't get caught
even though its inside a try catch
validation-bug.gif
does it make sense from the gif?
danwalmsley
@danwalmsley
Oct 16 2017 11:35
hmm maybe it is being caught
danwalmsley
@danwalmsley
Oct 16 2017 12:07
@kekekeks @kekekeks the portable.xaml thing seems to be exceptions when loading the XAML, like it cant find a namespace or something
I think the repro might just be to checkout avalonstudio, and run it
and you can see the exception and where it gets stuck?
looks like from inspecting the debugger should be able to work out what went wrong
Nikita Tsukanov
@kekekeks
Oct 16 2017 13:15
@grokys @jkoritzinsky We need a way to load all assemblies that have types referencing Avalonia
For proper xmlns discovery
AppDomain.Current.GetAssemblies() gives us a snapshot
But that's not what we actually need
Matthijs ter Woord
@mterwoord
Oct 16 2017 13:17
there's something .net core for that..
Nikita Tsukanov
@kekekeks
Oct 16 2017 13:17
Nope, that doesn't work properly
Matthijs ter Woord
@mterwoord
Oct 16 2017 13:17
the .deps.json file?
Nikita Tsukanov
@kekekeks
Oct 16 2017 13:17
With deps.json we need a JSON parser
And when we've tried using it
via AssemblyLoadContext
Matthijs ter Woord
@mterwoord
Oct 16 2017 13:17
iir cthere's an api for that
Nikita Tsukanov
@kekekeks
Oct 16 2017 13:18
We were loading way too many assemblies
Like system.cryptography, etc
Matthijs ter Woord
@mterwoord
Oct 16 2017 13:18
ok
Nikita Tsukanov
@kekekeks
Oct 16 2017 13:18
And that doesn't work with iOS properly
Matthijs ter Woord
@mterwoord
Oct 16 2017 13:18
isn't that a problem with wpf as well?
Nikita Tsukanov
@kekekeks
Oct 16 2017 13:18
Because unless linker actually sees your root assembly referencing another one
It won't be even included
And Assembly.Load doesn't work there
So we need some compile-time solution for that
possibly involving Mono.Cecil
Matthijs ter Woord
@mterwoord
Oct 16 2017 13:19
i believe i had similar issues with wpf..
but you cant solve it, unless you're introducing circular dependencies..
Nikita Tsukanov
@kekekeks
Oct 16 2017 13:20
I was thinking about emiting something like
yield return typeof(SomeLib.SomeType).Assembly;
yield return typeof(AnotherLib.SomeType).Assembly;
And merging it somewhere
The question is where
Obvious choice would be App.xaml.cs
But it's not the final entry point
So some types might be added afterwards
Another place where we can possibly do that
Is our new BuildAvaloniaApp static method that's required for designer to work
We can emit some code and call it from there
sdoroff
@sdoroff
Oct 16 2017 16:09
Hello, I'm Sam
First, Avalonia looks awesome. I want to thank everyone who's dedicated time to building it
I think I'd like to start contribuing
I'm still learning my way around the framework and have no experience with low-level graphic rendering, but I'm pretty handy with controls.
To get my feet wet, I've ported the Calendar control over from Silverlight
Its working pretty well
I have no prior experience contributing to open source projects, so I may have some stupid questions along the way
First and foremost, the Silverlight source is licensed under MS-Pl. Can that code be directly integrated into Avalonia?
Nikita Tsukanov
@kekekeks
Oct 16 2017 16:14
MS-PL is compatible with MIT, so it can be merged to the main repo. However, we need to keep the original license text
Eric Dunaway
@EricDunaway
Oct 16 2017 16:19
I thought it would cause a problem because anyone who files a patent claim against Microsoft looses license rights.
Nikita Tsukanov
@kekekeks
Oct 16 2017 16:21
Well... I guess it's not that bad
And it doesn't specify "microsoft"
If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically.
So, don't be evil, mkay?
sdoroff
@sdoroff
Oct 16 2017 16:22
I'm not planning on anything evil...
Eric Dunaway
@EricDunaway
Oct 16 2017 16:22
Yeah i just assumed Microsoft was the originator of silverlight control
sdoroff
@sdoroff
Oct 16 2017 16:22
They are.
The code is from a Microsoft repository
I'm currently planning on porting a few other controls over, then starting the massive undertaking that is the DataGrid
Nikita Tsukanov
@kekekeks
Oct 16 2017 16:25
It might take months...
AvaloniaUI/Avalonia#1030
sdoroff
@sdoroff
Oct 16 2017 16:25
I'm aiming to have it by the end of 2018 working about a day a week.
Eric Dunaway
@EricDunaway
Oct 16 2017 16:25
Its would only be a problem for someone who filed a claim against Microsoft or Avalonia for parent infringement on the control.
Nikita Tsukanov
@kekekeks
Oct 16 2017 16:27
Well, at least we have Static/DynamicResource now
So porting controls should be easier than before
sdoroff
@sdoroff
Oct 16 2017 16:27
I'm pretty thankful for that
Eric Dunaway
@EricDunaway
Oct 16 2017 16:28
I saw Telerik released a datagrid for UWP under Apache License. Maybe that can be ported
sdoroff
@sdoroff
Oct 16 2017 16:28
I need to clean up the Calendar code a bit and move it into the actual Avalonia.Controls project, but I'll hopefully have pull request in the next couple of days.
I'll look into Telerik as option for the DataGrid once I get to it. Next up will be a DatePicker using the Calendar control.
Nikita Tsukanov
@kekekeks
Oct 16 2017 16:31

Maybe that can be ported

I've checked that, they heavily rely on their own rendering code

That uses DirectX directly
The one from Xceed seems to be more promising
Jeremy Koritzinsky
@jkoritzinsky
Oct 16 2017 16:39
Also look at the analyzers in AvaloniaAnalyzers. They're a little out of date but they help a lot with the conversion of controls with lots of DependencyPropertys