Skip to content

Give the .NET example the _51DEGREES_ variable names alongside the old ones - #25

Merged
jwrosewell merged 2 commits into
rcfrom
fix/dotnet-example-underscore-names
Nov 11, 2026
Merged

jwrosewell merged 2 commits into
rcfrom
fix/dotnet-example-underscore-names

Conversation

@jwrosewell

@jwrosewell jwrosewell commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

The problem

51degrees-dotnet#131 gives every 51Degrees environment variable in .NET one _51DEGREES_ name, with nothing read in its place. Once it merges, the .NET cloud web example (examples/device-detection/Cloud/GettingStarted-Web) reads its resource key only from _51DEGREES_RESOURCE_KEY and its cloud endpoint only from _51DEGREES_CLOUD_ENDPOINT.

This harness starts that example with SUPER_RESOURCE_KEY and FIFTYONE_CLOUD_ENDPOINT (Examples/ExampleApps.cs lines 241 and 243 at 345a4a64), which is how the cloud service's own tests run the .NET example. After 51degrees-dotnet#131 the example would start with no resource key and the public cloud endpoint, so those tests would fail.

No specification page covers these names. They are the agreed 51Degrees environment variable names that every language is moving to, as 51degrees-rust#378 did for Rust.

What changes

  • ExampleApps.cs sets _51DEGREES_RESOURCE_KEY and _51DEGREES_CLOUD_ENDPOINT for the .NET example, with the same values as before.
  • It still sets SUPER_RESOURCE_KEY and FIFTYONE_CLOUD_ENDPOINT too, because the harness also runs released versions of the example, which read only those names. Setting both pairs works with either version.
  • Examples/ExampleAppsTests.cs gains Descriptors_Dotnet_SetsTheUnderscoreNames, which builds the .NET descriptor's environment and checks both new names and their values, the endpoint with its api/v4/ path.

Nothing changes for the other languages' descriptors.

How it was checked

The test commit went first, so this pull request's first build shows it failing.

Run Link Result
Red, the test alone (c3d5d0b) run 43019519307 Descriptors_Dotnet_SetsTheUnderscoreNames fails with "The given key '_51DEGREES_RESOURCE_KEY' was not present in the dictionary." The browser jobs pass
Green, with the change (01126f7) run 43019914202 build-and-test passes, 40 tests with 15 skipped (the tests that need a browser, the cloud or keys, which that job leaves out), and the browser job passes on all three runners

This repository's own build is the full build for it. It has no macOS entries.

What remains

  • The old names come out once every language has released with the _51DEGREES_ names, because until then the harness runs examples that read either set. #26 tracks taking them out.
  • This repository uses two names that start with a digit itself, 51DEGREES_RESOURCE_KEY and 51DEGREES_CLOUD_ENDPOINT, for the 51Did browser demo, in Browser51Did/Harness.cs (lines 60, 84 to 87, 118 to 119, 426 and 574), Browser51Did/Demo.cs (lines 102 to 104), Browser51Did/README.md (lines 81 to 83) and README.md (line 55). A POSIX shell cannot set such a name. It belongs in a separate change, made in step with the language demos that read those names.
  • This draft is into rc, as #23 was. The language repositories' full builds clone the contract tests from main, so the change reaches them once rc merges into main, and it has to reach main before 51degrees-dotnet#131 merges.

Version

No version change.

The .NET cloud web example reads the resource key from
_51DEGREES_RESOURCE_KEY and the cloud endpoint from
_51DEGREES_CLOUD_ENDPOINT, with no other name, once its rename is
released.
The .NET cloud web example now reads the resource key from
_51DEGREES_RESOURCE_KEY and the endpoint from _51DEGREES_CLOUD_ENDPOINT,
with no other name. Released versions of it read SUPER_RESOURCE_KEY and
FIFTYONE_CLOUD_ENDPOINT, so the harness sets both pairs until every
language has released with the new names.
@jwrosewell
jwrosewell marked this pull request as ready for review November 11, 2026 14:44
@jwrosewell
jwrosewell merged commit c7ca30f into rc Nov 11, 2026
5 checks passed
@jwrosewell jwrosewell mentioned this pull request Nov 11, 2026
jwrosewell added a commit that referenced this pull request Nov 11, 2026
* Find the Java example in 51degrees-java (#16)

* Find the dotnet example in 51degrees-dotnet (#17)

device-detection-dotnet-examples has moved into 51degrees-dotnet, under
examples/device-detection. Both dotnet demos, pmp-web and GettingStarted-Web,
are found there as siblings, and the docs name the monorepo.

* Find the Node example in 51degrees-node (#18)

* Find the Node example in 51degrees-node

* Copy the monorepo packages in when installing the Node example

* Check that only rc merges into the default branch (#19)

* Find the Python example in 51degrees-python (#20)

* Find the PHP example in 51degrees-php (#21)

* Java uses the default JSON endpoint and still accepts the old one (#23)

* Let Java use the default JSON endpoint and still accept its old one

* Say once which JSON path each language uses

* Give the .NET example the _51DEGREES_ variable names alongside the old ones (#25)

* Test that the .NET example is given the underscore variable names

The .NET cloud web example reads the resource key from
_51DEGREES_RESOURCE_KEY and the cloud endpoint from
_51DEGREES_CLOUD_ENDPOINT, with no other name, once its rename is
released.

* Give the .NET example the _51DEGREES_ variable names

The .NET cloud web example now reads the resource key from
_51DEGREES_RESOURCE_KEY and the endpoint from _51DEGREES_CLOUD_ENDPOINT,
with no other name. Released versions of it read SUPER_RESOURCE_KEY and
FIFTYONE_CLOUD_ENDPOINT, so the harness sets both pairs until every
language has released with the new names.

---------

Co-authored-by: ben51degrees <ben@51degrees.com>
Co-authored-by: Jamesr51d <122470673+Jamesr51d@users.noreply.github.com>
Co-authored-by: Eugene Dorfman <justadreamer2007@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant