Bug 449268 - code importing wizard C#: Windows Forms classes are not imported
Summary: code importing wizard C#: Windows Forms classes are not imported
Status: RESOLVED FIXED
Alias: None
Product: umbrello
Classification: Applications
Component: importer (show other bugs)
Version: 2.32.0 (KDE releases 20.08.0)
Platform: Microsoft Windows Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: Umbrello Development Group
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-01-27 21:50 UTC by Jessica
Modified: 2022-02-19 21:29 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 2.33.80 (KDE releases 22.03.80)
Sentry Crash Report:


Attachments
windows forms class to import (1.22 KB, application/x-zip-compressed)
2022-01-27 21:50 UTC, Jessica
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jessica 2022-01-27 21:50:11 UTC
Created attachment 146001 [details]
windows forms class to import

STEPS TO REPRODUCE
1.  Import the file Form1.cs using the code importing wizard
2. After importing, there are no errors, but the class is not in the treeview. It's not imported at all.

OBSERVED RESULT

It seems windows forms classes are not imported at all. Only C# classes that are not a windows form are imported correctly.

EXPECTED RESULT

Windows Forms classes should be imported too, because they are just like regular classes. 

Variables from inside
SOFTWARE/OS VERSIONS
Windows:  Microsoft Windows [Version 10.0.19044.1466]
KDE Frameworks Version: 4.14.65


ADDITIONAL INFORMATION

I'm using https://download.kde.org/stable/umbrello/latest/win64/umbrello-mingw64-2.32.0-126.1-setup.exe
Comment 1 Oliver Kellogg 2022-02-11 22:38:19 UTC
Git commit e9fbd978a03453669735bcc2c008afef14f553a8 by Oliver Kellogg.
Committed on 11/02/2022 at 22:38.
Pushed by okellogg into branch 'master'.

First stab at "code importing wizard C#: Windows Forms classes are not imported"

umbrello/codeimport/csharp/csharpimport.cpp
- Simplify function isClassModifier.
- In function isCommonModifier,
  - simplify such that each keyword is looked at only once;
  - add missing modifiers "readonly", "volatile", "virtual", "override",
   "unsafe", "extern", "partial", "async".

This is just enough to get the classes imported but there remain plenty
of details to straighten out.

M  +30   -45   umbrello/codeimport/csharp/csharpimport.cpp

https://invent.kde.org/sdk/umbrello/commit/e9fbd978a03453669735bcc2c008afef14f553a8
Comment 2 Oliver Kellogg 2022-02-12 13:44:42 UTC
Git commit 47e8a38a28f02bbafd437fb4038e055249d4441b by Oliver Kellogg.
Committed on 12/02/2022 at 13:44.
Pushed by okellogg into branch 'master'.

Finalize "C#: Windows Forms classes are not imported" and fix "C# importer doesn't support properties"

umbrello/codeimport/csharp/csharpimport.{h,cpp}
- Reimplement function preprocess(QString&); from NativeImportBase,
  currently only to discard preprocessor lines.
  Reason: If we don't do this then preprocessor lines are forwarded to
  the m_source token stream which creates problems on parsing.

umbrello/codeimport/csharp/csharpimport.cpp
- Cosmetic change in function joinTypename: Use lookAhead() in place of
  m_source[m_srcIndex + 1].
- In function resolveClass first call
    findObject(className, currentScope())
  and if this returns non null then return the found object.
- In function parseStmt :
  - Before testing isTypeDeclaration(keyword), while
    isClassModifier(keyword) returns true assign advance() to keyword.
  - Simplify if-statement testing isTypeDeclaration(keyword), use
    `keyword' in place of nextKeyword.
  - Remove handling of keyword "#", this is obsoleted by reimplementing
    preprocess(QString&).
  - Before expecting `keyword' to be a type name advance over possible
    modifiers using isCommonModifier(keyword).
  - In handling of nextToken "(", do not try resolving the return type
    if it is "void". In this case set typeName empty to avoid creation
    of a bogus type for "void".
  - Before handling a data member declaration add handling of nextToken
    "{" (property).
Related: bug 375223
FIXED-IN:2.33.80 (KDE releases 22.03.80)

M  +72   -44   umbrello/codeimport/csharp/csharpimport.cpp
M  +4    -2    umbrello/codeimport/csharp/csharpimport.h

https://invent.kde.org/sdk/umbrello/commit/47e8a38a28f02bbafd437fb4038e055249d4441b
Comment 3 Oliver Kellogg 2022-02-19 21:29:11 UTC
Git commit 02d0a994cad70411ef0e000a2424289fa635f043 by Oliver Kellogg.
Committed on 19/02/2022 at 16:51.
Pushed by okellogg into branch 'master'.

umbrello/codeimport/csharp/csharpimport.{h,cpp} followup to commit 47e8a38:

- Reimplement function fillSource from CsValaImportBase in order to map
  .NET type aliases to their native C# counterparts.

M  +37   -0    umbrello/codeimport/csharp/csharpimport.cpp
M  +1    -1    umbrello/codeimport/csharp/csharpimport.h

https://invent.kde.org/sdk/umbrello/commit/02d0a994cad70411ef0e000a2424289fa635f043