Blazor InputLargeTextArea#34856
Conversation
Update Release .js files Update InputLargeTextAreaTest.cs Update InputLargeTextAreaTest.cs
531b629 to
af4f4b7
Compare
|
/ping @aspnet-blazor-eng, this is ready for review 😄 |
|
Thank you for your API proposal. I'm removing the |
|
The code changes are fairly straight forward, but I'd like to make sure this is the right API shape. |
|
This is now ready for review based on the new symmetric |
| { | ||
| // Special casing support for empty textareas. Due to security considerations | ||
| // 0 length streams/textareas aren't permitted from JS->.NET Streaming Interop. | ||
| if (jsException.InnerException is ArgumentOutOfRangeException) |
There was a problem hiding this comment.
Can we throw a more specific exception? Hard to say that ArgumentOutOfRange is specifically because of a 0-length stream?
There was a problem hiding this comment.
Hmm in the original context, I believe the ArgumentOutOfRange exception may make sense, however I see your point about it still being ambiguous with other areas where that exception may be thrown.
How about this:
https://github.com/dotnet/aspnetcore/pull/34856/files#diff-30d94608ca41ec93dcbe8eb2bb646257519e86080e81ed5c246a715a8782c4b9R94-R102
Alternatively, we can decorate the Exception.Data property with something more specific (though that may not necessarily be statically typed).
| // public override async Task InitializeAsync() | ||
| // { | ||
| // // Since the tests share interactivity with the same text area, it's easiest for each | ||
| // // test to run in its own browser instance. | ||
| // await base.InitializeAsync(Guid.NewGuid().ToString()); | ||
| // } |
There was a problem hiding this comment.
| // public override async Task InitializeAsync() | |
| // { | |
| // // Since the tests share interactivity with the same text area, it's easiest for each | |
| // // test to run in its own browser instance. | |
| // await base.InitializeAsync(Guid.NewGuid().ToString()); | |
| // } | |
| public override async Task InitializeAsync() | |
| { | |
| // Since the tests share interactivity with the same text area, it's easiest for each | |
| // test to run in its own browser instance. | |
| await base.InitializeAsync(Guid.NewGuid().ToString()); | |
| } |
| }); | ||
|
|
||
| class DotNetStream { | ||
| export interface IDotNetStreamReference { |
There was a problem hiding this comment.
In Typescript it's idiomatic for interfaces not to have an I prefix. I suppose the difference vs C# is that it's very meaningful to think about runtime types in .NET but not so relevant in JS.
| } | ||
|
|
||
| /// <summary> | ||
| /// The textarea element for which the event was raised. |
There was a problem hiding this comment.
| /// The textarea element for which the event was raised. | |
| /// The <see cref="InputLargeTextArea" /> for which the event was raised. |
| /// <summary> | ||
| /// Gets the length of the textarea value. | ||
| /// </summary> | ||
| public int Length { get; } |
There was a problem hiding this comment.
Should the type be long? Can it be > 2GB? I know that it would be pretty outrageous to have a 2GB textarea, but do we definitely want to preclude it?
|
There are concerns with API complexity from having to work with Closing this PR in favor of docs/samples of a solution for users that encounter this issue. |
Usage:
Implementation Notes:
Follows the overall pattern we have with the
InputFileComponent, communicating with the client and relaying back events.Fixes: #30291
API Proposal: #35007