New Posts New Posts RSS Feed: Design-time problem
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Design-time problem

 Post Reply Post Reply
Author
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Topic: Design-time problem
    Posted: 21-Sep-2012 at 10:57am
Yes, this "Method not found" problem is one we've seen when using an EntityCacheState at design time.
 
We don't have any fixes for this, and the best advice I can give right now is not to use the ECS at design time.  You can create detached entities, or create and attach them to an EntityManager if you wish to retrieve them from the EM cache.
Back to Top
blogger View Drop Down
Newbie
Newbie


Joined: 14-Sep-2012
Posts: 6
Post Options Post Options   Quote blogger Quote  Post ReplyReply Direct Link To This Post Posted: 21-Sep-2012 at 10:02am
I have found problem whose the corresponding exception is listed bellow  in design-time mode:

I am wondering if it is t the problem kimj  is talking about, otherwise i wish if you have any idea about this issue knowing that i found it in design mode when i have built the BookshelfDF project

Method not found: 'System.Delegate System.Reflection.MethodInfo.CreateDelegate(System.Type)'.
   at System.Runtime.Serialization.CodeGenerator.EndMethod()
   at System.Runtime.Serialization.XmlFormatReaderGenerator.CriticalHelper.GenerateClassReader(ClassDataContract classContract)
   at System.Runtime.Serialization.ClassDataContract.get_XmlFormatReaderDelegate()
   at System.Runtime.Serialization.ClassDataContract.ReadXmlValue(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context)
   at System.Runtime.Serialization.XmlObjectSerializerReadContext.ReadDataContractValue(DataContract dataContract, XmlReaderDelegator reader)
   at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator reader, String name, String ns, DataContract& dataContract)
   at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator xmlReader, Type declaredType, DataContract dataContract, String name, String ns)
   at System.Runtime.Serialization.DataContractSerializer.InternalReadObject(XmlReaderDelegator xmlReader, Boolean verifyObjectName)
   at System.Runtime.Serialization.XmlObjectSerializer.ReadObjectHandleExceptions(XmlReaderDelegator reader, Boolean verifyObjectName)
   at System.Runtime.Serialization.XmlObjectSerializer.ReadObject(XmlDictionaryReader reader)
   at IdeaBlade.EntityModel.SerializationFns.RestoreDCS(Type instanceType, Stream stream, Boolean closeOnExit, IEnumerable`1 knownTypes, Boolean useBinaryFormat)
   at IdeaBlade.EntityModel.EntityCacheState.Restore(Stream stream, Boolean closeOnExit, Boolean useBinaryFormat)
   at BookShelf.DesignEntityManagerProvider.GetDesignEntityCacheState() in C:\Users\ppc\Downloads\BookShelfDF\130_AdditionalTechniques\BookShelfDF\CodeCS\BookShelf\DesignServices\DesignEntityManagerProvider.cs:line 87
   at BookShelf.DesignEntityManagerProvider.PopulateFromEntityCacheState(EntityManager context) in C:\Users\ppc\Downloads\BookShelfDF\130_AdditionalTechniques\BookShelfDF\CodeCS\BookShelf\DesignServices\DesignEntityManagerProvider.cs:line 69
   at BookShelf.DesignEntityManagerProvider.CreateManager() in C:\Users\ppc\Downloads\BookShelfDF\130_AdditionalTechniques\BookShelfDF\CodeCS\BookShelf\DesignServices\DesignEntityManagerProvider.cs:line 25
   at BookShelf.DesignServiceProvider..ctor() in C:\Users\ppc\Downloads\BookShelfDF\130_AdditionalTechniques\BookShelfDF\CodeCS\BookShelf\DesignServices\DesignServiceProvider.cs:line 8
   at BookShelf.ServiceProviderBase.CreateInstance() in C:\Users\ppc\Downloads\BookShelfDF\130_AdditionalTechniques\BookShelfDF\CodeCS\BookShelf\Services\ServiceProviderBase.cs:line 21
   at BookShelf.ServiceProviderBase.get_Instance() in C:\Users\ppc\Downloads\BookShelfDF\130_AdditionalTechniques\BookShelfDF\CodeCS\BookShelf\Services\ServiceProviderBase.cs:line 16
   at BookShelf.ViewModelLocator..ctor() in C:\Users\ppc\Downloads\BookShelfDF\130_AdditionalTechniques\BookShelfDF\CodeCS\BookShelf\ViewModels\ViewModelLocator.cs:line 9

Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Posted: 01-Feb-2012 at 11:28am
Hi Samir,
 
We haven't seen this particular design-time error with Silverlight 5 before, but we have seen others (which I mention below).  There are a few things you can try:
 
 - Ensure your assembly has an InternalsVisibleTo attribute specifying System.Runtime.Serialization.  We generate this automatically in Silverlight application projects (in AssemblyInfo.cs), so if your model project doesn't already include it you can copy the attribute from one that does.
 
- If the above doesn't work add the AllowPartiallyTrusedCallers attribute to your assembly.
 
Now for the SL5 design-time errors we've run into.  Even should you get the above working, we've seen problems with using an EntityCacheState at design time, and with adding or attaching entities to an EntityManager.  These problems will usually manifest as a MissingMethodException, and will occur in code that was working fine when only Silverlight 4 was installed.   We don't yet have an answer for these problems, since Microsoft tells us they're caused by designer dependencies on .NET 4.5. 
 
If you do run into additional problems, we have found that creating entities, but not attaching or adding them to an EntityManager, does work.
 
Back to Top
samir View Drop Down
Newbie
Newbie


Joined: 30-Mar-2011
Posts: 14
Post Options Post Options   Quote samir Quote  Post ReplyReply Direct Link To This Post Posted: 01-Feb-2012 at 6:43am
Hello.
 
I´m trying to instantiate an Entity Manager during design-time but I get this error:
 
Attempt by security transparent method 'DynamicClass.ReadImaginePulseTaskFromXml(System.Runtime.Serialization.XmlReaderDelegator, System.Runtime.Serialization.XmlObjectSerializerReadContext, System.Xml.XmlDictionaryString[], System.Xml.XmlDictionaryString[])' to access security critical type 'ImaginePulse.Models.ImaginePulseTask' failed.
 
Assembly 'System.Runtime.Serialization, Version=5.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' is marked with the AllowPartiallyTrustedCallersAttribute, and uses the level 2 security transparency model.  Level 2 transparency causes all methods in AllowPartiallyTrustedCallers assemblies to become security transparent by default, which may be the cause of this exception.
 
Do you have any idea how can I solve this error?
 
Thanks,
Samir
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down