You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you've added new public APIs and are getting build errors about missing API declarations, you'll need to update the PublicAPI files. You can generate the PublicAPI files manually by building a project with the `PublicApiType=Generate` property:
This approach will generate the `PublicAPI.Unshipped.txt` files for that specific project. You may need to run this for each project that has new public APIs.
86
+
87
+
**Note:** If you're still having troubles with PublicAPI errors, you can delete all the content in the relevant `PublicAPI.Unshipped.txt` files and then run the command above to regenerate them completely.
[Category(UITestCategories.Layout)] // or appropriate category
143
+
publicvoidTestMethodName()
144
+
{
145
+
App.WaitForElement("AutomationId");
146
+
App.Tap("AutomationId");
147
+
// Add assertions to verify expected behavior
148
+
}
149
+
}
150
+
```
151
+
152
+
**Before committing UI tests:**
153
+
- Compile both the HostApp project and TestCases.Shared.Tests project to ensure no build errors
154
+
- Verify AutomationId references match between XAML and test code
155
+
- Ensure tests follow the established naming and inheritance patterns
156
+
113
157
### Code Formatting
114
158
115
159
Before committing any changes, format the codebase using the following command to ensure consistent code style:
@@ -152,6 +196,27 @@ For compatibility with specific branches:
152
196
153
197
## Contribution Guidelines
154
198
199
+
### Handling Existing PRs for Assigned Issues
200
+
201
+
**🚨 CRITICAL REQUIREMENT: Always develop your own solution first, then compare with existing PRs.**
202
+
203
+
When working on an issue:
204
+
205
+
1.**FIRST: Develop your own solution** - Come up with your own implementation approach without looking at existing PRs. Analyze the issue, understand the requirements, and design your solution independently
206
+
2.**THEN: Search for existing PRs** - After you have developed your solution approach, search for open PRs that address the same issue using GitHub search or issue links
207
+
3.**Compare solutions thoroughly** - Examine the existing PR's proposed changes, implementation approach, and any discussion in comments. Compare this to your own solution
208
+
4.**Evaluate and choose the best approach** - Decide which solution (yours or the existing PR's) better addresses the issue and follows best practices
209
+
5.**Always document your decision** - In your PR description, always include a summary comparing your solution to any other open PRs for the issue you are working on, and explain why you chose your approach over the alternatives
210
+
6.**Report on why you didn't choose other solutions** - Always make sure to explain the specific reasons why you didn't go with other existing solutions, including any concerns or issues you identified
211
+
7.**It's OK to abandon existing PRs** - If you're not confident enough in the existing PR's approach, it's completely acceptable to abandon it and implement your own solution
212
+
8.**Pull existing changes when you prefer them** - If you determine the existing solution is better than your approach, pull those changes into your PR as the foundation for your work, then find areas to improve and add tests
213
+
9.**Identify improvement opportunities** - Whether you use your solution or an existing one, look for areas where you can enhance it, such as:
214
+
- Adding comprehensive test coverage
215
+
- Improving code quality, performance, or maintainability
216
+
- Enhancing error handling or edge case coverage
217
+
- Better documentation or code comments
218
+
- More robust implementation patterns
219
+
155
220
### Files to Never Commit
156
221
-**Never** check in changes to `cgmanifest.json` files
157
222
-**Never** check in changes to `templatestrings.json` files
@@ -163,6 +228,17 @@ Since coding agents function as both CI and pair programmers, they need to handl
163
228
-**Always reset changes to `cgmanifest.json` files** - These are generated during CI builds and should not be committed by coding agents
164
229
-**Always reset changes to `templatestrings.json` files** - These localization files are auto-generated and should not be committed by coding agents
165
230
231
+
### PublicAPI.Unshipped.txt File Management
232
+
When working with public API changes, proper handling of PublicAPI.Unshipped.txt files is critical:
233
+
234
+
-**Never turn off analyzers or set no warn** to fix PublicAPI.Unshipped.txt file issues
235
+
-**Always work to fix the PublicAPI.Unshipped.txt files properly** by adding the correct API entries
236
+
-**Use `dotnet format analyzers`** if having trouble fixing PublicAPI.Unshipped.txt file issues
237
+
-**Revert and re-add approach when files are incorrect:**
238
+
1. First, revert all changes to PublicAPI.Unshipped.txt files to their original state
239
+
2. Then, make only the necessary additions required for your new public APIs
240
+
3. This ensures clean, minimal changes that accurately reflect the new APIs being introduced
Copy file name to clipboardExpand all lines: docs/DevelopmentTips.md
+10Lines changed: 10 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,6 +21,16 @@ for IntelliSense and other tasks to initialize. If the project hasn't 'settled'
21
21
22
22
The below parameters can be used with the `dotnet cake` command in the root of your locally cloned .NET MAUI repository folder.
23
23
24
+
#### PublicAPI Management
25
+
`--target=publicapi`
26
+
- Clears and regenerates PublicAPI.Unshipped.txt files across all MAUI projects (Core, Controls, Essentials, Graphics)
27
+
- Use this when you've added new public APIs and are getting build errors about missing API declarations
28
+
- Automatically skips Windows-specific files when not running on Windows, and always skips Tizen files
29
+
30
+
```bash
31
+
dotnet cake --target=publicapi
32
+
```
33
+
24
34
#### Clean
25
35
`--clean`
26
36
- Occasionally, when switching branches or syncing with the main branch, incremental builds may stop working. A common fix for this is to use git clean -xdf to delete all locally cached build information. However, the issue with git clean -xdf is that it will also wipe out any uncommitted changes. Using --clean to recursively delete the local obj/bin folders should hopefully resolve the issue while preserving your changes.
0 commit comments