Although the development of implicit grammatical knowledge is highly desirable, not all grammatical constructions could be learned implicitly. Therefore, one of the ultimate objectives of most English as Foreign Language (EFL) classrooms is to aid learners in developing their (automatic) explicit grammatical knowledge. Using progressively complex tasks and task-supported instructional conditions is one efficient way to materialize this objective. The current study investigates the extent to which performing focused dictogloss tasks accompanied with explicit instruction (EI) affects EFL learners' explicit knowledge and automatized explicit knowledge of the past-counterfactual conditional structure. Sixty-seven upper-intermediate proficiency learners were assigned into four groups: task performance without any EI (Task- Only); prewriting EI (Pre-EI); prewriting EI also available during task enactment (Pre + online- EI); and post-writing EI with revision (Post-EI). Results indicated explicit knowledge gains for the Pre-EI and Pre + online-EI groups in the immediate and delayed posttests. However, no significant development appeared concerning the automatized explicit knowledge. Learners' task engagement and the discrepancies and correspondences between the learning outcomes and learners' and teachers' perceptions are further discussed. اگرچه یادگیری دانش دستوری به صورت ضمنی بسیار مطلوب است، اما همه ساختارهای دستوری را نمی توان به طور ضمنی یاد گرفت. بنابراین، یکی از اهداف نهایی کلاس های درس زبان انگلیسی به عنوان زبان خارجی کمک به زبان آموزان در توسعه دانش دستوری ضمنی آنها است. استفاده از فعالیت های به تدریج پیچیده و آموزشی که مبتنی بر انجام فعالیت به همراه توضیح صریح دستوری است از جمله راه های کارآمد برای تحقق این هدف است. مطالعه حاضر به بررسی این میپردازد که تا چه اندازه انجام فعالیت متمرکز نوشتاری (دیکتوگلاس) به همراه ارائه آموزش صریح بر دانش صریح و سپس ضمنی شدهِ ساختار شرطی زبانآموزان انگلیسی تأثیر میگذارد. شصت و هفت زبان آموز سطح متوسطه به چهار گروه تقسیم شدند: گروه اول که فعالیت را بدون هیچ آموزشی انجام داد، گروه دوم که قبل از انجام فعالیت آموزش صریح دریافت کرد، گروه سوم که قبل و هنگام انجام فعالیت به توضیحات دستوری دسترسی داشت و گروه چهارم که توضیحات را پس از فعالیت با امکان بازنگری در نوشتار خود دریافت کرد. نتایج نشانگر پیشرفت در دانش صریح گروه های دوم و سوم در پس آزمون های فوری و تاخیری بود. با این حال، هیچ کدام از گروه ها پیشرفت قابل توجهی در دانش ضمنی خود نشان ندادند. تحقیق حاضر همچنین به بحث در مورد اینکه زبان آموزان چقدر با اشتیاق به انجام فعالیت نوشتاری پرداختند و اینکه تا چه اندازه دیدگاه زبان آموزان و معلمان با نتایج به دست آمده از دانش صریح و ضمنی مطابقت یا مخالفت میکند، میپردازد. Scholars have been interested in how the use of authentic, meaning--focused tasks with or without the provision of explicit instruction (EI) affects second language learning. However, there are still concerns about when and how best to incorporate EI in a task-based lesson. Some advocates of task-based language teaching (TBLT) argue that EI is effective not before the performance of the task (Long, 1996) or during task phases, but only after the task is completed (Willis, 1996) in order not to change an opportunity for authentic communication into a predefined language exercise. Nevertheless, this proposal often seems to be counterintuitive for teachers, particularly those who are used to the present-practice-production (PPP) approach. In most Asian countries including Iran, modifications of TBLT often comprise EI at the pre-task stage because of learners' needs and other institutional requirements (Khezrlou, 2019; Nguyen, 2013). Hence, the purpose of the current study was to explore whether the timing of EI differentially impacted the learning of a complex grammatical structure as well as learners' task engagement. The results of this classroom-based study suggest that opportunities to focus on the target structure before and during writing had a significant add-on impact to learners' explicit knowledge without compromising task engagement. The findings also illuminate the role of EI and its timing in developing second language knowledge from the perspective of teachers and learners. This study, thus, contributes to teachers', teacher educators', policy makers', and practitioners' knowledge. Effective integration of EI particularly in English as a foreign language (EFL) classes to draw learners' attention to linguistic features in a context-bound way is suggested. [ABSTRACT FROM AUTHOR]