<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/techniques-and-tools-to-update-your-c-project---migrating-to-nullable-reference-types---part-4-qatyfmhvw" -->

---
title: Techniques and tools to update your C# project -...
description: A fourth and final post in a series on migrating existing C# codebases to nullable reference types covers practical techniques: starting migration at DTO/POCO...
canonical: https://daily.dev/posts/techniques-and-tools-to-update-your-c-project---migrating-to-nullable-reference-types---part-4-qatyfmhvw
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Techniques and tools to update your C# project - Migrating to nullable reference types - Part 4 | daily.dev
og:description: A fourth and final post in a series on migrating existing C# codebases to nullable reference types covers practical techniques: starting migration at DTO/POCO...
og:url: https://daily.dev/posts/techniques-and-tools-to-update-your-c-project---migrating-to-nullable-reference-types---part-4-qatyfmhvw
og:image: https://api.daily.dev/og/posts/QAtYFmHVw.png
og:image:alt: Techniques and tools to update your C# project - Migrating to nullable reference types - Part 4
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Techniques and tools to update your C# project - Migrating to nullable reference types - Part 4

**[Maarten Balliauw](https://daily.dev/sources/maartenballiauw)** · 17 min read · 0 upvotes · 0 comments

## Summary

A fourth and final post in a series on migrating existing C# codebases to nullable reference types covers practical techniques: starting migration at DTO/POCO classes with few dependencies, deciding between annotating properties versus redesigning APIs, treating null-forgiving operator (!) suppressions as temporary code smells, and using ReSharper/JetBrains Rider features like value tracking, call tracking, and automated migration quick fixes. It also addresses handling third-party libraries with varying annotation support, pessimistic vs optimistic analysis modes, best and worst practices for JSON deserialization with nullable properties, and a warning that enabling nullable annotations on Entity Framework entities can trigger database schema migrations.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://blog.maartenballiauw.be/posts/2022-05-03-techniques-and-tools-to-update-your-csharp-project-migrating-to-nullable-reference-types-part-4>

## Questions this post answers

### How do I avoid nullability warnings when deserializing JSON into a C# class with Newtonsoft.Json?

Add a primary constructor that covers all properties so the JSON deserializer calls it instead of setting properties directly, letting you assign a default value or throw an exception for missing data (for example, defaulting name to "Unknown" when null). This avoids both making the property nullable, which forces null checks everywhere it's used, and suppressing warnings with default!, which lies to the compiler about possible null values.

_daily.dev surfaces practical patterns like this for developers hardening C# models against null reference bugs._

### Why does enabling nullable reference types on an Entity Framework entity sometimes trigger a database migration?

Entity Framework treats the nullable annotation (?) on a property as part of its data model, not just a compiler hint: a property is mapped to a nullable database column if null is a valid value, and to a non-nullable column otherwise. Adding or removing the ? annotation, or even just enabling #nullable enable project-wide, changes that mapping and causes EF to generate a schema migration.

_developers rolling out nullable reference types across EF-backed projects can track gotchas like this on daily.dev._

### Should I use the null-forgiving operator (!) when migrating C# code to nullable reference types?

Only temporarily and with care. The ! operator disables flow analysis for that code path, which can hide the exact nullability issues you're trying to surface, so while it's sometimes genuinely needed, treat recurring suppressions as a code smell to revisit rather than a permanent fix. ReSharper and JetBrains Rider can list all suppressions in a file, project, or solution to help track them down.

_daily.dev helps developers weighing null-safety trade-offs keep up with C# tooling and migration practices._

## Similar posts on daily.dev

- [Taming the Billion Dollar Mistake: Maarten Balliauw's Guide to C\# Nullable Reference Types](https://daily.dev/posts/taming-the-billion-dollar-mistake-maarten-balliauw-s-guide-to-c-nullable-reference-types-dhuc5b5o7) · JetBrains · 5 upvotes · 0 comments

---

Tags: [#devtools](https://daily.dev/tags/devtools), [#.net](https://daily.dev/tags/.net), [#c#](https://daily.dev/tags/c#)

[View this post on daily.dev](https://daily.dev/posts/techniques-and-tools-to-update-your-c-project---migrating-to-nullable-reference-types---part-4-qatyfmhvw)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Techniques and tools to update your C# project - Migrating to nullable reference types - Part 4","url":"https://daily.dev/posts/techniques-and-tools-to-update-your-c-project---migrating-to-nullable-reference-types---part-4-qatyfmhvw","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/techniques-and-tools-to-update-your-c-project---migrating-to-nullable-reference-types---part-4-qatyfmhvw"},"datePublished":"2026-10-04T13:04:08.901Z","dateModified":"2026-10-04T13:05:31.646Z","description":"A fourth and final post in a series on migrating existing C# codebases to nullable reference types covers practical techniques: starting migration at DTO/POCO...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/a8096c8d050e2f037c2ee195a9bfc9db?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/a8096c8d050e2f037c2ee195a9bfc9db?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Maarten Balliauw","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Maarten Balliauw","logo":"https://media.daily.dev/image/upload/s--rOTg3VYO--/f_auto,q_auto/v1791119043/logos/maartenballiauw?_a=BAMAMicg0","url":"https://daily.dev/sources/maartenballiauw"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/techniques-and-tools-to-update-your-c-project---migrating-to-nullable-reference-types---part-4-qatyfmhvw","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"devtools,.net,c#","timeRequired":"PT17M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Maarten Balliauw","item":"https://daily.dev/sources/maartenballiauw"},{"@type":"ListItem","position":3,"name":"Techniques and tools to update your C# project - Migrating to nullable reference types - Part 4"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/techniques-and-tools-to-update-your-c-project---migrating-to-nullable-reference-types---part-4-qatyfmhvw#faq","mainEntity":[{"@type":"Question","name":"How do I avoid nullability warnings when deserializing JSON into a C# class with Newtonsoft.Json?","acceptedAnswer":{"@type":"Answer","text":"Add a primary constructor that covers all properties so the JSON deserializer calls it instead of setting properties directly, letting you assign a default value or throw an exception for missing data (for example, defaulting name to \"Unknown\" when null). This avoids both making the property nullable, which forces null checks everywhere it's used, and suppressing warnings with default!, which lies to the compiler about possible null values. daily.dev surfaces practical patterns like this for developers hardening C# models against null reference bugs."}},{"@type":"Question","name":"Why does enabling nullable reference types on an Entity Framework entity sometimes trigger a database migration?","acceptedAnswer":{"@type":"Answer","text":"Entity Framework treats the nullable annotation (?) on a property as part of its data model, not just a compiler hint: a property is mapped to a nullable database column if null is a valid value, and to a non-nullable column otherwise. Adding or removing the ? annotation, or even just enabling #nullable enable project-wide, changes that mapping and causes EF to generate a schema migration. developers rolling out nullable reference types across EF-backed projects can track gotchas like this on daily.dev."}},{"@type":"Question","name":"Should I use the null-forgiving operator (!) when migrating C# code to nullable reference types?","acceptedAnswer":{"@type":"Answer","text":"Only temporarily and with care. The ! operator disables flow analysis for that code path, which can hide the exact nullability issues you're trying to surface, so while it's sometimes genuinely needed, treat recurring suppressions as a code smell to revisit rather than a permanent fix. ReSharper and JetBrains Rider can list all suppressions in a file, project, or solution to help track them down. daily.dev helps developers weighing null-safety trade-offs keep up with C# tooling and migration practices."}}]}
```

