Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
128 commits
Select commit Hold shift + click to select a range
85086ea
Update core library to add support for generics <T> (#242)
josesimoes Apr 18, 2025
2bb1d2d
Work CI-CD
josesimoes Apr 21, 2025
f9a9158
Work CI-CD
josesimoes Apr 21, 2025
e37e4b8
Work CI-CD
josesimoes Apr 21, 2025
488ab3b
Merge branch 'main' of https://github.com/nanoframework/CoreLibrary i…
josesimoes Apr 29, 2025
6303710
Work CI-CD
josesimoes Apr 30, 2025
7005c52
Fix and improvements in `String` class (#248)
josesimoes Sep 4, 2025
fa61139
Merge branch 'main' into develop
josesimoes Sep 9, 2025
ed90c8e
Add `Span<T>` and `ReadOnlySpan<T>` (#249)
josesimoes Sep 11, 2025
32a57c5
Add `ByRefLikeGenerics` to runtime features (#250)
josesimoes Sep 18, 2025
ab7909f
Remove exclusion of `DebuggerTypeProxyAttribute` (#251)
josesimoes Sep 18, 2025
e99e3aa
Add `IsReferenceOrContainsReferences` runtime helper (#252)
josesimoes Sep 24, 2025
03e6ddb
Work CD-CI
josesimoes Sep 24, 2025
412684a
Add collection related interfaces and classes (#253)
josesimoes Sep 24, 2025
3cf3175
Add IntelliSense comments to `Nullable` classes (#254)
josesimoes Sep 24, 2025
5d24cd3
Remove test struct with nested field ref
josesimoes Sep 24, 2025
d2b908e
Work CI-CD
josesimoes Sep 25, 2025
668efa7
Bump test framework sub-module @602d512
josesimoes Sep 27, 2025
7c0182d
Merge branch 'main' of https://github.com/nanoframework/CoreLibrary i…
josesimoes Nov 6, 2025
5b23ee9
Add `SZArrayHelper` and `Unsafe.As<T>` (#257)
josesimoes Nov 6, 2025
4738eed
Fixed null references and added == and != overloads in `Guid` (#247)
dcyonce Nov 24, 2025
51be470
Add benchmark tests for ToString
josesimoes Nov 24, 2025
ce5c6d8
Fix `Guid` constructor (#259)
josesimoes Nov 24, 2025
d92a1c1
Update test framework sub-module @9f6e02c
josesimoes Nov 27, 2025
903c2b2
Work CI-CD
josesimoes Nov 27, 2025
b0bf1e3
Work CI-CD
josesimoes Dec 4, 2025
2a79b7a
Work CI-CD
josesimoes Dec 5, 2025
7977eda
Add new constructors to `Span<T>` and `ReadOnlySpan<T>` (#260)
josesimoes Dec 5, 2025
6996df8
Moved `String.Format()` to native (#261)
josesimoes Dec 6, 2025
b3427e4
Improvements in `ReadOnlySpan<T>` and `Span<T>` (#262)
josesimoes Dec 12, 2025
f4163d3
Work CI-CD
josesimoes Jan 6, 2026
0d014fa
Add `MemoryExtensions` class (#263)
josesimoes Jan 6, 2026
ebb5481
Add interfaces for generic collections (#264)
josesimoes Jan 8, 2026
bfcba6a
Update test sub-module @2e5c15c
josesimoes Jan 14, 2026
6c93600
Add implicit operator to `Span<T>` to allow conversion from array (#265)
josesimoes Jan 14, 2026
50352eb
Work CI-CD
josesimoes Jan 14, 2026
7c5e825
Add .github/copilot-instructions.md for Copilot cloud agent onboardin…
Copilot Apr 8, 2026
46cf909
Merge branch 'main' into develop
josesimoes Apr 8, 2026
c326223
Merge branch 'main' of https://github.com/nanoframework/CoreLibrary i…
josesimoes Apr 16, 2026
2aa5d2a
Fix unit test for `String.Format()` (#269)
josesimoes Apr 23, 2026
1474d8c
Improvements in `String` class (#270)
josesimoes Apr 24, 2026
1d0f540
Fix file
josesimoes Apr 27, 2026
779da80
Rewrote `Guid.CompareTo` (#271)
josesimoes Apr 27, 2026
30df403
Fix `ReadOnlySpan<T>` operator == to use identity semantics (#272)
josesimoes Apr 27, 2026
17440c8
Add unit tests group to release notes config
josesimoes Apr 27, 2026
7a33d32
Update test framework sub-module @521b03b
josesimoes May 6, 2026
974d1db
Work CI-CD
josesimoes May 7, 2026
eac1915
Update test framework sub-module @6aa00b2
josesimoes May 7, 2026
9cba9c3
Update test framework sub-module @9d8b809
josesimoes May 7, 2026
6cf6098
Merge branch 'main' of https://github.com/nanoframework/CoreLibrary i…
josesimoes May 8, 2026
3dd272a
Merge branch 'main' of https://github.com/nanoframework/CoreLibrary i…
josesimoes May 11, 2026
9049bf0
Bump native assembly version to 100.22.0.5
nfbot May 25, 2026
2b76a68
Update test framework sub-module @ba8142e
josesimoes Jun 23, 2026
3f2f5c7
Update copilot instructions
josesimoes Jun 23, 2026
90505da
Update 4 NuGet dependencies (#274)
josesimoes Jun 23, 2026
96f7257
Add CLAUDE file
josesimoes Jul 23, 2026
d3a67ff
Add unit tests covering generic types (#275)
josesimoes Jul 24, 2026
94d6d54
Merge branch 'main' of https://github.com/nanoframework/CoreLibrary i…
josesimoes Sep 1, 2026
8ed283b
Improve unit tests for lock and Monitor (#277)
josesimoes Sep 2, 2026
6822b30
Add unit test for GC with static fields (#278)
josesimoes Sep 3, 2026
ed91c4f
Add `CompilerGenerated` attribute (#279)
josesimoes Oct 8, 2026
152f9d3
Add InlineArray attribute (#280)
josesimoes Oct 8, 2026
1c38b18
Move to new assembly format (#281)
josesimoes Oct 12, 2026
a694793
Fix configurations to build healthy nupkg
josesimoes Oct 13, 2026
8f3fc72
Add conditional fallback `.props` imports to allow updates to SourceLink
josesimoes Oct 26, 2026
711a8be
Add static init tests (#282)
josesimoes Nov 2, 2026
1763bd1
Split NFUnitTestSystemLib into smaller test projects (#284)
josesimoes Nov 5, 2026
91d4fbe
Add unit tests for reflection type validation (#285)
josesimoes Nov 5, 2026
db2a460
Add more generic type tests (#286)
josesimoes Nov 5, 2026
40e7894
Add tests for generic instantiation binding (#287)
josesimoes Nov 6, 2026
74decaf
Add tests for generic type identity (#288)
josesimoes Nov 9, 2026
d4870b1
Add tests for static T on open generic owners and bare T fields (#289)
josesimoes Nov 9, 2026
2e44e93
Add tests for runtime-closed generic instantiations (#290)
josesimoes Nov 10, 2026
81f7365
More tests for runtime-closed generic instantiations
josesimoes Nov 10, 2026
ebe4ce3
Add tests for castclass, Invoke and SetValue on mismatched generic ar…
josesimoes Nov 10, 2026
32ff95a
More tests on mismatched generic arguments
josesimoes Nov 10, 2026
f9a6ba8
Add tests for isinst on generic types and arrays (#292)
josesimoes Nov 10, 2026
702e92a
Add generic reflection tests (#293)
josesimoes Nov 10, 2026
4abad5d
Change AZDO VM to VS2006
josesimoes Nov 11, 2026
b97dfb3
Update NuGets (#295)
josesimoes Nov 11, 2026
e23e84a
Add generic invoke tests (#294)
josesimoes Nov 11, 2026
06f92fc
Adding more reflection tests
josesimoes Nov 11, 2026
9413ef3
Add array element tests (#296)
josesimoes Nov 12, 2026
c815854
Update test framework @d7047c1
josesimoes Nov 12, 2026
efd0148
Add generic cast binding tests (#297)
josesimoes Nov 12, 2026
9d4ce79
Add generic array tests (#298)
josesimoes Nov 12, 2026
1f5a0f3
Add more tests to erased array
josesimoes Nov 12, 2026
7d5146a
Add generic call context tests (#299)
josesimoes Nov 12, 2026
ecc1e38
Add generic method parameter tests (#300)
josesimoes Nov 13, 2026
a2e89f5
Fix GH release title
josesimoes Nov 13, 2026
749b914
Revert AZDO VM to windows-latest
josesimoes Nov 13, 2026
6a9b46d
Merge remote-tracking branch 'upstream/main' into develop
josesimoes Nov 13, 2026
08fc91d
Revert "Revert AZDO VM to windows-latest"
josesimoes Nov 13, 2026
7ab9957
Add unit tests with EH regressions (#301)
josesimoes Nov 13, 2026
ee9fc45
AZDO VM back to windows latest
josesimoes Nov 16, 2026
b6a809a
Update NuGets
josesimoes Nov 16, 2026
31f8d58
Add tests for arrays as generic collections (#302)
josesimoes Nov 16, 2026
0dba2ed
Add tests for closed generic base in reflection (#303)
josesimoes Nov 17, 2026
0394120
[Work CI-CD] Adjust runsettings to improve testing
josesimoes Nov 18, 2026
57f5589
Add `Type.IsAssignableFrom` and tests for generic Type identity (#304)
josesimoes Nov 18, 2026
3afdfaa
Add generic parameter Types to Type (#305)
josesimoes Nov 18, 2026
08a55a5
Fix for reflection unit test
josesimoes Nov 18, 2026
43d14c2
Add generic parameter constraints to Type (#306)
josesimoes Nov 18, 2026
d3b3131
Add generic variance and array assignability tests (#307)
josesimoes Nov 19, 2026
e13f8e6
Add reflection exceptions and dispatch and mismatch tests (#308)
josesimoes Nov 23, 2026
63e8cfd
Adding more generics dispatch tests
josesimoes Nov 23, 2026
d248439
Adding more generics dispatch tests
josesimoes Nov 23, 2026
770b738
Add MakeGenericType and generic method reflection (#309)
josesimoes Nov 23, 2026
be7531e
[CI-CD] Add new parameter for preview nanoclr CLI
josesimoes Nov 23, 2026
dee1aea
Update test framework @4c8784148
josesimoes Nov 23, 2026
5ff934a
Add Activator.CreateInstance and array type members (#310)
josesimoes Nov 24, 2026
6473369
Update test framework @27b4bca31
josesimoes Nov 24, 2026
ff0f3b5
Add tests for casts to arrays of generic instances (#311)
josesimoes Nov 24, 2026
9785212
Support structs with a parameterless constructor in Activator.CreateI…
josesimoes Nov 24, 2026
b69a712
Add tests for two instantiations of one generic interface (#313)
josesimoes Nov 25, 2026
531d934
Update test sub-module @00ce3fdde
josesimoes Nov 25, 2026
71a7ccb
Add tests for MethodBase.Invoke with a null or wrong target (#314)
josesimoes Nov 25, 2026
2410f3e
Remove non-public constructor checks from reflection test (#315)
josesimoes Nov 25, 2026
a6f9180
[CI-CD] Improve templates for integrated tests prompts
josesimoes Nov 25, 2026
9272ffa
[CI-CD] Adjust test run parameters
josesimoes Nov 25, 2026
b60fe62
Update test sub-module @0d25e8726
josesimoes Nov 25, 2026
f140f8d
[CI-CD] Fix condition of matching test PRs
josesimoes Nov 25, 2026
48aa6c0
[CI-CD] Fix nanoCLR DLL path for test runner
josesimoes Nov 25, 2026
e7e2c5b
[CI-CD] MOre fixes to the test run to use nanCLR DLL artifact
josesimoes Nov 25, 2026
c676bc9
Add MemberAccessException and MissingMethodException (#316)
josesimoes Nov 25, 2026
c768531
[CI-CD] Task now targets artifact to for test
josesimoes Nov 25, 2026
e4f2fff
Add tests for interface calls into inherited generic methods (#317)
josesimoes Nov 25, 2026
1e1c0d3
Add tests for calls over a generic base nested too deep (#318)
josesimoes Nov 26, 2026
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
7 changes: 7 additions & 0 deletions .github/.changelog-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@
],
"exhaustive": true
},
{
"title": "## Unit Tests",
"labels": [
"Type: Unit Tests"
],
"exhaustive": true
},
{
"title": "## ⚠️ Breaking Changes",
"labels": [
Expand Down
271 changes: 142 additions & 129 deletions .github/copilot-instructions.md

Large diffs are not rendered by default.

15 changes: 6 additions & 9 deletions .runsettings
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<RunSettings>
<!-- Configurations that affect the Test Framework -->
<RunConfiguration>
<MaxCpuCount>1</MaxCpuCount>
<MaxCpuCount>10</MaxCpuCount>
<ResultsDirectory>.\TestResults</ResultsDirectory><!-- Path relative to solution directory -->
<TestSessionTimeout>1200000</TestSessionTimeout><!-- Milliseconds -->
<TargetFrameworkVersion>net48</TargetFrameworkVersion>
<TargetPlatform>x64</TargetPlatform>
</RunConfiguration>
<nanoFrameworkAdapter>
<Logging>Verbose</Logging>
<Logging>Detailed</Logging>
<IsRealHardware>False</IsRealHardware>
<!-- The forcegc argument makes the EE collect on every context switch, which decouples GC
activity from heap pressure. The virtual device has plenty of the latter (its heap is
compiled in at 10 MB), so this is what gives the GC-sensitive tests a chance to fail.
See Tests/NFUnitTestAttributes/GetCustomAttributesGCTests.cs -->
<RunnerExtraArguments> --forcegc </RunnerExtraArguments>
<UsePreviewClr>True</UsePreviewClr>
<UsePreviewNanoClr>True</UsePreviewNanoClr>
</nanoFrameworkAdapter>
</RunSettings>
</RunSettings>
69 changes: 69 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

`.github/copilot-instructions.md` is the authoritative rulebook for this repo (build details, coding conventions, contribution rules). Read it whenever you need more than the summary below.

## What this repo is

The Base Class Library (BCL) for **.NET nanoFramework** — the `mscorlib` equivalent for embedded/MCU targets. This is **not** standard .NET: it targets `TargetFrameworkVersion v1.0` (the nanoFramework target), builds `.nfproj` projects, and pairs with a native C++ runtime.

Two output NuGet packages, both producing an assembly named `mscorlib`:
- `nanoFramework.CoreLibrary/` — full BCL including `System.Reflection`
- `nanoFramework.CoreLibrary.NoReflection/` — reflection excluded for smaller flash footprint (same sources, minus `System/Reflection/`)

When adding or removing files, decide whether the change also applies to the NoReflection variant and update its `.nfproj` accordingly. Reflection-only sources stay in the full project.

## Native-interop constraints (read before editing methods)

- Methods marked `[MethodImpl(MethodImplOptions.InternalCall)]` are **native stubs** — the implementation lives in the nanoFramework C++ interpreter. Never add a body. Changing signatures requires a coordinated change to the native runtime.
- Some methods intentionally `throw new NotSupportedException();` (usually no message) to satisfy an interface contract while omitting the feature to save flash. This is by design — do not "fix" them.
- Assembly size is a first-class concern. Avoid adding features that noticeably grow the binary; comment the rationale when omitting functionality.

## Build & test

Windows only. Requires Visual Studio 2022 with the nanoFramework VS extension (or MSBuild 17+ with `NFProjectSystem.CSharp.targets`). Linux CI cannot build this repo. CI is Azure Pipelines (`azure-pipelines.yml`), not GitHub Actions.

```powershell
nuget restore nanoFramework.CoreLibrary.sln
msbuild nanoFramework.CoreLibrary.sln /p:Configuration=Release /p:Platform="Any CPU"
```

Tests run on the **nanoCLR Win32 emulator** via `vstest.console.exe` — `dotnet test` will not work. Run a single suite from a Developer Command Prompt:

```powershell
vstest.console.exe .\Tests\NFUnitTestBitConverter\bin\Release\NFUnitTest.dll /Settings:.\.runsettings /TestAdapterPath:.\nanoFramework.TestFramework\source\TestAdapter\bin\Debug\net4.8
```

Runsettings:
- `.runsettings` — preview nanoCLR downloaded from NuGet (default)
- `local_clr.runsettings` — locally-built nanoCLR

Every test suite is its own `.nfproj` under `Tests/`. Tests reference `mscorlib`, `nanoFramework.TestFramework`, and `nanoFramework.UnitTestLauncher` **as project references** (via the `nanoFramework.TestFramework/` submodule), not as NuGet packages — this is mandatory because the CoreLibrary itself replaces `mscorlib`.

New API surface requires test coverage for methods, properties, events, and thrown exceptions.

## Repo layout landmarks

- `nanoFramework.CoreLibrary/System/` — all `System.*` sources, subfoldered by sub-namespace (`Collections/`, `Diagnostics/`, `Globalization/`, `IO/`, `Reflection/`, `Runtime/`, `Threading/`, …)
- `nanoFramework.CoreLibrary/Friends.cs` — `InternalsVisibleTo` declarations for test projects; add new ones here when they need access to internals
- `nanoFramework.CoreLibrary/key.snk` — strong-name key; do not replace or remove
- `nanoFramework.TestFramework/` — git submodule; test framework sources referenced by every test project
- `version.json` — Nerdbank.GitVersioning; do not hand-edit version numbers
- `.runsettings`, `local_clr.runsettings` — test runner configs (emulator, sequential execution, 20 min timeout)

## Coding conventions (highlights)

- File header on every `.cs`:
```csharp
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
```
- 4-space C# indent, CRLF, UTF-8 BOM, `using` outside namespace, System usings first, always braces.
- Private/internal fields `_camelCase`; private/internal statics `s_camelCase`; constants and public members PascalCase.
- Avoid `var` — use explicit types.
- C# language version: 13.0 for the main project; `default` for the NoReflection variant.

## Pipeline note

`RestoreLockedMode` is on in CI. If a package version genuinely needs to change, regenerate and commit the corresponding `packages.lock.json`; do not bypass the lock.
9 changes: 8 additions & 1 deletion Tests/NFUnitTestArithmetic/UnitTestFormat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,14 @@ public void StringFormat_01()
{
// catch an exception if the format string is null
string nullFormat = null;
Assert.ThrowsException(typeof(NullReferenceException), () => { string.Format(nullFormat, 12345.67); });
Assert.ThrowsException(typeof(ArgumentNullException), () => { string.Format(nullFormat, 12345.67); });
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
}

[TestMethod]
public void StringFormat_NullArgs()
{
// passing a null params array should throw ArgumentNullException
Assert.ThrowsException(typeof(ArgumentNullException), () => { string.Format("{0}", (object[])null); });
}

[TestMethod]
Expand Down
3 changes: 3 additions & 0 deletions Tests/NFUnitTestClasses/NFUnitTestClasses.nfproj
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
<Compile Include="UnitTestPropertiesTests.cs" />
<Compile Include="UnitTestHashCodeTests.cs" />
<Compile Include="UnitTestStaticTests.cs" />
<Compile Include="UnitTestGenericStaticTests.cs" />
<Compile Include="UnitTestGenericInstantiationTests.cs" />
<Compile Include="UnitTestGenericIdentityTests.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\nanoFramework.CoreLibrary\CoreLibrary.nfproj" />
Expand Down
Loading
Loading