4

aspnet/Home

 1 year ago
source link: https://gitter.im/aspnet/Home
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

The Home repository is the starting point for people to learn about ASP.NET Core.

People
Repo info
TeBeCo
@tebeco
no node at all
sake402
@sake402

don't use VS front front ;)
use vscode

Thanks. Will give this a try though we use blazor.

Also while debugging in VS I just noticed this printed out this on output window, like a lot and continuously
Exception thrown: 'System.ObjectDisposedException' in System.Private.CoreLib.dll
Exception thrown: 'System.ObjectDisposedException' in System.Private.CoreLib.dll
Exception thrown: 'System.ObjectDisposedException' in System.Private.CoreLib.dll
Exception thrown: 'System.ObjectDisposedException' in System.Private.CoreLib.dll
Exception thrown: 'System.ObjectDisposedException' in System.Private.CoreLib.dll
Exception thrown: 'System.ObjectDisposedException' in System.Private.CoreLib.dll
Exception thrown: 'System.ObjectDisposedException' in System.Private.CoreLib.dll
Exception thrown: 'System.ObjectDisposedException' in System.Private.CoreLib.dll
Exception thrown: 'System.ObjectDisposedException' in System.Private.CoreLib.dll
Exception thrown: 'System.ObjectDisposedException' in System.Private.CoreLib.dll
Exception thrown: 'System.ObjectDisposedException' in System.Private.CoreLib.dll
Exception thrown: 'System.ObjectDisposedException' in System.Private.CoreLib.dll
This just started today and slows debug experience a lot.
In a blazor app, response to click takes at least a minute when debugging with VS. But when I run the app using dotnet run, it is good.
TeBeCo
@tebeco

Thanks. Will give this a try though we use blazor.

that's not what i said

mohammadfarfour
@mohammadfarfour
@Robban1980 what i am looking for is and asp.net web core app that have the organization identity where user can only login through his university email using application registered in azure ad
but when i choose organization identity in visual studio the program is not connected to database and users are not inserted while when choosing the individual identity a database is created and users are inserted automatically when login
so i need an oraganization identity but with automatic database
Jeffrey Jones
@rurounijones_gitlab

Could anyone familiar with EFCore give me a hint as to what I am doing wrong? (I think it must be some stupid mistake).

Table units is existing Postgres table and has string id field as primary key. EFCore (5.0.0) is throwing an exception because it is looking for u.UnitId / u.unit_id (if using the UseSnakeCaseNamingConvention plugin) column despite the Column annotation and the fluent HasColumnName API call. Based on what I have read in the docs this should be working. Like I said, I think I must be missing something. Googling about lead to some suggestions of using fluent HasField instead but I am not sure that is what I want (Trying it results in an error saying it cannot find an id field so not sure what is going on there).

Gist with code: https://gist.github.com/rurounijones/c4adc0b90d4cf47fb3bc480af814a989

corner-down-right.svg 2 replies
Jeffrey Jones
@rurounijones_gitlab
More details in thread but it appears to be looking for u.id (as expected) and u.unit_id (er...)
Robert Karlsson
@Robban1980
@rurounijones_gitlab where did you state the that table has a primary key named id in your code?
i only see your mapping that the Id property should map to the id column, but no setup for a primary key
your issue is literally explained in the first link on google if you search on UseSnakeCaseNamingConvention
Jeffrey Jones
@rurounijones_gitlab
@Robban1980 As far as I understand it if there is a field called Id then it is automatically set as the primary key so I don't need to add the [Key] annotation, however the same issue exists even if I do add the [Key] annotation. Id-> id is not the problem. It is the fact that there u.id and also u.unit_id in the generated SQL which happens with and without the SnakeCaseNamingConvention plugin being used or not (In which case it is looking for UnitId)
There is nothing in that link that has anything to do with this problem
Jeffrey Jones
@rurounijones_gitlab
To me it looks like a bug but since I started using EFCore yesterday I wanted a sanity check.
CaptainStealthy
@CaptainStealthy
Has anyone ever had .NET just refuse to start a SPA (React) development server?
I just get a "connection refused" when I try to browse to the frontend when running the project w/ dotnet run or via Visual Studio
If I do a dotnet publish, everything works fine
Stefan Ossendorf
@StefanOssendorf
Good morning everyone.
Why does Visual Studio support C#9 features in a dotnet core 3.1 app >_>
CaptainStealthy
@CaptainStealthy
Its the compiler that takes the C# code and compiles it, not the .NET Core SDK
Stefan Ossendorf
@StefanOssendorf
Yeah okay. But that only means I get two different compile results if I compile (with a global.json present) with VS or dotnet-cli >_>
Andrew
@andrewleith
anyone know if its possible to dynamically define the name of an html element in razor?
Depending on how this component is called, sometimes it should be an anchor element, and sometimes a div. I am trying to avoid repeating a bunch of markup in there...
Joe4evr
@Joe4evr
MarkupString may be the thing you want there
@_openTag
@* content *@
@_closeTag

@code {
  private MarkupString _openTag;
  private MarkupString _closeTag;
}
Andrew
@andrewleith
interesting, ill check that out, thanks!
Porkopek
@porkopek

@andrewleith An option would be this primitive component, where you can pass whatever html element you want through the HtmlTag property

public class Element:ComponentBase
    {
        [Parameter] public RenderFragment ChildContent { get; set; }
                                  public Dictionary<string, object> UserAttributes { get; set; } = new Dictionary<string, object>();

       protected  override void BuildRenderTree(RenderTreeBuilder builder)
        {
            base.BuildRenderTree(builder);
            builder.OpenElement(0, HtmlTag);
            builder.AddMultipleAttributes(1, UserAttributes);
            builder.AddContent(2, ChildContent);
            builder.CloseElement();
        }
    }

So you can use it like

<Element HtmlTag="div" class="my-class" > <div> Child Content</div> </Element>
This renders like
<div class="my-class"> <div> Child Content</div> </div>
Taylor
@TaylorWatson
hey guys, has anyone experienced this? I have a premade class from an old WSDL file I have to use, I generated it. It has "Field" appended on the end of all the properties.... Reference_IDField etc ... When I return the object normally in a POST method it keeps the fields. However when serializing it with Json.Serializer it actually removes the "Field" from all the properties.
how can I make it so returning the object also removes the "Field" part
I've never seen this before, is this related to Text.Json.Serializer?
Scott R. Frost
@ScottRFrost
Got a super weird one for you guys. We have a .NET 5 API app, running as a sub application as a folder under a .NET 4.x app in Windows Server 2016. It works, but only the first 4096 bytes of each response are being returned. It doesn't crash, it just hangs there forever after returning the first 4096 bytes of data. I've been searching for 2 hours trying to fix it, but it's a really weird case. Any ideas?
Tomas Jurasek
@tomasjurasek
Hi guys, I'm playing with localized routes in the asp.net core MVC and I created package where you can localize your routes also with localized links in View.
Feedback welcome - https://github.com/tomasjurasek/AspNetCore.Mvc.Routing.Localization
GOVINDA ALWANI
@govi2010

my signalr hub gives 403 when I try to access wss://myurl.com/hub but it works well when I use https://myurl.com/hub
anyone here can help or just explain why this is happening ?

there is no Authorize attribute on my Hub so there is not authentication on hub url.

TeBeCo
@tebeco
do you cross posting each signalr question every time ?
getting 6notifications for 2 questions is weird TBH
Stefan Ossendorf
@StefanOssendorf
Good morning everyone. I have a web-api action which returns a File (via File()). How do I annotate it properly so that swagger/openAPI gets it right and I can use it for code generation? Thanks in advance :)
32x0lf
@32x0lf
I am using asp.net boilerplate asp.net core mvc .net 5 . I got stuck in api when using a post, put and delete. anyone have experience this one? I got a 400 bad request response and I can't find any answers in google. :(
32x0lf
@32x0lf
I figured out never mind thanks
Alberto Passalacqua
@AlbertoPa
Did you have ApiController annotation? 🤔
Because antiforgery is only for mvc controllers (out of the box)
32x0lf
@32x0lf
I was running the wrong project instead of web.host, I started web.mvc. Right now, I don't see that error anymore
Alberto Passalacqua
@AlbertoPa
oh... happens

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK