Skip to content

Commit

Permalink
CodeFix project: generate comment instead of opening browser; Vsix: A…
Browse files Browse the repository at this point in the history
…uto version number; Update dependencies.
  • Loading branch information
fryderykhuang committed Jan 30, 2024
1 parent e852f3f commit b64fc5d
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 13 deletions.
5 changes: 3 additions & 2 deletions src/NullGC.Abstractions/Linq/LinqFixedRefEnumerable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public LinqFixedRefEnumerable(TEnumerator enumerator)

IEnumerator<T> IEnumerable<T>.GetEnumerator()
{
throw new NotImplementedException();
return _enumerator;
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
Expand All @@ -29,10 +29,11 @@ public TEnumerator GetEnumerator()
// {
// return new EnumerableWrapper<T, TEnumerator>(_enumerator);
// }

public int? Count => _enumerator.Count;

public int? MaxCount => _enumerator.Count;

IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
Expand Down
4 changes: 2 additions & 2 deletions src/NullGC.TestCommons/AllocatorContextInitializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ public static void SetupDefaultUnscopedAllocationContext(out IMemoryAllocationTr
allocTracker = nativeTracker = nt;
}

public static void SetupDefaultUncachedUnscopedAllocationContext(out IMemoryAllocationTrackable allocTracker,
out IMemoryAllocationTrackable nativeTracker)
public static void SetupDefaultUncachedUnscopedAllocationContext(out IMemoryAllocationTrackable? allocTracker,
out IMemoryAllocationTrackable? nativeTracker)
{
var nt = new DefaultAlignedNativeMemoryAllocator();
AllocatorContext.SetAllocatorProvider(nt, (int) AllocatorTypes.Default, false);
Expand Down
4 changes: 2 additions & 2 deletions src/NullGC.TestCommons/AssertEx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ private static Exception Throws(Type exceptionType, Exception? exception)
Guard.IsNotNull(exceptionType);

if (exception == null)
throw new ThrowsException(exceptionType);
throw ThrowsException.ForNoException(exceptionType);

if (exceptionType != exception.GetType())
throw new ThrowsException(exceptionType, exception);
throw ThrowsException.ForIncorrectExceptionType(exceptionType, exception);

return exception;
}
Expand Down
12 changes: 6 additions & 6 deletions src/NullGC.TestCommons/AssertMemoryAllFreedBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ namespace NullGC.TestCommons;
public abstract class AssertMemoryAllFreedBase : TestBase, IDisposable, IClassFixture<DefaultAllocatorContextFixture>
{
private readonly bool _scoped;
private readonly IMemoryAllocationTrackable _memTrackable;
private readonly IMemoryAllocationTrackable _allocTrackable;
private readonly IMemoryAllocationTrackable? _memTrackable;
private readonly IMemoryAllocationTrackable? _allocTrackable;

protected IMemoryAllocationTrackable AllocTracker => _allocTrackable;
protected IMemoryAllocationTrackable? AllocTracker => _allocTrackable;

protected AssertMemoryAllFreedBase(ITestOutputHelper logger, bool scoped, bool uncached = false) : base(logger)
{
Expand All @@ -28,14 +28,14 @@ protected AssertMemoryAllFreedBase(ITestOutputHelper logger, bool scoped, bool u
out _memTrackable);
}

public virtual void Dispose()
public override void Dispose()
{
if (_allocTrackable is IAllocatorCacheable c1) c1.ClearCachedMemory();
if (_allocTrackable is not null)
Assert.True(_allocTrackable.ClientIsAllFreed);
if (_allocTrackable is IAllocatorCacheable c2) c2.ClearCachedMemory();
if (_scoped)
Assert.True(_memTrackable.IsAllFreed);
if (_scoped)
if (_memTrackable is not null) Assert.True(_memTrackable.IsAllFreed);
AllocatorContext.ClearProvidersAndAllocations();
}
}
2 changes: 1 addition & 1 deletion src/NullGC.TestCommons/TestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ protected TestBase(ITestOutputHelper logger)
else throw new InvalidOperationException();
}

public void Dispose()
public virtual void Dispose()
{
if (_logger.TryGetITest(out var test)) _logger.WriteLine($"Finished test '{test.DisplayName}'");
else throw new InvalidOperationException();
Expand Down

0 comments on commit b64fc5d

Please sign in to comment.