C
C#2mo ago
Furina.♡

Cannot find method although defined and used?

I'm currently creating a WPF project and have this static class:
namespace KupoFinder.AppConfigHandler;

public static class AppConfigHandler
{
private const string ConfigFileName = "KupoFinder.settings.json";

public static void CheckConfigFile(){}

// ...
}
namespace KupoFinder.AppConfigHandler;

public static class AppConfigHandler
{
private const string ConfigFileName = "KupoFinder.settings.json";

public static void CheckConfigFile(){}

// ...
}
And I use it in my ViewModel like this:
using CommunityToolkit.Mvvm.ComponentModel;
using KupoFinder.AppConfigHandler;

namespace KupoFinder.MVVM;

public partial class MainWindowVM : ObservableObject
{
public MainWindowVM()
{
AppConfigHandler.CheckConfigFile();
}
}
using CommunityToolkit.Mvvm.ComponentModel;
using KupoFinder.AppConfigHandler;

namespace KupoFinder.MVVM;

public partial class MainWindowVM : ObservableObject
{
public MainWindowVM()
{
AppConfigHandler.CheckConfigFile();
}
}
But I get the error: Cannot resolve symbol 'CheckConfigFile' It should find it tho cuz my VM has a dependency on it. Does anyone see the error?
2 Replies
boiled goose
boiled goose2mo ago
i think it's because you have class name == namespace (AppConfigHandler)
Furina.♡
Furina.♡2mo ago
I changed the namespace name, now it works. Ty a lot!!