Print Page | Close Window

Silverlight IConnectionOptionsResolver

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2010
Forum Discription: For .NET 4.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=3630
Printed Date: 12-Jan-2026 at 2:31pm


Topic: Silverlight IConnectionOptionsResolver
Posted By: halloweenx8
Subject: Silverlight IConnectionOptionsResolver
Date Posted: 14-Sep-2012 at 3:43pm
Hi
 
Im trying to authenticate a user using AuthenticationService and an implementation of IEntityLoginManager
My users have different database so I had to implement IDataSourceKeyResolver, all this works using aspx pages, but when i try the same thing in Silverlight i get this error
 
{System.MethodAccessException: Attempt by method 'Microsoft.Internal.ReflectionInvoke.SafeInvoke(System.Reflection.ConstructorInfo, System.Object[])' to access method 'ClientService.Authentication.DealerliveConnectionOptionsResolver..ctor()' failed.
   at IdeaBlade.EntityModel.CoroutineOperation.HandleError(INotifyCompletedArgs notifyCompletedArgs)
   at IdeaBlade.EntityModel.CoroutineOperation.OnCompleted(INotifyCompletedArgs notifyCompletedArgs)
   at IdeaBlade.EntityModel.CoroutineOperation.OnError(Exception error)
   at IdeaBlade.EntityModel.CoroutineSerialProcessor.Process()
   at IdeaBlade.EntityModel.CoroutineProcessor.Start()
   at IdeaBlade.EntityModel.Coroutine.Start(Func`1 coroutine, Action`1 completedHandler)
   at Cocktail.AuthenticationService.LoginAsync(ILoginCredential credential, Action onSuccess, Action`1 onFail)
   at DealerLive.MainPage.Login()
   at DealerLive.MainPage..ctor()
   at DealerLive.App.Application_Startup(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)}
 
Any help will be appreciated, thanks


-------------
Jean

"If You are Not Making Mistakes, then You are Not Doing Anything.”



Replies:
Posted By: halloweenx8
Date Posted: 15-Sep-2012 at 8:25pm
Anybody, any ideas?

-------------
Jean

"If You are Not Making Mistakes, then You are Not Doing Anything.”


Posted By: kimj
Date Posted: 16-Sep-2012 at 6:29pm
Hi Jean,
 
This is actually a Cocktail issue, not a DevForce issue per se, and Marcel is traveling right now.  I can try to help, but you may need to repost this in the Cocktail section of the forum to ensure Marcel sees it.
 
My first guess at why you'd get a MethodAccessException when looking for your DealerliveConnectionOptionsResolver constructor is that you don't have a public parameterless constructor defined for the class.  If you do, or don't have any constructors defined, then my next thought would be the class definition.  Reflection in Silverlight works only with public types and members, or internal types and members if you explicitly grant access.


Posted By: mgood
Date Posted: 17-Sep-2012 at 2:22pm
Jean,
ConnectionOptionsResolvers are created through MEF. As Kim says, your class needs to be public and have a public default ctor or alternatively a public ctor marked with the ImportingConstructorAttribute if you wish to inject dependencies.



Print Page | Close Window