Skip the Stack Overflow: Version 1 -Common Errors Solved Here (Bookmark This!)

Nuthan Murarysetty
5 min readJan 11, 2024

--

Designed this using Canva Team

Stuck on a coding error? Skip the search and head straight to this page! We’ve identified and addressed the most common development roadblocks, offering quick solutions to get you back on track. No more wasted time, just troubleshooting efficiency.

Beyond fixing errors, we also aim to educate. By understanding the context and reasoning behind the solutions, you’ll gain valuable knowledge from this.

Here’s how it works:

Error: We identify the specific error message or issue we encountering.

Scenario Base: We provide a real-world example of how this error might arise in your code, giving you context and helping you identify if it’s relevant to your situation.

Solution: We offer a step-by-step guide or clear explanation of how to resolve the error, often including alternative approaches if applicable.

So, what are you waiting for? Explore the page, conquer those errors, and get back to building amazing things!

Here is our first error,

Error 1 (StorageException):
Issue
: StorageException: The server failed to authenticate the request. Make sure the value of the Authorization header is formed correctly including the signature.

When I got this error: While copying a blob using a C# URL and SAS token crashed and burned because the token expired.

Solution: The SAS Token expired and a new one was created. Now, the issue has been resolved.

Example Blob URL with SAS Token:
http://127.0.0.1:10000/devstoreaccount1/dnav/25576-CAC-09222023085629424.JSON?sv=2018-03-28&st=2023-12-19T10%3A54%3A27Z&se=2022-01-05T10%3A54%3A00Z&sr=b&sp=r&sig=Iske%2F%2FTqDLslTOYGxCne5n8k5Gu%2FsDKcPm5VPIfR0uE%3D

Error 2 (ArgumentException):
Issue: Keyword not supported: ‘multiple active result sets’
at: System.ArgumentException: at system.Data.Common.DbConnectionOptions.ParseInternal

Scenario I faced: Importing Excel data to SQL in C# worked fine locally, but crashed in Dev because I used the old System.Data.SqlClient data provider

Answer: I just changed to Microsoft.Data.Sqlclient and it worked for me.

Error 3:
AZFW0001 The attribute ‘HttpTriggerAttribute’ is a WebJobs attribute and not supported in the .NET Worker (Isolated Process).

Scenario I faced: HttpTrigger migration error! Migrated from In-Process to Isolated in Azure Functions.

Solution: Change the namespace from Microsoft.Azure.WebJobs.Extensions.Http to Microsoft.Azure.Functions.Worker.Http

Note: In the Isolated Model, there is no need to have *.WebJobs.* namespaces.

Error 4: Newtonsoft.Json.JsonSerializationException: Unable to find a constructor to use for type Namespace.Models.Recipient. A class should either have a default constructor, one constructor with arguments, or a constructor marked with the JsonConstructor attribute. Path ‘Recipients[0].displayName’, line 9, position 26.

Scenario: {
“Recipients”: [
{
“DisplayName”: “Test”,
“EmailAddress”: “abc@abc.com”,
“ReceipentType”: 0
},
{
“DisplayName”: “Test1”,
“EmailAddress”: “abc1@abc.com”,
“ReceipentType”: 1
}
]
}

Solution: After we added the [JsonConstructor] attribute on top of the constructor this issue was resolved.

Error 5:
“error_type”: “System.InvalidOperationException”, “error_message”: “SET Columns not defined. If one or more columns should be updated to thiers default value use ‘updateColumns’ argument.”,

Query:
db.FileDetails.Where(x=> fileIds.Contains(x.Id).BatchUpdateAsync(new FileDetails{ status = “Restore”});

Solution:
db.FileDetails.Where(x=> fileIds.Contains(x.Id).BatchUpdateAsync(y => new FileDetails{ status = “Restore”});

Error 6: Failed to decrypt settings. Encrypted settings only be edited through ‘func settings add’.

The issue occured in Azure Functions: I missed one of the properties to add in local.settings.json

Solution: Inside this local.settings.json file,
{
“IsEncrypted”: false
}

Error 7: No job functions found. Try making your job classes and methods public. If you’re using binding extensions (e.g. Azure Storage, ServiceBus, Timers, etc.) make sure you’ve called the registration method for the extension(s) in your startup code (e.g. builder.AddAzureStorage(), builder.AddServiceBus(), builder.AddTimers(), etc.).

This issue is in Azure Function: When you run your Azure function you see this error in the console window

Solution: Add local.settings.json file to your project and mainly include runtime property: “FUNCTIONS_WORKER_RUNTIME”: “dotnet-isolated”.
Also, add this file or any files you need to access in the application you must place these in the bin folder.

Note: In my case, I used this runtime, you can keep based on your requirement in that file.

Error 8: Failed to load NLog LoggingConfiguration. Searched the following locations: - /site/wwwroot\nlog.config

This issue I got in Azure function: AzureWebjobsScriptRoot, we use this property to get the project bin path but a pre-requisite here is one namespace: Microsoft.Azure.Functions.Woker.Sdk unfortunately I removed it and ran the application, After that, I got the following error.

Solution: Keep that namespace and you get the path similar to below,
D:\Projects\2024\<ProjectNamespace>\<Sub>\bin\Debug\net6.0

Error 9: fail: Microsoft.Azure.Functions.Worker.FunctionsApplication[2]
[2023–12–21T10:13:56.367Z] Function ‘RequestFunction’, Invocation id ‘8679baaf-9b0e-439f-a198-a2fde78d42f0’: An exception was thrown by the invocation.
[2023–12–21T10:13:56.370Z] System.UriFormatException: Invalid URI: The URI is empty.

Solution: This issue I got in Azure Function, I missed a few configuration sections in appsettings.json file that contain a URL. After I added that this issue was resolved.

Error 10: 413 Request Entity Too Large.
By default, MaxRequestBodySize property upload size is 28.6 MB. Whe you try more than this size you might see this error. We got this issue while we tried uploading 50MB and 100MB files.

Framework: .NET Core
API: Core web API
Language: C#

Solution:
1.
We added the following in startup.cs at ConfigureServices method
services.Configure<IISServerOptions>(settings =>
{
settings.MaxRequestBodySize = configuration.GetValue<long>(“InputFileMaxSize”);
});

2. Next we added on top of the action method
[RequestSizeLimit(100 * 1024 * 1024)] // 100 MBytes

Finally, it accepts a 100MB file and processes the request without any issues. :)

Error 11: System.ObjectDisposedException
HResult=0x80131622
Message=Cannot access a disposed context instance. A common cause of this error is disposing of a context instance that was resolved from dependency injection and then later trying to use the same context instance elsewhere in your application. This may occur if you are calling ‘Dispose’ on the context instance, or wrapping it in a using statement. If you are using dependency injection, you should let the dependency injection container take care of disposing of context instances.
Object name: ‘ApiCalculatorDbContext’.
Source=Microsoft.EntityFrameworkCore

The issue occured in Azure Functions, we got this issue because our functions are not async and await.

Wrong code:
public void Run([ServiceBusTrigger(“d-de-ev”, “sub”, Connection = “azurewebjobservicebus”)] string myQueueItem)
{
_service.UpdateRecords();
}
Modified code and solution:
public async Task Run([ServiceBusTrigger(“d-de-ev”, “sub”, Connection = “azurewebjobservicebus”)] string myQueueItem)
{
await _service.UpdateRecords();
}

Error 12: “error_message”: “The value for one of the HTTP headers is not in the correct format.\nRequestId:0353250e-9e25–4c08–9bd0-f272b29e54af\nTime:2024–01–08T10:49:44.207Z\r\nStatus: 400 (The value for one of the HTTP headers is not in the correct format.)

Reason for this issue: Outdated version of using azurite

Solution: After we updated azurite then this issue was resolved. To update azurite in Windows, use the following command,
Command: npm update -g azurite

Note: Stop the existing azurite and close the current command prompt. Reopen and run the azurite command

Error 13:
System.Data.SqlTypes.SqlNullValueException
Data is Null. This method or property cannot be called on Null values.

The issue occured because one of the database table columns was nullable and if any of the rows had null in that column we got this issue.

Reason: Defined this column in the entity as int datatype but it should be int? (Nullable int) datatype.

Solution: After we made this change this issue was resolved. If that column value is null then in JSON as default behavior that column might not show in the API response.

This is just the tip of the iceberg! Buckle up, because we’re diving deeper into a treasure trove of errors in upcoming articles.

To ensure comprehensive coverage and easy access, we’ve divided the errors into multiple focused articles, highlighting each one’s impact and practical solutions.

Stay tuned and don’t forget to bookmark these articles for your error-busting toolkit!

What errors have you encountered that you’d love to see us explore? Share your thoughts in the comments below!

Remember, knowledge is power, and knowing your errors is the first step to mastering them. Let’s conquer these errors together.

— Happy Learning :)

--

--

Nuthan Murarysetty

I love sharing things what I know to others and passionate in photography.