.NET Core
Cannot convert from 'long?' to 'long'
I use a code similar to the following to accept the value for a query string named Id on one of my pages of a .NET Razor Page application. It is an optional query string. Its value is then passed to another function for further processing. When I compile the code, I get the error message "cannot convert from 'long?' to 'long'"
Tags: Troubleshooting
Your target project [ProjectName] doesn't match your migrations assembly [AssemblyName]. Either change your target project or change your migrations assembly.
I am working on a project in ASP.NET Core 5.0, which contains a web application and the related class libraries. I use Entity Framework Core for data access. My DbContext is in a class library project. When I run the add-migration command I get this error.
Tags: Troubleshooting
Unable to resolve service for type 'System.Net.Http.HttpClient' while attempting to activate... error
When I tried to register a service that uses an object of System.Net.Http.HttpClient for dependency injection, I got this error "Unable to resolve service for type 'System.Net.Http.HttpClient' while attempting to activate "
Tags: Troubleshooting
The 'async' modifier can only be used in methods that have a body.
I declared a method in my interface using the async modifier and I am getting the error "The 'async' modifier can only be used in methods that have a body"
Tags: Troubleshooting
Solution For Blazor Error - Cannot provide a value for property, There is no registered service of type [TypeName]
While experimenting with Blazor, I ran into "There is no registered service of type [TypeName]" error. I was trying to use a new service on a Blazor component by injecting the service into it.
Tags: Troubleshooting