question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Application crashes if scanned assemblies are duplicated

See original GitHub issue

We have a plugin model that discovers view/viewmodels from external assemblies. If by mistake the assemblies are copied twice (to different discovery locations), the application would blow up with the following stack trace.

The SelectedAssemblies() method uses assemblies where as underlying cache which is the cause of the problem uses the Type name as the key.

System.ArgumentException: An item with the same key has already been added.
   at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at Caliburn.Micro.EnumerableExtensions.Apply[T](IEnumerable`1 enumerable, Action`1 action)
   at Caliburn.Micro.AssemblySourceCache.<>c.<Install>b__3_0(Object s, NotifyCollectionChangedEventArgs e)
   at System.Collections.ObjectModel.ObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
   at Caliburn.Micro.BindableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
   at Caliburn.Micro.BindableCollection`1.OnUIThread(Action action)
   at Caliburn.Micro.BootstrapperBase.StartRuntime()
   at Caliburn.Micro.BootstrapperBase.Initialize()
   at ServiceInsight.Startup.AppBootstrapper..ctor() in /_/src/ServiceInsight/Startup/AppBootstrapper.cs:line 41

A simple fix would be to not add duplicate items to the cache if they already exist.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
vb2aecommented, Jun 24, 2021

@HEskandari thanks for the PR

0reactions
HEskandaricommented, Jun 24, 2021

@KasperSK Raised a PR with a failing test and the fix.

Read more comments on GitHub >

github_iconTop Results From Across the Web

WPF ARM64 app crashes on startup, unless assemblies ...
So, I decided to export as self-contained + not as single file, to be able to scan all assemblies. I simply add a...
Read more >
Scanning application crashes upon close after you perform ...
This issue occurs because, when the scanning application performs a scan, the callbacks that were registered are not released until the scanning application...
Read more >
Windows Explorer crashes when opening folder with a ...
After installing VS17 Update 1, I can no longer open any folder with a Typescript file in it in Windows Explorer (Windows 10)....
Read more >
Software Crashes before the Viewport Is Displayed When ...
When launching BuildIT, the splash screen is shown (or not) and the software crashes before showing the BuildIT interface.
Read more >
App crashes when trying to duplicate layer
When I use the Smart Selection tool with or without refining the selection, if I try to duplicate the selection, the app crashes....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found