I just ran a test using the Revit 2023 API and I can confirm this behavior.
Test 1: created a new material programmatically with thisMaterial.UseRenderAppearanceForShading = False
result as expected (direct control of shading color):

Test 2: created a new material programmatically with thisMaterial.UseRenderAppearanceForShading = False,
then manually checked the box in the UI. The resulting color and transparency values were generated as usual when creating a material in the UI (the shading color being derived by a combination of the color and bitmap properties that are set in the Appearance Asset):

Test 3: created a new material programmatically with thisMaterial.UseRenderAppearanceForShading = True
The resulting color was different than that generated in test 2 (even though all properties of the Appearance Asset were identical):

Test 4: Duplicated the material created in test 3 in the UI, using the same Appearance Asset as the test 3 material:
The result was the same as test 3. Unchecked the Use Render... in the UI. Hit apply. changed the Shading color. hit apply. checked Use Render... and: the color reverted to the unexpected color in Material 3 (expected result was the resulting color in Material 2).
Test 5: Duplicated Material 1 in the UI, using the same Appearance Asset as Material 1. Checked Use Render... and the result was the same as Test 2 (the expected derived color).
Test 6: Changed the Appearance Asset in Material 3 to use the one created in test 2. The derived Shading color was the same as in Test 2 (the expected derived color).
Continued changing Appearance Assets in the different test materials between those created programmatically as well as manually duplicating those Appearance Assets and assigning them using the UI.
As a final test, I moved the setting of the material properties to later in the code (after the creation of the Appearance Asset) and...
bingo!!! we have a winner. Everything started acting as it should act.
The final result and conclusion: The bug comes in the form of an Appearance Asset that is created programmatically after the Use Render Appearance value is enabled programmatically in the Material itself. This specific combination sets the derived color value to an unexpected value that somehow becomes cached in the Appearance asset.
@khanh_phamWU8FK,
Try creating and assigning the Appearance Asset before setting the Use Render... property on the material.
-G
Gary J. Orr
GaryOrrMBI (MBI Companies 2014-Current)
aka (past user names):
Gary_J_Orr (GOMO Stuff 2008-2014);
OrrG (Forum Studio 2005-2008);
Gary J. Orr (LHB Inc 2002-2005);
Orr, Gary J. (Gossen Livingston 1997-2002)