dotnet | It 's a great starting point | DevOps library
kandi X-RAY | dotnet Summary
kandi X-RAY | dotnet Summary
This repo is the official home of .NET on GitHub. It's a great starting point to find many .NET OSS projects from Microsoft and the community, including many that are part of the .NET Foundation.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of dotnet
dotnet Key Features
dotnet Examples and Code Snippets
Community Discussions
Trending Discussions on dotnet
QUESTION
This question is about two MAUI controls (Switch
and ListView
) - I'm asking about them both in the same question as I'm expecting the root cause of the problem to be the same for both controls. It's entirely possible that they're different problems that just share some common symptoms though. (CollectionView
has similar issues, but other confounding factors that make it trickier to demonstrate.)
I'm using 2-way data binding in my MAUI app: changes to the data can either come directly from the user, or from a background polling task that checks whether the canonical data has been changed elsewhere. The problem I'm facing is that changes to the view model are not visually propagated to the Switch.IsToggled
and ListView.SelectedItem
properties, even though the controls do raise events showing that they've "noticed" the property changes. Other controls (e.g. Label
and Checkbox
) are visually updated, indicating that the view model notification is working fine and the UI itself is generally healthy.
Build environment: Visual Studio 2022 17.2.0 preview 2.1
App environment: Android, either emulator "Pixel 5 - API 30" or a real Pixel 6
The sample code is all below, but the fundamental question is whether this a bug somewhere in my code (do I need to "tell" the controls to update themselves for some reason?) or possibly a bug in MAUI (in which case I should presumably report it)?
Sample codeThe sample code below can be added directly a "File new project" MAUI app (with a name of "MauiPlayground" to use the same namespaces), or it's all available from my demo code repo. Each example is independent of the other - you can try just one. (Then update App.cs
to set MainPage
to the right example.)
Both examples have a very simple situation: a control with two-way binding to a view-model, and a button that updates the view-model property (to simulate "the data has been modified elsewhere" in the real app). In both cases, the control remains unchanged visually.
Note that I've specified {Binding ..., Mode=TwoWay}
in both cases, even though that's the default for those properties, just to be super-clear that that isn't the problem.
The ViewModelBase
code is shared by both examples, and is simply a convenient way of raising INotifyPropertyChanged.PropertyChanged
without any extra dependencies:
ViewModelBase.cs:
...ANSWER
Answered 2022-Apr-09 at 18:07These both may be bugs with the currently released version of MAUI.
This bug was recently posted and there is already a fix for the Switch to address this issue.
QUESTION
Some time ago, a Visual Studio update added a hot reload feature. It be handy, but it also can be annoying especially when you're testing and you don't want to reset the current state of the front end. Visual Studio injects the script whether you're debugging or not.
How can hot reload be disabled? My Visual Studio version is 16.10.3
...ANSWER
Answered 2021-Aug-27 at 14:23You can change this feature here:
Tools > Options > Projects and Solutions > ASP.NET Core > Auto build and refresh option
Options to automatically build and refresh the browser if the web server is running when changes are made to the project.
Your options in this dropdown are the following:
- None
- Auto build on browser request (IIS only)
- Refresh browser after build
- Auto build and refresh browser after saving changes
Also note my version of VS is 16.11.1
.
QUESTION
I used the database first approach. The model is right (or at least it looks like) But I always get this error. Please, I've already tried so many things.. The full code of my program (and even sql script by which I create my database) is here: https://github.com/AntonioParroni/test-task-for-backend-stack/blob/main/Server/Models/ApplicationContext.cs
Since I have a mac. I created my model with dotnet ef cli commands (dbcontext scaffold) I can use my context. But I can't touch any DbSet..
...ANSWER
Answered 2022-Mar-31 at 09:23You have net6.0
target framework which is still not released while you have installed EF6 which is a previous iteration Entity Framework (mainly used with legacy .NET Framework projects) and you also have EF Core (a modern iteration of it) but older version - 5.0 (which you are actually using for your context, see the using Microsoft.EntityFrameworkCore;
statements there).
Try removing EntityFramework
package and installing preview version of Microsoft.EntityFrameworkCore.SqlServer
(possibly just updating to the latest 5 version also can help) and either removing completely or installing preview version of Microsoft.EntityFrameworkCore.Design
. (Also I would recommend to update your SDK to rc and install rc versions of packages).
Or try removing the reference to EntityFramework
(not Core one) and changing target framework to net5.0
(if you have it installed on your machine).
As for why do you see this exception - I would guess it is related to new methods added to Queryable
in .NET 6 which made one of this checks to fail.
TL;DR
As mentioned in the comments - update EF Core to the corresponding latest version (worked for 5.0 and 3.1) or update to .NET 6.0 and EF Core 6.
QUESTION
I have an Azure pipeline setup for my builds. I have been running into this issue recently and cannot figure out a way to fix this:
...ANSWER
Answered 2022-Mar-16 at 06:02From Agent pool - Change Agent Specification from Window-Latest to Window-2019 ,It seems MS has done some changes in default agent
QUESTION
When I publish my ABP project I get the following error:
...ANSWER
Answered 2022-Jan-13 at 21:59Issue:
The issue raises after .NET 6 migration. There's a new feature that blocks multiple files from being copied to the same target directory with the same file name. See https://docs.microsoft.com/en-us/dotnet/core/compatibility/sdk/6.0/duplicate-files-in-output
Solution #1 (workaround):
You can add the following build property to all your publishable (*.Web) projects' *.csproj files. This property will bypass this check and works as previously, in .NET5.
QUESTION
I get the error:
...ANSWER
Answered 2021-Aug-30 at 12:24The cause was simple, i had my docker desktop running on linux containers and the image is build from a windows image.
Simply switching to windows containers solved the problem.
The message is clueless, so i hope this save some time to others.
QUESTION
Since updating to Visual Studio 2019 version 16.11.0 (today), compilation of Razor MVC views is failing on multiple cshtml
files in multiple projects:
error CS1576: The line number specified for #line directive is missing or invalid
I've tried to set fixed version of .NET Core SDK in global.json
file, which was placed in a root folder of MVC Web project, as described here, but that did not help as well.
ANSWER
Answered 2021-Aug-15 at 13:53I'm having the same problem. I thought it was because I had recently updated .Net 6
to Prerelease 7
but looks like there is a serious bug somewhere in the 16.11
release.
QUESTION
I have installed .NET 6.0 SDK and Visual Studio 2022. However, Visual Studio 2022 does not offer the ability to select .NET 6.0.
I know I can edit the project file with the target framework so please don't suggest that. This question is specifically around the Visual Studio 2022 UI.
Edit 1:
.NET 6.0 Runtime has been selected in the Visual Studio Installer for Visual Studio 2022
Edit 2:
I can create .NET 6.0 projects but cannot seem to target .NET 6.0 in existing projects which were previously .NET 5.0.
...ANSWER
Answered 2021-Nov-11 at 12:15During Visual Studio setup, you need to select the ".NET 6.0 Runtime". As can be seen in the screenshot, this option not only includes the runtime itself but also "templates for developing [...] .NET 6.0 applications".
You can modify your installation by starting "Apps & Features" from the Windows start menu or by selecting Tools/"Get Tools and Features..." from the Visual Studio menu bar.
QUESTION
I am using VS 2022, .Net 6.0, and trying to build my first app using System.CommandLine
.
Problem: when I build it, I get an error
The name 'CommandHandler' does not exist in the current context
The code I'm trying to build is the sample app from the GitHub site: https://github.com/dotnet/command-line-api/blob/main/docs/Your-first-app-with-System-CommandLine.md , without alteration (I think).
It looks like this:
...ANSWER
Answered 2021-Dec-17 at 23:16Think you're missing a using
line:
QUESTION
So I have a c# class library project that I only intend to use on windows. It contains some classes that use the System.Drawing.Image
class which is only available on windows. After upgrading to VS2022 and setting the target framework to .NET 6.0 I'm seeing a bunch of warnings that say CA1416 "This call site is reachable on all platforms. 'SomeClass.SomeMethod' is only supported on: 'windows'. See screenshot below for some examples:
In some sense, it's cool that VS2022 has scanned the library and found all the platform specific code that I'm using in the library. But I'd like to tell VS that I only plan to use the library on windows and it can mute all those warnings.
First I checked the Target Platform options in the properties of the project but didn't seen any windows specific targets.
Then I decided to edit the project's .csproj directly and changed the Target framework from
net6.0
to
net6.0-windows
But sadly even after a recompile, that didn't make the warnings go away either. So then I did some reading on the CA1416 warnings and sure enough it says in the Microsoft Docs that the TFM is ignored for assessing this warning however VS does add an attribute to the project based on the TFM that influences this warning, but it only does so if the project is configured to generate the AssemblyInfo.cs
file on the fly. But alas, my project's AssemblyInfo.cs
is maintained as a actual file rather then having it auto generated at build time.
So at this point, I'm ready to punt the ball and just disable CA1416 warnings for my project. So in the project's .proj file I added CA1416 for both the release and debug builds like so:
One would think that would be the end of those pesky warnings. (sigh) As it turns out, after rebuilding the project the warnings still show up. Got any suggestions? I'm all ears.
...ANSWER
Answered 2021-Nov-12 at 13:58One way to solve this issue is to create an .editorconfig for the solution and then add the following line to that .editorconfig file:
dotnet_diagnostic.CA1416.severity = none
This will make all "Validate platform compatibility" warnings go away.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install dotnet
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page