### Install IoTHub Service Test Prerequisites on Windows Source: https://github.com/azure/azure-iot-sdk-csharp/blob/main/iothub/service/tests/readme.md Run this command to install the necessary prerequisites for IoTHub Service tests on a Windows system. Ensure you are running elevated (as Administrator). ```batch prerequisites\windows_install.cmd ``` -------------------------------- ### Rerun e2eTestsSetup without Dependency Installation Source: https://github.com/azure/azure-iot-sdk-csharp/blob/main/e2e/Tests/prerequisites/readme.md If encountering issues with already installed components, rerun the `e2eTestsSetup.ps1` script using `-InstallDependencies $false` to skip the dependency installation step. ```powershell . /e2eTestsSetup -SubscriptionId [yourSubscriptionId] -Region [YourRegion] -ResourceGroup [ResourceGroupName] -GroupCertificatePassword [Password] -InstallDependencies $false ``` -------------------------------- ### Run e2eTestsSetup PowerShell Script Source: https://github.com/azure/azure-iot-sdk-csharp/blob/main/e2e/Tests/prerequisites/readme.md Execute the `e2eTestsSetup.ps1` script in PowerShell as Administrator, replacing bracketed placeholders with your specific values. The `-InstallDependencies` flag should be used for the initial setup. ```powershell . /e2eTestsSetup -SubscriptionId [yourSubscriptionId] -Region [YourRegion] -ResourceGroup [ResourceGroupName] -GroupCertificatePassword [Password] -InstallDependencies ``` -------------------------------- ### Navigate to Docker Setup Directory and Run Script Source: https://github.com/azure/azure-iot-sdk-csharp/blob/main/e2e/test/docker/readme.md Change to the directory containing the docker-setup.sh script and execute it. This script is essential for setting up Docker instances with the correct network configuration for E2E testing. ```Shell cd /e2e/test/docker .\/docker-setup.sh ``` -------------------------------- ### Start Capturing Traces with logman (Windows) Source: https://github.com/azure/azure-iot-sdk-csharp/blob/main/tools/CaptureLogs/readme.md Use this PowerShell script to start capturing event traces on Windows. Specify the output file, provider list file, and a trace name. ```powershell .\iot_startlog.ps1 -Output iot.etl -ProviderFile .\iot_providers.txt -TraceName IotTrace ``` -------------------------------- ### Install AsmDiff and Run Diff Tool Source: https://github.com/azure/azure-iot-sdk-csharp/blob/main/tools/diffscripts/README.md Installs the AsmDiff tool globally and then executes the diffapi.ps1 script from the tools directory. ```powershell cd c:\repos git clone https://github.com/Azure/iot-sdks-internals.git dotnet tool install Microsoft.Dotnet.AsmDiff -g --add-source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json --version 6.0.0-beta.21161.15 cd c:\repos\azure-iot-sdk-csharp\tools\difftools .\diffapi.ps1 ``` -------------------------------- ### Install AsmDiff Tool Source: https://github.com/azure/azure-iot-sdk-csharp/blob/main/tools/diffscripts/README.md Installs the AsmDiff tool globally with a specific version and adds a custom NuGet source. ```powershell dotnet tool install Microsoft.Dotnet.AsmDiff -g --add-source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json --version 6.0.0-beta.21161.15 ``` -------------------------------- ### Azure Functions Package Management Example Source: https://github.com/azure/azure-iot-sdk-csharp/blob/main/iothub/device/readme.md This JSON snippet illustrates the dependencies section in project.json for an Azure Function, specifying versions for Microsoft.Azure.Devices.Client and Validation. ```json { "frameworks": { "net46":{ "dependencies": { "Microsoft.Azure.Devices.Client": "1.1.1", "Validation": "2.0.6.15003" } } } } ``` -------------------------------- ### Install AsmDiff Tool Globally Source: https://github.com/azure/azure-iot-sdk-csharp/blob/main/tools/diffscripts/README.md Installs the AsmDiff tool globally, allowing the script to run without specifying the tool path. Requires .NET Core 3.1 SDK or higher. ```powershell ❯ .\diffapi.ps1 You do not have the required tool to check for SDK differences. Please get the AsmDiff tool from the dotnet arcade by installing it using the following command line: dotnet tool install Microsoft.Dotnet.AsmDiff -g --add-source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json --version 6.0.0-beta.21161.15 NOTE: The command above will install the AsmDiff tool globally and will allow you to run the script without parameters. NOTE: If you don't want it to be installed globally remove the -g flag from the above command and specify the tool location with -AsmToolExecutable parameter when running this script. dotnet tool install Microsoft.Dotnet.AsmDiff --add-source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json --version 6.0.0-beta.21161.15 --tool-path c:\tools\asmdiff .\diffapi.ps1 -AsmToolExecutable c:\tools\asmdiff\dotnet-asmdiff.exe NOTE: This requires .NET Core 2.1 SDK or higher, but it is recommended to use .NET Core 3.1 NOTE: Install .NET Core 3.1 from here: https://dotnet.microsoft.com/download/dotnet/thank-you/sdk-3.1.407-windows-x64-installer NOTE: dotnet tool install help: https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-tool-install Please correct the above and rerun this tool. ``` -------------------------------- ### Get TPM Endorsement Key Source: https://github.com/azure/azure-iot-sdk-csharp/blob/main/provisioning/device/samples/how to guides/TpmSample/readme.md Use this parameter to retrieve and print the TPM endorsement key (EK) to the console. This key is required for creating an individual enrollment. ```commandline dotnet run --GetTpmEndorsementKey ``` -------------------------------- ### Associate Logging Example Source: https://github.com/azure/azure-iot-sdk-csharp/blob/main/iothub/device/devdoc/architecture.md Use this to associate parent and child objects for log parsing. Always specify at least three parameters: the context object, the parent object, and the child object. ```csharp Logging.Associate(thisOrContextObject:this, first:deviceClient, second:internalClient); ``` -------------------------------- ### Enable PowerShell Script Execution (Windows) Source: https://github.com/azure/azure-iot-sdk-csharp/blob/main/doc/devbox_setup.md Enables PowerShell script execution on your system. This is a one-time setup required for Windows environments. ```powershell Set-ExecutionPolicy -ExecutionPolicy RemoteSigned ``` -------------------------------- ### Azure Functions Binding Redirect Example Source: https://github.com/azure/azure-iot-sdk-csharp/blob/main/iothub/device/readme.md This XML snippet shows the dependentAssembly element with a bindingRedirect, which is relevant when working with Azure Functions and the IoT SDK. ```xml ``` -------------------------------- ### Remove IoTHub Service Test Prerequisites on Windows Source: https://github.com/azure/azure-iot-sdk-csharp/blob/main/iothub/service/tests/readme.md Run this command to remove the prerequisites previously installed for IoTHub Service tests on a Windows system. Ensure you are running elevated (as Administrator). ```batch prerequisites\windows_remove.cmd ``` -------------------------------- ### Get IoT Hub Event Hub Details via Azure CLI Source: https://github.com/azure/azure-iot-sdk-csharp/blob/main/iothub/service/samples/getting started/ReadD2cMessages/README.md Use these Azure CLI commands to retrieve the necessary details for forming the Event Hubs compatible connection string for your IoT Hub. ```bash az iot hub show --query properties.eventHubEndpoints.events.endpoint --name {your IoT Hub name} az iot hub show --query properties.eventHubEndpoints.events.path --name {your IoT Hub name} az iot hub policy show --name service --query primaryKey --hub-name {your IoT Hub name} ``` -------------------------------- ### Display All Parameters for Provisioning Device Client Sample Source: https://github.com/azure/azure-iot-sdk-csharp/blob/main/provisioning/device/samples/how to guides/TpmSample/readme.md Run this command to view a comprehensive list of all available parameters for the provisioning device client sample. ```commandline dotnet run -? ``` -------------------------------- ### Run Provisioning Device Client Sample Source: https://github.com/azure/azure-iot-sdk-csharp/blob/main/provisioning/device/samples/how to guides/TpmSample/readme.md Execute the provisioning device client sample with your IdScope and RegistrationId. Ensure you replace the placeholders with your actual values. ```commandline dotnet run -s -r ``` -------------------------------- ### Build Sample Application Source: https://github.com/azure/azure-iot-sdk-csharp/blob/main/iothub/device/samples/readme.md Use this command to build the sample application using .NET Core. Navigate to the sample folder containing the .csproj file before executing. ```console dotnet build ``` -------------------------------- ### Run Sample Application Source: https://github.com/azure/azure-iot-sdk-csharp/blob/main/iothub/device/samples/readme.md Execute this command to run the sample application using .NET Core. Ensure any required parameters discovered via '--help' are included. ```console dotnet run ``` -------------------------------- ### WireShark TLS Filter Example Source: https://github.com/azure/azure-iot-sdk-csharp/blob/main/tools/TLS Protocols Tests/ReadMe/readme.md Example WireShark filter to capture traffic to a specific IP address. Replace 'xx.xx.xx.xx' with the IP address of your hub or DPS. ```text ip.dst == xx.xx.xx.xx ``` -------------------------------- ### Run Sample with Command Line Arguments Source: https://github.com/azure/azure-iot-sdk-csharp/blob/main/iothub/device/samples/how to guides/X509DeviceCertWithChainSample/readme.md Provide these command-line arguments when running the sample application. Ensure all paths and sensitive information are correctly specified. ```bash "commandLineArgs": "-h -d --devicePfxPath --devicePfxPassword (ConvertFrom-SecureString -SecureString $password -AsPlainText) --rootCertPath --intermediate1CertPath --intermediate2CertPath " ``` -------------------------------- ### Run Provisioning Device Client Sample in Visual Studio Source: https://github.com/azure/azure-iot-sdk-csharp/blob/main/provisioning/device/samples/how to guides/TpmSample/readme.md Configure the application arguments in Visual Studio's project properties to run the provisioning device client sample with your IdScope and RegistrationId. ```commandline -s -r ``` -------------------------------- ### View Sample Application Parameters Source: https://github.com/azure/azure-iot-sdk-csharp/blob/main/iothub/device/samples/readme.md To see the parameters required by a sample application, execute this command. This is useful for understanding input requirements before running the sample. ```console dotnet run --help ``` -------------------------------- ### Build Azure IoT SDK on Windows Source: https://github.com/azure/azure-iot-sdk-csharp/blob/main/doc/devguide.md Execute this command to build the Azure IoT SDK for C# on a Windows machine. ```bash build.cmd ``` -------------------------------- ### Provision Devices for Performance Testing Source: https://github.com/azure/azure-iot-sdk-csharp/blob/main/e2e/stress/IoTClientPerf/readme.md Use `dotnet run` with specific arguments to provision a large number of devices for IoT Hub performance testing. This command generates a configuration file and outputs a `devices.txt` file for import. ```bash dotnet run -- -a sas -n 100 -o out.csv -f generate_iothub_config ``` -------------------------------- ### Stop Capturing Traces with logman (Windows) Source: https://github.com/azure/azure-iot-sdk-csharp/blob/main/tools/CaptureLogs/readme.md Use this PowerShell script to stop capturing event traces on Windows. You must provide the same trace name used when starting the capture. ```powershell .\iot_stoplog.ps1 -TraceName IotTrace ``` -------------------------------- ### Run .NET Framework Project Source: https://github.com/azure/azure-iot-sdk-csharp/blob/main/tools/TLS Protocols Tests/ReadMe/readme.md Execute the TLS protocol tests targeting .NET Framework 4.5.1. Ensure necessary environment variables are set. ```bash dotnet run -f net451 ``` -------------------------------- ### Run AuthSetup.ps1 Script Source: https://github.com/azure/azure-iot-sdk-csharp/blob/main/iothub/device/samples/how to guides/X509DeviceCertWithChainSample/readme.md Execute the AuthSetup.ps1 script to create and manage certificates for your IoT Hub. Ensure you run this in admin mode and replace placeholders with your specific values. ```powershell .\AuthSetup.ps1 ` -certFolderPath ` -rootCertPassword $password ` -iotHubResourceGroup ` -iotHubName ` -deviceId ``` -------------------------------- ### Build Azure IoT SDK on Linux Source: https://github.com/azure/azure-iot-sdk-csharp/blob/main/doc/devguide.md Execute this command to build the Azure IoT SDK for C# on a Linux machine. ```bash ./build.sh ``` -------------------------------- ### Run Device-to-Cloud Test (Single Device) Source: https://github.com/azure/azure-iot-sdk-csharp/blob/main/e2e/stress/IoTClientPerf/readme.md Execute a device-to-cloud stress test scenario with a single device. Specify output file, duration, number of devices, and test function. ```bash dotnet run -- -o device.csv -t 60 -n 10 -f single_device_d2c ``` -------------------------------- ### Run .NET Core Project Source: https://github.com/azure/azure-iot-sdk-csharp/blob/main/tools/TLS Protocols Tests/ReadMe/readme.md Execute the TLS protocol tests targeting .NET Core. Ensure necessary environment variables are set. ```bash dotnet run -f netcoreapp2.1 ``` -------------------------------- ### Default ExponentialBackoff Retry Policy Source: https://github.com/azure/azure-iot-sdk-csharp/blob/main/iothub/device/devdoc/retrypolicy.md This is the default retry policy used by the SDK. It configures retry attempts with exponential backoff, starting with a 100ms delay and increasing up to 10 seconds. Retries are throttled to a minimum of 1 second to prevent high CPU usage during immediate failures. ```C# new ExponentialBackoff(int.MaxValue, TimeSpan.FromMilliseconds(100), TimeSpan.FromSeconds(10), TimeSpan.FromMilliseconds(100)); ``` -------------------------------- ### Run Windows Service Prerequisites Script Source: https://github.com/azure/azure-iot-sdk-csharp/blob/main/doc/devbox_setup.md Executes a batch script to set up prerequisites for the iothub service tests on Windows. This should be run as an administrator. ```batch iothub\service\tests\prerequisites\windows_install.cmd ``` -------------------------------- ### Run Device-to-Cloud Test (Multiple Devices) Source: https://github.com/azure/azure-iot-sdk-csharp/blob/main/e2e/stress/IoTClientPerf/readme.md Execute a device-to-cloud stress test scenario involving multiple devices. Specify output file, duration, number of devices, and test function. ```bash dotnet run -- -o device.csv -t 60 -n 10 -f device_d2c ``` -------------------------------- ### Copy and Configure Linux/OSX IoT Configuration Script Source: https://github.com/azure/azure-iot-sdk-csharp/blob/main/doc/devbox_setup.md Copies a template script for IoT configuration to a local file and optionally adds it to the system's PATH. This file contains sensitive account information and should not be checked into source control. ```shell cp e2e/test/prerequisites/iot_config.sh_template iot_config.sh ``` -------------------------------- ### Load Key Vault Script Execution Source: https://github.com/azure/azure-iot-sdk-csharp/blob/main/e2e/Tests/prerequisites/readme.md After the `e2eTestsSetup` script completes, run the generated `.ps1` file (named using the Key Vault name) each time before executing end-to-end tests to load necessary configurations. ```powershell .\load-].ps1 ``` -------------------------------- ### Copy and Configure Windows IoT Configuration Script Source: https://github.com/azure/azure-iot-sdk-csharp/blob/main/doc/devbox_setup.md Copies a template script for IoT configuration to a local file and adds it to the system's PATH for easy access. This file contains sensitive account information and should not be checked into source control. ```batch copy e2e/test/prerequisites/iot_config.cmd_template iot_config.cmd ``` -------------------------------- ### Add IoT Configuration Variables to Environment (Linux/OSX) Source: https://github.com/azure/azure-iot-sdk-csharp/blob/main/doc/devbox_setup.md Dot-sources the configured IoT configuration script to add necessary environment variables for running tests. This should be run from the same command prompt/terminal used for testing. ```shell . iot_config.sh ``` -------------------------------- ### Add IoT Configuration Variables to Environment (Windows) Source: https://github.com/azure/azure-iot-sdk-csharp/blob/main/doc/devbox_setup.md Executes the configured IoT configuration script to add necessary environment variables for running tests. This should be run from the same command prompt/terminal used for testing. ```batch iot_config.cmd ``` -------------------------------- ### Run Cloud-to-Device Test Source: https://github.com/azure/azure-iot-sdk-csharp/blob/main/e2e/stress/IoTClientPerf/readme.md Execute a cloud-to-device stress test. This requires running the command in two separate consoles, one for device output and one for service output. ```bash dotnet run -- -o device.csv -t 60 -n 10 -f device_c2d dotnet run -- -o service.csv -t 60 -n 10 -f service_c2d ``` -------------------------------- ### Create DigitalTwinClient with Logging Handler Source: https://github.com/azure/azure-iot-sdk-csharp/blob/main/iothub/service/src/DigitalTwin/readme.md Creates a DigitalTwinClient using a connection string and a custom logging delegating handler for tracing requests and responses. The LoggingHandler logs each Http request and response. ```csharp internal class LoggingHandler : DelegatingHandler { private readonly ILogger _logger; public LoggingHandler(ILogger logger) { _logger = logger; } protected override async Task SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) { _logger.LogTrace($"Request: {request}"); try { // base.SendAsync calls the inner handler HttpResponseMessage response = await base.SendAsync(request, cancellationToken); _logger.LogTrace($"Response: {response}"); return response; } catch (Exception ex) { _logger.LogError($"Failed to get response: {ex}"); throw; } } } DelegatingHandler[] handlers = { new LoggingHandler(Logger) }; using var digitalTwinClient = DigitalTwinClient.CreateFromConnectionString(connectionString, handlers); ``` -------------------------------- ### Build Xamarin Project on Windows Source: https://github.com/azure/azure-iot-sdk-csharp/blob/main/doc/devguide.md Run this Jenkins script from the root of the repository to build and test Xamarin projects. ```bash jenkins\windows_csharp_xamarin.cmd ``` -------------------------------- ### Run Tests from a .NET Core Test Project Source: https://github.com/azure/azure-iot-sdk-csharp/blob/main/doc/devguide.md Use the dotnet CLI to run tests from a test project. This command is applicable on Windows, Linux, and macOS. ```bash dotnet test ``` -------------------------------- ### Configure X.509 Security Provider with Certificate and Chain Source: https://github.com/azure/azure-iot-sdk-csharp/blob/main/provisioning/device/samples/getting started/X509Sample/readme.md This C# code configures the X.509 security provider using a PFX certificate file and an optional certificate chain file. Ensure the PFX file is password-protected and the correct password is used. ```csharp using var security = new SecurityProviderX509Certificate(certificate); ``` ```csharp var myCertificate = new X509Certificate2("myCertificate.pfx", "mypassword"); var myChain = new X509Certificate2Collection(); // Comment out the below line if you do not have a .p7b file (e.g. if you generated certificates using the tool below) myChain.Import("myChain.p7b"); using var security = new SecurityProviderX509Certificate(myCertificate, myChain); ``` -------------------------------- ### Clone Azure IoT SDK Repository Source: https://github.com/azure/azure-iot-sdk-csharp/blob/main/doc/devguide.md Use this command to clone the Azure IoT SDK for C# repository from GitHub. ```bash git clone https://github.com/Azure/azure-iot-sdk-csharp.git ``` -------------------------------- ### Device Client Creation with SAS Token Authentication Source: https://github.com/azure/azure-iot-sdk-csharp/blob/main/device_connection_and_reliability_readme.md Use `DeviceClient.CreateFromConnectionString` to authenticate using a device's shared access key. The SDK automatically handles SAS token creation and renewal. ```csharp var deviceClient = DeviceClient.CreateFromConnectionString(connectionString); ``` -------------------------------- ### Run Combined Tests Source: https://github.com/azure/azure-iot-sdk-csharp/blob/main/e2e/stress/IoTClientPerf/readme.md Execute a combination of stress tests including device-to-cloud, cloud-to-device, and direct methods. This requires running three commands in separate consoles. ```bash dotnet run -- -o device.csv -t 60 -n 10 -f device_all dotnet run -- -o service1.csv -t 60 -n 10 -f service_c2d dotnet run -- -o service2.csv -t 60 -n 10 -f service_method ``` -------------------------------- ### Initialize IoT Hub Service Client Source: https://github.com/azure/azure-iot-sdk-csharp/blob/main/iothub/service/samples/getting started/ServiceClientSample/readme.md Initializes the service client using a connection string and specifies the transport type. Ensure you obtain the correct connection string from the Azure portal or CLI. ```csharp string connectionString = ""; TransportType transportType = TransportType.Amqp; serviceClient = ServiceClient.CreateFromConnectionString(connectionString, transportType); ``` -------------------------------- ### Initialize Device Client Source: https://github.com/azure/azure-iot-sdk-csharp/blob/main/iothub/device/samples/how to guides/DeviceReconnectionSample/readme.md Initializes the DeviceClient using a connection string and transport type. It also configures SDK options for message ID assignment. ```csharp // Connection string: // Get the device connection string from Azure IoT Portal, or using Azure CLI. // Azure portal - // Navigate to your IoT Hub. From the left pane, under "Explorers", click on "IoT devices". // Click and navigate to your device. // Copy the connection strings listed (primary and/or secondary). // Azure CLI - // az iot hub device-identity connection-string show --device-id [--key-type {primary, secondary}] // --key-type is optional. It defaults to "primary". // // Transport type: // The transport to use to communicate with the IoT Hub. Possible values include Mqtt, // Mqtt_WebSocket_Only, Mqtt_Tcp_Only, Amqp, Amqp_WebSocket_Only, Amqp_Tcp_only, and Http1. string connectionString = ""; TransportType transportType = TransportType.Mqtt; // This option is helpful in delegating the assignment of Message.MessageId to the sdk. // If the user doesn't set a value for Message.MessageId, the sdk will assign it a random GUID before sending the message. var options = new ClientOptions { SdkAssignsMessageId = Shared.SdkAssignsMessageId.WhenUnset, }; deviceClient = DeviceClient.CreateFromConnectionString(connectionString, transportType, options); ``` -------------------------------- ### Run Direct Method Test Source: https://github.com/azure/azure-iot-sdk-csharp/blob/main/e2e/stress/IoTClientPerf/readme.md Execute a direct method stress test. This requires running the command in two separate consoles, one for device output and one for service output. ```bash dotnet run -- -o device.csv -t 60 -n 10 -f device_method dotnet run -- -o service.csv -t 60 -n 10 -f service_method ``` -------------------------------- ### Run Diff Tool with Preview Flag Source: https://github.com/azure/azure-iot-sdk-csharp/blob/main/tools/diffscripts/README.md Executes the diffapi.ps1 script, specifying a custom path for the SDK internals repository and enabling the preview mode. ```powershell dotnet tool install Microsoft.Dotnet.AsmDiff -g --add-source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json --version 6.0.0-beta.21161.15 git clone https://github.com/Azure/iot-sdks-internals.git d:\internals cd c:\repos\azure-iot-sdk-csharp\tools\difftools .\diffapi.ps1 -SDKInternalsPath d:\internals -IsPreview ``` -------------------------------- ### Instantiate EventHubConsumerClient with Options Source: https://github.com/azure/azure-iot-sdk-csharp/blob/main/iothub/service/samples/getting started/ReadD2cMessages/README.md This C# code shows how to create an instance of EventHubConsumerClient, passing in a consumer group name, connection string, event hub name, and the custom options configured for WebSocket and proxy support. ```csharp string consumerGroup = EventHubConsumerClient.DefaultConsumerGroupName; await using var consumer = new EventHubConsumerClient(consumerGroup, "<< CONNECTION STRING >>", "<< EVENT HUB >>", options); ``` -------------------------------- ### Generate Release Log and Compare SDK Versions Source: https://github.com/azure/azure-iot-sdk-csharp/blob/main/tools/diffscripts/README.md This PowerShell script generates release logs by comparing Git tags to the current HEAD. It creates detailed and short logs, and can be used to compare against specific tags. It also generates markdown files for SDK components and reports on file changes. ```powershell ❯ .\diffapi.ps1 ``` ```powershell git log --stat ..HEAD --output releaselog_detailed.txt git log --oneline ..HEAD --output releaselog_short.txt ``` -------------------------------- ### Accessing Raw Assets in Android Source: https://github.com/azure/azure-iot-sdk-csharp/blob/main/iothub/device/samples/how to guides/XamarinSample/XamarinSample/XamarinSample.Android/Assets/AboutAssets.txt Place raw assets in the 'Assets' directory and set their Build Action to 'AndroidAsset'. Access them using Android's AssetManager. ```csharp public class ReadAsset : Activity { protected override void OnCreate (Bundle bundle) { base.OnCreate (bundle); InputStream input = Assets.Open ("my_asset.txt"); } } ``` -------------------------------- ### Run CI Scripts for Windows C# Source: https://github.com/azure/azure-iot-sdk-csharp/blob/main/doc/devguide.md The CI system runs these Jenkins scripts from the root folder for testing. ```bash jenkins\windows_csharp.cmd ``` -------------------------------- ### Device Authentication with x509 Certificate Source: https://github.com/azure/azure-iot-sdk-csharp/blob/main/device_connection_and_reliability_readme.md Authenticate using an x509 certificate with `DeviceAuthenticationWithX509Certificate`. The authentication is valid until the certificate expires; manual renewal and client recreation are required. ```csharp var authMethod = new DeviceAuthenticationWithX509Certificate(deviceId, certificate); var deviceClient = DeviceClient.Create(iotHubUri, authMethod); ``` -------------------------------- ### Run Diff Tool with Custom SDK Internals Path Source: https://github.com/azure/azure-iot-sdk-csharp/blob/main/tools/diffscripts/README.md Executes the diffapi.ps1 script, specifying a custom path for the SDK internals repository. ```powershell dotnet tool install Microsoft.Dotnet.AsmDiff -g --add-source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json --version 6.0.0-beta.21161.15 git clone https://github.com/Azure/iot-sdks-internals.git d:\internals cd c:\repos\azure-iot-sdk-csharp\tools\difftools .\diffapi.ps1 -SDKInternalsPath d:\internals ``` -------------------------------- ### Autorest Configuration for Digital Twin Generation Source: https://github.com/azure/azure-iot-sdk-csharp/blob/main/iothub/service/src/DigitalTwin/autorest.md This YAML configuration specifies the input OpenAPI definition file and C# specific settings for code generation, including namespace, output folder, and credential management. ```yaml input-file: DigitalTwin.json csharp: namespace: Microsoft.Azure.Devices.Generated output-folder: Generated add-credentials: true use-internal-constructors: true sync-methods: none ```