1
Vote

Problem deploying Silverlight App using MEF and Azure

description

Hello I developed an app using Silverlight 5.

When I run this application in my computer this app works like a charm.
but When I publish this application to my WebRole in Azure my app is dead.

I was trying to figure what is going on. My enviroment is:

ASP.NET MVC 5
Silverlight 5 using MEF

I catched this error using Firebug

Error: Unhandled Error in Silverlight Application
Code: 4004
Category: ManagedRuntimeError
Message: System.FieldAccessException: Error al intentar el método 'System.ComponentModel.Composition.ReflectionModel.ReflectionField.SetValue(System.Object, System.Object)' obtener acceso al campo 'SiivasaAppClient.ViewModels.ShellViewModel.mainView'.
at System.Reflection.RtFieldInfo.PerformVisibilityCheckOnField(IntPtr field, Object target, RuntimeType declaringType, FieldAttributes attr, UInt32 invocationFlags)
at System.Reflection.RtFieldInfo.InternalSetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, CultureInfo culture, Boolean doVisibilityCheck, Boolean doCheckConsistency)
at System.Reflection.RtFieldInfo.InternalSetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, CultureInfo culture, Boolean doVisibilityCheck)
at System.Reflection.RtFieldInfo.SetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, CultureInfo culture)
at System.ComponentModel.Composition.ReflectionModel.ReflectionField.SetValue(Object instance, Object value)
at System.ComponentModel.Composition.ReflectionModel.ImportingMember.SetSingleMemberValue(Object instance, Object value)
at System.ComponentModel.Composition.ReflectionModel.ImportingMember.SetExportedValue(Object instance, Object value)
at System.ComponentModel.Composition.ReflectionModel.ReflectionComposablePart.SetExportedValueForImport(ImportingItem import, ImportDefinition definition, Object value)
at System.ComponentModel.Composition.ReflectionModel.ReflectionComposablePart.UseImportedValues[TImportDefinition](IEnumerable1 definitions, Action3 useImportValue, Boolean errorIfMissing)
at System.ComponentModel.Composition.ReflectionModel.ReflectionComposablePart.SetNonPrerequisiteImports()
at System.ComponentModel.Composition.ReflectionModel.ReflectionComposablePart.Activate()
at System.ComponentModel.Composition.Hosting.ImportEngine.PartManager.TryOnComposed()
at System.ComponentModel.Composition.Hosting.ImportEngine.TrySatisfyImportsStateMachine(PartManager partManager, ComposablePart part)
at System.ComponentModel.Composition.Hosting.ImportEngine.TrySatisfyImports(PartManager partManager, ComposablePart part, Boolean shouldTrackImports)
at System.ComponentModel.Composition.Hosting.ImportEngine.SatisfyImports(ComposablePart part)
at System.ComponentModel.Composition.Hosting.CompositionServices.GetExportedValueFromComposedPart(ImportEngine engine, ComposablePart part, ExportDefinition definition)
at System.ComponentModel.Composition.Hosting.CatalogExportProvider.GetExportedValue(ComposablePart part, ExportDefinition export, Boolean isSharedPart)
at System.ComponentModel.Composition.Hosting.CatalogExportProvider.CatalogExport.GetExportedValueCore()
at System.ComponentModel.Composition.Primitives.Export.get_Value()
at System.ComponentModel.Composition.ExportServices.GetCastedExportedValue[T](Export export)
at System.ComponentModel.Composition.Hosting.ExportProvider.GetExportedValuesCore[T](String contractName)
at System.ComponentModel.Composition.Hosting.ExportProvider.GetExportedValues[T](String contractName)
at SiivasaAppClient.MefBootstrapper.GetInstance(Type serviceType, String key)
at Caliburn.Micro.BootstrapperBase.DisplayRootViewFor(Type viewModelType)
at Caliburn.Micro.BootstrapperBase.DisplayRootViewForTViewModel
at SiivasaAppClient.MefBootstrapper.OnStartup(Object sender, StartupEventArgs e)
at MS.Internal.CoreInvokeHandler.InvokeEventHandler(UInt32 typeIndex, Delegate handlerDelegate, Object sender, Object args)
at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName, UInt32 flags)


This the code I'm using to import the viewModel
    [Import]
    Infrastructure.ViewModels.MainPageViewModel mainView = null;

Thank you for your help.

comments