The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 4,262 other subscribers

Archive for the ‘VB.NET’ Category

sharplab.io – ashmind/SharpLab: .NET language playground

Posted by jpluimers on 2024/05/08

[Wayback/Archive] ashmind/SharpLab: .NET language playground is hosted on [Wayback/Archive] SharpLab.io  and has this README:

Read the rest of this entry »

Posted in .NET, C#, C# 10, C# 11, Development, F#, Software Development, VB.NET | Leave a Comment »

Oh boy, VB.NET and JavaScript both have a `with` keyword too!

Posted by jpluimers on 2024/03/05

Last year, within a week, I saw two tweets of languages that, like Pascal, have a with statement as well:

  1. [Archive.is] Shawn Wildermuth 💻☕🎸🎥🎮 on Twitter: “JavaScript’s Forgotten Keyword (with)”
  2. [Archive.is] John Kaster #BlackLivesMatter on Twitter: “@suited_aces @marcocantu @delphijunkie @JimMcKeeth @jpluimers I present “with”… “

The first points to an article that shows the JavaScript implementation of with is very similar to the Pascal one: [Wayback] JavaScript’s Forgotten Keyword (with) – DEV Community.

Just in case some of my readers do not know my opinion of the Pascal with statement  (it even has it’s own blog category), I really think you should not use it Delphi: you should avoid the with statement as it makes your code less future proof.

The reason not to use it is called [Wayback] Accidental Shadowing in computer language speak (it also can rear its head when you define variables at different block levels like for instance this golang example: [Wayback] Warning for accidental variable shadowing with block scope – Technical Discussion – Go Forum).

Even the JavaScript specification advises against using the with keyword in [Wayback] with – JavaScript | MDN

**Warning:**Use of the with statement is not recommended, as it may be the source of confusing bugs and compatibility issues. See the “Ambiguity Contra” paragraph in the “Description” section below for details.

There have been various proposals to extend the Delphi implementation of the with statement to make it more resilient to Accidental Shadowing by forcing the usage to be prepended by a . (dot) or alias, as for instance seen in [Wayback] Re: “with” Coders are Monsters – delphi / [Wayback] delphi • View topic • “with” Coders are Monsters:

This is in fact what the second twitter messages pointed to: a VB.NET example doing just that: prepend with a dot: [Wayback] Maarten Balliauw on Twitter: “Looks like using With makes it pretty clean!… “

I was not even aware that VB.NET had it, but it has: [Wayback] With…End With Statement – Visual Basic | Microsoft Docs

And it has similar debugging issues as with Delphi as per [Wayback] The VB.NET ‘With’ Statement – embrace or avoid? – Stack Overflow:

Find the beginning of a With statement and set a breakpoint. Step to the next line (so you’re hiding the first line right under the if block). Highlight it, then ‘Add Watch’. You should see this: ‘With’ contexts and statements are not valid in debug windows.

–jeroen

Posted in Delphi, .NET, Software Development, Development, Scripting, VB.NET, JavaScript/ECMAScript, Pascal, With statement, Go (golang) | Leave a Comment »

awaescher/Fusion: 🧰 A modern alternative to the Microsoft Assembly Binding Log Viewer (FUSLOGVW.exe)

Posted by jpluimers on 2023/12/18

[Wayback/Archive] awaescher/Fusion: 🧰 A modern alternative to the Microsoft Assembly Binding Log Viewer (FUSLOGVW.exe)

So, do you know what “Enable immersive logging” means? Or why you should separate log categories from “Default” and “Native Images”? Did you ever forget to disable the log again and wondered why every .NET application was that slow and your disk ran out of space?

Forget all the setup upfront – just hit “Record” to capture your assembly logs. If you are done, click “Stop” again. That’s it.

Via [Wayback/Archive] Meik Tranel on Twitter: “@Nick_Craver Take this: github.com/awaescher/Fusion Nice UI and never forget to disable that env var ever again.”.

–jeroen

Posted in .NET, C#, Development, F#, Software Development, VB.NET | Leave a Comment »

.NET: programmatically cutting and pasting files (as opposed to copy/pasting them)

Posted by jpluimers on 2022/11/17

Some notes for my link archive.

A long time ago, I asked [Wayback/Archive] c# – Console application using Clipboard.GetFileDropList: how to check if that came from a cut or copy operation? – Stack Overflow.

Back then, the use case had disappeared, so I didn’t follow up. But a new use case might appear soon, so here it goes:

–jeroen

Posted in .NET, C#, Development, Software Development, VB.NET | Leave a Comment »

Mad With PowerShell: FileInfo and DirectoryInfo objects are not populated upon creation in PowerShell

Posted by jpluimers on 2020/01/16

[WayBack] Mad With PowerShell: FileInfo and DirectoryInfo objects are not populated upon creation in PowerShell.

TL;DR:

  • Apart from the FullName property, the other poprerties of FileInfo and DirectoryInfo are populated later than their instance creation
  • A call to their Refresh method populates or re-populates them
  • That method is implicitly called when you request other properties than FullName

Example: see the [Archive.is]fileinfo.cs: Length property

–jeroen

Posted in .NET, C#, CommandLine, Development, F#, PowerShell, Software Development, VB.NET | Leave a Comment »