When upgrading to the latest versions of the asp.net-5 stack, I encountered the following stack trace while attempting to access my SignalR hub.
FileNotFoundException: Could not load file or assembly 'Microsoft.AspNet.Security.DataProtection, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMarkHandle stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName, ObjectHandleOnStack type)
System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName)
System.RuntimeType.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark)
System.Type.GetType(String typeName, Boolean throwOnError)
Microsoft.AspNet.DataProtection.KeyManagement.XmlKeyManager.ParseKeyElement(XElement keyElement)
Microsoft.AspNet.DataProtection.KeyManagement.XmlKeyManager.GetAllKeys()
Microsoft.AspNet.DataProtection.KeyManagement.KeyRingProvider.CreateCachedKeyRingInstanceUnderLock(DateTime utcNow, CachedKeyRing existingCachedKeyRing)
Microsoft.AspNet.DataProtection.KeyManagement.KeyRingProvider.GetCurrentKeyRing()
Microsoft.AspNet.DataProtection.KeyManagement.KeyRingBasedDataProtector.Protect(Byte[] unprotectedData)
Microsoft.AspNet.SignalR.Infrastructure.DataProtectionProviderProtectedData.Protect(String data, String purpose)
I understand that this assembly has been renamed Microsoft.AspNet.DataProtection and I see from the aspnet github repositories that this change SEEMS to have rippled through the other projects.
I have deleted all references to the old assembly, searched the ENTIRE contents of the .k directory, my project directory, my GAC, EVERYTHING.
Of course, after 4 hours of trying to figure this out, I discover the bizarre cause of it right after I post the question:
The reason why scouring my entire hard drive for any possible mention of the old assembly turned up nothing is because the reference to it was cleverly ENCRYPTED in an XML file in my %APPDATA% directory created by the old version of the assembly!
When upgrading to the new version with the new assembly name, you MUST delete the contents of the directory: %APPDATA%\Local\ASP.NET\keys-BETA or you will end up with this error! The xml file in this directory contains an encrypted representation of the assembly-qualified classname of the decryptor, which will be using the old "Security.DataProtection" assembly instead of the new one.
Similar to Avi Cherry, I found I had this problem moving from .NET Core (DNX) RC1 to (DotNet) RC2.
The directory I needed to delete was %localappdata%\ASP.NET\DataProtection-Keys.
The xml inside referenced Microsoft.AspNet.Security.DataProtection, which was should have been Microsoft.AspNetCore.... Instead of trying to change it, I just removed the directory.
I can't comment on the other answers, so need to add my own.
As others have said you need to delete the CONTENTS of the
%localappdata%\ASP.NET\DataProtection-Keys
directory.
But do NOT delete the entire folder. This can cause issues for dotnetcore apps later. Visual Studio may say "debugging is starting" and just hang.
Related
As my first task working with vb.net, I was assigned the job of migrating a VB6 project over to vb.net using Visual Studio 2008. I am now working with Visual Studio 2017 and have gone through and cleared up all of the Upgrade Warnings that the conversion process gave me. The only remaining issues I have are with two instances of "Class Not Registered" Exceptions.
Things to note:
the original vb6 program was on a Windows XP machine. I am currently working on a Windows 7 64bit system.
I have read a couple of other posts here and here, but I haven't been able to solve my issue.
This warning is more specifically related to a Design view of a form
I believe the issue is probably something to do with a missing dll, as I had to move the source code to another computer to do the debugging.
Here is the call stack if anyone can help point me in the right direction:
Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))
Instances of this error (2)
1. Hide Call Stack
at System.Windows.Forms.UnsafeNativeMethods.CoCreateInstance(Guid& clsid, Object punkOuter, Int32 context, Guid& iid)
at System.Windows.Forms.AxHost.CreateInstanceCore(Guid clsid)
at System.Windows.Forms.AxHost.CreateInstance()
at System.Windows.Forms.AxHost.GetOcxCreate()
at System.Windows.Forms.AxHost.set_Site(ISite value)
at System.ComponentModel.Container.Add(IComponent component, String name)
at System.ComponentModel.Design.DesignerHost.PerformAdd(IComponent component, String name)
at System.ComponentModel.Design.DesignerHost.System.ComponentModel.Design.IDesignerHost.CreateComponent(Type componentType, String name)
at System.ComponentModel.Design.Serialization.DesignerSerializationManager.CreateInstance(Type type, ICollection arguments, String name, Boolean addToContainer)
at System.ComponentModel.Design.Serialization.DesignerSerializationManager.System.ComponentModel.Design.Serialization.IDesignerSerializationManager.CreateInstance(Type type, ICollection arguments, String name, Boolean addToContainer)
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeInstance(IDesignerSerializationManager manager, Type type, Object[] parameters, String name, Boolean addToContainer)
at System.ComponentModel.Design.Serialization.ComponentCodeDomSerializer.DeserializeInstance(IDesignerSerializationManager manager, Type type, Object[] parameters, String name, Boolean addToContainer)
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeExpression(IDesignerSerializationManager manager, String name, CodeExpression expression)
at System.ComponentModel.Design.Serialization.CodeDomSerializer.DeserializeStatementToInstance(IDesignerSerializationManager manager, CodeStatement statement)
at System.ComponentModel.Design.Serialization.CodeDomSerializer.Deserialize(IDesignerSerializationManager manager, Object codeObject)
at System.Windows.Forms.Design.ControlCodeDomSerializer.Deserialize(IDesignerSerializationManager manager, Object codeObject)
at System.ComponentModel.Design.Serialization.TypeCodeDomSerializer.DeserializeName(IDesignerSerializationManager manager, String name, CodeStatementCollection statements)
Thanks for the help!
I have not used my Visual Studio 2010 for 2 weeks. Did not even touch my computer and now I am trying to work on a project.
Loaded in the project and none of the errors are shown (not even in the errorlist window). When I click build it says: build succeeded (but a bit too fast for my saying). I have tried to reload the references and even created a new project and copied the code in to it. None of this works. If I then run the project I get current error:
A first chance exception of type 'System.MissingMemberException' occurred in Microsoft.VisualBasic.dll
System.MissingMemberException: Der öffentliche Member Domains für den Typ Iref wurde nicht gefunden.
bei Microsoft.VisualBasic.CompilerServices.LateBinding.LateGet(Object o, Type objType, String name, Object[] args, String[] paramnames, Boolean[] CopyBack)
bei Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateGet(Object Instance, Type Type, String MemberName, Object[] Arguments, String[] ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack)
bei myprogram.myfunction() in projectpath/myprogram.vb:Line 132.
Iref is a reference and I am 100 procent sure that the Domains member still exists in this reference.
Anyone have any ideas how I can fix this?
Fixed this by putting on the Option Strict to ON.
Not really the best solution but will do for the meanwhile
I encountered the same problem. I solved this by changing the Active Solution Platform to Mixed Platform. To do so, go to Configuration Manager and set the Active Solution Platform in the upper right corner.
I am just trying to run a simple NServiceBus Pub/Sub example. Basically, I have pub/sub as console apps and when i run them I am getting an exception on sub side.
Exception was unhandled by user code
Message=Exception when starting endpoint, error has been logged. Reason: Error creating object with name 'NServiceBus.Unicast.UnicastBus' : Error setting property values: PropertyAccessExceptionsException (1 errors); nested PropertyAccessExceptions are:
[Spring.Core.TypeMismatchException: Cannot convert property value of type [System.Collections.Hashtable] to required type [System.Collections.IDictionary] for property 'MessageOwners'., Inner Exception: System.ArgumentException: Problem loading message assembly: Messages ---> System.IO.FileNotFoundException: Could not load file or assembly 'Messages' or one of its dependencies. The system cannot find the file specified.
File name: 'Messages'
at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.Load(String assemblyString)
at NServiceBus.Unicast.UnicastBus.ConfigureMessageOwners(IDictionary owners) in d:\BuildAgent-02\work\20b5f701adefe8f8\src\unicast\NServiceBus.Unicast\UnicastBus.cs:line 1204
Looks like I am missing assembly called "Messages", but I am not sure where I could find it.
Thanks.
It's most likely that you have "Messages" specified in the UnicastBusConfig (maybe left over from copying the config from one of the samples).
I'm not exactly what the issue is, HOWEVER, you must make sure that your Message Types are in a separate assembly, and that your Message classes Implement the NServiceBus IMessage Interface.
Also, both your Pub and Sub need to reference your Messages assembly (which you can call anything obviously, you don't have to call it Messages).
I am following the steps as outlined on MSDN Blogs > ADO.NET team blog > Walkthrough: POCO Template for the Entity Framework.
I created a simple model in the Keith.Data Project (and Namespace). I created a Keith.Model Project and added it to the solution, dropped the Class.cs file, dragged and dropped the DataEntities.tt file into the Keith.Model project and added a reference to Keith.Model in my Keith.Data project. I then changed the path reference in the DataEntities.tt file from #"DataModel.edmx" to #"..\Keith.Data\DataModel.edmx". When I saved it I got this error:
Running transformation: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.FileNotFoundException: Unable to locate file
at Microsoft.VisualStudio.TextTemplating.VSHost.TextTemplatingService.ResolvePath(String path)
at Microsoft.VisualStudio.TextTemplating.VSHost.TextTemplatingService.ResolvePath(String path)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
at System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Microsoft.VisualStudio.TextTemplating6A60439B68BD2BCE671B842FB15E35C4.GeneratedTextTransformation.DynamicHost.ResolvePath(String path)
at Microsoft.VisualStudio.TextTemplating6A60439B68BD2BCE671B842FB15E35C4.GeneratedTextTransformation.MetadataLoader.TryCreateEdmItemCollection(String sourcePath, String[] referenceSchemas, EdmItemCollection& edmItemCollection)
at Microsoft.VisualStudio.TextTemplating6A60439B68BD2BCE671B842FB15E35C4.GeneratedTextTransformation.MetadataLoader.CreateEdmItemCollection(String sourcePath, String[] referenceSchemas)
at Microsoft.VisualStudio.TextTemplating6A60439B68BD2BCE671B842FB15E35C4.GeneratedTextTransformation.TransformText()
at Microsoft.VisualStudio.TextTemplating.TransformationRunner.RunTransformation(TemplateProcessingSession session, String source, ITextTemplatingEngineHost host, String& result)
Anyone run into this and know what the problem is? I am sure I missed something but for the life of me I cannot figure out what.
TIA
I replicated the scenario you mentioned and got the same error when the Path to the .edmx file in POCO.tt (DataEntities.tt in your scenario) was wrong. Double check if the path you have specified is correct.
I use EF4/POCO but have all my entitites defined in code not an edmx so I'm not an expert in the approach you're using...
That said, a simple way to identify what the app is doing: download the sysinternals Proces Monitor and point it at VS - then have a look at what files it's trying to access (filter on DataModel.edmx). This will at least tell you where it's expecting the file to be - it's possible your relative path is incorrect.
I'm sure other devs with more experience in this topic can give you a better answer but this is how I'd approach solving it...
i searched several hours four solution and nothing found. If I open WPF Designer in my VS2008 Team Suite SP1 I become following error:
Loading this assembly would produce a
different grant set from other
instances. (Exception from HRESULT:
0x80131401) at
System.RuntimeTypeHandle.CreateInstance(RuntimeType
type, Boolean publicOnly, Boolean
noCheck, Boolean& canBeCached,
RuntimeMethodHandle& ctor, Boolean&
bNeedSecurityCheck) at
System.RuntimeType.CreateInstanceSlow(Boolean
publicOnly, Boolean fillCache) at
System.RuntimeType.CreateInstanceImpl(Boolean
publicOnly, Boolean
skipVisibilityChecks, Boolean
fillCache) at
System.Activator.CreateInstance(Type
type, Boolean nonPublic) at
System.RuntimeType.CreateInstanceImpl(BindingFlags
bindingAttr, Binder binder, Object[]
args, CultureInfo culture, Object[]
activationAttributes) at
System.Activator.CreateInstance(Type
type, BindingFlags bindingAttr, Binder
binder, Object[] args, CultureInfo
culture, Object[]
activationAttributes) at
System.Activator.CreateInstance(String
assemblyName, String typeName, Boolean
ignoreCase, BindingFlags bindingAttr,
Binder binder, Object[] args,
CultureInfo culture, Object[]
activationAttributes, Evidence
securityInfo, StackCrawlMark&
stackMark) at
System.Activator.CreateInstance(String
assemblyName, String typeName) at
System.AppDomain.CreateInstance(String
assemblyName, String typeName) at
System.AppDomain.CreateInstanceAndUnwrap(String
assemblyName, String typeName) at
System.AppDomain.CreateInstanceAndUnwrap(String
assemblyName, String typeName) at
MS.Internal.Package.VSIsolationProviderService.CreateIsolationProvider(String
identity, AssemblyReferenceProvider
assemblyReferences, IEnumerable`1
assemblyFolders) at
MS.Internal.Providers.VSDesignerContext.GetIsolationProvider(IServiceProvider
provider, IVsHierarchy hierarchy,
AssemblyReferenceProvider
assemblyReferences, Boolean
isSilverlightProject) at
MS.Internal.Providers.VSDesignerContext.GetIsolationProvider(IServiceProvider
provider, IVsHierarchy hierarchy,
AssemblyReferenceProvider
assemblyReferences) at
MS.Internal.Providers.VSDesignerContext.Initialize(IServiceProvider
provider, IVsHierarchy hierarchy,
UInt32 itemid, Object docDataObj)
at
MS.Internal.Providers.VSDesignerContext..ctor(IServiceProvider
provider, IVsWindowFrame frame, Object
docDataObj) at
MS.Internal.Providers.VSDesignerContext.GetContext(IServiceProvider
services, IVsWindowFrame frame,
Boolean createIfNotExist) at
MS.Internal.Designer.DesignerPane.InitializeDesigner()
What I tried to this moment:
Reset all settings in Visual Studio
Closed any open XAML files in project, closed Visual Studio, re-opened VS, opened XAML file
Create new user in operating system and try open solution with them
Completed uninstallation/reinstallation of VS 2008 SP1 + MSDN, .NET 3.5 Framework SP1, Silverlight SDK, WPF Toolkit - January 2009
I run on Windows Vista SP1 32bit Business Edition.
Do any have a idea how can I solve it before I would try reinstalling operation system?
Regards
Anton Kalcik
UPDATE: Also I tried to disable all add-ons.
First of all not only you receive this error so may be you should google it first? As you can see there are many behaviors of this problem and we are not able to figure out what is wrong in your case because it's hard to reproduce the problem. Also you may try to repair you VS or disable all your addins
Thanks for explaining what attempts failed. Saves me the hours and false hope.
Have you tried reinstalling VS without SP1? (You bet it's SP1's fault, this never happened before I updated VS)
Also your designer doesn't work on ANY project right? Even new ones? And in other prog languages too?