Reputation: 11890
Environment: Visual Studio 2015, Xamarin 4.7.9.45, Xamarin Android 7.4.5.1
My development environment used to work fine until yesterday and now I am not able to debug properly. While loading string resources, the following code from AppResources.designer.cs
throws a "file-not-found" exception:
public static string Button_Username {
get {
return ResourceManager.GetString("Button_Username", resourceCulture);
}
}
The resource culture is "en-US." The string resource Button_Username
is indeed defined. Otherwise, the above lines of code wouldn't even be there in the auto-generated AppResources.designer.cs
file.
Upon inspecting the exception in the debugger, it appears Xamarin is trying to load the following file:
/storage/emulated/0/Android/data/myapp.mycomp.com/
files/.__override__/en-US/MyProject.resources.dll
We generate MyProject.resources.dll
for many other languages but not en-US as it is the default language. Why is Xamarin trying to load this dll? Shouldn't it be looking into resources.arsc file? Regards.
Upvotes: 0
Views: 417
Reputation: 10831
We generate MyProject.resources.dll for many other languages but not en-US as it is the default language. Why is Xamarin trying to load this dll? Shouldn't it be looking into resources.arsc file?
resources.arsc
works for Android Native localization. But you are currently developing a Xamarin.Forms App and using its localization, where the related .resw
files will be complied into MyProject.resources.dll
and as your project sets en-US
as the default culture.
If you have created AppResources.en-US.resw
file and current culture is en-US
. Your app will try to look for this file, which is contained in .../en-US/MyProject.resources.dll
.
If you didn't created AppResources.en-US.resw
your app will search the string in AppResources.resw
file.
Upvotes: 1