Skip to content

Commit 708e33b

Browse files
authored
Merge branch 'release/8.0-staging' into merge/release/8.0-to-release/8.0-staging
2 parents 2fc9614 + b56fb2a commit 708e33b

File tree

39 files changed

+917
-124
lines changed

39 files changed

+917
-124
lines changed

NuGet.config

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@
1010
<!--Begin: Package sources managed by Dependency Flow automation. Do not edit the sources below.-->
1111
<!-- Begin: Package sources from dotnet-emsdk -->
1212
<add key="darc-pub-dotnet-emsdk-201f4da" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-emsdk-201f4dae/nuget/v3/index.json" />
13+
<add key="darc-pub-dotnet-emsdk-0af50f7" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-emsdk-0af50f73/nuget/v3/index.json" />
14+
<add key="darc-pub-dotnet-emsdk-d75f77c" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-emsdk-d75f77cb/nuget/v3/index.json" />
1315
<!-- End: Package sources from dotnet-emsdk -->
16+
<!-- Begin: Package sources from dotnet-sdk -->
17+
<!-- End: Package sources from dotnet-sdk -->
1418
<!--End: Package sources managed by Dependency Flow automation. Do not edit the sources above.-->
1519
<!--
1620
'src/test/PrepareTestAssets/PrepareTestAssets.proj' generates a NuGet.config file using this
@@ -28,5 +32,9 @@
2832
</packageSources>
2933
<disabledPackageSources>
3034
<clear />
35+
<!--Begin: Package sources managed by Dependency Flow automation. Do not edit the sources below.-->
36+
<!-- Begin: Package sources from dotnet-sdk -->
37+
<!-- End: Package sources from dotnet-sdk -->
38+
<!--End: Package sources managed by Dependency Flow automation. Do not edit the sources above.-->
3139
</disabledPackageSources>
3240
</configuration>

eng/Version.Details.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,14 @@
9999
<Sha>201f4dae9d1a1e105d8ba86d7ece61eed1f665e0</Sha>
100100
<SourceBuild RepoName="emsdk" ManagedOnly="true" />
101101
</Dependency>
102-
<Dependency Name="Microsoft.SourceBuild.Intermediate.source-build-reference-packages" Version="8.0.0-alpha.1.23556.3">
102+
<Dependency Name="Microsoft.SourceBuild.Intermediate.source-build-reference-packages" Version="8.0.0-alpha.1.23565.1">
103103
<Uri>https://github.com/dotnet/source-build-reference-packages</Uri>
104-
<Sha>fa4c0e8f53ef2541a23e519af4dfb86cb88e1bae</Sha>
104+
<Sha>95f83e27806330fec09edd96e06bba3acabe3f35</Sha>
105105
<SourceBuild RepoName="source-build-reference-packages" ManagedOnly="true" />
106106
</Dependency>
107-
<Dependency Name="Microsoft.SourceBuild.Intermediate.source-build-externals" Version="8.0.0-alpha.1.23518.1">
107+
<Dependency Name="Microsoft.SourceBuild.Intermediate.source-build-externals" Version="8.0.0-alpha.1.23570.1">
108108
<Uri>https://github.com/dotnet/source-build-externals</Uri>
109-
<Sha>3dc05150cf234f76f6936dcb2853d31a0da1f60e</Sha>
109+
<Sha>e844aa02a05b90d8cbe499676ec6ee0f19ec4980</Sha>
110110
<SourceBuild RepoName="source-build-externals" ManagedOnly="true" />
111111
</Dependency>
112112
</ProductDependencies>
@@ -354,9 +354,9 @@
354354
<Uri>https://dev.azure.com/dnceng/internal/_git/dotnet-optimization</Uri>
355355
<Sha>67613417f5e1af250e6ddfba79f8f2885d8e90fb</Sha>
356356
</Dependency>
357-
<Dependency Name="Microsoft.DotNet.HotReload.Utils.Generator.BuildTool" Version="8.0.0-alpha.0.23563.1">
357+
<Dependency Name="Microsoft.DotNet.HotReload.Utils.Generator.BuildTool" Version="8.0.0-alpha.0.23570.2">
358358
<Uri>https://github.com/dotnet/hotreload-utils</Uri>
359-
<Sha>12d02e5c2310be6460f896bc3aeb0ddf1e8926bc</Sha>
359+
<Sha>5524f726f92ef862b415793758cebbd2a1950b70</Sha>
360360
</Dependency>
361361
<Dependency Name="System.Runtime.Numerics.TestData" Version="8.0.0-beta.23566.1">
362362
<Uri>https://github.com/dotnet/runtime-assets</Uri>

eng/Versions.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
<MicrosoftDotNetXHarnessTestRunnersCommonVersion>8.0.0-prerelease.23407.2</MicrosoftDotNetXHarnessTestRunnersCommonVersion>
187187
<MicrosoftDotNetXHarnessTestRunnersXunitVersion>8.0.0-prerelease.23407.2</MicrosoftDotNetXHarnessTestRunnersXunitVersion>
188188
<MicrosoftDotNetXHarnessCLIVersion>8.0.0-prerelease.23407.2</MicrosoftDotNetXHarnessCLIVersion>
189-
<MicrosoftDotNetHotReloadUtilsGeneratorBuildToolVersion>8.0.0-alpha.0.23563.1</MicrosoftDotNetHotReloadUtilsGeneratorBuildToolVersion>
189+
<MicrosoftDotNetHotReloadUtilsGeneratorBuildToolVersion>8.0.0-alpha.0.23570.2</MicrosoftDotNetHotReloadUtilsGeneratorBuildToolVersion>
190190
<XUnitVersion>2.4.2</XUnitVersion>
191191
<XUnitAnalyzersVersion>1.0.0</XUnitAnalyzersVersion>
192192
<XUnitRunnerVisualStudioVersion>2.4.5</XUnitRunnerVisualStudioVersion>

src/coreclr/debug/daccess/enummem.cpp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,34 @@ HRESULT ClrDataAccess::EnumMemCLRStatic(IN CLRDataEnumMemoryFlags flags)
224224

225225
ReportMem(g_gcDacGlobals.GetAddr(), sizeof(GcDacVars));
226226

227+
PTR_WSTR entryAssemblyPath = (PTR_WSTR)g_EntryAssemblyPath;
228+
entryAssemblyPath.EnumMem();
229+
230+
// Triage dumps must not include full paths (PII data). Replace entry assembly path with file name only.
231+
if (flags == CLRDATA_ENUM_MEM_TRIAGE)
232+
{
233+
WCHAR* path = entryAssemblyPath;
234+
if (path != NULL)
235+
{
236+
size_t pathLen = u16_strlen(path) + 1;
237+
238+
// Get the file name based on the last directory separator
239+
const WCHAR* name = u16_strrchr(path, DIRECTORY_SEPARATOR_CHAR_W);
240+
if (name != NULL)
241+
{
242+
name += 1;
243+
size_t len = u16_strlen(name) + 1;
244+
wcscpy_s(path, len, name);
245+
246+
// Null out the rest of the buffer
247+
for (size_t i = len; i < pathLen; ++i)
248+
path[i] = W('\0');
249+
250+
DacUpdateMemoryRegion(entryAssemblyPath.GetAddr(), pathLen, (BYTE*)path);
251+
}
252+
}
253+
}
254+
227255
// We need all of the dac variables referenced by the GC DAC global struct.
228256
// This struct contains pointers to pointers, so we first dereference the pointers
229257
// to obtain the location of the variable that's reported.

src/coreclr/inc/daccess.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,8 @@
574574
#include "crosscomp.h"
575575
#endif
576576

577+
#include <dn-u16.h>
578+
577579
// Information stored in the DAC table of interest to the DAC implementation
578580
// Note that this information is shared between all instantiations of ClrDataAccess, so initialize
579581
// it just once in code:ClrDataAccess.GetDacGlobals (rather than use fields in ClrDataAccess);
@@ -1493,10 +1495,10 @@ class __Str16Ptr : public __DPtr<WCHAR>
14931495
}
14941496
void EnumMem(void) const
14951497
{
1496-
char* str = DacInstantiateStringW(m_addr, maxChars, false);
1498+
WCHAR* str = DacInstantiateStringW(m_addr, maxChars, false);
14971499
if (str)
14981500
{
1499-
DacEnumMemoryRegion(m_addr, strlen(str) + 1);
1501+
DacEnumMemoryRegion(m_addr, u16_strlen(str) + 1);
15001502
}
15011503
}
15021504
};

src/coreclr/inc/dacvars.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,5 +231,7 @@ DEFINE_DACVAR(SIZE_T, dac__g_clrNotificationArguments, ::g_clrNotificationArgume
231231
DEFINE_DACVAR(bool, dac__g_metadataUpdatesApplied, ::g_metadataUpdatesApplied)
232232
#endif
233233

234+
DEFINE_DACVAR(PTR_WSTR, dac__g_EntryAssemblyPath, ::g_EntryAssemblyPath)
235+
234236
#undef DEFINE_DACVAR
235237
#undef DEFINE_DACVAR_NO_DUMP

src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ObjectWriter.cs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -439,15 +439,11 @@ public void EmitDebugEHClauseInfo(ObjectNode node)
439439
private static extern void EmitDebugFunctionInfo(IntPtr objWriter, byte[] methodName, int methodSize, uint methodTypeIndex);
440440
public void EmitDebugFunctionInfo(ObjectNode node, int methodSize)
441441
{
442-
uint methodTypeIndex = 0;
443-
444-
var methodNode = node as IMethodNode;
445-
if (methodNode != null)
442+
if (node is IMethodNode methodNode)
446443
{
447-
methodTypeIndex = _userDefinedTypeDescriptor.GetMethodFunctionIdTypeIndex(methodNode.Method);
444+
uint methodTypeIndex = _userDefinedTypeDescriptor.GetMethodFunctionIdTypeIndex(methodNode.Method);
445+
EmitDebugFunctionInfo(_nativeObjectWriter, _currentNodeZeroTerminatedName.UnderlyingArray, methodSize, methodTypeIndex);
448446
}
449-
450-
EmitDebugFunctionInfo(_nativeObjectWriter, _currentNodeZeroTerminatedName.UnderlyingArray, methodSize, methodTypeIndex);
451447
}
452448

453449
[DllImport(NativeObjectWriterFileName)]

src/coreclr/vm/corhost.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,15 @@ HRESULT CorHost2::ExecuteAssembly(DWORD dwAppDomainId,
310310

311311
_ASSERTE (!pThread->PreemptiveGCDisabled());
312312

313+
if (g_EntryAssemblyPath == NULL)
314+
{
315+
// Store the entry assembly path for diagnostic purposes (for example, dumps)
316+
size_t len = u16_strlen(pwzAssemblyPath) + 1;
317+
NewArrayHolder<WCHAR> path { new WCHAR[len] };
318+
wcscpy_s(path, len, pwzAssemblyPath);
319+
g_EntryAssemblyPath = path.Extract();
320+
}
321+
313322
Assembly *pAssembly = AssemblySpec::LoadAssembly(pwzAssemblyPath);
314323

315324
#if defined(FEATURE_MULTICOREJIT)

src/coreclr/vm/vars.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ GVAL_IMPL_INIT(DWORD, g_debuggerWordTLSIndex, TLS_OUT_OF_INDEXES);
106106
#endif
107107
GVAL_IMPL_INIT(DWORD, g_TlsIndex, TLS_OUT_OF_INDEXES);
108108

109+
GVAL_IMPL_INIT(PTR_WSTR, g_EntryAssemblyPath, NULL);
110+
109111
#ifndef DACCESS_COMPILE
110112

111113
// <TODO> @TODO - PROMOTE. </TODO>

src/coreclr/vm/vars.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,9 @@ GVAL_DECL(DWORD, g_debuggerWordTLSIndex);
389389
#endif
390390
GVAL_DECL(DWORD, g_TlsIndex);
391391

392+
// Full path to the managed entry assembly - stored for ease of identifying the entry asssembly for diagnostics
393+
GVAL_DECL(PTR_WSTR, g_EntryAssemblyPath);
394+
392395
// Global System Information
393396
extern SYSTEM_INFO g_SystemInfo;
394397

src/coreclr/vm/weakreferencenative.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,7 @@ FCIMPL1(FC_BOOL_RET, ComAwareWeakReferenceNative::HasInteropInfo, Object* pObjec
172172
_ASSERTE(pObject != nullptr);
173173

174174
SyncBlock* pSyncBlock = pObject->PassiveGetSyncBlock();
175-
_ASSERTE(pSyncBlock != nullptr);
176-
return pSyncBlock->GetInteropInfoNoCreate() != nullptr;
175+
return pSyncBlock != nullptr && pSyncBlock->GetInteropInfoNoCreate() != nullptr;
177176
}
178177
FCIMPLEND
179178

src/libraries/Microsoft.Bcl.TimeProvider/ref/Microsoft.Bcl.TimeProvider.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@
1313
<Compile Include="Microsoft.Bcl.TimeProvider.Common.cs" />
1414
</ItemGroup>
1515
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' != '.NETCoreApp'">
16-
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="$(MicrosoftBclAsyncInterfacesVersion)" />
16+
<ProjectReference Include="$(LibrariesProjectRoot)Microsoft.Bcl.AsyncInterfaces\ref\Microsoft.Bcl.AsyncInterfaces.csproj" />
1717
</ItemGroup>
1818
</Project>

src/libraries/Microsoft.Bcl.TimeProvider/src/Microsoft.Bcl.TimeProvider.csproj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ System.TimeProvider
1414
System.ITimer</PackageDescription>
1515
<!-- This library uses IsPartialFacadeAssembly for which the compiler doesn't produce any XML documentation. -->
1616
<UseCompilerGeneratedDocXmlFile>false</UseCompilerGeneratedDocXmlFile>
17+
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
18+
<ServicingVersion>1</ServicingVersion>
1719
</PropertyGroup>
1820

1921
<PropertyGroup>
@@ -31,7 +33,7 @@ System.ITimer</PackageDescription>
3133
</ItemGroup>
3234

3335
<ItemGroup Condition="'$(IsPartialFacadeAssembly)' != 'true'">
34-
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="$(MicrosoftBclAsyncInterfacesVersion)" />
36+
<ProjectReference Include="$(LibrariesProjectRoot)Microsoft.Bcl.AsyncInterfaces\src\Microsoft.Bcl.AsyncInterfaces.csproj" />
3537
</ItemGroup>
3638

3739
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">

src/libraries/Microsoft.Extensions.Options/gen/Emitter.cs

Lines changed: 78 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -374,12 +374,83 @@ public void EmitCompareAttribute(string modifier, string prefix, string classNam
374374
""");
375375
}
376376

377-
public void EmitRangeAttribute(string modifier, string prefix, string className, string suffix)
377+
public void EmitRangeAttribute(string modifier, string prefix, string className, string suffix, bool emitTimeSpanSupport)
378378
{
379379
OutGeneratedCodeAttribute();
380380

381381
string qualifiedClassName = $"{prefix}{suffix}_{className}";
382382

383+
string initializationString = emitTimeSpanSupport ?
384+
"""
385+
if (OperandType == typeof(global::System.TimeSpan))
386+
{
387+
if (!global::System.TimeSpan.TryParse((string)Minimum, culture, out global::System.TimeSpan timeSpanMinimum) ||
388+
!global::System.TimeSpan.TryParse((string)Maximum, culture, out global::System.TimeSpan timeSpanMaximum))
389+
{
390+
throw new global::System.InvalidOperationException(c_minMaxError);
391+
}
392+
Minimum = timeSpanMinimum;
393+
Maximum = timeSpanMaximum;
394+
}
395+
else
396+
{
397+
Minimum = ConvertValue(Minimum, culture) ?? throw new global::System.InvalidOperationException(c_minMaxError);
398+
Maximum = ConvertValue(Maximum, culture) ?? throw new global::System.InvalidOperationException(c_minMaxError);
399+
}
400+
"""
401+
:
402+
"""
403+
Minimum = ConvertValue(Minimum, culture) ?? throw new global::System.InvalidOperationException(c_minMaxError);
404+
Maximum = ConvertValue(Maximum, culture) ?? throw new global::System.InvalidOperationException(c_minMaxError);
405+
""";
406+
407+
string convertValue = emitTimeSpanSupport ?
408+
"""
409+
if (OperandType == typeof(global::System.TimeSpan))
410+
{
411+
if (value is global::System.TimeSpan)
412+
{
413+
convertedValue = value;
414+
}
415+
else if (value is string)
416+
{
417+
if (!global::System.TimeSpan.TryParse((string)value, formatProvider, out global::System.TimeSpan timeSpanValue))
418+
{
419+
return false;
420+
}
421+
convertedValue = timeSpanValue;
422+
}
423+
else
424+
{
425+
throw new global::System.InvalidOperationException($"A value type {value.GetType()} that is not a TimeSpan or a string has been given. This might indicate a problem with the source generator.");
426+
}
427+
}
428+
else
429+
{
430+
try
431+
{
432+
convertedValue = ConvertValue(value, formatProvider);
433+
}
434+
catch (global::System.Exception e) when (e is global::System.FormatException or global::System.InvalidCastException or global::System.NotSupportedException)
435+
{
436+
return false;
437+
}
438+
}
439+
"""
440+
:
441+
"""
442+
try
443+
{
444+
convertedValue = ConvertValue(value, formatProvider);
445+
}
446+
catch (global::System.Exception e) when (e is global::System.FormatException or global::System.InvalidCastException or global::System.NotSupportedException)
447+
{
448+
return false;
449+
}
450+
""";
451+
452+
453+
383454
OutLn($$"""
384455
[global::System.AttributeUsage(global::System.AttributeTargets.Property | global::System.AttributeTargets.Field | global::System.AttributeTargets.Parameter, AllowMultiple = false)]
385456
{{modifier}} class {{qualifiedClassName}} : {{StaticValidationAttributeType}}
@@ -414,19 +485,20 @@ public override string FormatErrorMessage(string name) =>
414485
string.Format(global::System.Globalization.CultureInfo.CurrentCulture, GetValidationErrorMessage(), name, Minimum, Maximum);
415486
private bool NeedToConvertMinMax { get; }
416487
private bool Initialized { get; set; }
488+
private const string c_minMaxError = "The minimum and maximum values must be set to valid values.";
489+
417490
public override bool IsValid(object? value)
418491
{
419492
if (!Initialized)
420493
{
421494
if (Minimum is null || Maximum is null)
422495
{
423-
throw new global::System.InvalidOperationException("The minimum and maximum values must be set to valid values.");
496+
throw new global::System.InvalidOperationException(c_minMaxError);
424497
}
425498
if (NeedToConvertMinMax)
426499
{
427500
System.Globalization.CultureInfo culture = ParseLimitsInInvariantCulture ? global::System.Globalization.CultureInfo.InvariantCulture : global::System.Globalization.CultureInfo.CurrentCulture;
428-
Minimum = ConvertValue(Minimum, culture) ?? throw new global::System.InvalidOperationException("The minimum and maximum values must be set to valid values.");
429-
Maximum = ConvertValue(Maximum, culture) ?? throw new global::System.InvalidOperationException("The minimum and maximum values must be set to valid values.");
501+
{{initializationString}}
430502
}
431503
int cmp = ((global::System.IComparable)Minimum).CompareTo((global::System.IComparable)Maximum);
432504
if (cmp > 0)
@@ -448,14 +520,7 @@ public override bool IsValid(object? value)
448520
System.Globalization.CultureInfo formatProvider = ConvertValueInInvariantCulture ? global::System.Globalization.CultureInfo.InvariantCulture : global::System.Globalization.CultureInfo.CurrentCulture;
449521
object? convertedValue;
450522
451-
try
452-
{
453-
convertedValue = ConvertValue(value, formatProvider);
454-
}
455-
catch (global::System.Exception e) when (e is global::System.FormatException or global::System.InvalidCastException or global::System.NotSupportedException)
456-
{
457-
return false;
458-
}
523+
{{convertValue}}
459524
460525
var min = (global::System.IComparable)Minimum;
461526
var max = (global::System.IComparable)Maximum;
@@ -574,7 +639,7 @@ private void GenValidationAttributesClasses()
574639
}
575640
else if (attributeData.Key == _symbolHolder.RangeAttributeSymbol.Name)
576641
{
577-
EmitRangeAttribute(_optionsSourceGenContext.ClassModifier, Emitter.StaticAttributeClassNamePrefix, attributeData.Key, _optionsSourceGenContext.Suffix);
642+
EmitRangeAttribute(_optionsSourceGenContext.ClassModifier, Emitter.StaticAttributeClassNamePrefix, attributeData.Key, _optionsSourceGenContext.Suffix, attributeData.Value is not null);
578643
}
579644
}
580645

0 commit comments

Comments
 (0)