0

私は、Microsoft Visual Studio Community 2017のASP.NETサンプルプロジェクトに取り組んでいます。現在作業中のプロジェクトは昨日正常に実行されていました。今日プロジェクトを開いたときに、すぐにメッセージボックスが表示されます。EntityFrameworkCore.InMemory System.ArgumentException

プロジェクトシステムにエラーが発生しました。

同じキーで異なる値を持つ要素は既に存在します。診断ログが書き込まれた

Microsoft.EntityFrameworkCore.InMemory:キー

===================== 
Crippling 
System.AggregateException: One or more errors occurred. ---> System.ArgumentException: An element with the same key but a different value already exists. Key: Microsoft.EntityFrameworkCore.InMemory 
    at System.Collections.Immutable.ImmutableDictionary`2.HashBucket.Add(TKey key, TValue value, IEqualityComparer`1 keyOnlyComparer, IEqualityComparer`1 valueComparer, KeyCollisionBehavior behavior, OperationResult& result) 
    at System.Collections.Immutable.ImmutableDictionary`2.AddRange(IEnumerable`1 items, MutationInput origin, KeyCollisionBehavior collisionBehavior) 
    at System.Collections.Immutable.ImmutableDictionary`2.AddRange(IEnumerable`1 pairs, Boolean avoidToHashMap) 
    at System.Collections.Immutable.ImmutableDictionary`2.AddRange(IEnumerable`1 pairs) 
    at Microsoft.VisualStudio.ProjectSystem.Designers.ProjectBuildSubscriptionService.UpdateRuleSnapshotCore(IProjectVersionedValue`1 source, String ruleName, IRule rule, ImmutableDictionary`2 items, ImmutableDictionary`2 properties, ImmutableList`1 recentItemRenames, IProjectChangeDiff& diff) 
    at Microsoft.VisualStudio.ProjectSystem.Designers.ProjectRuleSubscriptionServiceBase`1.UpdateSnapshotCoreAsync(TSource source, IImmutableSet`1 subscribedElements, IProjectVersionedValue`1 previousResult) 
    at Microsoft.VisualStudio.ProjectSystem.Designers.CustomizableBlockSubscriberBase`3.<UpdateSnapshotAsync>d__28.MoveNext() 
--- End of stack trace from previous location where exception was thrown --- 
    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) 
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) 
    at Microsoft.VisualStudio.ProjectSystem.Designers.CustomizableBlockSubscriberBase`3.<>c__DisplayClass27_0.<<Initialize>b__1>d.MoveNext() 
--- End of stack trace from previous location where exception was thrown --- 
    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) 
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) 
    at Microsoft.VisualStudio.Threading.JoinableTask.<JoinAsync>d__76.MoveNext() 
--- End of stack trace from previous location where exception was thrown --- 
    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) 
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) 
    at Microsoft.VisualStudio.Threading.JoinableTask`1.<JoinAsync>d__3.MoveNext() 
--- End of stack trace from previous location where exception was thrown --- 
    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) 
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) 
    at Microsoft.VisualStudio.ProjectSystem.Designers.CustomizableBlockSubscriberBase`3.<<Initialize>b__27_0>d.MoveNext() 
--- End of stack trace from previous location where exception was thrown --- 
    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) 
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) 
    at Microsoft.VisualStudio.ProjectSystem.DataflowExtensions.<>c__DisplayClass23_0`2.<<CreateSelfFilteringTransformBlock>b__0>d.MoveNext() 
--- End of stack trace from previous location where exception was thrown --- 
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() 
    at Microsoft.VisualStudio.ProjectSystem.CommonProjectSystemTools.Rethrow(Exception ex) 
    at Microsoft.VisualStudio.ProjectSystem.ProjectErrorReporting.<>c__DisplayClass6_0.<SubmitErrorReport>b__0() 
    at Microsoft.VisualStudio.ProjectSystem.ExceptionFilter.<>c__DisplayClass2_0.<Guard>b__0() 
    at GuardMethodClass.GuardMethod(Func`1 , Func`2 , Func`2) 
    --- End of inner exception stack trace --- 
---> (Inner Exception #0) System.ArgumentException: An element with the same key but a different value already exists. Key: Microsoft.EntityFrameworkCore.InMemory 
    at System.Collections.Immutable.ImmutableDictionary`2.HashBucket.Add(TKey key, TValue value, IEqualityComparer`1 keyOnlyComparer, IEqualityComparer`1 valueComparer, KeyCollisionBehavior behavior, OperationResult& result) 
    at System.Collections.Immutable.ImmutableDictionary`2.AddRange(IEnumerable`1 items, MutationInput origin, KeyCollisionBehavior collisionBehavior) 
    at System.Collections.Immutable.ImmutableDictionary`2.AddRange(IEnumerable`1 pairs, Boolean avoidToHashMap) 
    at System.Collections.Immutable.ImmutableDictionary`2.AddRange(IEnumerable`1 pairs) 
    at Microsoft.VisualStudio.ProjectSystem.Designers.ProjectBuildSubscriptionService.UpdateRuleSnapshotCore(IProjectVersionedValue`1 source, String ruleName, IRule rule, ImmutableDictionary`2 items, ImmutableDictionary`2 properties, ImmutableList`1 recentItemRenames, IProjectChangeDiff& diff) 
    at Microsoft.VisualStudio.ProjectSystem.Designers.ProjectRuleSubscriptionServiceBase`1.UpdateSnapshotCoreAsync(TSource source, IImmutableSet`1 subscribedElements, IProjectVersionedValue`1 previousResult) 
    at Microsoft.VisualStudio.ProjectSystem.Designers.CustomizableBlockSubscriberBase`3.<UpdateSnapshotAsync>d__28.MoveNext() 
--- End of stack trace from previous location where exception was thrown --- 
    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) 
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) 
    at Microsoft.VisualStudio.ProjectSystem.Designers.CustomizableBlockSubscriberBase`3.<>c__DisplayClass27_0.<<Initialize>b__1>d.MoveNext() 
--- End of stack trace from previous location where exception was thrown --- 
    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) 
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) 
    at Microsoft.VisualStudio.Threading.JoinableTask.<JoinAsync>d__76.MoveNext() 
--- End of stack trace from previous location where exception was thrown --- 
    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) 
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) 
    at Microsoft.VisualStudio.Threading.JoinableTask`1.<JoinAsync>d__3.MoveNext() 
--- End of stack trace from previous location where exception was thrown --- 
    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) 
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) 
    at Microsoft.VisualStudio.ProjectSystem.Designers.CustomizableBlockSubscriberBase`3.<<Initialize>b__27_0>d.MoveNext() 
--- End of stack trace from previous location where exception was thrown --- 
    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) 
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) 
    at Microsoft.VisualStudio.ProjectSystem.DataflowExtensions.<>c__DisplayClass23_0`2.<<CreateSelfFilteringTransformBlock>b__0>d.MoveNext() 
--- End of stack trace from previous location where exception was thrown --- 
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() 
    at Microsoft.VisualStudio.ProjectSystem.CommonProjectSystemTools.Rethrow(Exception ex) 
    at Microsoft.VisualStudio.ProjectSystem.ProjectErrorReporting.<>c__DisplayClass6_0.<SubmitErrorReport>b__0() 
    at Microsoft.VisualStudio.ProjectSystem.ExceptionFilter.<>c__DisplayClass2_0.<Guard>b__0() 
    at GuardMethodClass.GuardMethod(Func`1 , Func`2 , Func`2)<--- 

=================== 

はまた、このようなエラーを与え、私の使用してシステムのディレクティブとMicrosoftの名前空間のすべてのようないくつかの他の問題を引き起こした:

型または名前空間名「システム」を見つけることができる(あなたがusingディレクティブまたはアセンブリ参照が不足している?)

これらのディレクティブは他のプロジェクトでも問題なく動作しているため、EntityFrameworkの問題が修正されたときに、それらの指示が崩れると思われます。

私はVisual Studioとコンピュータの両方を再起動しようとしましたが、とにかくプロジェクトを構築しようとしました。プロジェクトへの参照を追加できません。操作がまだ正常に動作しているプロジェクト内の名前空間へ

参照を完了できませんでした

タスクが

キャンセルされました:私は、メッセージボックスを受け取ります。

ありがとうございました。

答えて

1
  1. 閉じるVS.

  2. は 外部のテキストエディタを経由して、プロジェクトファイル(csprojファイルまたはproject.json)を開き、重複したパッケージ参照を削除します。

  3. Reopen VS.すべて正常に動作するはずです。

csprojファイルを使用する場合 - このような行を探します。

<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="1.1.1" /> 
+0

ありがとうございました。これはうまくいった。 – MadKeys

関連する問題