These are chat archives for AvaloniaUI/Avalonia

21st
May 2018
danwalmsley
@danwalmsley
May 21 2018 08:38
@Gillibald I had a hopefully final review to the Font PR
just a few minor nits to resolve :)
Wiesław Šoltés
@wieslawsoltes
May 21 2018 08:43
I have setup CI builds servers and NuGet packages myget feed for for Dock library
danwalmsley
@danwalmsley
May 21 2018 09:12
@wieslawsoltes great, i should get chance to look at it this evening :)
hopefully I can start submitting you a few PRs :)
@MarchingCube does your Skia PR enable gpu on linux now?
Dariusz Komosiński
@MarchingCube
May 21 2018 09:16
@danwalmsley Nope, this would be in another one. Need to setup a Linux machine to test it.
danwalmsley
@danwalmsley
May 21 2018 09:18
ok thanks
i just ran it on linux with UseSkia(gpu)
and it fell back to software
so thats good
Benedikt Schroeder
@Gillibald
May 21 2018 09:42
Is it intended that skia isnt available under ControlCatalog.Desktop? The package isn't referenced anymore.
zamgi
@zamgi
May 21 2018 10:45
hi guys. I m getting the master version from the repository. I'm trying to compile - it's not going, error: The type or namespace name 'Markup' does not exist in the namespace 'Portable.Xaml' Avalonia.Markup.Xaml D: \ Avalonia-master \ src \ Markup \ Avalonia.Markup.Xaml \ PortableXaml \ AttributeExtensions.cs 3
what to do?
Jumar Macato
@jmacato
May 21 2018 10:46
clone it again but add a --recursive option to fetch the submodules :)
example: git clone https://github.com/AvaloniaUI/Avalonia/ --recursive
zamgi
@zamgi
May 21 2018 10:47
ok. i'm trying...
Steven Kirk
@grokys
May 21 2018 10:49
@zamgi if you've already cloned you can also do git submodule update --init : http://avaloniaui.net/contributing/build
zamgi
@zamgi
May 21 2018 10:53
thank you, it worked out
danwalmsley
@danwalmsley
May 21 2018 11:56
@kekekeks im not sure if I asked you before, but do you know why on gtk backend all windows and popups are given a drop shadow, like the tooltip shown here:
Screenshot from 2018-05-21 13-00-12.png
ok around the child window shown
sanjayicy
@sanjayicy
May 21 2018 13:52
hi guys, i am getting an exception
Portable.Xaml.XamlDuplicateMemberException: Property '{clr-namespace:Avalonia.Controls;assembly=Avalonia.Controls}ContentControl.Content' is already set to this '{clr-namespace:Avalonia.Controls;assembly=Avalonia.Controls}Window' object
at Portable.Xaml.XamlWriterInternalBase.WriteStartMember(XamlMember property)
at Portable.Xaml.XamlObjectWriter.WriteStartMember(XamlMember property)
at Portable.Xaml.XamlWriter.WriteNode(XamlReader reader)
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.DesignerSupport.DesignWindowLoader.LoadDesignerWindow(String xaml, String assemblyPath)
at Avalonia.DesignerSupport.Remote.RemoteDesignerEntryPoint.<>cDisplayClass17_0.<OnTransportMessage>b0()
Please let me know , if you have any solution for it?
Jumar Macato
@jmacato
May 21 2018 13:56
@sanjayicy Can we see the xaml in question?
sanjayicy
@sanjayicy
May 21 2018 14:17

@jmacato The is as follows: <Window xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MyswitchApp">
Hello World!
<StackPanel>

</StackPanel>

</Window>

The moment i insert StackPanel, i get this exception
ahopper
@ahopper
May 21 2018 14:21
just remove the Hello World, only one direct child is allowed here
Jumar Macato
@jmacato
May 21 2018 14:36
@sanjayicy sorry for the delayed response
@ahopper is right, you can only set Window objects' content once, just like in WPF
for example, you can wrap the text and the StackPanel in a Grid
 <Window xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MyswitchApp">
<Grid>Hello World!
<StackPanel>

</StackPanel>
</Grid>
</Window>
but, even though we support plain text in xaml, i'd really advise you to use specific controls like TextBlock & etc. for content
something like this, perhaps?
 <Window xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MyswitchApp">
  <Grid>
   <TextBlock>Hello World!</TextBlock>
   <StackPanel>

   </StackPanel>
  </Grid>
</Window>
i hope that helped you out, and feel free to ask more questions :smile:
danwalmsley
@danwalmsley
May 21 2018 14:49
@grokys at some point I'm going to need to work with you to solve this issue...
Steven Kirk
@grokys
May 21 2018 14:50
oh dear. what issue is that?
danwalmsley
@danwalmsley
May 21 2018 14:50
I did some debugging with @kekekeks a while back and its seemed like layout and arrange queue just kept growing
and unable to process the queue entirely
so you end up with loads of stuff in the tree that no longer gets layout or measure calls
I can repro it, but debugging this goes way over my head ;)
Steven Kirk
@grokys
May 21 2018 14:51
yeah, and i assume you can only repro it in the full app
danwalmsley
@danwalmsley
May 21 2018 14:52
yes, I'm afraid there is very little chance I could make a small repro of it
@kekekeks was able to diagnose the issue but it was like 6 months ago or more now
and we didn't know what the solution should be
Steven Kirk
@grokys
May 21 2018 14:52
did you file an issue?
danwalmsley
@danwalmsley
May 21 2018 14:52
the theory of what was happening is like a "stack overflow" (but not the stack)
@grokys i'll just check
I cant remember if we did
basically you open intellisense which is a popup with a listbox
if you scroll to an item that causes horizontal scrollbar visible
it causes a layout / measure pass inside popup
this resizes the content, and the item that caused the horizontal scrollbar to be required is no longer needed
it then triggers another resize,
which reveals the item
and back and forth
Steven Kirk
@grokys
May 21 2018 14:54
right, that's why there's a limit on the number of layout passes that can take place
danwalmsley
@danwalmsley
May 21 2018 14:54
which makes the layout / measure queue just fill up very quickly until this happens
yeah, if you increase that limit it takes longer for this to happen
ie it screws up display and locks up a bit longer
Steven Kirk
@grokys
May 21 2018 14:55
hmm ok
danwalmsley
@danwalmsley
May 21 2018 14:55
(although disabling the horizontal scrollbar didn't fix it) so theory might be wrong
I think @kekekeks was suggesting if each Window / Popup had its own queue
then the popup going wrong wouldn't affect the other windows
do you think that sounds possible to do that?
Steven Kirk
@grokys
May 21 2018 14:56
yeah, that might be a decent workaround, but there's still a problem
danwalmsley
@danwalmsley
May 21 2018 14:56
yeah
ok ill open an issue and put detailed instructions on how to repro
Steven Kirk
@grokys
May 21 2018 14:56
my problem with debugging this sort of stuff on avalonstudio is when i get the time, avalonstudio never seems to compile!
danwalmsley
@danwalmsley
May 21 2018 14:57
unfortunately it will involve debugging the full app though
Steven Kirk
@grokys
May 21 2018 14:57
so i end up fighting that instead of using my time to debug the issue
danwalmsley
@danwalmsley
May 21 2018 14:57
ok
how about if I add a repro commit
Steven Kirk
@grokys
May 21 2018 14:57
is that likely to be a problem going ahead?
danwalmsley
@danwalmsley
May 21 2018 14:58
with a powershell script that just builds it all correctly?
so you just have to type build.ps1
or something?
Steven Kirk
@grokys
May 21 2018 14:58
oh do i need to run a build script? i always just try to compile in VS
danwalmsley
@danwalmsley
May 21 2018 14:59
I was suggesting I just add one
but visual studio should work fine
the trick is to only build the AvalonStudio.csproj
Steven Kirk
@grokys
May 21 2018 14:59
let me try it now. it's been a while
danwalmsley
@danwalmsley
May 21 2018 14:59
building the solution usually leads to lots of errors
if you have an old version on there
id delete it and re-clone
and make sure you clone --recursive
Steven Kirk
@grokys
May 21 2018 15:01
Submodule path 'AvalonStudio/Avalonia.Ide/src/external/pngcs/pngcs': checked out '67511b5d9cbec5ea4fcf24ff9c44f5e2d6daab44'
error: Server does not allow request for unadvertised object cda9c5d422b6c2d4c225b3cc62c3313db10c8b81
Fetched in submodule path 'AvaloniaEdit', but it did not contain cda9c5d422b6c2d4c225b3cc62c3313db10c8b81. Direct fetching of that commit failed.
danwalmsley
@danwalmsley
May 21 2018 15:01
omg!
ok let me make sure stuff is pushed
oh do git submodule sync
I think some remotes changed since you last did it
Steven Kirk
@grokys
May 21 2018 15:02
ah ok
danwalmsley
@danwalmsley
May 21 2018 15:04
did that make a difference?
Steven Kirk
@grokys
May 21 2018 15:04
yeah, trying to compile now
so i shouldn't do a Build All?
danwalmsley
@danwalmsley
May 21 2018 15:04
no
just AvalonStudio project at the bottom of sol explorer
Steven Kirk
@grokys
May 21 2018 15:05
why is that?
danwalmsley
@danwalmsley
May 21 2018 15:06
just to reduce the number of issues you will have
there are a load of other projects in there that are not to do with the main ide
Steven Kirk
@grokys
May 21 2018 15:07
ok, it's working :)
danwalmsley
@danwalmsley
May 21 2018 15:07
@jmacato I'm trying to trigger the issue, do you just scroll intellisense up and down or type code?
@grokys ok start by opening Avalonia.sln in the ide
then you will need to give me a few mins to find an easy way to trigger it
normally have to open a few files and trigger intellisense a bit
Jumar Macato
@jmacato
May 21 2018 15:09
@danwalmsley just hold down down arrow key whenever a large intellisense popup shows
Steven Kirk
@grokys
May 21 2018 15:10
@danwalmsley this is really cool :D
a lot of progress since i last checked
though the treeview selection seems to be broken
tbh you'll probably want to not use the inbuilt TreeView, VS implements its own based on ListView afair
danwalmsley
@danwalmsley
May 21 2018 15:11
hmm I thought that was fixed
@grokys just wait til you open the XAML editor!
I'm not sure it will work on control catalog though
@jmacato I'm struggling to trigger the bug here
are you able to find a file in Avalonia.sln that causes it?
Steven Kirk
@grokys
May 21 2018 15:12
yeah i couldn't trigger it either
Jumar Macato
@jmacato
May 21 2018 15:13
@danwalmsley it only triggered on AvalonStudio's CodeEditor.cs
danwalmsley
@danwalmsley
May 21 2018 15:13
ok ill see if that works
@grokys might have to open the avalonstudio.sln instead
Jumar Macato
@jmacato
May 21 2018 15:14
right, just triggered the bug again
there
Steven Kirk
@grokys
May 21 2018 15:14
btw when i try to open a xaml file i get:
System.NullReferenceException
  HResult=0x80004003
  Message=Object reference not set to an instance of an object.
  Source=AvalonStudio.Languages.Xaml
  StackTrace:
   at AvalonStudio.Languages.Xaml.XamlLanguageService.RegisterSourceFile(IEditor editor) in D:\projects\AvalonStudio\AvalonStudio\AvalonStudio.Languages.Xaml\XamlLanguageService.cs:line 124
   at AvalonStudio.Controls.Standard.CodeEditor.CodeEditor.RegisterLanguageService(ISourceFile sourceFile) in D:\projects\AvalonStudio\AvalonStudio\AvalonStudio.Controls.Standard\CodeEditor\CodeEditor.cs:line 820
   at AvalonStudio.Controls.Standard.CodeEditor.CodeEditor.<.ctor>b__42_15(Tuple`2 file) in D:\projects\AvalonStudio\AvalonStudio\AvalonStudio.Controls.Standard\CodeEditor\CodeEditor.cs:line 387
   at System.Reactive.AutoDetachObserver`1.OnNextCore(T value)
   at System.EventHandler`1.Invoke(Object sender, TEventArgs e)
   at Avalonia.AvaloniaObject.RaisePropertyChanged(AvaloniaProperty property, Object oldValue, Object newValue, BindingPriority priority)
   at Avalonia.AvaloniaObject.Avalonia.IPriorityValueOwner.Changed(PriorityValue sender, Object oldValue, Object newValue)
   at Avalonia.Utilities.DeferredSetter`2.<>c__DisplayClass9_0`1.<SetAndNotify>b__0(Action notification)
   at Avalonia.PriorityValue.UpdateCore(ValueTuple`2 update, ValueTuple`2& backing, Action`1 notify)
   at Avalonia.Utilities.DeferredSetter`2.SetAndNotify[TValue](TProperty property, TValue& backing, SetterDelegate`1 setterCallback, TSetRecord value)
   at Avalonia.PriorityValue.UpdateValue(Object value, Int32 priority)
   at System.Reactive.AnonymousSafeObserver`1.OnNext(T value)
   at System.Reactive.Linq.ObservableImpl.Merge`1._.Iter.OnNext(TSource value)
   at System.Reactive.Linq.ObservableImpl.Select`2._.OnNext(TSource value)
   at System.Reactive.AutoDetachObserver`1.OnNextCore(T value)
   at System.Reactive.SafeObserver`1.OnNext(TSource value)
   at System.Reactive.Linq.ObservableImpl.Select`2._.OnNext(TSource value)
   at System.Reactive.Subjects.BehaviorSubject`1.OnNext(T value)
   at System.Reactive.Linq.ObservableImpl.Select`2._.OnNext(TSource value)
   at System.Reactive.Linq.ObservableImpl.TakeUntil`2._.T.OnNext(TSource value)
   at System.Reactive.AnonymousSafeObserver`1.OnNext(T value)
   at Avalonia.Markup.Data.Plugins.InpcPropertyAccessorPlugin.Accessor.SendCurrentValue()
Jumar Macato
@jmacato
May 21 2018 15:14
type protected override v (dont complete void) and wait for the popup
then hold down key
type it somewhere in line 534
danwalmsley
@danwalmsley
May 21 2018 15:15
ok just trying now
in codeeditor.cs
@grokys to open codeeditor.cs
when ide is focused you can press
CTRL+P
and type code
use arrow keys to select file
Steven Kirk
@grokys
May 21 2018 15:18
nice :)
@jmacato still cant reproduce here
danwalmsley
@danwalmsley
May 21 2018 15:19
@grokys if yours giving very high cpu usage when doing what he suggested?
Jumar Macato
@jmacato
May 21 2018 15:21
@grokys my cpu throttling could be a factor too. I'm currently on a laptop so it might be a variable to this bug
Steven Kirk
@grokys
May 21 2018 15:22
no, doesn't seem to be
hold on, let me do a screen capture
then you can see if i'm doing something differently
Jumar Macato
@jmacato
May 21 2018 15:22
alright sir
the bug is triggered intermittently now
Steven Kirk
@grokys
May 21 2018 15:24
2018-05-21_17-23-13.gif
Jumar Macato
@jmacato
May 21 2018 15:25
Screenshot from 2018-05-21 23-23-56.png
you should restart AS sir then scroll down to line 534
and type the protected override
Steven Kirk
@grokys
May 21 2018 15:25
ahhh i missed that part
danwalmsley
@danwalmsley
May 21 2018 15:26
being on Linux might be making it easier to trigger
I have had it on windows today though
it just seemed completely random to me though
Jumar Macato
@jmacato
May 21 2018 15:29
this might be easily triggered on linux since it doesnt have GPU acceleration
danwalmsley
@danwalmsley
May 21 2018 15:30
I think its more the gtk backend doesn't behave the same as on windows
if you see the screenshot that groky posted
the intellisense is full size
yours only show 2 items?
Jumar Macato
@jmacato
May 21 2018 15:30
yes
consistently
danwalmsley
@danwalmsley
May 21 2018 15:30
that's obviously a bug in gtk backend I think
Jumar Macato
@jmacato
May 21 2018 15:31
i even tried on the same place sir @grokys typed
i think you might be able to repro this on 18.04 @danwalmsley
danwalmsley
@danwalmsley
May 21 2018 15:31
yeah
iv had it happen on windows today when randomly typing
I think opening lots of editors and code editor last might help
you have to fill up the layout / measure queue a bit first
Steven Kirk
@grokys
May 21 2018 15:32
yeah, works fine on that line too
that isn't going to be easy to fix :(
sanjayicy
@sanjayicy
May 21 2018 15:33
Thank you @jmacato and @ahopper for the help :)
danwalmsley
@danwalmsley
May 21 2018 15:34
yeah just reproing it reliably isn't easy
Steven Kirk
@grokys
May 21 2018 15:34
i've tried opening lots of editors
danwalmsley
@danwalmsley
May 21 2018 15:34
@jmacato I think this might be the reason for typing lag
yeah same here
nothing yet
@grokys where is the layout pass queue size limited
I think if I reduce that in avalonia it might be easier to make it happen?
Jumar Macato
@jmacato
May 21 2018 15:34
@danwalmsley i suspect the same too
Steven Kirk
@grokys
May 21 2018 15:34
the queue size isn't limited
danwalmsley
@danwalmsley
May 21 2018 15:35
ok
hmm I'm going to try using gtk backend
@jmacato when you trigger it does the intellisense only ever appear that size?
Jumar Macato
@jmacato
May 21 2018 15:39
yes
danwalmsley
@danwalmsley
May 21 2018 15:40
ok I'm trying with it forced to about that size
I think its an interaction with scrollbars
Jumar Macato
@jmacato
May 21 2018 15:40
image.png
after triggering the bug, it's stuck to that size
danwalmsley
@danwalmsley
May 21 2018 15:41
but before you get normal size
Jumar Macato
@jmacato
May 21 2018 15:41
i'll recheck
danwalmsley
@danwalmsley
May 21 2018 15:41
ah that make sense because it starts needing more layout passes
Jumar Macato
@jmacato
May 21 2018 15:42
yup, i dont get the normal sized popup at all
on CodeEditor.cs at least
other smaller files has normal intellisense popup size
danwalmsley
@danwalmsley
May 21 2018 15:43
any exception messages?
in console
Jumar Macato
@jmacato
May 21 2018 15:44
there's none (albeit im on Release mode, gonna switch back)
nothing on Debug configuration too
danwalmsley
@danwalmsley
May 21 2018 15:46
@grokys i'll give you a shout when we find a repro
or how to trigger it
Steven Kirk
@grokys
May 21 2018 15:48
ok. when it happens if you could look in the devtools and see if the controls are actually layed out there all wrong, or simply drawn there wrong
danwalmsley
@danwalmsley
May 21 2018 15:49
ok looks like its just the formatted text inside the editor
that gets messed up
Steven Kirk
@grokys
May 21 2018 15:50
ok, so that's not a layout problem
Jumar Macato
@jmacato
May 21 2018 15:51
@grokys @danwalmsley i have to go, midnight's clocking in
danwalmsley
@danwalmsley
May 21 2018 15:51
@jmacato thanks for helping with this :)
Steven Kirk
@grokys
May 21 2018 15:51
sure, have a good sleep :D
Jumar Macato
@jmacato
May 21 2018 15:51
alright, thanks! :smiley:
danwalmsley
@danwalmsley
May 21 2018 15:51
@grokys I'm not 100% sure what avalonia edit does under the hood
could it be measure pass doesn't happen?
then all text has 0 height or something
Steven Kirk
@grokys
May 21 2018 15:52
no idea honestly
i don't know how avalonia edit works either
Jeremy Koritzinsky
@jkoritzinsky
May 21 2018 15:53
@grokys would you be interested in enabling SourceLink on our packages? I think it would make debugging a lot easier.
Steven Kirk
@grokys
May 21 2018 15:53
most definitely!!
Jeremy Koritzinsky
@jkoritzinsky
May 21 2018 15:54
I'll take look at doing that as my next PR then!
Steven Kirk
@grokys
May 21 2018 15:54
@jkoritzinsky if you're around for a bit, i wanted to go through your refactor PR again
Jeremy Koritzinsky
@jkoritzinsky
May 21 2018 15:54
Sure! I'm on mobile now so let be pull out my laptop.
*me
Steven Kirk
@grokys
May 21 2018 15:54
i think it's looking good, just if you're around it's worth me doing it now so i can ask you questions here
Jeremy Koritzinsky
@jkoritzinsky
May 21 2018 15:55
Yep!
I've got my laptop up so ask away!
Steven Kirk
@grokys
May 21 2018 16:03
cool - so what you were saying about Binding makes sense as well. not sure we really need a BindingBase
however, it should probably be in the Avalonia.Data namespace?
danwalmsley
@danwalmsley
May 21 2018 16:05
@jmacato I have an idea, what we could do tomorrow when your available is if you run the application against locally compiled binaries
Steven Kirk
@grokys
May 21 2018 16:05
maybe we should make the Avalonia.Markup project's default namespace Avalonia, move the other stuff in there into a Markup directory and move Binding out into a top-level Data directory
danwalmsley
@danwalmsley
May 21 2018 16:05
@grokys could possibly attach a debugger to your system over ssh whilst you trigger the bug?
if I cant find a repro
Jeremy Koritzinsky
@jkoritzinsky
May 21 2018 16:06
That worsk for me!
Steven Kirk
@grokys
May 21 2018 16:06
just to keep the directory structure and the namespace structure the same?
ahopper
@ahopper
May 21 2018 16:06
@danwalmsley not related to this discussion but it inspired me to try avalonia studio again. Two project I've tried load build and run which is cool. I noticed that the bottoms of fonts are cut off in the solution explorer, ps and ys loose their tails in 0.4.3.0. Also I use .tt templates to generate c# native bindings and view models from my c++ classes, I just wondered if you had any plan to support them.
Jeremy Koritzinsky
@jkoritzinsky
May 21 2018 16:06
That sounds good.
danwalmsley
@danwalmsley
May 21 2018 16:06
@ahopper hey
Jeremy Koritzinsky
@jkoritzinsky
May 21 2018 16:06
@danwalmsley What about VS Live Share?
Steven Kirk
@grokys
May 21 2018 16:06
do you want to do that @jkoritzinsky or shall I?
Jeremy Koritzinsky
@jkoritzinsky
May 21 2018 16:06
I can do that. Can you put that as a comment in the PR just so we have a record of it?
Steven Kirk
@grokys
May 21 2018 16:07
sure!
danwalmsley
@danwalmsley
May 21 2018 16:08
@jkoritzinsky VS Live share hmm does that work already?
Steven Kirk
@grokys
May 21 2018 16:08
@jkoritzinsky done!
probably MultiBinding too
Jeremy Koritzinsky
@jkoritzinsky
May 21 2018 16:09
@danwalmsley It's in public beta right now.
Steven Kirk
@grokys
May 21 2018 16:09
and RelativeSource etc
Jeremy Koritzinsky
@jkoritzinsky
May 21 2018 16:09
@grokys I'm thinking of moving the whole Avalonia.Markup.Data namespace except maybe DelayedBinding since that's more markup-specific.
danwalmsley
@danwalmsley
May 21 2018 16:09
@grokys ill get the repro working on my Linux machine and when you have time we can try out this live share see if we can debug the issue like that
Steven Kirk
@grokys
May 21 2018 16:09
yeah was just about to say
@danwalmsley ok cool
danwalmsley
@danwalmsley
May 21 2018 16:10
@ahopper I messaged you in the AvalonStudio room re the issue.
Steven Kirk
@grokys
May 21 2018 16:13
@jkoritzinsky other than that, looks good i think!
we can tweak as necessary moving forward
Jeremy Koritzinsky
@jkoritzinsky
May 21 2018 16:15
Works for me!
Also, any chance you've had time to take a look at the last comment on the TypeConverters PR? I'd like to get that one merged in as well.
Steven Kirk
@grokys
May 21 2018 16:40
ah yeah that one had dropped off my radar
ok @jkoritzinsky yeah the problem with CreateDelegate is that I don't think that will work on iOS?
so we can add an #if around it, but I was wondering how much of a perf bottleneck it'd really be?
Jeremy Koritzinsky
@jkoritzinsky
May 21 2018 16:45
I can't find anything that says that it doesn't work on iOS
And everything I can find online says that MethodInfo.Invoke is a serious perf hit compared to a delegate created with Delegate.CreateDelegate
Like 100x worse.
Steven Kirk
@grokys
May 21 2018 16:49
hmm ok, i thought it would involve codegen which afaik isn't available on iOS
i'll make that change then
Benedikt Schroeder
@Gillibald
May 21 2018 16:50
That's what I discovered when I researched it. That's why I made the comment.
Steven Kirk
@grokys
May 21 2018 16:53
:+1:
Steven Kirk
@grokys
May 21 2018 17:16
@jkoritzinsky @Gillibald updated that PR to call CreateDelegate
i also added a check for IsPrimitive on the type because we were creating type converters for int etc
that lets e.g. DateTime through though. i'm not sure what the list of types we shouldn't create ParseTypeConverters for would be?
DateTime and Uri?
Steven Kirk
@grokys
May 21 2018 18:32
added in a check for those
Benedikt Schroeder
@Gillibald
May 21 2018 18:42
Do you check for TypeCoverterAttribute if a type has no parse method
Steven Kirk
@grokys
May 21 2018 18:51
that's checked before it gets to that point
the parse method is a last resort
Benedikt Schroeder
@Gillibald
May 21 2018 19:09
Sounds good
Steven Kirk
@grokys
May 21 2018 19:13
@Gillibald finally got time to look at your font PR
really cool
thanks for doing that!
just one change i think is needed and one question
also as @danwalmsley said, I think the string cast operator is the wrong way round ;)
Benedikt Schroeder
@Gillibald
May 21 2018 19:15
I will commit some changes soon. Need to add some more unit tests first.
Yes thats true changed that my bad
Steven Kirk
@grokys
May 21 2018 19:16
cool
Benedikt Schroeder
@Gillibald
May 21 2018 19:17
Had to introduce some more overrides for GetHashcode etc
I can just store Uris instead of FontAsset thats fine for me. I had something else in mind when i introduced that abstraction but thats no longer needed.
Steven Kirk
@grokys
May 21 2018 19:21
cool. that would remove one reason for InternalsVisibleTo i think
Benedikt Schroeder
@Gillibald
May 21 2018 19:21
I dont understand why a consumer of avalonia should see properties like FontFamily.Key etc. I can make these public thats easy to do but in my opinion thats just wrong
I just needed InternalsVisibileTo for unit tests
Steven Kirk
@grokys
May 21 2018 19:22
for unit tests that's fine
but there's [assembly: InternalsVisibleTo("Avalonia.Direct2D1")] and [assembly: InternalsVisibleTo("Avalonia.Skia")]
that means that we're saying no-one can create a 3rd-party renderer
or would they just have to copy/paste those classes?
Benedikt Schroeder
@Gillibald
May 21 2018 19:24
Those are needed to access FontFamilyKey
Dont know how to make them available to 3rd Party without confusing a normal consumer of avalonia
Most of the font stuff is internal but i can make it public to remove InternalsVisibleTo entirly
Steven Kirk
@grokys
May 21 2018 19:35
Well maybe we don't even want to support that, but I'd always had in mind that we'd be extendable without recompiling
Benedikt Schroeder
@Gillibald
May 21 2018 19:35
I will introduce a IFontFamily interface that makes it possible to access these properties. That way these dont need to be internal.
Steven Kirk
@grokys
May 21 2018 19:44
What is it you want to hide from that class?
Benedikt Schroeder
@Gillibald
May 21 2018 19:46
Doesn't seem right to make FamilyNames and Key public. I mean they are immutable so we dont risk anything. But in my opinion these properties are just some implementation detail and should be made public.
The fast fix would be to make everything public
Steven Kirk
@grokys
May 21 2018 19:50
Hmm
You could argue that because they're needed by the renderer they're not an implementation detail
Benedikt Schroeder
@Gillibald
May 21 2018 19:52
Hmm
Steven Kirk
@grokys
May 21 2018 19:52
But I guess it depends where you draw the line on "implementation"
Jeremy Koritzinsky
@jkoritzinsky
May 21 2018 19:53
I think we should either do the interface way or make them public.
Benedikt Schroeder
@Gillibald
May 21 2018 19:53
FamilyNameCollection IFontFamily.FamilyNames => FamilyNames;
FontFamilyKey IFontFamily.Key => Key;
internal FamilyNameCollection FamilyNames { get; }
internal FontFamilyKey Key { get; }
Jeremy Koritzinsky
@jkoritzinsky
May 21 2018 19:53
We definitely shouldn't need InternalsVisibleTo for anything except unit tests.
Works for me
danwalmsley
@danwalmsley
May 21 2018 19:58
@Gillibald imaging tomorrow I have some custom system that uses some strange rendering system, etc and I want to add support for Avalonia, but the system is closed source or proprietry.
I might want to make a DLL that adds support for that and the text implementation part of that might need access to the font key and other parts that are currently marked internal.
If direct 2d and Skia needed them I'd probably need them for the new rendering system, and it being proprietry means I wouldn't be able to submit it as a PR to main repo
So I couldn't add the assemblies visible to really
Benedikt Schroeder
@Gillibald
May 21 2018 20:07
I will keep that in mind just didn't think about 3rd party renderers
Benedikt Schroeder
@Gillibald
May 21 2018 20:47
IAssetLoader probably needs some comment fixes. All comments talk about resources but they should be named asset to be consistent.

Should I rename this?

IEnumerable<(string absolutePath, Assembly assembly)> GetAssets(Uri location);

to

IEnumerable<(string absolutePath, Assembly assembly)> GetResources(Uri location);
Steven Kirk
@grokys
May 21 2018 21:13
hmm, not sure really. we should probably just change all mention of "resource" in the comments to "asset"?
as i said before, calling things "resources" can be confusing because we have Control.Resources so it's not immediately obvious which one we mean

for example in the WPF docs they have to say https://docs.microsoft.com/en-us/dotnet/framework/wpf/advanced/xaml-resources:

The resource files described in this topic are different than the resource files described in WPF Application Resource, Content, and Data Files and different than the embedded or linked resources described in Managing Application Resources (.NET).

that's 3 different things called resources!
Jeremy Koritzinsky
@jkoritzinsky
May 21 2018 21:18
@grokys idea for asset management in the future: support loading Android or iOS assets when on those platforms.
Steven Kirk
@grokys
May 21 2018 21:19
don't we have that yet?
Jeremy Koritzinsky
@jkoritzinsky
May 21 2018 21:43
I don't think we have anything in Avalonia to do that.
At least not in AssetLoader