MissingManifestResourceException occurred

Oct 22, 2011 at 4:50 AM

I am getting an exception when I run my application, which uses Catel.  The title of the exception is 'MissingManifestResourceException occurred'  The exception text is:

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

This is with Catel 2.2.  My CurrentCulture is 'en-US'.

I have tried compiling the source and referencing the compiled assemblies, and have also tried adding Catel references via NuGet.  I get the same error either way.

The Catel method that is closest to the top of the stack when the exception occurs is Catel.Core.dll!Catel.Properties.Exceptions.PropertyNotFound.get().  the method at the top of the stack, which throws the exception, is      'mscorlib.dll!System.Resources.ManifestBasedResourceGroveler.HandleResourceStreamMissing(string fileName)'.

It would appear that this exception occurs when Catel is trying to throw a PropertyNotFound exception, which is also weird because the code in my application that is causing this is a simple property setter in a ViewModel.  The property was created using the vmprop snippet, and the property definitely exists. 

Any ideas on how to resolve this (mainly the missing resource issue)?

Thanks,

Tom B

Coordinator
Oct 22, 2011 at 10:47 AM

This is a mistake I made with the NET 40 WPF library. I forgot to run the custom tool again for the resources (required because the resource dictionaries are added as a link file). You have the following options:

  1. Use the 3.5 version
  2. Catel 2.3 is almost out, wait for that one
  3. Use the latest beta of Catel 2.3, which can be found here  (recommended)

We are sorry for the inconvenience.

Back to the actual issue (of the PropertyNotFound exception): can you show me the property registration and the code where you set the property?

Oct 22, 2011 at 1:16 PM

Thanks, Geert.  I can use the beta of 2.3 for now. 

Here is the relevant code.  The exception gets raised in the setter for DSModel:

        [Model]
        public DataSetModel DSModel
        {
            get { return GetValue<DataSetModel>(DSModelProperty); }
            private set { SetValue(DSModelProperty, value); }
        }

        /// <summary>
        /// Register the DS property so it is known in the class.
        /// </summary>
        public static readonly PropertyData DSModelProperty = RegisterProperty("DSModel", typeof(DataSetModel), null, false, (sender, e) => ((EditorWinViewModel)sender).OnDSModelPropertyChanged());

Coordinator
Oct 22, 2011 at 4:54 PM

Thanks for the code example. The new version also writes all stuff to the output window. Can you please check that log (or post it here so I can investigate it). I don't think the model property is causing the exception, it's probably one of the ViewModelToModel attributes.

Oct 23, 2011 at 3:20 PM

Hi Geert,

2.3 did fix the MissingManifestResources exception.  Now that I am past that, I realize that the PropertyNotFound exception is being thrown because of a different property mapping which I had setup incorrectly.  This property mapping gets indirectly referenced when DSModel gets set. 

Thanks again for your help!