Migration ASP.NET Core 6.0 to 7.0 - automapper

Project works fine in ASP.NET Core 6.0 but when I tried to migrate it to 7.0, it builds successfully without errors but at runtime I got this error:
Message "GenericArguments[0], 'AbilityFix.Model.Models.Forums', on 'T MaxIntegerT' violates the constraint of type 'T'." string
InnerException {"Method System.Linq.Enumerable.MaxInteger: type argument 'AbilityFix.Model.Models.Forums' violates the constraint of type parameter 'T'."}
System.Exception {System.Security.VerificationException}
Error in startup.cs file
services.AddAutoMapper(mapperConfig => mapperConfig.AddProfiles(GetType().Assembly));

Related

Parser Error Message: Could not load type 'MvcInterop.InteropMasterPage'

I am receiving this error when running an ASP.NET MVC 5.27 application. I am running Visual Studio 2017. I have all the web developer tools installed for Visual Studio.
Server Error in '/' Application.
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: Could not load type 'MvcInterop.InteropMasterPage'.

Profile Base GetProfile command throws null type in CreateInstance

I am working on a web application that uses built-in security classes to create new users
newuser = MembershipUser.Create(relevant parameters)
that is all well and good
it then issues a Profile.GetProfile(newuser.UserName)
which drills down to a
System.Activator.CreateInstance(Type type, Boolean nonPublic)
which throws a
Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.ArgumentNullException: Value cannot be null.
Parameter name: type
it works fine in dev (visual Studio 2015 Community)
the current site was developed on an older machine, probably Visual Studio 2010
and works just fine
why am I getting these errors - and how do I fix it?

Unity 3.5 not resolving controllers

I have taken the following example code from the Unity documentation, and yet a basic controller can't be instantiated with a service implementation as a required constructor dependency.
public static void RegisterTypes(IUnityContainer container)
{
container.RegisterTypes(
AllClasses.FromLoadedAssemblies(),
WithMappings.FromMatchingInterface,
WithName.TypeName,
WithLifetime.ContainerControlled);
}
This gives the error Exception information:
Exception type: ResolutionFailedException Exception message:
Resolution of the dependency failed, type =
"[XXX].Controllers.HomeController", name = "(none)". Exception
occurred while: Calling constructor
Microsoft.Practices.Unity.InterceptionExtension.PolicyInjectionBehavior(Microsoft.Practices.Unity.InterceptionExtension.CurrentInterceptionRequest
interceptionRequest,
Microsoft.Practices.Unity.InterceptionExtension.InjectionPolicy[]
policies, Microsoft.Practices.Unity.IUnityContainer container).
Exception is: ArgumentException - Type passed must be an interface
This is an MVC5 application and i have the latest Nuget packages for Unity and the bootstrapper
in order to get this working we switched the WithName parameter to use Default as the passed value.

'ViewBag' It may be inaccessible due to its protection level

MVC 5 vb web application
I created a entityFramework migrations where I have a class library for data entities and combined it with the AspNet Identity within the web application. No error so far. I created a IndentityDB that has the defaultConnection and updated the AccountController to point to the connection
(New UserStore(Of ApplicationUser)(New IndentityDB())))
seems to be right with no error on the build except for a enum issue in the classlibrary that I will fix later but I get a error:
'ViewBag' is not declared. It may be inaccessible due to its protection level.
A first chance exception of type 'System.InvalidOperationException'
occurred in System.dll A first chance exception of type
'System.Web.HttpException' occurred in System.Web.dll 'iisexpress.exe'
(CLR v4.0.30319: /LM/W3SVC/32/ROOT-1-130360312907627858): Loaded
'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Data.Services.Design\v4.0_4.0.0.0__b77a5c561934e089\System.Data.Services.Design.dll'.
Cannot find or open the PDB file.
This error happens when I try to login on the home page and any other Authorized Controller

Entity Framework MetadataWorkspace error

Using a Code-First approach with Entity Framework 5 for a Silverlight to WCF RIA Services project. During solution build, I receive the following error and warning:
Warning
No persistent classes found. Is the metadata information missing?
Error
Failed to get the MetadataWorkspace for the DbContext type
I'm running off a local Database, and placed the custom connection string information in the constructor for the DbContext.

Resources