'System.Reflection.TargetException' in mscorlib.dll

Hi everyone,

I’m fairly new in servicestack, so bear with me. When using the openapi descriptions, every apimember description generates a “Exception thrown: ‘System.Reflection.TargetException’ in mscorlib.dll” when visualizeing the metadata for a service. It still does what it’s supposed to, though. So the code below contributes two errors (the description in the route itself does not generate one, the two apimembers do). I’d like to at least understand what’s going on, and if possible eliminate the errors. Anyone?

namespace DataCenterServiceSelfHost.ServiceModel
{
    [Route("/dtm", Summary = @"Digital Terrain Model Service.", Notes = "Returns the altitude above sea level for a WGS84 coordinate pair.")]
    public class DTMRequest : IReturn<DTMResponse>
    {
        [ApiMember(Description = "Longitude in decimal degrees", IsRequired = true)]
        public string X { get; set; }

        [ApiMember(Description = "Latitude in decimal degrees", IsRequired = true)]
        public string Y { get; set; }
    }

    public class DTMResponse
    {
        public ResultHeight Result { get; set; }
    }

    public class ResultHeight
    {
        public string HeightAboveSeaLevel { get; set; }
        public string TimeOfResponse { get; set; }
    }
}

Can you please upload a minimal repro on GitHub that I can run locally to repro the issue.

I have uploaded a minimal test on https://github.com/phuffel/testtargetexception

I’m running the project locally but I’m not seeing the issue, can you provide a screenshot of the issue in your project?

The mscorlib.dll exception should no longer occur in the latest v5.7.1 on MyGet.

But I’m not sure what issue the project has that I’m meant to be looking at, was it only the mscorlib exception?

The issue has indeed been solved with the MyGet distribution. Thank you very much for the help. It was indeed only the mscorlib exception.

1 Like