uno-platform wasm debugging - uno-platform

Still running into wasm debugging. I am on debug and a new project do work but not the project that I stared 8 months ago. I have deleted bin file and obj and user temp files.
<PackageReference Include="Uno.UI.WebAssembly" Version="3.2.0-dev.83" />
<PackageReference Include="Uno.UI.RemoteControl" Version="3.2.0-dev.83" Condition="'$(Configuration)'=='Debug'" />
<PackageReference Include="Uno.Wasm.Bootstrap" Version="1.5.0-dev.57" />
<PackageReference Include="Uno.Wasm.Bootstrap.DevServer" Version="1.5.0-dev.57" PrivateAssets="all" />

It's probably caused by old packages. Following instructions on this page and there should solve your problem:
Update Uno.UI to latest version
Update Uno.WasmBootstrap & Uno.UI.RemoteControl to latest versions
Add reference to Uno.Wasm.Bootstrap.DevServer
Open your .csproj and remove any <DotNetCliToolReference />
It should work after that.

Related

SQLite Exception in .NET MAUI

When running a .NET MAUI application, I get an error
System.TypeInitializationException: 'The type initializer for 'SQLite.SQLiteConnection' threw an exception.'
which is related to SQLite. I don't know how to solve it, I looked at some suggestions to clean and rebuild the application, but I tried that and it was unsuccessful.
Do you have any effective solution? I followed the tutorial on YT through which I did this, on the video everything works but I get an error... I'm in the process of learning .NET MAUI and this is my first time working with a database so I don't know what to do..
Thank you in advance!
I added these NuGet packages to the project:
<PackageReference Include="Microsoft.Toolkit.Mvvm" Version="7.1.2" />
<PackageReference Include="sqlite-net-pcl" Version="1.6.292" />
<PackageReference Include="SQLitePCLRaw.core" Version="2.1.0" />
<PackageReference Include="SQLitePCLRaw.provider.sqlite3" Version="2.1.0" />
<PackageReference Include="SQLitePCLRawEx.bundle_green" Version="2.1.0" />
<PackageReference Include="SQLitePCLRawEx.provider.dynamic_cdecl" Version="2.1.0" />

How do I update other Microsoft libraries after updating to .Net Core 3.1

I have a web app solution that is quite old where the main project is Asp.Net 4.6 and a small companion project is .Net Core 2.
I want to first upgrade them both to .Net Core 3.1, and then upgrade to .Net 7 later this year.
According to the Microsoft documentation I have to update the target framework and associated libraries.
So I updated this part in my project file:
<TargetFramework>netcoreapp3.1</TargetFramework>
However, the other referenced libraries don't seem to have 3.1 updates. How would I upgrade these?
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="2.0.2" />
<PackageReference Include="Microsoft.AspNetCore.SpaServices" Version="2.0.3" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.0.4" />
<PackageReference Include="Microsoft.AspNetCore.Server.IISIntegration" Version="2.0.2" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.0.2" />
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="2.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.0.3" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
<PackageReference Include="System.ServiceModel.Duplex" Version="4.3.0" />
<PackageReference Include="System.ServiceModel.Security" Version="4.3.0" />
Thanks!
When Microsoft introduced .NET Core 3.0, they stopped producing a large number of NuGet packages (If you're interested, you can see the list here).
Microsoft made them part of the shared framework Microsoft.AspNetCore.App that is implicitly referenced if your .csproj targets Microsoft.NET.Sdk.Web SDK. You can check this in your .csproj project.
<Project Sdk="Microsoft.NET.Sdk.Web">
...
</Project>
If your project targets Microsoft.NET.Sdk, then you might have to add a FrameworkReference, as explained here.
Assuming the latter is not your case, removing the references to those NuGet packages should be fine.
For microsoft .net core packages,I think you could search in the document and found the correspond packages.
https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore?view=aspnetcore-2.2
example1:
example2:

Azure Function App using SQLite M1 Macbook - Unable to load shared library 'e_sqlite3' or one of its dependencies

Running MacOS Monterey version 12.1
IDE Jetbrains Rider version 2021.3.2
Using Microsoft EF Core version 6.0.1 on Macbook Pro M1. Trying to save to the database using EF Core but getting the following error message back.
It's an Azure Functions App that I am running locally and attempting to connect locally.
I've got Migrations working through EntityFramework but just cannot see to get the dbContext to connect to the DB when a function is called through the app.
'System.DllNotFoundException: Unable to load shared library 'e_sqlite3' or one of its dependencies. In order to help diagnose loading problems, consider setting the DYLD_PRINT_LIBRARIES environment variable: dlopen(libe_sqlite3, 0x0001): tried: 'libe_sqlite3' (no such file), '/usr/local/lib/libe_sqlite3' (no such file), '/usr/lib/libe_sqlite3' (no such file), '/Users/<name>/RiderProjects/API/project.API.Admin/bin/Debug/net6.0/libe_sqlite3' (no such file), '/usr/local/lib/libe_sqlite3' (no such file), '/usr/lib/libe_sqlite3' (no such file)'
I've tried installing 'SQLitePCLRaw.bundle_e_sqlite3 2.0.8-pre20220111224339' package but I still get the same problem.
Here is my CSPROJ file
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<AzureFunctionsVersion>V4</AzureFunctionsVersion>
<LangVersion>preview</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Azure.Functions.Extensions" Version="1.1.0" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.OpenApi" Version="1.0.0" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.0.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0" />
</ItemGroup>
<ItemGroup>
<None Update="host.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="local.settings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\iAi.Services\iAi.Services.csproj" />
</ItemGroup>
</Project>
Any help on how to get SQLite working on Mac using EntityFramework and .NET 6 is greatly appreciated.
Try to add Nuget package SQLitePCLRaw.bundle_e_sqlite3 2.0.7

Error scaffolding identity in blazor webassembly app

I am building a webassembly project in Razor using Visual Studio 2019 (version 16.9.4) and whenever I try to scaffold the identity I get an error saying that a package restore did not work, and everything is rolled back.
My question is twofold:
How do I solve this error?
Are there any alternatives to the scaffolding of the identity?
Grtz,
Iede Snoek
There is an offical page about this but I found it a little confusing. The Blazor WebAssembly UI is not supported, that makes sense. But the Hosted variation should be just like a Blazor Server project. I think that is what is being said there and that makes sense.
But whewn I gave it a try I got the same error as you did, with packages getting rolled back. And no info on what packages.
So I gave Blazor Server a go, and I kept a watch on the changes. The scaffolding worked and it downgraded some packages from 5.0.5 to 5.0.4 .
After editing the MyProject.Server.csproj the same way scaffolding worked like a charm. The "Manage Packages" UI did not work and I did have to Clean the solution first.
The altered parts of my csproj file:
<Project Sdk="Microsoft.NET.Sdk.Web">
...
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server"
Version="5.0.4" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design"
Version="5.0.2" />
</ItemGroup>
<ItemGroup>
...
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore"
Version="5.0.5" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore"
Version="5.0.4" />
<PackageReference Include="Microsoft.AspNetCore.Identity.UI"
Version="5.0.4" />
<PackageReference Include="Microsoft.AspNetCore.ApiAuthorization.IdentityServer"
Version="5.0.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer"
Version="5.0.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools"
Version="5.0.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
</Project>
The small version steps make me think this is a very temporary problem.

Adding Xunit for asp.net core application

Could you tell me what I am doing wrong?
I have Asp.net core webb application and use VS Code, I tried to add xunit directory for testing my application but finally I got this:
My application cannot see Xunit even when I 'using' it
My algorithm of adding xunit:
Manually create directory UnitTests
Use in command line command 'dotnet new xunit'
And finally I got mistake.
Dit you add the required NuGet packages? Should be present in the project file and look something like:
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0" />
<PackageReference Include="xunit" Version="2.4.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />

Resources