Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,9 @@
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\ApplicationIntent.cs">
<Link>Microsoft\Data\SqlClient\ApplicationIntent.cs</Link>
</Compile>
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\AssemblyCache.netfx.cs">
<Link>Microsoft\Data\SqlClient\AssemblyCache.netfx.cs</Link>
</Compile>
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\AssemblyRef.cs">
<Link>Microsoft\Data\SqlClient\AssemblyRef.cs</Link>
</Compile>
Expand Down Expand Up @@ -862,7 +865,6 @@
<Compile Include="Microsoft\Data\Common\DbConnectionOptions.cs" />
<Compile Include="Microsoft\Data\Common\DbConnectionString.cs" />
<Compile Include="Microsoft\Data\Common\GreenMethods.cs" />
<Compile Include="Microsoft\Data\SqlClient\assemblycache.cs" />
<Compile Include="Microsoft\Data\SqlClient\BufferWriterExtensions.cs" />
<Compile Include="Microsoft\Data\SqlClient\Reliability\SqlConfigurableRetryLogicManager.LoadType.cs" />
<Compile Include="Microsoft\Data\SqlClient\Server\SmiConnection.cs" />
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#if NETFRAMEWORK

using System;
using System.Diagnostics;
using Microsoft.Data.SqlClient.Server;

namespace Microsoft.Data.SqlClient
{
internal static class AssemblyCache
{
internal static int GetLength(object inst)
{
// Caller should have allocated enough, based on MaxByteSize
return SerializationHelperSql9.SizeInBytes(inst);
}

internal static SqlUdtInfo GetInfoFromType(Type t)
{
Debug.Assert(t != null, "Type object cant be NULL");

Copy link

Copilot AI Mar 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider updating the assertion message to include an apostrophe (e.g. "Type object can't be null") for clarity.

Suggested change
Debug.Assert(t != null, "Type object cant be NULL");
Debug.Assert(t != null, "Type object can't be NULL");

Copilot uses AI. Check for mistakes.
Type orig = t;
do
{
SqlUdtInfo attr = SqlUdtInfo.TryGetFromType(t);

if (attr != null)
{
return attr;
}

t = t.BaseType;
}
while (t != null);

throw SQL.UDTInvalidSqlType(orig.AssemblyQualifiedName);
}
}
}

#endif
Loading