Contract.Assert(a != null, "assembly != null");
string cultureName = null;
short fallback = 0;
+
+#if MONO
+ if (GetNeutralResourcesLanguageAttribute(a, ref cultureName, ref fallback)) {
+#else
if (GetNeutralResourcesLanguageAttribute(((RuntimeAssembly)a).GetNativeHandle(),
JitHelpers.GetStringHandleOnStack(ref cultureName),
out fallback)) {
+#endif
if ((UltimateResourceFallbackLocation)fallback < UltimateResourceFallbackLocation.MainAssembly || (UltimateResourceFallbackLocation)fallback > UltimateResourceFallbackLocation.Satellite) {
throw new ArgumentException(Environment.GetResourceString("Arg_InvalidNeutralResourcesLanguage_FallbackLoc", fallback));
}
throw new MissingManifestResourceException(Environment.GetResourceString("MissingManifestResource_NoNeutralAsm", resName, _mediator.MainAssembly.GetSimpleName()));
}
+#if MONO
+ static bool GetNeutralResourcesLanguageAttribute (Assembly assembly, ref string cultureName, ref short fallbackLocation)
+ {
+ var ca = assembly.GetCustomAttribute<NeutralResourcesLanguageAttribute> ();
+ if (ca == null)
+ return false;
+
+ cultureName = ca.CultureName;
+ fallbackLocation = (short) ca.Location;
+ return true;
+ }
+#else
[DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)]
[System.Security.SecurityCritical] // Our security team doesn't yet allow safe-critical P/Invoke methods.
[ResourceExposure(ResourceScope.None)]
[System.Security.SuppressUnmanagedCodeSecurity]
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool GetNeutralResourcesLanguageAttribute(RuntimeAssembly assemblyHandle, StringHandleOnStack cultureName, out short fallbackLocation);
+#endif
}
}
_neutralResourcesCulture = ManifestBasedResourceGroveler.GetNeutralResourcesLanguage(MainAssembly, ref _fallbackLoc);
-#if !FEATURE_CORECLR && !MONO // PAL doesn't support eventing, and we don't compile event providers for coreclr
+#if !FEATURE_CORECLR // PAL doesn't support eventing, and we don't compile event providers for coreclr
if (_bUsingModernResourceManagement == false)
{
+#if !MONO
if (FrameworkEventSource.IsInitialized && FrameworkEventSource.Log.IsEnabled()) {
CultureInfo culture = CultureInfo.InvariantCulture;
String defaultResName = GetResourceFileName(culture);
FrameworkEventSource.Log.ResourceManagerNeutralResourcesNotFound(BaseNameField, MainAssembly, outputResName);
}
}
-
+#endif
#pragma warning disable 618
ResourceSets = new Hashtable(); // for backward compatibility
#pragma warning restore 618
private const int AverageValueSize = 40;
private Dictionary<String, Object> _resourceList;
- private Stream _output;
+ internal Stream _output;
private Dictionary<String, Object> _caseInsensitiveDups;
private Dictionary<String, PrecannedResource> _preserializedData;
private const int _DefaultBufferSize = 4096;