This is a follow up release to preview.1. Please be aware that this release includes several breaking changes.
The release 0.6.0 / 0.6.1 were skipped as there were problems with the publishing of the nugets:
- For 0.6.0 the new
GObject-2.0.Integration
package had an empty symbol package which resulted in an upload error. - For 0.6.1 there were nuget packages created for the tutorial projects which were missing nuget informations thus resulting in an upload error.
The partially uploaded packages got unlisted. This is the reason why this release has the version number 0.6.2.
Notworthy
Since 0.6.0-preview.1
- Support for .NET 9.0 added. Support for .NET 6.0 and .NET 7.0 got removed.
- Rework of the
GObject.Object
instantiation process. Those changes remove the reflection code for object instantiation and subclassing. This brings NativeAOT support a lot closer. - Internal: Support individual SafeHandles for classes allowing to report native memory consumption. This improves the garbage collection behavior of the dotnet runtime as classes like
Gdk.Pixbuf
tend to reference large portions of native memory.
0.6.0-preview.1
- Update to GNOME 47 which includes GTK 4.16 and libadwaita 1.6.
- The dummy implementation of
INotifyPropertyChanged
onGObject.Object
was removed. - Propertydefinitions have a new
Notify
/Unnotify
method which simplifies registration for property specific notifications. For details see the FAQ. - The size of the C
long
datatype on windows is now always 32 bit. On unix it corresponds to 64 / 32 bit depending on the system architecture. In earlier releases it was always 64 bit which was only correct for 64 bit unix systems. - The size of C
gsize
is now equivalent tonint
. In earlier releases it was equal tolong
which was wrong on 32 bit based systems. - Fixed implementation of the memory pressure feature of records. In earlier releases memory pressure was only removed if
Dispose
was called. Now memory pressure is released automatically for records. The feature is not yet implemented for classes and will be part the full 0.6.0 release. - First steps to publish the GirCore generator as a
dotnet tool
.
Breaking changes
Changed public APIs
- Obsolete interface
GLib.IHandle
got removed - Obsolete interface
GObject.IObject
got removed GObject.Object
new primary constructor requires aObjectHandle
.protected
constructors usingConstructArgument[]
orIntPtr
got removed.GObject.Object
methodprotected virtual void Initialize()
got removed. To execute instance initialization either use a custom constructor or customObjectHandle
.GdkPixbuf.PixbufLoader.FromBytes
got removed as it was a purely cosmetic helper function which is not available as native code. The following code shows the corresponding code to recreate the original behavior:
using var bytes = Bytes.New(data);
var pixbufLoader = PixbufLoader.New();
pixbufLoader.WriteBytes(bytes);
pixbufLoader.Close();
var pixbuf = pixbufLoader.GetPixbuf() ?? throw new Exception("No pixbuf loaded");
Subclass changes
To implement reflection free instantiation and subclassing the data which the reflection based code retrieved during runtime must be available during compile time to register the class with the GObject typesystem. This is done automatically for all classes which are part of the GirCore nuget packages. If custom classes inherit from some GObject.Object
this code must be written otherwise the new class is not properly registered with the GObject typesystem.
The boiler plate code needed to properly register a class can be completly avoided if the new nuget package GObject-2.0.Integration is used. This package provides a source generator which generates the needed code if the SubclassAttribute
is set on the custom GObject subclass. Please see the following sample and refer to the FAQ:
[Subclass<GObject.Object>]
public partial class Data
{
public string? MyString { get; set; }
public Data(string myString) : this()
{
MyString = myString;
}
}
What's Changed
- Remove INotifyPropertyChanged by @badcel in #1061
- Property: Add Notify / Unnotify methods by @badcel in #1062
- Improve long handling for structs by @badcel in #1065
- Remove duplicate semicolon in return statements by @adamreeve in #1068
- Map "gssize" to native integers by @badcel in #1069
- Improve long handling 2 by @badcel in #1067
- Add nullable annotation to nullable string array parameters in internal methods by @adamreeve in #1079
- Disable rendering code for repositories only required via includes by @adamreeve in #1086
- documenting System.DllNotFoundException troubleshooting by @lamg in #1085
- Improve struct freeing by @badcel in #1072
- Improve logging by @badcel in #1093
- Support loading repositories from files embedded as resources in GirTool by @adamreeve in #1091
- Readme: Update status by @badcel in #1096
- Generator: Support opaque typed records with copy / free annotations by @badcel in #1088
- Support copy annotation typed records by @badcel in #1103
- Add new modifier to class methods that hide base class methods by @adamreeve in #1097
- Add DBus sample to read desktop appearance color scheme by @badcel in #1110
- Foreign typed records: Implement IDisposable by @badcel in #1112
- Foreign typed records: Require to implement a handle release manually by @badcel in #1113
- Opaque typed records: Support adding memory pressure by @badcel in #1114
- ImageSurface: Support memory pressure by @badcel in #1115
- GObject.Type: Mark struct as readonly and make it a record by @badcel in #1117
- Improve alias support by @badcel in #1119
- GObject.Type: Add IsFundamental method by @badcel in #1123
- Differentiate between Long and CLong by @badcel in #1126
- Object: Fix ToggleNotify called after callback is disposed by @badcel in #1128
- Update gir files by @badcel in #1132
- Refactor GdkPixbuf-2.0.Tests by @badcel in #1133
- Update macos runner to version 14 by @badcel in #1134
- Initial hello world tutorials by @anthonyirwin82 in #1139
- Box Layout Tutorial by @anthonyirwin82 in #1143
- Move ChooseAsync method to correct class by @badcel in #1150
- Support class based safe handles by @badcel in #1118
- Tutorial: Use project reference instead of package reference by @badcel in #1152
- Class: Add public constructor which support ConstructArguments by @badcel in #1164
- Class: Add primary constructor by @badcel in #1165
- Add GObject-2.0.Integration.csproj by @badcel in #1158
- Update dependencies by @badcel in #1173
- GObject-2.0.Integration: Disable snupk generation by @badcel in #1176
- Do not publish tutorial projects by @badcel in #1179
New Contributors
- @adamreeve made their first contribution in #1068
- @lamg made their first contribution in #1085
- @anthonyirwin82 made their first contribution in #1139
Full Changelog: 0.5.0...0.6.2