Skip to content

部分情况下 I18N MarkupExtension 会导致 FieldAccessException #29

Description

@Misaka-L

Source

https://github.com/project-vrcz/content-publisher/blob/7db9c6eac8573f7b13080988acc0c1d84f1b02f4/src/App/VRChatContentPublisher.App/Views/Data/UpdateDownloadProgressView.axaml#L100

暂时拿不出来最小可复现,其他部分的相同用法又能正常使用

相同的代码直接使用 Submodule 引入则无事发生,使用 nuget 包版本后才有问题:https://github.com/project-vrcz/content-publisher/blob/519d37545c1f3ca3abc005773a5cc167707cc69c/src/App/VRChatContentPublisher.App/Views/Data/UpdateDownloadProgressView.axaml#L100

Full Exception

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.FieldAccessException: Attempt by method 'VRChatContentPublisher.App.Views.Data.UpdateDownloadProgressView.!XamlIlPopulate(System.IServiceProvider, VRChatContentPublisher.App.Views.Data.UpdateDownloadProgressView)' to access field 'Antelcat.I18N.Avalonia.I18NExtension.KeyProperty' failed.
   at VRChatContentPublisher.App.Views.Data.UpdateDownloadProgressView.!XamlIlPopulate(IServiceProvider, UpdateDownloadProgressView) in C:\Data\Project\VRChat\ContentManager\VRChatContentManager\src\App\VRChatContentPublisher.App\Views/Data/UpdateDownloadProgressView.axaml:line 100
   at HotAvalonia.AvaloniaControlManager.OnPopulate(Action`2 populate, IServiceProvider provider, Object control) in /_/src/HotAvalonia.Core/AvaloniaControlManager.cs:line 116
   at HotAvalonia.AvaloniaControlManager.<>c__DisplayClass4_0.<.ctor>b__0(IServiceProvider s, Object c) in /_/src/HotAvalonia.Core/AvaloniaControlManager.cs:line 51
   at HotAvalonia.Xaml.<CompiledXamlDocument>F70C1C3C83594D7BB6430787C7004AD87B3636D13167F946BB9C5AB1C163998AC__OverridePopulateInjection.<>c__DisplayClass3_0.<.ctor>b__0(Object control) in /_/src/HotAvalonia.Core/Xaml/CompiledXamlDocument.cs:line 358
   at VRChatContentPublisher.App.Views.Data.UpdateDownloadProgressView.!XamlIlPopulateTrampoline(UpdateDownloadProgressView)
   at VRChatContentPublisher.App.Views.Data.UpdateDownloadProgressView.InitializeComponent(Boolean loadXaml) in C:\Data\Project\VRChat\ContentManager\VRChatContentManager\src\App\VRChatContentPublisher.App\obj\Debug\net10.0-windows10.0.17763.0\Avalonia.Generators\Avalonia.Generators.NameGenerator.AvaloniaNameIncrementalGenerator\VRChatContentPublisher.App.Views.Data.UpdateDownloadProgressView.g.cs:line 24
   at VRChatContentPublisher.App.Views.Data.UpdateDownloadProgressView..ctor() in C:\Data\Project\VRChat\ContentManager\VRChatContentManager\src\App\VRChatContentPublisher.App\Views\Data\UpdateDownloadProgressView.axaml.cs:line 9
   at System.RuntimeType.CreateInstanceOfT()
   --- End of inner exception stack trace ---
   at System.RuntimeType.CreateInstanceOfT()
   at System.Activator.CreateInstance[T]()
   at VRChatContentPublisher.App.ViewLocator.<>c__3`2.<Register>b__3_0() in C:\Data\Project\VRChat\ContentManager\VRChatContentManager\src\App\VRChatContentPublisher.App\ViewLocator.cs:line 15
   at VRChatContentPublisher.App.ViewLocator.Build(Object param) in C:\Data\Project\VRChat\ContentManager\VRChatContentManager\src\App\VRChatContentPublisher.App\ViewLocator.cs:line 38
   at Avalonia.Controls.Presenters.ContentPresenter.CreateChild(Object content, Control oldChild, IDataTemplate template)
   at Avalonia.Controls.Presenters.ContentPresenter.UpdateChild(Object content)
   at Avalonia.Controls.Presenters.ContentPresenter.UpdateChild()
   at Avalonia.Controls.Presenters.ContentPresenter.ApplyTemplate()
   at Avalonia.Layout.Layoutable.MeasureCore(Size availableSize)
   at Avalonia.Layout.Layoutable.Measure(Size availableSize)
   at Avalonia.Layout.Layoutable.MeasureOverride(Size availableSize)
   at Avalonia.Layout.Layoutable.MeasureCore(Size availableSize)
   at Avalonia.Layout.Layoutable.Measure(Size availableSize)
   at Avalonia.Layout.LayoutHelper.MeasureChild(Layoutable control, Size availableSize, Thickness padding, Thickness borderThickness)
   at Avalonia.Controls.Presenters.ContentPresenter.MeasureOverride(Size availableSize)
   at Avalonia.Layout.Layoutable.MeasureCore(Size availableSize)
   at Avalonia.Layout.Layoutable.Measure(Size availableSize)
   at Avalonia.Layout.LayoutHelper.MeasureChild(Layoutable control, Size availableSize, Thickness padding, Thickness borderThickness)
   at Avalonia.Controls.Border.MeasureOverride(Size availableSize)
   at Avalonia.Layout.Layoutable.MeasureCore(Size availableSize)
   at Avalonia.Layout.Layoutable.Measure(Size availableSize)
   at Avalonia.Layout.LayoutHelper.MeasureChild(Layoutable control, Size availableSize, Thickness padding, Thickness borderThickness)
   at Avalonia.Controls.Border.MeasureOverride(Size availableSize)
   at Avalonia.Layout.Layoutable.MeasureCore(Size availableSize)
   at Avalonia.Layout.Layoutable.Measure(Size availableSize)
   at Avalonia.Layout.Layoutable.MeasureOverride(Size availableSize)
   at Avalonia.Layout.Layoutable.MeasureCore(Size availableSize)
   at Avalonia.Layout.Layoutable.Measure(Size availableSize)
   at Avalonia.Layout.LayoutHelper.MeasureChild(Layoutable control, Size availableSize, Thickness padding, Thickness borderThickness)
   at Avalonia.Controls.Presenters.ContentPresenter.MeasureOverride(Size availableSize)
   at Avalonia.Layout.Layoutable.MeasureCore(Size availableSize)
   at Avalonia.Layout.Layoutable.Measure(Size availableSize)
   at Avalonia.Layout.Layoutable.MeasureOverride(Size availableSize)
   at Avalonia.Layout.Layoutable.MeasureCore(Size availableSize)
   at Avalonia.Layout.Layoutable.Measure(Size availableSize)
   at Avalonia.Layout.LayoutHelper.MeasureChild(Layoutable control, Size availableSize, Thickness padding, Thickness borderThickness)
   at Avalonia.Controls.Presenters.ContentPresenter.MeasureOverride(Size availableSize)
   at Avalonia.Layout.Layoutable.MeasureCore(Size availableSize)
   at Avalonia.Layout.Layoutable.Measure(Size availableSize)
   at Avalonia.Controls.StackPanel.MeasureOverride(Size availableSize)
   at Avalonia.Layout.Layoutable.MeasureCore(Size availableSize)
   at Avalonia.Layout.Layoutable.Measure(Size availableSize)
   at Avalonia.Layout.LayoutManager.Measure(Layoutable control)
   at Avalonia.Layout.LayoutManager.ExecuteMeasurePass()
   at Avalonia.Layout.LayoutManager.InnerLayoutPass()
   at Avalonia.Layout.LayoutManager.ExecuteLayoutPass()
   at Avalonia.Layout.LayoutManager.ExecuteQueuedLayoutPass()
   at Avalonia.Media.MediaContext.FireInvokeOnRenderCallbacks()
   at Avalonia.Media.MediaContext.RenderCore()
   at Avalonia.Media.MediaContext.Render()
   at Avalonia.Threading.DispatcherOperation.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.Win32.Win32DispatcherImpl.DispatchWorkItem()
   at Avalonia.Win32.Win32Platform.WndProc(IntPtr hWnd, UInt32 msg, IntPtr wParam, IntPtr lParam)
   at Avalonia.Win32.Interop.UnmanagedMethods.DispatchMessage(MSG& lpmsg)
   at Avalonia.Win32.Win32DispatcherImpl.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.StartCore(String[] args)
   at Avalonia.Controls.ApplicationLifetimes.ClassicDesktopStyleApplicationLifetime.Start()
   at VRChatContentPublisher.App.Extensions.AvaloniaHostExtension.RunAvaloniaWaitForShutdown(IHost host, String[] args) in C:\Data\Project\VRChat\ContentManager\VRChatContentManager\src\App\VRChatContentPublisher.App\Extensions\AvaloniaHostExtension.cs:line 58
   at VRChatContentPublisher.App.Program.Main(String[] args) in C:\Data\Project\VRChat\ContentManager\VRChatContentManager\src\App\VRChatContentPublisher.App\Program.cs:line 129

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions