Image 1 — Autofac Not Resolving IIndex<>
Image 2 — Autofac Not Resolving IIndex<>
▲ 0 r/csharp

Autofac Not Resolving IIndex<>

Solved!

The solution, courtesy of u/kant8, is to resolve an `IList` or `IEnumerable` of the registered types, not a `List`. Because trying to resolve a concrete type like a `List` sends Autofac hunting for the corresponding list registered as itself. Which won't work.

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

I've registered a number of types via a common interface they share, keyed by different byte values:

builder.RegisterType(concreteType)
.Keyed<IJpgSegmentGenerator>(id)
.As<IJpgSegmentGenerator>()
.SingleInstance();

concreteType is the type being registered. All concrete types share a common interface, IJpgSegmentGenerator. id is a byte value distinguishing the different concrete types, some of which share the same key (which I’ve read online Autofac supports…unless the references I found are wrong 😀).

The registrations are successful, because after building the Autofac container I can see the registrations via Container.ComponentRegistry.Registrations (see first image in gallery above).

The individual registrations show the correct byte keys (see second image in gallery above for a zoomed in view of one registration).

However, the following code fails to resolve IIndex

var lazyList = Container.Resolve<IIndex<byte, List<Lazy<IJpgSegmentGenerator>>>>();

lazyList.TryGetValue( 237, out var generators ).Should().BeTrue();

(The above code is inside an XUnit test, hence the Should() reference)

I've checked that the service type is specified identically in both the registration and resolution code, and unless I'm going blind they sure seem to match, as does the type of the key. I've also tried not resolving to Lazy<>, and that fails to.

Thoughts?

u/MotorcycleMayor — 1 day ago
▲ 4 r/csharp+1 crossposts

Autofac: Accessing metadata on lazy-loaded multiple services sharing same key

I have a need to register/resolve multiple services that sometimes share the same key. The services also need to by lazy-loaded...and I need to access the key values before instantiating any of the services.

The following pattern registers/resolves the lazy-loaded multiple services sharing the same key. But it does not allow me to access the key values before instantiation because IIndex<>, while it allows lookup via key values, does not expose the keys themselves:

// registration phase snippet (id is the key value, which can be of  
// any type which supports IEquatable&lt;&gt;)
var id = baseGenArgs[ 0 ].GetCustomAttribute&lt;PsdSegmentAttribute&gt;( false )?.SequenceNumber  
    ?? throw new     RequiredAttributeMissingException&lt;PsdSegmentAttribute&gt;( baseGenArgs[ 0 ] );

builder.RegisterType( generatorType )
    .SingleInstance()
    .Keyed( id, individualGenInterface );

// resolution phase (in registered class's constructor)

private readonly IIndex&lt;TTypeId, List&lt;Lazy&lt;IGenerator&lt;TEntityInterface, TTypeId, TContext&gt;, IGeneratorInfo&gt;&gt;&gt; _keyedGenerators; 

    protected EntityGenerator(
        IIndex&lt;TTypeId, List&lt;Lazy&lt;IGenerator&lt;TEntityInterface, TTypeId, TContext&gt;, IGeneratorInfo&gt;&gt;&gt; keyedGenerators 
        )
    {
        _keyedGenerators = keyedGenerators;
    }

I've tried registering using both Keyed() and WithMetadata():

var id = baseGenArgs[ 0 ].GetCustomAttribute&lt;ExifDirectoryAttribute&gt;( false )?.DirectoryId
    ?? throw new RequiredAttributeMissingException&lt;ExifDirectoryAttribute&gt;( baseGenArgs[ 0 ] );

builder.RegisterType( generatorType )
    .SingleInstance()
    .Keyed( id, individualGenInterface )
    .WithMetadata&lt;IGeneratorMetadata&gt;( m =&gt; m.For( x =&gt; x.Key, id ) );

but that requires resolving (in the registered class's constructor) using Meta<>...and I can't figure out how to retain the "allow lazy-loading multiple services sharing same key" part. But that may just be because there are a >>lot<< of generic type specifications that need to be made :)!

Is there a way to do what I'm trying to achieve? Or would I be better off registering and resolving a separate class that holds the key values? I only need to know which keys are "supported" by a lazy-loading registration.

reddit.com
u/MotorcycleMayor — 3 days ago
▲ 1 r/Epson

XP-15000 Asking for CD Tray

SOLVED: See comments

Which is pretty fracking funny because I'm not printing a CD label! I'm trying to print a page of Avery labels (15513)!!! From within Microsoft Word! Specifically identifying both the rear paper feed and regular paper!!!!

I'm targeting the "network" version of the XP-15000, because it's connected to my network.

Is something wrong with Epson's engineering department? Were they spending too much time drinking saki or something? :)

I've tried rebooting the printer and my computer and the problem still exists.

Is the solution to junk this piece of garbage and buy a printer from someone who knows how to design printers? Seems kind of ridiculous but maybe so.

reddit.com
u/MotorcycleMayor — 16 days ago
▲ 3 r/csharp

Culture-specific Embedded File

Solution provided in a comment to this post.

Based on the last two hours of trial and error, I obviously know almost nothing about embedded files :).

Is it possible to embed culture-specific files in an assembly?

When I try to do it by including a folder called Resources which contains a culture-specific file name (e.g., exif_chrom_bright_align.en-US.json) and mark the file as an embedded resource, a satellite assembly folder (en-US) containing a DLL gets created upon build.

But calling GetManifestResourceNames() on the assembly shows no resources (i.e., it returns an empty string array).

Interestingly, if I drop the culture-specific part of the path (i.e., the en-US), the embedded resource does get shown by GetManifestResourceNames().

Do culture-specific resources have to be accessed by something other than GetManifestResourceStream()? Or is it just not possible to have culture-specific embedded files?

reddit.com
u/MotorcycleMayor — 22 days ago
▲ 5 r/arlo

No confirmations of delete?!?

Wow! I just accidentally deleted a video from my cloud subscription. There was no pop up to confirm the action. Unbelievable! Where did Arlo get its software engineers from?

Makes you wonder what else is badly implemented.

reddit.com
u/MotorcycleMayor — 1 month ago
▲ 1 r/arlo

Cameras missing from Standby, constantly recording

Sigh. I HATE Arlo. I did something that apparently deleted my cameras from Standby, so now when the mode switches to Standby, nothing changes. The cameras all keep recording.

That’s on me.

What’s on Arlo is that there’s no obvious way to fix the problem. When I try to add something to Standby, the only choice available is to record video. Which is exactly the wrong thing to do.

Arlo software is apparently written by nitwits who know nothing about human factors engineering and never field tested before release.

Anyone have an idea on how to fix this? Google suggests I delete and re-add cameras, but that seems excessive.

reddit.com
u/MotorcycleMayor — 1 month ago
▲ 2 r/arlo

Location services missing (iPhone iOS 2026)

I invited my wife to join my Arlo account. Her Arlo app claims it is set up…but no devices show, and I cannot get iOS to let me add location services to the Arlo app (I’m checking this in settings->apps->arlo)

Suggestions? Besides ditching Arlo 😀

reddit.com
u/MotorcycleMayor — 2 months ago

Outlook 365: Can't Delete Cached Email Address

This relates to Ye Olde Outlook 365 😄. Sorry, should've mentioned that when I first posted this.

Whenever I start addressing an email to a particular person, Outlook displays a list of emails it knows which match the name. One of the emails it provides for this person is defunct.

I want to remove that email.

Unfortunately, I'm not able to do that. I've tried:

  • following online instructions to "start typing the name, and then click the x next to the email you want to remove". Sadly, in Outlook 365 (as of May 2026) there is no 'x' (thanx for keeping your documentation up to date, Microsoft 😞)
  • clearing the RoamCache
  • clearing the Offline Address Books

This failed to delete the defunct email.

Where else might this email be hiding?

reddit.com
u/MotorcycleMayor — 2 months ago
▲ 0 r/help

I got an email alerting me that another Reddit user had logged into my account (I had forgotten I’d used an easily hackable password for my account).

I immediately reset the password, and could find no evidence of comments or posts made by the user.

But what I’m curious about is that the user name the alert email cited doesn’t exist…and isn’t me 😀. Wouldn’t someone have to use my user name to log in?

I presume the reason the user doesn’t exist is the miscreant created a new Reddit account to do the hack and then deleted it.

Is there anything else I should do at this point?

u/MotorcycleMayor — 2 months ago