Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MissingMethodException is thrown #94

Open
mrn-aglic opened this issue Jan 24, 2020 · 1 comment
Open

MissingMethodException is thrown #94

mrn-aglic opened this issue Jan 24, 2020 · 1 comment

Comments

@mrn-aglic
Copy link

mrn-aglic commented Jan 24, 2020

I tried to add AvaloniaEdit nuget into a project. Using Avalonia.Desktop 0.9.2
Project template is created from the mvvm template provided by avalonia.

However, the project fails to run with the following exception:
Unhandled exception. System.TypeInitializationException: The type initializer for 'AvaloniaEdit.Editing.TextArea' threw an exception.

Here is the entire stack trace:

Unhandled exception. System.TypeInitializationException: The type initializer for 'AvaloniaEdit.Editing.TextArea' threw an exception.
 ---> System.TypeInitializationException: The type initializer for 'AvaloniaEdit.Rendering.TextView' threw an exception.
 ---> System.MissingMethodException: Method not found: 'Void Avalonia.Media.Pen..ctor(Avalonia.Media.IBrush, Double, Avalonia.Media.DashStyle, Avalonia.Media.PenLineCap, Avalonia.Media.PenLineCap, Avalonia.Media.PenLineCap, Avalonia.Media.PenLineJoin, Double)'.
   at AvaloniaEdit.Rendering.TextView.CreateFrozenPen(IBrush brush)
   at AvaloniaEdit.Rendering.TextView..cctor()
   --- End of inner exception stack trace ---
   at AvaloniaEdit.Editing.TextArea..cctor()
   --- End of inner exception stack trace ---
   at Builder_cc0eb0a092b34ebca0de3b4a0e5e8c03_resm:AvaloniaEdit.Editing.TextArea.xaml?assembly=AvaloniaEdit.__AvaloniaXamlIlPopulate(IServiceProvider , Styles )
   at lambda_method(Closure , IServiceProvider )
   at Avalonia.Markup.Xaml.XamlIl.AvaloniaXamlIlRuntimeCompiler.LoadOrPopulate(Type created, Object rootInstance)
   at Avalonia.Markup.Xaml.XamlIl.AvaloniaXamlIlRuntimeCompiler.LoadSreCore(String xaml, Assembly localAssembly, Object rootInstance, Uri uri, Boolean isDesignMode)
   at Avalonia.Markup.Xaml.XamlIl.AvaloniaXamlIlRuntimeCompiler.LoadSre(String xaml, Assembly localAssembly, Object rootInstance, Uri uri, Boolean isDesignMode)
   at Avalonia.Markup.Xaml.XamlIl.AvaloniaXamlIlRuntimeCompiler.Load(Stream stream, Assembly localAssembly, Object rootInstance, Uri uri, Boolean isDesignMode)
   at Avalonia.Markup.Xaml.AvaloniaXamlLoader.Load(Stream stream, Assembly localAssembly, Object rootInstance, Uri uri)
   at Avalonia.Markup.Xaml.AvaloniaXamlLoader.Load(Uri uri, Uri baseUri)
   at Avalonia.Markup.Xaml.Styling.StyleInclude.get_Loaded()
   at Avalonia.Markup.Xaml.Styling.StyleInclude.Avalonia.Controls.ISetResourceParent.ParentResourcesChanged(ResourcesChangedEventArgs e)
   at Avalonia.Styling.Styles.<.ctor>b__4_0(IStyle x)
   at Avalonia.Collections.AvaloniaListExtensions.<>c__DisplayClass0_0`1.<ForEachItem>b__0(Int32 _, T i)
   at Avalonia.Collections.AvaloniaListExtensions.<>c__DisplayClass1_0`1.<ForEachItem>g__Add|0(Int32 index, IList items)
   at Avalonia.Collections.AvaloniaListExtensions.<>c__DisplayClass1_0`1.<ForEachItem>b__2(Object _, NotifyCollectionChangedEventArgs e)
   at Avalonia.Collections.AvaloniaList`1.NotifyAdd(T item, Int32 index)
   at Avalonia.Collections.AvaloniaList`1.Add(T item)
   at Builder_f5ecc677d06342bca01968013cf8ba82_resm:AvaloniaEdit.AvaloniaEdit.xaml?assembly=AvaloniaEdit.__AvaloniaXamlIlPopulate(IServiceProvider , Styles )
   at lambda_method(Closure , IServiceProvider )
   at Avalonia.Markup.Xaml.XamlIl.AvaloniaXamlIlRuntimeCompiler.LoadOrPopulate(Type created, Object rootInstance)
   at Avalonia.Markup.Xaml.XamlIl.AvaloniaXamlIlRuntimeCompiler.LoadSreCore(String xaml, Assembly localAssembly, Object rootInstance, Uri uri, Boolean isDesignMode)
   at Avalonia.Markup.Xaml.XamlIl.AvaloniaXamlIlRuntimeCompiler.LoadSre(String xaml, Assembly localAssembly, Object rootInstance, Uri uri, Boolean isDesignMode)
   at Avalonia.Markup.Xaml.XamlIl.AvaloniaXamlIlRuntimeCompiler.Load(Stream stream, Assembly localAssembly, Object rootInstance, Uri uri, Boolean isDesignMode)
   at Avalonia.Markup.Xaml.AvaloniaXamlLoader.Load(Stream stream, Assembly localAssembly, Object rootInstance, Uri uri)
   at Avalonia.Markup.Xaml.AvaloniaXamlLoader.Load(Uri uri, Uri baseUri)
   at Avalonia.Markup.Xaml.Styling.StyleInclude.get_Loaded()
   at Avalonia.Markup.Xaml.Styling.StyleInclude.Avalonia.Controls.ISetResourceParent.ParentResourcesChanged(ResourcesChangedEventArgs e)
   at Avalonia.Styling.Styles.<.ctor>b__4_0(IStyle x)
   at Avalonia.Collections.AvaloniaListExtensions.<>c__DisplayClass0_0`1.<ForEachItem>b__0(Int32 _, T i)
   at Avalonia.Collections.AvaloniaListExtensions.<>c__DisplayClass1_0`1.<ForEachItem>g__Add|0(Int32 index, IList items)
   at Avalonia.Collections.AvaloniaListExtensions.<>c__DisplayClass1_0`1.<ForEachItem>b__2(Object _, NotifyCollectionChangedEventArgs e)
   at Avalonia.Collections.AvaloniaList`1.NotifyAdd(T item, Int32 index)
   at Avalonia.Collections.AvaloniaList`1.Add(T item)
   at Avalonia.Styling.Styles.Add(IStyle item)
   at SharpVisUI.App.!XamlIlPopulate(IServiceProvider , App ) in /Users/Marin/Rider/SharpVisUI/SharpVisUI/App.xaml:line 1
   at SharpVisUI.App.!XamlIlPopulateTrampoline(App )
   at SharpVisUI.App.Initialize() in /Users/Marin/Rider/SharpVisUI/SharpVisUI/App.xaml.cs:line 13
   at Avalonia.Controls.AppBuilderBase`1.Setup()
   at Avalonia.Controls.AppBuilderBase`1.SetupWithLifetime(IApplicationLifetime lifetime)
   at Avalonia.ClassicDesktopStyleApplicationLifetimeExtensions.StartWithClassicDesktopLifetime[T](T builder, String[] args, ShutdownMode shutdownMode)
   at SharpVisUI.Program.Main(String[] args) in /Users/Marin/Rider/SharpVisUI/SharpVisUI/Program.cs:line 14

I know the demo in this repo is working, but I haven't the slightest clue of what I'm missing to make it work.

With further investigation, I noticed that the nuget version uses a constructor for Pen that doesn't exist anymore:

private static Pen CreateFrozenPen(IBrush brush)
    {
      return new Pen(brush, 1.0, (DashStyle) null, PenLineCap.Flat, PenLineCap.Flat, PenLineCap.Flat, PenLineJoin.Miter, 10.0);
    }

The github code of AvaloniaEdit:

private static Pen CreateFrozenPen(IBrush brush)
        {
            var pen = new Pen(brush);
            return pen;
        }
@rmboggs
Copy link

rmboggs commented Jun 20, 2020

I just ran into the same exact issue. Any idea when 0.10 (assuming it is fixed in this version) can be distributed to nuget?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants