Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C#: Method not found exception (Setter missing)

Tags:

c#

exception

I'm facing really strange error while debugging my program. I have a data contract where I added new properties but one of them cause the following exception:

Method not found: 'Void Measurement.set_ContactId(Int32)'.

The data contract looks following:

[DataContract]
public class Measurement
{
    [DataMember]
    public int FactId { get; set; }

    [DataMember]
    public int ContactId { get; set; }
.....

I don't really understand what can be a problem since, as I said, I added some other properties but there was no problem with them.

UPD: The exception is happening on the service side when I try to assign a value to ContactId:

foreach (Measurement m in result.Where(m => m.FactId == factId)){
    m.ContactId = contactId;
  .....
like image 363
Azimuth Avatar asked Aug 26 '26 09:08

Azimuth


1 Answers

The problem was with some older version of the DLL which was stored in .NET's cache. I made a search on the whole disk for the DLL and deleted all found files (some were in use by the .NET so I had to use Unlocker). After rebuilding the project it worked fine.

like image 180
Azimuth Avatar answered Aug 28 '26 23:08

Azimuth



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!