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 1,822 other followers

Archive for the ‘.NET’ Category

Delphi developer switching to C# – Stack Overflow

Posted by jpluimers on 2020/01/23

Another blast from the past. I’ve been using many development environment all my live, so I have been using .NET very early on allowing me to make a good comparison: [WayBackDelphi developer switching to C# – Stack Overflow.

I have a broad toolbox because we’ve never lived in a “silver bullet” era: any problem needs a combination of tools to solve them. Having a broad toolset allows you to pick and choose more easily. Mastering the different tools however requires a lot of effort and time. You really need to love this profession to put that energy in it.

I heavily use both for software development.

Development speed of server apps (web apps, web services, windows services) is much higher in .NET.

Development speed of business apps (pure Windows UI) is much higher in Delphi.

Development of sexy apps is a pain in both environments.

A few things you should know:

  • Learning the .NET framework will take a lot of time: it is huge, but contains a lot of gizmos (some gems are really well hidden).
  • Don’t lose yourself in following all new trends at once: generics, lambda, LINQ, each are nice, but grasping them all at once is only for a few of us
  • For web apps, skip WebForms, but learn ASP.NET MVVC (yes, the Ruby guys were right after all); learn HTML 5 and JavaScript too.
  • For sexy Windows apps, learn WPF, but be prepared for a steep learning curve (designer, and framework are radically different)
  • Don’t get a too sexy UI: it costs you a disproportional amount of time while your users are waiting for functionality
  • Like the market has been bashing Delphi since version 1, the market is bashing SilverLight too
  • Skip WinForms; if you need something like WinForms, then Delphi is way more productive (even more so if you have an existing Delphi VCL codebase).
  • WPF is just as thread-friendly as the VCL or WinForms (read: neither of the 3 is thread friendly)
  • Don’t perform rewrites of your Delphi stuff in .NET (or for that matter any other 1:1 rewrite from platform A into platform B): it is a waste of your time.
  • Threading and synchronization are a pain in all development environments. The pain is not so much in the general stuff (the Concurrent Collections in the .NET 4 framework helps, as do the Delphi OmniThreadLibrary), but in getting the final details and exception cases right is the real pain.
  • Garbage collection does not mean that you won’t leak memory: it means that you won’t leak when your app terminates, but while it runs the leaks are way harder to detect (boy, I wish I had the FastMM memory monitor for .NET)

–jeroen

Posted in .NET, C#, Delphi, Development, Software Development | 2 Comments »

Delphi / Visual Studio build events: xcopy exit code 9009; ensure your PATH indeed includes the Windows directories

Posted by jpluimers on 2020/01/22

If you ever get an exit code 9009 from xcopy like the one below, then try using the full path to xcopy. It should be there, it should not matter, but it does if someone changed your path.

[Exec Error] The command " xcopy ....\Shared\DLL\FastMM\FastMM_FullDebugMode.dll .\Win32\Debug\ /y&& xcopy ....\Shared\DLL\OpenSSL\libeay32.dll .\Win32\Debug\ /y&& xcopy ....\Shared\DLL\OpenSSL\ssleay32.dll .\Win32\Debug\ /y&& xcopy ....\Shared\DLL\gRPC\nghttp2.dll .\Win32\Debug\ /y&& xcopy ....\Shared\DLL\gRPC\sgcWebSockets.dll .\Win32\Debug\ /y" exited with code 9009.

Preliminary solution: replace xcopy    with C:\Windows\System32\xcopy.exe .

Final solution: look with Process Explorer and Process Monitor what the exact environment PATH is. It should include C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;

If it does not, then find out what is changing your path.

Related:

–jeroen

Posted in .NET, Delphi, Development, Software Development | Leave a Comment »

visual studio code – Does the “editorWhitespace.foreground” workbench.colorCustomizations setting in VSCode actually work? – Stack Overflow

Posted by jpluimers on 2020/01/16

[WayBack] visual studio code – Does the “editorWhitespace.foreground” workbench.colorCustomizations setting in VSCode actually work? – Stack Overflow

Yes, it does. But after reading [WayBack] vscode-docs/theme-color-reference.md at master · Microsoft/vscode-docs · GitHub: Editor Colors or [WayBack] Visual Studio Code Theme Color Reference you might want to put it in the config straight like this:

see the editor white spaces, enable Toggle Render Whitespace.

  • editorWhitespace.foreground: Color of whitespace characters in the editor.

However, you need to embed it like this:

"workbench.colorCustomizations": {
    "editorWhitespace.foreground": "#333",
    "editorIndentGuide.background": "#333"
  }

The embedding makes it work.

References:

–jeroen

Posted in .NET, Development, Software Development, Visual Studio and tools, Visual Studio Code | 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 »

Debugging a stackexchange memory leak while transitioning to .NET Core: by @Nick_Craver

Posted by jpluimers on 2020/01/14

Cool thread with steps (windbg) tooling and graphs: this is how you approach problem solving.

Easiest to read: [WayBack] Thread by @Nick_Craver: “Well hello there memory leak…let’s see what you are. It’s times when I type !dumpheap without an argument that cals. Alrighty, let’s see what these little guys are: Quite a bit of repetition in here – let’s root some of the […]”

Twitter thread below the fold.

[WayBackNick Craver on Twitter: “So let’s form our dictionary in batches EF Core will load, like this. We can lower our SQL roundtrips to n / 1000 + relevant changes. It’s more SQL trips than our original 1, but we aren’t needlessly loading a million users into memory. We load about 0.3% of that instead.… https://t.co/wgHpWgCoJH”

Tooling:

Related: Some notes/links on Windows Debugging CLR applications

A good WinDbg introduction is [WayBack] Getting Started with WinDbg (User-Mode) | Microsoft Docs.

Note that temp tables in SQL Server might look nice, but actually do not scale well: [WayBack] Lucas Trzesniewski on Twitter: “I’ve found out the following massively improves performance over queries with an IN clause with lots of parameters: – Open a transaction – Create a temp table – Bulk insert your IDs into the temp table – Inner join your query on the temp table And you only make a single query.… https://t.co/anwGSrxRqh”

–jeroen

Read the rest of this entry »

Posted in .NET, .NET Core, .NET Core, .NET Standard, Development, Software Development | Leave a Comment »

 
%d bloggers like this: