64 Commits
Author SHA1 Message Date
Elinor Fung 1f2f9b929b Add tracing for handling of dependencies for Assembly.LoadFrom (#27833)
Signed-off-by: dotnet-bot <[email protected]>
2019-11-15 13:29:04 +01:00
Filip Navara bd278dd00d Mirror changes from mono/corefx,coreclr (#17777)
* Rewrite the rest of the array non-generic fast paths in C# (#27703)

* Rewrite the rest of the array non-generic fast paths in C#

* Add missing resource string

* Use CorElementType and handle native ints to match the unmanaged implementation

* Avoid try pattern for Sort and Reverse

* Match the native implementation more closely

Signed-off-by: dotnet-bot <[email protected]>

* Rewrite Enum.CompareTo in C# (dotnet/coreclr#27792)

* Rewrite Enum.CompareTo in C#

* Handle floating point too for match the existing native implementation

Signed-off-by: dotnet-bot <[email protected]>

* Remove unused argument from GetRegionDisplayName (dotnet/coreclr#27806)

* Remove unused argument from GetRegionDisplayName

* Address race conditions in CultureData

While most of the race conditions in this file are benign, in these cases, a thread could end up returning an intermediate value due to multiple potential writes to the same field.

Signed-off-by: dotnet-bot <[email protected]>

* Fix StyleCop rule SA1129 ("Do not use default value type constructor") (#27716)

Will enable the rule in corefx once these changes have propagated.

Signed-off-by: dotnet-bot <[email protected]>

* Remove non-shared Enum.CompareTo/InternalCompareTo implementation, add new Array icalls used by shared code
2019-11-12 18:46:00 +01:00
Dan Moseley 9aeef958c6 Add path to not-absolute-path exception (dotnet/coreclr#27470)
Signed-off-by: dotnet-bot <[email protected]>
2019-10-29 23:34:11 +01:00
Jan Kotas b98911d4f8 Delete Uap quirks from CoreLib (dotnet/coreclr#27356)
This matches cleanup done in CoreFX.

Signed-off-by: dotnet-bot <[email protected]>
2019-10-22 14:48:34 -04:00
Stephen Toub 670738b55f Use const internally in corelib for Environment.NewLine (#27013)
Signed-off-by: dotnet-bot <[email protected]>
2019-10-05 14:09:54 +02:00
Stephen Toub 1e3d017479 More corelib cleanup (dotnet/coreclr#26993)
* Make relevant types static (mostly Interop)

* Fix a few stray semicolons

* Remove unnecessary locals

Some can be removed entirely, some can be replaced by discards.

* Remove unnecessary usings

* Move Unix-specific helper method to TimeZoneInfo.Unix.cs

* Remove duplicated code

* Remove duplicative checks

* Remove [ThreadStatic] initialization

These are all the default values and wouldn't be necessary for any static, but inline initialization for [ThreadStatic]s is particularly unuseful (and in non-default cases problematic) because the fields are only set to these values on the initializing thread.

* Fix methods whose return value is never used

* Use string.IsNullOrEmpty

* Remove unnecessary field initialization

All ctors overwrite these values.

* Address PR feedback

Signed-off-by: dotnet-bot <[email protected]>
2019-10-05 14:09:54 +02:00
Stephen Toub c256e409c9 More Corelib cleanup (dotnet/coreclr#26872)
* Remove unnecessary asserts

* Make several classes static

* Use is instead of as+null check

* Use T? instead of Nullable<T>

* more static classes

* Mark locals as const

* Merge declaration and initialization of some variables

* Remove unnecessary casts

* Remove unnecessary "unsafe"s

* Simplify several lambda expressions

* Remove redundant parentheses

* Remove redundant '== true'

* Remove redundant empty lines

* Simplify boolean comparison with '== false'

* Replace if-statement with return statement

* Use while for infinite loop

* Add static to all partial static class declarations

* Use ++/-- operator instead of assignment

* Use string.IsNullOrEmpty

* Use coalesce expression

* Simplify lazy initialization

* Use coalese expression

* Join string expressions

* Use regular string literal instead of verbatim string literal

* Optimize StringBuilder.Append calls

* Remove redundant assignment

* Remove unnecessary unsafe context

* Merge processor directives

* Use String.Equals instead of String.Compare

* Use Debug.Fail instead of Debug.Assert(false

* Remove Attribute suffix

* Use predefined type

* Use compound assignment

* Use while statement to create an infinite loop

* Remove redundant base ctor call

* Avoid using catch (Exception)

* Remove empty regions

* Span comparison to null

* Avoid unnecessary boxing of value type

* Expression is always equal to 'true'

* Remove unused method

* update coalesce assignment

* fix unsafe

* fix redundant parens

* Fix whitespace errors introduced

Signed-off-by: dotnet-bot <[email protected]>
2019-09-25 20:13:47 +02:00
Dotnet-GitSync-Bot 381c187df9 Mirror changes from mono/coreclr (#16713)
* Remove stale SuppressMessage attributes (dotnet/coreclr#26501)

Signed-off-by: dotnet-bot <[email protected]>

* Use null coalescing assignment operator in more places

There's currently no auto-fix for this, so the fixes were done manually.

Signed-off-by: dotnet-bot <[email protected]>

* Fix IDE0026 (use expression-bodied members for indexers)

Signed-off-by: dotnet-bot <[email protected]>
2019-09-06 15:58:38 -04:00
Stephen ToubandAdam Sitnik ff7dd88cfa Use expression-bodied members in more places (dotnet/coreclr#26500)
* Fix IDE0027 (use expression body for accessors)

* Fix IDE0023 / IDE0024 (use expression body for operators)

* Apply suggestions from code review

Co-Authored-By: Adam Sitnik <[email protected]>

Signed-off-by: dotnet-bot <[email protected]>
2019-09-05 10:46:55 +02:00
Dotnet-GitSync-Bot a6b91f4295 Mirror changes from mono/coreclr (#16547)
* Move FormatTypeName to Type (dotnet/coreclr#25631)

Signed-off-by: dotnet-bot <[email protected]>

* Fix for mono
2019-09-02 16:02:59 -04:00
Stephen Toub 35d8ca894b Fix StyleCop warning SA1005 (single line comment spacing)
Signed-off-by: dotnet-bot <[email protected]>
2019-08-22 20:21:18 +02:00
Stephen Toub 5f38497e19 Remove unused usings from Corlib (dotnet/coreclr#26250)
* Fix IDE0065 (misplaced using)

* Fix IDE0005 (remove unnecessary usings)

Signed-off-by: dotnet-bot <[email protected]>
2019-08-20 19:45:30 +02:00
Stephen Toub c48dd0608d Fix IDE0025 (use expression body for properties)
Signed-off-by: dotnet-bot <[email protected]>
2019-08-18 07:01:54 +02:00
Stephen Toub 2e9134f1a6 Fix IDE0056 (use index operator)
Signed-off-by: dotnet-bot <[email protected]>
2019-08-18 07:01:54 +02:00
Stephen Toub 828f89360f Fix IDE0031 (use null propagation)
Signed-off-by: dotnet-bot <[email protected]>
2019-08-18 07:01:54 +02:00
Stephen Toub 3803a00421 Fix StyleCop warnings for rules enabled in corefx
Signed-off-by: dotnet-bot <[email protected]>
2019-08-14 10:15:38 +02:00
Stephen Toub e19d95b6de Contribute to IDE0044 (make field readonly)
I used the auto-fix and then undid changes in areas where the fields were potentially mutated in native, e.g. I undid many of the changes in reflection.  We can revisit those individually later.

Signed-off-by: dotnet-bot <[email protected]>
2019-08-13 21:35:04 +02:00
Stephen Toub f39ac1d32d Fix FxCop warning CA2229 (private deserialization ctor)
Signed-off-by: dotnet-bot <[email protected]>
2019-08-09 16:23:42 +02:00
Stephen Toub da2c1cde97 Re-enable StyleCop warnings SA1028 and SA1518 (trailing whitespace and blank lines) (#40113)
Mechanical/automated change.  The only manual changes were a) removing the two rules from the CodeAnalysis.ruleset file, b) removing spaces from one line of a .targets file that is used to generate a .cs file, and c) reverting the changes in a few test files where the naive replacement happened in the middle of a verbatim string where the whitespace actually mattered.

Signed-off-by: dotnet-bot <[email protected]>
2019-08-08 23:44:46 +02:00
Stephen Toub 3385433b60 Enable several StyleCopAnalyzers (dotnet/corefx#39921)
* Fix ordering of keywords in member signatures

* Add StyeCop.Analyzers

Most rules are disabled.  Many of them we'll want to leave disabled, however there are a handful it'll be good to enable over time.

* Use built-in type alias

* Fix straggling stylecop warnings in all configurations

* Replace tabs with spaces

Signed-off-by: dotnet-bot <[email protected]>
2019-08-03 20:55:40 +02:00
Stephen Toub f8d61819b8 Make all event types nullable (dotnet/coreclr#25752)
Late-breaking design change: all events should be declared with nullable delegate types.

Signed-off-by: dotnet-bot <[email protected]>
2019-07-24 09:45:03 +02:00
Stephen Toub 4ec5b8de98 Remove now unnecessary !s / TODO-NULLABLE comments (dotnet/coreclr#25749)
* Remove !s and TODO-NULLABLE comments for [DoesNotReturn]

* Remove !s and TODO-NULLABLE comments for [NotNullIfNotNull]

* Remove !s and TODO-NULLABLE comments for writes via Interlocked.CompareExchange

* Remove !s and TODO-NULLABLE comments for Debug.Assert on fields

* Update/add several TODO-NULLABLE comments

Signed-off-by: dotnet-bot <[email protected]>
2019-07-24 09:45:03 +02:00
Jan Kotas cc779bd7e3 Fix StackChange value for OpCodes.Stelem (dotnet/coreclr#25382)
Fixes dotnet/corefx#37955

Signed-off-by: dotnet-bot <[email protected]>
2019-07-01 23:01:13 +02:00
Stephen Toub 7d4ce9cd8c Remove several unnecessary string allocations (dotnet/coreclr#25305)
Signed-off-by: dotnet-bot <[email protected]>
2019-06-24 21:12:12 +02:00
Stephen Toub 4a29e94abb Update Corelib to adapt to compiler nullability updates
Signed-off-by: dotnet-bot <[email protected]>
2019-06-17 22:36:59 +00:00
Stephen Toub 5eedd4f813 Fix nullable annotations on Binder.ReorderArgumentArray
Signed-off-by: dotnet-bot <[email protected]>
2019-06-13 09:44:12 +02:00
Stephen Toub 001844340a Remove defunct !s and update some TODO-NULLABLE comments
Signed-off-by: dotnet-bot <[email protected]>
2019-06-13 09:44:12 +02:00
Santiago Fernandez Madero 355d611e94 Address nullable feedback for System.Runtime and System.Runtime.Extensions (#25017)
* Address last nullable feedback from System.Runtime

* Address nullable feedback for System.Runtime.Extensions

* PR Feedback

Signed-off-by: dotnet-bot <[email protected]>
2019-06-07 23:17:51 +02:00
Santiago Fernandez Madero 420a9da24a PR Feedback
Signed-off-by: dotnet-bot <[email protected]>
2019-06-06 10:32:52 +02:00
Santiago Fernandez Madero eab7775571 PR Feedback
Signed-off-by: dotnet-bot <[email protected]>
2019-06-06 10:32:52 +02:00
Santiago Fernandez Madero c2796feb97 Fix some nullable annotations from API Review
Signed-off-by: dotnet-bot <[email protected]>
2019-06-06 10:32:52 +02:00
Egor Bogatov 9a11bd94a3 Move some CustomAttribute related types to shared (dotnet/coreclr#23651)
Signed-off-by: dotnet-bot <[email protected]>
2019-05-29 09:43:57 +02:00
Stephen Toub a67c6a2b52 Add and apply nullable attributes (dotnet/coreclr#24679)
* Add and apply nullable attributes

* Adapt to API review decisions

* Address PR feedback

Signed-off-by: dotnet-bot <[email protected]>
2019-05-28 18:14:19 +02:00
Santiago Fernandez Madero 0d1ed39f45 Add IsVariableBoundArray to TypeDelegator (dotnet/coreclr#24637)
Signed-off-by: dotnet-bot <[email protected]>
2019-05-21 14:47:36 +02:00
Levi Broderick 88944be25c Make Label and OpCode readonly and IEquatable (dotnet/coreclr#24360)
Signed-off-by: dotnet-bot <[email protected]>
2019-05-16 00:20:25 -07:00
Stephen Toub 061d44d72e Tweak a few nullable annotations (dotnet/coreclr#24494)
- Assembly.ToString() won't return null
- Several attributes have the intent that their arguments are non-nullable, even though they don't check and throw; the annotations should match the intent in such cases.

Signed-off-by: dotnet-bot <[email protected]>
2019-05-13 22:49:30 -07:00
Stephen Toub b31b703b89 Turn on nullability for all of Corelib (dotnet/coreclr#24497)
* Enable nullable at the project level

* Remove `#nullable enable` from individual files

Removes `#nullable enable` from almost all .cs files in System.Private.CoreLib. I left it only in the ~30 files (out of ~1480 that had it) that are mirrored to corefx, that are built into projects by corefx that don't yet set NullableContextOptions at the project level, and that use nullable annotations; otherwise, they'd break the corefx build.

Signed-off-by: dotnet-bot <[email protected]>
2019-05-10 10:51:17 +02:00
Buyaa Namnan a25a0c2fc6 Fix test failures
Signed-off-by: dotnet-bot <[email protected]>
2019-05-02 20:34:11 +02:00
Krzysztof Wicher 50a010a39f fix build errors after merge
Signed-off-by: dotnet-bot <[email protected]>
2019-05-02 20:34:11 +02:00
buyaa-n 3183fd2028 Nullable for Type class (dotnet/coreclr#23489)
System.Type, System.Reflection nullability

Signed-off-by: dotnet-bot <[email protected]>
2019-05-02 20:34:11 +02:00
Anipik c94f194278 synving with coreclr 2019-04-29 22:10:14 +02:00
Steve MacLean f318317bbd Remove create assembly name (dotnet/coreclr#24154)
* Remove RuntimeAssembly.CreateAssemblyName

Fixes #24135

CreateAssemblyName was not compatible with AssemblyLoadContext isolation.

Assembly.Load(string)
Assembly.LoadWithPartialName(string)
Activator.CreateInstance(...)

* Remove unused AssemblyNameNative::Init arguments

* Temp disable corefx CreateInstanceAssemblyResolve

Signed-off-by: dotnet-bot <[email protected]>
2019-04-22 16:49:48 +00:00
buyaa-n f7c25c025c Nullable: Enums, Structures from Reflection folder (dotnet/coreclr#23933)
* Nullable: Enums, Structures from Reflection

Signed-off-by: dotnet-bot <[email protected]>
2019-04-22 16:43:19 +00:00
Stephen Toub f1901501e8 Nullable: Runtime serialization, COM, Vector, remaining IO, and other (#23895)
Signed-off-by: dotnet-bot <[email protected]>
2019-04-22 16:42:05 +00:00
Santiago Fernandez Madero 88f40c0547 Fix build errors due to merge conflicts
Signed-off-by: dotnet-bot <[email protected]>
2019-04-22 16:37:53 +00:00
Stephen Toub 074f8a9e6c Nullable: Attributes, SafeHandles, and misc (dotnet/coreclr#23810)
* Nullable: Attributes, SafeHandles, and misc

* Address PR feedback

Signed-off-by: dotnet-bot <[email protected]>
2019-04-22 16:28:28 +00:00
Jan Kotas 30d94ae529 Fix AssemblyName regression
Signed-off-by: dotnet-bot <[email protected]>
2019-04-14 15:54:18 +02:00
Jan Kotas 88c35b4974 Delete unused AssemblyName._hashForControl and related code (#23972)
Signed-off-by: dotnet-bot <[email protected]>
2019-04-14 15:54:18 +02:00
Egor Bogatov 1fc8151c7c Move AssemblyName to shared (dotnet/coreclr#23737)
Signed-off-by: dotnet-bot <[email protected]>
2019-04-12 23:45:22 +02:00
Steve MacLean 9501ef8cfb Fix Assembly.LoadFromPartialName(string) (dotnet/coreclr#23912)
Assembly.LoadFromPartialName(string) should not throw FileNotFoundException, but
should rather return null.

ArgumentException should use nameof(partialName)

Fixes #19817

Signed-off-by: dotnet-bot <[email protected]>
2019-04-12 19:22:35 +02:00