Skip to main content

Posts

Showing posts from 2024

Who owns AI in your organization?

AI is the new shiny toy in many organizations, promising innovation, efficiency, and a competitive edge. But with great potential comes great complexity—and in many cases, inter-departmental turf wars over who should "own" AI. IT wants control for its infrastructure expertise, Data Science claims it as their domain due to their deep knowledge of models and analytics, and business units see it as a tool to drive their specific goals. So, who really owns AI? I think that’s the wrong question to ask…. AI’s transformative potential means it touches almost every part of an organization. Each department has valid reasons for their claim, but this fragmented approach can lead to inefficiencies, duplicated efforts, and missed opportunities. AI is not a standalone tool that fits neatly into one department. In my opinion it’s a cross-functional enabler that thrives on collaboration. Framing AI as something to be "owned" misses its broader organizational value. Instead...

Efficient searching in .NET with SearchValues

While browsing through the list of changes in .NET 9, I noticed a remark about the SearchValues functionality. I had no idea what it does so time to further investigate this feature... The SearchValues<T> type was introduced in .NET 8 to help optimize search. It allows us to specify the values we want to search for. Based on the provided values the runtime will come up with different strategies to optimize the search performance. After the SearchValues<T> is created, we can use it on any ReadOnlySpan<T> . Here is a small example: In .NET 8, the SearchValues was limited to simple data types like char. Starting from .NET 9, you can also use string values: Remark: Use SearchValues<T> when you expect to use the same search values a lot. More information SearchValues Class (System.Buffers) | Microsoft Learn SearchValues<T> Class (System.Buffers) | Microsoft Learn What's new in .NET 9 | Microsoft Learn

Free ebook - Practical debugging for .NET Developers

Even with the introduction of AI in the software development process, debugging remains an important part of our job. Being able to investigate difficult problems efficiently and find solutions fast is an important skill to master. The good news is that it is a skill you can learn and the even better news is that you can get help through the ‘Practical Debugging for .NET Developers’ book by  Michael Shpilt that is now available for free!   I like to share a fragment of the introduction: The best software engineers I know are excellent at debugging. They find solutions to difficult problems where no one else can. They accomplish this by using the right tools, knowing what to look for, and having a deep understanding of both their own domain and the .NET ecosystem. Moreover, they conduct a systematic investigation using proven debugging methodologies. Debugging is not an art—it’s something that can be taught, and this book is going to do exactly that. This book is all abou...

Docker - Environment variable is not picked up

I lost a lot of time today with a stupid issue I had with docker. I’m playing around with OpenUI (more about it in another post) and wanted to use it in combination with Ollama to limit the costs. In the documentation I found I could do this by setting the OLLAMA_HOST environment variable on startup. I know I had to use the --env or –e parameter to pass the value. So this was my original attempt: docker run --rm --name openui -p 7878:7878 ghcr.io/wandb/openui --env OLLAMA_HOST= http://host.docker.internal:11434 Unfortunately when I took a look at the logs, I noticed that the default value was still used: I lost a lot of time until I finally discovered that the environment variable should be set BEFORE the image. Here is the updated and working command: docker run --rm --name openui -p 7878:7878 --env OLLAMA_HOST=http://host.docker.internal:11434 ghcr.io/wandb/openui More information Set environment variables | Docker Docs GitHub - wandb/openui: OpenUI let's yo...

Custom instructions when using GitHub Copilot

Last week when talking about a new release of the JetBrains AI assistant, I noticed a specific feature I really liked; the prompt library. This allows you to tweak the prompts that are used in specific contexts. This made me wonder, does a similar feature exists for GitHub Copilot? Let’s find out… Custom instructions(preview) For GitHub Copilot, a similar feature is in preview; Custom Instructions . With custom instructions you can provide extra context that will be added to your conversations so that Copilot can generate higher quality responses. To use this feature, we first need to enable it because it is still in preview. I’ll show you how to this using Visual Studio(check the link at the bottom of this post to see the instructions for VS Code). Open Visual Studio (make sure you have the latest version installed) Go to Tools   -> Options Search for custom instructions Select the checkbox for (Preview) Enable custom instructions to be loaded from .g...

The downside of hiring for cultural fit

For years, hiring for cultural fit has been a cornerstone of my recruitment strategy. The idea is simple: more than focusing only on skills, I focused on finding people who aligned with our company's values, norms, and practices to create a harmonious and productive work environment. This also means that I put a lot of focus on building a strong culture inside my team. Cultural fit However, when listening to Malcolm Gladwell and Adam Grant on the Work Life podcast, I had to re-think this approach as it highlighted the potential downsides of overemphasizing cultural fit. In the podcast Adam says that startups where founders put culture fit first, their organizations are dramatically less likely to fail. So culture fit clearly wins in terms of startups surviving and then going public. But studies have shown that after their IPO, these ‘culture fit’ firms grow at slower rates.  He thinks that what is happening is that early on when you have a really clear mission, it's very ...

JetBrains AI Assistent–Ollama support

I talked about Ollama before as a way to run a Large-Language-Model(LLM) locally. This opens the door to try out multiple modals at a low(er) cost (although also a lower performance) and could be interesting if you are not allowed to share any data with an AI provider. For example you are a developer but your employer doesn’t allow you to use AI tools for that reason. If this is a use case that is relevant for you, than I have some good news for you. With the latest version of JetBrains AI Assistent(available in JetBrains Rider but also other IDE’s) you can now use Let me show you how to use this: Open JetBrains Rider(or any other IDE that integrates the JetBrains AI Assistent) Hit Ctrl-Alt-S or go to the Settings through the Settings icon at the top right   Go to the AI Assistant section under Tools Check the Enable Ollama checkbox. A warning message appears about Data Sharing with Third-Party AI Service Providers. Click OK to con...

Ollama - Unable to locate runners

I'm a big fan of Ollama as a way to try and run a large language model locally. Today I got into trouble when I tried to connect to Ollama. When I tried to run Ollama through ollama serve I got the following error message: time=2024-12-02T21:15:55.398+01:00 level=ERROR source=common.go:279 msg="empty runner dir" Error: unable to initialize llm runners unable to locate runners in any search path I was able to fix the issue by going the AppData\Local\Ollama folder. There inside updates I found a new(er) version that I installed manually by executing the OllamaSetup.exe. After the setup completed, Ollama was running again as expected. More information Ollama

Visual Studio 2022 17.12- Show inline return values while debugging

With the 17.12 version of Visual Studio 2022 there comes a feature that I was waiting to be added for a long time(and with long I really mean long). Of course you are wondering what feature I'm talking about. Let me first set the scene by showing you the class I want to debug: I created a small Calculator example. Notice that I'm using 2 different syntaxes(the regular syntax and expression-bodied method). This is not an accidental inconsistency from my side as you’ll see later. Now what if I wanted to debug the return values of these functions. Before the latest Visual Studio update I typically used a temporary variable to inspect the return values or took a look at the Autos window or the Watch window. With this release, you finally see the return statements inline in the editor window. Here is an example where I added the breakpoint at the end of the function: Unfortunately this doesn’t work (yet?) when using the expression-bodied method syntax, this is because ...

C# 13–Implicit index access

New features keeps getting added to C#. With the release of C# 13 as part of .NET 9, you can now use the implicit index operator, ^ , to initialize a collection in reverse order. Before C# 13, you had to index elements from the front when using an object initializer. With the introduction of this operator, you get better readability and it  can help avoid potential off-by-one errors. More information What's new in C# 13 | Microsoft Learn

Autonomy and loose coupling are not only an important characteristic for a software architecture

A utonomy in software design refers to the ability of a system or component to operate independently, making decisions and performing tasks without requiring other components or systems. Autonomy goes hand in hand with loose coupling , limiting the number of dependencies between components. These concepts are crucial for creating systems that are resilient, adaptable, and capable of handling complex tasks in dynamic environments. But could we apply the same concepts outside software design? Let's find out... Some observations If I showed you the following component diagram; what would be some observations, you could make?   Here are some of mine: Information is flowing up from components B, C and D to A. Probably there is some centralized decision making where most of the power is residing in component A. There is a high dependency on component A inside the system. Although without extra details we can misinterpret this diagram, but the risk exists that the co...

Powershell - The profile for the user is a temporary profile

Today I investigated an issue we had in one of our build pipelines. For an unknown reason the build suddenly started to fail. In the build logs we found the following error message: ============================================================================== Generating script. Arguments passed sanitization without change. Formatted command: . 'D:\b\2\_work\135\s\Certificates\Import-PfxCertificate.ps1' -PfxFilePath ***2024.pfx -Password *** ========================== Starting Command Output =========================== "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command ". 'D:\b\2\_work\_temp\e3fa7d9e-bd6e-490f-8f71-182a958e03d7.ps1'" Importing store certificate &#39;D:\b\2\_work\135\s\Certificates\***2024.pfx&#39;... Exception calling "Import" with "3" argument(s): "The profile for the user is a temporary profile. ...

Creating a dependency graph using Github Copilot

Today I was in a meeting with 2 colleagues where we were discussing a specific solution. We were investigating which component had dependencies on which other component to find a way to simplify the architecture and limit the number of dependencies. After the meeting I wondered if Github Copilot could help. I opened the solution in Visual Studio and tried a first prompt: Create me a mermaid diagram showing all projects with their dependencies That didn’t resulted in what I hoped for. By default Visual Studio doesn’t automatically include context. Let’s fix that by adding @workspace: That look’s promising! Let’s copy the result over to a mermaid visualizer tool: Exactly what I was looking for. Nice!

Trust & Inspire instead of Command & Control

I have been in a leadership role for many years and had the opportunity to follow multiple leadership trainings. These trainings all agree that good leadership does not come from a Command & Control mindset. Despite this knowledge I still see some leaders fall back to this mindset. They rely heavily on authority, directives, and the carrot-and-stick approach—rewarding compliance and punishing deviation. While these tactics may yield short-term results, they fail to unlock the true potential of individuals and teams. While authority, directives, and the carrot-and-stick approach may yield short-term results, they fail to unlock the true potential of individuals and teams. I believe in another model where leaders start from a Trust & Inspire mindset. The core idea is to move away from the traditional Command & Control approach by focusing on empowering and inspiring individuals rather than directing and managing them through authority and compliance. Remark: One ...

.NET 8 upgrade - AuthenticationHandler

I know, I know, .NET 9 is released but I’m still helping one of my customers to move all workloads to .NET 8 first. Today we got a compiler error after upgrading our authentication code to .NET 8: 'ISystemClock' is obsolete: 'Use TimeProvider instead.' 1>C:\projects\IAMCore\IAM.Loket\IAMApiKeyAuthenticationHandler.cs(21,13,21,52): warning CS0618: 'AuthenticationHandler<IAMApiKeyAuthenticationOptions>.AuthenticationHandler(IOptionsMonitor<IAMApiKeyAuthenticationOptions>, ILoggerFactory, UrlEncoder, ISystemClock)' is obsolete: 'ISystemClock is obsolete, use TimeProvider on AuthenticationSchemeOptions instead.' Sidenote: I know that this is a warning, but we got ‘ Treat warnings as errors enabled’, a good practice I would recommend everyone to activate on their projects. Here is the original code: ISystemClock was an old abstraction to help during testing. It was never promoted as an official feature. With the release of .NE...

NU1803–NuGet requires HTTPS sources

Today I had to make an update in an old application that was still based on .NET 4.8. When trying to build the application I got the following warning message: NU1803 – NuGet requires HTTPS sources. When going to the NuGet Package Manager in Visual Studio I got a similar warning: The clean solution is switch to an HTTPS based URL. For this application I just removed the old HTTP based package source from my nuget.config file as it was no longer used. If you are absolutely certain you can trust the HTTP source, you can opt out of this warning by setting allowInsecureConnections to true for this package source: More information NuGet Warning NU1803 | Microsoft Learn

.NET Upgrade Assistant now supports upgrading to Centralized Package Management

Centralized package management in Visual Studio is a feature that allows you to manage NuGet package dependencies for multiple projects from a single location. This is particularly useful for large solutions with many projects, as it simplifies the process of keeping package versions consistent across the entire solution. To enable centralized package management, you need to create a Directory.Packages.props file at the root of your repository and set the MSBuild property ManagePackageVersionsCentrally to true . Inside this file, you define the package versions required by your projects using <PackageVersion /> elements. For each project, you then define a <PackageReference /> but omit the Version attribute, as the version will be obtained from the corresponding <PackageVersion /> item. Although this is not that much work, if you find this still too cumbersome I have some good news for you; with the latest release of the .NET Upgrade Assistant, you can let t...

VISUG XL - Azure Static Web Apps

Hello everyone, I hope that when you are reading this post, you are doing it live from VISUG XL 2024 where I'm giving a presentation about Azure Static Web Apps. During this presentation I show(ed) a lot of the great features that Azure Static Web Apps has to offer. In case you have missed the presentation or you want to get more details, I can recommend to check out the full blog series that I created about Azure Static Web Apps: Part I - Using the VS Code Extension Part II - Using the Astro Static Site Generator Part III  – Deploying to multiple environments Part IV – Password protect your environments Part V – Traffic splitting Part VI – Authentication using pre-configured providers Part VII – Application configuration using staticwebapp.config.json Part VIII – API Configuration Part IX – Injecting snippets Part X – Custom authentication Part XI – Authorization Part XII -  Assign roles through an Azure function Part XII...

NU1301–Unable to load the service index for source

Today a colleague contacted me because she got an error when trying to build a specific solution inside Visual Studio. The compilation process failed on contacting the internal Azure DevOps Artifacts nuget feed. Instead she got the following error message: NU1301 Unable to load the service index for source  I tried to load and build the same project but I couldn’t reproduce the issue. There are multiple reasons why this error message appears. I suggested here to try any of the following: Restart Visual Studio: always a good one to try first Run dotnet restore in Interactive Mode : Run the dotnet restore command in interactive mode can help resolve the issue. Clear NuGet Cache : Sometimes, clearing the NuGet cache can help. You can do this by running the following command in the terminal: nuget locals all -clear Neither of my suggestions seemed to help. In the end she was able to solve the issue by removing the local nuget.config file. As she had the pack...

Using secrets.json in IIS

In the world of software development, safeguarding sensitive data is paramount, especially when it comes to configuration settings that may include passwords, API keys, and connection strings. ASP.NET Core provides a robust mechanism for managing such sensitive data during development through the use of a secrets.json file. This feature is part of a broader configuration system that allows developers to store and retrieve application settings in a variety of ways, including environment variables, command-line arguments, and external files. The secrets.json file is a secure and convenient place to store confidential information that is specific to your development environment. It is not checked into source control, which means your secrets are not exposed when your code is shared or published. Instead, the secrets.json file resides in a system-protected user profile folder on your machine, keeping your secrets outside your main source tree avoiding that you accidently check-in and sha...

Multi model support in Github Copilot

Today I want to point out a new feature that was recently introduced in Github Copilot chat; support for multiple large language models. It is now possible to choose between different models so that you can choose the model that aligns best with the needs you have in your specific project. Models that are supported today are GPT-4o, o1, o1-mini and Claud Sonnet 3.5. Remark: To be exact, I have to point out that Github Copilot was leveraging multiple LLMs already for different use cases. Let me show you how this feature works… VS Code Open Github Copilot Chat inside VSCode Click on the ‘Pick model’ dropdown and select a different model   That’s it! Visual Studio Open Github Copilot Chat inside Visual Studio Click on the ‘Pick model’ dropdown and select a different model   That’s it! Remark: I noticed that the Claud Sonnet 3.5 model is not yet available inside Visual Studio. More information https://github.blog/changelog/20...

.NET Conf 2024 is almost there!

Make sure you are well rested as the next 3 days you'll need all your energy to learn about the latest and greatest in .NET at .NET Conf 2024 , a free virtual event from November 12 until November 14. This year you’ll discover the newest features and enhancements in .NET 9, including cloud-native development , AI integration , and performance improvements .   Join me and many others to learn from the .NET team members and the broader .NET community.  Don't forget to collect your free digital swag , enter your details to win a price bag from the sponsors or participate in the challenge to also win a price. More information .NET Conf 2024 What's new in .NET 9 | Microsoft Learn

Web Deploy - WDeployConfigWriter issue

At one of my customers, we are still (happily) using Microsoft Web Deploy to deploy our web applications to IIS. This works great and is all nicely automated and integrated in our Azure DevOps pipelines. Until the moment it no longer works. Something that happened last month when trying to deploy one of our projects. A look at the web deploy logs showed us the following error message: Web deployment task failed. ((2/11/2024 15:00:08) An error occurred when the request was processed on the remote computer.)(2/11/2024 15:00:08) An error occurred when the request was processed on the remote computer.Unable to perform the operation. Please contact your server administrator to check authorization and delegation settings. Time to contact the server administrator... Unfortunately that’s my team in this case. So let’s investigate. We logged in on the web server and checked the event logs. There we got some extra details: A tracing deployment agent exception occurred that was propagat...

Embracing change requests: a mindset shift

In software development, change requests(CR) often get a bad reputation. As developers and architects it can feel frustrating to have to redesign and change existing features(especially if the change request has a big impact on the existing system). However, we should see them as a positive sign for a product's success, evolution, and continued relevance. Let’s explore why… Reason 1 - Our system is used! The fact that we get a CR means that at least someone tried our system and even better they see value in using it further because they want to improve it. When users ask for changes, it's because they're actively engaging with the software. They’re uncovering real-world use cases and scenarios that may not have been anticipated during initial design. This feedback loop confirms that the software is doing something valuable—and that users believe it can do even more. Reason 2 – We have learned something! Software, by its nature, is built to be flexible and adaptabl...