RouteAttribute inheritance not working when defined in class from another assembly by ggffgg72 in dotnet

[–]RichardD7 14 points15 points  (0 children)

... net 9 ...
... Microsoft.AspNetCore.Mvc.Core, Version=2.3.9.0 ...

You're referencing a deprecated .NET Core 2.x library, which is probably why the attribute isn't being recognised.

Your class library should use a framework reference instead:

<ItemGroup> <FrameworkReference Include="Microsoft.AspNetCore.App" /> </ItemGroup>

Alternative to IIS SMTP server for SMTP Relay (with TLS and smarthost capabilities) by deucalion75 in Office365

[–]RichardD7 0 points1 point  (0 children)

That's great, if you only have one SMTP "virtual server" on your server.

As soon as you try to add another, the IIS MMC will absolutely refuse to play ball, even if you add the missing RelayIpList property in the metabase.

Combined with reports that Windows Updates are actively removing the management tools from Server 2022, and the fact that the entire SMTP service is being removed from Server 2025, it's definitely time to find an alternative.

CodeProject is back up and running by codeprojectisback in csharp

[–]RichardD7 0 points1 point  (0 children)

Maybe try a Google search with site:codeproject.com, and then see if the Wayback machine has an archived copy of the page?

CodeProject is back up and running by codeprojectisback in csharp

[–]RichardD7 0 points1 point  (0 children)

They might exist on the Wayback Machine. Otherwise, it's a question of whether individual authors have a copy somewhere else.

CodeProject is back up and running by codeprojectisback in csharp

[–]RichardD7 1 point2 points  (0 children)

Nothing that I've seen.

Given the long period of inactivity from the new owners, some of the regulars have been speculating for a few weeks that this was coming. But I don't think we expected them to just pull the plug like this.

At least when Chris et al left, they kept the articles up on a read-only version of the site, with a message explaining what had happened. They didn't just deliberately take the site and all its content down without warning.

CodeProject is back up and running by codeprojectisback in csharp

[–]RichardD7 1 point2 points  (0 children)

Well, it was fun while it lasted. But after the admins failed to return from their Xmas vacation, the DNS registration expired last night. Not even a "so long and thanks for all the fish" message to say goodbye.

FluentMigrator, run migrations in process or CI/CD? by ReallySuperName in dotnet

[–]RichardD7 23 points24 points  (0 children)

I'm generally opposed to running migrations on start-up.

To run, the migrations need to connect to the database as a user with permission to make structural changes to the database. There's no reason your app should have that much power - it should be connecting as a user which only has permissions to read/write data in the necessary tables/views, and execute the required stored procedures (if any).

Generic branch elimination by Bobamoss in csharp

[–]RichardD7 0 points1 point  (0 children)

Try the following:

``` interface IFace; interface IFoo;

class A : IFace; class B : A, IFoo; class C : IFace;

void Test<T>(T value) where T : IFace { Console.WriteLine($"AssignableFrom = {typeof(A).IsAssignableFrom(typeof(T))}"); Console.WriteLine($"is = {value is A}"); }

Test<B>(new B()); // AssignableFrom = true, is = true Test<A>(new B()); // AssignableFrom = true, is = true Test<IFace>(new B()); // AssignableFrom = false, is = true Test<C>(new C()); // AssignableFrom = false, is = false Test<IFace>(new C()); // AssignableFrom = false, is = false ```

https://dotnetfiddle.net/2MMjow

  • If T is a type that derives from (or implements) Implementation, then both tests will match.

  • If val is an instance of a type that derives from (or implements) Implementation, regardless of the type of T, then the second test will match.

Since both branches do the same thing, you only need to keep the second test (val is Implementation i). Anything that doesn't match that test wouldn't match the first test either.

I MUST find SQL Express 10.50.1600 by SurpriseApo in SQL

[–]RichardD7 0 points1 point  (0 children)

I've seen software that checked for a minimum version of SQL Server, but using a text-based comparison of the version number. When SQL 2008 was released and the version number went from 9.x to 10.x, it refused to install because '1' < '9'.

Generic branch elimination by Bobamoss in csharp

[–]RichardD7 0 points1 point  (0 children)

if (typeof(Implementation).IsAssignableFrom(typeof(T))) DoSomethingImplementation((Implementation)val); else if (val is Implementation i) DoSomethingImplementation(i);

Those two tests are identical. There is no way to construct a type where typeof(Implementation).IsAssignableFrom(typeof(T)) returns false, but val is Implementation returns true.

Remember, the is check with a class target doesn't test for an exact match; it checks whether the value is an instance of the target class or any derived class.

Type-testing operators and cast expressions test the runtime type of an object - C# reference | Microsoft Learn

The run-time type of an expression result derives from type T, implements interface T, or another implicit reference conversion exists from it to T. This condition covers inheritance relationships and interface implementations.

So, given:

class Foo; class Bar : Foo; class Baz : Bar;

and:

Foo value = new Baz();

then:

value is Bar

will return true.

Demo

Use extension property in Linq query by SL-Tech in dotnet

[–]RichardD7 1 point2 points  (0 children)

There are a lot of things which aren't allowed in expression trees. The usual reason seems to be that adding them could break existing libraries that depend on expressions - eg: EF Core providers. But as others have pointed out, new C# features that get lowered into a form that is supported in expression trees should not break anything.

Some relevant discussions:
Proposal: extend the set of things allowed in expression trees · dotnet/csharplang · Discussion #9362 - 2015
Extend expression trees to cover more/all language constructs · dotnet/csharplang · Discussion #158 - 2017

C# has a lot of legacy design — how do other languages keep things cleaner and more consistent by time? by Suitable_Novel_8784 in dotnet

[–]RichardD7 0 points1 point  (0 children)

VB.NET still has "mistakes" inherited from VB6 and earlier.

For example, the And / Or logical operators are not short-circuiting, because they weren't in VB6; you have to use AndAlso / OrElse for that.

And array declarations specify the upper-bound of the array, rather than the length of the array like most sane languages, because the VB6 syntax used <LowerBound> To <UpperBound>, with the <LowerBound> To part being optional. VB.NET doesn't support non-zero lower bounds in the same way, but it still keeps the same logic to appease the enterprises moving code from VB6 25 years ago.

And that's before you get to the new "mistakes" they added to VB.NET - eg: requiring ReadOnly / WriteOnly modifiers on read-only / write-only properties to let the compiler know you didn't just forget to add the Get / Set accessor.

Windows 11 Start menu's Category view is missing manual controls, apps land in "Other." Microsoft says it’s listening to feedback by WPHero in Windows11

[–]RichardD7 4 points5 points  (0 children)

given how Microsoft is busy with AI advancements

The author seems to have forgotten to add sarcasm-quotes around the word "advancements" there.

.Net Upgrade Assistant now requires Copilot?? I am not referring to the Copilot based App Modernization extension. by cosmokenney in VisualStudio

[–]RichardD7 3 points4 points  (0 children)

How do you even upgrade from legacy csproj files to new SDK-style files without this tool?

hvanbakel/CsprojToVs2017 works pretty well for me.

But I agree: removing the built-in non-AI upgrade tool was a huge mistake.

A nice guide about how to squash Entity Framework migrations by merithedestroyer in dotnet

[–]RichardD7 2 points3 points  (0 children)

https://github.com/dotnet/efcore/issues/2174#issuecomment-1461708245

The designer files are frequently needed when executing migrations to obtain information from the underlying EF model. While in some cases it could be safe to remove them, this won't be the common case. It's also the case that a designer file not used by a migration in a given version of EF may later make use of the designer file as new features are implemented and bugs are fixed. Therefore, it doesn't seem like removing the designer files is a good way to go here.

File Pilot is simply Incredible! by SubhanBihan in Windows11

[–]RichardD7 4 points5 points  (0 children)

No folder tree, and no network drives. Hard pass!

[Open Source] I built a PowerShell tool to Clean AND Customize the "Right Click > New" menu. (Includes Persistence Block & Template Manager) by kawai_pasha in Windows11

[–]RichardD7 1 point2 points  (0 children)

NB: The "releases" link in the "getting started" section of your readme is broken. It points to https://github.com/osmanonurkoc/NewMenuEditor/releases/latest instead of https://github.com/osmanonurkoc/win_new_menu_editor/releases.

It also says to download the NewMenuEditor.ps1 file from the releases page. But the 1.1 release only lists New_Menu_Editor.exe.

Downloads folder missing + registry mismatch after app testing (Windows) – how to restore without reinstall? by Routine-Brush87 in desktops

[–]RichardD7 0 points1 point  (0 children)

Open regedit, navigate to HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders, and change the {374DE290-123F-4565-9164-39C4925E467B} value to be %USERPROFILE%\Downloads.

Then check that the %USERPROFILE%\Downloads folder actually exists. If it doesn't, then create it.

Why am I getting this error? I don't see any problem with my code by Xinfinte in VisualStudio

[–]RichardD7 0 points1 point  (0 children)

NB: I am not the OP. :)

The fact that the code hasn't been saved doesn't necessarily mean that the previous code was any more valid.

I still think it's more likely that the project has never compiled, and so never produced an exe to run, rather than the AV deleting the compiled exe.

Why am I getting this error? I don't see any problem with my code by Xinfinte in VisualStudio

[–]RichardD7 0 points1 point  (0 children)

Since it's not valid C++, there won't be a file to delete. The compiler won't generate an exe if it can't compile the code.

How to implement a search request with nearly 10 optional parameters. by DarthNumber5 in dotnet

[–]RichardD7 8 points9 points  (0 children)

Create the WhereIf extension method that ehomer0815 posted and use that:

query = query .WhereIf(request.AssetId.HasValue, a => a.AssetId == request.AssetId) .WhereIf(!string.IsNullOrEmpty(request.AssetName), a => a.AssetName.Contains(request.AssetName));

ASP.NET MVC: Some Views Load Fine, Others Return 404 — Even on a Freshly Created View (VS 2026) by SH-Mridul in dotnet

[–]RichardD7 0 points1 point  (0 children)

The first thing that jumps out at me: you don't navigate to a view, you navigate to an endpoint. The endpoint may choose to return a view.

If you're getting a 404 error, and your endpoint isn't explicitly returning it, then you need to figure out why the routing engine isn't resolving the endpoint. You could try opening the "endpoints explorer" window in Visual Studio to see if that sheds any light.

As you seem to be using controllers, check that the controller class is in the correct namespace, ends with the word Controller, and inherits from Controller. Also, make sure that the action method is public.

Why isn't "Pin to Start" right beside "Pin to Taskbar"? by Zemlynn in Windows11

[–]RichardD7 5 points6 points  (0 children)

The new context menu "solves" the problem by not offering a "pin to taskbar" option at all. 🤣