c# – Creating RDLC report in ASP.NET Core Web API


Thought it might save people a lot of trouble if they knew a bad solution to avoid. I follow up with something that seems to be working.

VS2022. .netCore 8.0. Already had a WebAPI project to which I wanted to add an rdlc report.

Had the same issue, and worse. Not sure how, someone at work claimed he was able to create a new rdlc but the steps he gave never worked on anyone elses’ machine. So we just copy pasted the rdlc file he created and tried working on it from there.

The DataSet/DataSource dropdowns wouldn’t work consistently. Wouldn’t work at all unless our classes had primitive data types only and they were changed to interfaces with implementations. If you edited a class associated with a dataset that had been working, it would stop working.

I started a .netcore windows form app, and all the usual rdlc functionality started working. Much the same seems true for a standalone reporting project. I wrapped up teh classes I needed from my api into a Class LIbrary and imporfted into the reports project. So far so good. I wrap up my Data Access Layer and should be able to use that to generate the report. Then import that as a Project Reference

Not sure if this is is related, but Microsoft Reporting Services doesn’t seem to be compatible with .net 8.0. Was thinking of sorting that out, but since I have something workable, I’m avoiding it.

asp.net core – Cannot start debug session in Visual Studio due to SSL cert missing or being out of date


I have an ASP.NET web application that has been working fine when pressing F5 to start a debug session in Visual Studio. Last Friday (January 23) I started getting this exception:

System.InvalidOperationException: ‘Unable to configure HTTPS endpoint. No server certificate was specified, and the default developer certificate could not be found or is out of date.
To generate a developer certificate run ‘dotnet dev-certs https’. To trust the certificate (Windows and macOS only) run ‘dotnet dev-certs https –trust’.
For more information on configuring HTTPS see https://go.microsoft.com/fwlink/?linkid=848054.’

It references app.Run(); in Program.cs. Starting a debug session by opening the “Debug” menu and choosing “Start Debugging” results in the same error (not that I expected any different).

  1. I opened a PowerShell window as an administrator, and went with the Nuclear Option:

    Get-ChildItem -Path Cert:\CurrentUser -recurse | where { $_.Issuer -match 'localhost' } | remove-item
    

    Just get rid of all localhost SSL certificates.

  2. Closed Visual Studio, and ran git clean -fdx in the root folder for my Visual Studio solution.

  3. Reopened Visual Studio, and pressed F5 again.

  4. It prompted me to create and install 2 SSL certificates, and mark them trusted, which I did.

  5. The application died again at app.Run() with the same exact error.

  6. Next, I restarted the computer, and then repeated steps 1-5. Got the same error.

Just now I repeated steps 1-5 (a week later) and get the same error. I ran the following PowerShell command to list the expiration dates for all localhost SSL certificates:

> Get-ChildItem -Path Cert:\CurrentUser -recurse | where { $_.Issuer -match 'localhost' } | select NotBefore,NotAfter

NotBefore            NotAfter
---------            --------
1/30/2026 4:37:58 PM 1/30/2027 4:37:58 PM
8/26/2025 8:58:28 AM 8/25/2030 8:00:00 PM
1/30/2026 4:37:58 PM 1/30/2027 4:37:58 PM

I ran these commands after 4:40 PM EST, so the certs should be valid. Just listing the localhost certs provided this:

> Get-ChildItem -Path Cert:\CurrentUser -recurse | where { $_.Issuer -match 'localhost' }


   PSParentPath: Microsoft.PowerShell.Security\Certificate::CurrentUser\Root

Thumbprint                                Subject
----------                                -------
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX  CN=localhost
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX  CN=localhost


   PSParentPath: Microsoft.PowerShell.Security\Certificate::CurrentUser\My

Thumbprint                                Subject
----------                                -------
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX  CN=localhost

Program.cs

(after removing all our application-specific stuff and I’m still able to replicate the error)

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddControllersWithViews();
builder.WebHost.UseStaticWebAssets();

builder.Services.AddMvc(options => options.SuppressImplicitRequiredAttributeForNonNullableReferenceTypes = true)
    .AddRazorOptions(options 
        => options.ViewLocationFormats.Add("/Views/Emails/{0}.cshtml"));

var app = builder.Build();

app.UseDeveloperExceptionPage();
app.UseHttpsRedirection();
app.UseStaticFiles();
app.MapStaticAssets();
app.UseRouting();
app.MapStaticAssets();

app.MapControllerRoute("default", "{controller=Home}/{action=Index}/{id?}")
    .WithStaticAssets();

app.Run();

launchsettings.json

{
  "$schema": "https://json.schemastore.org/launchsettings.json",
  "profiles": {
    "http": {
      "commandName": "Project",
      "dotnetRunMessages": true,
      "launchBrowser": true,
      "applicationUrl": "http://localhost:5063",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Local"
      }
    },
    "https": {
      "commandName": "Project",
      "dotnetRunMessages": true,
      "launchBrowser": true,
      "applicationUrl": "https://localhost:7072;http://localhost:5063",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Local"
      }
    }
  }
}

The exception message gives a command to trust the certificates, which I ran:

> dotnet dev-certs https --trust
Trusting the HTTPS development certificate was requested. A confirmation prompt will be displayed if the certificate was not previously trusted. Click yes on the prompt to trust the certificate.
Successfully trusted the existing HTTPS certificate.

But I continue getting the same error.

Here is the full log in the terminal as the debug session starts:

dbug: Microsoft.AspNetCore.Watch.BrowserRefresh.BlazorWasmHotReloadMiddleware[0]
      Middleware loaded
dbug: Microsoft.AspNetCore.Watch.BrowserRefresh.BrowserScriptMiddleware[0]
      Middleware loaded. Script /_framework/aspnetcore-browser-refresh.js (16491 B).
dbug: Microsoft.AspNetCore.Watch.BrowserRefresh.BrowserScriptMiddleware[0]
      Middleware loaded. Script /_framework/blazor-hotreload.js (799 B).
dbug: Microsoft.AspNetCore.Watch.BrowserRefresh.BrowserRefreshMiddleware[0]
      Middleware loaded: DOTNET_MODIFIABLE_ASSEMBLIES=debug, __ASPNETCORE_BROWSER_TOOLS=true
fail: Microsoft.Extensions.Hosting.Internal.Host[11]
      Hosting failed to start
      System.InvalidOperationException: Unable to configure HTTPS endpoint. No server certificate was specified, and the default developer certificate could not be found or is out of date.
      To generate a developer certificate run 'dotnet dev-certs https'. To trust the certificate (Windows and macOS only) run 'dotnet dev-certs https --trust'.
      For more information on configuring HTTPS see https://go.microsoft.com/fwlink/?linkid=848054.
         at Microsoft.AspNetCore.Hosting.ListenOptionsHttpsExtensions.UseHttps(ListenOptions listenOptions, Action`1 configureOptions)
         at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.AddressesStrategy.BindAsync(AddressBindContext context, CancellationToken cancellationToken)
         at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.BindAsync(CancellationToken cancellationToken)
         at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.StartAsync[TContext](IHttpApplication`1 application, CancellationToken cancellationToken)
         at Microsoft.AspNetCore.Hosting.GenericWebHostService.StartAsync(CancellationToken cancellationToken)
         at Microsoft.Extensions.Hosting.Internal.Host.<StartAsync>b__14_1(IHostedService service, CancellationToken token)
         at Microsoft.Extensions.Hosting.Internal.Host.ForeachService[T](IEnumerable`1 services, CancellationToken token, Boolean concurrent, Boolean abortOnFirstException, List`1 exceptions, Func`3 operation)

I’m stumped. This was all working for a long time, and the Visual Studio workflow that creates and trusts the developer certificates the first time you start a debug session isn’t working either.

I can start the application fine using HTTP, so I have a workaround. Regardless, how can I fix this so starting a debug session in Visual Studio successfully spins up my application using Kestrel running on HTTPS?


As a backdrop to this, the day I noticed this start happening is also the same day some Windows updates were installed, and now I cannot power my machine down – KB5074754, KB5074753, and KB5073455. Today I installed KB5078132, which should include the patches to this shutdown problem from KB5077744 and KB5077797, however my machine still does not power down properly; it just restarts. I’m not sure if my SSL issue in Visual Studio has anything to do with this, but just in case it does, this is also going on at the moment.

c++ – How to register an C# class for COM?


I’d like to create an C# WPF library exposing some class to COM to use the class functionality from separate C++ project.

What I’d like to achieve is to have a WPF class which implements simple form like window where can i output the text messages using “shared”. exposed function, say OutputText. What i want is to instantiate the class object what in turn just spawns the form text window, and the using the OutputText just send some text to it. That all have to be done from C++ application, using exposed COM class and CoCreateInstance function to get the things roll.

Here is the C# code:

using Microsoft.SqlServer.Server;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace WpfCustomControlLibrary11
{
    [Guid("0E633447-41D9-4E28-A8F4-D24ADE2913CD")]
    public interface ICustomControl1
    {
        void Test();
    }
    [Guid("2002FDA9-E74A-4A88-B0E3-0CCD2C2695AD")]
    public class CustomControl1 : Control
    {
        static CustomControl1()
        {
            DefaultStyleKeyProperty.OverrideMetadata(typeof(CustomControl1), new FrameworkPropertyMetadata(typeof(CustomControl1)));
        }

        public void Test()
        {
            MessageBox.Show("CustomControl1 - Test");
            System.Console.Beep();
        }
    }
}

and the C++ code calling the exposed COM class:

#include <windows.h>
#include <iostream>
#include <thread>
#import  <WpfCustomControlLibrary11.tlb>
//#include <WpfCustomControlLibrary11.tlh>

EXTERN_C const CLSID CLSID_FileOpenDialog2;

const GUID CLSID_riid = { 0xe633447, 0x41d9, 0x4e28, { 0xa8, 0xf4, 0xd2, 0x4a, 0xde, 0x29, 0x13, 0xcd } };
const GUID CLSID_rclsid = { 0x2002fda9, 0xe74a, 0x4a88, { 0xb0, 0xe3, 0xc, 0xcd, 0x2c, 0x26, 0x95, 0xad } };

using namespace std;
using namespace WpfCustomControlLibrary11;

HANDLE fileHandle;
char buffer[100];
ICustomControl1* g_pMyComClient = NULL;
HRESULT g_hr = NULL;

void RunClient() {

    HRESULT hr = CoInitializeEx(NULL,
        //COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE
        COINIT_MULTITHREADED
    );
    if (SUCCEEDED(hr))
    {
        ICustomControl1* pMyComClient;
        
        hr = CoCreateInstance(
            CLSID_rclsid,
            NULL, CLSCTX_ALL,
            CLSID_riid,
            reinterpret_cast<void**>(&pMyComClient));

        if (SUCCEEDED(hr)) {
            g_hr = hr;
            g_pMyComClient = pMyComClient;
            pMyComClient->Test();
        }

        CoUninitialize();
    }
}

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
    PSTR lpCmdLine, int nCmdShow)
{
    sprintf(buffer, "WinMain - creating Client thread\n");
    OutputDebugString(buffer);
    buffer[0] = '\0';

    thread newThread(RunClient);
    newThread.join();

    sprintf(buffer, "WinMain - Client thread has ENDED!\n");
    OutputDebugString(buffer);
    buffer[0] = '\0';

    return 0;
}

I’ve performed below steps:

  • created the C# project using the WPF Custom Control Library(.NET Fremework) template.

  • checked Make assembly COM-visible in the project settings.

  • signed the library using the “sn -k Proj_Name.snk” and then providing this key in “signing” section in the project settings.

  • registered via RegAsm.exe

  • added to the GAC via gacutil /i

Now when i run the C++ Client i’m getting “REGDB_E_CLASSNOTREG Class not registered” error in response to CoCreateInstance call.

What’s curious when i create just the Windows Forms project using the Windows Forms Control Library(.NET Fremework) template and follow above steps everything works great – CoCreateInstance returns no errors and the function test is successfully being called.

What could be the reason for the WPF project class NOT being registered and therefore used by C++ client while the Windows Forms project class registers and run flawlessly?

Thx for help in advance!

visual studio – MAUI project not building on F5 after changes to the XAML, but it used to


When I make a change to the XAML of my project (say change the text in a label) the changes are reflected in the runnning app but if I re-run the app I get the old version of the file. If I build the App before I run it I get the new version. It seems that VS is not picking up the fact that a file has changed and it needs to rebuild, the Output (Build) window seems to confirm that as there is no mention of the Build just the Deployment. Even after closing and re-opening the project just pressing F5 gives me the old file, I have to hit build to get the new file.

Configuration manager is set to Build and Deploy for Debug.

enter image description here

I cant see anything obvious in Propject Properties
or Launch Profiles.

enter image description here

I have re-installed VS (Microsoft Visual Studio Community 2022 (64-bit) – Preview
Version 17.10.0 Preview 5.0)
I have logged out of OneDrive in case it was some sort of syncing problem.

I created a new vanilla MAUI app and that seems to work correctly which made me suppose that it was some kind of project setting causing this, so I looked at the project file, which seems to me (and I really have no clue about this but..) it looks a complete mess!! There are Includes, Removes and Updates everywhere, maby thats correct, I dont know.

<Project Sdk="Microsoft.NET.Sdk">

    <PropertyGroup>
        <!--<TargetFrameworks>net8.0-android;net8.0-ios;net8.0-maccatalyst</TargetFrameworks>-->

        <!--<TargetFrameworks>net8.0-ios;net8.0-maccatalyst</TargetFrameworks>-->
        <TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net8.0-windows10.0.19041.0</TargetFrameworks>
        <!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET -->
        <!-- <TargetFrameworks>$(TargetFrameworks);net8.0-tizen</TargetFrameworks> -->

        <!-- Note for MacCatalyst:
        The default runtime is maccatalyst-x64, except in Release config, in which case the default is maccatalyst-x64;maccatalyst-arm64.
        When specifying both architectures, use the plural <RuntimeIdentifiers> instead of the singular <RuntimeIdentifier>.
        The Mac App Store will NOT accept apps with ONLY maccatalyst-arm64 indicated;
        either BOTH runtimes must be indicated or ONLY macatalyst-x64. -->
        <!-- For example: <RuntimeIdentifiers>maccatalyst-x64;maccatalyst-arm64</RuntimeIdentifiers> -->

        <OutputType>Exe</OutputType>
        <RootNamespace>PropertyManagement</RootNamespace>
        <UseMaui>true</UseMaui>
        <SingleProject>true</SingleProject>
        <ImplicitUsings>enable</ImplicitUsings>
        <Nullable>enable</Nullable>

        <!-- Display name -->
        <ApplicationTitle>PropertyManagement</ApplicationTitle>

        <!-- App Identifier -->
        <ApplicationId>com.companyname.propertymanagement</ApplicationId>

        <!-- Versions -->
        <ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
        <ApplicationVersion>1</ApplicationVersion>

        <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">11.0</SupportedOSPlatformVersion>
        <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">13.1</SupportedOSPlatformVersion>
        <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>
        <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
        <TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
        <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion>
        <Configurations>Debug;Release</Configurations>
    </PropertyGroup>

    <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net8.0-windows10.0.19041.0|AnyCPU'">
      <Optimize>True</Optimize>
    </PropertyGroup>

    <ItemGroup>
        <!-- App Icon -->
        <MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" />

        <!-- Splash Screen -->
        <MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#512BD4" BaseSize="128,128" />

        <!-- Images -->
        <MauiImage Include="Resources\Images\*" />
        <MauiImage Update="Resources\Images\dotnet_bot.png" Resize="True" BaseSize="300,185" />

        <!-- Custom Fonts -->
        <MauiFont Include="Resources\Fonts\*" />

        <!-- Raw Assets (also remove the "Resources\Raw" prefix) -->
        <MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
    </ItemGroup>

    <ItemGroup>
      <Compile Remove="Accounts\**" />
      <EmbeddedResource Remove="Accounts\**" />
      <MauiCss Remove="Accounts\**" />
      <MauiXaml Remove="Accounts\**" />
      <None Remove="Accounts\**" />
    </ItemGroup>

    <ItemGroup>
      <Compile Remove="Agreements\Agreements.xaml.cs" />
      <Compile Remove="Models\PropertyType.cs" />
      <Compile Remove="Templates\DataTemplates\PropertyViewItemTemplate.xaml.cs" />
      <Compile Remove="Templates\DataTemplates\TenantViewItemDataTemplate.xaml.cs" />
      <Compile Remove="Services\DataSharing\AgreementData.cs" />
    </ItemGroup>

    <ItemGroup>
      <None Remove="Resources\Images\pexels1029599.jpg" />
      <None Remove="Resources\Images\pexels208736.jpg" />
      <None Remove="Resources\Images\pexels259588.jpg" />
      <None Remove="Resources\Images\pexels280222.jpg" />
      <None Remove="Resources\Images\remove.png" />
    </ItemGroup>

    <ItemGroup>
        <PackageReference Include="CommunityToolkit.Maui" Version="8.0.1" />
        <PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2" />
        <PackageReference Include="Microsoft.Maui.Controls" Version="8.0.21" />
        <PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="8.0.21" />
        <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0" />
        <PackageReference Include="sqlite-net-pcl" Version="1.9.172" />
        <PackageReference Include="SQLiteNetExtensions" Version="2.1.0" />
        <PackageReference Include="SQLiteNetExtensions.Async" Version="2.1.0" />
        <PackageReference Include="SQLitePCLRaw.bundle_green" Version="2.1.8" />
    </ItemGroup>

    <ItemGroup>
      <Compile Update="MyControls\PropertyTypePickerControl.xaml.cs">
        <DependentUpon>PropertyTypePickerControl.xaml</DependentUpon>
      </Compile>
      <Compile Update="RentalProperties\AddNewProperty.xaml.cs">
        <DependentUpon>AddNewProperty.xaml</DependentUpon>
      </Compile>
      <Compile Update="RentalProperties\PropertyList.xaml.cs">
        <DependentUpon>PropertyList.xaml</DependentUpon>
      </Compile>
      <Compile Update="RentalProperties\PropertiesPage.xaml.cs">
        <DependentUpon>PropertiesPage.xaml</DependentUpon>
      </Compile>
      <Compile Update="Tenants\TenantsPage.xaml.cs">
        <DependentUpon>TenantsPage.xaml</DependentUpon>
      </Compile>
      <Compile Update="Agreements\Templates\AgreementList_Item_UITemplate.xaml.cs">
        <DependentUpon>AgreementList_Item_UITemplate.xaml</DependentUpon>
      </Compile>
      <Compile Update="Dictionaries\TenantList_ItemTemplate.xaml.cs">
        <DependentUpon>TenantListItemTemplate.xaml</DependentUpon>
      </Compile>
      <Compile Update="Templates\DataTemplates\LetPropertyViewItemDataTemplate.xaml.cs">
        <DependentUpon>LetPropertyViewItemDataTemplate.xaml</DependentUpon>
      </Compile>
      <Compile Update="Templates\DataTemplates\UnLetPropertyViewItemDataTemplate.xaml.cs">
        <DependentUpon>UnLetPropertyViewItemDataTemplate.xaml</DependentUpon>
      </Compile>
      <Compile Update="Tenants\AddNewTenant.xaml.cs">
        <DependentUpon>AddNewTenant.xaml</DependentUpon>
      </Compile>
      <Compile Update="Agreements\AddNewAgreement.xaml.cs">
        <DependentUpon>AddNewAgreement.xaml</DependentUpon>
      </Compile>
      <Compile Update="Tenants\TenantList.xaml.cs">
        <DependentUpon>TenantListView.xaml</DependentUpon>
      </Compile>
      <Compile Update="Resources\Styles\ButtonStyles.xaml.cs">
        <DependentUpon>ButtonStyles.xaml</DependentUpon>
      </Compile>
    </ItemGroup>

    <ItemGroup>
      <MauiXaml Update="Agreements\Templates\AgreementList_DataTemplate.xaml">
        <Generator>MSBuild:Compile</Generator>
      </MauiXaml>
      <MauiXaml Update="MyControls\PropertyTypePickerControl.xaml">
        <Generator>MSBuild:Compile</Generator>
      </MauiXaml>
      <MauiXaml Update="Agreements\AgreementList.xaml">
        <Generator>MSBuild:Compile</Generator>
      </MauiXaml>
      <MauiXaml Update="RentalProperties\PropertyList.xaml">
        <Generator>MSBuild:Compile</Generator>
      </MauiXaml>
      <MauiXaml Update="Agreements\Templates\AgreementList_Item_UITemplate.xaml">
        <Generator>MSBuild:Compile</Generator>
      </MauiXaml>
      <MauiXaml Update="Templates\ControlTemplates\RadioButtonTemplate.xaml">
        <Generator>MSBuild:Compile</Generator>
      </MauiXaml>
      <MauiXaml Update="Dictionaries\TenantList_ItemTemplate.xaml">
        <Generator>MSBuild:Compile</Generator>
      </MauiXaml>
      <MauiXaml Update="Widgets\PropertiesWidget.xaml">
        <Generator>MSBuild:Compile</Generator>
      </MauiXaml>
      <MauiXaml Update="Dashboard.xaml">
        <Generator>MSBuild:Compile</Generator>
      </MauiXaml>
      <MauiXaml Update="RentalProperties\DeleteProperty.xaml">
        <Generator>MSBuild:Compile</Generator>
      </MauiXaml>
      <MauiXaml Update="RentalProperties\PropertiesPage.xaml">
        <Generator>MSBuild:Compile</Generator>
      </MauiXaml>
      <MauiXaml Update="Tenants\TenantsPage.xaml">
        <Generator>MSBuild:Compile</Generator>
      </MauiXaml>
      <MauiXaml Update="RentalProperties\AddNewProperty.xaml">
        <Generator>MSBuild:Compile</Generator>
      </MauiXaml>
      <MauiXaml Update="Tenants\AddNewTenant.xaml">
        <Generator>MSBuild:Compile</Generator>
      </MauiXaml>
      <MauiXaml Update="Agreements\AddNewAgreement.xaml">
        <Generator>MSBuild:Compile</Generator>
      </MauiXaml>
      <MauiXaml Update="Tenants\TenantList.xaml">
        <Generator>MSBuild:Compile</Generator>
      </MauiXaml>
      <MauiXaml Update="Resources\Styles\ButtonStyles.xaml">
        <Generator>MSBuild:Compile</Generator>
      </MauiXaml>
    </ItemGroup>

    <ItemGroup>
      <Folder Include="Accounts\ViewModels\" />
      <Folder Include="Suppliers\Templates\" />
      <Folder Include="Suppliers\ViewModels\" />
      <Folder Include="Widgets\ViewModels\" />
    </ItemGroup>

    <ItemGroup>
      <PRIResource Remove="Accounts\**" />
    </ItemGroup>

    <ItemGroup>
      <MauiXaml Remove="Agreements\Agreements.xaml" />
      <MauiXaml Remove="Templates\DataTemplates\PropertyViewItemTemplate.xaml" />
      <MauiXaml Remove="Templates\DataTemplates\TenantViewItemDataTemplate.xaml" />
    </ItemGroup>

    <ItemGroup>
      <Compile Include="Accounts\ContentPages\AccountsHomePage.xaml.cs">
        <DependentUpon>AccountsHomePage.xaml</DependentUpon>
      </Compile>
    </ItemGroup>

    <ItemGroup>
      <MauiXaml Include="Accounts\ContentPages\AccountsHomePage.xaml">
        <Generator>MSBuild:Compile</Generator>
      </MauiXaml>
    </ItemGroup>

</Project>

I commented out everything that was directly related to my code but no difference. Tried deleting the .vs file, no difference.

Now at a brick wall. Any help is really appreciated

c++ – Cross-compiling for ARM64 using Visual Studio and WSL2 is generating x64 binary


I was using VS2026, but have switched back to VS2022 for now. The project is a MSBuild project, not a CMake project. I have the C++ ARM64/ARM64EC build tools installed (latest) and I have all the required libraries and tools installed in WSL. However, for some reason it keeps building Advanced Micro Devices X86-64 binaries.

My .vcxproj has only 2 configurations, ARM and ARM64, and ARM64 is set config manager.

When I set the build output to Diagnostic, I can see that it is setting the Platform as ARM64 (sample provided below) and it even outputs the binary to the ARM64 output directory, yet nothing I do will force it to build an ARM64 binary.

1>------ Rebuild All started: Project: NativeSerialPort, Configuration: ReleaseLinux ARM64 ------


1>  Using "Message" task from assembly "Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
1>  Task "Message"
1>    Task Parameter:Importance=Low
1>    Task Parameter:Text=Configuration=ReleaseLinux
1>    Configuration=ReleaseLinux
1>  Done executing task "Message".
1>  Task "Message"
1>    Task Parameter:Importance=Low
1>    Task Parameter:Text=Platform=ARM64
1>    Platform=ARM64

When I inspect the library with file (on WSL), this is says X64 and the library, and as expected, the library fails to load under arm64 install.

libNativeSerialPort.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=96996de8ea441261e335bc02b46910918d61eaa9, with debug_info, not stripped

Looking further at the output from the build I can see the options that VS is telling gcc to use, but I cannot find any reference to the tool it is actually using to do the build.

Compiling sources:
1>    g++ -c -x c++ /root/projects/NativeSerialPort/NativeSerialPort.cpp -g1 -o "/root/projects/NativeSerialPort/obj/ARM64/ReleaseLinux/NativeSerialPort.o" -Wall -Wswitch -W"no-deprecated-declarations" -W"empty-body" -Wconversion -W"return-type" -Wparentheses -W"no-format" -Wuninitialized -W"unreachable-code" -W"unused-function" -W"unused-value" -W"unused-variable" -O3 -fno-strict-aliasing -fomit-frame-pointer -D_DEFAULT_SOURCE -DNDEBUG -fpic -fthreadsafe-statics -fexceptions -frtti -std=c++11
1>    NativeSerialPort.cpp

Is there anywhere I am missing when you need to specify what toolchain to use? The only option I can see in Visual Studio is WSL2 GCC Toolset.

I have no idea what I am doing wrong here.

Visual Studio January Update – Visual Studio Blog


Summary of VS January updates

Productivity Improvements

This month, we are bringing you a series of small yet long requested and popular features to let you better control and customize your editor.

  • Fast scrolling: Hold down the Alt key while scrolling the mouse wheel to move quickly when reviewing code or reading documentation. You can adjust the fast-scrolling speed in Tools > Options > Text Editor > Advanced > Touchpad and mouse wheel scrolling sensitivity.
  • Middle click scroll: Press down on your scroll wheel and move the mouse to quickly scroll through your document, making it easier to explore large files. This feature is off by default in 18.3 Insiders 2 and needs to be enabled via Tools > Options > Text Editor > Advanced > Middle click to scroll.
  • HTML-rich copy paste: Visual Studio now supports HTML clipboard format when cutting or copying code from the editor. You can paste colorized code into web versions of Office apps, Azure DevOps work items, or other HTML-based controls. This feature is available in the latest Insiders and will be shipped in the Release channel soon.
  • Syntactic line compression: Lines without letters or numbers are compressed by 25%, letting you see more code at once. Regular lines stay the same height. Enable this feature in Tools > Options > Text Editor > Advanced by checking Compress blank lines and Compress lines that do not have any alphanumeric characters.
  • Slimmer left margin: We’ve heard you that you would like to see a slimmer left margin to have more horizontal space for your code! To save an extra column, we moved the Quick Actions icon (lightbulb or screwdriver) from the margin into the editor, where it appears inline with your code when fixes or refactoring are available. To try out the experience now, go to Tools > Options > Text Editor > Advanced and check Show Quick Actions icon inside the editor. We also have more customized margin controls coming, so stay tuned!

Colorized Code Completions

Code completions are now colorized with syntax highlighting to help you quickly parse suggested code between variables, functions, and other elements! To try out this experience, go to Tools > Options > Text Editor > Code Completions and check “Use colorized text for code completions.

To differentiate suggestions from actual code, colorized completions use lower opacity and italic styling. If you want to further customize the look, go to Tools > Options > Environment > Fonts and Colors and select “Code Completions” from the Display items list. From there, you can customize the font, size, foreground/background colors, and styles (bold, italicized…).

Click to Accept Code Completions Partially

Have you ever wanted to accept a code completion partially with a single click? With this new feature, you can click directly inside a suggestion to accept it up to the cursor position. As you hover over the suggestion, each segment highlights to show exactly what will be accepted.

Using mouse clicks to partially accept a suggestion

This feature gives you more control over how much of a completion you want to accept. If you prefer using the keyboard, you can still press Ctrl + Right Arrow to accept one word at a time, or Ctrl + Down Arrow to accept one line at a time.

Streamlined Markdown Preview Controls

Visual Studio Markdown editor now gives you faster, clearer access to preview options:

  • Switch between preview modes: Split Preview shows the editor and preview side by side, Open Preview shows only the preview, and Edit Markdown shows just the editor. The preview-only mode helps you focus on rendered content, especially for large images or complex Mermaid diagrams.
  • When previewing a Mermaid diagram, use the zoom controls in the top-left corner to zoom in or out for better readability.
  • When Copilot Chat generates markdown content, click the Preview button at the top right corner of the chat window to see a rendered view. You can then edit and save the content directly. No need to copy and paste manually.

 

To try all this latest goodness, please update your Visual Studio regularly and join us in the Insiders Channel if you haven’t yet! (Note: All features shared in this blog post are available in Visual Studio 2026 only.) Please give them a try and let us know any feedback you have or the next thing you would like to see!

c# – Why aren’t my environment variables being set in Visual Studio 2026?


I’m working on a Windows machine which has been locked down fairly heavily, so I’m unable to set environment variables on my machine. Since I’m using Visual Studio 2026, I tried setting the environment variables via the projects properties, as you can see below.

launchSettings.json:

{
  "profiles": {
    "MyProject": {
      "commandName": "Project",
      "environmentVariables": {
        "MY_VARIABLE": "my_value"
      }
    }
  }
}

Properties -> Debug -> General:

environment variables in vs 2026

I’m then trying to retrieve the value of the environment variables value with Environment.GetEnvironmentVariable() like so:

TestVariable = Environment.GetEnvironmentVariable("MY_VARIABLE") ?? string.Empty; 

However, when running this locally, this code always returns an empty string, suggesting it couldn’t find the environment variable.

I’m doing all of this inside of an NUnit project, and I’ve tried running it in debug mode. Also, this code works just fine when plugged into our GitLab CI/CD pipeline with the environment variable set via our .gitlab-ci.yml file.

Why aren’t the values of my environment variables set via Visual Studio 2026 being respected?

c# – The auto-completion for await changes the method’s signature – how do I prevent that?


I cannot reproduce the problem.

before tab

enter image description here

afer tab

enter image description here

I’m running

Microsoft Visual Studio Professional 2022
Version 17.11.5

C# Tools   4.11.0-3.24460.3+5649376e0e5f5db3743a94a62b073f2cce4be5d9
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual Studio IntelliCode   2.2
AI-assisted development for Visual Studio.

In a response to a related issue async/await Visual Studio autocomplete #68512 on github the functionality is mentioned:

We also just add ‘async’ automatically to the method if you try to complete out await in your method body.

It does not mention any modification of the return type (or lack thereof). Note that the opener of the issue explicitly asks for a modification of the return type to Task, which is the undesired behavior that you observe.
However the issue is “closed as not planned”.

In this PR, the functionality was implemented including the modification of the return type.

c# – Xamarin: System.IO.IOException: The file name, directory name, or volume label syntax is incorrect


I’m building a mobile application, however, when I try to put an image png under the Android Device (Android – Resources Drawable) I get this weird error when running the application:

Severity Code Description Project File Line Status Deleted
Error System.IO.IOException: The file name, directory name, or volume label syntax is incorrect.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.Directory.DeleteHelper(String fullPath, String userPath, Boolean recursive, Boolean throwOnTopLevelDirectoryNotFound, WIN32_FIND_DATA& data)
   at System.IO.Directory.Delete(String fullPath, String userPath, Boolean recursive, Boolean checkHost)
   at Xamarin.Android.Tasks.RemoveDirFixed.RunTask() mvm_guia2.Android

I don’t know why I’m getting that, and the only way that I have found to troubleshoot this is by creating a new project.

Any recommendations?

App Termination while paused for debugging in Visual Studio MAUI


I have a C# MAUI App.
The App partial class is trivial

public partial class App : Application {public App() {AppData.Init();}}

I need to debug the Init() function, deployed to a local iPhone.

However, when I hit a debug breakpoint in Init(), after ~10 seconds something happens and the App is immediately terminated, even though it is ostensibly paused for debugging. Which makes debugging challenging.

The issue seems to be maybe related to HotReload, but I have disabled HotReload under VS.Tools.Options.Debugging.XAMLHotReload and under VS.Tools.Options.Debugging..NET/C++HotReload.

This is Windows VS 17.7.0 Preview 4.0. Same behavior on VS Stable.
Not sure what to try next