roslynpad / roslynpad

A cross-platform C# editor based on Roslyn and AvalonEdit
https://roslynpad.net
MIT License
2.48k stars 344 forks source link

Crash after entering the first character #472

Open b0wter opened 1 year ago

b0wter commented 1 year ago

I am running Fedora and installed dotnet core using the official repository. I downloaded the source code of roslynpad since dotnet core is installed in a location currently unknown to the app. I can compile the app successfully and it starts but after entering the first character in the main text box the app crashes with the following stack trace:

Unhandled exception. System.MethodAccessException: Attempt by method 'AvaloniaEdit.CodeCompletion.CompletionWindowBase+InputHandler.OnPreviewKeyUp(Avalonia.Input.KeyEventArgs)' to access method 'Avalonia.Input.KeyEventArgs..ctor()' failed.
   at AvaloniaEdit.CodeCompletion.CompletionWindowBase.InputHandler.OnPreviewKeyUp(KeyEventArgs e)
   at AvaloniaEdit.Editing.TextArea.OnPreviewKeyUp(Object sender, KeyEventArgs e)
   at Avalonia.Interactivity.EventRoute.RaiseEventImpl(RoutedEventArgs e) in /_/src/Avalonia.Base/Interactivity/EventRoute.cs:line 118
   at Avalonia.Interactivity.EventRoute.RaiseEvent(IInteractive source, RoutedEventArgs e) in /_/src/Avalonia.Base/Interactivity/EventRoute.cs:line 79
   at Avalonia.Interactivity.Interactive.RaiseEvent(RoutedEventArgs e) in /_/src/Avalonia.Base/Interactivity/Interactive.cs:line 126
   at Avalonia.Input.KeyboardDevice.ProcessRawEvent(RawInputEventArgs e) in /_/src/Avalonia.Base/Input/KeyboardDevice.cs:line 228
   at Avalonia.Input.InputManager.ProcessInput(RawInputEventArgs e) in /_/src/Avalonia.Base/Input/InputManager.cs:line 37
   at Avalonia.RawEventGrouper.DispatchFromQueue() in /_/src/Shared/RawEventGrouping.cs:line 59
   at Avalonia.Threading.JobRunner.RunJobs(Nullable`1 priority) in /_/src/Avalonia.Base/Threading/JobRunner.cs:line 38
   at Avalonia.X11.X11PlatformThreading.HandleX11(CancellationToken cancellationToken) in /_/src/Avalonia.X11/X11PlatformThreading.cs:line 199
   at Avalonia.X11.X11PlatformThreading.RunLoop(CancellationToken cancellationToken) in /_/src/Avalonia.X11/X11PlatformThreading.cs:line 245
   at Avalonia.Threading.Dispatcher.MainLoop(CancellationToken cancellationToken) in /_/src/Avalonia.Base/Threading/Dispatcher.cs:line 61
   at Avalonia.Controls.ApplicationLifetimes.ClassicDesktopStyleApplicationLifetime.Start(String[] args) in /_/src/Avalonia.Controls/ApplicationLifetimes/ClassicDesktopStyleApplicationLifetime.cs:line 120
   at Avalonia.ClassicDesktopStyleApplicationLifetimeExtensions.StartWithClassicDesktopLifetime[T](T builder, String[] args, ShutdownMode shutdownMode) in /_/src/Avalonia.Controls/ApplicationLifetimes/ClassicDesktopStyleApplicationLifetime.cs:line 209
   at RoslynPad.Program.Main(String[] args) in /home/b0wter/work/roslynpad/src/RoslynPad.Avalonia/Program.cs:line 13

Other app features (like adding nugets) work fine.

Version

aelij commented 12 months ago

Can you please try with the latest version?

b0wter commented 12 months ago

I've cloned the latest version ( 67481b87017ee6b7b125f93f0a499c0b8d72937a). Running the app makes it briefly visible and results in a crash:

.../RoslynPad.Avalonia on  main 
❯ dotnet run                                                                                      21:57:18
Unhandled exception. System.InvalidOperationException: Operation is not valid due to the current state of the object.
   at RoslynPad.UI.OpenDocumentViewModel.set_Platform(ExecutionPlatform value) in /home/b0wter/work/roslynpad2/src/RoslynPad.Common.UI/ViewModels/OpenDocumentViewModel.cs:line 451
   at RoslynPad.UI.OpenDocumentViewModel.Initialize(DocumentId documentId, Action`1 onError, Func`1 getSelection, IDisposable viewDisposable) in /home/b0wter/work/roslynpad2/src/RoslynPad.Common.UI/ViewModels/OpenDocumentViewModel.cs:line 613
   at RoslynPad.DocumentView.OnDataContextChanged(Object sender, EventArgs args) in /home/b0wter/work/roslynpad2/src/RoslynPad.Avalonia/DocumentView.axaml.cs:line 59
   at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_0(Object state)
   at Avalonia.Threading.SendOrPostCallbackDispatcherOperation.InvokeCore()
   at Avalonia.Threading.DispatcherOperation.Execute()
   at Avalonia.Threading.Dispatcher.ExecuteJob(DispatcherOperation job)
   at Avalonia.Threading.Dispatcher.ExecuteJobsCore(Boolean fromExplicitBackgroundProcessingCallback)
   at Avalonia.Threading.Dispatcher.Signaled()
   at Avalonia.X11.X11PlatformThreading.CheckSignaled()
   at Avalonia.X11.X11PlatformThreading.RunLoop(CancellationToken cancellationToken)
   at Avalonia.Threading.DispatcherFrame.Run(IControlledDispatcherImpl impl)
   at Avalonia.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
   at Avalonia.Threading.Dispatcher.MainLoop(CancellationToken cancellationToken)
   at Avalonia.Controls.ApplicationLifetimes.ClassicDesktopStyleApplicationLifetime.Start(String[] args)
   at Avalonia.ClassicDesktopStyleApplicationLifetimeExtensions.StartWithClassicDesktopLifetime(AppBuilder builder, String[] args, ShutdownMode shutdownMode)
   at RoslynPad.Program.Main(String[] args) in /home/b0wter/work/roslynpad2/src/RoslynPad.Avalonia/Program.cs:line 13

I've opened the Avalonia-Solution in Rider and tried running Roslynpad.Avalonia to get more details and got this:

image