28313

Stub generation failes with obsolete attribute, Pex v0.94.51023.0

Question:

I have an interface with a method marked with the obsolete attribute. The attributes <em>error</em> parameter is set to <em>true</em> to throw an exception when used. The problem is this causes the stub to not generate for the whole class. When I alter the value to <em>false</em> the stub generates as expected.

I’m looking for a way to generate the stub while retaining the <em>error</em> parameter as <em>true</em>.

public interface ICar { void Start(); [Obsolete("this is obsolete Stop, stop using it", true)] void Stop(); }

I’ve tried different permutations of.

<Moles xmlns="http://schemas.microsoft.com/moles/2010/"> <Assembly Name="My.Car.Services"/> <StubGeneration> <TypeFilter TypeName="ICar" SkipObsolete="true" /> </StubGeneration> </Moles>

Answer1:

This is by design. When a method is marked at Obsolete(..., true), C# will not allow to instantiate an class implementing that interface.

Recommend

  • Java - why does sending concrete implementation to a generic interaface as parameter does not compil
  • Data.table: Add rows for missing combinations of 2 factors without losing associated descriptive fac
  • How to deal with xxx~HEAD after git merge?
  • Objective C difference between self.variable and variable assignments
  • Event files in Google Tensorflow
  • Winform Designer Application
  • several hexbin plots on one PDF page in R
  • inserting duplicate records with SQL
  • Alter Table doesn't work under MS Access 64 bit. Why?
  • How to specify a multi-column UNIQUE constraint in code-first Entity Framework fluent API
  • MOC adding namespace to class names
  • C++ Boost ptr_map serialization error
  • Usage of local dart library
  • how can I key rotate for google cloud storage service account?
  • HTML checkbox form and HTTP URL
  • HighCharts - Show tooltip on column where value is 0 or null
  • Fragment gives me an error while inflating 1
  • triggering user space with kernel
  • SetWindowsHookEx does not react on media keys
  • The plugin 'org.apache.maven.plugins:maven-jboss-as-plugin' does not exist or no valid ver
  • How to add a column to a Pandas dataframe made of arrays of the n-preceding values of another column
  • Join two tables and save into third-sql
  • Trying to switch camera back to front but getting exception
  • How to model a transition system with SPIN
  • ORA-29908: missing primary invocation for ancillary operator
  • Cannot Parse HTML Data Using Android / JSOUP
  • JTable with a ScrollPane misbehaving
  • Why joiner is not used after Sequence generator or Update statergy
  • Java static initializers and reflection
  • Bitwise OR returns boolean when one of operands is nil
  • unknown Exception android
  • sending mail using smtp is too slow
  • costura.fody for a dll that references another dll
  • Binding checkboxes to object values in AngularJs
  • Observable and ngFor in Angular 2
  • failed to connect to specific WiFi in android programmatically
  • Unable to use reactive element in my shiny app
  • Android Heatmap on canvas or ImageView
  • Converting MP3 duration time
  • How can I use threading to 'tick' a timer to be accessed by other threads?