Maple project error

After a few months of not looking at Netduino and the issues I was seeing at that time. I saw that the 1 bug reported against Maple was fixed in the latest version 0.10.

However after downloading the latest Netduino.Foundation zip I built the project and see an error. I removed the code causing the error but before I get to deep I ask if this is an issue removing this?

Can anyone advise if this will cause other issues?

ApplianceHost.cs in RequestHandler

    public RequestHandler(HttpListenerContext context) : base(context)
    {
    }

Severity Code Description Project File Line Suppression State
Error CS1729 ‘RequestHandlerBase’ does not contain a constructor that takes 1 arguments ApplianceHost C:\Users\brad\Downloads\Netduino_Samples-master\Connected_CoffeeMaker\ApplianceHost\src\ApplianceHost\RequestHandler.cs 13 Active

So by removing : base(context) I have a building project.

    public RequestHandler(HttpListenerContext context) 
    {
    }

I have not tried to use this so I am hoping that this is an OK change or is there a reason for this error?

Hi Brad - RequestHandlerBase was refactored slightly. The constructor no longer has a HttpListenerContext parameter. Instead, there’s a public property named Context of the same type.

The reason being, the HttpListenerContext isn’t required to use Maple (so it shouldn’t be a constructor param), but you’ll still need to supply an object the Context property if you want to define REST endpoints.

In your code - you would update to:

public RequestHandler(HttpListenerContext context) 
{
    this.Context = context;
}

Cheers!

1 Like

Adrian

Thank you for the help, I briefly had a few minutes to look at the code and made the change you suggested.

Hoping to spend some time this weekend on my project - so we will see if Maple hangs like it did before.

Thanks