.NET MAUI Team Stamps Out Memory Leaks, Tweaks NuGet Packaging

Microsoft's dev team for .NET MAUI is stamping out memory leaks and improving NuGet functionality in .NET 8 Preview 3.

The framework evolves its predecessor, Xamarin.Forms, by adding support to build desktop apps in addition to traditional Xamarin targets iOS and Android.

Released last week, .NET MAUI (.NET Multi-platform App UI) in .NET 8 Preview 3 mostly continues the effort to improve the quality of UI controls, layout and memory management, Microsoft said.

For the latter, senior engineer Jonathan Peppers is credited with hunting and eliminating memory leaks and tracking the team's progress on that front.

"He found that when navigating forward and back repeatedly the memory would grow ~2.45KB each time," Microsoft said in an April 11 announcement. "By implementing a WeakList<T> to keep track of references, he was able to make sure the memory is properly released." Similar memory improvements were enacted across other constructs, including buttons, pages, layouts, windows and more as the team prioritizes the highest-impact issues on the most-used controls. In addition to Layout, those include CollectionView, Shell and drawing: shapes, shadows and clipping.

Another part of the quality push is the ability to layer specific versions of NuGet packages into a project, which Microsoft said is useful for:

  • reviewing a pull request
  • previewing unreleased or experimental builds
  • pinning a project to specific version
[Click on image for larger view.] Navigate to Azure Build Pipeline (source: Microsoft).

As shown in the graphic above, developers can go to any pull request or branch at the GitHub dotnet/maui repo and navigate to the associated Azure build pipeline by clicking a green checkmark to locate the build artifacts. They can then be downloaded and extracted to a local directory. After setting a NuGet source path to that same directory -- or using a nuget.config file -- developers can specify the version (for example, 8.0.0-ci.net8.11560) of that build within a project's csproj file. More about that can be found in the Workloads distribution and management is understandable and seamless for developers issue.

Further information can also be found in Preview 3's release notes, which list a whopping 107 bugs fixed so far.

[Click on image for larger view.] Navigate to Azure Build Pipeline (source: Microsoft).

That speaks to the developer engagement on the project, which Microsoft said is one of the most active projects under the direction of the .NET Foundation (see graphic above). "When you combine Android, iOS and .NET MAUI together, it's far and away the most active for issues and pull requests," Microsoft said. "In less than a year .NET MAUI usage has grown 450 percent. Our goal in .NET 8 is to make you even more successful using .NET to build apps for Android, iOS, macOS, and Windows with .NET MAUI."

Many of the fixes in .NET MAUI previews for .NET 8 have also been introduced into a .NET 7 service release.

.NET 8 will ship in November.

About the Author

David Ramel is an editor and writer for Converge360.

comments powered by Disqus


Subscribe on YouTube