我有一个带有标记为过时属性的方法的接口。attributes错误参数设置为true以在使用时抛出异常。问题是这会导致存根无法为整个班级生成。当我将值更改为false时,存根会按预期生成。
我正在寻找一种方法来生成存根,同时将错误参数保留为true。
public interface ICar
{
void Start();
[Obsolete("this is obsolete Stop, stop using it", true)]
void Stop();
}
我尝试了不同的排列。
<Moles xmlns="http://schemas.microsoft.com/moles/2010/">
<Assembly Name="My.Car.Services"/>
<StubGeneration>
<TypeFilter TypeName="ICar" SkipObsolete="true" />
</StubGeneration>
</Moles>