Replies: 6 comments 3 replies
-
|
Yeah, I thought a lot about a rule like this recently. But it gets more complicated the longer you think about it. the rule should then also be able to trace variables if they are passed by reference, that only works until the call path leaves the current extension. |
Beta Was this translation helpful? Give feedback.
-
|
Also some other restrictions apply if the Findx would be followed by a Modify, ...: For performance reasons, it's not recommended to use partial records on a record that will do inserts, deletes, renames, field transfers, or copies to temporary records. All these operations require that all fields on the record are loaded, so the platform will emit a JIT load if they're not already loaded. |
Beta Was this translation helpful? Give feedback.
-
|
Maybe we should start 'small' first and limit the scope of the warning to below usages?
This would at least show the occurrences where a record is fetched to only read data / get a field value. https://www.yammer.com/dynamicsnavdev/#/Threads/show?threadId=1033577983172608 |
Beta Was this translation helpful? Give feedback.
-
|
Has there been any Update to this Topic? In this post https://www.keytogoodcode.com/post/jit-loads-vs-full-record-load was shown that SetLoadFields is allways faster than working with the whole Table so the relevance for this rule is higher than ever. Greetings :) |
Beta Was this translation helpful? Give feedback.
-
|
I would like to suggest an addtional check for the LoadFields. Currently there are some places where Microsoft by default only loads partial records Currently there isn't a warning that reminds me to add we have e.g. some processing only reports that generates excel files. |
Beta Was this translation helpful? Give feedback.
-
|
Good news, this idea didn’t get lost and it’s been picked up and is now an implemented in ALCops. I've focused on the SetLoadFields, a. AddLoadFields will be another separate diagnostic. You can already try it out today in the current beta while we’re working towards the stable v0.7.0 release. Details on the new diagnostic is available here: https://alcops.dev/docs/analyzers/platformcop/pc0030/. Also, as noted on the front page of this repository: Important This repository is deprecated and will not receive any new updates for the foreseeable future. With that in mind, I’m go ahead and close this discussion here and we could continue the conversation over at: https://github.com/ALCops/Analyzers/discussions Thanks! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Currently the CodeCop warns you if you use a field which is not loaded in the current scope, but this warning only occurs if you have SetLoadFields in your code scope - if you don't have it in the scope, the warning doesn't show up / it doesn't get checked
Hint: If you change SetLoadFields with AddLoadFields the warning also doesn't show up - so the trigger seems to be SetLoadFields for this CodeCop rule
The idea:
Example for 2.:
It doesn't give you the warning in the method :/
Reason:
To make the performance of your solution / app better by using <Set|Add>LoadFields this rule would be a big help.
Greets
someC0d3r :)
Beta Was this translation helpful? Give feedback.
All reactions