Sr. Content Developer at Microsoft, working remotely in PA, TechBash conference organizer, former Microsoft MVP, Husband, Dad and Geek.
163621 stories
·
33 followers

Random.Code() - Resurrecting Partial Function Application in C#, Part 4

1 Share
From: Jason Bock
Duration: 1:27:47
Views: 90

Getting a neglected code base updated is never a simple task, but I'm making progress. More immutable data model work today.

https://github.com/JasonBock/PartiallyApplied/issues/21

#dotnet #csharp

Read the whole story
alvinashcraft
56 minutes ago
reply
Pennsylvania, USA
Share this story
Delete

v7.6.9 Release of PowerShell

1 Share

7.6.9

Build and Packaging Improvements

Update to .NET SDK 10.0.403

  • Merged PR 42305: [release/v7.6.9] Update branch for release

SHA256 Hashes of the release artifacts

  • hashes.sha256
    • 638E954664D07A29190570FAF862B8A50B35F7E1C10DBD0F0E8A7E0F70138B45
  • powershell-7.6.9-1.azl4.aarch64.rpm
    • FA959724AE0FB6D68731981DDDF5D35C3CD1F7308E9EAE8EC1F3D5159B4350A6
  • powershell-7.6.9-1.azl4.x86_64.rpm
    • 04607223FDA408A26CDF641BFE38F651965C2769EB30CEB17AEC4D4F570EE4FE
  • powershell-7.6.9-1.cm.aarch64.rpm
    • 80C6ED0A0BEA7D3EF827383C7DDB2F369DEA8F8A7FBBA7E32A510D114C980E1B
  • powershell-7.6.9-1.cm.x86_64.rpm
    • A5F9545679C194F8EB9C55B24D06843A148CF27AFFF40CE0DF55751C6A1607CD
  • powershell-7.6.9-1.rh.x86_64.rpm
    • 91C7F3D518389B1042B1465D70D365BCD040B67A3C0F79849658C695B777A6BE
  • powershell-7.6.9-linux-arm32.tar.gz
    • 16C471C8ADCD5AFD9B533C77943AFC347716345B9859654D0EE7A1C4307A478F
  • powershell-7.6.9-linux-arm64.tar.gz
    • 02EB9991AF447C7E7FE881ACDE195961AFD397C40B8EB1C2B3856B84EC2D85F2
  • powershell-7.6.9-linux-musl-x64.tar.gz
    • F83DF6705EDAAE07DB970DCC6C34AD6583D33A2F6199F1B55CDC5354FBB9001C
  • powershell-7.6.9-linux-x64-fxdependent.tar.gz
    • E62256F057E1D17B0626BEB781A3A0913F15B231E4BCC767AA1B00FCD0CC6AB0
  • powershell-7.6.9-linux-x64-musl-noopt-fxdependent.tar.gz
    • 639A79DBDAAA0F17F05A6E89F67795CD00BB008376E98A3581F1B5D1F23B5B68
  • powershell-7.6.9-linux-x64.tar.gz
    • 1DA6D6D6035D651F20E70DDEE7C4C15AC6AB8B9FB40EE92240D91263F28A884B
  • powershell-7.6.9-osx-arm64.pkg
    • 9002562086AD18DCDC4A1156F6CD6467CFB5A91B28206E56491212193B68E5E6
  • powershell-7.6.9-osx-arm64.tar.gz
    • A1C7E98AC403DA4BE5BA75C1C5855AF272DE7787A91D478C4267466FE58FC1AF
  • powershell-7.6.9-osx-x64.pkg
    • C599B3859DD199E223E237B008B6564961791DD2D849B96296FE4A63FBAA59DC
  • powershell-7.6.9-osx-x64.tar.gz
    • A5AA2308A7E9664510A5C93D5B337FD524FF7DC14B8A637FB6144A2BBAA298AE
  • PowerShell-7.6.9-win-arm64.msi
    • F29D127A798DA0D3FEC9224171AE4D85453ECB466CE53A957237BCA4008C1D2B
  • PowerShell-7.6.9-win-arm64.zip
    • 2157FB002178E606C2A5532C56647118D90D029742F04D4900A71E3B478C2363
  • PowerShell-7.6.9-win-fxdependent.zip
    • 7023CA72E332F43B8532FDE368023CE51DEEB79A5276B2723578BB37644DBD8E
  • PowerShell-7.6.9-win-fxdependentWinDesktop.zip
    • FC63325E0D93FDBF1F6826CA345CD2E3414050F52B0D6DA6D93312739CBFE040
  • PowerShell-7.6.9-win-x64.msi
    • 50D33C7494AAF82B987CFD4DE3F232D04F91FDD4C0DEECA8A669CCED3E7CF8F9
  • PowerShell-7.6.9-win-x64.zip
    • CE7484804C0F0AD4DDA10C958E71ACDAF7EEBFB22505C1B480F89E0E9F1DA94D
  • PowerShell-7.6.9-win-x86.msi
    • 067659D573A953FF93D1BDD87D7CDD3C34BF1B9C8B9226C5C2164215F3C37608
  • PowerShell-7.6.9-win-x86.zip
    • 5B9806943EE5F1CF4AFD1E04AF859D7445449F017550D7E3EAC3B86B3E80A7CE
  • PowerShell-7.6.9.msixbundle
    • DA75C8AA23EDDA52E888FB586A46B923AB37A7C243719C2E8914B00130C5917A
  • powershell-lts-7.6.9-1.azl4.aarch64.rpm
    • 58FBB1EDFFD57952E8D2F23CA4B485D3B84F1E081C566503EAD2B2216C4BF5B8
  • powershell-lts-7.6.9-1.azl4.x86_64.rpm
    • DBA44C4ACE0CA6A3AAAAFFE404A6C13899F47E526D04D13A30490ABDBA2E02CA
  • powershell-lts-7.6.9-1.cm.aarch64.rpm
    • 47BA037C365BB28E90B0A1D748B9A256560BD05EDF8144DDE0C8764CB0136955
  • powershell-lts-7.6.9-1.cm.x86_64.rpm
    • 90F704B2983CF289941193CDE068FA1CFB62A4F5CA7505BB3BC572D1405DDC57
  • powershell-lts-7.6.9-1.rh.x86_64.rpm
    • DB4FA1E039ED23F627F0989D91DC452B44BFBDA2C2651824E402C23F5062EE7C
  • powershell-lts-7.6.9-osx-arm64.pkg
    • D22D04606B4E446F7B989EC48F5D8E12F938EB808FA9B795D0321AFD84C671B2
  • powershell-lts-7.6.9-osx-x64.pkg
    • 25566C66452CB5E91F6C47FD7743F19F1C0FC4DCB630C37C82BEE41047846B22
  • PowerShell-LTS-7.6.9.msixbundle
    • 93C82DD33B98331ED1DF91E3F857C2371B716F9B46B431F7A0155416AA395A98
  • powershell-lts_7.6.9-1.deb_amd64.deb
    • 99448C9E183082323AB1736A0BA6944D4B6219C74F709B56E274DA2F05FCC5D7
  • powershell-lts_7.6.9-1.deb_arm64.deb
    • 03A13B44FEB4CEE290263F2B478787B88A269DC4EB38EC8F214986B42B9C3682
  • powershell_7.6.9-1.deb_amd64.deb
    • 491B1A51E257E2AC86AF33E3A4DC9AA91ADB1B3926A57967AF39D9A1CA38DC79
  • powershell_7.6.9-1.deb_arm64.deb
    • EC7B431576F225B1113BA5BC4BD53797D5E1D129917258B57346B2BE46AA96BC
Read the whole story
alvinashcraft
56 minutes ago
reply
Pennsylvania, USA
Share this story
Delete

v7.5.13 Release of PowerShell

1 Share

7.5.13

Build and Packaging Improvements

Update to .NET SDK 9.0.320

  • Merged PR 42303: [release/v7.5.13] Update branch for release

SHA256 Hashes of the release artifacts

  • hashes.sha256
    • 3AD34E14948C3DE4E9D51185FEE8ECCA4406A9A9D96F5B6944514E2BC6AE0549
  • powershell-7.5.13-1.cm.aarch64.rpm
    • 9CE23CF885D680352BD056A952B686BE39D42DA1D6166FF06C57A984C5BC02F8
  • powershell-7.5.13-1.cm.x86_64.rpm
    • 1E864FDD64F3F4ED558FFAB6163A2BD70E4115096BA671F1AECCCF14C6834710
  • powershell-7.5.13-1.rh.x86_64.rpm
    • A7ED6DF953F8F35FF9A9B517BB15569E41F873F4277FD94DC8AEB1C94EF56D53
  • powershell-7.5.13-linux-arm32.tar.gz
    • 8900399477F2305176AF524993AE9B82CFA23F95AE3FC45BB7BE91A035983DE5
  • powershell-7.5.13-linux-arm64.tar.gz
    • 6A556353CCFB0A414B80322334EAC29A540A398537D3CF8DCC3ECEC9CD8ABD66
  • powershell-7.5.13-linux-musl-x64.tar.gz
    • 34D757C09177BFA9D8E449F729B8B46DCE2FEDE887DB801B26F6F6E7F0FC680C
  • powershell-7.5.13-linux-x64-fxdependent.tar.gz
    • 744126B1661BCCBD594C836E7240F9F188FA90A79B26E922B09DCCB903257707
  • powershell-7.5.13-linux-x64-musl-noopt-fxdependent.tar.gz
    • D6D56DFDDFB5E6FA2A1D6AA0D9754A7B33319FD5D700C4A22DAEE6E75FF88A09
  • powershell-7.5.13-linux-x64.tar.gz
    • E9256BFC6AC98FCBEC97270E8A986577A7346A587837CC80D30595EEF3C2546B
  • powershell-7.5.13-osx-arm64.pkg
    • 6E64E2D9A61A39E9660C00F53364748F741F3103DE66CB49083F00D619692893
  • powershell-7.5.13-osx-arm64.tar.gz
    • 0D2F48707D18A388096BEE8820967C2EF78156F4EB74700D8A77C50798B99E94
  • powershell-7.5.13-osx-x64.pkg
    • 5277E1645DA22DBD9406CDF62BF1338DB872EDAF6DA15F2426291F21048CACC3
  • powershell-7.5.13-osx-x64.tar.gz
    • 57B18193FB4038B115D2B0BFE284C275E471027CDE1AD202E777FEBF2C7DA58F
  • PowerShell-7.5.13-win-arm64.msi
    • 329F43D6D8AEB4A3A445FA4F2E2598AFFE6F869F55B89F80F7BF2DDC56A272AE
  • PowerShell-7.5.13-win-arm64.zip
    • FC850EA69B8D476A4C1BAB1A2321A0B656260EFA425681A62C290D1F7054C9E8
  • PowerShell-7.5.13-win-fxdependent.zip
    • E8371AAF07675C6C96B62BF84F009700A8E8F7B96E4AE220D9EA225641E24F8D
  • PowerShell-7.5.13-win-fxdependentWinDesktop.zip
    • A4FA3A0240B533E837091EF16A5C9A694F534827602DAD76480CAD560883A3AA
  • PowerShell-7.5.13-win-x64.msi
    • B61492A06107F04DBA8FA9599D0CC8D82DBFF9E69807769BEB7FCBE05E521966
  • PowerShell-7.5.13-win-x64.zip
    • 120B8F0B04F3B3F6E8C351DDBE568BF596CDCA15EEB2ECB7E724060051A36D65
  • PowerShell-7.5.13-win-x86.msi
    • 5545022DB39E5E4B3348F44CE5BD3C420E4E6CB1E2AFC1975FE8BD0E72FF3E1D
  • PowerShell-7.5.13-win-x86.zip
    • 794E9E1DFA6FE333158C2449E9003AA1908C6543E892F89AF72B570658B538D8
  • PowerShell-7.5.13.msixbundle
    • 9A4075DEEA8CD516B75EA651DB73DA4AE13E70F4E22DEFF008BFAF72626FE64C
  • powershell_7.5.13-1.deb_amd64.deb
    • 51C3172EE68251B8EF2A4EA1CE9EA2A2ADA84C1010E2FDC49ACF8257B964EDFE
Read the whole story
alvinashcraft
56 minutes ago
reply
Pennsylvania, USA
Share this story
Delete

v7.4.22 Release of PowerShell

1 Share

7.4.22

Build and Packaging Improvements

Update to .NET SDK 8.0.427

SHA256 Hashes of the release artifacts

  • hashes.sha256
    • AA81683B111314FF48083CD6CD757EF795683047FEFC9D06412B36D93046B481
  • powershell-7.4.22-1.cm.aarch64.rpm
    • 1D9628127B2CA4963EDDB3876ED67C91AC96A8593DB0269B68F49A1D3E9548F2
  • powershell-7.4.22-1.cm.x86_64.rpm
    • FF74FE178EFD5BEBE2C78424134C656F4A39B5D0CFF5DBCBBBB66A31E55D676E
  • powershell-7.4.22-1.rh.x86_64.rpm
    • BCA2C7F5B583F5E0701BEA162CCFAD963027C87F96C79019440C037CD0C9AFF7
  • powershell-7.4.22-linux-arm32.tar.gz
    • 532750DF5D0A3587EBE2D714D0F96899C2F7B248AFE051FDD98E97FA2C20B1B4
  • powershell-7.4.22-linux-arm64.tar.gz
    • EF95973FACF60CF735F6D8CAEF3383394B9E8200CBD078D6068F7E14CA6B9078
  • powershell-7.4.22-linux-musl-x64.tar.gz
    • 3AFF414FBF6C489B00A202FBE1CCF9A9F40CDA1EC45BF4183277A4F0D3879D64
  • powershell-7.4.22-linux-x64-fxdependent.tar.gz
    • EDD5F78FF003B6A1612AC2E888C0D8121D0C1307CEB2B6EAC1A20A51B671E747
  • powershell-7.4.22-linux-x64-musl-noopt-fxdependent.tar.gz
    • F8C9D64E774E987923414C6882241A1AEFFC48136133E5DADC1D0274E4DCCE8E
  • powershell-7.4.22-linux-x64.tar.gz
    • 9DE443BEF974F219C98A33B0F4096AACE7F30B42188F37A1B14C5DA7E82C8A6A
  • powershell-7.4.22-osx-arm64.pkg
    • 15A9339DF6025637CF3884F83859AD12A1F7B38F3571E0E0670CD751F26EB9D3
  • powershell-7.4.22-osx-arm64.tar.gz
    • AFD9B5DC4AA1934F4A2BAB906EFC443F7E576E4BA501F3D355B121E3F6EC3C1A
  • powershell-7.4.22-osx-x64.pkg
    • 8E7987907888143D5FFEF59882D1DA8EFB564E063DBFCD7CF4955E8D076A8D14
  • powershell-7.4.22-osx-x64.tar.gz
    • 09A7AF0EC9ECAC489725E9C22343C6CA33EE35D02A448F6EE20F596FDD2E2446
  • PowerShell-7.4.22-win-arm64.msi
    • 32CE637BEC06D34685D4C79BBFAA6EFDD35F18F0796463537237245E50495947
  • PowerShell-7.4.22-win-arm64.zip
    • C01FDF605CAA1598B30E881DB25239446E78EC2376E9526B364A291DEEB47C3F
  • PowerShell-7.4.22-win-fxdependent.zip
    • 40F7ED3365CE3BA6792DEB321B9AC7D68182D749C1AD72A49A2C84C3E4C364FA
  • PowerShell-7.4.22-win-fxdependentWinDesktop.zip
    • 62B10B38D3226E898EFDD374D9CE1D21C96DE3A481B2944CFE4A6106A3E56E77
  • PowerShell-7.4.22-win-x64.msi
    • 78E819DF51A672FBA8362258A19DB0E681452DCEE6FEE63C60BCB5AA45D1B859
  • PowerShell-7.4.22-win-x64.zip
    • 5F89F51860A1A3B07937945663AFD7CBD44387361FF9985F5758939CB9BD6359
  • PowerShell-7.4.22-win-x86.msi
    • 312B9B827542B8BB6F4960BD4540DF437D8DE342FF9A7BAAD77A51F80DA5D0C4
  • PowerShell-7.4.22-win-x86.zip
    • 5C9BA83FACB8A6FCD2034CB14FA5AF4B9B06C4E41F98682A41BC4B5FA969D024
  • PowerShell-7.4.22.msixbundle
    • E19132EC55489E2E17CDD2E361A9E7D5DD78A908B32146AD8D86EACDD3AEC0C5
  • powershell-lts-7.4.22-1.cm.aarch64.rpm
    • D68700056FDFDD8A9B80CA96E952FE29C1F879CF54A2F1B1F8EE5EA70A55F78F
  • powershell-lts-7.4.22-1.cm.x86_64.rpm
    • 93A6233061A0CD2670DCC528DEE061FBCC6887359F2EC5F53457F97AB36FF016
  • powershell-lts-7.4.22-1.rh.x86_64.rpm
    • 7870CD3CCEBF0A0624767916A613ABD0F4D02AF66D133CA63AD9BB0A85708439
  • powershell-lts-7.4.22-osx-arm64.pkg
    • FC452946F25CB1F7CE0CCBE3F3B22B9FFC7F0011786982A5467595885BA59AAD
  • powershell-lts-7.4.22-osx-x64.pkg
    • 9D204DE78AD24714BE9381A0F1B4816CDA0BC513007066A27D43DA8F79A0E6DC
  • PowerShell-LTS-7.4.22.msixbundle
    • 57BF52633213B14AE279953AC0814F90F84AEB5BB8119D0C6B6FE98BEE878AD0
  • powershell-lts_7.4.22-1.deb_amd64.deb
    • A6DDDD815542018F0F1CFB068CF838401FB61AC54F16FEF632565157AB7145BD
  • powershell_7.4.22-1.deb_amd64.deb
    • C9053B126A7B8A9872B9933AB3A64CE9D5B6E54D2DCB6FCC5243558E0BDA4649
Read the whole story
alvinashcraft
56 minutes ago
reply
Pennsylvania, USA
Share this story
Delete

7,100 demos on Steam... should indie developers be WORRIED?

1 Share

Hello and Welcome, I’m your Code Monkey!

I'm still super busy working on my Game and the accompanying Steam course and everything is coming along quite nicely, there is now a Steam page!

Even though my goal is to just make a simple sample game so I can build the course around it, I've actually really enjoyed building this game. It came out much better than just a sample game, I actually really enjoy playing through it. I've got the Steam Demo build already in the review queue, so hopefully this week I'll be able to let you all play! If you enjoy Tidy Up games I think you'll enjoy this one, stay tuned!

  • Game Dev: 7,100 demos on Steam… should indie developers be WORRIED?; Crowdsource data for your games!

  • Gaming: Could GTA 6 cost the US economy $1 BILLION in one day?



Game Dev

7,100 demos on Steam… should indie developers be WORRIED?

October's Steam Next Fest is running right now and this one has around 7,100 playable demos, almost double the last Next Fest that had 4,300. That is a LOT of games!

Many people are saying this is due to AI slop, and looking at the page for the first two days (the algorithm only engages on the third day) it would seem like that is correct, lots of games that were made in 1 prompt.

But while the headline number sounds scary, personally my reaction is the same as when people say "oh there are too many games on Steam!"

Steam’s discovery tools are very good nowadays. By Wednesday when the algorithm turned on, no one was seeing all those AI slop games, players are not being shown the tons of slop that exist on the store.

The Steam algorithm is why I’m less worried about the idea that low-effort AI games will automatically bury everything else. As discovery becomes more personalized, I expect simply uploading MORE games to become less useful than making something a particular audience actually wants to play.

Although this absolutely does NOT mean "make a good game and Steam will magically sell it."

You still need to understand your audience, execute the idea well, communicate the appeal, and actually do the marketing. Personally, I find those are much more useful things to focus on than panicking about the total number of entries.

Ideally if you're making proper games where the idea is good, the execution is well done and you've done some marketing, then you're not competing with AI Slop Game #42. Your professionally made game should easily rise above those. If you can't get above those then I would honestly say you likely just need to get better. Someone lazy just doing a single prompt should NOT be able to be better than you at idea selection, validation, prototyping, game design, UX, pacing, marketing, etc.

So yes there are more games than ever before, but that should not discourage people like yourself who are taking this seriously and genuinely trying to make good games.

I imagine this topic will come up for every Next Fest in the future, and I imagine another scary headline like "2026 was another RECORD year for games published on Steam!" and once again lots of people will make videos and comments on how this is the indiepocalypse. My advice to you is to not waste your energy on that and instead do something more productive like focusing on improving your skills so you can easily rise above all the slop.


Affiliate

FREE Synty! Bundle 80% OFF

My Code Monkey Bundle is BACK to celebrate the End of Summer with 80% OFF!

You’ve got 12 of my courses covering C#, Problem Solving, Multiplayer, DOTS and tons more, plus 9 of my Steam games and 1 month of my Game Dev Practice Lab to put those skills into practice!

Grab the whole bundle 80% OFF with coupon SUMMER2026. Get it HERE!

The Publisher of the Week this time is Synty Studios, which I’m sure you already know about!

Get the FREE Fantasy Villagers – Sidekick Modular Characters by Synty which includes modular clothing, hairstyles and accessories, plus the Sidekick Character Creator tool. Perfect for filling your RPG town with lots of different NPCs!

Get it HERE and use coupon SYNTYSIDEKICK at checkout to get it for FREE!

There’s an awesome HumbleBundle! packed with Unity tools and assets!

You’ve got Gaia for Unity 6 to build your worlds, Love/Hate for NPC personalities and relationships, plus tools for Vehicle Physics, Water, Lighting and VFX. On top of that you get Characters, Environments, Props and more!

62 tools and assets in the full bundle, all at 99% OFF! Get it HERE!


Game Dev

Crowdsource data for your games!

Sometimes your game idea might need a ton of names for something, like some item or NPCs. You might try to come up with names yourself, but it will probably be difficult after the first 10 or 20. That's where asking a giant crowd can help!

The developer behind The MachinEGG wanted each chicken arriving at your farm to have a unique name. Rather than generating a random list, they asked a chicken-keeping community for the names of their actual pets. They thought 100–200 would be plenty, assuming anyone replied at all.

The response was much bigger than expected. The post attracted over 700 comments! They spent roughly 12 hours copying names and reading the accompanying stories. In total they got nearly 3,000 names!

The most common name? Nuggets, which the developer says appeared 20 times.

There is a useful development idea here: communities connected to your game’s subject can contribute details with maybe some stories which you can then use to make your game better. This is also a great way to get people more invested in your game. No idea how many wishlists this generated but it's a pretty funny story!

I did make a game once where I needed some names, Game Corp DX, and I made some VIPs in that game and I used names from actual game developers, critics and studios. It was fun drawing a character inspired by Gabe Newell, coming up with the studio name Electronic Poptarts and the reviewer TotalCrumpet.



Gaming

Could GTA 6 cost the US economy $1 BILLION in one day?

Normally we talk about how much money a game might MAKE, but apparently GTA 6 could also COST everyone else a fortune! Not the devs but literally everyone else.

There is a headline going around claiming its launch could cause $1 BILLION in lost productivity, based on an estimate of roughly 1.5 million Americans taking time off work to play. Not development costs, not money spent buying copies, just people choosing Vice City over their workplace!

Rockstar currently has the release scheduled for November 19, 2026, that's a Thursday so I'm guessing that Friday will have record low productivity.

Imagine making something so anticipated that people start calculating its impact on national productivity. Most of us are just trying to convince someone to wishlist our game!

I think this is pretty funny, it's crazy how a single game can be so insanely impactful, not just in the games industry but in real life as well!




Get Rewards by Sending the Game Dev Report to a friend!

(please don’t try to cheat the system with temp emails, it won’t work, just makes it annoying for me to validate)

Thanks for reading!

Code Monkey

Read the whole story
alvinashcraft
56 minutes ago
reply
Pennsylvania, USA
Share this story
Delete

Which device is on this COM port? A tiny .NET 10 utility

1 Share
Two StackChan robots beside their retail box. One screen shows a colorful .NET Bot face and the other a simple neutral face.

⚠ This blog post was created with the help of AI tools. Yes, I used a bit of magic from language models to organize my thoughts and automate the boring parts, but the geeky fun and the 🤖 in C# are 100% mine.

Hi!

While building the USB demo for the upcoming New Year, New Bot series, I had two small robots connected to one Windows PC. Windows showed several COM ports, but the names did not tell me which cable belonged to which robot.

That matters before connecting to a device, and especially before choosing a firmware target. Two different boards can report the same USB vendor and product IDs. A COM number is a current Windows assignment, not a permanent identity.

The solution: read metadata, then unplug one cable

Instead of opening each serial port and guessing, this small console app reads Windows Plug and Play metadata: the COM assignment, device description, USB IDs, parent and location. It never opens a port, toggles DTR/RTS, resets a board or flashes firmware.

The diagram uses synthetic IDs. Notice that every cable has a clear, continuous path from the PC inventory to its device. The app helps narrow the match; disconnecting one cable and watching for REMOVED confirms which physical device it is.

Diagram linking three Windows COM inventory entries to two similar robots and a development board with clearly traced USB cables, followed by the unplug-and-label identification steps.

The code: one file, no project scaffolding

The standalone sample targets .NET 10 and uses System.Management to ask Windows for present ports. It reads the COM assignment from the device’s registry metadata:

var query = new ObjectQuery(
"SELECT * FROM Win32_PnPEntity WHERE PNPClass = 'Ports' AND Present = TRUE");
using var searcher = new ManagementObjectSearcher(
new ManagementScope(@"root\cimv2"),
query,
new EnumerationOptions { Timeout = TimeSpan.FromSeconds(5), ReturnImmediately = false });
using var devices = searcher.Get();
foreach (ManagementObject device in devices)
{
using (device)
{
string? instanceId = device["PNPDeviceID"] as string;
if (string.IsNullOrWhiteSpace(instanceId))
throw new InvalidOperationException("A present port has no PnP instance ID.");
using var key = Registry.LocalMachine.OpenSubKey(
$@"SYSTEM\CurrentControlSet\Enum\{instanceId}\Device Parameters",
writable: false);
string? port = key?.GetValue("PortName") as string;
// The app validates the COM name, reads optional metadata, and reports it.
}
}

The full code also handles ports disappearing during a query, orders ports numerically, and reports errors explicitly. --watch compares snapshots and reports added, removed or changed devices. --json makes the snapshot usable by another tool.

From the sample folder, with a stable .NET 10 SDK installed:

dotnet run SerialPorts.cs
dotnet run SerialPorts.cs -- --watch
dotnet run SerialPorts.cs -- --json
dotnet run SerialPorts.cs -- --self-test

For two look-alike devices, run watch mode, unplug just one cable, wait for REMOVED, reconnect it and label that physical robot. Repeat for the other device. Do not use the inventory as an automatic firmware-target selector. The synthetic self-test checks parsing and device changes without WMI, the registry or hardware.

This is a small building block for the upcoming New Year, New Bot series, where we are exploring a desk companion built with StackChan and .NET.

Image note: the hero photo was provided by Bruno. The diagram is a hand-authored vector with synthetic port and USB ID values. Other draft illustrations are not used in this shorter version.

References

Happy coding!

Greetings

El Bruno

More posts in my blog ElBruno.com.

More info in https://beacons.ai/elbruno




Read the whole story
alvinashcraft
57 minutes ago
reply
Pennsylvania, USA
Share this story
Delete
Next Page of Stories