I have the following code in App.xaml:
<Application x:Class="PcgTools.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:PcgTools.ViewModels"
xmlns:res="clr-namespace:PcgTools.Resources"
StartupUri="MainWindow.xaml"
Startup="Application_Startup">
<Application.Resources>
<ResourceDictionary>
...
<res:Strings x:Key="LocStrings"/>
</ResourceDictionary>
</Application.Resources>
</Application>
(...... some lines that I deleted to make the example cleaner).
When I launch the application, I get the following error (immediately after trying to start / debug): (translation from Dutch, so it may not be 100% literally equal):
No matching constructor was found in type PcgTools.Resources.Strings. You can use the Arguments or FactoryMethod statement to create this type.
There is a constructor file Strings.Designer.cs in the file:
namespace PcgTools.Resources {
...
public class Strings {
...
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute
("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Strings() {
}
However, it is generated, so I can’t even change it.
Btw, it worked without changing the code (about a week ago), but in about 30% of cases when debugging gave this error, and after a second attempt, this exception did not occur.