Creating a gui snap using .net

Facing issues like :

GDK Backend: wayland (HelloWorldGuiApp:91366): Gtk-WARNING **: 22:44:58.503: cannot open display: :0

when i am trying to build a simple helloworldguiapp whats missing from my snapcraft.yaml file?

name: helloworldguiapp

base: core22

version: ‘1.0’

summary: A simple Hello World GUI app

description: | This is a simple .NET Gtk# Hello World GUI application designed to run in kiosk mode using ubuntu-frame.

grade: stable

confinement: strict

architectures:

  • build-on: amd64
  • build-on: arm64

apps:

helloworldguiapp:

command: HelloWorldGuiApp
daemon: simple
restart-condition: always
plugs:
  - wayland
  - opengl
  - network
  - content[graphics-core22]  # Added the missing graphics-core22 plug
environment:
  WAYLAND_DISPLAY: wayland-0

parts:

helloworldguiapp:

plugin: dotnet
dotnet-build-configuration: Release
dotnet-self-contained-runtime-identifier: linux-x64
source: .
build-packages:
  - dotnet-sdk-8.0
stage-packages:
  - libgtk-3-0
  - libglib2.0-0
  - libwayland-client0

Thaanks in Advance.