Patient description: The patient is a 37-year-old woman who came to the clinic for a routine Pap smear. The test revealed stage 1B of cervical cancer. The patient tested positive for HPV 16. She has three sexual partners and four children. She underwent tubal ligation. She smokes 30 packs/year and drinks alcohol frequently. She is otherwise healthy. She was offered a radical hysterectomy.

Clinical trial eligibility criteria: eligible ages (years): 18.0-999.0,  Anatomic Stage III Breast Cancer AJCC v8 Anatomic Stage IIIA Breast Cancer AJCC v8 Anatomic Stage IIIB Breast Cancer AJCC v8 Anatomic Stage IIIC Breast Cancer AJCC v8 Anatomic Stage IV Breast Cancer AJCC v8 BRCA-Mutated Malignant Neoplasm BRCA-Mutated Metastatic Breast Carcinoma BRCA-Mutated Ovarian Carcinoma Metastatic Breast Carcinoma Metastatic Fallopian Tube Carcinoma Metastatic Malignant Solid Neoplasm Metastatic Ovarian Carcinoma Metastatic Pancreatic Carcinoma Metastatic Primary Peritoneal Carcinoma Prognostic Stage III Breast Cancer AJCC v8 Prognostic Stage IIIA Breast Cancer AJCC v8 Prognostic Stage IIIB Breast Cancer AJCC v8 Prognostic Stage IIIC Breast Cancer AJCC v8 Prognostic Stage IV Breast Cancer AJCC v8 Stage III Fallopian Tube Cancer AJCC v8 Stage III Ovarian Cancer AJCC v8 Stage III Pancreatic Cancer AJCC v8 Stage III Primary Peritoneal Cancer AJCC v8 Stage IIIA Fallopian Tube Cancer AJCC v8 Stage IIIA Ovarian Cancer AJCC v8 Stage IIIA Primary Peritoneal Cancer AJCC v8 Stage IIIA1 Fallopian Tube Cancer AJCC v8 Stage IIIA1 Ovarian Cancer AJCC v8 Stage IIIA2 Fallopian Tube Cancer AJCC v8 Stage IIIA2 Ovarian Cancer AJCC v8 Stage IIIB Fallopian Tube Cancer AJCC v8 Stage IIIB Ovarian Cancer AJCC v8 Stage IIIB Primary Peritoneal Cancer AJCC v8 Stage IIIC Fallopian Tube Cancer AJCC v8 Stage IIIC Ovarian Cancer AJCC v8 Stage IIIC Primary Peritoneal Cancer AJCC v8 Stage IV Fallopian Tube Cancer AJCC v8 Stage IV Ovarian Cancer AJCC v8 Stage IV Pancreatic Cancer AJCC v8 Stage IV Primary Peritoneal Cancer AJCC v8 Stage IVA Fallopian Tube Cancer AJCC v8 Stage IVA Ovarian Cancer AJCC v8 Stage IVA Primary Peritoneal Cancer AJCC v8 Stage IVB Fallopian Tube Cancer AJCC v8 Stage IVB Ovarian Cancer AJCC v8 Stage IVB Primary Peritoneal Cancer AJCC v8 Unresectable Breast Carcinoma Unresectable Fallopian Tube Carcinoma Unresectable Malignant Solid Neoplasm Unresectable Ovarian Carcinoma Unresectable Pancreatic Carcinoma Unresectable Primary Peritoneal Carcinoma Participant must have breast, pancreas, ovary, fallopian tube or primary peritoneal cancer that is unresectable or metastatic, with a pathogenic mutation in BRCA1 or BRCA2 (either germline or somatic) as confirmed by next generation gene sequencing such as University of Washington (UW) OncoPlex assay or equivalent, and who have experienced progression or been intolerant to standard therapies for their disease Breast cancer patients with or without HER2+, estrogen receptor (ER)+, and/or progesterone receptor (PR)+ disease, as determined by pathological report, are allowed Participant must be able and willing to undergo pre-treatment and on-treatment biopsy Participant must have life expectancy of 4 months or greater Tumor must be measurable according to Response Evaluation in Solid Tumors (RECIST)1.1 Participant must have an Eastern Cooperative Oncology Group (ECOG) performance status of =< 1 Participant must be >= 18 years of age Patient must be able to tolerate oral medication Absolute neutrophil count >= 1,500/uL Platelets >= 100,000/uL  Participant must not be simultaneously enrolled in any interventional clinical trial Participant must not have had major surgery =< 3 weeks prior to initiating protocol therapy and participant must have recovered from any surgical effects Prior treatment with both PARP inhibitor and immune checkpoint inhibitor blockade either sequentially or together including inhibitors of PD1, PD-L1 or CTLA4 is not allowed. Patients may have had either PARP inhibitor or Immune checkpoint inhibitor previously but not within 3 months of starting treatment Participant must not have received investigational therapy =< 4 weeks, or within a time interval less than at least 5 half-lives of the investigational agent, whichever is shorter, prior initiating protocol therapy Participant must not have had radiation therapy encompassing > 20% of the bone marrow within 2 weeks; or any radiation therapy within 1 week prior to day 1 of protocol therapy Participant must not have a known hypersensitivity to niraparib and dostarlimab (TSR-042) components or excipients Participant must not have received a transfusion (platelets or red blood cells) =< 4 weeks prior to initiating protocol therapy Participant must not have received colony stimulating factors (e.g., granulocyte colony-stimulating factor, granulocyte macrophage colony stimulating factor, or recombinant erythropoietin) within 4 weeks prior initiating protocol therapy Participant has had any known grade 3 or 4 anemia, neutropenia or thrombocytopenia due to prior chemotherapy that persisted > 4 weeks and was related to the most recent treatment Participant must not have any known history of myelodysplastic syndrome (MDS) or acute myeloid leukemia (AML)