Hi,

i try to proxy a specific method of an already created object. So i build an
ProxyGenerationHook - class

and its ShouldInterceptMethod simply checks

      return memberInfo.Name.Equals("doStart", StringComparison.Ordinal);

after this i create the proxy:

  ITaskStartableInterceptor pTSInterceptor =
ServiceResolver.doResolveByType<ITaskStartableInterceptor>();
  if (pTSInterceptor != null)
  {
      ProxyGenerator pGen = new ProxyGenerator();
      ProxyGenerationOptions pGenOptions = new ProxyGenerationOptions(new
TaskProxyGenerationHook());
      pResult = pGen.CreateInterfaceProxyWithTarget<ITask>(pResult,
pGenOptions, pTSInterceptor);
  }

If I start this, an exception is thrown:

"The method "get_Definition" in Type
"ITaskProxy24b04ad20e1146f68e57a44a48a51c86" der Assembly
"DynamicProxyGenAssembly2, Version=0.0.0.0, Culture=neutral,
PublicKeyToken=null"
 has no implementation".

If i leave the genOptions out of the CreateInterfaceProxyWithTarget - Method

      pResult = pGen.CreateInterfaceProxyWithTarget<ITask>(pResult,
pTSInterceptor);

everything works as expected.

Has anyone an idea what i do wrong?

Thanks,

Belvasis

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to