text:
Storage is currently broken when following the sample

When you follow the sample the following error pops up when reading from the localstorage:
System.AggregateException: One or more errors occurred. (Could not load type 'System.Text.Json.Serialization.JsonSerializerOptions' from assembly 'System.Text.Json, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.)
 ---> System.TypeLoadException: Could not load type 'System.Text.Json.Serialization.JsonSerializerOptions' from assembly 'System.Text.Json, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.
   at Microsoft.AspNetCore.ProtectedBrowserStorage.ProtectedBrowserStorage.GetAsync[T](String purpose, String key)
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
   at Microsoft.AspNetCore.ProtectedBrowserStorage.ProtectedBrowserStorage.GetAsync[T](String purpose, String key)
   at Microsoft.AspNetCore.ProtectedBrowserStorage.ProtectedBrowserStorage.GetAsync[T](String key)

Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

ID: ae14b3e3-3271-b919-9e0a-6f317a6b2d2d
Version Independent ID: e5e1273b-195e-5da1-b4aa-66bbcff1425b
Content: ASP.NET Core Blazor state management
Content Source: aspnetcore/blazor/state-management.md
Product: aspnet-core
Technology: aspnetcore-blazor
GitHub Login: @guardrex
Microsoft Alias: riande

Hello @vertonghenb ... Open that for the repo where that package lives :point_right: https://github.com/aspnet/AspLabs/issues
... and then after you/they find out what went wrong if it's a docs issue, ping me back over here and then we'll re-open this issue and work it.

authors: guardrex vertonghenb


text:
UIMouseEventArgs ClientX and ScreenX producing wierd values in Canvas tag

I'm exploring Blazor as a replacement for some TypeScript libraries to do 2D drawing in an HMTL5 canvas. I'm capturing mousedown like this
<canvas id="cvmain" width="500" height="500" @onmousedown="@(e=> MouseDown(e))" style="border:1px solid black" />

@code {
private async void MouseDown(UIMouseEventArgs args)
{
    long X = args.ScreenX;  // or args.ClientX
    var sts = await JsRuntime.InvokeAsync<int>("alert",X);
}
}

The ClientX and ScreenX values of UIMouseEventArgs don't make sense. I would have expected the ClientX to be based on the canvas element but it appears to be the screen, and the ScreenX value is a large negative value.
bug or feature?
John Mott
CTO, Surge Holdings.

Thanks for contacting us, @johnmott59.
@SteveSandersonMS can you please look into this? Thanks!

@johnmott59 what version of Blazor are you using? We made changes to the data type used to represent ScreenX in the preview7 release, perhaps that addresses this.

Thank you for your response. I’m using whatever comes with core version 3, as shown below.
From: Pranav K [mailto:notifications@github.com]
Sent: Thursday, June 27, 2019 11:37 AM
To: aspnet/AspNetCore
Cc: John Mott; Mention
Subject: Re: [aspnet/AspNetCore] UIMouseEventArgs ClientX and ScreenX producing wierd values in Canvas tag (#11651)
@johnmott59 https://github.com/johnmott59  what version of Blazor are you using? We made changes to the data type used to represent ScreenX in the preview7 release, perhaps that addresses this.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/aspnet/AspNetCore/issues/11651?email_source=notifications&email_token=ACDQ4X2NNFPJT5DINCLAOILP4TUEJA5CNFSM4H34YKUKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODYXV6SQ#issuecomment-506421066 , or mute the thread https://github.com/notifications/unsubscribe-auth/ACDQ4XYUNW4RQSCX5USI4HLP4TUEJANCNFSM4H34YKUA .  https://github.com/notifications/beacon/ACDQ4X5OJAXULY4KCGGATTDP4TUEJA5CNFSM4H34YKUKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODYXV6SQ.gif

My  mistake, I forgot Blazor was a nuget package. Where would I retrieve an updated nuget?
From: Pranav K [mailto:notifications@github.com]
Sent: Thursday, June 27, 2019 11:37 AM
To: aspnet/AspNetCore
Cc: John Mott; Mention
Subject: Re: [aspnet/AspNetCore] UIMouseEventArgs ClientX and ScreenX producing wierd values in Canvas tag (#11651)
@johnmott59 https://github.com/johnmott59  what version of Blazor are you using? We made changes to the data type used to represent ScreenX in the preview7 release, perhaps that addresses this.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/aspnet/AspNetCore/issues/11651?email_source=notifications&email_token=ACDQ4X2NNFPJT5DINCLAOILP4TUEJA5CNFSM4H34YKUKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODYXV6SQ#issuecomment-506421066 , or mute the thread https://github.com/notifications/unsubscribe-auth/ACDQ4XYUNW4RQSCX5USI4HLP4TUEJANCNFSM4H34YKUA .  https://github.com/notifications/beacon/ACDQ4X5OJAXULY4KCGGATTDP4TUEJA5CNFSM4H34YKUKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODYXV6SQ.gif

@johnmott59 It looks some of your response didn't make it to your github comment. To verify which .NET Core version you are using, could you please share the output of dotnet --version? Also, which specific Blazor template are you using?

Dotnet –version is
3.0.100-preview6-012264
Blazor from nuget is v3.0.0-preview6-19307.2
From: Daniel Roth [mailto:notifications@github.com]
Sent: Thursday, June 27, 2019 12:08 PM
To: aspnet/AspNetCore
Cc: John Mott; Mention
Subject: Re: [aspnet/AspNetCore] UIMouseEventArgs ClientX and ScreenX producing wierd values in Canvas tag (#11651)
@johnmott59 https://github.com/johnmott59  It looks some of your response didn't make it to your github comment. To verify which .NET Core version you are using, could you please share the output of dotnet --version? Also, which specific Blazor template are you using?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/aspnet/AspNetCore/issues/11651?email_source=notifications&email_token=ACDQ4X5CKHLPLKCXKKEBG43P4TXYJA5CNFSM4H34YKUKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODYXYP7A#issuecomment-506431484 , or mute the thread https://github.com/notifications/unsubscribe-auth/ACDQ4X2VOTLNRQORCSQNGH3P4TXYJANCNFSM4H34YKUA .  https://github.com/notifications/beacon/ACDQ4X6JPKFV7XX6TJAKP23P4TXYJA5CNFSM4H34YKUKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODYXYP7A.gif

I've figured out that Screen values are for the screen. I have 3 monitors and for some reason it picked the middle moniter as x=0. screen values to the left were 0 and to the right were positive. It looks like the ClientX is related to the browser, not to the element. Is there an element bias that I'm supposed to retrieve to find out displacement within the element?

Ah, that makes sense. So this is working as expected.

Is there an element bias that I'm supposed to retrieve to find out displacement within the element?

You'll need to combine your event handler with some extra JS interop to get the information you need: https://stackoverflow.com/a/42111623

source: gharchive/issue

repo: aspnet/AspNetCore

license: MIT

license_type: permissive

license_source: github-api


text:
[Epic] Kestrel HTTP/2 improvements

We want to improve the HTTP/2 experience in Kestrel
Child Items:

[ ] https://github.com/aspnet/AspNetCore/issues/6192 Pool HTTP/2 Streams on the Http2Connection

This is very closely related to gRPC scenarios @glennc


text:
Use DI to configure ICompressionProviders

@Tratcher

No, this directly reverts recent changes from API review.
https://github.com/aspnet/BasicMiddleware/commit/e7b41c4f53a5a511d9fd5c0bee86c4e22692418d

source: gharchive/pull-request

authors: Tratcher pakrym

repo: aspnet/BasicMiddleware


text:
add custom response support

@Tratcher @mikaelm12
Addresses https://github.com/aspnet/BasicMiddleware/issues/135. Status reason/description are not implemented per https://github.com/aspnet/HttpAbstractions/issues/395.
Couple of notes:
I inlined the switch from UrlRewriteRuleBuilder.AddUrlAction. This cleaned up the actual logic flow and eliminated doing work for action types that didn't need it. This had the side effect that some of the enum parsing was moved inside of the try/catch block which caused inner exceptions to have duplicated line/column xml detail in the message. To solve this (and clean up the code a bit more), I created a dedicated exception for parse errors which allowed me not to double wrap some exceptions by filtering on the type.
I also added a test to assert that the action performs as expected.

Hi @davidpeden3, I'm your friendly neighborhood .NET Foundation Pull Request Bot (You can call me DNFBOT). Thanks for your contribution!
You've already signed the contribution license agreement. Thanks!
The agreement was validated by .NET Foundation and real humans are currently evaluating your PR.
TTYL, DNFBOT;

For full fidelity you can set the ReasonPhrase this way:
https://github.com/aspnet/HttpAbstractions/issues/395#issuecomment-140153284

yeah, i saw that. i'll add support for it tomorrow. it will require additional parsing.

@Tratcher "full fidelity" would include status description which introduces a small wrinkle. it makes the stack go async to write the response. i can avoid that by calling .Wait which is probably ok since this is terminating the pipeline. so which option do you prefer?

partial fidelity (reason phrase but no description)

maintain sync:

	public class CustomResponseAction : UrlAction
	{
		public int StatusCode { get; }
		public string StatusReason { get; }
		public string StatusDescription { get; }

		public CustomResponseAction(int statusCode, string statusReason, string statusDescription)
		{
			StatusCode = statusCode;
			StatusReason = statusReason;
			StatusDescription = statusDescription;
		}

		public override void ApplyAction(RewriteContext context, BackReferenceCollection ruleBackReferences, BackReferenceCollection conditionBackReferences)
		{
			context.HttpContext.Response.StatusCode = StatusCode;
			context.HttpContext.Features.Get<IHttpResponseFeature>().ReasonPhrase = StatusReason;
			context.HttpContext.Response.WriteAsync(StatusDescription).Wait();
			context.Result = RuleResult.EndResponse;
			context.Logger?.CustomResponse(context.HttpContext.Request.GetEncodedUrl());
		}
	}

introduce async

    public class CustomResponseAction : UrlAction
    {
        public int StatusCode { get; }
        public string StatusReason { get; }
        public string StatusDescription { get; }

        public CustomResponseAction(int statusCode, string statusReason, string statusDescription)
        {
            StatusCode = statusCode;
            StatusReason = statusReason;
            StatusDescription = statusDescription;
        }

        public override async Task ApplyActionAsync(RewriteContext context, BackReferenceCollection ruleBackReferences, BackReferenceCollection conditionBackReferences)
        {
            context.HttpContext.Response.StatusCode = StatusCode;
            context.HttpContext.Features.Get<IHttpResponseFeature>().ReasonPhrase = StatusReason;
            await context.HttpContext.Response.WriteAsync(StatusDescription);
            context.Result = RuleResult.EndResponse;
            context.Logger?.CustomResponse(context.HttpContext.Request.GetEncodedUrl());
        }
    }

i have not assessed the extent to which async spreads.

i went ahead with the sync version for now. will look at async if you think it's worthwhile.

@mikaelm12 all feedback implemented

@mikaelm12 i'm not sure why https://github.com/aspnet/BasicMiddleware/pull/200/commits/0eaf9b27924237afcd8fbd02c49058b03b6391ff failed the appveyor build. it was literally converting tabs to spaces.

@davidpeden3 Looks like this needs to be rebased on dev. After that it should be good to go!

@mikaelm12 I tried to install VS 2017 RC to keep up with https://github.com/aspnet/BasicMiddleware/commit/24a95f6c5dc7587fee24154f49bc8a42ddaafa3e and get all of my PRs up to date. Unfortunately, I've had a lot of issues getting it installed. I did manage to get it working yesterday but now I'm struggling with builds and tests. When i build aspnet/dev, I get a million build warnings like this:
2>C:\src\aspnet\BasicMiddleware\src\Microsoft.AspNetCore.HttpOverrides\obj\Microsoft.AspNetCore.HttpOverrides.csproj.nuget.g.props(19,5): warning MSB4011: "C:\Users\dpeden\.nuget\packages\internal.aspnetcore.sdk\1.0.1-rc2-15164\buildMultiTargeting\Internal.AspNetCore.Sdk.props" cannot be imported again. It was already imported at "C:\src\aspnet\BasicMiddleware\src\Microsoft.AspNetCore.HttpOverrides\obj\Microsoft.AspNetCore.HttpOverrides.csproj.nuget.g.props (16,5)". This is most likely a build authoring error. This subsequent import will be ignored. [C:\src\aspnet\BasicMiddleware\src\Microsoft.AspNetCore.HttpOverrides\Microsoft.AspNetCore.HttpOverrides.csproj]

and
6>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(1912,5): warning MSB3277: Found conflicts between different versions of the same dependent assembly that could not be resolved.  These reference conflicts are listed in the build log when log verbosity is set to detailed.

Despite the warnings, I can successfully build the solution:
========== Rebuild All: 12 succeeded, 0 failed, 0 skipped ==========
Having said that, none of the tests show up in Test Explorer nor in ReSharper's test runner so something is definitely wrong. I'm not sure how to proceed.

I blew everything away, re-cloned aspnet/dev and ran build.cmd. I am now in a working state in y'all's branch (though I still get warnings). I will try to get my branches updated and report back.

I merged dev in. I cannot get tests to run. Code compiles. Will rely on your builds...

How about build.cmd from the command line? That should also run tests.

Yeah, I had tried that (in my branch and it didn't work). Looking at the error, it was something related to a project.json file. It occurred to me that my branch must have still had some legacy stuff in it post-merge. I did a git clean -xdf as you had suggested a while back and then build.cmd worked as expected. Thanks!

This needs to be rebased now that https://github.com/aspnet/BasicMiddleware/pull/168 was merged. Thanks for all the contributions!


text:
How to handle posting a List of objects

I would like to see a definitive example on how to post a list of objects. As an example, this article: https://www.c-sharpcorner.com/UploadFile/pmfawas/Asp-Net-mvc-how-to-post-a-collection/ shows how to post a collection, but it's outdated (MVC3). As far as I've been able to find, there is no documentation from Microsoft on how to handle (what I expect is) a rather common scenario.

Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

ID: a96bbb2e-2611-525f-129d-b86a491e423c
Version Independent ID: 4e39097d-b058-d4e2-8780-31b0067b6717
Content: Tag Helpers in forms in ASP.NET Core
Content Source: aspnetcore/mvc/views/working-with-forms.md
Product: aspnet-core
GitHub Login: @Rick-Anderson
Microsoft Alias: riande

Additionally, I'm specifically having the issue of this not working - the model doesn't bind to a list of complex objects, as I think it should. I have a question on Stack Overflow, but no answer as of yet. https://stackoverflow.com/questions/55288952/post-a-list-to-a-controller-with-tag-helpers-and-dotnet-core

I figured out my issue. The name in the HTML is what binds to the model name. So in my case, the asp-for doesn't "know" that the name on each item should be the same, so it will get picked up by the List on the model side.

@rhires  thanks for updating with the solution.

authors: Rick-Anderson rhires

repo: aspnet/Docs


text:
Document how to replace the Authentication/Identity related middlewares in the integration tests

Hi,
For integration tests, this continue to be a problem, especially with so many (sometimes outdated) unofficial examples around. Because of that, some of old working hacks won't work anymore in the new releases.
Please help with this,
Thanks

Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

ID: 77889d43-fedb-f8b4-8fea-379ec946555c
Version Independent ID: f499b131-8b14-7e10-1728-543fdd5a5656
Content: Integration tests in ASP.NET Core
Content Source: aspnetcore/test/integration-tests.md
Product: aspnet-core
GitHub Login: @guardrex
Microsoft Alias: riande

Hello @lnaie ... Can you clarify your request? Are you asking about how to test with an authenticated/unauthenticated clients, or are you actually trying to replace middlewares in the SUT?

It's about how to replace the middlewares responsible for authorization.

Thanks @lnaie ... Call ConfigureTestServices on the builder when either overriding ConfigureWebHost or calling WithWebHostBuilder. There's an example of this in the inject mock services area of the topic ...
var client = _factory.WithWebHostBuilder(builder =>
    {
        builder.ConfigureTestServices(services =>
        {
            services.AddScoped<IQuoteService, TestQuoteService>();
        });
    })
    .CreateClient();

... you should be able to swap in your services similarly.
RE: Expanding the topic generally with more examples and particularly for auth testing ... Yes! We have several issues in this area that we hope to address, including:

How to create authenticated request?
add Integration Testing chapter for the Contoso University example code
Using Kerberos/Negotiate/UseDefaultCredentials with WebApplicationFactory
How to test Web API with Jwt Bearer Authentication
How to actually perform post requests?

The priorities on these would have them worked sometime in early to mid-2019. I suggest that because the .NET Core 3.0 release is anticipated sometime in 2019 and we just had the 2.2 release. If one or more community members don't work on any of these issues, they might be worked by the docs team before the team gets close to a 3.0 release. The work for 3.0 will be another 🏃😅 very busy period for the doc authors, and these will be considered low priority compared to the 3.0 doc issues.
Let's leave this issue open so that the doc author(s) and/or engineers can take a look at this when the time comes.

Thanks for contacting us.
We don’t have the resources to invest in this area, so we are closing the issue. Should your request generate enough  👍 responses, we’ll reconsider.

Instead of replacing the Authentication/Identity related middlewares in the integration tests you can add a fake AuthenticationHandler that gets configured by the WebHostBuilder in the WebApplicationFactory of your test class.
For how to do this, see: https://github.com/aspnet/AspNetCore.Docs/issues/6882#issuecomment-540020183

authors: Rick-Anderson guardrex lnaie vanillajonathan


text:
Fix type Brower Link to Browser Link

This seems like a small (but important) contribution, so no Contribution License Agreement is required at this point. We will now review your pull request.
Thanks,
.NET Foundation Pull Request Bot

@odin88 Thank you for fixing this typo, and congrats on your 1st docs contribution! We hope to see more from you in the future.

authors: dnfclas odin88 scottaddie


text:
ASP.NET Core Identity sample

Sample code for #5102

@Noor1978 The sample you would like is outside the scope of an introduction article. If it fits with another doc, I'll open an issue to use it there as that sample.


text:
VS 2010

How about VS 2019. Not sure which 'model content' to select as 2019 is so much different than 2010.

Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

ID: 63be9b09-2dde-819c-72a9-874182a92113
Version Independent ID: 0ef66141-904a-34b2-b2a1-b090c5d62339
Content: Database First - EF6
Content Source: entity-framework/ef6/modeling/designer/workflows/database-first.md
Product: entity-framework
Technology: entity-framework-6
GitHub Login: @divega
Microsoft Alias: avickers

I just did this in VS 2019. There is a step before where you select the Tables checkbox; otherwise, it's the same as what is on the page.

authors: ChefSQL scottheckel


text:
Adding EF Core to a standalone class library

I spent yesterday getting tripped on on why I was unable to create a working EF7 standalone class library. Specifically a pattern that I like to use is to create a Model project so that additional applications can be created to load models and data access on their own without WEB.
This can allow for a console app, web app (and other projects) to use the same set of models, services and interfaces.
While following the guide, I tried choosing File -> New -> Class Library (Package) instead of console application or ASP.NET web application.
This failed because the default project.json file on a class lib comes in with
"frameworks": {
  "dotnet": { }
}

instead of
"frameworks": {
  "dnx451": { },
  "dnxcore50": { }
}

I'd like to suggest adding a note to getting started aspnet as seen in the following commit https://github.com/AlexChesser/EntityFramework.Docs/commit/ac3ae509d7925b7130065d89561ac1547c0c3b2f
.. note::
    If you are attempting to create a standalone class library as data layer shared across multiple applications, ensure that the ``frameworks`` section of the ``project.json`` is updated to replace ``dotnet`` with ``dnx451`` and ``dnxcore50``.  This will ensure that the library has a reference to the ``Microsoft.Data.Entity`` namespace.

.. literalinclude:: aspnet5/sample/src/EFGetStarted.AspNet5/project.json
        :language: json
        :linenos:
        :lines: 25-28
        :emphasize-lines: 2-3

It's not so much extra but could help save someone a few extra minutes.

Go ahead and create a pull request for this.

Hi Nate, I hope the PR is in the correct format. Let me know if I got something wrong.

On a related note: how is this similar or different from using separate projects? I'm referencing an issue [https://github.com/aspnet/EntityFramework.Docs/issues/43] I came across that's been added to the 7.0.0 milestone. It seems close, but I don't completely understand the subtleties of these things very well.

hey Rhires - I have a similar configuration as you've talked about in #43 and in the thing I'm working on and yes, I created a startup.cs to live in my "Model" project (your business project) I have found that it does take less duplicated code to run the ef commands from the web project with params like '-StarupProjectName Web -ProjectName Business'
there are probably better ways maybe calling the startup.cs in the business project from the startup in web project and keeping the two properly separated

Hey @AlexChesser - I stumbled on this (https://github.com/aspnet/EntityFramework/pull/3589) looking around for something else. I tried it on the project I left in a stalled state, and it seems to work. I have to go about fixing the other dependencies and renaming all the assemblies and such (it was beta7), but it didn't fail for the reason that it didn't know what I'm talking about. :-)

Closing as this is specific to project.json tooling, which is being replaced by MSBuild based tooling in VS2017

authors: AlexChesser natemcmaster rhires rowanmiller


text:
Cache FromSql based on parameter types instead of values

The CompiledQueryCache adds a new entry for each unique set of argument values in the FromSql call. If we extract the parameters (SQL string and parameters object array) in query compilation and update the cache key to use the QueryAnnotation parameter types (using these parameters on SQL generation), the caching for FromSql will be more consistent with other query operations.

@mikary any idea how much work this would be. Seems like it would be good to fix now if it's not a huge job.

We should investigate the perf impact to help prioritize.

As a result of the deep comparison of parameters in the ShaperCommandContext CommandCacheKey Equals method, queries with calls FromSql appear to generate a new command on every call. As long as these commands have the same number and Types of parameters, the command should be reusable.
This came up in our discussion on proposed changes for #3704 and #3115
@anpete @divega

In further discussion with @divega we noticed that null parameter values to FromSql are going to result in cache misses since the Type is lost when the vales are stored in an object array. We discussed a few different options and tradeoffs:

Current implementation

Creates a new cache entry for each parameter value / object reference in param array
Always uses RelationalTypeMapping.NullMapping for null values
Always configures non parameters based on RelationalTypeMapper mappings

Strict Type comparison

Creates a new cache entry for each parameter Type change in param array (i.e. change to null value)

Expected to have fewer entries, still can have 2^n permutations

Extra overhead of repeated GetType() calls / building Type info into cache key

Loose Type comparison

Cache key with null param array values matches with / defaults to string mapping

Potentially has incorrect mappings for other Nullable types

Late mapping

Cache entry only depends on number of elements in param array
Introduces Dictionary lookup / RelationalTypeMapper method calls to hot path
Mappings may be saved after the first non-null parameter value

Potentially has incorrect mappings if the parameter type changes (unlikely corner case)

Untyped parameters

Cache entry only depends on number of elements in param array
Allow parameter definitions without type metadata, set the values and let ADO interpret the value

Similar to older versions of the way parameters are managed

authors: mikary rowanmiller

repo: aspnet/EntityFramework


text:
missing reference

I'm porting one services, from the preview in krl using EntityFrameWork 7.0.0-Beta4, to the new version with Dnx, and using EntityFramework 7.0.0-Beta6, i can't find the way to set the relation betwen my entities, i try to follow the examples but theres is always something missing.
var alm = Builder.Model.GetEntityType(typeof(Almacen));
var fkAlm = alm.ForeignKeys.Single(k => k.ReferencedEntityType == tras);
The error is:
Error	CS1061	'EntityType' does not contain a definition for 'ForeignKeys' and no extension   method 'ForeignKeys' accepting a first argument of type 'EntityType' could be found (are you missing a using directive or an assembly reference?)

Try replacing alm.ForeignKeys to alm.GetForeignKeys()

i make the change to someting like this, i have to run migration proces tosee how does it generate the model.
        var tras = Builder.Model.GetEntityType(typeof(Traspaso));
        var alm = Builder.Model.GetEntityType(typeof(Almacen));
        var fkAlm =( (List<ForeignKey>) alm.GetForeignKeys());
        tras.AddNavigation( "Almacen", fkAlm[0], pointsToPrincipal: true);

I see other method, is GetForeingKey(), but i don't know wich param send it, or how to send it.

You probably want something like:
builder.Entity<Post>()
    .Reference(p => p.Blog)
    .Collection(b => b.Posts)

authors: Saotome38 rowanmiller smitpatel


text:
EDMX Metadata Generator options for .NET Core

Per the announcement post, EF 6.3 Preview 5 is currently shipping without EDMX support. Fortunately, I solved that problem about a year ago for SDK-style projects targeting the .NET Framework. I've open-sourced that tool here: https://github.com/CloudNimble/EF6.3MetadataGenerator.
Elements of this tool could be turned into a .NET Core Global Tool using dotnet-script and csx files (or possibly another option), but the code would have to be changed to manipulate the Project XML manually.
According to this tweet, the team is considering a couple different options. I thought this thread would be a good place to discuss those options, and consider if the tool I linked to would be useful in the final product.

My initial thought was just to port and package Microsoft.Data.Entity.targets and Microsoft.Data.Entity.Build.Tasks.dll as part of EntityFramework. It feels like a good candidate for NuGet's buildTransitive directory.

I've got this working on an internal branch using the approach I described. We're just waiting for approval to open source Microsoft.Data.Entity.Build.Tasks.dll...

Hello,
Was there a conclusion on this? in 6.3 Preview 7?
Thx

@GuyBenhaim The fix was included in preview 7.

authors: GuyBenhaim ajcvickers bricelam robertmclaws


text:
Prevent add ORDER BY when using Include

Hi all
I have problem with query performance when using Include.
My query
.Include(i => i.TABLE1).ThenInclude(i => i.TableX).ThenInclude(i => i.TableY)
.Include(i => i.TABLE2)

EF generate query like this:
SELECT TABLE1.*
FROM TABLE1
LEFT JOIN TABLE2 ON TABLE2.ID = TABLE1.FIELD1
LEFT JOIN TABLE2 ON TABLE2.ID = TABLE1.FIELD2
ORDER BY TABLE1.MYCUSTOMSORTFIELD DESC,TABLE1.ID,TABLE1.VIRTUALFIELDONTABLE2.id
LIMIT 50 OFFSET 1

So, two last ORDER BY condition in sql query is automatically added by EF and make query slower. Without this conditions query runs during 10ms, with conditions above 500ms.
Is exist way to prevent add this fields on ORDER BY?

@Haza85 EF needs an ordering so that value can be correlated when creating entity instances. EF doesn't do a descending order by default, so I am assuming that you have an ordering in the query which is then being modified by EF. This might be why primary key indexes are not being hit. You might try creating descending indexes on these columns to improve perf.
Beyond that, we would likely need a small, runnable project/solution or complete code listing that demonstrates the behavior you are seeing so we can fully investigate.

EF Team Triage: Closing this issue as the requested additional details have not been provided and we have been unable to reproduce it.
BTW this is a canned response and may have info or details that do not directly apply to this particular issue. While we'd like to spend the time to uniquely address every incoming issue, we get a lot traffic on the EF projects and that is not practical. To ensure we maximize the time we have to work on fixing bugs, implementing new features, etc. we use canned responses for common triage decisions.

repo: aspnet/EntityFrameworkCore


text:
Azure functions dependency injection - error when referencing class library

I have a Azure Functions project that has a reference to a class library (netstandard 2.0).
The class library contains a reference to Microsoft.Extensions.DependencyInjection.Abstractions.
The class library has the following extension method:
using JOS.MyApp.Core;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;

namespace JOS.MyApp.Application
{
    public static class ApplicationConfigurator
    {
        public static void AddApplication(this IServiceCollection services)
        {
              // Do stuff
        }
    }
}

My functions startup looks like this:
Startup.cs
using JOS.MyApp.Functions;
using Microsoft.Azure.Functions.Extensions.DependencyInjection;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;

[assembly: FunctionsStartup(typeof(Startup))]
namespace JOS.MyApp.Functions
{
    public class Startup : FunctionsStartup
    {
        public override void Configure(IFunctionsHostBuilder builder)
        {
              // It does not matter if this call is here or not, it crashes because of the reference to the class library anyway.
               builder.Services.AddApplication();
        }
    }
}

When the Azure Functions project references the class library, the following error occurs:
Azure Functions Core Tools (2.7.1158 Commit hash: f2d2a2816e038165826c7409c6d10c0527e8955b)
Function Runtime Version: 2.0.12438.0
SKipping 'FUNCTIONS_CORETOOLS_ENVIRONMENT' because value is null
[2019-05-14 20:10:32] Starting Rpc Initialization Service.
[2019-05-14 20:10:32] Initializing RpcServer
[2019-05-14 20:10:32] Building host: startup suppressed:False, configuration suppressed: False
[2019-05-14 20:10:32] A host error has occurred
[2019-05-14 20:10:32] JOS.MyApp.Functions: Method not found: 'Microsoft.Extensions.DependencyInjection.IServiceCollection Microsoft.Azure.Functions.Extensions.DependencyInjection.IFunctionsHostBuilder.get_Services()'.
Value cannot be null.
Parameter name: provider

If I remove the reference to the class library, the function app starts as expected.
So the problem appears to be that im using the Microsoft.Extensions.DependencyInjection.Abstractions package in my class library.
To Reproduce
Steps to reproduce the behavior:

Create a new functions app
Create a new class library
Setup DI for your functions app as described here: https://docs.microsoft.com/en-us/azure/azure-functions/functions-dotnet-dependency-injection
Add the same extension method as above to the class library
Add a reference to the class library from the Azure Functions project
Try to run the functions project

Expected behavior
The functions project starts without any issues.
Additional context
Host (useful for support):
  Version: 3.0.0-preview5-27626-15
  Commit:  61f30f5a23

.NET Core SDKs installed:
  2.1.602 [C:\Program Files\dotnet\sdk]
  2.1.700-preview-009597 [C:\Program Files\dotnet\sdk]
  2.1.700-preview-009601 [C:\Program Files\dotnet\sdk]
  2.1.700-preview-009618 [C:\Program Files\dotnet\sdk]
  2.2.202 [C:\Program Files\dotnet\sdk]
  2.2.203 [C:\Program Files\dotnet\sdk]
  2.2.300-preview-010046 [C:\Program Files\dotnet\sdk]
  2.2.300-preview-010050 [C:\Program Files\dotnet\sdk]
  2.2.300-preview-010067 [C:\Program Files\dotnet\sdk]
  3.0.100-preview5-011568 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.2.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.2.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.2.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.2.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.0.0-preview5-19227-01 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.2.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.2.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.0.0-preview5-27626-15 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.0.0-preview5-27626-15 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Is that true? Looking at the sample, the class library references 3.0.0-preview5.19227.9 of Microsoft.Extensions.DependencyInjection.Abstractions but the Microsoft.Azure.Functions.Extensions package references 2.2.0 of that package.

The class library references version 3.0.0-preview5.19227.9 of the Microsoft.Extensions.DependencyInjection.Abstractions package. The function app MyApp references version version 1.0.0 of the Microsoft.Azure.Functions.Extensions, which in turn references Microsoft.Extensions.DependencyInjection v2.2.0, which then references version 3.0.0-preview5.19227.9 of Microsoft.Extensions.DependencyInjection.Abstractions.
So for both projects the same version of Microsoft.Extensions.DependencyInjection.Abstractions should be resolved, or?

Microsoft.Extensions.DependencyInjection v2.2.0, which then references version 3.0.0-preview5.19227.9 of Microsoft.Extensions.DependencyInjection.Abstractions.

That's not what the package manifest itself says: https://www.nuget.org/packages/Microsoft.Extensions.DependencyInjection
If you're looking in Visual Studio, it shows the resolved version, not the version specified in the dependency. When you have two package references in the dependency graph for the same ID, only one version is selected (the highest one generally) and used to satisfy both dependencies. This is generally good, but can lead to situations like this where you are referencing a 3.0 package with a breaking change and a dependency is built against the 2.2 package without that breaking change thus causing a break.
You should avoid crossing the version "streams" when referencing dependencies like this as breaking changes can bite you. Does the issue occur if you change your class library to depend on 2.2.0 of Microsoft.Extensions.DependencyInjection.Abstractions?

OK. I was under the wrong impression then.

Closing as it appears there is no actionable work here. It is possible to use the Abstractions library in this way, but you should generally stick the the lowest version supported on your platform to avoid these issues. There are cases where using a higher version will work, but your code may be built expecting certain methods/members to exist that don't.

✔ Had the same issue. Just to clarify how to fix it for anyone who would get that out of the box following the instructions on DI with .net Functions - downgrade version of nuget package Microsoft.Extensions.DependencyInjection from 3.0.0 to 2.2.0

✔ Had the same issue. Just to clarify how to fix it for anyone who would get that out of the box following the instructions on DI with .net Functions - downgrade version of nuget package Microsoft.Extensions.DependencyInjection from 3.0.0 to 2.2.0

Worked for me after downgrading it in a class library as well

✔ Had the same issue. Just to clarify how to fix it for anyone who would get that out of the box following the instructions on DI with .net Functions - downgrade version of nuget package Microsoft.Extensions.DependencyInjection from 3.0.0 to 2.2.0

This worked for me too ! Thanks !!

For me it helped to also use a downgraded version of Microsoft.NET.Sdk.Functions in 1.0.28.
A full list of working references is as follows:
	<PackageReference Include="Microsoft.Azure.Functions.Extensions" Version="1.0.0" />
	<PackageReference Include="Microsoft.Azure.WebJobs.Extensions" Version="3.0.2" />
	<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="1.0.28" />
	(<PackageReference Include="Microsoft.Extensions.Http" Version="3.0.0" />) if you need IHttpClientFactory as stated in [the MS guide](https://docs.microsoft.com/en-us/azure/azure-functions/functions-dotnet-dependency-injection).

authors: JosXa MikaBerglund anurse cfe84 joseftw rfcdejong shelbaz

repo: aspnet/Extensions


text:
Use new CancellationToken API on netcoreapp3.0

Implement Register by calling UnsafeRegister on netcoreapp3.0

Which does what? The docs are blank.

authors: Tratcher davidfowl


text:
GetOrCreateAsync's factory should use ConfigureAwait

GetOrCreateAsync's factory should use with ConfigureAwait false, as some UI applications might block on the UI thread.

Added ConfigureAwait(false) in GetOrCreateAsync
Added a test to cover the issue.
Added two helper classes for the tests. Helper classes comments' indicated their original source.

Not sure if tests falls into the 'too hard' category, because of the helper classes.
Addresses #2252

@anurse and @Tratcher please review thid PR.

@Pilchie please suggest reviewers

@rynowak had some thoughts about ConfigureAwait in these libraries, specifically that its not worth trying to test all of the code paths and instead use an analyzer to make sure all the places have ConfigureAwait(false).
cc @JamesNK

@davidfowl , I am happy to with the analyzer instead of tests, could you suggest one?

I have setup Microsoft.CodeAnalysis.FxCopAnalyzers in https://github.com/grpc/grpc-dotnet
It comes with a lot of analyzers. I have disabled most of them but ConfigureAwait false is still enabled: https://github.com/grpc/grpc-dotnet/blob/master/Grpc.DotNet.ruleset

I suppose I need to run GenerateReferenceSource or GenerateReferenceAssemblies to resolve build issues.

When Directory.Build.target defines the build Reference to FxCopAnalyzer and as well as CodeAnalysisRuleset, I get a build error because ref/*.csproj-s are not updated.

eng/targets/ResolveReferences.targets(200,5): error MSB3245: Could not resolve this reference. Could not locate the package or project for "Microsoft.CodeAnalysis.FxCopAnalyzers". Did you update baselines and dependencies lists? See docs/ReferenceResolution.md for more details.

When I  move
  <ItemGroup>
    <Reference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" />
  </ItemGroup>

to Directory.Build.props, and run the script that updates the ref/ projects, then build.cmd, I get the following error:

C:\Users...\source\repos\Extensions.dotnet\sdk\5.0.100-alpha1-015536\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.DefaultItems.targets(256,5): error NETSDK1023: A PackageReference for 'Microsoft.CodeAnalysis.FxCopAnalyzers' was included in your project. This package is implicitly referenced by the .NET SDK and you do not typically need to reference it from your project. For more information, see https://aka.ms/sdkimplicitrefs [C:\Users...\source\repos\Extensions\src\Caching\Abstractions\ref\Microsoft.Extensions.Caching.Abstractions.csproj]

What would be the suggested way to resolve this issue?

Looks like we probably have to add this to the references list: https://github.com/aspnet/Extensions/blob/master/docs/ReferenceResolution.md#example-adding-a-new-dependency
@anurse @JamesNK - can you help with that?

Step 1 and 2 there should be all that's needed, I believe. Adding the <Reference> element to the project and then the <LatestPackageReference> element to the eng/Dependencies.props file. While this package does comes from "another dotnet team", it's dotnet/roslyn-analyzers which is not part of our dependency flow process, so there's no need to go through step 3.
@ladeak let me know if you have any issues making those updates!

@anurse , I have added the Dependency to the "External dependencies":
https://github.com/aspnet/Extensions/pull/2767/files#diff-8c508e8b957801ef7a859521e59d58b9 but still returns a build error:
eng/targets/ResolveReferences.targets(200,5): error MSB3245: Could not resolve this reference. Could not locate the package or project for "Microsoft.CodeAnalysis.FxCopAnalyzers". Did you update baselines and dependencies lists? See docs/ReferenceResolution.md for more details.

@anurse Could you suggest, I did those two steps as suggested, but I still get errors.

authors: JamesNK anurse davidfowl ladeak rynowak


text:
Question. Asp net core apps Memory and cpu limits

How can i configure asp dot net core to have memory and/or cpu usage limits like IIS app pools settings. We would like to use kestrel without IIS but we need to be able to setup that kind of resources usage limits to our applications.

IIS uses Job Objects for that and so can you. See https://stackoverflow.com/questions/192876/set-windows-process-or-user-memory-limit

Thanks. Do you have any example implementing  ALM with Job Objects?. We want to be able to deploy from VSTS and create a Job Object per app deployed.

authors: Tratcher oerodriguezn

repo: aspnet/Home


text:
EmailConfirmationToken generated from UserManager does not reflect user's email address

The token generated by UserManager.GenerateEmailConfirmationTokenAsync does not reflect current email address of the user, and no email address assertion is performed when validating a  confirmation token.
Therefore the user is able to "confirm" his/her updated email address (B) by following a link containing a token generated before the changing is made when the email address was actually (A) if he/she changes his/her email address to (B).
This causes some risk that a user could "confirm" an email address doesn't really owned by him/her unless application blocks further email address changing before a pending confirmation completes.

Furthermore, a token is not limited to be used only once, so with the issue, the use will be able to confirm whatever email address during the validity of the first received token.

@HaoK can you look at this? No email assertion is true.

Token's validity can be controlled by time like for x TimeSpan
but once used should not allow to use again is a good option
_userManager.UserTokenProvider = _userManager.GetDataProtectionProvider("EmailConfirmationToken", TimeSpan.FromDays(GetEmailConfirmationTokensValidityDays()));

Well, I know the time based validity controllability. But this is not what I was saying. Because people can always generate new tokens if token expires.
People are able to "validate" email addresses do not belong to them.
As a workaround, I was able to override the default ConfirmEmailAsync method and embed the email address being validated into the token.
Here is the sample code.

authors: blowdart dnxit jijiechen

repo: aspnet/Identity


text:
Angular-CLI-Based-Template: Angular 5 TransferStateModule doesn't work

@SteveSandersonMS since the thread about new angular cli based template is too long that its seems very difficult to track each issue, I am opening this issue about Transfer State Module.
Further to our discussion,
Unfortunately, I am still unable to use Transfer State Module with this template. There is a cli based repo https://github.com/Angular-RU/angular-universal-starter , with Transfer State Module which works fine (demo here http://master-ssr.gorniv.com/back). But when we port this code to the .NetCore Angular CLI based template this no longer works and requests are rendered twice once on server and once on client.
You were rite, the &q is not an issue, because when adding transfer state and manually adding below script tag to index.html file, it is able to pick it from markup. So apparently, the issue is when script tag is added to markup.
<script id="ng-cli-universal-state" type="application/json">{&q;http://localhost:63783/api/SampleData/WeatherForecasts&q;:[{&q;dateFormatted&q;:&q;11/29/2017&q;,&q;temperatureC&q;:40,&q;summary&q;:&q;Cool&q;,&q;temperatureF&q;:103},{&q;dateFormatted&q;:&q;11/30/2017&q;,&q;temperatureC&q;:18,&q;summary&q;:&q;Chilly&q;,&q;temperatureF&q;:64},{&q;dateFormatted&q;:&q;12/1/2017&q;,&q;temperatureC&q;:-9,&q;summary&q;:&q;Cool&q;,&q;temperatureF&q;:16},{&q;dateFormatted&q;:&q;12/2/2017&q;,&q;temperatureC&q;:28,&q;summary&q;:&q;Mild&q;,&q;temperatureF&q;:82},{&q;dateFormatted&q;:&q;12/3/2017&q;,&q;temperatureC&q;:18,&q;summary&q;:&q;Cool&q;,&q;temperatureF&q;:64}]}</script>

I am quite sure there is something wrong either with this template or with aspnet-prerendering that prevents TransferState to work properly. There is another module from Universal (TransferHttpCacheModule), that automatically handles the http request caching on server which underneath uses TransferStateModule. Even that module doesn't work with this template. Here is the link to that package https://www.npmjs.com/package/@nguniversal/common
@MarkPieszak in one of our conversations in mid Nov, you mentioned about some change in  AngularCompilerPlugin, which was preventing TransferState to work with https://github.com/MarkPieszak/aspnetcore-angular2-universal 5.x . Should that issue affect new .Net Core Angular cli based template as well? In our conversation you mentioned:

It is something happening at the AngularCompilerPlugin level that's not able to handle things (for our aspnet use-case) the way the previous AoTPlugin for 4.x was.
I talked with some of the guys from the CLI team and will hopefully circle back with them early next week to get it all ironed out!

@SteveSandersonMS finally I got it working. In browser (i.e. main.ts) we need to delay the bootstrap until the DOMContentLoaded event fires, for TransferState to work correctly.
In main.ts I replaced:
platformBrowserDynamic(providers).bootstrapModule(AppModule)
  .catch(err => console.log(err));

with
document.addEventListener('DOMContentLoaded', () => {
  platformBrowserDynamic(providers).bootstrapModule(AppModule)
  .catch(err => console.log(err));
});

and it started work :)

Apparently the only thing left now is support for LazyLoading on SSR (https://github.com/aspnet/JavaScriptServices/issues/1413)

repo: aspnet/JavaScriptServices


text:
README gif is out of date packages -> libraries

Describe the bug
The README.md for this products repository contains an animated gif in the Intellisense section that shows the JSON of the libman.json file. The gif shows, what I assume is, an older format of the file using a packages node, whereas the current version uses a libraries node. Could someone with gif making skills update the gif, to avoid confusion/misleading new adopters?
To Reproduce
Steps to reproduce the behavior:

Navigate to the rendered README.md for this repository
View the Intellisense section
Notice the JSON format used in the animated gif

Expected behavior
The gif should show accurate JSON format. It shows a packages node instead of the libraries node. Assuming packages was an older format.
Screenshots
Inaccurate annimated gif
Additional context
Strictly a documentation issue. Not a tool issue.

Looks great! Thanks @jimmylewis

repo: aspnet/LibraryManager


text:
SQLite: decimal literals formatted incorrectly

From @Mats391 on April 18, 2017 12:16
When I insert a decimal value into a Sqlite database using EntityFramework Core, it will save it in a Text column.  This is fine and prevents loss of data, but sometimes makes you unable to find a value you added before
Steps to reproduce

Create Sqlite DbContext
Insert Entity with a decimal value without decimal places
SaveChanges
Try to find by inserted value

using(var db = new MyDbContext()) {
    db.Database.EnsureCreated();
    db.Add( new MyEntity() { Value = 3m } );
    db.SaveChanges();

    // Creates error
    db.Entities.First( x => x.Value == 3m );
}

It adds the value as "3" into the database, but uses "3.0" in the query. It seems to not use the same ToString()
Further technical details
EF Core version: 1.1.1
Database Provider:  Microsoft.EntityFrameworkCore.Sqlite
Operating system: Win7 x86
IDE: Visual Studio 2017
Edit:
This works for some reason:
using(var db = new MyDbContext()) {
    db.Database.EnsureCreated();
    decimal value = 3m;
    db.Add( new MyEntity() { Value = value } );
    db.SaveChanges();

    // Works as expected
    var y = db.Entities.First( x => x.Value == value );
}

Copied from original issue: aspnet/EntityFramework#8205

Looks like we need to add the following.
partial class SqliteSqlGenerationHelper
{
    protected overrride string DecimalFormat => "G";
}

BUT this is only the tip of the iceberg. Any arithmetic operation will coerce the values into doubles before performing the operation. This could yield lossy results. In general, using decimal values (and any non-SQLite-primitive type like DateTime, DateTimeOffset, and TimeSpan) in an expression that gets evaluated on the server should be carefully reviewed for potential errors due to coercion.

It looks like double and float literals are also wrong for certain values: (#8270)
SQLite Error 1: 'unrecognized token: "1.79769313486232E+308E0"'.

Oh wait, the above code probably isn't sufficient. They need to be TEXT literals.

We should review all literals too--we had anther issue with Guid in 1.0.0.

lossless less lossy

Fixed by aspnet/Microsoft.Data.Sqlite#381

From @smitpatel on June 29, 2017 23:54
This should be fixed in SQLite to allow lossless arithmetic operations.

@smitpatel the logic used by Microsoft.Data.Sqlite is value.ToString(CultureInfo.InvariantCulture) quoted as a string literal.


text:
Suggestion: Allow using interfaces for controllers

We're building a microservices-based system using Service Fabric and MVC, and many of the services are internal. In order to ease the development of those services, I've created an IApplicationModelProvider (a bit hacky but works) that also reads route and verb attributes from interfaces which are shared between services. This makes them very easy to consume. Essentially turning MVC to RPC-style calls.
For example:
[ContractRoute("api/foo")]
public interface IFooService
{
    [HttpGet("{type}"]
    Task<List<Foo>> GetFoo([FromRoute] string type);
    [HttpPost]
    Task<Foo> UpdateFoo([FromBody] Foo foo);
}

The controller just implements the interface with no attributes at all.
I've also written a Roslyn analyzer and code generator that creates clients from those interfaces using HttpClient and the Microsoft.AspNet.WebApi.Client package. The analyzer checks the contract for:

Valid route template syntax
Match route parameters with method parameters
All parameters have binding attributes (implicit not allowed)

Some of those diagnostics could probably be used by any controller.
Note this is not meant to replace Swagger, which is great for public APIs.

Hi @aelij. Can you please provide more details about the scenario and why do you do that? Thanks!

/cc @DamianEdwards ,@glennc

@mkArtakMSFT
The idea is that with services that are in the same repo/solution, using Swagger is a bit of a hassle. If both the controller and the generated client implement the same interface, they're always in sync, and that's guaranteed at compile time. If I changed the contract, I'd have to change the implementation and the call site.
The idea is somewhat similar to Refit but instead of a separate interface for the client with different attributes, I use MVC's attributes, and write them just once.
This makes the development of a system with a large amount of non-public services much simpler IMO.

Thank you for your feature request. We'll consider this feature during the next release planning period and update the status of this issue accordingly. To help us prioritize this feature correctly, please make sure you provide as much information as possible about the scenarios and their importance.

This may give an inspire.

/cc @glennc FYI

Hi @aelij.
This sounds like an interesting idea. If you'd like to build something like this, and hit any blockers we'd be interested in learning about these to unblock you, if possible.

authors: aelij mikeandersun mkArtakMSFT

repo: aspnet/Mvc


text:
Verbose messages in build log about System.ComponentModel.Annotations

One of our dependencies references System.ComponentModel.Annotations. ASP.NET Core references it too (via a NuGet package). Therefore we receive a LOT of the following build messages when executing our build:

C:\Program Files\dotnet\sdk\2.1.401\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.ConflictResolution.targets(41,5): message NETSDK1041: Encountered conflict between 'Platform:System.ComponentModel.Annotations.dll' and 'CopyLocal:C:\Users<myuser>.nuget\packages\system.componentmodel.annotations\4.5.0\lib\net461\System.ComponentModel.Annotations.dll'.  NETSDK1033: Choosing 'CopyLocal:C:\Users<myuser>.nuget\packages\system.componentmodel.annotations\4.5.0\lib\net461\System.ComponentModel.Annotations.dll' because AssemblyVersion '4.2.1.0' is greater than '4.0.10.0'. [C:\Development<ourrepo>\src<ourproj><ourproj>.csproj]

Are those ok? Can we safely ignore them? Why are they printed out in non-verbose mode? Should this be moved to verbose mode? It's irritating ;-)

Thanks for contacting us, @drauch.
We actually don't own the package you reference here.
@Petermarcu, is this something you have context on?

@weshaggard, do you have context on this?

The conflict resolution sounds right if you are referencing a higher version the ASP.NET platform is. As for why the log message I though it was at a lower importance level and should be anywhere but a diag log.

Thanks for contacting us. We believe that the question you've raised have been answered. If you still feel a need to continue the discussion, feel free to reopen it and add your comments.

authors: drauch mkArtakMSFT weshaggard


text:
Added HttpNotFoundObjectResult

Issue #842 @rynowak @yishaigalatzer

:watch: product code is fine, would like to see slightly better tests

Updated.

:shipit:

authors: ajaybhargavb rynowak


text:
Remove DefaultTagHelperResolverFactory.

Nothing consumes this.

:shipit:

authors: NTaylorMullen rynowak

repo: aspnet/Razor


text:
javascript client file for .net core2

Hey how would I get the the client file to work without using node?
I tried using a raw copy of the file:
https://rawgit.com/wpitallo/scripts/master/signalr-client-1.0.0-alpha2-final.js
But when it runs it does not resolve the HubConnection
I have created an example here:
https://codepen.io/Wpitallo/pen/zPyjVv?editors=1010
Thanks for the help,
Regards Warren

We have multiple samples
Take a look here:
https://github.com/aspnet/SignalR/tree/dev/samples
https://github.com/aspnet/SignalR-samples

Thanks so much, you a legend!

authors: BrennanConroy wpitallo

repo: aspnet/SignalR


text:
Several features from our fork

Hi assaf,
A coworker (@shuqunzhang) and I have been working on a fork of vanity which introduces several new features; we're making this pull request to see if you would consider incorporating some of the changes. The biggest things are:

Ab tests can now be "enabled" or "disabled". While disabled, a "default" option will always be chosen and no metrics/participants will be tracked. The dashboard shows the status and also lets users change it by clicking a link. Tests also have a different colored background depending on if they're enabled, disabled, or finished.
Tests can be "reset", which removes participant/conversion data (same as destroy) but also re-initializes the experiment (setting its created_at again). The dashboard shows a "reset" button for each experiment.
Users can manually select which option should be the outcome; the dashboard shows a "complete" button for each alternative.
Support for tracking multiple metrics per experiment.

A couple other miscellaneous notes:

We added two ActiveRecord migrations to accomodate our features.
Experiments are sorted alphabetically instead of by creation date in the report
AbTest#save may only be called once; this is clearly not optimal but wanted your input as to how important it is (we personally don't ever call it more than once)
Documentation is missing except for in the README.rdoc; we have not modified any code in the /doc folder.

Thanks for your time!
Xiaohan Zhang, Sherry Zhang
Vertical Brands

Are you going to pull in the enable/disable experiment code?

Hi @davidguthu, if you'd like to pull it into a separate pr, that'd be
great. It sounds like a useful feature!
On Friday, January 16, 2015, David Guthu notifications@github.com wrote:

Are you going to pull in the enable/disable experiment code?
—
Reply to this email directly or view it on GitHub
https://github.com/assaf/vanity/pull/121#issuecomment-70288040.

Closed by #281

authors: davidguthu hellochar phillbaker

repo: assaf/vanity

license: mit

license_source: bigquery


text:
webfinger broken because activitypub.actor.get is not registered

Décrivez le bug
It seems that @semapps/webfinger is broken because activitypub.actor.get was removed at some point since 0.1.15, which is the version the molecular installer uses.
mol $ call webfinger.get '{ "resource": "acct:s-ol@tun.s-ol.nu" }'
>> Call 'webfinger.get' with params: { resource: 'acct:s-ol@tun.s-ol.nu' }
[2021-01-27T17:19:46.431Z] WARN  virek-86976/BROKER: Service 'activitypub.actor.get' is not registered.
>> Execution time:2ms
>> Response:
undefined

mol $ call activitypub.actor.get
>> Call 'activitypub.actor.get' with params: {}
[2021-01-27T17:25:48.300Z] WARN  virek-86976/BROKER: Service 'activitypub.actor.get' is not registered.
>> ERROR:
ServiceNotFoundError: Service 'activitypub.actor.get' is not found.
    at ServiceBroker.findNextActionEndpoint (/home/s-ol/Documents/other/fedidag/backend/node_modules/moleculer/src/service-broker.js:1025:13)
    at ServiceBroker.call (/home/s-ol/Documents/other/fedidag/backend/node_modules/moleculer/src/service-broker.js:1074:26)
    at call (/home/s-ol/Documents/other/fedidag/backend/node_modules/moleculer-repl/src/commands/call.js:88:9)
    at CommandInstance.<anonymous> (/home/s-ol/Documents/other/fedidag/backend/node_modules/moleculer-repl/src/commands/call.js:144:27)
    at Session.session.execCommandSet (/home/s-ol/Documents/other/fedidag/backend/node_modules/@moleculer/vorpal/dist/session.js:513:20)
    at Vorpal.vorpal._exec (/home/s-ol/Documents/other/fedidag/backend/node_modules/@moleculer/vorpal/dist/vorpal.js:1077:18)
    at Vorpal.vorpal._execQueueItem (/home/s-ol/Documents/other/fedidag/backend/node_modules/@moleculer/vorpal/dist/vorpal.js:852:17)
    at Vorpal.vorpal._queueHandler (/home/s-ol/Documents/other/fedidag/backend/node_modules/@moleculer/vorpal/dist/vorpal.js:835:10)
    at Vorpal.vorpal.exec (/home/s-ol/Documents/other/fedidag/backend/node_modules/@moleculer/vorpal/dist/vorpal.js:778:10)
    at /home/s-ol/Documents/other/fedidag/backend/node_modules/@moleculer/vorpal/dist/vorpal.js:722:10
    at /home/s-ol/Documents/other/fedidag/backend/node_modules/@moleculer/vorpal/dist/ui.js:258:13
    at processTicksAndRejections (node:internal/process/task_queues:93:5)
Data:  { action: 'activitypub.actor.get' }

reproduction

create a new project (moleculer init assemblee-virtuelle/semapps-template-activitypub my-activitypub-server)
update all packages to the last version (0.1.41)
create a user account
get user info from webfinger

Thanks, I will fix that soon.

Thanks, I will fix that soon.

I'm very new to molecular and semapps, but it seems that the cause is that in 9896553eeea81011b827af2afee6cf98c4f5038c the DbService that implements get was removed.

I'm very new to molecular and semapps, but it seems that the cause is that in 9896553eeea81011b827af2afee6cf98c4f5038c the DbService that implements get was removed.

It is fixed by https://github.com/assemblee-virtuelle/semapps/pull/539 and in the latest version 0.1.42
Please beware that there is a breaking change. There is a running issue https://github.com/assemblee-virtuelle/semapps/issues/508 to update the Moleculer templates with the latest versions.

It is fixed by https://github.com/assemblee-virtuelle/semapps/pull/539 and in the latest version 0.1.42
Please beware that there is a breaking change. There is a running issue https://github.com/assemblee-virtuelle/semapps/issues/508 to update the Moleculer templates with the latest versions.

Thanks for the quick response!

Thanks for the quick response!

repo: assemblee-virtuelle/semapps


text:
Find way to make obvious what all extension methods exist in the docs

Right now you have to hunt through all of the traits and it makes it hard to see the big picture.

All hail @QuietMisdreavus, almighty solver of docs problems:
https://twitter.com/QuietMisdreavus/status/1023416134903783429

Thank @guillaumegomez instead, he's the one who put that PR together: https://github.com/rust-lang/rust/pull/52585

Fixed.

Rejoice! Our rustdoc herald @QuietMisdreavus sings the cheerful lore of @GuillaumeGomez grand accomplishments:
https://twitter.com/QuietMisdreavus/status/1023416134903783429

You're all forgiven. :stuck_out_tongue:

Got a couple ideas

Add #[doc(inline)] in a couple places to ensure similar items are shown together rather than some being shown as re-exports
Add a unstable_doc feature where I re-export std::process::Command and std::process::Output into a doc module.  This makes it so they will show up in my docs with all extension traits visible.

authors: GuillaumeGomez QuietMisdreavus epage killercup


text:
♿bridge: Refactor footer links to use unordered list

Description
Portage des changement rgaa du footerBar sur le bridge
Playground

<template>
	<VApp>
		<PageContainer>
			<FooterBar v-bind='docProps'/>

			<FooterBar v-bind='docProps'>

Contenu supplémentaire.

			</FooterBar>

			<FooterBar v-bind='docProps' hide-sitemap-link>

Contenu supplémentaire.

			</FooterBar>

			<FooterBar v-bind='docProps' class='theme--dark'>
				<VRow :no-gutters="isXs" class="max-width-none">
					<VCol cols="12" sm="6">
						<CollapsibleList
							:items="remboursementItems"
							list-title="Remboursement"
							class='theme--dark'
						/>
					</VCol>

					<VCol cols="12" sm="6">
						<CollapsibleList
							:items="healthItems"
							list-title="Santé"
							class='theme--dark'
						/>
					</VCol>
				</VRow>
			</FooterBar>
		</PageContainer>
	</VApp>
</template>

Type de changement

Correction de bug

Checklist

[x] Ma Pull Request pointe vers la bonne branche
[x] Mon code suit le style de code du projet
[x] J'ai effectué une review de mon propre code
[x] J'ai commenté mon code, en particulier dans les parties difficiles à comprendre
[x] J'ai apporté les modifications correspondantes à la documentation
[x] Mes modifications ne génèrent aucun nouveau warning
[ ] J'ai ajouté des tests qui prouvent que mon correctif est efficace ou que ma fonctionnalité fonctionne
[x] Les tests unitaires passent localement avec mes modifications
[ ] J'ai mis à jour le fichier Changelog

a mergé dans une global rgaa

repo: assurance-maladie-digital/design-system


text:
rename the 'in' predicate to 'member'

The in predicate clashes with the in keyword in for loops necessitating the use of excessive parens, e.g.
for (x,y) if x > y in pairlist do
   assert(x>y).
end

produces the error,
error: expected 'in' expression in for loop found 'do'.

This is due to the fact that in pairlist is interpreted as part of the conditional pattern
(x,y) if x > y in pairlist

By removing the predicate in this ambiguity will disappear.

The workaround is to put the pattern expression into parentheses,
for ((x,y) if x > y) in pairlist do
   assert(x>y).
end

There is no good way to fix this because here the language is inherently ambiguous.

repo: asteroid-lang/asteroid


text:
UP035: Deprecate typing.Union and typing.NoReturn

Summary
Update UP035 to catch the following:
Python > 3.11
from typing import NoReturn
>> `typing.NoReturn` is deprecated, use `typing.Never` instead

Python > 3.10
from typing import Union
>> `typing.Union` is deprecated, use `|` instead

Test Plan
Added additional fixture for 3.11 and amended existing file with updated examples
Issue Link
Fixes: #5111

Ugh, my bad -- this is a nice PR, though on reconsideration, I'm leaning towards not marking these as deprecated based on the comments in https://github.com/astral-sh/ruff/issues/5111#issuecomment-1593706211 and some additional research. What do you think?

Closing for now -- needs a decision as to how we handle this (e.g., as a separate rule).

authors: charliermarsh sollyvarcoe

repo: astral-sh/ruff


text:
Skip serializing cell ID if it's None

Summary

Fix #6834
Test Plan

Need tests?

@konstin Added a test!


text:
How to install uv on google colab

Firstly, excellent project! Thanks a lot for taking the time to build this and open source it!
Secondly, do you want to enable the discussions tab in the GitHub repo? I find the discussions a good place to ask usage questions (like this) and filters them out of issues which allows Issues to be more focused on bugs and feature requests.
Are they any google colab notebooks out there that install uv then pip install something else (ruff?). I wasn't sure it.
It writing this I just worked out how to do: https://colab.research.google.com/drive/1Lt2mw6zsqcvzmHxcqyp26EX-W5ARt1FZ?usp=sharing
PR incoming.
You are more than welcome to create you own notebook and use the colab button to link it so you can own the notebook

I've been using
!pip install uv
!uv pip install --system [packages]

I've made a notebook showing the two main options, using pip (as renxida showed) and using our standalone installer: https://colab.research.google.com/drive/1yXx2Xbmgsx34q5lsKEchwEBo5dGbmRa8. I've skipped the pipx installation since pipx is not preinstalled on colab.

I've made a notebook showing the two main options, using pip (as renxida showed) and using our standalone installer: https://colab.research.google.com/drive/1yXx2Xbmgsx34q5lsKEchwEBo5dGbmRa8. I've skipped the pipx installation since pipx is not preinstalled on colab.

thanks for putting this together!
For both of these options I end up with
error: No Python interpreters found in system toolchains

when trying to do uv pip install ....

authors: jas-ho konstin raybellwaves renxida

repo: astral-sh/uv


text:
uv pip install -e . installs script with unusable shebang

Using uv 0.4.18 on Linux.
Given a directory with this setup.py:
from setuptools import setup

setup(
   name="test",
   scripts=(
      "scripts/test_script",
   ),
)

And this scripts/test_script:
#!/usr/bin/env python
print('hello')

And running these commands:
uv venv
uv pip install -e .

The script test_script was copied into .venv/bin/test_script and its shebang changed to #!/home/myuser/.cache/uv/builds-v0/.tmpl3hQKg/bin/python
This python path does not exist, which means the script is not executable.
Is uv behaving incorrectly, or is something wrong in the setup.py configuration?

Looks like it. I missed it in my searches. Thanks!

Np!

authors: charliermarsh salty-horse


text:
document: tox

something like this should get you going:
# tox.ini

[testenv]
...
allowlist_externals =
                uvx
                uv
commands_pre = uv sync --all-extras --dev
commands =
    uvx pytest -v {posargs}
...

well actually this seems to break
i'll update if i find a solution


text:
uv python install --preview fails with same minor version

$ uv --version
uv 0.5.5 (b7564f403 2024-12-03)
$ uv python uninstall --all
Searching for Python installations
No Python installations found
$ ls -l ~/.local/bin/python*
ls: cannot access '/home/jon/.local/bin/python*': No such file or directory
$ uv python install --preview 3.12.7 3.12.6
Installed 2 versions in 7.15s
 + cpython-3.12.6-linux-x86_64-gnu (python3.12)
 + cpython-3.12.7-linux-x86_64-gnu
error: Failed to install cpython-3.12.7-linux-x86_64-gnu
  Caused by: Executable already exists at `/home/jon/.local/bin/python3.12` but is not managed by uv; use `--force` to replace it

Correct behavior IMHO is to pick the highest patch version within the minor version. This matches what happens when you install them one by one.
Install symlink for 3.12.6, then upgrade the symlink to 3.12.7
$ uv python uninstall --all
Searching for Python installations
No Python installations found
$ uv python install --preview 3.12.6
Installed Python 3.12.6 in 4.01s
 + cpython-3.12.6-linux-x86_64-gnu (python3.12)
$ uv python install --preview 3.12.7
Installed Python 3.12.7 in 3.91s
 + cpython-3.12.7-linux-x86_64-gnu (python3.12)

Install symlink for 3.12.7, then keep it when installing 3.12.6
$ uv python uninstall --all
Searching for Python installations
Uninstalled 2 versions in 58ms
 - cpython-3.12.6-linux-x86_64-gnu
 - cpython-3.12.7-linux-x86_64-gnu (python3.12)
$ uv python install --preview 3.12.7
Installed Python 3.12.7 in 3.69s
 + cpython-3.12.7-linux-x86_64-gnu (python3.12)
$ uv python install --preview 3.12.6
Installed Python 3.12.6 in 3.64s
 + cpython-3.12.6-linux-x86_64-gnu

Thanks!

authors: jooon zanieb


text:
Add dry-run to bridge-withdrawer batcher

Add a "dry-run" mode where batches are saved to a file instead of being submitted to the sequencer. This would make manual operation with a wallet cli app such as astria-cli-go possible, as the cli could:

Read batch info from file (this would be the payload Vec<Action> for the sequencer transaction)
Attach a nonce
Sign
Submit to the sequencer

Rough outline:

[ ] Using a config value, the Submitter could be disabled and instead the batch channel output would be saved to a file that can be read by other wallet applications.

This should be the extent of the changes required in the bridge withdrawer binary before the intended audit date

[ ] How should this be saved to file?
[ ] Add the related astria-cli-go logic

closing this as we added functionality in the CLI to provide manual operation functionality

repo: astriaorg/astria


text:
Deploy to Github Pages

Here's the link to the online version of this app:
https://astroboyreloaded.github.io/

Hi @astroboyReloaded ,
STATUS: APPROVED! 🥇🟢🟢💯

Your project is complete!  There is nothing else to say other than... it's time to merge it :ship it:
Congratulations! 🎉
Highlights💯🎈🪄✔

[x]  Good deploying at the GitHub pages
[x] Beautiful UI. ✔
[x] Nice design.✔

Cheers and Happy coding!👏👏👏
Feel free to leave any questions or comments in the PR thread if something is not 100% clear.
Please, remember to tag me in your question so I can receive the notification.

As described in the Code reviews limits policy  you have a limited number of reviews per project (check the exact number in your Dashboard). If you think that the code review was not fair, you can request a second opinion using this form.


text:
Add trigger dag option to deployment workflow

Why
Most of the time, I use the deploy-integration-tests-to-astro-cloud for testing certain DAGs. Thus, if we can add an option to let the workflow which DAGs should be triggered after the deployment, it would facilitate our testing process
Changes

github-actions

add dags_to_trigger_after_deployment input to deployment workflow

dev/providers_rc_test_scripts

change trigger_master_dag into trigger_dag which can take argument dag_ids to trigger multiple different dags

Example run
https://github.com/astronomer/astronomer-providers/actions/runs/5068141893

repo: astronomer/astronomer-providers


text:
Add unit tests for Observer

Right now, there are many functional tests to compare with output from PyEphem. We need unit tests!

Can you clarify the difference? What is missing?

Sure.
A "unit test" tests a specific function or method, or a specific part of a function / method, with many different inputs / checks for failure modes / etc. These meant primarily to check that the code executes with valid input, returns valid output with valid input, fails as expected, etc. For example, you could write some very simple tests for _generate_24hr_grid that check that (for all possible valid inputs) you get back a length N Time object. Other good ones are to check for failure modes: What happens if you pass in a float for N instead of an int? Are there any cases for which it should fail? If so, you can check and require that it throws an error. For this function it's not critical that the tests are too extensive because it is an internal function, but same principles.
A "functional test" (sometimes called an integration test, but sometimes they are considered different...) tests more of the user-facing code and are what you mainly have implemented now -- e.g., checking calculations that may involve smaller pieces of code against output from PyEphem.
Many people have written many words about the differences / utilities of each (google 'unit test vs functional test'). Here's a blog post that (I haven't read) but has some examples: http://jeffknupp.com/blog/2013/12/09/improve-your-python-understanding-unit-testing/

@adrn – agreed that unit tests are important, but ...
IMO a few functional tests are more important, so I like that @bmorris3 started with those.
There can be millions of lines of code and unit tests, and still the software isn't functional, i.e. can't do the major use cases.
Personally I'd prefer @bmorris3 works on features, e.g. making the code work with arrays of targets and adding a functional test for that.
One can easily spend many days or weeks thinking of and implementing unit tests for everything and especially invalid input handling / response.
So maybe we can agree that @bmorris3 should implement more unit tests (or unit tests at all ... I haven't been really looking too closely) in the coming weeks, but try to avoid this becoming too big of a time sink, i.e. also spend time on more features and high-level tests?

@cdeil it's always about finding the balance of functional and unit tests. I should've made it more clear: this issue isn't even necessarily for @bmorris3, but is to remind us that there is definitely room to add some unit tests (by someone...at some point).

However, @bmorris3 is responsible for #18 !

(I assigned the units to hopefully make this more clear)

@adrn – OK, then we're on the same page.
@bmorris3 – If you have any questions about what / how to test, please ask!
Developing good tests, i.e. tests that cover a lot of ground, but are easy to read and write, is hard.
Probably browsing the tests in astropy.coordinates for a while is a good way to learn.

Current coverage report for Observer:
https://coveralls.io/builds/3413013/source?filename=astroplan%2Fcore.py#L108
(overall OK, but there's a few methods / branches of if statements that are untested)
@bmorris3 – Can you make a PR to address this issue and #18 ? Or do you want to move those to the 0.2 milestone?

@cdeil If time allows, I'd like to address #18 in time for 0.1, but the updates that I want to make for #18 depend on #69 getting merged.
I'd be happy to let #19 (this issue) slide until 0.2, and I'd like to remind @adrn of his apt prompt:

that there is definitely room to add some unit tests (by someone...at some point).

After all @adrn, it's presently some point, and he's currently someone. :wink:

authors: adrn bmorris3 cdeil

repo: astroplanners/astroplan


text:
non-periodic pair counting maximum separation

There should be no maximum pair separation condition when PBCs==False.
Currently, the pair counters calculate the minimum cube that encloses the points.  If this cube's sides satisfy max(rbin)>Lbox/3, then the pair counters through an error.  This is not desired behavior.
We should look at the separation bins and enforce that the box is large enough not to throw an error.

I fixed this by padding the box with empty space.

repo: astropy/halotools


text:
halotools.test_installation() fails

Dear all,
I installed halotools as explained in the guide, step by step.
However, when the installation test always fails.
Here the exit on the terminal:
ImportError while loading conftest '/home/matteo.serafino/virtualenv/venv/lib/python3.5/site-packages/halotools/conftest.py'.
venv/lib/python3.5/site-packages/halotools/conftest.py:5: in
from astropy.tests.pytest_plugins import *
E   ImportError: No module named 'astropy.tests.pytest_plugins'
4
It seems related to some changes on the astropy package.
How may I solve it?

Not sure offhand, @MatteoSerafino - it looks like could be an incompatibility between halotools and different versions of astropy. How did you try to install the code? With pip, conda, or building from source? Did you use a virtual environment? Could you review what you did to install?
To help identify the problem, could you include information about your python distribution and/or conda environment, and also version information for both halotools and astropy?
@bsipocz or @eteq - do you know whether the existence of pytest_plugins varies across astropy versions?

Sure.
I'm working on a virtual environment since I'm on a server where I do not have sudo permission.
I'm working with Python 3.5.2 and I installed the code with pip as reported in your guide.
The version of the code the pip installed is the 0.6, that I suppose is the most released recent one.
The problem seems to be related to the issue #660, but I do not know how to solve it.
Astropy version 3.2.1.

Sorry the one I suppose it's the related issue is the following: https://github.com/astropy/ccdproc/issues/660

@MatteoSerafino - would it work for you to instead install the code from source with a later python distribution? For example, the following conda environment should resolve the issue:
conda create -n ht3 python=3 numpy scipy matplotlib cython h5py astropy ipython jupyter

After creating the environment, you should be able to install the latest version of halotools as follows:
$ conda activate ht3
$ cd path/to/halotools
$ python setup.py install

Dear Aphearin,
I exactly did now what you suggested to me. So uninstalled everything and then I proceeded as you said:
conda create -n ht3 python=3 numpy scipy matplotlib cython h5py astropy ipython jupyter
and then
$ conda activate ht3
$ cd path/to/halotools
$ python setup.py install
Indeed in this way, I got the version 0.7.dev5027. However, I still face the same problem.

Hmm, dang, sorry that didn't fix the problem. When you activate the ht3 environment, could you report on which version of python and astropy is installed?

I should have also asked: is it just the testing suite that is the problem? Or have you noticed other functionality impacted? If the lack of existence of astropy.tests.pytest_plugins is the only bug, then in principle the only problem is that you can't locally run the test suite, but other than that the code may be perfectly good to go for your science application. I would still want to fix this, of course, but that doesn't need to be your problem in case you just to get on with your research.

Hi,
the version of python is the Python 3.5.2. Astropy 3.2.1.
Indeed I tried:

from halotools.empirical_models import NFWPhaseSpace
nfw = NFWPhaseSpace()
data = nfw.mc_generate_nfw_phase_space_points(Ngals = 100, mass = 1e13, conc = 10)
and indeed it is working. So it seems only the test is not working.
However when I run the first line I obtain a warning, but I suppose it is not a problem.
WARNING: AstropyDeprecationWarning: astropy.extern.six will be removed in 4.0, use the six module directly if it is still needed [astropy.extern.six]

Great, ok, that's good to hear. Since the problem has to do with the existence of astropy.tests.pytest_plugins across versions, and since this module is not used by any halotools source code, only the test suite, then I think you should be good to go with your science.
Based on the discussion in the Astropy issue you pointed to, it looks like if you modify the conda environment I previously sent you to use python 3.6.x, then this may be also resolve the problem with the test suite:
conda create -n ht3 python=3.6 numpy scipy matplotlib cython h5py astropy ipython jupyter
Although I think this should only be necessary if you want to run the test suite, and shouldn't have any impact on the source code behavior.
Re:

WARNING: AstropyDeprecationWarning: astropy.extern.six will be removed in 4.0, use the six module directly if it is still needed [astropy.extern.six]

Yes, the current version of the code raises a bunch of warnings about future compatibility. Fixing this is one of the last obstacles remaining before the v0.7 release. For now they should be harmless and can be ignored.
I'll leave this issue open until I either resolve the installation problem, or at least add a note to the documentation.

Ok, thank you.
I really appreciated.  I also have one more question about the function >>>nfw.mc_generate_nfw_radial_positions
All the results are obtained by imposing the value of Δref(z)=200.
Is there a way to change this value without changing internally the code?

The NFWProfile class accepts a mdef argument that lets you change mass definition.
>>> nfw = NFWProfile(mdef='2500m')
>>> nfw = NFWProfile(mdef='500c')

Alternatively, you can just drill down into the module subdirectories and import the standalone function, which has a halo_radius argument that can simply be any positive float or ndarray of positive floats.
from halotools.empirical_models.phase_space_models.analytic_models.satellites.nfw.kernels.mc_generate_nfw_radial_positions import mc_generate_nfw_radial_positions

Hi @aphearin! I am commenting here since this is an issue I have been facing too. I recently re-installed Anaconda and all my packages due to a bug I had been facing and I was able to install the stable version of halotools (v0.6). When testing it, I ran into the same issue pointed out here with pytest_plugins which I was able to fix by making the relevant changes mentioned at the bottom of https://docs.astropy.org/en/stable/whatsnew/3.0.html in conftest.py . It seems that in Astropy v3.0 they have moved some pytest plugins to their own packages.
However, the AstropyDeprecationWarning regarding the six module is not letting me run the following import I need for my script:
from halotools.empirical_models import SubhaloModelFactory
It was originally also not working for:
from halotools.sim_manager import CachedHaloCatalog
but I was able to fix it by manually going into the sim_manager directory and editing the .py files from import astropy.extern.six to import six.
Should I, for now, just change the files connected to the packages I need until this warning has been resolved in v0.7?

@MehnaazAsad - those two issues has been fixed yesterday, so if you try to install the dev version from here, it they both should be fixed. The alternative workaround is to downgrade your astropy install to <3.2
However it's interesting what you're saying about the deprecation. As it's a warning, it should not be a blocker to do any of the imports, they may be another issue somewhere else.

@bsipocz Yes, I too found it strange that a warning was performing more like an error but making the same changes I made to get the other import to work fixed the issue. It still shows up as a warning when I try to import SubhaloModelFactory but now it behaves purely like a warning.
Despite fixing it, I installed the dev version. The halotools.test_installation() still produces errors but none of the ones mentioned above. Moreover, I am able to use the two packages I need so I will just ignore those errors for now.

Thanks for the fixes @bsipocz! There are a lot of annoying warnings I'm working on fixing so that I can finish and release v0.7. It's been pretty tedious, so in the meantime thanks for the patience @MehnaazAsad.

authors: MatteoSerafino MehnaazAsad aphearin bsipocz


text:
Update modal overflow

Changed overflow from scroll to hidden in order to hide scroll bars on some devices.

This has been fixed with the catalog rework

authors: Jdyn levikline

repo: asuc-octo/berkeleytime


text:
Support for a generic InputObject

I'm attempting to create a 'base' generic InputObject, that could be extended into a concrete type without reimplementing the fields.
Something like this would be ideal:
#[derive(Default)]
pub struct EqualityFilter<T: PartialEq + Eq> {
    equals: Option<T>,
    not_equals: Option<T>,
}

#[InputObject(name = "SomeConcreteName")]
impl EqualityFilter<SomeType> {}

Is there an existing pattern that might support something close to this approach?
I could write a macro for this specific use-case, but curious if there's an existing way to do this that I might be overlooking.
Thanks!

There is currently no method that supports the generic InputObject.
Because the following code cannot get the fields of the struct, it cannot be done.
#[InputObject(name = "SomeConcreteName")]
impl EqualityFilter<SomeType> {}

I am trying the following implementation.
#[derive(Default)]
#[graphql(generic(name = "SomeConcreteName", params("SomeType")))]
pub struct EqualityFilter<T: PartialEq + Eq> {
    equals: Option<T>,
    not_equals: Option<T>,
}

There is currently no method that supports the generic InputObject.
Because the following code cannot get the fields of the struct, it cannot be done.
#[InputObject(name = "SomeConcreteName")]
impl EqualityFilter<SomeType> {}

I am trying the following implementation.
#[derive(Default)]
#[graphql(generic(name = "SomeConcreteName", params("SomeType")))]
pub struct EqualityFilter<T: PartialEq + Eq> {
    equals: Option<T>,
    not_equals: Option<T>,
}

Released in v2.4.8 😁
Here is the test:
https://github.com/async-graphql/async-graphql/blob/4a4e4e7219d77ef379a535685cb83d32c45f85be/tests/input_object.rs#L354
When you are free, can you help me add a tutorial about generic InputObject in the Book?
Note:  params is a list.
 #[derive(InputObject)]
#[graphql(concrete(name = "SomeConcreteName", params(A, B, C)))]

Released in v2.4.8 😁
Here is the test:
https://github.com/async-graphql/async-graphql/blob/4a4e4e7219d77ef379a535685cb83d32c45f85be/tests/input_object.rs#L354
When you are free, can you help me add a tutorial about generic InputObject in the Book?
Note:  params is a list.
 #[derive(InputObject)]
#[graphql(concrete(name = "SomeConcreteName", params(A, B, C)))]

Thanks, as usual, for being so attentive to feature requests! Really appreciated.
I'd be happy to write up a doc page for this.
There's one thing I'm not clear on -- when adding multiple type annotations, the schema that's generated seems off.
I'm attempting to use this:
#[derive(Enum, Copy, Clone, Eq, PartialEq)]
/// Type of component
pub enum ComponentType {
    Source,
    Transform,
    Sink,
}

#[derive(InputObject)]
#[graphql(concrete(name = "ComponentTypeEqualityFilter", params(ComponentType)))]
#[graphql(concrete(name = "StringEqualityFilter", params(String)))]
pub struct EqualityFilter<T: InputType + PartialEq + Eq> {
    equals: Option<T>,
    not_equals: Option<T>,
}

impl<T: InputType + PartialEq + Eq> EqualityFilter<T> {
    pub fn filter_value(&self, value: T) -> bool {
        filter_check!(
            // Equals
            self.equals.as_ref().map(|s| value.eq(s)),
            // Not equals
            self.not_equals.as_ref().map(|s| !value.eq(s))
        );
        true
    }
}

And then implementing both as fields of another InputObject, like so:
#[derive(Default, InputObject)]
pub struct ComponentsFilter {
    name: Option<Vec<filter::StringFilter>>,
    component_type: Option<Vec<filter::EqualityFilter<ComponentType>>>,
    big_test: Option<Vec<filter::EqualityFilter<String>>>,
    and: Option<Vec<Self>>,
    or: Option<Vec<Self>>,
}

But looking at the generated schema, this is what I get:
input ComponentsFilter {
  name: [StringFilter!]
  componentType: [EqualityFilter!] # <-- shouldn't this be [ComponentTypeEqualityFilter!]?
  bigTest: [EqualityFilter!] # <-- and this one [StringEqualityFilter!]?
  and: [ComponentsFilter!]
  or: [ComponentsFilter!]
}

Both fields appear to be [EqualityFilter!], which is implemented as String -- and not ComponentType:
input EqualityFilter {
  equals: String
  notEquals: String
}

I might be implementing it incorrectly -- would you mind taking a quick look? Thanks!

Thanks, as usual, for being so attentive to feature requests! Really appreciated.
I'd be happy to write up a doc page for this.
There's one thing I'm not clear on -- when adding multiple type annotations, the schema that's generated seems off.
I'm attempting to use this:
#[derive(Enum, Copy, Clone, Eq, PartialEq)]
/// Type of component
pub enum ComponentType {
    Source,
    Transform,
    Sink,
}

#[derive(InputObject)]
#[graphql(concrete(name = "ComponentTypeEqualityFilter", params(ComponentType)))]
#[graphql(concrete(name = "StringEqualityFilter", params(String)))]
pub struct EqualityFilter<T: InputType + PartialEq + Eq> {
    equals: Option<T>,
    not_equals: Option<T>,
}

impl<T: InputType + PartialEq + Eq> EqualityFilter<T> {
    pub fn filter_value(&self, value: T) -> bool {
        filter_check!(
            // Equals
            self.equals.as_ref().map(|s| value.eq(s)),
            // Not equals
            self.not_equals.as_ref().map(|s| !value.eq(s))
        );
        true
    }
}

And then implementing both as fields of another InputObject, like so:
#[derive(Default, InputObject)]
pub struct ComponentsFilter {
    name: Option<Vec<filter::StringFilter>>,
    component_type: Option<Vec<filter::EqualityFilter<ComponentType>>>,
    big_test: Option<Vec<filter::EqualityFilter<String>>>,
    and: Option<Vec<Self>>,
    or: Option<Vec<Self>>,
}

But looking at the generated schema, this is what I get:
input ComponentsFilter {
  name: [StringFilter!]
  componentType: [EqualityFilter!] # <-- shouldn't this be [ComponentTypeEqualityFilter!]?
  bigTest: [EqualityFilter!] # <-- and this one [StringEqualityFilter!]?
  and: [ComponentsFilter!]
  or: [ComponentsFilter!]
}

Both fields appear to be [EqualityFilter!], which is implemented as String -- and not ComponentType:
input EqualityFilter {
  equals: String
  notEquals: String
}

I might be implementing it incorrectly -- would you mind taking a quick look? Thanks!

Thanks, as usual, for being so attentive to feature requests! Really appreciated.
I'd be happy to write up a doc page for this.
There's one thing I'm not clear on -- when adding multiple type annotations, the schema that's generated seems off.
I'm attempting to use this:
#[derive(Enum, Copy, Clone, Eq, PartialEq)]
/// Type of component
pub enum ComponentType {
    Source,
    Transform,
    Sink,
}

#[derive(InputObject)]
#[graphql(concrete(name = "ComponentTypeEqualityFilter", params(ComponentType)))]
#[graphql(concrete(name = "StringEqualityFilter", params(String)))]
pub struct EqualityFilter<T: InputType + PartialEq + Eq> {
    equals: Option<T>,
    not_equals: Option<T>,
}

impl<T: InputType + PartialEq + Eq> EqualityFilter<T> {
    pub fn filter_value(&self, value: T) -> bool {
        filter_check!(
            // Equals
            self.equals.as_ref().map(|s| value.eq(s)),
            // Not equals
            self.not_equals.as_ref().map(|s| !value.eq(s))
        );
        true
    }
}

And then implementing both as fields of another InputObject, like so:
#[derive(Default, InputObject)]
pub struct ComponentsFilter {
    name: Option<Vec<filter::StringFilter>>,
    component_type: Option<Vec<filter::EqualityFilter<ComponentType>>>,
    big_test: Option<Vec<filter::EqualityFilter<String>>>,
    and: Option<Vec<Self>>,
    or: Option<Vec<Self>>,
}

But looking at the generated schema, this is what I get:
input ComponentsFilter {
  name: [StringFilter!]
  componentType: [EqualityFilter!] # <-- shouldn't this be [ComponentTypeEqualityFilter!]?
  bigTest: [EqualityFilter!] # <-- and this one [StringEqualityFilter!]?
  and: [ComponentsFilter!]
  or: [ComponentsFilter!]
}

Both fields appear to be [EqualityFilter!], which is implemented as String -- and not ComponentType:
input EqualityFilter {
  equals: String
  notEquals: String
}

I might be implementing it incorrectly -- would you mind taking a quick look? Thanks!

Please wait, I am confirming whether this problem really exists.

Thanks, as usual, for being so attentive to feature requests! Really appreciated.
I'd be happy to write up a doc page for this.
There's one thing I'm not clear on -- when adding multiple type annotations, the schema that's generated seems off.
I'm attempting to use this:
#[derive(Enum, Copy, Clone, Eq, PartialEq)]
/// Type of component
pub enum ComponentType {
    Source,
    Transform,
    Sink,
}

#[derive(InputObject)]
#[graphql(concrete(name = "ComponentTypeEqualityFilter", params(ComponentType)))]
#[graphql(concrete(name = "StringEqualityFilter", params(String)))]
pub struct EqualityFilter<T: InputType + PartialEq + Eq> {
    equals: Option<T>,
    not_equals: Option<T>,
}

impl<T: InputType + PartialEq + Eq> EqualityFilter<T> {
    pub fn filter_value(&self, value: T) -> bool {
        filter_check!(
            // Equals
            self.equals.as_ref().map(|s| value.eq(s)),
            // Not equals
            self.not_equals.as_ref().map(|s| !value.eq(s))
        );
        true
    }
}

And then implementing both as fields of another InputObject, like so:
#[derive(Default, InputObject)]
pub struct ComponentsFilter {
    name: Option<Vec<filter::StringFilter>>,
    component_type: Option<Vec<filter::EqualityFilter<ComponentType>>>,
    big_test: Option<Vec<filter::EqualityFilter<String>>>,
    and: Option<Vec<Self>>,
    or: Option<Vec<Self>>,
}

But looking at the generated schema, this is what I get:
input ComponentsFilter {
  name: [StringFilter!]
  componentType: [EqualityFilter!] # <-- shouldn't this be [ComponentTypeEqualityFilter!]?
  bigTest: [EqualityFilter!] # <-- and this one [StringEqualityFilter!]?
  and: [ComponentsFilter!]
  or: [ComponentsFilter!]
}

Both fields appear to be [EqualityFilter!], which is implemented as String -- and not ComponentType:
input EqualityFilter {
  equals: String
  notEquals: String
}

I might be implementing it incorrectly -- would you mind taking a quick look? Thanks!

Please wait, I am confirming whether this problem really exists.

Ah, hold on, I see you changed the comment to 2.4.9 and not 2.4.8-- I only tested with 2.4.8. Trying now... will get back to you in a few mins!

Ah, hold on, I see you changed the comment to 2.4.9 and not 2.4.8-- I only tested with 2.4.8. Trying now... will get back to you in a few mins!

Hmm yeah, this still appears to be happening on 2.4.9.

Hmm yeah, this still appears to be happening on 2.4.9.

I confirmed that this problem does exist. . . .

I confirmed that this problem does exist. . . .

I fixed this in v2.4.10. 🙂 @leebenson

I fixed this in v2.4.10. 🙂 @leebenson

Beautiful, thanks so much!

Beautiful, thanks so much!

repo: async-graphql/async-graphql


text:
Preserve field order for introspection

I've the following code:
pub enum ChangeStatus {
    Applied,
    Canceled,
    Handling,
    Pending,
    Rejected,
    Scheduled,
}

Resulting GraphQL SDL from playground:
enum ChangeStatus {
  APPLIED
  CANCELED
  REJECTED
  PENDING
  SCHEDULED
  HANDLING
}

Is it possible to preserve declared order? I think this feature is important, especially for Interfaces with common fields, which should have a stable order for readability.

Good suggestion, enumValues, fields, possibleTypes, inputFields, args have order problems, I will fix this problem now.
Thank you. 😁

Please upgrade async-graphql to 1.12.8. 😁

Great. My scheme looks nice. Many thanks.