These are chat archives for AvaloniaUI/Avalonia

27th
Nov 2015
Friedrich von Never
@ForNeVeR
Nov 27 2015 05:06
@grokys okay, I'll try to make an example of problems that can be caused by this comparison. operator == for Double is generally considered harmful, and, for example, Resharper will complain if it see code like that in ProgressBar.cs.
But I'll try to make a real example of a problem that can be rarely triggered in ProgressBar with its current implementation.
Steven Kirk
@grokys
Nov 27 2015 11:07
yeah, a real problem would be helpful - if you could put it in a unit test too
i know == on double isn't usually a good idea, but in this case it's only there to prevent divide by zero
Nikita Tsukanov
@kekekeks
Nov 27 2015 11:09
BTW dividing double by zero doesn't give you an exception
Steven Kirk
@grokys
Nov 27 2015 11:09
@kekekeks ok, taking a look at the PR now
Nikita Tsukanov
@kekekeks
Nov 27 2015 11:09
It returns infinity
So we should probably check for that instead
Steven Kirk
@grokys
Nov 27 2015 11:10
i'd like the see the actual problem that @ForNeVeR is trying to fix first; it's hard to know the correct solution when the problem isn't clear
a unit test demonstrating the problem, together with the fix would be the best way to do that
anyway, regarding the designer PR: i see why you moved the window creation methods to the IWindowingPlatform interface, however i'm not convinced it's the best way to do it.
as creating a designer friendly window is only valid for windows/VS
if we were to write a monodevelop designer, it's quite possible that a different technique would be needed right?
would a separate IVsDesignerPlatform interface make more sense?
Nikita Tsukanov
@kekekeks
Nov 27 2015 11:15

if we were to write a monodevelop designer, it's quite possible that a different technique would be needed right?

It will use GtkSocket/GtkPlug

And implement the same method
Steven Kirk
@grokys
Nov 27 2015 11:15
i don't like having a method that will always be throw new NotImplementedException(); on all other platforms
Nikita Tsukanov
@kekekeks
Nov 27 2015 11:15
GTK will be supported later
Steven Kirk
@grokys
Nov 27 2015 11:16
but android, ios, etc will never have a valid implementation for that
so to me it would make more sense to have a designer interface
Nikita Tsukanov
@kekekeks
Nov 27 2015 11:16
Well, it should be probably called "CreateEmbeddableWindow"
Steven Kirk
@grokys
Nov 27 2015 11:16
ah, in that case, yeah
Nikita Tsukanov
@kekekeks
Nov 27 2015 11:16
Because it's what it actually does
Steven Kirk
@grokys
Nov 27 2015 11:16
ok yeah, i don't have such a problem with that
small nit: could we move WindowingPlatformMock out of the Perspex.Controls.UnitTests.Primitives namespace and into Perspex.Controls.UnitTests? it's not a primitive
Steven Kirk
@grokys
Nov 27 2015 11:21
and quite possible it'd be needed for other tests
Nikita Tsukanov
@kekekeks
Nov 27 2015 11:22
yep, I've initially extracted it to another file in the same namespace
Steven Kirk
@grokys
Nov 27 2015 11:23
DesignerApi is internal, shouldn't it be public if it's an API?
Nikita Tsukanov
@kekekeks
Nov 27 2015 11:23
Well, you are supposed to include source file to your project
To avoid any coupling with perspex codebase
I'm using OWIN approach with primitive types, Actions and dictionaries here
Steven Kirk
@grokys
Nov 27 2015 11:25
sorry, i don't understand - include the source file in your project?
Nikita Tsukanov
@kekekeks
Nov 27 2015 11:25
Yep
Instead of referencing dll
Steven Kirk
@grokys
Nov 27 2015 11:26
so when you create a new perspex project, that file gets added to the project?
Nikita Tsukanov
@kekekeks
Nov 27 2015 11:26
Ehm
Steven Kirk
@grokys
Nov 27 2015 11:26
confused
Nikita Tsukanov
@kekekeks
Nov 27 2015 11:26
When you want to write your designer host for perspex, you take this file and include in your project
So you don't have to reference any perspex dlls
API itself is defined by Dictionary<string, object> and a bunch of actions
See how OWIN do this
Steven Kirk
@grokys
Nov 27 2015 11:27
when you say "your project" what do you mean? a project created by "New -> Perspex Application"?
Nikita Tsukanov
@kekekeks
Nov 27 2015 11:28
By "your project" I mean something that wants to host designer
Steven Kirk
@grokys
Nov 27 2015 11:28
ah, ok
Nikita Tsukanov
@kekekeks
Nov 27 2015 11:28
VS extension, Xamarin Studio Extension, whatever
Steven Kirk
@grokys
Nov 27 2015 11:28
ok.
so why is it in Perspex.Application?
Nikita Tsukanov
@kekekeks
Nov 27 2015 11:28
That stuff shouldn't reference perspex assemblies
Perspex.Application implements that API
Steven Kirk
@grokys
Nov 27 2015 11:29
you've really lost me...
Nikita Tsukanov
@kekekeks
Nov 27 2015 11:29
Since we need to implement it in some assembly that is guaranteed to exist on output directory
Steven Kirk
@grokys
Nov 27 2015 11:30
so it exists in Perspex.Application but you also copy the same file into the designer project?
Nikita Tsukanov
@kekekeks
Nov 27 2015 11:30
Yep
Not copy, there is "Add as link..." option
Designer host-process loading process:
1) Locate output directory
2) Load all assemblies from it
3) Locate Perspex.Designer.Designer type
4) Call Init method and pass a dictionary to it
That dictionary gets filled with delegates that implement designer API
Host process also fills entries with event handlers
Steven Kirk
@grokys
Nov 27 2015 11:32
and DesignerApi is the dictionary?
Nikita Tsukanov
@kekekeks
Nov 27 2015 11:32
It's a wrapper around that dictionary
That provides strongly-typed accessors
Steven Kirk
@grokys
Nov 27 2015 11:34
yeah, i'm aware of OWIN (at least to some extent)
Nikita Tsukanov
@kekekeks
Nov 27 2015 11:34
It also uses dictionaries for app <-> host communication
Steven Kirk
@grokys
Nov 27 2015 11:34
but a Dictionary<string, object> is passed from the designer process to the application's Designerobject which fills it in, i get that
Nikita Tsukanov
@kekekeks
Nov 27 2015 11:35
Using ((Action<string>) _api["UpdateXaml"])(xaml) is a bit inconvinient, you know
So there is a wrapper called DesignerApi
It's not supposed to be a public type
You are supposed to have your own copy that corresponds to specific API version
Steven Kirk
@grokys
Nov 27 2015 11:37
ok, but it exists for the designer process
Nikita Tsukanov
@kekekeks
Nov 27 2015 11:37
Yep
It's used both by api user and api implementation
Steven Kirk
@grokys
Nov 27 2015 11:38
so the fact that the designer process and Perspex.Application use the same implementation is an implementation detail
Nikita Tsukanov
@kekekeks
Nov 27 2015 11:38
Yep
Steven Kirk
@grokys
Nov 27 2015 11:38
ok, i think i understand
oh sorry
ignore that
i read new DesignerApi
Nikita Tsukanov
@kekekeks
Nov 27 2015 11:39
We might extend DesignerApi later and still stay compatible with older VS extension and vice versa
Steven Kirk
@grokys
Nov 27 2015 11:39
won't the new DesignerApp get collected?
Nikita Tsukanov
@kekekeks
Nov 27 2015 11:40
Ehm
I thought, that you are the one who saves application instance to a static variable
Steven Kirk
@grokys
Nov 27 2015 11:40
haha yeah you're right sorry
ok, i think i understand
might be a good idea to put some documentation in there because if i didn't understand it it's unlikely that someone else will...
though i am quite slow at times...
Steven Kirk
@grokys
Nov 27 2015 11:46
but yeah, i like it in general
Nikita Tsukanov
@kekekeks
Nov 27 2015 11:46
It's better than that bunch of dynamic/reflection hacks we had before
Steven Kirk
@grokys
Nov 27 2015 11:46
definitely
linking the DesignerApi class from Perspex.Application into the designer process seems a little strange, but i think it makes sense to me now
it's just a pattern i've not seen before
is there a similar class in OWIN that uses the same pattern?
Nikita Tsukanov
@kekekeks
Nov 27 2015 11:49
They are shipping wrappers using NuGet
I've linked that stuff directly because I didn't want to introduce a dll just for one class
Steven Kirk
@grokys
Nov 27 2015 11:50
ok, yeah makes sense
Nikita Tsukanov
@kekekeks
Nov 27 2015 11:51
I've seen some separate cs file with owin definitions, however
Steven Kirk
@grokys
Nov 27 2015 11:51
i was just wondering what it was called in OWIN? the name DesignerApi doesn't make it immediately obvious what it is
can't think of a better name off the top of my head, was just wondering what OWIN called it
but probably some documentation would solve that
Nikita Tsukanov
@kekekeks
Nov 27 2015 11:52
Well, they don't have a uniform connection point for everything
They have "environment" that is stored in a dictionary that's passed to app delegate
Steven Kirk
@grokys
Nov 27 2015 11:57
ok. yeah, all looks good to me i think
Nikita Tsukanov
@kekekeks
Nov 27 2015 11:57
I'll work on attached property and markup extension intellisense then
Steven Kirk
@grokys
Nov 27 2015 11:57
cool!
Nikita Tsukanov
@kekekeks
Nov 27 2015 11:58
Might as well do something about designer background since @ImaBrokeDude seems to have abandoned that
That thing can directly debug decompiled binaries
Steven Kirk
@grokys
Nov 27 2015 12:00
btw, what's with the whitespace? sometimes you have a linebreak at the beginning of classes, sometimes none sometimes two, sometimes one or two at the end. sometimes you have pages of code with no linebreaks, sometimes two linebreaks between seemingly connected statements... i know it's a very tiny nit, but it distracts me... i crave consistency in whitespace! ;)
Nikita Tsukanov
@kekekeks
Nov 27 2015 12:02
Well, I treat whitespace as a noise, so in most cases it doesn't even make its way to consciousness level
I mean, whitespace outside of methods
Steven Kirk
@grokys
Nov 27 2015 12:03
yeah i noticed that in general you don't like it!
Nikita Tsukanov
@kekekeks
Nov 27 2015 12:04
Ahahah
Steven Kirk
@grokys
Nov 27 2015 12:04
it's not a problem, i was just wondering why the different styles
Nikita Tsukanov
@kekekeks
Nov 27 2015 12:05
Well, lines 26 and 32 are definetely useless
But lines 38 and 44 split the method's logical components
Some kind of paragraph separator
Steven Kirk
@grokys
Nov 27 2015 12:06
yeah, i'm all for that. but from reading your usual code it... ii dunno it just looks like someone else wrote it.
;)
as long as you don't start using regions though, i'm fine with it ;)
two line breaks is a bit excessive however for my tastes
Nikita Tsukanov
@kekekeks
Nov 27 2015 12:08

like someone else wrote it

Might depend on the current level of sleep deprivation

Steven Kirk
@grokys
Nov 27 2015 12:08
probably!
i dunno if it's just me, but i was investigating the roslyn source the other day, and it's so nicely formatted!
Nikita Tsukanov
@kekekeks
Nov 27 2015 12:47
We are releasing next week, right?
Steven Kirk
@grokys
Nov 27 2015 13:13
we should if possible yeah!
Darnell Williams
@Seeker1437
Nov 27 2015 13:23
@kekekeks Actually I have it
I just never PR'd it because there are a couple of other thing s I want to add to it as well
Nikita Tsukanov
@kekekeks
Nov 27 2015 14:53
It's too late, I've implemented that in 20mins
Dude, you just can't keep code unpublished for months
Darnell Williams
@Seeker1437
Nov 27 2015 14:53
true XD
@kekekeks I'm curious, when did you start learning to develop?
I but it was at least 10 years ago XD
Nikita Tsukanov
@kekekeks
Nov 27 2015 14:58
Approximately when I was 9-11 years old
I have almost no consistent memory of that time period, but I've found my BASIC program on old hard drive that was dated Apr 2002
Darnell Williams
@Seeker1437
Nov 27 2015 15:00
Ah okay so for me I am starting pretty late (17) should I even bother? (Please keep in mind I live and sleep wanting to program)
Nikita Tsukanov
@kekekeks
Nov 27 2015 15:00
It was quite complex (well, if you can call simple bitmap editor "complex"), so I assume that I've started a bit earlier than the time that program was written
Dude, just write code
Darnell Williams
@Seeker1437
Nov 27 2015 15:01
ha nice :)
Nikita Tsukanov
@kekekeks
Nov 27 2015 15:02
The thing is that one either has the needed qualities or doesn't, everything else is a matter of experience
Darnell Williams
@Seeker1437
Nov 27 2015 15:04
I feel like i could do a loot but i just don't know any concepts.
Darnell Williams
@Seeker1437
Nov 27 2015 15:04
I can read code I've never seen before and generalize what it's doing
Nikita Tsukanov
@kekekeks
Nov 27 2015 15:06
That's one of the most valuable skills, you know
Darnell Williams
@Seeker1437
Nov 27 2015 15:08
THis is majorly awesome :O
ALso, yeah I could imagine it being so, but then sometimes it does get limited by lack of knowledge for certain concpets
You know I started looking at MVVM stuff 2 years ago and now I am only just starting to understand it 2 montsh ago
I probably still don't understand it enough to follow everything but I am not entirely lost anymore
I shall work my way through these
Weston
@ronnyek
Nov 27 2015 15:15
mvvm is easy
its just like mvc cept you have a view model
the differing databinding across frameworks is the difficulty
and weird niche things like how do you represent dialogs and shti with mvvm
Darnell Williams
@Seeker1437
Nov 27 2015 15:16
Never understood MVC either XD
bitbonk
@bitbonk
Nov 27 2015 15:54
I really like how caliburn.micro made MVVM+XAML approachable
Weston
@ronnyek
Nov 27 2015 16:25
I only looked at caliburn briefly but didnt like what I saw
dont know why
Steven Kirk
@grokys
Nov 27 2015 16:37
are we going to postpone the remaining issues in the alpha 3 milestone until the next milestone
it's a shame but we've done a lot that we hadn't planned on doing, so not a huge disappointment
Nikita Tsukanov
@kekekeks
Nov 27 2015 16:38
It would be nice to fix that ItemContainerGenerator bug through
Steven Kirk
@grokys
Nov 27 2015 16:39
yeah i'm going to start on that but not sure i'll have time to fix it before early next week
and it's not a dealbreaker for alpha 3 imo
Nikita Tsukanov
@kekekeks
Nov 27 2015 16:39
Well, I'll be busy with designer improvements for a couple of days anyway
And it will be nice to have them in alpha3
Steven Kirk
@grokys
Nov 27 2015 16:40
ok, lets see how it goes
Nikita Tsukanov
@kekekeks
Nov 27 2015 16:41
We should probably release on Wednesday and make an annoucement on Thursday morning
Steven Kirk
@grokys
Nov 27 2015 16:41
ok, lets aim for that
though as i said, until tuesday evening i'm a bit tied up
Nikita Tsukanov
@kekekeks
Nov 27 2015 16:42
I also need to make a video with mobile support
Darnell Williams
@Seeker1437
Nov 27 2015 16:43
I will workon more unit tests
Steven Kirk
@grokys
Nov 27 2015 16:44
that would be great - you know how to view code coverage right?
also for testing, i'd really advise at least giving the trial period of ncrunch a spin
forget resharper, ncrunch is the single most valuable tool for vs ;)
Nikita Tsukanov
@kekekeks
Nov 27 2015 16:46
dotCover is nice through
Darnell Williams
@Seeker1437
Nov 27 2015 16:47
I have Resharper Ultimate Access
But ncrunch
Also I don't know how to view code coverage
reshaper 10 just added something similar to ncrunch
Steven Kirk
@grokys
Nov 27 2015 16:49
did it? that runs your unit tests in the background as you type?
Darnell Williams
@Seeker1437
Nov 27 2015 16:52
Ah not that :(
Johan Larsson
@JohanLarsson
Nov 27 2015 16:52
I think they only update when tests are changed
don't think it updates when the tested code is modified
Steven Kirk
@grokys
Nov 27 2015 16:52
or when the tested code changes
Nikita Tsukanov
@kekekeks
Nov 27 2015 16:52

did it? that runs your unit tests in the background as you type?

probably not the best idea performance-wise

Johan Larsson
@JohanLarsson
Nov 27 2015 16:52
at least I have not seen ut happen yet
Steven Kirk
@grokys
Nov 27 2015 16:52
the performance is surprisingly good
you really don't notice it, on my machine at least
Johan Larsson
@JohanLarsson
Nov 27 2015 16:53
no, no noticeable lag
Steven Kirk
@grokys
Nov 27 2015 16:53
it's intelligent about the tests it runs and only re-runs impacted tests
Johan Larsson
@JohanLarsson
Nov 27 2015 16:53
not super useful but nice
Steven Kirk
@grokys
Nov 27 2015 16:53
it's super useful
Johan Larsson
@JohanLarsson
Nov 27 2015 16:54
not in sweden :)
I had mad perf in my lib, 1000 tests in ~1 second
Added a bunch of tests for throws now so slower.
It was unreal, did I run them?
Darnell Williams
@Seeker1437
Nov 27 2015 16:55
okay because I do have this
Not sure how I could make use of it though
Steven Kirk
@grokys
Nov 27 2015 16:56
yep, that's what you need
ncrunch is still really useful alongside it though
Nikita Tsukanov
@kekekeks
Nov 27 2015 16:58
Just make sure that you aren't writing tests for unintended behavior
That's what usually happens when people aim for 100% test coverage
Johan Larsson
@JohanLarsson
Nov 27 2015 16:59
coverage is not super interesting ime
Nikita Tsukanov
@kekekeks
Nov 27 2015 16:59
Test coverage is another useless metric
Steven Kirk
@grokys
Nov 27 2015 16:59
i agree we shouldn't aim for 100% but it can show where tests are missing generally
Darnell Williams
@Seeker1437
Nov 27 2015 16:59
right but it can help with covering areas which have no tests right?
Johan Larsson
@JohanLarsson
Nov 27 2015 16:59
not completely useless but more a guide than a goal
Steven Kirk
@grokys
Nov 27 2015 16:59
exactly
Johan Larsson
@JohanLarsson
Nov 27 2015 17:00
it is nice to code with nice tests, know that tests will catch derps
and then microoptimize away
Darnell Williams
@Seeker1437
Nov 27 2015 17:03
SO then from there it's just up to me to write code that actually tests for the wanted result.
Steven Kirk
@grokys
Nov 27 2015 17:03
yeah
Darnell Williams
@Seeker1437
Nov 27 2015 17:04
For example I wrote an app for work, tiny little thing but the picture I showed you shows barely any of it is covered (no tests were written)
Johan Larsson
@JohanLarsson
Nov 27 2015 17:04
test happy path and error conditions and edge cases
Steven Kirk
@grokys
Nov 27 2015 17:04
for example, Button has a low test coverage
a good place to start might be to e.g. make sure the Click event is raised when it receives an Enter key press
or that it's raised when the Space key is pressed or released depending on the ClickMode property
Darnell Williams
@Seeker1437
Nov 27 2015 17:06
And I would do that using Platform input to make sure it works on any platform?
possibly?
Steven Kirk
@grokys
Nov 27 2015 17:06
nope, just send a keydown event directly to the control
Darnell Williams
@Seeker1437
Nov 27 2015 17:06
okay
Steven Kirk
@grokys
Nov 27 2015 17:08
at the moment Click is raised on Enter key down, but when Space is pressed, it depends on the ClickMode property
whether it's key down or key up
first check with WPF that that's correct behavior
Darnell Williams
@Seeker1437
Nov 27 2015 17:09
okay :)
Steven Kirk
@grokys
Nov 27 2015 17:09
in that case, you might want to write tests for WPF first and then port them to Perspex as our behavior should match theirs
and i think the APIs are the same
@kekekeks regarding cancelling animations, this seems to be how jquery handles it: https://api.jquery.com/stop/
If the jumpToEnd argument is provided with a value of true, the current animation stops, but the element is immediately given its target values for each CSS property
also
If more than one animation method is called on the same element, the later animations are placed in the effects queue for the element.
Nikita Tsukanov
@kekekeks
Nov 27 2015 17:13
So we need caurosel to be smarter
Steven Kirk
@grokys
Nov 27 2015 17:14
well, there are two options: cancel the animation and make it jump to its final value, or queue them
i fear that queuing them could cause the animation to lag
i.e. if you move really quickly a lot of animations could be queued
i'm not sure that animation queuing should be the default
we need to support cancelling animations so i'll try that first and see how it looks
Steven Kirk
@grokys
Nov 27 2015 17:32
ok, here's the problem: Animation is a class that wraps the animation source (e.g. the observable producing the animation values) and the property subscription to that observable
they can already be cancelled
(albeit without the jumpToEnd feature)
Nikita Tsukanov
@kekekeks
Nov 27 2015 17:33

i fear that queuing them could cause the animation to lag

Well, you can cancel any pending animations that aren't currently executing

That way there won't be any lags
Let current animation to complete and start the last one
Steven Kirk
@grokys
Nov 27 2015 17:34
yeah, true
Nikita Tsukanov
@kekekeks
Nov 27 2015 17:34
(albeit without the jumpToEnd feature)

we need some kind of animation queue manager then
Steven Kirk
@grokys
Nov 27 2015 17:34
no, that can be added easily enough
the problem is
a page transition is actually two animations that are run either concurrently (crossfade) or one after the other (slide)
we currently have no way to represent that in Perspex, so IPageTransition just returns a task
i think this will be a common enough scenario that we should think about how to represent it better
my first thought is that Animation should be able to represent either
so a single animation and an animation composed of multiple different animations can be treated the same
question is what that API should look like...
Johan Larsson
@JohanLarsson
Nov 27 2015 17:42
What do you think of something like this:
<Grid>
    <ColDefs>...</ColDefs>
    <GridRow Height="Auto>...</GridRow >
    <GridRow Height="Auto>...</GridRow >
</Grid>
a row would promote its children
would take the pain away when reordering in a grid
Steven Kirk
@grokys
Nov 27 2015 17:44
yeah, i've though about doing something like that in the past - it would be really nice
however, I'm not sure how to achieve it
Grid is a black box that nobody understands ;)
I use ^ at times
not super intuituve and allocates more than needed but nice
Just a bunch of styles
Steven Kirk
@grokys
Nov 27 2015 17:46
yeah, nested ItemsControls isn't very efficient
and how do you make the columns line up?
Johan Larsson
@JohanLarsson
Nov 27 2015 17:46
I'll try to find time for writing a gridrow prototype some time
Steven Kirk
@grokys
Nov 27 2015 17:49
we should probably rewrite Grid from scratch as nobody understands it, but it'd be a massive effort i fear
but tbh your sugestion is more like a html table so maybe it should be a Table control
Johan Larsson
@JohanLarsson
Nov 27 2015 17:50
@grokys sharedsizegroup
Nikita Tsukanov
@kekekeks
Nov 27 2015 17:50

we should probably rewrite Grid from scratch as nobody understands it, but it'd be a massive effort i fear

We need to get test coverage there first

Steven Kirk
@grokys
Nov 27 2015 17:50
true
Johan Larsson
@JohanLarsson
Nov 27 2015 17:50
Pretty sure Reed understands grid
and all things
Steven Kirk
@grokys
Nov 27 2015 17:50
and yeah @JohanLarsson - SharedSizeGroup is missing from Perspex
:(
Johan Larsson
@JohanLarsson
Nov 27 2015 17:51
the nested itemscontrol is just for the demo if you have datatemplates for two viewmodels in one propertygrid
Steven Kirk
@grokys
Nov 27 2015 18:08
hmm, the more i read about animation stuff, the more complex it becomes
i think the right thing to do for now might be just to work around the problem in carousel
Steven Kirk
@grokys
Nov 27 2015 18:58
ok, #212 should now be fixed
i just worked around it in CarouselPresenter instead of doing an overhaul of animation
there are just two alpha3 issues remaining: #201 and #204 - shall we push those back to the next release?
Nikita Tsukanov
@kekekeks
Nov 27 2015 19:01
Well, I don't think that these are must-haves
Steven Kirk
@grokys
Nov 27 2015 19:01
i agree
Nikita Tsukanov
@kekekeks
Nov 27 2015 19:02
Better get that memory leak fixed or something
Steven Kirk
@grokys
Nov 27 2015 19:02
which one?
Nikita Tsukanov
@kekekeks
Nov 27 2015 19:03
binding-related one
Steven Kirk
@grokys
Nov 27 2015 19:03
is there an issue for it?
Nikita Tsukanov
@kekekeks
Nov 27 2015 19:03
No idea, need to ask @wieslawsoltes
There were some screenshot from dotMemory that illustrates the issue
Steven Kirk
@grokys
Nov 27 2015 19:04
yeah, i remember vaguely, but i can't remember the details
#264 is the only one logged relating to memory leaks
Basically bindings subscribe to INotifyPropertyChanged and control never gets collected
If XAML binding chain is referenced somewhere in target PerspexObject, then we can use my weak event manager implementation
Steven Kirk
@grokys
Nov 27 2015 19:30
ok, i will investigate
Steven Kirk
@grokys
Nov 27 2015 19:47
so just to get it straight: if i have <TextBlock Text={Binding Foo}/> and that textbox gets removed from the window, then something retains a reference to the textbox's DataContext?
Nikita Tsukanov
@kekekeks
Nov 27 2015 19:47
Retains the reference to the TextBlock
Steven Kirk
@grokys
Nov 27 2015 19:47
ok, so it's not a binding problem per-se
Nikita Tsukanov
@kekekeks
Nov 27 2015 19:48
It is
The reference is held by the binding chain
Have you sent an application for dotMemory license?
Steven Kirk
@grokys
Nov 27 2015 19:48
so if the binding isn't there, then the TextBox gets released fine?
yeah, i have dotmemory now
i just need to get a minimal example of the problem to test with
Nikita Tsukanov
@kekekeks
Nov 27 2015 19:49

so if the binding isn't there, then the TextBox gets released fine?

Not sure what do you mean by that

Mkay, I'll try to prepare one
Steven Kirk
@grokys
Nov 27 2015 19:50
you say something retains the reference to the TextBlock in the case of <TextBlock Text={Binding Foo}/>
and the reference is held by the binding chain
so if there's no binding, then TextBox gets released ok?
Nikita Tsukanov
@kekekeks
Nov 27 2015 19:50
Yep
Steven Kirk
@grokys
Nov 27 2015 19:50
ok, strange
i did have a look a few days ago and i found one that seemed to be related to transforms
not sure if this is the same
Steven Kirk
@grokys
Nov 27 2015 19:56
we should probably add unit tests to test for this sort of thing
but they usually involve the whole system, so not sure where to put them
Steven Kirk
@grokys
Nov 27 2015 20:06
ok, confirmed that a <TextBlock Text={Binding Foo}/> is collected fine
so the problem's not there
Andrey Kunchev
@donandren
Nov 27 2015 20:07
hey guys, half hour ago I've just found a possible source of memory leaks in Selector.cs
        if (inputs.Count > 0)
        {
            return new SelectorMatch(new StyleActivator(inputs));
        }
Steven Kirk
@grokys
Nov 27 2015 20:08
oh nice! what causes the leak there?
Andrey Kunchev
@donandren
Nov 27 2015 20:08
StyleActivator is IDisposable, but Dispose() is never called
and subscriptions are always active
Steven Kirk
@grokys
Nov 27 2015 20:09
ahhh
Andrey Kunchev
@donandren
Nov 27 2015 20:09
slecting the style
is trigering a new selectormatch and style activator for every new Classes to control
e.g. every new visual state that has a style setter
but don't have any idea how i can fix that
Steven Kirk
@grokys
Nov 27 2015 20:11
hmm, ok, i need to look into that
looks like that might be the root of the problems
Andrey Kunchev
@donandren
Nov 27 2015 20:11
made some tests if have the last styleactivator instance in a private variable in the selector and dispose it, to check whether the memory leak is there
but it seems after dispose of a styleactivator there is no memory leak in my very simple test, but this is not a solution as the style are not working ok then
Nikita Tsukanov
@kekekeks
Nov 27 2015 20:19
@grokys Regarding "Direct2D1 not found"
That's because .paml is in dll
That doesn't reference Perspex.Desktop
BTW, I can't reproduce the leak, we need @wieslawsoltes here
Or you can compile his Core2D project
Steven Kirk
@grokys
Nov 27 2015 20:20
i think @donandren has given me a clue
yeah, i've tried looking in Core2D but there's so much going on it's hard to find what's leaking
Nikita Tsukanov
@kekekeks
Nov 27 2015 20:21
Well, I don't see anything style-related in that dotmemory dump
So it may be another leak
Steven Kirk
@grokys
Nov 27 2015 20:22
yeah, there's probably lots of them
d2d backend still seems to be leaking unmanaged memory to me
Nikita Tsukanov
@kekekeks
Nov 27 2015 20:24
We can use Skia, you know :smirk:
Steven Kirk
@grokys
Nov 27 2015 20:27
oh did you mention that? ;)
btw any idea why the imagine scaling with skia is jaggedy compared to d2d?
Nikita Tsukanov
@kekekeks
Nov 27 2015 20:29
No idea, haven't checked that stuff yet
That probably can be configured somehow
Probably need to set filter level or something
Steven Kirk
@grokys
Nov 27 2015 20:52
ok, i think i've found a leak related to xaml
Darnell Williams
@Seeker1437
Nov 27 2015 20:55
:O
Darnell Williams
@Seeker1437
Nov 27 2015 21:00
btw now that I am exploring all these tools I never use, what is the profiler cgood for?
RIght now it seems to be tracking the amount of time it took for functions to run
AH @grokys it basically runs a new for the following by default: On Save, Build, and Run Dirty Test
Steven Kirk
@grokys
Nov 27 2015 21:03
sorry, i don't understand
Darnell Williams
@Seeker1437
Nov 27 2015 21:03
Sorry totally a change of topic, for resharper and it's "Continuous Testing" feature
Its basically rerun the test when you save or build and only reruns "dirty" tests
by default.
nvm
Ah I misread that.
When saving or when building you have the option of detecting or builds dirty tests
Steven Kirk
@grokys
Nov 27 2015 21:07
oh ok, i've never tried it
anyway, it seems that giving a control a name in XAML causes a reference to be held
gives me something to work with
Darnell Williams
@Seeker1437
Nov 27 2015 21:10
Weird..... why would that happen?
Steven Kirk
@grokys
Nov 27 2015 21:18
it seems that controls are getting added to Window's template child namescope as well as to Window's namescope!
i need to go out now, but i think i'm close to finding this one at least
Darnell Williams
@Seeker1437
Nov 27 2015 21:19
it should just be the window correct?
Steven Kirk
@grokys
Nov 27 2015 21:19
yeah
it's definitely a bug
Darnell Williams
@Seeker1437
Nov 27 2015 21:19
hmm interesting
Now how are you following it
FOr some reason for me with more complicated (and possibly multithreaded operations) I lose my step power half way through :9
What is our testing framework I just noticed it wasn't a normal VS Unit test thing
Nikita Tsukanov
@kekekeks
Nov 27 2015 21:21
xUnit
Steven Kirk
@grokys
Nov 27 2015 21:21
xunit
Nikita Tsukanov
@kekekeks
Nov 27 2015 21:21
Should be supported by Test Explorer out of the box
it's searching the visual tree when it should be searching the logical tree
Darnell Williams
@Seeker1437
Nov 27 2015 21:22
hehe
Steven Kirk
@grokys
Nov 27 2015 21:22
but the logical tree isn't available at that point
hmm, need to think about this
anyway, night all! i'm off out
Darnell Williams
@Seeker1437
Nov 27 2015 21:22
night!
this is my last full day alone at home
vegged out on video games and programming :D
Darnell Williams
@Seeker1437
Nov 27 2015 21:31
eh okay
Nikita Tsukanov
@kekekeks
Nov 27 2015 21:43
@grokys Why some attached properties don't have static setters?
Steven Kirk
@grokys
Nov 27 2015 21:45
Probably because I forgot!
Which ones?
It has a regular property accessor
While being registered as attached
Not sure how I should handle this
Since now I'm loading metadata using some kind of reflection-only context that doesn't allow me to run static constructor
I think we need to somehow move to attributes for property registrations
Steven Kirk
@grokys
Nov 27 2015 21:51
There's a registry for perspex properties
Nikita Tsukanov
@kekekeks
Nov 27 2015 21:52
Which is built by static constructors
Which I can't use from reflection-only context
Steven Kirk
@grokys
Nov 27 2015 21:52
Hmm, ok. Don't understand why...
But I'm in a bar now...
Nikita Tsukanov
@kekekeks
Nov 27 2015 21:53
Because loading in reflection-only context doesn't involve JITing MSIL
You can even load mixed-mode assemlies built for another architecture
Steven Kirk
@grokys
Nov 27 2015 21:53
It's done like that from wpf however so must be possible
Nikita Tsukanov
@kekekeks
Nov 27 2015 21:53
They may use naming convention approach
with SetMySuperDuperProperty
Steven Kirk
@grokys
Nov 27 2015 22:17
Maybe attached property fields could use a different type?
Nikita Tsukanov
@kekekeks
Nov 27 2015 22:17
Yep, this will do
Nikita Tsukanov
@kekekeks
Nov 27 2015 23:36
blob
blob
Nikita Tsukanov
@kekekeks
Nov 27 2015 23:44
blob
blob
blob
Nikita Tsukanov
@kekekeks
Nov 27 2015 23:53
blob
clr-namespace and attached property support
@wieslawsoltes @ImaBrokeDude @grokys Please test it with some xaml you have