Base solution for your next web application
Open Closed

Error while Runing 2 version of ASPZero Applcaition from same repository. #8180


User avatar
0
MellowoodMedical created

Hi ,

I have a development branch and release branch, On development, I have recently updated ASPzero version to 7.2.0 where as in release branch, i have 3.x.x version.

I am having a single repository here. while doing the following steps,

  1. Build and run the applciation on development branch [version 7.2.0] .
  2. Stop the applciation and switch branch to release [verison 3.x.x].
  3. When I try to run the application on release , I am getting the following exception . Could you please verify if this is due to running 2 versions on ASPZERO from single repository and if Yes, do we have a work around for this?

soft.AspNetCore.Hosting.Internal.WebHost - Application startup exception Castle.MicroKernel.ComponentActivator.ComponentActivatorException: ComponentActivator: could not instantiate Microsoft.AspNetCore.Mvc.Internal.MvcEndpointDataSource ---> System.Exception: Could not instantiate Microsoft.AspNetCore.Mvc.Internal.MvcEndpointDataSource. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.FileNotFoundException: Could not load file or assembly 'PatientPortal.Web.Host, Version=7.2.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified. ---> System.IO.FileNotFoundException: Could not load the specified file. at System.Runtime.Loader.AssemblyLoadContext.ResolveUsingEvent(AssemblyName assemblyName) at System.Runtime.Loader.AssemblyLoadContext.ResolveUsingResolvingEvent(IntPtr gchManagedAssemblyLoadContext, AssemblyName assemblyName) --- End of inner exception stack trace --- at System.Reflection.CustomAttribute._CreateCaObject(RuntimeModule pModule, IRuntimeMethodInfo pCtor, Byte** ppBlob, Byte* pEndBlob, Int32* pcNamedArgs) at System.Reflection.CustomAttribute.CreateCaObject(RuntimeModule module, IRuntimeMethodInfo ctor, IntPtr& blob, IntPtr blobEnd, Int32& namedArgs) at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes) at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeAssembly assembly, RuntimeType caType) at System.Attribute.GetCustomAttributes(Assembly element, Type attributeType, Boolean inherit) at System.Reflection.CustomAttributeExtensions.GetCustomAttributes[T](Assembly element) at Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemLoader.LoadItems(Assembly assembly) at Microsoft.AspNetCore.Mvc.ApplicationParts.RazorCompiledItemFeatureProvider.PopulateFeature(IEnumerable1 parts, ViewsFeature feature) at Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartManager.PopulateFeature[TFeature](TFeature feature) at Microsoft.AspNetCore.Mvc.RazorPages.Internal.CompiledPageRouteModelProvider.GetViewFeature(ApplicationPartManager applicationManager) at Microsoft.AspNetCore.Mvc.RazorPages.Internal.CompiledPageRouteModelProvider.GetViewDescriptors(ApplicationPartManager applicationManager)+MoveNext() at Microsoft.AspNetCore.Mvc.RazorPages.Internal.CompiledPageRouteModelProvider.CreateModels(PageRouteModelProviderContext context) at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionDescriptorProvider.BuildModel() at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionDescriptorProvider.OnProvidersExecuting(ActionDescriptorProviderContext context) at Microsoft.AspNetCore.Mvc.Infrastructure.DefaultActionDescriptorCollectionProvider.UpdateCollection() at Microsoft.AspNetCore.Mvc.Infrastructure.DefaultActionDescriptorCollectionProvider.Initialize() at Microsoft.AspNetCore.Mvc.Infrastructure.DefaultActionDescriptorCollectionProvider.GetChangeToken() at Microsoft.Extensions.Primitives.ChangeToken.OnChange(Func1 changeTokenProducer, Action changeTokenConsumer) at Microsoft.AspNetCore.Mvc.Internal.MvcEndpointDataSource..ctor(IActionDescriptorCollectionProvider actions, MvcEndpointInvokerFactory invokerFactory, ParameterPolicyFactory parameterPolicyFactory) --- End of inner exception stack trace --- at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions) at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) at Castle.Core.Internal.ReflectionUtil.Instantiate[TBase](Type subtypeofTBase, Object[] ctorArgs) --- End of inner exception stack trace --- at Castle.Core.Internal.ReflectionUtil.Instantiate[TBase](Type subtypeofTBase, Object[] ctorArgs) at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateInstanceCore(ConstructorCandidate constructor, Object[] arguments, Type implType) --- End of inner exception stack trace --- at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateInstanceCore(ConstructorCandidate constructor, Object[] arguments, Type implType) at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateInstance(CreationContext context, ConstructorCandidate constructor, Object[] arguments) at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.InternalCreate(CreationContext context) at Castle.MicroKernel.ComponentActivator.AbstractComponentActivator.Create(CreationContext context, Burden burden) at Castle.MicroKernel.Lifestyle.AbstractLifestyleManager.CreateInstance(CreationContext context, Boolean trackedExternally) at Castle.MicroKernel.Lifestyle.SingletonLifestyleManager.Resolve(CreationContext context, IReleasePolicy releasePolicy) at Castle.MicroKernel.Handlers.DefaultHandler.ResolveCore(CreationContext context, Boolean requiresDecommission, Boolean instanceRequired, Burden& burden) at Castle.MicroKernel.Handlers.DefaultHandler.Resolve(CreationContext context, Boolean instanceRequired) at Castle.MicroKernel.DefaultKernel.ResolveComponent(IHandler handler, Type service, IDictionary additionalArguments, IReleasePolicy policy, Boolean ignoreParentContext) at Castle.MicroKernel.DefaultKernel.Castle.MicroKernel.IKernelInternal.ResolveAll(Type service, IDictionary arguments, IReleasePolicy policy) at Castle.Windsor.MsDependencyInjection.ScopedWindsorServiceProvider.ResolveInstanceOrNull(Type serviceType, Boolean isOptional) in D:\Github\castle-windsor-ms-adapter\src\Castle.Windsor.MsDependencyInjection\ScopedWindsorServiceProvider.cs:line 86 at Castle.Windsor.MsDependencyInjection.ScopedWindsorServiceProvider.GetServiceInternal(Type serviceType, Boolean isOptional) in D:\Github\castle-windsor-ms-adapter\src\Castle.Windsor.MsDependencyInjection\ScopedWindsorServiceProvider.cs:line 55 at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider) at Microsoft.AspNetCore.Builder.MvcApplicationBuilderExtensions.UseMvc(IApplicationBuilder app, Action`1 configureRoutes) at PatientPortal.Web.Startup.Startup.Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) in C:\Projects\MellwoodMedical\IdeasPatientPortalv2.0WebAPI\src\PatientPortal.Web.Host\Startup\Startup.cs:line 190 --- End of stack trace from previous location where exception was thrown --- at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.Configure(IApplicationBuilder app) at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()


6 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team

    hi

    After switching branches you need to rebuild the application instead of running it directly.

  • User Avatar
    0
    MellowoodMedical created

    Hi ,

    I have cleaned and reubuild after each run. Still throwing exception.

  • User Avatar
    0
    maliming created
    Support Team

    Can you try dotnet cli to rebuild the project?

    dotnet clean
    dotnet build
    

    Or you can try to switch branches from a new directory so that we can confirm the problem.

  • User Avatar
    0
    MellowoodMedical created

    Hi ,

    Please find the below steps I tried,

    1. Builded and ran the latest version from local directory.
    2. switched branch and ran 'dotnet clean' and 'dotnet build' on older version of ASPZero from same directory.
    3. Throws exception.

    I changed the local directory for older version and I got the applciation up and running. So I assume both newer and older version of applciation will not co-exist on the same local deirectory of source control. Could you guys fix this?

  • User Avatar
    0
    maliming created
    Support Team

    Please try to execute the Delete-BIN-OBJ-Folders.bat file in zero to clean up the solution.

    https://medium.com/volosoft/deleting-all-bin-obj-folders-in-a-solution-93e401372e69

  • User Avatar
    0
    ismcagdas created
    Support Team

    This issue is closed because it has not had recent activity for a long time.