question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

can't I add a resource to the Application?

See original GitHub issue

Hello,

I’m trying to add my own ViewModelLocator that I have for years and for that I need to add in App.xaml the code:

<Application.Resources>
    <local:Locator x:key="locator" />
</Application.Resources>

and I’m getting the error: /home/esqueleto/myWork/myAvaloniaApp/App.xaml(12,10,12,10): Avalonia error XAMLIL: Unable to find suitable setter or adder for property Resources of type Avalonia.Controls:Avalonia.Application for argument myAvaloniaApp:myAvaloniaApp.Locator, available setter parameter lists are: [/home/esqueleto/myWork/myAvaloniaApp/myAvaloniaApp.csproj] /home/esqueleto/myWork/myAvaloniaApp/App.xaml(12,10,12,10): Avalonia error XAMLIL: Avalonia.Controls.IResourceDictionary [/home/esqueleto/myWork/myAvaloniaApp/myAvaloniaApp.csproj] /home/esqueleto/myWork/myAvaloniaApp/App.xaml(12,10,12,10): Avalonia error XAMLIL: System.Collections.Generic.KeyValuePair2<System.Object,System.Object> [/home/esqueleto/myWork/myAvaloniaApp/myAvaloniaApp.csproj] /home/esqueleto/myWork/myAvaloniaApp/App.xaml(12,10,12,10): Avalonia error XAMLIL: System.Collections.Generic.KeyValuePair2<TKey,TValue> (line 12 position 10) Line 12, position 10. [/home/esqueleto/myWork/myAvaloniaApp/myAvaloniaApp.csproj]

you can see the code and the compilation error here: https://github.com/aboimpinto/myAvaloniaApp/pull/1/checks?check_run_id=1185181198

Is there anything that I’m doing wrong?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
maxkatz6commented, Sep 30, 2020

@derekantrican had same issue with missing “x:Key” - https://github.com/AvaloniaUI/Avalonia/issues/1020#issuecomment-701097462 I think this error message should also include possible solution of the problem, specifically in the “Resources” case.

1reaction
maxkatz6commented, Sep 30, 2020

x:key - should be x:Key.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Add app resources | Android Studio
Add a resource directory​​ To add a new resource directory, follow these steps: Click the target app module in the Project window. Select...
Read more >
Create resource files - .NET
You can include resources, such as strings, images, or object data, in resources files to make them easily available to your application.
Read more >
How do I add a file to a UWP application's resource?
1 Answer 1 · You can just begin a URI with a "/" to refer to the package root. For example: <img src="/file....
Read more >
The Qt Resource System | Qt Core 5.15.14
The Qt resource system is a platform-independent mechanism for storing binary files in the application's executable. This is useful if your application ...
Read more >
Understanding App Resources | CodePath Android Cliffnotes
Overview. In Android, almost everything is a resource. Defining resources that you can then access in your app is an essential part of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found