Azure-Samples / azure-cache-redis-samples

This repository contains samples that demonstrate best practices and general recommendations to communicate with Azure Redis Cache Service caches from various Redis client frameworks.
MIT License
69 stars 156 forks source link

fix bundle issue and NullReferenceException #21

Closed stanleysmall-microsoft closed 2 years ago

stanleysmall-microsoft commented 2 years ago

Hi All,

Can you please advise if the samples can work correctly. Already, for ASP sample, in VS 2022 after struggling with missing bundles/scripts not found virtual directory, it fails on the line 149 of azure-cache-redis-samples of redisConnection.cs I followed the instructions for "cache-web-app-aspnet-core-howto" it builds and run then when clicking on "Azure Cache for Redis Test", I get

azure-cache-redis-samples/quickstart/aspnet at main · Azure-Samples/azure-cache-redis-samples · GitHub

In the ASP sample, execution jumps from line

await redisConnection.ForceReconnectAsync(initializing: true);

right away to

await oldConnection?.CloseAsync();

with the following error on line 149 :

System.NullReferenceException HResult=0x80004003 Message=Object reference not set to an instance of an object. Source=ContosoTeamStats StackTrace: at ContosoTeamStats.RedisConnection.d__14.MoveNext() in C:\Projects\AzureDevOpsProjects\Redis\aspnet\ContosoTeamStats\RedisConnection.cs:line 149

stanleysmall-microsoft commented 2 years ago

This change includes features from #19 @philon-msft