Bug 35774 - ResourceManager can not read value from resource file
Summary: ResourceManager can not read value from resource file
Status: RESOLVED ANSWERED
Alias: None
Product: MonoMac
Classification: Desktop
Component: Bindings ()
Version: unspecified
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Chris Hamons
URL:
Depends on:
Blocks:
 
Reported: 2015-11-10 23:52 UTC by BillXu
Modified: 2015-11-12 09:36 UTC (History)
1 user (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Mac Resource Issue (21.80 KB, application/zip)
2015-11-10 23:53 UTC, BillXu
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED ANSWERED

Description BillXu 2015-11-10 23:52:57 UTC
Hi Support Team,

We meet one issue for loading Mac resource with Xamarin. We have one resource file named Resource1.resx. It failed when loading one string from this resource file with below code. Please refer attachment sample to create this issue. Could you please give some advice to load resource? 

If you need any more information, please let me know that. Please check the codes as follow:
partial void loadResourceButtonClicked(MonoMac.Foundation.NSObject sender){
    try{
        var b = Resources1.ResourceManager;
        var name = b.GetString("Name1");
        resultLabel.StringValue = name;
    }
    catch {
        resultLabel.StringValue = "Resource load failed.";
    }
}

PS.We have attached the test project, please have a check.

Thanks,
Bill
Comment 1 BillXu 2015-11-10 23:53:59 UTC
Created attachment 13771 [details]
Mac Resource Issue
Comment 2 Chris Hamons 2015-11-12 09:36:16 UTC
If you look at the exception that you are catching:

Could not find any resources appropriate for the specified culture or the neutral culture.  Make sure "MacResourceTest.Resources1.resources" was correctly embedded or linked into assembly "MacResourceTest" at compile time, or that all the satellite assemblies required are loadable and fully signed.

It points out that you aren't correctly embedding your resource. If you swap your Resources1.resx to EmbeddedResource everything works.

For problems you are having that you are unsure if bugs, our community forums are often a good place place to post:

https://forums.xamarin.com/categories/mac