These are chat archives for AvaloniaUI/Avalonia

14th
Apr 2018
Jumar Macato
@jmacato
Apr 14 2018 00:32
@wieslawsoltes awesome!!
for rd.xml, i hope there is some kind of reflection hooks that can log all the types accessed by the app at runtime on a CoreCLR build
Wiesław Šoltés
@wieslawsoltes
Apr 14 2018 11:39
@jmacato @danwalmsley I managed to publish my app in release mode with Direct2D1 support :smile: But when I run it I'm getting error.
PS C:\DOWNLOADS\GitHub\Draw2D> .\src\Core2D.Avalonia\bin\win-x64-release\Core2D.Avalonia.exe --d2d
HRESULT: [0x800401F0], Module: [Unknown], ApiCode: [Unknown/Unknown], Message: Funkcja CoInitialize nie została wywołana.

   at SharpDX.Result.CheckError() + 0x2e
   at SharpDX.Utilities.CreateComInstance(Guid, Utilities.CLSCTX, Guid, ComObject) + 0x3c
   at SharpDX.WIC.ImagingFactory..ctor() + 0x81
   at Avalonia.Direct2D1.Direct2D1Platform.InitializeDirect2D() + 0x7b
   at Avalonia.Direct2D1.Direct2D1Platform.Initialize() + 0xa
   at Avalonia.Controls.AppBuilderBase`1.Setup() + 0xc1
   at Core2D.Avalonia!<BaseAddress>+0x9a46f4
   at Core2D.Avalonia.Program.Main(String[]) + 0x1b0
Jumar Macato
@jmacato
Apr 14 2018 11:43
yeah i also got that SharpDX error, forgot to report that to coreRT team
@wieslawsoltes have you placed an <IlcArg Include="--stacktracedata" /> to the native props?
Wiesław Šoltés
@wieslawsoltes
Apr 14 2018 11:45
Yes
Jumar Macato
@jmacato
Apr 14 2018 11:45
alright
Jumar Macato
@jmacato
Apr 14 2018 11:46
okay :thumbsup:
@wieslawsoltes do you still have your benchmark test .json for core2D? the one you used on Avalon+Direct2D vs WPF comparison vid?
Wiesław Šoltés
@wieslawsoltes
Apr 14 2018 11:54
I think I have, but I changed types :fire:
Will try manually fix, but no promises
Jumar Macato
@jmacato
Apr 14 2018 11:55
thanks! i'll use it when i get back next week on my CoreRT stuff :)
Wiesław Šoltés
@wieslawsoltes
Apr 14 2018 11:56
ok
I really hope the SharpDX issue can be fixed soon :smile:
Jumar Macato
@jmacato
Apr 14 2018 11:57
me too :D
juepiezhongren
@juepiezhongren
Apr 14 2018 12:00
is it possible to use avalonia in a xamarin.ios or xamarin.android project?
Wiesław Šoltés
@wieslawsoltes
Apr 14 2018 12:06
@jmacato
Jumar Macato
@jmacato
Apr 14 2018 12:07
wow that was quick haha thank you so much @wieslawsoltes !
Wiesław Šoltés
@wieslawsoltes
Apr 14 2018 12:07
Just quick find and replace in notepad
The project format is json :smile:
Jumar Macato
@jmacato
Apr 14 2018 12:08
alright, i'll try this next week :D
Wiesław Šoltés
@wieslawsoltes
Apr 14 2018 12:08
I did not try CoreRT with https://github.com/wieslawsoltes/Core2D
There are many more dependencies than for Draw2D https://github.com/wieslawsoltes/Core2D/tree/master/src
:fire:
Jumar Macato
@jmacato
Apr 14 2018 12:09
oh.. so Draw2D can't load this lines project?
Wiesław Šoltés
@wieslawsoltes
Apr 14 2018 12:10
No
Jumar Macato
@jmacato
Apr 14 2018 12:10
i see :/ i'll try something else, maybe shaving off some stuff in Core2D to make it run in linux+coreRT
Wiesław Šoltés
@wieslawsoltes
Apr 14 2018 12:10
But should not be that difficult make Core2D work with CoreRT
It has same project
structure
Jumar Macato
@jmacato
Apr 14 2018 12:11
alright i'll see what i can do
Jumar Macato
@jmacato
Apr 14 2018 12:14
but Avalonia+D2D runs on release mode, doesn't it?
Wiesław Šoltés
@wieslawsoltes
Apr 14 2018 12:14
No
It publishes successfully to single executable in release, but throws exception when it runs
Jumar Macato
@jmacato
Apr 14 2018 12:15
oh, it says something about 'canGetCookieForPInvokeCalliSig' that is not implemented
in corert
perhaps
Wiesław Šoltés
@wieslawsoltes
Apr 14 2018 12:15
Well
Now debug mode has this issue
:fire:
See my comment in corert gitter
looks like it is indeed unimplemented part of the JIT
Wiesław Šoltés
@wieslawsoltes
Apr 14 2018 12:18
But why it works in release mode?
Jumar Macato
@jmacato
Apr 14 2018 12:18
it might be just suppressed when you do Release builds
Wiesław Šoltés
@wieslawsoltes
Apr 14 2018 12:18
ok
Jumar Macato
@jmacato
Apr 14 2018 12:19
it'll be more confusing when the app runs without hitch on release and throws that error if it's on debug haha
:)
but yeah, let's wait for the corert people to look at it :)
Wiesław Šoltés
@wieslawsoltes
Apr 14 2018 12:20
yep
juepiezhongren
@juepiezhongren
Apr 14 2018 12:24
could ava run in mono runtime?
Wiesław Šoltés
@wieslawsoltes
Apr 14 2018 12:25
@jmacato Publishing Core2D...
Jumar Macato
@jmacato
Apr 14 2018 12:25
@juepiezhongren it can (tried running the MVVM example app on monodevelop once) but .NET core is better supported by Avalonia
@wieslawsoltes alright
juepiezhongren
@juepiezhongren
Apr 14 2018 12:26
i suggest
msrf
Wiesław Šoltés
@wieslawsoltes
Apr 14 2018 12:26
@jmacato I have Roslyn dependency for C# scripting, will see if it publishes :fire:
Jumar Macato
@jmacato
Apr 14 2018 12:27
@wieslawsoltes wow, never knew you had that in there haha :D sorry i haven't done a thorough dive-in to Core2D yet
juepiezhongren
@juepiezhongren
Apr 14 2018 12:27
i suggest mstf purchase ava team, make it part of xamarin
dart make flutter a nasty option
Wiesław Šoltés
@wieslawsoltes
Apr 14 2018 12:38
Operation is not supported on this platform.
   at System.Reflection.Runtime.Assemblies.RuntimeAssembly.get_CodeBase() + 0x1c
   at Core2D.FileSystem.DotNet.DotNetFileSystem.Core2D.Interfaces.IFileSystem.GetAssemblyPath(Type) + 0x46
   at Core2D.Avalonia.App.Start(IServiceProvider, AboutInfo) + 0x7b
   at Core2D.Avalonia.Program.Main(String[]) + 0x12b
@jmacato CoreRT issue
Jumar Macato
@jmacato
Apr 14 2018 12:39
damn :/
release build or debug?
Wiesław Šoltés
@wieslawsoltes
Apr 14 2018 12:39
Release
Jumar Macato
@jmacato
Apr 14 2018 12:40
i see...
Wiesław Šoltés
@wieslawsoltes
Apr 14 2018 12:40
My exe is 73,4 MB
I included too much :fire:
Jumar Macato
@jmacato
Apr 14 2018 12:41
can the roslyn dependency be dropped?
Wiesław Šoltés
@wieslawsoltes
Apr 14 2018 12:41
Its not roslyn issue
It can be dropped for testing purposes
danwalmsley
@danwalmsley
Apr 14 2018 12:42
@grokys iv been trying to figure out AvaloniaUI/Avalonia#1440 perhaps you remember we talked about it a while back.
Jumar Macato
@jmacato
Apr 14 2018 12:42
@wieslawsoltes hmm alright, but if i recall correctly, assembly.load is not working in CoreRT?
danwalmsley
@danwalmsley
Apr 14 2018 12:42
I don't know if you might get chance to have a quick look soon?
Wiesław Šoltés
@wieslawsoltes
Apr 14 2018 12:45
@jmacato I am using Autofac and all dependencies are loaded that way.
So I can remove and change everything easily.
:worried:
Core2D.Avalonia Error: 0 : Method '[Avalonia.Win32]Avalonia.Win32.Interop.UnmanagedMethods.GetMonitorInfo(native int,MONITORINFO)' requires non-trivial marshalling that is not yet supported by this compiler.
   at Avalonia.Win32.Interop.UnmanagedMethods.GetMonitorInfo(IntPtr, UnmanagedMethods.MONITORINFO) + 0x23
   at Avalonia.Win32.WindowImpl.MaximizeWithoutCoveringTaskbar() + 0x47
   at Avalonia.Win32.WindowImpl.ShowWindow(WindowState) + 0x56
   at Avalonia.Controls.Window.Show() + 0xea
   at Core2D.Avalonia.App.Start(IServiceProvider, AboutInfo) + 0x376
Jumar Macato
@jmacato
Apr 14 2018 12:48
hmm i'm totally not sure if Assembly.Load works, or was it Reflection.Emit that doesnt..
Steven Kirk
@grokys
Apr 14 2018 12:49
@danwalmsley i started it, but i've not had time to finish it yet
all my time recently is spent reviewing PRs
which is good ;)
Jumar Macato
@jmacato
Apr 14 2018 12:50
@wieslawsoltes thats unfortunate :/
i think we should file an issue to CoreRT to track every errors that we get
on avalonia
Steven Kirk
@grokys
Apr 14 2018 12:55
@danwalmsley basically I decided to copy WPF's DirectionalNavigation framework
which handles the navigation automatically
except it sucks
even in WPF it doesn't work very well it seems
Wiesław Šoltés
@wieslawsoltes
Apr 14 2018 12:56
@jmacato Managed to publish
But got blank window, I think there is issue with Autofac
Steven Kirk
@grokys
Apr 14 2018 12:56
so i think I need to remove that and just make controls handle their own directional navigation
which will probably be simpler anyway
Wiesław Šoltés
@wieslawsoltes
Apr 14 2018 13:04
@jmacato That is what I managed to get so far: https://github.com/wieslawsoltes/Core2D/tree/corert
Jumar Macato
@jmacato
Apr 14 2018 13:05
@wieslawsoltes alright, i'll take a look later :thumbsup:
Wiesław Šoltés
@wieslawsoltes
Apr 14 2018 13:06
I suspect component registration issues with Autofac
or not
Debugging issues with CoreRT is hard :worried:
Wiesław Šoltés
@wieslawsoltes
Apr 14 2018 13:11
@jmacato Trying last thing, than I have to go
Jumar Macato
@jmacato
Apr 14 2018 13:12
@wieslawsoltes alright
indeed it is hard coz they strip more debugging info than what we're accustomed to
Wiesław Šoltés
@wieslawsoltes
Apr 14 2018 13:12
Core2D.Avalonia Error: 0 : An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = MainWindow (ReflectionActivator), Services = [Core2D.Avalonia.Windows.MainWindow], Lifetime = Autofac.Core.Lifetime.CurrentScopeLifetime, Sharing = Shared, Ownership = OwnedByLifetimeScope ---> An exception was thrown while invoking the constructor 'Void .ctor()' on type 'MainWindow'. ---> Exception has been thrown by the target of an invocation. (See inner exception for details.) (See inner exception for details.)
   at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1) + 0x181
   at Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid, Func`1) + 0x81
   at Autofac.Core.Resolving.InstanceLookup.Execute() + 0x87
   at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope, IComponentRegistration, IEnumerable`1) + 0xb0
   at Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration, IEnumerable`1) + 0x5a
   at Autofac.ResolutionExtensions.TryResolveService(IComponentContext, Service, IEnumerable`1, Object&) + 0x79
   at Autofac.ResolutionExtensions.ResolveService(IComponentContext, Service, IEnumerable`1) + 0x41
   at Core2D.Avalonia!<BaseAddress>+0x11faa73
   at Core2D.Avalonia.App.Start(IServiceProvider, AboutInfo) + 0x324

Core2D.Avalonia Error: 0 : An exception was thrown while invoking the constructor 'Void .ctor()' on type 'MainWindow'. ---> Exception has been thrown by the target of an invocation. (See inner exception for details.)
   at Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate() + 0x22c
   at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext, IEnumerable`1) + 0x50
   at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1) + 0x69
Jumar Macato
@jmacato
Apr 14 2018 13:14
def. autofac and corert's reflection are not going together well
Wiesław Šoltés
@wieslawsoltes
Apr 14 2018 13:16
Lots of things are going here, my app has some not trivial stuff to deal with CoreRT :fire:
Wiesław Šoltés
@wieslawsoltes
Apr 14 2018 13:21
@jmacato That is dead end for now. Will try later next week.
Jumar Macato
@jmacato
Apr 14 2018 13:22
@wieslawsoltes alright, hopefully i can work on it too next week
see ya!
Bruno Marques
@BMarques
Apr 14 2018 21:24
hello. Is it possible make SharpDx render stuff in Avalonia much like D3DImage for WPF ? I saw the d3d interop sample, but that's not the same I think.
Steven Kirk
@grokys
Apr 14 2018 21:28
@BMarques what do you mean "much like D3DImage for WPF"?
Steven Kirk
@grokys
Apr 14 2018 21:32
right, but what in the D3D interop sample isn't enough like D3DImage?
Bruno Marques
@BMarques
Apr 14 2018 21:32
perhaps I'm assuming it's not doing it already, but i'm struggling to implement a render loop by looking at the sample :)
Bruno Marques
@BMarques
Apr 14 2018 21:37
the sample provided for the d3d interop sample is waiting for an input to go to the handle paint
where as I want to use it in a game render loop
Steven Kirk
@grokys
Apr 14 2018 22:05
ah ok. hmm i think you'd need to speak to @kekekeks about that
Bruno Marques
@BMarques
Apr 14 2018 22:12
thanks :)
Steven Kirk
@grokys
Apr 14 2018 22:13
yeah, sorry. i tried ;)
Bruno Marques
@BMarques
Apr 14 2018 22:19
no worries eheh
could be useful to us
Bruno Marques
@BMarques
Apr 14 2018 22:57
I think something I think it works, but feels like a bad hack
AvaloniaLocator.Current.GetService<IRenderLoop>().Tick += OnTick; // Added on MainWindow

private void OnTick(object sender, EventArgs e)
        {
            if (hasHandledPaintAlready)
            {
                hasHandledPaintAlready = false;

                // Process input
                // Update objects

                Renderer.AddDirty(this);
            }
        }