Hi all. I'm trying to use a type-safe WeakReference in my Silverlight app. I'm following the recipe on this site: http://ondevelopment.blogspot.com/2008/01/generic-weak-reference.html only using the System.WeakReference and omitting the stuff that references Serialization.
It's throwing a ReflectionTypeLoadException when I try to run it, with this message:
"{System.TypeLoadException: Inheritance security rules violated while overriding member: 'Coatue.Silverlight.Shared.Cache.WeakReference`1..ctor()'. Security accessibility of the overriding method must match the security accessibility of the method being overriden.}"
Any suggestions?
EDIT: Here's the code I'm using:
using System;
namespace Frank
{
public class WeakReference<T>
: WeakReference where T : class
{
public WeakReference(T target)
: base(target) { }
public WeakReference(T target, bool trackResurrection)
: base(target, trackResurrection) { }
protected WeakReference() : base() { }
public new T Target
{
get
{
return (T)base.Target;
}
set
{
base.Target = value;
}
}
}
}