idexus/Sharp.UI

Auto-Properties generation problem

Closed this issue · 4 comments

Hi,

i'm desperately trying to use your library, but i can't get it to work.

You can find the repo under

https://github.com/OpenSemi-de/ACDCs

Using Vs 2022 with 0.0.20 beta gives following results:

Severity Code Description Project File Line Suppression State Error CS0246 The type or namespace name 'Action<>' could not be found (are you missing a using directive or an assembly reference?) ACDCs (net7.0-android) C:\Users\lmnt1\Desktop\OSSpice\ACDCs\Sharp.UI.Generator\Sharp.UI.Generator.Generator\ACDCs.Views.Components.Edit.EditContainer.g.cs 26 Active Error CS0738 'EditContainer' does not implement interface member 'IEditContainerProperties.CircuitView'. 'EditContainer.CircuitView' cannot implement 'IEditContainerProperties.CircuitView' because it does not have the matching return type of 'CircuitViewContainer'. ACDCs (net7.0-android), ACDCs (net7.0-windows10.0.19041.0) C:\Users\lmnt1\Desktop\OSSpice\ACDCs\Views\Components\Edit\EditContainer.cs 9 Active Error CS0246 The type or namespace name 'Func<,>' could not be found (are you missing a using directive or an assembly reference?) ACDCs (net7.0-android) C:\Users\lmnt1\Desktop\OSSpice\ACDCs\Sharp.UI.Generator\Sharp.UI.Generator.Generator\ACDCs.Views.Components.Edit.EditContainer.extension.g.cs 25 Active Error CS0246 The type or namespace name 'Func<,>' could not be found (are you missing a using directive or an assembly reference?) ACDCs (net7.0-android) C:\Users\lmnt1\Desktop\OSSpice\ACDCs\Sharp.UI.Generator\Sharp.UI.Generator.Generator\ACDCs.Views.Components.Edit.EditContainer.extension.g.cs 36 Active Error CS0111 Type 'EditContainerGeneratedExtension' already defines a member called 'CircuitView' with the same parameter types ACDCs (net7.0-android) C:\Users\lmnt1\Desktop\OSSpice\ACDCs\Sharp.UI.Generator\Sharp.UI.Generator.Generator\ACDCs.Views.Components.Edit.EditContainer.extension.g.cs 45 Active Error CS0246 The type or namespace name 'Func<,>' could not be found (are you missing a using directive or an assembly reference?) ACDCs (net7.0-android) C:\Users\lmnt1\Desktop\OSSpice\ACDCs\Sharp.UI.Generator\Sharp.UI.Generator.Generator\ACDCs.Views.Components.Edit.EditContainer.extension.g.cs 56 Active Error CS0246 The type or namespace name 'Func<,>' could not be found (are you missing a using directive or an assembly reference?) ACDCs (net7.0-android) C:\Users\lmnt1\Desktop\OSSpice\ACDCs\Sharp.UI.Generator\Sharp.UI.Generator.Generator\ACDCs.Views.Components.Edit.EditContainer.extension.g.cs 68 Active Error CS0246 The type or namespace name 'Action<>' could not be found (are you missing a using directive or an assembly reference?) ACDCs (net7.0-android) C:\Users\lmnt1\Desktop\OSSpice\ACDCs\Sharp.UI.Generator\Sharp.UI.Generator.Generator\ACDCs.Views.Components.Edit.EditContainer.g.cs 21 Active Error CS0246 The type or namespace name 'BindableProperty' could not be found (are you missing a using directive or an assembly reference?) ACDCs (net7.0-android) C:\Users\lmnt1\Desktop\OSSpice\ACDCs\Sharp.UI.Generator\Sharp.UI.Generator.Generator\ACDCs.Views.Components.Edit.EditContainer.g.cs 34 Active Error CS0246 The type or namespace name 'CircuitViewContainer' could not be found (are you missing a using directive or an assembly reference?) ACDCs (net7.0-android) C:\Users\lmnt1\Desktop\OSSpice\ACDCs\Sharp.UI.Generator\Sharp.UI.Generator.Generator\ACDCs.Views.Components.Edit.EditContainer.g.cs 36 Active Error CS0102 The type 'EditContainer' already contains a definition for 'CircuitView' ACDCs (net7.0-android) C:\Users\lmnt1\Desktop\OSSpice\ACDCs\Sharp.UI.Generator\Sharp.UI.Generator.Generator\ACDCs.Views.Components.Edit.EditContainer.g.cs 36 Active

from
`
using ACDCs.Views.Components.CircuitView;
using Microsoft.Maui.Graphics;
using Microsoft.Maui.Layouts;
using Sharp.UI;

namespace ACDCs.Views.Components.Edit;

[SharpObject]
public partial class EditContainer : StackLayout, IEditContainerProperties
{
public EditContainer()
{
AbsoluteLayout.SetLayoutFlags(this, AbsoluteLayoutFlags.None);
AbsoluteLayout.SetLayoutBounds(this, new Rect(0,300,AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize));
_selectAreaButton = new(SelectArea, OnSelectButtonChange);
_rotateButton = new(Rotate, OnSelectButtonChange);
_mirrorButton = new(Mirror, OnSelectButtonChange);
_deleteButton = new(Delete, OnSelectButtonChange);
Add(_selectAreaButton);
Add(_rotateButton);
Add(_mirrorButton);
Add(_deleteButton);
}

private readonly EditButton _selectAreaButton;

private void OnSelectButtonChange(EditButton editButton)
{
    _lastButton?.Deselect();
    _lastButton = editButton;
}

private void SelectArea()
{ }

private void Delete()
{ }

private void Mirror()
{ }

private void Rotate()
{ }

private readonly EditButton _deleteButton;
private readonly EditButton _mirrorButton;
private readonly EditButton _rotateButton;
private EditButton? _lastButton;

}

[BindableProperties]
public interface IEditContainerProperties
{
CircuitViewContainer CircuitView { get; set; }
}
`

Some of the problems seem to be inlink with disabling implicit usings. The generator doesnt put in the usings in the generated files

I found the problem. Not all types used names with namespaces.

I found a workaround to a "bug" by using a globalusings.cs. see repo

Updated to the 0.0.22 and removed global usings. Works fine! Great library, i'll keep you informed. Thanks