Azure / dotnet-template-azure-iot-edge-module

Scaffolding tool for Azure IoT Edge C# module
MIT License
15 stars 23 forks source link

Update C# template with Dispose pattern implementation #62

Closed sandervandevelde closed 5 years ago

sandervandevelde commented 5 years ago

As discussed in https://github.com/microsoft/vscode-azure-iot-edge/issues/503

In the C# module template and the C# function template, a message is constructed:

var pipeMessage = new Message(messageBytes);

The Message class implements the Dispose method. The Message class must follow the Dispose pattern to ensure it's disposed in all paths.

With 'using()' we can enforce the Dispose pattern.

This is also in sync with eg. the https://docs.microsoft.com/en-us/azure/iot-edge/tutorial-csharp-module documentation.

blackchoey commented 5 years ago

Thanks for the contribution, looks good to me. We will merge this PR after test.